Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
- <style>
- .dataTable > thead {
- background: white;
- border-bottom: 4px solid #35568F;
- color: #000;
- }
- .table-bordered {
- border: 1px solid #dedddd;
- }
- .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; }
- #tableNrcBln_filter { display: none }
- #tableNrcBln_length { display: none }
- #tableNrcBln_info { display: none }
- #tableNrcBln_paginate { display: none }
- </style>
- <!-- <link href="<?php echo base_url('assets/plugins/select2/css/select2.min.css'); ?>" rel="stylesheet" type="text/css" /> -->
- <!-- <link href="<?php echo base_url('assets/plugins/select2/css/select2.AdminLTE.css'); ?>" rel="stylesheet" type="text/css" /> -->
- <div class="content-wrapper" style="background:#F2F2F2;background-repeat: repeat;background-position: 50%;margin-top: 0;margin-bottom: 0;">
- <!-- <section class="content-header text-center" style="margin-top: 2%;margin-bottom: 5%"> -->
- <section class="content-header text-center">
- <h4 style="background: #ddd; padding: 5px 0">PT.PRATHITA TITIAN NUSANTARA</h4><br>
- </section>
- <section class="content">
- <div class="row">
- <div class="col-xs-12">
- <div class="box box-widget">
- <div class="box-header text-center">
- <h3>Laporan Laba-Rugi Komperhensif</h3>
- Per
- <?php for ($a = date('Ym', strtotime($dateStart)); $a <= date('Ym', strtotime($dateEnd)); $a++) { ?>
- <?php echo date('M', strtotime($a . '01')); ?>
- <?php } ?>
- 2019
- </div>
- <div class="box-body">
- <div class="table-responsive">
- <table class="table table-bordered table-hover" id="tableNrcBln">
- <thead>
- <tr>
- <th>LVL</th>
- <th>Header</th>
- <th>GL/Act</th>
- <th>GL/Ctr</th>
- <th>Description</th>
- <?php
- for ($a = date('Ym', strtotime($dateStart)); $a <= date('Ym', strtotime($dateEnd)); $a++) {
- ?>
- <th><?php echo date('M Y', strtotime($a . '01')); ?></th>
- <?php
- }
- ?>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($asets as $aset) {
- ?>
- <tr data-akun="<?php echo $aset['gl_act']; ?>" data-child="<?php echo $aset['gl_child']; ?>" data-parent="<?php echo $aset['gl_parent']; ?>">
- <td><?php echo 'LVL' . ($aset['gl_lvl']); ?></td>
- <td class="text-left"><?php echo ($aset['gl_lvl'] === 'G') ? '<strong>' . $aset['gl_act'] . '</strong>': ''; ?></td>
- <td class="text-left"><?php echo ($aset['gl_lvl'] === 'D') ? $aset['gl_act']: ''; ?></td>
- <td class="text-left"><?php echo ($aset['gl_lvl'] === 'D') ? $aset['gl_ctr']: ''; ?></td>
- <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>
- <?php
- for ($b = date('Ym', strtotime($dateStart)); $b <= date('Ym', strtotime($dateEnd)); $b++) {
- $onClick = '';
- $sCursor = 'auto';
- if ($aset['gl_lvl'] === 'D') {
- $onClick = "loadNrc('" . $aset["gl_act"] . "', '" . $aset["gl_ctr"] . "', '" . date("Y-m-d", strtotime($b . "01")) . "');";
- $sCursor = "pointer";
- }
- ?>
- <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>
- <?php
- }
- ?>
- </tr>
- <?php
- }
- ?>
- <tr>
- <td>LVLG</td>
- <td></td>
- <td></td>
- <td></td>
- <td class="text-center">
- <strong>JUMLAH ASET</strong>
- </td>
- <?php
- for ($c = date('Ym', strtotime($dateStart)); $c <= date('Ym', strtotime($dateEnd)); $c++) {
- ?>
- <td class="text-right"><?php echo number_format(array_sum(array_column($asets, date('MY', strtotime($c . '01')))), 2); ?></td>
- <?php
- }
- ?>
- </tr>
- <?php
- $labahold = 0;
- $labarun = 0;
- foreach ($liabilities as $k => $l) {
- ?>
- <tr data-akun="<?php echo $l['gl_act']; ?>" data-child="<?php echo $l['gl_child']; ?>" data-parent="<?php echo $l['gl_parent']; ?>">
- <td><?php echo 'LVL' . $l['gl_lvl']; ?></td>
- <td class="text-left"><?php echo ($l['gl_lvl'] === 'G') ? '<strong>' . $l['gl_act'] . '</strong>': ''; ?></td>
- <td class="text-left"><?php echo ($l['gl_lvl'] === 'D') ? $l['gl_act']: ''; ?></td>
- <td class="text-left"><?php echo ($l['gl_lvl'] === 'D') ? $l['gl_ctr']: ''; ?></td>
- <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>
- <?php
- for ($d = date('Ym', strtotime($dateStart)); $d <= date('Ym', strtotime($dateEnd)); $d++) {
- $onClick = '';
- $sCursor = 'auto';
- if ($l['gl_lvl'] === 'D') {
- $onClick = "loadNrc('" . $l["gl_act"] . "', '" . $l["gl_ctr"] . "', '" . date("Y-m-d", strtotime($d . "01")) . "');";
- $sCursor = "pointer";
- }
- ?>
- <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>
- <?php
- }
- ?>
- </tr>
- <?php
- }
- ?>
- <tr>
- <td>LVLG</td>
- <td></td>
- <td></td>
- <td></td>
- <td class="text-center">
- <strong>JUMLAH LIABILITAS DAN EKUITAS</strong>
- </td>
- <?php
- for ($e = date('Ym', strtotime($dateStart)); $e <= date('Ym', strtotime($dateEnd)); $e++) {
- ?>
- <td class="text-right"><?php echo number_format(array_sum(array_column($liabilities, date('MY', strtotime($e . '01')))), 2); ?></td>
- <?php
- }
- ?>
- </tr>
- <tr>
- <td>LVLG</td>
- <!-- <td class="text-center" colspan="4">
- <strong>SELISIH ASET - LIABILITY</strong>
- </td>
- <td style="display: none;"></td>
- <td style="display: none;"></td>
- <td style="display: none;"></td>
- <td style="display: none;"></td> -->
- <td></td>
- <td></td>
- <td></td>
- <td class="text-center">
- <strong>SELISIH ASET - LIABILITY</strong>
- </td>
- <?php
- for ($f = date('Ym', strtotime($dateStart)); $f <= date('Ym', strtotime($dateEnd)); $f++) {
- $fa = array_sum(array_column($asets, date('MY', strtotime($f . '01'))));
- $fb = array_sum(array_column($liabilities, date('MY', strtotime($f . '01'))));
- $fc = $fa - (($fb >= 0) ? $fb: 0 - $fb);
- ?>
- <td class="text-right"><?php echo number_format(($fc >= 0) ? $fc: 0 - $fc); ?></td>
- <?php
- }
- ?>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="<?php echo base_url('assets/plugins/select2/js/select2.min.js'); ?>" type="text/javascript"></script>
- <script src="<?php echo base_url() . 'assets/js/jquery.number.min.js'; ?>" type="text/javascript"></script>
- <script type="text/javascript">
- function loadJurnal(code) {
- $('#myMdlJurnal').html(code);
- if ($.fn.dataTable.isDataTable('#tblJurnal')) { $('#tblJurnal').DataTable().destroy(); }
- $('#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>');
- $('#tblJurnalTOTCRD').html('0.00');
- $('#tblJurnalTOTDBT').html('0.00');
- sendData('<?php echo site_url('accounting/reportacc/jurnals/'); ?>' + code, '', 'GET', function(a) {
- if (a.code === 200) {
- var b = a.message;
- var d = '';
- for (var c = 0; c < b.length; c++) {
- d += '<tr>';
- d += '<td class="text-left">' + b[c].coa + ' ' + b[c].ctr + '</td>';
- d += '<td class="text-left">' + (((typeof b[c].name) === 'string') ? b[c].name: '') + '</td>';
- d += '<td class="text-left">' + (((typeof b[c].sub) === 'string') ? b[c].sub: '') + '</td>';
- d += '<td class="text-right">' + $.number(b[c].dbt, 2) + '</td>';
- d += '<td class="text-right">' + $.number(b[c].crd, 2) + '</td>';
- d += '<td class="text-left">' + (((typeof b[c].desc) === 'string') ? b[c].desc: '') + '</td>';
- d += '</tr>';
- }
- $('#tblJurnal tbody').html(d);
- }
- else {
- $('#tblJurnal tbody').html('');
- if (typeof a.message === 'string') { alert(a.message); }
- }
- dtResponsive('#tblJurnal', { buttons: ['copyHtml5', 'csvHtml5', 'excelHtml5', 'pdfHtml5', 'print'] }, function(e) {
- e.buttons().container().appendTo($('#exportTblJurnal'));
- e.on('search.dt', function() {
- let f = e.rows({ search: 'applied' }).data();
- let g = h = 0;
- for (let i = 0; i < f.length; i++) {
- let ga = f[i][3];
- g += parseFloat(ga.replaces(',', ''));
- let ha = f[i][4];
- h += parseFloat(ha.replaces(',', ''));
- }
- $('#tblJurnalTOTDBT').html($.number(g, 2));
- $('#tblJurnalTOTCRD').html($.number(h, 2));
- });
- e.search('').draw();
- });
- });
- $('#mdlJurnal').modal('show');
- }
- function loadNrc(coa, sta, date) {
- if ($.fn.dataTable.isDataTable('#tblNrcDtl')) { $('#tblNrcDtl').DataTable().destroy(); }
- $('#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>');
- $('#NrcDtlTOT').html('0.00');
- sendData('<?php echo site_url('accounting/reportacc/jurnal'); ?>', 'coa=' + coa + '&ctr=' + sta + '&date=' + date, 'POST', function(a) {
- if (a.code === 200) {
- var b = a.message;
- var d = '';
- for (var c = 0; c < b.length; c++) {
- d += '<tr>';
- d += '<td class="text-left">' + b[c].jurnal_date + '</td>';
- d += '<td class="text-left"><a href="javascript: loadJurnal(\'' + b[c].jurnal_code + '\');">' + b[c].jurnal_code + '</a></td>';
- d += '<td class="text-left">' + b[c].jurnal_coa + '</td>';
- d += '<td class="text-left">' + b[c].jurnal_sta + '</td>';
- d += '<td class="text-right">' + $.number(b[c].jurnal_tot, 2) + '</td>';
- d += '</tr>';
- }
- $('#tblNrcDtl tbody').html(d);
- } else { $('#tblNrcDtl tbody').html(''); }
- dtResponsive('#tblNrcDtl', { buttons: ['copyHtml5', 'csvHtml5', 'excelHtml5', 'pdfHtml5', 'print'] }, function(e) {
- e.buttons().container().appendTo($('#exportNrcDtl'));
- e.on('search.dt', function() {
- let f = e.rows({ search: 'applied' }).data();
- let g = 0;
- for (let h = 0; h < f.length; h++) {
- let fa = f[h][4];
- g += parseFloat(fa.replaces(',', ''));
- }
- $('#NrcDtlTOT').html($.number(g, 2));
- });
- e.search('').draw();
- });
- });
- $('#myMdlNrcDtl').html(coa + ' - ' + sta + ' - ' + $('#' + coa + '_' + sta).html());
- $('#mdlNrcDtl').modal('show');
- }
- $(document).ready(function() {
- var tableNrcBln;
- dtResponsive('#tableNrcBln', {
- autoWidth: false,
- buttons: [
- { extend: 'copy', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
- { extend: 'csv', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
- { extend: 'excel', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
- { extend: 'pdf', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' },
- { extend: 'print', exportOptions: { columns: ':visible' }, title: 'Neraca 12 Bulan' }],
- columnDefs: [{ targets: [0], visible: false }],
- lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'All']],
- ordering: false }, function(a) {
- tableNrcBln = a;
- tableNrcBln.buttons().container().appendTo($('#divDTButtons')); });
- $('#formNrcBlnBtn').on('click', function(e) {
- e.preventDefault();
- // var dateEnd = '?dateEnd=' + $('#formNrcBln select[name="yearEnd"]').val() + '-' + $('#formNrcBln select[name="monthEnd"]').val() + '-01';
- // var dateStart = '&dateStart=' + $('#formNrcBln select[name="yearStart"]').val() + '-' + $('#formNrcBln select[name="monthStart"]').val() + '-01';
- // var tabActive = getTabActive();
- // loadPage($(this).attr('action') + dateEnd + dateStart, function(a) { $(tabActive).html(a); });
- $('#dateEnd').val($('#formNrcBln select[name="yearEnd"]').val() + '-' + $('#formNrcBln select[name="monthEnd"]').val() + '-01');
- $('#dateStart').val($('#formNrcBln select[name="yearStart"]').val() + '-' + $('#formNrcBln select[name="monthStart"]').val() + '-01');
- $('#formNrcBln').submit();
- });
- tableNrcBln.page.len(-1).draw();
- $('.select2').select2();
- $('.select2').on('change', function() { tableNrcBln.search($(this).val()).draw(); });
- $('#tableNrcBln tr[data-child="1"]').each(function() {
- var akun = $(this).attr('data-akun');
- var $parent = $(this);
- var temp = tableNrcBln.row($parent.index()).data();
- $('#tableNrcBln tr[data-parent="' + akun + '"]').each(function(k) {
- for (var a = 4; a < $(this).find('td').length; a++) {
- var b = parseFloat($parent.find('td:eq(' + a + ')').attr('data-total'));
- var c = parseFloat($(this).find('td:eq(' + a + ')').attr('data-total'));
- $parent.find('td:eq(' + a + ')').attr('data-total', parseFloat(b + c).toFixed(2));
- // $parent.find('td:eq(' + a + ')').html($.number($parent.find('td:eq(' + a + ')').attr('data-total'), 2));
- temp[a + 1] = $.number($parent.find('td:eq(' + a + ')').attr('data-total'), 2);
- }
- // $(this).hide();
- });
- tableNrcBln.row($parent.index()).data(temp).invalidate();
- });
- // tableNrcBln.search('LVLG').draw();
- tableNrcBln
- .column(0).search('LVLG')
- .draw();
- });
- </script>
- </section>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement