ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/otc-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_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-One time Customer 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">Referance Code<span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="db_code" class="form-control" name="db_code" value="<?php if(isset($_POST['db_code'])){echo $_POST['db_code'];} ?>"> <input type="hidden" autocomplete="none" id="db_value" class="form-control" name="db_value" value="no"> </div> <div class="col-sm-4"> <span id="db_code_txt"></span> </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" checked> <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">Customer Name<span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="none" id="customer_name" class="form-control" name="customer_name" value="<?php if(isset($_POST['customer_name'])){echo $_POST['customer_name'];} ?>" required> </div> <div class="col-sm-4"> <span id="customer_name_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="search_pincode" required> <ul id="searchResult"></ul> </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;" required></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 class="col-sm-4"> <span id="city_txt"> </span> </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 class="col-sm-4"> <span id="state_txt"> </span> </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_city" class="form-control" name="destination_city"> </div> <div class="col-sm-4"> <span id="destination_txt"> </span> </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 class="col-sm-4"> <span id="phone_txt"> </span> </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">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">CASSH</option> </select> </div> </div> <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  : <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  :<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 Box <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">×</a> <strong>Success!</strong> Pick Entry Added !     <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">×</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 setText(element) { var value = $(element).text(); var userid = $(element).val(); $("#search_pincode").val(value); get_pincode_list(userid); $("#searchResult").empty(); } function formValidate() { var valid = 1; if ($('#client_id').val() == 'none') { $('#client_id_txt').text('Please select the Client'); $('#client_id_txt').css('color', 'red'); valid=0; } else { $('#client_id_txt').text(''); } if ($('#customer_id').val() == 'none') { $('#customer_id_txt').text('Please select the Customer'); $('#customer_id_txt').css('color', 'red'); valid=0; } else { $('#customer_id_txt').text(''); } if ($('#awb_value').val() == 'no' || $('#awb_no').val() =='') { $('#awb_txt').text('Please Enter Valid AWB Number'); $('#awb_txt').css('color', 'red'); valid=0; } else { $('#awb_txt').text(''); } if ($('#customer_name').val() == '' || $('#customer_name').val()==0) { $('#customer_name_txt').text('Please Enter Customer Name'); $('#customer_name_txt').css('color', 'red'); valid=0; } else { $('#customer_name_txt').text(''); } if ($('#pincode').val() == '' || $('#pincode').val()==0) { $('#pincode_txt').text('Please Pincode'); $('#pincode_txt').css('color', 'red'); valid=0; } else { $('#pincode_txt').text(''); } if ($('#address').val() == '' || $('#address').val()==0) { $('#remain_txt').text('Please enter address details'); $('#remain_txt').css('color', 'red'); valid=0; } else { $('#remain_txt').text(''); } if ($('#city').val() == '' || $('#city').val()==0) { $('#city_txt').text('Please city'); $('#city_txt').css('color', 'red'); valid=0; } else { $('#city_txt').text(''); } if ($('#state').val() == '' || $('#state').val()==0) { $('#state_txt').text('Please state'); $('#state_txt').css('color', 'red'); valid=0; } else { $('#state_txt').text(''); } if ($('#destination_city').val() == '' || $('#destination_city').val()==0) { $('#destination_txt').text('Please Destination City'); $('#destination_txt').css('color', 'red'); valid=0; } else { $('#destination_txt').text(''); } if ($('#phone').val() == '' || $('#phone').val()==0) { $('#phone_txt').text('Please Phone Number'); $('#phone_txt').css('color', 'red'); valid=0; } else { $('#phone_txt').text(''); } if ($('#db_value').val() == 'no') { $('#db_code_txt').text('Please Enter Valid DP Code'); $('#db_code_txt').css('color', 'red'); valid=0; } else { $('#db_code_txt').text(''); } return valid; } function get_pincode_list(search_pincode) { var search_pincode = $('#search_pincode').val(); if(search_pincode != "") { $("#destination_city").val(''); $.ajax({ type: 'POST', url: 'custom-api/pincode-list.php', data: { search_pincode: search_pincode, type:'get-datalist-pincode' }, dataType: 'json', success: function(response) { console.log('Rssponse:'+response['status']); if(response['status'] == 2) { console.log('data :'+response['data']); var len = response['data'].length; $("#searchResult").empty(); for(var i = 0; i < len; i++) { var id = response['data'][i]['id']; var pin_code = response['data'][i]['pin_code']; $("#searchResult").append("<li value='" + pin_code + "'>" + pin_code + "</li>"); } $("#searchResult li").bind("click", function() { setText(this); }); } if(response['status'] == 1) { $("#searchResult").empty(); $("#destination_city").val(response['data'][0]['area_code']); } } }); } } 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() { /************Search pincode based on work start************/ $('#search_pincode').bind('input',function() { var s=''; get_pincode_list(s); }); /*********** 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(''); } } }); } }); /*********** For checking Unique db code Number ***********/ $("#db_code").keyup(function() { var awb = $(this).val(); // alert(awb); if(awb == '') { $("#db_code_txt").text(''); } else { $.ajax({ type: 'POST', url: 'get_unique_awb.php', data: { awb: awb, type: 'dpcode' }, dataType: 'json', success: function(response) { console.log(response); if(response[0]['error'] == '0') { $("#db_value").val('yes'); $("#db_code_txt").css('color', 'green'); $("#db_code_txt").text(response[0]['txt']); } else if(response[0]['error'] == '1') { $("#db_value").val('no'); $("#db_code_txt").css('color', 'red'); $("#db_code_txt").text(response[0]['txt']); } else { $("#db_value").val('no'); $("#db_code_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_one_time_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"); $('#form')[0].reset(); } 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"); } } }); // alert('Ready To Submit....'); $("#form_submit").prop('disabled', false); } 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() { var length1=$('#length1').val(); var width1=$('#width1').val(); var height1=$('#height1').val(); var nob1=$('#nob1').val(); var act_wt1=$('#act_wt1').val(); var shipping_mode=$('#shipping_mode').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'); ?>