<?php
require_once('functions.php');?>

<!--===========================================================================================================================-->
<script language="javascript" type="text/javascript">

function multiply(){

a=Number(document.abc.BUYING.value);

b=Number(document.abc.MARGIN.value);
i=Number(document.abc.QTY.value);
f=Number(document.abc.TOTAL.value);



h=f/i;
e=h/100*b;
c=e+h;

document.abc.SELLING.value=c.toFixed(0);

document.abc.BUYING.value=h.toFixed(2);




	


}
</script>
<fieldset><legend><b>Add New Product</b></legend>
<form action="save_product.php" method="post" name="abc">

name:<br />
<input name="b" required="required"   type="text" SIZE="40" /><br />
QTY:<br />
<input name="qty" value="" required="required"  type="text" SIZE="40" /><br />




<?
    $dbc=mysqli_connect('localhost','wqvsodvt_porr','@@W!QSER765VBlkj@@@!!','wqvsodvt_point');
$result=@mysqli_query($dbc,("SELECT *
FROM categories"));
print"<b>Category:</br>";

print"<select name=\"category\" required='required'>";
print "<option></option>";
while ($row=mysqli_fetch_assoc($result)){
$id=$row['id'];
$name=$row['name'];
print"<option value=$id>$name\n";
}
print"</select>\n";
print"</p>\n";
?>
</td></tr>
<?
    $dbc=mysqli_connect('localhost','wqvsodvt_porr','@@W!QSER765VBlkj@@@!!','wqvsodvt_point');
$resul=@mysqli_query($dbc,("select * from accounts
inner join group_accounts on group_accounts.account_id=accounts.id
where group_id='2' and status='ACTIVE' order by name"));
print"<b>Company:</br>";

print"<select name=\"supplier\" required='required'>";
print "<option></option>";
while ($row=mysqli_fetch_assoc($resul)){
$ids=$row['id'];
$names=$row['name'];
print"<option value=$ids>$names\n";
}
print"</select>\n";
print"</p>\n";
?>
</td></tr>

buying price:<br />
<input name="e" required="required" id="BUYING" onkeyup="multiply()"  type="text" /><br />


WholeSale price:<br />
<input name="mini" required="required" id="SELLING"   type="text" /><br />
Retail price:<br />
<input name="SELLING" required="required" id="SELLING"   type="text" /><br />
VAT:<br />
<input name="vat" required="required" value="16" id="SELLING" placeholder='PUT 16 or 0 ,dont include the sign'  type="text" /><br />



<input name="submit" type="submit" value="save">
</form></fieldset>
