Share via


ProjInvoiceOnAcc::initInvoiceFromProposale Method

Creates a new invoice line and initializes it from an invoice proposal line.

Syntax

client server public static ProjInvoiceOnAcc initInvoiceFromProposale(ProjProposalOnAcc _projProposalOnAcc)

Run On

Called

Parameters

Return Value

Type: ProjInvoiceOnAcc Table
The new invoice line.

Examples

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

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

See Also

Reference

ProjInvoiceOnAcc Table