how to retrieve the first invoice amount

Horse06
Horse06 Member Posts: 496
How to program to retrieve customers' first invoice amount and filter out the rest of the amount in the report? Thanks!

Comments

  • ssingla
    ssingla Member Posts: 2,973
    As far as I understood you want only the First Invoice of the customer.
    For that you can filter the Cust. Ledger Entry for Customer, then document type as Invoice. The data will be sorted as per Entry No. (Primary Key) and you will get the desired output.
    CA Sandeep Singla
    http://ssdynamics.co.in
  • Horse06
    Horse06 Member Posts: 496
    Thanks! I know how to filter ou the payment etc through the document type, but if customers have so many invoices, how to base on the entry no? Thanks!
  • ssingla
    ssingla Member Posts: 2,973
    The entries of the customer i.e. invoices by entry number. The first invoice entry will have a lesser number assigned to it then the later invoice entry. Use the code like this

    "Cust. Ledger Entry".SETRANGE("Customer No.",Cust_Code);
    "Cust. Ledger Entry".SETRANGE("Document Type",Invoice);
    IF "Cust. Ledger Entry".FIND('-') THEN
    InvNumberCode:= "Cust. Ledger Entry"."Document No.";

    Cust_Code is code variable for the customer to be filtered
    InvNumberInt is a code variable for storing the Invoice Number.

    ( '-' ) is to find the first record.
    CA Sandeep Singla
    http://ssdynamics.co.in
  • Horse06
    Horse06 Member Posts: 496
    It seems that it doesn't work. It retrieves one customer with first invoice of amount zero with many many pages. I want to get the all the customers with the first invoice amount.