DocType Invoice Customer

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Profile for Customer's Invoice

The Customer's Invoice (AR Invoice) is a document of base type AR Invoice. It can be issued from the functionality found at

 Menu -> Quote-to-Invoice -> Sales Invoices -> Invoice (Customer)


Purpose of the AR Invoice

When in the whole business process it should be used and in what cases its use is specifically not appropriate?

 The functionality for the AR Invoice is used to issue such document on the basis of Sales Order 
 and/or Shipment. Its use is not necessary in the cases when the document has been generated 
 automatically (e.g. by POS Order).

Accounting consequences

  • How is the AR Invoice involved in the accounting processes, e.g. what accounts are debited and what accounts are credited through its use (if any)?
The accounts involved in posting an Invoice

Or as summarized in the following table:

Accounts affected by AR Invoice
Posting Type Accounts and their meaning
Debit T_DUE_ACCT (21610 - Tax Due) - the sum is equal to the tax sum found in the Invoice Tax tab
P_REVENUE_ACCT (41000 - Trade Revenue) - the sum is equal to the total of document's lines
Credit C_RECEIVABLE_ACCT (12110 - Accounts Receivable Trade) - the sum equals the sum of the credits for the credited accounts

  • How and where in the ADempiere's Client App those accounts can be changed (switched to another or complementary meanings)?

Place in the Documents Processing Chain

  • What other documents the AR Invoice generates if any?
 The Customer's Invoice doesn't generate automatically any other documents. Later on, on its basis 
 can be generated the Customer's Payment (AR Receipt).

  • If the document has impact on the stock availability in the warehouse, what is the document's behavior in the extreme cases - when there's not enough or not at all quantities of the product in the warehouse?
 The Invoices do not generate material related documents so they don't have direct impact on the 
 availability of the products in the warehouse.

Debugging the AR Invoice

  • What database tables hold the document's data?
 The main table for the Invoices (where they are created and kept) is C_Invoice. For the Customer's 
 Invoice there are several auxiliary tables completing its functionality. They are: 
   * C_InvoiceLine, which holds the document's lines (product, quantity, price, etc.)
   * C_InvoiceTax, which  is responsible for keeping the taxes applied to the Invoice, if any
   * C_InvoicePaySchedule is used when a schedule for paying the Invoice is specified
   * C_AllocationLine is used when a Payment is allocated to the Invoice

  • What Java classes and methods define the document's behavior?
    • The model class - this class extends the base model X_C_Invoice, implements the interface DocAction and adds complementary methods for invoicing functionality. The most interesting methods involved in the Invoice's Workflow (Process_Invoice) are:
      • MInvoice.processIt(String) - this method is the connection to the class - it creates an instance of the class and by passing it the document's current state (one of the constants defined in the DocAction interface, which value for the document is kept in the database) it gets the appropriate action to be done
      • MInvoice.prepareIt() - does some preliminary actions: checks whether the accounting period is open; explodes BOM (assures that none of the Invoice's products has missing subparts, if any); calculates the total tax of the invoice; creates payment schedule based on the payment term; checks the credit status of the Business Partner; sets the DocAction to complete.
      • MInvoice.completeIt() - call MInvoice.prepareIt; approves the document if it is not approved; creates cash-lines if the payment term is cash; updates the credit amount of the Business Partner.
    • The posting class - this class extends the abstract class Doc with concrete implementations of the methods for accounting of documents.
      • - respoinsible for performing the posting of the document. It calls Doc_Invoice.postLogic()
      • Doc_Invoice.postLogic() - creates the actual account entries like this: checks whether the account is balanced, the account period is open and the amount is convertible; calls Doc_Invoice.createFacts() - For each line DocLine.getAccount() is called which selects the account of each product from M_Product_Acct based on the product id and the accounting schema.