ProjInvoiceCost::initInvoiceFromProposal Method
Creates a new invoice line and initializes it from an invoice proposal line.
Syntax
client server public static ProjInvoiceCost initInvoiceFromProposal(ProjProposalCost _projProposalCost)
Run On
Called
Parameters
- _projProposalCost
Type: ProjProposalCost Table
An invoice proposal line from which to initialize the invoice line.
Return Value
Type: ProjInvoiceCost Table
The new invoice line.
Examples
The following example creates an expense invoice line from an expense invoice proposal line and saves it.
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();
}