Revision 913fe339
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1526 | 1526 |
$main::lxdebug->leave_sub(); |
1527 | 1527 |
} |
1528 | 1528 |
|
1529 |
sub _get_charts { |
|
1530 |
$main::lxdebug->enter_sub(); |
|
1531 |
|
|
1532 |
my ($self, $dbh, $params) = @_; |
|
1533 |
|
|
1534 |
$key = $params->{key}; |
|
1535 |
$key = "all_charts" unless ($key); |
|
1536 |
$self->{$key} = []; |
|
1537 |
|
|
1538 |
my $transdate = quote_db_date($params->{transdate}); |
|
1539 |
|
|
1540 |
my $query = |
|
1541 |
qq|SELECT c.accno, c.description, c.link, tk.taxkey_id, tk.tax_id | . |
|
1542 |
qq|FROM chart c | . |
|
1543 |
qq|LEFT JOIN taxkeys tk ON | . |
|
1544 |
qq|(tk.id = (SELECT id FROM taxkeys | . |
|
1545 |
qq| WHERE taxkeys.chart_id = c.id AND startdate <= $transdate | . |
|
1546 |
qq| ORDER BY startdate DESC LIMIT 1)) | . |
|
1547 |
qq|ORDER BY c.accno|; |
|
1548 |
|
|
1549 |
my $sth = $dbh->prepare($query); |
|
1550 |
$sth->execute() || $self->dberror($query); |
|
1551 |
|
|
1552 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
|
1553 |
push(@{ $self->{$key} }, $ref); |
|
1554 |
} |
|
1555 |
$sth->finish; |
|
1556 |
|
|
1557 |
$main::lxdebug->leave_sub(); |
|
1558 |
} |
|
1559 |
|
|
1560 |
sub _get_taxcharts { |
|
1561 |
$main::lxdebug->enter_sub(); |
|
1562 |
|
|
1563 |
my ($self, $dbh, $key) = @_; |
|
1564 |
|
|
1565 |
$key = "all_taxcharts" unless ($key); |
|
1566 |
$self->{$key} = []; |
|
1567 |
|
|
1568 |
my $query = qq|SELECT * FROM tax ORDER BY taxkey|; |
|
1569 |
|
|
1570 |
my $sth = $dbh->prepare($query); |
|
1571 |
$sth->execute() || $self->dberror($query); |
|
1572 |
|
|
1573 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
|
1574 |
push(@{ $self->{$key} }, $ref); |
|
1575 |
} |
|
1576 |
$sth->finish; |
|
1577 |
|
|
1578 |
$main::lxdebug->leave_sub(); |
|
1579 |
} |
|
1580 |
|
|
1529 | 1581 |
sub get_lists { |
1530 | 1582 |
$main::lxdebug->enter_sub(); |
1531 | 1583 |
|
... | ... | |
1556 | 1608 |
$self->_get_printers($dbh, $params{"printers"}); |
1557 | 1609 |
} |
1558 | 1610 |
|
1611 |
if ($params{"charts"}) { |
|
1612 |
$self->_get_charts($dbh, $params{"charts"}); |
|
1613 |
} |
|
1614 |
|
|
1615 |
if ($params{"taxcharts"}) { |
|
1616 |
$self->_get_taxcharts($dbh, $params{"taxcharts"}); |
|
1617 |
} |
|
1618 |
|
|
1559 | 1619 |
$dbh->disconnect(); |
1560 | 1620 |
|
1561 | 1621 |
$main::lxdebug->leave_sub(); |
Auch abrufbar als: Unified diff
Dialogbuchen: Die Drop-Down-Boxen bei jedem Formularaufbau aus der Datenbank heraus aufbauen und nicht in $form mitschleifen. Behebt auch den Fehler, dass das Steuerkonto beim initialen Aufbau nicht richtig ausgewählt wurde.