Compartir a través de


ProjInvoiceItem::initInvoice_Project Method

Creates a new invoice line and initializes it from an invoice proposal line by using data from the associated project transaction.

Syntax

client server public static ProjInvoiceItem initInvoice_Project(ProjProposalItem _projProposalItem)

Run On

Called

Parameters

  • _projProposalItem
    Type: ProjProposalItem Table
    An invoice proposal line from which to initialize the invoice line.

Return Value

Type: ProjInvoiceItem Table
The new invoice line.

Examples

The following example creates an item invoice line from an item invoice proposal line and saves it.

public void projInvoiceItemCreate(ProjProposalItem _projProposalItem) 
{ 
    ProjInvoiceItem    projInvoiceItem; 
 
    // Initialize the invoice line fields from the invoice  proposal. 
    projInvoiceItem = ProjInvoiceItem::initInvoice_Project(_projProposalItem); 
 
    // Set the invoice ID and date based on the invoice proposal's journal. 
    projInvoiceItem.ProjInvoiceId  = _projProposalItem.projProposalJour().ProjInvoiceId; 
    projInvoiceItem.InvoiceDate    = _projProposalItem.projProposalJour().InvoiceDate; 
 
    // Validate the invoice line before attempting to save. 
    if (!projInvoiceItem.validateWrite()) 
    { 
        // Update has been aborted due to an error. 
        throw error("@SYS21628"); 
    } 
    // Save the new invoice line to the database. 
    projInvoiceItem.insert(); 
}

See Also

Reference

ProjInvoiceItem Table