EVOLUTION-NINJA
Edit File: quality_check_grid.php
<?php $id=$this->session->userdata('logged_in');?> <script src="<?php echo base_url('assets/js/jquery.table2excel.js');?>"></script> <script src="<?php echo base_url('assets/js/jspdf.debug.js');?>"></script> <script src="<?php echo base_url('assets/js/jspdf.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/shim.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/xlsx.full.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/Blob.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/FileSaver.js');?>"></script> <script type="text/ecmascript" src="<?php echo base_url('assets/js/jquery.min.js');?>"></script> <script src="<?php echo base_url('assets/js/bootstrap.min.js');?>"></script> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('assets/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('assets/js/grid.locale-en.js');?>"></script> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css" rel="stylesheet"/> <style> .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } .ui-jqgrid tr.jqgrow td{ text-transform: uppercase !important; } </style> <script> function back_func() { window.location.href = "<?php echo base_url('reports/inspected_fabric'); ?>" } </script> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> Color/Quality Approval </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="<?php echo base_url(); ?>dashboard/dashboard_fun" > Dashboard </a></li> </ul> </div> <!-- <input type="hidden" value="<?php echo date('m'); ?>" id="get_months" > <input type="button" name="Insert" data-toggle="modal" data-target="#delivery_date_Modal" value="Select" /> <input type="text" class="openDatePicker" name="" id="datepicker" placeholder="Select Year" value="<?php echo date('Y'); ?>"> <select style="margin-left: 9px;padding-top: 2px;padding-bottom: 3px;cursor:pointer;" onchange="select_month();" id="select_month_id"> <option value="<?php echo '1'; ?>" <?php if('1' == date('m')) {echo "selected";}?>>January</option> <option value="<?php echo '2'; ?>" <?php if('2' == date('m')) {echo "selected";}?>> February</option> <option value="<?php echo '3'; ?>" <?php if('3' == date('m')) {echo "selected";}?>>March</option> <option value="<?php echo '4'; ?>" <?php if('4' == date('m')) {echo "selected";}?>>April</option> <option value="<?php echo '5'; ?>" <?php if('5' == date('m')) {echo "selected";}?>>May</option> <option value="<?php echo '6'; ?>" <?php if('6' == date('m')) {echo "selected";}?>>June</option> <option value="<?php echo '7'; ?>" <?php if('7' == date('m')) {echo "selected";}?>>July</option> <option value="<?php echo '8'; ?>" <?php if('8' == date('m')) {echo "selected";}?>>August</option> <option value="<?php echo '9'; ?>" <?php if('9' == date('m')) {echo "selected";}?>>September</option> <option value="<?php echo '10'; ?>" <?php if('10' == date('m')) {echo "selected";}?>>October</option> <option value="<?php echo '11'; ?>" <?php if('11' == date('m')) {echo "selected";}?>>November</option> <option value="<?php echo '12'; ?>" <?php if('12' == date('m')) {echo "selected";}?>>December</option> </select> --> <form action="<?php echo base_url(); ?>quality_check/insert" method="post" class="form-horizontal" target ="_blank"> <input type="hidden" value="<?php echo $ref; ?>" id="" name="reference_value"> <b>To insert data click here:</b> <input type="submit" name="Insert" value="Insert" /> </form> <input type="hidden" id="usertype" class="usertype" value="<?php echo $usertype; ?>" > <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="insert_id" class="insert_id" value="<?php if(empty($access_row)){ } else { echo $access_row->insert_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="edit_id" class="edit_id" value="<?php if(empty($access_row)){ } else { echo $access_row->edit_id; } ?>" > <input type="hidden" id="approval_id" class="approval_id" value="<?php if(empty($access_row)){ } else { echo $access_row->approval_id; } ?>" > <input type="hidden" value="<?php echo $ref; ?>" id="ref_id" > <input type="hidden" value="<?php echo $url_val; ?>" id="url_ref" style="width: 230px;" > <input type="hidden" id="asmu" class="asmu" value="<?php echo $id['userid']; ?>" > <!-- END PAGE HEADER--> <!-- BEGIN DASHBOARD STATS --> <!-- Modal --> <!--<div class="caption"> <i class="fa fa-globe" style="border:1px solid"></i>Transaction Input details </div>--> <div class="radio-list" style="margin-left: 2%;"> <lable class="radio-inline" > <input type="radio" name="shipping" onclick="pending()" checked /> Pending Col/Quality </lable> <input type="radio" name="shipping" class="full" onclick="full()" /><lable>Approved Col/Quality</lable> <input type="radio" name="shipping" class="full" onclick="reject()" /><lable>Rejectd Col/Quality</lable> <input type="hidden" name="to_val" class="to_val" id="to_val" /> </div> <div id = "jaytab3" style="margin-top:0%;margin-left: -28px;" class="col-sm-12 grid"><br/> <div class="grid_div"></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 id = "jaytab4" style="margin-top:0%;margin-left: -28px;" class="col-sm-12 grid"><br/> <div class="grid_div"></div><table id="list4"></table> <div id="pager4"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> <div id = "jaytab5" style="margin-top:0%;margin-left: -28px;" class="col-sm-12 grid"><br/> <div class="grid_div"></div><table id="list5"></table> <div id="pager5"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div> </div> <div style="display:none;"><table border="1" style="border-spacing: 0px !important;" id="export_table" class="export_table"></table></div> <div style="display:none;"> <table border="1" style="border-spacing: 0px !important;" id="print_table" class="print_table"></table> </div> <script> // $("#datepicker").datepicker({ // format: "yyyy", // viewMode: "years", // minViewMode: "years" // }); function print_page1() { var divToPrint=document.getElementById('print_table'); newWin= window.open(""); newWin.document.write('<html><head><title></title>'); newWin.document.write('</head>'); newWin.document.write(divToPrint.outerHTML); newWin.document.write('</html>'); newWin.print(); document.getElementById('print_table').style.display=''; newWin.close(); location.reload(); } </script> <style type="text/css"> a{ color: inherit; } #print_broker_report { display:none; } </style> <!-- 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.min.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.min.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.min.css'); ?>" /> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <script type="text/javascript"> Pending(); var v = $('#usertype').val(); //alert(v); function approve_assignment(rowId) { var today = new Date(); var time=today.toLocaleTimeString(); var date =(today.getDate()+'-'+(today.getMonth()+1)+'-'+today.getFullYear()+','+time); var id = rowId.closest('tr').attr('id'); var mm=$('#asmu').val(); var as=id; var v = $('#approval_id').val(); $.ajax({ type:'post', url:'<?php echo base_url("quality_check/fetch_usertype"); ?>', data:{'as':as}, async:false, success: function ( response12 ) { response12 = jQuery.parseJSON(response12); var shade = response12; $('#to_val').val(shade); } }); var to=$('#to_val').val(); //alert(v); // return; if(v == 1){ $.ajax({ type:'post', url:'<?php echo base_url("quality_check/approve_assignment"); ?>', data:{'as':as,'date':date}, async:false, success: function (data) { alert('Approved Successfully'); Pending(); } }); } else{ alert("You don't have access to this.") } } function reject_assignment(rowId) { var today = new Date(); var time=today.toLocaleTimeString(); var date =(today.getDate()+'-'+(today.getMonth()+1)+'-'+today.getFullYear()+','+time); var id = rowId.closest('tr').attr('id'); var as=id; var mm=$('#asmu').val(); $.ajax({ type:'post', url:'<?php echo base_url("quality_check/fetch_usertype"); ?>', data:{'as':as}, async:false, success: function ( response12 ) { response12 = jQuery.parseJSON(response12); var shade = response12; $('#to_val').val(shade); } }); var to=$('#to_val').val(); var v = $('#approval_id').val(); if(v == 1){ $.ajax({ type:'post', url:'<?php echo base_url("quality_check/reject_assignment"); ?>', data:{'as':as,'date':date}, async:false, success: function (data) { alert('Rejected...'); Pending(); } }); } else{ alert("You don't have access to this.") } } function edit(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v = $('#insert_id').val(); if(v == 1 || v==2){ window.location.href = '<?php echo base_url('quality_check/edit_quality_check');?>/'+ '?id='+as; } else{ alert("You don't have access to this.") } } function delete_assignment(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v = $('#usertype').val(); if(v == 1 || v==2){ $.ajax({ type:'post', url:'<?php echo base_url("quality_check/delete_assignment"); ?>', data:{'as':as}, async:false, success: function (data) { alert('Deleted...'); Pending(); } }); } else{ alert("You don't have access to this.") } } function Pending() { $.ajax({ type : 'get', url:"<?php echo base_url('quality_check/pending_list_details')?>", success:function(response) { response=jQuery.parseJSON(response); console.log(response); jQuery('#list3').jqGrid('clearGridData'); jQuery('#list3').jqGrid('setGridParam', {data: response}); jQuery('#list3').trigger('reloadGrid'); } }); jQuery("#list3").jqGrid({ data:'', mtype:'get', datatype: "local", colNames:['Id','Case#','Order#','To','Product','Product Name', 'Shade','Created By','Required Date','Preview','Approve','Reject','Delete'], colModel:[ {name:'id',index:'id',hidden:true, width:50}, {name:'case_no',index:'case_no',width:100}, {name:'order_no',index:'',width:110}, {name:'to',index:'to',width:80}, {name:'product',index:'product',width:50}, {name:'article',index:'product name',width:120}, {name:'shade',index:'shade',width:120}, {name:'from',index:'from',width:70,}, {name:'required_before',index:'required_before',width:80,formatter: 'date', formatoptions: { newformat: 'd-m-Y' }}, {name:'preview',index:'preview',width:80,editable:false,editrules:{required: true}, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="preview1($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='Preview' \>"; }}, {name:'', index: '', width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="approve_assignment($(this))" '; } }, {name:'', index: '', width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="reject_assignment($(this))" '; } }, {name:'', index: '', width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="delete_assignment($(this))" '; } }, ], height: 'auto', rowNum:50, rowTotal: 20000000000000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager3", 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:"Pending List Of Orders Details", footerrow: true, subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { // we pass two parameters // subgrid_id is a id of the div tag created within a table // the row_id is the id of the row // If we want to pass additional parameters to the url we can use // the method getRowData(row_id) - which returns associative array in type name-value // here we can easy construct the following 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('quality_check/subgrid');?>/"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames: ['Id','Remark','Edit'], colModel: [ {name:'id',index:'id',hidden:true, width:50,editable:true}, {name:'remarks',index:'remarks',width:200,editable:true}, {name:'edit',index:'edit',align: "center",editable:false,editrules:{required: true}, width:80, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' \>"; }} ], loadonce : true, viewrecords: true, height: 'auto', rowNum:20000000, sortname: 'num', sortorder: "asc", }); } }); $("#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 } ).navButtonAdd('#pager3', { caption:"Print", buttonicon:"ui-icon-print", onClickButton:print_page, position: "last", title:"", cursor: "pointer", id:"client_delete_new" } ); $("#list3").navButtonAdd('#pager3', { caption:"Export", buttonicon:"", onClickButton: export_page_list, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); } function Reject() { $.ajax({ type : 'get', url:"<?php echo base_url('quality_check/reject_list_details')?>", success:function(response) { response=jQuery.parseJSON(response); console.log(response); jQuery('#list5').jqGrid('clearGridData'); jQuery('#list5').jqGrid('setGridParam', {data: response}); jQuery('#list5').trigger('reloadGrid'); } }); jQuery("#list5").jqGrid({ data:'', mtype:'get', datatype: "local", colNames:['Id','Case#','Order#','To','Product','Product Name', 'Shade','Created By','Required Date','Rejected_date','Preview','Approve','Reject','Delete'], colModel:[ {name:'id',index:'id',hidden:true, width:50}, {name:'case_no',index:'case_no',width:120}, {name:'order_no',index:'',width:120}, {name:'to',index:'to',width:100}, {name:'product',index:'product',width:70}, {name:'article',index:'product name',width:70}, {name:'shade',index:'shade',width:70}, {name:'from',index:'from',width:100,}, {name:'required_before',index:'required_before',width:120,formatter: 'date', formatoptions: { newformat: 'd-m-Y' }}, {name:'rejected_date',index:'rejected_date',width:120,formatoptions: { newformat: 'd-m-Y' }}, {name:'preview',index:'preview',width:80,editable:false,editrules:{required: true}, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="preview1($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='Preview' \>"; }}, {name:'', index: '',hidden:true, width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="approve_assignment($(this))" '; } }, {name:'', index: '',hidden:true, width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="reject_assignment($(this))" '; } }, {name:'', index: '', width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="delete_assignment($(this))" '; } }, ], height: 'auto', rowNum:50, rowTotal: 20000000000000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager5", 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:"Reject List Of Orders Details", footerrow: true, subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { // we pass two parameters // subgrid_id is a id of the div tag created within a table // the row_id is the id of the row // If we want to pass additional parameters to the url we can use // the method getRowData(row_id) - which returns associative array in type name-value // here we can easy construct the following 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('quality_check/subgrid');?>/"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames: ['Id','Reamrk','Edit'], colModel: [ {name:'id',index:'id',hidden:true, width:50,editable:true}, {name:'remarks',index:'remarks',width:200,editable:true}, {name:'edit',index:'edit',align: "center",editable:false,editrules:{required: true}, width:80,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' \>"; }} ], loadonce : true, viewrecords: true, height: 'auto', rowNum:20000000, sortname: 'num', sortorder: "asc", }); } }); $("#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 } ).navButtonAdd('#pager5', { caption:"Print", buttonicon:"ui-icon-print", onClickButton:print_page, position: "last", title:"", cursor: "pointer", id:"client_delete_new" } ); $("#list5").navButtonAdd('#pager5', { caption:"Export", buttonicon:"", onClickButton: export_page_list, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); } function Approve() { $.ajax({ type : 'get', url:"<?php echo base_url('quality_check/approve_list_details')?>", success:function(response) { response=jQuery.parseJSON(response); console.log(response); jQuery('#list4').jqGrid('clearGridData'); jQuery('#list4').jqGrid('setGridParam', {data: response}); jQuery('#list4').trigger('reloadGrid'); } }); jQuery("#list4").jqGrid({ data:'', mtype:'get', datatype: "local", colNames:['Id','Case#','Order#','To','Product','Product Name', 'Shade','Created By','Required Date','Approved Date','Approved By','Preview','Approve','Reject','Delete'], colModel:[ {name:'id',index:'id',hidden:true, width:50}, {name:'case_no',index:'case_no',width:100}, {name:'order_no',index:'',width:90}, {name:'to',index:'to',width:80}, {name:'product',index:'product',width:50}, {name:'article',index:'product name',width:100}, {name:'shade',index:'shade',width:100}, {name:'from',index:'from',width:80,}, {name:'required_before',index:'required_before',width:90,formatter: 'date', formatoptions: { newformat: 'd-m-Y' }}, {name:'approved_date',index:'approved_date',width:150,}, {name:'approve_by',index:'approve_by',width:150,}, {name:'preview',index:'preview',width:80,editable:false,editrules:{required: true}, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="preview1($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='Preview' \>"; }}, {name:'', index: '',hidden:true, width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="approve_assignment($(this))" '; } }, {name:'', index: '',hidden:true, width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="reject_assignment($(this))" '; } }, {name:'', index: '', width:55, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="delete_assignment($(this))" '; } }, ], height: 'auto', rowNum:50, rowTotal: 20000000000000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager4", 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:"Approve List Of Orders Details", footerrow: true, subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { // we pass two parameters // subgrid_id is a id of the div tag created within a table // the row_id is the id of the row // If we want to pass additional parameters to the url we can use // the method getRowData(row_id) - which returns associative array in type name-value // here we can easy construct the following 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('quality_check/subgrid');?>/"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames: ['Id','Reamrk','Edit'], colModel: [ {name:'id',index:'id',hidden:true, width:50,editable:true}, {name:'remarks',index:'remarks',width:200,editable:true}, {name:'edit',index:'edit',align: "center",editable:false,editrules:{required: true}, width:80,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' \>"; }} ], loadonce : true, viewrecords: true, height: 'auto', rowNum:20000000, sortname: 'num', sortorder: "asc", }); } }); $("#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 } ).navButtonAdd('#pager4', { caption:"Print", buttonicon:"ui-icon-print", onClickButton:print_page, position: "last", title:"", cursor: "pointer", id:"client_delete_new" } ); $("#list4").navButtonAdd('#pager4', { caption:"Export", buttonicon:"", onClickButton: export_page_list, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); } // var lastsel2; function preview1(rowId){ var row = rowId.closest('tr').attr('id'); var as = row; var v = $('#insert_id').val(); if(v == 1){ window.open('<?php echo base_url('quality_check/preview1');?>/'+ '?id='+as); } else{ alert("You don't have access to this.") } } function ship1(rowId){ var row = rowId.closest('tr').attr('id'); var as = row; //var row1 = rowId.closest('tr').attr('orderID'); // var row1 = rowId.closest('tr').next('tr') // var order_id = row1; // alert(order_id); // return; var shipping_status= $("#shipping_status"+row).val(); var v=$('#insert_id').val(); // alert(v); if(v == 1){ $.ajax({ type : 'post', url:"<?php echo base_url('marketing/shipping')?>", data: {shipping_status:shipping_status,as:as}, success:function(data){ response=jQuery.parseJSON(data); } }); } else{ alert("You don't have access to this."); } //alert(shipping_status); // return; } function export_page() { id = jQuery("#list3").jqGrid('getDataIDs'); var type= $('#type').val(); var l=$('#get_months').val(); var d=$('#datepicker').val(); $.ajax({ type : 'post', url:"<?php echo base_url('dashboard/getcurrent_month_details')?>/s"+l+"/"+d, data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); //alert(d); console.log(response); var count =1; $('.export_table').empty(); var content = ''; content +='<thead><tr><th><b>SL No.</b></th><th><b>OSL #</b></th> <th><b>File No</b></th> <th><b>Mode Of Order</b></th> <th><b>Party Order No</b></th> <th><b>Quantity</b></th> <th><b>Order Type</b></th> <th><b>Value</b></th> <th><b>Currency</b></th> <th><b>INR</b></th> <th><b>Delivery Date</b></th> <th><b>Status</b></th> <th><b>Plan status</b></th></tr></thead>'; $.each(response,function(key,vas){ content +='<tr><td>'+count+'</td> <td>'+vas.oslNo+'</td> <td>'+vas.fileNo+'</td> <td>'+vas.orderMode+'</td> <td>'+vas.orderNo+'</td> <td>'+vas.qnty+'</td><td>'+vas.orders_Type+'</td> <td>'+vas.value+'</td> <td>'+vas.currency+'</td> <td>'+vas.indian+'</td><td>'+vas.deliveryDate+'</td><td>'+vas.confirm_status+'</td><td>'+vas.planningStatus+'</td></tr>'; count++; }); $('.export_table').append(content); doit('xlsx'); // doit(type, fn, dl); // export_data(); // pdf_download(); } }); } function doit(type, fn, dl) { var elt = document.getElementById('export_table'); var wb = XLSX.utils.table_to_book(elt, {sheet:"Sheet JS"}); return dl ? XLSX.write(wb, {bookType:type, bookSST:true, type: 'base64'}) : XLSX.writeFile(wb, fn || ('Marketing OSL Delivery Date Report.' + (type || 'xlsx'))); } function tableau(pid, iid, fmt, ofile) { if(typeof Downloadify !== 'undefined') Downloadify.create(pid,{ swf: 'downloadify.swf', downloadImage: 'download.png', width: 100, height: 30, filename: ofile, data: function() { return doit(fmt, ofile, true); }, transparent: false, append: false, dataType: 'base64', onComplete: function(){ alert('Your File Has Been Saved!'); }, onCancel: function(){ alert('You have cancelled the saving of this file.'); }, onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); } }); else document.getElementById(pid).innerHTML = ""; } tableau('biff8btn', 'xportbiff8', 'biff8', 'test.xls'); tableau('odsbtn', 'xportods', 'ods', 'test.ods'); tableau('fodsbtn', 'xportfods', 'fods', 'test.fods'); tableau('xlsbbtn', 'xportxlsb', 'xlsb', 'test.xlsb'); tableau('xlsxbtn', 'xportxlsx', 'xlsx', 'test.xlsx'); function export_page_list() { id = jQuery("#list3").jqGrid('getDataIDs'); var type= $('#type').val(); var l=$('#get_months').val(); var d=$('#datepicker').val(); $.ajax({ type : 'post', url:"<?php echo base_url('dashboard/getcurrent_month_details')?>/s"+l+"/"+d, data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); //alert(d); console.log(response); var count =1; $('.export_table').empty(); var contents = ''; contents +='<thead><tr><th><b>SL No.</b></th><th><b>OSL #</b></th> <th><b>File No</b></th> <th><b>Mode Of Order</b></th> <th><b>Party Order No</b></th> <th><b>Quantity</b></th> <th><b>Order Type</b></th> <th><b>Value</b></th> <th><b>Currency</b></th> <th><b>INR</b></th> <th><b>Delivery Date</b></th> <th><b>Status</b></th> <th><b>Plan status</b></th></tr></thead>'; $.each(response,function(key,vas){ contents +='<tr><td>'+count+'</td> <td>'+vas.oslNo+'</td> <td>'+vas.fileNo+'</td> <td>'+vas.orderMode+'</td> <td>'+vas.orderNo+'</td> <td>'+vas.qnty+'</td><td>'+vas.orders_Type+'</td> <td>'+vas.value+'</td> <td>'+vas.currency+'</td> <td>'+vas.indian+'</td><td>'+vas.deliveryDate+'</td><td>'+vas.confirm_status+'</td><td>'+vas.planningStatus+'</td></tr>'; count++; }); $('.export_table').append(contents); export_data(); // pdf_download(); } }); } function export_data() { //alert(); $("#export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Marketing OSL Delivery Date Report", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } // function pdf_download() // { // alert(); // var options = { // }; // var pdf = new jsPDF('p', 'pt', 'a4'); // pdf.addHTML($("#export_table"), 0, 0, options, function() { // pdf.save('inspected_fabric.pdf'); // }); // } $("#export").on("click", function(){ $("#list3").jqGrid("exportToHtml",{ includeLabels : true, includeGroupHeader : true, includeFooter: true, autoPrint : true }); }); function print_page() { id = jQuery("#list3").jqGrid('getDataIDs'); //alert(); $.ajax({ type : 'post', url:"<?php echo base_url('reports/pdf_print')?>", data : {id:id}, success:function(){ } }); } function print_page1() { //alert(); var divToPrint=document.getElementById('print_table'); newWin= window.open(""); newWin.document.write('<html><head><title></title>'); newWin.document.write('</head>'); newWin.document.write(divToPrint.outerHTML); newWin.document.write('</html>'); newWin.print(); document.getElementById('print_table').style.display=''; newWin.close(); location.reload(); } function recent_shipment() { var as= $('#ref_id').val(); //alert(as); if(as == 'indent') { alert("Plese select Order#"); } else { var as= $('#ref_id').val(); var v=$('#preview_id').val(); //alert(v); if(v == 1) { window.open('<?php echo base_url('marketing/recent_shipment');?>/'+ '?id='+as,'_blank'); } else { alert("You Don't Have Access For This Preview"); } } } function vehicalFmatter (cellvalue, options, rowObject) { a } function change_delievery(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#edit_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/fetch_change_date_id"); ?>', data:{'as':as}, async:false, success: function (data) { //alert(data); var objData = jQuery.parseJSON(data); $('#user_ref_id').val(as); $('#change_del_date').val(objData); $('#change_delivery_date_Modal').modal('show'); } }); } else { swal({ title: "You Don't Have Access For This Edit", text: "", }); } } function change_del_submit() { var ref_id=$('#user_ref_id').val(); var del_date=$('#change_del_date').val(); $.ajax({ type:'post', url:'<?php echo base_url("marketing/change_date"); ?>', data:{'ref_id':ref_id,'del_date':del_date}, async:false, success:function() { $('#change_delivery_date_Modal').modal('hide'); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } }); } function fun_edit(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#edit_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/edit_form"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { window.location.href = '<?php echo base_url('marketing/edit_from');?>/'+ '?id='+as; } else if(url_r == '2') { window.location.href = '<?php echo base_url('marketing/edit_marketing_form');?>/'+ '?id='+as; } else if(url_r == '3') { window.location.href = '<?php echo base_url('marketing/edit_transaction_form');?>/'+ '?id='+as; } else if(url_r == '4') { window.location.href = '<?php echo base_url('marketing/marketing_edit_form');?>/'+ '?id='+as; } } }); } else { swal({ title: "You Don't Have Access For This Edit", text: "", }); } } function editRow() { // Get the currently selected row var row = $("#list2").jqGrid('getGridParam','selrow'); //alert('hai'); if( row != null ) $("#list2").jqGrid('editGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ var id=$("#id").val(); //alert(id); var oslNo=$("#oslNo").val(); var fileNo=$("#fileNo").val(); var orderMode=$("#orderMode").val(); var orderNo=$("#orderNo").val(); //alert(id); $.ajax({ url:"<?php echo base_url('marketing/customer_update')?>", type:"POST", data:{'id':id,'oslNo':oslNo,'fileNo':fileNo,'orderMode':orderMode,'orderNo':orderNo}, async:false, success:function(data){ if(data==""){ alert('Successfully Updated.'); $("#editmodlist2").remove(); $("#list2").trigger("reloadGrid"); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else{ $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } function deleteRow() { var v=$('#delete_id').val(); if(v == 1) { // Get the currently selected row var row = $("#list2").jqGrid('getGridParam','selrow'); $("#id").val(row); // A pop-up dialog will appear to confirm the selected action if( row != null ) $("#list2").jqGrid( 'delGridRow', row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ $.ajax({ url:"<?php echo base_url('marketing/customer_delete')?>", type:"POST", data:{'id':row}, async:false, success:function(data){ if(data==""){ //alert('Successfully Updated.'); $("#delmodlist2").remove(); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); //$("#list2").trigger("reloadGrid"); } else{ // alert('Successful'); $("#delmodlist2").remove(); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); // $("#list2").trigger("reloadGrid"); } } }); }, reloadAfterSubmit:false, closeAfterDelete: true, afterSubmit : function(response, postdata) { } }); else $( "#dialogSelectRow" ).dialog(); } else { swal({ title: "You Don't Have Access For This Delete", text: "", }); } } </script> <style> .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; } #table_approved_indent { display:none; } #refresh_list3 { display:none !important; } @media only screen and (min-width:320px) and (max-width:640px) { } </style> <script type="text/javascript"> $(document).ready(function(){ $("#sites_print").click(function(){ var divToPrint=document.getElementById("print_sites_report"); newWin= window.open(""); newWin.document.write(divToPrint.outerHTML); newWin.print(); newWin.close(); }); $("#sites_export").click(function(){ $(".sites_table_print").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Broker List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); }); }); </script> <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'); ?>" /> <script> $(function(){ $(".from_delivery_date_required_on").datepicker({ dateFormat: 'dd-mm-yy', }).on('changeDate', function(ev){ $('.from_delivery_date_required_on').datepicker('hide'); }); }); $('.from_delivery_date_required_on').on('change', function(){ var date = $(this).val(); $('.to_delivery_date_required_on').datepicker({ dateFormat: 'dd-mm-yy', minDate: date, }); }); function fun_radio_val(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var m=$('#ref_id').val(as); } function orders_preview() { var as= $('#ref_id').val(); //alert(as); if(as == 'indent') { alert("Plese select Order#"); // swal({ // title: "Plese select Invoice", // text: "", // }); } else { var as= $('#ref_id').val(); var v=$('#preview_id').val(); //alert(v); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/orderinput"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { // window.location.href = '<?php echo base_url('marketing/orderinput');?>/'+ '?id='+as; window.open('<?php echo base_url('marketing/orderinput');?>/'+ '?id='+as,'_blank'); } else if(url_r == '2') { //window.location.href = '<?php echo base_url('marketing/orderinput_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('marketing/orderinput_preview');?>/'+ '?id='+as,'_blank'); } else if(url_r == '3') { //window.location.href = '<?php echo base_url('marketing/order_input');?>/'+ '?id='+as; window.open('<?php echo base_url('marketing/order_input');?>/'+ '?id='+as,'_blank'); } else if(url_r == '4') { //window.location.href = '<?php echo base_url('marketing/order_input_preview');?>/'+ '?id='+as; window.open('<?php echo base_url('marketing/order_input_preview');?>/'+ '?id='+as,'_blank'); } } }); } else { alert("You Don't Have Access For This Preview"); // swal({ // title: "You Don't Have Access For This Preview", // text: "", // }); } } } $("#full").hide(); function pending(){ $("#list3").show(); $("#jaytab3").show(); $("#list4").hide(); $("#jaytab4").hide(); $("#list5").hide(); $("#jaytab5").hide(); Pending(); } function full(){ $("#list4").show(); $("#jaytab4").show(); $("#list3").hide(); $("#jaytab3").hide(); $("#list5").hide(); $("#jaytab5").hide(); Approve(); } function reject(){ $("#list5").show(); $("#jaytab5").show(); $("#list3").hide(); $("#jaytab3").hide(); $("#list4").hide(); $("#jaytab4").hide(); Reject(); } </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; } .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; padding-right: 22px !important; padding-left: 23px !important; margin-top: 4px !important; color:bold !important; } .ui-jqgrid .ui-jqgrid-bdiv { overflow:hidden; } .col_delete { padding-left:8px !important; padding-right:7px !important; padding-bottom: 6px !important; } .col_pre { display: inline; padding-left: 32px !important; padding-right: 33px !important; margin-top:5px !important; padding-bottom: 6px !important; } </style> <script type="text/javascript"> $(function () { $("#fromdate").datepicker({ dateFormat: "dd-mm-yy", changeMonth: true, // setDate: new Date(), changeYear: true }); //$("#fromdate").datepicker("setDate", new Date()); }); $(function () { $("#enddate").datepicker({ dateFormat: "dd-mm-yy", changeMonth: true, // setDate: new Date(), changeYear: true }); //$("#enddate").datepicker("setDate", new Date()); }); </script> <style> #jaytab{ width:100% !important; overflow-x:scroll !important; } #ui-datepicker-div{ z-index: 100!important; } #jaytab1{ width:100% !important; overflow-x:scroll !important; } .tablediv { overflow-x:scroll !important; } #search_list2 { display:none !important; } #list2_122_t { height:0px !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; } #client_edit { padding-right:12px !important; } #list2 { //width: 1050px; height: 0px !important; } #gbox_list2 { 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; } .radio-list { margin-left:7% !important; } #table_pending_indent{ //overflow-x: scroll; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: scroll; //width: 600px !important; padding-left: 0 !important; } #jaytab1 { margin-top: 0 !important; margin-left: 0 !important; //overflow-x: scroll; //width: 300px !important; padding-left: 0 !important; } #editmodlist2 { //width:90% !important; } #sData span, #cData span { margin-left: 0 !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; } #edit_list3,#search_list3,#client_delete_new { display:none; } .jqgfirstrow { height: 0px !important; } .preview { padding-bottom:3px !important; padding-top:3px !important; } .preview { padding-bottom:3px !important; padding-top:3px !important; } .tablediv { width: auto !important; // overflow: scroll !important; } .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td { overflow: hidden; white-space: pre; } </style>