update form barang

This commit is contained in:
2026-07-27 08:32:05 +07:00
parent 0a16246138
commit 7d90548717
8 changed files with 187 additions and 37 deletions
+4
View File
@@ -1087,6 +1087,7 @@ class Items extends CI_Controller {
ib.id as barcode_id,
ib.item_id,
ib.qty_sisa,
ib.barcode,
ib.warehouse_id,
ib.status as barcode_status,
i.nama_barang,
@@ -1182,6 +1183,9 @@ class Items extends CI_Controller {
'qty_sisa' => $new_qty_sisa,
'status' => $new_qty_sisa <= 0 ? 'installed' : $barcode->barcode_status
]);
$this->db->where('barcode', $barcode->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
$this->db->trans_complete();
+49 -9
View File
@@ -88,6 +88,18 @@ class Teknisi extends CI_Controller {
]);
}
function get_date_by_employee_id()
{
$user_id = (int)$this->input->get('user_id');
if (!$user_id) {
echo json_encode(['status' => false, 'message' => 'ID teknisi tidak valid']);
return;
}
$dates = $this->ptm->get_dates_by_employee_id($user_id);
echo json_encode(['status' => true, 'data' => $dates]);
}
public function batch_kembalikan()
{
$barcodes = $this->input->post('barcodes');
@@ -209,6 +221,7 @@ class Teknisi extends CI_Controller {
$result[] = [
$no++,
$row->tanggal ?? date('d/m/Y'),
htmlspecialchars($row->barcode, ENT_QUOTES, 'UTF-8'),
htmlspecialchars($row->nama_barang, ENT_QUOTES, 'UTF-8'),
htmlspecialchars($row->serial_number, ENT_QUOTES, 'UTF-8') ?: '-',
@@ -240,15 +253,32 @@ class Teknisi extends CI_Controller {
return;
}
$items = $this->ptm->get_teknisi_items_full($user_id);
$noFaktur = 'GRJN/K/' . date('d/m/Y');
$tanggal = date('d F Y');
$tanggal_param = $this->input->get('tanggal');
$items = [];
if ($tanggal_param) {
$items = $this->ptm->get_teknisi_items_full($user_id, $tanggal_param);
}
if ($tanggal_param) {
if ($tanggal_param === 'all') {
$noFaktur = 'GRJN/K/ALL' . date('/m/Y');
$tanggal = date('d F Y');
} else {
$ts = strtotime($tanggal_param);
$noFaktur = 'GRJN/K/' . date('d/m/Y', $ts);
$tanggal = date('d F Y', $ts);
}
} else {
$noFaktur = 'GRJN/K/' . date('d/m/Y');
$tanggal = date('d F Y');
}
$itemsData = [];
$no = 1;
foreach ($items as $item) {
$itemsData[] = [
'no' => $no++,
'tanggal' => $item->tanggal ?? date('d/m/Y'),
'barcode' => $item->barcode ?? '-',
'nama_barang' => $item->nama_barang ?? '-',
'serial_number' => $item->serial_number ?? '-',
@@ -275,9 +305,6 @@ class Teknisi extends CI_Controller {
public function generate_pdf_barang_bawaan($user_id = null)
{
if ($this->session->userdata('role') != 'Admin') {
show_error('Akses ditolak', 403);
}
$user_id = (int)$user_id;
if (!$user_id) {
@@ -293,9 +320,22 @@ class Teknisi extends CI_Controller {
show_error('Teknisi tidak ditemukan', 404);
}
$items = $this->ptm->get_teknisi_items_full($user_id);
$noFaktur = 'GRJN/K/' . date('d/m/Y');
$tanggal = date('d F Y');
$tanggal_param = $this->input->get('tanggal');
if ($tanggal_param === 'all') {
$items = $this->ptm->get_teknisi_items_full($user_id);
$noFaktur = 'GRJN/K/ALL' . date('/m/Y');
$tanggal = 'Semua Tanggal';
} elseif ($tanggal_param) {
$ts = strtotime($tanggal_param);
$items = $this->ptm->get_teknisi_items_full($user_id, $tanggal_param);
$noFaktur = 'GRJN/K/' . date('d/m/Y', $ts);
$tanggal = date('d/m/Y', $ts);
} else {
$items = $this->ptm->get_teknisi_items_full($user_id);
$noFaktur = 'GRJN/K/' . date('d/m/Y');
$tanggal = date('d/m/Y');
}
require_once(APPPATH . 'third_party/fpdf/fpdf.php');
require_once(APPPATH . 'libraries/PDF_BarangBawaan.php');