Advertisement
dahliamuerder13

Dashboard_laba

Sep 18th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 15.83 KB | None | 0 0
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
  2. <style>
  3. .dataTable > thead {
  4.     background: white;
  5.     border-bottom: 4px solid #35568F;
  6.     color: #000;
  7. }
  8. .table-bordered {
  9.     border: 1px solid #dedddd;
  10. }
  11. .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td { border: 1px solid #dddcdc; }
  12. #tableNrcBln_filter { display: none }
  13. #tableNrcBln_length { display: none }
  14. #tableNrcBln_info { display: none }
  15. #tableNrcBln_paginate { display: none }
  16. </style>
  17. <!--                            <link href="<?php echo base_url('assets/plugins/select2/css/select2.min.css'); ?>" rel="stylesheet" type="text/css" /> -->
  18. <!--                            <link href="<?php echo base_url('assets/plugins/select2/css/select2.AdminLTE.css'); ?>" rel="stylesheet" type="text/css" /> -->
  19.                             <div class="content-wrapper" style="background:#F2F2F2;background-repeat: repeat;background-position: 50%;margin-top: 0;margin-bottom: 0;">
  20.                                 <!-- <section class="content-header text-center" style="margin-top: 2%;margin-bottom: 5%"> -->
  21.                                 <section class="content-header text-center">
  22.                                     <h4 style="background: #ddd; padding: 5px 0">PT.PRATHITA TITIAN NUSANTARA</h4><br>
  23.                                 </section>
  24.                                 <section class="content">
  25.                                 <div class="row">
  26.                                     <div class="col-xs-12">
  27.                                         <div class="box box-widget">
  28.                                         <div class="box-header text-center">
  29.                                         <h3>Laporan Laba-Rugi Komperhensif</h3>
  30.                                         Per
  31.                                         <?php for ($a = date('Ym', strtotime($dateStart)); $a <= date('Ym', strtotime($dateEnd)); $a++) { ?>
  32.                                             <?php echo date('M', strtotime($a . '01')); ?>
  33.                                         <?php } ?>                             
  34.                                         2019
  35.                                         </div>
  36.                                         <div class="box-body">
  37.                                         <div class="table-responsive">
  38.                                             <table class="table table-bordered table-hover" id="tableNrcBln">
  39.                                                 <thead>
  40.                                                     <tr>
  41.                                                         <th>LVL</th>
  42.                                                         <th>Header</th>
  43.                                                         <th>GL/Act</th>
  44.                                                         <th>GL/Ctr</th>
  45.                                                         <th>Description</th>
  46.                                                         <?php
  47.                                                         for ($a = date('Ym', strtotime($dateStart)); $a <= date('Ym', strtotime($dateEnd)); $a++) {
  48.                                                         ?>
  49.                                                         <th><?php echo date('M Y', strtotime($a . '01')); ?></th>
  50.                                                         <?php
  51.                                                         }
  52.                                                         ?>
  53.                                                     </tr>
  54.                                                 </thead>
  55.                                                 <tbody>
  56.                                                     <?php
  57.                                                     foreach ($asets as $aset) {
  58.                                                     ?>
  59.                                                     <tr data-akun="<?php echo $aset['gl_act']; ?>" data-child="<?php echo $aset['gl_child']; ?>" data-parent="<?php echo $aset['gl_parent']; ?>">
  60.                                                         <td><?php echo 'LVL' . ($aset['gl_lvl']); ?></td>
  61.                                                         <td class="text-left"><?php echo ($aset['gl_lvl'] === 'G') ? '<strong>' . $aset['gl_act'] . '</strong>': ''; ?></td>
  62.                                                         <td class="text-left"><?php echo ($aset['gl_lvl'] === 'D') ? $aset['gl_act']: ''; ?></td>
  63.                                                         <td class="text-left"><?php echo ($aset['gl_lvl'] === 'D') ? $aset['gl_ctr']: ''; ?></td>
  64.                                                         <td class="text-left" id="<?php echo $aset['gl_act'] . '_' . $aset['gl_ctr']; ?>"><?php echo ($aset['gl_lvl'] === 'G') ? '<strong>' . $aset['gl_name2'] . '</strong>': $aset['gl_name2']; ?></td>
  65.                                                         <?php
  66.                                                             for ($b = date('Ym', strtotime($dateStart)); $b <= date('Ym', strtotime($dateEnd)); $b++) {
  67.                                                                 $onClick = '';
  68.                                                                 $sCursor = 'auto';
  69.                                                                 if ($aset['gl_lvl'] === 'D') {
  70.                                                                     $onClick = "loadNrc('" . $aset["gl_act"] . "', '" . $aset["gl_ctr"] . "', '" . date("Y-m-d", strtotime($b . "01")) . "');";
  71.                                                                     $sCursor = "pointer";
  72.                                                                 }
  73.                                                         ?>
  74.                                                         <td class="text-right" data-total="<?php echo floatval($aset[date('MY', strtotime($b . '01'))]); ?>" onclick="<?php echo $onClick; ?>" style="cursor: <?php echo $sCursor; ?>;"><?php echo number_format($aset[date('MY', strtotime($b . '01'))], 2); ?></td>
  75.                                                         <?php
  76.                                                             }
  77.                                                         ?>
  78.                                                     </tr>
  79.                                                     <?php
  80.                                                         }
  81.                                                     ?>
  82.                                                     <tr>
  83.                                                         <td>LVLG</td>
  84.                                                         <td></td>
  85.                                                         <td></td>
  86.                                                         <td></td>
  87.                                                         <td class="text-center">
  88.                                                             <strong>JUMLAH ASET</strong>
  89.                                                         </td>
  90.                                                         <?php
  91.                                                             for ($c = date('Ym', strtotime($dateStart)); $c <= date('Ym', strtotime($dateEnd)); $c++) {
  92.                                                         ?>
  93.                                                         <td class="text-right"><?php echo number_format(array_sum(array_column($asets, date('MY', strtotime($c . '01')))), 2); ?></td>
  94.                                                         <?php
  95.                                                             }
  96.                                                         ?>
  97.                                                     </tr>
  98.                                                     <?php
  99.                                                     $labahold = 0;
  100.                                                     $labarun = 0;
  101.                                                     foreach ($liabilities as $k => $l) {
  102.                                                     ?>
  103.                                                     <tr data-akun="<?php echo $l['gl_act']; ?>" data-child="<?php echo $l['gl_child']; ?>" data-parent="<?php echo $l['gl_parent']; ?>">
  104.                                                         <td><?php echo 'LVL' . $l['gl_lvl']; ?></td>
  105.                                                         <td class="text-left"><?php echo ($l['gl_lvl'] === 'G') ? '<strong>' . $l['gl_act'] . '</strong>': ''; ?></td>
  106.                                                         <td class="text-left"><?php echo ($l['gl_lvl'] === 'D') ? $l['gl_act']: ''; ?></td>
  107.                                                         <td class="text-left"><?php echo ($l['gl_lvl'] === 'D') ? $l['gl_ctr']: ''; ?></td>
  108.                                                         <td class="text-left" id="<?php echo $l['gl_act'] . '_' . $l['gl_ctr']; ?>"><?php echo ($l['gl_lvl'] === 'G') ? '<strong>' . $l['gl_name2'] . '</strong>': $l['gl_name2']; ?></td>
  109.                                                         <?php
  110.                                                             for ($d = date('Ym', strtotime($dateStart)); $d <= date('Ym', strtotime($dateEnd)); $d++) {
  111.                                                                 $onClick = '';
  112.                                                                 $sCursor = 'auto';
  113.                                                                 if ($l['gl_lvl'] === 'D') {
  114.                                                                     $onClick = "loadNrc('" . $l["gl_act"] . "', '" . $l["gl_ctr"] . "', '" . date("Y-m-d", strtotime($d . "01")) . "');";
  115.                                                                     $sCursor = "pointer";
  116.                                                                 }
  117.                                                         ?>
  118.                                                         <td class="text-right" data-total="<?php echo floatval($l[date('MY', strtotime($d . '01'))]); ?>" onclick="<?php echo $onClick; ?>" style="cursor: <?php echo $sCursor; ?>;"><?php echo number_format($l[date('MY', strtotime($d . '01'))], 2); ?></td>
  119.                                                         <?php
  120.                                                             }
  121.                                                         ?>
  122.                                                     </tr>
  123.                                                     <?php
  124.                                                     }
  125.                                                     ?>
  126.                                                     <tr>
  127.                                                         <td>LVLG</td>
  128.                                                         <td></td>
  129.                                                         <td></td>
  130.                                                         <td></td>
  131.                                                         <td class="text-center">
  132.                                                             <strong>JUMLAH LIABILITAS DAN EKUITAS</strong>
  133.                                                         </td>
  134.                                                         <?php
  135.                                                             for ($e = date('Ym', strtotime($dateStart)); $e <= date('Ym', strtotime($dateEnd)); $e++) {
  136.                                                         ?>
  137.                                                         <td class="text-right"><?php echo number_format(array_sum(array_column($liabilities, date('MY', strtotime($e . '01')))), 2); ?></td>
  138.                                                         <?php
  139.                                                             }
  140.                                                         ?>
  141.                                                     </tr>
  142.                                                     <tr>
  143.                                                         <td>LVLG</td>
  144.                                                         <!-- <td class="text-center" colspan="4">
  145.                                                             <strong>SELISIH ASET - LIABILITY</strong>
  146.                                                         </td>
  147.                                                         <td style="display: none;"></td>
  148.                                                         <td style="display: none;"></td>
  149.                                                         <td style="display: none;"></td>
  150.                                                         <td style="display: none;"></td> -->
  151.                                                         <td></td>
  152.                                                         <td></td>
  153.                                                         <td></td>
  154.                                                         <td class="text-center">
  155.                                                             <strong>SELISIH ASET - LIABILITY</strong>
  156.                                                         </td>
  157.                                                         <?php
  158.                                                             for ($f = date('Ym', strtotime($dateStart)); $f <= date('Ym', strtotime($dateEnd)); $f++) {
  159.                                                                 $fa = array_sum(array_column($asets, date('MY', strtotime($f . '01'))));
  160.                                                                 $fb = array_sum(array_column($liabilities, date('MY', strtotime($f . '01'))));
  161.                                                                 $fc = $fa - (($fb >= 0) ? $fb: 0 - $fb);
  162.                                                         ?>
  163.                                                                                                             <td class="text-right"><?php echo number_format(($fc >= 0) ? $fc: 0 - $fc); ?></td>
  164.                                                         <?php
  165.                                                             }
  166.                                                         ?>
  167.                                                     </tr>
  168.                                                 </tbody>
  169.                                             </table>
  170.                                         </div>
  171.                                         </div>
  172.                                         </div>
  173.                                     </div>
  174.                                 </div>
  175.  
  176.                             <script src="<?php echo base_url('assets/plugins/select2/js/select2.min.js'); ?>" type="text/javascript"></script>
  177.                             <script src="<?php echo base_url() . 'assets/js/jquery.number.min.js'; ?>" type="text/javascript"></script>
  178.                             <script type="text/javascript">
  179.                                 function loadJurnal(code) {
  180.                                     $('#myMdlJurnal').html(code);
  181.                                     if ($.fn.dataTable.isDataTable('#tblJurnal')) { $('#tblJurnal').DataTable().destroy(); }
  182.                                     $('#tblJurnal tbody').html('<tr><td class="text-center" colspan="6"><i aria-hidden="true" class="fa fa-spinner fa-pulse fa-fw"></i> Loading...</td></tr>');
  183.                                     $('#tblJurnalTOTCRD').html('0.00');
  184.                                     $('#tblJurnalTOTDBT').html('0.00');
  185.                                     sendData('<?php echo site_url('accounting/reportacc/jurnals/'); ?>' + code, '', 'GET', function(a) {
  186.                                         if (a.code === 200) {
  187.                                             var b = a.message;
  188.                                             var d = '';
  189.                                             for (var c = 0; c < b.length; c++) {
  190.                                                 d += '<tr>';
  191.                                                 d += '<td class="text-left">' + b[c].coa + ' ' + b[c].ctr + '</td>';
  192.                                                 d += '<td class="text-left">' + (((typeof b[c].name) === 'string') ? b[c].name: '') + '</td>';
  193.                                                 d += '<td class="text-left">' + (((typeof b[c].sub) === 'string') ? b[c].sub: '') + '</td>';
  194.                                                 d += '<td class="text-right">' + $.number(b[c].dbt, 2) + '</td>';
  195.                                                 d += '<td class="text-right">' + $.number(b[c].crd, 2) + '</td>';
  196.                                                 d += '<td class="text-left">' + (((typeof b[c].desc) === 'string') ? b[c].desc: '') + '</td>';
  197.                                                 d += '</tr>';
  198.                                             }
  199.                                             $('#tblJurnal tbody').html(d);
  200.                                         }
  201.                                         else {
  202.                                             $('#tblJurnal tbody').html('');
  203.                                             if (typeof a.message === 'string') { alert(a.message); }
  204.                                         }
  205.                                         dtResponsive('#tblJurnal', { buttons: ['copyHtml5', 'csvHtml5', 'excelHtml5', 'pdfHtml5', 'print'] }, function(e) {
  206.                                             e.buttons().container().appendTo($('#exportTblJurnal'));
  207.                                             e.on('search.dt', function() {
  208.                                                 let f = e.rows({ search: 'applied' }).data();
  209.                                                 let g = h = 0;
  210.                                                 for (let i = 0; i < f.length; i++) {
  211.                                                     let ga = f[i][3];
  212.                                                     g += parseFloat(ga.replaces(',', ''));
  213.                                                     let ha = f[i][4];
  214.                                                     h += parseFloat(ha.replaces(',', ''));
  215.                                                 }
  216.                                                 $('#tblJurnalTOTDBT').html($.number(g, 2));
  217.                                                 $('#tblJurnalTOTCRD').html($.number(h, 2));
  218.                                             });
  219.                                             e.search('').draw();
  220.                                         });
  221.                                     });
  222.                                     $('#mdlJurnal').modal('show');
  223.                                 }
  224.                                 function loadNrc(coa, sta, date) {
  225.                                     if ($.fn.dataTable.isDataTable('#tblNrcDtl')) { $('#tblNrcDtl').DataTable().destroy(); }
  226.                                     $('#tblNrcDtl tbody').html('<tr><td class="text-center" colspan="5"><i aria-hidden="true" class="fa fa-spinner fa-pulse fa-fw"></i> Loading...</td></tr>');
  227.                                     $('#NrcDtlTOT').html('0.00');
  228.                                     sendData('<?php echo site_url('accounting/reportacc/jurnal'); ?>', 'coa=' + coa + '&ctr=' + sta + '&date=' + date, 'POST', function(a) {
  229.                                         if (a.code === 200) {
  230.                                             var b = a.message;
  231.                                             var d = '';
  232.                                             for (var c = 0; c < b.length; c++) {
  233.                                                 d += '<tr>';
  234.                                                 d += '<td class="text-left">' + b[c].jurnal_date + '</td>';
  235.                                                 d += '<td class="text-left"><a href="javascript: loadJurnal(\'' + b[c].jurnal_code + '\');">' + b[c].jurnal_code + '</a></td>';
  236.                                                 d += '<td class="text-left">' + b[c].jurnal_coa + '</td>';
  237.                                                 d += '<td class="text-left">' + b[c].jurnal_sta + '</td>';
  238.                                                 d += '<td class="text-right">' + $.number(b[c].jurnal_tot, 2) + '</td>';
  239.                                                 d += '</tr>';
  240.                                             }
  241.                                             $('#tblNrcDtl tbody').html(d);
  242.                                         } else { $('#tblNrcDtl tbody').html(''); }
  243.                                         dtResponsive('#tblNrcDtl', { buttons: ['copyHtml5', 'csvHtml5', 'excelHtml5', 'pdfHtml5', 'print'] }, function(e) {
  244.                                             e.buttons().container().appendTo($('#exportNrcDtl'));
  245.                                             e.on('search.dt', function() {
  246.                                                 let f = e.rows({ search: 'applied' }).data();
  247.                                                 let g = 0;
  248.                                                 for (let h = 0; h < f.length; h++) {
  249.                                                     let fa = f[h][4];
  250.                                                     g += parseFloat(fa.replaces(',', ''));
  251.                                                 }
  252.                                                 $('#NrcDtlTOT').html($.number(g, 2));
  253.                                             });
  254.                                             e.search('').draw();
  255.                                         });
  256.                                     });
  257.                                     $('#myMdlNrcDtl').html(coa + ' - ' + sta + ' - ' + $('#' + coa + '_' + sta).html());
  258.                                     $('#mdlNrcDtl').modal('show');
  259.                                 }
  260.                                 $(document).ready(function() {
  261.                                     var tableNrcBln;
  262.                                     dtResponsive('#tableNrcBln', {
  263.                                         autoWidth: false,
  264.                                         buttons: [
  265.                                             { extend: 'copy', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
  266.                                             { extend: 'csv', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
  267.                                             { extend: 'excel', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
  268.                                             { extend: 'pdf', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
  269.                                             { extend: 'print', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' }],
  270.                                         columnDefs: [{ targets: [0], visible: false }],
  271.                                         lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'All']],
  272.                                         ordering: false }, function(a) {
  273.                                             tableNrcBln = a;
  274.                                             tableNrcBln.buttons().container().appendTo($('#divDTButtons')); });
  275.                                     $('#formNrcBlnBtn').on('click', function(e) {
  276.                                         e.preventDefault();
  277.                                         // var dateEnd = '?dateEnd=' + $('#formNrcBln select[name="yearEnd"]').val() + '-' + $('#formNrcBln select[name="monthEnd"]').val() + '-01';
  278.                                         // var dateStart = '&dateStart=' + $('#formNrcBln select[name="yearStart"]').val() + '-' + $('#formNrcBln select[name="monthStart"]').val() + '-01';
  279.                                         // var tabActive = getTabActive();
  280.                                         // loadPage($(this).attr('action') + dateEnd + dateStart, function(a) { $(tabActive).html(a); });
  281.                                         $('#dateEnd').val($('#formNrcBln select[name="yearEnd"]').val() + '-' + $('#formNrcBln select[name="monthEnd"]').val() + '-01');
  282.                                         $('#dateStart').val($('#formNrcBln select[name="yearStart"]').val() + '-' + $('#formNrcBln select[name="monthStart"]').val() + '-01');
  283.                                         $('#formNrcBln').submit();
  284.                                     });
  285.                                     tableNrcBln.page.len(-1).draw();
  286.                                     $('.select2').select2();
  287.                                     $('.select2').on('change', function() { tableNrcBln.search($(this).val()).draw(); });
  288.                                     $('#tableNrcBln tr[data-child="1"]').each(function() {
  289.                                         var akun = $(this).attr('data-akun');
  290.                                         var $parent = $(this);
  291.                                         var temp = tableNrcBln.row($parent.index()).data();
  292.                                         $('#tableNrcBln tr[data-parent="' + akun + '"]').each(function(k) {
  293.                                             for (var a = 4; a < $(this).find('td').length; a++) {
  294.                                                 var b = parseFloat($parent.find('td:eq(' + a + ')').attr('data-total'));
  295.                                                 var c = parseFloat($(this).find('td:eq(' + a + ')').attr('data-total'));
  296.                                                 $parent.find('td:eq(' + a + ')').attr('data-total', parseFloat(b + c).toFixed(2));
  297.                                                 // $parent.find('td:eq(' + a + ')').html($.number($parent.find('td:eq(' + a + ')').attr('data-total'), 2));
  298.                                                 temp[a + 1] = $.number($parent.find('td:eq(' + a + ')').attr('data-total'), 2);
  299.                                             }
  300.                                             // $(this).hide();
  301.                                         });
  302.                                         tableNrcBln.row($parent.index()).data(temp).invalidate();
  303.                                     });
  304.                                     // tableNrcBln.search('LVLG').draw();
  305.                                     tableNrcBln
  306.                                         .column(0).search('LVLG')
  307.                                         .draw();
  308.                                 });
  309.                             </script>
  310.                         </section>
  311.                     </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement