Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Update query statement

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-05-10 : 15:58:17
Is it possible to write an update statement:

for invoice's and payments.

i have an invoice, it has 3 lines items in it.

invoice total is $1000 - payments total is $ 900

----Invtotal$1000-------------Paymentmade$900------------
lineitem1 amount: $500---------$500
lineitem2 amount: $300---------$300
lineitem3 amount: $200---------$100 not enough money left to pay

**********************same above example ************
invoice total is $1000.

Now making payments against this invoice, if the payment amount is less than $1000.

in that case i want to auto pay line by line.

for first lineitem payment: $500 (paid from $900 and left $400)
second lineitem payment: $300 (paid from $400 which is left, now only $100 left.)

third line item i only have left $100. i make $100 payment.

Please is it possible via queries to loop and validate if the payment
Yhank you very much for the helpful info.

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-05-11 : 02:15:27
This idea is on paper...

What is table structure for this...???
InvTotal and Paymentmade is being passed to procedure or what??


Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page
   

- Advertisement -