index1.php
来自「极限网络智能办公系统 - Office Automation 2008 官方10」· PHP 代码 · 共 164 行
PHP
164 行
<?php
function GETALLDATE( $CODE, $GETVALUE )
{
global $connection;
$query = "SELECT * from SYS_CODE where PARENT_NO='".$CODE."'";
$connection = openconnection( );
$cursor = exequery( $connection, $query );
echo "<option value= ></option>";
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$CODE_NO = $ROW['CODE_NO'];
$CODE_NAME = $ROW['CODE_NAME'];
if ( $CODE_NO == $GETVALUE )
{
echo "<option value=".$CODE_NO." selected>".$CODE_NAME."</option>";
}
else
{
echo "<option value=".$CODE_NO." >".$CODE_NAME."</option>";
}
}
}
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
$PAGE_SIZE = 10;
echo "\r\n<html>\r\n<head>\r\n<title>产品库存查询 </title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n<script Language=\"JavaScript\">\r\nfunction chk(input,strwher)\r\n {\r\n URL=\"list1.php?\"+strwher+\"&SUMFIELD=\"+input.value;\r\n myleft=(screen.availWidth-650)/2;\r\n window.open(URL,\"formul_edit\",\"height=350,width=650,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left=\"+myleft+\",resizable=yes\");\r\n }\r\n\r\nfunction LoadWindow1(ARRAY_FIELD,graphValues1,graphValues2,graphValues3,showname,type)\r\n {\r\n URL=\"statics?ARRAY_FIELD=\"+ARRAY_FIELD+\"&graphValues1=\"+graphValues1+\"&graphValues2=\"+graphValues2+\"&graphValues3=\"+graphValues3+\"&showname=\"+showname+\"&type=\"+type;\r\n myleft=(screen.availWidth-650)/2;\r\n window.open(URL,\"formul_edit\",\"height=350,width=650,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left=\"+myleft+\",resizable=yes\");\r\n }\r\n\r\nfunction show_detail(PRODUCT_ID)\r\n {\r\n URL=\"detail.php?PRODUCT_ID=\"+PRODUCT_ID;\r\n myleft=(screen.availWidth-650)/2;\r\n window.open(URL,\"product\",\"height=350,width=650,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left=\"+myleft+\",resizable=yes\");\r\n }\r\n</script>\r\n</head>\r\n<body topmargin=\"5\" class=\"bodycolor\">\r\n<div align=\"left\">\r\n<fieldset style=\"width:95%;padding-bottom:5px;\">\r\n\t <legend class=\"small\" align=left>\r\n <b>快速查询</b>\r\n </legend>\r\n<table class=\"TableList\" align=\"left\" width=\"100%\">\r\n <form action=\"index1.php\" method=\"post\" name=\"form1\">\r\n <tr>\r\n \t<td nowrap class=\"TableData\"> 产品类别:</td>\r\n <td nowrap class=\"TableData\">\r\n <select name=\"PRODUCT_MODE\" class=\"SmallSelect\">\r\n";
getalldate( "PRODUCT_MODE", $PRODUCT_MODE );
echo " </select>\r\n </td>\r\n <td nowrap class=\"TableData\">产品名称: </td>\r\n <td nowrap class=\"TableData\">\r\n <input type=\"text\" name=\"PRODUCT_NAME\" value=\"";
echo $PRODUCT_NAME;
echo "\" class=\"SmallInput\" size=\"15\" maxlength=\"100\">\r\n </td>\r\n <td nowrap class=\"TableData\">产品型号: </td>\r\n <td nowrap class=\"TableData\">\r\n <input type=\"text\" name=\"PRODUCT_TYPE\" value=\"";
echo $PRODUCT_TYPE;
echo "\" class=\"SmallInput\" size=\"15\" maxlength=\"100\">\r\n </td>\r\n </tr>\r\n </tr>\r\n <tr>\r\n <td nowrap class=\"TableData\"> 警戒库存: </td>\r\n <td nowrap class=\"TableData\">\r\n <input type=\"text\" name=\"PRODUCT_LOWSTOCK1\" value=\"";
echo $PRODUCT_LOWSTOCK1;
echo "\" class=\"SmallInput\" size=\"5\" maxlength=\"100\">\r\n\t\t-\r\n <input type=\"text\" name=\"PRODUCT_LOWSTOCK2\" value=\"";
echo $PRODUCT_LOWSTOCK2;
echo "\" class=\"SmallInput\" size=\"5\" maxlength=\"100\">\r\n </td>\r\n <td nowrap class=\"TableData\">当前库存: </td>\r\n <td nowrap class=\"TableData\">\r\n <input type=\"text\" name=\"TOTAL_AMT1\" value=\"";
echo $TOTAL_AMT1;
echo "\" class=\"SmallInput\" size=\"5\" maxlength=\"100\">\r\n\t\t-\r\n <input type=\"text\" name=\"TOTAL_AMT2\" value=\"";
echo $TOTAL_AMT2;
echo "\" class=\"SmallInput\" size=\"5\" maxlength=\"100\">\r\n </td>\r\n \t<td nowrap class=\"TableData\">总金额: </td>\r\n \t<td nowrap class=\"TableData\">\r\n <input type=\"text\" name=\"TOTAL_PRICE1\" size=\"5\" maxlength=\"10\" class=\"SmallInput\" value=\"";
echo $TOTAL_PRICE1;
echo "\">\r\n 至<input type=\"text\" name=\"TOTAL_PRICE2\" size=\"5\" maxlength=\"10\" class=\"SmallInput\" value=\"";
echo $TOTAL_PRICE2;
echo "\">\r\n </tr>\r\n <tr>\r\n \t<td nowrap class=\"TableData\" colspan=\"6\" >\r\n \t <input value=\"快速查询\" type=\"submit\" class=\"SmallButton\" title=\"快速查询\" name=\"button\">\r\n </td>\r\n </tr>\r\n</form>\r\n</table>\r\n</fieldset>\r\n</div>\r\n<br>\r\n";
if ( $ORDERFIELD != "" )
{
if ( $ORDERSIGN == "DOWN" )
{
$ORDERTYPE = "ASC";
}
if ( $ORDERSIGN == "UP" )
{
$ORDERTYPE = "DESC";
}
$OREDERBY = " ORDER BY ".$ORDERFIELD." ".$ORDERTYPE;
}
$HAVING_STR = " HAVING 1=1";
if ( $PRODUCT_NAME != "" )
{
$WHERE_STR .= " and PRODUCT_NAME like '%".$PRODUCT_NAME."%'";
}
if ( $PRODUCT_MODE != "" )
{
$WHERE_STR .= " and PRODUCT_MODE ='".$PRODUCT_MODE."'";
}
if ( $PRODUCT_TYPE != "" )
{
$WHERE_STR .= " and PRODUCT_TYPE like '%".$PRODUCT_TYPE."%'";
}
if ( $PRODUCT_LOWSTOCK1 != "" )
{
$WHERE_STR .= " and PRODUCT_LOWSTOCK>='".$PRODUCT_LOWSTOCK1."'";
}
if ( $PRODUCT_LOWSTOCK2 != "" )
{
$WHERE_STR .= " and PRODUCT_LOWSTOCK<='".$PRODUCT_LOWSTOCK2."'";
}
if ( $TOTAL_PRICE1 != "" )
{
$HAVING_STR .= " and sum(PRICE*AMT)>='".$TOTAL_PRICE1."'";
}
if ( $TOTAL_PRICE2 != "" )
{
$HAVING_STR .= " and sum(PRICE*AMT)<='".$TOTAL_PRICE2."'";
}
if ( $TOTAL_AMT1 != "" )
{
$HAVING_STR .= " and TOTAL_AMT>='".$TOTAL_AMT1."'";
}
if ( $TOTAL_AMT2 != "" )
{
$HAVING_STR .= " and TOTAL_AMT<='".$TOTAL_AMT2."'";
}
$query1 = "SELECT STOCK.PRODUCT_ID,MEASURE_UNIT,PRODUCT_NAME,WH_ID,PRODUCT_LOWSTOCK,sum(PRICE*AMT) TOTAL_PRICE,sum(AMT) TOTAL_AMT\r\n\t from STOCK left join PRODUCT on PRODUCT.PRODUCT_ID=STOCK.PRODUCT_ID where WH_ID<>0".$WHERE_STR." GROUP BY STOCK.PRODUCT_ID {$HAVING_STR}".$OREDERBY;
$cursor1 = exequery( $connection, $query1 );
$STOCK_COUNT = 0;
$LOWSTOCK_COUNT = 0;
while ( $ROW = mysql_fetch_array( $cursor1 ) )
{
++$STOCK_COUNT;
$WH_ID0 = $WH_ID1;
$WH_ID1 = $ROW['WH_ID'];
$PRODUCT_ID = $ROW['PRODUCT_ID'];
$PRODUCT_NAME = $ROW['PRODUCT_NAME'];
$MEASURE_UNIT = $ROW['MEASURE_UNIT'];
$PRODUCT_LOWSTOCK = $ROW['PRODUCT_LOWSTOCK'];
$TOTAL_PRICE = $ROW['TOTAL_PRICE'];
$TOTAL_AMT = $ROW['TOTAL_AMT'];
$ERROR_AMT = $TOTAL_AMT - $PRODUCT_LOWSTOCK;
if ( $STOCK_COUNT % 2 == 0 )
{
$TableLine = "TableLine1";
}
else
{
$TableLine = "TableLine2";
}
if ( $STOCK_COUNT == 1 )
{
echo "<table border=\"0\" cellspacing=\"1\" width=\"95%\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\">\r\n";
}
echo " <tr class=\"";
echo $TableLine;
echo "\">\r\n <td nowrap align=\"center\">";
if ( $TOTAL_AMT < $PRODUCT_LOWSTOCK )
{
echo "<font color=red>";
}
echo $PRODUCT_NAME;
if ( $TOTAL_AMT < $PRODUCT_LOWSTOCK )
{
echo "</font>";
}
echo "</td>\r\n <td nowrap align=\"center\">";
echo $MEASURE_UNIT;
echo "</td>\r\n <td nowrap align=\"center\">";
echo $PRODUCT_LOWSTOCK;
echo "</td>\r\n <td nowrap align=\"center\">";
echo $TOTAL_AMT;
echo "</td>\r\n <td nowrap align=\"center\">";
echo $ERROR_AMT;
echo "</td>\r\n <td nowrap align=\"center\">";
echo $TOTAL_PRICE;
echo "</td>\r\n <td nowrap align=\"center\"> <a href=\"javascript:show_detail(";
echo $PRODUCT_ID;
echo ");\"> 详细信息 </a></td>\r\n </tr>\r\n\r\n";
}
if ( $STOCK_COUNT == 0 )
{
message( "", "无库存统计" );
exit( );
}
echo " <thead class=\"TableHeader\">\r\n <TD>产品名称</TD>\r\n <TD>单位</TD>\r\n <TD>警戒库存</TD>\r\n <TD>当前库存</TD>\r\n <TD>超限数目</TD>\r\n <TD>总金额</TD>\r\n <TD>详细信息</TD>\r\n </thead>\r\n</table>\r\n<br>\r\n";
if ( 0 < $STOCK_COUNT )
{
message( "", "共有产品 ".$STOCK_COUNT." 个" );
exit( );
}
echo "</body>\r\n</html>";
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?