<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>



<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo site_url(); ?>assets/admin_css/css/jquery.datetimepicker.css" />
<!-- <link href="css/for_mobile.css" rel="stylesheet" /> -->


<link href="<?php echo base_url(); ?>assets/admin_css/css/bootstrap.min.css" rel="stylesheet" />
<link href="font-awesome-4.4.0/css/font-awesome.min.css"
	rel="stylesheet" />
<link href="<?php echo base_url(); ?>assets/admin_css/css/jquery.dataTables.css" rel="stylesheet"/>
<link href="<?php echo base_url(); ?>assets/admin_css/css/jquery.dataTables.min.css" rel="stylesheet"/>
<link href="<?php echo base_url(); ?>assets/admin_css/css/buttons.dataTables.min.css" rel="stylesheet"/>
<script src="<?php echo base_url(); ?>assets/admin_js/js/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="<?php echo base_url(); ?>assets/admin_js/js/jquery.dataTables.min.js"></script>
<script type="text/javascript"
	src="<?php echo base_url(); ?>assets/admin_js/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/admin_js/js/buttons.print.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/admin_js/js/buttons.colVis.min.js"></script>
<script src="<?php echo base_url(); ?>assets/admin_js/js/bootstrap.min.js"></script>
<script src="<?php echo base_url(); ?>assets/admin_js/js/jquery.datetimepicker.js"></script>




<script>
$(function() {
	$("#event_date").datepicker({
		changeMonth : true,
		changeYear : true
	});
});
</script>


</head>
<body>




	<h3 style="text-align: center;">Bilty</h3>


	<div id="abcd"></div>

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


	<?php echo form_open_multipart('/BiltyControllers/insertInfo') ?>


						<div class="row">
							<div class="col-md-3">
		
								
			

								<div class="form-group">

									<strong for="Name">LR. No.</strong>

									<?php foreach($single_data as  $dto){

?>
									 <input type="text" name="invoice_no"
										id="invoice_no" class=" Name form-control" placeholder="Invoice No"
										required="required" value='<?php echo $dto->ram+1;?> '>
								</div>
							</div>

							<?php }

?>

							<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Date</strong> <input type="date" name="bill_date"
		id="bill_date" class=" Name form-control" placeholder="Bill Date"
		required="required" value="<?php echo date("Y-m-d"); ?>">
</div>
</div>
<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Mill No.</strong> <input type="text" name="sms_no"
		id="sms_no" class=" Name form-control" placeholder="Mill No" value="0"
		required="required">
</div>
</div>

<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Type</strong>  <select
										class="ling form-control" name="TYPE" required="required">
										<option value="Normal">Normal</option>
										<option value="Paid">Paid</option>
									</select>
</div>
</div>

						
					
						</div>

						<div class="row">

						<div class="col-md-3">

								<div class="form-group">

									<strong for="ling">Consignor</strong> 
								
								


										<input type="text" name="Consignor" id="Consignor"
									list="Consignor_list" class="Name form-control"
									placeholder="choose Consignor" onblur="getConsignorInfo();"
								 autocomplete="off" />

								 
		

									<datalist id="Consignor_list"> 
									<?php foreach($consignor_info as  $dto1){

?>
								<option ><?php echo $dto1->NAME;?>
								<?php }

?>
								
								</datalist>



								</div>
							</div>
							<div class="col-md-3">

								<div class="form-group">

									<strong for="Name">Consignor </strong> <input type="text" name="consignor_name"
										id="consignor_name" class=" Name form-control" placeholder="Consignor Name"
										required="required">
								</div>
							</div>

							<div class="col-md-3">

<div class="form-group">

	<strong for="Name">GSTIN</strong> <input type="text" name="consignor_gstin"
		id="consignor_gstin" class=" Name form-control" placeholder="Consignor Gstin"
		required="required">
</div>
</div>
<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Address</strong> <input type="text" name="consignor_address"
		id="consignor_address" class=" Name form-control" placeholder="consignor_address"
		required="required">
</div>
</div>


</div>

<div class="row">

<div class="col-md-3">



		<div class="form-group">
		<strong for="ling">Consignee</strong> 
			
		<input type="text" name="Consignee" id="Consignee"
									list="Consignee_list" class="Name form-control"
									placeholder="choose Consignee" onblur="getConsigneeInfo();"
								 autocomplete="off" />
								 
		

									<datalist id="Consignee_list"> 
									<?php foreach($Consignee_info as  $dto){

?>
								<option ><?php echo $dto->NAME;?>
								<?php }

?>
								
								</datalist>

		</div>
	</div>
	<div class="col-md-3">

		<div class="form-group">

			<strong for="Name">Consignee</strong> <input type="text" name="consignee_name"
				id="consignee_name" class=" Name form-control" placeholder="Consignee Name"
				required="required">
		</div>
	</div>

	<div class="col-md-3">

<div class="form-group">

<strong for="Name">GSTIN</strong> <input type="text" name="consignee_gstin"
id="consignee_gstin" class=" Name form-control" placeholder="Consignee Gstin"
required="required">
</div>
</div>
<div class="col-md-3">

<div class="form-group">

<strong for="Name">Address</strong> <input type="text" name="consignee_address"
id="consignee_address" class=" Name form-control" placeholder="Consignee Address"
required="required">
</div>
</div>
<div id="abcd"></div>

</div>


<div class="row">
							<div class="col-md-3">

						


								<div class="form-group">
		<strong for="ling">From</strong> 
			
		<input type="text" name="source" id="source"
									list="Destination_list" class="Name form-control"
									placeholder="choose From" 
								 autocomplete="off" />
								 
		

									<datalist id="Destination_list"> 
									<?php foreach($Destination_info as  $dto){

?>
								<option ><?php echo $dto->NAME;?>
								<?php }

?>
								
								</datalist>

		</div>




							</div>

							<div class="col-md-3">


<div class="form-group">
		<strong for="ling">To</strong> 
			
		<input type="text" name="destination" id="destination"
									list="Destination_list" class="Name form-control"
									placeholder="choose From" 
								 autocomplete="To" />
								 
		

									<datalist id="Destination_list"> 
									<?php foreach($Destination_info as  $dto){

?>
								<option ><?php echo $dto->NAME;?>
								<?php }

?>
								
								</datalist>

		</div>





</div>
<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Truck No.</strong> <input type="text" name="truck_no"
		id="truck_no" class=" Name form-control" placeholder="Truck No"
		required="required">
</div>
</div>

<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Product</strong> <input type="text" name="item"
		id="item" class=" Name form-control" placeholder="Product" value="F P COTTON BALES"
		required="required">
</div>
</div>

						
					
						</div>

					




						<div class="row">
							<div class="col-md-3">

								<div class="form-group">

									<strong for="Name">Lot No</strong> <input type="text" name="lot_no"
										id="lot_no" class=" Name form-control" placeholder="Lot No"
										required="required">
								</div>
							</div>

							<div class="col-md-3">

<div class="form-group">

	<strong for="Name">PR No.</strong> <input type="text" name="pr_no"
		id="pr_no" class=" Name form-control" placeholder="Pr No"
		required="required">
</div>
</div>
<div class="col-md-3">

<div class="form-group">

	<strong for="Name">PM</strong> <input type="text" name="pm"
		id="pm" class=" Name form-control" placeholder="PM"
		required="required">
</div>
</div>

<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Quality</strong> <input type="text" name="quality"
		id="quality" class=" Name form-control" placeholder="Quality"
		required="required">
</div>
</div>						
					
						</div>

						<div class="row">
							<div class="col-md-3">

								<div class="form-group">

									<strong for="Name">Weight</strong> <input type="text" name="weight"
										id="weight" class=" Name form-control" placeholder="Weight"
										required="required">
								</div>
							</div>

							<div class="col-md-3">

<div class="form-group">

	<strong for="Name">No. Of Pack</strong> <input type="text" name="packages"
		id="packages" class=" Name form-control" placeholder="No. Of Pack"
		required="required" onblur="getCalculation();">
</div>
</div>
<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Rate</strong> <input type="text" name="rate"
		id="rate" class=" Name form-control" placeholder="Rate"
		required="required" onblur="getCalculation();">
</div>
</div>

<div class="col-md-3">

<div class="form-group">

	<strong for="Name">Total Amt.</strong> <input type="text" name="total_amount"
		id="total_amount" class=" Name form-control" placeholder="Total Amount"
		required="required">
</div>
</div>						
					
						</div>
					
							<div class="col-md-12">
								<div class="form-group">

									<strong for="Memories">Remark</strong>

									<!--<input name="memoris" id="memoris" class="form-control">-->
									<textarea class="form-control" rows="5" id="remark"
										name="remark"></textarea>
								</div>
							</div>
						</div>



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

								<center>
									<input type="submit" name="submit" id="submit" value="Submit"
										class="btn view-btn"
										style="width: 31%; background-color: #f88904; border-color: #f88904;">
								</center>
							</div>
						</div>


				  <?php echo form_close() ?>

		

	</div>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>


		<script>

function getConsignorInfo() {

var name = document.getElementById("Consignor").value;
var base_url='https://the5thda.com/Nimar_Transport/index.php/';


$
		.ajax({

			url: "<?php echo base_url(); ?>" + "index.php/BiltyControllers/fetch_Consignor",
		
			data:{name:name},
			type : "post",
			dataType: 'json',
			success : function(msg) {

				//$("#abcd").html(msg);
			
				//alert(msg);

				var len = msg.length;


				$('#consignor_name').text('');
       
	   
	   if(len > 0){
         // Read values


         var uname = msg[0].NAME; 	
		 var u_gst = msg[0].gst_no; 			
		 var u_address = msg[0].address; 		
        //alert(uname);

		document.getElementById("consignor_name").value = uname;
		document.getElementById("consignor_address").value =u_address;
		document.getElementById("consignor_gstin").value =u_gst;
        // $('#consignor_name').text(uname);
        
 
       }

				document.getElementById("Consignee").focus();

			}
		});
}



function getConsigneeInfo() {

var name = document.getElementById("Consignee").value;
var base_url='http://the5thda.com/Nimar_Transport/index.php/';


$
		.ajax({

			url: "<?php echo base_url(); ?>" + "index.php/BiltyControllers/fetch_Consignee",
		
			data:{name:name},
			type : "post",
			dataType: 'json',
			success : function(msg) {

				//$("#abcd").html(msg);
			
				//alert(msg);

				var len = msg.length;
				       
	   
	   if(len > 0){
         // Read values


         var uname = msg[0].NAME; 	
		 var u_gst = msg[0].gst_no; 			
		 var u_address = msg[0].address; 		
        //alert(uname);

		document.getElementById("consignee_name").value = uname;
		document.getElementById("consignee_address").value =u_address;
		document.getElementById("consignee_gstin").value =u_gst;
        // $('#consignor_name').text(uname);
        
 
       }

				document.getElementById("source").focus();

			}
		});
}

function getCalculation() {

var packages = document.getElementById("packages").value;
var rate = document.getElementById("rate").value;

var total = packages * rate;

document.getElementById("total_amount").value = total;

}



	</script>
