-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit net price and discounted unit net price on the invoice #287
Conversation
ead0105
to
e9a42e4
Compare
80c3296
to
f5e6dc7
Compare
$unitNetPrice = $grossValue - $taxAmount - $shipment->getAdjustmentsTotal(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT); | ||
$discountedUnitNetPrice = $grossValue - $taxAmount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$unitNetPrice = $grossValue - $taxAmount - $shipment->getAdjustmentsTotal(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT); | |
$discountedUnitNetPrice = $grossValue - $taxAmount; | |
$discountedUnitNetPrice = $grossValue - $taxAmount; | |
$unitNetPrice = $discountedUnitNetPrice - $shipment->getAdjustmentsTotal(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT); |
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE sylius_invoicing_plugin_line_item ADD discounted_unit_net_price INT DEFAULT NULL'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add checks similar to Sylius? https://github.com/Sylius/Sylius/blob/1.12/src/Sylius/Bundle/CoreBundle/Doctrine/Migrations/AbstractMigration.php#L23
@@ -59,13 +61,15 @@ private function convertShippingAdjustmentToLineItem(AdjustmentInterface $shippi | |||
$grossValue = $shipment->getAdjustmentsTotal(); | |||
$taxAdjustment = $this->getShipmentTaxAdjustment($shipment); | |||
$taxAmount = $taxAdjustment !== null ? $taxAdjustment->getAmount() : 0; | |||
$netValue = $grossValue - $taxAmount; | |||
$unitNetPrice = $grossValue - $taxAmount - $shipment->getAdjustmentsTotal(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling, that it is small de-cohesion, that in the units to line items converter we have dedicated service for net price calculation and here we don't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed 👍 we could probably refactor (could be done in a separate PR IMO) 🖖
Fixes #273