2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

Add viewConfig for PnL and TB

This commit is contained in:
Faris Ansari 2018-10-26 02:27:34 +05:30
parent edd9f35756
commit 163a25529b
4 changed files with 64 additions and 3 deletions

View File

@ -0,0 +1,31 @@
const title = 'Profit and Loss';
module.exports = {
title: title,
method: 'profit-and-loss',
filterFields: [
{ fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1 },
{ fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1 },
{
fieldtype: 'Select', options: ['Monthly', 'Quarterly', 'Half Yearly', 'Yearly'],
label: 'Periodicity', fieldname: 'periodicity', default: 'Monthly'
}
],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 340 }
];
if (data && data.columns) {
const currencyColumns = data.columns;
const columnDefs = currencyColumns.map(name => ({
label: name,
fieldname: name,
fieldtype: 'Currency'
}));
columns.push(...columnDefs);
}
return columns;
}
};

View File

@ -0,0 +1,22 @@
const title = 'Trial Balance';
module.exports = {
title: title,
method: 'trial-balance',
filterFields: [
{ fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1 },
{ fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1 }
],
getColumns(data) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 340 },
{ label: 'Opening (Dr)', fieldtype: 'Currency', fieldname: 'openingDebit' },
{ label: 'Opening (Cr)', fieldtype: 'Currency', fieldname: 'openingCredit' },
{ label: 'Debit', fieldtype: 'Currency', fieldname: 'debit' },
{ label: 'Credit', fieldtype: 'Currency', fieldname: 'credit' },
{ label: 'Closing (Dr)', fieldtype: 'Currency', fieldname: 'closingDebit' },
{ label: 'Closing (Cr)', fieldtype: 'Currency', fieldname: 'closingCredit' }
];
return columns;
}
};

View File

@ -1,4 +1,6 @@
module.exports = {
'general-ledger': require('./GeneralLedger/viewConfig'),
'sales-register': require('./SalesRegister/viewConfig')
'sales-register': require('./SalesRegister/viewConfig'),
'profit-and-loss': require('./ProfitAndLoss/viewConfig'),
'trial-balance': require('./TrialBalance/viewConfig')
}

View File

@ -9,16 +9,22 @@
description="List of all ledger entries booked against all accounts"
@click="routeTo('general-ledger', { 'referenceType': 'Invoice' })"
/>
<clickable-card
class="mt-2"
title="Profit and Loss"
description="Profit and Loss statement"
@click="routeTo('profit-and-loss')"
/>
<clickable-card
class="mt-2"
title="Trial Balance"
description="Balance of accounts"
description="Trial Balance"
@click="routeTo('trial-balance')"
/>
<clickable-card
class="mt-2"
title="Sales Register"
description="Sales"
description="Sales transactions for a given period with invoiced amount and tax details"
@click="routeTo('sales-register')"
/>
</div>