Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/
Upload File :
Current File : /var/www/html/mmishra/indem/booking.inc

<span id='title'>Booking for Effervescence T-Shirt</span><br>

<?php
$tbl = "booking";
if (!isset($_SESSION["uid"])) {
	login($pg);
} else {
	$uid = strtolower($_SESSION["uid"]);
	$id = $_REQUEST["id"];
	if ($_POST["submit"] == "SUBMIT") {
		$qty_gs = $_POST["qty_gs"];
		if (!$qty_gs) $qty_gs = 0;
		$qty_gm = $_POST["qty_gm"];
		if (!$qty_gm) $qty_gm = 0;
		$qty_gl = $_POST["qty_gl"];
		if (!$qty_gl) $qty_gl = 0;
		$qty_gxl = $_POST["qty_gxl"];
		if (!$qty_gxl) $qty_gxl = 0;
		$qty_gxxl = $_POST["qty_gxxl"];
		if (!$qty_gxxl) $qty_gxxl = 0;

                $qty_ls = $_POST["qty_ls"];
                if (!$qty_ls) $qty_ls = 0;
                $qty_lm = $_POST["qty_lm"];
                if (!$qty_lm) $qty_lm = 0;
                $qty_ll = $_POST["qty_ll"];
                if (!$qty_ll) $qty_ll = 0;
                $qty_lxl = $_POST["qty_lxl"];
                if (!$qty_lxl) $qty_lxl = 0;
                $qty_lxxl = $_POST["qty_lxxl"];
                if (!$qty_lxxl) $qty_lxxl = 0;
		
		$ip = $_SERVER["REMOTE_ADDR"];
		
        	if (($qty_gs + $qty_gm + $qty_gl + $qty_gxl + $qty_gxxl + $qty_ls + $qty_lm + $qty_ll + $qty_lxl + $qty_lxxl) >0) {
			if (mysql_num_rows(mysql_query("select * from $tbl where uid='$uid'"))) {
               			mysql_query("update $tbl set 
				qty_gs=$qty_gs,qty_gm=$qty_gm,qty_gl=$qty_gl,qty_gxl=$qty_gxl,qty_gxxl=$qty_gxxl,
				qty_ls=$qty_ls,qty_lm=$qty_lm,qty_ll=$qty_ll,qty_lxl=$qty_lxl,qty_lxxl=$qty_lxxl,
				dated=now(),ip='$ip' where uid='$uid'");
				echo "<br><b>Your order was already placed, which has been updated now.</b><br>";
        		} else {
               			mysql_query("insert into $tbl(uid,batch,
				qty_gs,qty_gm,qty_gl,qty_gxl,qty_gxxl,
				qty_ls,qty_lm,qty_ll,qty_lxl,qty_lxxl,
				dated,ip) 
				values('$uid','" . user_group($uid) . "',
				$qty_gs,$qty_gm,$qty_gl,$qty_gxl,$qty_gxxl,
				$qty_ls,$qty_lm,$qty_ll,$qty_lxl,$qty_lxxl,
				now(),'$ip')");
			}
		} else {
			echo "<br><b>Zero figure not allowed.</b><br>";
		}
	}
	$rs = mysql_query("select * from $tbl");
	while ($o = mysql_fetch_object($rs)) {
		$qgs += $o->qty_gs;
		$qgm += $o->qty_gm;
		$qgl += $o->qty_gl;
		$qgxl += $o->qty_gxl;
		$qgxxl += $o->qty_gxxl;

                $qls += $o->qty_ls;
                $qlm += $o->qty_lm;
                $qll += $o->qty_ll;
                $qlxl += $o->qty_lxl;
                $qlxxl += $o->qty_lxxl;

	}
	$tot += $qgs + $qgm + $qgl + $qgxl + $qgxxl + $qls + $qlm + $qll + $qlxl + $qlxxl;
	
	$rs = mysql_query("select * from $tbl where uid='$uid'");
	$o = mysql_fetch_object($rs);
	$qty_gs = $o->qty_gs;
	$qty_gm = $o->qty_gm;
	$qty_gl = $o->qty_gl;
	$qty_gxl = $o->qty_gxl;
	$qty_gxxl = $o->qty_gxxl;

	$qty_ls = $o->qty_ls;
	$qty_lm = $o->qty_lm;
	$qty_ll = $o->qty_ll;
	$qty_lxl = $o->qty_lxl;
	$qty_lxxl = $o->qty_lxxl;

	echo "<br>
	<b>Hello $uid!</b><br>
	Please place your booking for <em>Effervescence MM9</em> T-Shirt by specifying size and quantity. Thanks,<br>
	<div align='right'><b>Boking Status: <font color='red'>
	G-S: $qgs, G-M: $qgm, G-L: $qgl, G-XL: $qgxl, G-XXL: $qgxxl, 
	L-S: $qls, L-M: $qlm, L-L: $qll, L-XL: $qlxl, L-XXL: $qlxxl,Total- $tot
	</font></b></div>
	Collection charges: @ Rs. <b>190/-</b> per piece
	<center><table width='90%' border='1'>
	<tr><td align='center'>
	Fabric Quality: 200 gsm<br>
	Size Specification (Length x Width) in inches<br> 
	<b>For Gents:</b> 
		G-S(26 x 20) G-M(27 x 21) G-L(28 x 22) G-XL(29 x 23) G-XXL(30 x 24)<br>
	<b>For Ladies:</b> 
		L-S(23.5 x 16.5) L-M(24.5 x 17.5) L-L(25.5 x 18.5) L-XL(26.5 x 19.5) L-XXL(27.5 x 20.5)<br>
	</td></tr><tr><th nowrap>Type the quantity of desired sizes only (single digit)<br>
	[GENTS] G-S <input type='text' name='qty_gs' size='5' maxlength='1' value='$qty_gs'>&nbsp;&nbsp;
	G-M <input type='text' name='qty_gm' size='5' maxlength='1' value='$qty_gm'>&nbsp;&nbsp;
	G-L <input type='text' name='qty_gl' size='5' maxlength='1' value='$qty_gl'>&nbsp;&nbsp;
	G-XL <input type='text' name='qty_gxl' size='5' maxlength='1' value='$qty_gxl'>&nbsp;&nbsp;
	G-XXL <input type='text' name='qty_gxxl' size='5' maxlength='1' value='$qty_gxxl'>&nbsp;&nbsp;
	<br>
	[LADIES] L-S <input type='text' name='qty_ls' size='5' maxlength='1' value='$qty_ls'>&nbsp;&nbsp;
	L-M <input type='text' name='qty_lm' size='5' maxlength='1' value='$qty_lm'>&nbsp;&nbsp;
	L-L <input type='text' name='qty_ll' size='5' maxlength='1' value='$qty_ll'>&nbsp;&nbsp;
	L-XL <input type='text' name='qty_lxl' size='5' maxlength='1' value='$qty_lxl'>&nbsp;&nbsp;
	L-XXL <input type='text' name='qty_lxxl' size='5' maxlength='1' value='$qty_lxxl'>&nbsp;&nbsp;
	<br>
	<!--input type='submit' name='submit' value='SUBMIT'--><br>
	Resubmission over-writes the previous figures
	</th></tr><tr><th>Click over for enlarged view of image<br>
	<a href='tshirt/tshirt09.jpg' title='View full size image'>
	<img src='tshirt/tshirt09t.jpg' width='300' height='200' border='0'></a>
	</th></tr>
	</table>";
}
if ($id == 'list') {
	echo "<center><b>Booking List</b>&nbsp;[ <a href='?pg=$pg&id='>Hide</a> ]&nbsp;&nbsp;
	<>&nbsp;&nbsp;<b>Booking Summary</b>&nbsp;[ <a href='?pg=$pg&id=summary'>Show</a> ]";

	$pno = $_REQUEST["pno"];
	if (!$pno) $pno = 1;
	$pgsize = 10;
	$start = (($pno - 1) * $pgsize);

	$rs = mysql_query("select SQL_CALC_FOUND_ROWS * from $tbl");
	$tro = mysql_fetch_object(mysql_query("select FOUND_ROWS() as t"));
	$total = $tro->t;
	echo "<div align='right'>Total aspirants: $total / Pages: ";

	if ($total > $pgsize) {
        	$firstpno = max (1, ceil($start/$pgsize) - 2);
        	$lastpno = $firstpno + 9;
        	if (ceil($total/$pgsize) > $pgsize && $lastpno >= ceil($total/$pgsize)) $firstpno = ceil($total/$pgsize) - 10;
        	for($i = $firstpno; $i <= min($lastpno, ceil($total/$pgsize)); $i++) {
                	if ($i == $pno) echo "<b>$i</b>&nbsp;";
                	else echo "<a href='?pg=$pg&id=list&pno=$i'>$i</a>&nbsp;";
        	}
	} else echo "1";

	echo "</div>
	<table width='98%' border='1'>
	<tr><th width='5%'>No.</th><th>ID</th><th>Name</th><th>Batch/Group</th>
	<th>G S</th><th>G M</th><th>G L</th><th>G XL</th><th>G XXL</th>
	<th>L S</th><th>L M</th><th>L L</th><th>L XL</th><th>L XXL</th>
	<th>Total</th><th width='25%'>Dated</th></tr>";
	$start = (($pno - 1) * $pgsize);
	$rs = mysql_query("select * from $tbl order by dated desc,uid LIMIT $start,$pgsize");
	while ($o = mysql_fetch_object($rs)) {
		$start++;
		$total = $o->qty_gs + $o->qty_gm + $o->qty_gl + $o->qty_gxl + $o->qty_gxxl + 
		$o->qty_ls + $o->qty_lm + $o->qty_ll + $o->qty_lxl + $o->qty_lxxl;
       		echo "<tr><td>$start</td><td>$o->uid</td><td>" . user_name($o->uid) . "<td>$o->batch</td>
		<td>$o->qty_gs</td><td>$o->qty_gm</td><td>$o->qty_gl</td><td>$o->qty_gxl</td><td>$o->qty_gxxl</td>
		<td>$o->qty_ls</td><td>$o->qty_lm</td><td>$o->qty_ll</td><td>$o->qty_lxl</td><td>$o->qty_lxxl</td>
		<td>$total</td><td>$o->dated</td></tr>";
	}
	echo "</table>";
} else if ($id == 'summary') {
	echo "<center><b>Booking List</b>&nbsp;[ <a href='?pg=$pg&id=list'>Show</a> ]&nbsp;&nbsp;
	<>&nbsp;&nbsp;<b>Booking Summary</b>&nbsp;[ <a href='?pg=$pg&id='>Hide</a> ]
        <table width='80%' border='1'>
        <tr><th width='5%'>No.</th><th width='40%'>Batch/Group<br>(Click for aspirants list)</th><th>No. of<br>Aspirants</th>
        <th>G S</th><th>G M</th><th>G L</th><th>G XL</th><th>G XXL</th>
        <th>L S</th><th>L M</th><th>L L</th><th>L XL</th><th>L XXL</th>
	<th>Total</th></tr>";
        
	$qgs=0;$qgm=0;$qgl=0;$qgxl=0;$qgxxl=0;
        $qls=0; $qlm=0;$qll=0;$qlxl=0;$qlxxl=0;
 	$tot=0;
	
        $rs = mysql_query("select sum(qty_gs) gsno, sum(qty_gm) gmno,sum(qty_gl) glno,sum(qty_gxl) gxlno,sum(qty_gxxl) gxxlno,
        sum(qty_ls) lsno, sum(qty_lm) lmno,sum(qty_ll) llno,sum(qty_lxl) lxlno,sum(qty_lxxl) lxxlno,
	batch,count(uid) no from $tbl group by batch order by no desc");
        while ($o = mysql_fetch_object($rs)) {
                $i++;
		$qgs += $o->gsno;
		$qgm += $o->gmno;
		$qgl += $o->glno;
		$qgxl += $o->gxlno;
		$qgxxl += $o->gxxlno;

                $qls += $o->lsno;
                $qlm += $o->lmno;
                $qll += $o->llno;
                $qlxl += $o->lxlno;
                $qlxxl += $o->lxxlno;
                
		$total = $o->gsno + $o->gmno + $o->glno + $o->gxlno + $o->gxxlno + 
		$o->lsno + $o->lmno + $o->llno + $o->lxlno + $o->lxxlno;
		$tot += $total;

                echo "<tr><td>$i</td><td><a href='?pg=$pg&id=summary&batch=$o->batch'>$o->batch</a></td><td>$o->no</td>
                <td>$o->gsno</td><td>$o->gmno</td><td>$o->glno</td><td>$o->gxlno</td><td>$o->gxxlno</td>
                <td>$o->lsno</td><td>$o->lmno</td><td>$o->llno</td><td>$o->lxlno</td><td>$o->lxxlno</td>
		<td>$total</td></tr>";
		if ($_REQUEST["batch"] == $o->batch) {
			echo "<tr><th colspan='15'><table width='100%' border='1'>
		        <tr><th width='5%'>No.</th><th>ID</th><th>Name</th>
        		<th>G S</th><th>G M</th><th>G L</th><th>G XL</th><th>G XXL</th>
        		<th>L S</th><th>L M</th><th>L L</th><th>L XL</th><th>L XXL</th>
			<th width='15%'>Dated</th></tr>";
        		$rs1 = mysql_query("select * from $tbl where batch='" . $_REQUEST["batch"] . "' order by uid");
        		while ($o = mysql_fetch_object($rs1)) {
        	        	$j++;
                		echo "<tr><td>$j</td><td>$o->uid</td><td>" . user_name($o->uid) . "</td>
                		<td>$o->qty_gs</td><td>$o->qty_gm</td><td>$o->qty_gl</td><td>$o->qty_gxl</td><td>$o->qty_gxxl</td>
                		<td>$o->qty_ls</td><td>$o->qty_lm</td><td>$o->qty_ll</td><td>$o->qty_lxl</td><td>$o->qty_lxxl</td>
				<td>$o->dated</td></tr>";
        		}
        		echo "</table></th></tr>";
		}
		$gtot += $o->no;
        }
        echo "<tr><td>=></td><td>Total</td><td>$gtot</td>
        <td>$qgs</td><td>$qgm</td><td>$qgl</td><td>$qgxl</td><td>$qgxxl</td>
        <td>$qls</td><td>$qlm</td><td>$qll</td><td>$qlxl</td><td>$qlxxl</td>
	<td>$tot</td></tr>
        </table>";
} else {
	echo "<center><b>Booking List</b>&nbsp;[ <a href='?pg=$pg&id=list'>Show</a> ]&nbsp;&nbsp;<>&nbsp;&nbsp;
	<b>Booking Summary</b>&nbsp;[ <a href='?pg=$pg&id=summary'>Show</a> ]";
}
echo "</center>";
?>