X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=9d48cf2d8c42d15b19a27eb894ccf19c2fadc8a6;hb=3d9df149ec915037561bebce349e6d49584749e0;hp=6f433a98aa5ada7090848c721ba152f1e25ac231;hpb=2b44867fc2d4e3c061c126890cc90fcaa84b6baa;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 6f433a98a..9d48cf2d8 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -300,8 +300,7 @@ sub form_header { my @old_project_ids = ($form->{"globalproject_id"}); map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"}; - $form->get_lists("shipto" => "ALL_SHIPTO", - "projects" => { "key" => "ALL_PROJECTS", + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 0, "old_id" => \@old_project_ids }, "taxzones" => "ALL_TAXZONES", @@ -312,6 +311,9 @@ sub form_header { $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]); + $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all(query => [ + or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ] + ]); $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all(query => [ or => [ cp_cv_id => $::form->{"$::form->{vc}_id"} * 1, @@ -321,7 +323,6 @@ sub form_header { ] ] ]); - $TMPL_VAR{shipto_labels} = sub { join "; ", grep { $_ } map { $_[0]->{"shipto${_}" } } qw(name department_1 street city) }; $TMPL_VAR{department_labels} = sub { "$_[0]->{description}--$_[0]->{id}" }; # customer @@ -404,6 +405,18 @@ sub form_footer { my ($tax, $subtotal); $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ]; + IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/; + + if ( $form->{vc} eq 'customer' && !$form->{taxincluded_changed_by_user} ) { + if ( $form->{taxincluded_checked} eq 'y' ) { + $form->{taxincluded} = 1; + } elsif ( $form->{taxincluded_checked} eq 'n' ) { + $form->{taxincluded} = 0; + } else { + $form->{taxincluded} = $myconfig{taxincluded_checked}; + } + } + foreach my $item (@{ $form->{taxaccounts_array} }) { if ($form->{"${item}_base"}) { if ($form->{taxincluded}) { @@ -575,7 +588,7 @@ sub update { $form->{creditremaining} -= $amount; - map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) } qw(sellprice listprice lastcost); + map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) } qw(sellprice lastcost); $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); @@ -728,7 +741,7 @@ sub post { ($form->{AR_paid}) = split /--/, $form->{AR_paid}; $form->{storno} ||= 0; - $form->{label} = $locale->text('Invoice'); + $form->{label} = $form->{type} eq 'credit_note' ? $locale->text('Credit Note') : $locale->text('Invoice'); $form->{id} = 0 if $form->{postasnew}; @@ -747,7 +760,7 @@ sub post { remove_draft() if $form->{remove_draft}; if(!exists $form->{addition}) { - $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = 'invnumber' .'_'. $form->{invnumber}; # ($form->{type} eq 'credit_note' ? 'cnnumber' : 'invnumber') .'_'. $form->{invnumber}; $form->{addition} = $form->{print_and_post} ? "PRINTED AND POSTED" : $form->{storno} ? "STORNO" : "POSTED"; @@ -937,6 +950,12 @@ sub credit_note { # map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } # qw(creditlimit creditremaining); + for my $i (1 .. $form->{rowcount}) { + for (qw(listprice)) { + $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"}; + } + } + my $currency = $form->{currency}; &invoice_links; @@ -978,7 +997,7 @@ sub yes { if (IS->delete_invoice(\%myconfig, \%$form)) { # saving the history if(!exists $form->{addition}) { - $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = 'invnumber' .'_'. $form->{invnumber}; # ($form->{type} eq 'credit_note' ? 'cnnumber' : 'invnumber') .'_'. $form->{invnumber}; $form->{addition} = "DELETED"; $form->save_history; }