<?php include("include/system_connect.php");?>







<? include("include/session.php"); ?>







<title><? echo $page_title;?></title>















<style>







		td







		{







		font-family:Verdana, Arial, Helvetica, sans-serif;







		font-size:11px;







		}







	







	</style>







<style>































































































































#print_this_page {































































































































	 BACKGROUND: url(images/print_this_page.gif) #fff no-repeat 0px 0px; HEIGHT: 23px; WIDTH: 130px































































































































}































































































































































































































































#close_this_page {































































































































	 BACKGROUND: url(images/close_this_page.gif) #fff no-repeat 0px 0px; HEIGHT: 23px; WIDTH: 130px































































































































}































































































































</style>







<?







$bill_no=$_REQUEST['bill_no'];































$qry2 = $mysqli->prepare("select member_id,stock_id,bill_type,id,date,gst_no from report_req where bill_no=?");







$qry2->bind_param('s', $bill_no);







$qry2->execute();







$qry2->bind_result($member_id,$stock_id,$bill_type,$id,$date,$gst_no);







while ($qry2->fetch())







{







$member_id=$member_id;







$stock_id=$stock_id;







$bill_type=$bill_type;







$id=$id;







$date=$date;



$gst_no=$gst_no;													







}









?>




					







					







					<table cellpadding="0" cellspacing="0" width="933" align="center" height="200">







<tr>







<td width="931">




















					







					







					







					







					<HR width="100%" />







					<table border="0"  cellpadding="0" cellspacing="0" width="100%" height="125">







					<tr>







						<td colspan="2">







					<table border="1"  cellpadding="4" cellspacing="0" width="100%" height="125">







					 <tr>







					 <td width="22"><b>Sl No.</b></td>







	<td width="149"><b>Description Of Goods</b></td>







	<td width="32"><b>HSN Code</b></td>







	<td width="25"><b>QTY</b></td>



    <td width="25"><b>Batch No</b></td>



	<td width="28"><b>UOM</b></td>







	<td width="29"><b>Rate</b></td>



<td width="29"><b>MRP</b></td>







	<td width="41"><b>Gross Value</b></td>







	<td width="55"><b>Delivery</b></td>







	







	<td width="56"><b>Discount</b></td>







	<td width="56"><b>Taxable Value</b></td>







	<td width="102"><table border="1" cellpadding="0" cellspacing="1"><tr><td colspan="2"><b>CGST</b></td></tr><tr><td><b>Rate</b></td><td><b>Amount</b></td></tr></table></td>







	<td width="102"><table border="1"  cellpadding="0" cellspacing="1"><tr><td colspan="2"><b>SGST</b></td></tr><tr><td><b>Rate</b></td><td><b>Amount</b></td></tr></table></td>







	<td width="102"><table border="1"  cellpadding="0" cellspacing="1"><tr><td colspan="2"><b>IGST</b></td></tr><tr><td><b>Rate</b></td><td><b>Amount</b></td></tr></table></td>







	</tr>







					<?







					







$qtyy=$mysqli->prepare("select item_code,qty,dis,del from bill_req where bill_no=?");







$qtyy->bind_param("s", $bill_no);







$qtyy->execute();







$qtyy->bind_result($item_code,$qty,$dis,$del);







$z=0;







while($qtyy->fetch())







{







$z++;







$itmcd[$z]=$item_code;







$qtty[$z]=$qty;







$disss[$z]=$dis;







$dell[$z]=$del;







}	















				  for($kk=1;$kk<=$z;$kk++)







				   {







				  







				  $item_code=$itmcd[$kk];







				  







				  







							  $qry22 = $mysqli->prepare("select  name, code, rate, pv, uom, cgst,sgst,igst,tax,batch_no,mrp from product_resale where id=?");







							  $qry22->bind_param("s", $item_code);







                             $qry22->execute();







                    $qry22->bind_result($name, $code, $rate, $pv, $uom, $cgst,$sgst,$igst,$tax,$batch_no,$mrp);







					while($qry22->fetch())







                  {







				  $name=$name;







				  $code=$code;







				  $rate=$rate;







				  $pv=$pv;







				  $uom=$uom;







				  $cgst=$cgst;







				  $sgst=$sgst;







				  $igst=$igst;







				  $tax=$tax;



				  $batch_no=$batch_no;



$mrp=$mrp;







				  }







				







$qty=$qtty[$kk];







$vat=$rate*$tax/100;







$dp=$rate+$vat;







$total=$rate*$qty;







$diss=$rate*$disss[$kk];







$taxable_val=$total+$dell[$kk]-$diss;















$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







?>







				    <tr>







					<td height="20" valign="middle" align="left">&nbsp;<? echo $kk;?></td>







					 <td height="20" valign="middle" align="left">&nbsp;<? echo $name;?></td>







					 <td height="20" valign="middle" align="left">&nbsp;<? echo $code;?></td>







					 <td height="20" valign="middle" align="left">&nbsp;<? echo $qty;?></td>



					  <td height="20" valign="middle" align="left">&nbsp;<? echo $batch_no;?></td>







					 <td height="20" valign="middle" align="left">&nbsp;<? echo $uom;?></td>







					 







					 <td height="20" valign="middle" align="left">&nbsp;<? echo $rate;?></td>



 <td height="20" valign="middle" align="left">&nbsp;<? echo $mrp;?></td>



					 <td height="20" valign="middle" align="left">&nbsp;<? echo $total=$rate*$qty;?></td>







					  <td height="20" valign="middle" align="left">&nbsp;<? echo $dell[$kk];?></td>







					   <td height="20" valign="middle" align="left">&nbsp;<? echo $diss;?></td>







					 <td height="20" valign="middle" align="left">&nbsp;<? echo sprintf("%01.2f",$taxable_val);?></td>







					<td><table width="102" border="1"  cellpadding="0" cellspacing="1">







  <tr><td width="35"><? if($bill_type=="state"){echo $cgst;  } ?></td>







  <td width="50"><? if($bill_type=="state"){echo sprintf("%01.2f",$cgst_val); } ?></td>







  </tr></table></td>







					 <td><table width="102" border="1"  cellpadding="0" cellspacing="1">







  <tr><td width="35"><? if($bill_type=="state"){echo $sgst;  } ?></td>







  <td width="50"><? if($bill_type=="state"){echo sprintf("%01.2f",$sgst_val); } ?></td>







  </tr></table></td>







					  <td><table width="102" border="1"  cellpadding="0" cellspacing="1">







  <tr><td width="35"><? if($bill_type=="central"){echo $igst;  } ?></td>







  <td width="50"><? if($bill_type=="central"){echo sprintf("%01.2f",$igst_val); } ?></td>







  </tr></table></td>







					







					







					</tr>







				<?







				$dis_pv=$disss[$kk]*$pv;







				$ind_pvv=$pv*$qty;







				$ind_pv=$ind_pvv-$dis_pv;







				$total_pv= $total_pv+$ind_pv;







				$total_qty=$total_qty+$qty;







				} ?>   







					







				







<?







$qry2 = $mysqli->prepare("select gross_bill,cgst,sgst,igst,total,discount from report_req where bill_no=?");







$qry2->bind_param('s', $bill_no);







$qry2->execute();







$qry2->bind_result($gross_bill,$cgst,$sgst,$igst,$total,$discount);







while ($qry2->fetch())







{







$gross_bill=$gross_bill;







$cgst=$cgst;







$sgst=$sgst;







$igst=$igst;







$total=$total;	







$discount=$discount;												







}







?>				







<tr>







<td height="20" valign="middle" align="right" colspan="3">Total P.V : <?  echo sprintf("%01.2f",$total_pv);?></td>







<td colspan="9" align="right"><b>Gross Total</b></td>















<td colspan="3"><?  echo sprintf("%01.2f",$gross_bill);?></td>















</tr>







<tr>







<td colspan="12" align="right"><b>CGST</b></td>















<td colspan="3"><?  echo sprintf("%01.2f",$cgst);?></td>















</tr>







<tr>







<td colspan="12" align="right"><b>SGST</b></td>















<td colspan="3"><?  echo sprintf("%01.2f",$sgst);?></td>















</tr>







<tr>







<td colspan="12" align="right"><b>IGST</b></td>















<td colspan="3"><?  echo sprintf("%01.2f",$igst);?></td>















</tr>















<tr>







<td colspan="12" align="right"><b>Net Amount</b></td>







<td colspan="3"><?  echo sprintf("%01.2f",$total);?></td>







</tr>







<?







$payable=$total-$discount;







?>







<tr>







<td colspan="12" align="right"><b>Discount</b></td>







<td colspan="3"><?  echo sprintf("%01.2f",$rw2['discount']);?></td>







</tr>







<tr>







<td colspan="12" align="right"><b>Payable</b></td>







<td colspan="3"><?  echo round($payable);?></td>







</tr>























					







					







					







					</table>







					</td>







					</tr>







					







					<tr>







					







					  







					<td width="52%" align="right">







					







					







					







	</td></tr>







				</table>







	</td>







</tr>	







</table>







			







		







							







					







					







					