Skip to content

Commit

Permalink
fix: subtract taxes only if they are neutral to get right total
Browse files Browse the repository at this point in the history
  • Loading branch information
delyriand committed Aug 11, 2023
1 parent cbba811 commit dd547b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Repository/AbstractReportRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function getSelectColumns(bool $isItemUnit = false, bool $isItem = fal
($isItemUnit ? 'CONCAT(item.productName, \' \' ,item.variantName) as variant_name' : ($isItem ? 'CONCAT(element.productName, \' \' , element.variantName) as variant_name' : '\'\' as variant_name')),

// Adjustments
$isItemUnit ? 'item.unitPrice - COALESCE(tax_adjustment.amount, 0) as without_tax' : '0 as without_tax',
$isItemUnit ? 'item.unitPrice - (CASE WHEN tax_adjustment.neutral = 1 THEN tax_adjustment.amount ELSE 0 END) as without_tax' : '0 as without_tax',
// Only retrieve without_tax price for item units
'(COALESCE(order_promotion_adjustment.amount, 0) + COALESCE(order_item_promotion_adjustment.amount, 0) + COALESCE(order_shipping_promotion_adjustment.amount, 0) + COALESCE(order_unit_promotion_adjustment.amount, 0)) AS without_tax_promo',
'shipping_adjustment.amount as without_tax_shipping',
Expand Down

0 comments on commit dd547b4

Please sign in to comment.