From 32a0d75f4751aa5453f373cb743b9df740eb5f34 Mon Sep 17 00:00:00 2001 From: DedrickEnc Date: Tue, 12 Sep 2017 11:21:47 +0100 Subject: [PATCH] feat(transaction type): Adding new transaction type and in the data base and at the client side --- client/src/i18n/en/vouchers.json | 93 ++++++++--------- client/src/i18n/fr/vouchers.json | 138 ++++++++++++------------- client/src/js/constants/bhConstants.js | 1 + server/controllers/stock/index.js | 2 +- server/models/bhima.sql | 3 +- server/models/procedures.sql | 2 +- 6 files changed, 121 insertions(+), 118 deletions(-) diff --git a/client/src/i18n/en/vouchers.json b/client/src/i18n/en/vouchers.json index c3d30a2631..429e0aa7a0 100644 --- a/client/src/i18n/en/vouchers.json +++ b/client/src/i18n/en/vouchers.json @@ -1,33 +1,33 @@ { - "VOUCHERS" : { - "COMPLEX":{ - "ADD_ITEMS":"Add item(s)", - "CASH_PAYMENT":"Cash Payment", - "CREATE_SUCCESS":"Successfully posted", - "CREATE_ERROR":"An error occurred when post", - "CREDITOR":"Creditor (C)", - "DEBTOR":"Debtor (D)", - "DEB_CRED":"Debtor/Creditor", - "DESCRIPTION":"This module allows you to make advanced journal transactions manually", - "ENTITY":"Entity (Debtor/Creditor)", - "ERROR_ACCOUNT":"Selected accounts are invalid", - "ERROR_AMOUNT":"Amount's values are invalid", - "ERROR_TOTALS":"The totals are not balanced", - "ERROR_PRECISION":"The amounts entered cannot have more than 4 decimal places in precision", - "INVALID_VALUES":"There are invalid values detected", - "PATIENT_INVOICE":"Patient Invoice", - "REFERENCE":"Reference", - "ROWS":"Row(s)", - "SELECT_DOCUMENT_TYPE":"Please select the document type", - "TITLE":"Advanced Journal Vouchers", - "VALID_TOTALS":"Transactions are valid (balanced transaction)", - "VOUCHER":"Voucher" + "VOUCHERS": { + "COMPLEX": { + "ADD_ITEMS": "Add item(s)", + "CASH_PAYMENT": "Cash Payment", + "CREATE_SUCCESS": "Successfully posted", + "CREATE_ERROR": "An error occurred when post", + "CREDITOR": "Creditor (C)", + "DEBTOR": "Debtor (D)", + "DEB_CRED": "Debtor/Creditor", + "DESCRIPTION": "This module allows you to make advanced journal transactions manually", + "ENTITY": "Entity (Debtor/Creditor)", + "ERROR_ACCOUNT": "Selected accounts are invalid", + "ERROR_AMOUNT": "Amount's values are invalid", + "ERROR_TOTALS": "The totals are not balanced", + "ERROR_PRECISION": "The amounts entered cannot have more than 4 decimal places in precision", + "INVALID_VALUES": "There are invalid values detected", + "PATIENT_INVOICE": "Patient Invoice", + "REFERENCE": "Reference", + "ROWS": "Row(s)", + "SELECT_DOCUMENT_TYPE": "Please select the document type", + "TITLE": "Advanced Journal Vouchers", + "VALID_TOTALS": "Transactions are valid (balanced transaction)", + "VOUCHER": "Voucher" }, - "TYPES":{ - "SUPPORT_PAYMENT_DESCRIPTION":"Debt transfer from {{ patientName }} ({{ patientReference}}) for invoice {{ invoiceReference }}." + "TYPES": { + "SUPPORT_PAYMENT_DESCRIPTION": "Debt transfer from {{ patientName }} ({{ patientReference}}) for invoice {{ invoiceReference }}." }, - "GLOBAL":{ - "CASHFLOW_OPTION":"Cashflow Option", + "GLOBAL": { + "CASHFLOW_OPTION": "Cashflow Option", "TRANSFER_DESCRIPTION": "Transfer: From {{ fromAccount }} to {{ toAccount }} for {{ amount }} {{ symbol }}", "CONVENTION_PAYMENT_DESCRIPTION": "Convention Payment: Payment for {{ numInvoices }} invoice(s) by {{ debtorGroupName }}.", "CONVENTION_INVOICES":"Convention - Invoices payment", @@ -48,25 +48,26 @@ "RECEIPT":{ "SUCCESS":"Voucher Payment recorded successfully." }, - "ERROR_SAME_ACCOUNT":"You cannot use the same account twice to in this transaction. Please select two different accounts." + "ERROR_SAME_ACCOUNT": "You cannot use the same account twice to in this transaction. Please select two different accounts." }, - "SIMPLE":{ - "CASH_PAYMENT":"Client Payment", - "CASH_RETURN":"Cash Return (Payback)", - "CONVENTION_PAYMENT":"Convention Payment", - "CREDIT_NOTE":"Credit Note", - "EXPENSE":"Expenses", - "INCOME":"Incomes", - "INVOICING":"Invoicing", - "SALARY_PAYMENT":"Salary Payment", - "GENERIC_EXPENSE":"Other Expenses", - "GENERIC_INCOME":"Other Incomes", - "PURCHASES":"Purchases", - "SUPPORT_INCOME":"Support Incomes", - "TITLE":"Simple Voucher", - "TRANSFER":"Money Transfer", - "TRANSFER_PATIENT_INVOICE_AMOUNT":"Patient Invoice Debt Transfer" + "SIMPLE": { + "CASH_PAYMENT": "Client Payment", + "CASH_RETURN": "Cash Return (Payback)", + "CONVENTION_PAYMENT": "Convention Payment", + "CREDIT_NOTE": "Credit Note", + "EXPENSE": "Expenses", + "INCOME": "Incomes", + "INVOICING": "Invoicing", + "SALARY_PAYMENT": "Salary Payment", + "GENERIC_EXPENSE": "Other Expenses", + "GENERIC_INCOME": "Other Incomes", + "PURCHASES": "Purchases", + "SUPPORT_INCOME": "Support Incomes", + "TITLE": "Simple Voucher", + "TRANSFER": "Money Transfer", + "TRANSFER_PATIENT_INVOICE_AMOUNT": "Patient Invoice Debt Transfer", + "STOCK_INTEGRATION" : "Stock Integration" }, - "REPORT":"Report" + "REPORT": "Report" } -} +} \ No newline at end of file diff --git a/client/src/i18n/fr/vouchers.json b/client/src/i18n/fr/vouchers.json index aa08a94919..56888091d2 100644 --- a/client/src/i18n/fr/vouchers.json +++ b/client/src/i18n/fr/vouchers.json @@ -1,71 +1,71 @@ { - "VOUCHERS":{ - "COMPLEX":{ - "ADD_ITEMS":"Ajouter item(s)", - "CASH_PAYMENT":"Paiement Caisse", - "CREATE_SUCCESS":"Transaction postée avec succes", - "CREATE_ERROR":"Une erreur s'est produite lors du post", - "CREDITOR":"Crediteur (C)", - "DEBTOR":"Debiteur (D)", - "DEB_CRED":"Debtor/Creditor", - "DESCRIPTION":"Ce module permet de passer des transactions avancees dans le journal", - "ENTITY":"Entité (Debiteur/Crediteur)", - "ERROR_ACCOUNT":"Les comptes selectionnés sont invalides", - "ERROR_AMOUNT":"Les montants sont invalides", - "ERROR_PRECISION":"Les quantités saisies ne peuvent pas avoir plus de 4 décimales dans la précision", - "ERROR_TOTALS":"Les totaux ne sont pas balancés", - "INVALID_VALUES":"Detection des valeurs invalides", - "PATIENT_INVOICE":"Facture Patient", - "REFERENCE":"Reference", - "ROWS":"Ligne(s)", - "SELECT_DOCUMENT_TYPE":"Veuillez selectionner le type de document", - "TITLE":"Ajout des transactions", - "VALID_TOTALS":"Les transactions sont valides (Transactions balancées)", - "VOUCHER":"Bordereau de Transfert" - }, - "TYPES":{ - "SUPPORT_PAYMENT_DESCRIPTION":"Prise en charge de {{ patientName }} ({{ patientReference}}) pour la facture {{ invoiceReference }}." - }, - "GLOBAL":{ - "CASHFLOW_OPTION":"Option pour le flux de trésorerie physique", - "CONVENTION_INVOICES":"Convention - Paiement factures", - "CONVENTION_PAYMENT_DESCRIPTION": "Convention Paiement Factures: Paiement pour {{ numInvoices }} factures(s) par {{ debtorGroupName }}.", - "SUPPORT_PAYMENT_DESCRIPTION":"Prise en charge de {{ patientName }} ({{ patientReference}}) pour {{ numInvoices }} facture(s) {{ invoiceReferences }}.", - "TRANSFER_DESCRIPTION": "Transfert: De {{ fromAccount }} à {{ toAccount }} pour {{ amount }} {{ symbol }}", - "SUPPORT_FORM":"Prise en Charge des patients", - "SUPPORT_TEXT":"Lorsque les deux champs ci-dessus sont remplis, Les dettes du patient apparaissent en vue qu'une \"Prise en Charge\" puissent être attribue à un Compte.", - "ERROR_SAME_ACCOUNT":"Vous ne pouvez pas utiliser le même compte deux fois dans cette transaction. Veuillez sélectionner deux comptes différents.", - "GENERIC_EXPENSE":"Depense Generique", - "GENERIC_INCOME":"Recette Generique", - "CASH_TRANSFER":"Transfert d'argent", - "ORIGIN_ACCOUNT":"Compte de provenance", - "DESTINATION_ACCOUNT":"Compte de destination", - "TRANSFER_ACCOUNT":"Compte de transfert", - "IMPORT_TRANSACTION":"Importer les transactions", - "RECEIPT":{ - "SUCCESS":"Bon de paiement enregistré avec succès." - }, - "REPORT":"Rapport des Quittances", - "TITLE":"Quittance", - "TRANSFER_TYPE_INFO":"Type de transaction selon qu'on a soit une recette ou une depense", - "USE_FINANCIAL_ACCOUNT":"Utilisation de compte de caisses ou banques dans cette transaction" - }, - "SIMPLE":{"CASH_PAYMENT":"Paiement des clients", - "CASH_RETURN":"Remboursement", - "CONVENTION_PAYMENT":"Paiement des Conventions", - "CREDIT_NOTE":"Note de crédit", - "EXPENSE":"Dépenses", - "INCOME":"Récettes", - "INVOICING":"Facturation", - "SALARY_PAYMENT":"Paiement des Salaires", - "GENERIC_EXPENSE":"Autres Depenses", - "GENERIC_INCOME":"Autres Recettes", - "PURCHASES":"Achats", - "SUPPORT_INCOME":"Paiement Prise en charge", - "TITLE":"Bordereau de transfert", - "TRANSFER":"Transfert d'argent", - "TRANSFER_PATIENT_INVOICE_AMOUNT":"Prise en Charge de Facture de Patient" - }, - "REPORT":"Rapport" - } + "VOUCHERS": { + "COMPLEX": { + "ADD_ITEMS": "Ajouter item(s)", + "CASH_PAYMENT": "Paiement Caisse", + "CREATE_SUCCESS": "Transaction postée avec succes", + "CREATE_ERROR": "Une erreur s'est produite lors du post", + "CREDITOR": "Crediteur (C)", + "DEBTOR": "Debiteur (D)", + "DEB_CRED": "Debtor/Creditor", + "DESCRIPTION": "Ce module permet de passer des transactions avancees dans le journal", + "ENTITY": "Entité (Debiteur/Crediteur)", + "ERROR_ACCOUNT": "Les comptes selectionnés sont invalides", + "ERROR_AMOUNT": "Les montants sont invalides", + "ERROR_PRECISION": "Les quantités saisies ne peuvent pas avoir plus de 4 décimales dans la précision", + "ERROR_TOTALS": "Les totaux ne sont pas balancés", + "INVALID_VALUES": "Detection des valeurs invalides", + "PATIENT_INVOICE": "Facture Patient", + "REFERENCE": "Reference", + "ROWS": "Ligne(s)", + "SELECT_DOCUMENT_TYPE": "Veuillez selectionner le type de document", + "TITLE": "Ajout des transactions", + "VALID_TOTALS": "Les transactions sont valides (Transactions balancées)", + "VOUCHER": "Bordereau de Transfert" + }, + "TYPES": { + "SUPPORT_PAYMENT_DESCRIPTION": "Prise en charge de {{ patientName }} ({{ patientReference}}) pour la facture {{ invoiceReference }}." + }, + "GLOBAL": { + "CASHFLOW_OPTION": "Option pour cashflow", + "CONVENTION_INVOICES": "Convention - Paiement factures", + "TRANSFER_DESCRIPTION": "Transfert: De {{ fromAccount }} à {{ toAccount }} pour {{ amount }} {{ symbol }}", + "SUPPORT_FORM": "Prise en Charge des patients", + "SUPPORT_TEXT": "Lorsque les deux champs ci-dessus sont remplis, Les dettes du patient apparaissent en vue qu'une \"Prise en Charge\" puissent être attribue à un Compte.", + "ERROR_SAME_ACCOUNT": "Vous ne pouvez pas utiliser le même compte deux fois dans cette transaction. Veuillez sélectionner deux comptes différents.", + "GENERIC_EXPENSE": "Depense Generique", + "GENERIC_INCOME": "Recette Generique", + "CASH_TRANSFER": "Transfert d'argent", + "ORIGIN_ACCOUNT": "Compte de provenance", + "DESTINATION_ACCOUNT": "Compte de destination", + "TRANSFER_ACCOUNT": "Compte de transfert", + "IMPORT_TRANSACTION": "Importer les transactions", + "RECEIPT": { + "SUCCESS": "Bon de paiement enregistré avec succès." + }, + "REPORT": "Rapport des Quittances", + "TITLE": "Quittance", + "TRANSFER_TYPE_INFO": "Type de transaction selon qu'on a soit une recette ou une depense", + "USE_FINANCIAL_ACCOUNT": "Utilisation de compte de caisses ou banques dans cette transaction" + }, + "SIMPLE": { + "CASH_PAYMENT": "Paiement des clients", + "CASH_RETURN": "Remboursement", + "CONVENTION_PAYMENT": "Paiement des Conventions", + "CREDIT_NOTE": "Note de crédit", + "EXPENSE": "Dépenses", + "INCOME": "Récettes", + "INVOICING": "Facturation", + "SALARY_PAYMENT": "Paiement des Salaires", + "GENERIC_EXPENSE": "Autres Depenses", + "GENERIC_INCOME": "Autres Recettes", + "PURCHASES": "Achats", + "SUPPORT_INCOME": "Paiement Prise en charge", + "TITLE": "Bordereau de transfert", + "TRANSFER": "Transfert d'argent", + "TRANSFER_PATIENT_INVOICE_AMOUNT": "Prise en Charge de Facture de Patient", + "STOCK_INTEGRATION" : "Integration Stock" + }, + "REPORT": "Rapport" + } } diff --git a/client/src/js/constants/bhConstants.js b/client/src/js/constants/bhConstants.js index 2552bf1020..36d0238a1a 100644 --- a/client/src/js/constants/bhConstants.js +++ b/client/src/js/constants/bhConstants.js @@ -65,6 +65,7 @@ function constantConfig() { PURCHASES : 9, CREDIT_NOTE : 10, INVOICING : 11, + STOCK_INTEGRATION : 12, INCOME : 'income', EXPENSE : 'expense', OTHER : 'other', diff --git a/server/controllers/stock/index.js b/server/controllers/stock/index.js index 79767c0cc5..d0975cf6d9 100644 --- a/server/controllers/stock/index.js +++ b/server/controllers/stock/index.js @@ -386,7 +386,7 @@ function createIntegration(req, res, next) { commonInfos = [ db.bid(documentUuid), new Date(params.movement.date), req.session.enterprise.id, req.session.project.id, req.session.enterprise.currency_id, req.session.user.id ]; // writting all records relative to the movement in the posting journal table - transaction.addQuery('CALL PostPurchase(?)', [commonInfos]); + transaction.addQuery('CALL PostStockEntry(?)', [commonInfos]); }); // execute all operations as one transaction diff --git a/server/models/bhima.sql b/server/models/bhima.sql index 989798afdd..9576c6c0f4 100644 --- a/server/models/bhima.sql +++ b/server/models/bhima.sql @@ -139,7 +139,8 @@ INSERT INTO `transaction_type` (`id`, `text`, `type`, `prefix`, `fixed`) VALUES (8, 'VOUCHERS.SIMPLE.CASH_RETURN', 'expense', 'PAYBACK', 1), (9, 'VOUCHERS.SIMPLE.PURCHASES', 'expense', 'ACHAT', 1), (10,'VOUCHERS.SIMPLE.CREDIT_NOTE', 'other', 'CREDIT NOTE', 1), - (11,'VOUCHERS.SIMPLE.INVOICING', 'income', 'INV', 1); + (11,'VOUCHERS.SIMPLE.INVOICING', 'income', 'INV', 1), + (12, 'VOUCHERS.SIMPLE.STOCK_INTEGRATION', 'stock integration', 'STOCK. INT', 1); -- Stock Movement Flux INSERT INTO `flux` VALUES diff --git a/server/models/procedures.sql b/server/models/procedures.sql index 07ccb3e6bb..6be2d62657 100644 --- a/server/models/procedures.sql +++ b/server/models/procedures.sql @@ -1350,7 +1350,7 @@ BEGIN END $$ -- This processus inserts records relative to the stock movement in the posting journal -CREATE PROCEDURE PostPurchase ( +CREATE PROCEDURE PostStockEntry ( IN document_uuid BINARY(16), IN date DATETIME, IN enterprise_id SMALLINT(5) UNSIGNED,