ESH/inventory_report.php
2024-10-23 18:28:06 +05:30

152 lines
4.7 KiB
PHP

<?php
include('pdf_header_reverse.php');
//include('pop_up_top.php');
?>
<html>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<?php
$warehouse_id = $_REQUEST['warehouseId9'];
$item_id = $_REQUEST['item_id9'];
if($item_id=='1')
{
$item_name='ALL';
}
else
{
$sql_item_name = "select drawing_details from vender_tbl_po_code where drawing_id = '".$item_id."'";
$res_item_name= @mysqli_query($conn,$sql_item_name);
$row_item_name = @mysqli_fetch_array($res_item_name);
$item_name= $row_item_name['drawing_details'];
}
if($warehouse_id=='1')
{
$warehouse_name='ALL';
}
else
{
$sql_warehouse = "select warehouse_name from warehouse_master where ware_id = '".$warehouse_id."'";
$res_warehouse= @mysqli_query($conn,$sql_warehouse);
$row_warehouse = @mysqli_fetch_array($res_warehouse);
$warehouse_name= $row_warehouse['warehouse_name'];
}
?>
<?php
if($_REQUEST['report9']=='Inventory')
{
$report="INVENTORY ";
}
?>
<table width="100%" >
<tr><div style="font-size:12px">
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size:17px"><strong><?php echo $report?> REPORT</strong></td>
<td width="25%" align="right"> User : <?php echo $username ?></td>
</tr>
<tr>
<tr><div align="center" style="font-size:12px">
<?php
$sql_firm = "select firm_name from tbl_firms where firm_id = '".$_REQUEST['firm_id9']."'";
$res_firm = @mysqli_query($conn,$sql_firm);
$row_firm = @mysqli_fetch_array($res_firm);
?>
<td align="left"><b><?php echo $row_firm['firm_name']?>, <?php echo $warehouse_name?></b> </td>
<td align="center"></td>
<td align="right"><b><?php echo $item_name?></b></td>
</div></tr>
</table>
<hr>
<table width="100%" border="1" cellspacing="0" cellpadding="0" style="font:Arial, Helvetica, sans-serif; font-size:8px;" >
<tr bgcolor="#eeeeee" border="1"><strong>
<td width="3%" align="center">Sr</td>
<td width="8%" align="left">Warehouse</td>
<td width="60%" align="left">Item Code - Item Description</td>
<td width="6%" align="right">Inventory Qty</td>
<td width="7%" align="right">Available Qty</td>
<td width="7%" align="right">Commit Qty</td>
</tr></strong>
<?php
if($_REQUEST['report9']=='Inventory') {
$count=1;
?>
<?php
if($_REQUEST['warehouseId9']=='1')
{
if($_REQUEST['item_id9']=='1')
{
$sql_item=" select * from item_stock where warehouse_id in (select ware_id from user_warehouse where user_id = '".$_SESSION['user_id']."') ";
}
else
{
$sql_item=" select * from item_stock where item_code_id in (select item_code_id from item_stock where item_code_id='".$_REQUEST['item_id9']."') and warehouse_id in (select ware_id from user_warehouse where user_id = '".$_SESSION['user_id']."') ";
}
}
else
{
if($_REQUEST['item_id9']=='1')
{
$sql_item=" select * from item_stock where warehouse_id = '".$_REQUEST['warehouseId9']."' and warehouse_id in (select ware_id from user_warehouse where user_id = '".$_SESSION['user_id']."') ";
}
else
{
$sql_item="select * from item_stock where warehouse_id = '".$_REQUEST['warehouseId9']."' and item_code_id in (select item_code_id from item_stock where item_code_id='".$_REQUEST['item_id9']."') and warehouse_id in (select ware_id from user_warehouse where user_id = '".$_SESSION['user_id']."') ";
}
}
$res_item = @mysqli_query($conn,$sql_item);
while($row_item = @mysqli_fetch_array($res_item))
{
@extract($row_item);
$sql_warehouse = "select warehouse_name from warehouse_master where ware_id = '".$warehouse_id."'";
$res_warehouse = @mysqli_query($conn,$sql_warehouse);
$row_warehouse = @mysqli_fetch_array($res_warehouse);
$warehouse = $row_warehouse['warehouse_name'];
$sql_qry_item = "select drawing_details, remarks from vender_tbl_po_code where drawing_id = '".$row_item['item_code_id']."' ";
$res_qry = @mysqli_query($conn,$sql_qry_item);
$row_qry_item = @mysqli_fetch_array($res_qry);
$sql_unit = "select unit_name from unit_master where unit_id = '".$row_item['unit_id']."' ";
$res_unit = @mysqli_query($conn,$sql_unit);
$row_unit = @mysqli_fetch_array($res_unit);
if($commit_qty=='0') $commit_qty = '-';
?>
<tr valign="top">
<td align="center" valign="top"><?php echo $count?></td>
<td align="left" valign="top"><?php echo $warehouse?></td>
<td align="left" valign="top"><?php echo $row_qry_item['drawing_details']?>,<?php echo $row_qry_item['remarks']?></td>
<td align="right" valign="top"><?php echo $row_item['inventory_qty']?>-<?php echo $row_unit['unit_name']?></td>
<td align="right" valign="top"><?php echo $row_item['available_qty']?>-<?php echo $row_unit['unit_name']?></td>
<td align="center" valign="top"><?php echo $commit_qty?></td>
</tr>
<?php
$count++;
}
}
?>
</table>
<hr>
</body>
</html>
<?php
include('pdf_footer.php');
?>