Revision 464f44ac
Von Moritz Bunkus vor mehr als 9 Jahren hinzugefügt
SL/DB/Invoice.pm | ||
---|---|---|
138 | 138 |
|
139 | 139 |
require SL::DB::Employee; |
140 | 140 |
|
141 |
my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_terms |
|
142 |
: $source->customer_id ? $source ->customer->payment_terms |
|
143 |
: undef; |
|
144 |
|
|
145 | 141 |
my (@columns, @item_columns, $item_parent_id_column, $item_parent_column); |
146 | 142 |
|
147 | 143 |
if (ref($source) eq 'SL::DB::Order') { |
148 |
@columns = qw(quonumber payment_id delivery_customer_id delivery_vendor_id);
|
|
144 |
@columns = qw(quonumber delivery_customer_id delivery_vendor_id); |
|
149 | 145 |
@item_columns = qw(subtotal); |
150 | 146 |
|
151 | 147 |
$item_parent_id_column = 'trans_id'; |
... | ... | |
158 | 154 |
$item_parent_column = 'delivery_order'; |
159 | 155 |
} |
160 | 156 |
|
157 |
my $terms = $source->can('payment_id') ? $source->payment_terms : undef; |
|
158 |
|
|
161 | 159 |
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber department_id |
162 |
cp_id language_id taxzone_id shipto_id globalproject_id transaction_description currency_id delivery_term_id), @columns), |
|
160 |
cp_id language_id taxzone_id shipto_id globalproject_id transaction_description currency_id delivery_term_id payment_id), @columns),
|
|
163 | 161 |
transdate => DateTime->today_local, |
164 | 162 |
gldate => DateTime->today_local, |
165 |
duedate => DateTime->today_local->add(days => ($terms ? $terms->terms_netto * 1 : 1)), |
|
166 |
payment_id => $terms ? $terms->id : undef, |
|
163 |
duedate => $terms ? $terms->calc_date(reference_date => DateTime->today_local) : DateTime->today_local, |
|
167 | 164 |
invoice => 1, |
168 | 165 |
type => 'invoice', |
169 | 166 |
storno => 0, |
Auch abrufbar als: Unified diff
Zahlungsbedingungen bei Lieferscheinen; veraltete Spalte »terms« entfernt