Your IP : 216.73.216.40


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

<h3>Challan/Bill Receipt</h3>
<center>

<?php
$tbl = "st_bills";

$id = $_REQUEST["id"];
$challanno = $_POST["challanno"];
$datechallan = $_REQUEST['datechallan'];
if (!$datechallan) $datechallan = date("Y-m-d");
$billno = $_POST["billno"];
$datebill = $_REQUEST['datebill'];
if (!$datebill) $datebill = date("Y-m-d");
$supplier = $_POST["supplier"];
$dated = date("Y-m-d");

if ($_POST["submit"] == 'SAVE') {
	if (mysql_num_rows(mysql_query("select * from $tbl where id=$id"))) {
		mysql_query("update $tbl set challanno='$challanno',datechallan='$datechallan',billno='$billno',datebill='$datebill',supplier=$supplier 
		where id=$id");
	} else {
        mysql_query("insert into $tbl(challanno,datechallan,billno,datebill,supplier) 
		values('$challanno','$datechallan','$billno','$datebill',$supplier)");
	}
}

if ($_POST["submit"] == 'DELETE') {
	mysql_query("delete from $tbl where id=$id");
}
?>

Last 100 challans/bills are listed here.
<table width='90%' border='1' style='border-collapse: collapse'>
<tr><th>No.</th><th>Challan No.</th><th>Challan Date</th><th>Bill No.</th><th>Bill Date</th><th>Supplier</th><th>Dated</th></tr>

<?php

if (!$id) {
	echo "<tr><td>New</td>
	<td><input type='text' name='challanno' size='20' value=''></td><td>";

	$myCalendar = new tc_calendar("datechallan", true, false);
	$myCalendar->setIcon("images/iconCalendar.gif");
	$myCalendar->setDate(date('d', strtotime($datechallan)), date('m', strtotime($datechallan)), date('Y', strtotime($datechallan)));
	$myCalendar->setPath("calendar/");
	$myCalendar->setYearInterval(2016, 2020);
	$myCalendar->setAlignment('left', 'bottom');
	$myCalendar->writeScript();	  

	echo "</td><td><input type='text' name='billno' size='20' value=''></td><td>";

	$myCalendar = new tc_calendar("dateBill", true, false);
	$myCalendar->setIcon("images/iconCalendar.gif");
	$myCalendar->setDate(date('d', strtotime($datebill)), date('m', strtotime($datebill)), date('Y', strtotime($datebill)));
	$myCalendar->setPath("calendar/");
	$myCalendar->setYearInterval(2016, 2020);
	$myCalendar->setAlignment('left', 'bottom');
	$myCalendar->writeScript();	  

	echo "</td><td>".supplier_list($supplier)."</td><td>$dated</td></tr>
    <tr><th colspan='7'><input type='submit' name='submit' value='SAVE'></th></tr>";
} else {
	echo "<tr><td colspan='7'><a href='?pg=$pg&id='>New</a></td></tr>";
}

$rs = mysql_query("select * from $tbl order by id desc limit 0,100");
while ($o = mysql_fetch_object($rs)) {
	$i++;
	echo "<tr><th><a href='?pg=$pg&id=$o->id'>$i</a></th>";
	if ($id == $o->id) {
		echo "<td><input type='text' name='challanno' size='20' value='$o->challanNo'></td><td>";
		
		$myCalendar = new tc_calendar("datechallan", true, false);
		$myCalendar->setIcon("images/iconCalendar.gif");
		$myCalendar->setDate(date('d', strtotime($o->dateChallan)), date('m', strtotime($o->dateChallan)), date('Y', strtotime($o->dateChallan)));
		$myCalendar->setPath("calendar/");
		$myCalendar->setYearInterval(2016, 2020);
		$myCalendar->setAlignment('left', 'bottom');
		$myCalendar->writeScript();	  

  
		echo "</td><td><input type='text' name='billno' size='20' value='$o->billNo'></td><td>";
		
		$myCalendar = new tc_calendar("datebill", true, false);
		$myCalendar->setIcon("images/iconCalendar.gif");
		$myCalendar->setDate(date('d', strtotime($o->dateBill)), date('m', strtotime($o->dateBill)), date('Y', strtotime($o->dateBill)));
		$myCalendar->setPath("calendar/");
		$myCalendar->setYearInterval(2016, 2020);
		$myCalendar->setAlignment('left', 'bottom');
		$myCalendar->writeScript();	  

  
		echo "</td><td>".supplier_list($o->supplier)."</td><td>$o->dateCreation<input type='hidden' name='id' value='$o->id'></td></tr>
		<tr><th colspan='6'><input type='submit' name='submit' value='SAVE'></th><th><input type='submit' name='submit' value='DELETE'></th>";
	} else {
		echo "<td>$o->challanNo</td><td>$o->dateChallan</td><td>$o->billNo</td><td>$o->dateBill</td>
		<td>".supplier_detail($o->supplier)."</td><td>$o->dateCreation</td>";
	}
	echo "</tr>";
}
?>

</table>
</center>