});
}
+ service.billPatron = function(args) {
+ var groc = new egCore.idl.mg();
+ groc.billing_location(egCore.auth.user().ws_ou());
+ groc.note(args.note);
+ groc.usr(patronSvc.current.id());
+
+ // create the xact
+ return egCore.net.request(
+ 'open-ils.circ',
+ 'open-ils.circ.money.grocery.create',
+ egCore.auth.token(), groc
+
+ // create the billing on the new xact
+ ).then(function(xact_id) {
+ if (evt = egCore.evt.parse(xact_id))
+ return alert(evt);
+
+ var bill = new egCore.idl.mb();
+ bill.xact(xact_id);
+ bill.amount(args.amount);
+ bill.btype(args.billingType);
+ bill.billing_type(egCore.env.cbt.map[args.billingType].name());
+ bill.note(args.note);
+
+ return egCore.net.request(
+ 'open-ils.circ',
+ 'open-ils.circ.money.billing.create',
+ egCore.auth.token(), bill
+ );
+
+ // check the billing response
+ }).then(function(bill_id) {
+ if (evt = egCore.evt.parse(bill_id))
+ return alert(evt);
+
+ });
+ }
+
return service;
}])
}
}).result.then(
function(args) {
- console.log('BILL: ' + JSON.stringify(args));
- //billSvc.billPatron(args);
+ // send the billing to the server using the arguments
+ // provided in the billing dialog, then refresh
+ billSvc.billPatron(args).then(function() {
+ $scope.payment_amount = 0;
+ $scope.gridRevision++;
+ });
}
);
}