diff --git a/client/src/js/services/appauth.js b/client/src/js/services/appauth.js deleted file mode 100644 index 9e6d842618..0000000000 --- a/client/src/js/services/appauth.js +++ /dev/null @@ -1,57 +0,0 @@ -angular.module('bhima.services') -.service('appauth', AppAuth); - -AppAuth.$inject = [ - '$q', '$http', '$window', '$location', 'appstate' -]; - -function AppAuth($q, $http, $window, $location, appstate) { - var session; - var service = {}; - - if ($window.sessionStorage.session) { - session = JSON.parse($window.sessionStorage.session); - } - - service.login = function login(credentials) { - return $http.post('/auth/login', credentials) - .then(function (res) { - - session = { - token : res.data.accessToken, - data : res.data.userData - }; - - // TODO -- do we even still use this? - appstate.set('user', session.data); - $window.sessionStorage.session = JSON.stringify(session); - - return session; - }); - }; - - service.logout = function logout() { - return $http.get('/auth/logout') - .then(function (res) { - delete $window.sessionStorage.session; - session = null; - return res; - }); - }; - - service.isAuthenticated = function () { - return !!session && !!session.token; - }; - - service.getSession = function () { - return session; - }; - - service.destroySession = function () { - delete $window.sessionStorage.session; - session = null; - - }; - - return service; -} diff --git a/client/src/js/services/calc.js b/client/src/js/services/calc.js deleted file mode 100644 index b924f6d08b..0000000000 --- a/client/src/js/services/calc.js +++ /dev/null @@ -1,29 +0,0 @@ -angular.module('bhima.services') -.service('calc', [ - 'precision', - 'appstate', - 'store', - function (precision, appstate, Store) { - // this service calculates the nearest rounded price - // to pay or bill, based on the currency - var store; - - appstate.register('currencies', function (curr) { - store = new Store({ data : curr}); - }); - - return function calcPrice(price, currency_id) { - var unit, r, round, total, diff; - - if (!store) { throw new Error('No currencies defined!'); } - - unit = store.get(currency_id).min_monentary_unit; - r = price % unit; - round = unit - r; - total = precision.round(r > unit / 2 ? price + round : price - r, 0); - diff = precision.round(unit - r); - - return { total : total, difference : diff }; - }; - } -]); diff --git a/client/src/js/services/chartservice.js b/client/src/js/services/chartservice.js deleted file mode 100644 index 3d74354c34..0000000000 --- a/client/src/js/services/chartservice.js +++ /dev/null @@ -1,30 +0,0 @@ - -angular.module('bhima.services') - -// Chart Service -// -// This service tries to make working with ChartJs easier by -// prepackaging lots of options that we use repeatedly. -.service('ChartService', ['$filter', function ($filter) { - var service = {}, - $date = $filter('date'), - $currency = $filter('currency'); - - // chart grouping options - // key is for translation - // grouping is for query generation - // format is for $date format - service.grouping = [ - { key : 'CHART.GROUPING.DAY' , grouping: 'day' , format : 'dd-MM-yyyy' }, - { key : 'CHART.GROUPING.WEEK' , grouping: 'week' , format : 'EEEE' }, - { key : 'CHART.GROUPING.MONTH' , grouping: 'month' , format : 'MMMM' }, - { key : 'CHART.GROUPING.YEAR' , grouping: 'year' , format : 'yyyy' } - ]; - - service.multitooltip = { - // Interesting that this works... - currency : '<%= datasetLabel %> : <%= value.toLocaleString("en", { style: "currency", currency: "USD" }) %>' - }; - - return service; -}]); diff --git a/client/src/js/services/errorcodes.js b/client/src/js/services/errorcodes.js deleted file mode 100644 index e56fdce9d6..0000000000 --- a/client/src/js/services/errorcodes.js +++ /dev/null @@ -1,95 +0,0 @@ -angular.module('bhima.services') -.service('errorCodes', function () { - return { - 'ERR_TXN_IMBALANCE' : { - title : 'Transaction Imbalance', - ref : 'ERR_TXN_IMBALANCE', - description : 'Imbalanced transaction(s) detected', - }, - 'ERR_TXN_ZERO' : { - title : 'Zero-Valued Lines', - ref : 'ERR_TXN_ZERO', - description : 'Invalid transaction(s) line missing both debit and credit amounts', - }, - 'ERR_TXN_CORRUPT_DATE' : { - title : 'Corrupt Transaction Date', - ref : 'ERR_TXN_CORRUPT_DATE', - description : 'Corrupted date detected in transaction(s)', - }, - 'ERR_TXN_MULTI_DATE' : { - title : 'Multiple Transaction Dates', - ref : 'ERR_TXN_MULTI_DATE', - description : 'Transaction dates do not agree. Multiple dates detected for single transaction(s)', - }, - 'ERR_TXN_EMPTY_ACCOUNT' : { - title : 'Empty Transaction Account', - ref : 'ERR_TXN_EMPTY_ACCOUNT', - description : 'Empty account field detect in transaction(s)', - }, - 'ERR_TXN_EMPTY_DC_TYPE' : { - ref : 'ERR_TXN_EMPTY_DC_TYPE', - title : 'Empty Debtor/Creditor Type', - description : 'Empty debtor/creditor type detected in transaction(s) with debtor/creditor id present', - }, - 'ERR_TXN_EMPTY_DC_UUID' : { - ref : 'ERR_TXN_EMPTY_DC_UUID', - title : 'Empty Debtor/Creditor ID', - description : 'Empty debtor/creditor ID detected in transaction(s) with debtor/creditor type present', - }, - 'ERR_TXN_UNRECOGNIZED_DATE' : { - ref : 'ERR_TXN_UNRECOGNIZED_DATE', - title : 'Unrecognized Transaction Date', - description : 'Unrecognized dates in transaction(s). Dates do not fall within a valid fiscal year', - }, - 'ERR_TXN_UNRECOGNIZED_DC_UUID' : { - ref : 'ERR_TXN_UNRECOGNIZED_DC_UUID', - title : 'Unrecognized Debtor/Creditor ID', - description : 'Unrecognized debtor/creditor ID in transaction(s)', - }, - 'ERR_HTTP_UNREACHABLE' : { - title : 'Server Unreachable', - ref : 'ERR_HTTP_UNREACHABLE', - description : 'Server returned a 404 unreachable response.', - }, - 'ERR_HTTP_INTERNAL' : { - title : 'Internal Server Error', - ref : 'ERR_HTTP_INTERNAL', - description : 'Server returned a 500 internal error response.', - }, - 'ERR_AUTH_UNAUTHORIZED' : { - title : 'Authorized Access', - ref : 'ERR_AUTH_UNAUTHORIZED', - description : 'User is not authorized to perform this action.', - }, - 'ERR_AUTH_UNRECOGNIZED' : { - title : 'Unrecognized User', - ref : 'ERR_AUTH_UNRECOGNIZED', - description : 'Invalid or unrecognized PIN registration.', - }, - 'ERR_SESS_EXPIRED' : { - title : 'Session Expired', - ref : 'ERR_SESS_EXPIRED', - description : 'Authenticated session has expired.' - }, - 'ERR_QUERY' : { - title : 'Database Exception', - ref : 'ERR_QUERY', - description : 'The database raised an exception to the query. Please contact a sysadmin.' - }, - 'ERR_ACCOUNT_LOCKED' : { - title : 'Locked Accounts', - ref : 'ERR_ACCOUNT_LOCKED', - description : 'Locked accounts included in transaction(s).' - }, - 'ERR_ACCOUNT_NULL' : { - title : 'Null Accounts', - ref : 'ERR_ACCOUNT_NULL', - description : 'Undefined or null accounts included in transaction(s).' - }, - 'ERR_RECORD_NOT_FOUND' : { - title : 'Record Not Found', - ref : 'ERR_RECORD_NOT_FOUND', - description : 'The record you were looking for could not be retrieved' - } - }; -}); diff --git a/client/src/js/services/exportFile.js b/client/src/js/services/exportFile.js deleted file mode 100644 index 692427a6ce..0000000000 --- a/client/src/js/services/exportFile.js +++ /dev/null @@ -1,300 +0,0 @@ -/* jshint forin: false */ - -angular.module('bhima.services') -.service('exportFile', ExportFile); - -function ExportFile() { - var LF = '%0A', - SP = '%20', - HT = '%09', - FF = '%44'; - - var exportFile = {}; - - function publish(file, format, fileName) { - fileName = fileName || 'Exportation'; - // Export stringData to file - switch(format) { - case 'csv' : - // Export to csv fileformat - csv(file, fileName); - break; - case 'tsv' : - // Export to tsv fileformat - tsv(file, fileName); - break; - case 'json' : - // Export to csv fileformat - json(file, fileName, true); - break; - default: - // Default csv - csv(file, fileName); - break; - } - } - - function isValidStructure(fileData) { - /* - * ============================= - * Parameters (fileData) - * ============================= - * => fileData = { - * column : ['',...], - * data : [{}, {}, ...] - * } - * - */ - var verdict = false; - if ('data' in fileData && 'column' in fileData) { - if (Array.isArray(fileData.data) && Array.isArray(fileData.column)) { - var bColumn = fileData.column.every(function (item) { - return typeof item !== 'function' && typeof item !== 'object'; - }); - var bData = fileData.data.every(function (item) { - return typeof item !== 'function'; - }); - verdict = bColumn && bData; - } - } - return verdict; - } - - function sanitize(str) { - return (typeof str === 'string') ? str.replace(/,/g, FF).replace(/ /g, SP) : str; - } - - function preDataCSV(fileData, separator) { - separator = separator || ','; - - var columns = ''; - fileData.column.forEach(function (item, index) { - columns += (index !== fileData.column.length - 1) ? sanitize(item) + separator : sanitize(item); - }); - columns += LF; - - var data = ''; - fileData.data.forEach(function (objectItem, index) { - var row = ''; - var counter = 1; - for (var i in objectItem) { - row += (counter++ < Object.keys(objectItem).length) ? sanitize(objectItem[i]) + separator : sanitize(objectItem[i]); - } - data += row + LF; - }); - - return columns + data; - } - - function preDataTSV(fileData) { - var columns = ''; - fileData.column.forEach(function (item, index) { - columns += (index !== fileData.column.length - 1) ? sanitize(item) + HT : sanitize(item); - }); - columns += LF; - - var data = ''; - fileData.data.forEach(function (objectItem, index) { - var row = ''; - var counter = 1; - for (var i in objectItem) { - row += (counter++ < Object.keys(objectItem).length) ? sanitize(objectItem[i]) + HT : sanitize(objectItem[i]); - } - data += row + LF; - }); - - return columns + data; - } - - function preDataJSON(fileData) { - return JSON.stringify(fileData, ['column', 'data'], 2); - } - - function preDataJSONV2(fileData) { - var result = []; - for (var i in fileData.data) { - var obj = {}; - for (var j in fileData.column) { - obj[fileData.column[j]] = fileData.data[i][j]; - } - result.push(obj); - } - return JSON.stringify(result, null, 2); - } - - function builder(preData, fileName, fileFormat, genDate) { - var e, today = new Date(), - date = today.toISOString().slice(0, 19).replace('T', '-').replace(':', '-').replace(':', '-'); - - var path = genDate ? fileName + '-' + date + '.' + fileFormat : fileName + '.' + fileFormat; - - e = document.createElement('a'); - e.href = 'data:attachment/'+ fileFormat +',' + preData; - e.className = 'no-print'; - e.target = '_blank'; - e.download = path; - document.body.appendChild(e); - e.click(); - } - - function csv(fileData, fileName, genDate, separator) { - /* - * ======================================== - * Parameters (fileData, fileName, option) - * ======================================== - * => fileData = { - * column : ['',...], - * data : [{}, {}, ...] - * } - * => fileName // The name of the new file to generate - * => separator // The separator to use - * => genDate // Boolean : Generate a date to attach to file - */ - separator = separator || ','; - - if (isValidStructure(fileData)) { - var preData = preDataCSV(fileData, separator); - builder(preData, fileName,'csv', genDate); - } else { - console.warn('Exportation CSV: Invalid data structure'); - } - } - - function tsv(fileData, fileName) { - /* - * ======================================== - * Parameters (fileData, fileName) - * ======================================== - * => fileData = { - * column : ['',...], - * data : [{}, {}, ...] - * } - * => fileName // The name of the new file to generate - */ - if (isValidStructure(fileData)) { - var preData = preDataTSV(fileData); - builder(preData, fileName,'tsv'); - } else { - console.warn('Exportation TSV: Invalid data structure'); - } - } - - function json(fileData, fileName, option) { - /* - * ======================================== - * Parameters (fileData, fileName, option) - * ======================================== - * => fileData = { - * column : ['',...], - * data : [{}, {}, ...] - * } - * => fileName // The name of the new file to generate - * => option // if true the function return an array of object - * // if false the function return an array of array - */ - option = option || false; - - if (isValidStructure(fileData)) { - var preData = option ? preDataJSONV2(fileData) : preDataJSON(fileData); - builder(preData, fileName,'json'); - } else { - console.warn('Exportation JSON: Invalid data structure'); - } - } - - function download(data, fileType, headers) { - // TODO Perform headers manipulation - // Like restrict data to only defined headers - - /* - * ======================================== - * Parameters (data, fileType, headers) - * ======================================== - * => data = [] - * {..., ..., ..., ...}, - * {..., ..., ..., ...} - * ] - * => fileType // String 'csv', 'tsv', 'json' - * => headers // Array of string ['ID', 'NAME', 'BIRTH DAY'] - */ - headers = headers || []; - fileType =fileType || 'csv'; - var isCorrectData = checking(data); - var fileData = {}; - - if (isCorrectData) { - if (headers.length) { - fileData = fileDataBuilder(data, headers); - } else { - fileData = fileDataBuilder(data); - } - publish(fileData, fileType); - } else { - console.warn('Erronous data type for download'); - } - } - - function fileDataBuilder(data, headers) { - var fileData = {}; - var sample = data[0]; - var keys = Object.keys(sample); - - if (headers && headers.length) { - fileData.column = headers; - fileData.data = getData(data); - } else { - fileData.column = keys.map(function (key) { - return key; - }); - fileData.data = getData(data); - } - - function getData() { - var d = []; - d = data.map(function (item) { - var obj = []; - for (var i in item) { - if (item.hasOwnProperty(i)) { - obj.push(item[i]); - } - } - return obj; - }); - return d; - } - - return fileData; - } - - function checking(data) { - // Check data has the same keys - var sameLength = false, - sample = data[0], - keys = Object.keys(sample), - length = keys.length; - - for (var i in data) { - for (var j in keys) { - var objKeys = Object.keys(data[i]); - if (keys[j] in data[i] && objKeys.length === length) { - continue; - } - else { - return false; - } - } - } - - return true; - } - - exportFile = { - publish : publish, - csv : csv, - tsv : tsv, - json : json, - download : download - }; - - return exportFile; -} diff --git a/client/src/js/services/generalledger.js b/client/src/js/services/generalledger.js deleted file mode 100644 index 44945a6752..0000000000 --- a/client/src/js/services/generalledger.js +++ /dev/null @@ -1,44 +0,0 @@ -angular.module('bhima.services') -.service('GeneralLedgerService', GeneralLedgerService); - -GeneralLedgerService.$inject = [ - '$http', '$q', 'messenger', 'store' -]; - -/** -* General Ledger Service -* -* Allows data to be loaded for the general ledger, and supports caching. -*/ -function GeneralLedgerService($http, $q, messenger, Store) { - 'use strict'; - - var service = this; - var cache = new Store({ identifier : 'uuid', data : [] }); - - service.load = load; - - /* ------------------------------------------------------------------------ */ - - // loads based on options - function load(options, reload) { - var promise; - var refresh = cache.data.length === 0 || reload; - - // should we reload or fetch data for the first time? - if (refresh) { - promise = $http.get('/ledgers/general', { params : options }) - .then(function (response) { - cache.setData(response.data); - return cache; - }); - // if we have local data, simply return it. - } else { - promise = $q.resolve(cache); - } - - return promise; - } - - return service; -} diff --git a/client/src/js/services/ipr.js b/client/src/js/services/ipr.js deleted file mode 100644 index 4cb9fb3718..0000000000 --- a/client/src/js/services/ipr.js +++ /dev/null @@ -1,96 +0,0 @@ -/* jshint forin:false */ -angular.module('bhima.services') -.service('ipr', [ - 'validate', - '$q', - 'connect', - function (validate, $q, connect) { - //Summary: - // Ce service effectue les calculs de l'IPR pour le Payroll - var dependencies = {}; - - dependencies.taxe_ipr = { - query : { - tables : { - 'taxe_ipr' : { - columns : ['id', 'taux', 'tranche_annuelle_debut', 'tranche_annuelle_fin', 'tranche_mensuelle_debut', 'tranche_mensuelle_fin', 'ecart_annuel', 'ecart_mensuel', 'impot_annuel', 'impot_mensuel', 'cumul_annuel', 'cumul_mensuel', 'currency_id'] - } - } - } - }; - - function setupModel(model) { - return $q.when(model.taxe_ipr.data); - } - - function generateEcartsImpots(tranches) { - var ecart_an, ecart_mois, impot_an, impot_mois, ecarts = [], impots = []; - for (var tranche in tranches) { - tranches[tranche].tranche_mensuelle_debut = tranches[tranche].tranche_annuelle_debut / 12; - tranches[tranche].tranche_mensuelle_fin = tranches[tranche].tranche_annuelle_fin / 12; - ecart_an = tranches[tranche].tranche_annuelle_fin - tranches[tranche].tranche_annuelle_debut; - ecart_mois = ecart_an / 12; - impot_an = Math.round(ecart_an * (tranches[tranche].taux / 100)); - impot_mois = impot_an / 12; - ecarts.push({'ecart_annuel':ecart_an,'ecart_mensuel':ecart_mois}); - impots.push({'impot_annuel':impot_an,'impot_mensuel':impot_mois}); - } - return $q.when({tranches : tranches, ecarts : ecarts, impots : impots, currency_id : (tranches[0]) ? tranches[0].currency_id : null}); - } - - function generateCumuls(obj) { - var cum_an, cum_mois, cumuls = []; - cumuls.push({'cumul_annuel':0,'cumul_mensuel':0}); - for (var i=1;i b) ? 1 : (a < b) ? -1 : 0; }); - return array[Math.floor(array.length / 2)]; - }; - - // calculate population variance - service.variance = function (array) { - var mean = service.mean(array); - return service.mean(array.map(function (v) { return Math.pow(v - mean, 2); })); - }; - - // calculate the population standard deviation - service.standardDeviation= function (array) { - return Math.sqrt(service.variance(array)); - }; - - service.standardError = function (array) { - return service.standardDeviation(array) / Math.sqrt(array.length); - }; -} diff --git a/client/src/js/services/transactionSource.js b/client/src/js/services/transactionSource.js deleted file mode 100644 index 7213a8ce71..0000000000 --- a/client/src/js/services/transactionSource.js +++ /dev/null @@ -1,39 +0,0 @@ -angular.module('bhima.services') -.service('transactionSource', ['$translate', function ($translate) { - var sources = { - 'cash' : 'SOURCE.CASH', - 'sale' : 'SOURCE.SALE', - 'journal' : 'SOURCE.JOURNAL', - 'group_deb_invoice' : 'SOURCE.GROUP_DEB_INVOICE', - 'credit_note' : 'SOURCE.CREDIT_NOTE', - 'caution' : 'SOURCE.CAUTION', - 'import_automatique' : 'SOURCE.IMPORT_AUTOMATIQUE', - 'pcash_convention' : 'SOURCE.PCASH_CONVENTION', - 'pcash_transfert' : 'SOURCE.PCASH_TRANSFERT', - 'generic_income' : 'SOURCE.GENERIC_INCOME', - 'distribution' : 'SOURCE.DISTRIBUTION', - 'stock_loss' : 'SOURCE.STOCK_LOSS', - 'payroll' : 'SOURCE.PAYROLL', - 'donation' : 'SOURCE.DONATION', - 'tax_payment' : 'SOURCE.TAX_PAYMENT', - 'cotisation_engagement' : 'SOURCE.COTISATION_ENGAGEMENT', - 'tax_engagement' : 'SOURCE.TAX_ENGAGEMENT', - 'cotisation_paiement' : 'SOURCE.COTISATION_PAIEMENT', - 'generic_expense' : 'SOURCE.GENERIC_EXPENSE', - 'indirect_purchase' : 'SOURCE.INDIRECT_PURCHASE', - 'confirm_purchase' : 'SOURCE.CONFIRM_PURCHASE', - 'salary_advance' : 'SOURCE.SALARY_ADVANCE', - 'employee_invoice' : 'SOURCE.EMPLOYEE_INVOICE', - 'pcash_employee' : 'SOURCE.PCASH_EMPLOYEE', - 'cash_discard' : 'SOURCE.CASH_DISCARD' - }; - - this.source = function (txt) { - return sources[txt]; - }; - - this.translate = function (txt) { - return $translate.instant(sources[txt]); - }; - -}]); diff --git a/client/src/js/services/validate.js b/client/src/js/services/validate.js deleted file mode 100644 index 9ae40a1f1c..0000000000 --- a/client/src/js/services/validate.js +++ /dev/null @@ -1,180 +0,0 @@ -angular.module('bhima.services') -.factory('validate', ['$q', 'connect', function($q, connect) { - var modelLabel = 'model'; - - var validateTests = [ - {flag: 'required', message : 'Required data not found!', method : hasData} - ]; - - function clear(dependencies, limit) { - var list = limit || Object.keys(dependencies); - list.forEach(function(modelKey) { - dependencies[modelKey].processed = false; - }); - } - - function refresh(dependencies, limit) { - var list = limit || Object.keys(dependencies); - - list.forEach(function(modelKey) { - dependencies[modelKey].processed = false; - }); - return process(dependencies, limit); - } - - function process(dependencies, limit) { - - var validate, deferred = $q.defer(), list = filterList((limit || Object.keys(dependencies)), dependencies); - dependencies[modelLabel] = dependencies[modelLabel] || {}; - - fetchModels(list, dependencies).then(function(model) { - packageModels(list, dependencies, model); - - validate = validateModels(list, dependencies); - // console.log('ran tests', validate); - if (validate.success) { return deferred.resolve(dependencies.model); } - - console.info('%c[validate]', 'color: blue; font-weight: bold;', 'Reminder that models have been tested and results should be handled'); - console.group('Validation results'); - console.log('Key Reference: \'%s\'', validate.reference); - console.log('Flag Reference: \'%s\'', validate.flag); - console.log('Passed: %s', validate.success); - console.log('Message: \'%s\'', validate.message); - console.groupEnd(); - deferred.reject(validate); - - }, function(error) { deferred.reject(error); }); - - return deferred.promise; - } - - function filterList(list, dependencies) { - var fList; - - fList = list.filter(function(key) { - if (dependencies[key].processed || key === modelLabel) { - return false; //processed requests || model store - } - return true; - }); - return fList; - } - - function validateModels(list, dependencies) { - var validateStatus = new Status(); - - list.some(function(modelKey) { - var model = dependencies.model[modelKey], details = dependencies[modelKey], modelTests = details.test || [], modelTestStatus = false; - - //Check for standard test flags - validateTests.forEach(function(testObject) { - if (details[testObject.flag]) { - modelTests.push(testObject); - } - }); - - //Run each test - modelTestStatus = modelTests.some(function(testObject) { - var testFailed, testMethod = testObject.method; - testFailed = !testMethod(model.data); - if (testFailed) { - validateStatus.setFailed(testObject, modelKey); - } - return testFailed; - }); - return modelTestStatus; - }); - return validateStatus; - } - - function packageModels(list, dependencies, model) { - list.forEach(function(key, index) { - dependencies.model[key] = model[index]; - dependencies[key].processed = true; - }); - } - - function fetchModels(list, dependencies) { - var deferred = $q.defer(), promiseList = []; - - list.forEach(function(key) { - var dependency = dependencies[key], args = [dependency.query]; - - //Hack to allow modelling reports with unique identifier - not properly supported by connect - if (dependency.identifier) { - args.push(dependency.identifier); - } - - promiseList.push(connect.req.apply(connect.req, args)); - }); - - $q.all(promiseList).then(function (populatedQuerry) { - deferred.resolve(populatedQuerry); - }, function(error) { - deferred.reject(error); - }); - return deferred.promise; - } - - // FIXME: unused - /* - var testSuite = { - 'enterprise' : {method: testRequiredModel, args: ['enterprise'], result: null}, - 'fiscal' : {method: testRequiredModel, args: ['fiscal_year'], result: null} - }; - - function testRequiredModel (tableName, primaryKey) { - var deferred = $q.defer(); - var testDataQuery = { - tables : {} - }; - - primaryKey = (primaryKey || 'id'); - testDataQuery.tables[tableName] = { - columns: [primaryKey] - }; - - //download data to test - connect.req(testDataQuery) - .then(function (res) { - - //run test on data - deferred.resolve(isNotEmpty(res.data)); - }, function () { - - //download failed - deferred.reject(); - }); - return deferred.promise; - } - */ - - function hasData(modelData) { - return (modelData.length > 0); - } - - function Status() { - - function setFailed(testObject, reference) { - this.success = false; - this.message = testObject.message; - this.flag = testObject.flag; - this.reference = reference; - } - - this.setFailed = setFailed; - this.success = true; - this.validModelError = true; - this.message = null; - this.reference = null; - this.flag = null; - - return this; - } - - return { - process : process, - clear : clear, - refresh : refresh - }; -}]); diff --git a/client/src/partials/group_invoice/group_invoice.html b/client/src/partials/group_invoice/group_invoice.html deleted file mode 100644 index 52c53bd599..0000000000 --- a/client/src/partials/group_invoice/group_invoice.html +++ /dev/null @@ -1,273 +0,0 @@ -
- {{ "GROUP_INVOICE.TITLE" | translate }} -
- - - -
-
-
- -
-
-
- {{ "GROUP_INVOICE.SELECT_PAYMENT_DETAILS" | translate }} -
-
-
-
- -
- - -
-
- -
- -
- -
-
-
-
- -
-
- -
-
- - - {{ InvoiceCtrl.debtor.text }} - -
- - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.INVOICE_ID" | translate }}{{ "COLUMNS.DATE" | translate }}{{ "COLUMNS.BALANCE" | translate }}{{ "COLUMNS.ACTIONS" | translate }}
- -
- {{ "UTIL.NO_DATA" | translate }} -
- - {{ invoice.invoiceRef }} - - {{ invoice.trans_date | date }}{{ invoice.balance | currency:invoice.currency_id }}
-
-
- -
- -
-

{{ "GROUP_INVOICE.TITLE" | translate }}

-

{{ "GROUP_INVOICE.DESCRIPTION_LONG" | translate }}

-
- -
-
-

{{ "GROUP_INVOICE.TITLE" | translate }}

-

{{ "GROUP_INVOICE.HELP_TXT_1" | translate }}.

-
-
- -
-
-
- {{ "GROUP_INVOICE.CONVENTION_INVOICE" | translate }} -
-
-
-
- {{ "GROUP_INVOICE.INVOICE_TITLE" | translate }} {{ InvoiceCtrl.debtor.text }} - -
- - - -
- -
-

{{ invoice.invoiceRef }}

-

{{ invoice.balance | currency:invoice.currency_id }}

-
- {{ InvoiceCtrl.currency.symbol }} - -
-
-
- -
- -

{{ ( InvoiceCtrl.balance | currency:InvoiceCtrl.currency.id ) || ("GROUP_INVOICE.ERROR_TXT_1" | translate) }}

-
-
-
-
- - - -
- -
-
-
- {{ "GROUP_INVOICE.PAYMENT_AUTHORIZATION" | translate }} -
-
- -
-
- {{ "GROUP_INVOICE.INVOICE_TITLE" | translate }} {{ InvoiceCtrl.debtor.text }} - -
- - - -
- -
-

{{ invoice.invoiceRef }}

-

{{ invoice.balance | currency:invoice.currency_id }}

-

{{ invoice.payment | currency:invoice.currency_id }}

-
-
- -
- -

{{ ( InvoiceCtrl.balance | currency:InvoiceCtrl.currency.id) || ("GROUP_INVOICE.ERROR_TXT_1" | translate) }}

- -
- -
-
- -
-
-
- - -
- -
-
-
- - {{ "GROUP_INVOICE.DETAILS" | translate }} -
-
-
-
- -
- -
-

{{ InvoiceCtrl.examine.invoiceRef }}

-
-
- -
- -
-

{{ InvoiceCtrl.examine.description }}

-
-
- -
- -
-

{{ InvoiceCtrl.examine.trans_date | date }}

-
-
- -
- -
-

{{ InvoiceCtrl.examine.account_id }}

-
-
- -
- -
-

{{ InvoiceCtrl.examine.balance | currency:InvoiceCtrl.examine.currency_id }}

-
-
- -
- -
-

{{ InvoiceCtrl.examine.comment }}

-
-
- -
-
-
-
-
-
-
-
- - - - - diff --git a/client/src/partials/group_invoice/group_invoice.js b/client/src/partials/group_invoice/group_invoice.js deleted file mode 100644 index ad0b06b807..0000000000 --- a/client/src/partials/group_invoice/group_invoice.js +++ /dev/null @@ -1,235 +0,0 @@ -angular.module('bhima.controllers') -.controller('GroupInvoiceController', GroupInvoiceController); - -GroupInvoiceController.$inject = [ - '$translate', 'connect', 'validate', 'messenger', 'uuid', 'SessionService', -]; - -/** -* Group Invoice Controller -* -* This controller allows conventions to pay for bills of patients. -*/ -function GroupInvoiceController($translate, connect, validate, messenger, uuid, SessionService) { - var vm = this; - - var dependencies = {}; - vm.action = 'default'; - vm.loading = false; - vm.queue = []; - - // import session variables - vm.project = SessionService.project; - vm.enterprise = SessionService.enterprise; - - // bind methods - vm.authorize = authorize; - vm.setDebtor = setDebtor; - vm.examineInvoice = examineInvoice; - vm.enqueue = enqueue; - vm.dequeue = dequeue; - vm.pay = pay; - vm.positive = positive; - vm.retotal = retotal; - - /* ------------------------------------------------------------------------ */ - - dependencies.invoices = { - query : 'ledgers/debtor/' - }; - - dependencies.conventions = { - required: true, - query : { - tables : { - 'debtor_group' : { - columns : ['uuid', 'name', 'account_id'] - } - }, - where : [ - 'debtor_group.is_convention<>0', 'AND', - 'debtor_group.enterprise_id=' + vm.project.enterprise_id - ] - } - }; - - dependencies.debtors = { - required : true, - query : { - tables : { - 'debtor' : { - columns : ['uuid', 'text'] - }, - 'debtor_group' : { - columns : ['account_id'] - } - }, - join : ['debtor.group_uuid=debtor_group.uuid'] - } - }; - - dependencies.currency = { - required : true, - query : { - tables : { - 'enterprise' : { - columns : ['currency_id'] - }, - 'currency' : { - columns : ['symbol'] - } - }, - join : ['enterprise.currency_id=currency.id'], - where : ['enterprise.id=' + vm.enterprise.id] - } - }; - - // startup the module - function initialise() { - validate.process(dependencies, ['debtors', 'conventions', 'currency']) - .then(setUpModels) - .catch(handler); - } - - // generic error logger - function handler(error) { - console.log(error); - } - - // select the debtor - function setDebtor() { - dependencies.invoices.query += vm.debtor.uuid; - - // turn on loading - vm.loading = true; - vm.showInvoices = true; - - validate.process(dependencies) - .then(setUpModels) - .catch(handler) - .finally(function () { - vm.loading = false; - }); - - vm.action = 'info'; - } - - // bind data to modules - function setUpModels(models) { - angular.extend(vm, models); - - vm.currency = models.currency.data[0]; - - if (vm.invoices) { - - // FIXME: this is hack - vm.invoices.data = vm.invoices.data.filter(function (d) { - return d.balance !== 0; - }); - - // proper formatting - vm.invoices.data.forEach(function (i) { - i.invoiceRef = i.abbr + ' ' + i.reference; - }); - } - - vm.payment = {}; - } - - function examineInvoice(invoice) { - vm.examine = invoice; - vm.action = 'examine'; - } - - function enqueue(idx) { - var invoice = vm.invoices.data.splice(idx, 1)[0]; - invoice.payment = invoice.balance; // initialize payment to be the exact amount -- 100% - vm.queue.push(invoice); - - vm.action = 'pay'; - - // run totaller - retotal(); - } - - function dequeue() { - vm.queue.forEach(function (i) { - vm.invoices.data.push(i); - }); - - // empty the queue - vm.queue.length = 0; - vm.action = 'default'; - - // run totaller - retotal(); - } - - function pay() { - var payment = vm.payment; - payment.project_id = vm.project.id; - payment.group_uuid = vm.convention.uuid; - payment.debtor_uuid = vm.debtor.uuid; - payment.total = vm.paymentBalance; - payment.date = new Date(); - vm.action = 'confirm'; - } - - function retotal() { - - var sums = { - balance : 0, - debit : 0, - credit : 0 - }; - - vm.queue.reduce(function (totals, row) { - totals.balance += row.payment; - totals.debit += row.debit; - totals += row.credit; - return totals; - }, sums); - - vm.balance = (sums.debit - sums.credit) - sums.balance; - vm.paymentBalance = sums.balance; - } - - function authorize() { - var id, - payment = connect.clean(vm.payment); - - payment.uuid = uuid(); - - connect.post('group_invoice', [payment]) - .then(function () { - id = payment.uuid; - return connect.post('group_invoice_item', formatItems(id)); - }) - .then(function () { - vm.action = 'default'; - vm.queue = []; - return connect.fetch('/journal/group_invoice/' + id); - }) - .then(function () { - messenger.success($translate.instant('GROUP_INVOICE.SUCCES')); - }) - .catch(handler); - } - - function formatItems(id) { - return vm.queue.map(function (i) { - var item = {}; - item.uuid = uuid(); - item.cost = i.payment; - item.invoice_uuid = i.inv_po_id; - item.payment_uuid = id; - return item; - }); - } - - function positive(invoice) { - return invoice.balance > 0; - } - - initialise(); -} diff --git a/client/src/partials/purchases/confirm/confirm.html b/client/src/partials/purchases/confirm/confirm.html deleted file mode 100644 index bc062e6798..0000000000 --- a/client/src/partials/purchases/confirm/confirm.html +++ /dev/null @@ -1,139 +0,0 @@ -
- {{ 'PURCHASE.CONFIRM.TITLE' | translate }} -
- - - -
-
-
- -
-
- {{ "PURCHASE.CONFIRM.TITLE" | translate }} -
- -
- -
- {{ 'PURCHASE.PURCHASE_TYPE' | translate }} : - - - - - -
- -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
{{"COLUMNS.DATE" | translate}}{{"COLUMNS.REFERENCE" | translate}}{{"COLUMNS.EMPLOYEE" | translate}}{{ "COLUMNS.ACTIONS" | translate }}
-
{{ "PURCHASE.NOT_FOUND" | translate }}
-
{{item.purchase_date | date}}{{item.abbr}}{{item.reference}}{{item.name}}
- - - - - - - - - - - - - - - - - - - - - - -
{{"COLUMNS.DATE" | translate}}{{"COLUMNS.REFERENCE" | translate}}{{"COLUMNS.SUPPLIER" | translate}}{{ "COLUMNS.ACTIONS" | translate }}
-
{{ "PURCHASE.NOT_FOUND" | translate }}
-
{{item.purchase_date | date}}{{item.abbr}}{{item.reference}}{{item.name}}
-
-
-
- -
-
-
- - {{ "PURCHASE.CONFIRM.CONFIRM_PAY" | translate }} {{purchaseConfirmCtrl.selected.uuid}} -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
{{ "PURCHASE.CONFIRM.DETAILS" | translate }}
{{"COLUMNS.ID" | translate}}{{purchaseConfirmCtrl.selected.uuid}}
{{"COLUMNS.NOTE" | translate}}{{purchaseConfirmCtrl.selected.note}}
{{"COLUMNS.EMPLOYEE" | translate}}{{purchaseConfirmCtrl.selected.name}}
{{"COLUMNS.SUPPLIER" | translate}}{{purchaseConfirmCtrl.selected.name}}
{{"COLUMNS.COST" | translate}}{{purchaseConfirmCtrl.selected.cost | currency}}
- - -
-
-
-
-
- diff --git a/client/src/partials/purchases/confirm/confirm.js b/client/src/partials/purchases/confirm/confirm.js deleted file mode 100644 index bfd8a7f625..0000000000 --- a/client/src/partials/purchases/confirm/confirm.js +++ /dev/null @@ -1,97 +0,0 @@ -var purchaseConfirm = function (validate, sessionService, connect, $location, messenger) { - - var vm = this; - var dependencies = {}; - vm.is_direct = false; - - dependencies.indirect_purchase = { - query : { - identifier : 'uuid', - tables : { - purchase : { columns : ['uuid', 'reference', 'cost', 'creditor_uuid', 'purchaser_id', 'project_id', 'purchase_date', 'note', 'paid_uuid'] }, - employee : { columns : ['name'] }, - project : { columns : ['abbr'] } - }, - join : ['purchase.project_id=project.id', 'purchase.purchaser_id=employee.id'], - where : ['purchase.paid=1', 'AND' ,'purchase.confirmed=' + 0, 'AND', 'purchase.is_direct=0', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.closed=1'] - } - }; - - dependencies.direct_purchase = { - query : { - identifier : 'uuid', - tables : { - purchase : { columns : ['uuid', 'reference', 'cost', 'creditor_uuid', 'purchaser_id', 'project_id', 'purchase_date', 'note', 'is_direct'] }, - supplier : { columns : ['name'] }, - project : { columns : ['abbr'] } - }, - join : ['purchase.project_id=project.id', 'purchase.creditor_uuid=supplier.creditor_uuid'], - where : ['purchase.confirmed=' + 0, 'AND', 'purchase.is_direct=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.closed=1'] - } - }; - - vm.project = sessionService.project; - validate.process(dependencies).then(initialise); - - function initialise(model) { - vm.idUser = sessionService.user.id; - angular.extend(vm, model); - } - - vm.confirmPurchase = function confirmPurchase(purchaseId) { - vm.selected = (vm.is_direct) ? vm.direct_purchase.get(purchaseId) : vm.indirect_purchase.get(purchaseId); - }; - - vm.confirmPayment = function confirmPayment () { - writeToJournal() - .then(updatePurchase) - .then(generateDocument) - .catch(handleError); - }; - - function updatePurchase () { - var purchase = { - uuid : vm.selected.uuid, - confirmed : 1, - confirmed_by : vm.idUser, - paid : 1 - }; - return connect.put('purchase', [purchase], ['uuid']); - } - - function writeToJournal () { - var query = (vm.is_direct) ? '/confirm_direct_purchase/' + vm.selected.uuid : '/confirm_indirect_purchase/' + vm.selected.paid_uuid; - return connect.fetch('/journal' + query); - } - - function paymentSuccess(result) { - var purchase = { - uuid : vm.selected.uuid, - paid : 1 - }; - return connect.put('purchase', [purchase], ['uuid']); - } - - function generateDocument(res) { - var query = (vm.is_direct) ? '/confirm_direct_purchase/' + vm.selected.uuid : '/confirm_indirect_purchase/' + vm.selected.uuid; - $location.path('/invoice' + query); - } - - function handleError(error) { - //TO DO catch the server error - messenger.danger(error.data); - } - - function getDate() { - var currentDate = new Date(); - return currentDate.getFullYear() + '-' + (currentDate.getMonth() + 1) + '-' + ('0' + currentDate.getDate()).slice(-2); - } - - vm.resetSelected = function () { - vm.selected = null; - }; -}; - -purchaseConfirm.$inject = ['validate', 'SessionService', 'connect', '$location', 'messenger']; - -angular.module('bhima.controllers').controller('PurchaseConfirm', purchaseConfirm); diff --git a/client/src/partials/purchases/purchases.html b/client/src/partials/purchases/purchases.html deleted file mode 100644 index 0c92d2b7a4..0000000000 --- a/client/src/partials/purchases/purchases.html +++ /dev/null @@ -1,40 +0,0 @@ -
- {{ 'PURCHASE_MENU.TITLE' | translate }} -
- - - -
-
-
- -
-
- {{ 'PURCHASE_MENU.OPERATION' | translate }} -
- -
- -
-
-
-
-
-

{{ 'PURCHASE_MENU.TITLE' | translate}}

-

{{ 'PURCHASE_MENU.DESCRIPTION' | translate}}

-
-
-
-
diff --git a/client/src/partials/purchases/purchases.js b/client/src/partials/purchases/purchases.js deleted file mode 100644 index 0182bbfaad..0000000000 --- a/client/src/partials/purchases/purchases.js +++ /dev/null @@ -1,22 +0,0 @@ -angular.module('bhima.controllers') -.controller('PurchaseController', PurchaseController); - -PurchaseController.$inject = [ - '$scope', '$location', '$translate' -]; - -function PurchaseController($scope, $location, $translate) { - var configuration = $scope.configuration = {}; - - configuration.operations = [{ - key : $translate.instant('PURCHASE_MENU.PUCHASE_CREATION'), - link : '/purchases/create' - }, { - key : $translate.instant('PURCHASE_MENU.VIEW'), - link : '/purchases/view/' - }]; - - $scope.loadPath = function loadPath(path) { - $location.path(path); - }; -} diff --git a/client/src/partials/purchases/view/purchase_records.css b/client/src/partials/purchases/view/purchase_records.css deleted file mode 100644 index 4118dbdc9c..0000000000 --- a/client/src/partials/purchases/view/purchase_records.css +++ /dev/null @@ -1,3 +0,0 @@ -.posting { - color: #018107; -} diff --git a/client/src/partials/purchases/view/purchase_records.html b/client/src/partials/purchases/view/purchase_records.html deleted file mode 100644 index 4a6cedb171..0000000000 --- a/client/src/partials/purchases/view/purchase_records.html +++ /dev/null @@ -1,137 +0,0 @@ -
- {{"PURCHASE.VIEW.TITLE" | translate}} -
- - - -
- -
-
- -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.REFERENCE" | translate }}{{ "COLUMNS.DATE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}{{ "COLUMNS.DISCOUNT" | translate }}{{ "COLUMNS.CREDITOR" | translate }}{{ "COLUMNS.PURCHASER" | translate }}{{ "COLUMNS.EMPLOYER" | translate }}{{ "COLUMNS.PAID" | translate }}
{{purchase.reference}}{{purchase.purchase_date | date : 'EEEE, dd/MM/yyyy'}}{{purchase.cost | currency}}{{purchase.discount}}{{purchase.text}}{{purchase.name}}{{purchase.first}} {{purchase.last}} - - - {{"PURCHASE_RECORDS.VIEW_PURCHASE_DETAIL" | translate}}
- {{"PURCHASE_RECORDS.NO_PURCHASE_FOUND" | translate}}. - {{"PURCHASE_RECORDS.REFERENCE" | translate}} - {{"PURCHASE_RECORDS.PURCHASE_ORDER" | translate}} {{"PURCHASE_RECORDS.TO_REQUEST" | translate}}. -
-
-
- -
-
-
- {{"PURCHASE_RECORDS.NO_PURCHASE_FOUND" | translate}}. {{"PURCHASE_RECORDS.REFERENCE" | translate}}{{"PURCHASE_RECORDS.PURCHASE_ORDER" | translate}} {{"PURCHASE_RECORDS.TO_REQUEST" | translate}}. -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.REFERENCE" | translate }}{{ "COLUMNS.DATE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}{{ "COLUMNS.DISCOUNT" | translate }}{{ "COLUMNS.CREDITOR" | translate }}{{ "COLUMNS.SUPPLIER" | translate }}{{ "COLUMNS.EMPLOYER" | translate }}{{ "COLUMNS.CONFIRMED" | translate }}
{{purchase.reference}}{{purchase.purchase_date | date : 'EEEE, dd/MM/yyyy'}}{{purchase.cost | currency}}{{purchase.discount}}{{purchase.text}}{{purchase.name}}{{purchase.first}} {{purchase.last}} - - - {{"PURCHASE_RECORDS.VIEW_PURCHASE_DETAIL" | translate}}
- {{"PURCHASE_RECORDS.NO_PURCHASE_FOUND" | translate}}. - {{"PURCHASE_RECORDS.REFERENCE" | translate}} - {{"PURCHASE_RECORDS.PURCHASE_ORDER" | translate}} {{"PURCHASE_RECORDS.TO_REQUEST" | translate}}. -
-
-
-
-
-
diff --git a/client/src/partials/purchases/view/purchase_records.js b/client/src/partials/purchases/view/purchase_records.js deleted file mode 100644 index 740999fed4..0000000000 --- a/client/src/partials/purchases/view/purchase_records.js +++ /dev/null @@ -1,74 +0,0 @@ - -var purchaseRecords = function ($q, connect) { - var vm = this; - var session = vm.session = { purchase_type: 'indirect'}; - vm.purchase_filter = {}; - - function init() { - vm.selected = null; - var promise = fetchRecords(); - - promise.then(function(model) { - vm.indirect_purchase = model[1]; - vm.direct_purchase = model[0]; - }); - } - - function fetchRecords() { - vm.selected = {}; - var indirect = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'employee' : { - 'columns' : ['name', 'prenom'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'purchase.purchaser_id=employee.id' - ], - where : ['purchase.is_direct=0', 'AND', 'purchase.is_donation=0'] - }; - - var direct = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'confirmed'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'supplier' : { - 'columns' : ['name'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'creditor.uuid=supplier.creditor_uuid' - ], - where : ['purchase.is_direct=1', 'AND', 'purchase.is_donation=0'] - }; - - var d = connect.req(direct); - var i = connect.req(indirect); - return $q.all([d,i]); - } - - init(); -}; - -purchaseRecords.$inject = ['$q', 'connect']; -angular.module('bhima.controllers').controller('purchaseRecords', purchaseRecords); diff --git a/client/src/partials/purchases/view/purchase_view.html b/client/src/partials/purchases/view/purchase_view.html deleted file mode 100644 index 566bc47ce7..0000000000 --- a/client/src/partials/purchases/view/purchase_view.html +++ /dev/null @@ -1,75 +0,0 @@ -
- {{"PURCHASE_RECORDS.TITLE" | translate}} -
- - - -
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.REFERENCE" | translate }}{{ "COLUMNS.DATE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}{{ "COLUMNS.DISCOUNT" | translate }}{{ "COLUMNS.CREDITOR" | translate }}{{ "COLUMNS.PURCHASER" | translate }} / {{ "COLUMNS.SUPPLIER" | translate }}{{ "COLUMNS.EMPLOYER" | translate }}{{ "COLUMNS.PAID" | translate }}
{{purchase.reference}}{{purchase.purchase_date | date : 'EEEE, dd/MM/yyyy'}}{{purchase.cost | currency}}{{purchase.discount}}{{purchase.text}}{{purchase.name}}{{purchase.first}} {{purchase.last}} - - - {{"PURCHASE_RECORDS.VIEW_PURCHASE_DETAIL" | translate}}
- {{"PURCHASE_RECORDS.NO_PURCHASE_FOUND" | translate}}. - {{"PURCHASE_RECORDS.REFERENCE" | translate}} - {{"PURCHASE_RECORDS.PURCHASE_ORDER" | translate}} {{"PURCHASE_RECORDS.TO_REQUEST" | translate}}. -
-
-
-
-
diff --git a/client/src/partials/purchases/view/purchase_view.js b/client/src/partials/purchases/view/purchase_view.js deleted file mode 100644 index 2e1a825420..0000000000 --- a/client/src/partials/purchases/view/purchase_view.js +++ /dev/null @@ -1,278 +0,0 @@ -angular.module('bhima.controllers') -.controller('purchase_view', [ - '$scope', - '$q', - '$routeParams', - 'connect', - function ($scope, $q, $routeParams, connect) { - - var session = $scope.session = {}; - session.option = $routeParams.option; - - $scope.purchase_filter = {}; - - function init() { - var promise = fetchRecords(); - $scope.selected = null; - - promise.then(function(model) { - $scope.purchase_model = model[0].data.concat(model[1].data); - }); - } - - function fetchRecords() { - var requette = {}, direct = {}, indirect = {}; - $scope.selected = {}; - - switch(session.option){ - case 'OrdersPayed' : - indirect = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'employee' : { - 'columns' : ['name', 'prenom'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'purchase.purchaser_id=employee.id' - ], - where : ['purchase.paid=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=0'] - }; - - direct = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'supplier' : { - 'columns' : ['name'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'creditor.uuid=supplier.creditor_uuid' - ], - where : ['purchase.paid=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=1'] - }; - break; - - case 'OrdersWatingPayment' : - indirect = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'employee' : { - 'columns' : ['name', 'prenom'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'purchase.purchaser_id=employee.id' - ], - where : ['purchase.paid=0', 'AND', 'purchase.confirmed=0', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=0'] - }; - - direct = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'supplier' : { - 'columns' : ['name'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'creditor.uuid=supplier.creditor_uuid' - ], - where : ['purchase.paid=0', 'AND', 'purchase.confirmed=0', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=1'] - }; - break; - - case 'OrdersReceived' : - indirect = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'employee' : { - 'columns' : ['name', 'prenom'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'purchase.purchaser_id=employee.id' - ], - where : ['purchase.closed=1', 'AND', 'purchase.confirmed=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=0'] - }; - - direct = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'supplier' : { - 'columns' : ['name'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'creditor.uuid=supplier.creditor_uuid' - ], - where : ['purchase.closed=1', 'AND', 'purchase.confirmed=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=1'] - }; - break; - - case 'InWatingReception' : - indirect = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'employee' : { - 'columns' : ['name', 'prenom'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'purchase.purchaser_id=employee.id' - ], - where : ['purchase.closed=0','AND','purchase.confirmed=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=0'] - }; - - direct = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'supplier' : { - 'columns' : ['name'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'creditor.uuid=supplier.creditor_uuid' - ], - where : ['purchase.closed=0', 'AND', 'purchase.confirmed=1', 'AND', 'purchase.is_donation=0', 'AND', 'purchase.is_direct=1'] - }; - break; - - default : - console.log('default'); - indirect = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'employee' : { - 'columns' : ['name', 'prenom'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'purchase.purchaser_id=employee.id' - ], - where : ['purchase.is_donation=0', 'AND', 'purchase.is_direct=0'] - }; - - direct = { - 'tables' : { - 'purchase' : { - 'columns' : ['uuid', 'reference', 'cost', 'discount', 'purchase_date', 'paid'] - }, - 'creditor' : { - 'columns' : ['text'] - }, - 'supplier' : { - 'columns' : ['name'] - }, - 'user' : { - 'columns' : ['first', 'last'] - } - }, - join : [ - 'purchase.creditor_uuid=creditor.uuid', - 'purchase.emitter_id=user.id', - 'creditor.uuid=supplier.creditor_uuid' - ], - where : ['purchase.is_donation=0', 'AND', 'purchase.is_direct=1'] - }; - break; - - } - - var d = connect.req(direct); - var i = connect.req(indirect); - return $q.all([d,i]); - } - - init(); - } -]); diff --git a/client/src/partials/snis/create/create.css b/client/src/partials/snis/create/create.css deleted file mode 100644 index 6cd433294b..0000000000 --- a/client/src/partials/snis/create/create.css +++ /dev/null @@ -1,25 +0,0 @@ -#canvas-snis h2 { background-color: #efefef; border: 1px solid #ccc; padding: 5px 10px; } -#canvas-snis h3 { padding-left: 10px; } -#canvas-snis table td input[type="text"] { width: 6em; } -#canvas-snis #identification .input-group-addon { min-width: 10em; } -#canvas-snis #hospitalisation .cas-2 input[type="text"] { width: 6em; } -#canvas-snis #hospitalisation table thead td { text-align: center; } -#canvas-snis #hospitalisation table thead .age { font-weight: bold; background-color: #efefef;text-align: center; } -#canvas-snis #hospitalisation table thead .age { border-bottom: 1px solid #999; font-style: italic; } - -table thead .age { border-bottom: 1px solid #999; font-style: italic; } -table thead .age td { border-right: 1px solid #999; } - -.no-padding { padding: 0px !important; } -.text-nota { text-align: center; font-style: italic; } - -.cellmini input[type="text"] { width: 8em; } -.cellmini-5em input[type="text"] { width: 5em; } -.cellmini-6em input[type="text"] { width: 6em; } - -.nav-sm { font-size: 1em; } -.nav-sm li { padding: 0px !important; margin: 2px !important; } -.nav-sm li a { padding: 3px !important; margin: 0px !important; } - -.separate-row tr { display: block; margin-bottom: 5em;font-style: italic;text-align: right; } -.separate-row-2m tr { display: block; margin-bottom: 2em;font-style: italic;text-align: right; } diff --git a/client/src/partials/snis/create/create.html b/client/src/partials/snis/create/create.html deleted file mode 100644 index e5d9adea98..0000000000 --- a/client/src/partials/snis/create/create.html +++ /dev/null @@ -1,71 +0,0 @@ - -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-

PRIERE DE REMPLIR COMPLETEMENT ET TRANSMETTRE A TEMPS CE CANEVAS POUR CENTRALISATION ET ANALYSE.
LA DIVISION SNIS.

-
-
- \ No newline at end of file diff --git a/client/src/partials/snis/create/create.js b/client/src/partials/snis/create/create.js deleted file mode 100644 index 3748916488..0000000000 --- a/client/src/partials/snis/create/create.js +++ /dev/null @@ -1,173 +0,0 @@ -angular.module('bhima.controllers') -.controller('SnisCreateController', SnisCreateController); - -SnisCreateController.$inject = [ - '$scope', '$http', '$q', '$translate', '$location', 'util', - 'validate', 'messenger', 'appstate' -]; - -function SnisCreateController($scope, $http, $q, $translate, $location, util, validate, messenger, appstate) { - var session = $scope.session = { step : 1 }, - identif = $scope.identif = {}, - dependencies = {}; - - dependencies.zs = { - query : { - tables : { - 'mod_snis_zs' : { columns : ['id', 'zone', 'territoire', 'province'] }, - 'project' : { columns : ['name'] }, - 'enterprise' : { columns : ['location_id'] }, - 'village' : { columns : ['name::villageName'] }, - 'sector' : { columns : ['name::sectorName'] }, - 'province' : { columns : ['name::provinceName'] } - }, - join : [ - 'project.enterprise_id=enterprise.id', - 'project.zs_id=mod_snis_zs.id', - 'enterprise.location_id=village.uuid', - 'village.sector_uuid=sector.uuid', - 'sector.province_uuid=province.uuid' - ] - } - }; - - dependencies.employes = { - query : { - tables : { - 'employee' : { columns : ['id', 'prenom', 'name', 'postnom'] }, - 'fonction' : { columns : ['fonction_txt']} - }, - join : ['employee.fonction_id=fonction.id'] - } - }; - - appstate.register('project', function (project) { - $scope.project = project; - dependencies.zs.query.where = ['project.id=' + $scope.project.id]; - validate.process(dependencies) - .then(init); - }); - - function init (model) { - angular.extend($scope, model); - setIdentificationData(); - } - - function setIdentificationData () { - if ($scope.zs.data.length) { - $scope.identif.province = $scope.zs.data[0].province; - $scope.identif.territoire = $scope.zs.data[0].territoire; - $scope.identif.zone = $scope.zs.data[0].zone; - $scope.identif.id_zs = $scope.zs.data[0].id; - $scope.identif.hopital = $scope.zs.data[0].name; - $scope.identif.adresse = $scope.zs.data[0].zone + ',' + $scope.zs.data[0].territoire + '-' + $scope.zs.data[0].province; - $scope.identif.medecin_dir = ''; - $scope.identif.qualification = ''; - $scope.identif.date_envoi = new Date(); - $scope.identif.date_reception = new Date(); - $scope.identif.date_encodage = new Date(); - } else { - console.warn('There are no data...'); - } - } - - function submit () { - - function submitIdentification () { - var def = $q.defer(), next = false; - - if ($scope.identif.mois && $scope.identif.medecin_dir_id && $scope.identif.nom_reception_id && $scope.identif.nom_envoi_id && $scope.identif.nom_encodage_id) { - - $http.post('/snis/createReport/',{params : - { - zs_id : $scope.identif.id_zs, - period : $scope.period, - project_id : $scope.project.id, - id_employe_medecin_dir : $scope.identif.medecin_dir_id, - info : $scope.identif.info, - date_reception : util.sqlDate($scope.identif.date_reception), - id_employe_reception : $scope.identif.nom_reception_id, - date_envoi : util.sqlDate($scope.identif.date_envoi), - id_employe_envoi : $scope.identif.nom_envoi_id, - date_encodage : util.sqlDate($scope.identif.date_encodage), - id_employe_encodage : $scope.identif.nom_encodage_id - } - }) - .success(function (res) { - next = true; - def.resolve(next); - }) - .error(function (err) { - messenger.danger('[erreur] lors de la sauvegarde', true); - }); - } else { - messenger.info('Veuillez remplir correctement les zones de l\'identification', true); - } - - return def.promise; - } - - function saveData (obj){ - $http.post('/snis/populateReport',{params : {data : obj}}) - .success(function(){ - messenger.success('[success] Donnees sauvegardees avec succes', true); - $location.path('/snis/'); - }); - } - - // sending and saving data - submitIdentification() - .then(function () { - saveData($scope.snis_report); - }); - } - - function loadView (view_id) { - session.step = view_id; - } - - $scope.getMedecinDir = function (obj) { - $scope.identif.medecin_dir_id = obj.id; - $scope.identif.medecin_dir = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - $scope.identif.qualification = obj.fonction_txt; - }; - - $scope.identif.nom_envoi_selected = function (obj) { - $scope.identif.nom_envoi_id = obj.id; - $scope.identif.nom_envoi = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - }; - - $scope.identif.nom_reception_selected = function (obj) { - $scope.identif.nom_reception_id = obj.id; - $scope.identif.nom_reception = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - }; - - $scope.identif.nom_encodage_selected = function (obj) { - $scope.identif.nom_encodage_id = obj.id; - $scope.identif.nom_encodage = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - }; - - $scope.getPeriod = function (obj) { - $scope.period = util.sqlDate(obj); - }; - - $scope.next = function () { - if (session.step < 9) { - // next step - session.step++; - } else if (session.step === 9) { - // validate operations - submit(); - } - }; - - $scope.previous = function () { - if (session.step > 1 && session.step <= 9) { - // next step - session.step--; - } - }; - - $scope.snis_report = {}; - $scope.loadView = loadView; -} diff --git a/client/src/partials/snis/snis.html b/client/src/partials/snis/snis.html deleted file mode 100644 index 0d537752ab..0000000000 --- a/client/src/partials/snis/snis.html +++ /dev/null @@ -1,61 +0,0 @@ -
- {{ "SNIS.TITLE" | translate }} -
- - - -
-
- -
-
-
- {{ "SNIS.ALL" | translate }} -
- - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.REFERENCE" | translate }}{{ "COLUMNS.NAME" | translate }}{{ "COLUMNS.ACTION" | translate }}
{{ report.id }}{{ "SNIS.LABEL" | translate }} - {{ report.date | date:"MMMM yyyy" }}
{{ "SNIS.NO_DATA" | translate }}
-
-
- -
-
-

{{ "SNIS.TITLE" | translate }}

-

{{ "SNIS.DESCRIPTION" | translate }}

-
-
- -
-
diff --git a/client/src/partials/snis/snis.js b/client/src/partials/snis/snis.js deleted file mode 100644 index 51e444bd6c..0000000000 --- a/client/src/partials/snis/snis.js +++ /dev/null @@ -1,55 +0,0 @@ -angular.module('bhima.controllers') -.controller('SnisController', SnisController); - -SnisController.$inject = [ - '$scope', '$q', '$translate', '$http', '$location', - 'validate', 'messenger', 'connect', 'appstate' -]; - -function SnisController($scope, $q, $translate, $http, $location, validate, messenger, connect, appstate) { - var dependencies = {}; - - // dependencies.reports = { - // query : '/snis/getAllReports' - // }; - - dependencies.reports = { - query : { - tables : { - 'mod_snis_rapport' : { columns : ['id', 'date'] }, - 'project' : { columns : ['name'] } - }, - join : ['mod_snis_rapport.id_snis_hopital=project.id'] - } - }; - - appstate.register('project', function (project) { - $scope.project = project; - dependencies.reports.query.where = ['project.id='+$scope.project.id]; - validate.process(dependencies, ['reports']) - .then(init); - }); - - function init(model) { - angular.extend($scope, model); - } - - $scope.print = function (obj) { - - }; - - $scope.edit = function (obj) { - $location.path('/snis/update/' + obj.id); - }; - - $scope.delete = function (obj) { - $http.delete('/snis/deleteReport/' + obj.id) - .success(function (res) { - validate.refresh(dependencies, ['reports']) - .then(init) - .then(function () { - messenger.success('[succes] Rapport supprime avec succes', true); - }); - }); - }; -} diff --git a/client/src/partials/snis/templates/step1.html b/client/src/partials/snis/templates/step1.html deleted file mode 100644 index fba64eb57d..0000000000 --- a/client/src/partials/snis/templates/step1.html +++ /dev/null @@ -1,129 +0,0 @@ -
-
-

{{ "SNIS.STEP1" | translate }}

- -
-
- -
- -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
-
-
-
-
- - -
-
- -
- - -
- -
- - -
-
-
-
-
-
- -
-
-
- - -
-
- -
-
- - -
-
-
- -
-
-
- - -
-
- -
-
- - -
-
-
-
-
- -
-
-
- - -
-
- -
-
- - -
-
-
-
-
-
- - -
-
- -
-
- - -
-
-
-
-
- -
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step2.html b/client/src/partials/snis/templates/step2.html deleted file mode 100644 index 4aee1baf51..0000000000 --- a/client/src/partials/snis/templates/step2.html +++ /dev/null @@ -1,778 +0,0 @@ -
-

{{ "SNIS.STEP2" | translate }}

-
-
-
-

2.1 Consultations externes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZ
Nouveaux cas
--- Dont nouveaux patients
--- Dont adherant des mutuelles
Anciens cas
Référés par le CS / autres structures
- -

2.1 Consultations externes (suite)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Consultations (a+b+c+d)
Indigents
Nouveaux cas vu par medecin
Nouveaux Cas < 5 ans
Nouveaux Cas féminins
Dont femmes enceintes
Nouveaux Cas référés par CS avec document
Nouveaux Cas référés et vu par médecin
Contre-référés au CS/autres structures avec doc
Référés par l’HGR vers l ’HGRP
Contre-référés par HGRP à l’HGR
- -

2.3 Consultations Survivants de violance Sexuelle

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Nouveaux cas SVS
--- Dont vu 72h
--- Dont Feminin
Anciens Cas SVS
SVS Référés juridique
SVS Référés à la réinsertion socio_économique
SVS Référés psycho-social
SVS Référés vers HGRP ou FOSA Specialisees
SVS ayant recu une PEC médicale(Médecin ou Infirmier)
SVS ayant recu le kit PEP – 72 h
SVS ayant recu le kit PEP après 72h
SVS ayant recu la Contraception d'Urgence
SVS testés pour le VIH
SVS testés VIH+
Fistules urogénitales post viol diagnost.
Fi stul es urogénital es post vi ol diagnost. réparés
-
- -
-

2.2. Consultations aux urgences

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZ
Nouveaux cas vus en urgence
--- Dont AVC
--- Dont morsure de serpent
--- Noyade
traumatisme
--- Dont accident trafic routier
Ancien Cas
Référés par le CS/ Autres Fosa
- -

2.2 Consultation aux urgences (suite)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Cas aux urgences
Cas décédés
Cas référés vers une FOSA spécialisée
Cas envoyés en hospitalisation
Cas sortis
-
-
-
-
-

2.4. Notification des nouveaux cas

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 0 - 11 mois12 - 59 mois5 - 14 ans15 ans +Total
Accident vasculo-cérébral (AVC)
Accidents de travail
Amibiase
Anémie
Autre affection cardio vasculaire
Brûlures
Cancer du col utérin
Cancer de la prostate
Cancer du sein
Choléra
Coqueluche patient non vacciné
Coqueluche patient vacciné
Diabète
Diarrhée sanglante
Diarrhée simple
Drépanocytose
Épilepsie
Erreur de réfraction
Fièvre hémorragique
Fièvre jaune
Fièvre typhoïde
Filariose lymphatique
Filarioses (autres)
Goitre
Hépatite virale aiguë
Infection dermatologique
Infection urinaire
Infections sexuellement transmissibles (IST)
Intoxications aux produits indigènes
IRA inférieure (pneumonie)
IRA sup (syndrome grippal / rhume)
Konzo
Lèpre
Maladie mentale
Maladies oculaires
Maladies professionnelles
Malnutrition aigue modérée
mal nutrition aiguë sévère
Méningite
Monkey Pox
Morsure par des animaux vénimeux
Noma
Onchocercose
Peste
PFA
Rage
Rougeole patient non vacciné
Rougeole patient vacciné
Schistosomiase
Syndrome appendiculaire
Syndrome gastritique
Tétanos
Tétanos néonatal
Toxicomanie et autres
Traumatisme
Trypanosomiase
Tuberculose TPM+
Typhus
Ulcère de Buruli
VIH/SIDA
Xérophtalmie
Autres
-
-
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step3.html b/client/src/partials/snis/templates/step3.html deleted file mode 100644 index a3d845ab1a..0000000000 --- a/client/src/partials/snis/templates/step3.html +++ /dev/null @@ -1,1486 +0,0 @@ -
-

{{ "SNIS.STEP3" | translate }}

-
-
-
-

3.1. Diagnostic et issue des cas hospitalisés sortis ce mois

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 0 - 11 mois1 - 4 ans5 - 14 ans15 ans +Total
 CasDcdCasDcdCasDcdCasDcdCasDcd
Accident vasculo-cérébral (AVC)
Amibiase
Anémie
Autre affection cardio vasculaire
Brûlures
Cancer du col utérin
Cancer de la prostate
Cancer du sein
Choléra
Coqueluche patient non vacciné
Coqueluche pati ent vacciné
Diabète
Diarrhée sanglante
Diarrhée simple
Drépanocytose
Épilepsie
Erreur de réfraction
Fièvre hémorragique
Fièvre jaune
Fièvre typhoïde
Filariose lymphatique
Filarioses (autres)
Goitre
Hépatite virale aiguë
Infection dermatologique
Infection urinaire
Infections sexuellement transmissibles (IST)
Intoxications aux produits indigènes
IRA inférieure (pneumonie)
IRA sup (syndrome grippal / rhume)
Konzo
Lèpre
Maladie mentale
Maladies oculaires
mal nutrition aiguë sévère
Méningite
Monkey Pox
Morsure par des animaux vénimeux
Onchocercose
Peste
PFA
Rage
Rougeole patient non vacciné
Rougeole patient vacciné
Schistosomiase
Syndrome appendiculaire
Syndrome gastritique
Tétanos
Tétanos néonatal
Toxicomanie et autres
Trypanosomiase
Tuberculose TPM+
Typhus
Ulcère de Buruli
VIH/SIDA
Violences sexuelles
Xérophtalmie
Autres
- -

3.2. Prise en charge

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Personnes ayant reçu le conseil et le traitement afin de prévenir les crises cardiaques ou les AVC
Cas d'hypertension diagnostiqués et mis sous traitement
Enfants de moins de 5 ans présentant la pneumonie et ayant reçu un antibiotique approprié
Enfants malades qui ont été correctement soignés contre la diarrhée avec SRO et sulfate de zinc
Nouveaux patients diabétiques mis sous traitement
Nouveaux cas de Déficience physique et sensorielle correctement prise en charge
Cas de cancer confirmé, admis en traitement chimiothérapie
Cas de cancer confirmé, ayant reçu la morphine
- -

3.2.1 Paludisme

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 0-11 mois12-59 mois5-14 ans15 ans +TotalDont femme
enceinte
Cas suspect
TDR réalisés
--- Dont positif
Goutte épaisse réalisée
--- Dont positif
Frottis mince réalisés
Paludisme simple confirmé
--- Dont traité
Paludisme grave confirmé
--- Dont traité
--- Dont décédé
Paludisme simple non confirmé
--- Dont traité
Paludisme grave non confirmé
--- Dont traité
--- Dont décédé
- -

3.3. VIH/SIDA

-

3.3.1. Conseils et dépistage volontaire (CDV)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 MasculinFemininTotal
 TestésPositifsNégatifsTestésPositifsNégatifsTestésPositifsNégatifs
0 – 14 ans
15 – 19 ans
20 – 24 ans
25 ans et plus
- -

3.3.2. Rapport conseils et dépistage volontaire pour les MSN et PS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 MasculinFemininTotal
 < 15 ans15 - 24 ans25 ans +< 15 ans15 - 24 ans25 ans +
Nb de MSN conseill és, testés et ayant retiré les résultats
Nb de PS conseillés, testés et ayant retiré les résultats
- -

3.3.3. Infections sexuellement transmissibles (IST)

- - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Nouveaux cas IST
Contacts parmi les Nouveaux Cas IST
Cas IST conseillés et testés au VIH
Cas IST traités selon l’approche syndromique.
- -

3.3.4. Soins, traitement et soutien

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Anciens CasNouveaux CasTotal
Nombre Nouveaux Cas IO
--- Dont Nouveaux Cas TBC
Nombre de PVV sous prophylaxie CTX
Nombre de PVV VIH dépistée TB sous prophylaxie CTX
Nombre de patients ayant bénéficié de la PEC PSS
Nombre de PVV Malnutris ayant bénéficié de la PEC Nutritionnelle
Nombre de PVV bénéficiant du suivi dans le cadre des visites à domicile
Nombre des PVVIH ayant bénéficié du suivi biologique par le CD4
Nombre d’enfant nés de mères VIH+ ayant bénéficié du DBS/PCR DNA
Nbre des personnes exposées ayant bénéficié du Kit PEP
Nombre de patients sous TARV
Nombre de PVV perdues de vue
Nombre de PVV file d’attente
- -

3.3.5. Nombre des patients sous traitement antirétroviral

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  < 14 ans 14 ans et plusTotal
 MasculinFemininDont
Enceinte
TotalMasculinFemininDont
Enceinte
Total 
AZT+3TC+NVP
AZT+3TC+ EFV
TDF+3TC+NVP
TDF+3TC+EFV
AZT+3TC+ NVP Sirop (pédiatrique)
ABC+ddI+LPV/r
ABC + 3TC + EFV
- -

3.3.6. Rétention sous TARV

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 MasculinFeminin
 12 mois24 mois36 mois60 mois12 mois24 mois36 mois60 mois
Adultes/enfants en vie et sous TARV depuis
- -

3.4. Utilisation des services

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Méd. inter.PédiatrieChirurgieGyn. Obst.AutresTotal
Nombre des lits
Nombre des journées d'hospitalisation Potentielles (d)
Malades début du mois
Malades du mois
--- Référés
--- Enfants < 5ans
Sortants du mois dont (b)
--- Sortants autorisés / Guéris
--- Statu quo
--- Evadés / Abandons
--- Décès avant 48 h
--- Décès après 48 h
--- Dont total décès enfants < 5ans
--- Transféré vers autre hôpital
--- Contre-référés vers CS / autres FOSA
--- Ayant subi intervention chirurgicale (e)
--- Ayant présenté une infection post-operatoire (f)
--- Ayant développé une infection nosocomiale
Somme séjours des malades sortants (a)
Nombre des journées hospitalisation Effectives (c)
Durée moyenne de séjour (a/b)
Taux d'occupation des lits (c/d)
Proportion d’infections post opératoires (f/e)
- -

3.5. Activités du bloc opératoire

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Type d'InterventionUrgenteProgramméeTotal
Appendicectomie
Herniorraphie
Laparotomie
Cataracte
Autres interventions en chirurgie génerale
Césarienne
Hystérectomie
Sur grossesse extra-uterine
Réparation fistules
Autres Interventions en gyneco-obstétrique
Amputations
Ostéosynthèse
Pieds bots
Autres Interventions orthopédiques
Total Interventions majeures
Total Interventions mineures
Total Interventions propres
- -

3.5. Activités du bloc opératoire (suite)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Jours de non fonctionnement du bloc opératoire
Anesthésie avec gaz
Anesthésie avec Kétamine
Autre anesthésie générale
Rachi anesthésie
Autre anesthésie régionale
Anesthésie locale
Interventions mineures avec décès post-op
Intervention majeures avec décès post-op
Infections du post opératoire
Prop d’infections du post opératoire
Poches de sang utilisées
Poches de sang utilisées et testées VIH / qualifiés
- -
-
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step4.html b/client/src/partials/snis/templates/step4.html deleted file mode 100644 index 0bad32c9b0..0000000000 --- a/client/src/partials/snis/templates/step4.html +++ /dev/null @@ -1,754 +0,0 @@ -
-

{{ "SNIS.STEP4" | translate }}

-
-
-

4.1. Examens de Laboratoire

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
 TotalPositif
Chimie Urines
--- Dosage albumine
--- Sucre
Culot urinaire
--- Schisto-haem.
--- Trichomonas
--- Autres
Gouttes épaisses
--- Micro filaire
--- Plasmodium
--- Trypanosome
--- Autres
Goutte fraîche
Ponct. ganglionnaires
--- Trypanosomes
--- Autres
LCR
--- Biochimie
--- Cytologie
--- Bactériologie
Couples dépistés: drépanocytose
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
 TotalPositif
Selles
--- Amibe
--- Ankylostome
--- Schisto-mansoni
--- Trichomonas
--- Ascaris
--- Oxyures
--- Autres
Hémoglobine
--- < 8gr %
Crachat Ziehl / BK Dépistage
--- Ziehl / BK Contrôle C2/C3
--- Ziehl / BK Contrôle C5
--- Ziehl / BK Contrôle C6/C7
VIH
Test rapide (Det., Unigld, Db chk)
Test lent(PCR,DNA,DBS)
Autres test drépanocytose
Culture
Antibiogramme
Ionogramme
WIDAL
-
-
- -
-

4.2. Banque de sang

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Tests RéalisésRésultats positif
 MasculinFemininMasculinFeminin
Tests de Sang rapportés Donneurs Benevole (DB)
Tests de Sang rapportés Donneurs Fidelisés (DF)
Tests de Sang rapportés Donneurs Payants(DP)
Testées HIV DF
Testées HIV DB
Testées HIV DP
Testées Hep B DB
Testées Hep B DF
Testées Hep B DP
Testées Hep C DB
Testées Hep C DF
Testées Hep C DP
Testées RPR DB
Testées RPR DF
Testées RPR DP
Transfusions sanguines testées aux 4 marqueurs
Transfusions sanguines non-testées
-
-
- - - - - - - - - - - - - - - - -
Proportion de sang VIH+ = tot poche VIH+ ´100 / tot poche test VIH
Proportion de sang HepB+ = tot poche Hep B+ ´100 / tot poche test Hep B
Proportion de sang Hep C+ = tot poche Hep C+ ´100 / tot poche test Hep C
Proportion de sang RPR+ = tot poche RPR+ ´100 / tot poche test RPR
-
-
- -
-

4.2. Banque de sang (suite)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 PédiatrieMédecine interneGynéco-obstétriqueChirurgieRéanimation urgence
 MasculinFemininMasculinFemininMasculinFemininMasculinFemininMasculinFeminin
Nature Transfusion Sang total
Nature Transfusion Concentré globulaire
Nature Transfusion Plasma frais congelé
Nature Transfusion Plaquettes
Nombre d’anémie
Nombre professionnels de santé victimes d'Accident d'Exposition au Sang(AES)
- -

4.3. Imagerie médicale

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Examens demandésExamens réalisésJours non-disponibles
RX Poumon
RX Os
RX Abdomen à blanc
RX du tube digestif avec prod. de contraste
Autre RX
Scanner
Echographie
ECG
EEG
Gastroscopie
Autres examens d'imagerie médicale
- -

4.4. Kinésithérapie et réadaptation

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 InterneExterneTotal
Nouveaux patients
Anciens patients
Total patients
--- Dont cas de neurologie
--- Dont cas d’orthopédie
--- Dont cas de traumatologie
--- Dont cas infectieux
Actes de kinésithérapie
--- Nb Massage
--- Nb Mobilisation passive ou active
--- Nb Mécanothérapie
--- Nb Plâtre de correction
--- Nb Verticalisation
--- Nb Rééducation à la marche
--- Nb Rééducation psycho motrice
--- Nb Kinésithérapie respiratoire
--- Nb Thermothérapie
--- Nb Cryothérapie
--- Nb Electrothérapie antalgique (TENS)
--- Nb Electrothérapie stimulatrice
--- Nb Electrothérapie ultrasons
--- Nb Autres
-
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step5.html b/client/src/partials/snis/templates/step5.html deleted file mode 100644 index 99a40287ff..0000000000 --- a/client/src/partials/snis/templates/step5.html +++ /dev/null @@ -1,1041 +0,0 @@ -
-

{{ "SNIS.STEP5" | translate }}

-
- -
-
-

5.1. Consultation prénatale (CPN)

-
-
- - - - - - - - - -
Pop cible = fe du mois
Séances de CPN
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZTotal
Visites CPN 1
--- Femmes enceintes < 20 Ans
Visites CPN 2
Visites CPN 3
Visites CPN 4
Femmes enceinte ayant réalisé la CPN1 au 1er trimestre
Femmes enceinte avec CPN 4 dont une au 8ème - 9ème mois
Femmes enceintes référées par le Centre de Sante
Femmes enceintes < 20 Ans référées par le Centre de Sante
Femmes enceinte à risque détectées
Femmes enceinte à risque référée vers l’HGRP ou FOSA spécialisée
Fer + Acide Folique 1ère dose reçue
Fer + Acide Folique 2ème dose reçues
Fer + Acide Folique 3ème dose reçue
Sulfadox. + Pyrimét 1ère dose reçue
Sulfadox. + Pyrimét 2ème dose reçues
Sulfadox. + Pyrimét 3ème dose reçue
Complètement vaccinées avant grossesse
Ayant acquis une MILD
Ayant reçu le Mébendazole à partir du 2ème trimestre
-
-
- - - - - - - - - - - - - - - - - -
Proportion de grossesses à haut risque détectées = Tot Grossesses à haut risque détectées x 100 / Total Nlles Inscrites
Propor-on de grossesses à haut risque référées = Tot Grossesses à haut risque référées x 100 / Total femmes à hauts risques détectées inscrites
Proportion de fe ayant reçu au moins la SP 2 = Nombre de femmes enceintes ayant reçu au moins 2 Quantité de SPX100 / Fe ayant effectué la première visite prénatale
Proportion des femmes enceintes ayant reçues une MILD à la CPN = femmes enceintes ayant acquis MILD X 100/ Total CPN1
-
-
- -

5.2. Prévention transmission mère enfant (PTME)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Qui connaissent leur statut sérologique VIH avant la CPN1
Qui ont été conseillée pour un test VIH
Qui ont été testées pour le VIH
Qui ont été informées du résultat
Qui ont eu un test positif au VIH
Qui ont eu un test positif au VIH et ont été informées du résultat
Qui sont VIH+ ayant bénéficié de la prophylaxie aux ARV (AZT /AZT+3TC+NVP)
Qui sont VIH+ ayant bénéficié de la prophylaxie au cotrimoxazole
Qui sont VIH+ dont l’éligibilité au TARV a été évaluée selon les critères clin. ou imm.
Qui sont VIH+ qui sont référées vers une structure de PEC
Testées et informées de leur résultat lors du travail, accouchement et post partum (72 h)
Femmes enceintes VIH+ éligibles au TARV (CD4 ou classification clinique)
Femmes enceintes ont été mis sous TARV
Qui ont eu la grossesse à l’issue d’un Viol
Mères VIH+ ayant opté pour l’allaitement exclusif jusqu’à 6 mois
Qui ont été dépistés pour la syphilis à la CPN
Qui ont été dépistés positives à la syphilis
Dont mères VIH+ mises sous double protection (PF+ préservatif)
Accouchées VIH +
--- Dont ayant reçu de la névirapine + AZT+LAV
Enfants nés de mère VIH+
--- Dont mis sous la névirapine + AZT+LAV a la naissance
--- Dont mis sous NVP à la naissance
--- Dont mis sous NVP pendant 6 semaines après la naissance
--- Dont mis sous cotrimoxazole pendant 6 semaines après la naissance
--- Dont mis sous NVP pendant 12 mois après la naissance
Enfants exposés reçus et testés au PCR1 à 6 semaines après la naissance
Enfants exposés testés positifs au PCR1 à 6 semaines après la naissance
Enfants exposés reçus et testés au PCR2 à 10 semaines après la naissance
Enfants exposés testés positifs au PCR2 à 10 semaines après la naissance
Enfants exposés testés au PCR1 ayant bénéficié d'un test séro. à 12 mois
- -

5.3. Partenaires et membres de famille de la femme enceinte

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Partenaires masculins de femme enceinte VIH+Membres de famille de femme enceinte VIH+
 ConseillésTestésPositifsInformées de
leur résultat
ConseillésTestésPositifsInformées de
leur résultat
0 - 14 ans
15 – 19 ans
20 – 24 ans
25 ans et plus
Total general
- -

5.4. Gynéco-obstétrique

-
-
-

5.4.1. Avortements

- - - - - - - - - - - - - - - - - -
 Nombre
Avortements spontanés
Avortements provoqués
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 NombreComplication
Curetage après avortement spontané
Curetage après avortement provoqué
Aspiration manuelle intrautérine réalisée
Décès liés aux avortements
- -

5.4.3. Accouchements avec interventions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Césariennes
Ventouses
Episiotomie
Manœuvre externe
Théobald
Autres interventions
Proportion accouchement dystociques = Nb Acc dystociques 100 / total accouchements
- -

5.4.5. Issue de la mère et soins

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Décès maternels
--- Dont décès maternels audités
--- Dont décès après intervention obstétricale
Infection du post-partum
Mères ayant reçu Vit A
Mères ayant reçu le mésoprostol
Mères ayant reçu l’ocytocine
Mères ayant reçu AZT/ 3TC/ NVP
Mères ayant bénéficié de la GATPA
Accouchée/parturiente ayant reçu antibiot. en IV/IM
Accouchée ayant reçu les anticonvuls ivants IV/IM
Mères ayant reçu CTX
-
-
-

5.4.2. Accouchements

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZTotal
Accouchements eutociques
Accouchements dystociques
Dont âgés de < 20 ans
Dont surveillés
Référé par CS
Référé par CPN
- -

5.4.4. Complications chez la mère

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Ruptures utérines
Eclampsie
Hémorragie du post partum
Dont celle ayant bénéficié de la transfusion sanguine
Déchirure du périnée
Déchirure du col
Autres
- -

5.4.6. Issue de l’enfant

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Naissances vivantes
Nouveaux-nés à terme
Nouveaux-nés à terme < 2 500 g
Morts nés frais
Mort-nés macérés
Dont asphyxié néonatale
Nouveau-nés avec malformation congénitale visible
Nouveaux-nés Prématurés
Dont conjonctivite
Nouveaux nés prématurés et de faibles poids de naissance s oignés selon la méthode du Kangourou
Nouveaux-nés ayant bénéficiés des soins essentiels
Nouveaux-nés ayant reçus d’antibiotiques
Nouveaux-nés mis au sein dans l’heure qui suit l’accouchement
Nouveaux nés Ayant été réanimé
Références mère et bébé
Décès nouveau-nés ≤ 7 jours
Décès nouveau-nés ≤ 28 jours
Femmes admises au village d’accueil
--- Morts nés parmi fe admises au village d’accueil
Naissances assistées
Dont mort-nés
-
-
- -

5.5. Consultations post- natales (CPON)

-
-
-
- - -
Nombre de séances
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZTotal
CPoN1 (6e jr après accouchement)
Accouchées enregistrées à la CPON3 (42ème jour)
Nb accouchées ayant reçu du Fer Folate
Nb accouchées ayant reçu de la vitamine A
Nb femmes ayant présenté des complications après l’accouchement
- -

5.6. Planification familiale (PF)

- -

5.6.1. Utilisation des Services de Planification familiale (PF)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZTotal
Nouveaux cas (Nouvelle acceptante) des services PF
Dont Moins de 20 ans
Ancien Cas (Renouvellement ou changement des methodes PF)
- -

5.6.2. Utilisation des Methodes de Planification familiale (PF)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nouvelles
acceptantes
ZS
Nouvelles
acceptantes
HZ
Renouvellement
année en cours
Renouvellement
années anterieures
Quantités utiliséesJrs RuptureQuantités disponiblesFacteurAnnée couple
protection
Inj. Dépoprovera
Inj. Norestera
Plaquette pilule
Plaquette pilule combinée
DIU placés
Préservatif masculin
Préservatif feminin
Spermicide cés
Spermicide bombe
Implants
Collier du cycle
MAMA
MAO confirmé
Ligature tubaire
Vasectomie
TOTAL
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step6.html b/client/src/partials/snis/templates/step6.html deleted file mode 100644 index bd29345243..0000000000 --- a/client/src/partials/snis/templates/step6.html +++ /dev/null @@ -1,180 +0,0 @@ -
-

{{ "SNIS.STEP6" | translate }}

-
- (NB : les données sur la vaccination sont rapportées par le CS de l’aire de santé où est situé l’HGR) - -

6.1. Réhabilitation nutritionnelle

- - - - - - - - - - - - - - - - - - - - -
 Malnutrition
modérée
Malnutrition
sévère
Effectif au début du mois
Nouvelle admission
- -

6.1.1. Entrées

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 < 6 mois6-24 mois24-59 mois5-18 ansAdultesTotal
Nouvelles admissions en P/T < -3 ET ou P/T< 70% ou IMC< 18 ou PB < 115mm ou PB< 180mm
Nouvel les admissions en œdème
Nouvel les admissions en rechute
Autres Entrées référence dune UNTA
Autres Entrées réadmission après abandon
Autres Entrées référence d’une UNTI
- -

6.1.2. Sorties

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 < 6 mois6-24 mois24-59 mois5-18 ansAdultesTotal
Sorties Guéris en réhabilitation nutritionnelle
Sorties Décès en réhabilitation nutritionnelle
Sorties abandon confirmés en réhab. nutritionnelle
Sorties abandon non confirmés en réhab. nutrit.
Sorties Non répondant en réhab. nutrit.
Sorties Contre référence vers UNTA en réhab. nutrit.
Sorties Référence vers autre UNTI en réhab. nutrit.
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step7.html b/client/src/partials/snis/templates/step7.html deleted file mode 100644 index e3007aba3e..0000000000 --- a/client/src/partials/snis/templates/step7.html +++ /dev/null @@ -1,2534 +0,0 @@ -
-

{{ "SNIS.STEP7" | translate }}

-
-

7.1. Gestion du personnel

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nb AgentsNb Jrs de
Travail
Prévu
Nb Jrs de
Travail
presté
Nb Jrs de
d'Absence
justifié
Nb Jrs de
d'Absence
non-justifié
Chirurgien
Gynécologue
Pédiatre
Internistes
Autres médecins spécialistes
Médecin généraliste
Chirurgien dentiste
Anesthésiste réanimateur
Kinésithérapeute
Pharmacien
Infirmier L2
Infirmier A1
Infirmier A2
Autres infirmiers
Accoucheur(se)/Sage-femmes
Nutritionnistes A2 /A1/ L2
Techniciens de laboratoire A2 A1 L2
Techniciens en radiologie A1 L2
Autres Techniciens L2 / A1/A2
Administrateur gestionnaire G3
Administrateur gestionnaire L2
Comptable
Personnel administratif
Stastisticien
Technicien d’assainissement A1 L2
Personnel de maintenance
Autres personnel
- -

7.2. Gestion des matériels, Hygiene, Eau et Assainissement

- -
-
-

7.2.1 Materiels et equipements medicaux

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre Jrs
Non-Fonctionnel
Frigo
Congelateur
Boîte isotherme
Balance Salter
Balance pèse adulte
Balance pèse bébé
Toise
Microscope
Centrifugeuse
Stérilisateur
Appareil de réanimation
Couveuse
Echographe
Radiographie
Echocardiographie
- -

7.2.3. Hygiene & Gestion des dechets

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre Jrs
fonctionnels
Incinérateur
Latrines hygiénique
Poubelles
Fosse à placenta
Trou à ordures
Eau courante (avec robinet)
Points d’eau existant
Buanderie
Unite de sterilisation
-
-
-

7.2.2. Materiel et Equipement de bureau

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre Jrs
Non-Fonctionnel
Ordinateur
Photocopieuse
Machine à écrire
Stencileuse
Moto
Véhicule
Hors-Bord
Phonie
Internet
Electricité
Système solaire
Groupe électrogène
-

Déclarer le nombre de jours durant lequel aucune unité n’a été fonctionnelle. (ex : nombre de jours sans aucun frigo fonctionnel)

-
-
- -

7.2.4. Gestion du matériel roulant et du carburant: Distances Parcourues

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Vehic 1Vehic 2Vehic 3Vehic 4Hors-bord 1Hors-bord 2Moto 1Moto 2Moto 3Moto 4Moto 5
Supervision
Formation
Transp Medicaments
Transp Malades
Monitorage
Administration
Surveillance
Autre
Total (KM parcourus)
- -

7.2.4. Gestion du matériel roulant et du carburant (suite)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Vehic 1Vehic 2Vehic 3Vehic 4Hors-
bord 1
Hors-
bord 2
Moto 1Moto 2Moto 3Moto 4Moto 5Groupe
Electrogene
Total
Quantité du carburant consommée
Km parcourus
Cons. carburant au Km ou hre
- -

7.2.4.Gestion du matériel roulant et du carburant (Fin)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 GasoilEssencePétrole
Stock début du mois
Quantité reçue au cours du mois
Stock fin du mois
- -

7.3. Gestion de la pharmacie

- -

7.3.1. Consommation des médicaments et autres intrants

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Stock Initial
Début mois
EntréesSorties hors
consommation
Qtés
consommées
Stock
disponible
(inv. physique)
Nb jours
rupture
de stock
Qté voie
péremption
Aspirine Co 500mg
Paracétamol 500 mg
Artémether inj 40 mg
Artémether inj 80 mg
Artésunate-Amodiaquine (12 -59 m)
Artésunate-Amodiaquine (2-11 m)
Artésunate-Amodiaquine (6-13 a)
Artésunate-Amodiaquine, (14a+)
Luméfantrine + Artéméther
Quinine amp 600 mg
Quinine co 500 mg
TDR
SP 500/25 mg, co
MIILD
Diazepam 5 mg amp
SRO
Zinc 20 mg
Amoxycilline caps 250 mg
Amoxycilline caps 500 mg
Amoxycilline 1g, Vial , Unité
Cotrimoxazole 480 mg
Ceftriaxone 1 gr inj
Gentamycine
Ciprofloxacine, 2mg/ml, 100ml , Flacon, Unité
Péniprocaïne+Benzyl 3+1 MIU, amp
Hydralazine
Hydrocortisone
Mebendazole 100 mg
Métronidazole 250 mg co
Preservatif feminin
Preservatif masculin
Depo-Provera
DIU
Microgynon
Implant
Plaquettes des Pilules
Determine
Double check
Kit PEP
Névirapine Sp
AZT+3TC+ NVP Sirop (pédiatrique)
AZT+3TC+EFV
AZT+3TC+LPV/r (pour VIH 2)
AZT+3TC+NVP
ABC+ddI+LPV/r
Kit groupage sanguin
Transfuseur avec filtre
Poche de transfusion, u.u., 250ml, Unité
Poche de transfusion, u.u., 450ml, Unité
Kit test sécurité transfusionnelle
Kit test VIH pour site PTME
Test HCV Hepatitis C, Rapid for HCV
Test Hepatitis B HbsAg Determine
Test HIV 1+2 (Determine)
Test Kit, HIV 1+2, Eli sa, 192T Vironostika Uniform II plus 0 *
Test Syphilis (RPR ou SD Bioline)
Insuline
Morphine
Oxytocine 10 UI
Methylergométrine amp 1 ml
Misoprostol
Sulphate de magnésium
Salbutamol 4 mg, co
Na DCC co
RH
RHZ
RHZE
Compresses de gaze
Dakin (Na DCC co)
Aiguilles 21 G
Seringue 5 ml
Eau ppi 5 ml fl
Lidocaïne 2%, fl
Ketamine, 50mg/ml, 10ml , Vial, Unité
Adrénaline
Atropine
Hydrocortisone
Sut., PGA, tressé, 75cm, déc.3 (2/0), ai g.1/2c, R, eff., 30mm, Un
Sut., PGA, tressé, 75cm, déc.4 (1), aig.1/2c, R, eff., 30mm, Un
Sut., PGA, tressé, 75cm, déc.4 (1), aig.1/2c, R, eff., 50mm, Un
Sut., PGA, tressé, 75cm, déc.4 (1), aig.3/8c, R, eff., 50mm, Un
Dextrose (Glucoce),50%, 50ml,Vial,Unité
Dextrose (Glucose) + NaCl, 5%+0,9%, 500ml, Perfusion, Unité
Dextrose (Glucose), 5%, 500ml, Perfusion, Unité
Dextrose(Glucose)5% 250ml,Perfusion, Unité
Ringer lactate (Sol uti on de Hartmann), 500ml, Perfusion, Uni té
Catheter Court IV avec site dinjection, U.U.,24G (0,7*19mm), jaune,Unit
Catheter court IV, avec site di njection, uu 22G (0,8*25mm),bleu
Catheter court IV, avec site dinjection,uu,20G(1.0*32mm),rose,U
Sonde Urinaire
Réactif radiologie
Fiche Consultation curative
Fiche CPN
Fiche CPS
- -

7.3.2. Situation Générale des items en stock

- - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Items en stock
Items en sur stock
Item dont une partie du stock est en voie de péremption
Item avec risque de perte par péremption
- -
-
-

7.3.3. Valeur de la pharmacie

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Valeur du stock physique de médicaments (inventaire) (+)
Montant du compte pharmacie (solde fin du mois) (+)
Montant des commandes en cours (déjà payées BCZ, CDR) (+)
Montant à recouvrer (créances=dette des malades) (+)
Montant à payer au tiers (dettes envers le fournisseur) (-)
Recettes totales mensuelles des médicaments
Dépenses totales mensuelles des médicaments
Valeur du stock sur fiche HGR
Valeur médicaments achetés à la CDR
Valeur subsides en médicaments reçus
-
-
-

7.3.3. Valeur de la pharmacie (suite)

- - - - - - - - - - - - - - - - - - - - - -
 Nombre
Articles hors usage
Articles commandés au BCZS
Articles complètement servis par BCZS
-
-
- -

7.3.4. Valeur des médicaments consommés au coût d’achat

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 AmbulatoireMedecine InternePediatrieGynecologieObstétriqueTotal
Médicament admin. aux malades
Médicament admin. au personnel
Médicament admin. aux indigents
Médicaments périmés, avariés, cassés
- - -

7.4.1. Valorisation des subventions reçues

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 EtatPartenairesAutresTotal
Salaire personnel
Primes personnel
Personnel de la structure d’appui
Infrastructure - Construction
Infrastructure - Réhabilitation
Subvention Matériel - Véhicule
Matériel - Equipement médicaux
Matériel - Autre équipement
Matériel - Médicaments
Activités des Formations
Autres Activites
Activités de soins - Routine
Activités de soins - Urgence
Recherche
- -

7.4.2. Tableau de trésorerie

-
-
-

7.4.2.1. Recettes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Solde mois précédent
Médicaments
Imprimés
Prestation des services
--- Consultations
--- Laboratoire
--- Chirurgie
--- Maternité
--- Médecine interne
--- Gynéco obstétrique
--- Pédiatrie
--- Imagerie
--- Suivi médico-infirmier
--- Autres prestation des services
Sous-Total Contributions Locales (a)
Subventions et subsides Etat
Subventions et subsides partenaires
Subventions et subsides autres
Sous-Total Appuis Extérieurs(b)
Remb. Crédits patients
Emprunts
Retour Prêts/ avances
Sous-Total Recouvrements divers (c)
TOTAL (a+b+c)
-
- -
-

7.4.2.2. Sorties du mois

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Salaires / Primes
Transport personnel
Autres dépenses personnels
Médicaments
Fourniture et petit matériel
Consommations des services
Consultations
Laboratoire
Chirurgie
Maternité
Médecine interne
Gynéco obstétrique
Pédiatrie
Imagerie
Suivi médico-infirmier
Autres Consommations des services
Services extérieurs
Contribution au BCZ
Contribution autres
Impôt et taxes
Investissement
Autres dépenses
Total Charges Fixes (a)
Remboursement dettes
Remboursement emprunts
Prêt / avances
Intérêts payés
Total Charges Ponctuelles (b)
Total (a+b)
-
-
- - -

7.4.3. Compte d’exploitation de l’hôpital

-
-
-
- - - - - -
Taux moyens de Change
-
-
-
-
-

7.4.3.1. Charges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Médicaments et autres stocks consommés
Matières et fournitures consommées
Transports consommés
Autres services consommés
Charges et pertes diverses
Charges du personnel
Contributions et taxes
Intérêts payés par l’institut
Dotations aux amortissements et provisions
Contribution sur les revenus
-
- -
-

7.4.3.2. Produits

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Vente des médicaments et autres articles
Production des services
Production stockée
Travaux faits pour cpte propre
Produits et profits divers
Subventions d’exploitation
Intérêts et dividendes reçus
Reprises sur amort. et provisions
Autres produits
Résultats
-
-
- - -

7.4.4. Justification

-
-
-

7.4.4.1 Charges et pertes diverses

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Médic. avariés, périmés, cassés, volés
Jetons de présence
Amendes payées
Remboursement trop perçu aux malades
Créances irrécouvrables
Pertes de change
Subventions accordées
Dons et assistances sociales diverses
Autres charges
-
-
-

7.4.4.2 Eléments constitutifs de la valeur de vente de médic. et autres articles(au P.V.) :cpte 70

- - - - - - - - - - - - - - - - - - - - - -
 Montant
Médicaments administrés aux indigents
Médicaments administrés aux malades
Autres articles
-
-
- -
-
-

7.4.4.3 Subventions d'exploitation

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Salaires Etat et prime
Contribution population
Subventions en médicaments
Autres travaux bénévoles
Autres subv. dexploitation
-
-
-

7.4.4.4. Production des services

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Consultations curatives
Hospitalisation
Interventions chirurgicales
Imagerie
Accouchements
Laboratoire
Suivi médico-infirmier
Autres productions
-
-
- -
-
-

7.4.4.5. Synthèse données de trésorerie

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Report du mois précédent (1)
Recettes totales du mois (2)
Dépenses totales du mois (3)
Total recettes propres du mois (A)
Total facturé (70 à 71) (B)
Dettes recouvrées (C)
Dettes à recouvrer (cumul ) (D)
-
- -
-

7.4.4.6. Gestion des dettes et créance

- - - - - - - - - - - - - - - - - - - - - - - - - -
 Montant
Montant total des factures émises
Montant total de factures payées
Montant total des créances accordées
Montant total des créances payées
-
-
- -

7.4.4.7. Epargne/Réserve

- - - - - - - - - - - - - - - - - - - -
 MedicamentsRecettesAutresTotal
Epargne/Réserve
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step8.html b/client/src/partials/snis/templates/step8.html deleted file mode 100644 index 46fbaf0fda..0000000000 --- a/client/src/partials/snis/templates/step8.html +++ /dev/null @@ -1,319 +0,0 @@ -
-

{{ "SNIS.STEP8" | translate }}

-
- -

8.1 Organes de gestion

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ProgrammesRealisésPV + liste prés
Activités du plan d’action
Réunions du comité directeur (CODI)
Décisions du CODI du mois précédent
Réunions du comité d’hygiène hospitalière
Décisions du comité d’hygiène hospitalière
Réunions d’analyse des données
Nb utilisateurs satisfaits des services de santé
- -

8.2. Supervisions reçues

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 MCZAGISMDHComptTDRNutDNAutreTotal
Nb de visites de super. prévues
Nb de visites de super. reçues
Nb rétro-inform. écrites reçues
- -
-
-

8.3. Formations

- - - - - - - - - - - - - - - - - - - - - -
 Nombre
Formations programmées
Formations réalisées
Confér., réunions scientifiques
-
-
-

8.3. Formations (suite)

- - - - - - - - - - - - - - - - - - - - - - - - - -
 MasculinFeminin
Nb Personnes à former
Nb Personnes formées
Nb Stagiaires encadrés
-
-
- -

8.3. Domaines de formation

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ForméA Former
 MasculinFemininMasculinFeminin
Management et SSP
SNIS
Surveillance épidémiologique
Assurance de qualité des soins
Tetu
Lutte contre la maladie
Autres domaines
- -
-
-

8.4. Communication pour le changement de comp. (CCC)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Thème 1Thème 2Thème 3
Nb séances prévues
Nb séances réalisées
Nb de participants Hommes CCC
Nb de participants Femmes CCC
-
- -
-

8.5. Recherche opérationnelle

- - - - - - - - - - - - - - - - - - - - - - - - - -
 Nombre
Nouvelles recherches programmées ce mois
Recherches en cours
Recherches terminées ce mois
Recherches diffusées ce mois
-
-
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/templates/step9.html b/client/src/partials/snis/templates/step9.html deleted file mode 100644 index 2200058a1e..0000000000 --- a/client/src/partials/snis/templates/step9.html +++ /dev/null @@ -1,42 +0,0 @@ -
-

{{ "SNIS.STEP9" | translate }}

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ZSHZ
Nouveaux cas consultation externe
Nouveaux cas consultation aux urgences
Nouveaux cas prévention mère (CPN, CPON,PF)
Nouveaux cas réhabilitation nutritionnelle
Nouveaux cas à la kinésithérapie
-
-
\ No newline at end of file diff --git a/client/src/partials/snis/update/update.html b/client/src/partials/snis/update/update.html deleted file mode 100644 index 3e5c1c8e2b..0000000000 --- a/client/src/partials/snis/update/update.html +++ /dev/null @@ -1,71 +0,0 @@ - -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-

PRIERE DE REMPLIR COMPLETEMENT ET TRANSMETTRE A TEMPS CE CANEVAS POUR CENTRALISATION ET ANALYSE.
LA DIVISION SNIS.

-
-
- \ No newline at end of file diff --git a/client/src/partials/snis/update/update.js b/client/src/partials/snis/update/update.js deleted file mode 100644 index 9630a9a5b5..0000000000 --- a/client/src/partials/snis/update/update.js +++ /dev/null @@ -1,209 +0,0 @@ -angular.module('bhima.controllers') -.controller('SnisUpdateController', SnisUpdateController); - -SnisUpdateController.$inject = [ - '$scope', '$http', '$q', '$translate', '$routeParams', '$location', - 'util', 'validate', 'messenger', 'appstate' -]; - -function SnisUpdateController($scope, $http, $q, $translate, $routeParams, $location, util, validate, messenger, appstate) { - var session = $scope.session = { step : 1 }, - identif = $scope.identif = {}, - dependencies = {}; - - session.reportId = $routeParams.id; - - dependencies.zs = { - identifier : 'id', - query : { - tables : { - 'mod_snis_zs' : { columns : ['id', 'zone', 'territoire', 'province'] }, - 'project' : { columns : ['name'] }, - 'enterprise' : { columns : ['location_id'] }, - 'village' : { columns : ['name::villageName'] }, - 'sector' : { columns : ['name::sectorName'] }, - 'province' : { columns : ['name::provinceName'] } - }, - join : [ - 'project.enterprise_id=enterprise.id', - 'project.zs_id=mod_snis_zs.id', - 'enterprise.location_id=village.uuid', - 'village.sector_uuid=sector.uuid', - 'sector.province_uuid=province.uuid' - ] - } - }; - - dependencies.report = { - query : { - tables : { - 'mod_snis_rapport' : { columns : ['date'] } - }, - where : ['mod_snis_rapport.id=' + session.reportId] - } - }; - - dependencies.employes = { - query : { - tables : { - 'employee' : { columns : ['id', 'prenom', 'name', 'postnom'] }, - 'fonction' : { columns : ['fonction_txt']} - }, - join : ['employee.fonction_id=fonction.id'] - } - }; - - appstate.register('project', function (project) { - $scope.project = project; - dependencies.zs.query.where = ['project.id=' + $scope.project.id]; - validate.process(dependencies) - .then(init) - .then(load); - }); - - function load () { - if (session.reportId) { - $http.get('/snis/getReport/' + session.reportId) - .success(function (res) { - setSnisData(res.snisData); - setIdentificationData(res.identification); - }); - } - } - - function init (model) { - angular.extend($scope, model); - } - - function setIdentificationData (identification) { - var medecin = $scope.employes.get(identification[0].id_employe_medecin_dir); - var envoi = $scope.employes.get(identification[0].id_employe_envoi); - var reception = $scope.employes.get(identification[0].id_employe_reception); - var encodage = $scope.employes.get(identification[0].id_employe_encodage); - var zone = $scope.zs.get(identification[0].id_zs); - - $scope.identif.mois = new Date(util.htmlDate($scope.report.data[0].date)); - - $scope.getMedecinDir(medecin); - $scope.identif.nom_envoi_selected(envoi); - $scope.identif.nom_reception_selected(reception); - $scope.identif.nom_encodage_selected(encodage); - - $scope.identif.province = zone.province; - $scope.identif.territoire = zone.territoire; - $scope.identif.zone = zone.zone; - $scope.identif.id_zs = zone.id; - $scope.identif.hopital = zone.name; - $scope.identif.info = identification[0].information; - $scope.identif.adresse = zone.zone + ',' + zone.territoire + ' - ' + zone.province; - $scope.identif.date_envoi = new Date(util.htmlDate(identification[0].date_envoie)); - $scope.identif.date_reception = new Date(util.htmlDate(identification[0].date_reception)); - $scope.identif.date_encodage = new Date(util.htmlDate(identification[0].date_encodage)); - } - - function setSnisData (snisData) { - snisData.forEach(function (field) { - $scope.snis_report[field.attribut_form] = field.value; - }); - } - - function submit () { - - function submitIdentification () { - var def = $q.defer(), next = false; - - if ($scope.identif.mois && $scope.identif.medecin_dir_id && $scope.identif.nom_reception_id && $scope.identif.nom_envoi_id && $scope.identif.nom_encodage_id) { - - $http.post('/snis/createReport/',{params : - { - zs_id : $scope.identif.id_zs, - period : util.sqlDate($scope.identif.mois), - project_id : $scope.project.id, - id_employe_medecin_dir : $scope.identif.medecin_dir_id, - info : $scope.identif.info, - date_reception : util.sqlDate($scope.identif.date_reception), - id_employe_reception : $scope.identif.nom_reception_id, - date_envoi : util.sqlDate($scope.identif.date_envoi), - id_employe_envoi : $scope.identif.nom_envoi_id, - date_encodage : util.sqlDate($scope.identif.date_encodage), - id_employe_encodage : $scope.identif.nom_encodage_id - } - }) - .success(function (res) { - next = true; - def.resolve(next); - }) - .error(function (err) { - messenger.danger('[erreur] lors de la sauvegarde', true); - }); - } else { - messenger.info('Veuillez remplir correctement les zones de l\'identification', true); - } - - return def.promise; - } - - function saveData (obj){ - $http.post('/snis/populateReport',{params : {data : obj}}) - .success(function(){ - messenger.success('[success] Donnees sauvegardees avec succes', true); - $location.path('/snis/'); - }); - } - - // sending and saving data - submitIdentification() - .then(function () { - saveData($scope.snis_report); - }); - } - - function loadView (view_id) { - session.step = view_id; - } - - $scope.getMedecinDir = function (obj) { - $scope.identif.medecin_dir_id = obj.id; - $scope.identif.medecin_dir = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - $scope.identif.qualification = obj.fonction_txt; - }; - - $scope.identif.nom_envoi_selected = function (obj) { - $scope.identif.nom_envoi_id = obj.id; - $scope.identif.nom_envoi = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - }; - - $scope.identif.nom_reception_selected = function (obj) { - $scope.identif.nom_reception_id = obj.id; - $scope.identif.nom_reception = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - }; - - $scope.identif.nom_encodage_selected = function (obj) { - $scope.identif.nom_encodage_id = obj.id; - $scope.identif.nom_encodage = obj.prenom + ', ' + obj.name + ' - ' + obj.postnom; - }; - - $scope.getPeriod = function (obj) { - $scope.period = util.sqlDate(obj); - }; - - $scope.next = function () { - if (session.step < 9) { - // next step - session.step++; - } else if (session.step === 9) { - // validate operations - submit(); - } - }; - - $scope.previous = function () { - if (session.step > 1 && session.step <= 9) { - // next step - session.step--; - } - }; - - $scope.snis_report = {}; - $scope.loadView = loadView; -} diff --git a/client/src/partials/stock/dashboard/dashboard.html b/client/src/partials/stock/dashboard/dashboard.html deleted file mode 100644 index b45f90a990..0000000000 --- a/client/src/partials/stock/dashboard/dashboard.html +++ /dev/null @@ -1,172 +0,0 @@ -
- {{ "STOCK_DASHBOARD.TITLE" | translate }} -
- - - -
-
-
-
-
- - {{ "STOCK_DASHBOARD.MOST_CONSUMED" | translate }} -
- - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.LABEL" | translate}}{{ "COLUMNS.QUANTITY" | translate}}
- -
- {{ 'STOCK_DASHBOARD.NO_CONSUMPTION_DATA' | translate }} -
{{ $index + 1 }}{{ item.label }}{{ item.consumed }}
-
- - - -
- - - - -
-
-
- - {{ "STOCK_DASHBOARD.DONATIONS.TITLE" | translate }} -
- - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.DONOR" | translate}}{{ "COLUMNS.DATE" | translate}}{{ "COLUMNS.LABEL" | translate}}{{ "COLUMNS.QUANTITY" | translate}}
- -
- {{ 'STOCK_DASHBOARD.DONATIONS.NO_DATA' | translate }} -
{{ donation.name }}{{ donation.date | date }}{{ donation.label }}{{ donation.quantity }}
-
-
-
-
diff --git a/client/src/partials/stock/dashboard/dashboard.js b/client/src/partials/stock/dashboard/dashboard.js deleted file mode 100644 index a002326e69..0000000000 --- a/client/src/partials/stock/dashboard/dashboard.js +++ /dev/null @@ -1,206 +0,0 @@ -angular.module('bhima.controllers') -.controller('StockDashboardController', StockDashboardController); - -StockDashboardController.$inject = [ - '$q', '$http', 'StockDataService', 'DateService' -]; - -function StockDashboardController($q, $http, DataService, Dates) { - var vm = this; - - // bind view values - vm.purchaseorders = {}; - vm.limits = { consumption : 10, donations : 10 }; - - // loading indicators - vm.indicators = { - consumption : false, - donations : false - }; - - // startup the module - startup(); - - /* ----------------------------------------------------------------------- */ - - function startup() { - loadPurchaseDetails(); - loadConsumptionDetails(); - loadDonations(); - loadExpirationDetails(); - loadStockStatus(); - } - - // get the top most consumed items - function loadConsumptionDetails() { - - // start loading indicator - vm.indicators.consumption = true; - - DataService.getConsumption() - .then(function (response) { - var items = response.data; - - // loop through each item and sum up the consumption quantity - items.forEach(function (i) { - - // sum up the consumption events - i.consumed = i.consumption.reduce(function (a, b) { - return a + b.quantity; - }, 0); - }); - - // sort the inventory items by greated consumption - items.sort(function (a, b) { - return a.consumed < b.consumed ? 1 : -1; - }); - - vm.consumption = items; - }) - .finally(function () { vm.indicators.consumption = false; }); - } - - // load stock alerts - function loadStockStatus() { - DataService.getStockStatus() - .then(function (response) { - - vm.statuses = response.data; - - // stock alerts to be displayed - var alerts = { - overstock : 0, - shortage : 0, - stockout : 0, - optimal : 0, - expired : 0 - }; - - // loop through each inventory item and categorize alerts - vm.alerts = vm.statuses.reduce(function (agg, value) { - if (value.overstock) { agg.overstock += 1; } - if (value.shortage) { agg.shortage += 1; } - if (value.stockout) { agg.stockout += 1; } - if (value.expired) { agg.expired += 1; } - - // we need to make sure someone didn't forget to set stock_max - if (value.stock_max === value.quantity && value.quantity !== 0) { - agg.optimal += 1; - } - return agg; - }, alerts); - }); - } - - /* Loads the most recent donations into the dashboard */ - function loadDonations() { - - // start the donations loading indicator - vm.indicators.donations = true; - - // TODO -- make this number configurable - DataService.getDonations(vm.limits.donations) - .then(function (response) { - vm.donations = response.data; - }) - .finally(function () { vm.indicators.donations = false; }); - } - - // TODO - this belongs in a PurchaseOrders Service - // - // Load information about purchases orders based on their statuses. - // We are getting orders that - // 1) have not been approved - // 2) have been paid but not fulfilled - // 3) are in transit - // 4) have been paid and delivered - function loadPurchaseDetails() { - var target = '/purchaseorders?status=', - statuses; - - statuses = [ - 'pending', - 'paid', - 'shipped', - 'delivered' - ]; - - $q.all(statuses.map(function (status) { - return $http.get(target + status); - })) - .then(function (array) { - vm.purchaseorders.pending = array[0].data[0].count; - vm.purchaseorders.paid = array[1].data[0].count; - vm.purchaseorders.shipped = array[2].data[0].count; - vm.purchaseorders.delivered = array[3].data[0].count; - }); - } - - - // load expirations over different time frames - function loadExpirationDetails() { - - // start and end dates for each period - vm.expirations = [{ - id : '0', - key : 'STOCK.EXPIRATIONS.TODAY', - range : [ - '00-00-0000', // this is supposed to be as far back as we can go! - Dates.util.str(Dates.current.day()), - ] - }, { - id : '0-30', - key : 'STOCK.EXPIRATIONS.30_DAYS', - range : [ - Dates.util.str(Dates.current.day()), - Dates.util.str(Dates.next.nDay(30)) - ] - }, { - id: '30-60', - key : 'STOCK.EXPIRATIONS.30_TO_60_DAYS', - range : [ - Dates.util.str(Dates.next.nDay(30)), - Dates.util.str(Dates.next.nDay(60)) - ] - }, { - id :'60-90', - key : 'STOCK.EXPIRATIONS.60_TO_90_DAYS', - range : [ - Dates.util.str(Dates.next.nDay(60)), - Dates.util.str(Dates.next.nDay(90)) - ] - }, { - id : '90-120', - key : 'STOCK.EXPIRATIONS.90_TO_120_DAYS', - range : [ - Dates.util.str(Dates.next.nDay(90)), - Dates.util.str(Dates.next.nDay(120)) - ] - }, { - id : '120-180', - key : 'STOCK.EXPIRATIONS.120_TO_180_DAYS', - range : [ - Dates.util.str(Dates.next.nDay(120)), - Dates.util.str(Dates.next.nDay(180)) - ] - }, { - id :'180-360', - key : 'STOCK.EXPIRATIONS.180_TO_360_DAYS', - range : [ - Dates.util.str(Dates.next.nDay(180)), - Dates.util.str(Dates.next.nDay(360)) - ] - }]; - - $q.all(vm.expirations.map(function (v) { - return DataService.getStockExpirations(v.range[0], v.range[1]); - })) - .then(function (results) { - // loop through expirations, counting the number of expiring items in - // the resultant arrays and attaching them as a count - results.forEach(function (ex, idx) { - vm.expirations[idx].count = ex.data.length; - }); - }); - } -} diff --git a/client/src/partials/stock/exit_service/distribution_service.html b/client/src/partials/stock/exit_service/distribution_service.html deleted file mode 100644 index 2e78857aca..0000000000 --- a/client/src/partials/stock/exit_service/distribution_service.html +++ /dev/null @@ -1,159 +0,0 @@ -
- {{ "DISTRIBUTION_SERVICE.TITLE" | translate }} -
- - - -
- -
-
- {{'DISTRIBUTION_SERVICE.CHOOSE' | translate }} -
-
-
- -
-
-
- -
-
- {{ "DISTRIBUTION_SERVICE.SUMMARY" | translate }} - - - - - - - - - - - - - - - -
{{ "COLUMNS.DATE" | translate }}{{ "COLUMNS.SERVICE" | translate }}{{ "COLUMNS.DEPOT" | translate }}
{{ DistributionsCtrl.metadata.date | date }}{{ DistributionsCtrl.service.service }}{{ DistributionsCtrl.depot.text }}
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.LABEL" | translate }}{{ "COLUMNS.QTY_ASKED" | translate }}{{ "COLUMNS.LOT" | translate }}{{ "COLUMNS.UNIT_PRICE" | translate }}{{ "COLUMNS.TOTAL" | translate }}
- - - - - - - - - - - - - - - - - - - - - - - -
{{ row.label }} [{{ row.maxQuantity }}]
{{ "DISTRIBUTION_SERVICE.LOT_NUMBER" | translate }}{{ lot.lot_number }}
{{ "DISTRIBUTION_SERVICE.REMAINING_QTY" | translate }}{{ lot.quantity }}
{{ "DISTRIBUTION_SERVICE.EXPIRING_DATE" | translate }}{{ lot.expiration_date | date }}
- - - - {{ 'DEPOT.DISTRIBUTION.SERVICE.NO_LOTS' | translate }} - -
{{ row.priceList }}{{ (row.totalPriceList) | currency:DistributionsCtrl.currencyId }} - -
{{ "DISTRIBUTION_SERVICE.TOTAL" | translate }}{{ DistributionsCtrl.total | currency:DistributionsCtrl.currencyId }}
- - -
-
- - - diff --git a/client/src/partials/stock/exit_service/distribution_service.js b/client/src/partials/stock/exit_service/distribution_service.js deleted file mode 100644 index 716e5c63f3..0000000000 --- a/client/src/partials/stock/exit_service/distribution_service.js +++ /dev/null @@ -1,267 +0,0 @@ -angular.module('bhima.controllers') -.controller('StockServiceDistributionsController', StockServiceDistributionsController); - -StockServiceDistributionsController.$inject = [ - '$routeParams', '$http', '$q', '$location', '$filter', 'SessionService', 'DepotService', 'InventoryService' -]; - -/** -* Responsible for distributing medications to services throughout the hospital. -* This entails the following steps: -* 1) Get the available lots in a particular depot -* 2) Recommend lots by increasing expiration date (soonest is first) -* 3) Select quantities from each lot -* 4) Distribute the drugs to an employee representing the service -* 5a) Print a receipt/generate documentation -* 5b) Decrease the stock inventory account in the journal by debiting the -* stock account and crediting the cost of goods sold account. -* -* @constructor -* @class StockServiceDistributionsController -*/ -function StockServiceDistributionsController($routeParams, $http, $q, $location, $filter, Session, Depots, Inventory) { - var vm = this; - - // view data - vm.uuid = $routeParams.depotId; - vm.total = 0; - vm.queue = [{}]; - vm.metadata = { date : new Date() }; - vm.currencyId = Session.enterprise.currency_id; - - // exposed functions - vm.dequeue = dequeue; - vm.enqueue = enqueue; - vm.use = use; - vm.retotal = retotal; - vm.submit = submit; - vm.filterAggregateQuantities = filterAggregateQuantities; - - // start the module up - startup(); - - /* ------------------------------------------------------------------------ */ - - // get all the services supported by the enterprise - function getServices() { - return $http.get('/services') - .then(function (response) { return response.data; }); - } - - // copy data from inventory onto queue row - function use(row, item) { - - // toggle visibility in the inventory typeahead - item.used = true; - - // cache selected inventory metadata on row - row.price = item.price; - row.label = item.label; - row.lots = item.lots; - row.unit = item.unit; - row.group = item.groupName; - row.tracking_number = item.tracking_number; - row.maxQuantity = item.maxQuantity; - } - - function getPriceList(lots, quantity) { - var aggregateLots = lots.filter(function (lot) { - return quantity > lot.aggregateQuantity; - }); - - return aggregateLots.map(function (lot) { - return $filter('currency')(lot.unit_price, vm.currencyId); - }).join(', '); - } - - function getTotalPriceList(lots, quantity) { - var tot = 0, cQuantity = quantity || 0; - - var aggregateLots = lots.filter(function (lot) { - return cQuantity > lot.aggregateQuantity; - }); - - aggregateLots.forEach(function (lot) { - if (lot.quantity - cQuantity >= 0) { - tot += lot.unit_price * cQuantity; - } else { - tot += lot.unit_price * lot.quantity; - cQuantity -= lot.quantity; - } - }); - return tot; - } - - // removes an item from the queue at a given index - function dequeue(idx) { - var item, i = 0, - removed = vm.queue.splice(idx, 1)[0]; - - // ensure the inventory item has actually been selected - if (!removed.code) { return; } - - // linear search: find the inventory item that we just dequeued by linearly - // searching through the inventory for a matching code - do { - item = vm.inventory[i++]; - } while (removed.code !== item.code); - - // set the item to be visible again in the typeahead - item.used = false; - } - - // adds a new row to the queue - function enqueue() { - vm.queue.push({}); - } - - // calculate the totals when quantities change - function retotal(row) { - // vm.total = vm.queue.reduce(function (sum, row) { - // return sum + (row.price * row.quantity); - // }, 0); - - // In the case we have to deal with more than one lot with different unit price - // Display a list of prices - // Calculate the correct total - row.priceList = getPriceList(row.lots, row.quantity); - row.totalPriceList = getTotalPriceList(row.lots, row.quantity); - - vm.total = vm.queue.reduce(function (sum, item) { - return sum + item.totalPriceList; - }, 0); - } - - // we need to extract the amount distributed from each lot - function distributeAmongLots(quantity, item) { - var lot, q, - distributions = [], - i = 0; - - while (quantity > 0) { - lot = item.lots[i++]; - - // q is the amount we will consume.distribute from this lot - q = (lot.quantity < quantity) ? lot.quantity : quantity; - - // add to list of distributions - distributions.push({ - service_id : vm.service.id, - unit_price : lot.unit_price, - depot_uuid : vm.uuid, - date : vm.metadata.date, - tracking_number : lot.tracking_number, - quantity : q - }); - - // decrease quantity needed by q - quantity -= q; - } - - return distributions; - } - - // triggered to submit the form - // NOTE -- we are guaranteed to have "valid" data, since the button will be - // disabled until it passes angular's validation checks. Further validation - // will be done on the server. - function submit() { - var data; - - // make a single flat array of distributions - data = vm.queue.reduce(function (array, item) { - return array.concat(distributeAmongLots(item.quantity, item)); - }, []); - - $http.post('/depots/' + vm.uuid + '/distributions', { - data : data, - type : 'service' // create a service distribution - }) - .then(function (result) { - - // go to the receipt - $location.url('/invoice/service_distribution/' + result.data); - }) - .catch(function (err) { - console.log('An error occurred:', err); - }); - } - - // startup the module - function startup() { - $q.all([ - getServices(), - Depots.getDepots(vm.uuid), - Depots.getAvailableStock(vm.uuid), - Inventory.getInventoryItems() - ]) - .then(function (responses) { - var stock, inventory; - - // destructure responses - vm.services = responses[0]; - vm.depot = responses[1]; - stock = responses[2]; - inventory = responses[3]; - - // we need to associate each stock with the proper inventory item - // if a particular inventory item does not have lots in this pharmacy, - // we will assign an empty array as the lots. - inventory.forEach(function (i) { - - // default: the item has not been selected yet - i.used = false; - - i.lots = stock.filter(function (s) { - return s.code === i.code; - }) - .map(function (s) { - return { - lot_number : s.lot_number, - quantity : s.quantity, - unit_price : s.unit_price, - tracking_number : s.tracking_number, - expiration_date : new Date(Date.parse(s.expiration_date)) - }; - }); - - // sum the lots and figure out how much quantity we can distribute of - // this item - i.maxQuantity = i.lots.reduce(function (s, lot) { - return s + lot.quantity; - }, 0); - - // sort lots in increasing order of expiration date - i.lots.sort(function (a,b) { - return a.expiration_date > b.expiration_date ? 1 : -1; - }); - - // aggregate the value (in sorted order) so that we can filter as demanded - // by the UI - i.lots.forEach(function (lot, index, lots) { - - // for the first item, the aggregate quantity is the quantity - // for all others, the aggregate quantity is the previous aggregate quantity - // plus the current quantity - lot.aggregateQuantity = (index === 0) ? - 0 : - lots[index - 1].aggregateQuantity + lots[index - 1].quantity; // quantity up to this one - }); - - // create a nicely formatted label for the typeahead - i.fmtLabel = i.code + ' ' + i.label; - }); - - // expose inventory to the view - vm.inventory = inventory; - }); - } - - // TODO - find a better name - // Creates a filter for each row, that removes aggregate quantities - function filterAggregateQuantities(row) { - return function (lot) { - return row.quantity > lot.aggregateQuantity; - }; - } -} diff --git a/client/src/partials/stock/integration/confirm_integration/confirm_integration.html b/client/src/partials/stock/integration/confirm_integration/confirm_integration.html deleted file mode 100644 index 9a10e97b56..0000000000 --- a/client/src/partials/stock/integration/confirm_integration/confirm_integration.html +++ /dev/null @@ -1,104 +0,0 @@ -
- {{ 'STOCK.INTEGRATION.CONFIRM_STOCK' | translate }} -
- - - -
-
-
- -
-
- {{ "STOCK.INTEGRATION.CONFIRM_STOCK" | translate }} -
- -
- -
- - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.DATE" | translate }}{{ "COLUMNS.REFERENCE" | translate }}{{ "COLUMNS.USER" | translate }}{{ "COLUMNS.ACTIONS" | translate }}
- -
- {{ "PURCHASE.NOT_FOUND" | translate }} -
{{ item.purchase_date | date }}{{ item.reference }}{{ item.first }} {{ item.last }}
-
-
- -
-
-
- - {{ "STOCK.INTEGRATION.CONFIRM_STOCK" | translate }} {{ ConfirmCtrl.selected.document_id }} -
- -
- - - - - - - - - - - - - - - - - - - - -
{{ "PURCHASE.CONFIRM.DETAILS" | translate }}
{{ "COLUMNS.ID" | translate }}{{ ConfirmCtrl.selected.document_id }}
{{ "COLUMNS.NOTE" | translate }}{{ ConfirmCtrl.selected.note }}
{{ "COLUMNS.EMPLOYEE" | translate }}{{ ConfirmCtrl.selected.first }} {{ ConfirmCtrl.selected.last }}
- - -
-
-
-
-
diff --git a/client/src/partials/stock/integration/confirm_integration/confirm_integration.js b/client/src/partials/stock/integration/confirm_integration/confirm_integration.js deleted file mode 100644 index b3672b6ad4..0000000000 --- a/client/src/partials/stock/integration/confirm_integration/confirm_integration.js +++ /dev/null @@ -1,69 +0,0 @@ -angular.module('bhima.controllers') -.controller('ConfirmStockIntegrationController', ConfirmStockIntegrationController); - -ConfirmStockIntegrationController.$inject = [ - 'connect', '$location', 'SessionService' -]; - -function ConfirmStockIntegrationController(connect, $location, Session) { - var vm = this; - - // bind variables to view - vm.user = Session.user; - vm.project = Session.project; - vm.filter = ''; - vm.loading = false; - - // bind methods - vm.confirmIntegration = confirmIntegration; - vm.select = select; - - /* ------------------------------------------------------------------------ */ - - function initialise() { - vm.loading = true; - connect.fetch('/stockIntegration') - .then(function (data) { - vm.data = data; - }) - .catch(handleError) - .finally(function () { vm.loading = false; }); - } - - function select(item) { - vm.selected = item; - } - - function confirmIntegration() { - writeToJournal() - .then(updatePurchase) - .then(generateDocument) - .catch(handleError); - } - - function updatePurchase () { - var purchase = { - uuid : vm.selected.uuid, - confirmed : 1, - confirmed_by : vm.user.id, - paid : 1 - }; - return connect.put('purchase', [purchase], ['uuid']); - } - - function writeToJournal () { - var query = 'confirm_integration/' + vm.selected.uuid; - return connect.fetch('/journal/' + query); - } - - function generateDocument(res) { - var query = 'confirm_integration/' + vm.selected.document_id; - $location.path('/invoice/' + query); - } - - function handleError(error) { - console.log(error); - } - - initialise(); -} diff --git a/client/src/partials/stock/integration/integration.html b/client/src/partials/stock/integration/integration.html deleted file mode 100644 index 1e9f7acde1..0000000000 --- a/client/src/partials/stock/integration/integration.html +++ /dev/null @@ -1,236 +0,0 @@ -
- {{ 'STOCK.INTEGRATION.TITLE' | translate }} -
- - - -
-
-
-
-
- {{ 'STOCK.INTEGRATION.TITLE' | translate }} : - {{ integrationCtrl.session.depot.text }} {{ 'STOCK.INTEGRATION.MADE_BY' | translate }} - {{ integrationCtrl.session.user.first }} {{ integrationCtrl.session.user.last }} -
- -
-
-
-
-
-

{{ integrationCtrl.session.depot.text }}

-

{{ "STOCK.INTEGRATION.DESCRIPTION" | translate }}

-
- -
-
-
- -
- -
- {{ 'STOCK.INTEGRATION.ITEMS' | translate }} - - {{ "STOCK.INTEGRATION.ITEMS" | translate }} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "DONATION_MANAGEMENT.ITEM" | translate }}{{ "COLUMNS.DESCRIPTION" | translate }}{{ "COLUMNS.LOT_NUMBER" | translate }}{{ "COLUMNS.EXPIRATION_DATE" | translate }}{{ "COLUMNS.QTY" | translate }}{{ "COLUMNS.PURCHASE_PRICE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}
- - - - - - - - - - - - - - - - - - - - - -
- {{ "UTIL.TOTAL" | translate }} - - {{ integrationCtrl.session.total | currency }} -
-
- - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.ITEM" | translate }}{{ "COLUMNS.DESCRIPTION" | translate }}{{ "COLUMNS.LOT_NUMBER" | translate }}{{ "COLUMNS.EXPIRATION_DATE" | translate }}{{ "COLUMNS.QTY" | translate }}{{ "COLUMNS.PURCHASE_PRICE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}{{ "COLUMNS.ACTIONS" | translate }}
{{ stockItem.code }}{{ stockItem.text }}{{ stockItem.lot_number }}{{ stockItem.expiration_date | date }}{{ stockItem.quantity }}{{ stockItem.purchase_price | currency }}{{ stockItem.quantity * stockItem.purchase_price | currency }} -
- -
-
{{ "COLUMNS.TOTAL" | translate }}{{ integrationCtrl.session.total | currency}}
-
-
- -
-
-
- - -
-
-
-
- - \ No newline at end of file diff --git a/client/src/partials/stock/integration/integration.js b/client/src/partials/stock/integration/integration.js deleted file mode 100644 index 57619a9402..0000000000 --- a/client/src/partials/stock/integration/integration.js +++ /dev/null @@ -1,290 +0,0 @@ -var stockIntegration = function ($q, $translate, $location, $routeParams, validate, connect, messenger, uuid, util, Appcache, Session) { - - var vm = this, cache = new Appcache('integration'), dependencies = {}; - - vm.session = { - total : 0, - depot : null, - project : Session.project, - user : Session.user, - step : null, - stocks : [], - integrationStarted : false - }; - - testContuity(); - - dependencies.depots = { - query : { - identifier : 'uuid', - tables : { - 'depot' : { - columns : ['uuid', 'reference', 'text'] - } - } - } - }; - - dependencies.inventory = { - query : { - identifier : 'uuid', - tables : { - inventory : { columns : ['uuid', 'code', 'text', 'purchase_price', 'type_id', 'group_uuid'] }, - inventory_group : { columns : ['sales_account', 'stock_account'] }, - }, - join : ['inventory_group.uuid=inventory.group_uuid'], - where : ['inventory_group.stock_account<>null'] - } - }; - - dependencies.employee = { - query : { - tables : { - employee : { columns : ['id', 'code', 'prenom', 'name', 'postnom', 'creditor_uuid']} - } - } - }; - - validate.process(dependencies).then(startup).catch(error); - - function startup (models) { - angular.extend(vm, models); - vm.session.depot = vm.depots.get(vm.session.depot.uuid); - } - - function error (err) { - messenger.danger(JSON.stringify(err)); - return; - } - - function testContuity (){ - if (angular.isDefined($routeParams.depotId)) { - vm.session.depot = { uuid : $routeParams.depotId }; - }else{ - messenger.error($translate.instant('UTIL.NO_DEPOT_SELECTED'), true); - return; - } - } - - function startIntegration() { - vm.session.step = 'select_inventories'; - vm.session.integrationStarted = true; - addStockItem(); - } - - function addStockItem () { - var stock = new StockItem(); - vm.session.stocks.push(stock); - } - - function StockItem () { - var self = this; - - this.code = null; - this.inventory_uuid = null; - this.text = null; - this.date = new Date(); - this.lot_number = null; - this.tracking_number = uuid(); - this.quantity = 0; - this.purchase_price = 0; - this.purchase_order_uuid = null; - this.isValidStock = false; - - - this.set = function (inventoryReference) { - self.inventory_uuid = inventoryReference.uuid; - self.code = inventoryReference.code; - self.text = inventoryReference.text; - self.expiration_date = new Date(); - self.date = new Date(); - self.lot_number = null; - self.tracking_number = uuid(); - self.purchase_price = inventoryReference.purchase_price || self.purchase_price; - self.purchase_order_uuid = null; - self.isSet = true; - }; - - return this; - } - - function removeStockItem (idx) { - vm.session.stocks.splice(idx, 1); - updateTotal(); - } - - function updateStockItem (stockItem, inventoryReference) { - stockItem.set(inventoryReference); - } - - function isValidLine (stockItem) { - if(angular.isDefined(stockItem.code) && - angular.isDefined(stockItem.expiration_date) && - angular.isDefined(stockItem.lot_number) && - angular.isDefined(stockItem.purchase_price) && - stockItem.purchase_price > 0 && - stockItem.quantity > 0 && - stockItem.expiration_date > new Date() - ){ - stockItem.isValidStock = true; - updateTotal(); - }else{ - stockItem.isValidStock = false; - } - } - - function isPassed (){ - return vm.session.stocks.every(function (item){ - return item.isValidStock === true; - }); - } - - function preview () { - vm.session.step = 'preview_inventories'; - } - - function updateTotal (){ - vm.session.total = vm.session.stocks.reduce(function (a, b){ return a + b.quantity * b.purchase_price; }, 0); - } - - function goback () { - vm.session.step = 'select_inventories'; - } - - function simulatePurchase() { - return { - uuid : uuid(), - cost : vm.session.total, - purchase_date : util.sqlDate(new Date()), - currency_id : Session.enterprise.currency_id, - creditor_uuid : null, - purchaser_id : null, - emitter_id : vm.session.user.id, - project_id : vm.session.project.id, - receiver_id : null, - note : 'INTEGRATION_STOCK/' + util.sqlDate(new Date()), - paid : 0, - confirmed : 0, - closed : 0, - is_integration: 1, - is_direct : 0 - }; - } - - function getPurchaseItem(purchase_uuid){ - var items = []; - vm.session.stocks.forEach(function (stock){ - var item = { - uuid : uuid(), - purchase_uuid : purchase_uuid, - inventory_uuid : stock.inventory_uuid, - quantity : stock.quantity, - unit_price : stock.purchase_price, - total : stock.quantity * stock.purchase_price - }; - items.push(item); - }); - return items; - } - - function getStocks(purchase_uuid) { - var stocks = []; - vm.session.stocks.forEach(function (item) { - var stock = { - tracking_number : item.tracking_number, - lot_number : item.lot_number, - inventory_uuid : item.inventory_uuid, - entry_date : util.sqlDate(new Date()), - quantity : item.quantity, - expiration_date : util.sqlDate(item.expiration_date), - purchase_order_uuid : purchase_uuid - }; - stocks.push(stock); - }); - return stocks; - } - - function getMovements (document_id) { - var movements = []; - vm.session.stocks.forEach(function (item) { - var movement = { - uuid : uuid(), - document_id : document_id, - tracking_number : item.tracking_number, - date : util.sqlDate(new Date()), - quantity : item.quantity, - depot_entry : vm.session.depot.uuid - }; - movements.push(movement); - }); - return movements; - } - - function integrate () { - var purchase = simulatePurchase(); - var purchase_items = getPurchaseItem(purchase.uuid); - var stocks = getStocks(purchase.uuid); - var document_id = uuid(); - var movements = getMovements(document_id); - - connect.post('purchase', purchase) - .then(function (){ - var promisses = purchase_items.map(function (item){ - return connect.post('purchase_item', item); - }); - return $q.all(promisses); - }) - .then(function (){ - var promisses = stocks.map(function (item){ - return connect.post('stock', item); - }); - return $q.all(promisses); - }) - .then(function (){ - var promisses = movements.map(function (item){ - return connect.post('movement', item); - }); - return $q.all(promisses); - }) - .then(function (){ - messenger.success($translate.instant('STOCK.ENTRY.WRITE_SUCCESS'), false); - return $q.when(1); - }) - .then(function () { - $location.path('/stock/entry/report/' + document_id); - }) - .catch(function (err) { - console.log(err); - messenger.error($translate.instant('STOCK.ENTRY.WRITE_ERROR'), false); - - var stock_ids = stocks.map(function (stock){return stock.tracking_number;}); - - connect.delete('movement', 'tracking_number', stock_ids). - then(function (){ - return connect.delete('stock', 'tracking_number', stock_ids); - }) - .then(function (){ - return connect.delete('purchase', 'uuid', [purchase.uuid]); - }) - .catch(function (err){console.log('can not remove corrumpted data, inform the admin of system');}); - }); - } - - vm.startIntegration = startIntegration; - vm.addStockItem = addStockItem; - vm.removeStockItem = removeStockItem; - vm.updateStockItem = updateStockItem; - vm.isValidLine = isValidLine; - vm.preview = preview; - vm.isPassed = isPassed; - vm.goback = goback; - vm.integrate = integrate; -}; - -stockIntegration.$inject = [ - '$q', '$translate', '$location', '$routeParams', 'validate', 'connect', - 'messenger', 'uuid', 'util', 'appcache', 'SessionService' -]; - -angular.module('bhima.controllers') -.controller('stockIntegration', stockIntegration); diff --git a/client/src/partials/stock/service_return_stock/service_return_stock.html b/client/src/partials/stock/service_return_stock/service_return_stock.html deleted file mode 100644 index a16b2b3f9f..0000000000 --- a/client/src/partials/stock/service_return_stock/service_return_stock.html +++ /dev/null @@ -1,260 +0,0 @@ -
- {{ "SERVICE_RETURN_STOCK.TITLE" | translate }} -
- - - -
- -
- -
-
- - {{'STOCK.RETURN_SERVICE.KEY' | translate }} -
- -
-
-
- -

{{ ReturnCtrl.session.depot.text }}

- - - -
- -
- - -
- -
- -
-
-
-
- - - -
- -
-
-
-
- {{ 'STOCK.INTEGRATION.ITEMS' | translate }} - - {{ "STOCK.INTEGRATION.ITEMS" | translate }} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "DONATION_MANAGEMENT.ITEM" | translate }}{{ "COLUMNS.DESCRIPTION" | translate }}{{ "COLUMNS.LOT_NUMBER" | translate }}{{ "COLUMNS.EXPIRATION_DATE" | translate }}{{ "COLUMNS.QTY" | translate }}{{ "COLUMNS.PURCHASE_PRICE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}
- - - - - - - - - - - - - - - - - - - - - -
- {{ "UTIL.TOTAL" | translate }} - - {{ ReturnCtrl.session.total | currency }} -
- - -
-
-
- -
- - - -
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ "COLUMNS.ITEM" | translate }}{{ "COLUMNS.DESCRIPTION" | translate }}{{ "COLUMNS.LOT_NUMBER" | translate }}{{ "COLUMNS.EXPIRATION_DATE" | translate }}{{ "COLUMNS.QTY" | translate }}{{ "COLUMNS.PURCHASE_PRICE" | translate }}{{ "COLUMNS.AMOUNT" | translate }}{{ "COLUMNS.ACTIONS" | translate }}
{{ stockItem.code }}{{ stockItem.text }}{{ stockItem.lot_number }}{{ stockItem.expiration_date | date }}{{ stockItem.quantity }}{{ stockItem.purchase_price | currency }}{{ stockItem.quantity * stockItem.purchase_price | currency }} -
- -
-
{{ "COLUMNS.TOTAL" | translate }}{{ ReturnCtrl.session.total | currency}}
- - -
-
-
- -
- -
- -
- - diff --git a/client/src/partials/stock/service_return_stock/service_return_stock.js b/client/src/partials/stock/service_return_stock/service_return_stock.js deleted file mode 100644 index b822ba34a8..0000000000 --- a/client/src/partials/stock/service_return_stock/service_return_stock.js +++ /dev/null @@ -1,335 +0,0 @@ -angular.module('bhima.controllers') -.controller('ServiceReturnStockController', ServiceReturnStockController); - -ServiceReturnStockController.$inject = [ - '$routeParams', '$http', '$q', '$translate', '$location', 'SessionService', - 'messenger', 'connect', 'uuid', 'validate', 'util' -]; - -/** - * Responsible for return medications from service to depot. - * This is the following steps: - * 1) Select the service in which there are stock to return - * 2) Select medications - * 3) Submission - * 4) Print a receipt/generate documentation - * 5) Increase the stock inventory account in the journal by debiting the - * stock account and crediting the cost of goods sold account. - * indicate the service as cost center in journal - * - * @constructor - * @class ServiceReturnStockController - */ -function ServiceReturnStockController($routeParams, $http, $q, $translate, $location, SessionService, messenger, connect, uuid, validate, util) { - var vm = this, - session = vm.session = {}, - dependencies = {}; - - // dependencies - dependencies.depots = { - query : { - identifier : 'uuid', - tables : { - 'depot' : { - columns : ['uuid', 'reference', 'text'] - } - } - } - }; - - dependencies.services = { - query : { - identifier : 'id', - tables : { - 'service' : { columns : ['id', 'name', 'cost_center_id'] } - } - } - }; - - dependencies.inventory = { - query : { - identifier : 'uuid', - tables : { - inventory : { columns : ['uuid', 'code', 'text', 'purchase_price', 'type_id', 'group_uuid'] }, - inventory_group : { columns : ['sales_account', 'stock_account'] }, - }, - join : ['inventory_group.uuid=inventory.group_uuid'], - where : ['inventory_group.stock_account<>null'] - } - }; - - dependencies.employee = { - query : { - tables : { - employee : { columns : ['id', 'code', 'prenom', 'name', 'postnom', 'creditor_uuid']} - } - } - }; - - // initialize models - vm.session.step = null; - vm.session.total = 0; - vm.session.stocks = []; - vm.session.integrationStarted = false; - - // Expose models to the views - vm.startingReturnProcess = startingReturnProcess; - vm.addStockItem = addStockItem; - vm.removeStockItem = removeStockItem; - vm.updateStockItem = updateStockItem; - vm.isValidLine = isValidLine; - vm.preview = preview; - vm.isPassed = isPassed; - vm.goback = goback; - vm.reset = reset; - vm.integrate = integrate; - - // start the module up - startup(); - - // Functions definitions - function startup() { - if (angular.isUndefined($routeParams.depotId)) { - messenger.error($translate.instant('UTIL.NO_DEPOT_SELECTED'), true); - return; - } - validate.process(dependencies) - .then(initialize) - .catch(error); - } - - function initialize(models) { - angular.extend(vm, models); - vm.session.depot = vm.depots.get($routeParams.depotId); - } - - function error (err) { - console.error(err); - return; - } - - function startingReturnProcess () { - if (!vm.service || !vm.service.id) { return; } - vm.session.step = 'select_inventories'; - vm.session.integrationStarted = true; - addStockItem(); - } - - function addStockItem () { - var stock = new StockItem(); - vm.session.stocks.push(stock); - } - - function StockItem () { - var self = this; - - this.code = null; - this.inventory_uuid = null; - this.text = null; - this.date = new Date(); - this.lot_number = null; - this.tracking_number = uuid(); - this.quantity = 0; - this.purchase_price = 0; - this.purchase_order_uuid = null; - this.isValidStock = false; - - - this.set = function (inventoryReference) { - self.inventory_uuid = inventoryReference.uuid; - self.code = inventoryReference.code; - self.text = inventoryReference.text; - self.expiration_date = new Date(); - self.date = new Date(); - self.lot_number = null; - self.tracking_number = uuid(); - self.purchase_price = inventoryReference.purchase_price || self.purchase_price; - self.purchase_order_uuid = null; - self.isSet = true; - }; - - return this; - } - - function removeStockItem (idx) { - vm.session.stocks.splice(idx, 1); - updateTotal(); - } - - function updateStockItem (stockItem, inventoryReference) { - stockItem.set(inventoryReference); - } - - function isValidLine (stockItem) { - if(angular.isDefined(stockItem.code) && - angular.isDefined(stockItem.expiration_date) && - angular.isDefined(stockItem.lot_number) && - angular.isDefined(stockItem.purchase_price) && - stockItem.purchase_price > 0 && - stockItem.quantity > 0 && - stockItem.expiration_date > new Date() - ){ - stockItem.isValidStock = true; - updateTotal(); - }else{ - stockItem.isValidStock = false; - } - } - - function isPassed (){ - return vm.session.stocks.every(function (item){ - return item.isValidStock === true; - }); - } - - function preview () { - vm.session.step = 'preview_inventories'; - } - - function updateTotal (){ - vm.session.total = vm.session.stocks.reduce(function (a, b){ return a + b.quantity * b.purchase_price; }, 0); - } - - function goback () { - vm.session.step = 'select_inventories'; - } - - function reset () { - vm.session.stocks = []; - vm.session.step = null; - } - - function simulatePurchase() { - return { - uuid : uuid(), - cost : vm.session.total, - purchase_date : util.sqlDate(new Date()), - currency_id : SessionService.enterprise.currency_id, - creditor_uuid : null, - purchaser_id : null, - emitter_id : SessionService.user.id, - project_id : SessionService.project.id, - receiver_id : null, - note : 'Service Return Stock/' + vm.service.name + '/' + vm.description + '/' + util.sqlDate(new Date()), - paid : 0, - confirmed : 0, - closed : 0, - is_integration: 0, - is_direct : 0, - is_return : 1 - }; - } - - function getPurchaseItem(purchase_uuid){ - var items = []; - vm.session.stocks.forEach(function (stock){ - var item = { - uuid : uuid(), - purchase_uuid : purchase_uuid, - inventory_uuid : stock.inventory_uuid, - quantity : stock.quantity, - unit_price : stock.purchase_price, - total : stock.quantity * stock.purchase_price - }; - items.push(item); - }); - return items; - } - - function getStocks(purchase_uuid) { - var stocks = []; - vm.session.stocks.forEach(function (item) { - var stock = { - tracking_number : item.tracking_number, - lot_number : item.lot_number, - inventory_uuid : item.inventory_uuid, - entry_date : util.sqlDate(new Date()), - quantity : item.quantity, - expiration_date : util.sqlDate(item.expiration_date), - purchase_order_uuid : purchase_uuid - }; - stocks.push(stock); - }); - return stocks; - } - - function getMovements (document_id) { - var movements = []; - vm.session.stocks.forEach(function (item) { - var movement = { - uuid : uuid(), - document_id : document_id, - tracking_number : item.tracking_number, - date : util.sqlDate(new Date()), - quantity : item.quantity, - depot_entry : vm.session.depot.uuid - }; - movements.push(movement); - }); - return movements; - } - - function integrate () { - var purchase = simulatePurchase(); - var purchase_items = getPurchaseItem(purchase.uuid); - var stocks = getStocks(purchase.uuid); - var document_id = uuid(); - var movements = getMovements(document_id); - - connect.post('purchase', purchase) - .then(function (){ - var promisses = purchase_items.map(function (item){ - return connect.post('purchase_item', item); - }); - return $q.all(promisses); - }) - .then(function (){ - var promisses = stocks.map(function (item){ - return connect.post('stock', item); - }); - return $q.all(promisses); - }) - .then(function (){ - var promisses = movements.map(function (item){ - return connect.post('movement', item); - }); - return $q.all(promisses); - }) - .then(function () { - // journal notify return stock from service - var params = { - purchase_uuid : purchase.uuid, - cost_center_id : vm.service.cost_center_id - }; - - return $http.get('/journal/service_return_stock/' + JSON.stringify(params)); - }) - .then(function (){ - messenger.success($translate.instant('STOCK.ENTRY.WRITE_SUCCESS'), false); - return $q.when(1); - }) - .then(function () { - $location.path('/stock/entry/report/' + document_id); - }) - .catch(function (err) { - // notify error - messenger.error($translate.instant('STOCK.ENTRY.WRITE_ERROR'), false); - console.error(err); - - // rollback - var stock_ids = stocks.map(function (stock){return stock.tracking_number;}); - connect.delete('movement', 'tracking_number', stock_ids). - then(function (){ - connect.delete('stock', 'tracking_number', stock_ids); - }) - .then(function (){ - connect.delete('purchase_item', 'purchase_uuid', [purchase.uuid]); - }) - .then(function (){ - connect.delete('purchase', 'uuid', [purchase.uuid]); - }) - .catch(function (err){console.log('can not remove corrumpted data, inform the admin of system');}); - }); - } - -} diff --git a/client/test/e2e/vouchers/simple.spec.js b/client/test/e2e/vouchers/simple.spec.js index 9dc075f666..624eefc61a 100644 --- a/client/test/e2e/vouchers/simple.spec.js +++ b/client/test/e2e/vouchers/simple.spec.js @@ -53,7 +53,7 @@ describe('Simple Vouchers', function () { FU.buttons.submit(); // assert that validation text appears - expect(element(by.css('.text-success')).isPresent()).to.eventually.equal(true); + expect(element(by.css('.alert-success')).isPresent()).to.eventually.equal(true); }); }); diff --git a/server/config/routes.js b/server/config/routes.js index ef4d6bb6e0..dcb4cdbd2d 100644 --- a/server/config/routes.js +++ b/server/config/routes.js @@ -216,11 +216,6 @@ exports.configure = function (app) { app.get('/tree', tree.generate); // snis controller - app.get('/snis/getAllReports', snis.getAllReports); - app.get('/snis/getReport/:id', snis.getReport); - app.post('/snis/createReport', snis.createReport); - app.delete('/snis/deleteReport/:id', snis.deleteReport); - app.post('/snis/populateReport', snis.populateReport); app.get('/snis/healthZones',snis.healthZones); /** diff --git a/server/controllers/locations.js b/server/controllers/locations.js index 1f970d474f..c6b4b71fa6 100644 --- a/server/controllers/locations.js +++ b/server/controllers/locations.js @@ -476,8 +476,6 @@ exports.update = {}; exports.update.country = function updateCountry(req, res, next) { 'use strict'; - const uid = db.bid(req.params.uuid); - var sql = 'UPDATE country SET ? WHERE uuid = ?;'; @@ -486,9 +484,9 @@ exports.update.country = function updateCountry(req, res, next) { var data = convert(req.body); - db.exec(sql, [data, uid]) + db.exec(sql, [data, req.params.uuid]) .then(function () { - return lookupCountry(uid); + return lookupCountry(req.params.uuid); }) .then(function (record) { res.status(200).json(record); @@ -507,8 +505,6 @@ exports.update.country = function updateCountry(req, res, next) { exports.update.province = function updateProvince(req, res, next) { 'use strict'; - const uid = db.bid(req.params.uuid); - var sql = 'UPDATE province SET ? WHERE uuid = ?;'; @@ -517,9 +513,9 @@ exports.update.province = function updateProvince(req, res, next) { var data = convert(req.body); - db.exec(sql, [data, uid]) + db.exec(sql, [data, req.params.uuid]) .then(function () { - return lookupProvince(uid); + return lookupProvince(req.params.uuid); }) .then(function (record) { res.status(200).json(record); @@ -538,8 +534,6 @@ exports.update.province = function updateProvince(req, res, next) { exports.update.sector = function updateSector(req, res, next) { 'use strict'; - const uid = db.bid(req.params.uuid); - var sql = 'UPDATE sector SET ? WHERE uuid = ?;'; @@ -548,9 +542,9 @@ exports.update.sector = function updateSector(req, res, next) { var data = convert(req.body); - db.exec(sql, [data, uid]) + db.exec(sql, [data, req.params.uuid]) .then(function () { - return lookupSector(uid); + return lookupSector(req.params.uuid); }) .then(function (record) { res.status(200).json(record); @@ -569,8 +563,6 @@ exports.update.sector = function updateSector(req, res, next) { exports.update.village = function updateVillage(req, res, next) { 'use strict'; - const uid = db.bid(req.params.uuid); - var sql = 'UPDATE village SET ? WHERE uuid = ?;'; @@ -579,9 +571,9 @@ exports.update.village = function updateVillage(req, res, next) { var data = convert(req.body); - db.exec(sql, [data, uid]) + db.exec(sql, [data, req.params.uuid]) .then(function () { - return lookupVillage(uid); + return lookupVillage(req.params.uuid); }) .then(function (record) { res.status(200).json(record); diff --git a/server/controllers/medical/snis.js b/server/controllers/medical/snis.js index 113abff933..cbd6062a3c 100644 --- a/server/controllers/medical/snis.js +++ b/server/controllers/medical/snis.js @@ -1,293 +1,6 @@ -var Q = require('q'); -var querystring = require('querystring'); -var url = require('url'); - var db = require('./../../lib/db'); -var sanitize = require('./../../lib/sanitize'); - -var _REPORT_ID; - -/* FIXME : not necessary when we use dependencies with validate.process() at client side */ -function getAllReports (req, res) { - - var sql = 'SELECT id, date FROM mod_snis_rapport ORDER BY id DESC'; - db.exec(sql, function (err, rows) { - if (err) { throw err; } - res.send(rows); - }); -} - -function createReport (req, res) { - - // Creation Nouveau Rapport - var newReport = function(req) { - var project_id = req.body.params.project_id; - var period = req.body.params.period; - var sql, query, isNew; - - var check_rapport = function() { - var def = Q.defer(); - - sql = 'SELECT * FROM mod_snis_rapport WHERE MONTH(date) LIKE MONTH(\'' + period + '\') AND YEAR(date) LIKE YEAR(\'' + period + '\') AND id_snis_hopital=\''+project_id+'\';'; - db.exec(sql) - .then(function (rows) { - if (rows.length > 0) { - _REPORT_ID = rows[0].id; - isNew = false; - def.resolve(isNew); - } else { - isNew = true; - //Resolve - def.resolve(isNew); - } - }) - .catch(function (err) { - console.log(err); - }); - return def.promise; - }; - - var insert_or_update = function () { - var def = Q.defer(); - - if (isNew === true) { - sql = 'INSERT INTO mod_snis_rapport(date,id_snis_hopital) VALUES (DATE(\'' + period + '\'),\'' + project_id + '\');'; - db.exec(sql) - .then(function (row) { - _REPORT_ID = row.insertId; - def.resolve(_REPORT_ID); - }); - } else { - def.resolve(_REPORT_ID); - } - - return def.promise; - }; - - //Verification puis insertion ou modification - return check_rapport() - .then(insert_or_update); - }; - - // Identification data - var insertDataIdentification = function(req) { - var id_rapport = _REPORT_ID, - project_id = req.body.params.project_id, - zs_id = req.body.params.zs_id, - id_employe_medecin_dir = req.body.params.id_employe_medecin_dir, - date_envoi = req.body.params.date_envoi, - id_employe_envoi = req.body.params.id_employe_envoi, - date_reception = req.body.params.date_reception, - id_employe_reception = req.body.params.id_employe_reception, - date_encodage = req.body.params.date_encodage, - id_employe_encodage = req.body.params.id_employe_encodage, - info = req.body.params.info; - - var sql; - - //Insertion - if (project_id) { - sql = 'INSERT INTO mod_snis_identification(id_rapport,id_hopital,id_zs,id_employe_medecin_dir,date_envoie,date_reception,date_encodage,information,id_employe_envoi,id_employe_reception,id_employe_encodage)'; - sql +=' VALUES (\''+id_rapport+'\',\''+project_id+'\',\''+zs_id+'\',\''+id_employe_medecin_dir+'\',\''+date_envoi+'\',\''+date_reception+'\',\''+date_encodage+'\',\''+info+'\',\''+id_employe_envoi+'\',\''+id_employe_reception+'\',\''+id_employe_encodage+'\')'; - db.exec(sql) - .then(function() { - console.log('[db] insertion donnees identification ok ...'); - }) - .catch(function (err) { - console.error('[error]: ', err); - }); - } - }; - - //Update - var updateDataIdentification = function(req) { - var id_rapport = _REPORT_ID, - project_id = req.body.params.project_id, - zs_id = req.body.params.zs_id, - id_employe_medecin_dir = req.body.params.id_employe_medecin_dir, - date_envoi = req.body.params.date_envoi, - id_employe_envoi = req.body.params.id_employe_envoi, - date_reception = req.body.params.date_reception, - id_employe_reception = req.body.params.id_employe_reception, - date_encodage = req.body.params.date_encodage, - id_employe_encodage = req.body.params.id_employe_encodage, - info = req.body.params.info; - - var sql; - - //Update - if (project_id) { - sql = 'UPDATE mod_snis_identification SET id_hopital=\''+project_id+'\', id_zs=\''+zs_id+'\', date_envoie = \''+date_envoi+'\', date_reception = \''+date_reception+'\', ' + - 'date_encodage = \''+date_encodage+'\', information = \''+info+'\', id_employe_medecin_dir = \''+id_employe_medecin_dir+'\', id_employe_envoi = \''+id_employe_envoi+'\', id_employe_reception = \''+id_employe_reception+'\', ' + - 'id_employe_encodage = \''+id_employe_encodage+'\' ' + - ' WHERE id_rapport = ' + id_rapport; - db.exec(sql) - .then(function() { - console.log('[db] update donnees identification ok ...'); - }) - .catch(function (err) { - console.error('[error]: ', err); - }); - } - }; - //Save Identification - var saveDataIdentification = function(req) { - var sql = 'SELECT * FROM mod_snis_identification WHERE id_rapport = \'' + _REPORT_ID +'\''; - db.exec(sql) - .then(function(rows) { - if (rows.length > 0) { - updateDataIdentification(req); - }else{ - insertDataIdentification(req); - } - }) - .catch(function (err) { - console.error('[error]: ', err); - }); - }; - - newReport(req) - .then(function (data) { - saveDataIdentification(req); - res.sendStatus(200); - }) - .catch(function (err) { - console.error('error newReport: ', err); - }); -} - -function deleteReport (req, res) { - var sql = 'DELETE FROM mod_snis_rapport WHERE id=\''+req.params.id+'\''; - db.exec(sql, function (err, rows) { - if (err) { throw err; } - res.sendStatus(200); - }); -} - -function populateReport (req, res) { - - var insertSnisRapport = function(req) { - var tabrecuperation = req.body.params.data; - var requeteNameAttribut = 'SELECT * FROM mod_snis_attribut_form'; - var idAttribut, nameAttribut; - - db.exec(requeteNameAttribut) - .then(function(ans) { - if (ans.length) { - for (var item in ans) { - var Form = ans[item]; - idAttribut = Form.id; - nameAttribut = Form.attribut_form; - if ((nameAttribut) && (tabrecuperation[nameAttribut])) { - fxReqInsertion(); - } - } - } - }) - .catch(function(err) { - console.error('[error]: ', err); - }); - - function fxReqInsertion () { - var ReqInsertion = 'INSERT INTO mod_snis_monthly_report (id_attribut_form,value,id_month) VALUES (\'' + idAttribut + '\',\'' + tabrecuperation[nameAttribut] + '\',\''+_REPORT_ID+'\')'; - db.exec(ReqInsertion); - } - }; - - //UPDATE DATA - var updateSnisRapport = function(req) { - var tabrecuperation = req.body.params.data; - var requeteNameAttribut = 'SELECT * FROM mod_snis_attribut_form'; - var idAttribut, nameAttribut; - - db.exec(requeteNameAttribut) - .then(function(ans) { - if (ans.length) { - for (var item in ans) { - var Form = ans[item]; - idAttribut = Form.id; - nameAttribut = Form.attribut_form; - if ((nameAttribut) && (tabrecuperation[nameAttribut])) { - fxReqUpdate(); - } - } - } - }) - .catch(function(err) { - console.error('[error]: ', err); - }); - - function fxReqUpdate () { - var ReqUpdate = 'UPDATE mod_snis_monthly_report SET value = \'' + tabrecuperation[nameAttribut] + - '\' WHERE id_month = \''+_REPORT_ID + '\' AND id_attribut_form = ' + idAttribut; - db.exec(ReqUpdate); - } - }; - - //Save Data Rapport - var saveSnisRapport = function(req) { - if (_REPORT_ID) { - var sql = 'SELECT * FROM mod_snis_monthly_report WHERE id_month = \'' + _REPORT_ID +'\''; - db.exec(sql) - .then(function(rows) { - if (rows.length > 0) { - // Iserer d'abord - // si certains champs sont vides ils seront ignores - insertSnisRapport(req); - // Puis Update - updateSnisRapport(req); - }else{ - // Insertion data - insertSnisRapport(req); - } - }) - .catch(function(err) { - console.error('[error]: ', err); - }); - } - }; - - saveSnisRapport(req); - res.sendStatus(200); -} - -function getReport (req, res) { - var report_id = sanitize.escape(req.params.id), - sql, sql2, snisData, identificationData; - - sql = 'SELECT monthly.value, attribut.attribut_form FROM mod_snis_monthly_report monthly ' + - ' JOIN mod_snis_attribut_form attribut ON attribut.id=monthly.id_attribut_form ' + - ' JOIN mod_snis_rapport report ON report.id=monthly.id_month ' + - ' WHERE report.id=' + report_id; - - db.exec(sql) - .then(function (data) { - snisData = data; - }) - .then(function () { - selectSnisIdentification(); - }) - .catch(function (err) { - console.error('[error]: ', err); - }); - - function selectSnisIdentification () { - sql2 = 'SELECT * FROM mod_snis_identification WHERE id_rapport='+report_id; - db.exec(sql2) - .then(function (data2) { - identificationData = data2; - res.send({ - 'identification' : identificationData, - 'snisData' : snisData - }); - }) - .catch(function (err) { - console.error('[error]: ', err); - }); - } -} function healthZones (req, res, next) { var sql = 'SELECT id, zone, territoire, province FROM mod_snis_zs'; @@ -303,10 +16,5 @@ function healthZones (req, res, next) { // Expose module.exports = { - getAllReports : getAllReports, - createReport : createReport, - deleteReport : deleteReport, - populateReport : populateReport, - getReport : getReport, healthZones : healthZones }; diff --git a/server/models/schema.sql b/server/models/schema.sql index 51239ba0f6..ffe96fef44 100644 --- a/server/models/schema.sql +++ b/server/models/schema.sql @@ -1016,90 +1016,6 @@ CREATE TABLE `language` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -DROP TABLE IF EXISTS `mod_snis_attribut_form`; - -CREATE TABLE `mod_snis_attribut_form` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_liste_item` int(11) NOT NULL, - `attribut_form` varchar(100) NOT NULL, - `request_auto` text NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `attribut_form` (`attribut_form`), - KEY `id_liste_item` (`id_liste_item`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `mod_snis_domaine`; - -CREATE TABLE `mod_snis_domaine` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `titre` varchar(50) NOT NULL, - `nb_jour_travail_prevu_mois` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `mod_snis_hopital`; - -CREATE TABLE `mod_snis_hopital` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_project` int(11) DEFAULT NULL, - `nom` varchar(50) DEFAULT NULL, - `id_zs` int(11) DEFAULT NULL, - `adresse` varchar(100) DEFAULT NULL, - `id_employe_medecin_directeur` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `mod_snis_identification`; - -CREATE TABLE `mod_snis_identification` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_rapport` int(11) NOT NULL, - `id_hopital` int(11) NOT NULL, - `id_zs` int(11) NOT NULL, - `id_employe_medecin_dir` int(11) DEFAULT NULL, - `date_envoie` date DEFAULT NULL, - `date_reception` date DEFAULT NULL, - `date_encodage` date DEFAULT NULL, - `information` text, - `id_employe_envoi` int(11) DEFAULT NULL, - `id_employe_reception` int(11) DEFAULT NULL, - `id_employe_encodage` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `mod_snis_items`; - -CREATE TABLE `mod_snis_items` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `libelle` varchar(255) DEFAULT NULL, - `rubrique_snis` varchar(20) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `mod_snis_monthly_report`; - -CREATE TABLE `mod_snis_monthly_report` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id_attribut_form` int(11) NOT NULL, - `value` float NOT NULL, - `id_month` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id_attribut_form` (`id_attribut_form`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -DROP TABLE IF EXISTS `mod_snis_rapport`; - -CREATE TABLE `mod_snis_rapport` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `date` date NOT NULL, - `id_snis_hopital` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - DROP TABLE IF EXISTS `mod_snis_zs`;