Skip to content

Commit

Permalink
Refactor (Employees Standing report)
Browse files Browse the repository at this point in the history
- Implement global situation of all employees in different mode

closes #6123
  • Loading branch information
lomamech committed Dec 20, 2021
1 parent 5240866 commit 7397357
Show file tree
Hide file tree
Showing 11 changed files with 476 additions and 9 deletions.
1 change: 1 addition & 0 deletions client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@
"EXPENSE_ACCOUNT": "Expense Accounts",
"EXPENSE": "Expenses",
"EXTRACT_EMPLOYEE_STANDING": "Extract of the Employee Standing by Period",
"EXTRACT_EMPLOYEES_STANDING": "Extract of the Employees Standing by Period",
"FAMILY_ALLOWANCES": "Family allowances",
"FATHER_NAME": "Father's Name",
"FAX": "Fax",
Expand Down
7 changes: 7 additions & 0 deletions client/src/i18n/en/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,15 @@
"DELETE": "Delete Report",
"DOWNLOAD": "Download",
"EMPLOYEE_STANDING": {
"AGGREGATE_REPORT": "Aggregate report",
"DESCRIPTION": "This report shows the financial situation of an employee",
"DETAILED_REPORT": "Detailed report",
"EXTRACT_EMPLOYEE_STANDING": "View extract of the employee's standing by date range",
"FINANCIAL_SITUATION_EMPLOYEES": "Financial situation of employees",
"INCLUDE_MEDICAL_CARE_EMPLOYEE": "Include medical care provided to the employee",
"REPORT": "Employee Standing Report",
"SEE_SITUATION_ALL_EMPLOYEES": "See the overall situation of all employees",
"SYNTHETIC": "Synthetic report",
"TITLE": "Employee Standing Report"
},
"EXPENSE_REPORT": "Expenses Report",
Expand Down
3 changes: 2 additions & 1 deletion client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@
"EXIT": "Sorties",
"EXPENSE_ACCOUNT": "Comptes de charges",
"EXPENSE": "Charges",
"EXTRACT_EMPLOYEE_STANDING": "Extrait de la situation financière de l'employée pour la période",
"EXTRACT_EMPLOYEE_STANDING": "Extrait de la situation financière de l'employé pour la période",
"EXTRACT_EMPLOYEES_STANDING": "Extrait de la situation financière des employés pour la période",
"FAMILY_ALLOWANCES": "Allocations Familiales",
"FATHER_NAME": "Nom du Père",
"FAX": "Fax",
Expand Down
7 changes: 7 additions & 0 deletions client/src/i18n/fr/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@
"DELETE" : "Supprimer un rapport",
"DOWNLOAD" : "Télécharger",
"EMPLOYEE_STANDING" : {
"AGGREGATE_REPORT": "Rapport agrégé",
"DESCRIPTION": "Ce rapport permet de connaître la situation financière d'un employé",
"DETAILED_REPORT": "Rapport détaillé",
"EXTRACT_EMPLOYEE_STANDING": "Voir l'extrait de la situation financière par rapport à une plage de dates",
"FINANCIAL_SITUATION_EMPLOYEES": "Situation financière des employés",
"INCLUDE_MEDICAL_CARE_EMPLOYEE": "Inclure les soins médicaux accordé à l'employé",
"REPORT": "Situation financière de l'employé",
"SEE_SITUATION_ALL_EMPLOYEES": "Voir la situation global de tous les employés",
"SYNTHETIC": "Rapport synthétique",
"TITLE": "Situation financière d'un employé"
},
"EXPENSE": "Charge",
Expand Down
2 changes: 0 additions & 2 deletions client/src/i18n/fr/table.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
"EXCHANGE_RATE": "Taux de change",
"EXPIRATION_DATE": "Date d'expiration",
"EXPIRE_IN" : "Expire Dans",
"EXTRACT_EMPLOYEE_STANDING": "Voir l'extrait de la situation financière de l'employé par rapport à une plage de dates",
"NUM_PIECE": "N° Piece",
"ENTRY": "Entrée",
"EXIT": "Sortie",
Expand Down Expand Up @@ -222,7 +221,6 @@
"RESULTS": "Résultats",
"RESULT_ACCOUNT_SCT": "Section Compte Résultat",
"RUBRICS": "Rubriques",
"SEE_SITUATION_ALL_EMPLOYEES": "Voir la situation global de tous les employés",
"SECTOR": "Secteur",
"SERVICE": "Service",
"SOLD": "Solde",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,57 @@ <h3 class="text-capitalize" translate>REPORT.EMPLOYEE_STANDING.TITLE</h3>
<div class="checkbox">
<label>
<input type="checkbox" ng-model="ReportConfigCtrl.reportDetails.allEmployee" ng-true-value="1" ng-false-value="0">
<span translate>TABLE.COLUMNS.SEE_SITUATION_ALL_EMPLOYEES</span>
<span translate>REPORT.EMPLOYEE_STANDING.SEE_SITUATION_ALL_EMPLOYEES</span>
</label>
</div>

<div ng-if="ReportConfigCtrl.reportDetails.allEmployee" class="panel-body">
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeRepport"
value="aggregate"
ng-model="ReportConfigCtrl.reportDetails.modeRepport"
ng-click="ReportConfigCtrl.onSelectMode('aggregate')"
required>
<span translate>
REPORT.EMPLOYEE_STANDING.AGGREGATE_REPORT
</span>
</label>
</div>
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeRepport"
value="synthetic"
ng-model="ReportConfigCtrl.reportDetails.modeRepport"
ng-click="ReportConfigCtrl.onSelectMode('synthetic')"
required>
<span translate>
REPORT.EMPLOYEE_STANDING.SYNTHETIC
</span>
</label>
</div>
<div class="radio">
<label class="radio-inline">
<input
type="radio"
name="modeRepport"
value="detailled"
ng-model="ReportConfigCtrl.reportDetails.modeRepport"
ng-click="ReportConfigCtrl.onSelectMode('detailled')"
required>
<span translate>
REPORT.EMPLOYEE_STANDING.DETAILED_REPORT
</span>
</label>
</div>
</div>

<!--select the Employee -->
<div ng-if="ReportConfigCtrl.reportDetails.allEmployee">
<div ng-if="!ReportConfigCtrl.reportDetails.allEmployee">
<bh-employee-select
employee-uuid="ReportConfigCtrl.reportDetails.employee_uuid"
on-select-callback="ReportConfigCtrl.onSelectEmployee(employee)"
Expand All @@ -42,9 +87,10 @@ <h3 class="text-capitalize" translate>REPORT.EMPLOYEE_STANDING.TITLE</h3>
<div class="checkbox">
<label>
<input type="checkbox" ng-model="ReportConfigCtrl.reportDetails.extractEmployee" ng-true-value="1" ng-false-value="0">
<span translate>TABLE.COLUMNS.EXTRACT_EMPLOYEE_STANDING</span>
<span translate>REPORT.EMPLOYEE_STANDING.EXTRACT_EMPLOYEE_STANDING</span>
</label>
</div>

<div ng-if="ReportConfigCtrl.reportDetails.extractEmployee">
<!-- date interval -->
<bh-date-interval
Expand All @@ -55,10 +101,10 @@ <h3 class="text-capitalize" translate>REPORT.EMPLOYEE_STANDING.TITLE</h3>
</bh-date-interval>
</div>
<hr>
<div class="checkbox">
<div ng-if="!ReportConfigCtrl.reportDetails.allEmployee" class="checkbox">
<label>
<input type="checkbox" ng-model="ReportConfigCtrl.reportDetails.includeMedicalCare" ng-true-value="1" ng-false-value="0">
<span translate>TABLE.COLUMNS.INCLUDE_MEDICAL_CARE_EMPLOYEE</span>
<span translate>REPORT.EMPLOYEE_STANDING.INCLUDE_MEDICAL_CARE_EMPLOYEE</span>
</label>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function EmployeeStandingController($state, $sce, Notify, BaseReportService, App

const vm = this;
const cache = new AppCache('configure_employee_standing');
const reportUrl = '/reports/finance/employee_standing';

vm.reportDetails = {};

Expand All @@ -27,6 +26,8 @@ function EmployeeStandingController($state, $sce, Notify, BaseReportService, App
vm.reportDetails.employee_uuid = employee.uuid;
};

let reportUrl;

vm.requestSaveAs = function requestSaveAs() {
const options = {
url : reportUrl,
Expand All @@ -41,12 +42,24 @@ function EmployeeStandingController($state, $sce, Notify, BaseReportService, App
.catch(Notify.handleError);
};

vm.onSelectMode = function onSelectMode(modeRepport) {
vm.reportDetails.modeRepport = modeRepport;
};

vm.preview = function preview(form) {
if (form.$invalid) {
Notify.danger('FORM.ERRORS.RECORD_ERROR');
return 0;
}

if (vm.reportDetails.allEmployee) {
delete vm.reportDetails.employee_uuid;
delete vm.reportDetails.includeMedicalCare;
reportUrl = '/reports/finance/employees_standing';
} else if (!vm.reportDetails.allEmployee && vm.reportDetails.employee_uuid) {
reportUrl = '/reports/finance/employee_standing';
}

// update cached configuration
cache.reportDetails = angular.copy(vm.reportDetails);

Expand All @@ -67,5 +80,7 @@ function EmployeeStandingController($state, $sce, Notify, BaseReportService, App
if (cache.reportDetails) {
vm.reportDetails = angular.copy(cache.reportDetails);
}

vm.reportDetails.modeRepport = 'aggregate';
}
}
1 change: 1 addition & 0 deletions server/config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ exports.configure = function configure(app) {
app.get('/reports/finance/cost_center_income_and_expense', financeReports.costCenterStepdown.incomeAndExpenseReport);
app.get('/reports/finance/annual_clients_report', financeReports.annualClientsReport);
app.get('/reports/finance/employee_standing/', financeReports.employee);
app.get('/reports/finance/employees_standing/', financeReports.employees);
app.get('/reports/finance/break_even', financeReports.breakEven.report);
app.get('/reports/finance/break_even_cost_center', financeReports.breakEvenCostCenter.report);
app.get('/reports/finance/operating', financeReports.operating.document);
Expand Down

0 comments on commit 7397357

Please sign in to comment.