accounting workflows
This commit is contained in:
@@ -122,6 +122,7 @@
|
||||
<th>Code</th>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Category</th>
|
||||
<th>Level</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
@@ -154,6 +155,19 @@
|
||||
expense: '<span class="badge bg-warning bg-opacity-10 text-warning">Expense</span>',
|
||||
};
|
||||
|
||||
var category_labels = {
|
||||
ar: 'Account Receivable',
|
||||
ap: 'Account Payable',
|
||||
sales_tax: 'Sales Tax',
|
||||
purchase_tax: 'Purchase Tax',
|
||||
};
|
||||
|
||||
function category_badge(cat) {
|
||||
if (!cat) return '<span class="text-muted small">—</span>';
|
||||
var label = category_labels[cat] || cat;
|
||||
return '<span class="badge bg-secondary bg-opacity-10 text-secondary">' + escape_html(label) + '</span>';
|
||||
}
|
||||
|
||||
var level_badge = {
|
||||
item: '<span class="badge bg-primary">Item</span>',
|
||||
parent: '<span class="badge bg-secondary">Parent</span>',
|
||||
@@ -166,8 +180,8 @@
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
onSuccess: function(res) {
|
||||
alasql('CREATE TABLE IF NOT EXISTS ac_account');
|
||||
alasql.tables.ac_account.data = res.output || [];
|
||||
alasql('CREATE TABLE IF NOT EXISTS md_account');
|
||||
alasql.tables.md_account.data = res.output || [];
|
||||
change_page(1);
|
||||
}
|
||||
});
|
||||
@@ -182,14 +196,14 @@
|
||||
if (active_type) conditions.push(`account_type = '${active_type}'`);
|
||||
|
||||
var where = conditions.length ? 'WHERE ' + conditions.join(' AND ') : '';
|
||||
var filtered = alasql(`SELECT * FROM ac_account ${where} ORDER BY account_code`);
|
||||
var filtered = alasql(`SELECT * FROM md_account ${where} ORDER BY account_code`);
|
||||
|
||||
var page = generate_pagination('ac_account', filtered.length);
|
||||
var page = generate_pagination('account_table', filtered.length);
|
||||
$('table#account_table tfoot').html(page);
|
||||
|
||||
if (filtered.length === 0) {
|
||||
$('table#account_table tbody').html(
|
||||
'<tr><td colspan="7" class="text-center py-5 text-muted">No accounts found.</td></tr>'
|
||||
'<tr><td colspan="8" class="text-center py-5 text-muted">No accounts found.</td></tr>'
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -204,6 +218,7 @@
|
||||
<td class="py-3 fw-semibold ${indent}">${prefix}${escape_html(item.account_code)}</td>
|
||||
<td class="py-3">${escape_html(item.account_name)}</td>
|
||||
<td class="py-3">${type_badge[item.account_type] || item.account_type}</td>
|
||||
<td class="py-3">${category_badge(item.account_category)}</td>
|
||||
<td class="py-3">${is_item ? level_badge.item : level_badge.parent}</td>
|
||||
<td class="py-3">${item.status ? '<span class="badge bg-success">Active</span>' : '<span class="badge bg-secondary">Inactive</span>'}</td>
|
||||
<td class="py-3">
|
||||
|
||||
Reference in New Issue
Block a user