Body section wont display correct value in report

nvermanverma Member Posts: 396
Hello

I had a quick question. I created a report for a user that allows the user to select Cust ledger entries and they could print a receipt for the selected entries. The user wants to modify the calculation of the Amount field in the report. If the user selects a Document type of “Invoice” and “Credit Memo”, she wants to see the sum of the two amount fields. Currently it shows the value of Amount field if the document type is "Invoice". Lets say the Document type is Invoice and the amount field contains a value of 100. Another line, has a document type of “Credit Memo” and the amount field contains a value of 50. So when the receipt report is printed the final amount field to show $50 (100 - 50).

When I was trying to debugging the code: I put a line of code: Message(‘Value %1’, TotalAmountC) and when i run the report, i get a message prompt which displays the correct answer. However, in the report it doesn’t display the correct answer. Any ideas or suggestions how I can get past this issue. Any help will be greatly appreciated.

TotalAmountI is sume of all the document type which are invoices. TotalAmountIC is the sum of all document type: Credit Memo

The code is written in the OnAfterGetRecord of the dataitem.
IF ("Cust. Ledger Entry"."Document Type" = "Cust. Ledger Entry"."Document Type"::"Credit Memo") THEN
  BEGIN
//    CurrReport.SHOWOUTPUT(FALSE);
    TotalAmountIC := "Cust. Ledger Entry".Amount + TotalAmountIC;
    MESSAGE('tOTAL IS %1 ', TotalAmountIC);

Total := TotalAmountI + TotalAmountIC;
END;

If I put the label in the footer section of the report, it display the correct value, but when its in the body section it doesnt work. What could I be doing wrong??

Answers

  • vijay_gvijay_g Member Posts: 884
    As you are saying that in footer section you are getting perfact value so i assume you are using custledgerentry therefor until all the records will not come on body section how can you get value(total invoice - total credit memo) in body section. is not this then be clear on.
    1. Which dataitem is in your report?
    2. What are you printing in body section?
  • nvermanverma Member Posts: 396
    vijay_g wrote:
    As you are saying that in footer section you are getting perfact value so i assume you are using custledgerentry therefor until all the records will not come on body section how can you get value(total invoice - total credit memo) in body section. is not this then be clear on.
    1. Which dataitem is in your report?
    2. What are you printing in body section?

    I think that is the reason its not working. Is there a way around this??
  • nvermanverma Member Posts: 396
    I was thinking to get rid of the body section and just try to do my calcuations in a footer section. But, no matter what I do footer section only reads one type of document type at a time. However, if i select two different lines, one has a doc type of invoice and the other is of credit memo doc type. It just seems to completely ignore the credit memo line and just displays the invoice line amount. Is it because its in a footer section???I am sorta lost (according to my manager doing it in footer should work). I went on google to try to find information regarding footers but i couldnt find much information on it. Any help will be greatly appreciated.
  • gerrykistlergerrykistler Member Posts: 149
    Add an Integer data item after the other data items - set the key on Number and a constant of 1. Then display your totals in this section.
    Gerry Kistler
    KCP Consultores
  • nvermanverma Member Posts: 396
    Add an Integer data item after the other data items - set the key on Number and a constant of 1. Then display your totals in this section.

    Thanksss!!! It took me a while to get it working but It works now.
  • nvermanverma Member Posts: 396
    Just out of curosity. Why did I need to create a new dataitem. I mean whats the logic behind it.
  • gerrykistlergerrykistler Member Posts: 149
    It is the only way to have a Body section where you want to show totals from the combination of other data items. A Footer section of the last data item normally works as well, but you mentioned this was not giving you the right totals.
    Gerry Kistler
    KCP Consultores
Sign In or Register to comment.