订单打印->明细单 //--------------条件定制 /* $arr_zd=array( "xh",//圆牌号 "kh",//款号 "title",//款式名称 "brand", "series", "theme", "season", "bc", "sxz", "category", "category1", "kh_dj", "designer", "zd1", "zd2", "zd3", "remark",//备注 "color",//颜色代码 "color_title",//颜色名称 "bx", "size",//尺码 "num",//数量 "dpj",//吊牌价 "je",//吊牌金额 "zk",//折扣 "jsj",//结算价 "jsje"//结算金额 ); */ //显示字段 $arr_zd=array("xh","kh","brand","bc","color","color_title","size","xs","num"); //排序 $con_order="no"; //可筛选字段 //$search_zd="brand"; $search_zd=""; //语言翻译 $arr_lang=array( "title"=>"款式名", "color"=>"颜色代码", "color_title"=>"颜色", "remark"=>"备注", "size"=>"尺码明细", "dpj"=>"吊牌价", "num"=>"小计", "xs"=>"箱数", "je"=>"吊牌金额", "zk"=>"折扣", "bx"=>"版型", "jsj"=>"结算价", "jsje"=>"结算金额" ); //-------------- $print_not_qr=get_set("print_not_qr"); $is_brand=get_set("is_brand"); //查询条件定制 $s_ka="n"; $s_key=$_key; $con=" and ka<> 'y'"; $var="s_".$search_zd; if($$var){ $con.=" and ".$search_zd."='".$$var."'"; $con_select=" and ".$search_zd."='".$$var."'"; }else{ $con_select=""; } if($search_zd=="brand"){ $con_brand=" and ".$search_zd."='".$$var."'"; }else{ $con_brand=""; } //杯型参数 if($bx_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$bx_sizegroup_title."' limit 0,1"); $bx_sizegroup_id=$tmp["id"]; }else{ $bx_sizegroup_id=0; } $con_u=""; if($s_username){ $s_username=str_replace(",",",",$s_username); //去掉最后一个逗号 if(substr($s_username,strlen($s_username)-1,1)==",") $s_username1=substr($s_username,0,-1); else $s_username1=$s_username; $arr_username=explode(",",$s_username1); //去掉重复值 $arr_username=array_unique($arr_username); $confirm_str=$confirm_str1=$p_title=$error=""; for($i=0;$iquery($q); $op=""; while($m=$db->fetch_array($r)){ $op.="{\"no\":\"".$m["no"]."\",\"title\":\"".$m["title"]."\"},"; } $json_data.="\"search_zd_op\":[".deel_end($op)."],"; } if($confirm_str) $json_data.="\"confirm_str\":\"".$confirm_str."\",";//订单确认提示 if($sub=="yes"){ $sys_client_title=get_set("sys_client_title"); $dl=get_dl_title($m_client["path"]); $title_dl=$dl?$dl."-":""; if($title_exp) $title_exp=",不含".substr($title_exp,0,-1); $title_sub=$title_dl.substr($p_title,0,-1).$title_exp."明细单 ".date("Y年m月d日 H点i分"); // $json_data.="\"print_not_qr\":\"".$print_not_qr."\","; $json_data.="\"not_confirm_username\":\"".$confirm_str1."\","; //头部信息 $html_print_top="
".$sys_client_title."
"; $html_print_top.="
".$title_sub."
"; $json_data.="\"print_top\":\"".$html_print_top."\","; //-------------------处理尺码表头 //取得合并尺码 $arr_size_merged=get_size_merged(); $num_size_total=count($arr_size_merged); //取得尺码合计sql $sql_sum_num=""; for($k=0;$k<$num_size_total;$k++){ $sql_sum_num.="sum(num_".$arr_size_merged[$k].") 'num_".$arr_size_merged[$k]."',"; } //取得尺码表头内容 $num_size_group=0; $size_tr=array(); $r1=$db->query("select * from ".$table_pre."keyword where cate='size' order by ord"); while($m1=$db->fetch_array($r1)){ $size_tr[$num_size_group]=""; for($i=1;$i<=$num_size_total;$i++){ $tmp=get_db_msg("select title from ".$table_pre."size where iid='".$m1["id"]."' and no='".$i."'"); $t=$tmp["title"]?$tmp["title"]:" "; $size_tr[$num_size_group].="{\"title\":\"".$t."\",\"align\":\"center\",\"width\":30},"; $thead_tmp.=""; } $arr_size_merged[]=$m1["no"]; $num_size_group++; } //----输出表头 $thead=""; $thead_tmp=""; for($i=0;$i"; $r=$db->query($q); $total_xs=$total_num=$total_je=$total_jsje=0; $total_record=0; while($m=$db->fetch_array($r)){ if($m["num"]>0){ $m_kh=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'"); $arr_kh_size=explode(",",$m_kh["size"]); $q4="select * from ".$table_pre."order_pm where uid='".$m["uid"]."' and iid='".$m["iid"]."' and color='".$m["color"]."' and bx='".$m["bx"]."' order by color"; //echo $q4."
"; $r4=$db->query($q4); while($m4=$db->fetch_array($r4)){ $m_pm=get_db_msg("select * from ".$table_pre."size_pm where id='".$m4["pmid"]."'"); $arr_pm=explode(":",$m_pm["gz"]); $arr_pm1=tz_pm($arr_kh_size,$arr_pm); $str_tmp=""; for($i=0;$i0){ $jsj=deel_num(keep_float($m["jsje"]/$m["num"],1)); } $str_tmp.="{\"title\":\"".$jsj."\"},"; }else if($arr_zd[$i]=="zk"){ $zk=deel_num(keep_float($m["jsje"]/$m["je"],2)); $str_tmp.="{\"".$arr_zd[$i]."\":\"".$zk."\"},"; }else if($arr_zd[$i]=="size"){ //尺码明细 for($k=1;$k<=$num_size_total;$k++){ $v1="hj_num_".$k; $tmp_num=$arr_pm1[$k]; $str_tmp.="{\"title\":\"".deel_0($tmp_num)."\"},"; $$v1+=$tmp_num; } }else{ //keyword表 $str_tmp.="{\"title\":\"".get_cate_title_no($arr_zd[$i],$m_kh[$arr_zd[$i]])."\"},"; } } //$total_je+=$m["je"]; //$total_jsje+=$m["jsje"]; $data_tmp.="{\"ind\":".$total_record.",\"content\":[".deel_end($str_tmp)."]},"; $total_record++; } } } //-----------合计行 //计算尺码所在index $size_index=0; for($i=0;$i0){ //没有尺码,但是有小计 $colspan=$num_index; // $str_tmp="{\"title\":\"合计\",\"colspan\":".$colspan.",\"align\":\"right\"},"; $str_tmp.="{\"title\":\"".$total_num."\",\"align\":\"right\"},"; for($i=$num_index+1;$i