Revision 7a147556
Von Kivitendo Admin vor mehr als 7 Jahren hinzugefügt
SL/Dev/Record.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
use base qw(Exporter); |
5 |
our @EXPORT = qw(create_invoice_item create_sales_invoice create_credit_note create_order_item create_sales_order create_purchase_order create_delivery_order_item create_sales_delivery_order create_project); |
|
5 |
our @EXPORT = qw(create_invoice_item create_sales_invoice create_credit_note create_order_item create_sales_order create_purchase_order create_delivery_order_item create_sales_delivery_order create_purchase_delivery_order create_project);
|
|
6 | 6 |
|
7 | 7 |
use SL::DB::Invoice; |
8 | 8 |
use SL::DB::InvoiceItem; |
... | ... | |
114 | 114 |
return $delivery_order; |
115 | 115 |
} |
116 | 116 |
|
117 |
sub create_purchase_delivery_order { |
|
118 |
my (%params) = @_; |
|
119 |
|
|
120 |
my $record_type = 'purchase_delivery_order'; |
|
121 |
my $orderitems = delete $params{orderitems} // _create_two_items($record_type); |
|
122 |
_check_items($orderitems, $record_type); |
|
123 |
|
|
124 |
my $vendor = $params{vendor} // SL::Dev::CustomerVendor::create_vendor(name => 'Testvendor')->save; |
|
125 |
die "illegal customer" unless ref($vendor) eq 'SL::DB::Vendor'; |
|
126 |
|
|
127 |
my $delivery_order = SL::DB::DeliveryOrder->new( |
|
128 |
'is_sales' => 'false', |
|
129 |
'closed' => undef, |
|
130 |
vendor_id => $vendor->id, |
|
131 |
taxzone_id => $vendor->taxzone_id, |
|
132 |
donumber => $params{donumber} // undef, |
|
133 |
currency_id => $params{currency_id} // $::instance_conf->get_currency_id, |
|
134 |
taxincluded => $params{taxincluded} // 0, |
|
135 |
employee_id => $params{employee_id} // SL::DB::Manager::Employee->current->id, |
|
136 |
salesman_id => $params{employee_id} // SL::DB::Manager::Employee->current->id, |
|
137 |
transdate => $params{transdate} // DateTime->today, |
|
138 |
orderitems => $orderitems, |
|
139 |
); |
|
140 |
$delivery_order->assign_attributes(%params) if %params; |
|
141 |
$delivery_order->save; |
|
142 |
return $delivery_order; |
|
143 |
} |
|
144 |
|
|
117 | 145 |
sub create_sales_order { |
118 | 146 |
my (%params) = @_; |
119 | 147 |
|
Auch abrufbar als: Unified diff
SL/Dev/Record.pm - create_purchase_delivery_order