Revision ddf6b218
Von Philip Reetz vor fast 17 Jahren hinzugefügt
bin/mozilla/rp.pl | ||
---|---|---|
586 | 586 |
|
587 | 587 |
if ($form->{report} eq "trial_balance") { |
588 | 588 |
print qq| |
589 |
<tr> |
|
590 |
<th align=right nowrap>| . $locale->text('Project') . qq|</th> |
|
591 |
<td colspan=3>$projectnumber</td> |
|
592 |
</tr> |
|
589 | 593 |
<input type=hidden name=nextsub value=generate_trial_balance> |
590 |
<input type=hidden name=eur value=$eur> |
|
591 |
<tr> |
|
592 |
<th align=right>| . $locale->text('From') . qq|</th> |
|
593 |
<td> |
|
594 |
$button1 |
|
595 |
$button1_2 |
|
596 |
</td> |
|
597 |
<th align=right>| . $locale->text('Bis') . qq|</th> |
|
598 |
<td> |
|
599 |
$button2 |
|
600 |
$button2_2 |
|
601 |
</td> |
|
594 |
</table> |
|
595 |
<table> |
|
596 |
<tr> |
|
597 |
<th align=left><input name=reporttype class=radio type=radio value="custom" checked> | |
|
598 |
. $locale->text('Customized Report') . qq|</th> |
|
602 | 599 |
</tr> |
603 |
</table> |
|
604 |
</td> |
|
605 |
</tr> |
|
606 |
<tr> |
|
607 |
<td> |
|
608 |
<table> |
|
609 | 600 |
<tr> |
610 |
<th align=right nowrap>| . $locale->text('Include in Report') . qq|</th> |
|
611 |
<td><input name=l_heading class=checkbox type=checkbox value=Y> | |
|
612 |
. $locale->text('Heading') . qq| |
|
613 |
<input name=l_subtotal class=checkbox type=checkbox value=Y> | |
|
614 |
. $locale->text('Subtotal') . qq| |
|
615 |
<input name=all_accounts class=checkbox type=checkbox value=Y> | |
|
616 |
. $locale->text('All Accounts') . qq|</td> |
|
601 |
<th colspan=1>| . $locale->text('Year') . qq|</th> |
|
602 |
<td><input name=year size=11 title="| |
|
603 |
. $locale->text('YYYY') . qq|" value="$year"></td> |
|
604 |
</tr> |
|
605 |
|; |
|
606 |
|
|
607 |
print qq| |
|
608 |
<tr> |
|
609 |
<td align=right> |
|
610 |
<b> | . $locale->text('Yearly') . qq|</b> </td> |
|
611 |
<th align=left>| . $locale->text('Quarterly') . qq|</th> |
|
612 |
<th align=left colspan=3>| . $locale->text('Monthly') . qq|</th> |
|
613 |
</tr> |
|
614 |
<tr> |
|
615 |
<td align=right> <input name=duetyp class=radio type=radio value="13" |
|
616 |
$checked></td> |
|
617 |
<td><input name=duetyp class=radio type=radio value="A" $checked > 1. | |
|
618 |
. $locale->text('Quarter') . qq|</td> |
|
619 |
|; |
|
620 |
$checked = "checked"; |
|
621 |
print qq| |
|
622 |
<td><input name=duetyp class=radio type=radio value="1" $checked > | |
|
623 |
. $locale->text('January') . qq|</td> |
|
624 |
|; |
|
625 |
$checked = ""; |
|
626 |
print qq| |
|
627 |
<td><input name=duetyp class=radio type=radio value="5" $checked > | |
|
628 |
. $locale->text('May') . qq|</td> |
|
629 |
<td><input name=duetyp class=radio type=radio value="9" $checked > | |
|
630 |
. $locale->text('September') . qq|</td> |
|
631 |
|
|
632 |
</tr> |
|
633 |
<tr> |
|
634 |
<td align= right> </td> |
|
635 |
<td><input name=duetyp class=radio type=radio value="B" $checked> 2. | |
|
636 |
. $locale->text('Quarter') . qq|</td> |
|
637 |
<td><input name=duetyp class=radio type=radio value="2" $checked > | |
|
638 |
. $locale->text('February') . qq|</td> |
|
639 |
<td><input name=duetyp class=radio type=radio value="6" $checked > | |
|
640 |
. $locale->text('June') . qq|</td> |
|
641 |
<td><input name=duetyp class=radio type=radio value="10" $checked > | |
|
642 |
. $locale->text('October') . qq|</td> |
|
643 |
</tr> |
|
644 |
<tr> |
|
645 |
<td> </td> |
|
646 |
<td><input name=duetyp class=radio type=radio value="C" $checked> 3. | |
|
647 |
. $locale->text('Quarter') . qq|</td> |
|
648 |
<td><input name=duetyp class=radio type=radio value="3" $checked > | |
|
649 |
. $locale->text('March') . qq|</td> |
|
650 |
<td><input name=duetyp class=radio type=radio value="7" $checked > | |
|
651 |
. $locale->text('July') . qq|</td> |
|
652 |
<td><input name=duetyp class=radio type=radio value="11" $checked > | |
|
653 |
. $locale->text('November') . qq|</td> |
|
654 |
|
|
617 | 655 |
</tr> |
656 |
<tr> |
|
657 |
<td> </td> |
|
658 |
<td><input name=duetyp class=radio type=radio value="D" $checked> 4. | |
|
659 |
. $locale->text('Quarter') . qq| </td> |
|
660 |
<td><input name=duetyp class=radio type=radio value="4" $checked > | |
|
661 |
. $locale->text('April') . qq|</td> |
|
662 |
<td><input name=duetyp class=radio type=radio value="8" $checked > | |
|
663 |
. $locale->text('August') . qq|</td> |
|
664 |
<td><input name=duetyp class=radio type=radio value="12" $checked > | |
|
665 |
. $locale->text('December') . qq|</td> |
|
618 | 666 |
|
667 |
</tr> |
|
668 |
<tr> |
|
669 |
<td colspan=5><hr size=3 noshade></td> |
|
670 |
</tr> |
|
671 |
<tr> |
|
672 |
<th align=left><input name=reporttype class=radio type=radio value="free" $checked> | |
|
673 |
. $locale->text('Free report period') . qq|</th> |
|
674 |
<td align=left colspan=4>| . $locale->text('From') . qq| |
|
675 |
$button1 |
|
676 |
$button1_2 |
|
677 |
| . $locale->text('Bis') . qq| |
|
678 |
$button2 |
|
679 |
$button2_2 |
|
680 |
</td> |
|
681 |
</tr> |
|
682 |
<tr> |
|
683 |
<td colspan=5><hr size=3 noshade></td> |
|
684 |
</tr> |
|
685 |
<tr> |
|
686 |
<th align=leftt>| . $locale->text('Method') . qq|</th> |
|
687 |
<td colspan=3><input name=method class=radio type=radio value=accrual $accrual>| |
|
688 |
. $locale->text('Accrual') . qq| |
|
689 |
<input name=method class=radio type=radio value=cash $cash>| |
|
690 |
. $locale->text('EUR') . qq|</td> |
|
691 |
</tr> |
|
692 |
<tr> |
|
693 |
<th align=right colspan=4>| |
|
694 |
. $locale->text('All Accounts') |
|
695 |
. qq|</th> |
|
696 |
<td><input name=all_accounts type=checkbox value=1></td> |
|
697 |
</tr> |
|
698 |
<tr> |
|
699 |
<th align=right colspan=4>| |
|
700 |
. $locale->text('Decimalplaces') |
|
701 |
. qq|</th> |
|
702 |
<td><input name=decimalplaces size=3 value="2"></td> |
|
703 |
</tr> |
|
704 |
|
|
619 | 705 |
$jsscript |
620 | 706 |
|; |
621 | 707 |
} |
... | ... | |
1168 | 1254 |
|
1169 | 1255 |
$auth->assert('report'); |
1170 | 1256 |
|
1257 |
if ($form->{reporttype} eq "custom") { |
|
1258 |
|
|
1259 |
#forgotten the year --> thisyear |
|
1260 |
if ($form->{year} !~ m/^\d\d\d\d$/) { |
|
1261 |
$locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~ |
|
1262 |
/(\d\d\d\d)/; |
|
1263 |
$form->{year} = $1; |
|
1264 |
} |
|
1265 |
|
|
1266 |
#yearly report |
|
1267 |
if ($form->{duetyp} eq "13") { |
|
1268 |
$form->{fromdate} = "1.1.$form->{year}"; |
|
1269 |
$form->{todate} = "31.12.$form->{year}"; |
|
1270 |
} |
|
1271 |
|
|
1272 |
#Quater reports |
|
1273 |
if ($form->{duetyp} eq "A") { |
|
1274 |
$form->{fromdate} = "1.1.$form->{year}"; |
|
1275 |
$form->{todate} = "31.3.$form->{year}"; |
|
1276 |
} |
|
1277 |
if ($form->{duetyp} eq "B") { |
|
1278 |
$form->{fromdate} = "1.4.$form->{year}"; |
|
1279 |
$form->{todate} = "30.6.$form->{year}"; |
|
1280 |
} |
|
1281 |
if ($form->{duetyp} eq "C") { |
|
1282 |
$form->{fromdate} = "1.7.$form->{year}"; |
|
1283 |
$form->{todate} = "30.9.$form->{year}"; |
|
1284 |
} |
|
1285 |
if ($form->{duetyp} eq "D") { |
|
1286 |
$form->{fromdate} = "1.10.$form->{year}"; |
|
1287 |
$form->{todate} = "31.12.$form->{year}"; |
|
1288 |
} |
|
1289 |
|
|
1290 |
#Monthly reports |
|
1291 |
SWITCH: { |
|
1292 |
$form->{duetyp} eq "1" && do { |
|
1293 |
$form->{fromdate} = "1.1.$form->{year}"; |
|
1294 |
$form->{todate} = "31.1.$form->{year}"; |
|
1295 |
last SWITCH; |
|
1296 |
}; |
|
1297 |
$form->{duetyp} eq "2" && do { |
|
1298 |
$form->{fromdate} = "1.2.$form->{year}"; |
|
1299 |
|
|
1300 |
#this works from 1901 to 2099, 1900 and 2100 fail. |
|
1301 |
$leap = ($form->{year} % 4 == 0) ? "29" : "28"; |
|
1302 |
$form->{todate} = "$leap.2.$form->{year}"; |
|
1303 |
last SWITCH; |
|
1304 |
}; |
|
1305 |
$form->{duetyp} eq "3" && do { |
|
1306 |
$form->{fromdate} = "1.3.$form->{year}"; |
|
1307 |
$form->{todate} = "31.3.$form->{year}"; |
|
1308 |
last SWITCH; |
|
1309 |
}; |
|
1310 |
$form->{duetyp} eq "4" && do { |
|
1311 |
$form->{fromdate} = "1.4.$form->{year}"; |
|
1312 |
$form->{todate} = "30.4.$form->{year}"; |
|
1313 |
last SWITCH; |
|
1314 |
}; |
|
1315 |
$form->{duetyp} eq "5" && do { |
|
1316 |
$form->{fromdate} = "1.5.$form->{year}"; |
|
1317 |
$form->{todate} = "31.5.$form->{year}"; |
|
1318 |
last SWITCH; |
|
1319 |
}; |
|
1320 |
$form->{duetyp} eq "6" && do { |
|
1321 |
$form->{fromdate} = "1.6.$form->{year}"; |
|
1322 |
$form->{todate} = "30.6.$form->{year}"; |
|
1323 |
last SWITCH; |
|
1324 |
}; |
|
1325 |
$form->{duetyp} eq "7" && do { |
|
1326 |
$form->{fromdate} = "1.7.$form->{year}"; |
|
1327 |
$form->{todate} = "31.7.$form->{year}"; |
|
1328 |
last SWITCH; |
|
1329 |
}; |
|
1330 |
$form->{duetyp} eq "8" && do { |
|
1331 |
$form->{fromdate} = "1.8.$form->{year}"; |
|
1332 |
$form->{todate} = "31.8.$form->{year}"; |
|
1333 |
last SWITCH; |
|
1334 |
}; |
|
1335 |
$form->{duetyp} eq "9" && do { |
|
1336 |
$form->{fromdate} = "1.9.$form->{year}"; |
|
1337 |
$form->{todate} = "30.9.$form->{year}"; |
|
1338 |
last SWITCH; |
|
1339 |
}; |
|
1340 |
$form->{duetyp} eq "10" && do { |
|
1341 |
$form->{fromdate} = "1.10.$form->{year}"; |
|
1342 |
$form->{todate} = "31.10.$form->{year}"; |
|
1343 |
last SWITCH; |
|
1344 |
}; |
|
1345 |
$form->{duetyp} eq "11" && do { |
|
1346 |
$form->{fromdate} = "1.11.$form->{year}"; |
|
1347 |
$form->{todate} = "30.11.$form->{year}"; |
|
1348 |
last SWITCH; |
|
1349 |
}; |
|
1350 |
$form->{duetyp} eq "12" && do { |
|
1351 |
$form->{fromdate} = "1.12.$form->{year}"; |
|
1352 |
$form->{todate} = "31.12.$form->{year}"; |
|
1353 |
last SWITCH; |
|
1354 |
}; |
|
1355 |
} |
|
1356 |
} |
|
1357 |
|
|
1358 |
|
|
1171 | 1359 |
# get for each account initial balance, debits and credits |
1172 | 1360 |
RP->trial_balance(\%myconfig, \%$form); |
1173 | 1361 |
|
1174 |
$form->{nextsub} = "generate_trial_balance"; |
|
1175 |
$form->{title} = $locale->text('Trial Balance'); |
|
1176 |
list_accounts('generate_trial_balance'); |
|
1362 |
|
|
1363 |
$form->{rowcount} = scalar @{ $form->{TB} }; |
|
1364 |
|
|
1365 |
my @columns = ( |
|
1366 |
"accno", "description", |
|
1367 |
"last_transaction", "soll_eb", |
|
1368 |
"haben_eb", |
|
1369 |
"soll", "haben", |
|
1370 |
"soll_kumuliert", "haben_kumuliert", |
|
1371 |
"soll_saldo", "haben_saldo" |
|
1372 |
); |
|
1373 |
|
|
1374 |
|
|
1375 |
my $attachment_basename; |
|
1376 |
|
|
1377 |
my $report = SL::ReportGenerator->new(\%myconfig, $form); |
|
1378 |
|
|
1379 |
my @hidden_variables = (); |
|
1380 |
push @hidden_variables, qw(fromdate todate year cash ); |
|
1381 |
|
|
1382 |
my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables); |
|
1383 |
|
|
1384 |
my %column_defs = ( |
|
1385 |
'accno' => { 'text' => $locale->text('Account Number'), }, |
|
1386 |
'description' => { 'text' => $locale->text('Description'), }, |
|
1387 |
'last_transaction' => { 'text' => $locale->text('Last Transaction'), }, |
|
1388 |
'soll_eb' => { 'text' => $locale->text('Debit Starting Balance'), }, |
|
1389 |
'haben_eb' => { 'text' => $locale->text('Credit Starting Balance'), }, |
|
1390 |
'soll' => { 'text' => $locale->text('Debit'), }, |
|
1391 |
'haben' => { 'text' => $locale->text('Credit'), }, |
|
1392 |
'soll_kumuliert' => { 'text' => $locale->text('Sum Debit'), }, |
|
1393 |
'haben_kumuliert' => { 'text' => $locale->text('Sum Credit'), }, |
|
1394 |
'soll_saldo' => { 'text' => $locale->text('Saldo Debit'), }, |
|
1395 |
'haben_saldo' => { 'text' => $locale->text('Saldo Credit'), } |
|
1396 |
); |
|
1397 |
|
|
1398 |
|
|
1399 |
|
|
1400 |
my %column_alignment = map { $_ => 'right' } qw(soll_eb haben_eb soll haben soll_kumuliert haben_kumuliert soll_saldo haben_saldo); |
|
1401 |
|
|
1402 |
map { $column_defs{$_}->{visible} = 1 } @columns; |
|
1403 |
|
|
1404 |
$report->set_columns(%column_defs); |
|
1405 |
$report->set_column_order(@columns); |
|
1406 |
|
|
1407 |
$report->set_export_options('trial_balance', @hidden_variables); |
|
1408 |
|
|
1409 |
$report->set_sort_indicator($form->{sort}, 1); |
|
1410 |
|
|
1411 |
my @options; |
|
1412 |
|
|
1413 |
|
|
1414 |
$form->{template_fromto} = $locale->date(\%myconfig, $form->{fromdate}, 0) . " - " . $locale->date(\%myconfig, $form->{todate}, 0); |
|
1415 |
$form->{template_to} = $locale->date(\%myconfig, $form->{todate}, 0); |
|
1416 |
|
|
1417 |
$report->set_options('output_format' => 'HTML', |
|
1418 |
'title' => $form->{title}, |
|
1419 |
'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), |
|
1420 |
); |
|
1421 |
$report->set_options_from_form(); |
|
1422 |
# $form->parse_html_template('report_generator/html_report_susa', $variables)); |
|
1423 |
$form->{report_template} = 'report_generator/html_report_susa'; |
|
1424 |
# add sort and escape callback, this one we use for the add sub |
|
1425 |
$form->{callback} = $href .= "&sort=$form->{sort}"; |
|
1426 |
|
|
1427 |
# escape callback for href |
|
1428 |
$callback = $form->escape($href); |
|
1429 |
|
|
1430 |
my @subtotal_columns = qw(soll_eb haben_eb soll haben soll_kumuliert haben_kumuliert soll_saldo haben_saldo); |
|
1431 |
|
|
1432 |
my %totals = map { $_ => 0 } @subtotal_columns; |
|
1433 |
|
|
1434 |
my $edit_url = build_std_url('action=edit', 'type', 'vc'); |
|
1435 |
|
|
1436 |
foreach $accno (@{ $form->{TB} }) { |
|
1437 |
|
|
1438 |
$accno->{soll} = $accno->{debit}; |
|
1439 |
$accno->{haben} = $accno->{credit}; |
|
1440 |
map { $totals{$_} += $accno->{$_} } @subtotal_columns; |
|
1441 |
|
|
1442 |
map { $accno->{$_} = $form->format_amount(\%myconfig, $accno->{$_}, 2) } qw(soll_eb haben_eb soll haben soll_kumuliert haben_kumuliert soll_saldo haben_saldo); |
|
1443 |
|
|
1444 |
map { $accno->{$_} = ($accno->{$_} == 0) ? '' : $accno->{$_} } qw(soll_eb haben_eb soll haben soll_kumuliert haben_kumuliert soll_saldo haben_saldo); |
|
1445 |
|
|
1446 |
my $row = { }; |
|
1447 |
|
|
1448 |
foreach my $column (@columns) { |
|
1449 |
$row->{$column} = { |
|
1450 |
'data' => $accno->{$column}, |
|
1451 |
'align' => $column_alignment{$column}, |
|
1452 |
}; |
|
1453 |
} |
|
1454 |
|
|
1455 |
|
|
1456 |
$row->{$ordnumber}->{link} = $edit_url . "&id=" . E($oe->{id}) . "&callback=${callback}"; |
|
1457 |
|
|
1458 |
my $row_set = [ $row ]; |
|
1459 |
|
|
1460 |
|
|
1461 |
$report->add_data($row_set); |
|
1462 |
|
|
1463 |
$idx++; |
|
1464 |
} |
|
1465 |
|
|
1466 |
$report->add_separator(); |
|
1467 |
|
|
1468 |
$report->add_data(create_subtotal_row(\%totals, \@columns, \%column_alignment, \@subtotal_columns, 'listtotal')); |
|
1469 |
|
|
1470 |
$report->generate_with_headers(); |
|
1471 |
|
|
1472 |
$lxdebug->leave_sub(); |
|
1473 |
|
|
1474 |
} |
|
1475 |
|
|
1476 |
sub create_subtotal_row { |
|
1477 |
$lxdebug->enter_sub(); |
|
1478 |
|
|
1479 |
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_; |
|
1480 |
|
|
1481 |
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } }; |
|
1482 |
|
|
1483 |
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns }; |
|
1484 |
|
|
1485 |
$row->{tax}->{data} = $form->format_amount(\%myconfig, $totals->{amount} - $totals->{netamount}, 2); |
|
1486 |
|
|
1487 |
map { $totals->{$_} = 0 } @{ $subtotal_columns }; |
|
1177 | 1488 |
|
1178 | 1489 |
$lxdebug->leave_sub(); |
1490 |
|
|
1491 |
return $row; |
|
1179 | 1492 |
} |
1180 | 1493 |
|
1181 | 1494 |
sub create_list_accounts_subtotal_row { |
Auch abrufbar als: Unified diff
Umbau der bisherigen Saldenbilanz zu einer richtigen Summen- Saldenliste unter Benutzung des
Reportgenerator Frameworks