X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=1e5aa98f26379b2dfee3846d90f97ad23c5cd842;hb=ebef09a8bde1d401fc7b0d60cfe09393e9a84c0f;hp=291ad068d5eff4b991c0f0221fdc1a8dc3ab75a2;hpb=a4b22a8f008d6431597fa80de26bcb0fa10e8d7b;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 291ad068d..1e5aa98f2 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -73,7 +73,14 @@ require "bin/mozilla/common.pl"; sub add { $lxdebug->enter_sub(); - + + # saving the history + if(!exists $form->{addition} && ($form->{id} ne "")) { + $form->{addition} = "ADDED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->{title} = "Add"; $form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" @@ -82,12 +89,14 @@ sub add { &create_links; AR->get_transdate(\%myconfig, $form); &display_form; - $lxdebug->leave_sub(); } sub edit { $lxdebug->enter_sub(); + # show history button + $form->{javascript} = qq||; + #/show hhistory button $form->{title} = "Edit"; @@ -204,6 +213,7 @@ sub create_links { $form->{"forex_$j"} = $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate}; $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}"; + $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id}; $form->{paidaccounts}++; } else { @@ -327,6 +337,9 @@ sub form_header { }; //--> |; + # show history button js + $form->{javascript} .= qq||; + #/show history button js $readonly = ($form->{id}) ? "readonly" : ""; @@ -421,6 +434,21 @@ sub form_header { |; } + my @old_project_ids = (); + map({ push(@old_project_ids, $form->{"project_id_$_"}) + if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }); + + my %project_labels = (); + my @project_values = (""); + foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { + push(@project_values, $item->{"id"}); + $project_labels{$item->{"id"}} = $item->{"projectnumber"}; + } + $form->{fokus} = "arledger.customer"; # use JavaScript Calendar or not @@ -582,6 +610,12 @@ $jsscript qq||; $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : ''); + my $projectnumber = + NTI($cgi->popup_menu('-name' => "project_id_$i", + '-values' => \@project_values, + '-labels' => \%project_labels, + '-default' => $form->{"project_id_$i"} )); + print qq| @@ -589,9 +623,7 @@ $jsscript {"tax_$i"}> $tax - - {"project_id_$i"}> - + $projectnumber |; $amount = ""; @@ -637,15 +669,15 @@ $jsscript - |; if ($form->{currency} eq $form->{defaultcurrency}) { - @column_index = qw(datepaid source memo paid AR_paid); + @column_index = qw(datepaid source memo paid AR_paid paid_project_id); } else { - @column_index = qw(datepaid source memo paid exchangerate AR_paid); + @column_index = qw(datepaid source memo paid exchangerate AR_paid paid_project_id); } $column_data{datepaid} = ""; @@ -653,7 +685,8 @@ $jsscript $column_data{exchangerate} = ""; $column_data{AR_paid} = ""; $column_data{source} = ""; - $column_data{memo} = ""; + $column_data{memo} = ""; + $column_data{paid_project_id} = ""; print " @@ -710,6 +743,14 @@ $jsscript $column_data{memo} = qq||; + $column_data{paid_project_id} = + qq||; + map { print qq|$column_data{$_}\n| } @column_index; print " @@ -741,6 +782,8 @@ sub form_footer { print qq| + + {path}> @@ -753,39 +796,50 @@ sub form_footer { $transdate = $form->datetonum($form->{transdate}, \%myconfig); $closedto = $form->datetonum($form->{closedto}, \%myconfig); + print qq| +|; if ($form->{id}) { if ($form->{radier}) { - print qq| - |; - - print qq| + print qq| |; - } - if ($transdate > $closedto) { - print qq| + } + if ($transdate > $closedto) { + print qq| |; - } - print qq| + } + print qq| + . $locale->text('Post Payment') . qq|"> |; - + } else { if ($transdate > $closedto) { print qq| - |; } } + if ($form->{menubar}) { + require "$form->{path}/menu.pl"; + &menubar; + } + # button for saving history + if($form->{id} ne "") { + print qq| + {id} + . qq|); name=history id=history value=| + . $locale->text('history') + . qq|>|; + } + # /button for saving history print " @@ -870,8 +924,6 @@ sub update { &check_name(customer); $form->{AR} = $save_AR; - &check_project; - $form->{invtotal} = ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax; @@ -979,9 +1031,9 @@ sub post { exit; } - ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected}; - ($taxkey, $NULL) = split /--/, $form->{taxchartselected}; - ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected}; + my ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected}; + my ($taxkey, $NULL) = split /--/, $form->{taxchartselected}; + my ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected}; $form->{AR}{amount_1} = $creditaccno; $form->{AR}{receivables} = $receivablesaccno; $form->{taxkey} = $taxkey; @@ -990,9 +1042,15 @@ sub post { unless $form->{invnumber}; $form->{id} = 0 if $form->{postasnew}; - - $form->redirect($locale->text('Transaction posted!')) - if (AR->post_transaction(\%myconfig, \%$form)); + if (AR->post_transaction(\%myconfig, \%$form)) { + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "POSTED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->redirect($locale->text('Transaction posted!')); + } $form->error($locale->text('Cannot post transaction!')); $lxdebug->leave_sub(); @@ -1002,6 +1060,12 @@ sub post_as_new { $lxdebug->enter_sub(); $form->{postasnew} = 1; + # saving the history + if(!exists $form->{addition} && $form->{id} ne "") { + $form->{addition} = "POSTED AS NEW"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history &post; $lxdebug->leave_sub(); @@ -1059,9 +1123,15 @@ sub delete { sub yes { $lxdebug->enter_sub(); - - $form->redirect($locale->text('Transaction deleted!')) - if (AR->delete_transaction(\%myconfig, \%$form, $spool)); + if (AR->delete_transaction(\%myconfig, \%$form, $spool)) { + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + $form->redirect($locale->text('Transaction deleted!')); + } $form->error($locale->text('Cannot delete transaction!')); $lxdebug->leave_sub();
| + | . $locale->text('Incoming Payments') . qq|
" . $locale->text('Date') . "" . $locale->text('Exch') . "" . $locale->text('Account') . "" . $locale->text('Source') . "" . $locale->text('Memo') . "" . $locale->text('Memo') . "" . $locale->text('Project Number') . "
| + . NTI($cgi->popup_menu('-name' => "paid_project_id_$i", + '-values' => \@project_values, + '-labels' => \%project_labels, + '-default' => $form->{"paid_project_id_$i"} )) + . qq|