From: Moritz Bunkus Date: Tue, 20 Feb 2007 09:13:43 +0000 (+0000) Subject: Debitorenrechnungen: Bei Zahlungseingängen ist für jede Zeile eine Projektnummer... X-Git-Tag: release-2.4.2~76 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=84da0ba2f48ac09652557a5aca1a912b06fb0b0b;p=kivitendo-erp.git Debitorenrechnungen: Bei Zahlungseingängen ist für jede Zeile eine Projektnummer vergebbar. --- diff --git a/SL/AR.pm b/SL/AR.pm index 22ed409c1..049229f55 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -299,29 +299,29 @@ sub post_transaction { # add receivable $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate) + transdate, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$form->{AR}{receivables}'), - $amount, '$form->{"datepaid_$i"}')|; - $dbh->do($query) || $form->dberror($query); + $amount, '$form->{"datepaid_$i"}', ?)|; + do_query($form, $dbh, $query, $project_id); } $form->{receivables} = $amount; $form->{"memo_$i"} =~ s/\'/\'\'/g; if ($form->{"paid_$i"} != 0) { - + my $project_id = conv_i($form->{"paid_project_id_$i"}); # add payment $amount = $form->{"paid_$i"} * -1; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, source, memo) + transdate, source, memo, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$form->{AR}{"paid_$i"}'), $amount, '$form->{"datepaid_$i"}', - '$form->{"source_$i"}', '$form->{"memo_$i"}')|; - $dbh->do($query) || $form->dberror($query); + '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|; + do_query($form, $dbh, $query, $project_id); # exchangerate difference for payment $amount = @@ -331,12 +331,12 @@ sub post_transaction { if ($amount != 0) { $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, fx_transaction, cleared) + transdate, fx_transaction, cleared, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$form->{AR}{"paid_$i"}'), - $amount, '$form->{"datepaid_$i"}', '1', '0')|; - $dbh->do($query) || $form->dberror($query); + $amount, '$form->{"datepaid_$i"}', '1', '0', ?)|; + do_query($form, $dbh, $query, $project_id); } # exchangerate gain/loss @@ -350,11 +350,11 @@ sub post_transaction { $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, fx_transaction, cleared) + transdate, fx_transaction, cleared, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$accno'), - $amount, '$form->{"datepaid_$i"}', '1', '0')|; - $dbh->do($query) || $form->dberror($query); + $amount, '$form->{"datepaid_$i"}', '1', '0', ?)|; + do_query($form, $dbh, $query, $project_id); } } @@ -404,6 +404,8 @@ sub post_payment { for my $i (1 .. $form->{paidaccounts}) { if ($form->{"paid_$i"} != 0) { + my $project_id = conv_i($form->{"paid_project_id_$i"}); + my ($accno) = split /--/, $form->{"AR_paid_$i"}; $form->{"datepaid_$i"} = $form->{invdate} unless ($form->{"datepaid_$i"}); @@ -434,11 +436,11 @@ sub post_payment { $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate) + transdate, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$form->{AR}'), - $amount, '$form->{"datepaid_$i"}')|; - $dbh->do($query) || $form->dberror($query); + $amount, '$form->{"datepaid_$i"}', ?)|; + do_query($form, $dbh, $query, $project_id); # record payment @@ -449,12 +451,12 @@ sub post_payment { $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, - source, memo) + source, memo, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$accno'), $form->{"paid_$i"}, '$form->{"datepaid_$i"}', - '$form->{"source_$i"}', '$form->{"memo_$i"}')|; - $dbh->do($query) || $form->dberror($query); + '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|; + do_query($form, $dbh, $query, $project_id); # gain/loss @@ -492,12 +494,12 @@ sub post_payment { WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|; $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, cleared, fx_transaction) + transdate, cleared, fx_transaction, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$accno'), - $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|; - $dbh->do($query) || $form->dberror($query); + $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|; + do_query($form, $dbh, $query, $project_id); } } } diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 9ca39fdd3..8b75b2da9 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -204,6 +204,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 { @@ -656,15 +657,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} = ""; @@ -672,7 +673,8 @@ $jsscript $column_data{exchangerate} = ""; $column_data{AR_paid} = ""; $column_data{source} = ""; - $column_data{memo} = ""; + $column_data{memo} = ""; + $column_data{paid_project_id} = ""; print " @@ -729,6 +731,14 @@ $jsscript $column_data{memo} = qq||; + $column_data{paid_project_id} = + qq||; + map { print qq|$column_data{$_}\n| } @column_index; print " @@ -760,6 +770,8 @@ sub form_footer { print qq| + + {path}> @@ -772,35 +784,32 @@ 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| - |; } }
| + | . $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|