EVOLUTION-NINJA
Edit File: purchase_order_list.php
<script> function planningtypes(str) { if(str=="po_pending") { $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $('#table_approved_po').hide(); $('#table_pre_approved_po').hide(); $('#table_pending_po').show(); } else if(str=="approved_po") { $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $('#table_approved_po').show(); $('#table_pre_approved_po').hide(); $('#table_pending_po').hide(); } else if(str=="pre_approved_po") { $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $('#table_approved_po').hide(); $('#table_pre_approved_po').show(); $('#table_pending_po').hide(); } } </script> <style> .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; width:auto !important; overflow-x:scroll; } #gbox_list2_1202_t{ width:auto !important; overflow-x:scroll; } .ui-jqgrid tr.jqgrow td{ text-transform: uppercase !important; } @media only screen and (min-width:641px) and (max-width:991px) { #jaytab { overflow-x: scroll; } } @media only screen and (min-width:992px) and (max-width:1258px) { #jaytab { overflow-x: scroll; } } .badge { background: -webkit-radial-gradient( 1px -11px, circle, rgba(17, 208, 85, 0.98) 8%, rgb(7, 46, 80) 26px ); background-color: #ef0e0e; border: 1px solid white; border-radius: 12px; color: white; font: bold 12px/9px Helvetica, Verdana, Tahoma; height: 17px; padding: 3px 3px 0 3px; text-align: center; min-width: 19px; margin-bottom: 16px; } </style> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title">Purchase Order List</h3> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="<?php echo base_url(); ?>/dashboard/dashboard_fun">Home</a> <i class="fa fa-angle-right"></i> <a href="#" > PO List </a></li> </ul> </div> <input type="hidden" id="edit_id" class="edit_id" value="<?php if(empty($access_row)){ } else { echo $access_row->edit_id; } ?>" > <input type="hidden" id="preview_id" class="preview_id" value="<?php if(empty($access_row)){ } else { echo $access_row->preview_id; } ?>" > <input type="hidden" id="delete_id" class="delete_id" value="<?php if(empty($access_row)){ } else { echo $access_row->delete_id; } ?>" > <input type="hidden" id="approval_id" class="approval_id" value="<?php if(empty($access_row)){ } else { echo $access_row->approval_id; } ?>" > <div class="radio-list" style="margin-left: 2%;"> <input type="hidden" value="<?php echo $user_type_id; ?>" id="uid" > <input type="hidden" value="<?php echo $ref; ?>" id="ref_id" > <input type="hidden" value="<?php echo $url_val; ?>" id="url_ref" style="width: 230px;" > <?php if($ref == 'today_dashboard' || $ref == 'month_dashboard' || $ref == 'year_dashboard') { ?> <label class="radio-inline"> <input type="radio" checked="checked" name="planningorder" id="planningorder" onclick="planningtypes('po_pending')" /> Pending PO List</label> <span class="badge"><?php echo $pen_list; ?></span> <label class="radio-inline" style="margin-left: 12px;"> <input type="radio" name="planningorder" id="planningorder" onclick="planningtypes('approved_po')" /> Current Financial Approved PO List</label><span class="badge"><?php echo $app_list; ?></span> <label class="radio-inline" style="margin-left: 12px;"> <input type="radio" name="planningorder" id="planningorder" onclick="planningtypes('pre_approved_po')" /> Previous Approved PO List</label><span class="badge"><?php echo $pre_app_list; ?></span> <?php } else { ?> <label class="radio-inline"> <input type="radio" checked="checked" name="planningorder" id="planningorder" onclick="planningtypes('po_pending')" /> Pending PO List</label> <label class="radio-inline" style="margin-left: 12px;"> <input type="radio" name="planningorder" id="planningorder" onclick="planningtypes('approved_po')" /> Current Financial Approved PO List</label> <label class="radio-inline" style="margin-left: 12px;"> <input type="radio" name="planningorder" id="planningorder" onclick="planningtypes('pre_approved_po')" /> Previous Approved PO List</label> <?php } ?> </div><br> <div id="table_pending_po"> <div id="jaytab" class="jaytab"> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="table_approved_po"> <div id="jaytab" class="jaytab"> <table id="list3"></table> <div id="pager3"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="table_pre_approved_po"> <div id="jaytab" class="jaytab"> <table id="list4"></table> <div id="pager4"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div> </div> <!-- End BEGIN CONTAINER --> <!-- BEGIN FOOTER --> <!-- BEGIN FOOTER --> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <style> #refresh_list1 { display:none !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; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } </style> <script> function getDesignAndQuality(articleNo) { $.ajax({ type: "post", url: "<?php echo base_url(); ?>marketing/getDesignAndQuality", data: "articleNo=" + articleNo, success: function (data) { var objData = jQuery.parseJSON(data); document.getElementById("design").value = objData.design; document.getElementById("quality").value = objData.quality; } }); } </script> <!-----------------datepicker-------------> <link href="<?php echo base_url('assets/css/sweetalert2.min.css');?>" rel="stylesheet"/> <script src="<?php echo base_url('assets/js/sweetalert2.min.js');?>"></script> <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.min.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <!-- 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.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap-ui.min.css'); ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/bootstrap-datepicker.min.css"/> <script src="<?php echo base_url();?>assets/js/bootstrap-datepicker.min.js"></script> <script> $('.datepicker').datepicker({ format: 'yyyy/mm/dd', }); </script> <style type="text/css"> .ss{ padding-right: 0 !important; padding-left: 0 !important; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } #search_list3 { display:none; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } input[type=file] { display: none; } .ui-jqgrid .ui-jqgrid-caption { text-align: left; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar { padding: .1em .1em; min-height: 35px; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: -9px; } #sData { height: 27px; } #cData { height: 27px; } #dData { height: 27px; } #eData { height: 27px; } .coledit { cursor:pointer; text-align: right; padding-right: 24px !important; padding-left: 24px !important; } .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td { overflow: hidden; white-space: pre; } #table_approved_po { display:none; } #table_pre_approved_po { display:none; } .coledit{ cursor: pointer; padding-right: 45px !important; padding-left: 45px !important; } </style> <style> </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <script> $(document).ready(function (){ var l=$("#ref_id").val(); //alert(l); jQuery("#list2").jqGrid({ url:"<?php echo base_url('vendor/add_purchase_grid_details')?>/s"+l+"/", datatype: "json", colNames:['Id','PO No','Vendor Name','Date','Currency','Grand Total','Created By','Approve','Hide','Action','Product Type','Preview','Download'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'po_no',index:'po_no', width:142,editable:false}, {name:'vendor_name',index:'vendor_name', editable:true,editrules:{required: true},width:142}, {name:'g_date',index:'g_date', width:142,editable:true,editrules:{required: true}}, {name:'currency',index:'currency', editable:true,editrules:{required: true},width:142}, {name:'grand_total',index:'grand_total', editable:true,editrules:{required: true},width:100}, {name:'created_by',index:'created_by', editable:true,editrules:{required: true},width:142}, {name:'confirm',index:'confirm',align: "center",editable:false,editrules:{required: true}, width:200,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='checkbox' id='check' class='check' value='SELECT' \>"; }}, {name:'hide_status',index:'hide_status',align: "center",width:200, formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false}, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="had($(this))" '; } }, // { // name: 'confirm', index: 'confirm', width: 70, align: 'center', // formatter: 'checkbox', editoptions: { value: '1:0' }, // formatoptions: { disabled: false }, // cellattr: function (rowId, tv, rawObject, cm, rdata) // { // return ' onclick="fun($(this))" '; // } // }, {name:'edit',index:'edit',align: "center",editable:false,editrules:{required: true}, width:200,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' class='fa fa-eye' value='EDIT' \>"; }}, {name:'product_type',index:'product_type', editable:true,editrules:{required: true},width:142}, {name:'preview',index:'preview',align: "center",editable:false,editrules:{required: true}, width:145,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pending_preview($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' onclick='some_function' \>"; }}, {name:'',index:'',align: "center",editable:false,editrules:{required: true}, width:145,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pdf($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PDF' onclick='some_function' \>"; }}, // {name:'edit',index:'edit',align: "center",editable:true,style:'cursor:pointer',editrules:{required: true},width:102,classes:'fa fa-pencil-square-o coledit',formatter:'showlink',formatoptions:{baseLinkUrl:'<?php echo base_url('vendor/po_list_edit')?>'} // }, ], height: 'auto', rowNum:50, rowTotal: 200000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", loadonce:true, caption:"Pending Purchase Order Details", footerrow: true, loadComplete: function () { var sumOfGrand_total = jQuery("#list2").jqGrid('getCol','grand_total',false,'sum'); jQuery("#list2").jqGrid('footerData', 'set', { grand_total: sumOfGrand_total.toFixed(2)}); }, subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); swan_id=row_id; //alert(swan_id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"<?php echo base_url('vendor/purchase_order_list_grid');?>/s"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames:['Id','Indent No','Department','Product Name','Product Type','Indent Qty','PO Qty','unit','Unit Price','INR Value','CGST','SGST','IGST','Total Value','Purpose','Delete'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'indent_no',index:'indent_no', width:100,editable:true,editrules:{required: true}}, {name:'department',index:'department', editable:true,editrules:{required: true},width:105}, {name:'product_name',index:'product_name', width:155,editable:false}, {name:'product_type',index:'product_type', width:108,editable:false}, {name:'indent_qty',index:'indent_qty', width:67,editable:true,editrules:{required: true}}, {name:'quantity',index:'quantity', width:67,editable:true,editrules:{required: true}}, {name:'indent_unit',index:'indent_unit', width:70,editable:true,editrules:{required: true}}, {name:'unit',index:'unit', editable:true,editrules:{required: true},width:70}, {name:'inrvalue',index:'inrvalue', width:80,editable:true,editrules:{required: true}}, {name:'cgst',index:'cgst', editable:true,editrules:{required: true},width:48}, {name:'sgst',index:'sgst', editable:true,editrules:{required: true},width:48}, {name:'igst',index:'igst', editable:true,editrules:{required: true},width:48}, {name:'totalvalue',index:'totalvalue', width:86,editable:true,editrules:{required: true}}, {name:'purpose',index:'purpose', width:86,editable:true,editrules:{required: true}}, {name:'',index:'',align: "center",editable:false,editrules:{required: true}, width:200,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' class='fa fa-eye' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20000000, sortname: 'num', sortorder: "asc" }); } }); //$("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required jQuery("#list2").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#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" } ); // $("#list2").navButtonAdd('#pager2', // { caption:"Delete", // buttonicon:"ui-icon-trash", // onClickButton: deleteRow, // position: "last", // title:"", // cursor: "pointer", // id:"client_delete" // } // ); }); function show_pending(){ var colPos = 0; var navGrid = $('#list2'); navGrid.jqGrid('showCol', navGrid.getGridParam("colModel")[10].name); } function hide_pending(){ var colPos = 0; var navGrid = $('#list2'); navGrid.jqGrid('hideCol', navGrid.getGridParam("colModel")[10].name); } $(document).ready(function(){ var uid=$('#uid').val(); if(uid==1 || uid==2){ show_pending(); }else{ hide_pending(); } }); function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; //alert(as); var v=$('#delete_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("vendor/vendor_delete_po"); ?>', data:{'as':as}, async:false, success:function() { $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } }); } else { swal({ title: "You Don't Have Access For This Delete", text: "", }); } } function fun_edit(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#edit_id').val(); var url_r=$('#url_ref').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("vendor/po_list_edit"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { window.location.href = '<?php echo base_url('vendor/po_list_edit');?>/'+ '?id='+as; } else if(url_r == '2') { window.location.href = '<?php echo base_url('vendor/po_pending_edit');?>/'+ '?id='+as; } else if(url_r == '3') { window.location.href = '<?php echo base_url('vendor/purchase_order_pending_edit');?>/'+ '?id='+as; } else if(url_r == '4') { window.location.href = '<?php echo base_url('vendor/purchase_order_edit');?>/'+ '?id='+as; } } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun(rowId) { var v=$('#approval_id').val(); if(v == 1) { var id = rowId.closest('tr').attr('id'); //alert(id); var confirmMsg= confirm("Do You Want To Confirm!"); if (confirmMsg==true) { swal({ title: 'Remarks', input: 'text', showCancelButton: true, confirmButtonText: 'Submit', showLoaderOnConfirm: true, }).then(function (email) { $.ajax({ //alert(email); url:"<?php echo base_url('vendor/purchase_order_list_yes_confirmation')?>", type:"POST", data:{'id':id,'remarks':email}, success:function(data){ if(data==""){ $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else{ $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); swal({ type: 'success', // title: 'Approved By', // html: '' + email }) }) ///alert(email); } else if (confirmMsg==false) { $("#editmodlist2").remove(); $("#list2").trigger("reloadGrid"); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $( ".check" ).prop( "checked", false ); } } function fun_pending_preview(rowId) { var v=$('#preview_id').val(); if(v == 1) { var id = rowId.closest('tr').attr('id'); var as=id; var url_r=$('#url_ref').val(); //alert(url_r); $.ajax({ type:'post', url:'<?php echo base_url("vendor/purchase_pending_preview"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { // window.location.href = '<?php echo base_url('vendor/purchase_pending_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_pending_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '2') { //window.location.href = '<?php echo base_url('vendor/po_pending_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/po_pending_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '3') { //window.location.href = '<?php echo base_url('vendor/purchase_order_pending_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_order_pending_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '4') { //window.location.href = '<?php echo base_url('vendor/purchase_order_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_order_preview');?>/'+ '?id='+as,'_blank'); } } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_pdf(rowId) { var v=$('#preview_id').val(); if(v == 1) { var id = rowId.closest('tr').attr('id'); var as=id; var url_r=$('#url_ref').val(); //alert(url_r); $.ajax({ type:'post', url:'<?php echo base_url("vendor/purchase_pending_preview"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { // window.location.href = '<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as,'_blank'); } else if(url_r == '2') { // window.location.href = '<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as,'_blank'); } else if(url_r == '3') { // window.location.href = '<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as,'_blank'); } else if(url_r == '4') { // window.location.href = '<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/convertpdf');?>/'+ '?id='+as,'_blank'); } } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function deleteRow() { // Get the currently selected row var v=$('#delete_id').val(); if(v == 1) { var row = $("#list2").jqGrid('getGridParam','selrow'); $("#id").val(row); if( row != null ) $("#list2").jqGrid('delGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ $.ajax({ url:"<?php echo base_url('vendor/purchase_order_delete');?>", type:"POST", data:{'id':row}, async:false, success:function(data){ if(data==""){ alert('Successfully Deleted'); $("#delmodlist2").remove(); $("#list2").trigger("reloadGrid"); window.location.reload(); } else{ alert('Successfully Deleted'); $("#delmodlist2").remove(); $("#list2").trigger("reloadGrid"); window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } else { swal({ title: "You Don't Have Access For This Delete", text: "", }); } } //<!-----------------------------------------approved pending grid---------------------------------------> $(document).ready(function (){ var l=$('#ref_id').val(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); jQuery("#list3").jqGrid({ url:"<?php echo base_url('vendor/approved_purchase_grid_details')?>/s"+l+"/", datatype: "json", colNames:['Id','PO No','Vendor Name','Date','Currency','Grand Total','Created By','Approve','Hide','Approved By','Product Type','PO preview','PDF','GRN Preview'], colModel:[ {name:'id',index:'id',hidden:true, width:100,editable:true,width:100}, {name:'po_no',index:'po_no', width:100,editable:false}, {name:'vendor_name',index:'vendor_name', editable:true,editrules:{required: true},width:200}, {name:'g_date',index:'g_date', width:60,editable:true,editrules:{required: true}}, {name:'currency',index:'currency', editable:true,editrules:{required: true},width:40}, {name:'grand_total',index:'grand_total', editable:true,editrules:{required: true},width:80}, {name:'created_by',index:'created_by', editable:true,editrules:{required: true},width:120}, { name: 'confirm', index: 'confirm', width: 50, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: true } }, {name:'hide_status',index:'hide_status',align: "center",width:200, formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false}, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="had($(this))" '; } }, {name:'approved_by',index:'approved_by', editable:true,editrules:{required: true},width:100}, {name:'product_type',index:'product_type', editable:true,editrules:{required: true},width:142}, {name:'preview',index:'preview',align: "center",editable:false,editrules:{required: true}, width:70,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_preview($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' onclick='some_function' \>"; }}, {name:'',index:'',align: "center",editable:false,editrules:{required: true}, width:70,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pdfs($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DOWNLOAD' onclick='some_function' \>"; }}, {name:'',index:'',align: "center",editable:false,editrules:{required: true}, width:75,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_grn_preview($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' onclick='some_function' \>"; }} ], height: 'auto', rowNum:50, rowTotal: 200000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager3", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", loadonce:true, caption:"Approved Purchase Order Details", footerrow: true, loadComplete: function () { var sumOfGrand_total = jQuery("#list3").jqGrid('getCol','grand_total',false,'sum'); jQuery("#list3").jqGrid('footerData', 'set', { grand_total: sumOfGrand_total.toFixed(2)}); }, subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); swan_id=row_id; //alert(swan_id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"<?php echo base_url('vendor/purchase_order_approved_list_grid');?>/s"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames:['Id','Indent No','Department','Product Name','Product Type','Indent Qty','PO Qty','Unit','Unit Price','INR Value','CGST','SGST','IGST','Total Value','Purpose','Created By','Approved By'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'indent_no',index:'indent_no', width:120,editable:true,editrules:{required: true}}, {name:'department',index:'department', editable:true,editrules:{required: true},width:80}, {name:'product_name',index:'product_name', width:150,editable:false}, {name:'product_type',index:'product_type', width:102,editable:false}, {name:'quantity',index:'quantity', width:71,editable:true,editrules:{required: true}}, {name:'quantity',index:'quantity', width:71,editable:true,editrules:{required: true}}, {name:'indent_unit',index:'indent_unit', width:60,editable:true,editrules:{required: true}}, {name:'unit',index:'unit', editable:true,editrules:{required: true},width:70}, {name:'inrvalue',index:'inrvalue', width:80,editable:true,editrules:{required: true}}, {name:'cgst',index:'cgst', editable:true,editrules:{required: true},width:47}, {name:'sgst',index:'sgst', editable:true,editrules:{required: true},width:47}, {name:'igst',index:'igst', editable:true,editrules:{required: true},width:47}, {name:'totalvalue',index:'totalvalue', width:117,editable:true,editrules:{required: true}}, {name:'purpose',index:'purpose', width:117,editable:true,editrules:{required: true}}, {name:'created_by',index:'created_by', width:117,editable:true,editrules:{required: true}}, {name:'approved_by',index:'approved_by', width:117,editable:true,editrules:{required: true}}, ], height: 'auto', rowNum:20000000, sortname: 'num', sortorder: "asc" }); } }); //$("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required jQuery("#list3").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#list3").jqGrid('navGrid','#pager3', {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" } ); }); function show_current_approved(){ var colPos = 0; var navGrid = $('#list3'); navGrid.jqGrid('showCol', navGrid.getGridParam("colModel")[10].name); } function hide_current_approved(){ var colPos = 0; var navGrid = $('#list3'); navGrid.jqGrid('hideCol', navGrid.getGridParam("colModel")[10].name); } $(document).ready(function(){ var uid=$('#uid').val(); if(uid==1 || uid==2){ show_current_approved(); }else{ hide_current_approved(); } }); // <!-----------------------------------------prevoius approved pending grid---------------------------------------> $(document).ready(function (){ var l=$('#ref_id').val(); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); jQuery("#list4").jqGrid({ url:"<?php echo base_url('vendor/pre_approved_purchase_grid_details')?>/s"+l+"/", datatype: "json", colNames:['Id','PO No','Vendor Name','Date','Currency','Grand Total','Created By','Approve','Hide','Approved By','Product Type','PO preview','GRN Preview'], colModel:[ {name:'id',index:'id',hidden:true, width:100,editable:true,width:100}, {name:'po_no',index:'po_no', width:100,editable:false}, {name:'vendor_name',index:'vendor_name', editable:true,editrules:{required: true},width:200}, {name:'g_date',index:'g_date', width:60,editable:true,editrules:{required: true}}, {name:'currency',index:'currency', editable:true,editrules:{required: true},width:40}, {name:'grand_total',index:'grand_total', editable:true,editrules:{required: true},width:80}, {name:'created_by',index:'created_by', editable:true,editrules:{required: true},width:120}, { name: 'confirm', index: 'confirm', width: 50, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: true } }, {name:'hide_status',index:'hide_status',align: "center",width:200, formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false}, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="had($(this))" '; } }, {name:'approved_by',index:'approved_by', editable:true,editrules:{required: true},width:100}, {name:'product_type',index:'product_type', editable:true,editrules:{required: true},width:142}, {name:'preview',index:'preview',align: "center",editable:false,editrules:{required: true}, width:70,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_preview($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' onclick='some_function' \>"; }}, {name:'id',index:'id',align: "center",editable:false,editrules:{required: true}, width:75,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_grn_preview($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' onclick='some_function' \>"; }} ], height: 'auto', rowNum:50, rowTotal: 200000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager4", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", loadonce:true, caption:"Approved Purchase Order Details", footerrow: true, loadComplete: function () { var sumOfGrand_total = jQuery("#list4").jqGrid('getCol','grand_total',false,'sum'); jQuery("#list4").jqGrid('footerData', 'set', { grand_total: sumOfGrand_total.toFixed(2)}); }, subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); swan_id=row_id; //alert(swan_id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"<?php echo base_url('vendor/purchase_order_approved_list_grid');?>/s"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames:['Id','Indent No','Department','Product Name','Product Type','Indent Qty','PO Qty','Unit','Unit Price','INR Value','CGST','SGST','IGST','Total Value','Purpose','Created By','Approved By'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'indent_no',index:'indent_no', width:120,editable:true,editrules:{required: true}}, {name:'department',index:'department', editable:true,editrules:{required: true},width:80}, {name:'product_name',index:'product_name', width:150,editable:false}, {name:'product_type',index:'product_type', width:102,editable:false}, {name:'quantity',index:'quantity', width:71,editable:true,editrules:{required: true}}, {name:'quantity',index:'quantity', width:71,editable:true,editrules:{required: true}}, {name:'indent_unit',index:'indent_unit', width:60,editable:true,editrules:{required: true}}, {name:'unit',index:'unit', editable:true,editrules:{required: true},width:70}, {name:'inrvalue',index:'inrvalue', width:80,editable:true,editrules:{required: true}}, {name:'cgst',index:'cgst', editable:true,editrules:{required: true},width:47}, {name:'sgst',index:'sgst', editable:true,editrules:{required: true},width:47}, {name:'igst',index:'igst', editable:true,editrules:{required: true},width:47}, {name:'totalvalue',index:'totalvalue', width:117,editable:true,editrules:{required: true}}, {name:'purpose',index:'purpose', width:117,editable:true,editrules:{required: true}}, {name:'created_by',index:'created_by', width:117,editable:true,editrules:{required: true}}, {name:'approved_by',index:'approved_by', width:117,editable:true,editrules:{required: true}}, ], height: 'auto', rowNum:20000000, sortname: 'num', sortorder: "asc" }); } }); //$("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required jQuery("#list4").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#list4").jqGrid('navGrid','#pager4', {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" } ); }); function show_previous_approved(){ var colPos = 0; var navGrid = $('#list4'); navGrid.jqGrid('showCol', navGrid.getGridParam("colModel")[10].name); } function hide_previous_approved(){ var colPos = 0; var navGrid = $('#list4'); navGrid.jqGrid('hideCol', navGrid.getGridParam("colModel")[10].name); } $(document).ready(function(){ var uid=$('#uid').val(); if(uid==1 || uid==2){ show_previous_approved(); }else{ hide_previous_approved(); } }); function fun_preview(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("vendor/purchase_preview"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { //window.location.href = '<?php echo base_url('vendor/purchase_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '2') { // window.location.href = '<?php echo base_url('vendor/po_purchase_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/po_purchase_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '3') { // window.location.href = '<?php echo base_url('vendor/purchase_order_approved_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_order_approved_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '4') { // window.location.href = '<?php echo base_url('vendor/po_approved_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/po_approved_preview');?>/'+ '?id='+as,'_blank'); } //window.location.href = '<?php echo base_url('vendor/purchase_preview');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_pdfs(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("vendor/purchase_preview"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { // window.location.href = '<?php echo base_url('vendor/purchase_preview_pdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_preview_pdf');?>/'+ '?id='+as,'_blank'); } else if(url_r == '2') { // window.location.href = '<?php echo base_url('vendor/po_purchase_preview_pdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/po_purchase_preview_pdf');?>/'+ '?id='+as,'_blank'); } else if(url_r == '3') { // window.location.href = '<?php echo base_url('vendor/purchase_order_approved_preview_pdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_order_approved_preview_pdf');?>/'+ '?id='+as,'_blank'); } else if(url_r == '4') { // window.location.href = '<?php echo base_url('vendor/po_approved_preview_pdf');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/po_approved_preview_pdf');?>/'+ '?id='+as,'_blank'); } //window.location.href = '<?php echo base_url('vendor/purchase_preview');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_grn_preview(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("vendor/purchase_grn_preview"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { // window.location.href = '<?php echo base_url('vendor/purchase_grn_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/purchase_grn_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '2') { // window.location.href = '<?php echo base_url('vendor/po_purchase_grn_details');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/po_purchase_grn_details');?>/'+ '?id='+as,'_blank'); } else if(url_r == '3') { // window.location.href = '<?php echo base_url('vendor/grn_po_purchase_order_approved_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/grn_po_purchase_order_approved_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '4') { // window.location.href = '<?php echo base_url('vendor/grn_po_approved_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('vendor/grn_po_approved_preview');?>/'+ '?id='+as,'_blank'); } // window.location.href = '<?php //echo base_url('vendor/purchase_grn_preview');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function had(rowId){ // alert('hii'); var id = rowId.closest('tr').attr('id'); var as=id; $.ajax({ type:'post', url:'<?php echo base_url("vendor/get_hide_status"); ?>', data:{'as':as}, async:false, success:function(data) { console.log(data); var objdata = jQuery.parseJSON(data); var fetch_res= objdata.hide_status; var po_num=objdata.po_no; if(fetch_res==1){ var id = rowId.closest('tr').attr('id'); //alert(id); var confirmMsg= confirm("This Order Is Already Hidden. Do You Want To Undo This!"); if (confirmMsg==true) { $.ajax({ url:"<?php echo base_url('vendor/no_hide_status')?>", type:"POST", data:{'po_num':po_num}, success:function(data){ $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else if (confirmMsg==false) { $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } else{ var id = rowId.closest('tr').attr('id'); //alert(id); var confirmMsg= confirm("Do You Want To Hide This!"); if (confirmMsg==true) { $.ajax({ url:"<?php echo base_url('vendor/insert_hide')?>", type:"POST", data:{'po_num':po_num}, success:function(data){ $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } }); } else if (confirmMsg==false) { $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } } }); } </script> <style> #jaytab { width: 100% !important; } #list2_122_t { height:0px !important; } #list4 { width: 1299px !important; } #pager4 { width: 1300px !important; } #list2_136_t { height:12px !important; } .scroll { height:12px !important; } .ui-jqgrid-btable { } .ui-common-table { height:12px !important; } #refresh_list2 { display:none !important; } #refresh_list3 { display:none !important; } #client_edit { padding-right:12px !important; } #list2 { width: 1050px !important; //height: 0px !important; } #gbox_list2 { //width:100% !important; height: auto !important; } #gview_list2 { height: auto !important; } @media only screen and (min-width:320px) and (max-width:641px){ .ui-jqgrid { margin-left: 1px !important; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 100% !important; padding-left: 0 !important; } #editmodlist2 { width:90% !important; } #sData span, #cData span { margin-left: 0 !important; } .radio-list { margin-left:7% !important; } } @media only screen and (min-width:641px) and (max-width:991px){ .ui-jqgrid { margin-left: 1px !important; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } } #sData span, #cData span { margin-left: 3px; } #sData { height: 29px; } #cData { height: 29px; } .jqgfirstrow { height: 0px !important; } .tablediv { width:auto !important; overflow-x:scroll; } .ui-jqgrid .ui-jqgrid-bdiv { overflow: inherit !important; } </style> <style> @media only screen and (min-width:320px) and (min-height:640px){ #gbox_list2{ //width:1052px !important; } #gview_list2{ // width:100% !important; } .ui-jqgrid-hdiv{ //width:100% !important; } .ui-jqgrid-htable{ // width:100% !important; } #list2{ // width:100% !important; } } .ui-jqgrid-view { width: 1300px !important; } .ui-jqgrid-hdiv { width: 1300px !important; } .ui-jqgrid-htable { width: 1300px !important; } .ui-jqgrid-bdiv { width: 1300px !important; } #list1 { width: 1300px !important; } #pager1 { width: 1300px !important; } #list3 { width: 1300px !important; } #pager3 { width: 1300px !important; } #list2 { width: 1300px !important; } #pager2 { width: 1300px !important; } #gbox_list2 { width: 1300px !important; } #gview_list2 { width: 1300px !important; } .ui-jqgrid-hdiv { // width: 1300px !important; } .ui-jqgrid-htable { width: 1300px !important; } .ui-jqgrid-bdiv { //width: 1300px !important; } </style>