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.
Author |
Topic |
rizwan.haider
Starting Member
1 Post |
Posted - 2014-03-23 : 04:04:47
|
I have created a report (for sales Order as well as Purchase Order) which contain a lot of fields from many different tables. Every field has an expression in order to get the correct values in front of sales/purchase order e.g:iif(isNothing(Fields!VendorInvoiceAmount.Value), Fields!CustomerInvoiceAmount.Value, Fields!VendorInvoiceAmount.Value)The problem is if a vendor/customer have 2 different Invoices and different types of tax are applied on them.I have the following table (just 3-4 fields to make you understand).SourceInvoiceNo ---- InvoiceAmount ------ SalesTaxAmount ------ TotalINV-000001 ----- - ----- 1000 ----- - ------- 200 ------ - -------- 1200INV-000002 ----- - ----- 2000 ----- - ------- 100 ------ - -------- 2300INV-000002 ----- - ----- 2000 ----- - ------- 200 ------ - -------- 2300AP-0001 -------- - ------ 3000 ----- - ------- 100 ------ ---- ----- 3100GRAND TOTAL-------------------------------------------------------8600Like in INV-000002 on the same invoice amount 2 different type of taxes are applied.the total should be 2000+100+200 = 2300. but here grand total is creating the problem.i tried to solve this but putting this expression in Total.Iif(Fields!SourceInvoiceNo.value = Previous(Fields!SourceInvoiceNo.value), 0 , iif(isNothing(Fields!VendorInvoiceAmount.Value), (Fields!CustomerInvoiceAmount.Value + Fields!SourceRegulateAmount), (Fields!VendorInvoiceAmount.Value + Fields!SourceRegulateAmount))Note: Source Regulate Amount is Sales Tax Amount.this gives the following output (which i wanted) but grand total is still the same.SourceInvoiceNo --- InvoiceAmount ------- SalesTaxAmount ----- TotalINV-000001 ----- - ----- 1000 ----- - ------- 200 ------ - -------- 1200INV-000002 ----- - ----- 2000 ----- - ------- 100 ------ - -------- 2300INV-000002 ----- - ----- 2000 ----- - ------- 200 ------ - -------- 0AP-0001 -------- - ------ 3000 ----- - ------- 100 ------ ---- ----- 3100GRAND TOTAL-------------------------------------------------------8600Grand total should be 6600.In grand total i have this expression.iif(isNothing(Fields!VendorInvoiceAmount.Value), (Fields!CustomerInvoiceAmount.Value + Fields!SourceRegulateAmount), (Fields!VendorInvoiceAmount.Value + Fields!SourceRegulateAmount)) |
|
|
|
|