<eg-grid idlClass="mp" #paymentsGrid
persistKey="circ.patron.billhistory_payments"
- (onRowActivate)="showStatement($event)"
+ (onRowActivate)="showStatement($event, true)"
[showDeclaredFieldsOnly]="true"
[reloadOnColumnChange]="true"
[dataSource]="paymentsDataSource" [sortable]="true">
}
}
- showStatement(row: any) {
+ showStatement(row: any, forPayment?: boolean) {
+ const id = forPayment ? row['xact.id'] : row.id;
this.router.navigate(['/staff/circ/patron',
- this.patronId, 'bills', row.xact.id(), 'statement']);
+ this.patronId, 'bills', id, 'statement']);
}
addBillingForXact(rows: any[]) {
<eg-grid-column path="summary.xact_type"
label="Type" i18n-label></eg-grid-column>
- <eg-grid-column path="summary.last_billing_type"
- label="Last Billing Type" i18n-label></eg-grid-column>
+ <eg-grid-column name="last_billing_type" path="summary.last_billing_type"
+ [required]="true" label="Last Billing Type" i18n-label></eg-grid-column>
+
+ <eg-grid-column name="last_payment_type" path="summary.last_payment_type"
+ [required]="true" label="Last Payment Type" i18n-label></eg-grid-column>
+
+ <eg-grid-column name="last_payment_ts" path="summary.last_payment_ts"
+ [required]="true" label="Last Payment Time" i18n-label></eg-grid-column>
<eg-grid-column name="billingLocation"
label="Billing Location" i18n-label></eg-grid-column>
path="circulation.target_copy.call_number.record.id"
[required]="true" [hidden]="true"></eg-grid-column>
- <eg-grid-column path="summary.balance_owed" datatype="money"
+ <eg-grid-column name="balance_owed" path="summary.balance_owed" datatype="money"
[required]="true" label="Balance Owed" i18n-label></eg-grid-column>
- <eg-grid-column path="summary.total_owed" datatype="money"
- label="Total Billed" i18n-label></eg-grid-column>
+ <eg-grid-column name="total_owed" path="summary.total_owed"
+ datatype="money" [required]="true" label="Total Billed" i18n-label></eg-grid-column>
- <eg-grid-column path="summary.total_paid" datatype="money"
- label="Total Paid" i18n-label></eg-grid-column>
+ <eg-grid-column name="total_paid" path="summary.total_paid" datatype="money"
+ [required]="true" label="Total Paid" i18n-label></eg-grid-column>
<eg-grid-column name="paymentPending" datatype="money"
label="Payment Pending" i18n-label></eg-grid-column>
path="circulation.target_copy.call_number.record.simple_record.author">
</eg-grid-column>
+ <eg-grid-column [hidden]="true" label="Grocery Billing Location"
+ [required]="true" i18n-label path="grocery.billing_location.shortname">
+ </eg-grid-column>
+
+ <eg-grid-column [hidden]="true" label="Circulation Billing Location"
+ [required]="true" i18n-label path="circulation.circ_lib.shortname">
+ </eg-grid-column>
+
<eg-grid-column path="usr" [hidden]="true"></eg-grid-column>
<eg-grid-column path="unrecovered" [hidden]="true"></eg-grid-column>
const query: any = {
usr: this.patronId,
xact_finish: null,
- 'summary.balance_owed' : {'<>' : 0}
+ balance_owed: {'<>' : 0}
};
return this.flatData.getRows(
this.billGrid.context, query, pager, sort)
.pipe(tap(row => {
row.paymentPending = 0;
+ row.billingLocation =
+ row['grocery.billing_location.shortname'] ||
+ row['circulation.circ_lib.shortname']
}));
};
if (!row) { return; } // Called mid-reload
- info.owed += Number(row['summary.balance_owed']) * 100;
- info.billed += Number(row['summary.total_owed']) * 100;
- info.paid += Number(row['summary.total_paid']) * 100;
+ info.owed += Number(row.balance_owed) * 100;
+ info.billed += Number(row.total_owed) * 100;
+ info.paid += Number(row.total_paid) * 100;
});
info.owed /= 100;
refundsAvailable(): number {
let amount = 0;
this.gridDataSource.data.forEach(row => {
- const balance = row['summary.balance_owed'];
+ const balance = row.balance_owed;
if (balance < 0) { amount += balance * 100; }
});
this.convertChangeToCredit
);
})
- .then(paymentIds => this.handlePayReceipt(payments, paymentIds))
+ .then(resp => {
+ this.patron().last_xact_id(resp.last_xact_id);
+ return this.handlePayReceipt(payments, resp.payments);
+ })
// refresh affected xact IDs
.then(_ => this.billGrid.reload())
if (done) { return; }
const row = this.billGrid.context.getRowByIndex(index);
- const owed = Number(row['summary.balance_owed']);
+ const owed = Number(row.balance_owed);
if (amount > owed) {
// Pending payment amount exceeds balance of this
payments.forEach(payment => {
const entry =
- this.gridDataSource.data.filter(e => e.xact.id() === payment[0])[0];
+ this.gridDataSource.data.filter(e => e.id === payment[0])[0];
context.payments.push({
amount: payment[1],
selectRefunds() {
this.billGrid.context.rowSelector.clear();
this.gridDataSource.data.forEach(row => {
- if (row['summary.balance_owed'] < 0) {
+ if (row.balance_owed < 0) {
this.billGrid.context.toggleSelectOneRow(row.id);
}
});
note?: string;
}
+interface PaymentResponse {
+ payments: number[];
+ last_xact_id: string;
+}
+
@Injectable()
export class BillingService {
billingTypes: IdlObject[];
paymentNote?: string,
checkNumber?: string,
creditCardParams?: CreditCardPaymentParams,
- convertChangeToCredit?: boolean): Promise<number[]> {
+ convertChangeToCredit?: boolean): Promise<PaymentResponse> {
return this.net.request(
'open-ils.circ',
}
// TODO work log
-
- return response.payments;
+ return response;
});
}
}
return $U->ou_ancestor_setting_value($org_id, $setting);
},
+ # Useful for accessing hash values whose key contains dots (.),
+ # which TT interprets as levels within a nested hash.
+ #
+ # e.g. So you don't have to do stuff like this:
+ # SET field = 'summary.balance_owed'; xact.$field
+ hashval => sub {
+ my ($hash, $key) = @_;
+ return $hash ? $hash->{$key} : undef;
+ }
};
(name, label, owner, active, locale, content_type, template)
VALUES ('bills_current', 'Bills, Current', 1, TRUE, 'en-US', 'text/html', '');
+*/
+
UPDATE config.print_template SET template = $TEMPLATE$
[%
USE date;
USE money = format('$%.2f');
- xacts = template_data.xacts;
+ SET xacts = template_data.xacts;
%]
<div>
<style>td { padding: 1px 3px 1px 3px; }</style>
</tr>
<tr>
<td>Last Billing:</td>
- <td>[% xact.summary.last_billing_type %]</td>
+ <td>[% xact.last_billing_type %]</td>
</tr>
<tr>
<td>Total Billed:</td>
- <td>[% money(xact.summary.total_owed) %]</td>
+ <td>[% money(xact.total_owed) %]</td>
</tr>
<tr>
<td>Last Payment:</td>
<td>
- [% xact.summary.last_payment_type %]
- [% IF xact.summary.last_payment_ts %]
- at [% date.format(helpers.format_date(
- xact.summary.last_payment_ts, staff_org_timezone), '%x %r') %]
+ [% xact.last_payment_type %]
+ [% IF xact.last_payment_ts %]
+ at [% date.format(
+ helpers.format_date(
+ xact.last_payment_ts, staff_org_timezone), '%x %r') %]
[% END %]
</td>
</tr>
<tr>
<td>Total Paid:</td>
- <td>[% money(xact.summary.total_paid) %]</td>
+ <td>[% money(xact.total_paid) %]</td>
</tr>
<tr>
<td>Balance:</td>
- <td>[% money(xact.summary.balance_owed) %]</td>
+ <td>[% money(xact.balance_owed) %]</td>
</tr>
</table>
</li>
</div>
$TEMPLATE$ WHERE name = 'bills_current';
+/*
+
INSERT INTO config.print_template
(name, label, owner, active, locale, content_type, template)
(name, label, owner, active, locale, content_type, template)
VALUES ('holds_for_patron', 'Holds For Patron', 1, TRUE, 'en-US', 'text/html', '');
-*/
UPDATE config.print_template SET template = $TEMPLATE$
[%
$TEMPLATE$ WHERE name = 'holds_for_patron';
+*/
+
COMMIT;