EVOLUTION-NINJA
Edit File: inventory_import_old.php
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <title>Yaskawa Inventory Import</title> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/main.css');?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/bootstrap.min.css');?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/font-awesome.min.css');?>" /> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <script type="text/javascript" src="<?php echo base_url('assets/js/jquery-3.6.0.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap.min.js');?>"></script> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.css'); ?>" /> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid.css'); ?>" /> <script src="<?php echo base_url('assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <style type="text/css"> .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } #editmodlist2 { //height: 232px !important; width: 326px !important; } #FrmGrid_list2 { width: 100% !important; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color:#2A4474 !important; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 43%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 27px !important; background-color: #2A4474!important; color:white !important; } .ui-jqgrid-bdiv { height: 232px !important; } .ui-widget-overlay { z-index:0 !important; } </style> </head> <body> <header class="cf"> <div class="container"> <div class="logo col-sm-4"> <a href="" class="hidden-xs hidden-sm"><img src="<?php echo base_url('assets/img/yaskawa_logo.png');?>" class="img-responsive"></a> <a href="" class="hidden-md hidden-lg"><img src="<?php echo base_url('assets/img/yaskawa_logo2.png');?>" class="img-responsive center-block"></a> </div> <div class="navigation col-sm-8"> <nav> <a href="javascript:void(0)" class="smobitrigger ion-navicon-round"><span>Menu</span></a> <ul class="mobimenu"> <?php if($details->role == 2) { if($details->department == 4) {?> <li class="dropdown"> <a href="" class="dropdown-toggle active" data-toggle="dropdown">Information <span class="glyphicon glyphicon-chevron-down"></span> </a> <ul class="dropdown-menu multi-column-dropdown"> <li><a href="<?php echo site_url('controller/inventory_import');?>">Stock Updates</a></li> <li><a href="<?php echo site_url('controller/po_import');?>">PO Acknowledgemets</a></li> </ul> </li> <!--<li><a href="<?php echo site_url('controller/news');?>">News</a></li>                       --> <?php }elseif($details->department == 5) {?> <li class="dropdown"> <a href="" class="dropdown-toggle" data-toggle="dropdown">Financials <span class="glyphicon glyphicon-chevron-down"></span> </a> <ul class="dropdown-menu multi-column-dropdown"> <li><a href="<?php echo site_url('controller/outstanding_statement');?>">Outstanding Statement</a></li> <li><a href="<?php echo site_url('controller/overdue_statement');?>">Overdue Statement</a></li> <li><a href="<?php echo site_url('controller/c_forms');?>">C forms</a></li> </ul> </li> <!--<li><a href="<?php echo site_url('controller/news');?>" class="active">News</a></li>                      --> <?php }elseif($details->department == 6) {?> <li class="dropdown"> <a href="" class="dropdown-toggle" data-toggle="dropdown">Technical Support <span class="glyphicon glyphicon-chevron-down"></span> </a> <ul class="dropdown-menu multi-column-dropdown"> <li><a href="<?php echo site_url('controller/drive_mannual_upload');?>">Drive Catalogues</a></li> <li><a href="<?php echo site_url('controller/case_stories_upload');?>">Case Stories</a></li> </ul> </li> <!--<li><a href="<?php echo site_url('controller/news');?>" class="active">News</a></li>                      --> <?php }elseif($details->department == 7) {?> <!--<li><a href="<?php echo site_url('controller/news_upload');?>" class="active">News</a></li>--> <?php } } elseif ($details->role == 3) {?> <li class="dropdown"> <a href="" class="dropdown-toggle active" data-toggle="dropdown">Information <span class="glyphicon glyphicon-chevron-down"></span> </a> <ul class="dropdown-menu multi-column-dropdown"> <li><a href="<?php echo site_url('controller/stock_updates');?>">Stock Updates</a></li> <li><a href="<?php echo site_url('controller/po_acknowledgemets');?>">PO Acknowledgemets</a></li> </ul> </li> <li class="dropdown"> <a href="" class="dropdown-toggle" data-toggle="dropdown">Financials <span class="glyphicon glyphicon-chevron-down"></span> </a> <ul class="dropdown-menu multi-column-dropdown"> <li><a href="<?php echo site_url('controller/outstanding_statements_display');?>">Outstanding Statement</a></li> <li><a href="<?php echo site_url('controller/overdue_statements_display');?>">Overdue Statement</a></li> <li><a href="<?php echo site_url('controller/c_forms_display');?>">C forms</a></li> </ul> </li> <li class="dropdown"> <a href="" class="dropdown-toggle" data-toggle="dropdown">Technical Support <span class="glyphicon glyphicon-chevron-down"></span> </a> <ul class="dropdown-menu multi-column-dropdown"> <li><a href="<?php echo site_url('controller/drive_catalogues');?>">Drive Catalogues</a></li> <li><a href="<?php echo site_url('controller/case_stories');?>">Case Stories</a></li> </ul> </li> <!--<li><a href="<?php echo site_url('controller/news');?>" >News</a></li>                       --> <?php }?> <ul class="navbar-right"> <li><a href="<?php echo site_url('controller/profile');?>">Profile</a></li> <li><a href="<?php echo site_url('controller/logout');?>">Logout</a></li> </ul> </ul> </nav> </div> </div> </header> <!---- Nav END -----------------------------------------------------------------------------> <div class="stock_update-banner"> </div> <!---- Banner END -----------------------------------------------------------------------------> <div class="middle_work_hedding"> <div class="container"> <h3><em>Inventory Import/Stock Updates</em></h3> </div> </div> <!---- middle_work_hedding END -----------------------------------------------------------------------------> <div class="mid-inventory-improt"> <div class="container"> <form action="<?php echo site_url('controller/import'); ?>" method="post" class="file-uploader"name="upload_excel" enctype="multipart/form-data"> <a href="<?php echo site_url("controller/download1"); ?>" style="padding-left:20px" >Download .XLSX file format</a> <div class="file-uploader__message-area"> <p>Import CSV/Excel File</p> </div> <div class="file-chooser"> <input type="file" name="file" id="file" class="file"> </div> <button type="submit" id="submit" name="import" class="btn btn-primary button-loading file-uploader__submit-button button-loading">Upload</button> </form> </div> </div> <!---- mid-inventory-improt END -----------------------------------------------------------------------------> <div class="middle_work_table"> <div class="container"> <div class="col-lg-12 table-responsive"> <div id = "jaytab" style="width: 1100px; margin-top:3%;"> <p>Last Updated Date and Time is : <?php if(empty($time)) { echo "Data not found"; }else{ echo $time->createdate; } ?></p> <p><b>Please Note: Standard Lead time is valid for Forecasted Quantities based on 6 months rolling forecast.</b></p> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> <div class="row" style="padding-bottom:20px;"></div> <!-- <table class="table table-striped " style="border-radius: 10px !important;" > <thead> <tr> <th style="border-top-left-radius: 10px !important;">Id</th> <th>Material</th> <th>Material Description</th> <th>Quanity In Stock</th> <th>Open PO</th> <th>Standard LT in Days</th> <th>Stock/Make to Order</th> <th style="border-top-right-radius: 10px !important;">Remarks</th> </tr> </thead> <tbody> <?php if($view_data != "") { foreach ($view_data as $data) { ?> <tr> <td><?php echo $data-> stock_id;?></td> <td><?php echo $data->material;?> </td> <td><?php echo $data->material_description;?> </td> <td><?php echo $data->quantity_in_stock;?></td> <td><?php echo $data->open_po; ?></td> <td><?php echo $data->in_transit_stock; ?></td> <td><?php echo $data->month_planned_qty; ?></td> <td><?php echo $data->remarks; ?></td> </tr> <?php } }?> </tbody> </table> ------> </div> </div> </div> <!---- middle_work_table END -----------------------------------------------------------------------------> <div class="height-50"></div> <footer class=" navbar-fixed-bottom"> <div class="top-bg"> <div class="container"> <ul class="top_marqu"> <li><a href="tel:+91-9731676611"><i class="fa fa-mobile" aria-hidden="true"></i> : +91 9731676611</a></li> <li><a href="mailto:services@powerpik.in"><i class="fa fa-envelope-o" aria-hidden="true"></i> : services@powerpik.in</a></li> <li><a href=""> | </a></li> <li><a href="tel:+91-9711351351">North <i class="fa fa-mobile" aria-hidden="true"></i> : +91 9711351351</a></li> <li><a href="tel:+91-9620512399">South <i class="fa fa-mobile" aria-hidden="true"></i> : +91 9620512399</a></li> </ul> </div> </div> </footer> </body> </html> <script> $(document).ready(function (){ //var l=$("#loc").val(); //alert(l); jQuery("#list2").jqGrid({ url:"<?php echo site_url('controller/stock_updates_view_insert');?>", mtype : "post", datatype: "json", colNames:['Stock Id','Material','Material Description','Quantity In Stock','Open PO','Standard LT in Days','Stock/Make to Order','Remarks'], colModel:[ {name:'stock_id',index:'stock_id', width:100, align:'center',key:true,editable:true,hidden:true}, {name:'material', index:'material', width:100, align:'center', sortable:false,editable:true,edittype:'text'}, {name:'material_description', index:'material_description', width:250, align:'center',editable:true,edittype:'text'}, {name:'quantity_in_stock', index:'quantity_in_stock', width:100, align:'center', sortable:false,editable:true,edittype:'text'}, {name:'open_po', index:'open_po', width:100, align:'center', sortable:false,editable:true,edittype:'text'}, {name:'in_transit_stock', index:'in_transit_stock', width:100, align:'center', sortable:false,editable:true,edittype:'text'}, {name:'month_planned_qty', index:'month_planned_qty', width:100, align:'center', sortable:false,editable:true,edittype:'text'}, {name:'remarks', index:'remarks', width:100, align:'center', sortable:false,editable:true,edittype:'text'} ], rowNum:50, rowTotal: 2000, rowList : [50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager2", sortname:'stock_id', viewrecords: true, loadonce:true, gridview: true, autowidth: true, sortorder:"desc", caption:"Stack Updates" }); $("#list2").jqGrid('filterToolbar',{searchOperators : false});//for multisearch code,remove if not required $("#list2").jqGrid('navGrid','#pager2', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, multipleGroup:true, caption:"search" } ); $('#pager2').css("height", "auto"); // $("#list2").navButtonAdd('#pager2', // { caption:"Add", // buttonicon:"ui-icon-plus", // onClickButton: addRow, // position: "last", // title:"", // cursor:"pointer", // id:"client_add" // } // ); // $("#list2").navButtonAdd('#pager2', // { caption:"Edit", // buttonicon:"ui-icon-pencil", // onClickButton: editRow, // position: "last", // title:"", // cursor: "pointer", // id:"client_edit" // } // ); // $("#list2").navButtonAdd('#pager2', // { caption:"delete", // buttonicon:"ui-icon-pencil", // onClickButton: deleteRow, // position: "last", // title:"", // cursor: "pointer", // id:"client_delete" // } // ); }); function addRow() { // Get the currently selected row $("#list2").jqGrid('editGridRow','new', { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ var stock_id = $("#stock_id").val(); //var partner_code = $("#partner_code").val(); var material = $("#material").val(); var material_description = $("#material_description").val(); var quantity_in_stock = $("#quantity_in_stock").val(); var open_po = $("#open_po").val(); var in_transit_stock = $("#in_transit_stock").val(); var month_planned_qty = $("#month_planned_qty").val(); var remarks = $("#remarks").val(); $.ajax({ url:"<?php echo site_url('controller/stock_info_insert_add');?>", type:"POST", data:{'stock_id':stock_id,'material':material,'material_description':material_description,'quantity_in_stock':quantity_in_stock,'open_po':open_po,'in_transit_stock':in_transit_stock,'month_planned_qty':month_planned_qty,'remarks':remarks}, async:false, success:function(data){ alert('Successfully Added.'); $("#editmodlist2").remove(); window.location.reload(); $("#list2").trigger("reloadGrid"); } }); }, closeAfterAdd: true, reloadAfterSubmit:false, closeOnEscape:true, clearAfterAdd: true, afterSubmit :false }); } function deleteRow() { // Get the currently selected row var row = $("#list2").jqGrid('getGridParam','selrow'); $("#stock_id").val(row); if( row != null ) $("#list2").jqGrid('delGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ $.ajax({ url:"<?php echo site_url('controller/stock_info_insert_delete');?>", type:"POST", data:{'stock_id':row,}, async:false, success:function(data){ if(data==""){ alert('Successfully Deleted.'); } else{ alert('Successfully Deleted.'); $("#delmodlist2").remove(); window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } function editRow() { // Get the currently selected row var row = $("#list2").jqGrid('getGridParam','selrow'); if( row != null ) $("#list2").jqGrid('editGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ var stock_id = $("#stock_id").val(); //var partner_code = $("#partner_code").val(); var material = $("#material").val(); var material_description = $("#material_description").val(); var quantity_in_stock = $("#quantity_in_stock").val(); var open_po = $("#open_po").val(); var in_transit_stock = $("#in_transit_stock").val(); var month_planned_qty = $("#month_planned_qty").val(); var remarks = $("#remarks").val(); $.ajax({ url:"<?php echo site_url('controller/stock_info_insert_edit');?>", type:"POST", data:{'stock_id':stock_id,'material':material,'material_description':material_description,'quantity_in_stock':quantity_in_stock,'open_po':open_po,'in_transit_stock':in_transit_stock,'month_planned_qty':month_planned_qty,'remarks':remarks}, async:false, success:function(data){ if(data==""){ alert('Successfully Updated.'); //$("#editmodlist2").remove(); $("#list2").trigger("reloadGrid"); jQuery('#list2').jqGrid('editRow',stock_id,true,reload()); // $("#clientcode").attr("aria-expanded","false"); // $("#cname").attr("aria-expanded","false"); } else{ alert('Successfully Updated.'); $("#editmodlist2").remove(); window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } </script> <!---------- Navigation -----------------------> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/simpleMobileMenu.css');?>" /> <script src="<?php echo base_url('assets/js/simpleMobileMenu.js');?>"></script> <script type="text/javascript"> jQuery(document).ready(function($) { $('.smobitrigger').smplmnu(); }); </script> <!---------------- Menu Drodown ---------------------> <script type="text/javascript"> jQuery(document).ready(function($) { $('.mobimenu li.dropdown').hover(function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500); }, function() { $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500); }); }); </script> <!------------------file-upload----------------------------> <script> (function( $ ) { $.fn.uploader = function( options ) { var settings = $.extend({ MessageAreaText: "No files selected.", MessageAreaTextWithFiles: "File List:", DefaultErrorMessage: "Unable to open this file.", BadTypeErrorMessage: "We cannot accept this file type at this time.", acceptedFileTypes: ['csv', 'rtf', 'xls', 'xlsx'] }, options ); var uploadId = 1; //update the messaging $('.file-uploader__message-area p').text(options.MessageAreaText || settings.MessageAreaText); //create and add the file list and the hidden input list var fileList = $('<ul class="file-list"></ul>'); var hiddenInputs = $('<div class="hidden-inputs hidden"></div>'); $('.file-uploader__message-area').after(fileList); $('.file-list').after(hiddenInputs); //when choosing a file, add the name to the list and copy the file input into the hidden inputs $('.file-chooser__input').on('change', function(){ var file = $('.file-chooser__input').val(); var fileName = (file.match(/([^\\\/]+)$/)[0]); //clear any error condition $('.file-chooser').removeClass('error'); $('.error-message').remove(); //validate the file var check = checkFile(fileName); if(check === "valid") { // move the 'real' one to hidden list $('.hidden-inputs').append($('.file-chooser__input')); //insert a clone after the hiddens (copy the event handlers too) $('.file-chooser').append($('.file-chooser__input').clone({ withDataAndEvents: true})); //add the name and a remove button to the file-list $('.file-list').append('<li style="display: none;"><span class="file-list__name">' + fileName + '</span><button class="removal-button" data-uploadid="'+ uploadId +'"></button></li>'); $('.file-list').find("li:last").show(800); //removal button handler $('.removal-button').on('click', function(e){ e.preventDefault(); //remove the corresponding hidden input $('.hidden-inputs input[data-uploadid="'+ $(this).data('uploadid') +'"]').remove(); //remove the name from file-list that corresponds to the button clicked $(this).parent().hide("puff").delay(10).queue(function(){$(this).remove();}); //if the list is now empty, change the text back if($('.file-list li').length === 0) { $('.file-uploader__message-area').text(options.MessageAreaText || settings.MessageAreaText); } }); //so the event handler works on the new "real" one $('.hidden-inputs .file-chooser__input').removeClass('file-chooser__input').attr('data-uploadId', uploadId); //update the message area $('.file-uploader__message-area').text(options.MessageAreaTextWithFiles || settings.MessageAreaTextWithFiles); uploadId++; } else { //indicate that the file is not ok $('.file-chooser').addClass("error"); var errorText = options.DefaultErrorMessage || settings.DefaultErrorMessage; if(check === "badFileName") { errorText = options.BadTypeErrorMessage || settings.BadTypeErrorMessage; } $('.file-chooser__input').after('<p class="error-message">'+ errorText +'</p>'); } }); var checkFile = function(fileName) { var accepted = "invalid", acceptedFileTypes = this.acceptedFileTypes || settings.acceptedFileTypes, regex; for ( var i = 0; i < acceptedFileTypes.length; i++ ) { regex = new RegExp("\\." + acceptedFileTypes[i] + "$", "i"); if ( regex.test(fileName) ) { accepted = "valid"; break; } else { accepted = "badFileName"; } } return accepted; }; }; }( jQuery )); //init $(document).ready(function(){ $('.fileUploader').uploader({ MessageAreaText: "No files selected. Please select a file." }); }); </script>