$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
# get customer / vendor
if ($form->{vc} eq 'vendor') {
IR->get_vendor(\%myconfig, \%$form);
# get customer / vendor
if ($form->{vc} eq 'vendor') {
IR->get_vendor(\%myconfig, \%$form);
+ if ($form->{ordnumber}) {
+ require SL::DB::Order;
+ if (my $order = SL::DB::Manager::Order->find_by(ordnumber => $form->{ordnumber})) {
+ $order->load;
+ $form->{orddate} = $order->transdate_as_date;
+ $form->{$_} = $order->$_ for qw(payment_id salesman_id taxzone_id quonumber);
+ }
+ }
+
$form->{currency} = $currency;
$form->{exchangerate} = "";
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, $buysell);
$form->{currency} = $currency;
$form->{exchangerate} = "";
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, $buysell);
map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref };
map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice lastcost);
map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref };
map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice lastcost);
# und keinen anderen discount wert an $i ...
$form->{"discount_$form->{rowcount}"} ||= $vc_discount; # ... nehmen wir diesen Rabatt
}
# und keinen anderen discount wert an $i ...
$form->{"discount_$form->{rowcount}"} ||= $vc_discount; # ... nehmen wir diesen Rabatt
}
foreach my $request (@{ DO->unpack_stock_information('packed' => $form->{"stock_out_$i"}) }) {
$request->{parts_id} = $form->{"id_$i"};
$request->{base_qty} = $request->{qty} * $units->{$request->{unit}}->{factor} / $base_unit_factor;
foreach my $request (@{ DO->unpack_stock_information('packed' => $form->{"stock_out_$i"}) }) {
$request->{parts_id} = $form->{"id_$i"};
$request->{base_qty} = $request->{qty} * $units->{$request->{unit}}->{factor} / $base_unit_factor;
my $map_key = join '--', ($form->{"id_$i"}, @{$request}{qw(warehouse_id bin_id chargenumber bestbefore)});
my $map_key = join '--', ($form->{"id_$i"}, @{$request}{qw(warehouse_id bin_id chargenumber bestbefore)});
push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, #5, for the transfer of #6.",
$pinfo->{description},
$binfo->{warehouse_description},
push @{ $form->{ERRORS} }, $locale->text("There is not enough available of '#1' at warehouse '#2', bin '#3', #4, #5, for the transfer of #6.",
$pinfo->{description},
$binfo->{warehouse_description},
DO->transfer_in_out('direction' => 'out',
'requests' => \@all_requests);
DO->transfer_in_out('direction' => 'out',
'requests' => \@all_requests);