Fix transfer quantity, unify date format, align demo seeds
Stock Transfer list showed 0.00 (read in instead of out); stock-out/transfer forms show the location quantity; dates display as YYYY-MM-DD HH:mm:ss. Demo seeds map product accounts, use product names and supplier batches, and add demo_seed_assets.php.
This commit is contained in:
@@ -93,6 +93,16 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Quantity: a stock-out always takes everything in the location -->
|
||||
<div class="mb-3 col-lg-6">
|
||||
<label for="location_quantity" class="form-label">Quantity</label>
|
||||
<div class="input-group">
|
||||
<input type="text" id="location_quantity" class="form-control text-end" placeholder="—" disabled>
|
||||
<span class="input-group-text" id="location_uom" style="min-width:60px;"> </span>
|
||||
</div>
|
||||
<div class="form-text">The whole quantity in the selected location is taken out.</div>
|
||||
</div>
|
||||
|
||||
<!-- Contact -->
|
||||
<div class="mb-3 col-lg-6">
|
||||
<label for="contact" class="form-label">Contact</label>
|
||||
@@ -159,6 +169,35 @@
|
||||
}
|
||||
set_select_value('#bin', data.bin, data.bin);
|
||||
scan_location_ready = true;
|
||||
show_location_quantity();
|
||||
});
|
||||
}
|
||||
|
||||
// Quantity held in the chosen location — the amount this stock-out moves.
|
||||
function show_location_quantity() {
|
||||
var bin_val = $('#bin').val();
|
||||
$('#location_quantity').val('');
|
||||
$('#location_uom').html(' ');
|
||||
if (!$('#warehouse').val() || !bin_val) return;
|
||||
|
||||
return ajax_request({
|
||||
url: '<?php echo $server_url?>ics/api/engine/retrieve_bin_stock.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
noLoading: true,
|
||||
queueLock: false,
|
||||
action: 'read',
|
||||
data: {
|
||||
warehouse: $('#warehouse').val(),
|
||||
zone: advanced ? $('#zone').val() : bin_val,
|
||||
aisle: advanced ? $('#aisle').val() : bin_val,
|
||||
bin: bin_val
|
||||
},
|
||||
onSuccess: function(res) {
|
||||
if (!res.output) return;
|
||||
$('#location_quantity').val(format_number(res.output.quantity, 2));
|
||||
$('#location_uom').text(res.output.uom || '');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -483,6 +522,8 @@
|
||||
$('#zone').html('<option value="">Please select ' + label_zone.toLowerCase() + '</option>').prop('disabled', true);
|
||||
$('#aisle').html('<option value="">Please select ' + label_aisle.toLowerCase() + '</option>').prop('disabled', true);
|
||||
$('#bin').html('<option value="">Please select ' + label_bin.toLowerCase() + '</option>').prop('disabled', true);
|
||||
$('#location_quantity').val('');
|
||||
$('#location_uom').html(' ');
|
||||
}
|
||||
|
||||
|
||||
@@ -509,7 +550,7 @@
|
||||
$('#serial_number').html(`<option value="${data.serial_number || ''}">${data.serial_number || '—'}</option>`)
|
||||
.val(data.serial_number || '').prop('disabled', true);
|
||||
|
||||
$('#warehouse').val('<?php echo $_GET["wh"];?>').prop('disabled', true);
|
||||
$('#warehouse').val('<?php echo (int)($_GET["wh"] ?? 0);?>').prop('disabled', true);
|
||||
|
||||
function populate_fields() {
|
||||
$.each(data, function(key, item) {
|
||||
@@ -522,6 +563,8 @@
|
||||
.attr('data-id', data.contact_id);
|
||||
$('#product_name').val(data.product_name);
|
||||
$('#product_sku').attr('secondary', data.product_sku).prop('disabled', true);
|
||||
$('#location_quantity').val(format_number(data.quantity, 2));
|
||||
$('#location_uom').text(data.uom || '');
|
||||
$('button[type=submit]').text('Update');
|
||||
$('button[type=reset]').hide();
|
||||
if (data.status == 0) {
|
||||
@@ -619,6 +662,9 @@
|
||||
if (advanced) retrieve_bin();
|
||||
});
|
||||
|
||||
// Bin selected → show how much it holds
|
||||
$('#bin').on('change', show_location_quantity);
|
||||
|
||||
<?php } ?>
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user