Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/pcstore/report/
Upload File :
Current File : /var/www/html/mmishra/irp/pcstore/report/form_parts_issue.php

<?php
include "report_header.inc";

$submit = $_REQUEST["submit"];
$user_code = $_REQUEST["user_code"];
$parts_code = $_REQUEST["parts_code"];
$customer = customer($user_code, $con);

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><b>Customer: $customer</b></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, $con);
  while ($qd1 = mysql_fetch_array($rs1)){
    $i++;
    $parts_code1 = $qd1["parts_code"];
    $parts = parts($parts_code1, $con);
    $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 parts_receipt im on pm.item_code=im.row_id where pm.row_id=$parts_code1";
    $rs2 = mysql_query($sql2, $con);
    $qd2 = mysql_fetch_array($rs2);
    $category_code1 = $qd2["category_code"];
    $category = category($category_code1, $con);
    $item_code1 = $qd2["item_code"];
    $description = $qd2["description"];
    $model_make = $qd2["model_make"];
    $supplier_code1 = $qd2["supplier_code"];
    $supplier = supplier($supplier_code1, $con);
    $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</td><td>$model_make</td><td>$parts</td>";
    echo "<td>$supplier</td><td align='right' nowrap>Rs. $unit_price</td><td align='center'>$issue_date</td><td>$destination</td><tr>";
  }
  echo "</table><p><p><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, $con);
    $qd1 = mysql_fetch_array($rs1);
    $i++;

    $parts_code1 = $qd1["parts_code"];
    $parts = parts($parts_code1, $con);
    $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 parts_receipt im on pm.item_code=im.row_id where pm.row_id=$parts_code1";
    $rs2 = mysql_query($sql2, $con);
    $qd2 = mysql_fetch_array($rs2);
    $category_code1 = $qd2["category_code"];
    $category = category($category_code1, $con);
    $item_code1 = $qd2["item_code"];
    $description = $qd2["description"];
    $model_make = $qd2["model_make"];
    $supplier_code1 = $qd2["supplier_code"];
    $supplier = supplier($supplier_code1, $con);
    $unit_price = $qd2["unit_price"];
    echo "<tr bordercolor='gray'><td align='center'><font size=-1>$i</font></td>";
    echo "<td>$category</td><td>$model_make</td><td>$parts</td>";
    echo "<td>$supplier</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>Customers are requested to report defects in the above items (if any) within the warranty period, so that warranty can be claimed.<p><p>";
}

echo '<input type="button" value="PRINT" onClick="window.print()" />';
echo "</center";
include "report_footer.inc";

?>