Get Vendor GSTN

  private Taxregistrationnumber_IN VendGSTNumberInvoiceNew(purchid _purchid)

    {
        TaxRegistrationNumbers_IN           taxRegistrationNumbers_IN;
        TaxInformation_IN                   taxInformation_IN;
        LogisticsEntityPostalAddressView    logisticsEntityPostalAddressView;
        PurchLine                           purchlineloc;
        //TransTaxInformationMap_IN           transTaxInformationMap;
        
        LogisticsPostalAddress              logisticsPostalAddress;
        LogisticsLocation                   logisticsLocation;
        LogisticsAddressing                 address;
        NoYes                               check;
        Description                         description;
        VendTable                           vendtable;
        VendInvoiceJour                     vendInvoiceJour;
        DIRPARTYPOSTALADDRESSVIEW           dIRPARTYPOSTALADDRESSVIEW;

        
        select * from vendInvoiceJour where vendInvoiceJour.PurchId == _purchid;
        select firstonly vendtable where vendtable.AccountNum == vendInvoiceJour.InvoiceAccount;
        select firstonly dIRPARTYPOSTALADDRESSVIEW where dIRPARTYPOSTALADDRESSVIEW.Party == vendtable.Party
            && dIRPARTYPOSTALADDRESSVIEW.IsPrimary == NoYes::Yes;

        select firstonly logisticsLocation where logisticsLocation.RecId == dIRPARTYPOSTALADDRESSVIEW.Location;
        select * from taxInformation_IN
            where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId
                join RegistrationNumber from taxRegistrationNumbers_IN
                    where taxRegistrationNumbers_IN.RecId == taxInformation_IN.GSTIN;
        if(taxRegistrationNumbers_IN.RegistrationNumber)
        {
            gstr2ReportTmp.VendName       = logisticsLocation.Description;
            gstr2ReportTmp.StateRecipient = LogisticsAddressState::find(logisticsPostalAddress.CountryRegionId,logisticsPostalAddress.state).Name;

            return taxRegistrationNumbers_IN.RegistrationNumber;
        }
        else
        {
            return "";
        }
    }

Comments