📄 rpt_stk_blance.php
字号:
<?
include("../application.php");
$username=$SESSION["user"]["user_name"];
$unit_set=$SESSION["user"]["unit_set"];
include("rptheader.php");
//$sql_list="SELECT stock_detail.stock_id,stock_detail.site_id,stock_product.group_id,stock_product.color, stock_detail.product_id,SUM(if(stock_detail.op_date<'$op_date',concat(stock_detail.type , stock_detail.qty),0)) as last_qty,stock_product.model,SUM(if(stock_detail.type='+' ,if(stock_detail.op_date='$op_date',stock_detail.qty,0 ),0) ) as qty_in,SUM(if(stock_detail.type='-' ,if(stock_detail.op_date='$op_date',stock_detail.qty,0 ),0) ) as qty_out ,SUM(concat(stock_detail.type , stock_detail.qty)) as bf_qty,stock_product.remarks as remark FROM stock_detail ,stock_product_group,stock_product WHERE stock_product_group.group_id=stock_product.group_id AND stock_product.product_id=stock_detail.product_id AND stock_detail.log_status='1' AND stock_detail.site_id='$site_id' AND stock_detail.op_date<='$op_date' ";
$sql_list="SELECT ".$data_style."stock_detail.stock_id,".$data_style."stock_detail.site_id,stock_product.group_id, ".$data_style."stock_detail.product_id,SUM(if(".$data_style."stock_detail.op_date<='$op_date',concat(".$data_style."stock_detail.type , ".$data_style."stock_detail.qty),0)) as last_qty,stock_product.model,stock_product.model,stock_product.color,SUM(if(".$data_style."stock_detail.type='+' ,if(".$data_style."stock_detail.op_date>'$op_date'&&".$data_style."stock_detail.op_date<='$to_date',".$data_style."stock_detail.qty,0 ),0) ) as qty_in,SUM(if(".$data_style."stock_detail.type='-',if(".$data_style."stock_detail.op_date>'$op_date'&&".$data_style."stock_detail.op_date<='$to_date',".$data_style."stock_detail.qty,0 ),0) ) as qty_out ,SUM(concat(".$data_style."stock_detail.type , ".$data_style."stock_detail.qty)) as bf_qty,stock_product.remarks as remark FROM ".$data_style."stock_detail ,stock_product_group,stock_product WHERE stock_product_group.group_id=stock_product.group_id AND stock_product.product_id=".$data_style."stock_detail.product_id AND ".$data_style."stock_detail.log_status='1' AND ".$data_style."stock_detail.site_id='$site_id' AND ".$data_style."stock_detail.op_date<='$to_date'";
$sql_list.=" AND ".$data_style."stock_detail.doc_type NOT IN ('".get_not_inven()."')";
if($group_id<>"")$sql_list.=" AND stock_product_group.group_id='$group_id'";
if($product_id<>"")$sql_list.=" AND ".$data_style."stock_detail.product_id='$product_id'";
$sql_list.=" GROUP BY stock_product.product_id";
if($show_zero=="1")$sql_list.=" HAVING bf_qty > 0";
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1" bordercolor="#000000" bgcolor="#ffffff" >
<tr bgcolor="#ffffff">
<td align ="left" class="txtThai" colspan="2">Hitachi Transport System (Thailand ) Co.,Ltd.<br></td>
<td align ="right" class="txtThai" height='20'>User Print : <?echo $username;?></td>
</tr>
<tr bgcolor="#ffffff">
<td align ="left" class="txtThai">STOCK BLANCE : <?echo $group_id;?></td>
<td align ="center" class="txtThai">DATE BLANCE : <b><?
list($op_year,$op_month,$op_day)= split ("-", $to_date, 3);
echo $op_day." ".engmonth($op_month)." ".$op_year;
?></b></td>
<td align ="right" class="txtThai" height='20'>Date Print : <?echo date('y-m-d');?></td>
</tr>
<tr bgcolor="#ffffff">
<td align ="left" class="txtThai" colspan="2">CUSTOMMER : <?echo site_info($site_id);?></td>
<td align ="right" class="txtThai" height='20'>Time Print : <?echo date('h:i:s');?></td>
</tr>
</table>
<br>
<DIV class=outerframe>
<table border="1" bgcolor="#ffffff" bordercolor="#000000" cellspacing="0" cellpadding="1" width="100%">
<THEAD>
<tr>
<td align="center" width="5%" class="txtThaiB" height="30"><b>Item</td>
<td align="center" class="txtThaiLB"><font color="#000000"><b>Part</font>
</td>
<td align="center" class="txtThaiLB"><font color="#000000"><b>Model </font>
</td>
<td align="center" class="txtThaiLB"><font color="#000000"><b>Color </font>
</td>
<td align="center" class="txtThaiLB"><font color="#000000"><b>Last Balance</font>
</td>
<td align="center" class="txtThaiLB" width="40"><font color="#000000"><b>IN</font>
</td>
<td align="center" class="txtThaiLB" width="40"><font color="#000000"><b>OUT</font>
</td>
<td align="center" class="txtThaiLB"><font color="#000000"><b>This Balance</font>
</td>
<td align="center" class="txtThaiLB" width="15%"><font color="#000000"><b>Remark</font>
</td>
</tr>
</THEAD>
</DIV>
<DIV class=innerframe>
<?
$row=0;
$last_qty=0;
$qty_in=0;
$qty_out=0;
$bf_qty=0;
$qid = db_query($sql_list);
while ($r = db_fetch_object($qid)) {
$row++;
$last_qty+=$r->last_qty;
$qty_in+=$r->qty_in;
$qty_out+=$r->qty_out;
$bf_qty+=$r->bf_qty;
?>
<tr bgcolor="#ffffff">
<td align="center" class="txtThaiB" ><?echo $row;?> </td>
<td align="left" class="txtThaiLB" > <?echo $r->product_id;?></td>
<td align="left" class="txtThaiLB" > <?echo $r->model;?></td>
<td align="left" class="txtThaiLB" > <?echo $r->color;?></td>
<td align="right" class="txtThaiLB" ><?echo number_format($r->last_qty,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiLB" ><?echo number_format($r->qty_in,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiLB" ><?echo number_format($r->qty_out,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiLB" ><?echo number_format($r->bf_qty,$unit_set,'.',',');?> </td>
<td align="left" class="txtThaiLB" > <?echo $r->remark;?></td>
</tr>
<?}?>
<tr>
<td colspan="4" align="center" class="txtThai">TOTAL</td>
<td align="right" class="txtThaiL"><?echo number_format($last_qty,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($qty_in,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($qty_out,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($bf_qty,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiL"> </td>
</tr>
</DIV>
</table>
<script language="javascript">
print_pv(7);
this.window.close();
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -