<?PHP
ob_start();
session_start();
include 'connect.php';
if(isset($_SESSION['adminemail']))
{
$user=$_SESSION['adminemail'];

$gtp=mysqli_query($conn,"select * from admin where username='$user'");
$gtp1=mysqli_fetch_assoc($gtp);

include 'top.php';
?>


<div id="page-wrapper" >
          <div id="page-inner">
<div class="main-content">
				<div class="main-content-inner">
					<div class="breadcrumbs ace-save-state" id="breadcrumbs">
						<ul class="breadcrumb">
							<li>
								<i class="ace-icon fa fa-home home-icon"></i>
								<a href="#">Home</a>
							</li>
							<li class="active">Sales Order</li>
						</ul><!-- /.breadcrumb -->
					</div>

					<div class="page-content">
			

						<div class="page-header">
                        
<?php

$aca=mysqli_query($conn,"select * from financial where user='$user' order by ID desc");
$aca1=mysqli_fetch_assoc($aca);

$financial=$aca1['financial'];

?>                        
                        
							<table style="width:100%;">
                        
                        <tr><td style="width:50%;">
                        
							<h1>
								Sales Order
							</h1>
                            
                            </td>
                            
                            <td style="width:50%; text-align:right; padding-right:15px; font-size:15px;">
                            
                            <i class="fa fa-calendar"></i>&nbsp; <?php echo $financial; ?>
                            
                            </td></tr></table>
                            
						</div><!-- /.page-header -->
<br />

						<div class="row">
							<div class="col-xs-12">
                            
								<!-- PAGE CONTENT BEGINS -->
                                
<script src="assets/js/jquery.js"></script>
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
  <script>
    $(function() {
      // Initialize the datepicker
      $("#datepicker").datepicker({
        format: "mm/dd/yyyy",
        autoclose: true,
        todayHighlight: true
      });

      // Adjust the positioning of the datepicker dropdown
      $("#datepicker").on("show", function(e) {
        var inputOffset = $(this).offset();
        var inputHeight = $(this).outerHeight();
        var datepickerDropdown = $(".datepicker-dropdown");

        datepickerDropdown.css({
          top: inputOffset.top + inputHeight + 10,
          left: inputOffset.left
        });
      });
    });
  </script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.min.css">
 <style>
    /* Custom CSS for Chosen select */
    .chosen-container {
      width: 25ch;
    }

    .chosen-container-single .chosen-single {
      border-radius: 4px;
      border: 1px solid #f0f0f0; /* Change the border color here */
      height:34px;
	  margin-bottom:10px;
      background-color: #fff;
      background-image: none;
      box-shadow: 0 0 0 1px #c0c0c0;
    }

    .chosen-container-single .chosen-single span {
      padding: 5px;
      text-transform: uppercase;
    }

    .chosen-container-single .chosen-search input[type="text"] {
      border-radius: 4px;
      border: 1px solid #c0c0c0;
      height: 34px;
    }

    .chosen-container-active .chosen-single {
      border-color: #7f7f7f;
      box-shadow: 0 0 0 1px #7f7f7f;
    }

    .chosen-container-active .chosen-single:hover {
      border-color: #7f7f7f;
      box-shadow: 0 0 0 1px #7f7f7f;
    }

    .chosen-container-active .chosen-search input[type="text"] {
      border-color: #7f7f7f;
    }
  </style>

<script>
$(function() {
  // Initialize the Chosen select element
  $(".chosen-select").chosen({
    width: '32ch',
    disable_search_threshold: 10
  });
});
</script>
<script>
	
jQuery(function($){
		   
	// simple jQuery validation script
	$('#work').submit(function(){
		
		var valid = true;
		var errormsg = 'This field is required!';
		var errorcn = 'error';
		
		$('.' + errorcn, this).remove();			
		
		$('#required', this).each(function(){
			var parent = $(this).parent();
			if( $(this).val() == '' ){
				var msg = $(this).attr('title');
				msg = (msg != '') ? msg : errormsg;
				$('<span style="font-size:13px;color:#FF0000; padding-left:3px;" class="'+ errorcn +'">'+ msg +'</span>')
					.appendTo(parent)
					.fadeIn('fast')
					.click(function(){ $(this).remove(); });
				valid = false;
			};
		});
		
		//All Fields Empty

	

	  var len=$('.item-row').length;

	  var r=0;

	  $('.row').each(function(i){

	  

	  var row = $(this).parents('.worker_row');

	  var category = row.find('.category').val();
	  
	  var product = row.find('.product').val();

	  var qty = row.find('.qty').val()*1;

	  var rate = row.find('.rate').val()*1;

	  

	  //alert(rn);

	  
	  if(category=='')

	  {

	  alert('Select Category');

	  

	  valid=false;

	  

	  }

	  else if(product=='')

	  {

	  alert('Select Product');

	  

	  valid=false;

	  

	  }

	  else if(qty=='')

	  {

	  alert('Enter qty');

	  

	  valid=false;

	  

	  }

	  else if(rate=='')

	  {

	  alert('Enter rate');

	  

	  valid=false;	  

	  }

		

	  });
		
		return valid;
	});
	
});	

</script>

<script type="text/javascript">

	//global var
	var maxRowNum = 1;
	var selectedId = 0;

function update_total() {

  var total = 0;

  $('.price').each(function(i){

    price = $(this).html().replace("Rs.","");

    if (!isNaN(price)) total += Number(price);

  });



  total = total.toFixed(2);

  //alert(total);

  $('.samount').html("Rs."+total);
  

}

function update_price() {

  var row = $(this).parents('.worker_row');

  

  var price = row.find('.rate').val().replace("Rs.","") * row.find('.qty').val();

  

  //alert(price);

  

  var cgst=row.find('.cgst').val()*1;

  var sgst=row.find('.sgst').val()*1;

  var igst=row.find('.igst').val()*1;

   

  var p1=price*cgst/100;

  var p2=price*sgst/100;

  var p3=price*igst/100;

  

  //alert(p1);

  

  var totalpr=price+p1+p2+p3;

  

  totalpr=totalpr.toFixed(2);

  

  isNaN(totalpr) ? row.find('.price').html("N/A") : row.find('.price').html(totalpr);

  update_total();

}


function bind() {

  $(".rate").blur(update_price);

  $(".qty").blur(update_price);

  $(".cgst").blur(update_price);

  $(".sgst").blur(update_price);

  $(".igst").blur(update_price);
  
}

$(document).ready(function() {


bind();


$("#addrow").click(function(){
maxRowNum++;
//alert($max);
    $(".worker_row:last").after("<tr align='center' class='worker_row'><td id='page' class='item-name' style='padding-top:10px;'><input type='hidden' name='row["+ maxRowNum +"]' value='"+ maxRowNum +"' class='row'><div class='delete-wpr'>&nbsp; <a class='delete' href='javascript:;' title='Remove row'>X </a></div></td><td style='padding-top:10px;'><select style='width: 25ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;'  name='category["+ maxRowNum +"]' class='category' style='width:170px;'><option value=''>Select Category</option><?php $cate=mysqli_query($conn,"select * from product_category where ID<='4' order by category asc"); while($cate1=mysqli_fetch_assoc($cate)){ echo"<option value='".$cate1['ID']."'>".$cate1['category']."</option>"; } ?></select></td><td style='padding-top:10px;'><select style='width: 25ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' name='product["+ maxRowNum +"]' class='product' style='width:170px;'><option value='' selected='selected'>Select Product</option></select></td><td style='padding-top:10px;'><input style='width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' type='text' name='unit["+ maxRowNum +"]' class='unit' style='width:50px;' placeholder='unit' autocomplete='off' readonly='true' /></td><td style='padding-top:10px;'><input style='width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' type='text' name='qty["+ maxRowNum +"]' class='qty' style='width:50px;' placeholder='Qty' autocomplete='off' /></td><td style='padding-top:10px;'><input style='width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' type='text' name='rate["+ maxRowNum +"]' class='rate' style='width:50px;' placeholder='Rate' autocomplete='off' /></td><td style='padding-top:10px;'><input style='width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' type='text' name='cgst["+ maxRowNum +"]' style='width:45px;' class='cgst' placeholder='CGST' autocomplete='off' /></td><td style='padding-top:10px;'><input style='width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' type='text' name='sgst["+ maxRowNum +"]' style='width:45px;' class='sgst' placeholder='SGST' autocomplete='off' /></td><td style='padding-top:10px;'><input style='width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;' type='text' name='igst["+ maxRowNum +"]' style='width:45px;' class='igst' placeholder='IGST' autocomplete='off' /></td><td style='padding-top:10px;'><span class='price'>0.00</span></td></tr>");
	
    if ($(".delete").length > 0) $(".delete").show();
	    bind();
		
		//alert("ds");
		
		  });
		  
		  
bind();

});


$(".category").live('change',function(){

  var row = $(this).parents('.worker_row');

  var category=row.find('.category').val();		  

 var dataString = 'category='+ category;

 //alert(dataString);

    $.ajax

({

type: "GET",

url: "getproduct.php",

data: dataString,

cache: false,

success: function( resp )

{

	//alert(resp);

	row.find('.product').html($('#material',resp).html());

}

});

});


    $(".product").live('change',function(){

var row = $(this).parents('.worker_row');

 var product=row.find('.product').val();

 var dataString = 'product='+ product;

//alert(dataString);

   $.ajax

({

type: "GET",

url: "getrate.php",

data: dataString,

cache: false,

success: function(html)

{

//alert(html);	

var unit=$(html).filter('#unit').text();

row.find('.unit').val(unit);

}

});

});

$(".delete").live('click',function(){
    $(this).parents('.worker_row').remove();
    update_total();
    if ($(".delete").length < 2) $(".delete").hide();
  });


$(".district").live('change',function() {



		  var district=$(this).val();



		  var dataString = 'district='+ district;



		  //alert(dataString);



		  $.ajax



		  ({



		  type: "GET",



		  url: "gettaluk.php",



		  data: dataString,



		  cache: false,



		  success: function(resp)



		  {

		  

		  $('.taluk').html($('#taluk',resp).html());



		  }



		  });



});





$(".taluk").live('change',function() {



		  var taluk=$(this).val();



		  var dataString = 'taluk='+ taluk;



		  //alert(dataString);



		  $.ajax



		  ({



		  type: "GET",



		  url: "getvillage.php",



		  data: dataString,



		  cache: false,



		  success: function(resp)



		  {

		  

		  $('.village').html($('#village',resp).html());



		  }



		  });



});


</script>

<?php
	
if(isset($_POST['submit']))
{
	
		$followid=$_POST['followid'];
	
		$date=$_POST['date'];

		$customer=$_POST['customer'];

		$orderno=$_POST['orderno'];
		
		$ordno=$_POST['ordno'];

		$product=$_POST['product'];
		
		$code=$_POST['code'];

		$hsn=$_POST['hsn'];

		$rate=$_POST['rate'];

		$qty=$_POST['qty'];

		$discount=$_POST['discount'];

		$cgst=$_POST['cgst'];

		$sgst=$_POST['sgst'];

		$igst=$_POST['igst'];

		$row=$_POST['row'];
		
		$executive=$_POST['executive'];
		
		$mobile=$_POST['mobile'];
		
		$village=$_POST['village'];
		
		$taluk=$_POST['taluk'];
		
		$district=$_POST['district'];

		$date=date('Y-m-d',strtotime($date));


		$csk=mysqli_query($conn,"select * from sales_order where orderno='$orderno'");
		$csk1=mysqli_num_rows($csk);
		if($csk1>0)
		{
		$chk=mysqli_query($conn,"select max(orderno) as orderno from sales_order");
		$chk1=mysqli_fetch_assoc($chk);
		$orderno=$chk1['orderno']+1;
		}
		else
		{
		$orderno=$orderno;
		}
		
		
		
		$chek=mysqli_query($conn,"select * from sales_order where ordno='$ordno' and financial='$financial'");
		$chek1=mysqli_num_rows($chek);
		if($chek1>0)
		{
		$chck=mysqli_query($conn,"select max(ordno) as ordno from sales_order where financial='$financial'");
		$chck1=mysqli_fetch_assoc($chck);
		$ordno=$chck1['ordno']+1;
		}
		else
		{
		$ordno=$ordno;
		}


if($customer)
{

foreach($row as $rw)
{

				$prod=$product[$rw];

				$cos=$rate[$rw];

				$qt=$qty[$rw];

				$dis=$discount[$rw];

				$cgs=$cgst[$rw];

				$sgs=$sgst[$rw];

				$igs=$igst[$rw];

				

				$totalrate=$cos*$qt;

				

				$totalrate=$totalrate;

				

				$cgsam=$totalrate*$cgs/100;

				$sgsam=$totalrate*$sgs/100;

				$igsam=$totalrate*$igs/100;

				

				$finalrate=$totalrate+$cgsam+$sgsam+$igsam;


$insert="INSERT into sales_order(date,customer,product,rate,qty,total,orderno,cgst,sgst,igst,cgst_amt,sgst_amt,igst_amt,ordno,financial,executive)

values('$date','$customer','$prod','$cos','$qt','$finalrate','$orderno','$cgs','$sgs','$igs','$cgsam','$sgsam','$igsam','$ordno','$financial','$executive')";

mysqli_query($conn,$insert) or die(mysqli_error($conn));

}

}


if($insert){

$up=mysqli_query($conn,"update followup set status='Confirmed',salesorderno='$orderno' where ID='$followid'");

header("location:viewsalesorder.php?id=".$orderno."&s=1" . urlencode($Message));

$upc=mysqli_query($conn,"update customer set mobile1='$mobile',district='$district',taluk='$taluk',village='$village' where ID='$customer'");

}

else{

echo "<script type='text/javascript'>alert('Field Missing.');</script><META HTTP-EQUIV = 'Refresh' Content = '1; URL =salesorder.php'>";

}

}

else
{
	
	if(isset($_GET['s'])) 
	{
	 $status=$_GET['s'];
		 if($status=='1')
		 {
		 echo '<div class="alert alert-success">
				<a class="close" data-dismiss="alert">x</a>
					<strong>Sales Order Created Successfully !</strong>
			  </div>';
		}
	}

$id=$_GET['id'];

$folow=mysqli_query($conn,"select * from followup where ID='$id'");
$folow1=mysqli_fetch_assoc($folow);

$ccs=mysqli_query($conn,"select * from crm_customer where ID='$folow1[customer]'");
$ccs1=mysqli_fetch_assoc($ccs);

$vil=mysqli_query($conn,"select * from villages where ID='$ccs1[village]'");
$vil1=mysqli_fetch_assoc($vil);

$tlk=mysqli_query($conn,"select * from taluk where ID='$ccs1[taluk]'");
$tlk1=mysqli_fetch_assoc($tlk);

$dis=mysqli_query($conn,"select * from districts where ID='$ccs1[district]'");
$dis1=mysqli_fetch_assoc($dis);

if($ccs1['salescustid']=='')
{
	
	$cnm=mysqli_query($conn,"select MAX(ID) as id from customer");
	$cnm1=mysqli_fetch_assoc($cnm);
	
	$cnid=$cnm1['id']+1;
	
	$ins=mysqli_query($conn,"insert into customer(ID,name,doorno,state,district,cultivatingcrop,executive,mobile1,taluk,village) values('$cnid','$ccs1[name]','$ccs1[address]','$ccs1[state]','$ccs1[district]','$ccs1[cultivatingcrop]','$folow1[executive]','$folow1[mobile]','$folow1[taluk]','$folow1[village]')");
	
	$up=mysqli_query($conn,"update crm_customer set salescustid='$cnid' where ID='$folow1[customer]'");

}
else
{
	$cnid=$ccs1['salescustid'];
}

$mx=mysqli_query($conn,"select MAX(orderno) as orderno from sales_order") or die(mysqli_error($conn));
$mx1=mysqli_fetch_assoc($mx);
$neworder=$mx1['orderno']+1;

$nmx=mysqli_query($conn,"select MAX(ordno) as ordno from sales_order where financial='$financial'") or die(mysqli_error($conn));
$nmx1=mysqli_fetch_assoc($nmx);
$neword=$nmx1['ordno']+1;

$sel=mysqli_query($conn,"select * from admin where username='$user'");
$nmrw=mysqli_num_rows($sel);
$sel1=mysqli_fetch_assoc($sel);

echo'<form action="salesorder1.php" method="post" id="work">

<input type="hidden" name="followid" value="'.$id.'" />

<center><table width="85%" id="page" style="line-height:35px;">

<tr><td style="width:13%;">Order No. <span class="red"></span></td><td> <input  type="hidden" name="orderno" id="required" title="*" value="'.$neworder.'" readonly="true" /><input class="form-control" style="width: 30ch; margin-bottom:10px" type="text" name="ordno" id="required" title="*" value="'.$neword.'" readonly="true" />

</td><td style="width:75px;"></td><td>Date <span class="red"></span></td><td><input class="form-control" style="width: 30ch; margin-bottom:10px" type="text" name="date" id="datepicker" title="*" class="datepicker" value="'.date('d-m-Y').'" autocomplete="off" /required></td></tr>

<tr><td colspan="3">';

echo'</td><td style="width:55px;"></td><td></td></tr>

<tr><td>Customer <span class="red"></span></td><td><select class="chosen-select" name="customer" id="required" title="*" style="width:220px;"><option value="">Select Customer</option>';

$sup=mysqli_query($conn,"select * from customer order by ID asc");
while($sup1=mysqli_fetch_assoc($sup))
{
	$ctm="<option value='".$sup1['ID']."'>".$sup1['name']."</option>";
	$ctm=str_replace("<option value='".$cnid."'","<option value='".$cnid."' selected",$ctm);
	echo $ctm;
}

echo'</select></td><td style="width:55px;"></td><td>Factory</td><td> <select class="form-control" style="width: 30ch; margin-bottom:10px" name="factory" style="width:220px;"><option value="">Select Factory</option>';

$fac=mysqli_query($conn,"select * from factory order by ID asc");
while($fac1=mysqli_fetch_assoc($fac))
{
	echo"<option value='".$fac1['ID']."'>".$fac1['factory']."</option>";
}

echo'</select></td></tr>

<tr><td style="width:13%;">Mobile</td><td> <input class="form-control" style="width: 30ch; margin-bottom:10px" type="text" name="mobile" value="'.$ccs1['mobile'].'" /></td>

<td style="width:75px;"></td><td>District</td><td> <select style="width: 30ch; margin-bottom:10px; height:34px;border-radius: 5px;border: 1px solid #c0c0c0;" name="district" class="district" style="width:220px;"><option value="" selected="selected">-- Select --</option>';

$disn=mysqli_query($conn,"select * from districts where state='32'");
while($disn1=mysqli_fetch_assoc($disn))
{
	$sdis="<option value='".$disn1['ID']."'>".$disn1['district']."</option>";
	$sdis=str_replace("<option value='".$ccs1['district']."'","<option value='".$ccs1['district']."' selected",$sdis);
	echo $sdis;
}

echo'</select></td></tr>

<tr><td style="width:13%;">Taluk</td><td> <select style="width: 30ch; margin-bottom:10px; height:34px;border-radius: 5px;border: 1px solid #c0c0c0;" name="taluk" class="taluk" style="width:220px;"><option value="" selected="selected">-- Select --</option>';

$tlk=mysqli_query($conn,"select * from taluk where district='$ccs1[district]'");
while($tlk1=mysqli_fetch_assoc($tlk))
{
	$stlk="<option value='".$tlk1['ID']."'>".$tlk1['taluk']."</option>";
	$stlk=str_replace("<option value='".$ccs1['taluk']."'","<option value='".$ccs1['taluk']."' selected",$stlk);
	echo $stlk;
}

echo'</select></td>

<td style="width:75px;"></td><td>Village</td><td> <select style="width: 30ch; margin-bottom:10px; height:34px;border-radius: 5px;border: 1px solid #c0c0c0;" name="village" class="village" style="width:220px;"><option value="" selected="selected">-- Select --</option>';

$vil=mysqli_query($conn,"select * from villages where taluk='$ccs1[taluk]'");
while($vil1=mysqli_fetch_assoc($vil))
{
	$svil="<option value='".$vil1['ID']."'>".$vil1['village']."</option>";
	$svil=str_replace("<option value='".$ccs1['village']."'","<option value='".$ccs1['village']."' selected",$stlk);
	echo $svil;
}

echo'</select></td></tr>

<tr><td style="width:13%;">Executive</td><td> ';

if($nmrw>0)
{
echo'<select style="width: 30ch; margin-bottom:10px; height:34px;border-radius: 5px;border: 1px solid #c0c0c0;" name="executive" style="width:220px;"><option value="">Select Executive</option>';

$exct=mysqli_query($conn,"select * from employee");
while($exct1=mysqli_fetch_assoc($exct))
{
	$sxct="<option value='".$exct1['ID']."'>".$exct1['name']."</option>";
	$sxct=str_replace("<option value='".$folow1['executive']."'","<option value='".$folow1['executive']."' selected",$sxct);
	echo $sxct;
}

echo'</select>';
}
else
{

$empd=mysqli_query($conn,"select * from employee where ID='".$folow1['executive']."'");
$empd1=mysqli_fetch_assoc($empd);

echo"<input type='hidden' name='executive' class='executive' value='".$usr."' />

<input type='text' readonly='true' value='".$empd1['name']."' />";

}

echo'</td>

<td style="width:75px;"></td><td></td><td></td></tr>

</table><br />

<br />

<br><table width="90%" style="line-height:25px; border:1px solid #dddddd; font-size:12px;">
			<tr height="25" bgcolor="#eaf5f8" border="1">
			<th width="3%"></th>
	
			<th style="width:10%; text-align:center;">Category</th>
		
			<th style="width:15%; text-align:center;">Product</th>
			
			<th style="width:7%; text-align:center;">Unit</th>
			
			<th style="width:7%; text-align:center;">Qty</th>
		
			<th style="width:7%; text-align:center;">Rate</th>
		
			<th style="width:7%; text-align:center;">CGST (%)</th>
		
			<th style="width:7%; text-align:center;">SGST (%)</th>
		
			<th style="width:7%; text-align:center;">IGST (%)</th>
		
			<th style="width:7%; text-align:center;">Amount</th>
			
			</tr>
			
			  <tr class="worker_row" align="center" style="margin-top:10px;">

		        <td id="page" style="padding-top:11px;"><a class="delete" href="javascript:;" title="Remove row">X</a></td>

				<td id="page" style="padding-top:11px;"><input type="hidden" name="row[1]" class="row" value="1" />
				
				<select style="width: 25ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  name="category[1]" class="category" style="width:170px;"><option value="">Select Category</option>';
				
				$cate=mysqli_query($conn,"select * from product_category where ID<='4' order by category asc");
				while($cate1=mysqli_fetch_assoc($cate))
				{
					echo"<option value='".$cate1['ID']."'>".$cate1['category']."</option>";
				}
				
				echo'</select></td>
		
				<td id="page" style="padding-top:11px;"><select style="width: 25ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  name="product[1]" class="product" style="width:170px;"><option value="" selected="selected">Select Product</option></select></td>
				
				<td id="page" style="padding-top:11px;"><input style="width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  type="text" name="unit[1]" class="unit" style="width:50px;" placeholder="Unit" autocomplete="off" readonly="true" /></td>
				
				<td id="page" style="padding-top:11px;"><input style="width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  type="text" name="qty[1]" class="qty" style="width:50px;" placeholder="Qty" autocomplete="off" /></td>
		
				<td id="page" style="padding-top:11px;"><input style="width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  type="text" name="rate[1]" class="rate" style="width:50px;" placeholder="Rate" autocomplete="off" /></td>
				
				<td id="page" style="padding-top:11px;"><input style="width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  type="text" name="cgst[1]" style="width:45px;" class="cgst" placeholder="CGST" autocomplete="off" /></td>
		
				<td id="page" style="padding-top:11px;"><input style="width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  type="text" name="sgst[1]" style="width:45px;" class="sgst" placeholder="SGST" autocomplete="off" /></td>
		
				<td id="page" style="padding-top:11px;"><input style="width: 10ch; margin-bottom:10px;border-radius: 4px;border: 1px solid #c0c0c0;height:34px;"  type="text" name="igst[1]" style="width:45px;" class="igst" placeholder="IGST" autocomplete="off" /></td>
		
				<td id="page" style="padding-top:11px;"><span class="price">0.00</span></td>
			  
			  </tr>

			  <tr id="hiderow">
			  
		      <td id="page" colspan="7"><a id="addrow" href="javascript:;" title="Add a row">Add Row</a></td>
			  
		      </tr>
			 
			  </table>
			  
			  <br /><br />
			  
			  <table style="width:85%; margin:auto;">
			  
			  <tr><td style="width:80%;">
			  
			  
			  </td>
			  
			  <td style="width:20%;">
			  
			  <table style="line-height:35px;">
			  
			  <tr><td>Total</td><td style="padding:0 7px 0 7px;">:</td><td><div class="samount"></div></td></tr>
			  
			  <tr><td colspan="3" style="text-align:center;"><button id="save" type="submit" class="btn btn-sm btn-primary" name="submit" value="Add">Save</button></td></tr>
			  
			  </table>
			  
			  </td></tr></table>
			  
</center>

<br />

</form>';

}
	
?>                             
                               
							<br>
<br>
	

								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					

</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->
			</div><!-- /.main-content -->
			</div><!-- /.main-content -->


<?php
include 'bottom.php';
}
else
{

 header("location:login.php");
}
ob_flush();
?>