Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voucher Registry Module #561

Merged
merged 19 commits into from
Jul 9, 2016
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/css/structure.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@
border: none;
max-height : 42px;
border-bottom : 1px solid #ccc;
min-height: 35px;
padding-top: 7px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this padding-top necessary? It seems very ... custom.

Copy link
Contributor Author

@mbayopanda mbayopanda Jul 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the flex-util need some fixation, the padding-top: 7px is necessary to avoid to have something like this :

padding

The content of the util bar is so closed to the top of the flex-util bar, the padding-top: 7px; is not so good, maybe i can use line-height: 35px or other things to center the content in the util bar.

All proposals are welcome

}

.bhima-title {
Expand Down
42 changes: 27 additions & 15 deletions client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@
"CREATED" : "Created",
"DATE" : "Date",
"DATE_CREATED" : "Date Created",
"DATE_FROM" : "Start",
"DATE_REGISTRATION" : "Registration Date",
"DATE_TO" : "End",
"DEBIT" : "Debit",
"DEBITOR_GROUP" : "Debtor Group",
"DEBTOR_GROUP" : "Form debtor group record",
Expand Down Expand Up @@ -500,8 +502,11 @@
"SUPPLIER" : "Supplier",
"TEL" : "TEL",
"TELEPHONE" : "Telephone",
"THIS_MONTH" : "This Month",
"THIS_WEEK" : "This week",
"TITLE" : "Title",
"TITLE_ACCOUNT" : "Title Account",
"TODAY" : "Today",
"TOTAL" : "Total",
"TOTAL_BILLED" : "Total Billed",
"TOTAL_PAID" : "Total Paid",
Expand All @@ -511,6 +516,7 @@
"TRANSFER_TYPE" : "Transfer Type",
"TYPE" : "Type",
"UNCONFIGURED" : "Unconfigured",
"UNDEFINED" : "Undefined",
"UPDATE" : "UPDATE",
"UPDATE_GROUP_DEBTOR" : "Debtor group assignment updated",
"UPDATE_PATIENT_GROUP" : "Patient group membership updated",
Expand Down Expand Up @@ -569,6 +575,7 @@
"SELECT_COUNTRY" : "Select Country",
"SELECT_CREDITOR" : "Select a creditor",
"SELECT_CREDITOR_GROUP" : "Select a Creditor Group",
"SELECT_DATE_INTERVAL" : "Select a date interval",
"SELECT_DEBITOR_GROUP" : "Select a Debtor Group",
"SELECT_ENTERPRISE" : "Select an Enterprise",
"SELECT_FUNCTION" : "Select function",
Expand Down Expand Up @@ -1175,6 +1182,8 @@
"TRANSACTIONS_BY_ACCOUNT" : "Transactions by Account",
"UPDATE_STOCK" : "Update stock",
"USERS" : "Users",
"VALIDATE_PURCHASE" : "Validation",
"VOUCHER_REGISTRY" : "Voucher Registry",
"VALIDATE_PURCHASE" : "Validate Purchase"
},
"VILLAGE": {
Expand All @@ -1188,21 +1197,6 @@
"TITLE" : "Village Management"
},
"VOUCHERS": {
"SIMPLE": {
"CASH_PAYMENT" : "Client Payment",
"CASH_RETURN" : "Cash Return (Payback)",
"CONVENTION_PAYMENT" : "Convention Payment",
"EXPENSE" : "Expenses",
"INCOME" : "Incomes",
"SALARY_PAYMENT" : "Salary Payment",
"GENERIC_EXPENSE" : "Other Expenses",
"GENERIC_INCOME" : "Other Incomes",
"PURCHASES" : "Purchases",
"SUPPORT_INCOME" : "Support Incomes",
"TITLE" : "Simple Voucher",
"TRANSFER" : "Money Transfer"
},
"TITLE" : "Voucher",
"COMPLEX": {
"ADD_ITEMS" : "Add item(s)",
"CASH_PAYMENT" : "Cash Payment",
Expand All @@ -1224,6 +1218,24 @@
"TITLE" : "Advanced Journal Vouchers",
"VALID_TOTALS" : "Transactions are valid (balanced transaction)",
"VOUCHER" : "Voucher"
},
"GLOBAL" : {
"REPORT" : "Voucher Report",
"TITLE" : "Voucher"
},
"SIMPLE": {
"CASH_PAYMENT" : "Client Payment",
"CASH_RETURN" : "Cash Return (Payback)",
"CONVENTION_PAYMENT" : "Convention Payment",
"EXPENSE" : "Expenses",
"INCOME" : "Incomes",
"SALARY_PAYMENT" : "Salary Payment",
"GENERIC_EXPENSE" : "Other Expenses",
"GENERIC_INCOME" : "Other Incomes",
"PURCHASES" : "Purchases",
"SUPPORT_INCOME" : "Support Incomes",
"TITLE" : "Simple Voucher",
"TRANSFER" : "Money Transfer"
}
},
"GRAPHS" : {
Expand Down
45 changes: 29 additions & 16 deletions client/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@
"CURRENT_LOCATION" : "Localisation actuelle",
"DATE" : "Date",
"DATE_CREATED" : "Date de création",
"DATE_FROM" : "Debut",
"DATE_REGISTRATION" : "Date d'enregistrement",
"DATE_TO" : "Fin",
"DEBIT" : "Débit",
"DEBITOR_GROUP" : "Groupe Débiteur",
"DEBTOR_GROUP" : "Formulaire d'enregistrement de groupe débiteur",
Expand Down Expand Up @@ -442,6 +444,7 @@
"OTHER" : "Autres",
"OPTIONAL_INFO" : "Informations optionnelles",
"ORIGIN_LOCATION" : "Localisation d'origine",
"OTHER" : "Autre",
"PARENT_ACCOUNT" : "Compte parent",
"PASSIVE" : "Passive",
"PASSWORD" : "Mot de passe",
Expand Down Expand Up @@ -498,8 +501,11 @@
"SUPPLIER" : "Fournisseur",
"TEL" : "Tél",
"TELEPHONE" : "Téléphone",
"THIS_MONTH" : "Ce Mois",
"THIS_WEEK" : "Cette Semaine",
"TITLE" : "Titre",
"TITLE_ACCOUNT" : "Comptes Titre",
"TODAY" : "Aujourd'hui",
"TOTAL" : "Total",
"TOTAL_BILLED" : "Total Facture",
"TOTAL_PAID" : "Total paye",
Expand All @@ -509,6 +515,7 @@
"TRANSFER_TYPE" : "Type de Transfert",
"TYPE" : "Type",
"UNCONFIGURED" : "Non configuree",
"UNDEFINED" : "Non defini",
"UNIT" : "Forme galenique",
"UNIT_WEIGHT" : "Poids",
"UNIT_VOLUME" : "Volume",
Expand Down Expand Up @@ -567,6 +574,7 @@
"SELECT_COUNTRY" : "Sélectionner pays",
"SELECT_CREDITOR" : "Sélectionner un Créditeur",
"SELECT_CREDITOR_GROUP" : "Sélectionner Groupe de créditeurs",
"SELECT_DATE_INTERVAL" : "Sélectionner un intervalle de date",
"SELECT_DEBITOR_GROUP" : "Sélectionner Groupe de Débiteurs",
"SELECT_ENTERPRISE" : "Sélectionner entreprise",
"SELECT_FUNCTION" : "Sélectionner une fonction",
Expand Down Expand Up @@ -1183,7 +1191,9 @@
"TRANSACTIONS_BY_ACCOUNT" : "Transactions par Compte",
"UPDATE_STOCK" : "Mettre à Jour les Stocks",
"USERS" : "Utilisateurs",
"VALIDATE_PURCHASE" : "Validation"
"VALIDATE_PURCHASE" : "Validation",
"VOUCHER_REGISTRY" : "Registre des Bordereaux",
"VALIDATE_PURCHASE" : "Validation Achat"
},
"VILLAGE": {
"CONFIG" : "Configuration de Gestion des Villages",
Expand All @@ -1196,21 +1206,6 @@
"TITLE" : "Gestion des Villages"
},
"VOUCHERS": {
"SIMPLE": {
"CASH_PAYMENT" : "Paiement des clients",
"CASH_RETURN" : "Remboursement",
"CONVENTION_PAYMENT" : "Paiement des Conventions",
"EXPENSE" : "Dépenses",
"INCOME" : "Récettes",
"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"
},
"TITLE" : "Quittance",
"COMPLEX": {
"ADD_ITEMS" : "Ajouter item(s)",
"CASH_PAYMENT" : "Paiement Caisse",
Expand All @@ -1232,6 +1227,24 @@
"TITLE" : "Ajout des transactions",
"VALID_TOTALS" : "Les transactions sont valides (Transactions balancées)",
"VOUCHER" : "Bordereau de Transfert"
},
"GLOBAL" : {
"REPORT" : "Rapport des Quittances",
"TITLE" : "Quittance"
},
"SIMPLE": {
"CASH_PAYMENT" : "Paiement des clients",
"CASH_RETURN" : "Remboursement",
"CONVENTION_PAYMENT" : "Paiement des Conventions",
"EXPENSE" : "Dépenses",
"INCOME" : "Récettes",
"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"
}
}
}
5 changes: 5 additions & 0 deletions client/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ function bhimaConfig($stateProvider, $urlRouterProvider, $urlMatcherFactoryProvi
controller: 'ComplexJournalVoucherController as ComplexVoucherCtrl',
templateUrl: 'partials/vouchers/complex.html'
})
.state('vouchers', {
url : '/vouchers',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better!

controller: 'VoucherController as VoucherCtrl',
templateUrl: 'partials/vouchers/index.html'
})

/* 2.X Journal routes */
.state('journal', {
Expand Down
4 changes: 2 additions & 2 deletions client/src/js/components/bhPDFPrint.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bhPDFPrintController.$inject = ['$window', '$http', '$sce', '$timeout'];
* options="options">
* </bh-pdf-print>
*/
function bhPDFPrintController($window, $http, $sce, $timeout) {
function bhPDFPrintController($window, $http, $sce, $timeout, uuid) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need uuid.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still don't need uuid. ;)

var cachedRequest;
var component = this;

Expand All @@ -57,7 +57,7 @@ function bhPDFPrintController($window, $http, $sce, $timeout) {
var loadingIndicatorDelay = 1000;

component.$loading = false;
component.embeddedContentId = 'pdfdirect';
component.embeddedContentId = 'pdfdirect' + Date.now();

// expose the print method to the view
component.print = print;
Expand Down
22 changes: 22 additions & 0 deletions client/src/js/services/ModalService.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ function ModalService(Modal) {
// inventory list action : add or edit
service.openInventoryListActions = openInventoryListActions;

// date interval modal
service.openDateInterval = openDateInterval;

/**
* Opens a "confirm delete" modal with a button for "Confirm" or "Cancel".
* The modal is a safe replacement for $window.confirm(), since you cannot
Expand Down Expand Up @@ -279,4 +282,23 @@ function ModalService(Modal) {
return instance.result;
}

/** Find by Date interval modal */
function openDateInterval(request) {

var params = angular.extend(modalParameters, {
templateUrl : 'partials/templates/modals/dateInterval.tmpl.html',
controller : 'DateIntervalModalController',
controllerAs : '$ctrl',
size : 'xs',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this size xs when most other modals are md? Does it fit well with the application style?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modal

Has a good look i think, and when the screen is so small we have :

modal2

Copy link
Collaborator

@jniles jniles Jul 9, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backdrop : 'static',
animation : false,
resolve : {
data : function dataProvider() { return request; }
}
});

var instance = Modal.open(params);
return instance.result;
}

}
19 changes: 17 additions & 2 deletions client/src/js/services/PrototypeApiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,32 @@ function PrototypeApiService($http, util) {

// append the id to the base url
var target = this.url.concat('reports/', param);
return reportBuilder(this, param, filetype);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return will now error. reportBuilder() only takes in two parameters, reportBuilder(param, filetype). Please update this line to prevent it!

}

/**
* Receipt
*/
function receipt(param, filetype) {

// append the id to the base url
var target = this.url.concat('receipts/', param);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this function in PrototypeApiService is a really interesting idea. It means that it naturally defines APIs for reports/receipts as follows:

var voucherService = new Api('vouchers/');
voucherService.receipt(uuid); // sends GET vouchers/receipts/uuid

var accountService = new Api('accounts/');
accountService.receipt(uuid); // sends GET accounts/receipts/uuid

var inventoryService = new Api('inventory/');
inventoryService.receipt(uuid); // sends GET inventory/receipts/uuid

That's a pretty cool API standard. I like it.

@sfount, what do you think of this standard for APIs? Should receipts be part of each API, or a separate API altogether? You could also imagine...

GET /receipts/vouchers/:uuid
GET /receipts/accounts/:id
GET /receipts/inventory/:id

Which do you prefer?

return reportBuilder(param, filetype);
}

/** report builder */
function reportBuilder(param, filetype) {

// filetype setup
var responseType = filetype === 'pdf' ? 'arraybuffer' : null;
var params = { renderer: filetype };

// send the GET request
return this.$http.get(target, {
return $http.get(target, {
params: params,
responseType: responseType
})
.then(util.unwrapHttpResponse);
.then(util.unwrapHttpResponse);
}

return Api;
Expand Down
15 changes: 1 addition & 14 deletions client/src/partials/inventory/list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,7 @@ function InventoryListController ($translate, Inventory, Notify, uiGridConstants

/** print inventory list */
function printList() {
var buttonState = JSON.parse(JSON.stringify(vm.bcButtons[2]));
vm.bcButtons[2].disabled = true;
vm.bcButtons[2].icon = 'fa fa-spinner fa-pulse';

Inventory.report('pdf')
.then(function (result) {
vm.report = result;
return Modal.openReports({ report: vm.report, renderer: 'pdf' });
})
.then(function () {
vm.bcButtons[2] = JSON.parse(JSON.stringify(buttonState));
vm.bcButtons[2].action = printList;
})
.catch(Notify.errorHandler);
Modal.openReports({ url: '/inventory/reports/metadata', renderer: 'pdf' });
}

/** startup */
Expand Down
8 changes: 8 additions & 0 deletions client/src/partials/templates/grid/linkFilePDF.tmpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div style="padding: 5px;">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better!

<a href=""
ng-if="row.entity.uuid"
ng-click="grid.appScope.showReceipt(row.entity.uuid)"
data-link-receipt="{{ row.entity.uuid }}">
<i class="fa fa-file-pdf-o"></i> {{ "TABLE.COLUMNS.RECEIPT" | translate }}
</a>
</div>
7 changes: 7 additions & 0 deletions client/src/partials/templates/grid/voucherType.tmpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div style="padding: 5px;">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @sfount created a class ui-grid-cell-contents to provide padding and proper overflow for grid cells. See #537 (comment) for more information. You should use that on all these grid cells.

<span ng-class="{'label label-success': grid.appScope.getType(row.entity.type_id).incomeExpense == 'income', 'label label-warning': grid.appScope.getType(row.entity.type_id).incomeExpense == 'expense'}" href="">
{{ grid.appScope.getType(row.entity.type_id).text | translate }}
<span ng-if="row.groupHeader">{{ COL_FIELD }}</span>
</span>
<a ng-if="grid.appScope.isDefined(row.entity)" class="label label-default">{{ "FORM.LABELS.UNDEFINED" | translate }}</a>
</div>
Loading