$sum_mopt_otpusk = round($sum_mopt_otpusk + $product['price_mopt_otpusk'] * $product['mopt_qty'], 2); $suppliers[$k]['sweight'] += round($product['weight'] * $product['mopt_qty'], 2); $suppliers[$k]['svolume'] += round($product['volume'] * $product['mopt_qty'], 2); } } if (!isset($suppliers_data[$k]['sum'])) { $suppliers_data[$k]['sum'] = $sum + $sum_mopt; } else { $suppliers_data[$k]['sum'] += $sum + $sum_mopt; } if (!isset($suppliers_data[$k]['sum_otpusk'])) { $suppliers_data[$k]['sum_otpusk'] = $sum_otpusk + $sum_mopt_otpusk; } else { $suppliers_data[$k]['sum_otpusk'] += $sum_otpusk + $sum_mopt_otpusk; } $suppliers_data[$k]['dn'] = $Supplier->GetDNByDate($s['id_supplier'], $orders_data[$order_id]['target_date']); $suppliers_data[$k]['sweight'] = $suppliers[$k]['sweight']; $suppliers_data[$k]['svolume'] = $suppliers[$k]['svolume']; $suppliers_data[$k]['name'] = $suppliers[$k]['name']; $suppliers_data[$k]['art'] = $suppliers[$k]['article']; $suppliers_data[$k]['phone'] = $suppliers[$k]['phones']; $suppliers_data[$k]['place'] = $suppliers[$k]['place']; $suppliers_data[$k]['is_partner'] = $suppliers[$k]['is_partner']; } } $supplier_order = array(); $processed_orders = array(); foreach ($suppliers_data as $sup_key => $supplier) { $num_orders = 0; foreach ($supplier['orders'] as $order) { foreach ($order as $product) {
$sum = 0; $sum_mopt = 0; $suppliers[$k]['sweight'] = 0; $suppliers[$k]['svolume'] = 0; foreach ($Order->list as $product) { if ($product['opt_qty'] > 0 && $product['id_supplier'] == $s['id_supplier']) { $sum = round($sum + $product['opt_sum'], 2); $suppliers[$k]['sweight'] += round($product['weight'] * $product['opt_qty'], 2); $suppliers[$k]['svolume'] += round($product['volume'] * $product['opt_qty'], 2); } if ($product['mopt_qty'] > 0 && $product['id_supplier_mopt'] == $s['id_supplier']) { $sum_mopt = round($sum_mopt + $product['mopt_sum'], 2); $suppliers[$k]['sweight'] += round($product['weight'] * $product['mopt_qty'], 2); $suppliers[$k]['svolume'] += round($product['volume'] * $product['mopt_qty'], 2); } } $suppliers[$k]['sum'] = $sum + $sum_mopt; $suppliers[$k]['dn'] = $Supplier->GetDNByDate($s['id_supplier'], $ord['target_date']); } $tpl->Assign('suppliers', $suppliers); $tpl->Assign('products', $parr); $suppliers_altern = array(); $Order->GetSuppliersAltern($id_order); $suppliers_altern = $Order->list; $tpl->Assign('suppliers_altern', $suppliers_altern); //print_r($suppliers_altern); //print_r($suppliers); //print_r($parr); echo $tpl->Parse($GLOBALS['PATH_tpl'] . 'invoice_contragent.tpl'); exit(0); // ---- right ----