use SL::PE;
require "$form->{path}/arap.pl";
+require "bin/mozilla/common.pl";
1;
my $tax = 0;
my $taxaccno = "";
foreach $ref (@{ $form->{GL} }) {
- $form->{"projectnumber_$i"} = "$ref->{projectnumber}--$ref->{project_id}";
-
$j = $i - 1;
if ($tax && ($ref->{accno} eq $taxaccno)) {
$form->{"tax_$j"} = abs($ref->{amount});
</tr>
| if $form->{selectdepartment};
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 1 });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels));
+
# use JavaScript Calendar or not
$form->{jsscript} = $jscalendar;
$jsscript = "";
<th align=right>| . $locale->text('Notes') . qq|</th>
<td colspan=3><input name=notes size=40></td>
</tr>
+ <tr>
+ <th align=right>| . $locale->text('Project Number') . qq|</th>
+ <td colspan=3>$projectnumber</td>
+ </tr>
<tr>
<th align=right>| . $locale->text('From') . qq|</th>
$button1
<tr>
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
<td>| . $locale->text('Subtotal') . qq|</td>
+ <td align=right><input name="l_projectnumbers" class=checkbox type=checkbox value=Y></td>
+ <td>| . $locale->text('Project Number') . qq|</td>
</tr>
</table>
</tr>
$option .= "\n<br>" if $option;
$option .= $locale->text('Notes') . " : $form->{notes}";
}
+ if ($form->{project_id}) {
+ $href .= "&project_id=" . $form->escape($form->{project_id});
+ $callback .= "&project_id=" . $form->escape($form->{project_id});
+ }
if ($form->{datefrom}) {
$href .= "&datefrom=$form->{datefrom}";
. $locale->date(\%myconfig, $form->{dateto}, 1);
}
- @columns = $form->sort_columns(
- qw(transdate id reference description notes source debit debit_accno credit credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno gifi_accno)
+ @columns = $form->sort_columns( qw(
+ transdate id reference description
+ notes source debit debit_accno
+ credit credit_accno debit_tax debit_tax_accno
+ credit_tax credit_tax_accno accno gifi_accno
+ projectnumbers
+ )
);
if ($form->{accno} || $form->{gifi_accno}) {
. $locale->text('GIFI')
. "</a></th>";
$column_header{balance} = "<th>" . $locale->text('Balance') . "</th>";
+ $column_header{projectnumbers} =
+ "<th class=listheading>" . $locale->text('Project Numbers') . "</th>";
$form->{landscape} = 1;
$column_data{balance} =
"<td align=right>"
. $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . "</td>";
+ $column_data{projectnumbers} =
+ "<td>" . join(", ", sort({ lc($a) cmp lc($b) } keys(%{ $ref->{projectnumbers} }))) . "</td>";
$i++;
$i %= 2;
map { $column_data{$_} = "<td> </td>" } @column_index;
+ my $balanced_ledger = $totaldebit
+ + $totaldebittax
+ - $totalcredit
+ - $totalcredittax;
+ # = 0 for balanced ledger
+
$column_data{debit} =
"<th align=right class=listtotal>"
. $form->format_amount(\%myconfig, $totaldebit, 2, " ") . "</th>";
print qq|
</tr>
+ <tr>|;
+
+
+ if ( abs($balanced_ledger) > 0.001 ) {
+
+ print qq|<td colspan="4" style="background-color:#FFA0A0" >|
+ . $locale->text('Unbalanced Ledger')
+ . ": "
+ . $form->format_amount(\%myconfig, $balanced_ledger, 3, " ")
+
+ } elsif ( abs($balanced_ledger) <= 0.001 ) {
+
+ print qq|<td colspan="3">|
+ . $locale->text('Balanced Ledger')
+
+ }
+
+
+ print qq|
+ </td>
+ </tr>
</tbody>
</table>
</td>
sub update {
$lxdebug->enter_sub();
- if ($form->{transdate} ne $form->{oldtransdate}) {
- if ($form->{selectprojectnumber}) {
- $form->all_projects(\%myconfig, undef, $form->{transdate});
- if (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} = "<option>\n";
- for (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} .=
- qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
- }
- $form->{selectprojectnumber} =
- $form->escape($form->{selectprojectnumber}, 1);
- }
- }
- $form->{oldtransdate} = $form->{transdate};
- }
+ $form->{oldtransdate} = $form->{transdate};
my @a = ();
my $count = 0;
my ($init) = @_;
$lxdebug->enter_sub();
- $form->{selectprojectnumber} = $form->unescape($form->{selectprojectnumber})
- if $form->{selectprojectnumber};
-
$form->{totaldebit} = 0;
$form->{totalcredit} = 0;
my $chart = $form->{chart};
$chart = $form->unquote($chart);
$form->{taxchart} = $form->unquote($form->{taxchart});
$taxchart = $form->{taxchart};
+
+ 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"};
+ }
+
for $i (1 .. $form->{rowcount}) {
$source = qq|
. ($i + 10 + (($i - 1) * 8))
. qq|>$form->{taxchart}</select></td>|;
- # if ($form->{selectprojectnumber}) {
- # $project = qq|
- # <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
- # }
$korrektur =
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
. ($i + 9 + (($i - 1) * 8))
. ($i + 10 + (($i - 1) * 8))
. qq|>$tax</select></td>|;
- # if ($form->{selectprojectnumber}) {
- # $form->{"projectnumber_$i"} = ""
- # if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
- #
- # $project = $form->{"projectnumber_$i"};
- # $project =~ s/--.*//;
- # $project = qq|<td>$project</td>|;
- # }
-
if ($form->{transfer}) {
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
$x = ($checked) ? "x" : "";
<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
. ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|;
- # if ($form->{selectprojectnumber}) {
- # $project = qq|
- # <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
- # }
$korrektur =
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
. ($i + 9 + (($i - 1) * 8))
}
}
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"project_id_$i"} ));
+
print qq|<tr valign=top>
$accno
$fx_transaction
$tax
$source
$memo
+ <td>$projectnumber</td>
</tr>
|;
$form->hide_form(qw(rowcount selectaccno));
- # print qq|
- # <input type=hidden name=selectprojectnumber value="|
- # . $form->escape($form->{selectprojectnumber}, 1) . qq|">|;
$lxdebug->leave_sub();
}
<th class=listheading style="width:20%">|
. $locale->text('Source') . qq|</th>
<th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
- $project
+ <th class=listheading style="width:20%">|
+ . $locale->text('Project Number') . qq|</th>
</tr>
$jsscript
<td></td>
<th align=right class=listtotal> $form->{totaldebit}</th>
<th align=right class=listtotal> $form->{totalcredit}</th>
- <td colspan=5></td>
+ <td colspan=6></td>
</tr>
</table>
</td>
print qq|<input class=submit type=submit name=action value="|
. $locale->text('Storno') . qq|">|;
- # Löschen und ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
+ # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
if (!$form->{locked} && $radieren) {
print qq|
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Transaction deleted!'))
- if (GL->delete_transaction(\%myconfig, \%$form));
+ if (GL->delete_transaction(\%myconfig, \%$form)){
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $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();
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
- # check project
- &check_project;
-
my @a = ();
my $count = 0;
my $debittax = 0;
$form->error($err[$errno]);
}
undef($form->{callback});
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{addition} = "SAVED";
+ $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id};
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
$form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id});
$lxdebug->leave_sub();
$form->{id} = 0;
$form->{storno} = 1;
+ # saving the history
+ if(!exists $form->{addition} && $form->{id} ne "") {
+ $form->{addition} = "STORNO";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
&post;
$lxdebug->leave_sub();