Thursday, June 16, 2016

Invoicing Sales Order by Confirming SalesQuotation

Hi Daxer’s !!!

Scenario:Creating SalesQuotation >>Send SalesQuotation to Customer >> here while doing SalesQuotation confirmation i have added one Checkbox of (SalesInvoicecheck) if i check this checkbox and confirm it,then the salesorder status will be invoiced of particular sales Quotation in Sales Order form

How I achieved scenario is
First I have Created a new field in SalesQuotationTable as below


Then I have added one check box(SalesInvoiceCheck) control in SalesQuotationEditLine Form






CommandButton:Ok>>Clicked()

void clicked() // added by shiva
{

    SalesQuotationParmTable SalesQuotationParmTable1;
    SalesquotationTable  salesquotationTable1;

    super();

    SalesQuotationParmTable1 = SalesQuotationParmTable::find(SalesQuotationParmTable.QuotationId,SalesQuotationParmTable.ParmId,true);
    salesquotationTable1=SalesquotationTable::find(SalesQuotationParmTable1.QuotationId);
     if (SalesInvoiceCheck.value()==1)
    {
        SalesQuotationTable1.selectForUpdate(true);
        ttsBegin;
        SalesQuotationTable1.Sk_SalesInvoiceCheck=NoYes::Yes;
        SalesQuotationTable1.update();
        ttsCommit;

    }
}


In above method i’m just finding SalesQuotationTable recid based on quotation id and also updating SalesQuotationTable with SalesInvoicecheck value as “Yes”


Now Finally based on above condition i was gone through with the SalesQuotationLineType Class>>updateSalesQuotationTable() as below





In updateSalesQuotationTable() i have added my logic here
void  updateSalesQuotationTable()
{
    SalesQuotationTable     salesQuotationTable;
    SalesFormLetter         salesformletter;// added by shiva

    salesQuotationTable = salesQuotationLine.salesQuotationTable(update);

    salesQuotationTable.CovStatus    = 0;

    salesQuotationTable.write();

    //added by shiva invoicing salesquotation through confirmation
    if(salesQuotationTable.Sk_SalesInvoiceCheck== NoYes::Yes && salesQuotationTable.SalesIdRef)
    {
        salesformletter = salesformletter::construct(DocumentStatus::Invoice);
        salesformletter.update(salestable::find(salesQuotationTable.SalesIdRef));
    }
    // ended by shiva
}
Now goto Navigation>>Sales&Marketing >>AllSalesOrders>>
Search the Above Salesorder(001358) status is invoiced








No comments:

Post a Comment

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...