// page data not yet refreshed, capture data from current scope
var print_data = {
payment_note : note,
- previous_balance : $scope.summary.balance_owed,
- payment_total : $scope.payment_amount,
+ previous_balance : Number($scope.summary.balance_owed()),
+ payment_total : Number($scope.payment_amount),
payment_applied : $scope.pending_payment(),
- amount_voided : $scope.session_voided,
+ amount_voided : Number($scope.session_voided),
change_given : $scope.pending_change(),
payments : payment_blobs,
current_location : egCore.idl.toHash(
return $modal.open({
templateUrl: './circ/patron/t_bill_patron_dialog',
controller:
- ['$scope','$modalInstance','billingTypes',
- function($scope , $modalInstance , billingTypes) {
+ ['$scope','$modalInstance','$timeout','billingTypes',
+ function($scope , $modalInstance , $timeout , billingTypes) {
$scope.focus = true;
$scope.xact = xact;
$scope.patron = patronSvc.current;
}
$scope.ok = function(args) { $modalInstance.close(args) }
$scope.cancel = function () { $modalInstance.dismiss() }
+ $scope.updateDefaultPrice = function() {
+ var type = billingTypes.filter(function(t) {
+ return t.id() == $scope.billArgs.billingType })[0];
+ if (type.default_price() && !$scope.billArgs.amount)
+ $scope.billArgs.amount = Number(type.default_price());
+ }
}],
resolve : {
// if we don't already have them, fetch the billing types
$scope.gridControls.selectItems([]);
}
});
+
$scope.gridControls.allItemsRetrieved = function() {
if (selectOnLoad) {
+ selectOnLoad = false; // only for initial controller load.
// select all non-refund items
$scope.gridControls.selectItems(
$scope.gridControls.allItems()
var bill_ids = [];
var cents = 0;
angular.forEach(bills, function(b) {
- cents += b.amount() * 100;
- bill_ids.push(b.id())
+ if (b.voided() != 't') {
+ cents += b.amount() * 100;
+ bill_ids.push(b.id())
+ }
});
$scope.session_voided =
}
// batch-edit billing and payment notes, depending on 'type'
- function editNotes(selected, type) {
- var notes = selected.map(function(b){ return b.note() }).join(',');
- var ids = selected.map(function(b){ return b.id() });
-
+ function editNotes(ids, notes, type) {
// show the note edit prompt
egPromptDialog.open(
egCore.strings.EDIT_BILL_PAY_NOTE, notes, {
}
$scope.editBillNotes = function(selected) {
- editNotes(selected, 'bill');
+ // bill data is flattened
+ var notes = selected.map(function(b){ return b.note }).join(',');
+ var ids = selected.map(function(b){ return b.id });
+ editNotes(ids, notes, 'bill');
}
$scope.editPaymentNotes = function(selected) {
- editNotes(selected, 'payment');
+ var notes = selected.map(function(b){ return b.note() }).join(',');
+ var ids = selected.map(function(b){ return b.id() });
+ editNotes(ids, notes, 'payment');
}
// -- retrieve our data