Greetings,
I have problem in creation of invoice proposal with certain line.
the requirement is to create invoice proposal for a certain line in sales order.
but, i faced the following problem the invoice proposal created contains all the lines from any sales order connected to the project.
here is my code:
ProjInvoiceProjId _ProjectContractId = "ProjectContract"; //Project Contract Id for which we want to create Invoice Proposal
ProjProposalJour projProposalJour; //Table which will store journal records after creating Invoice Proposal
ProjInvoiceChoose m_oProjInvoiceChooseNormal; //Class for creating Invoice Proposal
ProjFormLetter projFormLetter; //Class for Posting Invoice Proposal
ProjTable projTable;
changecompany("Company")
{
ttsBegin;
projTable = projTable::find("ProjectID");
//Creation of Invoice Proposal
m_oProjInvoiceChooseNormal = ProjInvoiceChoose::PSANew_InvoiceChoose(_ProjectContractId,projTable.ProjId,dateNull(),maxDate(),true, SalesUpdate::All);
m_oProjInvoiceChooseNormal.parmQuerySalesLine(true);
m_oProjInvoiceChooseNormal.parmQueryOnAccTrans(false);
m_oProjInvoiceChooseNormal.parmQueryRetentionTrans(false);
m_oProjInvoiceChooseNormal.parmQueryRevenueTrans(false);
m_oProjInvoiceChooseNormal.parmQuerySubscriptionTrans(false);
m_oProjInvoiceChooseNormal.parmQueryAdvanceTrans(false);
m_oProjInvoiceChooseNormal.parmQueryCostTrans(false);
m_oProjInvoiceChooseNormal.parmQueryEmplTrans(false);
m_oProjInvoiceChooseNormal.run();
while select forUpdate projProposalJour where projProposalJour.ProjInvoiceProjId == projTable.ProjInvoiceProjId
{
//For approving Invoice proposals
projProposalJour.LineProperty = ProjLinePropertyCode::Approved;
projProposalJour.update();
//For Posting Invoice Proposals
projFormLetter = ProjFormLetter::construct(DocumentStatus::ProjectInvoice);
projFormLetter.createParmLine(projProposalJour);
projFormLetter.run();
//To get latest record
projProposalJour = projProposalJour::find(projProposalJour.ProposalId);
info(strFmt("Invoice ProposalId: %1 \t InvoiceId: %2",projProposalJour.ProposalId,projProposalJour.ProjInvoiceId));
}
ttsCommit;
}
Really appreciate any assistance greatly.
thanks.