public function act_repeatShipments2() { date_default_timezone_set("Asia/Chongqing"); error_reporting(0); $currenctyList = CurrencyModel::getCurrencyList('currency,rates', 'where 1=1'); foreach ($currenctyList as $value) { $currenctys[$value['currency']] = $value['rates']; //汇率数组 } $packinglists = GoodsModel::getMaterInfo(); //获取全部包材记录 foreach ($packinglists as $packinglist) { $packings[$packinglist['id']]['pmName'] = $packinglist['pmName']; $packings[$packinglist['id']]['pmCost'] = $packinglist['pmCost']; } unset($packinglists); $carrierLists = CommonModel::getCarrierList(); //获取全部运输方式 foreach ($carrierLists as $carrierList) { $carriers[$carrierList['id']] = $carrierList['carrierNameCn']; } unset($carrierLists); $channelLists = CommonModel::getAllChannelList(); //获取全部运输方式下的渠道记录 foreach ($channelLists as $channelList) { $channels[$channelList['id']] = $channelList['channelName']; } unset($channelLists); $staffInfoLists = CommonModel::getStaffInfoList(); //获取全部人员 foreach ($staffInfoLists as $staffInfoList) { $staffLists[$staffInfoList['global_user_id']] = $staffInfoList['global_user_name']; } unset($staffInfoLists); //print_r($packings); // exit; $ebayaccount = omAccountModel::ebayaccountAllList(); //获取全部账号信息 foreach ($ebayaccount as $value) { $ebayaccounts[$value['ebay_platform']][] = $value['id']; //账号id对应名称 } unset($ebayaccount); $accountLists = omAccountModel::accountAllList(); //获取全部账号信息 foreach ($accountLists as $value) { $accounts[$value['id']] = $value['account']; //账号id对应名称 } $time1 = time(); $start = strtotime($_REQUEST['start']); $end = strtotime($_REQUEST['end']); $mailway = $_REQUEST['mailway']; $account = $_REQUEST['account']; /////////////////////////////////////////////// $accountStr = ''; if ($account != '') { //组合成sql 中accountId In() 语句 $account = explode("#", $account); foreach ($account as $value) { if ($value != '') { $accountStr .= " accountId='" . $value . "' or "; } } } $accountStr = substr($accountStr, 0, strlen($accountStr) - 3); if (empty($accountStr)) { $accountStr = ' 1=1'; } //$shipOrderList = OrderInfoModel :: getShipOrderList($start, $end, $accountStr); $tNameUnShipped = 'om_shipped_order'; //已發貨订单表 $where = " WHERE id IN ('8344971','8344971','8344971','8849112','9027686','9118441','9253209','9255395','9337524','9337524','9393954','9395762','9423987','9423987','9425121','9437038','9440042','9440042','9440042','9457399','9461841','9465559','9466929','9472244','9472244','9472244','9488351','9488351','9488479','9489408','9489408','9489408','9489408','9499144','9518194','9518200','9518866','9518866','9518866','9518866','9518898','9519076','9522183','9522183','9532719','9535192','9549634','9549634','9549634','9549643','9552004','9552004','9552004','9560244','9560244','9560244','9560244','9576989','9576989','9576989','9596753','9612887','9622477','9622500','9622512','9623276','9623276','9624016','9626076','9626076','9626076','9626076','9626316','9626385','9626385','9626385','9626403','9627404','9628837','9630913','9630913','9640585','9640585','9640585','9640604','9640770','9641002','9641274','9641274','9641274','9641395','9641529','9641529','9641744','9641829','9641829','9641892','9641892','9641946','9642205','9642205','9642380','9642780','9643939','9643939','9644644','9644644','9647186','9648475','9648478','9648478','9649284','9649286','9649649','9649649','9649649','9649652','9649652','9649652','9649885','9649909','9650192','9650192','9650198','9650198','9650241','9650322','9650322','9650322','9650322','9650380','9650381','9650388','9650571','9650571','9650571','9650612','9650615','9650637','9650649','9650673','9650673','9650681','9650685','9650696','9650704','9650704','9650726','9650741','9650741','9650761','9650785','9650826','9650834','9650834','9650834','9650834','9650838','9650841','9650841','9650914','9650937','9650937','9650958','9650958','9650989','9650995','9651008','9651120','9651151','9651333','9651351','9651351','9651351','9651363','9651618','9652039','9652041','9652172','9652197','9652294','9652355','9652355','9652365','9652547','9652570','9652815','9652829','9652829','9652830','9652830','9652830','9652834','9653349','9653350','9653677','9653677','9653784','9653786','9653790','9653790','9653826','9653866','9653866','9653866','9653866','9653868','9653869','9653869','9653869','9653870','9653870','9653871','9653874','9653878','9653878','9653878','9653878','9653879','9653884','9653884','9653959','9654059','9654071','9654332','9654572','9654572','9654572','9654573','9654573','9654778','9654778','9654784','9654792','9654961','9654964','9655556','9655630','9655630','9655643','9655643','9655643','9655646','9655734','9655775','9655777','9656086','9656208','9656209','9656210','9656529','9656529','9656593','9656629','9656634','9656746','9656983','9657511','9657566','9657566','9657566','9657566','9657641','9657641','9657677','9657678','9657680','9657802','9657802','9657803','9657985','9658074','9658081','9658321','9658337','9658449','9658458','9658501','9658501','9658840','9659006','9659144','9659726','9659726','9660877','9661308','9662160','9662162','9663236','9663236','9663236','9663236','9663236','9663236','9663254','9663408','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664338','9664338','9664341','9665707','9667826','9667826','9667826','9667826','9667826','9667826','9667826','9667826','9667835','9667843','9667849','9667849','9667849','9667849','9667849','9670393','9670393','9670393','9670393','9670393','9670393','9670407','9670407','9670407','9670407','9670407','9670417','9670426','9670683','9673777','9673777','9673777','9673777','9673777','9673778','9675229','9675242','9675595','9675595','9675595','8526402','8809110','8842096','8842096','8842096','8862631','8862631','8905974','8905974','8968635','9046612','9162772','9180940','9180940','9180940','9180940','9241329','9241329','9241329','9308486','9308486','9308486','9376347','9378671','9393969','9411833','9457216','9474385','9474385','9474385','9474385','9474603','9476126','9477416','9477416','9478721','9489020','9489608','9489608','9489608','9498874','9505075','9505075','9505075','9505075','9505151','9505151','9505151','9505151','9505733','9510621','9520197','9528779','9537456','9537668','9550596','9550596','9550596','9566234','9566234','9566248','9566248','9592573','9593512','9593512','9593512','9593512','9593512','9593512','9593512','9602420','9602420','9607647','9607647','9607647','9607647','9607647','9610633','9610776','9610776','9611433','9612362','9615401','9618958','9618958','9623437','9628510','9628510','9628655','9628655','9638991','9641400','9649804','9649855','9649855','9649855','9649855','9649894','9650472','9650472','9650552','9650556','9650583','9650585','9651279','9651509','9651712','9652013','9652013','9652273','9652273','9652274','9652274','9652274','9652441','9652483','9652513','9652523','9652523','9652929','9652929','9652929','9652929','9652929','9652929','9652929','9652929','9653014','9653027','9653027','9653027','9653027','9653103','9653345','9653345','9653345','9653345','9653345','9653489','9653567','9653637','9653938','9653938','9653938','9653938','9653938','9653941','9653941','9653941','9654055','9654055','9654055','9654055','9654061','9654075','9654084','9654323','9654641','9655179','9655255','9655255','9655506','9655506','9655538','9655671','9655835','9655967','9655967','9655967','9656198','9656251','9656251','9656251','9656277','9656279','9656329','9656329','9656329','9656329','9656522','9656541','9656541','9656655','9656921','9656921','9656942','9656942','9657107','9657174','9657174','9657175','9657175','9657175','9657345','9657860','9657860','9657994','9658000','9658000','9658004','9658004','9658012','9658030','9658030','9658030','9658030','9658114','9658141','9658141','9658156','9658209','9658286','9658286','9658295','9658295','9658295','9658295','9658296','9658296','9658595','9658595','9658649','9658691','9658784','9658784','9658784','9658784','9658798','9658809','9658834','9658845','9658852','9658852','9658852','9658914','9658914','9659007','9659009','9659083','9659084','9659148','9659151','9659151','9659355','9659378','9659401','9659451','9659451','9659594','9659804','9660076','9660076','9660393','9660399','9660399','9660406','9660453','9660453','9660453','9660453','9660460','9660603','9660603','9660603','9660862','9660862','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660942','9660952','9660952','9661096','9661096','9661156','9661187','9661292','9661481','9661622','9661850','9661890','9661890','9662030','9662113','9662113','9662146','9662146','9662249','9662249','9662343','9662457','9662471','9662471','9662502','9662696','9662732','9662732','9662732','9662733','9662733','9662733','9662832','9662908','9662908','9662909','9662971','9663010','9663010','9663010','9663014','9663380','9663380','9663380','9663386','9663386','9663692','9663693','9663754','9663754','9663826','9663826','9663894','9663998','9664012','9664080','9664090','9664093','9664112','9664112','9664112','9664112','9664175','9664191','9664191','9664192','9664192','9664196','9664554','9664554','9664968','9665016','9665209','9665222','9665222','9665309','9665392','9665396','9665667','9665667','9665667','9665668','9665668','9659581','9660388','9662117','9662117','9664751','9666120','9666124','9666258','9666258','9666262','9666264','9666344','9666377','9666383','9666383','9666383','9666383','9666384','9666384','9666384','9666384','9666828','9666828','9666947','9667031','9667031','9667206','9667206','9667206','9667206','9667332','9667564','9667564','9667564','9667564','9667567','9667567','9667567','9667567','9667567','9667567','9667580','9667580','9667581','9667597','9667754','9667802','9667802','9667802','9667802','9667949','9667949','9668151','9668151','9668683','9668685','9668773','9668802','9668802','9668802','9668808','9668808','9669255','9669262','9669265','9669268','9669268','9669273','9669285','9669541','9669883','9669964','9669964','9669964','9669964','9669964','9669972','9670114','9670129','9670129','9670286','9670338','9670338','9670411','9671287','9671290','9671452','9671531','9671634','9671634','9671634','9671680','9671680','9671693','9671896','9671934','9671973','9671988','9671988','9672000','9672194','9672194','9672339','9672362','9672362','9672698','9672735','9672743','9672751','9672790','9672911','9672911','9672911','9672993','9673004','9673004','9673101','9673218','9673319','9673323','9673380','9673421','9673452','9673475','9673516','9673643','9673643','9673643','9673668','9673747','9673749','9673753','9673753','9673760','9674395','9674395','9674419','9674419','9674848','9674848','9674850','9674850','9674850','9674850','9674852','9674854','9674854','9674854','9674885','9674899','9674899','9674899','9674899','9674899','9674899','9674908','9674913','9674913','9674913','9674920','9674920','9674920','9674920','9675055','9675087','9675087','9675087','9675137','9675137','9675137','9675137','9675137','9675157','9675157','9675157','9675271','9675583','9675584','9675586','9675586','9696845','9696880','9696880','9697073','9697082','9697092','9697095','9697095','9697095','9697095','9697105','9697110','9697110','9697110','9697115','9697115','9697115','9697254','9698356','9632026','9658246','9661119','9661119','9661119','9661119','9661119','9662121','9666751','9697750','9697750','9698264','9698805','9698808','9698810','9698810','9698810','9698810','9698813','9699173','9699175','9699179','9699179','9699179','9699182','9699184','9699267','9699267','9699267','9699821','9699821','9699892','9699900','9699908','9699923','9699924','9699924','9699924','9699927','9699930','9699930','9699976','9700235','9700312','9700333','9700357','9700357','9700399','9700399','9700931','9700973','9701169','9701449','9701648','9704135')"; //$where = " WHERE `paymentTime` > $start AND `paymentTime` < $end AND `accountId` = '336' LIMIT 1,100"; $shipOrderList = OrderindexModel::showOrderList($tNameUnShipped, $where); $fileName = "repeatShipments" . date('Y-m-d', $end) . ".xls"; $excel = new ExportDataExcel('browser', $fileName); $excel->initialize(); $row = array('日期', 'ebay store', '交易号', '客户ID', '仓位号', '料号', '数量', '料号重量', '成本', '国家', '包裹总价值', '邮费', '币种', '运输方式', '邮寄公司', '挂号条码', '是/否', '重量', '收件人姓名', '客户电话', '地址', '英文州名', '英文城市名', '邮编', '订单编号', '包装员', '配货员', '扫描员', '分区人员', '料号描述'); $excel->addRow($row); foreach ($shipOrderList as $key => $value) { //key代表最外层的维数 /*$value分别有7个对应的键,分别为 orderData,//订单表头数据记录 orderExtenData,//订单表扩展数据记录 orderUserInfoData,//订单表中客户的数据记录 orderWhInfoData,//物料对订单进行操作的数据记录 orderNote,//订单的备注(销售人员添加)记录 orderTracknumber,//订单的追踪号记录 orderAudit,//订单明细审核记录 orderDetail //订单明细记录 */ $orderData = $value['orderData']; //订单表头数据记录,为一维数组 $orderExtenData = $value['orderExtenData']; //扩展表头数据记录,为一维数组 $orderUserInfoData = $value['orderUserInfoData']; //订单客户数据记录,为一维数组 $orderWhInfoData = $value['orderWhInfoData']; //物料对订单进行操作的数据记录,为一维数组 $orderNote = $value['orderNote']; //订单备注记录,二维数组 $orderTracknumber = $value['orderTracknumber']; //订单跟踪号,二维数组 $orderAudit = $value['orderAudit']; //订单明细审核记录,二维数组 $orderDetail = $value['orderDetail']; //订单明细记录,三维数组 $orderId = $orderData['id']; //****订单编号 $ebay_id $orderPaidtime = @date('Y-m-d', $orderData['paymentTime']); //****订单付款时间 paidtime $orderUserInfoEmail = $orderUserInfoData['email']; //****客户邮箱 emial $platformUsername = $orderExtenData['platformUsername']; //****客户平台登录名称 $ebay_userid,用扩展表中的该字段 ebay_username $username = @html_entity_decode($orderUserInfoData['username'], ENT_QUOTES, 'UTF-8'); //****客户真实名称(收件人) username $orderUserInfoStreet1 = @$orderUserInfoData['street']; //**** 街道地址 street1 $orderUserInfoStreet2 = @$orderUserInfoData['address2']; //*** 街道地址2 steet2(一般订单会有两个街道地址) $orderUserInfoCity = $orderUserInfoData['city']; //**** 市 city $orderUserInfoState = $orderUserInfoData['state']; //**** 州 state $orderUserInfoCountryName = $orderUserInfoData['countryName']; //**** 国家全名 //客服部小霞提出 导出列 国家 显示英文 方便退款处理 //$cnname = $country[$countryname]; $orderUserInfoZip = $orderUserInfoData['zipCode']; //**** 邮编 zipCode $orderUserInfoTel = $orderUserInfoData['landline']; //**** 座机 landline $orderWhInfoActualShipping = $orderWhInfoData['actualShipping']; //****实际运费,warehouse表中,ebay_shipfee $orderExtenFeedback = $orderExtenData['feedback']; //****客户留言 ebay_note $OrderActualTotal = @round($orderData['actualTotal'], 2); //****实际收款总价 $ebay_total $orderTracknumberOne = @$orderTracknumber[0]['tracknumber']; //****追踪号,这里只读取记录数的第一条记录的追踪号 $ebay_tracknumber $accountName = @$accounts[$orderData['accountId']]; //****账号名称 $ebay_account $orderRecordnumber = @$orderData['recordNumber']; //****订单编码(对应平台上的编码) $recordnumber0?????? //$ebay_carrier = @$shipOrder['transportId'];//transportId ebay_carrier $orderUserInfoPhone = $orderUserInfoData['phone']; //****客户手机号码 $ebay_phone $orderExtenCurrency = $orderExtenData['currency']; //****币种 $ebay_currency $orderWhInfoPackersId = $orderWhInfoData['packersId']; //包装人员Id $packinguser = $staffLists[$orderWhInfoPackersId]; //对应包装人员姓名 //var_dump($packinguser); $OrderChannelId = $orderData['channelId']; //渠道Id $channelId $orderCalcShipping = $orderData['calcShipping']; //估算运费 $ordershipfee $orderExtenPayPalPaymentId = $orderExtenData['PayPalPaymentId']; //Paypal付款ID $ebay_ptid $orderExtenPayPalEmailAddress = $orderExtenData['PayPalEmailAddress']; //PayPal付款邮箱地址 $ebay_pp $isCopy = $orderData['isCopy']; //默认为0为原始订单,1为被复制订单,2为复制订单 $isCopy = $isCopy == '0' ? '' : ($isCopy == '1' ? '被复制订单' : '复制订单'); //$ebay_noteb = $is_main_order==2 ? '复制 订单' : ($is_main_order==1 ? '被复制 订单' : ''); $isBuji = $orderData['isBuji']; //是否补寄订单。默认0正常订单;1为被补寄的订单;2为补寄产生的新订单 $isBuji = $isBuji == '0' ? '' : ($isBuji == '1' ? '被补寄订单' : '补寄产生新订单'); //$isBuji = isset ($sendreplacement[$isBuji]) ? $sendreplacement[$isBuji] : ''; //$is_sendreplacement = $isBuji; $isSplit = $orderData['isSplit']; //默认0正常订单;1为被拆分的订单;2为拆分产生的订单 $isSplit = $isSplit == '0' ? '' : ($isSplit == '1' ? '被拆分订单' : '拆分产生新订单'); //$ebay_splitorder $isCombinePackage = $orderData['combinePackage']; //是否合并包裹。合并包裹状态,0为正常订单;1为合并包裹主订单;2为合并包裹子订单 $isCombinePackage = $isCombinePackage == '0' ? '' : ($isCombinePackage == '1' ? '合并包裹主订单' : '合并包裹子订单'); $weighStaffId = isset($orderWhInfoData[0]['weighStaffId']) ? $orderWhInfoData[0]['weighStaffId'] : ''; //扫描员ID//称重 $weighStaff = $weighStaffId != '' ? $staffLists[$weighStaffId] : ''; //扫描员 $districtStaffId = isset($orderWhInfoData[0]['districtStaffId']) ? $orderWhInfoData[0]['districtStaffId'] : ''; //分区人员ID $districtStaff = $districtStaffId != '' ? $staffLists[$districtStaffId] : ''; //分区人员 $OrderTransportId = $orderData['transportId']; //运输方式Id $transportId $carrierName = $carriers[$OrderTransportId]; //运输方式名称 $ebay_carrier $address = $orderUserInfoStreet1 . "\n" . $orderUserInfoStreet2 . "\n" . $orderUserInfoCity . "\n" . $orderUserInfoState . "\n" . $orderUserInfoZip . "\n" . $orderUserInfoCountryName; //字段拼接成地址 $orderWhInfoWeighTime = date('Y-m-d', $orderWhInfoData['weighTime']); //称重时间,亦可以当做发货时间 $scantime $OrderCalcWeight = $orderData['calcWeight']; //估算重量,单位是kg $calculate_weight $orderWhInfoActualWeight = number_format($orderWhInfoData['actualWeight'] / 1000, 3); //实际重量 $orderweight2 $totalweight = $orderWhInfoActualWeight; //总重量 $mailway_c = $channels[$OrderChannelId]; //根据运输管理系统的接口获取 $isContainCombineSku = CommonModel::judge_contain_combinesku($orderId); //$ebay_combineorder 判断订单是否包含组合料号,返回true or false if (count($orderDetail) == 1) { //订单明细中只有一条记录时,订单中只有一种料号 $orderDetailTotalData = array_pop($orderDetail); //取得orderDetail中的这条总记录数据,包括orderDetailData和orderDetailExtenData $orderDetailData = $orderDetailTotalData['orderDetailData']; //明细中的常用数据 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData']; //明细中的扩展数据 $orderDetailSku = $orderDetailData['sku']; //该明细下的$sku $orderDetailExtenItemId = $orderDetailExtenData['itemId']; //itemId $ebay_itemid $orderDetailAmount = intval($orderDetailData['amount']); //$amount 该明细下的sku对应的数量 $orderDetailRecordnumber = $orderDetailData['recordNumber']; //该明细对应平台的recordnumber $recordnumber $orderDetailItemPrice = round($orderDetailData['itemPrice'], 2) * $orderDetailAmount; //itemPrice(平台对应的销售单价)*对应数量 $ebay_itemprice // $ebay_shipfee = round_num(($OrderActualTotal - $orderDetailItemPrice), 2); $ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId); //round_num(($OrderActualTotal - $orderDetailItemPrice), 2); //订单总价-sku对应的总价得出运费,$ebay_shipfee $ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : ''; $skus = GoodsModel::get_realskuinfo($orderDetailSku); //获取该sku下对应的真实料号信息(包括料号转换及组合料号对应真实料号信息) $values_skus = array_values($skus); //得到sku的数量 $goods_location = CommonModel::getPositionBySku($orderDetailSku); //仓位 $goodsInfo = GoodsModel::getSkuinfo($orderDetailSku); //获取真实sku的详细信息,包括采购名称和可用库存 $goodsWeight = $goodsInfo['goodsWeight']; //料号重量 $goods_cost = isset($goodsInfo['goodsCost']) ? round($goodsInfo['goodsCost'], 2) : 0; //采购成本 $pmId = isset($goodsInfo['pmId']) ? $goodsInfo['pmId'] : ''; //包材Id $ebay_packingmaterial = $packings[$pmId]['pmName']; //包材名称 $ebay_packingCost = $packings[$pmId]['pmCost']; //包材成本 $purchaseId = isset($goodsInfo['purchaseId']) ? $goodsInfo['purchaseId'] : ''; $cguser = $staffLists[$purchaseId]; //采购名称 $combineSku = GoodsModel::getCombineSkuinfo($orderDetailSku); //判断该sku是否是组合料号,如果是返回combineSku,sku,count关系记录数据,不是则返回false if ($combineSku !== false) { //为组合订单 $goods_costs = 0; $combine_weight_list = array(); $goods_costs_list = array(); foreach ($skus as $k => $v) { $goodsInfo2 = GoodsModel::getSkuinfo($k); $combine_weight_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsWeight']; //组合订单重量数组 $goods_costs_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsCost']; //货本数组 $goods_costs += $orderDetailAmount * $v * $goodsInfo2['goodsCost']; } $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, ''); $excel->addRow($row); foreach ($skus as $k => $v) { $goodsInfo3 = GoodsModel::getSkuinfo($k); $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0; $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0; $goods_location2 = CommonModel::getPositionBySku($k); //仓位 $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : ''; $ebay_packingmaterial = $packings[$pmId]['pmName']; $ebay_packingCost = $packings[$pmId]['pmCost']; $purchaseId = isset($goodsInfo3[0]['purchaseId']) ? $goodsInfo3[0]['purchaseId'] : ''; $cguser = $staffLists[$purchaseId]; $ishipfee = round_num($goods_costs_list[$k] / array_sum($goods_costs_list) * $ebay_shipfee, 2); //根据货本比ebay运费 $iorderweight2 = round($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderWhInfoActualWeight, 3); $iordershipfee = round_num($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderCalcShipping, 2); $iprice = round_num(($goods_costs_list[$k] + $iordershipfee) / (array_sum($goods_costs_list) + $orderCalcShipping) * $ebay_itemprice, 2); //根据货本比产品价格 last modified by herman.xi @20130916 $row = array('', '', '', '', $goods_location2, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); $excel->addRow($row); } } else { //非组合订单 $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, ''); $excel->addRow($row); } unset($combine_weight_list); unset($goods_costs_list); } else { //订单详细记录>1 $cctotal = 0; $ebay_itemprice = 0; $goods_costs = 0; $goods_list = array(); $goods_lists = array(); $goods_weight_list = array(); $goods_costs_list = array(); $calculate_weight = 0; foreach ($orderDetail as $orderDetailTotalData) { //$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData $orderDetailData = $orderDetailTotalData['orderDetailData']; //明细中的常用数据 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData']; //明细中的扩展数据 $detail_id = $orderDetailData['id']; $sku = $orderDetailData['sku']; $skus = GoodsModel::get_realskuinfo($sku); $_ebay_itemprice = round($orderDetailData['itemPrice'], 2); $ebay_itemprice += $orderDetailData['amount'] * $_ebay_itemprice; foreach ($skus as $k => $v) { $goodsInfo3 = GoodsModel::getSkuinfo($k); $_ebay_amount = intval($orderDetailData['amount'] * $v); $cctotal += $_ebay_amount; $calculate_weight += $_ebay_amount * $goodsInfo3['goodsWeight']; $goods_weight_list[$detail_id . $sku][$k] = $_ebay_amount * $goodsInfo3['goodsWeight']; $goods_costs_list[$detail_id . $sku][$k] = round($goodsInfo3['goodsCost'], 2) * $_ebay_amount; $goods_costs += round($goodsInfo3['goodsCost'], 2) * $_ebay_amount; } } //echo "---------$ebay_itemprice--------"; $ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId); $ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : ''; // $ebay_shipfee = round_num(($OrderActualTotal - $ebay_itemprice), 2); $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, '', '', $cctotal, '', $ebay_itemprice, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, ''); $excel->addRow($row); foreach ($orderDetail as $orderDetailTotalData) { //$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData $orderDetailData = $orderDetailTotalData['orderDetailData']; //明细中的常用数据 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData']; //明细中的扩展数据 $detail_id = $orderDetailData['id']; $skuDe = $orderDetailData['sku']; $recordnumber = $orderDetailData['recordNumber']; $orderDetailExtenItemId = $orderDetailExtenData['itemId']; //itemId $ebay_itemid //$ebay_itemid = $detail_array['ebay_itemid']; $amount = intval($orderDetailData['amount']); $dshipingfee = $orderDetailData['shippingFee']; $debay_itemprice = round($orderDetailData['itemPrice'], 2); $goods_location = CommonModel::getPositionBySku($skuDe); $goodsInfo3 = GoodsModel::getSkuinfo($skuDe); $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0; $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : 0; $ebay_packingmaterial = $packings[$pmId]['pmName']; $ebay_packingCost = $packings[$pmId]['pmCost']; $purchaseId = isset($goodsInfo3['purchaseId']) ? $goodsInfo3['purchaseId'] : ''; $cguser = $staffLists[$purchaseId]; $dordershipfee = round($orderCalcShipping * (array_sum($goods_weight_list[$detail_id . $skuDe]) / $calculate_weight), 2); $dorderweight2 = round($orderWhInfoActualWeight * (array_sum($goods_weight_list[$detail_id . $skuDe]) / $calculate_weight), 3); $combineSku = GoodsModel::getCombineSkuinfo($skuDe); //$is_combineSku = count($combineSku); if ($combineSku !== false) { //为组合料号 $skus = GoodsModel::get_realskuinfo($skuDe); foreach ($skus as $k => $v) { $goods_location = CommonModel::getPositionBySku($k); $goodsInfo3 = GoodsModel::getSkuinfo($k); $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0; $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0; $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : ''; $ebay_packingmaterial = $packings[$pmId]['pmName']; $ebay_packingCost = $packings[$pmId]['pmCost']; $purchaseId = isset($goodsInfo3['purchaseId']) ? $goodsInfo3['purchaseId'] : ''; $cguser = $staffLists[$purchaseId]; //$iprice = round_num(($goods_costs_list[$detail_id.$k][$k]/array_sum($goods_costs_list[$detail_id.$k])) * $debay_itemprice * $amount,2); //根据货本比产品价格 $ishipfee = round_num($goods_costs_list[$detail_id . $skuDe][$k] / array_sum($goods_costs_list[$detail_id . $skuDe]) * $dshipingfee, 2); //根据货本比ebay运费 $iorderweight2 = round($goods_weight_list[$detail_id . $skuDe][$k] / array_sum($goods_weight_list[$detail_id . $skuDe]) * $dorderweight2, 3); $iordershipfee = round_num($goods_weight_list[$detail_id . $skuDe][$k] / array_sum($goods_weight_list[$detail_id . $skuDe]) * $dordershipfee, 2); $iprice = round_num(($goods_costs_list[$detail_id . $skuDe][$k] + $iordershipfee) / (array_sum($goods_costs_list[$detail_id . $skuDe]) + $dordershipfee) * $debay_itemprice * $amount, 2); //根据货本比产品价格 last modified by herman.xi @20130916 $row = array('', '', '', '', $goods_location, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); $excel->addRow($row); } } else { $goods_location = CommonModel::getPositionBySku($skuDe); $goodsInfo3 = GoodsModel::getSkuinfo($skuDe); $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0; $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0; $row = array('', '', '', '', $goods_location, $skuDe, $amount, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); $excel->addRow($row); } } unset($goods_weight_list); unset($goods_costs_list); } } $excel->finalize(); exit; }
function act_accountAllListAPI() { $res = omAccountModel::accountAllList(); self::$errCode = omAccountModel::$errCode; self::$errMsg = omAccountModel::$errMsg; return $res; }