Monday 26 February 2018

Get GST rates ref pepper

Get GST rates ref pepper

static void aks_GetGSTRate(Args _args)
{
    TaxRuntimeLookupCondition               taxRuntimeLookupCondition;
    TaxRuntimeLookupMeasureResult           taxRuntimeLookupMeasureResult;
    TaxRuntimeLookupMeasureResultDetail     taxRuntimeLookupMeasureResultDetail;
    TaxRuntimeLookup                        taxRuntimeLookup;
    TaxRuntimeLookupVersion                 taxRuntimeLookupVersion;
    TaxRuntimeDocComponentMeasure           taxRuntimeDocComponentMeasure;
    TaxRuntimeDocComponentMeasureVersion    taxRuntimeDocComponentMeasureVersion;
    TaxRuntimeDocComponent                  taxRuntimeDocComponent;
    TaxRuntimeDocComponentVersion           taxRuntimeDocComponentVersion;
    TaxRuntimeDocTaxType                    taxRuntimeDocTaxType;
    TaxRuntimeDocTaxTypeVersion             taxRuntimeDocTaxTypeVersion;


    while select taxRuntimeLookupCondition
        where taxRuntimeLookupCondition.DimValue1 == 'KA' &&
        taxRuntimeLookupCondition.DimValue2 == '73239200' &&
        taxRuntimeLookupCondition.Ledger == CompanyInfo::find().RecId
    {
        taxRuntimeLookupVersion = TaxRuntimeLookupVersion::find(taxRuntimeLookupCondition.LookupVersion);
        taxRuntimeLookup = TaxRuntimeLookup::find(taxRuntimeLookupVersion.Lookup);

        switch(taxRuntimeLookup.LookupOwnerTableId)
        {
            case tableNum(TaxRuntimeDocComponentMeasure):
                taxRuntimeDocComponentMeasure   =   TaxRuntimeDocComponentMeasure::find(taxRuntimeLookup.LookupOwnerRecId);

                select taxRuntimeDocComponentMeasureVersion order by taxRuntimeDocComponentMeasureVersion.RecId desc
                        where taxRuntimeDocComponentMeasureVersion.TaxRuntimeDocComponentMeasure == taxRuntimeDocComponentMeasure.RecId;

                select firstOnly taxRuntimeLookupMeasureResult
                        join forUpdate taxRuntimeLookupMeasureResultDetail
                    where taxRuntimeLookupMeasureResult.LookupCondition == taxRuntimeLookupCondition.RecId
                        && taxRuntimeLookupMeasureResultDetail.LookupMeasureResult == taxRuntimeLookupMeasureResult.RecId;
                break;

            case tableNum(TaxRuntimeDocComponent):
                taxRuntimeDocComponent  =   TaxRuntimeDocComponent::find(taxRuntimeLookup.LookupOwnerRecId);

                select taxRuntimeDocComponentVersion order by taxRuntimeDocComponentVersion.RecId desc
                        where taxRuntimeDocComponentVersion.TaxRuntimeDocComponent ==  taxRuntimeDocComponent.RecId;
                break;

            case tableNum(TaxRuntimeDocTaxType):
                taxRuntimeDocTaxType    =   TaxRuntimeDocTaxType::find(taxRuntimeLookup.LookupOwnerRecId);

                select taxRuntimeDocTaxTypeVersion order by taxRuntimeDocTaxTypeVersion.RecId
                        where taxRuntimeDocTaxTypeVersion.TaxRuntimeDocTaxType ==  taxRuntimeDocTaxType.RecId;
                break;
        }

        info(strFmt("Path: %1,Value:%2",taxRuntimeDocComponentMeasure.Path,taxRuntimeLookupMeasureResultDetail.Value));
    }
}

No comments:

Post a Comment