Revision 833972cf
Von Holger Lindemann vor etwa 18 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
875 | 875 |
if ($form->{to}) { |
876 | 876 |
$where .= "AND $tabelle.transdate <= '$form->{to}' "; |
877 | 877 |
} |
878 |
my $query = qq|select shiptoname, $tabelle.transdate, $tabelle.invnumber, $tabelle.ordnumber, invoice.description, qty, invoice.unit FROM $tabelle LEFT JOIN shipto ON |; |
|
878 |
if ($kdspez1) { $adr_code="adr_code, "; } |
|
879 |
my $query = qq|select shiptoname, $adr_code $tabelle.transdate, $tabelle.invnumber, $tabelle.ordnumber, invoice.description, qty, invoice.unit FROM $tabelle LEFT JOIN shipto ON |; |
|
879 | 880 |
$query .= ($tabelle eq "ar") ? qq|($tabelle.shipto_id=shipto.shipto_id) |:qq|($tabelle.id=shipto.trans_id) |; |
880 |
$query .=qq|LEFT join invoice on ($tabelle.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) $where ORDER BY $tabelle.transdate DESC LIMIT 15|; |
|
881 |
$query .=qq|LEFT join invoice on ($tabelle.id=invoice.trans_id) LEFT join parts ON (parts.id=invoice.parts_id) LEFT join adr ON (parts.adr_id=adr.id) $where ORDER BY $tabelle.transdate DESC LIMIT 15|;
|
|
881 | 882 |
my $sth = $dbh->prepare($query); |
882 | 883 |
$sth->execute || $form->dberror($query); |
883 | 884 |
|
... | ... | |
891 | 892 |
$main::lxdebug->leave_sub(); |
892 | 893 |
} |
893 | 894 |
|
895 |
sub adr { |
|
896 |
$main::lxdebug->enter_sub(); |
|
897 |
|
|
898 |
my ($self, $myconfig, $form) = @_; |
|
899 |
my $dbh = $form->dbconnect($myconfig); |
|
900 |
$where = " WHERE 1=1 "; |
|
901 |
if ($form->{from}) { |
|
902 |
$where .= "AND ar.transdate >= '$form->{from}' "; |
|
903 |
} |
|
904 |
if ($form->{to}) { |
|
905 |
$where .= "AND ar.transdate <= '$form->{to}' "; |
|
906 |
} |
|
907 |
if ($form->{year}) { |
|
908 |
$where = " WHERE ar.transdate >= '$form->{year}-01-01' AND ar.transdate <= '$form->{year}-12-31' "; |
|
909 |
} |
|
910 |
|
|
911 |
my $query = qq|select adr_code, adr_description, sum(base_qty), parts.unit from ar LEFT join invoice on (ar.id=invoice.trans_id) LEFT join parts ON (invoice.parts_id=parts.id) LEFT join adr ON (adr.id=parts.adr_id) $where GROUP BY adr_code,adr_description,parts.unit|; |
|
912 |
my $sth = $dbh->prepare($query); |
|
913 |
$sth->execute || $form->dberror($query); |
|
914 |
|
|
915 |
|
|
916 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
|
917 |
push @{ $form->{ADR} }, $ref; |
|
918 |
} |
|
919 |
$sth->finish; |
|
920 |
$dbh->disconnect; |
|
921 |
|
|
922 |
$main::lxdebug->leave_sub(); |
|
923 |
} |
|
924 |
|
|
894 | 925 |
1; |
895 | 926 |
|
Auch abrufbar als: Unified diff
Kundenspezifische Felder mit Schalter ausblenden