JezK
Edit File: issuetranscation.php
<?php include_once("../app/checkSession.php"); include("header.php"); // if($_SESSION['created_by'] > 0){ // $quote_list = $wareHouseAdminObj->db->get_results("select urq.* from uflexit_request_quote as urq join uflexit_users as uu on uu.user_id=urq.user_id WHERE company_id=".(int)$_SESSION['company_id']." and quotation_status =3 and closed_status != 4" ); // } else { // $quote_list = $wareHouseAdminObj->db->get_results("select urq.* from uflexit_request_quote as urq join uflexit_users as uu on uu.user_id=urq.user_id WHERE company_id=".(int)$_SESSION['company_id']." and quotation_status =3 and closed_status != 4"); // } if($_SESSION['created_by'] > 0){ $query1="select user_id from uflexit_users where company_id=".(int)$_SESSION['company_id']." and (role_id=1 or role_id=2)"; $res=$wareHouseAdminObj->db->get_results($query1); $userArray=array(); foreach($res as $data ){ $userArray[]=$data['user_id']; } $imploded_arr = implode(',', $userArray); $query = "SELECT quotation_id FROM uflexit_request_quote WHERE whadmin_id IN ($imploded_arr) and quotation_status =3 and closed_status != 4"; $quote_list=$wareHouseAdminObj->db->get_results($query); // $quote_list = $wareHouseAdminObj->db->get_results("select urq.* from uflexit_request_quote as urq join uflexit_users as uu on uu.user_id=urq.user_id WHERE company_id=".(int)$_SESSION['company_id']." and quotation_status =3 and closed_status != 4" ); } else { // $query ="select urq.* from uflexit_request_quote as urq join uflexit_users as uu on uu.user_id=urq.user_id WHERE company_id=".(int)$_SESSION['company_id']." and quotation_status =3 and closed_status != 4"; $query1="select user_id from uflexit_users where company_id=".(int)$_SESSION['company_id']." and (role_id=1 or role_id=2)"; // echo $query1; $res=$wareHouseAdminObj->db->get_results($query1); $userArray=array(); foreach($res as $data ){ $userArray[]=$data['user_id']; } $imploded_arr = implode(',', $userArray); $query = "SELECT quotation_id FROM uflexit_request_quote WHERE whadmin_id IN ($imploded_arr) and quotation_status =3 and closed_status != 4"; // echo $query; $quote_list=$wareHouseAdminObj->db->get_results($query); } ?> <div class="container pl-5 pr-5 mt-5"> <a href="javascript:history.go(-1)"><img src="images/back_main.png" class="mb-3"></a> <p class="text-dark"><strong><?php echo $lang['ISSUING_TRANSACTION_DETAILS'];?></strong></p> </div> <form method="post" action="app/add-issutransaction.php" class="px-3 px-md-5"> <div class="warehouse_boxshadow container pb-3"> <div class="containercontent mt-0"> <div class="card-body invoices_page_div"> <div class="row"> <div class="col-md-4 col-lg-3 col-sm-12 ipadMargin"> <label for="qutationid"><?php echo $lang['QUOTATION_ID'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12 ipadMargin "> <!-- <input type="text" class="" id="qutationid" required placeholder="014462" name="quotation_id"> --> <select class="form-control" name="quotation_id" id="qutationid" onchange="getqutationdata(this.value);" required=""> <option value=''>Select Quotation</option> <?php foreach ($quote_list as $qlist) { ?> <option value='<?php echo $qlist['quotation_id'] ?>'><?php echo $qlist['quotation_id'] ?> </option> <?php } ?> </select> <div class="error qutationid_error"></div> </div> <div class="col-md-4 col-lg-3 col-sm-12" style="max-width: 215px;"> <label for="advshipmentid"><?php echo $lang['ADVANCE_SHIPMENT_ID'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <input type="text" class="form-control" required id="asn_id" placeholder="ASN id" name="asn_id" readonly> <!-- <select class="form-control" name="asn_id" id="asn_id" required="" onchange="getasndata(this.value);"> <option value=''>Select Shipment ID</option> </select> --> </div> </div> <div class="row mt-2"> <div class="col-md-4 col-lg-3 col-sm-12 "> <label for="customername"><?php echo $lang['CUSTOMER_NAME'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <input type="text" class="form-control" id="customer_name" placeholder="Name" name="customer_name" readonly> </div> <div class="col-md-4 col-lg-3 col-sm-12 ipadMargin" style="max-width: 215px;"> <label for="country"><?php echo $lang['COUNTRY'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12 ipadMargin"> <input type="text" class="form-control" id="country" placeholder="Country" name="country" readonly> </div> </div> <div class="row mt-2"> <div class="col-md-4 col-lg-3 col-sm-12 ipadMargin"> <label for="email"><?php echo $lang['EMAIL'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12 ipadMargin"> <input type="text" class="form-control" id="email" placeholder="Email" name="email" readonly> </div> <div class="col-md-4 col-lg-3 col-sm-12" style="max-width: 215px;"> <label for="city"><?php echo $lang['CITY'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <input type="text" class="form-control" id="city" placeholder="City" name="city" readonly> </div> </div> <div class="row mt-lg-2"> <div class="col-md-4 col-lg-3 col-sm-12 ipadMargin"> <label for="warehouse_name"><?php echo $lang['WAREHOUSE_NAME'];?></label> </div> <div class="col-md-6 col-lg-3 col-sm-12 ipadMargin"> <input type="text" class="form-control" id="warehouse_name" placeholder="Warehouse name" name="warehouse_name" readonly> <div class="error email_error"></div> </div> </div> </div> </div> </div> <div class="container pt-5 px-0"> <p class="text-dark"><strong><?php echo $lang['ADD_ITEM_DETAILS'];?></strong></p> </div> <div class="warehouse_boxshadow container py-5 table-responsive "> <table class="table table-bordered table_body newRow_add"> <thead class="theadcolor"> <tr> <th><?php echo $lang['ITEM_CODE'];?></th> <th><?php echo $lang['ITEM_DESCRIPTION'];?></th> <th><?php echo $lang['QUANTITY'];?></th> <!-- <th>Quotation ID</th> --> <th><?php echo $lang['REFERENCE_NUMBER'];?></th> <th id="currencyLabel"><?php echo $lang['COST'];?></th> <th><?php echo $lang['PALLET_NO'];?></th> <th><?php echo $lang['ROW'];?></th> <th><?php echo $lang['RACK'];?></th> <th><?php echo $lang['PIN'];?></th> <th><?php echo $lang['ACTION'];?></th> </tr> </thead> <tbody id="itemDetails"> </tbody> </table> <div class="error rowadd_error"></div> <div class="error itemcode_error"></div> <div class="error item_desc_error"></div> <div class="error qty_error"></div> <div class="error ref_number_error"></div> <div class="error cost_error"></div> <div class="error pallet_no_error"></div> <div class="error row_val_error"></div> <div class="error rack_error"></div> <div class="error pin_error"></div> <input type="hidden" name="warehouse_id" id="warehouse_id" /> <!-- <button id="addRow" disabled class="buttonDisable btn-color">Add</button> --> </div> <button id="addRowSave" type="submit" name="saveissue" class="float-right mr-1 mt-3 btn-color" onclick="return receivedtransactionvalidations()" disabled ><?php echo $lang['ISSUE'];?></button> </form> </div> <?php include("footer.php"); ?> <style> .newRow_add tr td { padding: 0px !important; width: 100px; } /* .newRow_add tr td input { width: 100% !important; border: none; background: #eaeffa; padding: 10px; border-bottom: 1px solid #3663c88c; } */ .newRow_add tr td input,.newRow_add tr td textarea{ width:100% !important;border:none;background:#eaeffa;padding: 10px;border-bottom: 1px solid #3663c88c; height: 50px !important; } .newRow_add tr td textarea{ width: 150px !important; background: #eaeffa !important; } .newRow_add tbody tr:nth-child(even) textarea { background: #ffffff !important; } .newRow_add tr td input.customWeigth { height: 15px !important; } button#addRow, button#addRowSave { background: #3663c8; border: none; padding: 5px 15px; color: #fff; } .invoices_page_div input { width: 100%; border: 1px solid #ced4da; border-radius: 5px; padding: 0px 5px; } .table-bordered td, .table-bordered th { border: 1px solid grey; } .btn-color { opacity: 0.5; } table.table.table-bordered.table_body.newRow_add input { text-align: center; } label{ padding-left:22px; } @media(max-width:767px){ label{ padding-left:0px; } } </style> <script> $('.newRow_add tbody input').change(function(event) { var len = 0; $(".newRow_add tbody input").each(function() { if (this.value != "") { len++; } if (len == 8) { $("#addRow").removeAttr("disabled"); $("#addRow").removeClass("btn-color"); } }); }) var counter = 0; $ = jQuery; $('#addRow').click(function(event) { event.preventDefault(); $('.error').html(''); var valid = 0; $(".newRow_add tbody input").each(function() { if (this.value == "") { valid++; } }) if (valid == 0) { counter++; var newRow = $('<tr id=' + counter + '><td><input type="text" id="itemcode' + counter + '" name="itemcode[]"/></td><td><input type="text" id="item_desc' + counter + '" name="item_desc[]"/></td><td><input type="text" id="qty' + counter + '" name="qty[]"/></td><td><input type="text" id="ref_number' + counter + '" name="ref_number[]"/></td><td><input type="text" id="cost[]" name="cost[]"/></td><td><input type="text" id="pallet_no' + counter + '" name="pallet_no[]"/></td><td><input type="text" id="row_val' + counter + '" name="row_val[]"/></td><td><input type="text" id="rack' + counter + '" name="rack[]"/></td><td><input type="text" id="pin' + counter + '" name="pin[]"/></td></tr>'); jQuery('table.newRow_add').append(newRow); } else { $('.rowadd_error').html('*Please Fill all the required fields'); $('#itemcode').focus(); ///return false; } }); var saudi="<?php echo $lang['SAUDI_ARABIA'] ?>"; var uae="<?php echo $lang['UAE'] ?>"; var jordon="<?php echo $lang['JORDAN'] ?>" function getqutationdata(qid) { // alert(qid); var div_data = ""; //$('#medicine_name' + rowid).select2("val", ''); //$("#medicine_name").html("<option value=''>Select</option>"); $.ajax({ // url: 'http://uflexit.krify.com/ajax.php', url: '../ajax.php', type: "POST", data: ({ action: 'get_quotationdata', qid: qid }), success: function(res) { result = JSON.parse(res); console.log(result); // var res = res.split("<<>>"); $('#customer_name').val(result[0].first_name); $('#country').val(result[0].country_id); $('#email').val(result[0].email); $('#city').val(result[0].city_name); $('#warehouse_id').val(result[0].warehouse_id); $('#warehouse_name').val(result[0].warehouse_name); if (result[0].asn_id == null) { $('#asn_id').val(0); } else { $('#asn_id').val(result[0].asn_id); } if(result[0].country_id==1){ $('#country').val(saudi); $('#currencyLabel').html("<?php echo $lang['COST'];?> (SAR)") }else if(result[0].country_id==2){ $('#country').val(uae); $('#currencyLabel').html("<?php echo $lang['COST'];?> (AED)") }else if(result[0].country_id==3){ $('#country').val(jordon); $('#currencyLabel').html("<?php echo $lang['COST'];?> (JD)") } } }) // alert("hello") $.ajax({ url: 'ajax.php', type: "POST", data: ({ action: 'get_quotationItemDetails', qid: qid }), success: function(res) { data = JSON.parse(res); $('#itemDetails').html(data.result) } }) } function quantityValidation(PrevValue,id){ var updatedVal=parseInt(id.value) var quantityId=id.id; if(updatedVal>PrevValue){ alert("Given stock quantity is not matching to the available stock") document.getElementById(quantityId).value=PrevValue; } } var counter=0; $(document).ready(function(){ $(document).on('change', 'input[type="checkbox"]', function(e){ //do your stuff here if ($(this).prop('checked') == true ) { counter++; }else if($(this).prop('checked') == false){ counter--; } if(counter>0){ $("#addRowSave").removeAttr("disabled"); $("#addRowSave").removeClass("btn-color"); }else if(counter==0){ $( '#addRowSave' ).addClass('btn-color'); $("#addRowSave").prop("disabled",true); } }); }); // $('#itemDetails').click(function() { // //~ var wid= document.getElementById('warehouseId').value; // var wid = $(this).closest("#qty").find(".PrevQuantity").val() // // alert(wid); // console.log(wid,"hello") // }) // $(document).on('[id^=qty_]',"keyup"(function() { // alert("hello") // var dInput = this.value; // console.log(dInput); // })); function receivedtransactionvalidations() { // alert("hello") // let itemcodeval=document.getElementsByName('itemcode[]'); // alert(itemcodeval); let Quote_id = document.getElementById('qutationid').value; let request_type = document.getElementById('asn_id').value; let customer_name = document.getElementById('customer_name').value; let country = document.getElementById('country').value; let email = document.getElementById('email').value; let city = document.getElementById('city').value; // alert(total_days); let itemcode = document.getElementById('itemcode').value; let item_desc = document.getElementById('item_desc').value; let qty = document.getElementById('qty').value; let ref_number = document.getElementById('ref_number').value; let cost = document.getElementById('cost').value; let pallet_no = document.getElementById('pallet_no').value; let row_val = document.getElementById('row_val').value; let rack = document.getElementById('rack').value; let pin = document.getElementById('pin').value; $('.error').html(''); if (Quote_id == '') { $('.qutationid_error').html('Select Quotation Id'); $('#Quote_id').focus(); return false; } else if (request_type == '') { // alert('hello') $('.advance_shippment_error').html('Select Advance shipment type'); $('#request_type').focus() return false; } else if (customer_name == '') { $('.customer_name_error').html('customer name required'); $('#customer_name').focus(); return false; } else if (country == '') { $('.country_error').html('country required'); $('#country').focus() return false; } else if (email == '') { $('.email_error').html('warehouse name required'); $('#email').focus(); return false; } else if (city == '') { $('.city_error').html('warehouse type required'); $('#city').focus(); return false; } else if (itemcode == '') { $('.itemcode_error').html('please enter itemcode'); $('#itemcode').focus(); return false; } else if (item_desc == '') { $('.item_desc_error').html('please enter item_desc'); $('#item_desc').focus(); return false; } else if (qty == '') { $('.qty_error').html('please enter qty'); $('#qty').focus(); return false; } else if (ref_number == '') { $('.ref_number_error').html('please enter ref_number'); $('#ref_number').focus(); return false; } else if (cost == '') { $('.cost_error').html('please enter cost'); $('#cost').focus(); return false; } else if (pallet_no == '') { $('.pallet_no_error').html('please enter pallet_no'); $('#itemcode').focus(); return false; } else if (row_val == '') { $('.row_val_error').html('please enter row'); $('#row_val').focus(); return false; } else if (rack == '') { $('.rack_error').html('please enter rack'); $('#rack').focus(); return false; } else if (pin == '') { $('.pin_error').html('please enter pin'); $('#pin').focus(); return false; } let itemcodeval = document.getElementsByName('itemcode[]') let item_descval = document.getElementsByName('item_desc[]') let qtyval = document.getElementsByName('qty[]') let ref_numberval = document.getElementsByName('ref_number[]') let costval = document.getElementsByName('cost[]') let pallet_noval = document.getElementsByName('pallet_no[]') let row_val1 = document.getElementsByName('row_val[]') let rackval = document.getElementsByName('rack[]') let pinval = document.getElementsByName('pin[]') for (x = 0; x < itemcodeval.length; x++) { if (itemcodeval[x].value == '' || itemcodeval[x].value == '0') { $(".itemcode_error").html('*please enter itemcode'); itemcodeval[x].focus(); return false; } else if (item_descval[x].value == '' || item_descval[x].value == '0') { $(".item_desc_error").html('*please enter item_description'); item_descval[x].focus(); return false; } else if (qtyval[x].value == '' || qtyval[x].value == '0') { $(".qty_error").html('*please enter quantity'); qtyval[x].focus(); return false; } else if (ref_numberval[x].value == '' || ref_numberval[x].value == '0') { $(".ref_number_error").html('*please enter ref_number'); ref_numberval[x].focus(); return false; } else if (costval[x].value == '' || costval[x].value == '0') { $(".cost_error").html('*please enter cost'); costval[x].focus(); return false; } else if (pallet_noval[x].value == '' || pallet_noval[x].value == '0') { $(".pallet_no_error").html('* please enter pallet_no'); pallet_noval[x].focus(); return false; } else if (row_val1[x].value == '' || row_val1[x].value == '0') { $(".row_val_error").html('*please enter row'); row_val1[x].focus(); return false; } else if (rackval[x].value == '' || rackval[x].value == '0') { $(".rack_error").html('*please enter rack no'); rackval[x].focus(); return false; } else if (pinval[x].value == '' || pinval[x].value == '0') { $(".pin_error").html('please enter itemcode'); pinval[x].focus(); return false; } } } function checkPhone(e){ // alert(e) var key = e.keyCode || e.charCode; if(key == 13 || key == 43 || (key >= 48 && key <= 57) || key == 8 || key == 46) { return true; } else { return false; } // if() } </script>