Help me with code for sales order in which one can add multiple item and can store it in database. Example.
item name | item rate | item quantity| total amount|
LEd 2100 2 4200 |Edit|Delete (line 1)
Mouse 100 4 400 |Edit|Delete (line 2)
Item list | auto fill | manual | Auto fill | Add (line 3)
Grand Total | 4400 |
**Submit**
Item list is taken from databse. item rate should be come auto as specified in database and total amount should come automatically. after pressing add button next line come automatically as line 3 and the added line must look like line 1 and line 2 with edit and delete option. after submitting the form all entry inserted into database.
Help will be highly appreciated.
the work I have done is …
fee.php
[php]
Fee
.NonPrintable
{
display: none;
}
|
Fee
|
Rs.
<?php
$host="localhost";
$username="root";
$password="";
$database="maggot";
mysql_connect($host,$username,$password);
mysql_select_db("$database");
$query = mysql_query("SELECT MAX(rate) FROM `billing_type`
WHERE department='Fee'");
$results = mysql_fetch_array($query);
$cur_auto_id = $results['MAX(rate)'] ;
echo $cur_auto_id;
//echo" ";
?>
only
|
Bill No :
<?php
$host=“localhost”;
$username=“root”;
$password="";
$database=“maggot”;
mysql_connect($host,$username,$password);
mysql_select_db("$database");
$query = mysql_query(“SELECT MAX(bill) FROM arv
WHERE department=‘Fee’”);
$results = mysql_fetch_array($query);
$cur_auto_id = $results[‘MAX(bill)’] + 1;
echo $cur_auto_id;
?>
</label>
</td>
<td width="492"><strong><center>Cash Reciept</center> </strong></td>
<td width="217" align="right">
<label>Date :
<?php
echo date(“Y/m/d”);
?>
|
Item Name :
A value is required.
|
rate :
A value is required.Invalid format.
|
quantity :
A value is required.
|
total :
A value is required.
|
grand total :
A value is required.
|
<table width="950" height="30">
<tr>
<td width="259" height="24"><p>Signature of .................................</p></td>
<td width="480"> </td>
<td width="195"><p>Signature of...................</p></td>
</tr>
</table>
<table width="945" border="0">
<tr>
<td width="468"><label>
<center><input type="submit" name="button" id="button" value="Submit" class="NonPrintable"/>
</center></label></td>
<td width="467"><center></center></td>
</tr>
</table></td>
|
[/php]
checkfee.php
[php]
fee
.NonPrintable
{
display: none;
}
|
Fee
|
Rs. <?php
$host=“localhost”;
$username=“root”;
$password="";
$database=“maggot”;
mysql_connect($host,$username,$password);
mysql_select_db("$database");
$query = mysql_query(“SELECT MAX(rate) FROM billing_type
WHERE department=‘Fee’”);
$results = mysql_fetch_array($query);
$cur_auto_id = $results[‘MAX(rate)’] ;
echo $cur_auto_id;
//echo" ";
?> only
|
Bill No :
<?php
$host=“localhost”;
$username=“root”;
$password="";
$database=“maggot”;
mysql_connect($host,$username,$password);
mysql_select_db("$database");
$department=$_POST[‘item’];
$query = mysql_query("SELECT MAX(bill_no) FROM arv ");
$results = mysql_fetch_array($query);
$cur_auto_id = $results[‘MAX(bill_no)’] + 1;
echo $cur_auto_id;
?>
</label>
</td>
<td width="492"><strong><center>Cash Reciept</center> </strong></td>
<td width="217" align="right">
<label>Date :
<?php
echo date(“Y/m/d”);
?>
|
Name :
<?php
print $_POST[‘itemname’];
?>
|
Age :
<?php
print $_POST[‘rate’];
?>
|
Sex :
<?php
print $_POST[‘quantity’];
?>
|
Ward :
<?php
print $_POST[‘total’];
?>
|
Bed No. :
<?php
print $_POST[‘grandtotal’];
?>
|
<table width="950" height="30">
<tr>
<td width="259" height="24"><p>Signature of .................................</p></td>
<td width="480"> </td>
<td width="195"><p>Signature of...................</p></td>
</tr>
</table>
<table width="945" border="0">
<tr>
<td width="468"><label>
<center>
</center></label></td>
<td width="467"><center><input type="submit" name="button2" id="button2" value="Print" onclick="window.print();return false;" class="NonPrintable"/></center></td>
</tr>
</table></td>
|
<?php
require_once ('../connections/connection.php');
$bill_no=$_POST['bill_no'];
$date=date('Y/m/d');
$name=$_POST['itemname'];
$rate=$_POST['rate'];
$total=$_POST['total'];
$grandtotal=$_POST['grandtotal'];
$quantity=$_POST['quantity'];
$sql1="INSERT INTO arv ( user, bill, date, itemname, rate, quantity, total, grandtotal)
VALUES ('$sname', '$bill_no', '$date', '$itemname', '$rate', '$quantity', '$total', '$grandtotal' )";
mysql_query($sql1);
echo "Form Submitted";
?>
[/php]