542 lines
23 KiB
PHP
542 lines
23 KiB
PHP
<?php
|
|
session_start();
|
|
require '../config.php';
|
|
require '../include_header.php';
|
|
?>
|
|
|
|
<body>
|
|
<?php require '../include_topbar.php'; ?>
|
|
<?php require '../include_sidebar_ac.php'; ?>
|
|
|
|
<main id="content" class="content py-15">
|
|
<div class="container-fluid">
|
|
|
|
<div class="row mb-6">
|
|
<div class="col-12">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<div>
|
|
<h1 class="fs-3 mb-1">GL Journal Listing</h1>
|
|
<p class="mb-0 text-muted">Posted general ledger entries from all document types</p>
|
|
</div>
|
|
<button class="btn btn-primary" onclick="open_manual_entry()">
|
|
<i class="ti ti-plus me-1"></i>New Manual Entry
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="card p-4 mb-4">
|
|
<div class="row g-2 align-items-end">
|
|
<div class="col-auto">
|
|
<label class="form-label mb-1 small">Date From</label>
|
|
<input type="text" id="f-date-from" class="form-control form-control-sm" placeholder="d/m/Y" style="width:140px;">
|
|
</div>
|
|
<div class="col-auto">
|
|
<label class="form-label mb-1 small">Date To</label>
|
|
<input type="text" id="f-date-to" class="form-control form-control-sm" placeholder="d/m/Y" style="width:140px;">
|
|
</div>
|
|
<div class="col-auto">
|
|
<label class="form-label mb-1 small">Source Type</label>
|
|
<select id="f-source-type" class="form-select form-select-sm" style="width:200px;">
|
|
<option value="">All Types</option>
|
|
<option value="invoice">Invoice</option>
|
|
<option value="credit_note">Credit Note</option>
|
|
<option value="purchase_invoice">Purchase Invoice</option>
|
|
<option value="supplier_credit_note">Supplier Credit Note</option>
|
|
<option value="receipt">Receipt</option>
|
|
<option value="payment">Payment</option>
|
|
<option value="manual">Manual</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-auto">
|
|
<button class="btn btn-secondary btn-sm" onclick="load_journal_listing()">
|
|
<i class="ti ti-search me-1"></i>Load
|
|
</button>
|
|
</div>
|
|
<div class="col ms-auto d-flex align-items-end justify-content-end">
|
|
<span id="jl-badge" class="text-muted small"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Table -->
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
<table id="jl-table" class="table table-hover mb-0 table-centered">
|
|
<thead class="table-primary border-light">
|
|
<tr>
|
|
<th>Document</th>
|
|
<th>Type</th>
|
|
<th>Contact</th>
|
|
<th>Period</th>
|
|
<th>Formula</th>
|
|
<th class="text-end">Debit</th>
|
|
<th class="text-end">Credit</th>
|
|
<th>Posted At</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="jl-tbody">
|
|
<tr><td colspan="9" class="text-center text-muted py-5">Use the filters above and click Load.</td></tr>
|
|
</tbody>
|
|
<tfoot></tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Manual entry modal -->
|
|
<div class="modal fade" id="me-modal" tabindex="-1">
|
|
<div class="modal-dialog modal-xl modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">New Manual Journal Entry</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<div class="row g-3 mb-4">
|
|
<div class="col-sm-3">
|
|
<label class="form-label small">Journal Date <span class="text-danger">*</span></label>
|
|
<input type="text" id="me-date" class="form-control form-control-sm" placeholder="d/m/Y">
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<label class="form-label small">Reference</label>
|
|
<input type="text" id="me-reference" class="form-control form-control-sm" placeholder="e.g. PCF-001">
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<label class="form-label small">Description</label>
|
|
<input type="text" id="me-description" class="form-control form-control-sm" placeholder="e.g. Petty cash reimbursement">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Balance indicator -->
|
|
<div class="d-flex align-items-center gap-3 mb-3">
|
|
<span class="text-muted small">Debit: <strong id="me-total-debit">0.00</strong></span>
|
|
<span class="text-muted small">Credit: <strong id="me-total-credit">0.00</strong></span>
|
|
<span id="me-balance-badge"></span>
|
|
</div>
|
|
|
|
<!-- Lines table -->
|
|
<table class="table table-sm table-hover table-centered mb-2">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th style="width:160px;">Account Code</th>
|
|
<th>Description</th>
|
|
<th style="width:160px;" class="text-end">Debit</th>
|
|
<th style="width:160px;" class="text-end">Credit</th>
|
|
<th style="width:40px;"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="me-lines">
|
|
<!-- rows injected by JS -->
|
|
</tbody>
|
|
</table>
|
|
|
|
<button class="btn btn-outline-secondary btn-sm" onclick="me_add_line()">
|
|
<i class="ti ti-plus me-1"></i>Add Line
|
|
</button>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<div id="me-msg" class="text-danger small me-auto d-none"></div>
|
|
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-primary btn-sm" id="me-btn-save" onclick="save_manual_entry()">
|
|
<i class="ti ti-device-floppy me-1"></i>Save
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Detail modal -->
|
|
<div class="modal fade" id="jl-modal" tabindex="-1">
|
|
<div class="modal-dialog modal-lg modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="jl-modal-title">Journal Entry</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body" id="jl-modal-body">
|
|
<div class="text-center text-muted py-4"><i class="ti ti-loader ti-spin me-1"></i>Loading…</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" id="jl-btn-edit" class="btn btn-outline-primary btn-sm d-none"
|
|
onclick="edit_manual_entry()">
|
|
<i class="ti ti-pencil me-1"></i>Edit
|
|
</button>
|
|
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php require '../include_ending.php'; ?>
|
|
|
|
<script>
|
|
var _jl_rows = [];
|
|
|
|
var SOURCE_LABELS = {
|
|
invoice: 'Invoice',
|
|
credit_note: 'Credit Note',
|
|
purchase_invoice: 'Purchase Invoice',
|
|
supplier_credit_note: 'Supplier Credit Note',
|
|
receipt: 'Receipt',
|
|
payment: 'Payment',
|
|
manual: 'Manual'
|
|
};
|
|
|
|
var SOURCE_BADGE = {
|
|
invoice: 'bg-success-subtle text-success',
|
|
credit_note: 'bg-warning-subtle text-warning',
|
|
purchase_invoice: 'bg-primary-subtle text-primary',
|
|
supplier_credit_note: 'bg-secondary-subtle text-secondary',
|
|
receipt: 'bg-info-subtle text-info',
|
|
payment: 'bg-danger-subtle text-danger',
|
|
manual: 'bg-dark-subtle text-dark'
|
|
};
|
|
|
|
function source_badge(type) {
|
|
var cls = SOURCE_BADGE[type] || 'bg-light text-dark';
|
|
return '<span class="badge ' + cls + '">' + (SOURCE_LABELS[type] || type) + '</span>';
|
|
}
|
|
|
|
// ── init ─────────────────────────────────────────────────────────────────
|
|
$(function() {
|
|
var today = new Date();
|
|
var firstDay = new Date(today.getFullYear(), today.getMonth(), 1);
|
|
var fmt = function(d) {
|
|
return ('0' + d.getDate()).slice(-2) + '/' +
|
|
('0' + (d.getMonth() + 1)).slice(-2) + '/' + d.getFullYear();
|
|
};
|
|
flatpickr('#f-date-from', { dateFormat: 'd/m/Y', allowInput: true, defaultDate: firstDay });
|
|
flatpickr('#f-date-to', { dateFormat: 'd/m/Y', allowInput: true, defaultDate: today });
|
|
$('#f-date-from').val(fmt(firstDay));
|
|
$('#f-date-to').val(fmt(today));
|
|
});
|
|
|
|
// ── load listing ─────────────────────────────────────────────────────────
|
|
function load_journal_listing() {
|
|
var $tbody = $('#jl-tbody');
|
|
$tbody.html('<tr><td colspan="9" class="text-center text-muted py-4">'
|
|
+ '<i class="ti ti-loader ti-spin me-1"></i>Loading…</td></tr>');
|
|
$('#jl-badge').text('');
|
|
$('#jl-table tfoot').empty();
|
|
|
|
var ctx = document.getElementById('session-context');
|
|
ajax_request({
|
|
url: '<?php echo $server_url?>accounting/api/engine/get_journal_listing.php',
|
|
action: 'get',
|
|
queueLock: false,
|
|
noLoading: true,
|
|
data: {
|
|
otp: ctx ? ctx.dataset.otp : '',
|
|
company_id: ctx ? ctx.dataset.companyId : '',
|
|
action: 'get',
|
|
date_from: $('#f-date-from').val(),
|
|
date_to: $('#f-date-to').val(),
|
|
source_type: $('#f-source-type').val()
|
|
},
|
|
onSuccess: function(res) {
|
|
_jl_rows = res.output || [];
|
|
|
|
if (!_jl_rows.length) {
|
|
$tbody.html('<tr><td colspan="9" class="text-center text-muted py-4">No GL entries found.</td></tr>');
|
|
$('#jl-badge').text('0 entries');
|
|
return;
|
|
}
|
|
|
|
$('#jl-badge').text(_jl_rows.length + ' entr' + (_jl_rows.length === 1 ? 'y' : 'ies'));
|
|
|
|
alasql('CREATE TABLE IF NOT EXISTS jl_table');
|
|
alasql.tables['jl_table'].data = _jl_rows;
|
|
|
|
window['change_page_jl_table'] = function(page_num) {
|
|
var offset = (page_num - 1) * prop_limit;
|
|
var page_rows = alasql('SELECT * FROM jl_table LIMIT ' + prop_limit + ' OFFSET ' + offset);
|
|
render_jl_rows(page_rows);
|
|
};
|
|
|
|
$('#jl-table tfoot').html(generate_pagination('jl-table', _jl_rows.length));
|
|
window['change_page_jl_table'](1);
|
|
}
|
|
});
|
|
}
|
|
|
|
function render_jl_rows(rows) {
|
|
var html = '';
|
|
$.each(rows, function(i, r) {
|
|
html +=
|
|
'<tr>' +
|
|
'<td class="fw-semibold">' + escape_html(r.doc_number || '—') + '</td>' +
|
|
'<td>' + source_badge(r.source_type) + '</td>' +
|
|
'<td>' + escape_html(r.contact_name || '—') + '</td>' +
|
|
'<td>' + escape_html(r.period) + '</td>' +
|
|
'<td class="text-muted small">' + escape_html(r.formula_name || '—') + '</td>' +
|
|
'<td class="text-end">' + format_number(r.total_debit, 2) + '</td>' +
|
|
'<td class="text-end">' + format_number(r.total_credit, 2) + '</td>' +
|
|
'<td class="text-muted small">' + escape_html(r.posted_at) + '</td>' +
|
|
'<td>' +
|
|
'<a href="javascript:;" onclick="show_journal_detail(' + r.id + ',\'' + escape_html(r.doc_number || '') + '\')" title="View lines">' +
|
|
'<i class="ti ti-eye fs-5"></i></a>' +
|
|
'</td>' +
|
|
'</tr>';
|
|
});
|
|
$('#jl-tbody').html(html);
|
|
}
|
|
|
|
// ── manual entry form ─────────────────────────────────────────────────────
|
|
var _me_line_idx = 0;
|
|
var _me_editing_gl_id = 0; // 0 = new, >0 = editing
|
|
|
|
function edit_manual_entry() {
|
|
if (!_jl_detail) return;
|
|
$('#jl-modal').modal('hide');
|
|
open_manual_entry(_jl_detail);
|
|
}
|
|
|
|
function open_manual_entry(existing) {
|
|
_me_line_idx = 0;
|
|
_me_editing_gl_id = existing ? (int_val(existing.header.id)) : 0;
|
|
$('#me-lines').empty();
|
|
$('#me-msg').addClass('d-none').text('');
|
|
$('#me-balance-badge').html('');
|
|
|
|
var title = _me_editing_gl_id > 0 ? 'Edit Manual Journal Entry' : 'New Manual Journal Entry';
|
|
$('#me-modal .modal-title').text(title);
|
|
|
|
if (existing) {
|
|
var h = existing.header;
|
|
$('#me-reference').val(h.reference || '');
|
|
$('#me-description').val(h.description || '');
|
|
flatpickr('#me-date', { dateFormat: 'd/m/Y', allowInput: true, defaultDate: h.journal_date || new Date() });
|
|
$('#me-date').val(h.journal_date_fmt || '');
|
|
$.each(existing.lines, function(i, l) { me_add_line(l); });
|
|
} else {
|
|
$('#me-reference').val('');
|
|
$('#me-description').val('');
|
|
flatpickr('#me-date', { dateFormat: 'd/m/Y', allowInput: true, defaultDate: new Date() });
|
|
me_add_line();
|
|
me_add_line();
|
|
}
|
|
|
|
me_update_totals();
|
|
|
|
// Load accounts if not yet fetched
|
|
if (!window.account_search_accounts || !window.account_search_accounts.length) {
|
|
var ctx = document.getElementById('session-context');
|
|
ajax_request({
|
|
url: '<?php echo $server_url?>accounting/api/engine/account.php',
|
|
action: 'get', queueLock: false, noLoading: true,
|
|
data: {
|
|
otp: ctx ? ctx.dataset.otp : '',
|
|
company_id: ctx ? ctx.dataset.companyId : '',
|
|
action: 'get'
|
|
},
|
|
onSuccess: function(res) {
|
|
window.account_search_accounts = res.output || [];
|
|
init_account_search_inputs('#me-modal', window.account_search_accounts);
|
|
}
|
|
});
|
|
} else {
|
|
init_account_search_inputs('#me-modal', window.account_search_accounts);
|
|
}
|
|
|
|
$('#me-modal').modal('show');
|
|
}
|
|
|
|
function int_val(v) { return parseInt(v, 10) || 0; }
|
|
|
|
function me_add_line(prefill) {
|
|
var idx = _me_line_idx++;
|
|
var code = prefill ? escape_html(prefill.account_code) : '';
|
|
var label = prefill ? escape_html(prefill.account_code + (prefill.account_name ? ' - ' + prefill.account_name : '')) : '';
|
|
var desc = prefill ? escape_html(prefill.description) : '';
|
|
var debit = prefill ? (parseFloat(prefill.debit) || '') : '';
|
|
var credit = prefill ? (parseFloat(prefill.credit) || '') : '';
|
|
|
|
var row =
|
|
'<tr id="me-line-' + idx + '">' +
|
|
'<td><input type="text" class="form-control form-control-sm account_search" placeholder="Search account…" autocomplete="off"' +
|
|
(prefill ? ' value="' + label + '" data-account-code="' + code + '" secondary="' + label + '"' : '') +
|
|
' oninput="me_update_totals()"></td>' +
|
|
'<td><input type="text" class="form-control form-control-sm" placeholder="Description" value="' + desc + '"></td>' +
|
|
'<td><input type="number" class="form-control form-control-sm text-end me-debit" min="0" step="0.01" placeholder="0.00" value="' + debit + '" oninput="me_update_totals()"></td>' +
|
|
'<td><input type="number" class="form-control form-control-sm text-end me-credit" min="0" step="0.01" placeholder="0.00" value="' + credit + '" oninput="me_update_totals()"></td>' +
|
|
'<td><a href="javascript:;" onclick="$(\'#me-line-' + idx + '\').remove(); me_update_totals();" class="text-danger"><i class="ti ti-x"></i></a></td>' +
|
|
'</tr>';
|
|
$('#me-lines').append(row);
|
|
|
|
var $newRow = $('#me-line-' + idx);
|
|
if (window.account_search_accounts && window.account_search_accounts.length) {
|
|
init_account_search_inputs($newRow[0], window.account_search_accounts);
|
|
}
|
|
}
|
|
|
|
function me_update_totals() {
|
|
var debit = 0, credit = 0;
|
|
$('#me-lines tr').each(function() {
|
|
debit += parseFloat($(this).find('.me-debit').val()) || 0;
|
|
credit += parseFloat($(this).find('.me-credit').val()) || 0;
|
|
});
|
|
$('#me-total-debit').text(format_number(debit, 2));
|
|
$('#me-total-credit').text(format_number(credit, 2));
|
|
|
|
var balanced = Math.abs(debit - credit) < 0.005 && debit > 0;
|
|
$('#me-balance-badge').html(
|
|
balanced
|
|
? '<span class="badge bg-success-subtle text-success">Balanced</span>'
|
|
: (debit > 0 || credit > 0
|
|
? '<span class="badge bg-danger-subtle text-danger">Unbalanced</span>'
|
|
: '')
|
|
);
|
|
}
|
|
|
|
function save_manual_entry() {
|
|
var lines = [];
|
|
$('#me-lines tr').each(function() {
|
|
var $row = $(this);
|
|
var account_code = $row.find('.account_search').attr('data-account-code') || '';
|
|
lines.push({
|
|
account_code: account_code.trim(),
|
|
description: $row.find('input').eq(1).val().trim(),
|
|
debit: parseFloat($row.find('.me-debit').val()) || 0,
|
|
credit: parseFloat($row.find('.me-credit').val()) || 0
|
|
});
|
|
});
|
|
|
|
set_btn_state('#me-btn-save', false);
|
|
$('#me-msg').addClass('d-none').text('');
|
|
|
|
var ctx = document.getElementById('session-context');
|
|
ajax_request({
|
|
url: '<?php echo $server_url?>accounting/api/engine/save_manual_journal.php',
|
|
action: 'post',
|
|
queueLock: false,
|
|
noLoading: true,
|
|
data: {
|
|
otp: ctx ? ctx.dataset.otp : '',
|
|
company_id: ctx ? ctx.dataset.companyId : '',
|
|
action: 'post',
|
|
gl_id: _me_editing_gl_id,
|
|
journal_date: $('#me-date').val(),
|
|
reference: $('#me-reference').val().trim(),
|
|
description: $('#me-description').val().trim(),
|
|
lines: JSON.stringify(lines)
|
|
},
|
|
onSuccess: function(res) {
|
|
set_btn_state('#me-btn-save', true);
|
|
if (res.success) {
|
|
$('#me-modal').modal('hide');
|
|
load_journal_listing();
|
|
} else {
|
|
$('#me-msg').removeClass('d-none').text(res.message || 'Failed to save.');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// ── detail modal ──────────────────────────────────────────────────────────
|
|
var _jl_detail = null; // cache last loaded detail for edit
|
|
|
|
function show_journal_detail(gl_id, doc_number) {
|
|
_jl_detail = null;
|
|
$('#jl-btn-edit').addClass('d-none');
|
|
$('#jl-modal-title').text('Journal Entry — ' + (doc_number || 'GL #' + gl_id));
|
|
$('#jl-modal-body').html('<div class="text-center text-muted py-4"><i class="ti ti-loader ti-spin me-1"></i>Loading…</div>');
|
|
$('#jl-modal').modal('show');
|
|
|
|
var ctx = document.getElementById('session-context');
|
|
ajax_request({
|
|
url: '<?php echo $server_url?>accounting/api/engine/get_journal_detail.php',
|
|
action: 'get',
|
|
queueLock: false,
|
|
noLoading: true,
|
|
data: {
|
|
otp: ctx ? ctx.dataset.otp : '',
|
|
company_id: ctx ? ctx.dataset.companyId : '',
|
|
action: 'get',
|
|
gl_id: gl_id
|
|
},
|
|
onSuccess: function(res) {
|
|
_jl_detail = res.output;
|
|
var h = res.output.header;
|
|
var lines = res.output.lines;
|
|
|
|
if (h.source_type === 'manual') {
|
|
$('#jl-btn-edit').removeClass('d-none');
|
|
}
|
|
|
|
var total_debit = 0;
|
|
var total_credit = 0;
|
|
var lines_html = '';
|
|
|
|
$.each(lines, function(i, l) {
|
|
total_debit += parseFloat(l.debit) || 0;
|
|
total_credit += parseFloat(l.credit) || 0;
|
|
var dept_label = l.dept_code
|
|
? escape_html(l.dept_code + (l.dept_name ? ' - ' + l.dept_name : ''))
|
|
: '<span class="text-muted">—</span>';
|
|
lines_html +=
|
|
'<tr>' +
|
|
'<td class="fw-semibold">' + escape_html(l.account_code) + '</td>' +
|
|
'<td>' + escape_html(l.account_name) + '</td>' +
|
|
'<td>' + dept_label + '</td>' +
|
|
'<td class="text-end">' + (parseFloat(l.debit) ? format_number(l.debit, 2) : '<span class="text-muted">—</span>') + '</td>' +
|
|
'<td class="text-end">' + (parseFloat(l.credit) ? format_number(l.credit, 2) : '<span class="text-muted">—</span>') + '</td>' +
|
|
'<td class="text-muted small">' + escape_html(l.description) + '</td>' +
|
|
'</tr>';
|
|
});
|
|
|
|
lines_html +=
|
|
'<tr class="table-light fw-semibold">' +
|
|
'<td colspan="3">Total</td>' +
|
|
'<td class="text-end">' + format_number(total_debit, 2) + '</td>' +
|
|
'<td class="text-end">' + format_number(total_credit, 2) + '</td>' +
|
|
'<td></td>' +
|
|
'</tr>';
|
|
|
|
var balanced = Math.abs(total_debit - total_credit) < 0.01;
|
|
var balance_indicator = balanced
|
|
? '<span class="badge bg-success-subtle text-success ms-2">Balanced</span>'
|
|
: '<span class="badge bg-danger-subtle text-danger ms-2">Unbalanced</span>';
|
|
|
|
var extra_fields = h.source_type === 'manual'
|
|
? '<div class="col-sm-4"><div class="text-muted small">Reference</div><div class="fw-semibold">' + escape_html(h.reference || ('MJE-' + h.id)) + '</div></div>' +
|
|
'<div class="col-sm-4"><div class="text-muted small">Journal Date</div><div>' + escape_html(h.journal_date_fmt || '—') + '</div></div>' +
|
|
'<div class="col-sm-4"><div class="text-muted small">Description</div><div>' + escape_html(h.description || '—') + '</div></div>'
|
|
: '<div class="col-sm-4"><div class="text-muted small">Formula</div><div>' + escape_html(h.formula_name) + '</div></div>' +
|
|
'<div class="col-sm-4"><div class="text-muted small">Version</div><div>v' + h.current_version + (h.current_version > 1 ? ' <span class="text-muted small">(replaced)</span>' : '') + '</div></div>' +
|
|
'<div class="col-sm-4"></div>';
|
|
|
|
var body =
|
|
'<div class="row g-3 mb-4 text-sm">' +
|
|
'<div class="col-sm-4"><div class="text-muted small">Source</div><div>' + source_badge(h.source_type) + '</div></div>' +
|
|
'<div class="col-sm-4"><div class="text-muted small">Period</div><div class="fw-semibold">' + escape_html(h.period) + '</div></div>' +
|
|
extra_fields +
|
|
'<div class="col-sm-4"><div class="text-muted small">Posted At</div><div class="text-muted small">' + escape_html(h.posted_at) + '</div></div>' +
|
|
'<div class="col-sm-4"><div class="text-muted small">Updated At</div><div class="text-muted small">' + escape_html(h.updated_at_fmt) + '</div></div>' +
|
|
'</div>' +
|
|
'<div class="d-flex align-items-center mb-2">' +
|
|
'<span class="fw-semibold">Journal Lines</span>' + balance_indicator +
|
|
'</div>' +
|
|
'<table class="table table-sm table-hover mb-0 table-centered">' +
|
|
'<thead class="table-light"><tr>' +
|
|
'<th>Account Code</th><th>Account Name</th><th>Department</th>' +
|
|
'<th class="text-end">Debit</th><th class="text-end">Credit</th><th>Description</th>' +
|
|
'</tr></thead>' +
|
|
'<tbody>' + lines_html + '</tbody>' +
|
|
'</table>';
|
|
|
|
$('#jl-modal-body').html(body);
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|