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 #======================================================================
39 require "$form->{path}/arap.pl";
45 # this is for our long dates
46 # $locale->text('January')
47 # $locale->text('February')
48 # $locale->text('March')
49 # $locale->text('April')
50 # $locale->text('May ')
51 # $locale->text('June')
52 # $locale->text('July')
53 # $locale->text('August')
54 # $locale->text('September')
55 # $locale->text('October')
56 # $locale->text('November')
57 # $locale->text('December')
59 # this is for our short month
60 # $locale->text('Jan')
61 # $locale->text('Feb')
62 # $locale->text('Mar')
63 # $locale->text('Apr')
64 # $locale->text('May')
65 # $locale->text('Jun')
66 # $locale->text('Jul')
67 # $locale->text('Aug')
68 # $locale->text('Sep')
69 # $locale->text('Oct')
70 # $locale->text('Nov')
71 # $locale->text('Dec')
74 $lxdebug->enter_sub();
76 $form->{title} = "Add";
79 "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
80 unless $form->{callback};
82 # we use this only to set a default date
83 GL->transaction(\%myconfig, \%$form);
87 "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
88 } @{ $form->{chart} };
91 qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
92 . ($_->{rate} * 100) . qq| %|
95 $form->{chart} = $chart;
97 $form->{debitchart} = $chart;
98 $form->{creditchart} = $chart;
99 $form->{taxchart} = $tax;
105 $form->{creditrowcount} = 2;
106 $form->{debitrowcount} = 2;
109 $form->all_departments(\%myconfig);
110 if (@{ $form->{all_departments} }) {
111 $form->{selectdepartment} = "<option>\n";
114 $form->{selectdepartment} .=
115 "<option>$_->{description}--$_->{id}\n"
116 } (@{ $form->{all_departments} });
121 $lxdebug->leave_sub();
125 $lxdebug->enter_sub();
127 GL->transaction(\%myconfig, \%$form);
130 if ($form->{debitaccno} eq $_->{accno}) {
131 $form->{debitchart} .=
132 "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}";
134 } @{ $form->{chart} };
136 if ($form->{creditaccno} eq $_->{accno}) {
137 $form->{creditchart} .=
138 "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}";
140 } @{ $form->{chart} };
143 qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
144 . ($_->{rate} * 100) . qq| %|
147 if ($form->{creditrowcount} > 2) {
148 for $i (2 .. $form->{creditrowcount}) {
150 if ($form->{"creditchartselected_$i"} eq $_->{accno}) {
151 $form->{"creditchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}";
153 } @{ $form->{chart} };
155 if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) {
156 $form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}";
161 if ($form->{debitrowcount} > 2) {
162 for $i (2 .. $form->{debitrowcount}) {
164 if ($form->{"debitchartselected_$i"} eq $_->{accno}) {
165 $form->{"debitchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}";
167 } @{ $form->{chart} };
169 if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) {
170 $form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}";
177 "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
178 } @{ $form->{chart} };
179 $form->{chart} = $chart;
182 qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
183 . ($_->{rate} * 100) . qq| %|
185 $form->{taxchart} = $tax;
187 if ($form->{tax} < 0) {
188 $form->{tax} = $form->{tax} * (-1);
191 $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
194 $form->all_departments(\%myconfig);
195 if (@{ $form->{all_departments} }) {
196 $form->{selectdepartment} = "<option>\n";
199 $form->{selectdepartment} .=
200 "<option>$_->{description}--$_->{id}\n"
201 } (@{ $form->{all_departments} });
205 ($form->datetonum($form->{transdate}, \%myconfig) <=
206 $form->datetonum($form->{closedto}, \%myconfig));
208 $form->{title} = "Edit";
214 $lxdebug->leave_sub();
218 $lxdebug->enter_sub();
220 $form->{title} = $locale->text('Buchungsjournal');
222 $form->all_departments(\%myconfig);
225 if (@{ $form->{all_departments} }) {
226 $form->{selectdepartment} = "<option>\n";
229 $form->{selectdepartment} .=
230 "<option>$_->{description}--$_->{id}\n"
231 } (@{ $form->{all_departments} });
236 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
237 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
239 | if $form->{selectdepartment};
241 # use JavaScript Calendar or not
242 $form->{jsscript} = $jscalendar;
244 if ($form->{jsscript}) {
246 # with JavaScript Calendar
248 <td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}">
249 <input type=button name=datefrom id="trigger1" value=|
250 . $locale->text('button')
254 <td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}">
255 <input type=button name=dateto id="trigger2" value=|
256 . $locale->text('button')
262 Form->write_trigger(\%myconfig, "2", "datefrom", "BR", "trigger1",
263 "dateto", "BL", "trigger2");
266 # without JavaScript Calendar
268 qq|<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}"></td>|;
270 qq|<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}"></td>|;
278 <form method=post action=$form->{script}>
280 <input type=hidden name=sort value=transdate>
284 <th class=listtop>$form->{title}</th>
291 <th align=right>| . $locale->text('Reference') . qq|</th>
292 <td><input name=reference size=20></td>
293 <th align=right>| . $locale->text('Source') . qq|</th>
294 <td><input name=source size=20></td>
298 <th align=right>| . $locale->text('Description') . qq|</th>
299 <td colspan=3><input name=description size=40></td>
302 <th align=right>| . $locale->text('Notes') . qq|</th>
303 <td colspan=3><input name=notes size=40></td>
306 <th align=right>| . $locale->text('From') . qq|</th>
311 <th align=right>| . $locale->text('Include in Report') . qq|</th>
316 <input name="category" class=radio type=radio value=X checked> |
317 . $locale->text('All') . qq|
318 <input name="category" class=radio type=radio value=A> |
319 . $locale->text('Asset') . qq|
320 <input name="category" class=radio type=radio value=L> |
321 . $locale->text('Liability') . qq|
322 <input name="category" class=radio type=radio value=I> |
323 . $locale->text('Revenue') . qq|
324 <input name="category" class=radio type=radio value=E> |
325 . $locale->text('Expense') . qq|
331 <td align=right><input name="l_id" class=checkbox type=checkbox value=Y></td>
332 <td>| . $locale->text('ID') . qq|</td>
333 <td align=right><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
334 <td>| . $locale->text('Date') . qq|</td>
335 <td align=right><input name="l_reference" class=checkbox type=checkbox value=Y checked></td>
336 <td>| . $locale->text('Reference') . qq|</td>
337 <td align=right><input name="l_description" class=checkbox type=checkbox value=Y checked></td>
338 <td>| . $locale->text('Description') . qq|</td>
339 <td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
340 <td>| . $locale->text('Notes') . qq|</td>
343 <td align=right><input name="l_debit" class=checkbox type=checkbox value=Y checked></td>
344 <td>| . $locale->text('Debit') . qq|</td>
345 <td align=right><input name="l_credit" class=checkbox type=checkbox value=Y checked></td>
346 <td>| . $locale->text('Credit') . qq|</td>
347 <td align=right><input name="l_source" class=checkbox type=checkbox value=Y checked></td>
348 <td>| . $locale->text('Source') . qq|</td>
349 <td align=right><input name="l_accno" class=checkbox type=checkbox value=Y checked></td>
350 <td>| . $locale->text('Account') . qq|</td>
351 <td align=right><input name="l_gifi_accno" class=checkbox type=checkbox value=Y></td>
352 <td>| . $locale->text('GIFI') . qq|</td>
355 <td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
356 <td>| . $locale->text('Subtotal') . qq|</td>
366 <td><hr size=3 noshade></td>
372 <input type=hidden name=nextsub value=generate_report>
374 <input type=hidden name=path value=$form->{path}>
375 <input type=hidden name=login value=$form->{login}>
376 <input type=hidden name=password value=$form->{password}>
379 <input class=submit type=submit name=action value="|
380 . $locale->text('Continue') . qq|">
386 $lxdebug->leave_sub();
389 sub generate_report {
390 $lxdebug->enter_sub();
392 $form->{sort} = "transdate" unless $form->{sort};
394 GL->all_transactions(\%myconfig, \%$form);
397 "$form->{script}?action=generate_report&path=$form->{path}&login=$form->{login}&password=$form->{password}";
401 %acctype = ('A' => $locale->text('Asset'),
402 'C' => $locale->text('Contra'),
403 'L' => $locale->text('Liability'),
404 'Q' => $locale->text('Equity'),
405 'I' => $locale->text('Revenue'),
406 'E' => $locale->text('Expense'),);
408 $form->{title} = $locale->text('General Ledger');
410 $ml = ($form->{ml} =~ /(A|E)/) ? -1 : 1;
412 unless ($form->{category} eq 'X') {
413 $form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
415 if ($form->{accno}) {
416 $href .= "&accno=" . $form->escape($form->{accno});
417 $callback .= "&accno=" . $form->escape($form->{accno}, 1);
419 $locale->text('Account')
420 . " : $form->{accno} $form->{account_description}";
422 if ($form->{gifi_accno}) {
423 $href .= "&gifi_accno=" . $form->escape($form->{gifi_accno});
424 $callback .= "&gifi_accno=" . $form->escape($form->{gifi_accno}, 1);
425 $option .= "\n<br>" if $option;
427 $locale->text('GIFI')
428 . " : $form->{gifi_accno} $form->{gifi_account_description}";
430 if ($form->{source}) {
431 $href .= "&source=" . $form->escape($form->{source});
432 $callback .= "&source=" . $form->escape($form->{source}, 1);
433 $option .= "\n<br>" if $option;
434 $option .= $locale->text('Source') . " : $form->{source}";
436 if ($form->{reference}) {
437 $href .= "&reference=" . $form->escape($form->{reference});
438 $callback .= "&reference=" . $form->escape($form->{reference}, 1);
439 $option .= "\n<br>" if $option;
440 $option .= $locale->text('Reference') . " : $form->{reference}";
442 if ($form->{department}) {
443 $href .= "&department=" . $form->escape($form->{department});
444 $callback .= "&department=" . $form->escape($form->{department}, 1);
445 ($department) = split /--/, $form->{department};
446 $option .= "\n<br>" if $option;
447 $option .= $locale->text('Department') . " : $department";
450 if ($form->{description}) {
451 $href .= "&description=" . $form->escape($form->{description});
452 $callback .= "&description=" . $form->escape($form->{description}, 1);
453 $option .= "\n<br>" if $option;
454 $option .= $locale->text('Description') . " : $form->{description}";
456 if ($form->{notes}) {
457 $href .= "¬es=" . $form->escape($form->{notes});
458 $callback .= "¬es=" . $form->escape($form->{notes}, 1);
459 $option .= "\n<br>" if $option;
460 $option .= $locale->text('Notes') . " : $form->{notes}";
463 if ($form->{datefrom}) {
464 $href .= "&datefrom=$form->{datefrom}";
465 $callback .= "&datefrom=$form->{datefrom}";
466 $option .= "\n<br>" if $option;
468 $locale->text('From') . " "
469 . $locale->date(\%myconfig, $form->{datefrom}, 1);
471 if ($form->{dateto}) {
472 $href .= "&dateto=$form->{dateto}";
473 $callback .= "&dateto=$form->{dateto}";
474 if ($form->{datefrom}) {
477 $option .= "\n<br>" if $option;
480 $locale->text('Bis') . " "
481 . $locale->date(\%myconfig, $form->{dateto}, 1);
486 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)
489 if ($form->{accno} || $form->{gifi_accno}) {
490 @columns = grep !/(accno|gifi_accno)/, @columns;
491 push @columns, "balance";
492 $form->{l_balance} = "Y";
496 $form->{l_credit_accno} = "Y";
497 $form->{l_debit_accno} = "Y";
498 $form->{l_credit_tax} = "Y";
499 $form->{l_debit_tax} = "Y";
500 $form->{l_credit_tax_accno} = "Y";
501 $form->{l_debit_tax_accno} = "Y";
502 $form->{l_accno} = "N";
503 foreach $item (@columns) {
504 if ($form->{"l_$item"} eq "Y") {
505 push @column_index, $item;
507 # add column to href and callback
508 $callback .= "&l_$item=Y";
509 $href .= "&l_$item=Y";
513 if ($form->{l_subtotal} eq 'Y') {
514 $callback .= "&l_subtotal=Y";
515 $href .= "&l_subtotal=Y";
518 $callback .= "&category=$form->{category}";
519 $href .= "&category=$form->{category}";
522 "<th><a class=listheading href=$href&sort=id>"
523 . $locale->text('ID')
525 $column_header{transdate} =
526 "<th><a class=listheading href=$href&sort=transdate>"
527 . $locale->text('Date')
529 $column_header{reference} =
530 "<th><a class=listheading href=$href&sort=reference>"
531 . $locale->text('Reference')
533 $column_header{source} =
534 "<th><a class=listheading href=$href&sort=source>"
535 . $locale->text('Source')
537 $column_header{description} =
538 "<th><a class=listheading href=$href&sort=description>"
539 . $locale->text('Description')
541 $column_header{notes} =
542 "<th class=listheading>" . $locale->text('Notes') . "</th>";
543 $column_header{debit} =
544 "<th class=listheading>" . $locale->text('Debit') . "</th>";
545 $column_header{debit_accno} =
546 "<th><a class=listheading href=$href&sort=accno>"
547 . $locale->text('Debit Account')
549 $column_header{credit} =
550 "<th class=listheading>" . $locale->text('Credit') . "</th>";
551 $column_header{credit_accno} =
552 "<th><a class=listheading href=$href&sort=accno>"
553 . $locale->text('Credit Account')
555 $column_header{debit_tax} =
556 "<th><a class=listheading href=$href&sort=accno>"
557 . $locale->text('Debit Tax')
559 $column_header{debit_tax_accno} =
560 "<th><a class=listheading href=$href&sort=accno>"
561 . $locale->text('Debit Tax Account')
563 $column_header{credit_tax} =
564 "<th><a class=listheading href=$href&sort=accno>"
565 . $locale->text('Credit Tax')
567 $column_header{credit_tax_accno} =
568 "<th><a class=listheading href=$href&sort=accno>"
569 . $locale->text('Credit Tax Account')
571 $column_header{gifi_accno} =
572 "<th><a class=listheading href=$href&sort=gifi_accno>"
573 . $locale->text('GIFI')
575 $column_header{balance} = "<th>" . $locale->text('Balance') . "</th>";
577 $form->{landscape} = 1;
586 <th class=listtop>$form->{title}</th>
596 <tr class=listheading>
599 map { print "$column_header{$_}\n" } @column_index;
608 # add sort to callback
609 $form->{callback} = "$callback&sort=$form->{sort}";
610 $callback = $form->escape($form->{callback});
612 # initial item for subtotals
613 if (@{ $form->{GL} }) {
614 $sameitem = $form->{GL}->[0]->{ $form->{sort} };
617 if (($form->{accno} || $form->{gifi_accno}) && $form->{balance}) {
619 map { $column_data{$_} = "<td> </td>" } @column_index;
620 $column_data{balance} =
622 . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
630 map { print "$column_data{$_}\n" } @column_index;
637 foreach $ref (@{ $form->{GL} }) {
639 # if item ne sort print subtotal
640 if ($form->{l_subtotal} eq 'Y') {
641 if ($sameitem ne $ref->{ $form->{sort} }) {
645 foreach $key (sort keys(%{ $ref->{amount} })) {
646 $form->{balance} += $ref->{amount}{$key};
650 foreach $key (sort keys(%{ $ref->{debit} })) {
651 $subtotaldebit += $ref->{debit}{$key};
652 $totaldebit += $ref->{debit}{$key};
654 $debit = $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
657 "<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
662 foreach $key (sort keys(%{ $ref->{credit} })) {
663 $subtotalcredit += $ref->{credit}{$key};
664 $totalcredit += $ref->{credit}{$key};
666 $credit = $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
669 . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
674 foreach $key (sort keys(%{ $ref->{debit_tax} })) {
675 $subtotaldebittax += $ref->{debit_tax}{$key};
676 $totaldebittax += $ref->{debit_tax}{$key};
679 $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
682 . $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
687 foreach $key (sort keys(%{ $ref->{credit_tax} })) {
688 $subtotalcredittax += $ref->{credit_tax}{$key};
689 $totalcredittax += $ref->{credit_tax}{$key};
692 $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
695 . $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
702 foreach $key (sort keys(%{ $ref->{debit_accno} })) {
705 "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>";
708 "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>";
710 if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
711 $ref->{debit_tax_accno}{$key} = $taxaccno;
713 $taxaccno = $ref->{debit_tax_accno}{$key};
714 $debittaxkey = $ref->{debit_taxkey}{$key};
720 foreach $key (sort keys(%{ $ref->{credit_accno} })) {
723 "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_accno}{$key}</a>";
726 "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_accno}{$key}</a>";
728 if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
729 $ref->{credit_tax_accno}{$key} = $taxaccno;
731 $taxaccno = $ref->{credit_tax_accno}{$key};
732 $credittaxkey = $ref->{credit_taxkey}{$key};
736 foreach $key (sort keys(%{ $ref->{debit_tax_accno} })) {
739 "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
742 "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_tax_accno}{$key}</a>";
746 $credittaxaccno = "";
747 foreach $key (sort keys(%{ $ref->{credit_tax_accno} })) {
750 "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
753 "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{credit_tax_accno}{$key}</a>";
757 # $ref->{debit} = $form->format_amount(\%myconfig, $ref->{debit}, 2, " ");
758 # $ref->{credit} = $form->format_amount(\%myconfig, $ref->{credit}, 2, " ");
760 $column_data{id} = "<td align=right> $ref->{id} </td>";
761 $column_data{transdate} =
762 "<td align=center> $ref->{transdate} </td>";
763 $column_data{reference} =
764 "<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>";
765 $column_data{description} =
766 "<td align=center>$ref->{description} </td>";
767 $column_data{source} = "<td align=center>$ref->{source} </td>";
768 $column_data{notes} = "<td align=center>$ref->{notes} </td>";
769 $column_data{debit} = "<td align=right>$debit</td>";
770 $column_data{debit_accno} = "<td align=center>$debitaccno</td>";
771 $column_data{credit} = "<td align=right>$credit</td>";
772 $column_data{credit_accno} = "<td align=center>$creditaccno</td>";
773 $column_data{debit_tax} =
774 ($ref->{debit_tax_accno} ne "")
775 ? "<td align=right>$debittax</td>"
777 $column_data{debit_tax_accno} = "<td align=center>$debittaxaccno</td>";
778 $column_data{gifi_accno} =
779 "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
780 $column_data{credit_tax} =
781 ($ref->{credit_tax_accno} ne "")
782 ? "<td align=right>$credittax</td>"
784 $column_data{credit_tax_accno} = "<td align=center>$credittaxaccno</td>";
785 $column_data{gifi_accno} =
786 "<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
787 $column_data{balance} =
789 . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
795 <tr class=listrow$i>";
796 map { print "$column_data{$_}\n" } @column_index;
801 &gl_subtotal if ($form->{l_subtotal} eq 'Y');
803 map { $column_data{$_} = "<td> </td>" } @column_index;
805 $column_data{debit} =
806 "<th align=right class=listtotal>"
807 . $form->format_amount(\%myconfig, $totaldebit, 2, " ") . "</th>";
808 $column_data{credit} =
809 "<th align=right class=listtotal>"
810 . $form->format_amount(\%myconfig, $totalcredit, 2, " ") . "</th>";
811 $column_data{debit_tax} =
812 "<th align=right class=listtotal>"
813 . $form->format_amount(\%myconfig, $totaldebittax, 2, " ") . "</th>";
814 $column_data{credit_tax} =
815 "<th align=right class=listtotal>"
816 . $form->format_amount(\%myconfig, $totalcredittax, 2, " ") . "</th>";
817 $column_data{balance} =
818 "<th align=right class=listtotal>"
819 . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0) . "</th>";
825 map { print "$column_data{$_}\n" } @column_index;
834 <td><hr size=3 noshade></td>
840 <form method=post action=$form->{script}>
842 <input name=callback type=hidden value="$form->{callback}">
844 <input type=hidden name=path value=$form->{path}>
845 <input type=hidden name=login value=$form->{login}>
846 <input type=hidden name=password value=$form->{password}>
848 <input class=submit type=submit name=action value="|
849 . $locale->text('GL Transaction') . qq|">
850 <input class=submit type=submit name=action value="|
851 . $locale->text('AR Transaction') . qq|">
852 <input class=submit type=submit name=action value="|
853 . $locale->text('AP Transaction') . qq|">
854 <input class=submit type=submit name=action value="|
855 . $locale->text('Sales Invoice') . qq|">
856 <input class=submit type=submit name=action value="|
857 . $locale->text('Vendor Invoice') . qq|">|;
859 if ($form->{menubar}) {
860 require "$form->{path}/menu.pl";
872 $lxdebug->leave_sub();
876 $lxdebug->enter_sub();
879 $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
881 $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
883 map { $column_data{$_} = "<td> </td>" }
884 qw(transdate id reference source description accno);
885 $column_data{debit} = "<th align=right>$subtotaldebit</td>";
886 $column_data{credit} = "<th align=right>$subtotalcredit</td>";
888 print "<tr class=listsubtotal>";
889 map { print "$column_data{$_}\n" } @column_index;
895 $sameitem = $ref->{ $form->{sort} };
897 $lxdebug->leave_sub();
903 $lxdebug->enter_sub();
907 @flds = (qw(accno debit credit projectnumber project_id oldprojectnumber));
908 $credit_save = $form->{credit};
909 $debit_save = $form->{debit};
911 if ($form->{chart} eq "") {
912 $form->{creditchart} =
913 "<option>" . $form->{creditchartselected} . "</option>";
914 $form->{debitchart} =
915 "<option>" . $form->{debitchartselected} . "</option>";
917 $form->{creditchart} = $form->{chart};
918 $form->{creditchart} =~
919 s/value=\"$form->{creditchartselected}\"/value=\"$form->{creditchartselected}\" selected/;
921 $form->{debitchart} = $form->{chart};
922 $form->{debitchart} =~
923 s/value=\"$form->{debitchartselected}\"/value=\"$form->{debitchartselected}\" selected/;
925 ($debitaccno, $debittaxkey) = split(/--/, $form->{debitchartselected});
926 ($creditaccno, $credittaxkey) = split(/--/, $form->{creditchartselected});
927 if ($debittaxkey > 0) {
928 $form->{taxchart} = $form->unescape($form->{taxchart});
929 $form->{taxchart} =~ s/selected//ig;
931 s/\"$debittaxkey--([^\"]*)\"/\"$debittaxkey--$1\" selected/;
935 if ($form->{taxincluded}) {
937 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
938 $form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
940 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) * $rate;
942 $form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
944 $form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
945 $form->{tax} = $form->parse_amount(\%myconfig, $form->{amount}) * $rate;
948 $form->{taxchart} = $form->unescape($form->{taxchart});
949 $form->{taxchart} =~ s/selected//ig;
951 s/\"$credittaxkey--([^\"]*)\"/\"$credittaxkey--$1\" selected/;
954 if ($form->{taxincluded}) {
955 $form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
957 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
959 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) * $rate;
962 $form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
963 $form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
964 $form->{tax} = $form->parse_amount(\%myconfig, $form->{amount}) * $rate;
967 if ($form->{credit_splited}) {
968 $form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
969 $form->{credit} = $credit_save;
971 } elsif ($form->{debit_splited}) {
972 $form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
973 $form->{debit} = $debit_save;
980 $lxdebug->leave_sub();
984 $lxdebug->enter_sub();
988 # for $i (1 .. $form->{rowcount}) {
989 # $form->{totaldebit} += $form->parse_amount(\%myconfig, $form->{"debit_$i"});
990 # $form->{totalcredit} += $form->parse_amount(\%myconfig, $form->{"credit_$i"});
997 $lxdebug->leave_sub();
1001 $lxdebug->enter_sub();
1003 $title = $form->{title};
1004 $form->{title} = $locale->text("$title General Ledger Transaction");
1005 $readonly = ($form->{id}) ? "readonly" : "";
1008 "$form->{script}?action=split_debit&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1009 $form->{urlcredit} =
1010 "$form->{script}?action=split_credit&path=$form->{path}&login=$form->{login}&password=$form->{password}";
1012 # $locale->text('Add General Ledger Transaction')
1013 # $locale->text('Edit General Ledger Transaction')
1014 map { $form->{$_} =~ s/\"/"/g } qw(reference description chart);
1016 $form->{selectdepartment} =~ s/ selected//;
1017 $form->{taxchart} =~ s/ selected//;
1018 $form->{selectdepartment} =~
1019 s/option>\Q$form->{department}\E/option selected>$form->{department}/;
1021 if (($rows = $form->numtextrows($form->{description}, 50)) > 1) {
1023 qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|;
1026 qq|<input name=description size=50 value="$form->{description}" tabindex="3" $readonly>|;
1029 $taxincluded = ($form->{taxincluded}) ? "checked" : "";
1032 $taxincluded = "checked";
1036 qq|<input name=amount size=20 value="$form->{amount}" tabindex="4" $readonly>|;
1040 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
1041 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
1042 <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
1044 | if $form->{selectdepartment};
1046 $form->{fokus} = "gl.reference";
1047 $form->{remote} = 1;
1049 # use JavaScript Calendar or not
1050 $form->{jsscript} = $jscalendar;
1052 if ($form->{jsscript}) {
1054 # with JavaScript Calendar
1056 <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly></td>
1057 <td><input type=button name=transdate id="trigger1" value=|
1058 . $locale->text('button')
1064 Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1", "",
1068 # without JavaScript Calendar
1070 qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly></td>|;
1076 <body onLoad="fokus()">
1078 <form method=post name="gl" action=$form->{script}>
1080 <input name=id type=hidden value=$form->{id}>
1082 <input type=hidden name=closedto value=$form->{closedto}>
1083 <input type=hidden name=locked value=$form->{locked}>
1084 <input type=hidden name=title value="$title">
1085 <input type=hidden name=taxchart value=|
1086 . $form->escape($form->{taxchart}) . qq|>
1087 <input type=hidden name=chart value="$form->{chart}">
1088 <input type=hidden name=creditrowcount value="$form->{creditrowcount}">
1089 <input type=hidden name=debitrowcount value="$form->{debitrowcount}">
1094 <th class=listtop>$form->{title}</th>
1096 <tr height="5"></tr>
1101 <th align=right>| . $locale->text('Reference') . qq|</th>
1102 <td><input name=reference size=20 value="$form->{reference}" tabindex="1" $readonly></td>
1106 <th align=right nowrap>| . $locale->text('Date') . qq|</th>
1115 <th align=right>| . $locale->text('Belegnummer') . qq|</th>
1116 <td><input name=id size=20 value="$form->{id}" $readonly></td>
1120 <th align=right width=50%>| . $locale->text('Buchungsdatum') . qq|</th>
1121 <td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly></td>
1132 <th align=right>| . $locale->text('Description') . qq|</th>
1133 <td>$description</td>
1137 <th align=right width=50%>| . $locale->text('Mitarbeiter') . qq|</th>
1138 <td align=left><input name=employee size=11 value=$form->{employee} $readonly></td>
1146 <th align=right>| . $locale->text('Description') . qq|</th>
1147 <td colspan=3>$description</td>
1152 <th align=right>| . $locale->text('Betrag') . qq|</th>
1154 <td align=left colspan=2>
1157 <th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
1158 <td><input type=checkbox name=taxincluded value=1 tabindex="8" $taxincluded></td>
1163 if ($form->{debit_splited}) {
1166 <th align=right>| . $locale->text('Debit') . qq|</th>
1167 <td>Betrag gesplittet</td>
1168 <td><input name=debit size=10 value="|
1169 . $form->format_amount(\%myconfig, $form->{debit}, 2)
1170 . qq|" readonly> EUR</td>
1171 <td><input class=submit type=submit name=action value="|
1172 . $locale->text('Split Debit')
1174 <input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
1177 <th align=right>| . $locale->text('Credit') . qq|</th>
1178 <td><select name=creditchartselected tabindex="6">$form->{creditchart}</select></td>
1179 <td><input name=credit size=10 value="|
1180 . $form->format_amount(\%myconfig, $form->{credit}, 2)
1181 . qq|" readonly > EUR</td>
1182 <input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
1185 } elsif ($form->{credit_splited}) {
1188 <th align=right>| . $locale->text('Debit') . qq|</th>
1189 <td><select name=debitchartselected tabindex="6">$form->{debitchart}</select></td>
1190 <td><input name=debit size=10 value="|
1191 . $form->format_amount(\%myconfig, $form->{debit}, 2)
1192 . qq|" readonly> EUR</td>
1193 <input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
1196 <th align=right>| . $locale->text('Credit') . qq|</th>
1197 <td>Betrag gesplittet</td>
1198 <td><input name=credit size=10 value="|
1199 . $form->format_amount(\%myconfig, $form->{credit}, 2)
1200 . qq|" readonly > EUR</td>
1201 <td><input class=submit type=submit name=action value="|
1202 . $locale->text('Split Credit')
1204 <input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
1209 <th align=right>| . $locale->text('Debit') . qq|</th>
1210 <td><select name=debitchartselected tabindex="6">$form->{debitchart}</select></td>
1211 <td><input name=debit size=10 value="|
1212 . $form->format_amount(\%myconfig, $form->{debit}, 2)
1213 . qq|" readonly> EUR</td>
1214 <td><input class=submit type=submit name=action value="|
1215 . $locale->text('Split Debit')
1217 <input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
1220 <th align=right>| . $locale->text('Credit') . qq|</th>
1221 <td><select name=creditchartselected tabindex="6">$form->{creditchart}</select></td>
1222 <td><input name=credit size=10 value="|
1223 . $form->format_amount(\%myconfig, $form->{credit}, 2)
1224 . qq|" readonly > EUR</td>
1225 <td><input class=submit type=submit name=action value="|
1226 . $locale->text('Split Credit')
1228 <input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
1231 <th align=right>| . $locale->text('Tax') . qq|</th>
1232 <td><select name=taxchartselected tabindex="7">$form->{taxchart}</select></td>
1233 <td><input name=tax size=10 value="|
1234 . $form->format_amount(\%myconfig, $form->{tax}, 2)
1235 . qq|" readonly > EUR</td>
1244 <td><hr size=3 noshade></td>
1249 $lxdebug->leave_sub();
1253 $lxdebug->enter_sub();
1254 ($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
1256 $decimalplaces = ($dec > 2) ? $dec : 2;
1258 ($form->{creditrowcount} > $form->{debitrowcount})
1259 ? $form->{creditrowcount}
1260 : $form->{debitrowcount};
1261 $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
1265 $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces, " ")
1266 } qw(totaldebit totalcredit);
1271 for $i (2 .. $form->{creditrowcount}) {
1273 <input type=hidden name=creditchartselected_$i value="$form->{"creditchartselected_$i"}">
1274 <input type=hidden name=credit_$i value="$form->{"credit_$i"}">
1277 for $i (2 .. $form->{debitrowcount}) {
1279 <input type=hidden name=debitchartselected_$i value="$form->{"debitchartselected_$i"}">
1280 <input type=hidden name=debit_$i value="$form->{"debit_$i"}">
1283 if ($taxrowcount > 1) {
1284 for $i (2 .. $taxrowcount) {
1286 <input type=hidden name=taxchartselected_$i value="$form->{"taxchartselected_$i"}">
1287 <input type=hidden name=tax_$i value="$form->{"tax_$i"}">
1292 <input type=hidden name=path value=$form->{path}>
1293 <input type=hidden name=login value=$form->{login}>
1294 <input type=hidden name=password value=$form->{password}>
1296 <input name=callback type=hidden value="$form->{callback}">
1300 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
1301 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
1305 print qq|<input class=submit type=submit name=action value="|
1306 . $locale->text('Storno') . qq|">|;
1308 # Löschen und ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
1310 if (!$form->{locked} && $radieren) {
1312 <input class=submit type=submit name=action value="|
1313 . $locale->text('Post')
1314 . qq|" accesskey="b">
1315 <input class=submit type=submit name=action value="|
1316 . $locale->text('Delete') . qq|">|;
1319 # if ($transdate > $closedto) {
1321 # <input class=submit type=submit name=action value="|.$locale->text('Post as new').qq|">|;
1324 if ($transdate > $closedto) {
1325 print qq|<input class=submit type=submit name=action value="|
1326 . $locale->text('Update') . qq|">
1327 <input class=submit type=submit name=action value="|
1328 . $locale->text('Post') . qq|">|;
1332 if ($form->{menubar}) {
1333 require "$form->{path}/menu.pl";
1344 $lxdebug->leave_sub();
1348 $lxdebug->enter_sub();
1355 <form method=post action=$form->{script}>
1358 map { $form->{$_} =~ s/\"/"/g } qw(reference description chart);
1360 delete $form->{header};
1362 foreach $key (keys %$form) {
1363 print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1367 <h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
1370 . $locale->text('Are you sure you want to delete Transaction')
1371 . qq| $form->{reference}</h4>
1373 <input name=action class=submit type=submit value="|
1374 . $locale->text('Yes') . qq|">
1378 $lxdebug->leave_sub();
1382 $lxdebug->enter_sub();
1384 $form->redirect($locale->text('Transaction deleted!'))
1385 if (GL->delete_transaction(\%myconfig, \%$form));
1386 $form->error($locale->text('Cannot delete transaction!'));
1388 $lxdebug->leave_sub();
1392 $lxdebug->enter_sub();
1394 # check if there is something in reference and date
1395 $form->isblank("reference", $locale->text('Reference missing!'));
1396 $form->isblank("transdate", $locale->text('Transaction Date missing!'));
1397 $form->isblank("description", $locale->text('Description missing!'));
1399 $transdate = $form->datetonum($form->{transdate}, \%myconfig);
1400 $closedto = $form->datetonum($form->{closedto}, \%myconfig);
1402 ($debitaccno, $debittaxkey) = split(/--/, $form->{debitchartselected});
1403 ($creditaccno, $credittaxkey) = split(/--/, $form->{creditchartselected});
1405 $credit_save = $form->{credit};
1406 $debit_save = $form->{debit};
1410 ($taxkey, $taxrate) = split(/--/, $form->{taxchartselected});
1412 if ($debittaxkey > 0) {
1413 $form->{taxchart} = $form->unescape($form->{taxchart});
1414 $form->{taxchart} =~ s/\"$debittaxkey--([^\"]*)\"/\"$debittaxkey--$1\"/;
1416 $rate = ($form->{taxchart} =~ /selected/) ? $taxrate : $1;
1418 ($form->{taxchart} =~ /selected/) ? $taxkey : $debittaxkey;
1420 if ($form->{storno}) {
1421 $form->{debit} = $form->parse_amount(\%myconfig, $form->{debit});
1422 $form->{credit} = $form->parse_amount(\%myconfig, $form->{credit});
1423 $form->{tax} = $form->parse_amount(\%myconfig, $form->{tax});
1425 if ($form->{taxincluded}) {
1427 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
1428 $form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
1430 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) *
1433 $form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
1435 $form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
1437 $form->parse_amount(\%myconfig, $form->{amount}) * $rate;
1440 $form->{debittaxkey} = 1;
1443 $form->{taxchart} = $form->unescape($form->{taxchart});
1444 $form->{taxchart} =~ s/\"$credittaxkey--([^\"]*)\"/\"$credittaxkey--$1\"/;
1446 $rate = ($form->{taxchart} =~ /selected/) ? $taxrate : $1;
1448 ($form->{taxchart} =~ /selected/) ? $taxkey : $credittaxkey;
1450 if ($form->{storno}) {
1451 $form->{debit} = $form->parse_amount(\%myconfig, $form->{debit});
1452 $form->{credit} = $form->parse_amount(\%myconfig, $form->{credit});
1453 $form->{tax} = $form->parse_amount(\%myconfig, $form->{tax});
1455 if ($form->{taxincluded}) {
1456 $form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
1458 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
1460 $form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) *
1464 $form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
1465 $form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
1467 $form->parse_amount(\%myconfig, $form->{amount}) * $rate;
1470 $form->{debittaxkey} = 0;
1473 if ($form->{credit_splited}) {
1474 $form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
1475 $form->{credit} = $credit_save;
1477 } elsif ($form->{debit_splited}) {
1478 $form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
1479 $form->{debit} = $debit_save;
1483 # this is just for the wise guys
1484 $form->error($locale->text('Cannot post transaction for a closed period!'))
1485 if ($transdate <= $closedto);
1486 $form->error($locale->text('Soll- und Habenkonto sind gleich!'))
1487 if ($debitaccno eq $creditaccno);
1488 $form->error($locale->text('Keine Steuerautomatik möglich!'))
1489 if ($debittaxkey && $credittaxkey && !($taxkey == 0));
1491 if (($errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) {
1493 $err[1] = $locale->text('Cannot have a value in both Debit and Credit!');
1494 $err[2] = $locale->text('Debit and credit out of balance!');
1495 $err[3] = $locale->text('Cannot post a transaction without a value!');
1497 $form->error($err[$errno]);
1499 undef($form->{callback});
1500 $form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id});
1502 $lxdebug->leave_sub();
1506 $lxdebug->enter_sub();
1511 $lxdebug->leave_sub();
1515 $lxdebug->enter_sub();
1518 $form->{storno} = 1;
1521 $lxdebug->leave_sub();
1525 $lxdebug->enter_sub();
1528 $form->{old_callback} = $form->escape($form->{callback}, 1);
1529 $form->{callback} = $form->escape("$form->{script}?action=update", 1);
1532 delete $form->{action};
1534 # save all other form variables in a previousform variable
1535 foreach $key (keys %$form) {
1538 $form->{$key} =~ s/&/%26/g;
1539 $previousform .= qq|$key=$form->{$key}&|;
1542 $previousform = $form->escape($previousform, 1);
1543 if (!$form->{debitpost}) {
1544 $form->{debitpost} = $form->{amount};
1546 $form->{previousform} = $previousform;
1547 &display_split_debit();
1549 $lxdebug->leave_sub();
1553 $lxdebug->enter_sub();
1556 $form->{old_callback} = $form->escape($form->{callback}, 1);
1557 $form->{callback} = $form->escape("$form->{script}?action=update", 1);
1560 delete $form->{action};
1562 # save all other form variables in a previousform variable
1563 foreach $key (keys %$form) {
1566 $form->{$key} =~ s/&/%26/g;
1567 $previousform .= qq|$key=$form->{$key}&|;
1570 $previousform = $form->escape($previousform, 1);
1571 if (!$form->{creditpost}) {
1572 $form->{creditpost} = $form->{amount};
1574 $form->{previousform} = $previousform;
1575 &display_split_credit();
1576 $lxdebug->leave_sub();
1579 sub display_split_credit {
1580 $lxdebug->enter_sub();
1581 $form->{taxchart} = $form->unescape($form->{taxchart});
1587 <form method=post name=split_credit action=gl.pl>
1589 . $locale->text('Credit') . qq|: |
1590 . $form->format_amount(\%myconfig, $form->{amount}, 2)
1593 . $locale->text('Still to post')
1594 . qq|:<input name=creditpost size=10 value="|
1595 . $form->format_amount(\%myconfig, $form->{creditpost}, 2)
1597 <script type="text/javascript">
1598 function update_stilltopost (betrag){
1599 remaining = parseFloat(document.split_credit.creditpost.value) - parseFloat(betrag);
1600 document.split_credit.creditpost.value= remaining;
1605 for $i (2 .. $form->{creditrowcount}) {
1606 $form->{"creditchart_$i"} = $form->{chart};
1607 $form->{"creditchart_$i"} =~
1608 s/value=\"$form->{"creditchartselected_$i"}\"/value=\"$form->{"creditchartselected_$i"}\" selected/;
1610 $form->{"taxchart_$i"} = $form->{taxchart};
1611 $form->{"taxchart_$i"} =~
1612 s/value=\"$form->{"taxchartselected_$i"}\"/value=\"$form->{"taxchartselected_$i"}\" selected/;
1617 <th>Position $position</th>
1618 <td><select name=creditchartselected_$i>$form->{"creditchart_$i"}</select></td>
1619 <th align=right>| . $locale->text('Amount') . qq| $1</th>
1620 <td><input name=credit_$i size=10 value="|
1621 . $form->format_amount(\%myconfig, $form->{"credit_$i"}, 2)
1622 . qq|" onBlur="update_stilltopost(this.value)"> EUR</td>
1626 <td><select name=taxchartselected_$i>$form->{"taxchart_$i"}</select></td>
1627 <th align=right>| . $locale->text('Tax') . qq|</th>
1628 <td><input name=tax_$i size=10 value="|
1629 . $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2)
1631 <td><input type=checkbox name=tax_manual_$i value=1> Steuerkorrektur</td>
1637 <td colspan=5><hr size=3 noshade></td>
1644 <input type=hidden name=previousform value="$form->{previousform}">
1646 <input type=hidden name=path value=$form->{path}>
1647 <input type=hidden name=login value=$form->{login}>
1648 <input type=hidden name=password value=$form->{password}>
1649 <input type=hidden name=callback value=$form->{callback}>
1650 <input type=hidden name=old_callback value=$form->{old_callback}>
1651 <input type=hidden name=amount value=$form->{amount}>
1652 <input type=hidden name=credit_splited value=1>
1653 <input type=hidden name=creditrowcount value="$form->{creditrowcount}">
1654 <input type=hidden name=chart value=| . $form->escape($form->{chart}) . qq|>
1655 <input type=hidden name=taxchart value=|
1656 . $form->escape($form->{taxchart}) . qq|>
1658 <input class=submit type=submit name=action value="|
1659 . $locale->text('New Account') . qq|">
1660 <input class=submit type=submit name=action value="|
1661 . $locale->text('Close') . qq|">
1668 $lxdebug->leave_sub();
1671 sub display_split_debit {
1672 $lxdebug->enter_sub();
1673 $form->{taxchart} = $form->unescape($form->{taxchart});
1679 <form method=post name=split_debit action=gl.pl>
1681 . $locale->text('Debit') . qq|: |
1682 . $form->format_amount(\%myconfig, $form->{amount}, 2)
1685 . $locale->text('Still to post')
1686 . qq|:<input name=debitpost size=10 value="|
1687 . $form->format_amount(\%myconfig, $form->{debitpost}, 2)
1689 <script type="text/javascript">
1690 function update_stilltopost (betrag){
1691 remaining = parseFloat(document.split_debit.debitpost.value) - parseFloat(betrag);
1692 document.split_debit.debitpost.value= remaining;
1697 for $i (2 .. $form->{debitrowcount}) {
1698 $form->{"debitchart_$i"} = $form->{chart};
1699 $form->{"debitchart_$i"} =~
1700 s/value=\"$form->{"debitchartselected_$i"}\"/value=\"$form->{"debitchartselected_$i"}\" selected/;
1702 $form->{"taxchart_$i"} = $form->{taxchart};
1703 $form->{"taxchart_$i"} =~
1704 s/value=\"$form->{"taxchartselected_$i"}\"/value=\"$form->{"taxchartselected_$i"}\" selected/;
1709 <th>Position $position</th>
1710 <td><select name=debitchartselected_$i>$form->{"debitchart_$i"}</select></td>
1711 <th align=right>| . $locale->text('Amount') . qq| $1</th>
1712 <td><input name=debit_$i size=10 value="|
1713 . $form->format_amount(\%myconfig, $form->{"debit_$i"}, 2)
1714 . qq|" onBlur="update_stilltopost(this.value)"> EUR</td>
1718 <td><select name=taxchartselected_$i>$form->{"taxchart_$i"}</select></td>
1719 <th align=right>| . $locale->text('Tax') . qq|</th>
1720 <td><input name=tax_$i size=10 value="|
1721 . $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2)
1723 <td><input type=checkbox name=tax_manual_$i value=1> Steuerkorrektur</td>
1729 <td colspan=5><hr size=3 noshade></td>
1736 <input type=hidden name=previousform value="$form->{previousform}">
1738 <input type=hidden name=path value=$form->{path}>
1739 <input type=hidden name=login value=$form->{login}>
1740 <input type=hidden name=password value=$form->{password}>
1741 <input type=hidden name=callback value=$form->{callback}>
1742 <input type=hidden name=old_callback value=$form->{old_callback}>
1743 <input type=hidden name=amount value=$form->{amount}>
1744 <input type=hidden name=debit_splited value=1>
1745 <input type=hidden name=debitrowcount value="$form->{debitrowcount}">
1746 <input type=hidden name=chart value=| . $form->escape($form->{chart}) . qq|>
1747 <input type=hidden name=taxchart value=|
1748 . $form->escape($form->{taxchart}) . qq|>
1750 <input class=submit type=submit name=action value="|
1751 . $locale->text('New Account') . qq|">
1752 <input class=submit type=submit name=action value="|
1753 . $locale->text('Close') . qq|">
1760 $lxdebug->leave_sub();
1764 $lxdebug->enter_sub();
1766 $form->{chart} = $form->unescape($form->{chart});
1768 if ($form->{credit_splited}) {
1769 $form->{creditpost} = $form->{amount};
1771 for $i (2 .. $form->{creditrowcount}) {
1772 $form->{"credit_$i"} =
1773 $form->parse_amount(\%myconfig, $form->{"credit_$i"});
1774 $form->{creditpost} -= $form->{"credit_$i"};
1775 ($taxkey, $taxrate) = split(/--/, $form->{"taxchartselected_$i"});
1776 if ($form->{"tax_manual_$i"}) {
1777 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
1779 $form->{"tax_$i"} = $form->{"credit_$i"} * $taxrate;
1781 $form->{creditpost} -= $form->{"tax_$i"};
1784 if ($form->{"credit_$form->{creditrowcount}"}) {
1785 $form->{creditrowcount}++;
1788 &display_split_credit;
1790 if ($form->{debit_splited}) {
1791 $form->{debitpost} = $form->{amount};
1793 for $i (2 .. $form->{debitrowcount}) {
1794 $form->{"debit_$i"} =
1795 $form->parse_amount(\%myconfig, $form->{"debit_$i"});
1796 $form->{debitpost} -= $form->{"debit_$i"};
1797 ($taxkey, $taxrate) = split(/--/, $form->{"taxchartselected_$i"});
1798 if ($form->{"tax_manual_$i"}) {
1799 $form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
1801 $form->{"tax_$i"} = $form->{"debit_$i"} * $taxrate;
1803 $form->{debitpost} -= $form->{"tax_$i"};
1806 if ($form->{"debit_$form->{debitrowcount}"}) {
1807 $form->{debitrowcount}++;
1810 &display_split_debit;
1812 $lxdebug->leave_sub();
1816 $lxdebug->enter_sub();
1818 # save the new form variables before splitting previousform
1819 map { $newform{$_} = $form->{$_} } keys %$form;
1821 $previousform = $form->unescape($form->{previousform});
1823 # don't trample on previous variables
1824 map { delete $form->{$_} } keys %newform;
1826 # now take it apart and restore original values
1827 foreach $item (split /&/, $previousform) {
1828 ($key, $value) = split /=/, $item, 2;
1829 $value =~ s/%26/&/g;
1830 $form->{$key} = $value;
1832 if ($newform{credit_splited}) {
1833 $form->{credit} = 0;
1834 $form->{credit_splited} = $newform{credit_splited};
1835 $form->{creditrowcount} = $newform{creditrowcount};
1836 for $i (2 .. $form->{creditrowcount}) {
1837 $form->{"creditchartselected_$i"} = $newform{"creditchartselected_$i"};
1838 $form->{"credit_$i"} = $newform{"credit_$i"};
1839 $form->{"credit_$i"} =
1840 $form->parse_amount(\%myconfig, $form->{"credit_$i"});
1841 $form->{"taxchartselected_$i"} = $newform{"taxchartselected_$i"};
1842 ($taxkey, $taxrate) = split(/--/, $form->{"taxchartselected_$i"});
1843 if ($newform{"tax_manual_$i"}) {
1845 $form->parse_amount(\%myconfig, $newform{"tax_$i"});
1847 $form->{"tax_$i"} = $form->{"credit_$i"} * $taxrate;
1849 $form->{credit} += $form->round_amount($form->{"credit_$i"}, 2);
1850 $form->{credit} += $form->round_amount($form->{"tax_$i"}, 2);
1855 $form->{debit_splited} = $newform{debit_splited};
1856 $form->{debitrowcount} = $newform{debitrowcount};
1857 for $i (2 .. $form->{debitrowcount}) {
1858 $form->{"debitchartselected_$i"} = $newform{"debitchartselected_$i"};
1859 $form->{"debit_$i"} = $newform{"debit_$i"};
1860 $form->{"debit_$i"} =
1861 $form->parse_amount(\%myconfig, $form->{"debit_$i"});
1862 $form->{"taxchartselected_$i"} = $newform{"taxchartselected_$i"};
1863 ($taxkey, $taxrate) = split(/--/, $form->{"taxchartselected_$i"});
1864 if ($newform{"tax_manual_$i"}) {
1866 $form->parse_amount(\%myconfig, $newform{"tax_$i"});
1868 $form->{"tax_$i"} = $form->{"debit_$i"} * $taxrate;
1870 $form->{debit} += $form->round_amount($form->{"debit_$i"}, 2);
1871 $form->{debit} += $form->round_amount($form->{"tax_$i"}, 2);
1874 delete $form->{action};
1875 $callback = $form->unescape($form->{callback});
1876 $form->{callback} = $form->unescape($form->{old_callback});
1877 delete $form->{old_callback};
1879 # put callback together
1880 foreach $key (keys %$form) {
1882 # do single escape for Apache 2.0
1883 $value = $form->escape($form->{$key}, 1);
1884 $callback .= qq|&$key=$value|;
1886 $form->{callback} = $callback;
1890 $lxdebug->leave_sub();