Based On PurchId show HSN,SAC,GST,TAX number  ,Base Amount ,Tax Amnt,and Total

static void Job19(Args _args)
{
    PurchTable                          purchTable;
    VendTable                           vendTable;
    TaxDocumentComponentTransaction     taxDocumentComponentTransaction;
    TaxDocumentRowTransaction_IN        taxDocumentRowTransaction_IN;
    TaxDocumentRowTransaction           taxDocumentRowTransaction;
    VendInvoiceInfoLine                 vendInvoiceInfoLine;
    VendInvoiceInfoTable                vendinvoiceInfoTable;
    DirPartyTable                       dirPartyTable;
    DirPartyLocation                    dirPartyLocation;
    LogisticsLocation                   logisticsLocation;
    TaxInformation_IN                   taxInformation_IN;

    DLS_Test_VendorGSTInfo           DLS_Test;


      delete_from DLS_Test;
  while  select  HSNCode ,SAC from taxDocumentRowTransaction_IN
            join RecId, DiscountAmount from taxDocumentRowTransaction
            join  vendinvoiceInfoTable
            join vendTable where
            vendinvoiceInfoTable.OrderAccount == vendTable.AccountNum
            && taxDocumentRowTransaction.RecId == taxDocumentRowTransaction_IN.TaxDocumentRowTransactionRecId
            && vendinvoiceInfoTable.RecId == taxDocumentRowTransaction.TransactionHeaderRecId

              join dirPartyLocation where dirPartyLocation.Party  == vendtable.Party
                join logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location
                 join taxInformation_IN where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId
                                           && taxInformation_IN.IsPrimary == NoYes::Yes

        if(taxDocumentRowTransaction.RecId )
         {
            while select *from taxDocumentComponentTransaction
                where taxDocumentRowTransaction.RecId == taxDocumentComponentTransaction.TaxDocumentRowTransactionRecId

               {
                  DLS_Test.OrderAccount = vendinvoiceInfoTable.OrderAccount;
                  DLS_Test.PurchName   = vendinvoiceInfoTable.PurchName;
                  DLS_Test.PurchId     = vendinvoiceInfoTable.PurchId;
                  DLS_Test.RegistrationNumber = TaxRegistrationNumbers_IN::find(taxInformation_IN.GSTIN).RegistrationNumber;

                  DLS_Test.HSNCode     = taxDocumentRowTransaction_IN.HSNCode;
                  DLS_Test.SAC         = taxDocumentRowTransaction_IN.SAC;
                if(taxDocumentComponentTransaction.TaxCode == "CGST")
                {
                    DLS_Test.TaxBaseAmount = taxDocumentComponentTransaction.TaxBaseAmount;
                    DLS_Test.CGST          = taxDocumentComponentTransaction.TaxAmountCur;
                }
                    else if(taxDocumentComponentTransaction.TaxCode == "SGST")
                {
                     DLS_Test.SGST       =  taxDocumentComponentTransaction.TaxAmountCur;
                }
                    else if(taxDocumentComponentTransaction.TaxCode == "IGST")
                {
                    DLS_Test.TaxBaseAmount = taxDocumentComponentTransaction.TaxBaseAmount;

                     DLS_Test.IGST       = taxDocumentComponentTransaction.TaxAmountCur;
                }
              DLS_Test.Total = DLS_Test.TaxBaseAmount + DLS_Test.CGST+DLS_Test.SGST+DLS_Test.IGST;
              DLS_Test.insert();
              DLS_Test.clear();

            }
     }
    info('Insert Record');
}


Note : The result will come based on line Level  ...so after this we should write anotther job group by 

Comments

Popular posts from this blog