query("set names 'utf8'"); //utf8防止乱码 if(!$dbConnect){ exit('数据库连接失败!'); } if(!empty($_POST["selectSub"])){ $keyword1 = $_POST["ckdm"]; $keyword2 = $_POST["spdm"]; if($keyword1 == "" || $keyword2 == "" ){ echo ""; }else{ $data = mysqli_query($dbConnect, "select distinct lxmc,djmc,djbh,qrrq,dm1,spdm,ckj,GG1DM, sum(case when GG2DM='X210' or GG2DM='T195' then -SL else null end) as wz1, sum(case when GG2DM='215' or GG2DM='T200' then -SL else null end) as wz2, sum(case when GG2DM='220' or GG2DM='205' then -SL else null end) as wz3, sum(case when GG2DM='225' or GG2DM='210' then -SL else null end) as wz4, sum(case when GG2DM='230' or GG2DM='T215' then -SL else null end) as wz5, sum(case when GG2DM='235' or GG2DM='T220' then -SL else null end) as wz6, sum(case when GG2DM='240' or GG2DM='T225' then -SL else null end) as wz7, sum(case when GG2DM='245' or gg2dm='T230' then -SL else null end) as wz8, sum(case when GG2DM='250' or gg2dm='T235' then -SL else null end) as wz9, sum(case when GG2DM='255' then -SL else null end) as wz10, sum(case when GG2DM='260' then -SL else null end) as wz11, sum(case when GG2DM='265' then -SL else null end) as wz12, sum(case when GG2DM='270' then -SL else null end) as wz13, sum(case when GG2DM='275' then -SL else null end) as wz14, sum(case when GG2DM='280' then -SL else null end) as wz15, sum(case when GG2DM='000' then -SL else null end) as wz16 from v_jxc where spdm like '%".$keyword2."%' and dm1 like '%".$keyword1."%' GROUP BY lxmc,djmc,djbh,qrrq,dm1,spdm,ckj,GG1DM order by qrrq desc limit 300 "); if($data){ echo "
类型名称
单据名称
单据编号
确认日期
客户代码
商品代码
出库价格
颜色代码
X210
T195
215
T200
220
205
225
210
230
T215
235
T220
240
T225
245
T230
250
T235
255
260
265
270
275
280
均码
"; while ($row = mysqli_fetch_array($data)){ echo '
'; echo "
$row[0]
$row[1]
$row[2]
$row[3]
$row[4]
$row[5]
$row[6]
$row[7]
$row[8]
$row[9]
$row[10]
$row[11]
$row[12]
$row[13]
$row[14]
$row[15]
$row[16]
$row[17]
$row[18]
$row[19]
$row[20]
$row[21]
$row[22]
$row[23]
"; echo '
'; } echo '
'; } } } mysqli_close($dbConnect); ?>