Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve(Employee Standing) #3779

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/i18n/en/table.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"HOSPITAL_FILE_NR": "Hospital File Number",
"ID": "ID",
"INCLUDE_MANUAL_DISTRIBUTIONS": "Include manual distributions",
"INCLUDE_MEDICAL_CARE_EMPLOYEE": "Include medical care provided to the employee",
"INVENTORY": "Inventory",
"INVENTORY_GROUP":"Inventory Group",
"INVOICES": "Invoices",
Expand Down Expand Up @@ -227,6 +228,7 @@
"TOTAL_DEBT": "Total Debt",
"TOTAL_DISTRIBUTE": "Total Distributions",
"TOTAL_GENERAL": "Total General",
"TOTAL_MEDICAL_CARE_EMPLOYEE": "Total medical care provided to the employee",
"TOTAL_UNICORPORATED_CHARGE": "Total unincorporated cost",
"TOTAL_UNICORPORARED_PRODUCT": "Total unincorporated product",
"TRANSACTION": "Transaction",
Expand Down
2 changes: 2 additions & 0 deletions client/src/i18n/fr/table.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"HOSPITAL_FILE_NR": "Numéro de Fiche",
"ID": "ID",
"INCLUDE_MANUAL_DISTRIBUTIONS": "Inclure les répartitions manuelles",
"INCLUDE_MEDICAL_CARE_EMPLOYEE": "Inclure les soins médicaux accordé à l'employé",
"INVENTORY": "Inventaire",
"INVENTORY_GROUP":"Groupe d'inventaire",
"INVOICES": "factures",
Expand Down Expand Up @@ -228,6 +229,7 @@
"TOTAL_DEBT": "Total des Dettes",
"TOTAL_GENERAL": "Total général",
"TOTAL_DISTRIBUTE": "Total de répartition",
"TOTAL_MEDICAL_CARE_EMPLOYEE": "Total des soins médicaux accordés à l'employé",
"TOTAL_UNICORPORATED_CHARGE": "Total charge non incorporé",
"TOTAL_UNICORPORARED_PRODUCT": "Total produit non incorporé",
"TRANSACTION": "Transaction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ <h3 class="text-capitalize" translate>REPORT.EMPLOYEE_STANDING.TITLE</h3>
required="true">
</bh-employee-select>

<div 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>
</label>
</div>

<!--preview-->
<bh-loading-button loading-state="ConfigForm.$loading">
<span translate>REPORT.UTIL.PREVIEW</span>
Expand Down
17 changes: 13 additions & 4 deletions server/controllers/finance/reports/financial.employee.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@
<h5 class="text-uppercase"><b>{{translate "FORM.LABELS.REGISTRATION_NUMBER"}} : {{ employee.code }}</b></h5>
<h4 class="text-uppercase" style="background-color: #efefef;">
<b>
{{translate "FORM.LABELS.BALANCE"}}== {{debcred ./employeeBalance metadata.enterprise.currency_id}}
{{translate balanceCreditorText}} == {{debcred ./creditorAggregates.balance metadata.enterprise.currency_id}}
</b>
</h4>
{{#if includeMedicalCare }}
<h5 class="text-uppercase" style="background-color: #efefef;">
<em>
{{translate "TABLE.COLUMNS.TOTAL_MEDICAL_CARE_EMPLOYEE"}} == {{debcred ./debtorAggregates.balance metadata.enterprise.currency_id}}
</em>
</h5>
{{/if}}
<hr/>

<section>
<h4>{{translate 'CREDITOR_GROUP.CREDITOR.TRANSACTIONS'}}</h4>
{{#if includeMedicalCare }}
<h4>{{translate 'CREDITOR_GROUP.CREDITOR.TRANSACTIONS'}}</h4>
{{/if}}
<table class="table table-condensed table-bordered table-report">
<thead>
<tr class="text-capitalize text-center" style="background-color: #ddd;" >
Expand Down Expand Up @@ -69,8 +78,7 @@
</tr>
</tfoot>
</table>


{{#if includeMedicalCare }}
<br/>
<h4>{{translate 'DEBTOR_GROUP.DEBTOR.TRANSACTIONS'}}</h4>
<table class="table table-condensed table-bordered table-report">
Expand Down Expand Up @@ -121,6 +129,7 @@
</tr>
</tfoot>
</table>
{{/if}}
</section>

</body>
8 changes: 6 additions & 2 deletions server/controllers/finance/reports/financial.employee.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const Employee = require('../../payroll/employees');
const Creditors = require('../../finance/creditors');
const Debtors = require('../../finance/debtors');
const db = require('../../../lib/db');
const util = require('../../../lib/util');

const TEMPLATE = './server/controllers/finance/reports/financial.employee.handlebars';

Expand Down Expand Up @@ -73,7 +72,12 @@ async function build(req, res, next) {
});

// employee balance
data.employeeBalance = util.roundDecimal(data.debtorAggregates.balance - data.creditorAggregates.balance, 2);
data.includeMedicalCare = parseInt(options.includeMedicalCare, 10) === 1;

// For the Employee Standing report, it must be mentioned if the employee has a credit or debit balance
data.balanceCreditorText = data.creditorAggregates.balance >= 0
? 'FORM.LABELS.CREDIT_BALANCE' : 'FORM.LABELS.DEBIT_BALANCE';

// let render
const result = await report.render(data);
return res.set(result.headers).send(result.report);
Expand Down