foreach ($orders as $order) { $orderId =
$order->
getId();
try { $operation =
$operations[$orderId] ?? null;
if ($operation === null
) { continue;
} $order =
$this->
handlePrices($order);
$config =
clone $this->documentConfigLoader->
load(self::TYPE,
$order->
getSalesChannelId(),
$context);
$config->
merge($operation->
getConfig());
$number =
$config->
getDocumentNumber() ?:
$this->
getNumber($context,
$order,
$operation);
$referenceDocumentNumber =
$referenceInvoiceNumbers[$operation->
getOrderId()];
$now =
(new \
DateTime())->
format(Defaults::STORAGE_DATE_TIME_FORMAT
);