Share via


ProjInvoiceItem::initInvoiceFromProposale Method

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

Syntax

client server public static ProjInvoiceItem initInvoiceFromProposale(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::initInvoiceFromProposale(_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