treasuredb/TrsrDB/Debit.pm
Florian "flowdy" Heß 3773c3f123 Various changes and fixes: Added report, etc. Tests pass.
* reworked and used TrsrDB::expand_ids more tightly
  * account item selection in TrsrDB::make_transfers
  * web_auth / User relation for coming HTTP interface
  * income and target inter-relations between TrsrDB::Credit and TrsrDB::Debit
  * Transfer note
  * reactivated enforceFixedCredit to take effect unless _temp table is empty
  * added CreditsInFocus and Report views
2017-01-14 09:50:16 +01:00

35 lines
873 B
Perl

use strict;
package TrsrDB::Debit;
use base qw/DBIx::Class::Core/;
__PACKAGE__->table('Debit');
__PACKAGE__->add_column("billId");
__PACKAGE__->add_column("debtor");
__PACKAGE__->add_column("targetCredit" => { data_type => 'INTEGER' });
__PACKAGE__->add_column("date" => { data_type => 'DATE' });
__PACKAGE__->add_column("purpose");
__PACKAGE__->add_column("value" => { data_type => 'INTEGER' });
__PACKAGE__->add_column("paid" => { data_type => 'INTEGER', default => 0 });
__PACKAGE__->set_primary_key("billId");
__PACKAGE__->belongs_to(
account => 'TrsrDB::Account',
{ 'foreign.ID' => 'self.debtor' }
);
__PACKAGE__->might_have(
target => 'TrsrDB::Credit',
{ 'foreign.credId' => 'self.targetCredit' }
);
__PACKAGE__->has_many(
incomings => 'TrsrDB::Transfer', 'billId'
);
__PACKAGE__->many_to_many(
paid_with => incomings => 'credit'
);
1;