ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/cargo-pickup-entry-add.php

<?php require_once('header.php'); ?>
	<!-- Script -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<script src='js/select2.full.min.js' type='text/javascript'></script>
	<!-- CSS -->
	<link href='css/select2.full.min.css' rel='stylesheet' type='text/css'>
	<script>
	$(document).ready(function() {
		// Initialize select2
		$("#pincode").select2();
	});
	$(document).ready(function() {
		// Initialize select2
		$("#customer_name").select2();
	});
	$(document).ready(function() {
		// Initialize select2
		$("#customer_id").select2();
		$("#client_id").select2();
		$("#content_desc").select2();
		
	});
	</script>
		<script type="text/javascript" language="javascript" >
	$(document).ready(function() {
		     

function branchDetails(){ // branch and Employee Details Set
   /*var branch = $("#branch").val();*/
        $.ajax({
          url: 'data-tables/custom-function.php',
          type: 'post',
          data: {type:'get_branch'},
          success: function(response)
          {
               var datas = JSON.parse(response)         
               $('#branch_id').empty();
                var tot = datas.length;
                  if(tot==0)
                  {
                          $('#branch_id')
                                        .append($("<option></option>")
                                      .attr("value", '')
                                      .text("Branch Not Available"));
                  }
                  else
                  {
                    $('#branch_id')
                                        .append($("<option></option>")
                                      .attr("value", '')
                                      .text("Select Branch"));
                  }
                  

                for (var index = 0; index < tot; index++) {
                     $('#branch_id')
                      .append($("<option></option>")
                    .attr("value", datas[index]['id'])
                    .text(datas[index]['branch_name']));
                                                 
                }   
          }
      });
}


function clientDetails(){ // branch and Employee Details Set
   var branch = $("#branch_id").val();

        $.ajax({
          url: 'data-tables/custom-function.php',
          type: 'post',
          data: {type:'get_client',branch_id:branch},
          success: function(response)
          {
               var datas = JSON.parse(response)         
               $('#client_id').empty();
                var tot = datas.length;
                  if(tot==0)
                  {
                          $('#client_id')
                                        .append($("<option></option>")
                                      .attr("value", '')
                                      .text("Client Not Available"));
                  }else{
                       $('#client_id')
                                        .append($("<option></option>")
                                      .attr("value", '')
                                      .text("Select Client"));
                  }
                 
                for (var index = 0; index < tot; index++) {
                     $('#client_id')
                      .append($("<option></option>")
                    .attr("value", datas[index]['id'])
                    .text(datas[index]['client_name']));
                                                 
                }   
          }
      });
}
				branchDetails();
			  
			  $('#branch_id').on('change', function(){			    
			        clientDetails();			      
			  } );      
			} );
		</script>
	<!--Script for onchange function on selection of pincode to get available shipping mode  -->

	<section class="content-header" style="background-color: white;" >
	    
	<div class="row">
		<div class="col-md-12" style="text-align: center;">
			<h4><i class="fa fa-info-circle"></i> Cargo Entry Details</h4>
		</div>
		
	</div>
	    
	    
	    
	    
	    
		<div class="row">
			<div class="col-md-12">
				<?php if($error_message): ?>
					<div class="callout callout-danger">
						<p>
							<?php echo $error_message; ?>
						</p>
					</div>
					<?php endif; ?>
						<?php if($success_message): ?>
							<div class="callout callout-success">
								<p>
									<?php echo $success_message; ?>
								</p>
								<a href="cargo-invoice-preview.php?list_id=<?php echo $awb_no; ?>">
									<button class="btn btn-md btn-primary">Print AWB Number</button>
								</a>
								<a href="cargo-lable-print.php?list_id=<?php echo $awb_no; ?>">
									<button class="btn btn-md btn-primary">Print Lable</button>
								</a>
							</div>
							<?php endif; ?>
								<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
									<div >
										<div >
										<div class="form-group">
							<label for="" class="col-sm-2 control-label">Select Branch <span>*</span></label>
							<div class="col-sm-6">
								<select class="form-control select2" name="branch_id"  id="branch_id" required="">
							        <option value="">Select Branch</option>	        
							    </select>
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Select Client <span>*</span></label>
							<div class="col-sm-6">
								<select class="form-control select2" name="client_id" id="client_id" onchange="auto_awb_check()" required="">
							        <option value="">Select Branch First!!!</option>	        
							    </select>
							</div>
							<div class="col-sm-4"> <span id="client_id_txt"></span> </div>
						</div>
											
											
											
											
											
											
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Select DB Number <span class='required'>*</span></label>
												<div class="col-sm-6">
													<select class="form-control" name="customer_id" id="customer_id">
														<option value="none">Select Client First !</option>
													</select>
												</div>
												<div class="col-sm-4"> <span id="customer_id_txt"></span> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Pincode <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" class="form-control" name="pincode" id="pincodes"> </div>
												<div class="col-sm-4"> <span id="pincode_txt"></span> </div>
											</div>
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Address <span class='required'>*</span></label>
												<div class="col-sm-6">
													<textarea class="form-control" name="address" id="address" style="height:100px;"></textarea>
												</div>
												<div class="col-sm-4"> <span id="remain">110</span><span id="remain_txt"> characters remaining</span> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">City <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" id="city" class="form-control" name="city"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">State </label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" id="state" class="form-control" name="state"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Destination <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" id="destination" class="form-control" name="destination"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Phone Number <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" class="form-control" name="phone" id="phone"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Pickup Entry Date <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="date" autocomplete="off" class="form-control" name="created" id="created" value="<?php echo date("Y-m-d") ?>"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">AWB No <span class='required'>*</span></label>
												<div class="col-sm-4">
													<input type="text" autocomplete="off" id="awb_no" class="form-control" name="awb_no" value="<?php if(isset($_POST['awb_no'])){echo $_POST['awb_no'];} ?>">
													<input type="hidden" autocomplete="off" id="awb_value" class="form-control" name="awb_value" value="no"></div>
												<div class="col-sm-2"> <input type="checkbox" id="awb_type" onchange="auto_awb_check()" class="checkbox"> <span style='color:green;size:10px;'>(Click Here If  Auto Awb Fetch)</span></div>	
												<div class="col-sm-4"> <span id="awb_txt"> </span> </div>
											</div>
											
										
											<input type="hidden" autocomplete="off" class="form-control" name="other_charges" id="other_charges" value="0">
											<input type="hidden" autocomplete="off" class="form-control" name="total_charges" id="total_charges" value="0">
											
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">E-Way Bill Number <span></span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" class="form-control" name="e_way_bill_number" id="e_way_bill_number" value="0"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Invoice Number <span></span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" class="form-control" name="invoice_no" id="invoice_no" value="0"> </div>
											</div>
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Invoice Value <span></span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" class="form-control" name="invoice_value" id="invoice_value" value="0"> </div>
											</div>
											
											
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Content Description <span class='required'>*</span></label>
												<div class="col-sm-6">
												    <select class="form-control select2" name="content_desc" id="content_desc">
                    							        <?php 
                    							        $statements = $pdo->prepare("SELECT * FROM material_desc");	     
                    									$statements->execute();
                    									$results = $statements->fetchAll(PDO::FETCH_ASSOC);	
                    									foreach ($results as $rows) {	?>
                    												        <option value="<?=$rows['id']?>"><?=$rows['short_desc']?></option>
                    											<?php }  ?>
                    								 </select>
											</div>
											</div>
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Shipment Mode <span class='required'>*</span></label>
												<div class="col-sm-6">
												    <select class="form-control select2" onchange="calcuate_actual_wt();" name="shipping_mode" id="shipping_mode">
												        <option value="SURFACE">SURFACE</option>
												        <option value="AIR">AIR</option>
												    </select>
											</div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Payment Type <span class='required'>*</span></label>
												<div class="col-sm-6">
												    <select class="form-control select2" name="payment_mode" id="payment_mode">
												        <option value="Credit">Credit</option>
												        <option value="Cash">Cash</option>
												    </select>
										    	</div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Payment Details <span class='required'>*</span></label>
												<div class="col-sm-6">
												    <select class="form-control select2" name="payment_details" id="payment_details">
												        <option value="UPI">UPI</option>
												        <option value="CASH">CASH</option>
												    </select>
										    	</div>
											</div>
											<!--<input type="hidden" autocomplete="off" class="form-control" name="shipping_mode" id="shipping_mode" value="Air">-->
												<div class="form-group">
												<label for="" class="col-sm-2 control-label">Volumetrix Weight Details <span class='required'>*</span></label>
												<div class="col-sm-10">
												    <span style="display: inline-block;width: 100px;height: 20px;text-align: center;padding:10px;"><b>Length</b></span>
												    <span style="display: inline-block;width: 100px;height: 20px;text-align: center;"><b>Width</b></span>
												    <span style="display: inline-block;width: 100px;height: 20px;text-align: center;"><b>Height</b></span>
												    <span style="display: inline-block;width: 100px;height: 20px;text-align: center;"><b>No of Box</b></span>
												    <span style="display: inline-block;width: 100px;height: 20px;text-align: center;"><b>Act WT</b></span>
												    <span style="display: inline-block;width: 100px;height: 20px;text-align: center;"><b>Charged WT</b></span>
												    
												    <br>
												    <div style="padding:2px;"><input type="text" placeholder="Length" style="width:100px;text-align:center;" name="length1" id="length1" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Width" style="width:100px;text-align:center;" name="width1" id="width1" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Height" style="width:100px;text-align:center;" name="height1" id="height1" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="No of Box" style="width:100px;text-align:center;" name="nob1" id="nob1" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="act_wt1" id="act_wt1"  value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="char_wt1" id="char_wt1"  value="0" onkeypress="return isNumberKey(this, event);" readonly><br>
												    
												    </div><div style="padding:2px;"><input type="text" placeholder="Length" style="width:100px;text-align:center;" name="length2" id="length2"  value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Width" style="width:100px;text-align:center;" name="width2"  id="width2" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Height" style="width:100px;text-align:center;" name="height2"  id="height2" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="No of Box" style="width:100px;text-align:center;" name="nob2"  id="nob2" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="act_wt2"  id="act_wt2" value="0" onkeypress="return isNumberKey(this, event); " onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="char_wt2" id="char_wt2"  value="0" onkeypress="return isNumberKey(this, event);" readonly><br>
												    
												    </div><div style="padding:2px;"><input type="text" placeholder="Length" style="width:100px;text-align:center;" name="length3"  id="length3" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Width" style="width:100px;text-align:center;" name="width3"  id="width3" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Height" style="width:100px;text-align:center;" name="height3"  id="height3" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="No of Box" style="width:100px;text-align:center;" name="nob3"  id="nob3" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="act_wt3"  id="act_wt3" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="char_wt3" id="char_wt3"  value="0" onkeypress="return isNumberKey(this, event);" readonly><br>
												    
												    </div><div style="padding:2px;"><input type="text" placeholder="Length" style="width:100px;text-align:center;" name="length4" id="length4" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Width" style="width:100px;text-align:center;" name="width4" id="width4" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Height" style="width:100px;text-align:center;" name="height4" id="height4" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="No of Box" style="width:100px;text-align:center;" name="nob4" id="nob4" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="act_wt4" id="act_wt4" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="char_wt4" id="char_wt4"  value="0" onkeypress="return isNumberKey(this, event);" readonly><br>
												    
												    </div><div style="padding:2px;"><input type="text" placeholder="Length" style="width:100px;text-align:center;" name="length5" id="length5" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Width" style="width:100px;text-align:center;" name="width5" id="width5" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Height" style="width:100px;text-align:center;" name="height5" id="height5" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="No of Box" style="width:100px;text-align:center;" name="nob5" id="nob5" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="act_wt5" id="act_wt5" value="0" onkeypress="return isNumberKey(this, event);" onchange="calcuate_actual_wt();">
												    <input type="text" placeholder="Act Wt" style="width:100px;text-align:center;" name="char_wt5" id="char_wt5"  value="0" onkeypress="return isNumberKey(this, event);" readonly>
										            <!--<br><br>
										            <div class="col-sm-6" style="padding:2px;text-align:right;">Actual Weight&ensp;&ensp;: <input type="text" placeholder="Width" style="width:100px;text-align:center;" name="a_weight" id="a_weight" value="0" onkeypress="return isNumberKey(this, event);"><br>
										            <div style="padding:2px;text-align:right;">Charged weight&ensp; :<input type="text" placeholder="Width" style="width:100px;text-align:center;" name="c_weight" id="c_weight" value="0" onkeypress="return isNumberKey(this, event);">
										            </div></div>-->
										        
												</div>
												</div>    
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Actual Weight <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" value="0" class="form-control" name="a_weight" id="a_weight"> </div>
											</div>
											
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Charged Weight <span></span></label>
												<div class="col-sm-6">
													<input type="text" autocomplete="off" class="form-control" name="c_weight" id="c_weight" value="0"> </div>
											</div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label">Number of Boxes <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="number" autocomplete="off" class="form-control" name="pics" id="pics" value="0"> </div>
											</div>
											
												<div class="form-group">
												<label for="" class="col-sm-2 control-label">Number of Pieces <span class='required'>*</span></label>
												<div class="col-sm-6">
													<input type="number" autocomplete="off" class="form-control" name="total_no_pieces" id="total_no_pieces" value="0"> </div>
											</div>
											
											
											
											<input type="hidden" autocomplete="off" id="gst" class="form-control" name="gst_no" value="<?php if(isset($_POST['gst_no'])){echo $_POST['gst_no'];} ?>">
											<div class="alert alert-success alert-dismissible fade in" id="status_success" style="display:none;"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <strong>Success!</strong> Pick Entry Added ! &emsp;&emsp;&emsp; <a href="#" id='btn_awb' class="btn btn-md btn-primary">Print AWB Number</a> <a href="#" id='btn_label' class="btn btn-md btn-primary">Print Label</a> </div>
											<div class="alert alert-danger alert-dismissible fade in" id="status_failure" style="display:none;"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <strong>Failed!</strong> Please Check the Form ! </div>
											<div class="form-group">
												<label for="" class="col-sm-2 control-label"></label>
												<div class="col-sm-6">
													<button type="submit" id='form_submit' class="btn btn-success pull-left" name="form1"><span id='submit_txt'>Submit</span><i id='submit_spin'></i></button>
													<button type="reset" id='form_reset' class="btn btn-primary pull-right">Reset <i class="fa fa-spin fa-recycle" style="color:white" aria-hidden="true"></i></button>
												</div>
											</div>
										</div>
									</div>
								</form>
			</div>
		</div>
	</section>
	<script src="js/validatePickupAdd.js"></script>
	<script>
	
	function auto_fetch_awb_no() {
	        var client_id=$('#client_id').val();
           if(client_id){
                $.ajax({
                  type:'POST',
                  url:'get-available-awb-number.php',
                  data:{id:client_id},
                   dataType: 'json',
                  success:function(response){
                      console.log('awb_code no :'+response[0]['awb_code']);
                      $('#awb_no').val(response[0]['awb_code']);
                      
                      	var awb1 = $(awb_no).val();
                      $.ajax({
					type: 'POST',
					url: 'get_unique_awb.php',
					data: {
						awb: awb1,
						type: 'awb_no'
					},
					dataType: 'json',
					success: function(response) {
						console.log(response);
						if(response[0]['error'] == '0') {
							$("#awb_value").val('yes');
							$("#awb_txt").css('color', 'green');
							$("#awb_txt").text(response[0]['txt']);
						} else if(response[0]['error'] == '1') {
							$("#awb_value").val('no');
							$("#awb_txt").css('color', 'red');
							$("#awb_txt").text(response[0]['txt']);
						} else {
							$("#awb_value").val('no');
							$("#awb_txt").css('color', 'red');
							$("#awb_txt").text('');
						}
					}
				});
                      
                      
                  }
               });
           }
	    }
	    
	    
	    
	    function auto_awb_check(){
	       var fd= $('#awb_type').is(':checked');
	       
	       if(fd){
	           auto_fetch_awb_no();
	       }else{
	           $('#awb_no').val('');
	           $("#awb_value").val('no');
    			$("#awb_txt").css('color', 'red');
    			$("#awb_txt").text('Enter Awb Number');
	       }

	    }
	
	
	
	
	
	function address_limit() {
		var maxchars = 110;
		var tlength = $('#address').val().length;
		$('#address').val($('#address').val().substring(0, maxchars));
		var tlength = $('#address').val().length;
		remain = maxchars - parseInt(tlength);
		if(remain < 10) {
			$('#remain').css('color', 'red');
			$('#remain_txt').css('color', 'red');
		} else {
			$('#remain').css('color', 'green');
			$('#remain_txt').css('color', 'green');
		}
		$('#remain').text(remain);
	}
	$(document).ready(function() {

	    	/***********    For checking Unique REF Number ***********/
		$("#awb_no").keyup(function() {
			var awb1 = $(this).val();
			if(awb1 == '') {
				$("#awb_txt").text('');
			} else {
				$.ajax({
					type: 'POST',
					url: 'get_unique_awb.php',
					data: {
						awb: awb1,
						type: 'awb_no'
					},
					dataType: 'json',
					success: function(response) {
						console.log(response);
						if(response[0]['error'] == '0') {
							$("#awb_value").val('yes');
							$("#awb_txt").css('color', 'green');
							$("#awb_txt").text(response[0]['txt']);
						} else if(response[0]['error'] == '1') {
							$("#awb_value").val('no');
							$("#awb_txt").css('color', 'red');
							$("#awb_txt").text(response[0]['txt']);
						} else {
							$("#awb_value").val('no');
							$("#awb_txt").css('color', 'red');
							$("#awb_txt").text('');
						}
					}
				});
			}
		});
		$('textarea#address').on('keyup', function(e) {
			address_limit();
		});
		$('#form_submit').on('click', function(e) {
			e.preventDefault();
			$("#form_submit").prop('disabled', true);
			var validate = 1;
			validate = formValidate();
			//	alert(validate);
			if(validate) {
				$('#form_submit').removeClass('btn-danger');
				$('#form_submit').addClass('btn-success');
				$('#submit_txt').text('Wait');
				$.ajax({
					type: 'POST',
					url: 'cargo_ajax_add.php',
					data: $("form").serialize(),
					beforeSend: function() {
						// setting a timeout
						$('#submit_spin').addClass('fa fa-spinner fa-spin');
					},
					dataType: 'json',
					success: function(response) {
						console.log(response);
						var res_text = response[0]['txt'];
						if(response[0]['error'] == '1') {
							var awb_num = response[0]['awb_number'];
							var p_id = response[0]['p_id'];
							$('#status_success').show();
							$('#status_failure').hide();
							$("#btn_awb").attr('href', 'cargo-invoice-preview.php?list_id=' + p_id);
							$("#btn_label").attr('href', 'cargo-lable-print.php?list_id=' + p_id);
							$('#form_submit').removeClass('btn-danger');
							$('#form_submit').addClass('btn-success');
							$('#submit_txt').text(res_text);
							$("#submit_spin").removeClass("fa fa-spinner fa-spin");
						} else {
							$('#status_success').hide();
							$('#status_failure').show();
							$("#form_submit").prop('disabled', false);
							$('#form_submit').removeClass('btn-success');
							$('#form_submit').addClass('btn-danger');
							$('#submit_txt').text(res_text);
							$("#submit_spin").removeClass("fa fa-spinner fa-spin");
						}
					}
				});
			} else {
				$('#status_success').hide();
				$('#status_failure').show();
				$("#form_submit").prop('disabled', false);
				window.scrollTo(0, 0);
				$('#form_submit').removeClass('btn-success');
				$('#form_submit').addClass('btn-danger');
				$('#submit_txt').text('Failed');
			}
		});
		$('#form_reset').on('click', function(e) {
			$("#form_submit").prop('disabled', false);
			$('#status_success').hide();
			$('#status_failure').hide();
		});
	});
	
	function isNumberKey(txt, evt) {
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if (charCode == 46) {
        //Check if the text already contains the . character
        if (txt.value.indexOf('.') === -1) {
          return true;
        } else {
          return false;
        }
      } else {
        if (charCode > 31 &&
          (charCode < 48 || charCode > 57))
          return false;
      }
      return true;
    }
    function calcuate_actual_wt() {
        console.log('Calculation Started...');
        var shipping_mode=$('#shipping_mode').val();
        var length1=$('#length1').val();
        var width1=$('#width1').val();
        var height1=$('#height1').val();
        var nob1=$('#nob1').val();
        var act_wt1=$('#act_wt1').val();
        var shipping_value=0;
        
        if(shipping_mode=='AIR'){
            shipping_value=5000;
             console.log('AIR...');
        }else{ shipping_value=4000;console.log('SURFACE...');}
        
        if(length1==""){
            length1=0;$('#length1').val('0');
        }
        if(width1==""){
            width1=0;$('#width1').val('0');
        }
        if(height1==""){
            height1=0;$('#height1').val('0');
        }
        if(nob1==""){
            nob1=0;$('#nob1').val('0');
        }
        if(act_wt1==""){
            act_wt1=0;$('#act_wt1').val('0');
        }
        var char_wt1=length1*width1*height1*nob1;
            if(char_wt1!=0 && char_wt1!=0.00){
                char_wt1=char_wt1/shipping_value;
            }
        $('#char_wt1').val(parseFloat(char_wt1).toFixed(2));
        
        
        var length2 =$('#length2').val();
        var width2 =$('#width2').val();
        var height2 =$('#height2').val();
        var nob2 =$('#nob2').val();
        var act_wt2=$('#act_wt2').val();
        
        if(length2 ==""){
            length2 =0;$('#length2').val('0');
        }
        if(width2 ==""){
            width2 =0;$('#width2').val('0');
        }
        if(height2 ==""){
            height2 =0;$('#height2').val('0');
        }
        if(nob2 ==""){
            nob2 =0;$('#nob2').val('0');
        }
        if(act_wt2 ==""){
            act_wt2 =0;$('#act_wt2').val('0');
        }
        var char_wt2 =length2 *width2 *height2 *nob2 ;
            if(char_wt2 !=0 && char_wt2 !=0.00){
                char_wt2 =char_wt2 /shipping_value;
            }
        $('#char_wt2').val(parseFloat(char_wt2 ).toFixed(2));
        
        
        var length3=$('#length3').val();
        var width3=$('#width3').val();
        var height3=$('#height3').val();
        var nob3=$('#nob3').val();
        var act_wt3=$('#act_wt3').val();
        
        if(length3==""){
            length3=0;$('#length3').val('0');
        }
        if(width3==""){
            width3=0;$('#width3').val('0');
        }
        if(height3==""){
            height3=0;$('#height3').val('0');
        }
        if(nob3==""){
            nob3=0;$('#nob3').val('0');
        }
        if(act_wt3==""){
            act_wt3=0;$('#act_wt3').val('0');
        }
        var char_wt3=length3*width3*height3*nob3;
            if(char_wt3!=0 && char_wt3!=0.00){
                char_wt3=char_wt3/shipping_value;
            }
        $('#char_wt3').val(parseFloat(char_wt3).toFixed(2));
        
        
        var length4=$('#length4').val();
        var width4=$('#width4').val();
        var height4=$('#height4').val();
        var nob4=$('#nob4').val();
        var act_wt4=$('#act_wt4').val();
        
        if(length4==""){
            length4=0;$('#length4').val('0');
        }
        if(width4==""){
            width4=0;$('#width4').val('0');
        }
        if(height4==""){
            height4=0;$('#height4').val('0');
        }
        if(nob4==""){
            nob4=0;$('#nob4').val('0');
        }
        if(act_wt4==""){
            act_wt4=0;$('#act_wt4').val('0');
        }
        var char_wt4=length4*width4*height4*nob4;
            if(char_wt4!=0 && char_wt4!=0.00){
                char_wt4=char_wt4/shipping_value;
            }
        $('#char_wt4').val(parseFloat(char_wt4).toFixed(2));
        
        
        var length5=$('#length5').val();
        var width5=$('#width5').val();
        var height5=$('#height5').val();
        var nob5=$('#nob5').val();
        var act_wt5=$('#act_wt5').val();
        
        if(length5==""){
            length5=0;$('#length5').val('0');
        }
        if(width5==""){
            width5=0;$('#width5').val('0');
        }
        if(height5==""){
            height5=0;$('#height5').val('0');
        }
        if(nob5==""){
            nob5=0;$('#nob5').val('0');
        }
        if(act_wt5==""){
            act_wt5=0;$('#act_wt5').val('0');
        }
        var char_wt5=length5*width5*height5*nob5;
            if(char_wt5!=0 && char_wt5!=0.00){
                char_wt5=char_wt5/shipping_value;
            }
        $('#char_wt5').val(parseFloat(char_wt5).toFixed(2));
        
        
        if(act_wt1 > char_wt1){
            char_wt1=act_wt1;
        }
        if(act_wt2 > char_wt2){
            char_wt2=act_wt2;
        }
        if(act_wt3 > char_wt3){
            char_wt3=act_wt3;
        }
        if(act_wt4 > char_wt4){
            char_wt4=act_wt4;
        }
        if(act_wt5 > char_wt5){
            char_wt5=act_wt5;
        }
        
        var c_weight=(parseFloat(char_wt1)+parseFloat(char_wt2)+parseFloat(char_wt3)+parseFloat(char_wt4)+parseFloat(char_wt5)).toFixed(2);
        $('#c_weight').val(c_weight);
        
        var a_weight=(parseFloat(act_wt1)+parseFloat(act_wt2)+parseFloat(act_wt3)+parseFloat(act_wt4)+parseFloat(act_wt5));
        $('#a_weight').val(parseFloat(a_weight).toFixed(2));
        
        
        var pics=parseInt(nob1)+parseInt(nob2)+parseInt(nob3)+parseInt(nob4)+parseInt(nob5);
        $('#pics').val(pics);
        console.log("a wight :"+a_weight);
     
    }
	</script>
	<?php require_once('footer.php'); ?>

Zerion Mini Shell 1.0