EVOLUTION-NINJA
Edit File: nandi_transaction_details.php
<style> .cure { width: 75px; } .modal_content_id { width: 246%; margin-left: -410px; } </style> <style> #other_charges_val { font-weight:bold; } </style> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> Nandi Transaction Details</h3> <?php // echo $this->load->view('templates/nav_menu'); ?> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="https://swansilk.co/dashboard/dashboard_fun">Home</a> <i class="fa fa-angle-right"></i> <a href="#" >Nandi Transaction Details</a></li> </ul> </div> <!-------------- grid data ------------------------------> <input type="hidden" id="refe_ids" name="refe_ids" class="refe_ids" > <input type="hidden" id="approval_id" class="approval_id" value="<?php if(empty($access_row)){ } else { echo $access_row->approval_id; } ?>" > <div id="table_pending_indent" style="margin-top:20px;"> <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> </div> </div> <!-- End BEGIN CONTAINER --> <table border="1" id="export_table" style="width:100%;border-spacing:0;margin-top: 1%; text-align: right;display: none" cellpadding="2px"> <thead> <tr> <th>SL No.</th> <th>Account</th> <th>Narration</th> <th>Debit</th> <th>Credit</th> <th>Total Balance</th> <th>Transaction Date</th> <th>Approved By</th> <th>Created At</th> </tr> </thead> <tbody class="tbody"> </tbody> </table> </script> <!-- BEGIN FOOTER --> <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> <style> .tablediv { width:auto !important; overflow-x:scroll; } .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <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" 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> .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) { } #more { display:none; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <script> $(document).ready(function (){ $('#more').hide(); var l=$("#ref_id").val(); jQuery("#list2").jqGrid({ url:"<?php echo base_url('packing_list/get_nandi_transaction_detailses')?>", datatype: "json", colNames:['Id','Year','Month','month_in_num','year_data','Debit','Credit','Balance Available','Approval','Approved By','Preview','Download'], colModel:[ {name:'id',index:'id',hidden:true, width:80,editable:true,key:true}, {name:'year',index:'year', width:80,editable:true,editrules:{required: true}}, {name:'month',index:'month', width:80,editable:true,editrules:{required: true}}, {name:'month_data',index:'month_data',hidden:true, width:100,editable:true}, {name:'year_data',index:'year_data',hidden:true, width:100,editable:true}, {name:'debit',index:'debit', width:100,editable:true,editrules:{required: true}}, {name:'credit',index:'credit', width:100,editable:true,editrules:{required: true}}, {name:'available_bal',index:'available_bal', width:100,editable:true,editrules:{required: true}}, {name:'confirm',index:'confirm', sortable:true, search:true,searchoptions: { sopt: ['eq','ne','bw','ew']}, width:90,align: "center", editable:true, edittype:"checkbox",cellattr:function (rowId, tv, rawObject, cm, rdata) { },formatter:function (cellvalue, options, rowObject) { if(rowObject.confirm == "0") { /*return '<input type='checkbox' value='1' onclick="approve('+rowObject.month+');" >Approve';*/ return "<input type='checkbox' value='1' onclick='approve("+rowObject.month_data+","+rowObject.year_data+" );'>Approve "; } else { return "<input type='checkbox' value='0' onclick='not_approve("+rowObject.month_data+","+rowObject.year_data+" );' checked >Approved"; } }}, {name:'approved_by',index:'approved_by', width:100,editable:true,editrules:{required: true}}, {name:'',index:'',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="preview_data('+rawObject.month_data+','+rawObject.year_data+')" '; }, formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' \>"; }}, {name:'',index:'',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="download_function('+rawObject.month_data+','+rawObject.year_data+','+rawObject.confirm+')" '; }, formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DOWLOAD' \>"; }}, ], 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:"Nandi Transaction Details", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; swan_id=row_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('packing_list/nandi_transaction_details_subgrid');?>/"+row_id, mtype : "get", datatype: "json", colNames:['Id','Date','Account','Narration','Credit','Debit','Created By'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'transaction_date',index:'transaction_date', width:100,editable:true,editrules:{required: true},formatter: 'date', formatoptions: { srcformat: 'Y-m-d', newformat: 'd-m-Y'}}, {name:'b_name',index:'b_name', width:250,editable:true,editrules:{required: true}}, {name:'narration',index:'narration',hidden:false, width:250,editable:true,editrules:{required: true}}, {name:'credit',index:'credit',hidden:false, width:250,editable:true,editrules:{required: true}}, {name:'debit',index:'debit',hidden:false, editable:true,editrules:{required: true},width:250}, {name:'created',index:'created', editable:true,editrules:{required: true},width:250}, ], height: 'auto', rowNum:200000000000000000, sortname: 'num', shrinkToFit: true, sortorder: "asc" }); } }); jQuery("#list2").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#list2").jqGrid('navGrid','#pager2', {edit:false,add:false,del:false,search:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); }); function download_function(mon,year,status) { if(status == 1) { $.ajax({ type:'post', url : '<?php echo site_url("packing_list/nandi_download_function");?>', data:{'mon':mon,'year':year}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.tbody').empty() var con=""; var tot_credit=0; var tot_debit=0; var tot_bal=0; $.each(response.message, function(keys, val) { var v=keys+1; var debit=val.debit; var credit=val.credit; //tot_credit=val.tot_credit; //tot_debit=val.tot_debit; var date=val.transaction_date.split("-"); var create_date=val.created_at.split(" "); var create_date=create_date[0].split("-"); var total_bal=parseInt(credit)-parseInt(debit); tot_credit=parseInt(tot_credit)+parseInt(val.credit); tot_debit=parseInt(tot_debit)+parseInt(val.debit); tot_bal=parseInt(tot_credit)-parseInt(tot_debit); // alert(tot_credit); con+='<tr>'; con+='<td>'+v+'</td>'; con+='<td>'+val.b_name+'</td>'; con+='<td>'+val.narration+'</td>'; con+='<td>'+val.debit+'</td>'; con+='<td>'+val.credit+'</td>'; con+='<td>'+total_bal+'</td>'; con+='<td>'+date[2]+'-'+date[1]+'-'+date[0]+'</td>'; con+='<td>'+val.approved_by+'</td>'; con+='<td>'+create_date[2]+'-'+create_date[1]+'-'+create_date[0]+'</td>'; con+='</tr>'; }); con+='<tr>'; con+='<td></td>'; con+='<td></td>'; con+='<td></td>'; con+='<td>'+tot_debit+'</td>'; con+='<td>'+tot_credit+'</td>'; con+='<td>'+tot_bal+'</td>'; con+='<td></td>'; con+='<td></td>'; con+='<td></td>'; con+='</tr>'; $('.tbody').append(con); doit('xlsx'); } } }); 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 || ('Transaction Report.' + (type || 'xlsx'))); } } else { swal({ title: "This Report Not Yet Approved", text: "", }); } } function preview_data(mon,year) { window.location.href = '<?php echo site_url('packing_list/nandi_preview');?>/'+mon+'/'+year; } function approve(mon,year){ //var id = rowId.closest('tr').attr('id'); $.ajax({ type:'post', url : '<?php echo site_url("packing_list/nandi_status_approve")?>', data:{'mon':mon,'year':year}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { swal({ title: "Successfully approved", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else { swal({ title: "Fail To add, Try Again", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } function not_approve(mon,year){ $.ajax({ type:'post', url : '<?php echo site_url("packing_list/nandi_status_not_approve")?>', data:{'mon':mon,'year':year}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { swal({ title: "Successfully Disapproved", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else { swal({ title: "Fail To add, Try Again", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } </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-btable tbody tr.jqgrow td { overflow: hidden; white-space: pre; } </style> <style> #jaytab{ width:100%; overflow:auto; } #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:640px){ .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 !important; 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; } .jqgfirstrow { height: 0px !important; } </style>