<?php include 'header.php';?>

<style>

/* Chrome, Safari, Edge, Opera */

input::-webkit-outer-spin-button,

input::-webkit-inner-spin-button {

  -webkit-appearance: none;

  margin: 0;

}


 
/* Firefox */ 

input[type=number] {

  -moz-appearance: textfield;

}

</style>
<?php
$qry10 = "select * from vendor_master where vendor_id = '".$_REQUEST['vendor_id']."'";
$re10 = mysqli_query($conn,$qry10);
while($row=mysqli_fetch_array($re10))
{  
$vendor_name = $row['vendor_name'];
}?>

<?php
$queryE = "select * from new_vendorpo_01 where vendorpo_id  = '".$_REQUEST['vendorpo_id']."' and auto_vendor_no='".$_REQUEST['vendor_no']."'";
$resultE = mysqli_query($conn,$queryE);
while($row=mysqli_fetch_array($resultE))
{  
$contact_person = $row['contact_person'];
$contact_no = $row['contact_no'];
$contact_email = $row['contact_email'];
$vendorpo_date = $row['vendorpo_date'];
$currency = $row['currency'];
$GST_type = $row['GST_type'];
$address = $row['address'];
$vendorpo_date = $row['vendorpo_date']; 
}?>
<?php 

$query3s = "select * from gst_type where invoice_type='$GST_type' ";
$result3s = mysqli_query($conn,$query3s);	
while($row=mysqli_fetch_array($result3s))
{
$invoice_type_name = $row['invoice_type_name'];
}

?>
<div class="content-page">
<div class="content">
<div class="container">

<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Vendor PO Module
<?php if($_REQUEST['vendorpo_id']==''){?>
<a href="index.php" class="button btn btn-large btn-primary btn-madmin" style="float:right">Cancel</a>
<?php } ?>
</h3>
</div>
<form name="chkForm" id="chkForm" action="insert_vendor02v.php"  method="post" enctype="multipart/form-data" >
<input type="hidden" value="<?php echo $_REQUEST['vendor_id'];?>" name="vendor_id" />
<input type="hidden" value="<?php echo  $_REQUEST['call_follow_up_id'];?>" name="call_follow_up_id" />
<input type="hidden" value="<?php echo  $_REQUEST['vendor_no'];?>" name="vendor_no" />
<input type="hidden" value="<?php echo  $_REQUEST['create_new'];?>" name="create_new" />
<input type="hidden" value="<?php echo  $_REQUEST['vendorpo_id'];?>" name="vendorpo_id" />



<?php if($currentmonth>03) { ?>
<input type="hidden" name="f_year" value="<?php echo date("Y");?>-<?php echo date("y")+1;?>" />
<?php } else { ?>
<input type="hidden" name="f_year" value="<?php echo date("Y")-1;?>-<?php echo date("y");?>" />
<?php } ?>

<div class="panel-body">
<div class="row">
<div class="col-sm-3 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b>Vendor Name</b></label>
<input type="text" class="form-control" value="<?php echo $vendor_name?>" name="vendor_name"/>
</div>
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b>PO No.:</b></label>
<?php if($_REQUEST['vendorpo_no']!=''){?>
<input class="form-control"  name="vendorpo_no" value="<?php echo $_REQUEST['vendor_no']?>" readonly="readonly">
<?php }else{?>
<input class="form-control"  name="vendorpo_no" value="<?php  if($currentmonth>03) { echo date("Y");?>-<?php echo date("y")+1; } else { echo date("Y")-1;?>-<?php echo date("y"); } ?>/<? echo $_REQUEST['vendor_no'] ?>" readonly="readonly">

<?php }?>

</div>
</div>
</div>
<div class="col-sm-2 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b>PO Date</b></label>
<input type="date" class="datepicker form-control" name="vendorpo_date"  value="<?php echo $vendorpo_date?>" required>
</div>
</div>
</div>
<div class="col-sm-2 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label for="username"><strong>Currency</strong></label>
<select class="form-control" name="currency" required>
<?php if($currency!=''){?>
<option value="<?php echo $currency;?>"  selected="selected"><?php echo $currency;?></option>
<?php }else{?>
<option value=""  selected="selected">Select Currency</option>
<?php } ?>
<?php 
$querycu = "select * from currency_master where admin_quotation_status ='1'";
$resultcu = mysqli_query($conn,$querycu);	
while($row=mysqli_fetch_array($resultcu))
{
$currency = $row['currency'];
?>
<option value="<?php echo $currency?>"><?php echo $currency?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="col-sm-2 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b> GST Type </b></label>
<select name="GST_type" class="form-control" required >
<?php if($GST_type!=''){?>
<option value="<? echo $GST_type; ?>" selected="selected"><? echo $invoice_type_name;?></option>
<?php }else {?>
<option value="" selected="selected">Select</option>
<?php } ?>
<? 

														$queryls = "select * from gst_type ";

		                 						  		$resultls = mysqli_query($conn,$queryls);	

													    while($row=mysqli_fetch_array($resultls))

	                                                 	{

													$invoice_type = $row['invoice_type'];

													$invoice_type_name = $row['invoice_type_name'];

													$id = $row['id'];

													?>
<option value="<? echo $invoice_type; ?>"><? echo $invoice_type_name;?></option>
<? }?>
</select>
</div>
</div>
</div>

<div class="col-sm-3 col-xs-12">
<div class="m-t-20">

<div class="form-group">
<label><b>Contact Person Name</b></label>
<select class="form-control" name="contact_id">
<option value=""  selected="selected">Select Contact Person</option>
<?php 
if($contact_person!=''){
$querys1 = "select * from   vendor_contact where vendor_id ='".$_REQUEST['vendor_id']."' and contact_name='$contact_person'";

}else {
$querys1 = "select * from   vendor_contact where vendor_id ='".$_REQUEST['vendor_id']."'";
}
$results1 = mysqli_query($conn,$querys1);	
while($row=mysqli_fetch_array($results1))
{
$contact_id = $row['contact_id'];
$contact_name = $row['contact_name'];
?><option value="<?php echo $contact_id?>" selected="selected"><?php echo $contact_name?></option>
<?php } ?>

</select>

<div class="checkbox checkbox-primary">
<input type="checkbox" id="overall_discount13" name="contact_id"  value="other_contact_id"  onClick="Disctype1();"  class="checkbox1">
<label for="checkbox2"><strong>If Other Contact Person</strong></label>
</div>
<script type="text/javascript">

function Disctype1(val){

 var element=document.getElementById('overall_discount02');

if(document.getElementById('overall_discount13').checked==true)

 

  element.style.display='block';

  else  

   element.style.display='none';

}



 

   </script>




</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b>Address</b></label>
<textarea name="address" class="form-control"><?php echo $address?></textarea>
</div>
</div>
</div>


<div class="clearfix"></div>
<div id="overall_discount02"  style="display:none;">
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Contact Person</label>
<input name="contact_name" type="text" class="inputBox1 form-control"  />
</div>
</div>
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Contact No</label>
<input name="mobile_no" type="text" class="inputBox1 form-control" />
</div>
</div>
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Contact email</label>
<input name="email_id" type="text" class="inputBox1 form-control"  />
</div>
</div>
<script type="text/javascript">

        $(document).ready(function() {

    $('.checkbox1').change(function() {

        if ($('.inputBox1').attr('required')) {

           $('.inputBox1').removeAttr('required');

        } 

        else {  

           $('.inputBox1').attr('required','required');

        }

    });

});

    </script>
</div>
<div class="clearfix"></div>
<div class="col-sm-12 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<label><b>Product Name</b></label>
<select name="state[]" id="countries-list" class="form-control select2" multiple="multiple">
<option value="">Select Product Name</option>
<?php
$query2="select * from vendor_product_master where  vendor_id = '".$_REQUEST['vendor_id']."'";
$result=mysqli_query($conn,$query2);
while($row=mysqli_fetch_array($result))
		{  
$product_name = $row['product_name'];
$product_id  = $row['vproduct_id'];


?>
<option value="<?php echo $product_id; ?>"><?php echo $product_name; ?></option>
<?php
}
?>
<option value="Other">Other Product</option>
</select>


</div>
</div>
</div>

<div class="col-sm-12 col-xs-12">
<div class="m-t-20">
<div class="form-group">
<input type="submit" name="PRO_ADD" value="ADD" class="btn btn-sm btn-primary add-more"   id="prod_check"/>
</div>
</div>
</div>
</div>
<table class="table table-striped table-bordered dt-responsive nowrap">
<tr>
<td>#</td>
<td>Product Name</td>
<td>HSN Code </td>
<td>Product Price</td>
<td>Unit</td>
<td>Qty</td>
<td>Recv Qty </td>
<td>Discount%</td>
<td>Discounted Price </td>
</tr>
<?php
$i=1; $po_price=''; $product_price=''; $pro_photo='';
$query2="select * from vendorpo_more_product_02 where vendorpo_id  = '".$_REQUEST['vendorpo_id']."' AND vendor_id = '".$_REQUEST['vendor_id']."' AND deleted !='YES' and auto_vendor_no = '".$_REQUEST['vendor_no']."' ORDER BY  more_vproduct_id ASC";
$result=mysqli_query($conn,$query2);
$num_rows = mysqli_num_rows($result);
while($row=mysqli_fetch_array($result))

		{  

$product_name = $row['product_name'];
$more_vproduct_id  = $row['more_vproduct_id'];
$product_id = $row['product_id'];

$qty = $row['qty'];
$unit = $row['unit'];
$HSN_code = $row['HSN_code'];
$product_price = $row['product_price'];
$discount_value = $row['discount_value'];
$enq_status = $row['enq_status'];
$itemdesc = $row['itemdesc'];
$po_price = $row['po_price'];
$unit=$row['unit'];
$pro_photo = $row['pro_photo'];
$recieved_qty = $row['recieved_qty'];

if(is_numeric($qty)) {
$po_price=$row['po_price']*$qty;
}
if (is_numeric($price) && is_numeric($qty)) {
$pro_value= $price*$qty;
}else {
}


?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<input type="hidden" name="more_vproduct_id<? echo $more_vproduct_id?>" value="<? echo $more_vproduct_id?>">

<tr>
<td><a href="delete_vendorpo_item.php?more_vproduct_id=<?php echo $more_vproduct_id?>&&vendorpo_id=<?php echo $_REQUEST['vendorpo_id'];?>&&vendor_id=<?php echo $_REQUEST['vendor_id'];?>&&call_follow_up_id=<?php echo $_REQUEST['call_follow_up_id']?>&&vendor_no=<?php echo $_REQUEST['vendor_no']?>&&proforma_id=<?php echo $_REQUEST['proforma_id']?>&&customer_id=<?php echo $_REQUEST['customer_id']?>" class="btn waves-light" style="float:right; background-color:#65bd77; color: #FFFFFF">Del</a></td>
<td><textarea  class="form-control" name="product_name<? echo $more_vproduct_id?>" placeholder="DESCRIPTION"><? echo $product_name;?></textarea>
<br />
<textarea name="itemdesc<? echo $more_vproduct_id?>" class="form-control" placeholder="DESCRIPTION"><? echo $itemdesc;?></textarea></td>
<td><input name="HSN_code<? echo $more_vproduct_id?>" type="text" class="form-control" value="<? echo $HSN_code;?>" />
</td>
<td><input type="text" onKeyPress="OgKeyPress<? echo $more_vproduct_id;?>()" onKeyUp="OgKeyPress<? echo $more_vproduct_id;?>()" id="product_price<? echo $more_vproduct_id;?>" name="product_price<? echo $more_vproduct_id;?>" value="<? echo $product_price;?>" class="form-control"  /></td>
<td><select class="form-control" name="unit<? echo $more_vproduct_id?>" required>
											<?php if($unit!=''){?>
												<option value="<?php echo $unit?>" selected="selected"><? echo $unit?></option><?php }else{?>
												<option value="" selected="selected">Select Unit</option><?php } ?>
									            	<option value="Kg">Kg</option>
										          	<option value="Nos">Nos</option>
													<option value="MM">MM</option>
												</select></td>
<td><input type="text" name="qty<? echo $more_vproduct_id?>" placeholder="Qty" class="form-control" value="<? echo $qty;?>"  id="qty<? echo $more_vproduct_id?>"  onKeyPress="OgKeyPress<? echo $more_vproduct_id;?>()" onKeyUp="OgKeyPress<? echo $more_vproduct_id;?>()"  required/>
<!--<br />
<div class="form-group">
<label>Current Stock: <strong></strong> </label>
<div>-->

</td>
<td><input id="recieved_qty<? echo $more_vproduct_id;?>" name="recieved_qty<? echo $more_vproduct_id;?>"  class="form-control"  step="0.00001"  inputmode="numeric" type="number"  value="<?php echo $recieved_qty?>" <?php if($recieved_qty!=''){?>readonly="readonly"<?php } ?> required/></td>
<td><?php 

			if($discount_value!=''){ $discount_price1 = $row['product_price']*$row['discount_value']/100;

			$discount_price = $row['product_price'] - $discount_price1;

			 $discount_price; } ?>
<input id="dis<? echo $more_vproduct_id;?>" name="discount_value<? echo $more_vproduct_id;?>"  class="form-control"  onKeyPress="OgKeyPress<? echo $more_vproduct_id;?>()" onKeyUp="OgKeyPress<? echo $more_vproduct_id;?>()" placeholder="Discount%" step="0.00001"  inputmode="numeric" type="number"  value="<?php if($discount_value!=''){echo $discount_value; }?>"/></td>
<td><input type="text" id="amount<? echo $more_vproduct_id;?>" name="po_price<? echo $more_vproduct_id;?>" value="<? echo $po_price;?>" class="form-control" readonly="readonly" placeholder="Discounted Price" /></td>
</tr>
<script>

$('#product_price<? echo $more_vproduct_id;?>, #dis<? echo $more_vproduct_id;?>,#qty<? echo $more_vproduct_id;?>').on('input',function(){

    var product_price<? echo $more_vproduct_id;?> = parseFloat($('#product_price<? echo $more_vproduct_id;?>').val()) || 0;

    var qty<? echo $more_vproduct_id;?> = parseFloat($('#qty<? echo $more_vproduct_id;?>').val()) || 0;

	var dis<? echo $more_vproduct_id;?> = parseFloat($('#dis<? echo $more_vproduct_id;?>').val()) || 0;

    $('#amount<? echo $more_vproduct_id;?>').val((product_price<? echo $more_vproduct_id;?> * qty<? echo $more_vproduct_id;?>)-dis<? echo $more_vproduct_id;?>*(product_price<? echo $more_vproduct_id;?> * qty<? echo $more_vproduct_id;?>)/100);   

	 

});</script>
<?php }?>
</table>
<div class="clearfix"></div>
<div class="row">
<div class="col-sm-12 col-xs-12">
<div class="m-t-20">
<input type="submit" name="Submit" class="btn waves-light" value="Save" style="float:right; background-color:#65bd77; color: #FFFFFF">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<footer class="footer"> &copy; <?php echo $company_namecnp ?></footer>
</div>
<script src="vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="vendors/bower_components/moment/min/moment-with-locales.min.js"></script>
<script src="vendors/bower_components/mjolnic-bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
<script src="vendors/bower_components/switchery/dist/switchery.min.js"></script>
<script src="vendors/bower_components/select2/dist/js/select2.full.min.js"></script>
<script src="vendors/bower_components/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<!-- Bootstrap Tagsinput JavaScript -->
<script src="vendors/bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>
<!-- Bootstrap Touchspin JavaScript -->
<script src="vendors/bower_components/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js"></script>
<!-- Multiselect JavaScript -->
<script src="vendors/bower_components/multiselect/js/jquery.multi-select.js"></script>
<!-- Bootstrap Switch JavaScript -->
<script src="vendors/bower_components/bootstrap-switch/dist/js/bootstrap-switch.min.js"></script>
<!-- Bootstrap Datetimepicker JavaScript -->
<script type="text/javascript" src="vendors/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<!-- Form Advance Init JavaScript -->
<script src="dist/js/form-advance-data.js"></script>
<!-- Slimscroll JavaScript -->
<script src="dist/js/jquery.slimscroll.js"></script>
<!-- Fancy Dropdown JS -->
<script src="dist/js/dropdown-bootstrap-extended.js"></script>
<!-- Owl JavaScript -->
<script src="vendors/bower_components/owl.carousel/dist/owl.carousel.min.js"></script>
<!-- Init JavaScript -->
<script src="dist/js/init.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<!-- Select2 JavaScript -->
<script src="vendors/bower_components/select2/dist/js/select2.full.min.js"></script>
<!-- Bootstrap Select JavaScript -->
<script src="vendors/bower_components/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/modernizr.min.js"></script>
<script src="assets/js/detect.js"></script>
<script src="assets/js/fastclick.js"></script>
<script src="assets/js/jquery.slimscroll.js"></script>
<script src="assets/js/jquery.blockUI.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<script src="assets/js/jquery.scrollTo.min.js"></script>
<script src="assets/js/app.js"></script>
</body><!-- Mirrored from themesdesign.in/xadmino/form-elements.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 03 Feb 2021 12:05:08 GMT -->
</html>