X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fis.pl;h=78ee3d3162cafad6a5ab5ef9add67d9986019f04;hb=f36eb9fca78c4940b486b7dafa4ab636cdaf99cd;hp=e2b99cb7418b1cbebbe0972a1012263ca965229c;hpb=d7f060429e809653d45e93e86b3c5c8d7129e0a9;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index e2b99cb74..78ee3d316 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -83,7 +83,7 @@ sub edit { # show history button $form->{javascript} = qq||; #/show hhistory button - + if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR") { $form->error("Access Denied"); @@ -288,13 +288,13 @@ sub form_header { if ($form->{type} eq "credit_note") { $form->{title} = $locale->text('Edit Credit Note'); - + if ($form->{storno}) { $form->{title} = $locale->text('Edit Storno Credit Note'); } } else { $form->{title} = $locale->text('Edit Sales Invoice'); - + if ($form->{storno}) { $form->{title} = $locale->text('Edit Storno Invoice'); } @@ -346,7 +346,7 @@ sub form_header { | . $locale->text('Contact Person') . qq| | . - NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, + NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px', '-labels' => \%labels, '-default' => $form->{"cp_id"})) . qq| @@ -357,14 +357,14 @@ sub form_header { @values = (); foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"name"}; + $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login}; } my $employees = qq| | . $locale->text('Employee') . qq| | . - NTI($cgi->popup_menu('-name' => 'employee', '-default' => $form->{"employee_id"}, + NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"}, '-values' => \@values, '-labels' => \%labels)) . qq| |; @@ -374,25 +374,25 @@ sub form_header { @values = (); foreach my $item (@{ $form->{"ALL_CUSTOMERS"} }) { push(@values, $item->{name}.qq|--|.$item->{"id"}); - $labels{$item->{"id"}} = $item->{name}.qq|--|.$item->{"id"}; + $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"}; } my $customers = qq| | . $locale->text('Customer') . qq| - | . - (($myconfig{vclimit} <= scalar(@values)) - ? qq|| - : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer}, + | . + (($myconfig{vclimit} <= scalar(@values)) + ? qq|| + : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer}, '-onChange' => 'document.getElementById(\'update_button\').click();', - '-values' => \@values, '-labels' => \%labels)))) . qq| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| + |; - + %labels = (); @values = (""); foreach my $item (@{ $form->{"ALL_SHIPTO"} }) { push(@values, $item->{"shipto_id"}); - $labels{$item->{"shipto_id"}} = - $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"}; + $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city); } my $shipto; @@ -401,7 +401,7 @@ sub form_header { | . $locale->text('Shipping Address') . qq| | . - NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, + NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px', '-labels' => \%labels, '-default' => $form->{"shipto_id"})) . qq||; } @@ -412,7 +412,7 @@ sub form_header { push(@values, $item); $labels{$item} = $item; } - + $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; my $currencies; if (scalar @values) { @@ -438,7 +438,7 @@ sub form_header { '-default' => $form->{"globalproject_id"})); %labels = (); - @values = (""); + @values = (); foreach my $item (@{ $form->{ALL_SALESMEN} }) { push(@values, $item->{id}); $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login}; @@ -448,8 +448,8 @@ sub form_header { qq| | . $locale->text('Salesman') . qq| | . - NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id}, - '-values' => \@values, '-labels' => \%labels)) + NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id} ? $form->{salesman_id} : $form->{employee_id}, + '-values' => \@values, '-labels' => \%labels)) . qq| |; @@ -466,7 +466,7 @@ sub form_header { | . $locale->text('Steuersatz') . qq| | . NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"}, - '-values' => \@values, '-labels' => \%labels)) . qq| + '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px',)) . qq| |; @@ -493,7 +493,7 @@ sub form_header { #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 { @@ -529,7 +529,7 @@ sub form_header { $department = qq| | . $locale->text('Department') . qq| - + @@ -540,13 +540,11 @@ sub form_header { if ($form->{business}) { $business = qq| - | . $locale->text('Business') . qq| - $form->{business} - | . $locale->text('Trade Discount') . qq| - | + | . $locale->text('Customer type') . qq| + $form->{business}; | . $locale->text('Trade Discount') . qq| | . $form->format_amount(\%myconfig, $form->{tradediscount} * 100) . qq| % - + |; } @@ -623,6 +621,7 @@ sub form_header { } $form->{"javascript"} .= qq||; + $form->{javascript} .= qq||; $jsscript .= $form->write_trigger(\%myconfig, 2, @@ -642,11 +641,13 @@ sub form_header {
| ; -map({print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} - qw(id action type media format queued printed emailed title vc discount - creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id)) ; -print ($form->{saved_message} ? qq|

$form->{saved_message}

| : "") ; -print qq| + + $form->hide_form(qw(id action type media format queued printed emailed title vc discount + creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id + max_dunning_level dunning_amount)); + print qq|

$form->{saved_message}

| if $form->{saved_message}; + + print qq| @@ -673,7 +674,7 @@ print qq| $business | . $locale->text('Record in') . qq| - + $taxzone @@ -787,20 +788,20 @@ print qq| -| . +| . $jsscript . qq| | ; -map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } +map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2)); print qq| |; -map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } +map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(message email subject cc bcc taxaccounts)); print qq||; foreach $item (split(/ /, $form->{taxaccounts})) { - map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } + map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } ("${item}_rate", "${item}_description", "${item}_taxnumber")); } $lxdebug->leave_sub(); @@ -822,7 +823,7 @@ sub form_footer { qq||; $intnotes = qq||; - + $form->{taxincluded} = ($form->{taxincluded} ? "checked" : ""); $taxincluded = ""; @@ -1010,7 +1011,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}) { @@ -1061,7 +1063,24 @@ if ($form->{type} eq "credit_note") { push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } - map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal)); + 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| @@ -1161,7 +1180,7 @@ if ($form->{type} eq "credit_note") { | . -$cgi->hidden("-name" => "callback", "-value" => $form->{callback}) +$cgi->hidden("-name" => "callback", "-value" => $form->{callback}) . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}]) . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]); map({ print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} qw(login password)); @@ -1185,7 +1204,7 @@ sub update { $form->{print_and_post} = 0; } - + if($form->{taxincluded}) { $taxincluded = "checked"; } @@ -1372,7 +1391,7 @@ sub post_payment { ($form->{AR}) = split /--/, $form->{AR}; ($form->{AR_paid}) = split /--/, $form->{AR_paid}; relink_accounts(); - $form->redirect($locale->text(' Payment posted!')) + $form->redirect($locale->text('Payment posted!')) if (IS->post_payment(\%myconfig, \%$form)); $form->error($locale->text('Cannot post payment!')); @@ -1454,7 +1473,7 @@ sub post { "POSTED"; $form->save_history($form->dbconnect(\%myconfig)); } - + $form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!')) unless $print_post; @@ -1586,7 +1605,7 @@ sub credit_note { $form->{script} = 'is.pl'; $script = "is"; $buysell = 'buy'; - + # bo creates the id, reset it map { delete $form->{$_} } @@ -1629,12 +1648,12 @@ sub yes { if (IS->delete_invoice(\%myconfig, \%$form, $spool)) { # saving the history if(!exists $form->{addition}) { - $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; $form->save_history($form->dbconnect(\%myconfig)); } - # /saving the history - $form->redirect($locale->text('Invoice deleted!')); + # /saving the history + $form->redirect($locale->text('Invoice deleted!')); } $form->error($locale->text('Cannot delete invoice!'));