use SL::DO;
use SL::IR;
use SL::IS;
+use SL::MoreCommon qw(ary_diff);
use SL::ReportGenerator;
use SL::WH;
require "bin/mozilla/arap.pl";
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
- $form->{webdav} = $::lx_office_conf{features}->{webdav};
- $form->{jsscript} = 1;
+ $form->{webdav} = $::instance_conf->get_webdav;
my $editing = $form->{id};
DO->retrieve('vc' => $form->{vc},
'ids' => $form->{id});
- $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes currency));
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes delivery_term_id currency));
$form->{shipto} = 1 if $form->{id} || $form->{convert_from_oe_ids};
# get customer / vendor
$form->{discount} = $form->{customer_discount};
}
- $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id));
+ $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id delivery_term_id));
$form->restore_vars(qw(currency)) if ($form->{id} || $form->{convert_from_oe_ids});
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
- # use JavaScript Calendar or not
- $form->{jsscript} = 1;
-
my @old_project_ids = ($form->{"globalproject_id"});
map({ push(@old_project_ids, $form->{"project_id_$_"})
if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
$form->{oldvcname} = $form->{"old$form->{vc}"};
$form->{oldvcname} =~ s/--.*//;
- if ($form->{resubmit}) {
- my $dispatch_to_popup = '';
- if ($form->{format} eq "html") {
- $dispatch_to_popup .= "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
- }
- # emulate click for resubmitting actions
- $dispatch_to_popup .= "document.do.${_}.click(); " for grep { /^action_/ } keys %$form;
+ my $dispatch_to_popup = '';
+ if ($form->{resubmit} && ($form->{format} eq "html")) {
+ $dispatch_to_popup = "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
$dispatch_to_popup .= "document.do.submit();";
- $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup})");
+ } elsif ($form->{resubmit}) {
+ # emulate click for resubmitting actions
+ $dispatch_to_popup = "document.do.${_}.click(); " for grep { /^action_/ } keys %$form;
}
+ $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup})");
+
my $follow_up_vc = $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
$follow_up_vc =~ s/--\d*\s*$//;
my $form = $main::form;
$form->{PRINT_OPTIONS} = print_options('inline' => 1);
+ $form->{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
print $form->parse_html_template('do/form_footer',
{transfer_default => ($::instance_conf->get_transfer_default)});
my $rows = scalar @{ $form->{item_list} };
if ($rows) {
- $form->{"qty_$i"} = 1 unless $form->parse_amount(\%myconfig, $form->{"qty_$i"});
+ $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"});
+ if( !$form->{"qty_$i"} ) {
+ $form->{"qty_$i"} = 1;
+ }
if ($rows > 1) {
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
- $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
+ $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"} * (1 - $form->{tradediscount}));
$form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"});
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+
+ # get pricegroups for parts
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+
+ # build up html code for prices_$i
+ &set_pricegroup($i);
}
display_form();
$form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
$form->{SHOW_VC_DROP_DOWN} = $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
- $form->{jsscript} = 1;
$form->{title} = $locale->text('Delivery Orders');
$form->header();
my @columns = qw(
ids transdate reqdate
id donumber
- ordnumber customernumber
+ ordnumber customernumber cusordnumber
name employee salesman
shipvia globalprojectnumber
transaction_description department
my $report = SL::ReportGenerator->new(\%myconfig, $form);
my @hidden_variables = map { "l_${_}" } @columns;
- push @hidden_variables, $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered donumber ordnumber
- transaction_description transdatefrom transdateto type vc employee_id salesman_id project_id);
+ push @hidden_variables, $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered donumber ordnumber serialnumber cusordnumber
+ transaction_description transdatefrom transdateto reqdatefrom reqdateto
+ type vc employee_id salesman_id project_id);
my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
my %column_defs = (
'ids' => { 'text' => '', },
- 'transdate' => { 'text' => $locale->text('Date'), },
+ 'transdate' => { 'text' => $locale->text('Delivery Order Date'), },
'reqdate' => { 'text' => $locale->text('Reqdate'), },
'id' => { 'text' => $locale->text('ID'), },
'donumber' => { 'text' => $locale->text('Delivery Order'), },
'ordnumber' => { 'text' => $locale->text('Order'), },
'customernumber' => { 'text' => $locale->text('Customer Number'), },
+ 'cusordnumber' => { 'text' => $locale->text('Customer Order Number'), },
'name' => { 'text' => $form->{vc} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
'employee' => { 'text' => $locale->text('Employee'), },
'salesman' => { 'text' => $locale->text('Salesman'), },
if ($form->{ordnumber}) {
push @options, $locale->text('Order Number') . " : $form->{ordnumber}";
}
+ push @options, $locale->text('Serial Number') . " : $form->{serialnumber}" if $form->{serialnumber};
if ($form->{transaction_description}) {
push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
}
- if ($form->{transdatefrom}) {
- push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
- }
- if ($form->{transdateto}) {
- push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1);
- }
+ if ( $form->{transdatefrom} or $form->{transdateto} ) {
+ push @options, $locale->text('Delivery Order Date');
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1) if $form->{transdatefrom};
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1) if $form->{transdateto};
+ };
+ if ( $form->{reqdatefrom} or $form->{reqdateto} ) {
+ push @options, $locale->text('Reqdate');
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{reqdatefrom}, 1) if $form->{reqdatefrom};
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{reqdateto}, 1) if $form->{reqdateto};
+ };
if ($form->{open}) {
push @options, $locale->text('Open');
}
}
$form->{id} = 0 if $form->{saveasnew};
- # best case fix für bug 1079. Einkaufsrabatt wird nicht richtig
- # aus Lieferantenauftrag -> Lieferschein -> Rechnung übernommen
- # Tritt nur auf, wenn man direkt über Lieferschein -> speichern ->
- # Workflow Rechnung geht (beim Aufruf über edit() i.O.)
- # Gut. DO-save() speichert den Discount im DB-Format 0.12 für
- # 12%, die Konvertierung wird leider in $form gemacht und daher
- # wird die Maske mit dem falschen Rabatt wieder aufgebaut.
- # Wie immer: backup_vars verwenden um nichts anderes kaputt zu
- # machen. jan 03.03.2010
- # nicht mehr notwendig da für bug 1284 der backend aufruf entsprechend
- # geändert wurde
+
DO->save();
# saving the history
if(!exists $form->{addition}) {
$form->{simple_save} = 1;
if (!$params{no_redirect} && !$form->{print_and_save}) {
- set_headings("edit");
- update();
+ delete @{$form}{ary_diff([keys %{ $form }], [qw(login id script type cursor_fokus)])};
+ edit();
::end_of_request();
}
$main::lxdebug->leave_sub();
check_do_access();
- my $form = $main::form;
- my $locale = $main::locale;
-
- map { delete $form->{$_} } qw(action header login password);
- my @variables = map { { 'key' => $_, 'value' => $form->{$_} } } grep { '' eq ref $form->{$_} } keys %{ $form };
-
- $form->{title} = $locale->text('Delete delivery order');
- $form->header();
-
- print $form->parse_html_template('do/delete', { 'VARIABLES' => \@variables });
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_delivery_order {
- $main::lxdebug->enter_sub();
-
- check_do_access();
-
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
$form->{"sellprice_pg_$i"} = join '--', $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"};
}
IS->get_pricegroups_for_parts(\%myconfig, \%$form);
- set_pricegroup($_) for 1 .. $form->{rowcount};
+ set_pricegroup($form->{rowcount});
display_form();
# Hinweis: delete gibt den wert zurueck und loescht danach das element (nett und einfach)
# $shell: perldoc perlunc; /delete EXPR
$form->{donumber} = delete $form->{donumber_array};
+ $form->{ordnumber} = delete $form->{ordnumber_array};
+ $form->{cusordnumber} = delete $form->{cusordnumber_array};
$form->{deliverydate} = $form->{transdate};
$form->{transdate} = $form->current_date(\%myconfig);
$form->{duedate} = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1);
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- $form->{jsscript} = 1;
-
$form->{title} = $locale->text('Stock');
my $part_info = IC->get_basic_part_info('id' => $form->{parts_id});
+ # Standardlagerplatz für Standard-Auslagern verwenden, falls keiner für die Ware explizit definiert wurde
+ if ($::instance_conf->get_transfer_default_use_master_default_bin) {
+ $part_info->{warehouse_id} ||= $::instance_conf->get_warehouse_id;
+ $part_info->{bin_id} ||= $::instance_conf->get_bin_id;
+ }
+
my $units = AM->retrieve_units(\%myconfig, $form);
# der zweite Parameter von unit_select_data gibt den default-Namen (selected) vor
my $units_data = AM->unit_select_data($units, $form->{do_unit}, undef, $part_info->{unit});
$request->{parts_id} = $form->{"id_$i"};
$row_sum_base_qty += $request->{qty} * $units->{$request->{unit}}->{factor} / $base_unit_factor;
+ $request->{project_id} = $form->{"project_id_$i"} || $form->{globalproject_id};
+
push @all_requests, $request;
}
# entsprechende defaults holen, falls standardlagerplatz verwendet werden soll
if ($::instance_conf->get_transfer_default_use_master_default_bin) {
- $default_warehouse_id = $::instance_conf->get_default_warehouse_id;
- $default_bin_id = $::instance_conf->get_default_bin_id;
+ $default_warehouse_id = $::instance_conf->get_warehouse_id;
+ $default_bin_id = $::instance_conf->get_bin_id;
}
# auslagern soll immer gehen, auch wenn nicht genügend auf lager ist.
# der lagerplatz ist hier extra konfigurierbar, bspw. Lager-Korrektur mit
# Lagerplatz Lagerplatz-Korrektur
- my $default_warehouse_id_ignore_onhand = $::instance_conf->get_default_warehouse_id_ignore_onhand;
- my $default_bin_id_ignore_onhand = $::instance_conf->get_default_bin_id_ignore_onhand;
+ my $default_warehouse_id_ignore_onhand = $::instance_conf->get_warehouse_id_ignore_onhand;
+ my $default_bin_id_ignore_onhand = $::instance_conf->get_bin_id_ignore_onhand;
if ($::instance_conf->get_transfer_default_ignore_onhand && $default_bin_id_ignore_onhand) {
# entsprechende defaults holen
# falls chargenumber, bestbefore oder anzahl nicht stimmt, auf automatischen