Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Commit

Permalink
fix(Inventory) individual incorrect total missing discount, eliminate…
Browse files Browse the repository at this point in the history
… global discount as it is not supported in individual mode
  • Loading branch information
joebordes committed May 18, 2024
1 parent 5ac72d9 commit f17272d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions include/Webservices/ProductLines.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
$tax_val = $productTax['percentage'];
$request_tax_name = $tax_name.'_percentage'.$i;
$_REQUEST[$request_tax_name] = $tax_val;
$totalwithtax += ($qty * $_REQUEST['listPrice'.$i]) * ($tax_val/100);
$totalwithtax += ($qty * $_REQUEST['listPrice'.$i] - $discount) * ($tax_val/100);
}
}
$cbMap = cbMap::getMapByName($elementType.'InventoryDetails', 'MasterDetailLayout');
Expand All @@ -106,13 +106,9 @@
}
$_REQUEST['totalProductCount']=$i;
$_REQUEST['subtotal']=round($subtotal + $totalwithtax, 2);
if ($taxtype == 'individual') {
if ($taxtype == 'individual') { // it is not legal to have global discount on individual type > use line discounts per product
$element['hdnDiscountAmount'] = $element['hdnDiscountPercent'] = 0;
$totaldoc=$subtotal+$totalwithtax;
if (!empty($element['discount_type_final']) && $element['discount_type_final']=='amount') {
$totaldoc=$totaldoc-$element['hdnDiscountAmount'];
} elseif (!empty($element['discount_type_final']) && $element['discount_type_final']=='percentage') {
$totaldoc=$totaldoc-($totaldoc*$element['hdnDiscountPercent']/100);
}
} else {
$totaldoc=$subtotal;
if (!empty($element['discount_type_final']) && $element['discount_type_final']=='amount') {
Expand Down

0 comments on commit f17272d

Please sign in to comment.