D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
edit-packign.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $login = $_SESSION['login_email']; if($login == ''){ echo '<script>location.replace("index.php")</script>'; } $clientId = ""; if(isset($_GET["clientId"])){ $clientId = $_GET["clientId"]; } if(isset($_SESSION["source_id"])){ $source_id = $_SESSION['source_id']; } $id = strip_tags($_GET['id']); $sql = " SELECT * FROM packing_list where id = '$id' and data_delete = 'NO'"; $result = mysqli_query($conn,$sql); $row = mysqli_fetch_array($result); $bill_pay_name = $row['bill_display_name']; $invoice_reference = $row['invoice_reference']; $invoice_Id = $row['invoice_id']; $proforma_id = $row['proforma_id']; $mobile_no = $row['mobile']; $package_type = $row['package_type']; $packing_date = $row['date']; $contactsql = mysqli_query($conn,"SELECT * FROM `contact` where id='$bill_pay_name' and data_delete ='no'"); $contactrow = mysqli_fetch_assoc($contactsql); $customer_type = $contactrow['customer_type']; $bill_display_name = $contactrow['bill_display_name']; $contact_person_name = $contactrow['contact_person_name']; $contact_person_designation = $contactrow['contact_person_designation']; $item = ""; $sqlitem = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $resultitem = mysqli_query($conn,$sqlitem); if($resultitem){ if(mysqli_num_rows($resultitem) > 0){ while( $rowitem = mysqli_fetch_assoc($resultitem)){ $item .= "<option value='". $rowitem['id'] ."'>".$rowitem['name']."</option> "; } } } $datacodeitem = ""; $datacodesqlitem = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $datacoderesultitem = mysqli_query($conn,$datacodesqlitem); if($datacoderesultitem){ if(mysqli_num_rows($datacoderesultitem) > 0){ while( $datacoderowitem = mysqli_fetch_assoc($datacoderesultitem)){ $datacodeitem .= "<option value='". $datacoderowitem['id'] ."'>".$datacoderowitem['item_code']."</option> "; } } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Invoice Management | Invoice</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" /> <meta content="Coderthemes" name="author" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Font Awsome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- App favicon --> <link rel="shortcut icon" href="assets/images/favicon.png"> <!-- Pie Chart Css --> <!--<link href="assets/pie charts/style.css" rel="stylesheet" type="text/css" />--> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.css" rel="stylesheet" type="text/css" /> <link href="assets/css/metismenu.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/style.css" rel="stylesheet" type="text/css" /> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css'> <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> <!--<script src = "https://code.jquery.com/jquery-1.10.2.js"></script> --> <script> function getInvoicePrefix(companyId) { $.ajax({ url: "getInvoicePrefix.php?companyId=" + companyId, method: "GET", async: false, success: function(response) { var str = response.split(","); var myArray = str[0].split(/([0-9]+)/); // for(var j = 0; j<myArray.length; j++){ // console.log(myArray[j]); // } var lastNumber = "0"+str[1]; var prev = ""; var i = 0; do{ prev = prev+""+myArray[i]; i++; }while(i < myArray.length-2); if(Number.isInteger(parseInt(myArray[myArray.length-2]))){ var val = parseInt(parseInt(myArray[myArray.length-2])+ parseInt(lastNumber)); $("#invoice_id").val("#"+prev + "" + val); } else{ $("#invoice_id").val("#"+prev+""+lastNumber); } // $("#invoice_id").val("#" + str[0] + "/" + str[1]); $("#invoice_number").val(str[1]); }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } </script> </head> <body> <!-- Begin page --> <div id="wrapper"> <!-- Top Bar Start --> <?php include 'top-header.php'; ?> <!-- Top Bar End --> <!-- ========== Left Sidebar Start ========== --> <?php include 'left-sidebar.php'; ?> <!-- Left Sidebar End --> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="content-page"> <!-- Start content --> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="page-title-box"> <h4 class="page-title float-left">Create Packing List</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Sales</li> <li class="breadcrumb-item active">Create Packing List</li> </ol> <div class="clearfix"></div> </div> </div> </div> <!-- end row --> <form action="update-packing-list.php" method="post" class="form-horizontal" role="form"> <div class="card-box"> <input type="hidden" name="id" value="<?php echo $id ?>"> <input type="hidden" name="invoice_id" value="<?php echo $invoice_Id ?>"> <input type="hidden" name="proforma_id" value="<?php echo $proforma_id ?>"> <input type="hidden" name="invoice_reference" value="<?php echo $invoice_reference ?>"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Bill Display Name</label> <input class="form-control" name="bill_display_name" value="<?php echo $bill_pay_name ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Mobile No.</label> <input class="form-control" name="contact" value="<?php echo $mobile_no ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Date</label> <input class="form-control" name="date" id="date" placeholder="Enter Date" value="<?php echo $packing_date ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Package Type</label> <select class="form-control select" name="packaging_type" required> <option value="">-- select type --</option> <option <?php if($package_type == 'Carton'){ echo 'selected';} ?> value="Carton">Carton</option> <option value="other">Other</option> </select> </div> </div> </div> <div class="row"> <button id="add" class="btn add-more button-yellow uppercase" type="button"> + Add Line Item</button> <table class="table table-responsive"> <thead> <tr> <th style="font-size:12px;">Item Name</th> <th style="font-size:12px;">Item Code</th> <th style="font-size:12px;">Size</th> <th style="font-size:12px;" style="font-size:12px;">Color</th> <th style="font-size:12px;">CTN / Roll</th> <th style="font-size:12px;">Qty</th> <th style="font-size:12px;">Qty Mult</th> <th style="font-size:12px;">G.W</th> <th style="font-size:12px;">N.W.</th> <th style="font-size:12px;">Measurement</th> <th></th> </tr> </thead> <tbody id='itemsadd'> <?php $getitemsql = mysqli_query($conn,"SELECT * FROM packing_item a left join inventory b on a.item = b.id where a.packing_id = '$id'"); while($item_row = mysqli_fetch_assoc($getitemsql)){ $item_id_p = $item_row['item']; $item_code_p = $item_row['item_code']; $price_p = $item_row['price']; $row_total = $item_row['row_total']; $item_name = $item_row['name']; $item_color = $item_row['color']; $unit_of_measure = $item_row['unit_of_measure']; $item_p_img = 'inventory/'.$item_row['item_image']; $item_p_size = $item_row['size']; $item_p_qty_qty_mult = $item_row['qty_mult']; $item_p_qty_box_pcs = $item_row['qty_box_pcs'] / $item_p_qty_qty_mult; $item_p_qty_ctn_roll = $item_row['ctn_roll']; $item_p_qty_gross_wt = $item_row['gross_wt'] / $item_p_qty_qty_mult; $item_p_qty_net_wt = $item_row['net_wt'] / $item_p_qty_qty_mult; $item_p_qty_measurement = $item_row['measurement']; ?> <tr> <td class="p-1" style="width:250px;"> <select class="form-control select itemClass" name="item[]" onchange="showitem(this)"> <?php $sqlitem = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $resultitem = mysqli_query($conn,$sqlitem); if($resultitem){ if(mysqli_num_rows($resultitem) > 0){ while( $rowitem = mysqli_fetch_assoc($resultitem)){ ?> <option value='<?php echo $rowitem['id'] ?>' <?php if($item_id_p == $rowitem['id']){ echo "selected";} ?>><?php echo $rowitem['name'] ?></option> <?php } } } ?> </select> </td> <td class="p-1"> <select class='form-control select itemcode' name="item_code[]" type='text' onchange="getitemcodedata(this)"> <option value=''>--select item code--</option> <option value='<?php echo $item_id_p ?>'><?php echo $item_code_p ?></option> <?php $sqlitem = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $resultitem = mysqli_query($conn,$sqlitem); if($resultitem){ if(mysqli_num_rows($resultitem) > 0){ while( $rowitem = mysqli_fetch_assoc($resultitem)){ ?> <option value='<?php echo $rowitem['id'] ?>' <?php if($item_id_p == $rowitem['id']){ echo "selected";} ?>><?php echo $rowitem['item_code'] ?></option> <?php } } } ?> </select> </td> <td class="p-1" class="p-1"> <input type='text' class='form-control size p-1' name="size[]" style="font-size:12px;" value="<?php echo $item_p_size ?>"> </td> <td class="p-1"> <input type='text' class='form-control color p-1' name="color[]" style="font-size:12px;" value="<?php echo $item_color ?>"> </td> <td class="p-1"> <input type='text' class='form-control ctn_roll p-1' name="ctn_roll[]" style="font-size:12px;" value="<?php echo $item_p_qty_ctn_roll ?>"> </td> <td class="p-1" class="p-1"> <input type='text' class="form-control p-1" name="qty_box_pcs[]" value="<?php echo $item_p_qty_box_pcs ?>" style="font-size:12px;"> </td> <td class="p-1"> <input type='text' class='form-control p-1' name="qty_mult[]" style="font-size:12px;" value="<?php echo $item_p_qty_qty_mult ?>"> </td> <td class="p-1" class="p-1"> <input type='text' class='form-control gross_wt' name="gross_wt[]" style="font-size:12px;" value="<?php echo $item_p_qty_gross_wt ?>"> </td> <td class="p-1"> <input type='text' class='form-control net_wt' name="net_wt[]" style="font-size:12px;" value="<?php echo $item_p_qty_net_wt ?>" > </td> <td class='p-1'> <input type='text' class='form-control' name="measurement[]" style="font-size:12px;" value="<?php echo $item_p_qty_measurement ?>"> </td> <td class="p-1 d-flex"><button type="button" class="btn btn-xs btn-danger delete"><span class="fa fa-trash"></span></button> <button type='button' class='btn btn-xs btn-primary addd'><span class='fa fa-plus'></span></button></td> </tr> <?php } ?> </tbody> </table> </div> <hr> <button type="submit" class="btn btn-info waves-effect waves-light w-100">Submit</button> </form> </div> </div> </div> <!-- container --> </div> <!-- content --> <?php include 'copyrignt.php' ?> </div> <!-- ============================================================== --> <!-- End Right content here --> <!-- ============================================================== --> </div> <!-- END wrapper --> <!-- Chart Js --> <script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.js'></script> <!-- jQuery --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/popper.min.js"></script><!-- Popper for Bootstrap --> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/metisMenu.min.js"></script> <!--<script src="assets/js/waves.js"></script>--> <script src="assets/js/jquery.slimscroll.js"></script> <!-- Dashboard init --> <script src="assets/pages/jquery.dashboard.js"></script> <!-- App js --> <script src="assets/js/jquery.core.js"></script> <script src="assets/js/jquery.app.js"></script> <!-- Chart Js --> <!-- <script src="assets/pie charts/script.js"></script>--> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js'></script> <script src="assets/js/modernizr.min.js"></script> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> --> <script type="text/javascript" src="script.js"></script> <script> $(document).ready(function() { //when the Add Field button is clicked $("#add").click(function(e) { //Append a new row of code to the "#items" div $("#itemsadd").append( "<tr style='width:100%'><td class='p-1'><select class='form-control select itemClass' name='item[]' onchange='showitem(this)'><option value=''>--Select Item--</option><?php echo $item ?></select></td><td class='p-1'><select class='form-control select itemcode' name='item_code[]' type='text' onchange='getitemcodedata(this)'><option value=''>--select item code--</option><?php echo $datacodeitem ?></select></td><td class='p-1'><input type='text' class='form-control size' name='size[]' ></td><td class='p-1'><input type='text' class='form-control color' name='color[]'></td><td class='p-1'><input class='form-control ctn_roll' type='text' name='ctn_roll[]'></td><td class='p-1'><input class='form-control' type='text' name='qty_box_pcs[]'></td><td class='p-1'><input class='form-control' type='text' name='qty_mult[]'> </td><td class='p-1'><input class='form-control gross_wt' type='text' name='gross_wt[]'></td><td class='p-1'><input class='form-control net_wt' type='text' name='net_wt[]'> </td> <td class='p-1'><input class='form-control' type='text' name='measurement[]'></td><td class='p-1 d-flex'><button type='button' class='btn btn-xs btn-danger delete'><span class='fa fa-trash'></span></button><button type='button' class='btn btn-xs btn-primary addd'><span class='fa fa-plus'></span></button></td></tr>" ); forSelect(); }); //("body").on("click", ".delete", function(e) { //$("#next-referral").last().remove(); //}); }); $(document).on('click', '.delete', function() { var totalColumn = $(this).closest('tr').parent(); $(this).closest('tr').remove(); }); $(document).on('click', '.addd', function() { //Append a new row of code to the "#items" div $(this).closest('tr').after( "<tr style='width:100%'><td class='p-1'><select class='form-control select itemClass' name='item[]' onchange='showitem(this)'><option value=''>--Select Item--</option><?php echo $item ?></select></td><td class='p-1'><select class='form-control select itemcode' name='item_code[]' type='text' onchange='getitemcodedata(this)'><option value=''>--select item code--</option><?php echo $datacodeitem ?></select></td><td class='p-1'><input type='text' class='form-control size' name='size[]' ></td><td class='p-1'><input type='text' class='form-control color' name='color[]'></td><td class='p-1'><input class='form-control ctn_roll' type='text' name='ctn_roll[]'></td><td class='p-1'><input class='form-control' type='text' name='qty_box_pcs[]'></td><td class='p-1'><input class='form-control' type='text' name='qty_mult[]'> </td><td class='p-1'><input class='form-control gross_wt' type='text' name='gross_wt[]'></td><td class='p-1'><input class='form-control net_wt' type='text' name='net_wt[]'> </td> <td class='p-1'><input class='form-control' type='text' name='measurement[]'></td><td class='p-1 d-flex'><button type='button' class='btn btn-xs btn-danger delete'><span class='fa fa-trash'></span></button> <button type='button' class='btn btn-xs btn-primary addd'><span class='fa fa-plus'></span></button></td></tr>" ); forSelect(); }); </script> <script> $(function () { $(".select") .on('select2:close', function() { var el = $(this); if(el.val()==="other") { var newval = prompt("Enter other value you want: "); if(newval !== null) { el.append('<option>'+newval+'</option>') .val(newval); } } }); }); function selectOption() { $('.select').select2(); } $(document).ready(function() { forSelect(); }); function forSelect() { selectOption(); $('#add').click(function() { var text = $('#text').html(); $('#demo').append(text); $('#demo .select').select2(); $('#demo .select').last().next().next().remove(); }); } $(document).ready(function() { $("#date").datepicker({ dateFormat: 'dd MM yy' }); }); $(document).ready(function(){ $("#date").datepicker("setDate", new Date()); }); // getInvoicePrefix("31"); function getitemcodedata(response){ var thisRow = $(response).closest('tr'); var getitemcodedata = thisRow.find('.itemcode').val(); if (getitemcodedata == "") { document.getElementById("txtHint").innerHTML = ""; return; } $.ajax({ url : "PHP/response.php", data : "getitemcodedata="+getitemcodedata+"&action=getitemcodedata", async : false, method : "post", success: function(response) { var str1 = JSON.parse(response); thisRow.find('.itemClass').html('<option value="' + str1.id + '">' + str1.name + '</option>'); thisRow.find('.item_qty').val(str1.item_qty); thisRow.find('.item_id').val(str1.id); thisRow.find('.size').val(str1.size); thisRow.find('.color').val(str1.color); thisRow.find('.unit_of_measure').val(str1.unit_of_measure); // thisRow.find('.discountAppliedClass').val(str1.discount_applied); // thisRow.find('.discountCategoryClass').val(str1.discount_category); if(thisRow.find('.quantityClass').val() != ""){ thisRow.find('.quantityClass').trigger("keyup"); } }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } function showitem(str) { var thisRow = $(str).closest('tr'); var item = thisRow.find('.itemClass').val(); if (item == "") { document.getElementById("txtHint").innerHTML = ""; return; } $.ajax({ url: "getitem.php", method: "POST", async: false, data: {q:item}, success: function(response) { var str1 = JSON.parse(response); thisRow.find('.itemcode').html('<option value="' + str1.item_code + '">' + str1.item_code + '</option>') thisRow.find('.item_id').val(str1.id); thisRow.find('.color').val(str1.color); thisRow.find('.size').val(str1.size); thisRow.find('.unit_of_measure').val(str1.unit_of_measure); thisRow.find(".img_item").attr("src",'inventory/'+str1.item_image); // thisRow.find('.discountAppliedClass').val(str1.discount_applied); // thisRow.find('.discountCategoryClass').val(str1.discount_category); if(thisRow.find('.quantityClass').val() != ""){ thisRow.find('.quantityClass').trigger("keyup"); } }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } </script> </body> </html>