EVOLUTION-NINJA
Edit File: 1734153030expense_list.php
<?php $this->load->view('includes/admin_header');?> <link rel="stylesheet" href="<?php echo base_url('admin_assets/css/jquery-ui.css');?>"> <script src="<?php echo base_url('admin_assets/assets/js/jquery.table2excel.js');?>"></script> <script src="<?php echo base_url('admin_assets/js/jquery-ui.js');?>"></script> <div class="main-content"> <div class="main-content-inner"> <div class="page-content"> <div class="row"> <div style="display:none;"><table border="1" style="border-spacing: 0px !important;" id="export_table" class="export_table"></table></div> <form id="invoice_reports"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div class="row" style="background-color:#f8f8f8;padding-top: 10px;padding-bottom: 10px;"> <div class="col-sm-12 col-md-2"> <span style="font-size:25px;">Expense List</span> </div> <div class="col-sm-7"></div> </div> <div class="row"> <div class="col-sm-12 col-xs-12 col-md-6"> <label class="col-sm-4">From Date <span style="color:red">*</span></label> <div class="col-sm-8 yes_form"> <input type="text" name="from_date" class="form-control from_date" required> </div> </div> <div class="col-sm-12 col-xs-12 col-md-6"> <label class="col-sm-4">To Date<span style="color:red">*</span></label> <div class="col-sm-8 yes_form"> <input type="text" name="to_date" class="form-control to_date" > </div> </div> </div> <div class="row" style="background-color:#f8f8f8;padding-top: 10px;padding-bottom: 10px;"> <div class="col-sm-10"></div> <div class="col-sm-2"> <button type="submit" class="btn btn-sm">Submit</button> <button type="reset" class="btn btn-sm">Cancel</button> </div> </div> </div> </form> <!-- PAGE CONTENT ENDS --> <div class="toat_count"></div> </div> <div class="row" style="background-color:white;margin-top:10px;"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div class="hr dotted"></div> <div> <div class="row search-page" id="search-page-1"> <div class="col-xs-12"> <div class="row"> <div class="col-xs-12 col-sm-12"> <div class="row"> <div id="addele_more"> <div class="col-sm-12 table-responsive"> <table class="table" id="maintable"> <thead> <tr id="column_id"> <th>Sl No</th> <th>Date</th> <th>Expense Type</th> <th>Expense Amount</th> <th>Expense Towards Account</th> <th>Vendor Name</th> <th>Action</th> </tr> </thead> <tbody id="newbody"> <?foreach ($expense as $key => $value) { ?> <tr> <td><?php echo $key+1; ?></td> <td><?php echo date('d-m-Y',strtotime($value->expense_date)); ?></td> <td><?php echo $value->expense_type; ?></td> <td><?php echo $value->expense_amount; ?></td> <td><?php echo $value->expense_towards_account; ?></td> <td><?php echo $value->vendor_name; ?></td> <td><span class="fa fa-trash" onclick="delete_iadmin(<?php echo $value->expense_id; ?>);" aria-hidden="true"></span>  <a href="<?php echo base_url('update-expense'); ?>/<?php echo $value->expense_id;; ?>"><span class="fa fa-pencil-square-o" aria-hidden="true"></span></a></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.page-content --> </div><!-- /.main-content --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. <!-- We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <!-- The link to the CSS that the grid needs --> <script type="text/javascript"> $('.from_date').datepicker({ dateFormat: 'dd-mm-yy', //numberOfMonths: 2, onSelect: function(selected) { $(".to_date").datepicker("option","minDate", selected) } }); $('.to_date').datepicker({ dateFormat: 'dd-mm-yy', onSelect: function(selected) { $(".from_date").datepicker("option","maxDate", selected) } }); function delete_iadmin(id) { var id = id; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("yaskawa/delete_expense")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"]("Deleted successfully"); $('.row'+id).hide(); $('#newbody').load(location.href + ' #newbody > *'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('#invoice_reports').submit(function(e){ var from_date = $(".from_date").val(); var to_date = $(".to_date").val(); e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("yaskawa/get_expense_list")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); var content=''; $.each(response,function(key,val){ var expense_date=val.expense_date; var arr = expense_date.split('-'); expense_date=arr[2]+'-'+arr[1]+'-'+arr[0]; key=key+1; content+='<tr>'; content+='<td>'+key+'</td>'; content+='<td>'+expense_date+'</td>'; content+='<td>'+val.expense_type+'</td>'; var expense_amount=val.expense_amount; x=expense_amount.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var expense_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content+='<td>'+expense_amount+'</td>'; content+='<td>'+val.expense_towards_account+'</td>'; content+='<td>'+val.vendor_name+'</td>'; content+='<td><span class="fa fa-trash" onclick="delete_iadmin('+val.expense_id+');" aria-hidden="true"></span> <a href="<?php echo base_url('update-expense'); ?>/'+val.expense_id+'"><span class="fa fa-pencil-square-o" aria-hidden="true"></span></a></td>'; content+='</tr>'; }); $('#newbody').empty(); $('#newbody').append(content); } }); }); function test(){ $('.toat_count').empty(); id = jQuery("#list3").jqGrid('getDataIDs'); var type= $('#type').val(); $.ajax({ type : 'post', url : "<?php echo site_url("yaskawa/get_invoice_report_details")?>", data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); var cgst=0; var sgst=0; var tota=0; var total_collected=0; var total_pending=0; var sub_tota=0; var content=''; $.each(response,function(key,vas){ cgst+=parseInt(vas.cgst_amount); sgst+=parseInt(vas.sgst_amount); tota+=parseInt(vas.grand_total); var price=jQuery.parseJSON(vas.price); $.each(price,function(key,va){ sub_tota+=parseInt(va); }); if(vas.invoice_status=='CLEARED'||vas.invoice_status=='PARTIAL'){ total_collected+=parseInt(vas.total_amount); } if(vas.invoice_status=='PENDING'){ total_pending+=parseInt(vas.total_amount); } }); content +='<p style="text-align:center;"><b>Sub Total Amount :</b>'; x=sub_tota.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +=res; content +='<span style="padding:0px 20px;"><b>CGST Amount :</b>'; x=cgst.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +=res+'</span>'; content +='<span style="padding:0px 20px;"><b>SGST Amount :</b>'; x=sgst.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +=res+'</span>'; content +='<b>Total Amount :</b>'; x=tota.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +=res+'</p>'; content +='<p style="text-align:center;"><b>Total Collected :</b>'; x=total_collected.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +=res content +='<span style="padding:0px 10px;"><b>Total Pending :</b>'; x=total_pending.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +=res+'</span></p>'; $('.toat_count').append(content); } }); } var cgst=0; var sgst=0; var tota=0; var sub_tota=0; function export_page() { id = jQuery("#list3").jqGrid('getDataIDs'); var type= $('#type').val(); $.ajax({ type : 'post', url : "<?php echo site_url("yaskawa/get_invoice_report_details")?>", data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); console.log(response); var count =1; var content = ''; content +='<thead><tr><th>Sl No</th> <th>Account Name</th> <th>Invoice Number</th> <th>Address</th> <th>Invoice Date</th> <th>Gstn</th><th>Description</th><th>Sac</th><th>Bill Amount</th><th>CGST</th><th>CGST Amount</th><th>SGST</th><th>SGST Amount</th><th>Total</th><th>Created By</th><th>Payment Type</th><th>Amount</th><th>Paid To</th><th>Cheque Number</th><th>Cheque Date</th><th>Bank</th><th>Branch</th><th>DD No</th><th>DD Date</th><th>UTR No</th><th>Online Date</th><th>Collected By</th><th>Added By</th></tr></thead>'; $.each(response,function(key,vas){ var desc=jQuery.parseJSON(vas.description); var sac=jQuery.parseJSON(vas.sac); var price=jQuery.parseJSON(vas.price); var peyment=vas.payments; var key=key+1; content +='<tr><td>'+key+'</td> <td>'+vas.name+'</td> <td>'+vas.invoice_no+'</td> <td>'+vas.address+'</td> <td>'+vas.invoice_date+'</td><td>'+vas.gstn+'</td>'; content +='<td>'; $.each(desc,function(key,val){ content +=val; }); content +='</td>'; content +='<td>'; $.each(sac,function(key,val){ content+=val; }); content +='</td>'; content +='<td>'; $.each(price,function(key,val){ content+=val; sub_tota+=val; }); content +='</td>'; content +='<td>'+vas.cgst+'</td> <td>'+vas.cgst_amount+'</td><td>'+vas.sgst+'</td><td>'+vas.sgst_amount+'</td><td>'+vas.grand_total+'</td><td>'+vas.created_by+'</td>'; cgst+=parseInt(vas.cgst_amount); sgst+=parseInt(vas.sgst_amount); tota+=parseInt(vas.grand_total); content+='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.payment_type content+='</br>'; }); }else{ content+=''; } content+='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.amount content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.favour_of content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.cheque_no content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.cheque_date content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.bank_name content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.branch_name content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.dd_no content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.dd_date content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.utr_no content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.online_date content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.collected_by content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='<td>'; if(peyment!='null'){ $.each(peyment,function(key,va){ content+=va.added_by content+='</br>'; }); }else{ content+=''; } content +='</td>'; content +='</tr>'; count++; }); content +='<tr>'; content +='<td></td>'; content +='<td></td>'; content +='<td></td>'; content +='<td></td>'; content +='<td></td>'; content +='<td></td>'; content +='<td></td>'; content +='<td></td>'; content +='<td>Total</td>'; x=sub_tota.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +='<td>'+res+'</td>'; x=cgst.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +='<td>'+res+'</td>'; content +='<td></td>'; x=sgst.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +='<td>'+res+'</td>'; x=tota.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content +='<td>'+res+'</td>'; content +='</tr>'; $('.export_table').empty(); $('.export_table').append(content); // $('.toat_count').empty(); // $('.toat_count').append(content1); export_data(); } }); } // function export_data() { $("#export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Invoice Report", fileext: ".xlsx", exclude_img: true, exclude_links: true, exclude_inputs: true }); } </script> <style type="text/css"> #treeview-searchable .node-disabled { display: none; } .hoverr:hover .addd { display:block; } .addd{ display:none; } .add_more { padding: 0px 7px !important; font-size: 12px !important; } #block{display:none;padding-left:10px;} .pd-7{ padding-right:7px !important; padding-left:7px !important; } .pd-9{ padding:2px 9px !important; } #jaytab3 { width: 100% !important; overflow-x: scroll; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color: #001a00; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 50%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 7px !important; background:steelblue !important; color:white !important; } .ui-jqgrid-bdiv { height: auto !important; } .ui-widget-overlay { z-index:0 !important; } .ui-widget-header { background: #1e7ad7 !important; } .ui-jqgrid-hdiv ui-state-default { //width: 873px !important; cursor: default!important } ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fed22f; background: #ffe45c; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { font-weight: bold; color: black; } .ui-jqgrid { //width: 988px !important; overflow-x: scroll !important; } @media only screen and (min-width:641px) and (max-width:991px){ .ui-jqgrid{ text-indent: 0; color: #307ECC; float: none; right: 2px; } #jaytab3{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: hidden; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } } .ui-datepicker { width: auto !important; } @media only screen and (min-width:320px) and (max-width:641px){ .ui-jqgrid{ } .ui-datepicker { width: auto !important; } .yes_form input{ width:100% !important; border:none !important; border-bottom:1px solid gray !important; margin-bottom:5%; } .yes_form select{ width:100% !important; border:none !important; border-bottom:1px solid gray !important; margin-bottom:5%; } .yes_form textarea{ width:100% !important; border:none !important; border-bottom:1px solid gray !important; margin-bottom:5%; } </style> <?php $this->load->view('includes/admin_footer');?>