Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/istore/staff/
Upload File :
Current File : /var/www/html/mmishra/istore/staff/indentors.inc

<h2 align='left'>Indentors</h2>

<?php

$tbl = 'indents';
$indentor = $_REQUEST["indentor"];
$indent_no = $_REQUEST["indent_no"];

if ($_POST["submit"] == 'SAVE') {
	$email = $_POST['email'];

	$rs = mysql_query("select * from $tbl where supplier_no=$supplier_no");
	if (mysql_num_rows($rs)) {
		mysql_query("update $tbl set firm_name='$firm_name',address='$address',contact='$contact',email='$email',
		date_updation=now(),login_id='$user' where supplier_no=$supplier_no");
	} else {
		mysql_query("insert into $tbl(firm_name,address,contact,email,date_creation,date_updation,login_id)
		values('$firm_name','$address','$contact','$email',now(),now(),'$user')");
	}
}

?>

<table width='95%' border='1' style='border-collapse: collapse'>
<tr><th>Sr</th><th>Indentor</th><th>Indents</th><th>Duration</th></tr>

<?php

$rs = mysql_query("select indentor,count(indent_no) as no,concat(min(indent_date),' to ',max(indent_date)) as duration from $tbl group by indentor");
/* fetch values */
while ($o = mysql_fetch_object($rs)) {
	$i++;
        echo "<tr valign='top'><td>$i</td>
        <td><a href='staff/?pg=$pg&indentor=$o->indentor'>".employee_detail($o->indentor)."</a></td>
        <td>$o->no</td>
        <td>$o->duration</td>
        </tr>";

	if ($indentor == $o->indentor) {
		echo "<tr valign='top'><td colspan='4' align='center'><b>Indents</b>
		<table width='90%' border='1' style='border-collapse: collapse'>
		<tr><th>Sr</th><th>Indent No</th><th>Fund Head</th><th>Department/Project/Purpose</th><th>Dated</th><th>Items</th><th>Status</th></tr>";

		$sr = mysql_query("select * from $tbl where indentor='$indentor' order by indent_date desc");
		while ($q = mysql_fetch_object($sr)) {
			$j++;
			echo "<tr><td>$j</td>
			<td><a href='staff/?pg=$pg&indentor=$indentor&indent_no=$q->indent_no'>$q->indent_no</a></td>
			<td>$q->fund_head</td>
			<td>".department_detail($q->purpose)."</td>
			<td>$q->indent_date</td>";
		        $ss = mysql_query("select count(item_no) as no from indent_items where indent_no=$q->indent_no");
                	while ($r = mysql_fetch_object($ss)) {
                        	echo "<td>$r->no</td>";
			}
			echo "<td>$q->status</td>
			</tr>";

			if ($indent_no == $q->indent_no) {
				echo "<tr valign='top'><td colspan='7' align='center'><b>Items</b>
				<table width='80%' border='1' style='border-collapse: collapse'>
				<tr><th>Sr</th><th>Particulars</th><th>Demanded Qty</th><th>Approved Qty</th><th>Issued Qty</th><th>Approx Cost</th></tr>";

		                $rr = mysql_query("select * from indent_items where indent_no=$indent_no order by item_no");
                		while ($s = mysql_fetch_object($rr)) {
                        		$k++;
                        		echo "<tr><td>$k</td>
                        		<td>".item_detail($s->item_no)."</td>
                        		<td>$s->demanded_qty</td>
                        		<td>$s->approved_qty</td>
                        		<td>$s->issued_qty</td>
                        		<td>$s->approx_cost</td>
                        		</tr>";
				}
				echo "</table></td></tr>";
			}
		}
		echo "</table></td></tr>";
	}
}
?>

</table>