7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
566 lines
20 KiB
PHP
566 lines
20 KiB
PHP
<?php
|
|
function get_kh_picture_dhd($no,$main_pic,$color){
|
|
$pic="";
|
|
if(trim($main_pic)){
|
|
$pic="../../attachments/design/mini/".$no."_".$main_pic.".jpg";
|
|
}
|
|
if(!is_file($pic)){
|
|
$pic="../../attachments/design/mini/".$no.".jpg";
|
|
}
|
|
if(!is_file($pic)){
|
|
$tmp=explode(",",$color);
|
|
for($j=0;$j<count($tmp);$j++){
|
|
$pic="../../attachments/design/mini/".$no."_".$tmp[$j].".jpg";
|
|
if(is_file($pic))
|
|
break;
|
|
}
|
|
}
|
|
if(!is_file($pic)){
|
|
$pic="../images/no_pic_80.gif";
|
|
}
|
|
return $pic;
|
|
}
|
|
require "../config.php";
|
|
include "../../tmpl/config.php";
|
|
require THIS_FILE_ROOT."/include/function.php";
|
|
require THIS_FILE_ROOT."/include/db_mysql.php";
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
|
$msg="";
|
|
$db=new DB_Sql;
|
|
$db->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<count($arr_select_no);$i++){
|
|
if(check_arr_select_show($arr_select_no[$i]))
|
|
$arr_zd[$arr_select_no[$i]]=$arr_select_title[$i];
|
|
$tmpsx="sx_".$arr_select_no[$i];
|
|
if($$tmpsx){
|
|
$consx.=" and ".$arr_select_no[$i]."='".$$tmpsx."'";
|
|
}
|
|
|
|
}
|
|
$data["col"][]='str';
|
|
$data["header"][0][]="序号";
|
|
$data["col"][]='img';
|
|
$data["header"][0][]="图片";
|
|
$data["col"][]='str';
|
|
$data["header"][0][]="款号";
|
|
for($i=0;$i<count($s_zd);$i++){
|
|
$data["col"][]='str';
|
|
$data["header"][0][]=get_main_value($arr_zd,$s_zd[$i]);
|
|
}
|
|
$sys_size_num=get_max_size_num();
|
|
$cs=$sys_size_num+2;
|
|
$data["col"][]='num';
|
|
$data["header"][0][]="件数";
|
|
for($i=0;$i<$cs;$i++){
|
|
$data["col"][]='str';
|
|
$data["header"][0][]="";
|
|
}
|
|
$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."<br>";
|
|
$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<count($s_zd);$i++){
|
|
$tmp_zd.="<td bgcolor=\"".$bg."\" class=\"border1\">";
|
|
$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.="</td>";
|
|
$num_zd++;
|
|
}
|
|
//--订单明细
|
|
//$detail="";
|
|
//$detail="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor='#cccccc'>";
|
|
//$detail.="<tr><td bgcolor=\"#f0f0f0\">颜色</td>";
|
|
if($bx_sizegroup_id==$m["size_group_id"]){
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">杯型</td>";
|
|
//
|
|
$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.="<td bgcolor=\"#f0f0f0\" width=\"25\">款型</td>";
|
|
//
|
|
$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<count($size);$l++){
|
|
$v1="hj_".$size[$l];
|
|
$$v1=0;
|
|
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m1["size_group"]."' and no='".$size[$l]."' limit 0,1");
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\" align='center'>".$tmp3["title"]."</td>";
|
|
}
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
|
|
$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."<br>";
|
|
$r2=$db->query($q2);
|
|
$hj=0;
|
|
$k=0;
|
|
$rs=1;
|
|
while($m2=$db->fetch_array($r2)){
|
|
//$detail.="<tr><td bgcolor=\"#ffffff\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
|
|
//if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"])
|
|
//$detail.="<td bgcolor=\"#ffffff\" align=\"center\">".$m2["bx"]."</td>";
|
|
//尺码列表
|
|
$xj=0;
|
|
for($l=0;$l<count($size);$l++){
|
|
$xj+=$m2["num_".$size[$l]];
|
|
$hj+=$m2["num_".$size[$l]];
|
|
//尺码合计
|
|
$v1="hj_".$size[$l];
|
|
$$v1+=$m2["num_".$size[$l]];
|
|
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".deel_0($m2["num_".$size[$l]])."</td>";
|
|
}
|
|
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".$xj."</td></tr>";
|
|
$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.="<tr><td bgcolor=\"#f0f0f0\" align=\"right\"".$hj_colspan.">合计</td>";
|
|
for($l=0;$l<count($size);$l++){
|
|
$v1="hj_".$size[$l];
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_0($$v1)."</td>";
|
|
}
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".$hj."</td></tr>";
|
|
}
|
|
//$detail.="</table>";
|
|
//if($dc!="y"){
|
|
//echo "<tr height=\"100\"><td bgcolor=\"".$bg."\" class=\"border1\">".$list."</td><td bgcolor=\"".$bg."\" class=\"border1\"><div align=\"center\">".out_good_pic($pic,90,90)."<div></td><td bgcolor=\"".$bg."\" class=\"border1\">".$m1["no"]."</td>".$tmp_zd."<td bgcolor=\"".$bg."\" class=\"border1\" align=\"center\">".$m["num"]."</td><td bgcolor=\"".$bg."\" valign=\"top\" class=\"border1\">".$detail."</td></tr>";
|
|
//}
|
|
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<count($s_zd);$i++){
|
|
if($s_zd=="title" || $s_zd=="price" || $s_zd=="xh"){
|
|
$data["body"][$row][]=$m1[$s_zd[$i]].$strrs;
|
|
}else{
|
|
$data["body"][$row][]=get_cate_title_no($s_zd[$i],$m1[$s_zd[$i]]).$strrs;
|
|
}
|
|
}
|
|
$data["body"][$row][]=$m["num"].$strrs;
|
|
//--订单明细
|
|
//$detail="";
|
|
//$detail="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor='#cccccc'>";
|
|
//$detail.="<tr><td bgcolor=\"#f0f0f0\">颜色</td>";
|
|
$data["body"][$row][]="颜色";
|
|
if($bx_sizegroup_id==$m["size_group_id"]){
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">杯型</td>";
|
|
$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.="<td bgcolor=\"#f0f0f0\" width=\"25\">款型</td>";
|
|
$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<count($size);$l++){
|
|
$v1="hj_".$size[$l];
|
|
$$v1=0;
|
|
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m1["size_group"]."' and no='".$size[$l]."' limit 0,1");
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\" align='center'>".$tmp3["title"]."</td>";
|
|
$data["body"][$row][]=$tmp3["title"];
|
|
}
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
|
|
$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."<br>";
|
|
$r2=$db->query($q2);
|
|
$hj=0;
|
|
$k=0;
|
|
$rs=0;
|
|
//print_r($size);
|
|
while($m2=$db->fetch_array($r2)){
|
|
//$detail.="<tr><td bgcolor=\"#ffffff\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
|
|
$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.="<td bgcolor=\"#ffffff\" align=\"center\">".$m2["bx"]."</td>";
|
|
$data["body"][$row][]=$m2["bx"];
|
|
}
|
|
//尺码列表
|
|
$xj=0;
|
|
for($l=0;$l<count($size);$l++){
|
|
//print_r($m2["num_".$size[$l]]);
|
|
$xj+=$m2["num_".$size[$l]];
|
|
$hj+=$m2["num_".$size[$l]];
|
|
//尺码合计
|
|
$v1="hj_".$size[$l];
|
|
$$v1+=$m2["num_".$size[$l]];
|
|
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".deel_0($m2["num_".$size[$l]])."</td>";
|
|
$data["body"][$row][]=deel_0($m2["num_".$size[$l]]);
|
|
}
|
|
//$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".$xj."</td></tr>";
|
|
$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.="<tr><td bgcolor=\"#f0f0f0\" align=\"right\"".$hj_colspan.">合计</td>";
|
|
$data["body"][$row][]="合计".$strhj;
|
|
for($l=0;$l<count($size);$l++){
|
|
$v1="hj_".$size[$l];
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_0($$v1)."</td>";
|
|
$data["body"][$row][]=deel_0($$v1);
|
|
}
|
|
//$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".$hj."</td></tr>";
|
|
$data["body"][$row][]=$hj;
|
|
$row++;
|
|
}
|
|
//$detail.="</table>";
|
|
//echo "<tr height=\"100\"><td bgcolor=\"".$bg."\" class=\"border1\">".$list."</td><td bgcolor=\"".$bg."\" class=\"border1\"><div align=\"center\">".out_good_pic($pic,90,90)."<div></td><td bgcolor=\"".$bg."\" class=\"border1\">".$m1["no"]."</td>".$tmp_zd."<td bgcolor=\"".$bg."\" class=\"border1\" align=\"center\">".$m["num"]."</td><td bgcolor=\"".$bg."\" valign=\"top\" class=\"border1\">".$detail."</td></tr>";
|
|
}
|
|
$count++;
|
|
$l++;
|
|
}
|
|
//print_r($data);
|
|
//exit;
|
|
$file_name="dhd_".date("Y-m-d-H-i");
|
|
output_excel($file_name,$data);
|
|
}else{
|
|
?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>大货生产单</title>
|
|
<style>
|
|
BODY{
|
|
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
|
|
}
|
|
a,a:link,a:visited,a:active {
|
|
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
|
|
}
|
|
a:hover {
|
|
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
|
|
}
|
|
body,input,td,select,div,li,ul,textarea,form {
|
|
font-family:宋体;
|
|
FONT-SIZE:12px;
|
|
}
|
|
.wrong{
|
|
color:#ff0000;font-weight:bold;
|
|
}
|
|
.border1{
|
|
border-bottom:1px solid #cccccc;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<br />
|
|
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
|
|
<form name="form1" action="dhd.php" method="post">
|
|
<tr>
|
|
<td align="center" bgcolor="#f0f0f0"><b>大货生产单</b></td>
|
|
</tr>
|
|
<tr><td align="left" bgcolor="#ffffff" valign="top" style="line-height:150%;">
|
|
<?php
|
|
//--------------------------------------------------------大货生产单
|
|
$s_zd=$_POST["s_zd"]?$_POST["s_zd"]:array("category","bc");
|
|
$s_px=$_POST["s_px"]?$_POST["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=$_POST[$tmpa];
|
|
}
|
|
//可选择字段
|
|
$arr_zd["xh"]="序号";
|
|
$arr_zd["price"]="零售价";
|
|
$arr_zd["price_zk"]="折扣价";
|
|
$arr_zd["title"]="款式名";
|
|
$sxzd="";
|
|
$consx="";
|
|
$tmpu="?dc=y";
|
|
for($i=0;$i<count($arr_select_no);$i++){
|
|
if(check_arr_select_show($arr_select_no[$i]))
|
|
$arr_zd[$arr_select_no[$i]]=$arr_select_title[$i];
|
|
$q="select no,title from ".$table_pre."keyword where cate='".$arr_select_no[$i]."' order by no";
|
|
$r=$db->query($q);
|
|
$sxzd.="<select name=\"sx_".$arr_select_no[$i]."\" onchange=\"form1.submit();\"><option value=\"\">".$arr_select_title[$i]."筛选</option>";
|
|
$op="";
|
|
$tmpsx="sx_".$arr_select_no[$i];
|
|
//echo $$tmpsx;
|
|
while($m=$db->fetch_array($r)){
|
|
$op.="<option value=\"".$m["no"]."\"";
|
|
if($$tmpsx==$m["no"]){
|
|
$op.=" selected";
|
|
$consx.=" and ".$arr_select_no[$i]."='".$m["no"]."'";
|
|
$tmpu.="&".$tmpsx."=".$m["no"];
|
|
}
|
|
$op.=">".$m["title"]."</option>";
|
|
}
|
|
$sxzd.=$op."</select> ";
|
|
}
|
|
//选项字段:
|
|
//排序选项设置数组=>左边填写需要排序的字段(如款号字段为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.="<input type=\"checkbox\" name=\"s_zd[]\" value=\"".$k1."\" id=\"zd_".$k1."\"";
|
|
if(in_array($k1,$s_zd)){
|
|
$zd.=" checked";
|
|
$tmpu.="&s_zd[]=".$k1;
|
|
}
|
|
$zd.="><label for=\"zd_".$k1."\">".$v1."</label>";
|
|
}
|
|
echo "显示列:".$zd;
|
|
echo " 排序:<select name=\"s_px\" onchange=\"form1.submit();\">".get_main_op($arr_px,$s_px)."</select>";
|
|
echo " </td></tr>";
|
|
$tmpu.="&s_px=".$s_px;
|
|
$dcurl="";
|
|
//echo " <a href='".$tmpu."'>导出</a></td></tr>";
|
|
|
|
echo "<tr><td>筛选列:".$sxzd;
|
|
//echo " <input type=submit value=\" 生 成 \" class=\"button_act\">";
|
|
$tmpu.="&s_px=".$s_px;
|
|
$dcurl="";
|
|
echo " <input type=submit value=\" 生 成 \" class=\"button_act\"> <a href='".$tmpu."'>导出</a></td></tr>";
|
|
//-----------------------/search
|
|
|
|
$th_zd="";
|
|
for($i=0;$i<count($s_zd);$i++){
|
|
$th_zd.="<td align=\"center\" bgcolor=\"#dddddd\">".get_main_value($arr_zd,$s_zd[$i])."</td>";
|
|
}
|
|
$sys_size_num=get_max_size_num();
|
|
echo "<tr><td bgcolor=\"#ffffff\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#cccccc\"><tr><td align=\"center\" bgcolor=\"#dddddd\" width=\"40\">序号</td><td align=\"center\" bgcolor=\"#dddddd\" width=\"100\">图片</td><td align=\"center\" bgcolor=\"#dddddd\">款号</td>".$th_zd."<td align=\"center\" bgcolor=\"#dddddd\" width=\"40\">件数</td><td align=\"center\" bgcolor=\"#dddddd\">明细</td></tr>";
|
|
$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."<br>";
|
|
$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<count($s_zd);$i++){
|
|
$tmp_zd.="<td bgcolor=\"".$bg."\" class=\"border1\">";
|
|
$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.="</td>";
|
|
$num_zd++;
|
|
}
|
|
//--订单明细
|
|
$detail="";
|
|
$detail="<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor='#cccccc'>";
|
|
$detail.="<tr><td bgcolor=\"#f0f0f0\">颜色</td>";
|
|
if($bx_sizegroup_id==$m["size_group_id"]){
|
|
$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">杯型</td>";
|
|
//
|
|
$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.="<td bgcolor=\"#f0f0f0\" width=\"25\">款型</td>";
|
|
//
|
|
$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<count($size);$l++){
|
|
$v1="hj_".$size[$l];
|
|
$$v1=0;
|
|
$tmp3=get_db_msg("select * from ".$table_pre."size where iid='".$m1["size_group"]."' and no='".$size[$l]."' limit 0,1");
|
|
$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\" align='center'>".$tmp3["title"]."</td>";
|
|
}
|
|
$detail.="<td bgcolor=\"#f0f0f0\" width=\"30\">小计</td></tr>";
|
|
$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."<br>";
|
|
$r2=$db->query($q2);
|
|
$hj=0;
|
|
$k=0;
|
|
$rs=0;
|
|
while($m2=$db->fetch_array($r2)){
|
|
$detail.="<tr><td bgcolor=\"#ffffff\">".$m2["color"]."-".get_cate_title_no("color",$m2["color"])."</td>";
|
|
if($bx_sizegroup_id==$m1["size_group"] || $child_sizegroup_id==$m1["size_group"])
|
|
$detail.="<td bgcolor=\"#ffffff\" align=\"center\">".$m2["bx"]."</td>";
|
|
//尺码列表
|
|
$xj=0;
|
|
for($l=0;$l<count($size);$l++){
|
|
$xj+=$m2["num_".$size[$l]];
|
|
$hj+=$m2["num_".$size[$l]];
|
|
//尺码合计
|
|
$v1="hj_".$size[$l];
|
|
$$v1+=$m2["num_".$size[$l]];
|
|
$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".deel_0($m2["num_".$size[$l]])."</td>";
|
|
}
|
|
$detail.="<td bgcolor=\"#ffffff\" align=\"right\">".$xj."</td></tr>";
|
|
$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.="<tr><td bgcolor=\"#f0f0f0\" align=\"right\"".$hj_colspan.">合计</td>";
|
|
for($l=0;$l<count($size);$l++){
|
|
$v1="hj_".$size[$l];
|
|
$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".deel_0($$v1)."</td>";
|
|
}
|
|
$detail.="<td bgcolor=\"#f0f0f0\" align=\"right\">".$hj."</td></tr>";
|
|
}
|
|
$detail.="</table>";
|
|
//if($dc!="y"){
|
|
echo "<tr height=\"100\"><td bgcolor=\"".$bg."\" class=\"border1\">".$list."</td><td bgcolor=\"".$bg."\" class=\"border1\"><div align=\"center\">".out_good_pic($pic,90,90)."<div></td><td bgcolor=\"".$bg."\" class=\"border1\">".$m1["no"]."</td>".$tmp_zd."<td bgcolor=\"".$bg."\" class=\"border1\" align=\"center\">".$m["num"]."</td><td bgcolor=\"".$bg."\" valign=\"top\" class=\"border1\">".$detail."</td></tr>";
|
|
//}
|
|
$count++;
|
|
$l++;
|
|
}
|
|
?></table></td></tr></form>
|
|
</table>
|
|
</body>
|
|
</html>
|
|
<?php
|
|
}
|
|
?>
|