Ejemplo n.º 1
0
             if ($settings_shipping_spsr['insurance_type'] == 'INS') {
                 $total_invoices_cost_ins += $invoice['cost'];
             }
             if ($settings_shipping_spsr['insurance_type'] == 'VAL') {
                 $total_invoices_cost_val += $invoice['cost'];
             }
             if (!empty($spsr_invoice['delivery_date'])) {
                 $spsr_invoice['delivery_date'] = date('Y-m-d', fn_parse_date($spsr_invoice['delivery_date'])) . 'T00:00:00.000';
             }
             $invoice_for_xml = array('Action' => "N", 'ShipRefNum' => $invoice['ship_ref_num'], 'PickUpType' => $spsr_invoice['pick_up_type'], 'ProductCode' => $spsr_invoice['invoice_product_code'], 'FullDescription' => fn_html_escape($invoice_full_desc), 'PiecesCount' => count($packages), 'DeliveryDate' => $spsr_invoice['delivery_date'], 'DeliveryTime' => $spsr_invoice['delivery_time'], 'InsuranceType' => $additional_params['insurance_type'], 'InsuranceSum' => $invoice['cost']);
             if ($settings_shipping_spsr['cod'] == 1) {
                 $invoice_for_xml['CODGoodsSum'] = $invoice['cost'] + $invoice['invoice_shipping_cost'];
                 $invoice_for_xml['CODDeliverySum'] = $invoice['invoice_shipping_cost'];
                 $total_invoices_cost_cod += $invoice_for_xml['CODGoodsSum'];
             }
             $invoice_xml = RusSpsr::invoiceXml($invoice_for_xml, $pieces_xml, $shipper_xml, $receiver_xml, $additional_services_xml, $sms_xml);
             $save_data['invoices'][$shipment_id] = $invoice;
             $save_data['invoices'][$shipment_id]['shipper'] = $shipper_for_xml;
             $save_data['invoices'][$shipment_id]['receiver_xml'] = $receiver_for_xml;
             $save_data['invoices'][$shipment_id]['invoice_for_xml'] = $invoice_for_xml;
             $invoices_xml = array_merge($invoices_xml, $invoice_xml);
         } else {
             unset($invoices[$invoice_key]);
         }
     }
 }
 if (!empty($invoices)) {
     $general_for_xml = array('ContractNumber' => RusSpsr::$icn, 'TotalShipments' => count($invoices), 'TotalInsurance' => $total_invoices_cost_ins, 'TotalDeclared' => $total_invoices_cost_val, 'TotalPieces' => $total_pieces_count, 'TotalWeight' => $total_weight);
     if ($settings_shipping_spsr['cod'] == 1) {
         $general_for_xml['TotalCOD'] = $total_invoices_cost_cod;
     }