Hi, to get the "Amount" for the selected customer and date period from the "Cust. Ledger Entry" table using the following code. But to show the output it is taking long time if there are lot of records for the customer. To speed up what the change need to do.
==========================================
RVCusLedger.RESET;
RVCusLedger.SETCURRENTKEY("Customer No.","Posting Date","Currency Code");
RVCusLedger.SETRANGE("Customer No.","No.");
RVCusLedger.SETRANGE("Posting Date",0D,DTOB-1);
IF RVCusLedger.FINDFIRST THEN
REPEAT
RVCusLedger.CALCFIELDS("Amount (LCY)",Amount);
DVOBLCY := DVOBLCY + RVCusLedger."Amount (LCY)";
UNTIL RVCusLedger.NEXT = 0;
==========================================
0
Comments
For faster outputs try to integrate the same with SQL procedure.
For faster outputs try to integrate the same with SQL procedure.
You could use the "Net Change" field on the customer
your code will look like this
Hope this helps.
mCustomer.RESET;
mCustomer.GET("No.");
mCustomer.SETRANGE("Date filter",0D,DTOB-1);
mCustomer.CALCFIELDS("Net Change (LCY)");
DVOBLCY := mCustomer."Net Change (LCY)";