[Vendor Tax] - Sales tax class that is not exempted still showing in tax function.

Issue No: AP-6777
Created 1/18/2019 12:33:07 AM
Type Bug-QC
Priority Blocker
Status Closed
Resolution Fixed
Fixed Version 18.3
Description Restore the MCP backup database   \\fileserver\d$\PROJECTS\i21\Databases\MCP\mcpco01_01132019   Bill: BL-6875   Issue:   1. Vendor has no tax exemption set up but the function still result ysnTaxExempt for other tax class under that tax code will show   2. Incorrect value for ysnTaxExempt and ysnInvalidTaxSetup   !pastedImage_d110902_0.png!   !pastedImage_d110902_1.png!   !pastedImage_d110902_2.png!   {noformat}SELECT [intBillDetailId] = A.intBillDetailId, --[intTaxGroupMasterId] = NULL, [intTaxGroupId] = Taxes.intTaxGroupId, [intTaxCodeId] = Taxes.intTaxCodeId, [intTaxClassId] = Taxes.intTaxClassId, [strTaxableByOtherTaxes]= Taxes.strTaxableByOtherTaxes, [strCalculationMethod] = Taxes.strCalculationMethod, [dblRate] = Taxes.dblRate, [intAccountId] = Taxes.intTaxAccountId, [dblTax] = ISNULL(Taxes.dblTax,0), [dblAdjustedTax] = ISNULL(Taxes.dblAdjustedTax,0), [ysnTaxAdjusted] = Taxes.ysnTaxAdjusted, [ysnSeparateOnBill] = Taxes.ysnSeparateOnInvoice, [ysnCheckOffTax] = Taxes.ysnCheckoffTax, ysnTaxExempt, strNotes, ysnInvalidSetup FROM (SELECT intItemId = B.intItemId ,intVendorId = CASE WHEN A.intShipFromEntityId != A.intEntityVendorId THEN A.intShipFromEntityId ELSE A.intEntityVendorId END ,dtmTransactionDate = A.dtmDate ,dblItemCost = B.dblCost ,dblQuantity = CASE WHEN B.intWeightUOMId > 0 AND B.dblNetWeight > 0 THEN B.dblNetWeight ELSE B.dblQtyReceived END -- CASE WHEN B.intWeightUOMId > 0 -- THEN dbo.fnCalculateQtyBetweenUOM(B.intWeightUOMId, ISNULL(NULLIF(B.intCostUOMId,0), B.intUnitOfMeasureId), B.dblNetWeight) -- ELSE (CASE WHEN B.intCostUOMId > 0 THEN dbo.fnCalculateQtyBetweenUOM(B.intUnitOfMeasureId, B.intCostUOMId, B.dblQtyReceived) ELSE B.dblQtyReceived END) -- END ,intTaxGroupId = NULL ,intCompanyLocationId = A.intShipToId ,intVendorLocationId = A.intShipFromId ,ysnIncludeExemptedCodes = 1 ,intFreightTermId = C.intFreightTermId ,ysnExcludeCheckOff = 0 ,intBillDetailId = B.intBillDetailId ,intItemUOMId = CASE WHEN B.intWeightUOMId > 0 AND B.dblNetWeight > 0 THEN B.intWeightUOMId ELSE B.intUnitOfMeasureId END FROM tblAPBill A INNER JOIN tblAPBillDetail B ON A.intBillId = B.intBillId INNER JOIN tblEMEntityLocation C ON C.intEntityLocationId = intShipFromId WHERE intBillDetailId = 27813 ) A CROSS APPLY fnGetItemTaxComputationForVendor (intItemId ,intVendorId ,dtmTransactionDate ,dblItemCost ,dblQuantity ,intTaxGroupId ,intCompanyLocationId ,intVendorLocationId ,ysnIncludeExemptedCodes ,intFreightTermId ,ysnExcludeCheckOff ,intItemUOMId ,NULL ,NULL ,NULL) Taxes WHERE Taxes.dblTax IS NOT NULL{noformat}