Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a87dd0ec

Von Sven Schöling vor fast 15 Jahren hinzugefügt

  • ID a87dd0ec36ef206227750773a4e36e20689a9f57
  • Vorgänger 6f7c3b10
  • Nachfolger ee454f5b

Batchaccounts angewendet.

Ausserdem einen subtilen Bug behoben, und ein Query gecacht.

Unterschiede anzeigen:

SL/IC.pm
#=====================================================================
#=====================================================================
# LX-Office ERP
# Copyright (C) 2004
# Based on SQL-Ledger Version 2.1.9
......
}
sub retrieve_accounts {
$main::lxdebug->enter_sub(2);
$main::lxdebug->enter_sub;
my $self = shift;
my $myconfig = shift;
my $form = shift;
my $dbh = $form->get_standard_dbh;
my %args = @_; # part_id => index
my %args = @_; # index => part_id
$form->{taxzone_id} *= 1;
return unless grep $_, values %args; # shortfuse if no part_id supplied
# transdate madness.
my $transdate = "";
if ($form->{type} eq "invoice") {
......
$transdate = $dbh->quote($transdate);
}
#/transdate
my $inc_exp = $form->{"vc"} eq "customer" ? "income" : "expense";
my @part_ids = grep { $_ } values %args;
my $in = join ',', ('?') x @part_ids;
my $sth_accno = prepare_query($::form, $dbh, <<SQL);
my %accno_by_part = map { $_->{id} => $_ }
selectall_hashref_query($form, $dbh, <<SQL, @part_ids);
SELECT
p.inventory_accno_id AS is_part,
p.id, p.inventory_accno_id AS is_part,
bg.inventory_accno_id,
bg.income_accno_id_$form->{taxzone_id} AS income_accno_id,
bg.expense_accno_id_$form->{taxzone_id} AS expense_accno_id,
......
LEFT JOIN chart c1 ON bg.inventory_accno_id = c1.id
LEFT JOIN chart c2 ON bg.income_accno_id_$form->{taxzone_id} = c2.id
LEFT JOIN chart c3 ON bg.expense_accno_id_$form->{taxzone_id} = c3.id
WHERE p.id = ?
WHERE p.id IN ($in)
SQL
my $sth_tax = prepare_query($::form, $dbh, <<SQL);
......
ORDER BY startdate DESC LIMIT 1)
SQL
while (my ($part_id, $index) = each %args) {
$sth_accno->execute($part_id);
my $ref = $sth_accno->fetchrow_hashref or next;
while (my ($index => $part_id) = each %args) {
my $ref = $accno_by_part{$part_id} or next;
$ref->{"inventory_accno_id"} = undef unless $ref->{"is_part"};
......
$form->{"${_}_accno_$index"} = $accounts{"${_}_accno"} for qw(inventory income expense);
my $inc_exp = $form->{"vc"} eq "customer" ? "income" : "expense";
$sth_tax->execute($accounts{"${inc_exp}_accno_id"}, quote_db_date($transdate));
$ref = $sth_tax->fetchrow_hashref or next;
......
$form->{"$ref->{accno}_${_}"} = $ref->{$_} for qw(rate description taxnumber);
}
$sth_accno->finish;
$sth_tax->finish;
$::lxdebug->leave_sub(2);
$::lxdebug->leave_sub;
}
sub get_basic_part_info {
bin/mozilla/io.pl
}
$form->{"taxaccounts"} = "";
for (my $i = 1; $i <= $form->{"rowcount"}; $i++) {
if ($form->{"id_$i"}) {
IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i);
}
}
IC->retrieve_accounts(\%myconfig, $form, map { $_ => $form->{"id_$_"} } 1 .. $form->{rowcount});
$main::lxdebug->leave_sub();
}
bin/mozilla/oe.pl
}
$form->{"taxaccounts"} = "";
for my $i (1 .. $form->{"rowcount"}) {
IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i) if $form->{"id_$i"};
}
IC->retrieve_accounts(\%myconfig, $form, map { $_ => $form->{"id_$_"} } 1 .. $form->{rowcount});
$form->{rowcount}++;
$form->{"project_id_$form->{rowcount}"} = $form->{globalproject_id};

Auch abrufbar als: Unified diff