Skip to content

Commit

Permalink
Optional requirement for cost center in trial balance
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Dec 4, 2021
1 parent 21b26d3 commit 1ac9813
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 11 deletions.
Binary file modified client/src/assets/IMAicon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/src/assets/favicon.ico
Binary file not shown.
Binary file modified client/src/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions client/src/i18n/en/enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"ENABLE_BARCODES_HELP_TEXT" : "Enable to place barcodes on most printed records and enable options to scan barcodes for document inputs.",
"ENABLE_AUTO_EMAIL_REPORT_LABEL" : "Enable sending automatic reports by email",
"ENABLE_AUTO_EMAIL_REPORT_HELP_TEXT" : "Enabling this option allows users to configure schedules to automatically send reports to a list of email addresses.",
"ENABLE_REQUIRE_COST_CENTER_FOR_POSTING" : "Enable cost centers requirement for posting to general ledger",
"ENABLE_REQUIRE_COST_CENTER_FOR_POSTING_HELP_TEXT" : "Require cost centers for operating accounts (6 and 7) before posting entries in the general ledger",
"ENABLE_INDEX_PAYMENT_SYSTEM" : "Enabling index payment system",
"HELPDESK_TEXT" : "Helpdesk Contact Information",
"HELPDESK_TEXT_HELP" : "If provided, show this information about how to contact the help desk on the bottom of the login page"
Expand Down
2 changes: 2 additions & 0 deletions client/src/i18n/fr/enterprise.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"ENABLE_BARCODES_HELP_TEXT" : "L'activation de cette fonction placera des codes à barres sur la plupart des enregistrements imprimés et activera les options permettant de numériser des codes à barres pour les entrées de document.",
"ENABLE_AUTO_EMAIL_REPORT_LABEL" : "Activer l'envoie des rapports automatiques par email",
"ENABLE_AUTO_EMAIL_REPORT_HELP_TEXT" : "L'activation de cette option permet aux utilisateurs de configurer des planifications pour envoyer automatiquement des rapports à une liste d'adresses électroniques.",
"ENABLE_REQUIRE_COST_CENTER_FOR_POSTING" : "Activer l'exigence des centres de cout pour le postage dans le grand livre",
"ENABLE_REQUIRE_COST_CENTER_FOR_POSTING_HELP_TEXT" : "Exiger les centres de cout pour les comptes d'exploitation (6 et 7) avant de poster les ecritures dans le grand livre",
"ENABLE_INDEX_PAYMENT_SYSTEM" : "Activer le systeme de payement par indice",
"HELPDESK_TEXT" : "Coordonnées du service d'assistance",
"HELPDESK_TEXT_HELP" : "Si défini, affichez ces informations sur la façon de contacter le service d'assistance en bas de la page de connexion"
Expand Down
8 changes: 8 additions & 0 deletions client/src/modules/enterprises/enterprises.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@
help-text="ENTERPRISE.SETTINGS.ENABLE_AUTO_EMAIL_REPORT_HELP_TEXT"
on-change-callback="EnterpriseCtrl.enableAutoEmailReportSetting(value)">
</bh-yes-no-radios>

<bh-yes-no-radios
label="ENTERPRISE.SETTINGS.ENABLE_REQUIRE_COST_CENTER_FOR_POSTING"
value="EnterpriseCtrl.enterprise.settings.enable_require_cost_center_for_posting"
name="enable_require_cost_center_for_posting"
help-text="ENTERPRISE.SETTINGS.ENABLE_REQUIRE_COST_CENTER_FOR_POSTING_HELP_TEXT"
on-change-callback="EnterpriseCtrl.enableRequireCostCenterForPostingSetting(value)">
</bh-yes-no-radios>
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions client/src/modules/enterprises/enterprises.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ function EnterpriseController(Enterprises, util, Notify, Projects, Modal, Scroll
vm.enableBalanceOnInvoiceReceipSetting = proxy('enable_balance_on_invoice_receipt');
vm.enableBarcodesSetting = proxy('enable_barcodes');
vm.enableAutoEmailReportSetting = proxy('enable_auto_email_report');
vm.enableRequireCostCenterForPostingSetting = proxy('enable_require_cost_center_for_posting');

startup();
}
6 changes: 0 additions & 6 deletions client/src/modules/journal/trial-balance/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ function TrialBalanceErrorsController(TrialBalance, Notify, $state) {
// FIXME(@jniles): why doesn't ui-sref work here?
vm.goToOverviewView = () => $state.go('TrialBalanceOverview');

// links the errors to the posting journal via their record uuid
const link = `<div class="ui-grid-cell-contents">
<bh-journal-link record-uuid="row.entity.record_uuid" display="{{row.entity.trans_id}}"></bh-journal-link>
</div>`;

const columns = [{
field : 'code',
displayName : 'TABLE.COLUMNS.ERROR_TYPE',
Expand All @@ -37,7 +32,6 @@ function TrialBalanceErrorsController(TrialBalance, Notify, $state) {
headerCellClass : 'ui-grid-header-cell-error',
}];


vm.gridOptions = {
appScopeProvider : vm,
enableColumnMenus : false,
Expand Down
3 changes: 2 additions & 1 deletion server/controllers/admin/enterprises.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports.list = function list(req, res, next) {
gain_account_id, loss_account_id, enable_price_lock, enable_prepayments,
enable_password_validation, enable_balance_on_invoice_receipt, enable_barcodes,
enable_auto_email_report, enable_index_payment_system, base_index_growth_rate,
posting_payroll_cost_center_mode
posting_payroll_cost_center_mode, enable_require_cost_center_for_posting
FROM enterprise LEFT JOIN enterprise_setting
ON enterprise.id = enterprise_setting.enterprise_id
;`;
Expand All @@ -51,6 +51,7 @@ exports.list = function list(req, res, next) {
'enable_index_payment_system',
'base_index_growth_rate',
'posting_payroll_cost_center_mode',
'enable_require_cost_center_for_posting',
];

row.settings = _.pick(row, settings);
Expand Down
2 changes: 0 additions & 2 deletions server/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
* This controller is responsible for managing user authentication and
* authorization to the entire application stack.
*
* @requires q
* @requires lodash
* @requires debug
* @requires lib/db
* @requires lib/errors/Unauthorized
*/

const _ = require('lodash');
const q = require('q');
const debug = require('debug')('app');
const db = require('../lib/db');
const Unauthorized = require('../lib/errors/Unauthorized');
Expand Down
10 changes: 8 additions & 2 deletions server/models/migrations/next/migrate.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Migration file from v1.21.1
*/
* Migration file from v1.21.4
*/

/*
* @author: mbayopanda
* @date: 2021-12-04
*/
CALL add_column_if_missing('enterprise_setting', 'enable_require_cost_center_for_posting', 'TINYINT(1) NOT NULL DEFAULT 0 AFTER `posting_payroll_cost_center_mode`');
6 changes: 6 additions & 0 deletions server/models/procedures/trial_balance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ BEGIN
FROM posting_journal AS pj
JOIN stage_trial_balance_transaction AS temp ON pj.record_uuid = temp.record_uuid
JOIN account a ON pj.account_id = a.id
JOIN project proj ON proj.id = pj.project_id
JOIN enterprise e ON e.id = proj.enterprise_id
JOIN enterprise_setting es ON es.enterprise_id = e.id AND es.enable_require_cost_center_for_posting = 1
WHERE a.type_id IN (income_account_id, expense_account_id) AND pj.cost_center_id IS NULL
GROUP BY pj.record_uuid;

Expand All @@ -135,6 +138,9 @@ BEGIN
FROM posting_journal AS pj
JOIN stage_trial_balance_transaction AS temp ON pj.record_uuid = temp.record_uuid
JOIN account a ON pj.account_id = a.id
JOIN project proj ON proj.id = pj.project_id
JOIN enterprise e ON e.id = proj.enterprise_id
JOIN enterprise_setting es ON es.enterprise_id = e.id AND es.enable_require_cost_center_for_posting = 1
WHERE a.type_id NOT IN (income_account_id, expense_account_id) AND pj.cost_center_id IS NOT NULL
GROUP BY pj.record_uuid;

Expand Down
1 change: 1 addition & 0 deletions server/models/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ CREATE TABLE `enterprise_setting` (
`enable_index_payment_system` TINYINT(1) NOT NULL DEFAULT 0,
`base_index_growth_rate` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
`posting_payroll_cost_center_mode` VARCHAR(100) NOT NULL DEFAULT 'default', -- With this function, transactions related to employee payment are done in bulk and require that each expense account be linked to a cost center
`enable_require_cost_center_for_posting` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`enterprise_id`),
CONSTRAINT `enterprise_setting__enterprise` FOREIGN KEY (`enterprise_id`) REFERENCES `enterprise` (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci;
Expand Down

0 comments on commit 1ac9813

Please sign in to comment.