EVOLUTION-NINJA
Edit File: po_list.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 PO Acknowledgemets 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-2.2.4.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap.min.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('assets/toastr/toastr.min.css');?>"> <script src="<?php echo base_url('assets/toastr/toastr.min.js');?>"></script> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/sweetalert.css');?>" /> <script type="text/javascript" src="<?php echo base_url('assets/js/sweetalert.min.js');?>"></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; } .my-nav{ width:100% !important; } .my-nav li{ width:100% !important; } .my-nav a:hover{ color:black !important; } .navbar-collapse{ padding-right:0px !important; padding-left:0px !important; } .menu-left{ padding-right:0px !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/create_po');?>">PO Generate</a></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" 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');?>" class="active">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> <script src="<?php echo base_url('assets/datatables/jquery.dataTables.min.js');?>"></script> <script src="<?php echo base_url('assets/datatables/dataTables.bootstrap.min.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('assets/datatables/dataTables.bootstrap.css');?>"> <!-- END CORE PLUGINS --> <script> $(document).ready(function() { $('#sample_1').DataTable(); var v=$('#approval_id').val(); if(v!=2) { $('#jaytab1').hide(); $('#jaytab5').show(); } } ); </script> <style> .checkbox-success input[type="checkbox"]:checked + label::before { background-color: #5cb85c!important; border-color: #5cb85c !important; } .checkbox-success input[type="checkbox"]:checked + label::after { color: #fff !important; } </style> <div class="row"> <div class="col-sm-2 menu-left" style="background-color:#2a4474;height:700px;"> <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens --> <div class="collapse navbar-collapse navbar-ex1-collapse text_color"> <ul class="nav navbar-nav side-nav my-nav" > <?php if ($details->role == 3) {?> <!--<li class="active" > <a href="<?php echo site_url('controller/add_new_po');?>"> Add New PO</a> </li>--> </br> <li> <a href="<?php echo site_url('controller/create_po');?>"> Create PO</a> </li> </br> <li> <a href="<?php echo site_url('controller/po_list');?>"> View All PO</a> </li> </br> <li> <a href="<?php echo site_url('controller/upload_signed_po');?>"> Upload Signed PO</a> </li> </br> <li> <a href="<?php echo site_url('controller/signed_po_list');?>"> Signed PO List</a> </li> <?php } else {?> <!--<li class="active" > <a href="<?php echo site_url('controller/add_new_po');?>"> Add New PO</a> </li>--> </br> <li> <a href="<?php echo site_url('controller/create_po');?>"> Create PO</a> </li> </br> <li> <a href="<?php echo site_url('controller/po_list');?>"> View All PO</a> </li> </br> <!--<li> <a href="<?php echo site_url('controller/add_product');?>"> Insert Product</a> </li> </br>--> <li> <a href="<?php echo site_url('controller/upload_signed_po');?>"> Upload Signed PO</a> </li> </br> <li> <a href="<?php echo site_url('controller/signed_po_list');?>"> Signed PO List</a> </li> </br> <!--<li> <a href="<?php echo site_url('controller/add_shipaddress');?>"> Add PO Address</a> </li>--> <?php }?> </ul> </div> <!-- /.navbar-collapse --> </div><!---left side---> <div class="col-sm-10"> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> Purchase Order List </h3> <button type="button" id="cancel" style="float: right;margin-top: -29px;margin-right: 35px;">Back</button> <br> <input type="hidden" id="approval_id" class="approval_id" value="<?php if(empty($details)){ } else { echo $details->role; } ?>" > <input type="hidden" id="user_id" class="user_id" value="<?php if(empty($details)){ } else { echo $details->id; } ?>" > <div class="row 10"> <?php if($details->role == 8 || $details->role == 2){ ?> <label class="col-sm-2"></label> <label class="radio-inline"> <input type="radio" value="po" checked="checked" onclick="approval_status('normal_unapproved/normal_disapproved');" name="availability" /> NORMAL PO </label> <label class="radio-inline"> <input type="radio" value="approved_po" onclick="approval_status('normal_approved');" name="availability" /> NORMAL APPROVED PO </label> <label class="radio-inline"> <input type="radio" value="po" onclick="approval_status('special_unapproved/special_disapproved');" name="availability" /> SPECIAL PO </label> <label class="radio-inline"> <input type="radio" value="approved_po" onclick="approval_status('special_approved');" name="availability" /> SPECIAL APPROVED PO </label> <?php } else { ?> <label class="col-sm-2"></label> <label class="radio-inline"> <input type="radio" value="po" onclick="approval_status('normal_unapproveds/normal_disapproveds');" name="availability" /> NORMAL PO </label> <label class="radio-inline"> <input type="radio" value="po" onclick="approval_status('special_unapproveds/special_disapproveds');" name="availability" /> SPECIAL PO </label> <label class="radio-inline"> <input type="radio" value="po" onclick="approval_status('pending_po');" name="availability" /> PENDING PO </label> <label class="radio-inline"> <input type="radio" value="po" onclick="approval_status('transferred_po');" name="availability" /> TRANSFERRED PO </label> <?php } ?> </div> <div id="menu1" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab1" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid1"> <div class="grid_div1"></div><table id="list1"></table> <div id="pager1"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu2" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab2" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid2"> <div class="grid_div2"></div><table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow4" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu3" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab3" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid3"> <div class="grid_div3"></div><table id="list3"></table> <div id="pager3"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu4" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab4" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid4"> <div class="grid_div4"></div><table id="list4"></table> <div id="pager4"></div> <div id="dialogSelectRow4" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu5" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab5" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid5"> <div class="grid_div5"></div><table id="list5"></table> <div id="pager5"></div> <div id="dialogSelectRow5" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu6" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab6" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid6"> <div class="grid_div6"></div><table id="list6"></table> <div id="pager6"></div> <div id="dialogSelectRow6" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu7" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab7" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid7"> <div class="grid_div7"></div><table id="list7"></table> <div id="pager7"></div> <div id="dialogSelectRow7" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="menu8" class="tab-pane col-sm-12 col-md-12 "> <div id="jaytab8" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid8"> <div class="grid_div8"></div><table id="list8"></table> <div id="pager8"></div> <div id="dialogSelectRow8" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <!-- 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> </div> </div> </div> </div> <div class="modal fade" id="newModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Upload File</h4> </div> <form id="upload" class="form-inline upload_pdf" enctype="multipart/form-data"> <div class="modal-body"> <input type="hidden" name="po_no" class="po_no"/> <div class="file-uploader"> <div class="file-uploader__message-area"> <p>Upload PDF file.</p> </div> <div class="file-chooser"> <input type="file" id="file" class="pdf_upload" name="pdf_file[]" multiple required> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit_pdf">Upload</button> </div> </form> </div> </div> </div> <!-- End BEGIN CONTAINER --> <footer> <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@yaskawa.in"><i class="fa fa-envelope-o" aria-hidden="true"></i> : services@yaskawa.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> <!-- BEGIN FOOTER --> <style> thead{ background-color:rgb(87,142,190) !important; color:white !important; } #search_list2 { display:none !important; } .ss{ padding-right: 0 !important; padding-left: 0 !important; } .form-control { width:65% !important; height:27px !important; padding: 3px 12px !important; border-radius: 0px !important; //margin-bottom:15px; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } #productgrid{ //height:380px; //overflow-y: scroll; } .text_color a{ color:white !important; } .agr_appr { font-weight:bold !important; color:#AF0100; cursor: pointer; text-transform: uppercase !important; } .po_type { font-weight:bold !important; color:BLUE; cursor: pointer; text-transform: uppercase !important; } </style> <script type="text/javascript"> $(document).ready(function (){ jQuery("#list1").jqGrid({ url:"<?php echo site_url('controller/normal_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','APPROVE','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:375, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:125, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'confirm',index:'confirm',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="confirm1($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='checkbox' id='check' class='check' value='SELECT' \>"; }}, // {name:'approve_status',index:'approve_status',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:250,cellattr: function (rowId, tv, rawObject, cm, rdata) // { // return ' onclick="confirm($(this))" '; // }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:220,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_po($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager1", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Normal Purchase Order Details", }); $("#list1").jqGrid("setLabel", "rn", "SL"); $("#list1").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list1").jqGrid('navGrid','#pager1', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); }); </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); }); }); $("#cancel").click(function(e) { e.preventDefault(); window.location.href = '<?php echo base_url('controller/create_po');?>'; }); /*function confirm(rowId) { var id = rowId.closest('tr').attr('id'); var po_no=id; $.ajax({ url:"<?php echo site_url('controller/approve_po')?>", type:"POST", data:{po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); } }); }*/ function confirm1(rowId) { //alert(); var v=$('#approval_id').val(); var u=$('#user_id').val(); if(u == 8){ if(v == 2){ var po_no = rowId.closest('tr').attr('id'); var app = $("#list1").jqGrid('getRowData',po_no); app=app.approve_status; if(app=="UNAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ //alert(po_no); if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_po")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else if(app=="DISAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_po")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { swal({ title: "Are you sure?", text: "Do you want to disapprove this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/disapprove_po")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("DISAPPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $( ".check" ).prop( "checked", false ); $("#list1").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } else{ swal("You Don't Have Access To Approve This PO."); } } function confirm2(rowId) { //alert(); var v=$('#approval_id').val(); var u=$('#user_id').val(); if(u == 8){ if(v == 2){ var po_no = rowId.closest('tr').attr('id'); var app = $("#list2").jqGrid('getRowData',po_no); app=app.approve_status; //alert(app); if(app=="UNAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_po")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else if(app=="DISAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_po")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { swal({ title: "Are you sure?", text: "Do you want to disapprove this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/disapprove_po")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("DISAPPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $( ".check" ).prop( "checked", false ); $("#list1").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } else{ swal("You Don't Have Access To Approve This PO."); } } function confirm3(rowId) { //alert(); var v=$('#approval_id').val(); var u=$('#user_id').val(); if(u == 8){ if(v == 2){ var po_no = rowId.closest('tr').attr('id'); var app = $("#list3").jqGrid('getRowData',po_no); app=app.approve_status; //alert(app); if(app=="UNAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ //alert(po_no); if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_specialpo")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else if(app=="DISAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_specialpo")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { swal({ title: "Are you sure?", text: "Do you want to disapprove this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/disapprove_specialpo")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("DISAPPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $( ".check" ).prop( "checked", false ); $("#list1").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } else{ swal("You Don't Have Access To Approve This PO."); } } function confirm4(rowId) { //alert(); var v=$('#approval_id').val(); var u=$('#user_id').val(); if(u == 8){ if(v == 2){ var po_no = rowId.closest('tr').attr('id'); var app = $("#list4").jqGrid('getRowData',po_no); app=app.approve_status; //alert(app); if(app=="UNAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_specialpo")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else if(app=="DISAPPROVED") { swal({ title: "Are you sure?", text: "Do you want to approve this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/approve_specialpo")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("APPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { swal({ title: "Are you sure?", text: "Do you want to disapprove this Purchase Order?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("controller/disapprove_specialpo")?>', data : {po_no:po_no}, success:function(response) { toastr["success"]("DISAPPROVED"); location.reload(); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $( ".check" ).prop( "checked", false ); $("#list1").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } else{ swal("You Don't Have Access To Approve This PO."); } } function view_po(rowId) { var id = rowId.closest('tr').attr('id'); var po_no=id; //alert(po_no); $.ajax({ url:"<?php echo site_url('controller/view_po')?>", type:"POST", data:{po_no:po_no}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $.each(response.res,function(key,va){ //window.location.href = "<?php echo base_url()?>/"+va.po_path; window.open("<?php echo base_url()?>/"+va.po_path , "_blank"); }); } else { } } }); } function view_specialpo(rowId) { var id = rowId.closest('tr').attr('id'); var po_no=id; //alert(po_no); $.ajax({ url:"<?php echo site_url('controller/view_specialpo')?>", type:"POST", data:{po_no:po_no}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $.each(response.res,function(key,va){ //window.location.href = "<?php echo base_url()?>/"+va.po_path; window.open("<?php echo base_url()?>/"+va.po_path , "_blank"); }); } else { } } }); } function approval_status(str) { if(str=="normal_unapproved/normal_disapproved") { $('#jaytab1').show(); $('#jaytab2').hide(); $('#jaytab3').hide(); $('#jaytab4').hide(); $('#jaytab5').hide(); $('#jaytab6').hide(); $('#jaytab7').hide(); $('#jaytab8').hide(); jQuery("#list1").jqGrid({ url:"<?php echo site_url('controller/normal_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','Approve','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:375, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:125, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'confirm',index:'confirm',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="confirm($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='checkbox' id='check' class='check' value='SELECT' \>"; }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:220,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_po($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager1", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Approved Normal Purchase Order Details", }); $("#list1").jqGrid("setLabel", "rn", "SL"); $("#list1").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list1").jqGrid('navGrid','#pager1', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="normal_approved") { $('#jaytab1').hide(); $('#jaytab2').show(); $('#jaytab3').hide(); $('#jaytab4').hide(); $('#jaytab5').hide(); $('#jaytab6').hide(); $('#jaytab7').hide(); $('#jaytab8').hide(); jQuery("#list2").jqGrid({ url:"<?php echo site_url('controller/get_normal_approved_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','APPROVE','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:375, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:125, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'approve_status',index:'approve_status',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:250,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="confirm2($(this))" '; }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:220,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_po($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager2", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Approved Normal Purchase Order Details", }); $("#list2").jqGrid("setLabel", "rn", "SL"); $("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list2").jqGrid('navGrid','#pager2', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="special_unapproved/special_disapproved") { $('#jaytab1').hide(); $('#jaytab2').hide(); $('#jaytab3').show(); $('#jaytab4').hide(); $('#jaytab5').hide(); $('#jaytab6').hide(); $('#jaytab7').hide(); $('#jaytab8').hide(); jQuery("#list3").jqGrid({ url:"<?php echo site_url('controller/special_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','Approve','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:375, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:125, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'confirm',index:'confirm',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="confirm3($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='checkbox' id='check' class='check' value='SELECT' \>"; }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:220,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_specialpo($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager3", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Special Purchase Order Details", }); $("#list3").jqGrid("setLabel", "rn", "SL"); $("#list3").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list3").jqGrid('navGrid','#pager3', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="special_approved") { $('#jaytab1').hide(); $('#jaytab2').hide(); $('#jaytab3').hide(); $('#jaytab4').show(); $('#jaytab5').hide(); $('#jaytab6').hide(); $('#jaytab7').hide(); $('#jaytab8').hide(); jQuery("#list4").jqGrid({ url:"<?php echo site_url('controller/get_special_approved_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','APPROVE','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:375, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:125, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'approve_status',index:'approve_status',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:250,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="confirm4($(this))" '; }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:220,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_specialpo($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager4", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Approved Special Purchase Order Details", }); $("#list4").jqGrid("setLabel", "rn", "SL"); $("#list4").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list4").jqGrid('navGrid','#pager4', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="normal_unapproveds/normal_disapproveds") { $('#jaytab1').hide(); $('#jaytab2').hide(); $('#jaytab3').hide(); $('#jaytab4').hide(); $('#jaytab5').show(); $('#jaytab6').hide(); $('#jaytab7').hide(); $('#jaytab8').hide(); jQuery("#list5").jqGrid({ url:"<?php echo site_url('controller/normal_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:450, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:150, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:300,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_po($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager5", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Approved Normal Purchase Order Details", }); $("#list5").jqGrid("setLabel", "rn", "SL"); $("#list5").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list5").jqGrid('navGrid','#pager5', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="special_unapproveds/special_disapproveds") { $('#jaytab1').hide(); $('#jaytab2').hide(); $('#jaytab3').hide(); $('#jaytab4').hide(); $('#jaytab5').hide(); $('#jaytab6').show(); $('#jaytab7').hide(); $('#jaytab8').hide(); jQuery("#list6").jqGrid({ url:"<?php echo site_url('controller/special_po_details')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','VIEW PO'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:450, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:150, editable:false}, {name:'approve_status',index:'approve_status', hidden:true, width:375, editable:false}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:300,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_specialpo($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager6", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Special Purchase Order Details", }); $("#list6").jqGrid("setLabel", "rn", "SL"); $("#list6").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list6").jqGrid('navGrid','#pager6', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="pending_po") { $('#jaytab1').hide(); $('#jaytab2').hide(); $('#jaytab3').hide(); $('#jaytab4').hide(); $('#jaytab5').hide(); $('#jaytab6').hide(); $('#jaytab7').show(); $('#jaytab8').hide(); jQuery("#list7").jqGrid({ url:"<?php echo site_url('controller/get_pending_po')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS','VIEW PO','SEND'], colModel:[ {name:'po_no',index:'po_no', width:100, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:100, editable:false}, {name:'po_path',index:'po_path', width:250, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:150, editable:false}, {name:'transfer_status',index:'transfer_status', classes:'transfer_status',align: "center", width:150, editable:false}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_pendingpo($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="transfer($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='SEND'\>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager7", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Pending Purchase Order Details", }); $("#list7").jqGrid("setLabel", "rn", "SL"); $("#list7").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list7").jqGrid('navGrid','#pager7', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } else if(str=="transferred_po") { $('#jaytab1').hide(); $('#jaytab2').hide(); $('#jaytab3').hide(); $('#jaytab4').hide(); $('#jaytab5').hide(); $('#jaytab6').hide(); $('#jaytab7').hide(); $('#jaytab8').show(); jQuery("#list8").jqGrid({ url:"<?php echo site_url('controller/get_transferred_po')?>", mtype : "post", datatype: "json", colNames:['SI','PO NO','PO PATH','PO TYPE','STATUS'], colModel:[ {name:'id',index:'id', width:150, hidden:true,editable:false,key:true}, {name:'po_no',index:'po_no', width:150, editable:false}, {name:'po_path',index:'po_path', width:350, editable:false}, {name:'po_type',index:'po_type',classes:'po_type',align: "center",width:250, editable:false}, {name:'transfer_status',index:'transfer_status', classes:'transfer_status',align: "center", width:250, editable:false}, /* {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="view_pendingpo($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW PO' onclick='some_function' data-toggle='modal' data-target='#edit_modal' target='_blank'\>"; }}, {name:'po_path',index:'po_path', align: "center", editable:false,editrules:{}, width:150,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="transfer($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='SEND'\>"; }},*/ ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager8", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:"Transferred Purchase Order Details", }); $("#list8").jqGrid("setLabel", "rn", "SL"); $("#list8").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list8").jqGrid('navGrid','#pager8', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } } function view_pendingpo(rowId) { var id = rowId.closest('tr').attr('id'); var ids=id; //alert(po_no); $.ajax({ url:"<?php echo site_url('controller/view_pendingpo')?>", type:"POST", data:{ids:ids}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { window.open("<?php echo base_url()?>/"+response.res.po_path , "_blank"); } else { } } }); } function transfer(rowId) { var id = rowId.closest('tr').attr('id'); var po_no = $('.po_no').val(id); $('#newModal').modal('show'); $('.upload_pdf').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("controller/upload_pending_po_pdf")?>', data : formdata, contentType: false, processData: false, //async : false, success:function(data){ $('#newModal').modal('hide'); toastr["success"]("Succesfully Uploaded"); window.location.href = "<?php echo base_url('controller/po_list');?>" } }); }); } </script>