Barcode Scan + Barcode Print
This commit is contained in:
@@ -63,6 +63,11 @@
|
||||
<input type="number" id="qty" class="form-control">
|
||||
</div>
|
||||
|
||||
<div id="group_tracking_qty">
|
||||
<label class="mt-2">Jumlah Per (Roll, Box, Dus)</label>
|
||||
<input type="number" id="tracking_qty" class="form-control">
|
||||
</div>
|
||||
|
||||
<label class="mt-2">Harga Beli</label>
|
||||
<input type="text" id="harga_beli" class="form-control format-rupiah">
|
||||
|
||||
@@ -252,16 +257,47 @@ function loadGudangList(){
|
||||
},'json');
|
||||
}
|
||||
|
||||
function loadKode(){
|
||||
$.get("<?= base_url('kodebarang/list'); ?>",res=>{
|
||||
let opt='<option value="">-- PILIH KODE --</option>';
|
||||
res.forEach(a=>{
|
||||
opt += `<option value="${a.id}">${a.kode_barang} - ${a.nama}</option>`;
|
||||
// function loadKode(){
|
||||
// $.get("<?= base_url('kodebarang/list'); ?>",res=>{
|
||||
// let opt='<option value="">-- PILIH KODE --</option>';
|
||||
// res.forEach(a=>{
|
||||
// opt += `<option value="${a.id}" data-type="${a.tracking_type}">${a.kode_barang} - ${a.nama}</option>`;
|
||||
// });
|
||||
// $('#kode_barang').html(opt);
|
||||
// },'json');
|
||||
// }
|
||||
|
||||
function loadKode() {
|
||||
$.get("<?= base_url('kodebarang/list'); ?>", function(res) {
|
||||
|
||||
let opt = '<option value="">-- PILIH KODE --</option>';
|
||||
|
||||
res.forEach(function(a){
|
||||
opt += `
|
||||
<option value="${a.id}"
|
||||
data-type="${a.tracking_type}">
|
||||
${a.kode_barang} - ${a.nama}
|
||||
</option>
|
||||
`;
|
||||
});
|
||||
$('#kode_barang').html(opt);
|
||||
},'json');
|
||||
|
||||
$('#kode_barang').html(opt).trigger('change');
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$(document).on('change', '#kode_barang', function () {
|
||||
|
||||
let type = $(this).find(':selected').data('type');
|
||||
|
||||
if(type == 'QTY'){
|
||||
$('#group_tracking_qty').show();
|
||||
}else{
|
||||
$('#group_tracking_qty').hide();
|
||||
$('#tracking_qty').val('');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// ================= RESET FORM =================
|
||||
function resetForm(){
|
||||
$('#id').val('');
|
||||
@@ -270,6 +306,8 @@ function resetForm(){
|
||||
$('#harga_beli').val('');
|
||||
$('#harga_jual').val('');
|
||||
$('#tanggal_beli').val('');
|
||||
$('#tracking_qty').val('');
|
||||
$('#group_tracking_qty').hide();
|
||||
}
|
||||
|
||||
// ================= INIT LOAD =================
|
||||
@@ -334,6 +372,7 @@ $('#btnSimpan').click(function(){
|
||||
warehouse_id: $('#warehouse_id').val(),
|
||||
account_kas: $('#account_kas').val(),
|
||||
tanggal_beli: $('#tanggal_beli').val(),
|
||||
tracking_qty: $('#tracking_qty').val(),
|
||||
status: `draft`
|
||||
};
|
||||
|
||||
@@ -501,6 +540,74 @@ $('#btnKeluar').click(function(){
|
||||
// ================= END URUSAN KELUAR ===============
|
||||
// =====================================================
|
||||
|
||||
// ================= PRINT BARCODE =================
|
||||
$(document).on('click', '.btn-print', function () {
|
||||
|
||||
let id = $(this).data('id');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Cetak Barcode',
|
||||
html: `
|
||||
<div class="text-left">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="print_column" class="font-weight-bold">
|
||||
Jumlah Kolom
|
||||
</label>
|
||||
<select id="print_column" class="form-control">
|
||||
<option value="1">1 Kolom</option>
|
||||
<option value="2">2 Kolom</option>
|
||||
<option value="3" selected>3 Kolom (Rekomendasi)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0">
|
||||
<label for="duplicat" class="font-weight-bold">
|
||||
Jumlah Cetak per Barcode
|
||||
</label>
|
||||
<select id="duplicat" class="form-control">
|
||||
<option value="1" selected>1 Label</option>
|
||||
<option value="2">2 Label</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`,
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Cetak',
|
||||
cancelButtonText: 'Batal',
|
||||
confirmButtonColor: '#f0ad4e',
|
||||
preConfirm: () => {
|
||||
|
||||
let column = $('#print_column').val();
|
||||
let duplicat = $('#duplicat').val();
|
||||
|
||||
return {
|
||||
column: column,
|
||||
duplicat: duplicat
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}).then((result) => {
|
||||
|
||||
if (!result.isConfirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.open(
|
||||
"<?= base_url('items/print_barcode/'); ?>" +
|
||||
id +
|
||||
"?column=" + result.value.column +
|
||||
"&duplicat=" + result.value.duplicat,
|
||||
"_blank"
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// ================= DELETE =================
|
||||
$(document).on('click','.btn-delete',function(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user