| Current Path : /var/www/html/mmishra/iws8/html/istore/ |
| Current File : /var/www/html/mmishra/iws8/html/istore/inapproval.inc |
<h2 align='left'>Indent Approval</h2>
<center>
<table width='90%' border='1' style='border-collapse: collapse'>
<tr><th>No.</th><th>Indent No.</th><th>Dated</th><th>Indentor</th><th>Account</th><th>Location</th><th>Recommendor</th></tr>
<?php
$tbl = 'indents';
$indentno = $_REQUEST["indent_no"];
if ($_POST["submit"] == 'APPROVE') {
$id = $_POST['id'];
$qty_approve = $_POST['qty_approve'];
for ($k=0; $k < count($id); $k++) {
mysql_query("update indent_items set qty_approve=$qty_approve[$k] where id=$id[$k]");
}
mysql_query("update $tbl set status='Approved' where indent_no=$indentno");
//send status mail for available items
//get email of indentor
$rs = mysql_query("select * from employees where emp_no=(select emp_no from indents where indent_no=$indentno)");
if (mysql_num_rows($rs)) {
$o = mysql_fetch_object($rs);
$empname = $o->emp_name;
$email = $o->email;
//$email = 'mmishra@iiita.ac.in';
}
if ($email) {
$str = "Dear Indentor
<br><br>
With reference to your indent No. $indentno some items marked with <font size='+1' color='red'>*</font> are available readily in the stock.
Kindly collect them during 12 - 1 PM (Cleaning items) and 3 - 4 PM (Stationary & Crockery items) at your suitable convenience.
Remaining items, if any, may take some time as they are subject to purchase processing.
<br><br>" . available_items($indentno) . "<br><br>
Thanks,<br><br>";
automailer($email, "Indent Approval", $str);
//automailer('istore@iiita.ac.in', "Indent Approval", $str);
}
$indentno = 0;
} else if ($_POST["submit"] == 'CANCEL') {
mysql_query("update $tbl set status='Cancelled' where indent_no=$indentno");
}
//list pending indents
$rs = mysql_query("select * from $tbl where status='Pending' order by indent_no desc");
while ($o = mysql_fetch_object($rs)) {
$i++;
echo "<tr><td>$i</td><th><a href='?pg=$pg&indent_no=$o->indent_no'>$o->indent_no</a></th>
<td>$o->date_indent</td><td>".employee_detail($o->emp_no)."</td><td>$o->account</td>
<td>$o->location</td><td>$o->recommendation</td></tr>";
if ($indentno == $o->indent_no) {
echo "<tr><th colspan='7' align='center'><input type='hidden' name='indent_no' value='$indentno'>
<b>Purpose: $o->purpose</b>
<table width='90%' border='1' style='border-collapse: collapse' bgcolor='white'>
<tr><th>No.</th><th>Particulars</th><th>Qty Demand</th><th>Qty Out</th><th>Qty Approve</th><th>Approx Cost</th></tr>";
$sr = mysql_query("select * from indent_items where indent_no=$indentno order by item");
/* fetch values */
while ($q = mysql_fetch_object($sr)) {
$j++;
echo "<tr><td>$j <input type='hidden' name='item[]' value='$q->item'></td>
<td>".item_detail($q->item)."</td><td>$q->qty_demand $q->qty_unit</td><td>$q->qty_out</td>";
$qty_approve = (!$q->qty_approve ? $q->qty_demand : $q->qty_approve);
echo "<td><input type='text' name='qty_approve[]' value='$qty_approve' size='5'></td>
<td>Rs. $q->approx_cost <input type='hidden' name='id[]' value='$q->id'></td></tr>";
}
if ($j) {
echo "<tr><th colspan='5' align='center'><input type='submit' name='submit' value='APPROVE'></th>
<th><input type='submit' name='submit' value='CANCEL'></th></tr>";
}
echo "</table></td></tr>";
}
}
?>
</table>
</center>