Skip to content

Commit

Permalink
bug(Define Orientation Report PDF)
Browse files Browse the repository at this point in the history
- Correction of the operating error on the bhRenderOption component

- Taking into account the choice of the orientation parameter for different
report
  • Loading branch information
lomamech committed Dec 9, 2020
1 parent 364bede commit 9180d38
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
7 changes: 4 additions & 3 deletions client/src/js/components/bhRenderOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ angular.module('bhima.components')
},
});


/**
* bhRenderOption Component
*
Expand All @@ -25,7 +24,9 @@ function RenderOptionController() {
const ctrl = this;
this.$onInit = function $onInit() {
ctrl.orientation = ctrl.orientation || 'portrait';
ctrl.onChange = ctrl.onChange || angular.noop();
ctrl.setOrientation = () => ctrl.onChange({ orientation : ctrl.orientation });
};

this.setOrientation = ($item) => {
ctrl.onChange({ orientation : $item });
};
}
1 change: 1 addition & 0 deletions client/src/modules/reports/reports.save.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function SaveReportController(ModalInstance, Notify, SavedReports, options, Lang

// vm.documentOptions.renderer = vm.supportedRenderTypes[0].key;
vm.documentOptions.lang = Languages.key;
vm.documentOptions.orientation = vm.documentOptions.orientation || 'portrait';

// @TODO this can directly be loaded from the form
const reportOptions = angular.merge(vm.documentOptions, options.reportOptions);
Expand Down
4 changes: 2 additions & 2 deletions client/src/modules/templates/bhRenderOption.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<label class="control-label" translate>FORM.LABELS.PRINT_ORIENTATION</label>
<div>
<label class="radio-inline">
<input type="radio" name="portrait" id="portrait" value="portrait" ng-click ="$ctrl.setOrientation()" ng-model="$ctrl.orientation" required>
<input type="radio" name="orientation" id="portrait" value="portrait" ng-click ="$ctrl.setOrientation('portrait')" ng-model="$ctrl.orientation" required>
<span translate>FORM.LABELS.PRINT_ORIENTATION_PORTRAIT</span>
</label>

<label class="radio-inline">
<input
type="radio" name="landscape" id="landscape" value="landscape" ng-click ="$ctrl.setOrientation()" ng-model="$ctrl.orientation" required>
type="radio" name="orientation" id="landscape" value="landscape" ng-click ="$ctrl.setOrientation('landscape')" ng-model="$ctrl.orientation" required>
<span translate>FORM.LABELS.PRINT_ORIENTATION_LANDSCAPE</span>
</label>
</div>
Expand Down
1 change: 0 additions & 1 deletion server/controllers/finance/reports/client_debts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ async function report(req, res, next) {
// with zero balances, this is the line to skip.
if (!entity.balance) { return; }


// classify debtors as patients or employees
if (entity.is_employee !== null) {
employees.push(entity);
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/consumption_graph.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, db, util, ReportManager, pdfOptions, STOCK_CONSUMPTION_GRAPTH_TEMPLATE,
_, db, util, ReportManager, STOCK_CONSUMPTION_GRAPTH_TEMPLATE,
} = require('../common');
const stockCore = require('../../core');
const i18n = require('../../../../lib/helpers/translate');
Expand All @@ -18,7 +18,7 @@ async function stockConsumptionGrathReport(req, res, next) {

const params = _.clone(req.query);

const optionReport = _.extend(params, pdfOptions, {
const optionReport = _.extend(params, {
filename : 'REPORT.STOCK_CONSUMPTION_GRAPH_REPORT.TITLE',
});

Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/entry_report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, db, util, ReportManager, pdfOptions, STOCK_ENTRY_REPORT_TEMPLATE,
_, db, util, ReportManager, STOCK_ENTRY_REPORT_TEMPLATE,
} = require('../common');

const StockEntryFromPurchase = require('./entry/entryFromPurchase');
Expand All @@ -21,7 +21,7 @@ function stockEntryReport(req, res, next) {

const params = util.convertStringToNumber(req.query);

const optionReport = _.extend(params, pdfOptions, {
const optionReport = _.extend(params, {
filename : 'REPORT.STOCK.ENTRY_REPORT',
});

Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/exit_report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, db, util, ReportManager, pdfOptions, STOCK_EXIT_REPORT_TEMPLATE,
_, db, util, ReportManager, STOCK_EXIT_REPORT_TEMPLATE,
} = require('../common');

const StockExitToPatient = require('./exit/exitToPatient');
Expand All @@ -21,7 +21,7 @@ function stockExitReport(req, res, next) {

const params = util.convertStringToNumber(req.query);

const optionReport = _.extend(params, pdfOptions, {
const optionReport = _.extend(params, {
filename : 'REPORT.STOCK.EXIT_REPORT',
});

Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/expiration_report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, db, ReportManager, pdfOptions, STOCK_EXPIRATION_REPORT_TEMPLATE,
_, db, ReportManager, STOCK_EXPIRATION_REPORT_TEMPLATE,
} = require('../common');

const stockCore = require('../../core');
Expand All @@ -16,7 +16,7 @@ async function stockExpirationReport(req, res, next) {
try {
const params = { includeEmptyLot : 0, ...req.query };

const optionReport = _.extend(params, pdfOptions, {
const optionReport = _.extend(params, {
filename : 'REPORT.STOCK_EXPIRATION_REPORT.TITLE',
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, ReportManager, Stock, formatFilters, pdfOptions, STOCK_INLINE_MOVEMENTS_REPORT_TEMPLATE,
_, ReportManager, Stock, formatFilters, STOCK_INLINE_MOVEMENTS_REPORT_TEMPLATE,
} = require('../common');

/**
Expand All @@ -12,7 +12,7 @@ const {
* GET /reports/stock/inline-movements
*/
async function stockInlineMovementsReport(req, res, next) {
const optionReport = _.extend(req.query, pdfOptions, {
const optionReport = _.extend(req.query, {
filename : 'TREE.STOCK_INLINE_MOVEMENTS',
csvKey : 'rows',
renameKeys : false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ async function stockInventoriesReport(req, res, next) {
const optionReport = _.extend({}, req.query, {
filename : 'TREE.STOCK_INVENTORY',
title : 'TREE.STOCK_INVENTORY',
orientation : 'landscape',
});

try {
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/lots_report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, ReportManager, Stock, formatFilters, pdfOptions, STOCK_LOTS_REPORT_TEMPLATE,
_, ReportManager, Stock, formatFilters, STOCK_LOTS_REPORT_TEMPLATE,
} = require('../common');

/**
Expand All @@ -20,7 +20,7 @@ function stockLotsReport(req, res, next) {
let hasFilter = false;
let report;

const optionReport = _.extend(req.query, pdfOptions, {
const optionReport = _.extend(req.query, {
filename : 'TREE.STOCK_LOTS',
});

Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/movement_report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, db, util, ReportManager, pdfOptions, STOCK_MOVEMENT_REPORT_TEMPLATE,
_, db, util, ReportManager, STOCK_MOVEMENT_REPORT_TEMPLATE,
} = require('../common');
const stockCore = require('../../core');
const i18n = require('../../../../lib/helpers/translate');
Expand All @@ -18,7 +18,7 @@ async function document(req, res, next) {

const params = _.clone(req.query);

const optionReport = _.extend(params, pdfOptions, {
const optionReport = _.extend(params, {
filename : 'REPORT.STOCK_MOVEMENT_REPORT.TITLE',
});

Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/movements_report.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const util = require('../../../../lib/util');
const {
_, ReportManager, Stock, formatFilters, pdfOptions, STOCK_MOVEMENTS_REPORT_TEMPLATE,
_, ReportManager, Stock, formatFilters, STOCK_MOVEMENTS_REPORT_TEMPLATE,
} = require('../common');

/**
Expand All @@ -14,7 +14,7 @@ const {
*/
async function stockMovementsReport(req, res, next) {
let display = {};
const optionReport = _.extend(req.query, pdfOptions, {
const optionReport = _.extend(req.query, {
filename : 'TREE.STOCK_MOVEMENTS',
csvKey : 'rows',
renameKeys : false,
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/stock_sheet.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, db, ReportManager, Stock, pdfOptions, STOCK_SHEET_REPORT_TEMPLATE,
_, db, ReportManager, Stock, STOCK_SHEET_REPORT_TEMPLATE,
} = require('../common');

/**
Expand All @@ -12,7 +12,7 @@ const {
* GET /reports/stock/inventory
*/
async function stockSheetReport(req, res, next) {
const optionReport = _.extend(req.query, pdfOptions, {
const optionReport = _.extend(req.query, {
filename : 'REPORT.STOCK.INVENTORY_REPORT',
csvKey : 'rows',
});
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/stock/reports/stock/value.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Exchange = require('../../../finance/exchange');

const {
_, db, ReportManager, pdfOptions, STOCK_VALUE_REPORT_TEMPLATE,
_, db, ReportManager, STOCK_VALUE_REPORT_TEMPLATE,
} = require('../common');

/**
Expand All @@ -23,7 +23,7 @@ async function reporting(_options, session) {
const data = {};
const enterpriseId = session.enterprise.id;

const optionReport = _.extend(_options, pdfOptions, {
const optionReport = _.extend(_options, {
filename : 'TREE.STOCK_VALUE',
});

Expand Down

0 comments on commit 9180d38

Please sign in to comment.