diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json index 07eaba09ab..8c3a77d143 100644 --- a/client/src/i18n/en.json +++ b/client/src/i18n/en.json @@ -858,6 +858,7 @@ "EDIT_TYPE" : "Edit inventory type", "EDIT_UNIT" : "Edit inventory unit form", "ELEMENT" : "Element", + "PRICES" : "Inventory Prices", "LIST" : "Inventory Data List", "LIST_METADATA" : "Inventory", "LIST_GROUP" : "Inventory Groups", @@ -1393,11 +1394,13 @@ "NUMBER_OF_DAYS" : "Number of Days", "TOTAL_COST" : "Total Cost", "TOTAL_AMOUNT" : "Total Amount", + "RECORDS" : "Records", "NUM_USERS" : "Number of Users", "NUM_SERVICES" : "Number of Services", "NUM_PROJECTS" : "Number of Projects", "NUM_PAYMENTS" : "Number of Payments", "NUM_INVOICES" : "Number of Invoices", + "NUM_RECORDS" : "Number of Records", "NUM_CAUTIONS" : "Number of PrePayments", "NUM_CASHBOXES" : "Number of Cashboxes", "NUM_CLIENTS" : "Number of Unique Clients", diff --git a/client/src/i18n/fr.json b/client/src/i18n/fr.json index 680ddb3de5..fb295faf8c 100644 --- a/client/src/i18n/fr.json +++ b/client/src/i18n/fr.json @@ -871,6 +871,7 @@ "EDIT_TYPE" : "Modifier Types d'inventaires", "EDIT_UNIT" : "Modifier Forme d'inventaires", "ELEMENT" : "Élément", + "PRICES" : "Tarification", "LIST" : "Liste des données d'inventaire", "LIST_METADATA" : "Inventaires", "LIST_GROUP" : "Groupes d'inventaires", diff --git a/server/config/routes.js b/server/config/routes.js index 4853cdf2b8..cc29c0b19e 100644 --- a/server/config/routes.js +++ b/server/config/routes.js @@ -368,7 +368,7 @@ exports.configure = function configure(app) { app.get('/reports/medical/patients/:uuid/checkins', medicalReports.patientCheckins); app.get('/reports/inventory/purchases/:uuid', inventoryReports.receipts.purchases); - app.get('/reports/inventory/items', inventory.getInventoryItemReport); + app.get('/reports/inventory/items', inventoryReports.reports.prices); app.get('/reports/finance/invoices', financeReports.invoices.report); app.get('/reports/finance/invoices/:uuid', financeReports.invoices.receipt); diff --git a/server/controllers/inventory/index.js b/server/controllers/inventory/index.js index 9545a28e9a..6862781cc7 100644 --- a/server/controllers/inventory/index.js +++ b/server/controllers/inventory/index.js @@ -51,7 +51,6 @@ exports.createInventoryItems = createInventoryItems; exports.updateInventoryItems = updateInventoryItems; exports.getInventoryItems = getInventoryItems; exports.getInventoryItemsById = getInventoryItemsById; -exports.getInventoryItemReport = getInventoryItemReport; // expose inventory group methods exports.createInventoryGroups = createInventoryGroups; @@ -166,34 +165,8 @@ function getInventoryItemsById(req, res, next) { .done(); } -/** -* GET /reports/inventory/imtes -* Returns a pdf file for inventory metadata -* -* @function getInventoryItemReport -*/ -function getInventoryItemReport(req, res, next) { - const template = './server/controllers/inventory/reports/items.handlebars'; - let report; - - const context = _.defaults({orientation : 'landscape' }, req.query); - - try { - report = new ReportManager(template, req.session, context); - } catch(e) { - return next(e); - } - - core.getItemsMetadata() - .then(rows => report.render({ rows })) - .then(result => { - res.set(result.headers).send(result.report); - }) - .catch(next) - .done(); -} - // ======================= inventory group ============================= + /** * POST /inventory/groups * Create a new inventory group diff --git a/server/controllers/inventory/reports/index.js b/server/controllers/inventory/reports/index.js index 2c6ed6e487..560a8bec19 100644 --- a/server/controllers/inventory/reports/index.js +++ b/server/controllers/inventory/reports/index.js @@ -8,5 +8,8 @@ module.exports = { receipts: { purchases: require('./purchases.receipt') + }, + reports : { + prices : require('./prices') } }; diff --git a/server/controllers/inventory/reports/prices.handlebars b/server/controllers/inventory/reports/prices.handlebars new file mode 100644 index 0000000000..ceff55159c --- /dev/null +++ b/server/controllers/inventory/reports/prices.handlebars @@ -0,0 +1,64 @@ +{{> head title="INVENTORY.PRICE_LIST_REPORT" }} + +
+ + {{> header }} + +{{translate "TREE.INVENTORY"}} | +{{translate "FORM.LABELS.TYPE"}} | +{{translate "FORM.LABELS.DEFAULT_QUANTITY"}} | +{{translate "FORM.LABELS.UNIT_PRICE"}} | +
---|---|---|---|
+ {{ name }} + | + ++ ({{ items.length }} {{ translate "TABLE.AGGREGATES.RECORDS" }}) + | +||
+ {{ item.text }} + | +{{ item.typeName }} | +{{ item.default_quantity }} | ++ {{currency item.price ../../metadata.enterprise.currency_id}} + | +
+ |