Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d71c833a

Von Tamino Steinert vor etwa 2 Jahren hinzugefügt

  • ID d71c833ab60749834dccfdad5a33c5371cbfb986
  • Vorgänger 78fedd6a
  • Nachfolger 295c1205

Controller: DeliveryOrder: stock_dialog um Einlagern erweitert (WIP)

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
29 29
use SL::DB::Shipto;
30 30
use SL::DB::Translation;
31 31
use SL::DB::TransferType;
32
use SL::DB::Warehouse;
32 33

  
33 34
use SL::Helper::CreatePDF qw(:all);
34 35
use SL::Helper::PrintOptions;
......
929 930

  
930 931
  $self->merge_stock_data($stock_info, \@contents, $part, $unit);
931 932

  
933
    my @collection = (
934
    { 'description' => 'foo_1', 'id' => '1',
935
      'key_1' => [
936
        { 'id' => 3, 'description' => "bar_1",
937
          'key_2' => [
938
            { 'id' => 1, 'value' => "foobar_1", },
939
            { 'id' => 2, 'value' => "foobar_2", },
940
          ],
941
        },
942
        { 'id' => 4, 'description' => "bar_2",
943
        'key_2' => [],
944
        },
945
      ],
946
    },
947
    { 'description' => 'foo_2', 'id' => '2',
948
      'key_1' => [
949
        { 'id' => 1, 'description' => "bar_1",
950
          'key_2' => [
951
            { 'id' => 3, 'value' => "foobar_3", },
952
            { 'id' => 4, 'value' => "foobar_4", },
953
          ],
954
        },
955
        { 'id' => 2, 'description' => "bar_2",
956
          'stock' => [
957
            { 'id' => 5, 'value' => "test_5", },
958
          ],
959
        },
960
      ],
961
    },
962
  );
963

  
932 964
  $self->render("delivery_order/stock_dialog", { layout => 0 },
933 965
    WHCONTENTS => $self->order->delivered ? $stock_info : \@contents,
966
    WAREHOUSES => SL::DB::Manager::Warehouse->get_all(with_objects=> ["bins",]),
967
    COLLECTION => \@collection,
934 968
    part       => $part,
935 969
    do_qty     => $qty,
936 970
    do_unit    => $unit->unit,
937 971
    delivered  => $self->order->delivered,
938 972
    row        => $row,
939 973
    item_id    => $item_id,
974
    in_out     => $inout,
940 975
  );
941 976
}
942 977

  
SL/DB/DeliveryOrder/TypeData.pm
83 83
      edit => "purchase_delivery_order_edit",
84 84
      view => "purchase_delivery_order_edit | purchase_delivery_order_view",
85 85
    },
86
    stock_direction => {
87
      in_out => 'in',
88
      in     => 1,
89
      out    => 0,
90
    },
86 91
  },
87 92
  SUPPLIER_DELIVERY_ORDER_TYPE() => {
88 93
    text => {
templates/webpages/delivery_order/stock_dialog.html
2 2
[%- USE HTML %]
3 3
[%- USE LxERP %]
4 4
[%- USE L %]
5

  
6
<form>
5 7
 [%- IF delivered %]
6
 [%- SET RO = ' readonly' %]
7
 [%- END %]
8
  [% PROCESS "delivery_order/stock_dialog/_stock_delivered_dialog.html" %]
9
 [%- ELSE %]
8 10

  
9 11
 <table>
10 12
  <tr>
......
21 23
  </tr>
22 24
 </table>
23 25

  
24
  [%- UNLESS WHCONTENTS.size %]
25
  <p>[% 'There are no items in stock.' | $T8 %]</p>
26
  [%- ELSE %]
27

  
28 26
  [% L.hidden_tag("in_out", in_out) %]
29 27
  [% L.hidden_tag("parts_id", parts_id) %]
30 28
  [% L.hidden_tag("do_qty", do_qty) %]
......
32 30
  [% L.hidden_tag("row", row, class="data-row") %]
33 31
  [% L.hidden_tag("item_id", item_id) %]
34 32

  
33
  [%- IF in_out == "in" %]
35 34
  <p>
36
   <table id="stock-in-out-table">
37
    <tr class="listheading">
38
     <th>&nbsp;</th>
39
     <th>[% 'Warehouse' | $T8 %]</th>
40
     <th>[% 'Bin' | $T8 %]</th>
41
     <th>[% 'Charge Number' | $T8 %]</th>
42
     [% IF INSTANCE_CONF.get_show_bestbefore %]
43
     <th>[% 'Best Before' | $T8 %]</th>
44
     [% END %]
45
     [%- UNLESS delivered %]
46
     <th align="right">[% 'Available qty' | $T8 %]</th>
47
     [%- END %]
48
     <th align="right">[% 'Qty' | $T8 %]</th>
49
     <th align="right">[% 'Unit' | $T8 %]</th>
50
    </tr>
51

  
52
    [%- FOREACH row = WHCONTENTS %]
53
    <tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
54
     <td>[% loop.count %]</td>
55
     <td>[% row.warehousedescription | html %]</td>
56
     <td>[% row.bindescription | html %]</td>
57
     <td>[% row.chargenumber | html %]</td>
58
     [% IF INSTANCE_CONF.get_show_bestbefore %]
59
     <td>[% row.bestbefore | html %]</td>
60
     [% END %]
61

  
62
     [%- IF delivered %]
63

  
64
     <td>[% LxERP.format_amount(row.stock_qty) | html %]</td>
65
     <td>
66
      [% row.stock_unit | html %]
67
      [% L.hidden_tag("unit", row.stock_unit, class="data-unit") %]
68
     </td>
69

  
70
     [%- ELSE %]
71

  
72
     <td>[% row.available_qty | html %]</td>
73
     <td>
74
      [% L.input_tag("qty", row.stock_qty                              ? LxERP.format_amount(row.stock_qty)
75
                          : (WHCONTENTS.size == 1) && (!row.stock_qty) ? LxERP.format_amount(do_qty)
76
                          : "", class="numeric data-qty", size="12") %]</td>
77
     <td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
78

  
79
     [%- END %]
80
     <td style="display:none">
81
      [% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
82
      [% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
83
      [% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
84
      [% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
85
      [% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
86
     </td>
87
    </tr>
35
   <table id="stock-info-table">
36
    [%- PROCESS "delivery_order/stock_dialog/_stock_info_table.html" %]
37
   </table>
38
  </p>
39
  [%- END %]
88 40

  
41
  <p>
42
   <table id="stock-in-out-table">
43
    [%- IF in_out == "in" %]
44
     [%- PROCESS "delivery_order/stock_dialog/_stock_in_table.html" %]
45
    [%- ELSE %]
46
     [%- PROCESS "delivery_order/stock_dialog/_stock_out_table.html" %]
89 47
    [%- END %]
90 48
   </table>
91 49
  </p>
92 50

  
93 51
  <hr size="3" noshade>
94 52

  
95
  <p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) IF !delivered %]</p>
53
  <p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) %]</p>
96 54

  
97 55
  [%- END %]
98 56
 </form>
99

  
100

  
templates/webpages/delivery_order/stock_dialog/_stock_delivered_dialog.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
[%- USE LxERP %]
4
[%- USE L %]
5
 [%- IF delivered %]
6
 [%- SET RO = ' readonly' %]
7
 [%- END %]
8

  
9
 <table>
10
  <tr>
11
   <td>[% 'Part Number' | $T8 %]</td>
12
   <td>[% part.partnumber | html %]</td>
13
  </tr>
14
  <tr>
15
   <td>[% 'Description' | $T8 %]</td>
16
   <td>[% part.description | html %]</td>
17
  </tr>
18
  <tr>
19
   <td>[% 'Qty according to delivery order' | $T8 %]</td>
20
   <td>[% LxERP.format_amount(do_qty) %] [% do_unit | html %]</td>
21
  </tr>
22
 </table>
23

  
24
  [%- UNLESS WHCONTENTS.size %]
25
  <p>[% 'There are no items in stock.' | $T8 %]</p>
26
  [%- ELSE %]
27

  
28
  [% L.hidden_tag("in_out", in_out) %]
29
  [% L.hidden_tag("parts_id", parts_id) %]
30
  [% L.hidden_tag("do_qty", do_qty) %]
31
  [% L.hidden_tag("do_unit", do_unit) %]
32
  [% L.hidden_tag("row", row, class="data-row") %]
33
  [% L.hidden_tag("item_id", item_id) %]
34

  
35
  <p>
36
   <table id="stock-in-out-table">
37
    <tr class="listheading">
38
     <th>&nbsp;</th>
39
     <th>[% 'Warehouse' | $T8 %]</th>
40
     <th>[% 'Bin' | $T8 %]</th>
41
     <th>[% 'Charge Number' | $T8 %]</th>
42
     [% IF INSTANCE_CONF.get_show_bestbefore %]
43
     <th>[% 'Best Before' | $T8 %]</th>
44
     [% END %]
45
     [%- UNLESS delivered %]
46
     <th align="right">[% 'Available qty' | $T8 %]</th>
47
     [%- END %]
48
     <th align="right">[% 'Qty' | $T8 %]</th>
49
     <th align="right">[% 'Unit' | $T8 %]</th>
50
    </tr>
51

  
52
    [%- FOREACH row = WHCONTENTS %]
53
    <tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
54
     <td>[% loop.count %]</td>
55
     <td>[% row.warehousedescription | html %]</td>
56
     <td>[% row.bindescription | html %]</td>
57
     <td>[% row.chargenumber | html %]</td>
58
     [% IF INSTANCE_CONF.get_show_bestbefore %]
59
     <td>[% row.bestbefore | html %]</td>
60
     [% END %]
61

  
62
     [%- IF delivered %]
63

  
64
     <td>[% LxERP.format_amount(row.stock_qty) | html %]</td>
65
     <td>
66
      [% row.stock_unit | html %]
67
      [% L.hidden_tag("unit", row.stock_unit, class="data-unit") %]
68
     </td>
69

  
70
     [%- ELSE %]
71

  
72
     <td>[% row.available_qty | html %]</td>
73
     <td>
74
      [% L.input_tag("qty", row.stock_qty                              ? LxERP.format_amount(row.stock_qty)
75
                          : (WHCONTENTS.size == 1) && (!row.stock_qty) ? LxERP.format_amount(do_qty)
76
                          : "", class="numeric data-qty", size="12") %]</td>
77
     <td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
78

  
79
     [%- END %]
80
     <td style="display:none">
81
      [% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
82
      [% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
83
      [% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
84
      [% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
85
      [% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
86
     </td>
87
    </tr>
88

  
89
    [%- END %]
90
   </table>
91
  </p>
92

  
93
  <hr size="3" noshade>
94

  
95
  <p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) IF !delivered %]</p>
96

  
97
  [%- END %]
98
 </form>
99

  
100

  
templates/webpages/delivery_order/stock_dialog/_stock_in_table.html
1
<tr class="listheading">
2
 <th>[% 'Warehouse' | $T8 %]</th>
3
 <th>[% 'Bin' | $T8 %]</th>
4
 <th align="right">[% 'Qty' | $T8 %]</th>
5
 <th align="right">[% 'Unit' | $T8 %]</th>
6
</tr>
7

  
8
<tr>
9
 [% L.multi_level_select_tag(
10
      "test_tag", WAREHOUSES, 2, surround_tag="td",
11
      level_1={
12
        name="warehouse.id",
13
        value_key="id",
14
        title_key="description",
15
      },
16
      level_2={
17
        object_key="bins",
18
        name="bin.id",
19
        value_key="id",
20
        title_key="description",
21
      },
22
    ) %]
23

  
24
 <td>
25
  [% L.input_tag("qty", LxERP.format_amount(do_qty), class="numeric data-qty", size="12") %]</td>
26
 <td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
27

  
28
 <td style="display:none">
29
  [% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
30
  [% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
31
  [% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
32
  [% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
33
  [% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
34
 </td>
35
</tr>
36
<tr>
37
  [% L.multi_level_select_tag("multi_select_foo_bar_foobar", COLLECTION, 3,
38
      surround_tag="td",
39
      level_1={
40
        name="foo.id",
41
        value_key="id",
42
        title_key="description",
43
        default="2",
44
      },
45
      level_2={
46
        object_key="key_1",
47
        name="bar.id",
48
        value_key="id",
49
        title_key="description",
50
        default="1",
51
      },
52
      level_3={
53
        object_key="key_2",
54
        name="foobar.id",
55
        value_key="id",
56
        title_key="value",
57
        default="4",
58
      },
59
    ) %]
60
</tr>
templates/webpages/delivery_order/stock_dialog/_stock_info_table.html
1
<tr class="listheading">
2
 <th>&nbsp;</th>
3
 <th>[% 'Warehouse' | $T8 %]</th>
4
 <th>[% 'Bin' | $T8 %]</th>
5
 <th>[% 'Charge Number' | $T8 %]</th>
6
 [% IF INSTANCE_CONF.get_show_bestbefore %]
7
 <th>[% 'Best Before' | $T8 %]</th>
8
 [% END %]
9
 <th align="right">[% 'Available qty' | $T8 %]</th>
10
</tr>
11

  
12
[%- FOREACH row = WHCONTENTS %]
13
<tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
14
 <td>[% loop.count %]</td>
15
 <td>[% row.warehousedescription | html %]</td>
16
 <td>[% row.bindescription | html %]</td>
17
 <td>[% row.chargenumber | html %]</td>
18
 [% IF INSTANCE_CONF.get_show_bestbefore %]
19
 <td>[% row.bestbefore | html %]</td>
20
 [% END %]
21

  
22
 <td>[% row.available_qty | html %]</td>
23
 <td>
24
  [% row.stock_unit | html %]
25
 </td>
26
</tr>
27
[%- END %]
templates/webpages/delivery_order/stock_dialog/_stock_out_table.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
[%- USE LxERP %]
4
[%- USE L %]
5
 [%- IF delivered %]
6
 [%- SET RO = ' readonly' %]
7
 [%- END %]
8

  
9
 <table>
10
  <tr>
11
   <td>[% 'Part Number' | $T8 %]</td>
12
   <td>[% part.partnumber | html %]</td>
13
  </tr>
14
  <tr>
15
   <td>[% 'Description' | $T8 %]</td>
16
   <td>[% part.description | html %]</td>
17
  </tr>
18
  <tr>
19
   <td>[% 'Qty according to delivery order' | $T8 %]</td>
20
   <td>[% LxERP.format_amount(do_qty) %] [% do_unit | html %]</td>
21
  </tr>
22
 </table>
23

  
24
  [%- UNLESS WHCONTENTS.size %]
25
  <p>[% 'There are no items in stock.' | $T8 %]</p>
26
  [%- ELSE %]
27

  
28
  [% L.hidden_tag("in_out", in_out) %]
29
  [% L.hidden_tag("parts_id", parts_id) %]
30
  [% L.hidden_tag("do_qty", do_qty) %]
31
  [% L.hidden_tag("do_unit", do_unit) %]
32
  [% L.hidden_tag("row", row, class="data-row") %]
33
  [% L.hidden_tag("item_id", item_id) %]
34

  
35
  <p>
36
   <table id="stock-in-out-table">
37
    <tr class="listheading">
38
     <th>&nbsp;</th>
39
     <th>[% 'Warehouse' | $T8 %]</th>
40
     <th>[% 'Bin' | $T8 %]</th>
41
     <th>[% 'Charge Number' | $T8 %]</th>
42
     [% IF INSTANCE_CONF.get_show_bestbefore %]
43
     <th>[% 'Best Before' | $T8 %]</th>
44
     [% END %]
45
     [%- UNLESS delivered %]
46
     <th align="right">[% 'Available qty' | $T8 %]</th>
47
     [%- END %]
48
     <th align="right">[% 'Qty' | $T8 %]</th>
49
     <th align="right">[% 'Unit' | $T8 %]</th>
50
    </tr>
51

  
52
    [%- FOREACH row = WHCONTENTS %]
53
    <tr [% IF row.stock_error %] class="error"[% ELSE %]class="listrow"[% END %]>
54
     <td>[% loop.count %]</td>
55
     <td>[% row.warehousedescription | html %]</td>
56
     <td>[% row.bindescription | html %]</td>
57
     <td>[% row.chargenumber | html %]</td>
58
     [% IF INSTANCE_CONF.get_show_bestbefore %]
59
     <td>[% row.bestbefore | html %]</td>
60
     [% END %]
61

  
62
     [%- IF delivered %]
63

  
64
     <td>[% LxERP.format_amount(row.stock_qty) | html %]</td>
65
     <td>
66
      [% row.stock_unit | html %]
67
      [% L.hidden_tag("unit", row.stock_unit, class="data-unit") %]
68
     </td>
69

  
70
     [%- ELSE %]
71

  
72
     <td>[% row.available_qty | html %]</td>
73
     <td>
74
      [% L.input_tag("qty", row.stock_qty                              ? LxERP.format_amount(row.stock_qty)
75
                          : (WHCONTENTS.size == 1) && (!row.stock_qty) ? LxERP.format_amount(do_qty)
76
                          : "", class="numeric data-qty", size="12") %]</td>
77
     <td>[% L.select_tag("unit_" _ loop.count, part.unit_obj.convertible_units, value_key="name", default=row.stock_unit, class="data-unit") %]</td>
78

  
79
     [%- END %]
80
     <td style="display:none">
81
      [% L.hidden_tag("warehouse_id", row.warehouse_id, class="data-warehouse-id") %]
82
      [% L.hidden_tag("bin_id", row.bin_id, class="data-bin-id") %]
83
      [% L.hidden_tag("chargenumber", row.chargenumber, class="data-chargenumber") %]
84
      [% L.hidden_tag("delivery_order_items_stock_id", row.delivery_order_items_stock_id, class="data-stock-id") %]
85
      [% L.hidden_tag("bestbefore", row.bestbefore, class="data-bestbefore") IF INSTANCE_CONF.get_show_bestbefore %]
86
     </td>
87
    </tr>
88

  
89
    [%- END %]
90
   </table>
91
  </p>
92

  
93
  <hr size="3" noshade>
94

  
95
  <p>[% L.button_tag('kivi.DeliveryOrder.save_updated_stock()', LxERP.t8('Save')) IF !delivered %]</p>
96

  
97
  [%- END %]
98
 </form>
99

  
100

  

Auch abrufbar als: Unified diff