From 4bc97c0d20b63cfaef3bfbf62952dddb8fec81a5 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sat, 14 Jul 2018 19:56:18 +0530 Subject: [PATCH] Make formatting fixes --- client/index.js | 69 +++++++------- electron/client.js | 105 +++++++++++---------- reports/GeneralLedger/GeneralLedgerView.js | 83 ++++++++++------ reports/GeneralLedger/viewConfig.js | 68 ++++++------- 4 files changed, 173 insertions(+), 152 deletions(-) diff --git a/client/index.js b/client/index.js index e269e4e0..8d9dffac 100644 --- a/client/index.js +++ b/client/index.js @@ -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); - - } -} \ No newline at end of file + frappe.router.show(window.location.hash); + } +}; diff --git a/electron/client.js b/electron/client.js index ee11a4c0..2b2f3243 100644 --- a/electron/client.js +++ b/electron/client.js @@ -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); } diff --git a/reports/GeneralLedger/GeneralLedgerView.js b/reports/GeneralLedger/GeneralLedgerView.js index 3d6564b7..0fd85946 100644 --- a/reports/GeneralLedger/GeneralLedgerView.js +++ b/reports/GeneralLedger/GeneralLedgerView.js @@ -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'} + ]; + } +}; diff --git a/reports/GeneralLedger/viewConfig.js b/reports/GeneralLedger/viewConfig.js index bab2513f..38c41764 100644 --- a/reports/GeneralLedger/viewConfig.js +++ b/reports/GeneralLedger/viewConfig.js @@ -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' } + ]; + } +};