Skip to content

Commit

Permalink
Added budget module
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcameron committed Nov 22, 2023
1 parent 5651736 commit 57f1b23
Show file tree
Hide file tree
Showing 66 changed files with 3,872 additions and 158 deletions.
1 change: 1 addition & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ blocks:
- npx playwright install
- 'yarn build:db'
- yarn build
- mkdir results
- 'yarn test:server-unit'
- 'yarn test:client-unit'
- 'yarn test:integration'
Expand Down
64 changes: 63 additions & 1 deletion client/src/css/structure.css
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ li.selected {
border-left-color : #2089CE;
}

.marginTop1ex {
margin-top: 1ex;
}

/**
* Temporary header breadcrumb bootstrap fork
* @todo implement this in less using the bootstrap element
Expand Down Expand Up @@ -1301,4 +1305,62 @@ form.NoSubmitButton div.modal-footer button.btn-primary {
.lots-modal-grid {
min-height: calc(320px);
}
/* -------------------- end lots modal grid ---------------- */
/* -------------------- end lots modal grid ---------------- */

/* -------------------- budget -------------------- */

.budget-title {
font-weight : bold;
}

.budget-income {
color: #007F00;
}

.budget-expense {
color: #7F0000;
}

.budget-total-expenses {
font-weight: bold;
background-color: #ffafaf;
}

.budget-total-expenses-large {
font-weight: bold;
font-size: 120%;
text-transform: uppercase;
background-color: #ffafaf;
}

.budget-total-income {
font-weight: bold;
background-color: #afffaf;
}

.budget-total-income-large {
font-weight: bold;
font-size: 120%;
text-transform: uppercase;
background-color: #afffaf;
}


.budget-total-summary {
font-weight: bold;
background-color: #cfcfcf;
}

.budget-total-summary-large {
font-weight: bold;
font-size: 120%;
text-transform: uppercase;
background-color: #cfcfcf;
}

.budget-edit-td {
padding-bottom: 0 !important;
vertical-align: middle !important;
}

/* -------------------- end budget -------------------- */
74 changes: 74 additions & 0 deletions client/src/i18n/en/budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"BUDGET": {
"TITLE": "Budget",
"ACTUALS_SUBTITLE": "(actuals)",
"BUDGET_SUBTITLE": "(budget)",
"BUDGET_YTD": "Budget (YTD)",
"BUDGET_YTD_COLUMN": "Budget",
"BUDGET_YTD_SUBTITLE": "(YTD)",
"BUDGET_YTD_TOOLTIP": "Budget totals for the year to date",
"EXPENSES_TOTAL": "Expenses Total",
"DEVIATION_YTD": "Deviation % (YTD)",
"DEVIATION_YTD_TOOLTIP": "Deviation % (YTD) = 100*(actuals_YTD/budget_YTD)",
"DIFFERENCE_YTD": "Difference (YTD)",
"DIFFERENCE_YTD_TOOLTIP": "Difference = Actuals - Budget",
"FY_ACTUALS": "FY Actuals (YTD)",
"FY_BUDGET": "FY Budget",
"FY_DEVIATION": "FY % Deviation",
"EXPORT_BUDGET": "Export Budget to CSV file",
"IMPORT_BUDGET": "Import Budget CSV file",
"IMPORT_BUDGET_BAD_HEADERS": "ERROR: Budget import failed! Check for missing or misspelled column header names. Expected: AcctNum, Label, Type, Budget, BudgetLastYear.",
"IMPORT_BUDGET_ERROR": "ERROR: Budget import failed! Check for missing or invalid data or incorrect Type values (should be 'title', 'income', or 'expense').",
"IMPORT_BUDGET_ERROR_ACCT_NUM": "ERROR: Budget import failed! Account number is not an integer.",
"IMPORT_BUDGET_ERROR_ACCT_TYPE": "ERROR: Budget import failed! Check for incorrect Type values (should be 'title', 'income', or 'expense').",
"IMPORT_BUDGET_ERROR_ACCT_TYPE_INCORRECT": "ERROR: Budget import failed! Account type does not match account in the database.",
"IMPORT_BUDGET_ERROR_BAD_BUDGET_VALUE": "ERROR: Budget import failed! Budget value is not a number.",
"IMPORT_BUDGET_ERROR_NEGATIVE_BUDGET_VALUE": "ERROR: Budget import failed! Budget value is negative.",
"IMPORT_BUDGET_WARN_TITLE_BUDGET_IGNORED": "WARNING: Budget values for title accounts are ignored",
"INCOME_TOTAL": "Income Total",
"TOTAL_SUMMARY": "Total Summary (Income - Expenses)",
"ACTUALS": {
"JANUARY": "January Actuals",
"FEBRUARY": "February Actuals",
"MARCH": "March Actuals",
"APRIL": "April Actuals",
"MAY": "May Actuals",
"JUNE": "June Actuals",
"JULY": "July Actuals",
"AUGUST": "August Actuals",
"SEPTEMBER": "September Actuals",
"OCTOBER": "October Actuals",
"NOVEMBER": "November Actuals",
"DECEMBER": "December Actuals"
},
"EDIT_ACCOUNT_BUDGET": {
"ACTION": "Edit Monthly Budgets",
"BUDGET_COLUMN_LABEL": "Budget ({{currencySymbol}})",
"ERROR_NEW_BUDGET_TOO_HIGH": "ERROR: Tne locked budget amounts exceed the available budget for the account!",
"DESCRIPTION": "Edit the budget for each month for this account.",
"DESCRIPTION_NOTE": "NOTE: Locking the budget for a month will distribute the balance of the budget evenly among the unlocked months.",
"LOCK": "Lock",
"TITLE": "Edit account: {{acctNum}} - {{acctLabel}}"
},
"EXPORT": {
"DATA_CSV": "Export YTD Budget Data (CSV)",
"DESCRIPTION": "Export account data to CSV file",
"EXCEL": "Export YTD Budget Data (Excel)",
"MODAL_BREADCRUMB": "Export Sample Budget Data",
"NO_ACCT_BALANCE_DATA_FOR_FY": "No accounts balance data found for {{fyName}}!",
"REPORT_FILENAME": "{{fyName}} Budget Report",
"REPORT_PDF": "Export YTD Report (PDF)",
"REPORT_TITLE": "FY Budget Report (Year to Date)",
"SELECT_FY": "Select fiscal year to export",
"SUCCESS": "Budget data CSV file for {{fyName}} succesfully downloaded!"
},
"IMPORT": {
"DESCRIPTION": "You can upload a budget from a CSV file. Only lines for title, income, and expense accounts may be included. Budget totals for tile accounts will be ignored. Note that imported budget data will replace any existing budget data for the selected fiscal year.",
"DOWNLOAD": "Click here to download an example budget CSV template file",
"LOAD_FROM_FILE": "Import budget data from a CSV file",
"MODAL_BREADCRUMB": "Upload Budget Data for {{fiscalYear}}",
"NO_FILE_SELECTED": "No file is selected",
"SUCCESS" : "Budget data for {{fyName}} successfully uploaded and imported!"
}
}
}
1 change: 1 addition & 0 deletions client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@
"BEGINNING_VIEW_BALANCE" : "Beginning View Balance",
"BILLING_DATE": "Billing Date",
"BREAK_EVEN": "Break Even",
"BUDGET": "Budget",
"BULK_QUANTITY": "Bulk quantity",
"BY": "by",
"BY_ID": "By Id",
Expand Down
10 changes: 7 additions & 3 deletions client/src/i18n/en/general_ledger.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{"GENERAL_LEDGER":{"TITLE":"General Ledger",
"ACCOUNT_SLIP":"Account Slip",
"SOLD":"Sold"}}
{
"GENERAL_LEDGER": {
"TITLE": "General Ledger",
"ACCOUNT_SLIP": "Account Slip",
"SOLD": "Sold"
}
}
17 changes: 16 additions & 1 deletion client/src/i18n/en/periods.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
"CUSTOM_TO" : "Custom To",
"SELECT_PERIOD" : "Select Period",
"SELECT_CUSTOM_PERIOD" : "Select Custom Period",
"SUBMIT_CUSTOM_PERIOD" : "Submit Custom Period"
"SUBMIT_CUSTOM_PERIOD" : "Submit Custom Period",
"NAME" : {
"ALL": "All",
"JANUARY": "January",
"FEBRUARY": "February",
"MARCH": "March",
"APRIL": "April",
"MAY": "May",
"JUNE": "June",
"JULY": "July",
"AUGUST": "August",
"SEPTEMBER": "September",
"OCTOBER": "October",
"NOVEMBER": "November",
"DECEMBER": "December"
}
}
}
1 change: 1 addition & 0 deletions client/src/i18n/en/table.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"MARGIN_VARIABLE_LOADS": "Margin on variable loads",
"TURNOVER" : "Sales Revenue"
},
"BUDGET": "Budget",
"BY": "by",
"CASHBOX": "Cashbox",
"CASES": "Cases",
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/en/tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"BREAK_EVEN_PROJECT_REPORT" : "Break-even Report by Project",
"BREAK_EVEN_REFERENCE":"Break-even references",
"BREAK_EVEN_REPORT": "Break-even Report",
"BUDGET": "Budget Management",
"CASHBOX_MANAGEMENT" : "Cashbox Management",
"CASHFLOW_BY_SERVICE" : "Cashflow by Service",
"CASHFLOW" : "Statement of Cash Flows",
Expand Down
74 changes: 74 additions & 0 deletions client/src/i18n/fr/budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"BUDGET": {
"TITLE": "Budget",
"ACTUALS_SUBTITLE": "(réels)",
"BUDGET_SUBTITLE": "(budget)",
"BUDGET_YTD": "Budget (CDA)",
"BUDGET_YTD_COLUMN": "Budget",
"BUDGET_YTD_SUBTITLE": "(CDA)",
"BUDGET_YTD_TOOLTIP": "Budget cumul de l'année (CDA)",
"EXPENSES_TOTAL": "Dépenses totales",
"DEVIATION_YTD": "Déviation % (CDA)",
"DEVIATION_YTD_TOOLTIP": "Déviation % (CDA) = 100*(Réels_CDA/budget_CDA)",
"DIFFERENCE_YTD": "Différence (CDA)",
"DIFFERENCE_YTD_TOOLTIP": "Différence = Réels - Budget",
"FY_ACTUALS": "FY Réels (CDA)",
"FY_BUDGET": "FY Budget",
"FY_DEVIATION": "FY % Déviation",
"EXPORT_BUDGET": "Exporter le budget vers un fichier CSV",
"IMPORT_BUDGET": "Importer un fichier CSV de budget",
"IMPORT_BUDGET_BAD_HEADERS": "ERREUR : L'importation du budget a échoué ! Vérifier si des noms d'en-têtes de colonnes sont manquants ou mal orthographiés. Attendu : AcctNum, Label, Type, Budget, BudgetLastYear.",
"IMPORT_BUDGET_ERROR": "ERREUR : L'importation du budget a échoué ! Vérifiez si des données sont manquantes ou invalides ou si les valeurs de type sont incorrectes (elles devraient être 'title', 'income', ou 'expense').",
"IMPORT_BUDGET_ERROR_ACCT_NUM": "ERREUR : L'importation du budget a échoué ! Le numéro de compte n'est pas un integer.",
"IMPORT_BUDGET_ERROR_ACCT_TYPE": "ERREUR : L'importation du budget a échoué ! Vérifier si les valeurs de type sont incorrectes (elles devraient être 'title', 'income', ou 'expense').",
"IMPORT_BUDGET_ERROR_ACCT_TYPE_INCORRECT": "ERREUR : L'importation du budget a échoué ! Le type de compte ne correspond pas au compte dans la base de données.",
"IMPORT_BUDGET_ERROR_BAD_BUDGET_VALUE": "ERREUR : L'importation du budget a échoué ! La valeur du budget n'est pas un nombre.",
"IMPORT_BUDGET_ERROR_NEGATIVE_BUDGET_VALUE": "ERREUR : L'importation du budget a échoué ! La valeur du budget est négative.",
"IMPORT_BUDGET_WARN_TITLE_BUDGET_IGNORED": "ATTENTION : Les valeurs budgétaires des comptes titres sont ignorées.",
"INCOME_TOTAL": "Revenu totales",
"TOTAL_SUMMARY": "Résumé des totaux (réel - budget)",
"ACTUALS": {
"JANUARY": "Réalisations de janvier",
"FEBRUARY": "Réalisations de fevrier",
"MARCH": "Réalisations de mars",
"APRIL": "Réalisations de avril",
"MAY": "Réalisations de mai",
"JUNE": "Réalisations de juin",
"JULY": "Réalisations de juillet",
"AUGUST": "Réalisations de aout",
"SEPTEMBER": "Réalisations de septembre",
"OCTOBER": "Réalisations de octobre",
"NOVEMBER": "Réalisations de novembre",
"DECEMBER": "Réalisations de decembre"
},
"EDIT_ACCOUNT_BUDGET": {
"ACTION": "Modifier les budgets mensuels",
"BUDGET_COLUMN_LABEL": "Budget ({{currencySymbol}})",
"ERROR_NEW_BUDGET_TOO_HIGH": "ERREUR : Les montants du budget bloqué dépassent le budget disponible pour le compte !",
"DESCRIPTION": "Modifiez le budget de ce compte pour chaque mois.",
"DESCRIPTION_NOTE": "NOTE : Le verrouillage du budget pour un mois répartira le solde du budget de manière égale entre les mois non verrouillés.",
"LOCK": "Verrouiller",
"TITLE": "Modifier le compte: {{acctNum}} - {{acctLabel}}"
},
"EXPORT": {
"DATA_CSV": "Exporter les données budgétaires CDA (CSV)",
"DESCRIPTION": "Exporter les données du compte vers un fichier CSV",
"EXCEL": "Exporter les données budgétaires CDA (Excel)",
"MODAL_BREADCRUMB": "Exporter les données budgétaires",
"NO_ACCT_BALANCE_DATA_FOR_FY": "Aucune donnée sur le solde des comptes n'a été trouvée pour {{fyName}}!",
"REPORT_FILENAME": "{{fyName}} Rapport budgétaire",
"REPORT_PDF": "Exporter le rapport budgétaire (PDF)",
"REPORT_TITLE": "Rapport budgétaire (cummul de l'année)",
"SELECT_FY": "Sélectionner l'année fiscale à exporter",
"SUCCESS": "Le fichier CSV des données budgétaires de {{fyName}} a été téléchargé avec succès !"
},
"IMPORT": {
"DESCRIPTION": "Vous pouvez télécharger un budget à partir d'un fichier CSV. Seules les lignes des comptes de titres, de revenus et de dépenses peuvent être incluses. Les totaux de budget pour les comptes de tuiles seront ignorés. Notez que les données budgétaires importées remplaceront toutes les données budgétaires existantes pour l'année fiscale sélectionnée.",
"DOWNLOAD": "Cliquez ici pour télécharger un exemple de modèle de budget CSV",
"LOAD_FROM_FILE": "Importer des données budgétaires à partir d'un fichier CSV",
"MODAL_BREADCRUMB": "Télécharger les données budgétaires pour {{fiscalYear}}",
"NO_FILE_SELECTED": "Aucun fichier n'est sélectionné",
"SUCCESS" : "Les données budgétaires pour {{fyName}} ont été téléchargées et importées avec succès !"
}
}
}
1 change: 1 addition & 0 deletions client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@
"BEGINNING_VIEW_BALANCE" : "Solde Début du Grid",
"BILLING_DATE": "Date Facturation",
"BREAK_EVEN": "Seuil de rentabilité",
"BUDGET": "Budget",
"BULK_QUANTITY": "Quantité en vrac",
"BY_ID": "Par id",
"BY_NAME": "Par nom",
Expand Down
10 changes: 7 additions & 3 deletions client/src/i18n/fr/general_ledger.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{"GENERAL_LEDGER":{"TITLE":"Grand Livre",
"ACCOUNT_SLIP":"Extrait de compte",
"SOLD":"Solde"}}
{
"GENERAL_LEDGER": {
"TITLE": "Grand Livre",
"ACCOUNT_SLIP": "Extrait de compte",
"SOLD": "Solde"
}
}
17 changes: 16 additions & 1 deletion client/src/i18n/fr/periods.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
"CUSTOM_TO" : "à",
"SELECT_PERIOD" : "Choisir une Période",
"SELECT_CUSTOM_PERIOD" : "Période Personnalisée",
"SUBMIT_CUSTOM_PERIOD" : "Valider la Période"
"SUBMIT_CUSTOM_PERIOD" : "Valider la Période",
"NAME" : {
"ALL": "Tous",
"JANUARY": "Janvier",
"FEBRUARY": "Fevrier",
"MARCH": "Mars",
"APRIL": "Avril",
"MAY": "Mai",
"JUNE": "Juin",
"JULY": "Juillet",
"AUGUST": "Août",
"SEPTEMBER": "Septembre",
"OCTOBER": "Octobre",
"NOVEMBER": "Novembre",
"DECEMBER": "Décembre"
}
}
}
1 change: 1 addition & 0 deletions client/src/i18n/fr/table.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"MARGIN_VARIABLE_LOADS": "Marge sur charges variables (Ms/CV)",
"TURNOVER" : "Chiffre d'affaire"
},
"BUDGET": "Budget",
"CANCEL_CASH": "Annuler le paiement",
"BY": "Par",
"CASES": "Cas",
Expand Down
1 change: 1 addition & 0 deletions client/src/i18n/fr/tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"BREAK_EVEN_PROJECT_REPORT" : "Rapport du seuil de rentabilité par Projets",
"BREAK_EVEN_REFERENCE":"Références du seuil de rentabilité",
"BREAK_EVEN_REPORT": "Rapport du seuil de rentabilité",
"BUDGET": "Gestion budgétaire",
"CASHBOX_MANAGEMENT":"Caisses et Banques",
"CASHFLOW": "Flux de Trésorerie",
"CASHFLOW_BY_SERVICE": "Journal de Ventilation",
Expand Down
18 changes: 18 additions & 0 deletions client/src/js/constants/bhConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,23 @@ function constantConfig() {
comment : 'PAYROLL_SETTINGS.GROUP_BY_COST_CENTERS_HELP_TEXT',
},
],

/* MUST match budgetPeriods() in server constants.js */
/* eslint-disable no-multi-spaces */
periods : [
{ periodNum : 1, label : 'PERIODS.NAME.JANUARY', key : 'jan' },
{ periodNum : 2, label : 'PERIODS.NAME.FEBRUARY', key : 'feb' },
{ periodNum : 3, label : 'PERIODS.NAME.MARCH', key : 'mar' },
{ periodNum : 4, label : 'PERIODS.NAME.APRIL', key : 'apr' },
{ periodNum : 5, label : 'PERIODS.NAME.MAY', key : 'may' },
{ periodNum : 6, label : 'PERIODS.NAME.JUNE', key : 'jun' },
{ periodNum : 7, label : 'PERIODS.NAME.JULY', key : 'jul' },
{ periodNum : 8, label : 'PERIODS.NAME.AUGUST', key : 'aug' },
{ periodNum : 9, label : 'PERIODS.NAME.SEPTEMBER', key : 'sep' },
{ periodNum : 10, label : 'PERIODS.NAME.OCTOBER', key : 'oct' },
{ periodNum : 11, label : 'PERIODS.NAME.NOVEMBER', key : 'nov' },
{ periodNum : 12, label : 'PERIODS.NAME.DECEMBER', key : 'dec' },
],
/* eslint-enable */
};
}
2 changes: 1 addition & 1 deletion client/src/js/services/PeriodService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ angular.module('bhima.services')

PeriodService.$inject = ['moment'];

/** @TODO rewrite this using AMD synatx so that the same file can be used across
/** @TODO rewrite this using AMD syntax so that the same file can be used across
* the client and the server */
function PeriodService(Moment) {
const service = this;
Expand Down

0 comments on commit 57f1b23

Please sign in to comment.