Thursday 13 September 2018

get VAT percentage of purchase line

static void purchsalestax(Args _args)
{
    TaxOnItem       TaxOnItem;
    TaxGroupData    TaxGroupData;
    real            TaxAmount;
    TaxValue        TaxValue;
    PurchLine       PurchLine;
    ;

    select firstOnly PurchLine where PurchLine.PurchId == '00002622'
    && PurchLine.LineNumber == 1;   

    if(PurchLine.TaxItemGroup && PurchLine.TaxGroup && PurchLine.LineAmount != 0)
    {
        while select TaxOnItem
        where TaxOnItem.TaxItemGroup == PurchLine.TaxItemGroup
        join TaxGroupData
        where TaxGroupData.TaxGroup == PurchLine.TaxGroup
        && TaxGroupData.TaxCode  == TaxOnItem.TaxCode
        {
            if(TaxGroupData)
            {
                TaxValue  =  TaxData::find(TaxOnItem.TaxCode, Systemdateget(), 0).TaxValue;
                TaxAmount = (PurchLine.LineAmount * TaxValue) / 100;
                info(strFmt("Rate = %1, Tax Amount = %2",TaxValue,TaxAmount));

            }
        }
       
    }


}

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...