update invoice barcode id
This commit is contained in:
@@ -529,10 +529,11 @@ class Invoices extends CI_Controller {
|
||||
// =========================
|
||||
public function get_items($id)
|
||||
{
|
||||
$this->db->select('invoice_details.*, accounts.kode_akun, accounts.nama_akun, invoices.status');
|
||||
$this->db->select('invoice_details.*, accounts.kode_akun, accounts.nama_akun, invoices.status, item_barcodes.barcode');
|
||||
$this->db->from('invoice_details');
|
||||
$this->db->join('accounts', 'accounts.id = invoice_details.account_id', 'left');
|
||||
$this->db->join('invoices', 'invoices.id = invoice_details.invoice_id', 'left');
|
||||
$this->db->join('item_barcodes', 'item_barcodes.id = invoice_details.barcode_id', 'left');
|
||||
$this->db->where('invoice_details.invoice_id', $id);
|
||||
$this->db->order_by('tanggal','ASC');
|
||||
$this->db->order_by('id','ASC');
|
||||
@@ -619,6 +620,11 @@ class Invoices extends CI_Controller {
|
||||
]);
|
||||
|
||||
$this->db->where('id', $barcode_id)->update('item_barcodes', ['status' => $status_bar, 'qty_sisa' => $total_sisa]);
|
||||
|
||||
if ($status_bar == 'sold_out') {
|
||||
$this->db->where('barcode', $itemBar->barcode)->where('status', 'active')->update('item_technician', ['status' => 'inactive', 'deleted_at' => date('Y-m-d H:i:s')]);
|
||||
}
|
||||
|
||||
// END - Item Movement & item barcodes update status
|
||||
|
||||
$total_hpp = $qty * $item->harga_beli;
|
||||
@@ -916,11 +922,13 @@ class Invoices extends CI_Controller {
|
||||
->select('
|
||||
invoice_details.*,
|
||||
customers.nama,
|
||||
invoices.no_invoice
|
||||
invoices.no_invoice,
|
||||
item_barcodes.barcode
|
||||
')
|
||||
->from('invoice_details')
|
||||
->join('invoices', 'invoices.id = invoice_details.invoice_id')
|
||||
->join('customers', 'customers.id = invoices.customer_id')
|
||||
->join('item_barcodes', 'item_barcodes.id = invoice_details.barcode_id', 'left')
|
||||
->where('invoice_details.id', $id)
|
||||
->get()
|
||||
->row();
|
||||
@@ -928,6 +936,7 @@ class Invoices extends CI_Controller {
|
||||
if(!$d) return;
|
||||
|
||||
$total_hpp = 0;
|
||||
$barcode = '';
|
||||
|
||||
// =========================
|
||||
// 🔥 TENTUKAN NILAI JURNAL
|
||||
@@ -957,8 +966,10 @@ class Invoices extends CI_Controller {
|
||||
'ref_type' => 'invoice_details',
|
||||
'ref_id' => $id,
|
||||
'warehouse_id' => $d->warehouse_id,
|
||||
'keterangan' => 'Penjualan ' . $item->nama_barang . ' kepada ' . $d->nama . ' - Invoice ' . $d->no_invoice . ' - Tgl ' . $d->tanggal
|
||||
'keterangan' => 'Penjualan ' . $item->nama_barang . ' kepada ' . $d->nama . ' - Invoice ' . $d->no_invoice . ' - Tgl ' . $d->tanggal . ' - Kode ' . $d->barcode
|
||||
]);
|
||||
|
||||
$barcode = ' - Kode: ' . $d->barcode;
|
||||
|
||||
$this->update_item_stok($d->items_id);
|
||||
}
|
||||
@@ -975,7 +986,7 @@ class Invoices extends CI_Controller {
|
||||
$this->db->insert('journals', [
|
||||
'tanggal' => $d->tanggal,
|
||||
'no_ref' => $no_ref,
|
||||
'keterangan' => 'Penjualan '.$nama_item_jr,
|
||||
'keterangan' => 'Penjualan '.$nama_item_jr . $barcode . ' - Kepada: ' . $d->nama,
|
||||
'ref_type' => 'invoice_details',
|
||||
'ref_id' => $id,
|
||||
'created_by' => $this->session->userdata('user_id')
|
||||
|
||||
@@ -74,7 +74,7 @@ class PDF_BarangBawaan extends FPDF
|
||||
$no = 1;
|
||||
|
||||
$colsMultiCell = [false, false, true, true, false, true];
|
||||
$cellAligns = ['C', 'C', 'L', 'L', 'C', 'L'];
|
||||
$cellAligns = ['C', 'L', 'L', 'L', 'C', 'L'];
|
||||
|
||||
foreach ($items as $item) {
|
||||
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
|
||||
|
||||
@@ -605,7 +605,7 @@ $(function(){
|
||||
</td>
|
||||
<td>${no++}</td>
|
||||
<td>${formatTglIndo(v.tanggal)}</td>
|
||||
<td>${v.nama_item || '-'}</td>
|
||||
<td>${v.nama_item || '-'}<br><small class="text-secondary"><small></small><i>${v.barcode || ''}</i></small></td>
|
||||
<td>${v.qty || 0}</td>
|
||||
<td>${formatNumber(v.harga)}</td>
|
||||
<td>${formatNumber(subtotal)}</td>
|
||||
|
||||
@@ -612,7 +612,7 @@ $(function(){
|
||||
{ data: 'teknisi' },
|
||||
{ data: 'aksi', orderable: false }
|
||||
],
|
||||
language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 5,
|
||||
lengthMenu: [[5, 10, 25, -1], [5, 10, 25, 'All']]
|
||||
});
|
||||
@@ -626,7 +626,7 @@ $(function(){
|
||||
{ data: 'serial_number' },
|
||||
{ data: 'aksi', orderable: false }
|
||||
],
|
||||
language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 5,
|
||||
lengthMenu: [[5, 10, 25, -1], [5, 10, 25, 'All']]
|
||||
});
|
||||
@@ -650,7 +650,7 @@ $(function(){
|
||||
}
|
||||
],
|
||||
language: {
|
||||
url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json",
|
||||
// url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json",
|
||||
emptyTable: 'Pilih teknisi asal terlebih dahulu'
|
||||
},
|
||||
pageLength: 5,
|
||||
@@ -685,7 +685,7 @@ $(function(){
|
||||
{ data: 5, className: 'text-center', orderable: false }
|
||||
],
|
||||
order: [[1, 'asc']],
|
||||
language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 10,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']]
|
||||
});
|
||||
@@ -740,7 +740,7 @@ $(function(){
|
||||
{ data: 5, className: 'text-center' }
|
||||
],
|
||||
order: [[1, 'asc']],
|
||||
language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 10,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']]
|
||||
});
|
||||
@@ -788,7 +788,7 @@ $(function(){
|
||||
{ data: 'serial_number' },
|
||||
{ data: 'jumlah', className: 'text-center' }
|
||||
],
|
||||
language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
||||
pageLength: 10,
|
||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
|
||||
order: []
|
||||
@@ -1028,14 +1028,14 @@ $(function(){
|
||||
|
||||
function loadTransferItems() {
|
||||
let userId = $('#teknisiFrom').val();
|
||||
console.log('[loadTransferItems] userId:', userId);
|
||||
// console.log('[loadTransferItems] userId:', userId);
|
||||
if (!userId) {
|
||||
dtTransferItems.clear().draw();
|
||||
return;
|
||||
}
|
||||
|
||||
let url = "<?= base_url('teknisi/get_data'); ?>";
|
||||
console.log('[loadTransferItems] GET', url, {user_id: userId, status: 'active'});
|
||||
// console.log('[loadTransferItems] GET', url, {user_id: userId, status: 'active'});
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
@@ -1043,7 +1043,7 @@ $(function(){
|
||||
dataType: 'json',
|
||||
data: {user_id: userId, status: 'active'},
|
||||
success: function(r){
|
||||
console.log('[loadTransferItems] response:', r);
|
||||
// console.log('[loadTransferItems] response:', r);
|
||||
let rows = r.data || [];
|
||||
|
||||
window._checkedBarcodes = [];
|
||||
@@ -1118,7 +1118,7 @@ $(function(){
|
||||
}).then(result => {
|
||||
if (!result.isConfirmed) return;
|
||||
|
||||
console.log('[Transfer] submitting', barcodes.length, 'items, from_user:', fromUserId, 'to_user:', toUserId);
|
||||
// console.log('[Transfer] submitting', barcodes.length, 'items, from_user:', fromUserId, 'to_user:', toUserId);
|
||||
submitBatch('batch_transfer', {
|
||||
barcodes: barcodes,
|
||||
from_user_id: fromUserId,
|
||||
@@ -1154,7 +1154,7 @@ $(function(){
|
||||
if (!result.isConfirmed) return;
|
||||
|
||||
let barcodes = kembalikanData.map(d => d.barcode);
|
||||
console.log('[Kembalikan] submitting', barcodes.length, 'items:', barcodes);
|
||||
// console.log('[Kembalikan] submitting', barcodes.length, 'items:', barcodes);
|
||||
submitBatch('batch_kembalikan', {barcodes: barcodes}, function(){
|
||||
kembalikanData = [];
|
||||
refreshTable(dtKembalikan, []);
|
||||
@@ -1193,7 +1193,7 @@ $(function(){
|
||||
if (!result.isConfirmed) return;
|
||||
|
||||
let barcodes = dibawaData.map(d => d.barcode);
|
||||
console.log('[Dibawa] submitting', barcodes.length, 'items to user_id:', userId, 'barcodes:', barcodes);
|
||||
// console.log('[Dibawa] submitting', barcodes.length, 'items to user_id:', userId, 'barcodes:', barcodes);
|
||||
submitBatch('batch_dibawa', {barcodes: barcodes, user_id: userId}, function(){
|
||||
dibawaData = [];
|
||||
refreshTable(dtDibawa, []);
|
||||
@@ -1214,7 +1214,7 @@ $(function(){
|
||||
let originalText = btn.data('original-text') || btn.html();
|
||||
btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm me-1"></span> Memproses...');
|
||||
|
||||
console.log('[submitBatch] endpoint:', endpoint, 'payload:', JSON.stringify(data));
|
||||
// console.log('[submitBatch] endpoint:', endpoint, 'payload:', JSON.stringify(data));
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('teknisi/'); ?>" + endpoint,
|
||||
@@ -1223,7 +1223,7 @@ $(function(){
|
||||
data: data,
|
||||
traditional: false,
|
||||
success: function(r) {
|
||||
console.log('[submitBatch] response:', endpoint, r);
|
||||
// console.log('[submitBatch] response:', endpoint, r);
|
||||
btn.prop('disabled', false).html(originalText);
|
||||
|
||||
if (r.status) {
|
||||
|
||||
Reference in New Issue
Block a user