Export Vend GST in AX

 Static void getVendorGST(AccountNum _accountNum)

{
    //VendTable           vendTable;
    //DirPartyTable       dirPartyTable;
    //LogisticsLocation   logisticsLocation;
    //TaxInformation_IN   taxInformation_IN;
    //TaxRegistrationNumbers_IN       taxRegistrationNumbers_IN;
//
  //while  select vendTable where vendTable.AccountNum == "SITL-0036"
        //join dirPartyTable
            //where dirPartyTable.RecId == vendTable.Party
        //join logisticsLocation
            //where logisticsLocation.RecId == dirPartyTable.PrimaryAddressLocation
    //{
//
    //taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(logisticsLocation.RecId);
    //
    //select * from taxRegistrationNumbers_IN where taxRegistrationNumbers_IN.RecId == taxInformation_IN.GSTIN;
    //
         //info(strFmt("%1, %2, %3", vendTable.AccountNum, taxRegistrationNumbers_IN.RegistrationNumber));
        //
    //}


    SysExcelApplication         xlsApplication;
    SysExcelWorkBooks           xlsWorkBookCollection;
    SysExcelWorkBook            xlsWorkBook;
    SysExcelWorkSheets          xlsWorkSheetCollection;
    SysExcelWorkSheet           xlsWorkSheet;
    SysExcelRange               xlsRange;
    int                         row;

    VendTable                   vendTable;
    DirPartyTable               dirPartyTable;
    DirPartyLocation            dirPartyLocation;
    DirPartyLocationRole        dirPartyLocationRole;
    LogisticsLocation           logisticsLocation;
    LogisticsLocationRole       logisticsLocationRole;
    LogisticsPostalAddress      logisticsPostalAddress;
    str                         isPrimary;
    TaxInformation_IN       taxInformation_IN;
    TaxRegistrationNumbers_IN       taxRegistrationNumbers_IN;
    TaxInformationVendTable_IN      taxInformationVendTable_IN;

    xlsApplication              = SysExcelApplication::construct();
    xlsWorkBookCollection       = xlsApplication.workbooks();
    xlsWorkBook                 = xlsWorkBookCollection.add();
    xlsWorkSheetCollection      = xlsWorkBook.worksheets();
    xlsWorkSheet                = xlsWorkSheetCollection.itemFromNum(1);

    row = 1;

    xlsWorkSheet.cells().item(row, 1).value("Vendor ID");
    xlsWorkSheet.cells().item(row, 2).value("Name or description");
    xlsWorkSheet.cells().item(row, 3).value("Addresss");
    xlsWorkSheet.cells().item(row, 4).value("Purpose");
    xlsWorkSheet.cells().item(row, 5).value("Primary");
    xlsWorkSheet.cells().item(row, 6).value("TaxName");
    xlsWorkSheet.cells().item(row, 7).value("GSTIN");
    xlsWorkSheet.cells().item(row, 8).value("Pan");
        // where vendTable.AccountNum == 'SITL-0372'
    while select AccountNum from vendTable  where vendTable.AccountNum == 'SITL-0372'
        join Name from dirPartyTable
            where dirPartyTable.RecId == vendTable.Party
        join IsPrimary from dirPartyLocation
            where dirPartyLocation.Party == vendTable.Party
        join dirPartyLocationRole
            where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId
        join Type from logisticsLocationRole
            where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole
        join logisticsLocation
            where logisticsLocation.RecId == dirPartyLocation.Location
        join logisticsPostalAddress
            where logisticsPostalAddress.Location == logisticsLocation.RecId
    {
        row++;

         select firstonly taxInformation_IN
            where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId;
       // taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation();

        select * from taxRegistrationNumbers_IN where taxRegistrationNumbers_IN.RecId == taxInformation_IN.GSTIN;

        select  * from taxInformationVendTable_IN where taxInformationVendTable_IN.VENDTABLE ==  vendTable.AccountNum;

        xlsWorkSheet.cells().item(row, 1).value(vendTable.AccountNum);
        xlsWorkSheet.cells().item(row, 2).value(logisticsLocation.Description);
        xlsWorkSheet.cells().item(row, 3).value(logisticsPostalAddress.Address);
        xlsWorkSheet.cells().item(row, 4).value(enum2str(logisticsLocationRole.Type));
        xlsWorkSheet.cells().item(row, 5).value(enum2str(dirPartyLocation.IsPrimary));
        xlsWorkSheet.cells().item(row, 6).value(taxInformation_IN.name);
        xlsWorkSheet.cells().item(row, 7).value(taxRegistrationNumbers_IN.RegistrationNumber);
        xlsWorkSheet.cells().item(row, 8).value(taxInformationVendTable_IN.PANNumber);
    }

    xlsApplication.visible(true);

}

Comments