qq| ex.$rate AS exchangerate, | .
qq| pr.projectnumber AS globalprojectnumber, | .
qq| e.name AS employee, s.name AS salesman, | .
- qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id | .
+ qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id, | .
+ qq| tz.description AS taxzone | .
$periodic_invoices_columns .
qq|FROM oe o | .
qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
qq|LEFT JOIN exchangerate ex ON (ex.currency_id = o.currency_id | .
qq| AND ex.transdate = o.transdate) | .
qq|LEFT JOIN project pr ON (o.globalproject_id = pr.id) | .
+ qq|LEFT JOIN tax_zones tz ON (o.taxzone_id = tz.id) | .
qq|$periodic_invoices_joins | .
qq|WHERE (o.quotation = ?) |;
push(@values, $quotation);
push(@values, conv_date($form->{reqdateto}));
}
+ if ($form->{shippingpoint}) {
+ $query .= qq| AND o.shippingpoint ILIKE ?|;
+ push(@values, '%' . $form->{shippingpoint} . '%');
+ }
+
+ if ($form->{taxzone_id} ne '') { # taxzone_id could be 0
+ $query .= qq| AND tz.id = ?|;
+ push(@values, $form->{taxzone_id});
+ }
+
if ($form->{transaction_description}) {
$query .= qq| AND o.transaction_description ILIKE ?|;
push(@values, '%' . $form->{transaction_description} . '%');
"employee" => "e.name",
"salesman" => "s.name",
"shipvia" => "o.shipvia",
- "transaction_description" => "o.transaction_description"
+ "transaction_description" => "o.transaction_description",
+ "shippingpoint" => "o.shippingpoint",
+ "taxzone" => "tz.description",
);
if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) {
$sortorder = $allowed_sort_columns{$form->{sort}} . " ${sortdir}";
use Data::Dumper;
use SL::DB::Customer;
+use SL::DB::TaxZone;
require "bin/mozilla/io.pl";
require "bin/mozilla/arap.pl";
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
"departments" => "ALL_DEPARTMENTS",
"$form->{vc}s" => "ALL_VC",
- "business_types" => "ALL_BUSINESS_TYPES");
+ "taxzones" => "ALL_TAXZONES",
+ "business_types" => "ALL_BUSINESS_TYPES",);
$form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
# constants and subs for template
"delivered", "periodic_invoices",
"marge_total", "marge_percent",
"vcnumber", "ustid",
- "country",
+ "country", "shippingpoint",
+ "taxzone",
);
# only show checkboxes if gotten here via sales_order form.
push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber
transaction_description transdatefrom transdateto type vc employee_id salesman_id
reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive
- business_id);
+ business_id shippingpoint taxzone_id);
- my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
+ my @keys_for_url = grep { $form->{$_} } @hidden_variables;
+ push @keys_for_url, 'taxzone_id' if $form->{taxzone_id} ne ''; # taxzone_id could be 0
+
+ my $href = build_std_url('action=orders', @keys_for_url);
my %column_defs = (
'ids' => { 'text' => '', },
'country' => { 'text' => $locale->text('Country'), },
'ustid' => { 'text' => $locale->text('USt-IdNr.'), },
'periodic_invoices' => { 'text' => $locale->text('Per. Inv.'), },
+ 'shippingpoint' => { 'text' => $locale->text('Shipping Point'), },
+ 'taxzone' => { 'text' => $locale->text('Steuersatz'), },
);
- foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia transaction_description)) {
+ foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia transaction_description shippingpoint taxzone)) {
my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
$column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
}
push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if $form->{ordnumber};
push @options, $locale->text('Notes') . " : $form->{notes}" if $form->{notes};
push @options, $locale->text('Transaction description') . " : $form->{transaction_description}" if $form->{transaction_description};
+ push @options, $locale->text('Shipping Point') . " : $form->{shippingpoint}" if $form->{shippingpoint};
if ( $form->{transdatefrom} or $form->{transdateto} ) {
push @options, $locale->text('Order Date');
push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1) if $form->{transdatefrom};
my $vc_type_label = $form->{vc} eq 'customer' ? $locale->text('Customer type') : $locale->text('Vendor type');
push @options, $vc_type_label . " : " . SL::DB::Business->new(id => $form->{business_id})->load->description;
}
+ if ($form->{taxzone_id} ne '') { # taxzone_id could be 0
+ push @options, $locale->text('Steuersatz') . " : " . SL::DB::TaxZone->new(id => $form->{taxzone_id})->load->description;
+ }
$report->set_options('top_info_text' => join("\n", @options),
'raw_top_info_text' => $form->parse_html_template('oe/orders_top'),
<th align="right">[% 'Salesman' | $T8 %]</th>
<td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
</tr>
+ <tr>
+ <th align="right">[% 'Steuersatz' | $T8 %]</th>
+ <td>[% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style='width: 250px') %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% 'Shipping Point' | $T8 %]</th>
+ <td colspan="3">[% L.input_tag('shippingpoint', '', style='width:250px') %]</td>
+ </tr>
<tr>
<th align="right">[% 'Transaction description' | $T8 %]</th>
<td colspan="3"><input name="transaction_description" style="width: 250px"></td>
<input name="l_customernumber" id="l_customernumber" class="checkbox" type="checkbox" value="Y">
<label for="l_customernumber">[% 'Customer Number' | $T8 %]</label>
</td>
+ <td>[%- L.checkbox_tag('l_taxzone', label => LxERP.t8('Steuersatz')) %]</td>
+ <td>[%- L.checkbox_tag('l_shippingpoint', label => LxERP.t8('Shipping Point')) %]</td>
</tr>
<tr>
<td>