<?php $action=$_REQUEST['action'];?>




<Script language="javascript">



function checkKeyCode(evt)



{







var evt = (evt) ? evt : ((event) ? event : null);



var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);



if(event.keyCode==116)



{



evt.keyCode=0;



return false



}



}



document.onkeydown=checkKeyCode;



</script>




<script language="javascript">







function formcheck()



{









if(document.myform.bill_type.value=="")















			{















				alert("Please Select Bill Type!");















				document.myform.bill_type.focus()















				return false;















			}















			



		







			















		return true;







	



			















}











</script>



<script language="javascript">















function duplicate_domain_check(member_id)















{ 















xmlHttp=GetXmlHttpObject()















if (xmlHttp==null)















 {















 alert ("Browser does not support HTTP Request")















 return















 }































 	















		var url="record.php";















		url=url+"?member_id="+member_id















		url=url+"&sid="+Math.random()















		xmlHttp.onreadystatechange=stateChanged_answer 















		xmlHttp.open("GET",url,true)















		xmlHttp.send(null)















		















}































function stateChanged_answer() 















{ 















  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")















  { 















  















	document.getElementById("msg").innerHTML='<font size=1>'+xmlHttp.responseText+'</font>';















  }















  else















  {















       document.getElementById("msg").innerHTML="<img src='images/loadingAnimation.gif' border=0  height=5 width=20 >";















  }















}























































































function GetXmlHttpObject()















{















var xmlHttp=null;















try















 {















 // Firefox, Opera 8.0+, Safari















 xmlHttp=new XMLHttpRequest();















 }















catch (e)















 {















 //Internet Explorer















 try















  {















  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");















  }















 catch (e)















  {















  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");















  }















 }















return xmlHttp;















}















function test()















{















alert('as');















}















</script>






<?php







							$stock_id=$_SESSION['admin_id']; 



							







					







							?>

</nav>

                </div>

                <!--  END TOPBAR  -->



            </ul>









            <ul class="navbar-item flex-row ml-auto">

                <li class="nav-item align-self-center search-animated">

                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search toggle-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>

                    <form class="form-inline search-full form-inline search" role="search">

                        <div class="search-bar">

                            <input type="text" class="form-control search-form-control  ml-lg-auto" placeholder="Search...">

                        </div>

                    </form>

                </li>

            </ul>



            <ul class="navbar-item flex-row nav-dropdowns">

               



               



                <li class="nav-item dropdown notification-dropdown">

                    <a href="javascript:void(0);" class="nav-link dropdown-toggle" id="notificationDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg><span class="badge badge-success"></span>

                    </a>

                    <div class="dropdown-menu position-absolute" aria-labelledby="notificationDropdown">

                        <div class="notification-scroll">

						  <?

		   





							 $query_not = $mysqli->prepare("select heading, content from notice_shop");



													$query_not->execute();



													$query_not->bind_result($heading, $content);

		   

		   ?>

		   <?

		                                 while ($query_not->fetch()){

		                                  ?>



                            <div class="dropdown-item">

                                <div class="media server-log">

                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-server"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6" y2="6"></line><line x1="6" y1="18" x2="6" y2="18"></line></svg>

                                    <div class="media-body">

                                        <div class="data-info">

                                            <h6 class=""><? echo $heading;?></h6>

                                            <p class=""><? echo $content;?></p>

                                        </div>



                                        <div class="icon-status">

                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>

                                        </div>

                                    </div>

                                </div>

                            </div>

							<? } ?>



                            



                            

                        </div>

                    </div>

                </li>

				

											

                <li class="nav-item dropdown user-profile-dropdown order-lg-0 order-1">

                    <a href="javascript:void(0);" class="nav-link dropdown-toggle user" id="user-profile-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                        <div class="media">

                            <img src="assets/img/90x90.jpg" class="img-fluid" alt="admin-profile">

                        </div>

                    </a>

                    <div class="dropdown-menu position-absolute" aria-labelledby="userProfileDropdown">

                        <div class="user-profile-section">

                            <div class="media mx-auto">

                                <div class="media-body">

                                    <h5>Name : <? echo $name;?></h5>

                                   
                                </div>

                            </div>

                        </div>

                        <div class="dropdown-item">

                            <a href="update_profile.php">

                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg> <span>Profile</span>

                            </a>

                        </div>

                       

                        <div class="dropdown-item">

                            <a href="logout.php">

                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg> <span>Log Out</span>

                            </a>

                        </div>

                    </div>



                </li>

            </ul>

        </header>

    </div>

    <!--  END NAVBAR  -->



    <!--  BEGIN MAIN CONTAINER  -->

    <div class="main-container" id="container">



        <div class="overlay"></div>

        <div class="search-overlay"></div>

        

        <!--  BEGIN CONTENT PART  -->

        <div id="content" class="main-content">

            <div class="layout-px-spacing">



                <div class="page-header">

                    <div class="page-title">

                        <h3><? echo $name;?></h3>

                    </div>

                    

                    <div class="toggle-switch">

                        <label class="switch s-icons s-outline  s-outline-secondary">

                            <input type="checkbox" checked="" class="theme-shifter">

                            <span class="slider round">

                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>



                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>

                            </span>

                        </label>

                    </div>

                </div>



                <div class="row layout-top-spacing">


<?
$stock_id=$_SESSION['admin_id'];
$quryin=$mysqli->prepare("select cwallet  from admin_account_login where id=?");
$quryin->bind_param("s", $stock_id);
$quryin->execute();
$quryin->bind_result($cwallet);
while($quryin->fetch())
{

$cwallet=$cwallet;
}
$up_ewt=$mysqli->prepare("update admin_account_login set cwallet_in=? where id=?");
$up_ewt->bind_param('ss', $cwallet,$stock_id);
$up_ewt->execute();
?>
          

     <div id="basic" class="col-lg-12 col-sm-12 col-12 layout-spacing">

                            <div class="statbox widget box box-shadow">

                                <div class="widget-header">                                

                                    <div class="row">

                                        <div class="col-xl-12 col-md-12 col-sm-12 col-12">

                                            <h4>Your Product Wallet Balance is Rs <? echo sprintf("%01.2f",$cwallet);?></h4>

                                        </div>

                                    </div>

                                </div>

								<?php







						  if($_SESSION['msg_box2']!="")







						  {?>

                                <div class="alert alert-light-success border-0 mb-4" role="alert"> <font color="#FF3300"><? echo $_SESSION['msg_box2'];?> </font></div>

								<?	} 







						 unset($_SESSION['msg_box2']);











						?>

						<?

						

								



								  ?>

								  <? if($action==""){?>
								    



		  <form action="product_request.php?action=before_process&tab_id=tab1&default=manage_agent" method="post" name="myform" enctype="multipart/form-data" onSubmit="return formcheck();">



		    <table class="table table-bordered mb-4">





<?







$stock_id=$_SESSION['admin_id'];







$z=0;







$crr=0;








?>







<tr>



<td align="left" colspan="2"><b>Product 1.</b>&nbsp;<select name="item1">







															<option value="">Please Select</option>


								<?	    





$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>		















													Quantity<input type="text" name="qty1" value="0" size="10">Discount<input type="text" name="dis1" value="0" size="10"></td>























</tr>







<?







$stock_id=$_SESSION['admin_id'];










?>







<tr>



<td align="left" colspan="2"><b>Product 2.</b>&nbsp;<select name="item2">







															<option value="">Please Select</option>


								<?	    




$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty2" value="0" size="10">Discount<input type="text" name="dis2" value="0" size="10"></td>























</tr>







<?







$stock_id=$_SESSION['admin_id'];







$z=0;




















?>







<tr>















<td align="left" colspan="2"><b>Product 3.</b>&nbsp;<select name="item3">







															<option value="">Please Select</option>


								<?	    


$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty3" value="0" size="10">Discount<input type="text" name="dis3" value="0" size="10"></td>























</tr>







<?






?>







<tr>















<td align="left" colspan="2"><b>Product 4.</b>&nbsp;<select name="item4">







															<option value="">Please Select</option>


								<?	    



$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty4" value="0" size="10">Discount<input type="text" name="dis4" value="0" size="10"></td>























</tr>







<?



?>







<tr>















<td align="left" colspan="2"><b>Product 5.</b>&nbsp;<select name="item5">







															<option value="">Please Select</option>


								<?	    




$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty5" value="0" size="10">Discount<input type="text" name="dis5" value="0" size="10"></td>























</tr>







<?








?>







<tr>















<td align="left" colspan="2"><b>Product 6.</b>&nbsp;<select name="item6">







															<option value="">Please Select</option>


								<?	    




$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty6" value="0" size="10">Discount<input type="text" name="dis6" value="0" size="10"></td>























</tr>















<tr>















<td align="left" colspan="2"><b>Product 7.</b>&nbsp;<select name="item7">







															<option value="">Please Select</option>


								<?	    



$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);

while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty7" value="0" size="10">Discount<input type="text" name="dis7" value="0" size="10"></td>























</tr>







<?





?>







<tr>















<td align="left" colspan="2"><b>Product 8.</b>&nbsp;<select name="item8">







															<option value="">Please Select</option>


								<?	    



$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty8" value="0" size="10">Discount<input type="text" name="dis8" value="0" size="10"></td>























</tr>







<?





?>







<tr>















<td align="left" colspan="2"><b>Product 9.</b>&nbsp;<select name="item9">







															<option value="">Please Select</option>


								<?	    




$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty9" value="0" size="10">Discount<input type="text" name="dis9" value="0" size="10"></td>























</tr>







<?



?>







<tr>















<td align="left" colspan="2"><b>Product 10.</b>&nbsp;<select name="item10">







															<option value="">Please Select</option>


								<?	    



$query_prd = $mysqli->prepare("select id,name,batch_no,expiry_date,mrp from product_resale");
$query_prd->execute();
$query_prd->bind_result($prod_id,$pname,$batch_no,$expiry_date,$mrp);


while($query_prd->fetch())

{


?>


															<option value="<? echo $prod_id;?>"><? echo $pname;?> Batch No : <? echo $batch_no;?> Expiry : <? echo $expiry_date;?> MRP : <? echo $mrp;?></option>


															<? } ?>







													</select>Quantity<input type="text" name="qty10" value="0" size="10">Discount<input type="text" name="dis10" value="0" size="10"></td>























</tr>























<tr>







	<td width="117" align="left"><b>Bill Type</b></td>







	<td width="447" align="left"><select name="bill_type">







															<option value="">Please Select</option>







														







															<option value="state">State</option>







															<option value="central">central</option>







														







													</select>







						







						







								 







	</td>







</tr>

<?
$stock_id=$_SESSION['admin_id'];
$query_fran = $mysqli->prepare("select gst_no from admin_account_login where id=?");
$query_fran->bind_param('s', $stock_id);
$query_fran->execute();
$query_fran->bind_result($gst_no);
while($query_fran->fetch())
{
$gst_no=$gst_no;

}

?>

<tr>



	<td align="left"><b>GST No</b></td>



	<td align="left"><input type="text" name="gst_no" id="gst_no" value="<? echo $gst_no;?>" readonly="">



	</td>



</tr>











<tr>







	<td align="left"><b>Entry Date</b></td>







	<td align="left"><input type="text" name="ent_date" id="ent_date" value="<?php echo date("d-m-Y");?>" readonly>







						







						







								 







													(dd-mm-yyyy) 







	</td>







</tr>















<tr>







	







	<td align="right" colspan="2"><input type="submit" name="submit" value="Submit.."></td>







</tr>







</table>



										</form>

 		


								<? } ?>

								

								<? if($action=="before_process"){ 







$bill_type=$_REQUEST['bill_type'];







$delevery=$_REQUEST['delevery'];



$gst_no=$_REQUEST['gst_no'];














$ent_date=$_REQUEST['ent_date'];







$qty1=$_REQUEST['qty1'];







$qty2=$_REQUEST['qty2'];







$qty3=$_REQUEST['qty3'];







$qty4=$_REQUEST['qty4'];







$qty5=$_REQUEST['qty5'];







$qty6=$_REQUEST['qty6'];







$qty7=$_REQUEST['qty7'];







$qty8=$_REQUEST['qty8'];







$qty9=$_REQUEST['qty9'];







$qty10=$_REQUEST['qty10'];















$item1=$_REQUEST['item1'];







$item2=$_REQUEST['item2'];







$item3=$_REQUEST['item3'];







$item4=$_REQUEST['item4'];







$item5=$_REQUEST['item5'];







$item7=$_REQUEST['item7'];







$item8=$_REQUEST['item8'];







$item6=$_REQUEST['item6'];







$item9=$_REQUEST['item9'];







$item10=$_REQUEST['item10'];















$dis1=$_REQUEST['dis1'];







$dis2=$_REQUEST['dis2'];







$dis3=$_REQUEST['dis3'];







$dis4=$_REQUEST['dis4'];







$dis5=$_REQUEST['dis5'];







$dis6=$_REQUEST['dis6'];







$dis7=$_REQUEST['dis7'];







$dis8=$_REQUEST['dis8'];







$dis9=$_REQUEST['dis9'];







$dis10=$_REQUEST['dis10'];















$del1=$_REQUEST['del1'];







$del2=$_REQUEST['del2'];







$del3=$_REQUEST['del3'];







$del4=$_REQUEST['del4'];







$del5=$_REQUEST['del5'];







$del6=$_REQUEST['del6'];







$del7=$_REQUEST['del7'];







$del8=$_REQUEST['del8'];







$del9=$_REQUEST['del9'];







$del10=$_REQUEST['del10'];















$discount=$_REQUEST['discount'];















$out_stock=0;







$stock_id=$_SESSION['admin_id'];
























				












			







?>


<form action="product_request.php?action=add_process" method="post" name="myform4" enctype="multipart/form-data">





<table class="table table-striped table-bordered zero-configuration" >







<tr>







	<td bgcolor="#0099FF" align="left" colspan="8"><b>  Request Details </b></td>







</tr>















<tr>







<td colspan="6"><b>Date </b></td>







<td colspan="6"><b><? echo $ent_date;?> </b></td>







</tr>







<tr>







<td><b>Description Of Goods</b></td>







<td><b>HSN Code</b></td>







<td><b>QTY</b></td>



<td><b>Batch No</b></td>



<td><b>UOM</b></td>







<td><b>DP</b></td>







<td><b>Gross Value</b></td>







<td><b>MRP</b></td>







<td><b>Discount</b></td>







<td><b>Taxable Value</b></td>







<td><table border="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><table border="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><table border="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>







<? if($item1!=""){















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















				$qry->bind_param('s', $item1);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;



 $batch_no=$batch_no;$mrp=$mrp;



				$prod_name=$prod_name;







				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}















$diss1=$rate*$dis1;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty1;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val1=$rate*$qty1;















$taxable_val=$g_val1+$del1-$diss1;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val1=$g_val1+$del1-$diss1;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val1;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss1;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate1=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate1=$cgst_val+$sgst_val; } ?>







<? 















 $total1=$taxable_val+$tax_rebate1;?>







</tr>







<?







if($bill_type=="state"){$cgs1=$cgst_val;$sgs1=$sgst_val;$igs1=0;}







if($bill_type=="central"){$cgs1=0;$sgs1=0;$igs1=$igst_val;}







$dis_pv1=$pv*$dis1;







$pv1=$pv*$qty1;







?>







<? } ?>







<? if($item2!=""){























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















				$qry->bind_param('s', $item2);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;



 $batch_no=$batch_no;$mrp=$mrp;



				$prod_name=$prod_name;







				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}























$diss2=$rate*$dis2;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty2;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val2=$rate*$qty2;















$taxable_val=$g_val2+$del2-$diss2;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val2=$g_val2+$del2-$diss2;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val2;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss2;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate2=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate2=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs2=$cgst_val;$sgs2=$sgst_val;$igs2=0;}







if($bill_type=="central"){$cgs2=0;$sgs2=0;$igs2=$igst_val;}







 $total2=$taxable_val+$tax_rebate2;?>







</tr>







<?







$dis_pv2=$pv*$dis2;







$pv2=$pv*$qty2;







?>







<? } ?>







<? if($item3!=""){















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















				$qry->bind_param('s', $item3);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;



 $batch_no=$batch_no;$mrp=$mrp;



				$prod_name=$prod_name;







				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}















$diss3=$rate*$dis3;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty3;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val3=$rate*$qty3;















$taxable_val=$g_val3+$del3-$diss3;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val3=$g_val3+$del3-$diss3;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val3;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss3;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate3=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate3=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs3=$cgst_val;$sgs3=$sgst_val;$igs3=0;}







if($bill_type=="central"){$cgs3=0;$sgs3=0;$igs3=$igst_val;}







 $total3=$taxable_val+$tax_rebate3;?>







</tr>







<?







$dis_pv3=$pv*$dis3;







$pv3=$pv*$qty3;







?>







<? } ?>







<? if($item4!=""){







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















				$qry->bind_param('s', $item4);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;







				$prod_name=$prod_name;



 $batch_no=$batch_no;$mrp=$mrp;



				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}















$diss4=$rate*$dis4;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty4;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val4=$rate*$qty4;















$taxable_val=$g_val4+$del4-$diss4;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val4=$g_val4+$del4-$diss4;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val4;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss4;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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
















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate4=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate4=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs4=$cgst_val;$sgs4=$sgst_val;$igs4=0;}







if($bill_type=="central"){$cgs4=0;$sgs4=0;$igs4=$igst_val;}







 $total4=$taxable_val+$tax_rebate4;?>







</tr>







<?







$dis_pv4=$pv*$dis4;







$pv4=$pv*$qty4;







?>







<? } ?>























<? if($item5!=""){







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















				$qry->bind_param('s', $item5);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;







				$prod_name=$prod_name;



 $batch_no=$batch_no;$mrp=$mrp;



				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}







$diss5=$rate*$dis5;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty5;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val5=$rate*$qty5;















$taxable_val=$g_val5+$del5-$diss5;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val5=$g_val5+$del5-$diss5;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val5;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss5;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate5=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate5=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs5=$cgst_val;$sgs5=$sgst_val;$igs5=0;}







if($bill_type=="central"){$cgs5=0;$sgs5=0;$igs5=$igst_val;}







 $total5=$taxable_val+$tax_rebate5;?>







</tr>







<?







$dis_pv5=$pv*$dis5;







$pv5=$pv*$qty5;







?>







<? } ?>















<? if($item6!=""){







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















				$qry->bind_param('s', $item6);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;







				$prod_name=$prod_name;



 $batch_no=$batch_no;$mrp=$mrp;



				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}







$diss6=$rate*$dis6;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty6;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val6=$rate*$qty6;















$taxable_val=$g_val6+$del6-$diss6;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val6=$g_val6+$del6-$diss6;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val6;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss6;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate6=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate6=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs6=$cgst_val;$sgs6=$sgst_val;$igs6=0;}







if($bill_type=="central"){$cgs6=0;$sgs6=0;$igs6=$igst_val;}







 $total6=$taxable_val+$tax_rebate6;?>







</tr>







<?







$dis_pv6=$pv*$dis6;







$pv6=$pv*$qty6;







?>







<? } ?>















<? if($item7!=""){







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















				$qry->bind_param('s', $item7);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;







				$prod_name=$prod_name;



 $batch_no=$batch_no;$mrp=$mrp;



				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}







$diss7=$rate*$dis7;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty7;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val7=$rate*$qty7;















$taxable_val=$g_val7+$del7-$diss7;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val7=$g_val7+$del7-$diss7;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val7;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss7;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate7=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate7=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs7=$cgst_val;$sgs7=$sgst_val;$igs7=0;}







if($bill_type=="central"){$cgs7=0;$sgs7=0;$igs7=$igst_val;}







 $total7=$taxable_val+$tax_rebate7;?>







</tr>







<?







$dis_pv7=$pv*$dis7;







$pv7=$pv*$qty7;







?>







<? } ?>















<? if($item8!=""){







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















				$qry->bind_param('s', $item8);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;







				$prod_name=$prod_name;



 $batch_no=$batch_no;$mrp=$mrp;



				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}







$diss8=$rate*$dis8;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty8;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val8=$rate*$qty8;















$taxable_val=$g_val8+$del8-$diss8;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val8=$g_val8+$del8-$diss8;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val8;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss8;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate8=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate8=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs8=$cgst_val;$sgs8=$sgst_val;$igs8=0;}







if($bill_type=="central"){$cgs8=0;$sgs8=0;$igs8=$igst_val;}







 $total8=$taxable_val+$tax_rebate8;?>







</tr>







<?







$dis_pv8=$pv*$dis8;







$pv8=$pv*$qty8;







?>







<? } ?>















<? if($item9!=""){







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















				$qry->bind_param('s', $item9);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;







				$prod_name=$prod_name;







				$rate=$rate;







				$pv=$pv;



 $batch_no=$batch_no;$mrp=$mrp;



				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}







$diss9=$rate*$dis9;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty9;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val9=$rate*$qty9;















$taxable_val=$g_val9+$del9-$diss9;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val9=$g_val9+$del9-$diss9;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val9;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss9;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate9=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate9=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs9=$cgst_val;$sgs9=$sgst_val;$igs9=0;}







if($bill_type=="central"){$cgs9=0;$sgs9=0;$igs9=$igst_val;}







 $total9=$taxable_val+$tax_rebate9;?>







</tr>







<?







$dis_pv9=$pv*$dis9;







$pv9=$pv*$qty9;







?>







<? } ?>















<? if($item10!=""){







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















				$qry->bind_param('s', $item10);								







                $qry->execute();







                $qry->bind_result($code,$prod_name,$rate,$pv,$cgst,$sgst,$igst,$uom,$batch_no,$mrp);







				while ($qry->fetch())







				{







				$code=$code;



 $batch_no=$batch_no;$mrp=$mrp;



				$prod_name=$prod_name;







				$rate=$rate;







				$pv=$pv;







				$cgst=$cgst;







				$sgst=$sgst;







				$igst=$igst;







				$uom=$uom;







				}







$diss10=$rate*$dis10;







?>







<tr>







<td><? echo $prod_name;?></td>







<td><? echo $code;?></td>







<td><? echo $qty10;?></td>



<td><? echo $batch_no;?></td>



<td><? echo $uom;?></td>







<?







$g_val10=$rate*$qty10;















$taxable_val=$g_val10+$del10-$diss10;







$cgst_val=$taxable_val*$cgst/100;







$igst_val=$taxable_val*$igst/100;







$sgst_val=$taxable_val*$sgst/100;







$gs_val10=$g_val10+$del10-$diss10;







?>







<td><? echo $rate;?></td>















<td><? echo $g_val10;?></td>







<td><? echo $mrp;?></td>







<td><? echo $diss10;?></td>







<td><? echo $taxable_val;?></td>







<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<td><table width="102" border="1">







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







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







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















<? if($bill_type=="central"){ $tax_rebate10=$igst_val; } ?>







<? if($bill_type=="state"){ $tax_rebate10=$cgst_val+$sgst_val; } ?>







<? 







if($bill_type=="state"){$cgs10=$cgst_val;$sgs10=$sgst_val;$igs10=0;}







if($bill_type=="central"){$cgs10=0;$sgs10=0;$igs10=$igst_val;}







 $total10=$taxable_val+$tax_rebate10;?>







</tr>







<?







$dis_pv10=$pv*$dis10;







$pv10=$pv*$qty10;







?>







<? } ?>







<?  $total=$total1+$total2+$total3+$total4+$total5+$total6+$total7+$total8+$total9+$total10;







$tot_qty=$qty1+$qty2+$qty3+$qty4+$qty5+$qty6+$qty7+$qty8+$qty9+$qty10;







$tot_vat=$tax_rebate1+$tax_rebate2+$tax_rebate3+$tax_rebate4+$tax_rebate5+$tax_rebate6+$tax_rebate7+$tax_rebate8+$tax_rebate9+$tax_rebate10;







$tot_dis_pv=$dis_pv1+$dis_pv2+$dis_pv3+$dis_pv4+$dis_pv5+$dis_pv6+$dis_pv7+$dis_pv8+$dis_pv9+$dis_pv10;







$tot_pvv=$pv1+$pv2+$pv3+$pv4+$pv5+$pv6+$pv7+$pv8+$pv9+$pv10;







$tot_pv=$tot_pvv-$tot_dis_pv;







$tot_g_val=$gs_val1+$gs_val2+$gs_val3+$gs_val4+$gs_val5+$gs_val6+$gs_val7+$gs_val8+$gs_val9+$gs_val10;















$tot_cgst=$cgs1+$cgs2+$cgs3+$cgs4+$cgs5+$cgs6+$cgs7+$cgs8+$cgs9+$cgs10;







$tot_sgst=$sgs1+$sgs2+$sgs3+$sgs4+$sgs5+$sgs6+$sgs7+$sgs8+$sgs9+$sgs10;







$tot_igst=$igs1+$igs2+$igs3+$igs4+$igs5+$igs6+$igs7+$igs8+$igs9+$igs10;







?>







<tr>







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







<td><?  echo $tot_qty;?></td>















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















</tr>







<tr>







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















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















</tr>







<tr>







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















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















</tr>







<tr>







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















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















</tr>







<?







$net_bill=$total-$dis;







$dists=$total*$discount/100;







$net_bill2=$total-$dists;







?>







<tr>







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







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







</tr>







<tr>







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







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







</tr>







<tr>















<td colspan="3" align="right"><b>Total B.P </b>: <? echo $tot_pv;?></td>







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







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







</tr>







<input type="hidden" name="name" value="<? echo $name;?>">







<input type="hidden" name="member_id" value="<? echo $member_id;?>">







<input type="hidden" name="ent_date" value="<? echo $ent_date;?>">







<input type="hidden" name="discount" value="<? echo $dis;?>">







<input type="hidden" name="dists" value="<? echo $dists;?>">







<input type="hidden" name="qty1" value="<? echo $qty1;?>">







<input type="hidden" name="qty2" value="<? echo $qty2;?>">







<input type="hidden" name="qty3" value="<? echo $qty3;?>">







<input type="hidden" name="qty4" value="<? echo $qty4;?>">







<input type="hidden" name="qty5" value="<? echo $qty5;?>">







<input type="hidden" name="qty6" value="<? echo $qty6;?>">







<input type="hidden" name="qty7" value="<? echo $qty7;?>">







<input type="hidden" name="qty8" value="<? echo $qty8;?>">







<input type="hidden" name="qty9" value="<? echo $qty9;?>">







<input type="hidden" name="qty10" value="<? echo $qty10;?>">















<input type="hidden" name="item1" value="<? echo $item1;?>">







<input type="hidden" name="item2" value="<? echo $item2;?>">







<input type="hidden" name="item3" value="<? echo $item3;?>">







<input type="hidden" name="item4" value="<? echo $item4;?>">







<input type="hidden" name="item5" value="<? echo $item5;?>">







<input type="hidden" name="item6" value="<? echo $item6;?>">







<input type="hidden" name="item7" value="<? echo $item7;?>">







<input type="hidden" name="item8" value="<? echo $item8;?>">







<input type="hidden" name="item9" value="<? echo $item9;?>">







<input type="hidden" name="item10" value="<? echo $item10;?>">







<input type="hidden" name="gst_no" value="<? echo $gst_no;?>">







<input type="hidden" name="dis1" value="<? echo $dis1;?>">







<input type="hidden" name="dis2" value="<? echo $dis2;?>">







<input type="hidden" name="dis3" value="<? echo $dis3;?>">







<input type="hidden" name="dis4" value="<? echo $dis4;?>">







<input type="hidden" name="dis5" value="<? echo $dis5;?>">







<input type="hidden" name="dis6" value="<? echo $dis6;?>">







<input type="hidden" name="dis7" value="<? echo $dis7;?>">







<input type="hidden" name="dis8" value="<? echo $dis8;?>">







<input type="hidden" name="dis9" value="<? echo $dis9;?>">







<input type="hidden" name="dis10" value="<? echo $dis10;?>">















<input type="hidden" name="del1" value="<? echo $del1;?>">







<input type="hidden" name="del2" value="<? echo $del2;?>">







<input type="hidden" name="del3" value="<? echo $del3;?>">







<input type="hidden" name="del4" value="<? echo $del4;?>">







<input type="hidden" name="del5" value="<? echo $del5;?>">







<input type="hidden" name="del6" value="<? echo $del6;?>">







<input type="hidden" name="del7" value="<? echo $del7;?>">







<input type="hidden" name="del8" value="<? echo $del8;?>">







<input type="hidden" name="del9" value="<? echo $del9;?>">







<input type="hidden" name="del10" value="<? echo $del10;?>">















<input type="hidden" name="total" value="<? echo $total;?>">







<input type="hidden" name="vat" value="<? echo $tot_vat;?>">







<input type="hidden" name="tot_pv" value="<? echo $tot_pv;?>">















<input type="hidden" name="tot_g_val" value="<? echo $tot_g_val;?>">







<input type="hidden" name="tot_cgst" value="<? echo $tot_cgst;?>">







<input type="hidden" name="tot_sgst" value="<? echo $tot_sgst;?>">







<input type="hidden" name="tot_igst" value="<? echo $tot_igst;?>">







<input type="hidden" name="bill_type" value="<? echo $bill_type;?>">















<tr>







	







	<td align="center" colspan="13"><input type="submit" name="submit" value="Submit.."></td>







</tr>







</table>







</form>




















<? } ?>



						<?  ?>
					



<?php if($action=="voucher")



				{



				$member_id=$_REQUEST['member_id'];



				$bill_no=$_REQUEST['bill_no'];



				 ?>



				



				<? 



				



				?>



				



                                

 <table class="table table-bordered mb-4">




<tr>



                                  <td valign="top" align="center"> Invoice</td>



                                </tr>



								 <tr>



										   <td colspan="4" align="center">



										   <input type="button" value="PRINT Invoice" onclick="window.open('print_bill.php?bill_no=<? echo $bill_no;?>', '','width=740,height=500,scrollbars=yes,resizable=yes,toolbar=yes,directories=no,location=no,menubar=no,status=no,left=50,top=0'); return true;" />



										   </td>



										 </tr>



										  



</table>







					



				<?php 



				



				



				}?>
						
						



                            </div>

                        </div>



                    

                



                    



                    



                </div>

				

	
<?







if($action=="add_process")







{







$member_id=$_REQUEST['member_id'];







$stock_id=$_SESSION['admin_id'];







$gr_date=date("Y-m-d:his");







$qry = $mysqli->prepare('SELECT * FROM bill where bill_no=?');







						 $qry->bind_param('s', $gr_date);







						$qry->execute();







						$qry->store_result();







						$bill_entry=$qry->num_rows;







while($bill_entry == 1) // If find same user ID in DB







{







$gr_date=date("Y-m-d:his");















$qry = $mysqli->prepare('SELECT * FROM bill where bill_no=?');







						 $qry->bind_param('s', $gr_date);







						$qry->execute();







						$qry->store_result();







						$bill_entry=$qry->num_rows;







}







$bill_type=$_REQUEST['bill_type'];







$total=$_REQUEST['total'];















$temp_no= mt_rand (1000000001, 9999999999); // Syntex : int mt_rand ( [int min, int max])



$temp_no=$temp_no;







														







$bill_no=$gr_date.$temp_no;														







$vat_no=$temp_no;







//$doc_name=$_REQUEST['doc_name'];







//$name=$_REQUEST['name'];







$ent_date=$_REQUEST['ent_date'];















$en_dat=explode("-",$ent_date);







$en_date_val=$en_dat[2].$en_dat[1].$en_dat[0];










$qty1=$_REQUEST['qty1'];







$qty2=$_REQUEST['qty2'];







$qty3=$_REQUEST['qty3'];







$qty4=$_REQUEST['qty4'];







$qty5=$_REQUEST['qty5'];







$qty6=$_REQUEST['qty6'];







$qty7=$_REQUEST['qty7'];







$qty8=$_REQUEST['qty8'];







$qty9=$_REQUEST['qty9'];







$qty10=$_REQUEST['qty10'];















$item1=$_REQUEST['item1'];







$item2=$_REQUEST['item2'];







$item3=$_REQUEST['item3'];







$item4=$_REQUEST['item4'];







$item5=$_REQUEST['item5'];







$item6=$_REQUEST['item6'];







$item7=$_REQUEST['item7'];







$item8=$_REQUEST['item8'];







$item9=$_REQUEST['item9'];







$item10=$_REQUEST['item10'];















$dis1=$_REQUEST['dis1'];







$dis2=$_REQUEST['dis2'];







$dis3=$_REQUEST['dis3'];







$dis4=$_REQUEST['dis4'];







$dis5=$_REQUEST['dis5'];







$dis6=$_REQUEST['dis6'];







$dis7=$_REQUEST['dis7'];







$dis8=$_REQUEST['dis8'];







$dis9=$_REQUEST['dis9'];







$dis10=$_REQUEST['dis10'];















$del1=$_REQUEST['del1'];







$del2=$_REQUEST['del2'];







$del3=$_REQUEST['del3'];







$del4=$_REQUEST['del4'];







$del5=$_REQUEST['del5'];







$del6=$_REQUEST['del6'];







$del7=$_REQUEST['del7'];







$del8=$_REQUEST['del8'];







$del9=$_REQUEST['del9'];







$del10=$_REQUEST['del10'];















$discount=$_REQUEST['discount'];







$dists=$_REQUEST['dists'];







$total=$_REQUEST['total'];







$vat=$_REQUEST['vat'];







$tot_pv=$_REQUEST['tot_pv'];







$tot_g_val=$_REQUEST['tot_g_val'];







$tot_cgst=$_REQUEST['tot_cgst'];







$tot_sgst=$_REQUEST['tot_sgst'];







$tot_igst=$_REQUEST['tot_igst'];







$gst_no=$_REQUEST['gst_no'];



if($gst_no==""){$gst_no="N";}


$quryin=$mysqli->prepare("select cwallet_in  from admin_account_login where id=?");
$quryin->bind_param("s", $stock_id);
$quryin->execute();
$quryin->bind_result($cwallet_in);
while($quryin->fetch())
{

$cwallet_in=$cwallet_in;
}


if($total>$cwallet_in)
{

$_SESSION['msg_box2']="<a href=# class=close><img src=resources/images/icons/cross_grey_small.png title=Close this notification alt=close /></a>
<div>
Please Check Product Wallet.
</div>";
$_SESSION['class_notification2']="notification success png_bg";	
header("location:product_request.php?tab_id=tab1&default=product_request");
}
else
{




if($item1!="")







{

$insert1=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert1->bind_param("sssssssss", $item1, $bill_no, $qty1, $vat_no, $ent_date, $en_date_val, $member_id, $dis1, $del1);
$insert1->execute();

}















if($item2!="")
{
$insert2=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert2->bind_param("sssssssss", $item2, $bill_no, $qty2, $vat_no, $ent_date, $en_date_val, $member_id, $dis2, $del2);
$insert2->execute();
}







if($item3!="")
{
$insert3=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert3->bind_param("sssssssss", $item3, $bill_no, $qty3, $vat_no, $ent_date, $en_date_val, $member_id, $dis3, $del3);
$insert3->execute();
}

if($item4!="")

{
$insert4=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert4->bind_param("sssssssss", $item4, $bill_no, $qty4, $vat_no, $ent_date, $en_date_val, $member_id, $dis4, $del4);
$insert4->execute();
}







if($item5!="")

{
$insert5=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert5->bind_param("sssssssss", $item5, $bill_no, $qty5, $vat_no, $ent_date, $en_date_val, $member_id, $dis5, $del5);
$insert5->execute();
}

if($item6!="")
{
$insert6=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert6->bind_param("sssssssss", $item6, $bill_no, $qty6, $vat_no, $ent_date, $en_date_val, $member_id, $dis6, $del6);
$insert6->execute();
}







if($item7!="")
{
$insert7=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert7->bind_param("sssssssss", $item7, $bill_no, $qty7, $vat_no, $ent_date, $en_date_val, $member_id, $dis7, $del7);
$insert7->execute();
}

if($item8!="")
{
$insert8=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert8->bind_param("sssssssss", $item8, $bill_no, $qty8, $vat_no, $ent_date, $en_date_val, $member_id, $dis8, $del8);
$insert8->execute();
}







if($item9!="")
{
$insert9=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert9->bind_param("sssssssss", $item9, $bill_no, $qty9, $vat_no, $ent_date, $en_date_val, $member_id, $dis9, $del9);
$insert9->execute();
}







if($item10!="")
{
$insert10=$mysqli->prepare("insert into bill_req (item_code, bill_no, qty, vat_no, date, date_val, member_id, dis, del) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert10->bind_param("sssssssss", $item10, $bill_no, $qty10, $vat_no, $ent_date, $en_date_val, $member_id, $dis10, $del10);
$insert10->execute();
}



$admin_id=$_SESSION['admin_id'];  






$qry_ins=$mysqli->prepare("insert into report_req (bill_no, vat_no, total, member_id, date, date_val, discount, admin_id, gross_bill, total_pv,vat,sgst,cgst,igst,bill_type,stock_id,gst_no) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$qry_ins->bind_param("sssssssssssssssss", $bill_no, $vat_no, $total, $member_id, $ent_date, $en_date_val, $dists,$admin_id,$total,$tot_pv,$vat,$tot_sgst,$tot_cgst,$tot_igst,$bill_type,$stock_id,$gst_no);
$qry_ins->execute();




//----------------------Direct Income Start---------------






//----------------------------End-----------------

$remark="Purchase For ".$bill_no;
$type="Debit";
$wallet_type="F-Wallet";
$sts="y";
$date=date("d-m-Y");
$date_val=date("Ymd");
$stake_time=date("Y-m-d H:i:s");
$insert=$mysqli->prepare("insert into walet (member_id, amount, type, remark, wallet_type, status, date, date_val,stake_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
$insert->bind_param("sssssssss", $stock_id, $total, $type, $remark, $wallet_type, $sts, $date, $date_val,$stake_time);
$insert->execute();
$quryin=$mysqli->prepare("select cwallet,cwallet_in  from admin_account_login where id=?");
$quryin->bind_param("s", $stock_id);
$quryin->execute();
$quryin->bind_result($cwallet,$cwallet_in);
while($quryin->fetch())
{

$cwallet=$cwallet;
$cwallet_in=$cwallet_in;
}
$cwallet=$cwallet-$total;
$cwallet_in=$cwallet_in-$total;
$up_ewt=$mysqli->prepare("update admin_account_login set cwallet=?,cwallet_in=? where id=?");
$up_ewt->bind_param('sss', $cwallet,$cwallet_in,$stock_id);
$up_ewt->execute();			














	








 $_SESSION['msg_box2']="<a href=# class=close><img src=resources/images/icons/cross_grey_small.png title=Close this notification alt=close /></a>
<div>
Request Submitted Successfully.
</div>";
$_SESSION['class_notification2']="notification success png_bg";	
header("location:product_request.php?tab_id=tab1&default=product_request");























}



}


?>