($form->{category}) = selectrow_query($form, $dbh, $query, $form->{accno});
if ($form->{fromdate}) {
- # get beginning balance
+ # get beginning balances
$query =
- qq|SELECT SUM(ac.amount) | .
- qq|FROM acc_trans ac | .
- qq|JOIN chart c ON (ac.chart_id = c.id) | .
- $dpt_join .
- qq|WHERE c.accno = ? | .
- qq|AND ac.transdate < ? | .
- $dpt_where .
- $project;
- @values = ($form->{accno}, conv_date($form->{fromdate}),
- @department_values, @project_values);
-
- if ($form->{project_id}) {
- $query .=
- qq|UNION | .
-
- qq|SELECT SUM(ac.qty * ac.sellprice) | .
- qq|FROM invoice ac | .
- qq|JOIN ar a ON (ac.trans_id = a.id) | .
- qq|JOIN parts p ON (ac.parts_id = p.id) | .
- qq|JOIN chart c ON (p.income_accno_id = c.id) | .
- $dpt_join .
- qq|WHERE c.accno = ? | .
- qq| AND a.transdate < ? | .
- qq| AND c.category = 'I' | .
- $dpt_where .
- $project .
-
- qq|UNION | .
-
- qq|SELECT SUM(ac.qty * ac.sellprice) | .
- qq|FROM invoice ac | .
- qq|JOIN ap a ON (ac.trans_id = a.id) | .
- qq|JOIN parts p ON (ac.parts_id = p.id) | .
- qq|JOIN chart c ON (p.expense_accno_id = c.id) | .
- $dpt_join .
- qq|WHERE c.accno = ? | .
- qq| AND a.transdate < ? | .
- qq| AND c.category = 'E' | .
- $dpt_where .
- $project;
-
- push(@values,
- $form->{accno}, conv_date($form->{transdate}),
- @department_values, @project_values,
- $form->{accno}, conv_date($form->{transdate}),
- @department_values, @project_values);
- }
+ qq|SELECT SUM(ac.amount) AS amount
+ FROM acc_trans ac
+ JOIN chart c ON (ac.chart_id = c.id)
+ $dpt_join
+ WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction
+ $dpt_where
+ $project
+ AND c.accno = ?|;
+
+ ($form->{beginning_balance}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{accno});
+
+ # get last transaction date
+ my $todate = ($form->{todate}) ? " AND ac.transdate <= '$form->{todate}' " : "";
+ $query = qq|SELECT max(ac.transdate) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) $todate AND c.accno = ?|;
+ ($form->{last_transaction}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{accno});
+
+ # get old saldo
+ $query = qq|SELECT sum(ac.amount) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.transdate < ? AND c.accno = ?|;
+ ($form->{saldo_old}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{fromdate}, $form->{accno});
+
+ #get old balance
+ $query = qq|SELECT sum(ac.amount) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.transdate < ? AND c.accno = ? AND ac.amount < 0 AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)|;
+ ($form->{old_balance_debit}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{fromdate}, $form->{accno});
- ($form->{balance}) = selectrow_query($form, $dbh, $query, @values);
+ $query = qq|SELECT sum(ac.amount) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.transdate < ? AND c.accno = ? AND ac.amount > 0 AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)|;
+ ($form->{old_balance_credit}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{fromdate}, $form->{accno});
+
+ # get current saldo
+ my $todate = ($form->{todate} ne "") ? " AND ac.transdate <= '$form->{todate}' " : "";
+ $query = qq|SELECT sum(ac.amount) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) $todate AND c.accno = ?|;
+ ($form->{saldo_new}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{accno});
+
+ #get current balance
+ my $todate = ($form->{todate} ne "") ? " AND ac.transdate <= '$form->{todate}' " : "";
+ $query = qq|SELECT sum(ac.amount) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) $todate AND c.accno = ? AND ac.amount < 0 AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)|;
+ ($form->{current_balance_debit}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{accno});
+
+ my $todate = ($form->{todate} ne "") ? " AND ac.transdate <= '$form->{todate}' " : "";
+ $query = qq|SELECT sum(ac.amount) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id)WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) $todate AND c.accno = ? AND ac.amount > 0 AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)|;
+ ($form->{current_balance_credit}) = selectrow_query($form, $dbh, $query, $form->{fromdate}, $form->{accno});
}
}
# JOIN ... that also works.
# get all transactions
- $query .=
- $union .
- qq|SELECT a.id, a.reference, a.description, ac.transdate, | .
- qq| $false AS invoice, ac.amount, 'gl' as module | .
+ $query =
+ qq|SELECT a.id, a.reference, a.description, ac.transdate, ac.chart_id, | .
+ qq| $false AS invoice, ac.amount, 'gl' as module, | .
+ qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § .
qq|FROM acc_trans ac, gl a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
qq| AND ac.chart_id = ? | .
qq| AND ac.trans_id = a.id | .
+ qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) | .
qq|UNION ALL | .
- qq|SELECT a.id, a.invnumber, c.name, ac.transdate, | .
- qq| a.invoice, ac.amount, 'ar' as module | .
+ qq|SELECT a.id, a.invnumber, c.name, ac.transdate, ac.chart_id, | .
+ qq| a.invoice, ac.amount, 'ar' as module, | .
+ qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § .
qq|FROM acc_trans ac, customer c, ar a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
qq| AND ac.chart_id = ? | .
- qq| AND NOT a.storno | .
qq| AND ac.trans_id = a.id | .
qq| AND a.customer_id = c.id | .
+ qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) | .
qq|UNION ALL | .
- qq|SELECT a.id, a.invnumber, v.name, ac.transdate, | .
- qq| a.invoice, ac.amount, 'ap' as module | .
+ qq|SELECT a.id, a.invnumber, v.name, ac.transdate, ac.chart_id, | .
+ qq| a.invoice, ac.amount, 'ap' as module, | .
+ qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § .
qq|FROM acc_trans ac, vendor v, ap a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
qq| AND ac.chart_id = ? | .
qq| AND ac.trans_id = a.id | .
- qq| AND NOT a.storno | .
qq| AND a.vendor_id = v.id |;
+ qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) | .
push(@values,
@where_values, @department_values, @project_values, $id,
qq|UNION ALL | .
qq|SELECT a.id, a.invnumber, c.name, a.transdate, | .
- qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ar' as module | .
+ qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ar' as module, | .
+ qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § .
qq|FROM ar a | .
qq|JOIN invoice ac ON (ac.trans_id = a.id) | .
qq|JOIN parts p ON (ac.parts_id = p.id) | .
qq|UNION ALL | .
qq|SELECT a.id, a.invnumber, v.name, a.transdate, | .
- qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ap' as module | .
+ qq| a.invoice, ac.qty * ac.sellprice AS sellprice, 'ap' as module, | .
+ qq§(SELECT accno||'--'||rate FROM tax LEFT JOIN chart ON (tax.chart_id=chart.id) WHERE tax.id = (SELECT tax_id FROM taxkeys WHERE taxkey_id = ac.taxkey AND taxkeys.startdate <= ac.transdate ORDER BY taxkeys.startdate DESC LIMIT 1)) AS taxinfo § .
qq|FROM ap a | .
qq|JOIN invoice ac ON (ac.trans_id = a.id) | .
qq|JOIN parts p ON (ac.parts_id = p.id) | .
$query .= qq|ORDER BY $sort|;
$sth = prepare_execute_query($form, $dbh, $query, @values);
+ #get detail information for each transaction
+ $trans_query =
+ qq|SELECT accno, | .
+ qq|amount, transdate FROM acc_trans LEFT JOIN chart ON (chart_id=chart.id) WHERE | .
+ qq|trans_id = ? AND sign(amount) <> sign(?) AND chart_id <> ? AND transdate = ?|;
+ my $trans_sth = $dbh->prepare($trans_query);
+
$form->{CA} = [];
while (my $ca = $sth->fetchrow_hashref(NAME_lc)) {
# ap
$ca->{debit} = 0;
}
- $ca->{index} = join "--", map { $ca->{$_} } qw(id reference description);
+ ($ca->{ustkonto},$ca->{ustrate}) = split /--/, $ca->{taxinfo};
+
+ #get detail information for this transaction
+ $trans_sth->execute($ca->{id}, $ca->{amount}, $ca->{chart_id}, $ca->{transdate}) ||
+ $form->dberror($trans_query . " (" . join(", ", $ca->{id}) . ")");
+ while (my $trans = $trans_sth->fetchrow_hashref(NAME_lc)) {
+ if (($ca->{transdate} eq $trans->{transdate}) && ($ca->{amount} * $trans->{amount} < 0)) {
+ if ($trans->{amount} < 0) {
+ $trans->{debit} = $trans->{amount} * -1;
+ $trans->{credit} = 0;
+ } else {
+ $trans->{credit} = $trans->{amount};
+ $trans->{debit} = 0;
+ }
+ push(@{ $ca->{GEGENKONTO} }, $trans);
+ } else {
+ next;
+ }
+ }
+
+ $ca->{index} = join "--", map { $ca->{$_} } qw(id reference description transdate);
push(@{ $form->{CA} }, $ca);
$form->{title} = $locale->text('List Transactions');
$form->{title} .= " - " . $locale->text('Account') . " $form->{accno}";
+ $year = (localtime)[5] + 1900;
# get departments
$form->all_departments(\%myconfig);
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
</tr>
| if $form->{selectdepartment};
+ $accrual = ($eur) ? "" : "checked";
+ $cash = ($eur) ? "checked" : "";
+
+ $name_1 = "fromdate";
+ $id_1 = "fromdate";
+ $value_1 = "$form->{fromdate}";
+ $trigger_1 = "trigger1";
+ $name_2 = "todate";
+ $id_2 = "todate";
+ $value_2 = "";
+ $trigger_2 = "trigger2";
+
+
+ # with JavaScript Calendar
+ if ($form->{jsscript}) {
+ if ($name_1 eq "") {
+
+ $button1 = qq|
+ <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
+ $button1_2 = qq|
+ <input type=button name=$name_2 id="$trigger_2" value=|
+ . $locale->text('button') . qq|>|;
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "1", "$name_2", "BR", "$trigger_2");
+ } else {
+ $button1 = qq|
+ <input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\" value="$value_1">|;
+ $button1_2 = qq|
+ <input type=button name=$name_1 id="$trigger_1" value=|
+ . $locale->text('button') . qq|>|;
+ $button2 = qq|
+ <input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
+ $button2_2 = qq|
+ <input type=button name=$name_2 id="$trigger_2" value=|
+ . $locale->text('button') . qq|>
+ |;
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "2", "$name_1", "BR", "$trigger_1",
+ "$name_2", "BL", "$trigger_2");
+ }
+ } else {
+
+ # without JavaScript Calendar
+ if ($name_1 eq "") {
+ $button1 =
+ qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
+ } else {
+ $button1 =
+ qq|<input name=$name_1 id=$id_1 size=11 title="$myconfig{dateformat}" value="$value_1" onBlur=\"check_right_date_format(this)\">|;
+ $button2 =
+ qq|<input name=$name_2 id=$id_2 size=11 title="$myconfig{dateformat}" onBlur=\"check_right_date_format(this)\">|;
+ }
+ }
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
+ $form->header;
+ $onload = qq|focus()|;
+ $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
+
$form->header;
$form->{description} =~ s/\"/"/g;
print qq|
-<body>
+<body onLoad="$onload">
<form method=post action=$form->{script}>
<input type=hidden name=accounttype value=$form->{accounttype}>
<table border=0 width=100%>
- <tr><th class=listtop>$form->{title}</th></tr>
- <tr height="5"></tr
- <tr valign=top>
- <td>
- <table>
- $department
+ <tr>
+ <th class=listtop>$form->{title}</th>
+ </tr>
+
+</table>
+<table>
<tr>
- <th align=right>| . $locale->text('From') . qq|</th>
- <td><input name=fromdate size=11 title="$myconfig{dateformat}"></td>
- <th align=right>| . $locale->text('To') . qq|</th>
- <td><input name=todate size=11 title="$myconfig{dateformat}"></td>
+ <th align=left><input name=reporttype class=radio type=radio value="custom" checked> |
+ . $locale->text('Customized Report') . qq|</th>
</tr>
<tr>
- <th align=right>| . $locale->text('Include in Report') . qq|</th>
- <td colspan=3>
- <input name=l_subtotal class=checkbox type=checkbox value=Y> |
- . $locale->text('Subtotal') . qq|</td>
+ <th colspan=1>| . $locale->text('Year') . qq|</th>
+ <td><input name=year size=11 title="|
+ . $locale->text('YYYY') . qq|" value="$year"></td>
</tr>
- </table>
- </td>
- </tr>
- <tr><td><hr size=3 noshade></td></tr>
+|;
+
+ print qq|
+ <tr>
+ <td align=right>
+<b> | . $locale->text('Yearly') . qq|</b> </td>
+ <th align=left>| . $locale->text('Quarterly') . qq|</th>
+ <th align=left colspan=3>| . $locale->text('Monthly') . qq|</th>
+ </tr>
+ <tr>
+ <td align=right> <input name=duetyp class=radio type=radio value="13"
+$checked></td>
+ <td><input name=duetyp class=radio type=radio value="A" $checked > 1. |
+ . $locale->text('Quarter') . qq|</td>
+|;
+ $checked = "checked";
+ print qq|
+ <td><input name=duetyp class=radio type=radio value="1" $checked > |
+ . $locale->text('January') . qq|</td>
+|;
+ $checked = "";
+ print qq|
+ <td><input name=duetyp class=radio type=radio value="5" $checked > |
+ . $locale->text('May') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="9" $checked > |
+ . $locale->text('September') . qq|</td>
+
+ </tr>
+ <tr>
+ <td align= right> </td>
+ <td><input name=duetyp class=radio type=radio value="B" $checked> 2. |
+ . $locale->text('Quarter') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="2" $checked > |
+ . $locale->text('February') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="6" $checked > |
+ . $locale->text('June') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="10" $checked > |
+ . $locale->text('October') . qq|</td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td><input name=duetyp class=radio type=radio value="C" $checked> 3. |
+ . $locale->text('Quarter') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="3" $checked > |
+ . $locale->text('March') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="7" $checked > |
+ . $locale->text('July') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="11" $checked > |
+ . $locale->text('November') . qq|</td>
+
+ </tr>
+ <tr>
+ <td> </td>
+ <td><input name=duetyp class=radio type=radio value="D" $checked> 4. |
+ . $locale->text('Quarter') . qq| </td>
+ <td><input name=duetyp class=radio type=radio value="4" $checked > |
+ . $locale->text('April') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="8" $checked > |
+ . $locale->text('August') . qq|</td>
+ <td><input name=duetyp class=radio type=radio value="12" $checked > |
+ . $locale->text('December') . qq|</td>
+
+ </tr>
+ <tr>
+ <td colspan=5><hr size=3 noshade></td>
+ </tr>
+ <tr>
+ <th align=left><input name=reporttype class=radio type=radio value="free" $checked> |
+ . $locale->text('Free report period') . qq|</th>
+ <td align=left colspan=4>| . $locale->text('From') . qq|
+ $button1
+ $button1_2
+ | . $locale->text('Bis') . qq|
+ $button2
+ $button2_2
+ </td>
+ </tr>
+ <tr>
+ <td colspan=5><hr size=3 noshade></td>
+ </tr>
+ <tr>
+ <th align=leftt>| . $locale->text('Method') . qq|</th>
+ <td colspan=3><input name=method class=radio type=radio value=accrual $accrual>|
+ . $locale->text('Accrual') . qq|
+ <input name=method class=radio type=radio value=cash $cash>|
+ . $locale->text('EUR') . qq|</td>
+ </tr>
+ <tr>
+ <th align=right colspan=4>|
+ . $locale->text('Decimalplaces')
+ . qq|</th>
+ <td><input name=decimalplaces size=3 value="2"></td>
+ </tr>
+
+$jsscript
+ <tr><td colspan=5 ><hr size=3 noshade></td></tr>
</table>
<br><input class=submit type=submit name=action value="|
$form->{title} = $locale->text('Account') . " $form->{accno} - $form->{description}";
+ if ($form->{reporttype} eq "custom") {
+
+ #forgotten the year --> thisyear
+ if ($form->{year} !~ m/^\d\d\d\d$/) {
+ $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
+ /(\d\d\d\d)/;
+ $form->{year} = $1;
+ }
+
+ #yearly report
+ if ($form->{duetyp} eq "13") {
+ $form->{fromdate} = "1.1.$form->{year}";
+ $form->{todate} = "31.12.$form->{year}";
+ }
+
+ #Quater reports
+ if ($form->{duetyp} eq "A") {
+ $form->{fromdate} = "1.1.$form->{year}";
+ $form->{todate} = "31.3.$form->{year}";
+ }
+ if ($form->{duetyp} eq "B") {
+ $form->{fromdate} = "1.4.$form->{year}";
+ $form->{todate} = "30.6.$form->{year}";
+ }
+ if ($form->{duetyp} eq "C") {
+ $form->{fromdate} = "1.7.$form->{year}";
+ $form->{todate} = "30.9.$form->{year}";
+ }
+ if ($form->{duetyp} eq "D") {
+ $form->{fromdate} = "1.10.$form->{year}";
+ $form->{todate} = "31.12.$form->{year}";
+ }
+
+ #Monthly reports
+ SWITCH: {
+ $form->{duetyp} eq "1" && do {
+ $form->{fromdate} = "1.1.$form->{year}";
+ $form->{todate} = "31.1.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "2" && do {
+ $form->{fromdate} = "1.2.$form->{year}";
+
+ #this works from 1901 to 2099, 1900 and 2100 fail.
+ $leap = ($form->{year} % 4 == 0) ? "29" : "28";
+ $form->{todate} = "$leap.2.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "3" && do {
+ $form->{fromdate} = "1.3.$form->{year}";
+ $form->{todate} = "31.3.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "4" && do {
+ $form->{fromdate} = "1.4.$form->{year}";
+ $form->{todate} = "30.4.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "5" && do {
+ $form->{fromdate} = "1.5.$form->{year}";
+ $form->{todate} = "31.5.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "6" && do {
+ $form->{fromdate} = "1.6.$form->{year}";
+ $form->{todate} = "30.6.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "7" && do {
+ $form->{fromdate} = "1.7.$form->{year}";
+ $form->{todate} = "31.7.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "8" && do {
+ $form->{fromdate} = "1.8.$form->{year}";
+ $form->{todate} = "31.8.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "9" && do {
+ $form->{fromdate} = "1.9.$form->{year}";
+ $form->{todate} = "30.9.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "10" && do {
+ $form->{fromdate} = "1.10.$form->{year}";
+ $form->{todate} = "31.10.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "11" && do {
+ $form->{fromdate} = "1.11.$form->{year}";
+ $form->{todate} = "30.11.$form->{year}";
+ last SWITCH;
+ };
+ $form->{duetyp} eq "12" && do {
+ $form->{fromdate} = "1.12.$form->{year}";
+ $form->{todate} = "31.12.$form->{year}";
+ last SWITCH;
+ };
+ }
+ }
+
CA->all_transactions(\%myconfig, \%$form);
+ print(STDERR "EB: $form->{beginning_balance}\n");
+
+ my $saldo_old = ($form->{saldo_old} > 0) ? $form->format_amount(\%myconfig, $form->{saldo_old}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{saldo_old}) , 2) . " S";
+
+ my $eb_string = ($form->{beginning_balance} > 0) ? $form->format_amount(\%myconfig, $form->{beginning_balance}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{beginning_balance}), 2) . " S";
+ print(STDERR "EB: $eb_string\n");
+
my @options;
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
push @options, $period;
- my @columns = qw(transdate reference description debit credit balance);
+ my @columns = qw(transdate reference description gegenkonto debit credit ustkonto ustrate);
my %column_defs = (
'transdate' => { 'text' => $locale->text('Date'), },
'reference' => { 'text' => $locale->text('Reference'), },
'description' => { 'text' => $locale->text('Description'), },
'debit' => { 'text' => $locale->text('Debit'), },
'credit' => { 'text' => $locale->text('Credit'), },
- 'balance' => { 'text' => $locale->text('Balance'), },
- );
- my %column_alignment = map { $_ => 'right' } qw(debit credit balance);
+ 'gegenkonto' => { 'text' => $locale->text('Gegenkonto'), },
+ 'ustkonto' => { 'text' => $locale->text('USt-Konto'), },
+ 'ustrate' => { 'text' => $locale->text('Satz %'), },
+ );
+ my %column_alignment = map { $_ => 'right' } qw(debit credit);
+
+ @custom_headers = ();
+ # Zeile 1:
+ push @custom_headers, [
+ { 'text' => 'Letzte Buchung', },
+ { 'text' => 'EB-Wert', },
+ { 'text' => 'Saldo alt', 'colspan' => 2, },
+ { 'text' => 'Jahresverkehrszahlen alt', 'colspan' => 2, },
+ { 'text' => '', 'colspan' => 2, },
+ ];
+ push @custom_headers, [
+ { 'text' => $form->{last_transaction}, },
+ { 'text' => $eb_string, },
+ { 'text' => $saldo_old, 'colspan' => 2, },
+ { 'text' => $form->format_amount(\%myconfig, abs($form->{old_balance_debit}), 2) . " S", },
+ { 'text' => $form->format_amount(\%myconfig, $form->{old_balance_credit}, 2) . " H", },
+ { 'text' => '', 'colspan' => 2, },
+ ];
+ # Zeile 2:
+ push @custom_headers, [
+ { 'text' => $locale->text('Date'), },
+ { 'text' => $locale->text('Reference'), },
+ { 'text' => $locale->text('Description'), },
+ { 'text' => $locale->text('Gegenkonto'), },
+ { 'text' => $locale->text('Debit'), },
+ { 'text' => $locale->text('Credit'), },
+ { 'text' => $locale->text('USt-Konto'), },
+ { 'text' => $locale->text('Satz %'), },
+ ];
+
+
my @hidden_variables = qw(accno fromdate todate description accounttype l_heading l_subtotal department projectnumber project_id sort);
$form->{callback} = $link . '&sort=' . E($form->{sort});
my $report = SL::ReportGenerator->new(\%myconfig, $form);
+ $report->set_custom_headers(@custom_headers);
$report->set_options('top_info_text' => join("\n", @options),
'output_format' => 'HTML',
my $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
- if ($form->{accno} && $form->{balance}) {
- my $row = {
- 'balance' => {
- 'data' => $form->format_amount(\%myconfig, $form->{balance} * $ml, 2),
- 'align' => 'right',
- },
- };
-
- $report->add_data($row);
- }
my $idx = 0;
my %totals = ( 'debit' => 0, 'credit' => 0 );
my ($previous_index, $row_set);
foreach my $ca (@{ $form->{CA} }) {
- $form->{balance} += $ca->{amount};
foreach (qw(debit credit)) {
$subtotals{$_} += $ca->{$_};
$ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
}
- $ca->{balance} = $form->format_amount(\%myconfig, $form->{balance} * $ml, 2);
my $row = { };
+ $ca->{ustrate} = $form->format_amount(\%myconfig, $ca->{ustrate} * 100, 2) if ($ca->{ustrate} != 0);
+
+
+
+ foreach my $gegenkonto (@{ $ca->{GEGENKONTO} }) {
+ if ($ca->{gegenkonto} eq "") {
+ $ca->{gegenkonto} = $gegenkonto->{accno};
+ } else {
+ $ca->{gegenkonto} .= ", " . $gegenkonto->{accno};
+ }
+ }
+
foreach (@columns) {
$row->{$_} = {
'data' => $ca->{$_},
$row->{balance}->{data} = $form->format_amount(\%myconfig, $form->{balance} * $ml, 2);
$report->add_data($row);
+
+ $report->add_separator();
+ my $row = {
+ 'transdate' => {
+ 'data' => "",
+ 'class' => 'listtotal',
+ },
+ 'reference' => {
+ 'data' => $locale->text('EB-Wert'),
+ 'class' => 'listtotal',
+ },
+ 'description' => {
+ 'data' => $locale->text('Saldo neu'),
+ 'colspan' => 2,
+ 'class' => 'listtotal',
+ },
+ 'debit' => {
+ 'data' => $locale->text('Jahresverkehrszahlen neu'),
+ 'colspan' => 2,
+ 'align' => 'left',
+ 'class' => 'listtotal',
+ },
+ 'ustkonto' => {
+ 'data' => '',
+ 'colspan' => 2,
+ 'align' => 'left',
+ 'class' => 'listtotal',
+ },
+ };
+
+ $report->add_data($row);
+ my $saldo_new = ($form->{saldo_new} > 0) ? $form->format_amount(\%myconfig, $form->{saldo_new}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{saldo_new}) , 2) . " S";
+ my $row = {
+ 'transdate' => {
+ 'data' => "",
+ 'class' => 'listtotal',
+ },
+ 'reference' => {
+ 'data' => $eb_string,
+ 'class' => 'listtotal',
+ },
+ 'description' => {
+ 'data' => $saldo_new,
+ 'colspan' => 2,
+ 'class' => 'listtotal',
+ },
+ 'debit' => {
+ 'data' => $form->format_amount(\%myconfig, abs($form->{current_balance_debit}) , 2) . " S",
+ 'class' => 'listtotal',
+ },
+ 'credit' => {
+ 'data' => $form->format_amount(\%myconfig, $form->{current_balance_credit}, 2) . " H",
+ 'class' => 'listtotal',
+ },
+ 'ustkonto' => {
+ 'data' => "",
+ 'colspan' => 2,
+ 'class' => 'listtotal',
+ },
+ };
+
+ $report->add_data($row);
+
$report->generate_with_headers();
$lxdebug->leave_sub();
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
'EAN' => 'EAN',
'EAN-Code' => 'EAN-Code',
+ 'EB-Wert' => 'EB-Wert',
'EK' => 'EK',
'ELSE' => 'Zusatz',
'ELSTER Export (Taxbird)' => 'ELSTER-Export nach Taxbird',
'Full Access' => 'Vollzugriff',
'Full access to all functions' => 'Vollzugriff auf alle Funktionen',
'GL Transaction' => 'Dialogbuchung',
+ 'Gegenkonto' => 'Gegenkonto',
'General Ledger' => 'Finanzbuchhaltung',
'General ledger and cash' => 'Finanzbuchhaltung und Zahlungsverkehr',
'Generic Tax Report' => 'USTVA Bericht',
'It may optionally be compressed with "gzip".' => 'Sie darf optional mit "gzip" komprimiert sein.',
'Item deleted!' => 'Artikel gelöscht!',
'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!',
+ 'Jahresverkehrszahlen neu' => 'Jahresverkehrszahlen neu',
'Jan' => 'Jan',
'January' => 'Januar',
'Journal' => 'Buchungsjournal',
'SIC' => 'SIC',
'Saldo Credit' => 'Saldo Haben',
'Saldo Debit' => 'Saldo Soll',
+ 'Saldo neu' => 'Saldo neu',
'Saldo per' => 'Saldo per',
'Sales Invoice' => 'Rechnung',
'Sales Invoices' => 'Kundenrechnung',
'Same as the quote character' => 'Wie Anführungszeichen',
'Sat. Fax' => 'Sat. Fax',
'Sat. Phone' => 'Sat. Tel.',
+ 'Satz %' => 'Satz %',
'Save' => 'Speichern',
'Save account first to insert taxkeys' => 'Einstellungen sind nach
dem Speichern des Kontos verfügbar...',
'USTVA-Hint: Method' => 'Wenn Sie Ist-Versteuert sind, wählen Sie die Einnahmen-/Überschuß-Rechnung aus. Sind Sie Soll-Versteuert und bilanzverpflichtet, dann wählen Sie Bilanz aus.',
'USTVA-Hint: Tax Authoritys' => 'Bitte das Bundesland UND die Stadt bzw. den Einzugsbereich Ihres zuständigen Finanzamts auswählen.',
'USt-IdNr.' => 'USt-IdNr.',
+ 'USt-Konto' => 'USt-Konto',
'UStVA' => 'UStVA',
'UStVA (PDF-Dokument)' => 'UStVa als PDF-Dokument',
'UStVa' => 'UStVa',
'AP' => 'Einkauf',
'AR' => 'Verkauf',
'Account' => 'Konto',
+ 'Accrual' => 'Bilanzierung',
'Advance turnover tax return' => 'Umsatzsteuervoranmeldung',
'All reports' => 'Alle Berichte (Kontenübersicht, Summen- u. Saldenliste, GuV, BWA, Bilanz, Projektbuchungen)',
'Apr' => 'Apr',
'April' => 'April',
'Aug' => 'Aug',
'August' => 'August',
- 'Balance' => 'Bilanz',
'Bcc' => 'Bcc',
'Bin List' => 'Lagerliste',
'Binding to the LDAP server as "#1" failed. Please check config/authentication.pl.' => 'Die Anmeldung am LDAP-Server als "#1" schlug fehl. Bitte überprüfen Sie die Angaben in config/authentication.pl.',
+ 'Bis' => 'bis',
'CANCELED' => 'Storniert',
'CSV export -- options' => 'CSV-Export -- Optionen',
'Cc' => 'Cc',
'Create and edit vendor invoices' => 'Eingangsrechnungen erfassen und bearbeiten',
'Credit' => 'Haben',
'Credit Note' => 'Gutschrift',
+ 'Customized Report' => 'Vorgewählte Zeiträume',
'DATEV Export' => 'DATEV-Export',
'DELETED' => 'Gelöscht',
'DUNNING STARTED' => 'Mahnprozess gestartet',
'Debit' => 'Soll',
'Dec' => 'Dez',
'December' => 'Dezember',
+ 'Decimalplaces' => 'Dezimalstellen',
'Delivery Order' => 'Lieferschein',
'Department' => 'Abteilung',
'Dependency loop detected:' => 'Schleife in den Abhängigkeiten entdeckt:',
'Description' => 'Beschreibung',
'Directory' => 'Verzeichnis',
+ 'EB-Wert' => 'EB-Wert',
'ELSE' => 'Zusatz',
+ 'EUR' => 'E/Ü-Rechnung',
'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
+ 'Falsches Datumsformat!' => 'Falsches Datumsformat!',
'Feb' => 'Feb',
'February' => 'Februar',
'File' => 'Datei',
+ 'Free report period' => 'Freier Zeitraum',
'From' => 'Von',
+ 'Gegenkonto' => 'Gegenkonto',
'General ledger and cash' => 'Finanzbuchhaltung und Zahlungsverkehr',
- 'Include in Report' => 'In Bericht aufnehmen',
'Invoice' => 'Rechnung',
+ 'Jahresverkehrszahlen neu' => 'Jahresverkehrszahlen neu',
'Jan' => 'Jan',
'January' => 'Januar',
'Jul' => 'Jul',
'May ' => 'Mai',
'May set the BCC field when sending emails' => 'Beim Verschicken von Emails das Feld \'BCC\' setzen',
'Message' => 'Nachricht',
+ 'Method' => 'Verfahren',
'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.',
'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.',
'Missing parameter #1 in call to sub #2.' => 'Fehlernder Parameter \'#1\' in Funktionsaufruf \'#2\'.',
+ 'Monthly' => 'monatlich',
'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
'No or an unknown authenticantion module specified in "config/authentication.pl".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/authentication.pl" angegeben.',
'Nov' => 'Nov',
'Proforma Invoice' => 'Proformarechnung',
'Project Number' => 'Projektnummer',
'Purchase Order' => 'Lieferantenauftrag',
+ 'Quarter' => 'Quartal',
+ 'Quarterly' => 'quartalsweise',
'Quotation' => 'Angebot',
'RFQ' => 'Anfrage',
'Receipt, payment, reconciliation' => 'Zahlungseingang, Zahlungsausgang, Kontenabgleich',
'SAVED' => 'Gespeichert',
'SAVED FOR DUNNING' => 'Gespeichert',
'SCREENED' => 'Angezeigt',
+ 'Saldo neu' => 'Saldo neu',
+ 'Satz %' => 'Satz %',
'Sep' => 'Sep',
'September' => 'September',
'Storno Invoice' => 'Stornorechnung',
'Storno Packing List' => 'Stornolieferschein',
'Subject' => 'Betreff',
- 'Subtotal' => 'Zwischensumme',
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
'The LDAP server "#1:#2" is unreachable. Please check config/authentication.pl.' => 'Der LDAP-Server "#1:#2" ist nicht erreichbar. Bitte überprüfen Sie die Angaben in config/authentication.pl.',
'The config file "config/authentication.pl" contained invalid Perl code:' => 'Die Konfigurationsdatei "config/authentication.pl" enthielt ungütigen Perl-Code:',
'The connection to the template database failed:' => 'Die Verbindung zur Vorlagendatenbank schlug fehl:',
'The creation of the authentication database failed:' => 'Das Anlegen der Authentifizierungsdatenbank schlug fehl:',
'The list has been printed.' => 'Die Liste wurde ausgedruckt.',
- 'To' => 'An',
'To (email)' => 'An',
'Transactions, AR transactions, AP transactions' => 'Dialogbuchen, Debitorenrechnungen, Kreditorenrechnungen',
+ 'USt-Konto' => 'USt-Konto',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'View warehouse content' => 'Lagerbestand ansehen',
'Warehouse management' => 'Lagerverwaltung/Bestandsveränderung',
+ 'YYYY' => 'JJJJ',
+ 'Year' => 'Jahr',
+ 'Yearly' => 'jährlich',
'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.',
'[email]' => '[email]',
'bin_list' => 'Lagerliste',
+ 'button' => '?',
'chart_of_accounts' => 'kontenuebersicht',
'config/authentication.pl: Key "DB_config" is missing.' => 'config/authentication.pl: Das Schlüsselwort "DB_config" fehlt.',
'config/authentication.pl: Key "LDAP_config" is missing.' => 'config/authentication.pl: Der Schlüssel "LDAP_config" fehlt.',
'request_quotation' => 'Angebotsanforderung',
'sales_order' => 'Kundenauftrag',
'sales_quotation' => 'Verkaufsangebot',
+ 'wrongformat' => 'Falsches Format',
};
$self->{subs} = {