public function ydf_excel($date = NULL) { header("Content-Type: text/html; charset=gb2312"); if ($date == NULL) { $date = date('Y-m-d'); } $orders = $this->get_ydf_order($date); $head = array('Sales Record Number', 'Buyer Fullname', 'Buyer Company', 'Buyer Address 1', 'Buyer Address 2', 'Buyer City', 'Buyer State', 'Buyer Zip', 'Buyer Phone Number', 'Buyer Country', 'Custom Label', 'Description EN', 'Description CN', 'HS Code', 'Quantity', 'Sale Price', 'Country of Manufacture', 'Mark', 'weight', 'Length', 'Width', 'Height', 'Shipping Service', 'Shipping Service Name', 'Track Number'); foreach ($orders as $order) { $skus = explode(',', $order->sku_str); $qties = explode(',', $order->qty_str); $shipping_method = shipping_method($order->is_register); //echo $order->id."<br>"; $count = count($skus); $product_name = ''; $product_name_en = ''; $qty = 0; $weight = 0; $rmb = price($this->order_model->calc_currency($order->currency, $order->gross)); for ($i = 0; $i < $count; $i++) { if ($i == 0) { $product_name .= iconv("UTF-8", "GB2312//IGNORE", get_product_name($skus[$i])); $product_name_en .= iconv("UTF-8", "GB2312//IGNORE", get_product_name_en($skus[$i])); } $qty += $qties[$i]; $weight += get_weight_by_sku($skus[$i]) * $skus[$i]; } $shipping_method_name_cn = iconv("UTF-8", "GB2312//IGNORE", $shipping_method->name_cn); $data[] = array($order->id, $order->name, " ", $order->address_line_1, $order->address_line_2, $order->town_city, $order->state_province, $order->zip_code, $order->contact_phone_number, $order->country, $skus[0], $product_name_en, $product_name, " ", $qty, $rmb, " ", " ", $weight, " ", " ", " ", $shipping_method->ydf_code, $shipping_method_name_cn, $order->track_number); } $this->excel->array_to_excel($data, $head, 'ydf_list_' . $date); }
.sty1{ width:20px; height:20px; border:1px solid #000000; font-size:20px; font-weight:bold; float:right;} </style> </head> <body> TEXT; $i = 0; foreach ($orders as $order) { foreach ($order as $order) { $i++; $sku_arr = explode(',', $order->sku_str); $ship_confirm_date = date('Y-m-d', strtotime($order->ship_confirm_date)); $ship_weight = "{$order->ship_weight}" / 1000 . 'Kg'; $shipping_cost = '¥' . "{$order->shipping_cost}"; $product_names = ''; foreach ($sku_arr as $sku) { $product_names .= get_product_name($sku) . '(' . get_product_name_en($sku) . ')' . br(); } if ($i != 1) { $page = <<<TEXT <div style="margin-left:auto; margin-right:auto; width : 210mm; height:303mm; clear:both; page-break-before: always;"> TEXT; } else { $page = <<<TEXT <div style="margin-left:auto; margin-right:auto; width : 210mm; height:303mm; clear:both;"> TEXT; } $html .= <<<TEXT {$page} \t<table width="100%" style="height:35mm;" border="0" cellspacing="0" cellpadding="0"> <tr> <td style=" width:105mm;font-size:12px;">