X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=da33886a12e23d10b012e8775b6ddd919c30b36d;hb=84bed7a655edfe816ad2a04b5549b6bd6a968c79;hp=da4315b2ec7838a6c2ced993b8af5285d4db5fa0;hpb=3253777d478fe7f8b8d85ef867c864cdae16d7fa;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index da4315b2e..da33886a1 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -36,7 +36,7 @@ use SL::IS; use SL::PE; use Data::Dumper; -require "$form->{path}/arap.pl"; +require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; @@ -79,6 +79,7 @@ sub add { # saving the history if(!exists $form->{addition} && ($form->{id} ne "")) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "ADDED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -86,11 +87,13 @@ sub add { $form->{title} = "Add"; $form->{callback} = - "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=add&login=$form->{login}&password=$form->{password}" unless $form->{callback}; - &create_links; AR->get_transdate(\%myconfig, $form); + $form->{initial_transdate} = $form->{transdate}; + &create_links; + $form->{transdate} = $form->{initial_transdate}; &display_form; $lxdebug->leave_sub(); } @@ -100,7 +103,7 @@ sub edit { # show history button $form->{javascript} = qq||; #/show hhistory button - + $form->{javascript} .= qq||; $form->{title} = "Edit"; &create_links; @@ -134,6 +137,9 @@ sub create_links { $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; $form->{rowcount} = 1; + # notes + $form->{notes} = $form->{intnotes} unless $form->{notes}; + # currencies @curr = split(/:/, $form->{currencies}); chomp $curr[0]; @@ -257,8 +263,6 @@ sub create_links { } } - $lxdebug->message(0, "1 ARselected $form->{ARselected}"); - $form->{taxincluded} = $taxincluded if ($form->{id}); $form->{paidaccounts} = 1 if not defined $form->{paidaccounts}; @@ -319,7 +323,7 @@ sub form_header { # show history button js $form->{javascript} .= qq||; #/show history button js - + $form->{javascript} .= qq||; $readonly = ($form->{id}) ? "readonly" : ""; $form->{radier} = @@ -359,8 +363,6 @@ sub form_header { } } - $taxincluded = ""; - $taxincluded = qq| {taxincluded}> @@ -387,7 +389,9 @@ sub form_header { $customer = ($form->{selectcustomer}) - ? qq|| + ? qq|| : qq||; $employee = qq| @@ -428,6 +432,7 @@ sub form_header { my (%AR_amount_labels, @AR_amount_values); my (%AR_labels, @AR_values); my (%AR_paid_labels, @AR_paid_values); + my %charts; my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { @@ -447,16 +452,20 @@ sub form_header { $AR_paid_labels{$item->{accno}} = "$item->{accno}--$item->{description}"; } + + $charts{$item->{accno}} = $item; } my %taxchart_labels = (); my @taxchart_values = (); + my %taxcharts = (); foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { my $key = "$item->{id}--$item->{rate}"; $taxchart_init = $key if ($taxchart_init eq $item->{id}); push(@taxchart_values, $key); $taxchart_labels{$key} = "$item->{taxdescription} " . ($item->{rate} * 100) . ' %'; + $taxcharts{$item->{id}} = $item; } $form->{fokus} = "arledger.customer"; @@ -468,12 +477,12 @@ sub form_header { # with JavaScript Calendar $button1 = qq| - {transdate}> + text('button') . qq|> |; $button2 = qq| - {duedate}> + text('button') . qq|> |; @@ -486,15 +495,17 @@ sub form_header { # without JavaScript Calendar $button1 = - qq|{transdate}>|; + qq||; $button2 = - qq|{duedate}>|; + qq||; } $form->header; - + $onload = qq|focus()|; + $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| - +
{script}> @@ -610,6 +621,24 @@ $jsscript $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2); $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2); + my $selected_accno_full; + my ($accno_row) = split(/--/, $form->{"AR_amount_$i"}); + my $item = $charts{$accno_row}; + $selected_accno_full = "$item->{accno}--$item->{tax_id}"; + + my $selected_taxchart = $form->{"taxchart_$i"}; + my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full); + my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AR_amount_$i"}); + + if ($previous_accno && + ($previous_accno eq $selected_accno) && + ($previous_tax_id ne $selected_tax_id)) { + my $item = $taxcharts{$selected_tax_id}; + $selected_taxchart = "$item->{id}--$item->{rate}"; + } + + $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"}); + $selectAR_amount = NTI($cgi->popup_menu('-name' => "AR_amount_$i", '-id' => "AR_amount_$i", @@ -617,7 +646,9 @@ $jsscript '-onChange' => "setTaxkey(this, $i)", '-values' => \@AR_amount_values, '-labels' => \%AR_amount_labels, - '-default' => $form->{"AR_amount_$i"})); + '-default' => $selected_accno_full)) + . $cgi->hidden('-name' => "previous_AR_amount_$i", + '-default' => $selected_accno_full); $tax = qq|| . NTI($cgi->popup_menu('-name' => "taxchart_$i", @@ -625,8 +656,7 @@ $jsscript '-style' => 'width:200px', '-values' => \@taxchart_values, '-labels' => \%taxchart_labels, - '-default' => $form->{"taxchart_$i"} eq "" ? - $taxchart_init : $form->{"taxchart_$i"})) + '-default' => $selected_taxchart)) . qq||; $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : ''); @@ -760,12 +790,12 @@ $jsscript |; $column_data{paid} = - qq|{"paid_$i"}>|; + qq||; $column_data{AR_paid} = qq|${selectAR_paid}|; $column_data{exchangerate} = qq|$exchangerate|; $column_data{datepaid} = - qq|{"datepaid_$i"}> + qq| |; $column_data{source} = qq||; @@ -813,7 +843,6 @@ sub form_footer { -{path}> {login}> {password}> | @@ -824,10 +853,19 @@ sub form_footer {
|; + if (!$form->{id} && $form->{draft_id}) { + print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft', + '-value' => 1, '-checked' => $form->{remove_draft}, + '-label' => '')) . + qq| 
|); + } + $transdate = $form->datetonum($form->{transdate}, \%myconfig); $closedto = $form->datetonum($form->{closedto}, \%myconfig); - print qq| |; if ($form->{id}) { @@ -860,7 +898,7 @@ sub form_footer { } if ($form->{menubar}) { - require "$form->{path}/menu.pl"; + require "bin/mozilla/menu.pl"; &menubar; } # button for saving history @@ -1050,13 +1088,11 @@ sub post { $form->{AR}{receivables} = $form->{ARselected}; - $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber") - unless $form->{invnumber}; - $form->{id} = 0 if $form->{postasnew}; if (AR->post_transaction(\%myconfig, \%$form)) { # saving the history if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1075,6 +1111,7 @@ sub post_as_new { $form->{postasnew} = 1; # saving the history if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED AS NEW"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1139,6 +1176,7 @@ sub yes { if (AR->delete_transaction(\%myconfig, \%$form, $spool)) { # saving the history if(!exists $form->{addition}) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1182,7 +1220,9 @@ sub search { | if $form->{selectdepartment}; $form->{title} = $locale->text('AR Transactions'); - + + $form->{javascript} .= qq||; + # use JavaScript Calendar or not $form->{jsscript} = $jscalendar; $jsscript = ""; @@ -1190,12 +1230,12 @@ sub search { # with JavaScript Calendar $button1 = qq| - + text('button') . qq|> |; $button2 = qq| - + text('button') . qq|> |; @@ -1208,9 +1248,9 @@ sub search { # without JavaScript Calendar $button1 = qq| - |; + |; $button2 = qq| - |; + |; } $form->get_lists("projects" => { "key" => "ALL_PROJECTS", @@ -1228,9 +1268,11 @@ sub search { $form->{fokus} = "search.customer"; $form->header; - + $onload = qq|focus()|; + $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| - + {script}> @@ -1343,7 +1385,6 @@ sub search { {nextsub}> -{path}> {login}> {password}> @@ -1372,7 +1413,7 @@ sub ar_transactions { AR->ar_transactions(\%myconfig, \%$form); $callback = - "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}"; + "$form->{script}?action=ar_transactions&login=$form->{login}&password=$form->{password}"; $href = $callback; if ($form->{customer}) { @@ -1602,12 +1643,13 @@ sub ar_transactions { $module = ($ar->{invoice}) ? "is.pl" : $form->{script}; $column_data{invnumber} = - "{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}"; + "{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}"; $column_data{type} = "" . - ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") : - $ar->{amount} < 0 ? - $locale->text("Credit note (one letter abbreviation)") : - $locale->text("Invoice (one letter abbreviation)")) . ""; + ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") : + $ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") : + $ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") : + $locale->text("AR Transaction (abbreviation)")) + . ""; $column_data{ordnumber} = "$ar->{ordnumber} "; $column_data{name} = "$ar->{name}"; $ar->{notes} =~ s/\r\n/
/g; @@ -1677,7 +1719,6 @@ sub ar_transactions { -{path}> {login}> {password}>