update form barang
This commit is contained in:
@@ -37,5 +37,6 @@ user_guide_src/cilexer/pycilexer.egg-info/*
|
|||||||
/tests/results/
|
/tests/results/
|
||||||
/dev-docs/
|
/dev-docs/
|
||||||
/ai-rules/
|
/ai-rules/
|
||||||
|
*.omo/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"sessionID": "ses_068c091cfffeSZ25RoesHkRZHA",
|
||||||
|
"updatedAt": "2026-07-25T03:09:04.625Z",
|
||||||
|
"sources": {
|
||||||
|
"background-task": {
|
||||||
|
"state": "idle",
|
||||||
|
"updatedAt": "2026-07-25T03:09:04.625Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"sessionID": "ses_0690d5681fferVVn0tDzMM9Ow7",
|
||||||
|
"updatedAt": "2026-07-25T08:09:46.929Z",
|
||||||
|
"sources": {
|
||||||
|
"background-task": {
|
||||||
|
"state": "idle",
|
||||||
|
"updatedAt": "2026-07-25T08:09:46.929Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1087,6 +1087,7 @@ class Items extends CI_Controller {
|
|||||||
ib.id as barcode_id,
|
ib.id as barcode_id,
|
||||||
ib.item_id,
|
ib.item_id,
|
||||||
ib.qty_sisa,
|
ib.qty_sisa,
|
||||||
|
ib.barcode,
|
||||||
ib.warehouse_id,
|
ib.warehouse_id,
|
||||||
ib.status as barcode_status,
|
ib.status as barcode_status,
|
||||||
i.nama_barang,
|
i.nama_barang,
|
||||||
@@ -1182,6 +1183,9 @@ class Items extends CI_Controller {
|
|||||||
'qty_sisa' => $new_qty_sisa,
|
'qty_sisa' => $new_qty_sisa,
|
||||||
'status' => $new_qty_sisa <= 0 ? 'installed' : $barcode->barcode_status
|
'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
|
// END - Item Movement & item barcodes update status
|
||||||
|
|
||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
|
|||||||
@@ -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()
|
public function batch_kembalikan()
|
||||||
{
|
{
|
||||||
$barcodes = $this->input->post('barcodes');
|
$barcodes = $this->input->post('barcodes');
|
||||||
@@ -209,6 +221,7 @@ class Teknisi extends CI_Controller {
|
|||||||
|
|
||||||
$result[] = [
|
$result[] = [
|
||||||
$no++,
|
$no++,
|
||||||
|
$row->tanggal ?? date('d/m/Y'),
|
||||||
htmlspecialchars($row->barcode, ENT_QUOTES, 'UTF-8'),
|
htmlspecialchars($row->barcode, ENT_QUOTES, 'UTF-8'),
|
||||||
htmlspecialchars($row->nama_barang, ENT_QUOTES, 'UTF-8'),
|
htmlspecialchars($row->nama_barang, ENT_QUOTES, 'UTF-8'),
|
||||||
htmlspecialchars($row->serial_number, ENT_QUOTES, 'UTF-8') ?: '-',
|
htmlspecialchars($row->serial_number, ENT_QUOTES, 'UTF-8') ?: '-',
|
||||||
@@ -240,15 +253,32 @@ class Teknisi extends CI_Controller {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = $this->ptm->get_teknisi_items_full($user_id);
|
$tanggal_param = $this->input->get('tanggal');
|
||||||
$noFaktur = 'GRJN/K/' . date('d/m/Y');
|
$items = [];
|
||||||
$tanggal = date('d F Y');
|
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 = [];
|
$itemsData = [];
|
||||||
$no = 1;
|
$no = 1;
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$itemsData[] = [
|
$itemsData[] = [
|
||||||
'no' => $no++,
|
'no' => $no++,
|
||||||
|
'tanggal' => $item->tanggal ?? date('d/m/Y'),
|
||||||
'barcode' => $item->barcode ?? '-',
|
'barcode' => $item->barcode ?? '-',
|
||||||
'nama_barang' => $item->nama_barang ?? '-',
|
'nama_barang' => $item->nama_barang ?? '-',
|
||||||
'serial_number' => $item->serial_number ?? '-',
|
'serial_number' => $item->serial_number ?? '-',
|
||||||
@@ -275,9 +305,6 @@ class Teknisi extends CI_Controller {
|
|||||||
|
|
||||||
public function generate_pdf_barang_bawaan($user_id = null)
|
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;
|
$user_id = (int)$user_id;
|
||||||
if (!$user_id) {
|
if (!$user_id) {
|
||||||
@@ -293,9 +320,22 @@ class Teknisi extends CI_Controller {
|
|||||||
show_error('Teknisi tidak ditemukan', 404);
|
show_error('Teknisi tidak ditemukan', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = $this->ptm->get_teknisi_items_full($user_id);
|
$tanggal_param = $this->input->get('tanggal');
|
||||||
$noFaktur = 'GRJN/K/' . date('d/m/Y');
|
|
||||||
$tanggal = date('d F Y');
|
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 . 'third_party/fpdf/fpdf.php');
|
||||||
require_once(APPPATH . 'libraries/PDF_BarangBawaan.php');
|
require_once(APPPATH . 'libraries/PDF_BarangBawaan.php');
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class PDF_BarangBawaan extends FPDF
|
|||||||
private $tanggal;
|
private $tanggal;
|
||||||
private $teknisi;
|
private $teknisi;
|
||||||
|
|
||||||
private $colWidths = [10, 28, 48, 30, 12, 62];
|
private $colWidths = [8, 18, 27, 44, 26, 10, 57];
|
||||||
|
|
||||||
public function __construct($orientation = 'L', $unit = 'mm', $size = 'A5')
|
public function __construct($orientation = 'L', $unit = 'mm', $size = 'A5')
|
||||||
{
|
{
|
||||||
@@ -57,7 +57,7 @@ class PDF_BarangBawaan extends FPDF
|
|||||||
$this->SetTextColor(255, 255, 255);
|
$this->SetTextColor(255, 255, 255);
|
||||||
$this->SetFont('Arial', 'B', 7);
|
$this->SetFont('Arial', 'B', 7);
|
||||||
|
|
||||||
$headers = ['No', 'Barcode', 'Nama Barang', 'Serial Number', 'Jumlah', 'Keterangan'];
|
$headers = ['No', 'Tanggal', 'Barcode', 'Nama Barang', 'Serial Number', 'Jumlah', 'Keterangan'];
|
||||||
foreach ($headers as $i => $h) {
|
foreach ($headers as $i => $h) {
|
||||||
$this->Cell($this->colWidths[$i], 7, $h, 1, 0, 'C', true);
|
$this->Cell($this->colWidths[$i], 7, $h, 1, 0, 'C', true);
|
||||||
}
|
}
|
||||||
@@ -73,8 +73,8 @@ class PDF_BarangBawaan extends FPDF
|
|||||||
$minRowH = 8;
|
$minRowH = 8;
|
||||||
$no = 1;
|
$no = 1;
|
||||||
|
|
||||||
$colsMultiCell = [false, false, true, true, false, true];
|
$colsMultiCell = [false, false, true, true, true, false, true];
|
||||||
$cellAligns = ['C', 'L', 'L', 'L', 'C', 'L'];
|
$cellAligns = ['C', 'C', 'L', 'L', 'L', 'C', 'L'];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
|
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
|
||||||
@@ -85,6 +85,7 @@ class PDF_BarangBawaan extends FPDF
|
|||||||
|
|
||||||
$cellValues = [
|
$cellValues = [
|
||||||
(string)$no,
|
(string)$no,
|
||||||
|
$item->tanggal ?? '-',
|
||||||
$barcode,
|
$barcode,
|
||||||
$namaBarang,
|
$namaBarang,
|
||||||
$serial,
|
$serial,
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
->from('item_barcodes ib')
|
->from('item_barcodes ib')
|
||||||
->join('items i', 'i.id = ib.item_id', 'left')
|
->join('items i', 'i.id = ib.item_id', 'left')
|
||||||
->where('ib.barcode', $barcode)
|
->where('ib.barcode', $barcode)
|
||||||
|
->where('ib.qty_sisa >', 0)
|
||||||
->get()
|
->get()
|
||||||
->row();
|
->row();
|
||||||
|
|
||||||
@@ -74,6 +75,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
->from('item_barcodes ib')
|
->from('item_barcodes ib')
|
||||||
->join('items i', 'i.id = ib.item_id', 'left')
|
->join('items i', 'i.id = ib.item_id', 'left')
|
||||||
->where('ib.serial_number', $barcode)
|
->where('ib.serial_number', $barcode)
|
||||||
|
->where('ib.qty_sisa >', 0)
|
||||||
->get()
|
->get()
|
||||||
->row();
|
->row();
|
||||||
}
|
}
|
||||||
@@ -163,6 +165,19 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
|
|
||||||
return ['status' => true, 'message' => $msg, 'errors' => $errors];
|
return ['status' => true, 'message' => $msg, 'errors' => $errors];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_dates_by_employee_id($user_id)
|
||||||
|
{
|
||||||
|
return $this->db
|
||||||
|
->select("DATE(it.created_at) as tanggal")
|
||||||
|
->from('item_technician it')
|
||||||
|
->where('it.user_id', $user_id)
|
||||||
|
->where('it.status', 'active')
|
||||||
|
->group_by("DATE(it.created_at)")
|
||||||
|
->order_by("DATE(it.created_at)", "DESC")
|
||||||
|
->get()
|
||||||
|
->result();
|
||||||
|
}
|
||||||
|
|
||||||
public function batch_dibawa(array $barcodes, $user_id)
|
public function batch_dibawa(array $barcodes, $user_id)
|
||||||
{
|
{
|
||||||
@@ -362,10 +377,11 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
public function get_teknisi_items_data($user_id, $start, $length, $search, $order_col, $order_dir)
|
public function get_teknisi_items_data($user_id, $start, $length, $search, $order_col, $order_dir)
|
||||||
{
|
{
|
||||||
$sort_cols = [
|
$sort_cols = [
|
||||||
1 => 'it.barcode',
|
1 => 'it.created_at',
|
||||||
2 => 'i.nama_barang',
|
2 => 'it.barcode',
|
||||||
3 => 'ib.serial_number',
|
3 => 'i.nama_barang',
|
||||||
4 => 'it.status'
|
4 => 'ib.serial_number',
|
||||||
|
5 => 'it.status'
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->db
|
$this->db
|
||||||
@@ -375,7 +391,7 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
ib.serial_number,
|
ib.serial_number,
|
||||||
ib.qty_sisa,
|
ib.qty_sisa,
|
||||||
it.status,
|
it.status,
|
||||||
it.created_at
|
DATE_FORMAT(it.created_at, '%d/%m/%Y') as tanggal
|
||||||
")
|
")
|
||||||
->from('item_technician it')
|
->from('item_technician it')
|
||||||
->join('items i', 'i.id = it.item_id', 'left')
|
->join('items i', 'i.id = it.item_id', 'left')
|
||||||
@@ -484,21 +500,28 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
->row();
|
->row();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_teknisi_items_full($user_id)
|
public function get_teknisi_items_full($user_id, $tanggal = null)
|
||||||
{
|
{
|
||||||
return $this->db
|
$this->db
|
||||||
->select("
|
->select("
|
||||||
it.barcode,
|
it.barcode,
|
||||||
i.nama_barang,
|
i.nama_barang,
|
||||||
ib.serial_number,
|
ib.serial_number,
|
||||||
ib.qty_sisa,
|
ib.qty_sisa,
|
||||||
it.status
|
it.status,
|
||||||
|
DATE_FORMAT(it.created_at, '%d/%m/%Y') as tanggal
|
||||||
")
|
")
|
||||||
->from('item_technician it')
|
->from('item_technician it')
|
||||||
->join('items i', 'i.id = it.item_id', 'left')
|
->join('items i', 'i.id = it.item_id', 'left')
|
||||||
->join('item_barcodes ib', 'ib.barcode = it.barcode', 'left')
|
->join('item_barcodes ib', 'ib.barcode = it.barcode', 'left')
|
||||||
->where('it.user_id', $user_id)
|
->where('it.user_id', $user_id)
|
||||||
->where('it.status', 'active')
|
->where('it.status', 'active');
|
||||||
|
|
||||||
|
if ($tanggal AND $tanggal != 'all') {
|
||||||
|
$this->db->where('DATE(it.created_at)', $tanggal);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db
|
||||||
->order_by('it.created_at', 'ASC')
|
->order_by('it.created_at', 'ASC')
|
||||||
->get()
|
->get()
|
||||||
->result();
|
->result();
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ body {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:50px">No</th>
|
<th style="width:50px">No</th>
|
||||||
|
<th>Tanggal</th>
|
||||||
<th>Barcode</th>
|
<th>Barcode</th>
|
||||||
<th>Nama Barang</th>
|
<th>Nama Barang</th>
|
||||||
<th>Serial Number</th>
|
<th>Serial Number</th>
|
||||||
@@ -531,7 +532,9 @@ body {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<small class="text-muted">Tanggal</small><br>
|
<small class="text-muted">Tanggal</small><br>
|
||||||
<strong id="fbTanggal">-</strong>
|
<select class="form-select form-select-sm d-inline-block" id="fbTanggalList" style="max-width:2000px">
|
||||||
|
<option value="">-- Pilih Tanggal --</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<small class="text-muted">Teknisi</small><br>
|
<small class="text-muted">Teknisi</small><br>
|
||||||
@@ -549,6 +552,7 @@ body {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:50px">No</th>
|
<th style="width:50px">No</th>
|
||||||
|
<th style="width:85px">Tanggal</th>
|
||||||
<th>Barcode</th>
|
<th>Barcode</th>
|
||||||
<th>Nama Barang</th>
|
<th>Nama Barang</th>
|
||||||
<th>Serial Number</th>
|
<th>Serial Number</th>
|
||||||
@@ -751,9 +755,10 @@ $(function(){
|
|||||||
{ data: 2 },
|
{ data: 2 },
|
||||||
{ data: 3 },
|
{ data: 3 },
|
||||||
{ data: 4 },
|
{ data: 4 },
|
||||||
{ data: 5, className: 'text-center' }
|
{ data: 5 },
|
||||||
|
{ data: 6, className: 'text-center' }
|
||||||
],
|
],
|
||||||
order: [[1, 'asc']],
|
order: [[1, 'desc']],
|
||||||
// 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,
|
pageLength: 10,
|
||||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']]
|
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']]
|
||||||
@@ -769,16 +774,35 @@ $(function(){
|
|||||||
let dtFormBarang;
|
let dtFormBarang;
|
||||||
let _formBarangUserId = null;
|
let _formBarangUserId = null;
|
||||||
|
|
||||||
$(document).on('click', '.btn-form-barang-bawaan', function(){
|
function loadListTanggal(userId) {
|
||||||
let userId = $(this).data('id');
|
$.get("<?= base_url('teknisi/get_date_by_employee_id'); ?>", {user_id: userId}, function(r){
|
||||||
let nama = $(this).data('nama');
|
if (!r.status) {
|
||||||
_formBarangUserId = userId;
|
Swal.fire({icon:'error', text:r.message});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$('#fbNoFaktur').text('Memuat...');
|
let opt='<option value="">-- Pilih Tanggal --</option><option value="all">ALL</option>';
|
||||||
$('#fbTanggal').text('-');
|
r.data.forEach(d=>{
|
||||||
$('#fbTeknisi').text(nama);
|
let parts = d.tanggal.split('-');
|
||||||
|
let display = parts[2] + '/' + parts[1] + '/' + parts[0];
|
||||||
|
opt += `<option value="${d.tanggal}">${display}</option>`;
|
||||||
|
});
|
||||||
|
$('#fbTanggalList').html(opt);
|
||||||
|
}, 'json');
|
||||||
|
}
|
||||||
|
|
||||||
$.get("<?= base_url('teknisi/get_form_barang_bawaan_data'); ?>", {user_id: userId}, function(r){
|
function loadFormBarangData() {
|
||||||
|
let tanggalVal = $('#fbTanggalList').val();
|
||||||
|
|
||||||
|
if (!tanggalVal) {
|
||||||
|
$('#fbNoFaktur').text('Memuat...');
|
||||||
|
if (dtFormBarang) {
|
||||||
|
dtFormBarang.clear().draw();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get("<?= base_url('teknisi/get_form_barang_bawaan_data'); ?>", {user_id: _formBarangUserId, tanggal: tanggalVal}, function(r){
|
||||||
if (!r.status) {
|
if (!r.status) {
|
||||||
Swal.fire({icon:'error', text:r.message});
|
Swal.fire({icon:'error', text:r.message});
|
||||||
return;
|
return;
|
||||||
@@ -786,8 +810,6 @@ $(function(){
|
|||||||
|
|
||||||
let d = r.data;
|
let d = r.data;
|
||||||
$('#fbNoFaktur').text(d.no_faktur);
|
$('#fbNoFaktur').text(d.no_faktur);
|
||||||
$('#fbTanggal').text(d.tanggal);
|
|
||||||
$('#fbTeknisi').text(d.teknisi);
|
|
||||||
|
|
||||||
if (dtFormBarang) {
|
if (dtFormBarang) {
|
||||||
dtFormBarang.destroy();
|
dtFormBarang.destroy();
|
||||||
@@ -797,24 +819,63 @@ $(function(){
|
|||||||
data: d.items,
|
data: d.items,
|
||||||
columns: [
|
columns: [
|
||||||
{ data: 'no' },
|
{ data: 'no' },
|
||||||
|
{ data: 'tanggal' },
|
||||||
{ data: 'barcode' },
|
{ data: 'barcode' },
|
||||||
{ data: 'nama_barang' },
|
{ data: 'nama_barang' },
|
||||||
{ data: 'serial_number' },
|
{ data: 'serial_number' },
|
||||||
{ data: 'jumlah', className: 'text-center' }
|
{ data: 'jumlah', className: 'text-center' }
|
||||||
],
|
],
|
||||||
// language: { url: "//cdn.datatables.net/plug-ins/1.13.6/i18n/id.json" },
|
|
||||||
pageLength: 10,
|
pageLength: 10,
|
||||||
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
|
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
|
||||||
order: []
|
order: []
|
||||||
});
|
});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#fbTanggalList').on('change', function() {
|
||||||
|
loadFormBarangData();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.btn-form-barang-bawaan', function(){
|
||||||
|
let userId = $(this).data('id');
|
||||||
|
let nama = $(this).data('nama');
|
||||||
|
_formBarangUserId = userId;
|
||||||
|
|
||||||
|
$('#fbNoFaktur').text('Memuat...');
|
||||||
|
$('#fbTanggalList').val('');
|
||||||
|
$('#fbTeknisi').text(nama);
|
||||||
|
|
||||||
|
if (!dtFormBarang) {
|
||||||
|
dtFormBarang = $('#tableFormBarang').DataTable({
|
||||||
|
data: [],
|
||||||
|
columns: [
|
||||||
|
{ data: 'no' },
|
||||||
|
{ data: 'tanggal' },
|
||||||
|
{ data: 'barcode' },
|
||||||
|
{ data: 'nama_barang' },
|
||||||
|
{ data: 'serial_number' },
|
||||||
|
{ data: 'jumlah', className: 'text-center' }
|
||||||
|
],
|
||||||
|
pageLength: 10,
|
||||||
|
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
|
||||||
|
order: [],
|
||||||
|
language: {
|
||||||
|
emptyTable: "No data available"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dtFormBarang.clear().draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadListTanggal(userId);
|
||||||
|
|
||||||
$('#modalFormBarangBawaan').modal('show');
|
$('#modalFormBarangBawaan').modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btnCetakPDF').click(function(){
|
$('#btnCetakPDF').click(function(){
|
||||||
if (_formBarangUserId) {
|
if (_formBarangUserId) {
|
||||||
let url = "<?= base_url('teknisi/generate_pdf_barang_bawaan/'); ?>" + _formBarangUserId;
|
let tanggalVal = $('#fbTanggalList').val();
|
||||||
|
let url = "<?= base_url('teknisi/generate_pdf_barang_bawaan/'); ?>" + _formBarangUserId + '?tanggal=' + encodeURIComponent(tanggalVal);
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user