use List::Util qw(sum first);
use SL::AM;
+use SL::DB::Employee;
use SL::VK;
use SL::IS;
use SL::ReportGenerator;
my ($customer);
- # setup customer selection
- $form->all_vc(\%myconfig, "customer", "AR");
+ $::request->layout->add_javascripts("autocomplete_project.js");
$form->{title} = $locale->text('Sales Report');
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
+ $form->get_lists("departments" => "ALL_DEPARTMENTS",
"business_types" => "ALL_BUSINESS_TYPES",
"salesmen" => "ALL_SALESMEN",
- 'employees' => 'ALL_EMPLOYEES',
- 'partsgroup' => 'ALL_PARTSGROUPS',
- "customers" => "ALL_VC");
+ 'partsgroup' => 'ALL_PARTSGROUPS');
+
+ $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted;
+
$form->{CUSTOM_VARIABLES_IC} = CVar->get_configs('module' => 'IC');
($form->{CUSTOM_VARIABLES_FILTER_CODE_IC},
$form->{CUSTOM_VARIABLES_INCLUSION_CODE_IC}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES_IC},
$form->{CUSTOM_VARIABLES_INCLUSION_CODE_CT}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES_CT},
'include_prefix' => 'l_',
'include_value' => 'Y');
- $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
- $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} };
- $form->{salesman_labels} = $form->{employee_labels};
-
$form->header;
print $form->parse_html_template('vk/search_invoice', { %myconfig });
-[%- USE T8 %]
-[%- USE L %]
+[%- USE T8 %][%- USE L %][%- USE P -%]
+[%- SET style="width: 250px" %]
<h1>[% title %]</h1>
<form method=post name="search_invoice" action=[% script %]>
<tr>
<th align=right>[% 'Customer' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'customer',
- default = oldcustomer,
- style = 'width: 250px',
- DATA = ALL_VC,
- id_sub = 'vc_keys',
- label_key = 'name',
- select = vc_select,
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 1,
- class = 'initial_focus',
- -%]
- </td>
+ <td>[% P.input_tag("customer", "", class="initial_focus", style=style) %]</td>
<th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
- <td>
- <input name="customernumber" size="20">
- </td>
+ <td>[% P.input_tag("customernumber", "", style=style) %]</td>
</tr>
<tr>
ALL_DEPARTMENTS,
title_key = 'description',
with_empty = 1,
- style = 'width: 250px')
+ style = style)
-%]
</td>
<th align="right">[% 'Project Number' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'project_id',
- style = "width: 250px",
- DATA = ALL_PROJECTS,
- id_key = 'id',
- label_key = 'projectnumber',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% P.project_picker("project_id", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Number' | $T8 %]</th>
- <td><input name="partnumber" size="20"></td>
+ <td>[% P.input_tag("partnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right" nowrap>[% 'Part Description' | $T8 %]</th>
- <td>
- <input name="description" size="40">
- </td>
+ <td>[% P.input_tag("description", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Partsgroup' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'partsgroup_id',
- style = 'width: 250px',
- DATA = ALL_PARTSGROUPS,
- id_key = 'id',
- label_key = 'partsgroup',
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
-
+ <td>[% P.select_tag("partsgroupd_id", ALL_PARTSGROUPS, title_key="partsgroup", with_empty=1, style=style) %]</td>
<td align="right" nowrap>[% 'Country' | $T8 %]</td>
- <td><input name="country" size="20"></td>
+ <td>[% P.input_tag("country", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'employee_id',
- style = 'width: 250px',
- DATA = ALL_EMPLOYEES,
- id_key = 'id',
- label_sub = 'employee_labels',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- default = ' ',
- -%]
- </td>
+ <td>[% L.select_tag("employee_id", ALL_EMPLOYEES, title_key="safe_name", with_empty=1, style=style) %]</td>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'salesman_id',
- style = 'width: 250px',
- DATA = ALL_SALESMEN,
- id_key = 'id',
- label_sub = 'salesman_labels',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% L.select_tag("salesman_id", ALL_EMPLOYEES, title_key="safe_name", with_empty=1, style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Customer type' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'business_id',
- style = "width: 250px",
- DATA = ALL_BUSINESS_TYPES,
- id_key = 'id',
- label_key = 'description',
- limit = vclimit,
- show_empty = 1,
- allow_textbox = 0,
- -%]
- </td>
+ <td>[% L.select_tag("business_id", ALL_BUSINESS_TYPES, title_key="description", with_empty=1, style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Invoice Date' | $T8 %] [% 'From' | $T8 %]</th>
<td>
[% L.date_tag('transdatefrom') %]
- </td>
-
- <th align=right>[% 'Bis' | $T8 %]</th>
-
- <td>
+ [% 'Bis' | $T8 %]
[% L.date_tag('transdateto') %]
</td>
</tr>