id分別是ishijian1,ishijian2,語句是
echo ' ';
?>
c_huizong.php
//訂單查詢
if ($_POST['1shijian1'])
{
echo "
document.getElementById('1shijian1').value='".$_POST['1shijian1'].
"';document.getElementById('1shijian2').value='".$_POST['1shijian2'].
"';cg1name();";
if ($_POST['1shijian1']<>NULL)
$shijian1=" and COPTC.TC003>=".$_POST['1shijian1'];
else
$shijian1="";
if ($_POST['1shijian2']<>NULL)
$shijian2=" and COPTC.TC003<=".$_POST['1shijian2'];
else
$shijian2="";
require_once('i_code/connect.php');
$query="select leixing,xifen,sewen,ddgm,bztdb,daba,SUM(TD008) AS TD008,SUM(TA015)TA015,SUM(RKZS)RKZS,SUM(D310)D310,SUM(D305)D305,SUM(D304)D304,SUM(D3023)D3023,SUM(TH008)TH008,SUM(TJ007)TJ007
FROM chaxun
LEFT JOIN DDTJMX ON MA003=leixing and xifen=XIFEN AND sewen=DDTJMX.UDF10 AND ddgm=DDGM and daba=XINGHAO
left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002
where xifen<>'' and xifen<>'5050' and TC003>='20150110' AND TC003<='20150120'
GROUP BY leixing,xifen,sewen,ddgm,bztdb,daba
union all
select leixing,xifen,null as sewen,null as ddgm,bztdb,null as daba,SUM(TD008) AS TD008,SUM(TA015)TA015,SUM(RKZS)RKZS,SUM(D310)D310,SUM(D305)D305,SUM(D304)D304,SUM(D3023)D3023,SUM(TH008)TH008,SUM(TJ007)TJ007
FROM chaxun
LEFT JOIN DDTJMX ON MA003=leixing and xifen=XIFEN
left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002
where xifen='5050' and TC003>='20150110' AND TC003<='20150120'
GROUP BY leixing,xifen,bztdb
union all
select leixing,null as xifen,null as sewen,null as ddgm,bztdb, null as daba,SUM(TD008) AS TD008,SUM(TA015)TA015,SUM(RKZS)RKZS,SUM(D310)D310,SUM(D305)D305,SUM(D304)D304,SUM(D3023)D3023,SUM(TH008)TH008,SUM(TJ007)TJ007
FROM chaxun
LEFT JOIN DDTJMX ON MA003=leixing
left join COPTC on TC001=DDTJMX.TD001 AND TC002=DDTJMX.TD002
where xifen='' and TC003>='20150110' AND TC003<='20150120'
GROUP BY leixing,bztdb".$shijian1.$shijian2;
$result=mssql_query($query);
$row_num=mssql_num_rows($result);
if ($row_num<=10000 && $row_num>0)
{
echo "
while($row=mssql_fetch_assoc($result))
{
echo"
echo"
echo"
\n";
}
echo"
";echo "
類別 | ;
細分 | ;
色溫 | ;
訂單規模 | ;
標準投單比 | ;
打靶 | ;
訂單量 | ;
預計產量 | ;
總入庫數 | ;
標準入庫 | ;
銷貨數量 | ;
銷退數量 | ;
跟蹤資訊 | ;
";
";
".$row['leixing']." | "; echo"
".$row['xifen']." | "; echo"
".$row['sewen']." | "; echo"
".$row['ddgm']." | "; echo"
".$row['bztdb']." | "; echo"
".$row['daba']." | "; echo"
".number_format($row['TD008'],0)." | "; echo"
".number_format($row['TA015'],0)." | "; echo"
".number_format($row['RKZS'],0)." | "; echo"
".number_format($row['D310'],0)." | "; echo"
".number_format($row['TH008'],0)." | "; echo"
".number_format($row['TJ007'],0)." | "; echo"
跟蹤資訊 | "; //跟蹤資訊
";
echo'';
}
mssql_close($conn);
}
?>
現在一運行語句是錯的,是後面的語句裡面的查詢語句有錯,求指正。