📄 rpt_stk_blance2.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_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 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,stock_product.model,SUM(concat(".$data_style."stock_detail.type , ".$data_style."stock_detail.qty)) as bf_qty 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<='$op_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 ("-", $op_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" height="30" width="5%" class="txtThaiB" rowspan="2" ><b>Item</td>
<td align="center" class="txtThaiLB" rowspan="2" width="15%"><font color="#000000" ><b>Part</font>
</td>
<td align="center" class="txtThaiLB" rowspan="2" width="35%"><font color="#000000"><b>Description </font>
</td>
<td align="center" class="txtThaiLB" width="15%"><font color="#000000" ><b>RAYONG</font>
</td>
<td align="center" class="txtThaiLB" rowspan="2" width="15%"><font color="#000000"><b>SUMRONG</font>
</td>
<td align="center" class="txtThaiLB" rowspan="2" width="15%"><font color="#000000"><b>TOTAL</font>
</td>
</tr>
<!-- <tr>
<td align="center" class="txtThai"><font color="#000000" ><b>Today B/F</font></td>
<td align="center" class="txtThai" width="40" ><font color="#000000"><b>IN</font> </td>
<td align="center" class="txtThai" width="40" ><font color="#000000"><b>OUT</font> </td>
<td align="center" class="txtThai" ><font color="#000000"><b>Bal</font>
</td>
</tr> -->
</THEAD>
</DIV>
<DIV class=innerframe>
<?
$row=0;
$last_qty=0;
$qty_in=0;
$qty_out=0;
$bf_qty=0;
$ttlqty=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;
$sumrong=get_import_data($op_date,$r->product_id);
$ttlqty+=$sumrong;
?>
<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="right" class="txtThaiLB"><?//echo number_format($r->last_qty,0,'.',',');?> </td>
<td align="right" class="txtThaiLB"><?//echo number_format($r->qty_in,0,'.',',');?> </td>
<td align="right" class="txtThaiLB"><?//echo number_format($r->qty_out,0,'.',',');?> </td> -->
<td align="right" class="txtThaiLB"><?echo number_format($r->bf_qty,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiLB"><?echo $sumrong;?> </td>
<td align="right" class="txtThaiLB"><?echo number_format($sumrong+$r->bf_qty,$unit_set,'.',',');?> </td>
</tr>
<?}?>
<tr>
<td colspan="3" align="center" class="txtThai">TOTAL</td>
<!-- <td align="right" class="txtThaiL"><?echo number_format($last_qty,0,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($qty_in,0,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($qty_out,0,'.',',');?> </td> -->
<td align="right" class="txtThaiL"><?echo number_format($bf_qty,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($ttlqty,$unit_set,'.',',');?> </td>
<td align="right" class="txtThaiL"><?echo number_format($ttlqty,$unit_set,'.',',');?> </td>
</tr>
<?
function get_import_data($op_date,$product_id){
$sql="SELECT qty FROM stock_import WHERE op_date='$op_date' AND product_id='$product_id' ";
$qid=db_query($sql);
$frm=db_fetch_array($qid);
return $frm[0];
}
?>
</DIV>
</table>
<script language="javascript">
print_pv(7);
this.window.close();
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -