diff --git a/client/src/modules/general-ledger/general-ledger.service.js b/client/src/modules/general-ledger/general-ledger.service.js index 6289c1015f..497fb0ae4e 100644 --- a/client/src/modules/general-ledger/general-ledger.service.js +++ b/client/src/modules/general-ledger/general-ledger.service.js @@ -50,8 +50,7 @@ function GeneralLedgerService(Api, $httpParamSerializer, Languages, Session) { service.aggregates = (params) => service.read.call({ url : service.url.concat('aggregates') }, null, params); // GET /general_ledger/transactions - service.transactions = (params) => - service.read.call({ url : service.url.concat('transactions') }, null, params); + service.transactions = (params) => service.read.call({ url : service.url.concat('transactions') }, null, params); return service; } diff --git a/client/src/modules/purchases/list/list.js b/client/src/modules/purchases/list/list.js index 93ea0ddf90..9278f6b36a 100644 --- a/client/src/modules/purchases/list/list.js +++ b/client/src/modules/purchases/list/list.js @@ -30,6 +30,12 @@ function PurchaseListController( // barcode scanner vm.openBarcodeScanner = openBarcodeScanner; + vm.openPurchaseOrderAnalysisReport = (uuid) => { + const params = PurchaseOrder.openPurchaseOrderAnalysisReport(uuid); + const link = `/reports/purchase_order_analysis?${params}`; + return link; + }; + vm.editStatus = editStatus; vm.FLUX_FROM_PURCHASE = bhConstants.flux.FROM_PURCHASE; diff --git a/client/src/modules/purchases/purchases.service.js b/client/src/modules/purchases/purchases.service.js index 36a0a5f0aa..2beb9d8cab 100644 --- a/client/src/modules/purchases/purchases.service.js +++ b/client/src/modules/purchases/purchases.service.js @@ -4,7 +4,7 @@ angular.module('bhima.services') PurchaseOrderService.$inject = [ '$uibModal', 'FilterService', 'appcache', 'PeriodService', 'PrototypeApiService', '$httpParamSerializer', 'LanguageService', - 'bhConstants', + 'bhConstants', 'SessionService', ]; /** @@ -16,7 +16,7 @@ PurchaseOrderService.$inject = [ */ function PurchaseOrderService( $uibModal, Filters, AppCache, Periods, Api, $httpParamSerializer, - Languages, bhConstants, + Languages, bhConstants, Session, ) { const baseUrl = '/purchases/'; const service = new Api(baseUrl); @@ -36,6 +36,8 @@ function PurchaseOrderService( service.stockBalance = stockBalance; service.purchaseState = purchaseState; + service.openPurchaseOrderAnalysisReport = openPurchaseOrderAnalysisReport; + purchaseFilters.registerDefaultFilters(bhConstants.defaultFilters); purchaseFilters.registerCustomFilters([ @@ -144,6 +146,18 @@ function PurchaseOrderService( }).result; } + function openPurchaseOrderAnalysisReport(row) { + const opts = { + lang : Languages.key, + currency_id : Session.enterprise.currency_id, + purchase_uuid : row.uuid, + shouldShowDetails : 1, + renderer : 'pdf', + }; + + return $httpParamSerializer(opts); + } + function download(type) { const filterOpts = purchaseFilters.formatHTTP(); const defaultOpts = { renderer : type, lang : Languages.key }; diff --git a/client/src/modules/purchases/templates/action.cell.html b/client/src/modules/purchases/templates/action.cell.html index dd69b4ba63..c25953713e 100644 --- a/client/src/modules/purchases/templates/action.cell.html +++ b/client/src/modules/purchases/templates/action.cell.html @@ -17,6 +17,14 @@
+