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

Make formatting fixes

This commit is contained in:
Suraj Shetty 2018-07-14 19:56:18 +05:30
parent 2f92899f09
commit 4bc97c0d20
4 changed files with 173 additions and 152 deletions

View File

@ -2,44 +2,43 @@ const frappe = require('frappejs');
const registerReportRoutes = require('../reports/view'); const registerReportRoutes = require('../reports/view');
module.exports = { module.exports = {
start() { start() {
// require modules // require modules
frappe.registerModels(require('../models'), 'client'); frappe.registerModels(require('../models'), 'client');
frappe.registerView('List', 'Customer', require('../models/doctype/Party/CustomerList.js')); frappe.registerView('List', 'Customer', require('../models/doctype/Party/CustomerList.js'));
registerReportRoutes(); registerReportRoutes();
frappe.desk.menu.addItem('ToDo', '#list/ToDo'); frappe.desk.menu.addItem('ToDo', '#list/ToDo');
frappe.desk.menu.addItem('Event', '#list/Event'); frappe.desk.menu.addItem('Event', '#list/Event');
frappe.desk.menu.addItem('Chart of Accounts', '#tree/Account'); frappe.desk.menu.addItem('Chart of Accounts', '#tree/Account');
frappe.desk.menu.addItem('Items', '#list/Item'); frappe.desk.menu.addItem('Items', '#list/Item');
frappe.desk.menu.addItem('Customers', '#list/Customer'); frappe.desk.menu.addItem('Customers', '#list/Customer');
frappe.desk.menu.addItem('Quotation', '#list/Quotation'); frappe.desk.menu.addItem('Quotation', '#list/Quotation');
frappe.desk.menu.addItem('Sales Order', '#list/SalesOrder'); frappe.desk.menu.addItem('Sales Order', '#list/SalesOrder');
frappe.desk.menu.addItem('Fulfillment', '#list/Fulfillment'); frappe.desk.menu.addItem('Fulfillment', '#list/Fulfillment');
frappe.desk.menu.addItem('Invoice', '#list/Invoice'); frappe.desk.menu.addItem('Invoice', '#list/Invoice');
frappe.desk.menu.addItem('Bill', '#list/Bill'); frappe.desk.menu.addItem('Bill', '#list/Bill');
frappe.desk.menu.addItem('Purchase Order', '#list/PurchaseOrder'); frappe.desk.menu.addItem('Purchase Order', '#list/PurchaseOrder');
frappe.desk.menu.addItem('Purchase Receipt', '#list/PurchaseReceipt'); frappe.desk.menu.addItem('Purchase Receipt', '#list/PurchaseReceipt');
frappe.desk.menu.addItem('Journal Entry', '#list/JournalEntry'); frappe.desk.menu.addItem('Journal Entry', '#list/JournalEntry');
frappe.desk.menu.addItem('Address', "#list/Address"); frappe.desk.menu.addItem('Address', '#list/Address');
frappe.desk.menu.addItem('Contact', "#list/Contact"); frappe.desk.menu.addItem('Contact', '#list/Contact');
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings')); frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
// reports // reports
frappe.desk.menu.addItem('General Ledger', '#report/general-ledger'); frappe.desk.menu.addItem('General Ledger', '#report/general-ledger');
frappe.desk.menu.addItem('Profit And Loss', '#report/profit-and-loss'); frappe.desk.menu.addItem('Profit And Loss', '#report/profit-and-loss');
frappe.desk.menu.addItem('Balance Sheet', '#report/balance-sheet'); frappe.desk.menu.addItem('Balance Sheet', '#report/balance-sheet');
frappe.desk.menu.addItem('Trial Balance', '#report/trial-balance'); frappe.desk.menu.addItem('Trial Balance', '#report/trial-balance');
frappe.desk.menu.addItem('Sales Register', '#report/sales-register'); frappe.desk.menu.addItem('Sales Register', '#report/sales-register');
frappe.desk.menu.addItem('Purchase Register', '#report/purchase-register'); frappe.desk.menu.addItem('Purchase Register', '#report/purchase-register');
frappe.desk.menu.addItem('Accounts Receivable', '#report/accounts-receivable'); frappe.desk.menu.addItem('Accounts Receivable', '#report/accounts-receivable');
frappe.desk.menu.addItem('Accounts Payable', '#report/accounts-payable'); frappe.desk.menu.addItem('Accounts Payable', '#report/accounts-payable');
frappe.router.default = '#tree/Account'; frappe.router.default = '#tree/Account';
frappe.router.show(window.location.hash); frappe.router.show(window.location.hash);
}
} };
}

View File

@ -11,78 +11,79 @@ const { slug } = require('frappejs/utils');
const fs = require('fs'); const fs = require('fs');
require.extensions['.html'] = function (module, filename) { require.extensions['.html'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8'); module.exports = fs.readFileSync(filename, 'utf8');
}; };
(async () => { (async () => {
let electronSettings = getSettings(); let electronSettings = getSettings();
let firstRun = false, setupWizardValues = null; let firstRun = false;
let setupWizardValues = null;
if (!electronSettings.dbPath) { if (!electronSettings.dbPath) {
const values = await runSetupWizard(); const values = await runSetupWizard();
const dbPath = path.join(values.file[0].path, slug(values.companyName) + '.db'); const dbPath = path.join(values.file[0].path, slug(values.companyName) + '.db');
const config = { const config = {
directory: path.dirname(dbPath), directory: path.dirname(dbPath),
dbPath: dbPath dbPath: dbPath
}; };
await saveSettings(config); await saveSettings(config);
firstRun = true; firstRun = true;
electronSettings = config; electronSettings = config;
setupWizardValues = values; setupWizardValues = values;
} }
await electron.start({ await electron.start({
dbPath: electronSettings.dbPath, dbPath: electronSettings.dbPath,
models: require('../models') models: require('../models')
}); });
await postStart(); await postStart();
if (firstRun) { if (firstRun) {
await saveSetupWizardValues(setupWizardValues); await saveSetupWizardValues(setupWizardValues);
await bootstrapChartOfAccounts(); await bootstrapChartOfAccounts();
} }
frappe.getPDF = getPDFForElectron; frappe.getPDF = getPDFForElectron;
frappe.electronSettings = electronSettings; frappe.electronSettings = electronSettings;
appClient.start(); appClient.start();
})(); })();
async function runSetupWizard() { async function runSetupWizard() {
const setup = new SetupWizard(); const setup = new SetupWizard();
const values = await setup.start(); const values = await setup.start();
return values; return values;
} }
async function saveSetupWizardValues(values) { async function saveSetupWizardValues(values) {
const { const {
companyName, companyName,
country, country,
name, name,
email, email,
abbreviation, abbreviation,
bankName, bankName,
fiscalYearStart, fiscalYearStart,
fiscalYearEnd fiscalYearEnd
} = values; } = values;
const doc = await frappe.getDoc('AccountingSettings'); const doc = await frappe.getDoc('AccountingSettings');
await doc.set('companyName', companyName); await doc.set('companyName', companyName);
await doc.set('country', country); await doc.set('country', country);
await doc.set('fullname', name); await doc.set('fullname', name);
await doc.set('email', email); await doc.set('email', email);
await doc.set('bankName', bankName); await doc.set('bankName', bankName);
await doc.set('fiscalYearStart', fiscalYearStart); await doc.set('fiscalYearStart', fiscalYearStart);
await doc.set('fiscalYearEnd', fiscalYearEnd); await doc.set('fiscalYearEnd', fiscalYearEnd);
await doc.update(); await doc.update();
} }
async function bootstrapChartOfAccounts() { async function bootstrapChartOfAccounts() {
const importCOA = require('../models/doctype/account/importCOA'); const importCOA = require('../models/doctype/account/importCOA');
const chart = require('../fixtures/standardCOA'); const chart = require('../fixtures/standardCOA');
await importCOA(chart); await importCOA(chart);
} }

View File

@ -2,36 +2,57 @@ const ReportPage = require('frappejs/client/desk/reportpage');
const frappe = require('frappejs'); const frappe = require('frappejs');
module.exports = class GeneralLedgerView extends ReportPage { module.exports = class GeneralLedgerView extends ReportPage {
constructor() { constructor() {
super({ super({
title: frappe._('General Ledger'), title: frappe._('General Ledger'),
filterFields: [ filterFields: [
{fieldtype: 'Select', options: ['', 'Invoice', 'Payment'], {
label: 'Reference Type', fieldname: 'referenceType'}, fieldtype: 'Select',
{fieldtype: 'DynamicLink', references: 'referenceType', options: ['', 'Invoice', 'Payment'],
label: 'Reference Name', fieldname: 'referenceName'}, label: 'Reference Type',
{fieldtype: 'Link', target: 'Account', label: 'Account'}, fieldname: 'referenceType'
{fieldtype: 'Link', target: 'Party', label: 'Party'}, },
{fieldtype: 'Date', label: 'From Date'}, {
{fieldtype: 'Date', label: 'To Date'} fieldtype: 'DynamicLink',
] references: 'referenceType',
}); label: 'Reference Name',
fieldname: 'referenceName'
},
{
fieldtype: 'Link',
target: 'Account',
label: 'Account'
},
{
fieldtype: 'Link',
target: 'Party',
label: 'Party'
},
{
fieldtype: 'Date',
label: 'From Date'
},
{
fieldtype: 'Date',
label: 'To Date'
}
]
});
this.method = 'general-ledger'; this.method = 'general-ledger';
} }
getColumns() {
return [
{label: 'Date', fieldtype: 'Date'},
{label: 'Account', fieldtype: 'Link'},
{label: 'Debit', fieldtype: 'Currency'},
{label: 'Credit', fieldtype: 'Currency'},
{label: 'Balance', fieldtype: 'Currency'},
{label: 'Reference Type', fieldtype: 'Data'},
{label: 'Reference Name', fieldtype: 'Data'},
{label: 'Party', fieldtype: 'Link'},
{label: 'Description', fieldtype: 'Data'},
]
}
}
getColumns() {
return [
{label: 'Date', fieldtype: 'Date'},
{label: 'Account', fieldtype: 'Link'},
{label: 'Debit', fieldtype: 'Currency'},
{label: 'Credit', fieldtype: 'Currency'},
{label: 'Balance', fieldtype: 'Currency'},
{label: 'Reference Type', fieldtype: 'Data'},
{label: 'Reference Name', fieldtype: 'Data'},
{label: 'Party', fieldtype: 'Link'},
{label: 'Description', fieldtype: 'Data'}
];
}
};

View File

@ -1,36 +1,36 @@
const title = 'General Ledger'; const title = 'General Ledger';
module.exports = { module.exports = {
title: title, title: title,
method: 'general-ledger', method: 'general-ledger',
filterFields: [ filterFields: [
{ {
fieldtype: 'Select', fieldtype: 'Select',
options: ['', 'Invoice', 'Payment'], options: ['', 'Invoice', 'Payment'],
label: 'Reference Type', label: 'Reference Type',
fieldname: 'referenceType' fieldname: 'referenceType'
}, },
{ {
fieldtype: 'DynamicLink', fieldtype: 'DynamicLink',
references: 'referenceType', references: 'referenceType',
label: 'Reference Name', label: 'Reference Name',
fieldname: 'referenceName' fieldname: 'referenceName'
}, },
{ fieldtype: 'Link', target: 'Account', label: 'Account', fieldname: 'account' }, { fieldtype: 'Link', target: 'Account', label: 'Account', fieldname: 'account' },
{ fieldtype: 'Link', target: 'Party', label: 'Party', fieldname: 'party' }, { fieldtype: 'Link', target: 'Party', label: 'Party', fieldname: 'party' },
{ fieldtype: 'Date', label: 'From Date', fieldname: 'fromDate' }, { fieldtype: 'Date', label: 'From Date', fieldname: 'fromDate' },
{ fieldtype: 'Date', label: 'To Date', fieldname: 'toDate' } { fieldtype: 'Date', label: 'To Date', fieldname: 'toDate' }
], ],
getColumns() { getColumns() {
return [ return [
{ label: 'Date', fieldtype: 'Date' }, { label: 'Date', fieldtype: 'Date' },
{ label: 'Account', fieldtype: 'Link' }, { label: 'Account', fieldtype: 'Link' },
{ label: 'Debit', fieldtype: 'Currency' }, { label: 'Debit', fieldtype: 'Currency' },
{ label: 'Credit', fieldtype: 'Currency' }, { label: 'Credit', fieldtype: 'Currency' },
{ label: 'Balance', fieldtype: 'Currency' }, { label: 'Balance', fieldtype: 'Currency' },
{ label: 'Reference Type', fieldtype: 'Data' }, { label: 'Reference Type', fieldtype: 'Data' },
{ label: 'Reference Name', fieldtype: 'Data' }, { label: 'Reference Name', fieldtype: 'Data' },
{ label: 'Party', fieldtype: 'Link' }, { label: 'Party', fieldtype: 'Link' },
{ label: 'Description', fieldtype: 'Data' } { label: 'Description', fieldtype: 'Data' }
] ];
} }
} };