customer old balance and new balance

hello to everyone… i am new consultant in navision. i am trying to make an sale invoice report. In my country (Greece) is necessary in the sales invoices to print the old balance of the customer and the new balance after the invoice posting. can you provide me with any info how to make it. 1) I make a first try puting the balance(LCY) from customer table (I PUT AS A DATA ITEM THE CUSTOMER TABLE) BUT when i run the report shows zero. 2) i know for the new balance i have to make a formula (BALANCE(LCY) - iNVOICE AMOUNT) but i do not know the way to do it. thanks in advance for any reply george[:D]

Hi, You couldn’t get the Balance (LCY) field value printed because it’s a flowfield. A flowfield doesn’t store value, but formula from which the value is derived. You can see the formula in the field’s CalcFormula property. In order to obtain the value of a flowfield you need to use CALCFIELDS() function. In the Customer - AfterGetRecord() trigger, add the following code: Customer.CALCFIELDS(“Balance (LCY)”); You should be able to see the figure in your report. Regards, Hadi Lai

dear hadi lai, thanks for your reply. i put the customer table as dataitem in the report (after the vat counter dataitem) i put your code in the trigger of the customer but still i get 0 also the field in the report has source experesion cust.balance (lcy) but nothing. do you have any clue? about the old balance i have to make a formula balance(lcy) - invoice amount??? do you thing i have to use calcfield function? thanks george

Hi, I tried the implementation and it works just fine. I wonder why you prefer an ‘expensive’ data item than simply a record variable just to get the Balance of the customer. Chances are that you implemented CALCFIELDS on the wrong Customer variable. Is your invoice customized from the standard navision Sales - Invoice (Report 206)? A global record variable Cust of subtype Customer is defined in this report. If you have taken the following actions: . Implement Customer.CALCFIELDS(“Balance (LCY)”); statement . Specify Cust.“Balance (LCY)” as a text box’s source expression then you will end up getting 0 values. You have to specify Customer.“Balance (LCY)” as the source exp. However, I would recommend not using a new data item, but simply using the record variable. I believe your formula does make sense. Regards, Hadi Lai

THANKS A LOT THE IMPLEMENTATION WENT FINE[:D]

hello hadi, the credit note processing is it the same with sale invoice processing?? I am saying that because i did the same implementation in credit note and goes wrong with regards geroge

Hi, CALCFELDS is a function that can be implemented in any code. There might be mistake in your code. If that’s the case, try not to use the Customer.CALCFIELDS statement; remove it. Use the CalcFields property of your dataitem instead. You can access it through the Property page of the dataitem. Then you can specify directly Balance (LCY) or you can select by clicking the elipsis button. Regards, Hadi Lai