Revision 971c9727
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
bin/mozilla/ar.pl | ||
---|---|---|
31 | 31 |
# |
32 | 32 |
#====================================================================== |
33 | 33 |
|
34 |
use POSIX qw(strftime); |
|
35 |
|
|
34 | 36 |
use SL::AR; |
35 | 37 |
use SL::IS; |
36 | 38 |
use SL::PE; |
37 |
use Data::Dumper;
|
|
39 |
use SL::ReportGenerator;
|
|
38 | 40 |
|
39 | 41 |
require "bin/mozilla/arap.pl"; |
40 | 42 |
require "bin/mozilla/common.pl"; |
41 | 43 |
require "bin/mozilla/drafts.pl"; |
44 |
require "bin/mozilla/report_generator.pl"; |
|
42 | 45 |
|
43 | 46 |
1; |
44 | 47 |
|
... | ... | |
1352 | 1355 |
$lxdebug->leave_sub(); |
1353 | 1356 |
} |
1354 | 1357 |
|
1358 |
sub create_subtotal_row { |
|
1359 |
$lxdebug->enter_sub(); |
|
1360 |
|
|
1361 |
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_; |
|
1362 |
|
|
1363 |
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } }; |
|
1364 |
|
|
1365 |
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns }; |
|
1366 |
|
|
1367 |
$row->{tax}->{data} = $form->format_amount(\%myconfig, $totals->{amount} - $totals->{netamount}, 2); |
|
1368 |
|
|
1369 |
map { $totals->{$_} = 0 } @{ $subtotal_columns }; |
|
1370 |
|
|
1371 |
$lxdebug->leave_sub(); |
|
1372 |
|
|
1373 |
return $row; |
|
1374 |
} |
|
1375 |
|
|
1355 | 1376 |
sub ar_transactions { |
1356 | 1377 |
$lxdebug->enter_sub(); |
1357 | 1378 |
|
1358 |
$form->{customer} = $form->unescape($form->{customer}); |
|
1359 | 1379 |
($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer}); |
1360 | 1380 |
|
1381 |
$form->{sort} ||= 'transdate'; |
|
1382 |
|
|
1361 | 1383 |
AR->ar_transactions(\%myconfig, \%$form); |
1362 | 1384 |
|
1363 |
$callback = |
|
1364 |
"$form->{script}?action=ar_transactions&login=$form->{login}&password=$form->{password}"; |
|
1365 |
$href = $callback; |
|
1385 |
$form->{title} = $locale->text('AR Transactions'); |
|
1386 |
|
|
1387 |
my $report = SL::ReportGenerator->new(\%myconfig, $form); |
|
1388 |
|
|
1389 |
my @columns = |
|
1390 |
qw(transdate id type invnumber ordnumber name netamount tax amount paid |
|
1391 |
datepaid due duedate transaction_description notes employee shippingpoint shipvia |
|
1392 |
globalprojectnumber); |
|
1393 |
|
|
1394 |
my @hidden_variables = map { "l_${_}" } @columns; |
|
1395 |
push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber activity_description notes project_id transdatefrom transdateto); |
|
1396 |
|
|
1397 |
my $href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables); |
|
1398 |
|
|
1399 |
my %column_defs = ( |
|
1400 |
'transdate' => { 'text' => $locale->text('Date'), }, |
|
1401 |
'id' => { 'text' => $locale->text('ID'), }, |
|
1402 |
'type' => { 'text' => $locale->text('Type'), }, |
|
1403 |
'invnumber' => { 'text' => $locale->text('Invoice'), }, |
|
1404 |
'ordnumber' => { 'text' => $locale->text('Order'), }, |
|
1405 |
'name' => { 'text' => $locale->text('Customer'), }, |
|
1406 |
'netamount' => { 'text' => $locale->text('Amount'), }, |
|
1407 |
'tax' => { 'text' => $locale->text('Tax'), }, |
|
1408 |
'amount' => { 'text' => $locale->text('Total'), }, |
|
1409 |
'paid' => { 'text' => $locale->text('Paid'), }, |
|
1410 |
'datepaid' => { 'text' => $locale->text('Date Paid'), }, |
|
1411 |
'due' => { 'text' => $locale->text('Amount Due'), }, |
|
1412 |
'duedate' => { 'text' => $locale->text('Due Date'), }, |
|
1413 |
'transaction_description' => { 'text' => $locale->text('Transaction description'), }, |
|
1414 |
'notes' => { 'text' => $locale->text('Notes'), }, |
|
1415 |
'employee' => { 'text' => $locale->text('Salesperson'), }, |
|
1416 |
'shippingpoint' => { 'text' => $locale->text('Shipping Point'), }, |
|
1417 |
'shipvia' => { 'text' => $locale->text('Ship via'), }, |
|
1418 |
'globalprojectnumber' => { 'text' => $locale->text('Project Number'), }, |
|
1419 |
); |
|
1420 |
|
|
1421 |
foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid |
|
1422 |
employee shippingpoint shipvia)) { |
|
1423 |
$column_defs{$name}->{link} = $href . "&sort=$name"; |
|
1424 |
} |
|
1425 |
|
|
1426 |
my %column_alignment = map { $_ => 'right' } qw(netamount tax amount paid due); |
|
1427 |
|
|
1428 |
$form->{"l_type"} = "Y"; |
|
1429 |
map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns; |
|
1366 | 1430 |
|
1431 |
$report->set_columns(%column_defs); |
|
1432 |
$report->set_column_order(@columns); |
|
1433 |
|
|
1434 |
$report->set_export_options('ar_transactions', @hidden_variables); |
|
1435 |
|
|
1436 |
my @options; |
|
1367 | 1437 |
if ($form->{customer}) { |
1368 |
$callback .= "&customer=" . $form->escape($form->{customer}, 1); |
|
1369 |
$href .= "&customer=" . $form->escape($form->{customer}); |
|
1370 |
$option = $locale->text('Customer') . " : $form->{customer}"; |
|
1438 |
push @options, $locale->text('Customer') . " : $form->{customer}"; |
|
1371 | 1439 |
} |
1372 | 1440 |
if ($form->{department}) { |
1373 |
$callback .= "&department=" . $form->escape($form->{department}, 1); |
|
1374 |
$href .= "&department=" . $form->escape($form->{department}); |
|
1375 | 1441 |
($department) = split /--/, $form->{department}; |
1376 |
$option .= "\n<br>" if ($option); |
|
1377 |
$option .= $locale->text('Department') . " : $department"; |
|
1442 |
push @options, $locale->text('Department') . " : $department"; |
|
1378 | 1443 |
} |
1379 | 1444 |
if ($form->{invnumber}) { |
1380 |
$callback .= "&invnumber=" . $form->escape($form->{invnumber}, 1); |
|
1381 |
$href .= "&invnumber=" . $form->escape($form->{invnumber}); |
|
1382 |
$option .= "\n<br>" if ($option); |
|
1383 |
$option .= $locale->text('Invoice Number') . " : $form->{invnumber}"; |
|
1445 |
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}"; |
|
1384 | 1446 |
} |
1385 | 1447 |
if ($form->{ordnumber}) { |
1386 |
$callback .= "&ordnumber=" . $form->escape($form->{ordnumber}, 1); |
|
1387 |
$href .= "&ordnumber=" . $form->escape($form->{ordnumber}); |
|
1388 |
$option .= "\n<br>" if ($option); |
|
1389 |
$option .= $locale->text('Order Number') . " : $form->{ordnumber}"; |
|
1448 |
push @options, $locale->text('Order Number') . " : $form->{ordnumber}"; |
|
1390 | 1449 |
} |
1391 | 1450 |
if ($form->{notes}) { |
1392 |
$callback .= "¬es=" . $form->escape($form->{notes}, 1); |
|
1393 |
$href .= "¬es=" . $form->escape($form->{notes}); |
|
1394 |
$option .= "\n<br>" if $option; |
|
1395 |
$option .= $locale->text('Notes') . " : $form->{notes}"; |
|
1451 |
push @options, $locale->text('Notes') . " : $form->{notes}"; |
|
1396 | 1452 |
} |
1397 | 1453 |
if ($form->{transaction_description}) { |
1398 |
$callback .= "&transaction_description=" . $form->escape($form->{transaction_description}, 1); |
|
1399 |
$href .= "&transaction_description=" . $form->escape($form->{transaction_description}); |
|
1400 |
$option .= "\n<br>" if $option; |
|
1401 |
$option .= $locale->text('Transaction description') . " : $form->{transaction_description}"; |
|
1454 |
push @options, $locale->text('Transaction description') . " : $form->{transaction_description}"; |
|
1402 | 1455 |
} |
1403 |
|
|
1404 | 1456 |
if ($form->{transdatefrom}) { |
1405 |
$callback .= "&transdatefrom=$form->{transdatefrom}"; |
|
1406 |
$href .= "&transdatefrom=$form->{transdatefrom}"; |
|
1407 |
$option .= "\n<br>" if ($option); |
|
1408 |
$option .= |
|
1409 |
$locale->text('From') . " " |
|
1410 |
. $locale->date(\%myconfig, $form->{transdatefrom}, 1); |
|
1457 |
push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1); |
|
1411 | 1458 |
} |
1412 | 1459 |
if ($form->{transdateto}) { |
1413 |
$callback .= "&transdateto=$form->{transdateto}"; |
|
1414 |
$href .= "&transdateto=$form->{transdateto}"; |
|
1415 |
$option .= "\n<br>" if ($option); |
|
1416 |
$option .= |
|
1417 |
$locale->text('Bis') . " " |
|
1418 |
. $locale->date(\%myconfig, $form->{transdateto}, 1); |
|
1460 |
push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1); |
|
1419 | 1461 |
} |
1420 | 1462 |
if ($form->{open}) { |
1421 |
$callback .= "&open=$form->{open}"; |
|
1422 |
$href .= "&open=$form->{open}"; |
|
1423 |
$option .= "\n<br>" if ($option); |
|
1424 |
$option .= $locale->text('Open'); |
|
1463 |
push @options, $locale->text('Open'); |
|
1425 | 1464 |
} |
1426 | 1465 |
if ($form->{closed}) { |
1427 |
$callback .= "&closed=$form->{closed}"; |
|
1428 |
$href .= "&closed=$form->{closed}"; |
|
1429 |
$option .= "\n<br>" if ($option); |
|
1430 |
$option .= $locale->text('Closed'); |
|
1431 |
} |
|
1432 |
if ($form->{globalproject_id}) { |
|
1433 |
$callback .= "&globalproject_id=" . E($form->{globalproject_id}); |
|
1434 |
$href .= "&globalproject_id=" . E($form->{globalproject_id}); |
|
1466 |
push @options, $locale->text('Closed'); |
|
1435 | 1467 |
} |
1436 | 1468 |
|
1437 |
@columns = |
|
1438 |
qw(transdate id type invnumber ordnumber name netamount tax amount paid |
|
1439 |
datepaid due duedate transaction_description notes employee shippingpoint shipvia |
|
1440 |
globalprojectnumber); |
|
1441 |
|
|
1442 |
$form->{"l_type"} = "Y"; |
|
1443 |
|
|
1444 |
foreach $item (@columns) { |
|
1445 |
if ($form->{"l_$item"} eq "Y") { |
|
1446 |
push @column_index, $item; |
|
1447 |
|
|
1448 |
# add column to href and callback |
|
1449 |
$callback .= "&l_$item=Y"; |
|
1450 |
$href .= "&l_$item=Y"; |
|
1451 |
} |
|
1452 |
} |
|
1453 |
|
|
1454 |
if ($form->{l_subtotal} eq 'Y') { |
|
1455 |
$callback .= "&l_subtotal=Y"; |
|
1456 |
$href .= "&l_subtotal=Y"; |
|
1457 |
} |
|
1458 |
|
|
1459 |
$column_header{id} = |
|
1460 |
"<th><a class=listheading href=$href&sort=id>" |
|
1461 |
. $locale->text('ID') |
|
1462 |
. "</a></th>"; |
|
1463 |
$column_header{transdate} = |
|
1464 |
"<th><a class=listheading href=$href&sort=transdate>" |
|
1465 |
. $locale->text('Date') |
|
1466 |
. "</a></th>"; |
|
1467 |
$column_header{duedate} = |
|
1468 |
"<th><a class=listheading href=$href&sort=duedate>" |
|
1469 |
. $locale->text('Due Date') |
|
1470 |
. "</a></th>"; |
|
1471 |
$column_header{type} = |
|
1472 |
"<th class=\"listheading\">" . $locale->text('Type') . "</th>"; |
|
1473 |
$column_header{invnumber} = |
|
1474 |
"<th><a class=listheading href=$href&sort=invnumber>" |
|
1475 |
. $locale->text('Invoice') |
|
1476 |
. "</a></th>"; |
|
1477 |
$column_header{ordnumber} = |
|
1478 |
"<th><a class=listheading href=$href&sort=ordnumber>" |
|
1479 |
. $locale->text('Order') |
|
1480 |
. "</a></th>"; |
|
1481 |
$column_header{name} = |
|
1482 |
"<th><a class=listheading href=$href&sort=name>" |
|
1483 |
. $locale->text('Customer') |
|
1484 |
. "</a></th>"; |
|
1485 |
$column_header{netamount} = |
|
1486 |
"<th class=listheading>" . $locale->text('Amount') . "</th>"; |
|
1487 |
$column_header{tax} = |
|
1488 |
"<th class=listheading>" . $locale->text('Tax') . "</th>"; |
|
1489 |
$column_header{amount} = |
|
1490 |
"<th class=listheading>" . $locale->text('Total') . "</th>"; |
|
1491 |
$column_header{paid} = |
|
1492 |
"<th class=listheading>" . $locale->text('Paid') . "</th>"; |
|
1493 |
$column_header{datepaid} = |
|
1494 |
"<th><a class=listheading href=$href&sort=datepaid>" |
|
1495 |
. $locale->text('Date Paid') |
|
1496 |
. "</a></th>"; |
|
1497 |
$column_header{due} = |
|
1498 |
"<th class=listheading>" . $locale->text('Amount Due') . "</th>"; |
|
1499 |
$column_header{notes} = |
|
1500 |
"<th class=listheading>" . $locale->text('Notes') . "</th>"; |
|
1501 |
$column_header{employee} = |
|
1502 |
"<th><a class=listheading href=$href&sort=employee>" |
|
1503 |
. $locale->text('Salesperson') . "</th>"; |
|
1504 |
|
|
1505 |
$column_header{shippingpoint} = |
|
1506 |
"<th><a class=listheading href=$href&sort=shippingpoint>" |
|
1507 |
. $locale->text('Shipping Point') |
|
1508 |
. "</a></th>"; |
|
1509 |
$column_header{shipvia} = |
|
1510 |
"<th><a class=listheading href=$href&sort=shipvia>" |
|
1511 |
. $locale->text('Ship via') |
|
1512 |
. "</a></th>"; |
|
1513 |
$column_header{globalprojectnumber} = |
|
1514 |
qq|<th class="listheading">| . $locale->text('Project Number') . qq|</th>|; |
|
1515 |
$column_header{transaction_description} = |
|
1516 |
"<th class=listheading>" . $locale->text('Transaction description') . "</th>"; |
|
1517 |
|
|
1518 |
$form->{title} = $locale->text('AR Transactions'); |
|
1519 |
|
|
1520 |
$form->header; |
|
1521 |
|
|
1522 |
print qq| |
|
1523 |
<body> |
|
1524 |
|
|
1525 |
<table width=100%> |
|
1526 |
<tr> |
|
1527 |
<th class=listtop>$form->{title}</th> |
|
1528 |
</tr> |
|
1529 |
<tr height="5"></tr> |
|
1530 |
<tr> |
|
1531 |
<td>$option</td> |
|
1532 |
</tr> |
|
1533 |
<tr> |
|
1534 |
<td> |
|
1535 |
<table width=100%> |
|
1536 |
<tr class=listheading> |
|
1537 |
|; |
|
1538 |
|
|
1539 |
map { print "\n$column_header{$_}" } @column_index; |
|
1540 |
|
|
1541 |
print qq| |
|
1542 |
</tr> |
|
1543 |
|; |
|
1469 |
$report->set_options('top_info_text' => join("\n", @options), |
|
1470 |
'raw_bottom_info_text' => $form->parse_html_template('ar/ar_transactions_bottom'), |
|
1471 |
'output_format' => 'HTML', |
|
1472 |
'title' => $form->{title}, |
|
1473 |
'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time), |
|
1474 |
); |
|
1475 |
$report->set_options_from_form(); |
|
1544 | 1476 |
|
1545 | 1477 |
# add sort and escape callback, this one we use for the add sub |
1546 |
$form->{callback} = $callback .= "&sort=$form->{sort}";
|
|
1478 |
$form->{callback} = $href .= "&sort=$form->{sort}";
|
|
1547 | 1479 |
|
1548 | 1480 |
# escape callback for href |
1549 |
$callback = $form->escape($callback); |
|
1550 |
|
|
1551 |
if (@{ $form->{AR} }) { |
|
1552 |
$sameitem = $form->{AR}->[0]->{ $form->{sort} }; |
|
1553 |
} |
|
1554 |
|
|
1555 |
# sums and tax on reports by Antonio Gallardo |
|
1556 |
# |
|
1557 |
foreach $ar (@{ $form->{AR} }) { |
|
1558 |
|
|
1559 |
if ($form->{l_subtotal} eq 'Y') { |
|
1560 |
if ($sameitem ne $ar->{ $form->{sort} }) { |
|
1561 |
&ar_subtotal; |
|
1562 |
} |
|
1563 |
} |
|
1481 |
$callback = $form->escape($href); |
|
1564 | 1482 |
|
1565 |
$column_data{netamount} = |
|
1566 |
"<td align=right>" |
|
1567 |
. $form->format_amount(\%myconfig, $ar->{netamount}, 2, " ") |
|
1568 |
. "</td>"; |
|
1569 |
$column_data{tax} = "<td align=right>" |
|
1570 |
. $form->format_amount(\%myconfig, $ar->{amount} - $ar->{netamount}, |
|
1571 |
2, " ") |
|
1572 |
. "</td>"; |
|
1573 |
$column_data{amount} = |
|
1574 |
"<td align=right>" |
|
1575 |
. $form->format_amount(\%myconfig, $ar->{amount}, 2, " ") . "</td>"; |
|
1576 |
$column_data{paid} = |
|
1577 |
"<td align=right>" |
|
1578 |
. $form->format_amount(\%myconfig, $ar->{paid}, 2, " ") . "</td>"; |
|
1579 |
$column_data{due} = "<td align=right>" |
|
1580 |
. $form->format_amount(\%myconfig, $ar->{amount} - $ar->{paid}, |
|
1581 |
2, " ") |
|
1582 |
. "</td>"; |
|
1483 |
my @subtotal_columns = qw(netamount amount paid due); |
|
1583 | 1484 |
|
1584 |
$subtotalnetamount += $ar->{netamount}; |
|
1585 |
$subtotalamount += $ar->{amount}; |
|
1586 |
$subtotalpaid += $ar->{paid}; |
|
1587 |
$subtotaldue += $ar->{amount} - $ar->{paid}; |
|
1485 |
my %totals = map { $_ => 0 } @subtotal_columns; |
|
1486 |
my %subtotals = map { $_ => 0 } @subtotal_columns; |
|
1588 | 1487 |
|
1589 |
$totalnetamount += $ar->{netamount}; |
|
1590 |
$totalamount += $ar->{amount}; |
|
1591 |
$totalpaid += $ar->{paid}; |
|
1592 |
$totaldue += ($ar->{amount} - $ar->{paid}); |
|
1488 |
my $idx = 0; |
|
1593 | 1489 |
|
1594 |
$column_data{transdate} = "<td>$ar->{transdate} </td>"; |
|
1595 |
$column_data{id} = "<td>$ar->{id}</td>"; |
|
1596 |
$column_data{datepaid} = "<td>$ar->{datepaid} </td>"; |
|
1597 |
$column_data{duedate} = "<td>$ar->{duedate} </td>"; |
|
1490 |
foreach $ar (@{ $form->{AR} }) { |
|
1491 |
$ar->{tax} = $ar->{amount} - $ar->{netamount}; |
|
1492 |
$ar->{due} = $ar->{amount} - $ar->{paid}; |
|
1598 | 1493 |
|
1599 |
$module = ($ar->{invoice}) ? "is.pl" : $form->{script}; |
|
1494 |
map { $subtotals{$_} += $ar->{$_}; |
|
1495 |
$totals{$_} += $ar->{$_} } @subtotal_columns; |
|
1600 | 1496 |
|
1601 |
$column_data{invnumber} = |
|
1602 |
"<td><a href=$module?action=edit&id=$ar->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}</a></td>"; |
|
1497 |
map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due); |
|
1603 | 1498 |
|
1604 | 1499 |
my $is_storno = $ar->{storno} && IS->is_storno(\%myconfig, $form, 'ar'); |
1605 | 1500 |
my $has_storno = $ar->{storno} && !$is_storno; |
1606 | 1501 |
|
1607 |
$column_data{type} = "<td>" . |
|
1608 |
($has_storno ? $locale->text("Invoice with Storno (abbreviation)") : |
|
1609 |
$is_storno ? $locale->text("Storno (one letter abbreviation)") : |
|
1610 |
$ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") : |
|
1611 |
$ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") : |
|
1612 |
$locale->text("AR Transaction (abbreviation)")) |
|
1613 |
. "</td>"; |
|
1614 |
$column_data{ordnumber} = "<td>$ar->{ordnumber} </td>"; |
|
1615 |
$column_data{name} = "<td>$ar->{name}</td>"; |
|
1616 |
$ar->{notes} =~ s/\r\n/<br>/g; |
|
1617 |
$column_data{notes} = "<td>$ar->{notes} </td>"; |
|
1618 |
$column_data{shippingpoint} = "<td>$ar->{shippingpoint} </td>"; |
|
1619 |
$column_data{shipvia} = "<td>$ar->{shipvia} </td>"; |
|
1620 |
$column_data{employee} = "<td>$ar->{employee} </td>"; |
|
1621 |
$column_data{globalprojectnumber} = |
|
1622 |
"<td>" . H($ar->{globalprojectnumber}) . "</td>"; |
|
1623 |
$column_data{transaction_description} = |
|
1624 |
"<td>" . H($ar->{transaction_description}) . "</td>"; |
|
1625 |
|
|
1626 |
$i++; |
|
1627 |
$i %= 2; |
|
1628 |
print " |
|
1629 |
<tr class=listrow$i> |
|
1630 |
"; |
|
1631 |
|
|
1632 |
map { print "\n$column_data{$_}" } @column_index; |
|
1633 |
|
|
1634 |
print qq| |
|
1635 |
</tr> |
|
1636 |
|; |
|
1637 |
|
|
1638 |
} |
|
1639 |
|
|
1640 |
if ($form->{l_subtotal} eq 'Y') { |
|
1641 |
&ar_subtotal; |
|
1642 |
} |
|
1643 |
|
|
1644 |
# print totals |
|
1645 |
print qq| |
|
1646 |
<tr class=listtotal> |
|
1647 |
|; |
|
1648 |
|
|
1649 |
map { $column_data{$_} = "<td> </td>" } @column_index; |
|
1650 |
|
|
1651 |
$column_data{netamount} = |
|
1652 |
"<th class=listtotal align=right>" |
|
1653 |
. $form->format_amount(\%myconfig, $totalnetamount, 2, " ") . "</th>"; |
|
1654 |
$column_data{tax} = "<th class=listtotal align=right>" |
|
1655 |
. $form->format_amount(\%myconfig, $totalamount - $totalnetamount, |
|
1656 |
2, " ") |
|
1657 |
. "</th>"; |
|
1658 |
$column_data{amount} = |
|
1659 |
"<th class=listtotal align=right>" |
|
1660 |
. $form->format_amount(\%myconfig, $totalamount, 2, " ") . "</th>"; |
|
1661 |
$column_data{paid} = |
|
1662 |
"<th class=listtotal align=right>" |
|
1663 |
. $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "</th>"; |
|
1664 |
$column_data{due} = |
|
1665 |
"<th class=listtotal align=right>" |
|
1666 |
. $form->format_amount(\%myconfig, $totaldue, 2, " ") . "</th>"; |
|
1667 |
|
|
1668 |
map { print "\n$column_data{$_}" } @column_index; |
|
1669 |
|
|
1670 |
print qq| |
|
1671 |
</tr> |
|
1672 |
</table> |
|
1673 |
</td> |
|
1674 |
</tr> |
|
1675 |
<tr> |
|
1676 |
<td><hr size=3 noshade></td> |
|
1677 |
</tr> |
|
1678 |
</table> |
|
1679 |
|
|
1680 |
<br> |
|
1681 |
<form method=post action=$form->{script}> |
|
1682 |
|
|
1683 |
<input name=callback type=hidden value="$form->{callback}"> |
|
1684 |
|
|
1685 |
<input type=hidden name=login value=$form->{login}> |
|
1686 |
<input type=hidden name=password value=$form->{password}> |
|
1502 |
$ar->{type} = |
|
1503 |
$has_storno ? $locale->text("Invoice with Storno (abbreviation)") : |
|
1504 |
$is_storno ? $locale->text("Storno (one letter abbreviation)") : |
|
1505 |
$ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") : |
|
1506 |
$ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") : |
|
1507 |
$locale->text("AR Transaction (abbreviation)"); |
|
1687 | 1508 |
|
1688 |
<input class=submit type=submit name=action value="| |
|
1689 |
. $locale->text('AR Transaction') . qq|"> |
|
1690 |
<input class=submit type=submit name=action value="| |
|
1691 |
. $locale->text('Sales Invoice') . qq|"> |
|
1509 |
my $row = { }; |
|
1692 | 1510 |
|
1693 |
</form> |
|
1694 |
|
|
1695 |
</body> |
|
1696 |
</html> |
|
1697 |
|; |
|
1698 |
|
|
1699 |
$lxdebug->leave_sub(); |
|
1700 |
} |
|
1701 |
|
|
1702 |
sub ar_subtotal { |
|
1703 |
$lxdebug->enter_sub(); |
|
1511 |
foreach my $column (@columns) { |
|
1512 |
$row->{$column} = { |
|
1513 |
'data' => $ar->{$column}, |
|
1514 |
'align' => $column_alignment{$column}, |
|
1515 |
}; |
|
1516 |
} |
|
1704 | 1517 |
|
1705 |
map { $column_data{$_} = "<td> </td>" } @column_index; |
|
1518 |
$row->{invnumber}->{link} = build_std_url("script=" . ($ar->{invoice} ? 'is.pl' : 'ar.pl'), 'action=edit') |
|
1519 |
. "&id=" . E($ar->{id}) . "&callback=${callback}"; |
|
1706 | 1520 |
|
1707 |
$column_data{tax} = "<th class=listsubtotal align=right>" |
|
1708 |
. $form->format_amount(\%myconfig, $subtotalamount - $subtotalnetamount, |
|
1709 |
2, " ") |
|
1710 |
. "</th>"; |
|
1711 |
$column_data{amount} = |
|
1712 |
"<th class=listsubtotal align=right>" |
|
1713 |
. $form->format_amount(\%myconfig, $subtotalamount, 2, " ") . "</th>"; |
|
1714 |
$column_data{paid} = |
|
1715 |
"<th class=listsubtotal align=right>" |
|
1716 |
. $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "</th>"; |
|
1717 |
$column_data{due} = |
|
1718 |
"<th class=listsubtotal align=right>" |
|
1719 |
. $form->format_amount(\%myconfig, $subtotaldue, 2, " ") . "</th>"; |
|
1521 |
my $row_set = [ $row ]; |
|
1720 | 1522 |
|
1721 |
$subtotalnetamount = 0; |
|
1722 |
$subtotalamount = 0; |
|
1723 |
$subtotalpaid = 0; |
|
1724 |
$subtotaldue = 0; |
|
1523 |
if (($form->{l_subtotal} eq 'Y') |
|
1524 |
&& (($idx == (scalar @{ $form->{AR} } - 1)) |
|
1525 |
|| ($ar->{ $form->{sort} } ne $form->{AR}->[$idx + 1]->{ $form->{sort} }))) { |
|
1526 |
push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, \@subtotal_columns, 'listsubtotal'); |
|
1527 |
} |
|
1725 | 1528 |
|
1726 |
$sameitem = $ar->{ $form->{sort} };
|
|
1529 |
$report->add_data($row_set);
|
|
1727 | 1530 |
|
1728 |
print "<tr class=listsubtotal>"; |
|
1531 |
$idx++; |
|
1532 |
} |
|
1729 | 1533 |
|
1730 |
map { print "\n$column_data{$_}" } @column_index; |
|
1534 |
$report->add_separator(); |
|
1535 |
$report->add_data(create_subtotal_row(\%totals, \@columns, \%column_alignment, \@subtotal_columns, 'listtotal')); |
|
1731 | 1536 |
|
1732 |
print " |
|
1733 |
</tr> |
|
1734 |
"; |
|
1537 |
$report->generate_with_headers(); |
|
1735 | 1538 |
|
1736 | 1539 |
$lxdebug->leave_sub(); |
1737 | 1540 |
} |
1738 | 1541 |
|
1739 |
|
|
1740 | 1542 |
sub storno { |
1741 | 1543 |
$lxdebug->enter_sub(); |
1742 | 1544 |
|
Auch abrufbar als: Unified diff
Die Liste der Debitorenbuchungen auf die Verwendung der ReportGenerator-Klasse umgestellt.