if (!empty($invoices[$shipment['shipment_id']]['packages'])) { asort($invoices[$shipment['shipment_id']]['packages']); } $total['packages_count'] = !empty($invoices[$shipment['shipment_id']]['packages_count']) ? $total['packages_count'] + $invoices[$shipment['shipment_id']]['packages_count'] : 0; $total['shipping_cost'] = $total['shipping_cost'] + $invoices[$shipment['shipment_id']]['invoice_shipping_cost']; $total['cost'] = $total['cost'] + $invoices[$shipment['shipment_id']]['cost']; $total['amount'] = $total['amount'] + $invoices[$shipment['shipment_id']]['amount']; } else { $new_invoice[$shipment['shipment_id']] = $invoices[$shipment['shipment_id']]; unset($invoices[$shipment['shipment_id']]); } } else { unset($invoices[$shipment['shipment_id']]); } } $addr_list = RusSpsr::WAGetAddrList(8); if (!empty($total)) { Tygh::$app['view']->assign('spsr_total', $total); } if (!empty($invoices)) { Tygh::$app['view']->assign('spsr_packages', 'Y'); Tygh::$app['view']->assign('spsr_invoices', $invoices); $f_spsr = 1; } if (!empty($new_invoice)) { Tygh::$app['view']->assign('spsr_new_invoice', 'Y'); Tygh::$app['view']->assign('spsr_data_invoice', $new_invoice); $f_spsr = 1; } if (!empty($registers)) { Tygh::$app['view']->assign('registers', $registers);