use parent qw(SL::Controller::Base);
use SL::Helper::Flash qw(flash_later);
+use SL::Helper::Number qw(_format_number_units);
use SL::Presenter::Tag qw(select_tag hidden_tag div_tag);
use SL::Locale::String qw(t8);
use SL::SessionFile::Random;
return @errors;
}
+sub calculate_stock_in_out {
+ my ($self, $item) = @_;
+
+ return "" if !$item->part || !$item->part->unit;
+
+ my $in_out = $self->type_data->properties("transfer");
+
+ my $do_qty = $item->qty;
+ my $sum = sum0 map { $_->unit_obj->convert_to($_->qty, $item->unit_obj) } @{ $item->delivery_order_stock_entries };
+
+ my $matches = $do_qty == $sum;
+ my $content = _format_number_units($sum, 2, $item->unit_obj, $item->part->unit_obj);
+
+ return $content;
+}
+
sub init_type_data {
SL::Controller::DeliveryOrder::TypeData->new($_[0]);
}
value_key = 'name',
class = 'unitselect') %]
</td>
+
+ <td>
+ <span id="stock_[% ID %]">[% SELF.calculate_stock_in_out(ITEM) %]</span>
+ <input type=hidden id='stock_in_out_qty_matches_[% ID %]' value='$matches'>
+ <input type="button" onclick="kivi.DeliveryOrder.open_stock_in_out_window('[% in_out %]', ID);" value="?">
+ </td>
</tr>
<tr [%- IF !MYCONFIG.show_form_details -%]style="display:none"[%- END -%]>
[%- END -%]
<th id="qty_header_id" class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("qty")'> [%- 'Qty' | $T8 %]</a></th>
<th class="listheading" nowrap width="5" >[%- 'Unit' | $T8 %] </th>
+ [% IF inout == 'in' %]
+ <th class="listheading" nowrap width="5" >[%- 'Transfer To Stock' | $T8 %] </th>
+ [% END %]
+ [% IF inout == 'out' %]
+ <th class="listheading" nowrap width="5" >[%- 'Release From Stock' | $T8 %] </th>
+ [% END %]
</tr>
</thead>