| Current Path : /var/www/html/mmishra/irp/irp/pcstore/ |
| Current File : /var/www/html/mmishra/irp/irp/pcstore/issue_form.php |
<?php
include "report_header.inc";
$submit = $_REQUEST["submit"];
$user_code = $_REQUEST["user_code"];
$parts_code = $_REQUEST["parts_code"];
$user_detail = user_detail($user_code, $link_id);
echo "<center><b><u><font color='red'>Issue/Receipt Form</font></u></b><p><br>";
echo "<table width='100%' frame='void' cellpadding='1' cellspacing='0'>";
echo "<tr><td nowrap>User: $user_detail</td><td nowrap align='right'>Date: " . date("d-m-Y") . "</td><tr>";
echo "</table><p>";
if ($user_code == "") echo "Nothing issued";
echo "<table width='100%' border='1' cellspacing='0' cellpadding='1' bordercolor='black' bordercolordark='white' frame='box'>";
echo "<tr><th>No.</th><th>Item</th><th>Model/Make</th><th>Parts Code</th><th>Supplier</th><th nowrap>Unit Price</th><th nowrap>Issue Date</th><th>Purpose</th><tr>";
$quantity = 1;
if ($submit != "PRINT SELECTED"){
$sql1 = "select * from parts_issued where user_code=$user_code";
$rs1 = mysql_query($sql1, $link_id);
while ($qd1 = mysql_fetch_array($rs1)){
$i++;
$parts_code1 = $qd1["parts_code"];
$parts_detail = parts_detail($parts_code1, $link_id);
$issue_date = $qd1["issue_date"];
$destination = $qd1["destination"];
$sql2 = "select pm.item_code, im.category_code, im.description, im.model_make, im.supplier_code, im.unit_price from parts_master pm left join item_master im on pm.item_code=im.row_id where pm.row_id=$parts_code1";
$rs2 = mysql_query($sql2, $link_id);
$qd2 = mysql_fetch_array($rs2);
$category_code1 = $qd2["category_code"];
$category_detail = category_detail($category_code1, $link_id);
$item_code1 = $qd2["item_code"];
$description = $qd2["description"];
$model_make = $qd2["model_make"];
$supplier_code1 = $qd2["supplier_code"];
$supplier_detail = supplier_detail($supplier_code1, $link_id);
$unit_price = $qd2["unit_price"];
echo "<tr bordercolor='gray'><td align='center' nowrap>$i <input type='checkbox' name='parts_code[]' value='$parts_code1'";
if ($submit == "SELECT ALL") echo " checked";
echo "></td><td>$category_detail</td><td>$model_make</td><td>$parts_detail</td>";
echo "<td>$supplier_detail</td><td align='right' nowrap>Rs. $unit_price</td><td align='center'>$issue_date</td><td>$destination</td><tr>";
}
echo "</table><input type='submit' name='submit' value='SELECT ALL'>";
echo "<input type='submit' name='submit' value='PRINT SELECTED'><input type='hidden' name='user_code' value='$user_code'>";
}else{
foreach ($parts_code as $s){
$sql1 = "select * from parts_issued where parts_code=$s";
$rs1 = mysql_query($sql1, $link_id);
$qd1 = mysql_fetch_array($rs1);
$i++;
$parts_code1 = $qd1["parts_code"];
$parts_detail = parts_detail($parts_code1, $link_id);
$issue_date = $qd1["issue_date"];
$destination = $qd1["destination"];
$sql2 = "select pm.item_code, im.category_code, im.description, im.model_make, im.supplier_code, im.unit_price from parts_master pm left
join item_master im on pm.item_code=im.row_id where pm.row_id=$parts_code1";
$rs2 = mysql_query($sql2, $link_id);
$qd2 = mysql_fetch_array($rs2);
$category_code1 = $qd2["category_code"];
$category_detail = category_detail($category_code1, $link_id);
$item_code1 = $qd2["item_code"];
$description = $qd2["description"];
$model_make = $qd2["model_make"];
$supplier_code1 = $qd2["supplier_code"];
$supplier_detail = supplier_detail($supplier_code1, $link_id);
$unit_price = $qd2["unit_price"];
echo "<tr bordercolor='gray'><td align='center'><font size=-1>$i</font></td>";
echo "<td>$category_detail</td><td>$model_make</td><td>$parts_detail</td>";
echo "<td>$supplier_detail</td><td align='right' nowrap>Rs. $unit_price</td><td align='center'>$issue_date</td>
<td>$destination</td><tr>";
$total_cost += $unit_price;
}
$total_cost = number_format($total_cost, 2);
echo "<tr><th colspan='6' align='right'>Total $i Items Worth Rs. $total_cost</th><td colspan='2'>(approx.)</td></tr></table><p>";
echo "<table width='100%'>";
echo "<tr><td><p><p>Received above items in good condition.<p></td><td align='right'><p><p>Sanctioned By<p></td></tr>";
echo "<tr><td><br><br>$name<br>$category</td><td align='right'><br><br>Issued By</td></tr>";
echo "</table><p>Users are requested to report defects in the above items (if any) within the warranty period, so that warranty can be claimed.";
}
include "report_footer.inc";
?>