"city" => "ct.city",
"country" => "ct.country",
"discount" => "ct.discount",
+ "insertdate" => "ct.itime",
"salesman" => "e.name",
"payment" => "pt.description"
);
}
my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';
- if ($sortorder !~ /(business|id|discount)/ && !$join_records) {
+ if ($sortorder !~ /(business|id|discount|itime)/ && !$join_records) {
$sortorder = "lower($sortorder) ${sortdir}";
} else {
$sortorder .= " ${sortdir}";
push(@values, conv_i($form->{salesman_id}));
}
+ if($form->{insertdatefrom}) {
+ $where .= qq| AND (ct.itime::DATE >= ?)|;
+ push@values, conv_date($form->{insertdatefrom});
+ }
+
+ if($form->{insertdateto}) {
+ $where .= qq| AND (ct.itime::DATE <= ?)|;
+ push @values, conv_date($form->{insertdateto});
+ }
+
# Nur Kunden finden, bei denen ich selber der Verkäufer bin
# Gilt nicht für Lieferanten
if ($cv eq 'customer' && !$main::auth->assert('customer_vendor_all_edit', 1)) {
}
my $query =
- qq|SELECT ct.*, b.description AS business, e.name as salesman, |.
+ qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
qq| pt.description as payment | .
(qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) .
qq|FROM $cv ct | .
push(@values, @saved_values);
$query .=
qq| UNION | .
- qq|SELECT ct.*, b.description AS business, e.name as salesman, |.
+ qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
qq| pt.description as payment, | .
qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | .
qq| '$module' AS module, 'invoice' AS formtype, | .
push(@values, @saved_values);
$query .=
qq| UNION | .
- qq|SELECT ct.*, b.description AS business, e.name as salesman, |.
+ qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
qq| pt.description as payment, | .
qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
qq| 'oe' AS module, 'order' AS formtype, o.closed | .
push(@values, @saved_values);
$query .=
qq| UNION | .
- qq|SELECT ct.*, b.description AS business, e.name as salesman, | .
+ qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
qq| pt.description as payment, | .
qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
qq| 'oe' AS module, 'quotation' AS formtype, o.closed | .
}
}
+ if ( $form->{insertdatefrom} or $form->{insertdateto} ) {
+ push @options, $locale->text('Insert Date');
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{insertdatefrom}, 1) if $form->{insertdatefrom};
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{insertdateto}, 1) if $form->{insertdateto};
+ };
+
my @columns = (
'id', 'name', "$form->{db}number", 'contact', 'phone', 'discount',
'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city',
'business', 'payment', 'invnumber', 'ordnumber', 'quonumber', 'salesman',
- 'country'
+ 'country', 'insertdate'
);
my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
'salesman' => { 'text' => $locale->text('Salesman'), },
'discount' => { 'text' => $locale->text('Discount'), },
'payment' => { 'text' => $locale->text('Payment Terms'), },
+ 'insertdate' => { 'text' => $locale->text('Insert Date'), },
%column_defs_cvars,
);
my @hidden_variables = ( qw(
db status obsolete name contact email cp_name addr_street addr_zipcode
- addr_city addr_country business_id salesman_id
+ addr_city addr_country business_id salesman_id insertdateto insertdatefrom
), "$form->{db}number",
map({ "cvar_$_->{name}" } @searchable_custom_variables),
map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)),