Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setAmountNet example
foreach
(
$order
->
getLineItems
(
)
??
[
]
as
$lineItem
)
{
$lineItem
->
setUnitPrice
(
$lineItem
->
getUnitPrice
(
)
/ -1
)
;
$lineItem
->
setTotalPrice
(
$lineItem
->
getTotalPrice
(
)
/ -1
)
;
}
foreach
(
$order
->
getPrice
(
)
->
getCalculatedTaxes
(
)
->
sortByTax
(
)
->
getElements
(
)
as
$tax
)
{
$tax
->
setTax
(
$tax
->
getTax
(
)
/ -1
)
;
}
$order
->
setShippingTotal
(
$order
->
getShippingTotal
(
)
/ -1
)
;
$order
->
setAmountNet
(
$order
->
getAmountNet
(
)
/ -1
)
;
$order
->
setAmountTotal
(
$order
->
getAmountTotal
(
)
/ -1
)
;
return
$order
;
}
private
function
getNumber
(
Context
$context
, OrderEntity
$order
, DocumentGenerateOperation
$operation
)
: string
{
return
$this
->numberRangeValueGenerator->
getValue
(
'document_' . self::TYPE,
$context
,
$order
->
getSalesChannelId
(
)
,
$totalPrice
-
$taxAmount
)
,
-
$totalPrice
,
-
$order
->
getPositionPrice
(
)
,
$taxes
,
$creditItemsCalculatedPrice
->
getTaxRules
(
)
,
$order
->
getTaxStatus
(
)
)
;
}
$order
->
setLineItems
(
$creditItems
)
;
$order
->
setPrice
(
$price
)
;
$order
->
setAmountNet
(
$price
->
getNetPrice
(
)
)
;
return
$price
;
}
}