mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
Make formatting fixes
This commit is contained in:
parent
2f92899f09
commit
4bc97c0d20
@ -2,44 +2,43 @@ const frappe = require('frappejs');
|
||||
const registerReportRoutes = require('../reports/view');
|
||||
|
||||
module.exports = {
|
||||
start() {
|
||||
// require modules
|
||||
frappe.registerModels(require('../models'), 'client');
|
||||
start() {
|
||||
// require modules
|
||||
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('Event', '#list/Event');
|
||||
frappe.desk.menu.addItem('Chart of Accounts', '#tree/Account');
|
||||
frappe.desk.menu.addItem('Items', '#list/Item');
|
||||
frappe.desk.menu.addItem('Customers', '#list/Customer');
|
||||
frappe.desk.menu.addItem('Quotation', '#list/Quotation');
|
||||
frappe.desk.menu.addItem('Sales Order', '#list/SalesOrder');
|
||||
frappe.desk.menu.addItem('Fulfillment', '#list/Fulfillment');
|
||||
frappe.desk.menu.addItem('Invoice', '#list/Invoice');
|
||||
frappe.desk.menu.addItem('Bill', '#list/Bill');
|
||||
frappe.desk.menu.addItem('Purchase Order', '#list/PurchaseOrder');
|
||||
frappe.desk.menu.addItem('Purchase Receipt', '#list/PurchaseReceipt');
|
||||
frappe.desk.menu.addItem('Journal Entry', '#list/JournalEntry');
|
||||
frappe.desk.menu.addItem('Address', "#list/Address");
|
||||
frappe.desk.menu.addItem('Contact', "#list/Contact");
|
||||
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
|
||||
frappe.desk.menu.addItem('ToDo', '#list/ToDo');
|
||||
frappe.desk.menu.addItem('Event', '#list/Event');
|
||||
frappe.desk.menu.addItem('Chart of Accounts', '#tree/Account');
|
||||
frappe.desk.menu.addItem('Items', '#list/Item');
|
||||
frappe.desk.menu.addItem('Customers', '#list/Customer');
|
||||
frappe.desk.menu.addItem('Quotation', '#list/Quotation');
|
||||
frappe.desk.menu.addItem('Sales Order', '#list/SalesOrder');
|
||||
frappe.desk.menu.addItem('Fulfillment', '#list/Fulfillment');
|
||||
frappe.desk.menu.addItem('Invoice', '#list/Invoice');
|
||||
frappe.desk.menu.addItem('Bill', '#list/Bill');
|
||||
frappe.desk.menu.addItem('Purchase Order', '#list/PurchaseOrder');
|
||||
frappe.desk.menu.addItem('Purchase Receipt', '#list/PurchaseReceipt');
|
||||
frappe.desk.menu.addItem('Journal Entry', '#list/JournalEntry');
|
||||
frappe.desk.menu.addItem('Address', '#list/Address');
|
||||
frappe.desk.menu.addItem('Contact', '#list/Contact');
|
||||
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
|
||||
|
||||
// reports
|
||||
frappe.desk.menu.addItem('General Ledger', '#report/general-ledger');
|
||||
frappe.desk.menu.addItem('Profit And Loss', '#report/profit-and-loss');
|
||||
frappe.desk.menu.addItem('Balance Sheet', '#report/balance-sheet');
|
||||
frappe.desk.menu.addItem('Trial Balance', '#report/trial-balance');
|
||||
frappe.desk.menu.addItem('Sales Register', '#report/sales-register');
|
||||
frappe.desk.menu.addItem('Purchase Register', '#report/purchase-register');
|
||||
frappe.desk.menu.addItem('Accounts Receivable', '#report/accounts-receivable');
|
||||
frappe.desk.menu.addItem('Accounts Payable', '#report/accounts-payable');
|
||||
// reports
|
||||
frappe.desk.menu.addItem('General Ledger', '#report/general-ledger');
|
||||
frappe.desk.menu.addItem('Profit And Loss', '#report/profit-and-loss');
|
||||
frappe.desk.menu.addItem('Balance Sheet', '#report/balance-sheet');
|
||||
frappe.desk.menu.addItem('Trial Balance', '#report/trial-balance');
|
||||
frappe.desk.menu.addItem('Sales Register', '#report/sales-register');
|
||||
frappe.desk.menu.addItem('Purchase Register', '#report/purchase-register');
|
||||
frappe.desk.menu.addItem('Accounts Receivable', '#report/accounts-receivable');
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
@ -11,78 +11,79 @@ const { slug } = require('frappejs/utils');
|
||||
const fs = require('fs');
|
||||
|
||||
require.extensions['.html'] = function (module, filename) {
|
||||
module.exports = fs.readFileSync(filename, 'utf8');
|
||||
module.exports = fs.readFileSync(filename, 'utf8');
|
||||
};
|
||||
|
||||
(async () => {
|
||||
let electronSettings = getSettings();
|
||||
let firstRun = false, setupWizardValues = null;
|
||||
let electronSettings = getSettings();
|
||||
let firstRun = false;
|
||||
let setupWizardValues = null;
|
||||
|
||||
if (!electronSettings.dbPath) {
|
||||
const values = await runSetupWizard();
|
||||
const dbPath = path.join(values.file[0].path, slug(values.companyName) + '.db');
|
||||
const config = {
|
||||
directory: path.dirname(dbPath),
|
||||
dbPath: dbPath
|
||||
};
|
||||
await saveSettings(config);
|
||||
if (!electronSettings.dbPath) {
|
||||
const values = await runSetupWizard();
|
||||
const dbPath = path.join(values.file[0].path, slug(values.companyName) + '.db');
|
||||
const config = {
|
||||
directory: path.dirname(dbPath),
|
||||
dbPath: dbPath
|
||||
};
|
||||
await saveSettings(config);
|
||||
|
||||
firstRun = true;
|
||||
electronSettings = config;
|
||||
setupWizardValues = values;
|
||||
}
|
||||
firstRun = true;
|
||||
electronSettings = config;
|
||||
setupWizardValues = values;
|
||||
}
|
||||
|
||||
await electron.start({
|
||||
dbPath: electronSettings.dbPath,
|
||||
models: require('../models')
|
||||
});
|
||||
await electron.start({
|
||||
dbPath: electronSettings.dbPath,
|
||||
models: require('../models')
|
||||
});
|
||||
|
||||
await postStart();
|
||||
await postStart();
|
||||
|
||||
if (firstRun) {
|
||||
await saveSetupWizardValues(setupWizardValues);
|
||||
await bootstrapChartOfAccounts();
|
||||
}
|
||||
if (firstRun) {
|
||||
await saveSetupWizardValues(setupWizardValues);
|
||||
await bootstrapChartOfAccounts();
|
||||
}
|
||||
|
||||
frappe.getPDF = getPDFForElectron;
|
||||
frappe.electronSettings = electronSettings;
|
||||
frappe.getPDF = getPDFForElectron;
|
||||
frappe.electronSettings = electronSettings;
|
||||
|
||||
appClient.start();
|
||||
appClient.start();
|
||||
})();
|
||||
|
||||
async function runSetupWizard() {
|
||||
const setup = new SetupWizard();
|
||||
const values = await setup.start();
|
||||
return values;
|
||||
const setup = new SetupWizard();
|
||||
const values = await setup.start();
|
||||
return values;
|
||||
}
|
||||
|
||||
async function saveSetupWizardValues(values) {
|
||||
const {
|
||||
companyName,
|
||||
country,
|
||||
name,
|
||||
email,
|
||||
abbreviation,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
} = values;
|
||||
const {
|
||||
companyName,
|
||||
country,
|
||||
name,
|
||||
email,
|
||||
abbreviation,
|
||||
bankName,
|
||||
fiscalYearStart,
|
||||
fiscalYearEnd
|
||||
} = values;
|
||||
|
||||
const doc = await frappe.getDoc('AccountingSettings');
|
||||
const doc = await frappe.getDoc('AccountingSettings');
|
||||
|
||||
await doc.set('companyName', companyName);
|
||||
await doc.set('country', country);
|
||||
await doc.set('fullname', name);
|
||||
await doc.set('email', email);
|
||||
await doc.set('bankName', bankName);
|
||||
await doc.set('fiscalYearStart', fiscalYearStart);
|
||||
await doc.set('fiscalYearEnd', fiscalYearEnd);
|
||||
await doc.set('companyName', companyName);
|
||||
await doc.set('country', country);
|
||||
await doc.set('fullname', name);
|
||||
await doc.set('email', email);
|
||||
await doc.set('bankName', bankName);
|
||||
await doc.set('fiscalYearStart', fiscalYearStart);
|
||||
await doc.set('fiscalYearEnd', fiscalYearEnd);
|
||||
|
||||
await doc.update();
|
||||
await doc.update();
|
||||
}
|
||||
|
||||
async function bootstrapChartOfAccounts() {
|
||||
const importCOA = require('../models/doctype/account/importCOA');
|
||||
const chart = require('../fixtures/standardCOA');
|
||||
await importCOA(chart);
|
||||
const importCOA = require('../models/doctype/account/importCOA');
|
||||
const chart = require('../fixtures/standardCOA');
|
||||
await importCOA(chart);
|
||||
}
|
||||
|
@ -2,36 +2,57 @@ const ReportPage = require('frappejs/client/desk/reportpage');
|
||||
const frappe = require('frappejs');
|
||||
|
||||
module.exports = class GeneralLedgerView extends ReportPage {
|
||||
constructor() {
|
||||
super({
|
||||
title: frappe._('General Ledger'),
|
||||
filterFields: [
|
||||
{fieldtype: 'Select', options: ['', 'Invoice', 'Payment'],
|
||||
label: 'Reference Type', fieldname: 'referenceType'},
|
||||
{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'}
|
||||
]
|
||||
});
|
||||
constructor() {
|
||||
super({
|
||||
title: frappe._('General Ledger'),
|
||||
filterFields: [
|
||||
{
|
||||
fieldtype: 'Select',
|
||||
options: ['', 'Invoice', 'Payment'],
|
||||
label: 'Reference Type',
|
||||
fieldname: 'referenceType'
|
||||
},
|
||||
{
|
||||
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';
|
||||
}
|
||||
|
||||
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'},
|
||||
]
|
||||
}
|
||||
}
|
||||
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'}
|
||||
];
|
||||
}
|
||||
};
|
||||
|
@ -1,36 +1,36 @@
|
||||
const title = 'General Ledger';
|
||||
module.exports = {
|
||||
title: title,
|
||||
method: 'general-ledger',
|
||||
filterFields: [
|
||||
{
|
||||
fieldtype: 'Select',
|
||||
options: ['', 'Invoice', 'Payment'],
|
||||
label: 'Reference Type',
|
||||
fieldname: 'referenceType'
|
||||
},
|
||||
{
|
||||
fieldtype: 'DynamicLink',
|
||||
references: 'referenceType',
|
||||
label: 'Reference Name',
|
||||
fieldname: 'referenceName'
|
||||
},
|
||||
{ fieldtype: 'Link', target: 'Account', label: 'Account', fieldname: 'account' },
|
||||
{ fieldtype: 'Link', target: 'Party', label: 'Party', fieldname: 'party' },
|
||||
{ fieldtype: 'Date', label: 'From Date', fieldname: 'fromDate' },
|
||||
{ fieldtype: 'Date', label: 'To Date', fieldname: 'toDate' }
|
||||
],
|
||||
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' }
|
||||
]
|
||||
}
|
||||
}
|
||||
title: title,
|
||||
method: 'general-ledger',
|
||||
filterFields: [
|
||||
{
|
||||
fieldtype: 'Select',
|
||||
options: ['', 'Invoice', 'Payment'],
|
||||
label: 'Reference Type',
|
||||
fieldname: 'referenceType'
|
||||
},
|
||||
{
|
||||
fieldtype: 'DynamicLink',
|
||||
references: 'referenceType',
|
||||
label: 'Reference Name',
|
||||
fieldname: 'referenceName'
|
||||
},
|
||||
{ fieldtype: 'Link', target: 'Account', label: 'Account', fieldname: 'account' },
|
||||
{ fieldtype: 'Link', target: 'Party', label: 'Party', fieldname: 'party' },
|
||||
{ fieldtype: 'Date', label: 'From Date', fieldname: 'fromDate' },
|
||||
{ fieldtype: 'Date', label: 'To Date', fieldname: 'toDate' }
|
||||
],
|
||||
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' }
|
||||
];
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user