10 Mart 2014 Pazartesi

AXAPTA - Find VAT rate and amount at document lines

while select InvoiceTrans where
        InvoiceTrans.SalesId == InvoiceJour.SalesId && InvoiceTrans.InvoiceId == InvoiceJour.InvoiceId &&
        InvoiceTrans.InvoiceDate == InvoiceJour.InvoiceDate && InvoiceTrans.numberSequenceGroup == InvoiceJour.numberSequenceGroup
    {
        InvoicePrintTrans.Name  = InvoiceTrans.Name;
        select taxOnItem
                where taxOnItem.TaxItemGroup == InvoiceTrans.TaxItemGroup
            join taxGroupData
                where taxGroupData.TaxCode == taxOnItem.TaxCode &&
                      taxGroupData.TaxGroup == InvoiceTrans.TaxGroup;
        TaxValue  = TaxData::find(TaxOnItem.TaxCode, InvoiceTrans.InvoiceDate, 0).TaxValue;
Tax = Tax::calcTaxAmount(InvoiceTrans.TaxGroup,taxOnItem.TaxItemGroup,InvoiceTrans.InvoiceDate,
                InvoiceTrans.CurrencyCode,InvoiceTrans.LineAmount,TaxModuleType::Sales);

        info(strFmt("VAT rate %1 VAT amount",TaxValue,Tax));
    }