connect($dbhost,$dbuser,$dbpw,$dbname,"p"); $sys_size_num=get_max_size_num(); //-------------------------------mysql connect $dc=$_GET["dc"]; if($dc=="y"){ $s_zd=$_GET["s_zd"]?$_GET["s_zd"]:array("category","bc"); $s_px=$_GET["s_px"]?$_GET["s_px"]:"category,bc"; //文胸 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; } //童装 if($child_sizegroup_title){ $tmp=get_db_msg("select id from ".$table_pre."keyword where cate='size' and title='".$child_sizegroup_title."' limit 0,1"); $child_sizegroup_id=$tmp["id"]; }else{ $child_sizegroup_id=0; } //取得选项 $arr_select_no=array(); $arr_select_title=array(); $q="select no,title from ".$table_pre."keyword where cate='arr_select' and flag_ka='y' and no<>'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord"; $r=$db->query($q); while($m=$db->fetch_array($r)){ $arr_select_no[]=$m["no"]; $arr_select_title[]=$m["title"]; $tmpa="sx_".$m["no"]; $$tmpa=$_GET[$tmpa]; } $arr_zd["xh"]="序号"; $arr_zd["price"]="零售价"; $arr_zd["price_zk"]="折扣价"; $arr_zd["title"]="款式名"; for($i=0;$i'y'".$consx." group by no order by ".$s_px; //echo $query."
"; $res=$db->query($query); $count=0; $l=0; $_tcontent=array(); $row=0; while($m=$db->fetch_array($res)){ $list=$count+1; $bg="#ffffff"; $m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'"); $total_num+=$m["num"]; $total_money+=$money; //图片 $pic=get_kh_picture_dhd($m1["no"],$m1["main_pic"],$m1["color"]); $tmp_zd=""; $num_zd=0; for($i=0;$i"; $tmp_zd.=($s_zd=="title" || $s_zd=="price" || $s_zd=="xh")?deel_td($m1[$s_zd[$i]]):deel_td(get_cate_title_no($s_zd[$i],$m1[$s_zd[$i]])); $tmp_zd.=""; $num_zd++; } //--订单明细 //$detail=""; //$detail=""; //$detail.=""; if($bx_sizegroup_id==$m["size_group_id"]){ //$detail.=""; // $size_str=""; $r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no"); while($m2=$db->fetch_array($r2)){ $size_str.=$m2["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else if($child_sizegroup_id==$m["size_group_id"]){ //$detail.=""; // $size_str=""; $r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no"); while($m2=$db->fetch_array($r2)){ $size_str.=$m2["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else{ $size=explode(",",$m1["size"]); } $tmp1=explode(",",$m1["color"]); for($l=0;$l".$tmp3["title"].""; } //$detail.=""; $q2="select ".get_size_sql("sum1").",color,bx from ".$table_pre."order where ka<>'y' and iid='".$m1["id"]."' group by color,bx"; //echo $q2."
"; $r2=$db->query($q2); $hj=0; $k=0; $rs=1; while($m2=$db->fetch_array($r2)){ //$detail.=""; //if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]) //$detail.=""; //尺码列表 $xj=0; for($l=0;$l".deel_0($m2["num_".$size[$l]]).""; } //$detail.=""; $k++; $rs++; } if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]) $hj_colspan=" colspan='2'"; else $hj_colspan=""; if($k>1){ $rs++; //合计 $detail.=""; for($l=0;$l".deel_0($$v1).""; } //$detail.=""; } //$detail.="
颜色杯型款型小计
".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."".$m2["bx"]."".$xj."
合计".$hj."
"; //if($dc!="y"){ //echo "".$list."
".out_good_pic($pic,90,90)."
".$m1["no"]."".$tmp_zd."".$m["num"]."".$detail.""; //} if($dc=="y"){ $strrs=""; if($rs){ $strrs="|rs:".$rs; } $data["body"][$row][]=$list.$strrs; $data["body"][$row][]=$pic.$strrs; $data["body"][$row][]=$m1["no"].$strrs; for($i=0;$i"; //$detail.="颜色"; $data["body"][$row][]="颜色"; if($bx_sizegroup_id==$m["size_group_id"]){ //$detail.="杯型"; $data["body"][$row][]="杯型"; // $size_str=""; $r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no"); while($m2=$db->fetch_array($r2)){ $size_str.=$m2["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else if($child_sizegroup_id==$m["size_group_id"]){ //$detail.="款型"; $data["body"][$row][]="款型"; // $size_str=""; $r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no"); while($m2=$db->fetch_array($r2)){ $size_str.=$m2["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else{ $size=explode(",",$m1["size"]); } $tmp1=explode(",",$m1["color"]); for($l=0;$l".$tmp3["title"].""; $data["body"][$row][]=$tmp3["title"]; } //$detail.="小计"; $data["body"][$row][]="小计"; $row++; $q2="select ".get_size_sql("sum1").",color,bx from ".$table_pre."order where ka<>'y' and iid='".$m1["id"]."' group by color,bx"; //echo $q2."
"; $r2=$db->query($q2); $hj=0; $k=0; $rs=0; //print_r($size); while($m2=$db->fetch_array($r2)){ //$detail.="".$m2["color"]."-".get_cate_title_no("color",$m2["color"]).""; $data["body"][$row][]=$m2["color"]."-".get_cate_title_no("color",$m2["color"]); if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]){ //$detail.="".$m2["bx"].""; $data["body"][$row][]=$m2["bx"]; } //尺码列表 $xj=0; for($l=0;$l".deel_0($m2["num_".$size[$l]]).""; $data["body"][$row][]=deel_0($m2["num_".$size[$l]]); } //$detail.="".$xj.""; $data["body"][$row][]=$xj; $k++; $rs++; $row++; } $strhj=""; if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]){ $hj_colspan=" colspan='2'"; $strhj="|cs:2"; }else{ $hj_colspan=""; } if($k>1){ $rs++; //合计 //$detail.="合计"; $data["body"][$row][]="合计".$strhj; for($l=0;$l".deel_0($$v1).""; $data["body"][$row][]=deel_0($$v1); } //$detail.="".$hj.""; $data["body"][$row][]=$hj; $row++; } //$detail.=""; //echo "".$list."
".out_good_pic($pic,90,90)."
".$m1["no"]."".$tmp_zd."".$m["num"]."".$detail.""; } $count++; $l++; } //print_r($data); //exit; $file_name="dhd_".date("Y-m-d-H-i"); output_excel($file_name,$data); }else{ ?> 大货生产单
"; $tmpu.="&s_px=".$s_px; $dcurl=""; //echo " 导出"; echo ""; //-----------------------/search $th_zd=""; for($i=0;$i".get_main_value($arr_zd,$s_zd[$i]).""; } $sys_size_num=get_max_size_num(); echo "".$tmp_zd.""; //} $count++; $l++; } ?>
大货生产单
'jgd' and no<>'sx' and no<>'zd1' and no<>'zd2' and no<>'zd3' order by ord"; $r=$db->query($q); while($m=$db->fetch_array($r)){ $arr_select_no[]=$m["no"]; $arr_select_title[]=$m["title"]; $tmpa="sx_".$m["no"]; $$tmpa=$_POST[$tmpa]; } //可选择字段 $arr_zd["xh"]="序号"; $arr_zd["price"]="零售价"; $arr_zd["price_zk"]="折扣价"; $arr_zd["title"]="款式名"; $sxzd=""; $consx=""; $tmpu="?dc=y"; for($i=0;$iquery($q); $sxzd.=" "; } //选项字段: //排序选项设置数组=>左边填写需要排序的字段(如款号字段为no,数量字段为num,吊牌金额字段为je),多个字段用逗号隔开最后以空格+desc结束。=>右边填写选项显示名字 $arr_px=array( "category,num desc"=>get_cate_title_no("arr_select","category"), "category,bc,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","bc"), "category,series,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","series"), "category,theme,num desc"=>get_cate_title_no("arr_select","category").",".get_cate_title_no("arr_select","theme"), "no,num desc"=>"款号", "num desc"=>"数量" ); //字段 $zd=""; $i=0; foreach($arr_zd as $k1 => $v1){ $zd.="".$v1.""; } echo "显示列:".$zd; echo "  排序:"; echo "
筛选列:".$sxzd; //echo " "; $tmpu.="&s_px=".$s_px; $dcurl=""; echo "  导出
".$th_zd.""; $query="select sum(".get_size_sql("sum").") 'num',no,iid,size_group_id from ".$table_pre."order where ka<>'y'".$consx." group by no order by ".$s_px; //echo $query."
"; $res=$db->query($query); $count=0; $l=0; $_tcontent=array(); $row=0; while($m=$db->fetch_array($res)){ $list=$count+1; $bg="#ffffff"; $m1=get_db_msg("select * from ".$table_pre."kh where id='".$m["iid"]."'"); $total_num+=$m["num"]; $total_money+=$money; //图片 $pic=get_kh_picture_dhd($m1["no"],$m1["main_pic"],$m1["color"]); $tmp_zd=""; $num_zd=0; for($i=0;$i"; $tmp_zd.=($s_zd=="title" || $s_zd=="price" || $s_zd=="xh")?deel_td($m1[$s_zd[$i]]):deel_td(get_cate_title_no($s_zd[$i],$m1[$s_zd[$i]])); $tmp_zd.=""; $num_zd++; } //--订单明细 $detail=""; $detail="
序号图片款号件数明细
"; $detail.=""; if($bx_sizegroup_id==$m["size_group_id"]){ $detail.=""; // $size_str=""; $r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no"); while($m2=$db->fetch_array($r2)){ $size_str.=$m2["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else if($child_sizegroup_id==$m["size_group_id"]){ $detail.=""; // $size_str=""; $r2=$db->query("select * from ".$table_pre."size where iid='".$m["size_group_id"]."' order by no"); while($m2=$db->fetch_array($r2)){ $size_str.=$m2["no"].","; } if($size_str) $size_str=substr($size_str,0,-1); $size=explode(",",$size_str); }else{ $size=explode(",",$m1["size"]); } $tmp1=explode(",",$m1["color"]); for($l=0;$l".$tmp3["title"].""; } $detail.=""; $q2="select ".get_size_sql("sum1").",color,bx from ".$table_pre."order where ka<>'y' and iid='".$m1["id"]."' group by color,bx"; //echo $q2."
"; $r2=$db->query($q2); $hj=0; $k=0; $rs=0; while($m2=$db->fetch_array($r2)){ $detail.=""; if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]) $detail.=""; //尺码列表 $xj=0; for($l=0;$l".deel_0($m2["num_".$size[$l]]).""; } $detail.=""; $k++; $rs++; } if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"]) $hj_colspan=" colspan='2'"; else $hj_colspan=""; if($k>1){ $rs++; //合计 $detail.=""; for($l=0;$l".deel_0($$v1).""; } $detail.=""; } $detail.="
颜色杯型款型小计
".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."".$m2["bx"]."".$xj."
合计".$hj."
"; //if($dc!="y"){ echo "
".$list."
".out_good_pic($pic,90,90)."
".$m1["no"]."".$m["num"]."".$detail."