partnumber => t8('Part Number'),
qty => t8('Qty'),
shipped_qty => t8('shipped'),
- delivered_qty => t8('transferred out'),
+ delivered_qty => t8('transferred in / out'),
not_shipped_qty => t8('not shipped'),
ordnumber => t8('Order'),
customer => t8('Customer'),
+ vendor => t8('Vendor'),
value_of_goods => t8('Value of goods'),
);
+my $vc;
+
sub action_list {
my ($self) = @_;
+ $vc = "customer";
+ $self->make_filter_summary;
+ $self->prepare_report;
+
+ my $orderitems = $self->models->get;
+
+ $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems);
+}
+
+sub action_list_ap {
+ my ($self) = @_;
+
+ $vc = "vendor";
$self->make_filter_summary;
$self->prepare_report;
delivered_qty => { sub => sub { $::form->format_amount(\%::myconfig, $_[0]->delivered_qty, 2) . ' ' . $_[0]->unit } },
ordnumber => { sub => sub { $_[0]->order->ordnumber },
obj_link => sub { $self->link_to($_[0]->order) } },
- customer => { sub => sub { $_[0]->order->customer->name },
- obj_link => sub { $self->link_to($_[0]->order->customer) } },
+ $vc => { sub => sub { $_[0]->order->$vc->name },
+ obj_link => sub { $self->link_to($_[0]->order->$vc) } },
);
# add value of goods in report
std_column_visibility => 1,
controller_class => 'DeliveryPlan',
output_format => 'HTML',
- top_info_text => $::locale->text('Delivery Plan for currently outstanding sales orders'),
+ top_info_text => ($vc eq 'customer') ? $::locale->text('Delivery Plan for currently outstanding sales orders') :
+ $::locale->text('Delivery Plan for currently outstanding purchase orders'),
title => $::locale->text('Delivery Plan'),
allow_pdf_export => 1,
allow_csv_export => 1,
$self->models->finalize; # for filter laundering
$self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
$report->set_options(
- raw_top_info_text => $self->render('delivery_plan/report_top', { output => 0 }),
+ raw_top_info_text => $self->render('delivery_plan/report_top', { output => 0 }, vc => $vc),
raw_bottom_info_text => $self->render('delivery_plan/report_bottom', { output => 0 }, models => $self->models),
);
}
[ $filter->{"reqdate:date::ge"}, $::locale->text('Delivery Date') . " " . $::locale->text('From Date') ],
[ $filter->{"reqdate:date::le"}, $::locale->text('Delivery Date') . " " . $::locale->text('To Date') ],
[ $filter->{"qty:number"}, $::locale->text('Quantity') ],
- [ $filter->{order}{customer}{"name:substr::ilike"}, $::locale->text('Customer') ],
- [ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ],
+ [ $filter->{order}{$vc}{"name:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer') : $::locale->text('Vendor') ],
+ [ $filter->{order}{$vc}{"${vc}number:substr::ilike"}, ($vc eq 'customer') ? $::locale->text('Customer Number') : $::locale->text('Vendor Number') ],
);
my %flags = (
sub delivery_plan_query {
my $employee_id = SL::DB::Manager::Employee->current->id;
- my $oe_owner = $_[0]->all_edit_right ? '' : " oe.eployee_id = $employee_id AND";
+ my $oe_owner = $_[0]->all_edit_right ? '' : " oe.employee_id = $employee_id AND";
# check delivered state for delivery_orders (transferred out) if enabled
my $filter_delivered = $::instance_conf->get_delivery_plan_calculate_transferred_do ?
"AND (SELECT delivered from delivery_orders where id = doi.delivery_order_id)" : '';
[
- 'order.customer_id' => { gt => 0 },
+ "order.${vc}_id" => { gt => 0 },
'order.closed' => 0,
or => [ 'order.quotation' => 0, 'order.quotation' => undef ],
FROM orderitems oi, oe, record_links rl, delivery_order_items doi
WHERE
oe.id = oi.trans_id AND
- oe.customer_id IS NOT NULL AND
+ oe.${vc}_id IS NOT NULL AND
(oe.quotation = 'f' OR oe.quotation IS NULL) AND
NOT oe.closed AND
$oe_owner
SELECT oi.id FROM orderitems oi, oe
WHERE
oe.id = oi.trans_id AND
- oe.customer_id IS NOT NULL AND
+ oe.${vc}_id IS NOT NULL AND
(oe.quotation = 'f' OR oe.quotation IS NULL) AND
NOT oe.closed AND
$oe_owner
rl.from_table = 'oe' AND
rl.to_table = 'delivery_orders' AND
- oe.customer_id IS NOT NULL AND
+ oe.${vc}_id IS NOT NULL AND
$oe_owner
(oe.quotation = 'f' OR oe.quotation IS NULL) AND NOT oe.closed
) rl
WHERE oi.trans_id = rl.from_id AND rl.from_table = 'oe' AND rl.to_table = 'delivery_orders'
) AND
coalesce(sum, 0) < oi.qty AND
- oe.customer_id IS NOT NULL AND
+ oe.${vc}_id IS NOT NULL AND
$oe_owner
(oe.quotation = 'f' OR oe.quotation IS NULL) AND NOT oe.closed
" ],
%sort_columns,
},
query => $self->delivery_plan_query,
- with_objects => [ 'order', 'order.customer', 'part' ],
+ with_objects => [ 'order', "order.$vc", 'part' ],
);
}
'Delivery Orders' => 'Lieferscheine',
'Delivery Plan' => 'Lieferplan',
'Delivery Plan check for transferred delivery orders' => 'Lieferplan berücksichtig den Status des Lieferscheins (ausgelagert / nicht ausgelagert)',
- 'Delivery Plan for currently outstanding sales orders' => 'Lieferplan für offene Verkaufsaufträge',
+ 'Delivery Plan for currently outstanding purchase orders' => 'Lieferplan für nicht vollständig gelieferte Einkaufs-Aufträge',
+ 'Delivery Plan for currently outstanding sales orders' => 'Lieferplan für nicht vollständig gelieferte Verkaufsaufträge',
'Delivery Terms' => 'Lieferbedingungen',
'Delivery terms' => 'Lieferbedingungen',
'Delivery terms (database ID)' => 'Lieferbedingungen (Datenbank-ID)',
'to (time)' => 'bis',
'transfer' => 'Umlagerung',
'transferred in' => 'eingelagert',
+ 'transferred in / out' => 'ein- / ausgelagert',
'transferred out' => 'ausgelagert',
'trial_balance' => 'susa',
'unconfigured' => 'unkonfiguriert',
<th align="right">[% 'Quantity' | $T8 %]</th>
<td>[% L.input_tag('filter.qty:number', filter.qty_number, size = 20) %]</td>
</tr>
- <tr>
- <th align="right">[% 'Customer' | $T8 %]</th>
- <td>[% L.input_tag('filter.order.customer.name:substr::ilike', filter.order.customer.name_substr__ilike, size = 20) %]</td>
- </tr>
- <tr>
- <th align="right">[% 'Customer Number' | $T8 %]</th>
- <td>[% L.input_tag('filter.order.customer.customernumber:substr::ilike', filter.order.customer.customernumber_substr__ilike, size = 20) %]</td>
- </tr>
+[% IF vc == 'customer' %]
+ <tr>
+ <th align="right">[% vc | $T8 %]</th>
+ <td>[% L.input_tag('filter.order.customer.name:substr::ilike', filter.order.customer.name_substr__ilike, size = 20) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% 'Customer Number' | $T8 %]</th>
+ <td>[% L.input_tag('filter.order.customer.customernumber:substr::ilike', filter.order.customer.customernumber_substr__ilike, size = 20) %]</td>
+ </tr>
+[% ELSE %] <tr>
+ <th align="right">[% vc | $T8 %]</th>
+ <td>[% L.input_tag('filter.order.vendor.name:substr::ilike', filter.order.vendor.name_substr__ilike, size = 20) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% 'Vendor Number' | $T8 %]</th>
+ <td>[% L.input_tag('filter.order.vendor.vendornumber:substr::ilike', filter.order.vendor.vendornumber_substr__ilike, size = 20) %]</td>
+ </tr>
+[% END %]
<tr>
<th align="right">[% 'Type' | $T8 %]</th>
<td>
[% L.hidden_tag('sort_by', FORM.sort_by) %]
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
[% L.hidden_tag('page', FORM.page) %]
-[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
+[% IF vc == 'customer' %]
+ [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
+[% ELSE %]
+ [% L.input_tag('action_list_ap', LxERP.t8('Continue'), type = 'submit', class='submit')%]
+[% END %]
<a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);'>[% 'Reset' | $T8 %]</a>