Revision 41cceb1e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/DB/Customer.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use Rose::DB::Object::Helpers qw(as_tree); |
6 | 6 |
|
7 |
use SL::DBUtils (); |
|
7 | 8 |
use SL::DB::MetaSetup::Customer; |
8 | 9 |
use SL::DB::Manager::Customer; |
9 | 10 |
use SL::DB::Helper::IBANValidation; |
... | ... | |
64 | 65 |
return join ' ', grep $_, $self->customernumber, $self->name; |
65 | 66 |
} |
66 | 67 |
|
68 |
sub last_used_ar_chart { |
|
69 |
my ($self) = @_; |
|
70 |
|
|
71 |
my $query = <<EOSQL; |
|
72 |
SELECT c.id |
|
73 |
FROM chart c |
|
74 |
JOIN acc_trans ac ON (ac.chart_id = c.id) |
|
75 |
JOIN ar a ON (a.id = ac.trans_id) |
|
76 |
WHERE (a.customer_id = ?) |
|
77 |
AND (c.category = 'I') |
|
78 |
AND (c.link !~ '_(paid|tax)') |
|
79 |
AND (a.id IN (SELECT max(a2.id) FROM ar a2 WHERE a2.customer_id = ?)) |
|
80 |
ORDER BY ac.acc_trans_id ASC |
|
81 |
LIMIT 1 |
|
82 |
EOSQL |
|
83 |
|
|
84 |
my ($chart_id) = SL::DBUtils::selectfirst_array_query($::form, $self->db->dbh, $query, ($self->id) x 2); |
|
85 |
|
|
86 |
return if !$chart_id; |
|
87 |
return SL::DB::Chart->load_cached($chart_id); |
|
88 |
} |
|
89 |
|
|
67 | 90 |
sub is_customer { 1 }; |
68 | 91 |
sub is_vendor { 0 }; |
69 | 92 |
sub payment_terms { goto &payment } |
Auch abrufbar als: Unified diff
Debitorenbuchungen auf Verwendung des Chart-Pickers umgestellt