Party Billno amount
Celv 1 5000
Raj 2 10000
Mani 3 15000
Going to pay for the bill no 1 as rs 10000 need to reduce for 1st bill and need to reduce for the 2 nd bill as 5000
Loading

Riddhi ValechaPosted Apr 12, 2015, 7:21 AM
Is it that the company will pay a certain amount of bill for some people ??
Or Company will pay certain amount for all ??
Then...I agree with Tom Mohan. His logic should work out....
Santhakumar MunuswamyPosted Apr 11, 2015, 11:05 AM
Hi Selvi Subramaniam,
I have understood the logic as following
First, the company is going to pay amount rs 10,000 for the Billno 1 but bill amount rs. 5,000. then the balance amount as credit rs 5000. After, the company is going to pay amount rs 5,000 for the Billno 2 but bill amount rs. 10,000 then automatically calculated balance amount + pay amount on billno 2. - this right means ( I have one Question)
1. How you want calculate bill (1 & 2) amount in the different persons?
If you want above logic proceed you can add more columns in your table as below
Party
BillNo
Bill Amount
Balance Amount
Total Paid Amt
Celv
1
5000
5000
10000
Raj
2
10000
5000
Mani
3
15000
0
0
Ex. Sql query logic
If @BalanceAmount > 0
begin
@TotalPaidAmount=@BillAmount;
end
else
begin
@TotalPaidAmount=@BillAmount+@BalanceAmount;
end
Pls "Mark Answer" if you have helpful. Advance Thanks
Tom MohanPosted Apr 11, 2015, 8:40 AM
Decimal payment = 10000;
if you are using asp.net girdview. loop it
foreach (GridViewRow row in grid.Rows) {
if payment > 0
{
decimal newpayment = payment - row[amount]
row[amount] = row[amount] - payment
payment = newpayment;
}
}
Take this as a pseudocode. Take the logic only
Khargesh RajputPosted Apr 11, 2015, 7:38 AM
you can set
if billno=2
then amount=5000
selvi subramanianPosted Apr 11, 2015, 7:23 AM
Khargesh RajputPosted Apr 11, 2015, 6:42 AM
you want to change
5000 as 10000
and 10000 as 5000
execute update query
update tablname set amount=10000 where billno=1
update tablname set amount=5000 where billno=2