1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
32 #======================================================================
37 require "$form->{path}/arap.pl";
38 require "bin/mozilla/common.pl";
44 # this is for our long dates
45 # $locale->text('January')
46 # $locale->text('February')
47 # $locale->text('March')
48 # $locale->text('April')
49 # $locale->text('May ')
50 # $locale->text('June')
51 # $locale->text('July')
52 # $locale->text('August')
53 # $locale->text('September')
54 # $locale->text('October')
55 # $locale->text('November')
56 # $locale->text('December')
58 # this is for our short month
59 # $locale->text('Jan')
60 # $locale->text('Feb')
61 # $locale->text('Mar')
62 # $locale->text('Apr')
63 # $locale->text('May')
64 # $locale->text('Jun')
65 # $locale->text('Jul')
66 # $locale->text('Aug')
67 # $locale->text('Sep')
68 # $locale->text('Oct')
69 # $locale->text('Nov')
70 # $locale->text('Dec')
73 $lxdebug->enter_sub();
75 $form->{title} = "Add";
78 "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
79 unless $form->{callback};
81 # we use this only to set a default date
82 GL->transaction(\%myconfig, \%$form);
86 "<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>"
87 } @{ $form->{chart} };
90 qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
91 . ($_->{rate} * 100) . qq| %|
94 $form->{chart} = $chart;
95 $form->{chartinit} = $chart;
96 $form->{rowcount} = 2;
98 $form->{debitchart} = $chart;
99 $form->{creditchart} = $chart;
100 $form->{taxchart} = $tax;
107 $form->all_departments(\%myconfig);
108 if (@{ $form->{all_departments} }) {
109 $form->{selectdepartment} = "<option>\n";
112 $form->{selectdepartment} .=
113 "<option>$_->{description}--$_->{id}\n"
114 } (@{ $form->{all_departments} });
118 $lxdebug->leave_sub();
123 $lxdebug->enter_sub();
125 GL->transaction(\%myconfig, \%$form);
128 "<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>"
129 } @{ $form->{chart} };
133 qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
134 . ($_->{rate} * 100) . qq| %|
137 $form->{chart} = $chart;
139 $form->{taxchart} = $tax;
141 $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
144 $form->all_departments(\%myconfig);
145 if (@{ $form->{all_departments} }) {
146 $form->{selectdepartment} = "<option>\n";
149 $form->{selectdepartment} .=
150 "<option>$_->{description}--$_->{id}\n"
151 } (@{ $form->{all_departments} });
157 foreach $ref (@{ $form->{GL} }) {
159 if ($tax && ($ref->{accno} eq $taxaccno)) {
160 $form->{"tax_$j"} = abs($ref->{amount});
161 $form->{"taxchart_$j"} = $ref->{id} . "--" . $ref->{taxrate};
162 if ($form->{taxincluded}) {
163 if ($ref->{amount} < 0) {
164 $form->{"debit_$j"} += $form->{"tax_$j"};
166 $form->{"credit_$j"} += $form->{"tax_$j"};
170 $form->{"accno_$i"} = "$ref->{accno}--$ref->{tax_id}";
171 for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} }
172 if ($ref->{amount} < 0) {
173 $form->{totaldebit} -= $ref->{amount};
174 $form->{"debit_$i"} = $ref->{amount} * -1;
176 $form->{totalcredit} += $ref->{amount};
177 $form->{"credit_$i"} = $ref->{amount};
179 $form->{"taxchart_$i"} = "0--0.00";
182 if ($ref->{taxaccno} && !$tax) {
183 $taxaccno = $ref->{taxaccno};
192 $form->{rowcount} = $i;
194 ($form->datetonum($form->{transdate}, \%myconfig) <=
195 $form->datetonum($form->{closedto}, \%myconfig));
197 $form->{title} = "Edit";
202 $lxdebug->leave_sub();
207 $lxdebug->enter_sub();
209 $form->{title} = $locale->text('Buchungsjournal');
211 $form->all_departments(\%myconfig);
214 if (@{ $form->{all_departments} }) {
215 $form->{selectdepartment} = "<option>\n";
218 $form->{selectdepartment} .=
219 "<option>$_->{description}--$_->{id}\n"
220 } (@{ $form->{all_departments} });
225 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
226 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
228 | if $form->{selectdepartment};
230 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
233 my %project_labels = ();
234 my @project_values = ("");
235 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
236 push(@project_values, $item->{"id"});
237 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
241 NTI($cgi->popup_menu('-name' => "project_id",
242 '-values' => \@project_values,
243 '-labels' => \%project_labels));
245 # use JavaScript Calendar or not
246 $form->{jsscript} = $jscalendar;
248 if ($form->{jsscript}) {
250 # with JavaScript Calendar
252 <td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}">
253 <input type=button name=datefrom id="trigger1" value=|
254 . $locale->text('button') . qq|></td>
257 <td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}">
258 <input type=button name=dateto id="trigger2" value=|
259 . $locale->text('button') . qq|></td>
264 Form->write_trigger(\%myconfig, "2", "datefrom", "BR", "trigger1",
265 "dateto", "BL", "trigger2");
268 # without JavaScript Calendar
270 qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}"></td>|;
272 qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}"></td>|;
280 <form method=post action=$form->{script}>
282 <input type=hidden name=sort value=transdate>
286 <th class=listtop>$form->{title}</th>
293 <th align=right>| . $locale->text('Reference') . qq|</th>
294 <td><input name=reference size=20></td>
295 <th align=right>| . $locale->text('Source') . qq|</th>
296 <td><input name=source size=20></td>
300 <th align=right>| . $locale->text('Description') . qq|</th>
301 <td colspan=3><input name=description size=40></td>
304 <th align=right>| . $locale->text('Notes') . qq|</th>
305 <td colspan=3><input name=notes size=40></td>
308 <th align=right>| . $locale->text('Project Number') . qq|</th>
309 <td colspan=3>$projectnumber</td>
312 <th align=right>| . $locale->text('From') . qq|</th>
314 <th align=right>| . $locale->text('To (time)') . qq|</th>
318 <th align=right>| . $locale->text('Include in Report') . qq|</th>
323 <input name="category" class=radio type=radio value=X checked> |
324 . $locale->text('All') . qq|
325 <input name="category" class=radio type=radio value=A> |
326 . $locale->text('Asset') . qq|
327 <input name="category" class=radio type=radio value=L> |
328 . $locale->text('Liability') . qq|
329 <input name="category" class=radio type=radio value=I> |
330 . $locale->text('Revenue') . qq|
331 <input name="category" class=radio type=radio value=E> |
332 . $locale->text('Expense') . qq|
338 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
339 <td>| . $locale->text('ID') . qq|</td>
340 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
341 <td>| . $locale->text('Date') . qq|</td>
342 <td align=right><input name="l_reference" class=checkbox type=checkbox value=Y checked></td>
343 <td>| . $locale->text('Reference') . qq|</td>
344 <td align=right><input name="l_description" class=checkbox type=checkbox value=Y checked></td>
345 <td>| . $locale->text('Description') . qq|</td>
346 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
347 <td>| . $locale->text('Notes') . qq|</td>
350 <td align=right><input name="l_debit" class=checkbox type=checkbox value=Y checked></td>
351 <td>| . $locale->text('Debit') . qq|</td>
352 <td align=right><input name="l_credit" class=checkbox type=checkbox value=Y checked></td>
353 <td>| . $locale->text('Credit') . qq|</td>
354 <td align=right><input name="l_source" class=checkbox type=checkbox value=Y checked></td>
355 <td>| . $locale->text('Source') . qq|</td>
356 <td align=right><input name="l_accno" class=checkbox type=checkbox value=Y checked></td>
357 <td>| . $locale->text('Account') . qq|</td>
358 <td align=right><input name="l_gifi_accno" class=checkbox type=checkbox value=Y></td>
359 <td>| . $locale->text('GIFI') . qq|</td>
362 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
363 <td>| . $locale->text('Subtotal') . qq|</td>
364 <td align=right><input name="l_projectnumbers" class=checkbox type=checkbox value=Y></td>
365 <td>| . $locale->text('Project Number') . qq|</td>
375 <td><hr size=3 noshade></td>
381 <input type=hidden name=nextsub value=generate_report>
383 <input type=hidden name=path value=$form->{path}>
384 <input type=hidden name=login value=$form->{login}>
385 <input type=hidden name=password value=$form->{password}>
388 <input class=submit type=submit name=action value="|
389 . $locale->text('Continue') . qq|">
395 $lxdebug->leave_sub();
398 sub generate_report {
399 $lxdebug->enter_sub();
401 $form->{sort} = "transdate" unless $form->{sort};
403 GL->all_transactions(\%myconfig, \%$form);
406 "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}";
410 %acctype = ('A' => $locale->text('Asset'),
411 'C' => $locale->text('Contra'),
412 'L' => $locale->text('Liability'),
413 'Q' => $locale->text('Equity'),
414 'I' => $locale->text('Revenue'),
415 'E' => $locale->text('Expense'),);
417 $form->{title} = $locale->text('General Ledger');
419 $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
421 unless ($form->{category} eq 'X') {
422 $form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
424 if ($form->{accno}) {
425 $href .= "&accno=" . $form->escape($form->{accno});
426 $callback .= "&accno=" . $form->escape($form->{accno}, 1);
428 $locale->text('Account')
429 . " : $form->{accno} $form->{account_description}";
431 if ($form->{gifi_accno}) {
432 $href .= "&gifi_accno=" . $form->escape($form->{gifi_accno});
433 $callback .= "&gifi_accno=" . $form->escape($form->{gifi_accno}, 1);
434 $option .= "\n<br>" if $option;
436 $locale->text('GIFI')
437 . " : $form->{gifi_accno} $form->{gifi_account_description}";
439 if ($form->{source}) {
440 $href .= "&source=" . $form->escape($form->{source});
441 $callback .= "&source=" . $form->escape($form->{source}, 1);
442 $option .= "\n<br>" if $option;
443 $option .= $locale->text('Source') . " : $form->{source}";
445 if ($form->{reference}) {
446 $href .= "&reference=" . $form->escape($form->{reference});
447 $callback .= "&reference=" . $form->escape($form->{reference}, 1);
448 $option .= "\n<br>" if $option;
449 $option .= $locale->text('Reference') . " : $form->{reference}";
451 if ($form->{department}) {
452 $href .= "&department=" . $form->escape($form->{department});
453 $callback .= "&department=" . $form->escape($form->{department}, 1);
454 ($department) = split /--/, $form->{department};
455 $option .= "\n<br>" if $option;
456 $option .= $locale->text('Department') . " : $department";
459 if ($form->{description}) {
460 $href .= "&description=" . $form->escape($form->{description});
461 $callback .= "&description=" . $form->escape($form->{description}, 1);
462 $option .= "\n<br>" if $option;
463 $option .= $locale->text('Description') . " : $form->{description}";
465 if ($form->{notes}) {
466 $href .= "¬es=" . $form->escape($form->{notes});
467 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
468 $option .= "\n<br>" if $option;
469 $option .= $locale->text('Notes') . " : $form->{notes}";
471 if ($form->{project_id}) {
472 $href .= "&project_id=" . $form->escape($form->{project_id});
473 $callback .= "&project_id=" . $form->escape($form->{project_id});
476 if ($form->{datefrom}) {
477 $href .= "&datefrom=$form->{datefrom}";
478 $callback .= "&datefrom=$form->{datefrom}";
479 $option .= "\n<br>" if $option;
481 $locale->text('From') . " "
482 . $locale->date(\%myconfig, $form->{datefrom}, 1);
484 if ($form->{dateto}) {
485 $href .= "&dateto=$form->{dateto}";
486 $callback .= "&dateto=$form->{dateto}";
487 if ($form->{datefrom}) {
490 $option .= "\n<br>" if $option;
493 $locale->text('Bis') . " "
494 . $locale->date(\%myconfig, $form->{dateto}, 1);
498 qw(transdate id reference description notes source debit debit_accno credit
499 credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno
500 gifi_accno projectnumbers);
502 if ($form->{accno} || $form->{gifi_accno}) {
503 @columns = grep !/(accno|gifi_accno)/, @columns;
504 push @columns, "balance";
505 $form->{l_balance} = "Y";
509 $form->{l_credit_accno} = "Y";
510 $form->{l_debit_accno} = "Y";
511 $form->{l_credit_tax} = "Y";
512 $form->{l_debit_tax} = "Y";
513 $form->{l_credit_tax_accno} = "Y";
514 $form->{l_debit_tax_accno} = "Y";
515 $form->{l_accno} = "N";
516 foreach $item (@columns) {
517 if ($form->{"l_$item"} eq "Y") {
518 push @column_index, $item;
520 # add column to href and callback
521 $callback .= "&l_$item=Y";
522 $href .= "&l_$item=Y";
526 if ($form->{l_subtotal} eq 'Y') {
527 $callback .= "&l_subtotal=Y";
528 $href .= "&l_subtotal=Y";
531 $callback .= "&category=$form->{category}";
532 $href .= "&category=$form->{category}";
535 "<th><a class=listheading href=$href&sort=id>"
536 . $locale->text('ID')
538 $column_header{transdate} =
539 "<th><a class=listheading href=$href&sort=transdate>"
540 . $locale->text('Date')
542 $column_header{reference} =
543 "<th><a class=listheading href=$href&sort=reference>"
544 . $locale->text('Reference')
546 $column_header{source} =
547 "<th><a class=listheading href=$href&sort=source>"
548 . $locale->text('Source')
550 $column_header{description} =
551 "<th><a class=listheading href=$href&sort=description>"
552 . $locale->text('Description')
554 $column_header{notes} =
555 "<th class=listheading>" . $locale->text('Notes') . "</th>";
556 $column_header{debit} =
557 "<th class=listheading>" . $locale->text('Debit') . "</th>";
558 $column_header{debit_accno} =
559 "<th><a class=listheading href=$href&sort=accno>"
560 . $locale->text('Debit Account')
562 $column_header{credit} =
563 "<th class=listheading>" . $locale->text('Credit') . "</th>";
564 $column_header{credit_accno} =
565 "<th><a class=listheading href=$href&sort=accno>"
566 . $locale->text('Credit Account')
568 $column_header{debit_tax} =
569 "<th><a class=listheading href=$href&sort=accno>"
570 . $locale->text('Debit Tax')
572 $column_header{debit_tax_accno} =
573 "<th><a class=listheading href=$href&sort=accno>"
574 . $locale->text('Debit Tax Account')
576 $column_header{credit_tax} =
577 "<th><a class=listheading href=$href&sort=accno>"
578 . $locale->text('Credit Tax')
580 $column_header{credit_tax_accno} =
581 "<th><a class=listheading href=$href&sort=accno>"
582 . $locale->text('Credit Tax Account')
584 $column_header{gifi_accno} =
585 "<th><a class=listheading href=$href&sort=gifi_accno>"
586 . $locale->text('GIFI')
588 $column_header{balance} = "<th>" . $locale->text('Balance') . "</th>";
589 $column_header{projectnumbers} =
590 "<th class=listheading>" . $locale->text('Project Numbers') . "</th>";
592 $form->{landscape} = 1;
601 <th class=listtop>$form->{title}</th>
611 <tr class=listheading>
614 map { print "$column_header{$_}\n" } @column_index;
623 # add sort to callback
624 $form->{callback} = "$callback&sort=$form->{sort}";
625 $callback = $form->escape($form->{callback});
627 # initial item for subtotals
628 if (@{ $form->{GL} }) {
629 $sameitem = $form->{GL}->[0]->{ $form->{sort} };
632 if (($form->{accno} || $form->{gifi_accno}) && $form->{balance}) {
634 map { $column_data{$_} = "<td> </td>" } @column_index;
635 $column_data{balance} =
637 . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
645 map { print "$column_data{$_}\n" } @column_index;
651 $form->{balance} *= $ml;
652 foreach $ref (@{ $form->{GL} }) {
653 $form->{balance} *= $ml;
655 # if item ne sort print subtotal
656 if ($form->{l_subtotal} eq 'Y') {
657 if ($sameitem ne $ref->{ $form->{sort} }) {
662 #foreach $key (sort keys(%{ $ref->{amount} })) {
663 # $form->{balance} += $ref->{amount}{$key};
667 foreach $key (sort keys(%{ $ref->{debit} })) {
668 $subtotaldebit += $ref->{debit}{$key};
669 $totaldebit += $ref->{debit}{$key};
671 $debit = $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
674 "<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
676 $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
680 foreach $key (sort keys(%{ $ref->{credit} })) {
681 $subtotalcredit += $ref->{credit}{$key};
682 $totalcredit += $ref->{credit}{$key};
684 $credit = $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
687 . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
689 $form->{balance} = abs($form->{balance}) - abs($ref->{credit}{$key});
693 foreach $key (sort keys(%{ $ref->{debit_tax} })) {
694 $subtotaldebittax += $ref->{debit_tax}{$key};
695 $totaldebittax += $ref->{debit_tax}{$key};
698 $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
701 . $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
703 $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
707 foreach $key (sort keys(%{ $ref->{credit_tax} })) {
708 $subtotalcredittax += $ref->{credit_tax}{$key};
709 $totalcredittax += $ref->{credit_tax}{$key};
712 $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
715 . $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
717 $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
723 foreach $key (sort keys(%{ $ref->{debit_accno} })) {
726 "<a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
729 "<br><a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
732 # if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
733 # $ref->{debit_tax_accno}{$key} = $taxaccno;
735 $taxaccno = $ref->{debit_tax_accno}{$key};
736 $debittaxkey = $ref->{debit_taxkey}{$key};
742 foreach $key (sort keys(%{ $ref->{credit_accno} })) {
745 "<a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
748 "<br><a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
751 # if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
752 # $ref->{credit_tax_accno}{$key} = $taxaccno;
754 $taxaccno = $ref->{credit_tax_accno}{$key};
755 $credittaxkey = $ref->{credit_taxkey}{$key};
759 foreach $key (sort keys(%{ $ref->{debit_tax_accno} })) {
762 "<a href=$href&accno=$ref->{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
765 "<br><a href=$href&accno=$ref->{debit_tax_accno}{$key}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
769 $credittaxaccno = "";
770 foreach $key (sort keys(%{ $ref->{credit_tax_accno} })) {
773 "<a href=$href&accno=$ref->{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
776 "<br><a href=$href&accno=$ref->{credit_tax_accno}{$key}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
781 foreach $key (sort keys(%{ $ref->{transdate} })) {
783 $transdate = "$ref->{transdate}{$key}";
785 $transdate .= "<br>$ref->{transdate}{$key}";
789 # $ref->{debit} = $form->format_amount(\%myconfig, $ref->{debit}, 2, " ");
790 # $ref->{credit} = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
792 $column_data{id} = "<td align=right> $ref->{id} </td>";
793 $column_data{transdate} = "<td align=center>$transdate</td>";
794 $column_data{reference} =
795 "<td align=center><a href=$ref->{module}.pl?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{reference}</td>";
796 $column_data{description} = "<td align=center>$ref->{description} </td>";
797 $column_data{source} = "<td align=center>$ref->{source} </td>";
798 $column_data{notes} = "<td align=center>$ref->{notes} </td>";
799 $column_data{debit} = "<td align=right>$debit</td>";
800 $column_data{debit_accno} = "<td align=center>$debitaccno</td>";
801 $column_data{credit} = "<td align=right>$credit</td>";
802 $column_data{credit_accno} = "<td align=center>$creditaccno</td>";
803 $column_data{debit_tax} =
804 ($ref->{debit_tax_accno} ne "")
805 ? "<td align=right>$debittax</td>"
807 $column_data{debit_tax_accno} = "<td align=center>$debittaxaccno</td>";
808 $column_data{gifi_accno} =
809 "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
810 $column_data{credit_tax} =
811 ($ref->{credit_tax_accno} ne "")
812 ? "<td align=right>$credittax</td>"
814 $column_data{credit_tax_accno} = "<td align=center>$credittaxaccno</td>";
815 $column_data{gifi_accno} =
816 "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
817 $column_data{balance} =
819 . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . "</td>";
820 $column_data{projectnumbers} =
821 "<td>" . join(", ", sort({ lc($a) cmp lc($b) } keys(%{ $ref->{projectnumbers} }))) . "</td>";
826 <tr class=listrow$i>";
827 map { print "$column_data{$_}\n" } @column_index;
832 &gl_subtotal if ($form->{l_subtotal} eq 'Y');
834 map { $column_data{$_} = "<td> </td>" } @column_index;
836 $column_data{debit} =
837 "<th align=right class=listtotal>"
838 . $form->format_amount(\%myconfig, $totaldebit, 2, " ") . "</th>";
839 $column_data{credit} =
840 "<th align=right class=listtotal>"
841 . $form->format_amount(\%myconfig, $totalcredit, 2, " ") . "</th>";
842 $column_data{debit_tax} =
843 "<th align=right class=listtotal>"
844 . $form->format_amount(\%myconfig, $totaldebittax, 2, " ") . "</th>";
845 $column_data{credit_tax} =
846 "<th align=right class=listtotal>"
847 . $form->format_amount(\%myconfig, $totalcredittax, 2, " ") . "</th>";
848 $column_data{balance} =
849 "<th align=right class=listtotal>"
850 . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) . "</th>";
856 map { print "$column_data{$_}\n" } @column_index;
865 <td><hr size=3 noshade></td>
871 <form method=post action=$form->{script}>
873 <input name=callback type=hidden value="$form->{callback}">
875 <input type=hidden name=path value=$form->{path}>
876 <input type=hidden name=login value=$form->{login}>
877 <input type=hidden name=password value=$form->{password}>
879 <input class=submit type=submit name=action value="|
880 . $locale->text('GL Transaction') . qq|">
881 <input class=submit type=submit name=action value="|
882 . $locale->text('AR Transaction') . qq|">
883 <input class=submit type=submit name=action value="|
884 . $locale->text('AP Transaction') . qq|">
885 <input class=submit type=submit name=action value="|
886 . $locale->text('Sales Invoice') . qq|">
887 <input class=submit type=submit name=action value="|
888 . $locale->text('Vendor Invoice') . qq|">
895 $lxdebug->leave_sub();
900 $lxdebug->enter_sub();
903 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
905 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
907 map { $column_data{$_} = "<td> </td>" }
908 qw(transdate id reference source description accno);
909 $column_data{debit} = "<th align=right>$subtotaldebit</td>";
910 $column_data{credit} = "<th align=right>$subtotalcredit</td>";
912 print "<tr class=listsubtotal>";
913 map { print "$column_data{$_}\n" } @column_index;
919 $sameitem = $ref->{ $form->{sort} };
920 $lxdebug->leave_sub();
925 $lxdebug->enter_sub();
927 $form->{oldtransdate} = $form->{transdate};
939 qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
941 for my $i (1 .. $form->{rowcount}) {
943 unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
944 for (qw(debit credit tax)) {
946 $form->parse_amount(\%myconfig, $form->{"${_}_$i"});
950 $debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
957 if (($debitcount >= 2) && ($creditcount == 2)) {
958 $form->{"credit_$i"} = 0;
959 $form->{"tax_$i"} = 0;
963 if (($creditcount >= 2) && ($debitcount == 2)) {
964 $form->{"debit_$i"} = 0;
965 $form->{"tax_$i"} = 0;
969 if (($creditcount == 1) && ($debitcount == 2)) {
972 if (($creditcount == 2) && ($debitcount == 1)) {
975 if ($debitcredit && $credittax) {
976 $form->{"taxchart_$i"} = "0--0.00";
978 if (!$debitcredit && $debittax) {
979 $form->{"taxchart_$i"} = "0--0.00";
982 ($form->{"debit_$i"} == 0)
983 ? $form->{"credit_$i"}
984 : $form->{"debit_$i"};
986 if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
987 $form->{"taxchart_$i"} = "0--0.00";
988 $form->{"tax_$i"} = 0;
990 if (!$form->{"korrektur_$i"}) {
991 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
998 if ($form->{taxincluded}) {
999 $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
1001 $form->{"tax_$i"} = $amount * $rate;
1004 $form->{"tax_$i"} = 0;
1008 for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
1013 for $i (1 .. $count) {
1015 for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} }
1018 for $i ($count + 1 .. $form->{rowcount}) {
1019 for (@flds) { delete $form->{"${_}_$i"} }
1022 $form->{rowcount} = $count + 1;
1025 $lxdebug->leave_sub();
1031 $lxdebug->enter_sub();
1033 &form_header($init);
1035 # for $i (1 .. $form->{rowcount}) {
1036 # $form->{totaldebit} += $form->parse_amount(\%myconfig, $form->{"debit_$i"});
1037 # $form->{totalcredit} += $form->parse_amount(\%myconfig, $form->{"credit_$i"});
1041 &display_rows($init);
1043 $lxdebug->leave_sub();
1049 $lxdebug->enter_sub();
1051 $form->{totaldebit} = 0;
1052 $form->{totalcredit} = 0;
1053 my $chart = $form->{chart};
1054 $chart = $form->unquote($chart);
1055 $form->{taxchart} = $form->unquote($form->{taxchart});
1056 $taxchart = $form->{taxchart};
1058 my @old_project_ids = ();
1059 map({ push(@old_project_ids, $form->{"project_id_$_"})
1060 if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
1062 $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
1064 "old_id" => \@old_project_ids });
1066 my %project_labels = ();
1067 my @project_values = ("");
1068 foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
1069 push(@project_values, $item->{"id"});
1070 $project_labels{$item->{"id"}} = $item->{"projectnumber"};
1073 for $i (1 .. $form->{rowcount}) {
1076 <td><input name="source_$i" value="$form->{"source_$i"}" size="16" tabindex=|
1077 . ($i + 11 + (($i - 1) * 8)) . qq|></td>|;
1079 <td><input name="memo_$i" value="$form->{"memo_$i"}" size="16" tabindex=|
1080 . ($i + 12 + (($i - 1) * 8)) . qq|></td>|;
1084 <td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
1085 . ($i + 5 + (($i - 1) * 8)) . qq|>$form->{chartinit}</select></td>|;
1087 qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px" tabindex=|
1088 . ($i + 10 + (($i - 1) * 8))
1089 . qq|>$form->{taxchart}</select></td>|;
1092 qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
1093 . ($i + 9 + (($i - 1) * 8))
1095 if ($form->{transfer}) {
1096 $fx_transaction = qq|
1097 <td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
1102 if ($form->{"debit_$i"} != 0) {
1103 $form->{totaldebit} += $form->{"debit_$i"};
1104 if (!$form->{taxincluded}) {
1105 $form->{totaldebit} += $form->{"tax_$i"};
1108 $form->{totalcredit} += $form->{"credit_$i"};
1109 if (!$form->{taxincluded}) {
1110 $form->{totalcredit} += $form->{"tax_$i"};
1114 for (qw(debit credit tax)) {
1115 $form->{"${_}_$i"} =
1116 ($form->{"${_}_$i"})
1117 ? $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
1121 if ($i < $form->{rowcount}) {
1124 $chart_selected = $form->{"accno_$i"};
1126 s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/;
1128 qq|<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
1129 . ($i + 5 + (($i - 1) * 8))
1130 . qq|>$accno</select></td>|;
1132 $tax_selected = $form->{"taxchart_$i"};
1133 $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
1135 qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
1136 . ($i + 10 + (($i - 1) * 8))
1137 . qq|>$tax</select></td>|;
1139 if ($form->{transfer}) {
1140 $checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
1141 $x = ($checked) ? "x" : "";
1142 $fx_transaction = qq|
1143 <td><input type=hidden name="fx_transaction_$i" value="$checked">$x</td>
1146 $checked = ($form->{"korrektur_$i"}) ? "checked" : "";
1148 qq|<td><input type="checkbox" name="korrektur_$i" value="1" $checked tabindex=|
1149 . ($i + 9 + (($i - 1) * 8))
1151 $form->hide_form("accno_$i");
1156 <td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|
1157 . ($i + 5 + (($i - 1) * 8)) . qq|>$chart</select></td>|;
1159 <td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
1160 . ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|;
1163 qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
1164 . ($i + 9 + (($i - 1) * 8))
1166 if ($form->{transfer}) {
1167 $fx_transaction = qq|
1168 <td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
1173 my $debitreadonly = "";
1174 my $creditreadonly = "";
1175 if ($i == $form->{rowcount}) {
1177 $debitreadonly = "readonly";
1178 } elsif ($creditlock) {
1179 $creditreadonly = "readonly";
1184 NTI($cgi->popup_menu('-name' => "project_id_$i",
1185 '-values' => \@project_values,
1186 '-labels' => \%project_labels,
1187 '-default' => $form->{"project_id_$i"} ));
1189 print qq|<tr valign=top>
1192 <td><input name="debit_$i" size=8 value="$form->{"debit_$i"}" accesskey=$i tabindex=|
1193 . ($i + 6 + (($i - 1) * 8)) . qq| $debitreadonly></td>
1194 <td><input name="credit_$i" size=8 value="$form->{"credit_$i"}" tabindex=|
1195 . ($i + 7 + (($i - 1) * 8)) . qq| $creditreadonly></td>
1196 <td><input name="tax_$i" size=6 value="$form->{"tax_$i"}" tabindex=|
1197 . ($i + 8 + (($i - 1) * 8)) . qq|></td>
1202 <td>$projectnumber</td>
1208 $form->hide_form(qw(rowcount selectaccno));
1210 $lxdebug->leave_sub();
1216 $lxdebug->enter_sub();
1217 $title = $form->{title};
1218 $form->{title} = $locale->text("$title General Ledger Transaction");
1219 $readonly = ($form->{id}) ? "readonly" : "";
1221 # $locale->text('Add General Ledger Transaction')
1222 # $locale->text('Edit General Ledger Transaction')
1224 map { $form->{$_} =~ s/\"/"/g }
1225 qw(reference description chart taxchart);
1226 $form->{javascript} = qq|<script type="text/javascript">
1228 function setTaxkey(accno, row) {
1229 var taxkey = accno.options[accno.selectedIndex].value;
1230 var reg = /--([0-9]*)/;
1231 var found = reg.exec(taxkey);
1232 var index = found[1];
1233 index = parseInt(index);
1234 var tax = 'taxchart_' + row;
1235 for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
1236 var reg2 = new RegExp("^"+ index, "");
1237 if (reg2.exec(document.getElementById(tax).options[i].value)) {
1238 document.getElementById(tax).options[i].selected = true;
1246 $form->{selectdepartment} =~ s/ selected//;
1247 $form->{selectdepartment} =~
1248 s/option>\Q$form->{department}\E/option selected>$form->{department}/;
1250 if (($rows = $form->numtextrows($form->{description}, 50)) > 1) {
1252 qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|;
1255 qq|<input name=description size=50 value="$form->{description}" tabindex="3" $readonly>|;
1258 $taxincluded = ($form->{taxincluded}) ? "checked" : "";
1261 $taxincluded = "checked";
1266 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1267 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1268 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
1270 | if $form->{selectdepartment};
1272 $form->{fokus} = "gl.reference";
1274 $form->{fokus} = qq|gl.accno_$form->{rowcount}|;
1277 # use JavaScript Calendar or not
1278 $form->{jsscript} = $jscalendar;
1280 if ($form->{jsscript}) {
1282 # with JavaScript Calendar
1284 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" tabindex="2" $readonly>
1285 <input type=button name=transdate id="trigger1" value=|
1286 . $locale->text('button') . qq|></td>
1291 Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1");
1294 # without JavaScript Calendar
1296 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" tabindex="2" $readonly></td>|;
1302 <body onLoad="fokus()">
1304 <form method=post name="gl" action=$form->{script}>
1306 <input name=id type=hidden value=$form->{id}>
1308 <input type=hidden name=closedto value=$form->{closedto}>
1309 <input type=hidden name=locked value=$form->{locked}>
1310 <input type=hidden name=title value="$title">
1311 <input type=hidden name=taxchart value="$form->{taxchart}">
1312 <input type=hidden name=chart value="$form->{chart}">
1317 <th class=listtop>$form->{title}</th>
1319 <tr height="5"></tr>
1324 <th align=left>| . $locale->text('Reference') . qq|</th>
1325 <td><input name=reference size=20 value="$form->{reference}" tabindex="1" $readonly></td>
1329 <th align=right nowrap>| . $locale->text('Date') . qq|</th>
1338 <th align=right>| . $locale->text('Belegnummer') . qq|</th>
1339 <td><input name=id size=20 value="$form->{id}" $readonly></td>
1343 <th align=right width=50%>| . $locale->text('Buchungsdatum') . qq|</th>
1344 <td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly></td>
1355 <th align=left width=1%>| . $locale->text('Description') . qq|</th>
1356 <td width=1%>$description</td>
1360 <th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
1361 <td><input type=checkbox name=taxincluded value=1 tabindex="5" $taxincluded></td>
1368 <th align=right width=50%>| . $locale->text('Mitarbeiter') . qq|</th>
1369 <td align=left><input name=employee size=11 value=$form->{employee} $readonly></td>
1377 <th align=left width=1%>| . $locale->text('Description') . qq|</th>
1378 <td width=1%>$description</td>
1382 <th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
1383 <td><input type=checkbox name=taxincluded value=1 tabindex="5" $taxincluded></td>
1393 <tr class=listheading>
1394 <th class=listheading style="width:15%">|
1395 . $locale->text('Account') . qq|</th>
1396 <th class=listheading style="width:10%">|
1397 . $locale->text('Debit') . qq|</th>
1398 <th class=listheading style="width:10%">|
1399 . $locale->text('Credit') . qq|</th>
1400 <th class=listheading style="width:10%">|
1401 . $locale->text('Tax') . qq|</th>
1402 <th class=listheading style="width:5%">|
1403 . $locale->text('Korrektur') . qq|</th>
1404 <th class=listheading style="width:10%">|
1405 . $locale->text('Taxkey') . qq|</th>
1406 <th class=listheading style="width:20%">|
1407 . $locale->text('Source') . qq|</th>
1408 <th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
1409 <th class=listheading style="width:20%">|
1410 . $locale->text('Project Number') . qq|</th>
1415 $lxdebug->leave_sub();
1420 $lxdebug->enter_sub();
1421 ($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
1423 $decimalplaces = ($dec > 2) ? $dec : 2;
1424 $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
1428 $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
1429 } qw(totaldebit totalcredit);
1432 <tr class=listtotal>
1434 <th align=right class=listtotal> $form->{totaldebit}</th>
1435 <th align=right class=listtotal> $form->{totalcredit}</th>
1443 <input type=hidden name=path value=$form->{path}>
1444 <input type=hidden name=login value=$form->{login}>
1445 <input type=hidden name=password value=$form->{password}>
1447 <input name=callback type=hidden value="$form->{callback}">
1452 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
1453 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
1457 print qq|<input class=submit type=submit name=action value="|
1458 . $locale->text('Storno') . qq|">|;
1460 # Löschen und ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
1462 if (!$form->{locked} && $radieren) {
1464 <input class=submit type=submit name=action value="|
1465 . $locale->text('Post') . qq|" accesskey="b">
1466 <input class=submit type=submit name=action value="|
1467 . $locale->text('Delete') . qq|">|;
1470 # if ($transdate > $closedto) {
1472 # <input class=submit type=submit name=action value="|.$locale->text('Post as new').qq|">|;
1475 if ($transdate > $closedto) {
1476 print qq|<input class=submit type=submit name=action value="|
1477 . $locale->text('Update') . qq|">
1478 <input class=submit type=submit name=action value="|
1479 . $locale->text('Post') . qq|">|;
1489 $lxdebug->leave_sub();
1494 $lxdebug->enter_sub();
1501 <form method=post action=$form->{script}>
1504 map { $form->{$_} =~ s/\"/"/g } qw(reference description chart taxchart);
1506 delete $form->{header};
1508 foreach $key (keys %$form) {
1509 print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
1513 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1516 . $locale->text('Are you sure you want to delete Transaction')
1517 . qq| $form->{reference}</h4>
1519 <input name=action class=submit type=submit value="|
1520 . $locale->text('Yes') . qq|">
1523 $lxdebug->leave_sub();
1528 $lxdebug->enter_sub();
1530 $form->redirect($locale->text('Transaction deleted!'))
1531 if (GL->delete_transaction(\%myconfig, \%$form));
1532 $form->error($locale->text('Cannot delete transaction!'));
1533 $lxdebug->leave_sub();
1538 $lxdebug->enter_sub();
1540 # check if there is something in reference and date
1541 $form->isblank("reference", $locale->text('Reference missing!'));
1542 $form->isblank("transdate", $locale->text('Transaction Date missing!'));
1543 $form->isblank("description", $locale->text('Description missing!'));
1545 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
1546 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
1553 my $creditcount = 0;
1558 qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
1559 if ($form->{storno}) {
1560 for my $i (1 .. $form->{rowcount}) {
1561 unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
1562 if ($form->{"debit_$i"} ne "") {
1563 $form->{"credit_$i"} = $form->{"debit_$i"};
1564 $form->{"debit_$i"} = "";
1565 } elsif ($form->{"credit_$i"} ne "") {
1566 $form->{"debit_$i"} = $form->{"credit_$i"};
1567 $form->{"credit_$i"} = "";
1573 for my $i (1 .. $form->{rowcount}) {
1575 unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
1576 for (qw(debit credit tax)) {
1577 $form->{"${_}_$i"} =
1578 $form->parse_amount(\%myconfig, $form->{"${_}_$i"});
1582 $debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
1590 if (($debitcount >= 2) && ($creditcount == 2)) {
1591 $form->{"credit_$i"} = 0;
1592 $form->{"tax_$i"} = 0;
1596 if (($creditcount >= 2) && ($debitcount == 2)) {
1597 $form->{"debit_$i"} = 0;
1598 $form->{"tax_$i"} = 0;
1602 if (($creditcount == 1) && ($debitcount == 2)) {
1605 if (($creditcount == 2) && ($debitcount == 1)) {
1608 if ($debitcredit && $credittax) {
1609 $form->{"taxchart_$i"} = "0--0.00";
1611 if (!$debitcredit && $debittax) {
1612 $form->{"taxchart_$i"} = "0--0.00";
1615 ($form->{"debit_$i"} == 0)
1616 ? $form->{"credit_$i"}
1617 : $form->{"debit_$i"};
1619 if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
1620 $form->{"taxchart_$i"} = "0--0.00";
1621 $form->{"tax_$i"} = 0;
1623 if (!$form->{"korrektur_$i"}) {
1624 ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
1631 if ($form->{taxincluded}) {
1632 $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
1634 $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
1636 $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
1639 $form->{"tax_$i"} = $amount * $rate;
1642 $form->{"tax_$i"} = 0;
1644 } elsif ($form->{taxincluded}) {
1646 $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
1648 $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
1652 for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
1657 for $i (1 .. $count) {
1659 for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} }
1662 for $i ($count + 1 .. $form->{rowcount}) {
1663 for (@flds) { delete $form->{"${_}_$i"} }
1666 for $i (1 .. $form->{rowcount}) {
1667 $dr = $form->{"debit_$i"};
1668 $cr = $form->{"credit_$i"};
1669 $tax = $form->{"tax_$i"};
1673 'Cannot post transaction with a debit and credit entry for the same account!'
1676 if ($form->{taxincluded}) {
1678 $debit += $dr + $tax;
1681 $credit += $cr + $tax;
1686 $debit += $dr + $tax;
1689 $credit += $cr + $tax;
1694 $form->{taxincluded} = 0;
1697 # this is just for the wise guys
1698 $form->error($locale->text('Cannot post transaction for a closed period!'))
1699 if ($transdate <= $closedto);
1700 if ($form->round_amount($debit, 2) != $form->round_amount($credit, 2)) {
1701 $form->error($locale->text('Out of balance transaction!'));
1704 if ($form->round_amount($debit, 2) + $form->round_amount($credit, 2) == 0) {
1705 $form->error($locale->text('Empty transaction!'));
1708 if (($errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) {
1710 $err[1] = $locale->text('Cannot have a value in both Debit and Credit!');
1711 $err[2] = $locale->text('Debit and credit out of balance!');
1712 $err[3] = $locale->text('Cannot post a transaction without a value!');
1714 $form->error($err[$errno]);
1716 undef($form->{callback});
1717 $form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id});
1718 $lxdebug->leave_sub();
1723 $lxdebug->enter_sub();
1727 $lxdebug->leave_sub();
1732 $lxdebug->enter_sub();
1735 $form->{storno} = 1;
1737 $lxdebug->leave_sub();