About the Calcsums
njaiku
Member Posts: 116
Hi everybody,
I have a doubt regarding calcsums. Suppose there are two tables
a) Contract
b) Contract Ledger Entry
Contract Ledger Entry fields are Entry No,Contract No,Subtype,Debit Amount,Credit Amount,Amount
There is a Subtype option field in the Contract Ledger Entry
options string are : ,Invoice Value,Initial Amount,Amount Financed,Finance Charges,DMA Payment,Subvention,Security Deposit,Processing Fee,Insurance,Installment,AFC,Repossession,Garage Rent,Others,Loan,Memorandum,FC Rebate,Contingency,Tyre Advance,Tyre Interest,Oil Advance,Oil Interest,TDS,AFC Rebate
In the report i have to get the total for the debit Amount once if the option is Insurance,it must total and show it in the single line
ex: Contract No Subtype Debit Amount
12345 Insurance 2000
12345 Insurance 2000
12345 Insurance 2000
Now I have to show the report like this:
ex: Contract No Subtype Debit Amount
12345 Insurance 6000
so i have written the coding in Onpredataitem of the report
I have created the variable as recContractLedger (Datatype Record)
reccontractLedger.setrange("No","No");
reccontractLedger.setrange("Subtype","Subtype"::Insurance);
if reccontractLedger.find('-') then
begin
reccontractLedger.setcurrentkey("Contract No","Subtype");
reccontract.calcsums("Debit Amount");
(created one variable decDebit)
decDebit := reccontract. "Debit Amount";
end;
So please anyone help me out
I have a doubt regarding calcsums. Suppose there are two tables
a) Contract
b) Contract Ledger Entry
Contract Ledger Entry fields are Entry No,Contract No,Subtype,Debit Amount,Credit Amount,Amount
There is a Subtype option field in the Contract Ledger Entry
options string are : ,Invoice Value,Initial Amount,Amount Financed,Finance Charges,DMA Payment,Subvention,Security Deposit,Processing Fee,Insurance,Installment,AFC,Repossession,Garage Rent,Others,Loan,Memorandum,FC Rebate,Contingency,Tyre Advance,Tyre Interest,Oil Advance,Oil Interest,TDS,AFC Rebate
In the report i have to get the total for the debit Amount once if the option is Insurance,it must total and show it in the single line
ex: Contract No Subtype Debit Amount
12345 Insurance 2000
12345 Insurance 2000
12345 Insurance 2000
Now I have to show the report like this:
ex: Contract No Subtype Debit Amount
12345 Insurance 6000
so i have written the coding in Onpredataitem of the report
I have created the variable as recContractLedger (Datatype Record)
reccontractLedger.setrange("No","No");
reccontractLedger.setrange("Subtype","Subtype"::Insurance);
if reccontractLedger.find('-') then
begin
reccontractLedger.setcurrentkey("Contract No","Subtype");
reccontract.calcsums("Debit Amount");
(created one variable decDebit)
decDebit := reccontract. "Debit Amount";
end;
So please anyone help me out
Jai
0
Comments
-
on contractledger entry you have to have a key for
contract no, subtype, and sumindex for "Debit Amount".
Now in your code you do this.
reccontractLedger.setrange("No","No");
reccontractLedger.setrange("Subtype","Subtype"::Insurance);
reccontractLedger.calcsums("Debit Amount");
(created one variable decDebit)
decDebit := reccontractLedger."Debit Amount";
end;0 -
Hi,
Thank you very much, it's working fine.Suppose there are so many options in the subtype,if i want to calculate for Amount financed,Finance charges...... Can i be able to use the CASE Statement
recContractLedgEntry.COPY("Contract Ledger Entry");
recContractLedgEntry.SETRANGE(" Contract No."," Contract No." );
recContractLedgEntry.SETRANGE("Sub Type","Sub Type");
case "subtype" of:
"subtype" :: Finance charges
begin
recContractLedgEntry.CALCSUMS("Debit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Credit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Amount (LCY)");
decDebit := recContractLedgEntry."Debit Amount (LCY)";
decCredit := recContractLedgEntry."Credit Amount (LCY)";
decAmount := recContractLedgEntry."Amount (LCY)";
end
"subtype" :: Amount Financed
begin
recContractLedgEntry.CALCSUMS("Debit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Credit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Amount (LCY)");
decDebit := recContractLedgEntry."Debit Amount (LCY)";
decCredit := recContractLedgEntry."Credit Amount (LCY)";
decAmount := recContractLedgEntry."Amount (LCY)";
end;
If i begin to code for the other options, I tried this. It's not working.
Please help me outJai0 -
You need to create different variables for each sub type. Or create an array
recContractLedgEntry.COPY("Contract Ledger Entry");
recContractLedgEntry.SETRANGE(" Contract No."," Contract No." );
recContractLedgEntry.SETRANGE("Sub Type","Sub Type");
recContractLedgEntry.CALCSUMS("Debit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Credit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Amount (LCY)");
case "subtype" of:
"subtype" :: Finance charges
begin
FinChrgdecDebit := recContractLedgEntry."Debit Amount (LCY)";
FinChrgdecCredit := recContractLedgEntry."Credit Amount (LCY)";
FinChrgdecAmount := recContractLedgEntry."Amount (LCY)";
end
"subtype" :: Amount Financed
begin
AmtFindecDebit := recContractLedgEntry."Debit Amount (LCY)";
AmtFindecCredit := recContractLedgEntry."Credit Amount (LCY)";
AmtFindecAmount := recContractLedgEntry."Amount (LCY)";
end;
to create an array
recContractLedgEntry.COPY("Contract Ledger Entry");
recContractLedgEntry.SETRANGE(" Contract No."," Contract No." );
recContractLedgEntry.SETRANGE("Sub Type","Sub Type");
recContractLedgEntry.CALCSUMS("Debit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Credit Amount (LCY)");
recContractLedgEntry.CALCSUMS("Amount (LCY)");
case "subtype" of:
"subtype" :: Finance charges
begin
decDebit[1] := recContractLedgEntry."Debit Amount (LCY)";
decDebit[2] := recContractLedgEntry."Credit Amount (LCY)";
decDebit[1] := recContractLedgEntry."Amount (LCY)";
end
"subtype" :: Amount Financed
begin
decDebit[2] := recContractLedgEntry."Debit Amount (LCY)";
decDebit[2] := recContractLedgEntry."Credit Amount (LCY)";
decDebit[2] := recContractLedgEntry."Amount (LCY)";
end;0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
