actor::org_unit->has_many( checkins => 'action::circulation' => 'checkin_lib' );
money::billable_transaction->has_a( usr => 'actor::user' );
- money::billable_transaction->might_have( circulation => 'action::circulation' );
- money::billable_transaction->might_have( grocery => 'money::grocery' );
+ #money::billable_transaction->might_have( circulation => 'action::circulation' );
+ #money::billable_transaction->might_have( grocery => 'money::grocery' );
actor::user->has_many( billable_transactions => 'action::circulation' => 'usr' );
metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source'] );
biblio::record_entry->has_many( metarecords => [ 'metabib::metarecord_source_map' => 'metarecord'] );
+ money::billing->has_a( xact => 'money::billable_transaction' );
+ money::payment->has_a( xact => 'money::billable_transaction' );
+
money::billable_transaction->has_many( billings => 'money::billing' );
money::billable_transaction->has_many( payments => 'money::payment' );
money::grocery->has_many( payments => 'money::payment' => 'xact' );
#money::grocery->might_have( billable_transaction => 'money::billable_transaction' );
- money::billing->has_a( xact => 'money::billable_transaction' );
- money::payment->has_a( xact => 'money::billable_transaction' );
#money::payment->might_have( cash_payment => 'money::cash_payment' );
#money::payment->might_have( check_payment => 'money::check_payment' );
#money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
my $to = 0;
my $lb = undef;
for my $b ($x->billings) {
- next if ($U->is_true($b->voided));
+ next if ($b->voided);
$to += int($b->amount * 100);
$lb ||= $b->billing_ts;
if ($b->billing_ts ge $lb) {
my $tp = 0;
my $lp = undef;
for my $p ($x->payments) {
- next if ($U->is_true($p->voided));
+ next if ($p->voided);
$tp += int($p->amount * 100);
$lp ||= $p->payment_ts;
if ($p->payment_ts ge $lp) {
$s->balance_owed( sprintf('%0.2f', int($to - $tp) / 100) );
- $s->xact_type( 'grocery' ) if ($x->grocery);
- $s->xact_type( 'circulation' ) if ($x->circulation);
+ $s->xact_type( 'grocery' ) if (money::grocery->retrieve($x->id));
+ $s->xact_type( 'circulation' ) if (action::circulation->retrieve($x->id));
push @mbts, $s;
}
my $client = shift;
my $search = shift;
- my @xacts = money::billable_xact->search_where( $search );
+ my @xacts = money::billable_transaction->search_where( $search );
$client->respond( $_ ) for (_make_mbts(@xacts));
return undef;