Skip to content

Commit

Permalink
Merge pull request #19 from delyriand/fix/totals-without-taxe
Browse files Browse the repository at this point in the history
Fix totals without taxe: subtract taxes only if they are neutral
  • Loading branch information
maximehuran authored Aug 17, 2023
2 parents cbba811 + dd547b4 commit 3e03f40
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 3e03f40

Please sign in to comment.