Share via


ProjInvoiceEmpl::initInvoiceFromProposale Method

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

Syntax

client server public static ProjInvoiceEmpl initInvoiceFromProposale(ProjProposalEmpl _projProposalEmpl)

Run On

Called

Parameters

  • _projProposalEmpl
    Type: ProjProposalEmpl Table
    An invoice proposal line from which to initialize the invoice line.

Return Value

Type: ProjInvoiceEmpl Table
A new invoice line.

Examples

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

See Also

Reference

ProjInvoiceEmpl Table