Revision 527e86b3
Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt
| SL/Controller/DeliveryOrder.pm | ||
|---|---|---|
|
use SL::DB::Shipto;
|
||
|
use SL::DB::Translation;
|
||
|
use SL::DB::TransferType;
|
||
|
use SL::DB::Warehouse;
|
||
|
|
||
|
use SL::Helper::CreatePDF qw(:all);
|
||
|
use SL::Helper::PrintOptions;
|
||
| ... | ... | |
|
|
||
|
$self->merge_stock_data($stock_info, \@contents, $part, $unit);
|
||
|
|
||
|
my @collection = (
|
||
|
{ 'description' => 'foo_1', 'id' => '1',
|
||
|
'key_1' => [
|
||
|
{ 'id' => 3, 'description' => "bar_1",
|
||
|
'key_2' => [
|
||
|
{ 'id' => 1, 'value' => "foobar_1", },
|
||
|
{ 'id' => 2, 'value' => "foobar_2", },
|
||
|
],
|
||
|
},
|
||
|
{ 'id' => 4, 'description' => "bar_2",
|
||
|
'key_2' => [],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{ 'description' => 'foo_2', 'id' => '2',
|
||
|
'key_1' => [
|
||
|
{ 'id' => 1, 'description' => "bar_1",
|
||
|
'key_2' => [
|
||
|
{ 'id' => 3, 'value' => "foobar_3", },
|
||
|
{ 'id' => 4, 'value' => "foobar_4", },
|
||
|
],
|
||
|
},
|
||
|
{ 'id' => 2, 'description' => "bar_2",
|
||
|
'stock' => [
|
||
|
{ 'id' => 5, 'value' => "test_5", },
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
);
|
||
|
|
||
|
$self->render("delivery_order/stock_dialog", { layout => 0 },
|
||
|
WHCONTENTS => $self->order->delivered ? $stock_info : \@contents,
|
||
|
WAREHOUSES => SL::DB::Manager::Warehouse->get_all(with_objects=> ["bins",]),
|
||
|
COLLECTION => \@collection,
|
||
|
part => $part,
|
||
|
do_qty => $qty,
|
||
|
do_unit => $unit->unit,
|
||
|
delivered => $self->order->delivered,
|
||
|
row => $row,
|
||
|
item_id => $item_id,
|
||
|
in_out => $inout,
|
||
|
);
|
||
|
}
|
||
|
|
||
| SL/DB/DeliveryOrder/TypeData.pm | ||
|---|---|---|
|
edit => "purchase_delivery_order_edit",
|
||
|
view => "purchase_delivery_order_edit | purchase_delivery_order_view",
|
||
|
},
|
||
|
stock_direction => {
|
||
|
in_out => 'in',
|
||
|
in => 1,
|
||
|
out => 0,
|
||
|
},
|
||
|
},
|
||
|
SUPPLIER_DELIVERY_ORDER_TYPE() => {
|
||
|
text => {
|
||
| templates/webpages/delivery_order/stock_dialog.html | ||
|---|---|---|
|
[%- USE HTML %]
|
||
|
[%- USE LxERP %]
|
||
|
[%- USE L %]
|
||
|
|
||
|
<form>
|
||
|
[%- IF delivered %]
|
||
|
[%- SET RO = ' readonly' %]
|
||
|
[%- END %]
|
||
|
[% PROCESS "delivery_order/stock_dialog/_stock_delivered_dialog.html" %]
|
||
|
[%- ELSE %]
|
||
|
|
||
|
<table>
|
||
|
<tr>
|
||
| ... | ... | |
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
[%- UNLESS WHCONTENTS.size %]
|
||
|
<p>[% 'There are no items in stock.' | $T8 %]</p>
|
||
|
[%- ELSE %]
|
||
|
|
||
|
[% L.hidden_tag("in_out", in_out) %]
|
||
|
[% L.hidden_tag("parts_id", parts_id) %]
|
||
|
[% L.hidden_tag("do_qty", do_qty) %]
|
||
| ... | ... | |
|
[% L.hidden_tag("row", row, class="data-row") %]
|
||
|
[% L.hidden_tag("item_id", item_id) %]
|
||
|
|
||
|
[%- IF in_out == "in" %]
|
||
|
<p>
|
||
|
<table id="stock-in-out-table">
|
||
|
<tr class="listheading">
|
||
|
<th> </th>
|
||
|
<th>[% 'Warehouse' | $T8 %]</th>
|
||
|
<th>[% 'Bin' | $T8 %]</th>
|
||
|
<th>[% 'Charge Number' | $T8 %]</th>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<th>[% 'Best Before' | $T8 %]</th>
|
||
|
[% END %]
|
||
|
[%- UNLESS delivered %]
|
||
|
<th align="right">[% 'Available qty' | $T8 %]</th>
|
||
|
[%- END %]
|
||
|
<th align="right">[% 'Qty' | $T8 %]</th>
|
||
|
<th align="right">[% 'Unit' | $T8 %]</th>
|
||
|
</tr>
|
||
|
|
||
|
[%- FOREACH row = WHCONTENTS %]
|
||
|
<tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
|
||
|
<td>[% loop.count %]</td>
|
||
|
<td>[% row.warehousedescription | html %]</td>
|
||
|
<td>[% row.bindescription | html %]</td>
|
||
|
<td>[% row.chargenumber | html %]</td>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<td>[% row.bestbefore | html %]</td>
|
||
|
[% END %]
|
||
|
|
||
|
[%- IF delivered %]
|
||
|
|
||
|
<td>[% LxERP.format_amount(row.stock_qty) | html %]</td>
|
||
|
<td>
|
||
|
[% row.stock_unit | html %]
|
||
|
[% L.hidden_tag("unit", row.stock_unit, class="data-unit") %]
|
||
|
</td>
|
||
|
|
||
|
[%- ELSE %]
|
||
|
|
||
|
<td>[% row.available_qty | html %]</td>
|
||
|
<td>
|
||
|
[% L.input_tag("qty", row.stock_qty ? LxERP.format_amount(row.stock_qty)
|
||
|
: (WHCONTENTS.size == 1) && (!row.stock_qty) ? LxERP.format_amount(do_qty)
|
||
|
: "", class="numeric data-qty", size="12") %]</td>
|
||
|
<td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
|
||
|
|
||
|
[%- END %]
|
||
|
<td style="display:none">
|
||
|
[% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
|
||
|
[% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
|
||
|
[% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
|
||
|
[% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
|
||
|
[% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
</td>
|
||
|
</tr>
|
||
|
<table id="stock-info-table">
|
||
|
[%- PROCESS "delivery_order/stock_dialog/_stock_info_table.html" %]
|
||
|
</table>
|
||
|
</p>
|
||
|
[%- END %]
|
||
|
|
||
|
<p>
|
||
|
<table id="stock-in-out-table">
|
||
|
[%- IF in_out == "in" %]
|
||
|
[%- PROCESS "delivery_order/stock_dialog/_stock_in_table.html" %]
|
||
|
[%- ELSE %]
|
||
|
[%- PROCESS "delivery_order/stock_dialog/_stock_out_table.html" %]
|
||
|
[%- END %]
|
||
|
</table>
|
||
|
</p>
|
||
|
|
||
|
<hr size="3" noshade>
|
||
|
|
||
|
<p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) IF !delivered %]</p>
|
||
|
<p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) %]</p>
|
||
|
|
||
|
[%- END %]
|
||
|
</form>
|
||
|
|
||
|
|
||
| templates/webpages/delivery_order/stock_dialog/_stock_delivered_dialog.html | ||
|---|---|---|
|
[%- USE T8 %]
|
||
|
[%- USE HTML %]
|
||
|
[%- USE LxERP %]
|
||
|
[%- USE L %]
|
||
|
[%- IF delivered %]
|
||
|
[%- SET RO = ' readonly' %]
|
||
|
[%- END %]
|
||
|
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td>[% 'Part Number' | $T8 %]</td>
|
||
|
<td>[% part.partnumber | html %]</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[% 'Description' | $T8 %]</td>
|
||
|
<td>[% part.description | html %]</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[% 'Qty according to delivery order' | $T8 %]</td>
|
||
|
<td>[% LxERP.format_amount(do_qty) %] [% do_unit | html %]</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
[%- UNLESS WHCONTENTS.size %]
|
||
|
<p>[% 'There are no items in stock.' | $T8 %]</p>
|
||
|
[%- ELSE %]
|
||
|
|
||
|
[% L.hidden_tag("in_out", in_out) %]
|
||
|
[% L.hidden_tag("parts_id", parts_id) %]
|
||
|
[% L.hidden_tag("do_qty", do_qty) %]
|
||
|
[% L.hidden_tag("do_unit", do_unit) %]
|
||
|
[% L.hidden_tag("row", row, class="data-row") %]
|
||
|
[% L.hidden_tag("item_id", item_id) %]
|
||
|
|
||
|
<p>
|
||
|
<table id="stock-in-out-table">
|
||
|
<tr class="listheading">
|
||
|
<th> </th>
|
||
|
<th>[% 'Warehouse' | $T8 %]</th>
|
||
|
<th>[% 'Bin' | $T8 %]</th>
|
||
|
<th>[% 'Charge Number' | $T8 %]</th>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<th>[% 'Best Before' | $T8 %]</th>
|
||
|
[% END %]
|
||
|
[%- UNLESS delivered %]
|
||
|
<th align="right">[% 'Available qty' | $T8 %]</th>
|
||
|
[%- END %]
|
||
|
<th align="right">[% 'Qty' | $T8 %]</th>
|
||
|
<th align="right">[% 'Unit' | $T8 %]</th>
|
||
|
</tr>
|
||
|
|
||
|
[%- FOREACH row = WHCONTENTS %]
|
||
|
<tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
|
||
|
<td>[% loop.count %]</td>
|
||
|
<td>[% row.warehousedescription | html %]</td>
|
||
|
<td>[% row.bindescription | html %]</td>
|
||
|
<td>[% row.chargenumber | html %]</td>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<td>[% row.bestbefore | html %]</td>
|
||
|
[% END %]
|
||
|
|
||
|
[%- IF delivered %]
|
||
|
|
||
|
<td>[% LxERP.format_amount(row.stock_qty) | html %]</td>
|
||
|
<td>
|
||
|
[% row.stock_unit | html %]
|
||
|
[% L.hidden_tag("unit", row.stock_unit, class="data-unit") %]
|
||
|
</td>
|
||
|
|
||
|
[%- ELSE %]
|
||
|
|
||
|
<td>[% row.available_qty | html %]</td>
|
||
|
<td>
|
||
|
[% L.input_tag("qty", row.stock_qty ? LxERP.format_amount(row.stock_qty)
|
||
|
: (WHCONTENTS.size == 1) && (!row.stock_qty) ? LxERP.format_amount(do_qty)
|
||
|
: "", class="numeric data-qty", size="12") %]</td>
|
||
|
<td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
|
||
|
|
||
|
[%- END %]
|
||
|
<td style="display:none">
|
||
|
[% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
|
||
|
[% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
|
||
|
[% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
|
||
|
[% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
|
||
|
[% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
[%- END %]
|
||
|
</table>
|
||
|
</p>
|
||
|
|
||
|
<hr size="3" noshade>
|
||
|
|
||
|
<p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) IF !delivered %]</p>
|
||
|
|
||
|
[%- END %]
|
||
|
</form>
|
||
|
|
||
|
|
||
| templates/webpages/delivery_order/stock_dialog/_stock_in_table.html | ||
|---|---|---|
|
<tr class="listheading">
|
||
|
<th>[% 'Warehouse' | $T8 %]</th>
|
||
|
<th>[% 'Bin' | $T8 %]</th>
|
||
|
<th align="right">[% 'Qty' | $T8 %]</th>
|
||
|
<th align="right">[% 'Unit' | $T8 %]</th>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
[% L.multi_level_select_tag(
|
||
|
"test_tag", WAREHOUSES, 2, surround_tag="td",
|
||
|
level_1={
|
||
|
name="warehouse.id",
|
||
|
value_key="id",
|
||
|
title_key="description",
|
||
|
},
|
||
|
level_2={
|
||
|
object_key="bins",
|
||
|
name="bin.id",
|
||
|
value_key="id",
|
||
|
title_key="description",
|
||
|
},
|
||
|
) %]
|
||
|
|
||
|
<td>
|
||
|
[% L.input_tag("qty", LxERP.format_amount(do_qty), class="numeric data-qty", size="12") %]</td>
|
||
|
<td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
|
||
|
|
||
|
<td style="display:none">
|
||
|
[% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
|
||
|
[% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
|
||
|
[% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
|
||
|
[% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
|
||
|
[% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
[% L.multi_level_select_tag("multi_select_foo_bar_foobar", COLLECTION, 3,
|
||
|
surround_tag="td",
|
||
|
level_1={
|
||
|
name="foo.id",
|
||
|
value_key="id",
|
||
|
title_key="description",
|
||
|
default="2",
|
||
|
},
|
||
|
level_2={
|
||
|
object_key="key_1",
|
||
|
name="bar.id",
|
||
|
value_key="id",
|
||
|
title_key="description",
|
||
|
default="1",
|
||
|
},
|
||
|
level_3={
|
||
|
object_key="key_2",
|
||
|
name="foobar.id",
|
||
|
value_key="id",
|
||
|
title_key="value",
|
||
|
default="4",
|
||
|
},
|
||
|
) %]
|
||
|
</tr>
|
||
| templates/webpages/delivery_order/stock_dialog/_stock_info_table.html | ||
|---|---|---|
|
<tr class="listheading">
|
||
|
<th> </th>
|
||
|
<th>[% 'Warehouse' | $T8 %]</th>
|
||
|
<th>[% 'Bin' | $T8 %]</th>
|
||
|
<th>[% 'Charge Number' | $T8 %]</th>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<th>[% 'Best Before' | $T8 %]</th>
|
||
|
[% END %]
|
||
|
<th align="right">[% 'Available qty' | $T8 %]</th>
|
||
|
</tr>
|
||
|
|
||
|
[%- FOREACH row = WHCONTENTS %]
|
||
|
<tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
|
||
|
<td>[% loop.count %]</td>
|
||
|
<td>[% row.warehousedescription | html %]</td>
|
||
|
<td>[% row.bindescription | html %]</td>
|
||
|
<td>[% row.chargenumber | html %]</td>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<td>[% row.bestbefore | html %]</td>
|
||
|
[% END %]
|
||
|
|
||
|
<td>[% row.available_qty | html %]</td>
|
||
|
<td>
|
||
|
[% row.stock_unit | html %]
|
||
|
</td>
|
||
|
</tr>
|
||
|
[%- END %]
|
||
| templates/webpages/delivery_order/stock_dialog/_stock_out_table.html | ||
|---|---|---|
|
[%- USE T8 %]
|
||
|
[%- USE HTML %]
|
||
|
[%- USE LxERP %]
|
||
|
[%- USE L %]
|
||
|
[%- IF delivered %]
|
||
|
[%- SET RO = ' readonly' %]
|
||
|
[%- END %]
|
||
|
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td>[% 'Part Number' | $T8 %]</td>
|
||
|
<td>[% part.partnumber | html %]</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[% 'Description' | $T8 %]</td>
|
||
|
<td>[% part.description | html %]</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[% 'Qty according to delivery order' | $T8 %]</td>
|
||
|
<td>[% LxERP.format_amount(do_qty) %] [% do_unit | html %]</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
[%- UNLESS WHCONTENTS.size %]
|
||
|
<p>[% 'There are no items in stock.' | $T8 %]</p>
|
||
|
[%- ELSE %]
|
||
|
|
||
|
[% L.hidden_tag("in_out", in_out) %]
|
||
|
[% L.hidden_tag("parts_id", parts_id) %]
|
||
|
[% L.hidden_tag("do_qty", do_qty) %]
|
||
|
[% L.hidden_tag("do_unit", do_unit) %]
|
||
|
[% L.hidden_tag("row", row, class="data-row") %]
|
||
|
[% L.hidden_tag("item_id", item_id) %]
|
||
|
|
||
|
<p>
|
||
|
<table id="stock-in-out-table">
|
||
|
<tr class="listheading">
|
||
|
<th> </th>
|
||
|
<th>[% 'Warehouse' | $T8 %]</th>
|
||
|
<th>[% 'Bin' | $T8 %]</th>
|
||
|
<th>[% 'Charge Number' | $T8 %]</th>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<th>[% 'Best Before' | $T8 %]</th>
|
||
|
[% END %]
|
||
|
[%- UNLESS delivered %]
|
||
|
<th align="right">[% 'Available qty' | $T8 %]</th>
|
||
|
[%- END %]
|
||
|
<th align="right">[% 'Qty' | $T8 %]</th>
|
||
|
<th align="right">[% 'Unit' | $T8 %]</th>
|
||
|
</tr>
|
||
|
|
||
|
[%- FOREACH row = WHCONTENTS %]
|
||
|
<tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
|
||
|
<td>[% loop.count %]</td>
|
||
|
<td>[% row.warehousedescription | html %]</td>
|
||
|
<td>[% row.bindescription | html %]</td>
|
||
|
<td>[% row.chargenumber | html %]</td>
|
||
|
[% IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
<td>[% row.bestbefore | html %]</td>
|
||
|
[% END %]
|
||
|
|
||
|
[%- IF delivered %]
|
||
|
|
||
|
<td>[% LxERP.format_amount(row.stock_qty) | html %]</td>
|
||
|
<td>
|
||
|
[% row.stock_unit | html %]
|
||
|
[% L.hidden_tag("unit", row.stock_unit, class="data-unit") %]
|
||
|
</td>
|
||
|
|
||
|
[%- ELSE %]
|
||
|
|
||
|
<td>[% row.available_qty | html %]</td>
|
||
|
<td>
|
||
|
[% L.input_tag("qty", row.stock_qty ? LxERP.format_amount(row.stock_qty)
|
||
|
: (WHCONTENTS.size == 1) && (!row.stock_qty) ? LxERP.format_amount(do_qty)
|
||
|
: "", class="numeric data-qty", size="12") %]</td>
|
||
|
<td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
|
||
|
|
||
|
[%- END %]
|
||
|
<td style="display:none">
|
||
|
[% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
|
||
|
[% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
|
||
|
[% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
|
||
|
[% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
|
||
|
[% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
[%- END %]
|
||
|
</table>
|
||
|
</p>
|
||
|
|
||
|
<hr size="3" noshade>
|
||
|
|
||
|
<p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) IF !delivered %]</p>
|
||
|
|
||
|
[%- END %]
|
||
|
</form>
|
||
|
|
||
|
|
||
Auch abrufbar als: Unified diff
Controller: DeliveryOrder: stock_dialog um Einlagern erweitert (WIP)