Revision d81f55ce
Von Moritz Bunkus vor fast 11 Jahren hinzugefügt
SL/DB/Invoice.pm | ||
---|---|---|
122 | 122 |
require SL::DB::Employee; |
123 | 123 |
|
124 | 124 |
my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_terms->terms_netto : 0; |
125 |
my (@columns, @item_columns); |
|
125 | 126 |
|
126 |
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber quonumber |
|
127 |
department_id cp_id language_id payment_id delivery_customer_id delivery_vendor_id taxzone_id shipto_id |
|
128 |
globalproject_id transaction_description currency_id delivery_term_id)), |
|
127 |
if (ref($source) eq 'SL::DB::Order') { |
|
128 |
@columns = qw(quonumber payment_id delivery_customer_id delivery_vendor_id); |
|
129 |
@item_columns = qw(subtotal); |
|
130 |
|
|
131 |
} else { |
|
132 |
@columns = qw(donumber); |
|
133 |
} |
|
134 |
|
|
135 |
my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber department_id |
|
136 |
cp_id language_id taxzone_id shipto_id globalproject_id transaction_description currency_id delivery_term_id), @columns), |
|
129 | 137 |
transdate => DateTime->today_local, |
130 | 138 |
gldate => DateTime->today_local, |
131 | 139 |
duedate => DateTime->today_local->add(days => $terms * 1), |
... | ... | |
148 | 156 |
my @items = map { |
149 | 157 |
my $source_item = $_; |
150 | 158 |
SL::DB::InvoiceItem->new(map({ ( $_ => $source_item->$_ ) } |
151 |
qw(parts_id description qty sellprice discount project_id |
|
152 |
serialnumber pricegroup_id ordnumber transdate cusordnumber unit |
|
153 |
base_qty subtotal longdescription lastcost price_factor_id)), |
|
159 |
qw(parts_id description qty sellprice discount project_id serialnumber pricegroup_id ordnumber transdate cusordnumber unit |
|
160 |
base_qty longdescription lastcost price_factor_id), @item_columns), |
|
154 | 161 |
deliverydate => $source_item->reqdate, |
155 | 162 |
fxsellprice => $source_item->sellprice,); |
156 | 163 |
} @{ $source->items_sorted }; |
Auch abrufbar als: Unified diff
SL::DB::Invoice: Umwandlung aus Lieferschein gefixt