my $in_out = $form->{type} =~ /^sales/ ? 'out' : 'in';
my $sinfo = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_${i}"});
+ my $do_qty = AM->sum_with_unit($::form->{"qty_$i"}, $::form->{"unit_$i"});
my $sum = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $sinfo });
+ my $matches = $do_qty == $sum;
my $content = $form->format_amount_units('amount' => $sum * 1,
'part_unit' => $form->{"partunit_$i"},
'amount_unit' => $all_units->{$form->{"partunit_$i"}}->{base_unit},
'conv_units' => 'convertible_not_smaller',
'max_places' => 2);
- $content = qq|<span id="stock_in_out_qty_display_${i}">${content}</span> <input type="button" onclick="open_stock_in_out_window('${in_out}', $i);" value="?">|;
+ $content = qq|<span id="stock_in_out_qty_display_${i}">${content}</span><input type=hidden id='stock_in_out_qty_matches_$i' value='$matches'> <input type="button" onclick="open_stock_in_out_window('${in_out}', $i);" value="?">|;
$main::lxdebug->leave_sub();
_stock_in_out_set_qty_display($stock_info);
+ my $do_qty = AM->sum_with_unit($::form->parse_amount(\%::myconfig, $::form->{do_qty}), $::form->{do_unit});
+ my $transfer_qty = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $stock_info });
+
$form->header();
- print $form->parse_html_template('do/set_stock_in_out');
+ print $form->parse_html_template('do/set_stock_in_out', {
+ qty_matches => $do_qty == $transfer_qty,
+ });
$main::lxdebug->leave_sub();
}
} else {
_stock_in_out_set_qty_display($stock_info);
+ my $do_qty = AM->sum_with_unit($::form->parse_amount(\%::myconfig, $::form->{do_qty}), $::form->{do_unit});
+ my $transfer_qty = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $stock_info });
+
$form->header();
- print $form->parse_html_template('do/set_stock_in_out');
+ print $form->parse_html_template('do/set_stock_in_out', {
+ qty_matches => $do_qty == $transfer_qty,
+ });
}
$main::lxdebug->leave_sub();
'There are no items in stock.' => 'Dieser Artikel ist nicht eingelagert.',
'There are no items on your TODO list at the moment.' => 'Ihre Aufgabenliste enthält momentan keine Einträge.',
'There are still entries in the database for which no unit has been assigned.' => 'Es gibt noch Einträge in der Datenbank, für die keine Einheit zugeordnet ist.',
+ 'There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?' => 'Einige der Lagerbewegungen sind nicht vollständig und Lagerbewegungen können nachträglich nicht mehr verändert werden. Wollen Sie wirklich fortfahren?',
'There are usually three ways to install Perl modules.' => 'Es gibt normalerweise drei Arten, ein Perlmodul zu installieren.',
'There is at least one sales or purchase invoice for which Lx-Office recorded an inventory transaction with taxkeys even though no tax was recorded.' => 'Es gibt mindestens eine Einkaufs- oder Verkaufsrechnung, für die Lx-Office einen Steuerschlüssel ungleich 0 verzeichnet hat, obwohl für Warenbestandsbuchugen bei Rechnungen nie Steuern gebucht werden.',
'There is at least one transaction for which the user has chosen a logically wrong taxkey.' => 'Es gibt mindestens eine Buchung, bei der ein logisch nicht passender Steuerschlüssel ausgewählt wurde.',
[%- UNLESS delivered %]
<input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]">
[%- IF vc == 'customer' %]
- <input class="submit" type="submit" name="action_transfer_out" value="[% 'Transfer out' | $T8 %]">
+ <input class="submit" type="submit" name="action_transfer_out" onclick="return check_transfer_qty()" value="[% 'Transfer out' | $T8 %]">
[%- ELSE %]
- <input class="submit" type="submit" name="action_transfer_in" value="[% 'Transfer in' | $T8 %]">
+ <input class="submit" type="submit" name="action_transfer_in" onclick="return check_transfer_qty()" value="[% 'Transfer in' | $T8 %]">
[%- END %]
[%- END %]
[%- IF id %]
<input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
</form>
-
+<script type='text/javascript'>
+ function check_transfer_qty() {
+ var all_match = true;
+ var rowcount = $('input[name=rowcount]').val();
+ for (var i = 1; i < rowcount; i++) {
+ if ($('#stock_in_out_qty_matches_' + i).val() != 1) {
+ all_match = false;
+ }
+ }
+
+ if (all_match) {
+ return true;
+ } else {
+ return confirm("[% 'There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?' | $T8 %]");
+ }
+ }
+</script>
</body>
</html>