ProjInvoiceRevenue::initInvoiceFromProposale Method
Creates a new invoice line and initializes it from an invoice proposal line.
Syntax
client server public static ProjInvoiceRevenue initInvoiceFromProposale(ProjProposalRevenue _projProposalRevenue)
Run On
Called
Parameters
- _projProposalRevenue
Type: ProjProposalRevenue Table
The invoice proposal line from which to initialize the invoice line.
Return Value
Type: ProjInvoiceRevenue 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 projInvoiceRevenueCreate(ProjProposalRevenue _projProposalRevenue)
{
ProjInvoiceRevenue projInvoiceRevenue;
// Initialize the invoice line fields from the invoice proposal.
projInvoiceRevenue = ProjInvoiceRevenue::initInvoiceFromProposale(_projProposalRevenue);
// Set the invoice ID and date based on the invoice proposal's journal.
projInvoiceRevenue.ProjInvoiceId = _projProposalRevenue.projProposalJour().ProjInvoiceId;
projInvoiceRevenue.InvoiceDate = _projProposalRevenue.projProposalJour().InvoiceDate;
// Validate the invoice line before attempting to save.
if (!projInvoiceRevenue.validateWrite())
{
// Update has been aborted due to an error.
throw error("@SYS21628");
}
// Save the new invoice line to the database.
projInvoiceRevenue.insert();
}