[Q] Query for outstanding payment per month
I have data like this:
Bill: $100
In January, I paid $50
In Febuary, I paid $30
In March, I paid $20
I used 2 tables (table A and table B)
Table A used to save total amount of the bill. Table B used to save how much I paid the bills. Table A Primary Key is the Foreign Key for Table B.
I need to make a report like this:
In January the report will be:
Bill: $100
Payment1: $50
In Febuary:
Bill: $100
Payment1: $50
Payment2: $30
In March:
Bill: $100
Payment1: $50
Payment2: $30
Payment3: $20
In May it won't appear because it already paid in March.
This is my Query:
SELECT A.BILL, A.BILL_DATE, B.PAYMENT, B.PAYMENT_DATE
FROM TABLE_A AS A
LEFT JOIN TABLE_B AS B ON A.BILL_NO = B.BILL_NO
WHERE MONTH(A.BILL_DATE) <= @PERIOD_MONTH AND YEAR(A.BILL_DATE) = @PERIOD_YEAR
Thanks for answering, but I just tried and I don't think its the result.
This is my table structure:
CREATE TABLE BILL
BILL_ID INT INDENTITY NOTNULL
BILL_DATE DATETIME
BILL_AMOUNT NUMERIC(10,2)
BILL_BALANCE NUMERIC(10,2)
CREATE TABLE PAYMENT
PAYMENT_ID INT IDENTITY NOTNULL
BILL_ID INT
PAYMENT_DATE DATETIME
PAYMENT_AMOUNT NUMERIC(10,2)
)INSERT INTO @BILL VALUES(1,'2014-01-01',100,0)PAYMENT 1INSERT INTO @PAYMENT VALUES(1,1,'2014-01-02',50)
UPDATE BILL SET BILL_BALANCE = BILL_BALANCE + 50 WHERE BILL_ID = 1PAYMENT 2INSERT INTO @PAYMENT VALUES(1,1,'2014-02-01',30)
UPDATE BILL SET BILL_BALANCE = BILL_BALANCE + 30 WHERE BILL_ID = 1
Everytime I paid, BILL_BALANCE = BILL_BALANCE + PAYMENT_AMOUNT
In january:
BILL_AMOUNT = $100
BILL_BALANCE = $50
In Feb:
BILL_BALANCE = $80 etc.
at first I have 11 Payment data, after I'm using cross join, it become 780 data.
Similar Messages
-
I now have photoshop in cloud for $9.99 per month.
I now have photoshop in cloud for $9.99 per month. I would prefer Illustrator. Can i cancel or exchange one for the other or is their a package of the two. I already have elements for editing photos
AL_N_C wrote:
With PE I can edit videos, do I have the same ability to edit videos in Photoshop CC & Lightroom for 9.99 per month?
The photographers "special" of Lightroom and Photoshop includes little for videographers. You can rent Premier Pro for an additional $20 a month, buy Premier Elements or live with the limited video capability of Lightroom.
As most users of any recent camera have a video button, it disappoints me that Adobe can't somehow accommodate the amateurs with some sort of limited access to Premier in their "special" price program. -
Speed Upgrade Advertised For $5 More Per Month Can't Get Any Answers
On Verizon's website is a speed upgrade to 75/75 for just $5 per month more. When I click on the button to order it it comes up as $10 per month more.On Verizon's Facebook page I posted this 3 times and each time my post was answered quickly and I was told they would look into it and get back to me. No one ever got back to me. The offer is on Verizon's website when I am logged in,
http://www.verizon.com/home/MLP/quantum75.html?X1=FQU512&CMP=DMC-CVD_ZZ_FD_E_DM_N_X00015I can speak from experience on this as I ran into the same situation a couple months ago. A rep. even tried to get me the $5 offer to no success. He could only get it to reflect $10 more. He said something goes on with the system that causes these pricing errors (yet Verizon never fixes them). I was told to wait a week and check the offer again once the system gets updated. I waited a week, checked again and was able to get the offer. My suggestion is to do the same. Wait a week and check again or keep checking daily.
-
Hi Guys,
I written a query for incoming payments for some particular account heads and i have tried this.
But did not achieved the desired result.
Anybody please modify the query.
SELECT T1.[DocNum], T0.DocNum, T0.AcctCode, T0.SumApplied, T0.AcctName ,
(Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='355102'),
(Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='211417'),
(Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='355103'),
(Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='211436')
FROM RCT4 T0
Left outer JOIN ORCT T1 ON T0.DocNum = T1.DocEntry INNER JOIN NNM1 T2 ON T1.Series = T2.Series
WHERE T2.[SeriesName] ='Spares' and t1.docdate between [%0] and [%1]
Regards,
VamsiHi Vamsi,
Try this:
SELECT T1.DocNum, T0.DocNum,
(Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='355102') AS '355102',
(Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='211417') AS '211417',
(Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='355103') AS '355103',
(Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='211436') AS '211436'
FROM RCT4 T0
INNER JOIN ORCT T1 ON T0.docnum = T1.DocEntry
INNER JOIN NNM1 T2 ON T1.Series = T2.Series
WHERE T2.SeriesName ='Spares' and t1.docdate between [%0\] and [%1\]
Thanks,
Gordon -
I recently signed up for $10.00 per month (Special included Lightroom and Adobe CC) I have continuous tried to download this and I have an Order # but it will not download Why???
What is "it" exactly? Lightroom? The Creative Cloud management App?
-
How do I sign up to join Adobe's Photoshop Photography Program for $9.99 per month, giving you access to Photoshop CC, Lightroom, Behance ProSite, and 20GB of cloud storage.
Cancel old and buy new is the only way I know, but you MAY be able to exchange
Return, cancel, or exchange an Adobe order -
I just bought the creative cloud. For 20 euros per month, and when I downloaded Illustrator it tells me that the trial has expired and gives me the option to buy. Why?
Hi Florencia33,
Please check if you are signed into the Creative cloud with the correct email ID under which you have subscribed.
Please refer to the steps as mentioned in the help document:
Sign out, Sign in | Creative Cloud Desktop app
Regards,
Sheena -
I want to buy the special complete for 49.99 per month. if I buy this, how many computers I can install since I have two computers?
only one computer or two? Please let me know.Cloud License allows 2 activations http://www.adobe.com/legal/licenses-terms.html
-Install on a 2nd computer http://forums.adobe.com/thread/1452292?tstart=0
-Windows or Mac does not matter... 2 on the same operating system, or 1 on each -
Query for Vendor Payment in SAP
Hello All,
I am a sap abap developer with little knowledge in SAP MM and SAP FI modules.
As per some requirement of my company ,i have created a PO then its GR and finally IR.
Now when i checked EKBE table (History per Purchasing Document) , i found two record in this table out of which one with
VGABE = 1 (Good Receipt) & another with VGABE = 2 (Invoice Receipt) .
Now my requirement is ,i want a entry in this table with VGABE = 5 (Payment) but i don't know how to do payment of vendor in sap so that this table will populate with a entry for payment type.
Please help me and let me know what will be the flow with tcodes to do the vendor payment in sap.
Please reply ASAP.
Thanks in advance.
Regards.
Abhinav Goel.Hello Mr.Raman,
Thanks for your response to my query.
As per my company requirement i have to track duplicate payment made to the vendor against same PO.
So for that after completing the cycle PR-PO-GR-IR-F-53 finally i found two records in BSAK table out of which :
One record was with my accounting document no from my invoice receipt of type RE.
Another record was with the vendor payment clearance document with type KZ.
Now again i have done payment to the vendor using F-53 tcode and now i found one more record with belnr = last payment document no and augbl = new payment document no. with type KZ.
So if i use below mentioned logic to track for duplicate payments made to the vendor ,then it will be fine or if not can you suggests me the needful changes in the logic.
1.) Check If record exists for my belnr no from invoice recipt in bsak.
2.) Take AUGBL No for this BELNR No and check if record exists for this AUGBL with type KZ.
Note:Means payment is done to the vendor upto this logic.
3.) Now if with the found record with type KZ any other record found with type KZ it can be taken of as duplicate payment made to the vendor.
Please suggest me if above mentioned logic is fine.
Regards.
Abhinav Goel. -
Help with Sql for Annual Report per month
Hi, I have been given the task to create an annual report by month that would show company's profits per month and totals in the last column to show which branch had the hightest income.
Branch||January||February||March||April||May||June....||Total||
ABC ||$0.00 ||$0.00 ||$0.00||$0.00||$0.00||$0.00||Total Amt||
DEF ||$18.01 ||$3.88 ||$18.01||$4.12||$18.01||$3.97||Total Amt||
Can anyone please help me in giving an idea of how to write sql for this report..? I am building sub-queries for everymonth by giving the dates for Jan/Feb/March..but I think this is not the right way to do this....
SELECT
sum(a.commission) December,
sum(b.commission) November
FROM
Select
c.account_id,
c.officer,
c.account_product_class_id,
sum(c.dp_monthly_premium) Commission
From
contract c
Where
c.account_id=109 and
c.status='APPROVED' and
c.protection_effective between '01-DEC-2009' and '31-DEC-2009'
Group by
c.account_id,
c.officer,
c.account_product_class_id
) a,
Select
c.account_id,
c.officer,
c.account_product_class_id,
sum(c.dp_monthly_premium) Commission
From
contract c
Where
c.account_id=109 and
c.status='APPROVED' and
c.protection_effective between '01-NOV-2009' and '30-NOV-2009'
Group by
c.account_id,
c.officer,
c.account_product_class_id
) b
I always have hight hope from this forum. So please help. Thanks in advance.
Edited by: Aditi_Seth on Jan 26, 2010 2:29 PMYou may try a group report on one simple query like:
Select
c.account_id, c.officer, to_char(c.protection_effective, 'MM') month
sum(c.dp_monthly_premium) Commission
From
contract c
Where
c.status='APPROVED' and .....
Group by
c.account_id
c.officer,
to_char(c.protection_effective, 'MM')
break/gropu on account_id, c.officer, to_char(c.protection_effective, 'MM') and total will be automatically calculated by Reports. -
Workaround for 1 invoice per month
Hi There,
Is there anybodywho could suggest me how to implement if a customer wants 1 invoice per month??
But the separate deliveries over the whole month. And auto create 1 invoice at the end of the month with the document generation wizard.
thanks MarkHi Mark,
Go to Sales -A/R->Document Generation Wizard and set your target document and according all data.
The document generation wizard lets you save the defined parameter set. First, you enter and save numerous parameters for base and target documents. Based on these definitions, you can select consolidation methods and choose a list of relevant business partners.
Once you save the defined parameter set, you can run the wizard periodically according to your companyu2019s business practices.
Thanks
Sachin -
Approval Query for Outgoing Payment
Hi All Experts,
I have to Create Approval for Outgoing Payment where payment means is Cash,Cheque or Bank Transfer but not Credit Card.
In other words approval should be raised for all payment means other than Credit card payment means.
For which I have Created Query as follows
select Distinct 'true' FROM dbo.OVPM T0
Left join dbo.VPM3 T1 on T0.DocEntry=T1.Docnum
WHERE T0.CreditSum=0 And T1.CreditAcct is null
payments goes for approval but Credit Card payment also goes for Approval which is not required.
Please Help me to Correct the Query.
Regards,
Gayatri Shukla.Hi,
Little modification to your query. Try this.
select Distinct 'true' FROM dbo.OVPM T0
Left join dbo.VPM3 T1 on T0.DocEntry=T1.Docnum
WHERE T0.CreditSum = 0
Regards,
Amrut Sabnis. -
How to pay for iCloud not per month but per year
Is there a way I can pay iCloud storage once a year instead of per month. If so, how?
Many thanks for your attention
MarkUnless you're currently on a yearly plan, no. Apple no longer offers them to new subscribers.
(126392) -
Query for allowed payment methods of BP
Hi there,
i would like to make a query where i get all allowed paymentmethods of a BP. Unfortunatly i do not know in which table i can find this information. The query for checking the standard paymentmethod is quite easy but i do not know in which table i get the information of the allowed (checked) paymentmethods.
thx for your help.
best regards
ManuelAnother question: is there an easy way to update all BP (so that it is allowed) with a paymentmethod without using DTW?
If I try it with an update query i think it is not the right way because it is not really an update of an existing record it's adding a new allowed paymentmethod.
br
Manuel -
Dears,
I am a staff from the American University of Iraq, Sulaimani and we are planning to run a course using adobe creative clouds, therefore my question is how many computers would the special offer students and teachers for $19.99 a month cover?
It's very confusing and some clarification would be highly appreciative.
Shad RashedYes. That offer is aimed at individuals.
If you're looking to subscribe for the department or class then try
Creative Cloud for enterprise | Educational institutions
Maybe you are looking for
-
How to connect steps in business scenario
Hello, After creating a project in Solution Manager, creating a business scenario in that project and creating a custom business process in my scenario, Iu2019ve defined the necessary steps that I want in my process. These steps involve 2 different l
-
Hi I want to get a list of all the files from a specified directory. I found these two function modules. But i am not able to run these, I am not getting how to pass the Dir name to these FM's? please help me on this.
-
Reconciliation between uninvoiced receipt and Trial balance
hello, i can't reconcil between URR AND TR.i have a big diffrence amount in account accruel. the setup is at receip for the both expence and good. what should the paramater that i put and the right time to URR. or is there another parameter that i ha
-
How to extract email address from Outlook friendly name cache
Hi guys, A while ago, somebody wrote a little VBA utility to help us to log CRM events. Whenever a user sends an email to a customer, it logs the fact in our CRM database. This is the programmatic process: 1. Grab the email address from ActiveInspect
-
db11gxe , apex 4.0 , firefox 24 , hi all , i have a master detail page , with an item "test_id" as a select list , and a detail region has also a column "test_id" , what i want is : when i change the value of the master "test_id" , the data is retrie