I have written below code to create sales invoice in business central but GST is not calculate on sales invoice.When i create same invoice manually then its calculating Gst.Can anyone suggest
procedure CreateSalesInvoice() var GLSetup: Record /General Ledger Setup/; begin GLSetup.Get();
SalesNReceivableSetup.Get(); SalesHeaderRec.Reset(); SalesHeaderRec.SetRange(/External Document No./, SalesStaging.InvoiceNo); if not SalesHeaderRec.FindFirst() then begin SalesHeader.Init(); SalesHeader./Document Type/ := SalesHeader./Document Type/::Invoice; SalesHeader.Validate(/Document Type/); SalesHeader./No./ := NoSeriesMngt.GetNextNo(SalesNReceivableSetup./Invoice Nos./, WORKDATE, TRUE); SalesHeader.Validate(/No./); SalesHeader./External Document No./ := SalesStaging.InvoiceNo; SalesHeader.Validate(/External Document No./); //To get Sell-To customer No++ CustomerRec.Reset(); CustomerRec.SetRange(ClientID, SalesStaging./Client ID/); if SalesStaging./Application Type/ <> '' then CustomerRec.SetRange(/Application Type/, SalesStaging./Application Type/); if CustomerRec.FindFirst() then begin SalesHeader./Sell-to Customer No./ := CustomerRec./No./; SalesHeader.Validate(/Sell-to Customer No./); end; //-- if SalesNReceivableSetup./Ho Location/ <> '' then begin SalesHeader./Location Code/ := SalesNReceivableSetup./Ho Location/; SalesHeader.Validate(/Location Code/); end; if SalesStaging.PaymentTerms <> '' then begin SalesHeader./Payment Terms Code/ := SalesStaging.PaymentTerms; SalesHeader.Validate(/Payment Terms Code/); end; SalesHeader./Sell-to Address/ := SalesStaging.Address; SalesHeader.Validate(/Sell-to Address/); SalesHeader./Posting Date/ := SalesStaging.Createddate; SalesHeader.Validate(/Posting Date/); if (GLSetup./LCY Code/ <> SalesStaging.Curency) then begin SalesHeader./Currency Code/ := SalesStaging.Curency; SalesHeader.Validate(/Currency Code/); end; SalesHeader.Insert();
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.