X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=0b7e00088a99e762ecd9687daff7187434acd64e;hb=afe6d1f6a6af704ffa5a0a633d92080ae784f817;hp=1a61ab2d4705977df67566260f190e5fba90af52;hpb=548f4467739c9fea1addee0e0717a89e7be75429;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 1a61ab2d4..0b7e00088 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -79,7 +79,7 @@ sub add { sub edit { $lxdebug->enter_sub(); - $form->{"Watchdog::paidaccounts"} = 1; + # show history button $form->{javascript} = qq||; #/show hhistory button @@ -169,11 +169,6 @@ sub invoice_links { $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; - if (@{ $form->{all_customer} }) { - $form->{customer} = "$form->{customer}--$form->{customer_id}"; - $form->{selectcustomer} = "$form->{customer}--$form->{customer_id}"; - } - # departments if ($form->{all_departments}) { $form->{selectdepartment} = "\n"; @@ -199,11 +194,6 @@ sub invoice_links { if ($key eq "AR_paid") { for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { - $lxdebug->message(0, "link " . $form->{acc_trans}->{$key}->[$i - 1]->{link}); - $lxdebug->dump(0, "...", $form->{acc_trans}->{$key}->[$i - 1]); - my $previous_links = { map { $_, 1 } split m/:/, $form->{acc_trans}->{$key}->[$i - 1]->{link} }; - next if (!$previous_links->{AR}); - $form->{"AR_paid_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; @@ -289,6 +279,13 @@ sub prepare_invoice { sub form_header { $lxdebug->enter_sub(); + if ($form->{old_employee_id}) { + $form->{employee_id} = $form->{old_employee_id}; + } + if ($form->{old_salesman_id}) { + $form->{salesman_id} = $form->{old_salesman_id}; + } + if ($edit) { if ($form->{type} eq "credit_note") { @@ -305,7 +302,7 @@ sub form_header { } } } - + $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); $form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; @@ -382,11 +379,13 @@ sub form_header { $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } + $form->{selectcustomer} = ($myconfig{vclimit} > scalar(@values)); + my $customers = qq| | . $locale->text('Customer') . qq| | . (($myconfig{vclimit} <= scalar(@values)) - ? qq|| + ? qq|| : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer}, '-onChange' => 'document.getElementById(\'update_button\').click();', '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| @@ -493,12 +492,6 @@ sub form_header { s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } - #quote customer Bug 133 - $form->{selectcustomer} = $form->quote($form->{selectcustomer}); - - #substitute \n and \r to \s (bug 543) - $form->{selectcustomer} =~ s/[\n\r]/ /g; - if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) { $creditwarning = 1; } else { @@ -667,7 +660,7 @@ sub form_header { - + $contact $shipto @@ -1016,7 +1009,8 @@ if ($form->{type} eq "credit_note") { "; - my @triggers = (); + my @triggers = (); + my $totalpaid = 0; $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); for $i (1 .. $form->{paidaccounts}) { @@ -1037,6 +1031,9 @@ if ($form->{type} eq "credit_note") { $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); + if ($form->{"exchangerate_$i"} == 0) { + $form->{"exchangerate_$i"} = ""; + } $exchangerate = qq| |; if ($form->{currency} ne $form->{defaultcurrency}) { if ($form->{"forex_$i"}) { @@ -1067,6 +1064,23 @@ if ($form->{type} eq "credit_note") { push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } + my $paid_missing = $form->{oldinvtotal} - $totalpaid; + + print qq| + + + + | . $locale->text('Total') . qq| + | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| + + + + + | . $locale->text('Missing amount') . qq| + | . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq| + +|; + map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal)); print qq| @@ -1157,11 +1171,16 @@ if ($form->{type} eq "credit_note") { . Q($form->{id}) . qq|);" name="history" id="history" value="| . $locale->text('history') - . qq|">|; + . qq|"> |; } # /button for saving history - - + + # mark_as_paid button + if($form->{id} ne "") { + print qq||; + } + # /mark_as_paid button print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) . qq| @@ -1182,6 +1201,12 @@ print qq| $lxdebug->leave_sub(); } +sub mark_as_paid { + $lxdebug->enter_sub(); + &mark_as_paid_common(\%myconfig,"ar"); + $lxdebug->leave_sub(); +} + sub update { $lxdebug->enter_sub(); @@ -1357,6 +1382,8 @@ sub update { sub post_payment { $lxdebug->enter_sub(); + + $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); for $i (1 .. $form->{paidaccounts}) { if ($form->{"paid_$i"}) { $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); @@ -1388,6 +1415,8 @@ sub post_payment { sub post { $lxdebug->enter_sub(); + + $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); $form->isblank("invdate", $locale->text('Invoice Date missing!')); $form->isblank("customer", $locale->text('Customer missing!')); @@ -1434,6 +1463,7 @@ sub post { ($form->{AR}) = split /--/, $form->{AR}; ($form->{AR_paid}) = split /--/, $form->{AR_paid}; + $form->{storno} = 0; $form->{label} = $locale->text('Invoice'); @@ -1531,7 +1561,6 @@ sub preview { $form->{preview} = 1; $old_form = new Form; for (keys %$form) { $old_form->{$_} = $form->{$_} } - $old_form->{rowcount}++; &print_form($old_form); $lxdebug->leave_sub();