Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d42483b350 | |||
| 80ecad47a3 | |||
| 0b94af8a26 | |||
| 7d349d4efd | |||
| 6bcac8b65c | |||
| 0d1f83872c | |||
| 4c2fefe9c3 | |||
| 7d90548717 | |||
| 0a16246138 | |||
| abbabf4af8 |
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"editor.language.colorizedBracketPairs": []
|
||||||
|
}
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
## TODO Baru - Catch-up penyusutan multi-bulan
|
## TODO Baru - Catch-up penyusutan multi-bulan
|
||||||
|
|
||||||
- [ ] Refactor logic depreciation_asset agar memproses multi-bulan (catch-up)
|
- [x] Refactor logic depreciation_asset agar memproses multi-bulan (catch-up)
|
||||||
- [ ] Terapkan loop per bulan dari bulan setelah tanggal patokan sampai bulan berjalan
|
- [x] Terapkan loop per bulan dari bulan setelah tanggal patokan sampai bulan berjalan
|
||||||
- [ ] Pertahankan idempotent check per bulan berdasarkan asset_mutations
|
- [x] Pertahankan idempotent check per bulan berdasarkan asset_mutations
|
||||||
- [ ] Generate mutasi + jurnal per bulan yang eligible
|
- [x] Generate mutasi + jurnal per bulan yang eligible
|
||||||
- [ ] Update nilai buku & akumulasi penyusutan asset setelah proses loop
|
- [x] Update nilai buku & akumulasi penyusutan asset setelah proses loop
|
||||||
- [ ] Tambahkan detail response per bulan (processed/skipped reason)
|
- [x] Tambahkan detail response per bulan (processed/skipped reason)
|
||||||
- [ ] Validasi syntax PHP untuk Cronjob.php
|
- [x] Validasi syntax PHP untuk Cronjob.php
|
||||||
|
|||||||
@@ -60,3 +60,6 @@ $route['iclock/cdata'] = 'AttendanceWebhook/cdata';
|
|||||||
$route['dbcompare/sql'] = 'Dbcompare/sql';
|
$route['dbcompare/sql'] = 'Dbcompare/sql';
|
||||||
$route['dbcompare/sql_download'] = 'Dbcompare/sql_download';
|
$route['dbcompare/sql_download'] = 'Dbcompare/sql_download';
|
||||||
|
|
||||||
|
// teknisi log barang
|
||||||
|
$route['teknisi/log_barang'] = 'teknisi/log_barang';
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class Accounts extends CI_Controller {
|
|||||||
$data[] = [
|
$data[] = [
|
||||||
$no,
|
$no,
|
||||||
$row->kode_akun,
|
$row->kode_akun,
|
||||||
|
$row->priority,
|
||||||
$row->nama_akun,
|
$row->nama_akun,
|
||||||
ucfirst($row->tipe),
|
ucfirst($row->tipe),
|
||||||
ucfirst($row->posisi),
|
ucfirst($row->posisi),
|
||||||
@@ -80,7 +81,8 @@ class Accounts extends CI_Controller {
|
|||||||
'tipe' => $tipe,
|
'tipe' => $tipe,
|
||||||
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
||||||
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
||||||
'parent_id' => $this->input->post('parent_id') ?: NULL
|
'parent_id' => $this->input->post('parent_id') ?: NULL,
|
||||||
|
'priority' => $this->input->post('priority') ?: NULL
|
||||||
];
|
];
|
||||||
|
|
||||||
$insert = $this->dm->setTable('accounts')->insert($data);
|
$insert = $this->dm->setTable('accounts')->insert($data);
|
||||||
@@ -111,7 +113,8 @@ class Accounts extends CI_Controller {
|
|||||||
'tipe' => $tipe,
|
'tipe' => $tipe,
|
||||||
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
'posisi' => in_array($tipe, ['asset','expense']) ? 'debit' : 'kredit',
|
||||||
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
'kategori' => in_array($tipe, ['asset','liability','equity']) ? 'neraca' : 'laba_rugi',
|
||||||
'parent_id' => $this->input->post('parent_id') ?: NULL
|
'parent_id' => $this->input->post('parent_id') ?: NULL,
|
||||||
|
'priority' => $this->input->post('priority') ?: NULL
|
||||||
];
|
];
|
||||||
|
|
||||||
$update = $this->dm->setTable('accounts')->update($id, $data);
|
$update = $this->dm->setTable('accounts')->update($id, $data);
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ class Asset extends CI_Controller {
|
|||||||
// ================= GET DATA =================
|
// ================= GET DATA =================
|
||||||
public function get_data(){
|
public function get_data(){
|
||||||
$data = $this->db
|
$data = $this->db
|
||||||
->select('assets.*, lokasi_asset.nama as nama_lokasi')
|
->select('assets.*, lokasi_asset.nama as nama_lokasi, item_barcodes.barcode as barcode, item_barcodes.id as barcode_id')
|
||||||
->from('assets')
|
->from('assets')
|
||||||
->join('lokasi_asset', 'lokasi_asset.id = assets.lokasi_asset_id', 'left')
|
->join('lokasi_asset', 'lokasi_asset.id = assets.lokasi_asset_id', 'left')
|
||||||
|
->join('item_barcodes', 'item_barcodes.id = assets.barcode_id', 'left')
|
||||||
->order_by('assets.tanggal_perolehan','DESC')
|
->order_by('assets.tanggal_perolehan','DESC')
|
||||||
->get()
|
->get()
|
||||||
->result();
|
->result();
|
||||||
@@ -37,7 +38,7 @@ class Asset extends CI_Controller {
|
|||||||
$no++,
|
$no++,
|
||||||
$d->tanggal_perolehan,
|
$d->tanggal_perolehan,
|
||||||
$d->kode_asset ?? '-',
|
$d->kode_asset ?? '-',
|
||||||
$d->nama_asset,
|
$d->nama_asset . ($d->barcode_id ? '<br><small class="text-muted"><i>'.$d->barcode.'</i></small>' : ''),
|
||||||
$d->nama_lokasi ?? '-',
|
$d->nama_lokasi ?? '-',
|
||||||
$d->keterangan ?? '-',
|
$d->keterangan ?? '-',
|
||||||
number_format($d->nilai_perolehan),
|
number_format($d->nilai_perolehan),
|
||||||
@@ -201,9 +202,22 @@ class Asset extends CI_Controller {
|
|||||||
|
|
||||||
$this->db->trans_start();
|
$this->db->trans_start();
|
||||||
|
|
||||||
|
// stock log keluar per item
|
||||||
|
$this->db->insert('stock_logs',[
|
||||||
|
'item_id' => $item_id,
|
||||||
|
'warehouse_id' => '1', // default gudang
|
||||||
|
'qty' => $qty,
|
||||||
|
'tipe' => 'keluar',
|
||||||
|
'keterangan' => 'Pemindahan barang ke asset tanggal ' . $tanggal . ' - (' . $keterangan . ')'
|
||||||
|
]);
|
||||||
|
$stock_log_id = $this->db->insert_id();
|
||||||
|
$this->update_item_stok($item_id);
|
||||||
|
|
||||||
// INSERT ASSET
|
// INSERT ASSET
|
||||||
$this->db->insert('assets',[
|
$this->db->insert('assets',[
|
||||||
'item_id' => $item_id,
|
'item_id' => $item_id,
|
||||||
|
'barcode_id' => $barcode_id,
|
||||||
|
'stock_log_id' => $stock_log_id,
|
||||||
'kode_asset' => 'AST-'.time(),
|
'kode_asset' => 'AST-'.time(),
|
||||||
'nama_asset' => $nama_asset,
|
'nama_asset' => $nama_asset,
|
||||||
'harga_per_unit' => $harga,
|
'harga_per_unit' => $harga,
|
||||||
@@ -238,6 +252,8 @@ class Asset extends CI_Controller {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// END - Item Movement & item barcodes update status
|
||||||
|
|
||||||
$total_sisa = $itemBar->qty_sisa - $qty;
|
$total_sisa = $itemBar->qty_sisa - $qty;
|
||||||
$status_bar = ($total_sisa == 0) ? 'installed' : 'available';
|
$status_bar = ($total_sisa == 0) ? 'installed' : 'available';
|
||||||
|
|
||||||
@@ -282,11 +298,6 @@ class Asset extends CI_Controller {
|
|||||||
'kredit' => $nilai_perolehan
|
'kredit' => $nilai_perolehan
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// UPDATE STOK ITEM (kurangi sesuai qty)
|
|
||||||
$this->db->where('id', $item_id)
|
|
||||||
->set('stok', 'stok-'.$qty, FALSE)
|
|
||||||
->update('items');
|
|
||||||
|
|
||||||
// MUTATION DARI GUDANG
|
// MUTATION DARI GUDANG
|
||||||
$this->db->insert('asset_mutations',[
|
$this->db->insert('asset_mutations',[
|
||||||
'asset_id' => $asset_id,
|
'asset_id' => $asset_id,
|
||||||
@@ -313,7 +324,12 @@ class Asset extends CI_Controller {
|
|||||||
$lokasi_asset_id = (int)$this->input->post('lokasi_asset');
|
$lokasi_asset_id = (int)$this->input->post('lokasi_asset');
|
||||||
$keterangan = $this->input->post('keterangan');
|
$keterangan = $this->input->post('keterangan');
|
||||||
|
|
||||||
$this->db->trans_start();
|
$asset = $this->db->get_where('assets',['id'=>$id])->row();
|
||||||
|
|
||||||
|
if(!$asset){
|
||||||
|
echo json_encode(['status'=>false,'message'=>'Asset tidak ditemukan']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'nama_asset' => $nama_asset,
|
'nama_asset' => $nama_asset,
|
||||||
@@ -321,17 +337,18 @@ class Asset extends CI_Controller {
|
|||||||
'keterangan' => $keterangan
|
'keterangan' => $keterangan
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if($asset->barcode_id && $asset->item_id){
|
||||||
|
$data = [
|
||||||
|
'lokasi_asset_id' => $lokasi_asset_id,
|
||||||
|
'keterangan' => $keterangan
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_start();
|
||||||
|
|
||||||
$this->db->where('id',$id);
|
$this->db->where('id',$id);
|
||||||
$this->db->update('assets',$data);
|
$this->db->update('assets',$data);
|
||||||
|
|
||||||
// MUTATION EDIT
|
|
||||||
$this->db->insert('asset_mutations',[
|
|
||||||
'asset_id' => $id,
|
|
||||||
'tipe' => 'penambahan',
|
|
||||||
'nilai' => 0,
|
|
||||||
'keterangan' => 'Edit asset: '.$nama_asset
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
|
|
||||||
if ($this->db->trans_status()) {
|
if ($this->db->trans_status()) {
|
||||||
@@ -349,9 +366,27 @@ class Asset extends CI_Controller {
|
|||||||
$keterangan = $this->input->post('keterangan');
|
$keterangan = $this->input->post('keterangan');
|
||||||
|
|
||||||
$asset = $this->db->get_where('assets',['id'=>$id])->row();
|
$asset = $this->db->get_where('assets',['id'=>$id])->row();
|
||||||
|
$itemBar = $this->db->get_where('item_barcodes',['id'=>$asset->barcode_id])->row();
|
||||||
|
|
||||||
|
if($alasan == 'dijual' || $alasan == 'rusak' ){
|
||||||
|
echo json_encode(['status'=>false,'message'=>'Alasan <b>' .strtoupper($alasan).'</b> tidak bisa digunakan, Karena fitur belum tersedia. Silahkan pilih alasan lain.']);
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->trans_start();
|
$this->db->trans_start();
|
||||||
|
|
||||||
|
if ($asset->barcode_id && $asset->item_id) {
|
||||||
|
// Update item_barcodes status to 'available' if it was linked to this asset
|
||||||
|
$qty_sisa = $asset->qty + $itemBar->qty_sisa;
|
||||||
|
|
||||||
|
$this->db->where('id', $asset->barcode_id)
|
||||||
|
->update('item_barcodes', ['status' => 'available', 'qty_sisa' => $qty_sisa]);
|
||||||
|
$this->db->delete('stock_logs', ['id'=>$asset->stock_log_id]);
|
||||||
|
$this->update_item_stok($asset->item_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Hapus journal
|
// Hapus journal
|
||||||
$journals = $this->db->get_where('journals', ['ref_type'=>'assets', 'ref_id'=>$id])->result();
|
$journals = $this->db->get_where('journals', ['ref_type'=>'assets', 'ref_id'=>$id])->result();
|
||||||
foreach($journals as $j){
|
foreach($journals as $j){
|
||||||
@@ -453,4 +488,18 @@ class Asset extends CI_Controller {
|
|||||||
->result();
|
->result();
|
||||||
echo json_encode($data);
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function update_item_stok($item_id)
|
||||||
|
{
|
||||||
|
$stok = $this->db->query("
|
||||||
|
SELECT COALESCE(SUM(qty * IF(tipe='masuk',1,-1)),0) as stok
|
||||||
|
FROM stock_logs
|
||||||
|
WHERE item_id = ?
|
||||||
|
", [$item_id])->row()->stok;
|
||||||
|
|
||||||
|
$this->db->where('id', $item_id)
|
||||||
|
->update('items', [
|
||||||
|
'stok' => $stok
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,7 @@ class Generateinvoice extends CI_Controller {
|
|||||||
$detail = $this->db
|
$detail = $this->db
|
||||||
->where('invoice_id', $invoice_id)
|
->where('invoice_id', $invoice_id)
|
||||||
->order_by('tanggal', 'ASC')
|
->order_by('tanggal', 'ASC')
|
||||||
|
->order_by('id', 'ASC')
|
||||||
->get('invoice_details')
|
->get('invoice_details')
|
||||||
->result_array();
|
->result_array();
|
||||||
|
|
||||||
@@ -87,12 +88,16 @@ class Generateinvoice extends CI_Controller {
|
|||||||
// =========================
|
// =========================
|
||||||
$total = (float)$invi['total'];
|
$total = (float)$invi['total'];
|
||||||
|
|
||||||
$this->db->select_sum('sisa_piutang');
|
// ================= AMBIL TUNGGAKAN =================
|
||||||
|
$this->db->select_sum('total');
|
||||||
|
$this->db->select_sum('total_bayar');
|
||||||
$this->db->where('customer_id', $invi['customer_id']);
|
$this->db->where('customer_id', $invi['customer_id']);
|
||||||
$this->db->where('status !=', 'paid');
|
$this->db->where('status !=', 'paid');
|
||||||
$this->db->where('id !=', $invoice_id); // exclude invoice sekarang
|
$this->db->where('id <', $invoice_id); // exclude invoice sekarang
|
||||||
|
|
||||||
$tunggakan = $this->db->get('invoices')->row()->sisa_piutang ?? 0;
|
$row = $this->db->get('invoices')->row();
|
||||||
|
|
||||||
|
$tunggakan = ($row->total ?? 0) - ($row->total_bayar ?? 0);
|
||||||
|
|
||||||
// Ngambil Data Tunggakan bulan lalu jika ada.
|
// Ngambil Data Tunggakan bulan lalu jika ada.
|
||||||
$keteranganlain = 'Akumulasi Tunggakan Invoice Bulan Lalu';
|
$keteranganlain = 'Akumulasi Tunggakan Invoice Bulan Lalu';
|
||||||
|
|||||||
@@ -510,12 +510,15 @@ class Invoices extends CI_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================= AMBIL TUNGGAKAN =================
|
// ================= AMBIL TUNGGAKAN =================
|
||||||
$this->db->select_sum('sisa_piutang');
|
$this->db->select_sum('total');
|
||||||
|
$this->db->select_sum('total_bayar');
|
||||||
$this->db->where('customer_id', $data->customer_id);
|
$this->db->where('customer_id', $data->customer_id);
|
||||||
$this->db->where('status !=', 'paid');
|
$this->db->where('status !=', 'paid');
|
||||||
$this->db->where('id !=', $id); // exclude invoice sekarang
|
$this->db->where('id <', $id); // exclude invoice sekarang
|
||||||
|
|
||||||
$tunggakan = $this->db->get('invoices')->row()->sisa_piutang ?? 0;
|
$row = $this->db->get('invoices')->row();
|
||||||
|
|
||||||
|
$tunggakan = ($row->total ?? 0) - ($row->total_bayar ?? 0);
|
||||||
|
|
||||||
// ================= MASUKKAN KE DATA =================
|
// ================= MASUKKAN KE DATA =================
|
||||||
$data->tunggakan = (int)$tunggakan;
|
$data->tunggakan = (int)$tunggakan;
|
||||||
@@ -1193,7 +1196,7 @@ class Invoices extends CI_Controller {
|
|||||||
public function get_accounts_assets()
|
public function get_accounts_assets()
|
||||||
{
|
{
|
||||||
$data = $this->db
|
$data = $this->db
|
||||||
->where_in('kode_akun', [101,102,207,201,202,203,204,205,209])
|
->where_in('tipe', ['asset','liability'])
|
||||||
->order_by('kode_akun', 'ASC')
|
->order_by('kode_akun', 'ASC')
|
||||||
->get('accounts')
|
->get('accounts')
|
||||||
->result();
|
->result();
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ class Items extends CI_Controller {
|
|||||||
->or_like('i.nama_barang', $barcode, 'both')
|
->or_like('i.nama_barang', $barcode, 'both')
|
||||||
->or_like('ib.serial_number', $barcode, 'both')
|
->or_like('ib.serial_number', $barcode, 'both')
|
||||||
->group_end()
|
->group_end()
|
||||||
->limit(15)
|
// ->limit(15)
|
||||||
->get()
|
->get()
|
||||||
->result();
|
->result();
|
||||||
|
|
||||||
@@ -646,7 +646,7 @@ class Items extends CI_Controller {
|
|||||||
public function get_accounts()
|
public function get_accounts()
|
||||||
{
|
{
|
||||||
$data = $this->db
|
$data = $this->db
|
||||||
->where_in('kode_akun', [101,102,201])
|
->where_in('kode_akun', [101,102,201,122,125,105])
|
||||||
->order_by('kode_akun','ASC')
|
->order_by('kode_akun','ASC')
|
||||||
->get('accounts')
|
->get('accounts')
|
||||||
->result();
|
->result();
|
||||||
@@ -969,6 +969,8 @@ class Items extends CI_Controller {
|
|||||||
|
|
||||||
// hapus item
|
// hapus item
|
||||||
$this->db->delete('stock_logs',['item_id'=>$id]);
|
$this->db->delete('stock_logs',['item_id'=>$id]);
|
||||||
|
$this->db->delete('item_movements',['item_id'=>$id]);
|
||||||
|
$this->db->delete('item_barcodes',['item_id'=>$id]);
|
||||||
$this->db->delete('items',['id'=>$id]);
|
$this->db->delete('items',['id'=>$id]);
|
||||||
|
|
||||||
$j = $this->db->get_where('journals', [
|
$j = $this->db->get_where('journals', [
|
||||||
@@ -1087,6 +1089,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 +1185,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();
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class Neraca extends CI_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->group_by('a.id');
|
$this->db->group_by('a.id');
|
||||||
$this->db->order_by('a.kode_akun','ASC');
|
$this->db->order_by('a.priority','ASC');
|
||||||
|
|
||||||
$rows = $this->db->get()->result();
|
$rows = $this->db->get()->result();
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class Teknisi extends CI_Controller {
|
|||||||
'serial_number' => $item->serial_number,
|
'serial_number' => $item->serial_number,
|
||||||
'barcode_id' => $item->barcode_id,
|
'barcode_id' => $item->barcode_id,
|
||||||
'item_id' => $item->item_id,
|
'item_id' => $item->item_id,
|
||||||
|
'barcode_status' => $item->barcode_status,
|
||||||
'teknisi_id' => $teknisi ? $teknisi->user_id : null,
|
'teknisi_id' => $teknisi ? $teknisi->user_id : null,
|
||||||
'teknisi_name' => $teknisi ? $teknisi->full_name : null,
|
'teknisi_name' => $teknisi ? $teknisi->full_name : null,
|
||||||
'teknisi_code' => $teknisi ? $teknisi->employee_code : null
|
'teknisi_code' => $teknisi ? $teknisi->employee_code : null
|
||||||
@@ -87,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');
|
||||||
@@ -208,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') ?: '-',
|
||||||
@@ -239,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 ?? '-',
|
||||||
@@ -274,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) {
|
||||||
@@ -292,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');
|
||||||
@@ -436,4 +477,42 @@ class Teknisi extends CI_Controller {
|
|||||||
|
|
||||||
echo json_encode(['status' => true, 'message' => $msg, 'errors' => $errors]);
|
echo json_encode(['status' => true, 'message' => $msg, 'errors' => $errors]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_log_data()
|
||||||
|
{
|
||||||
|
$data = $this->ptm->get_log_barang();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
$no = 1;
|
||||||
|
|
||||||
|
foreach ($data as $row) {
|
||||||
|
$status_badge = $row->status === 'active'
|
||||||
|
? '<span class="badge bg-success">ACTIVE</span>'
|
||||||
|
: '<span class="badge bg-secondary">INACTIVE</span>';
|
||||||
|
|
||||||
|
$result[] = [
|
||||||
|
$no++,
|
||||||
|
htmlspecialchars($row->teknisi_name ?? '-', ENT_QUOTES, 'UTF-8'),
|
||||||
|
htmlspecialchars($row->item_code ?? '-', ENT_QUOTES, 'UTF-8'),
|
||||||
|
htmlspecialchars($row->barcode, ENT_QUOTES, 'UTF-8'),
|
||||||
|
htmlspecialchars($row->nama_barang ?? '-', ENT_QUOTES, 'UTF-8'),
|
||||||
|
$row->created_at ? date('d/m/Y H:i', strtotime($row->created_at)) : '-',
|
||||||
|
$row->status === 'inactive' && $row->deleted_at ? date('d/m/Y H:i', strtotime($row->deleted_at)) : '-',
|
||||||
|
$status_badge,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode(['data' => $result]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function log_barang()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
"active_menu" => "peralatan_teknisi",
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->load->view('partials/header', $data);
|
||||||
|
$this->load->view('peralatan_teknisi/log_barang', $data);
|
||||||
|
$this->load->view('partials/footer');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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, 42, 24, 10, 46, 15];
|
||||||
|
|
||||||
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', 'Server'];
|
||||||
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, false];
|
||||||
$cellAligns = ['C', 'L', 'L', 'L', 'C', 'L'];
|
$cellAligns = ['C', 'C', 'L', 'L', 'L', 'C', 'L', 'L'];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
|
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
|
||||||
@@ -82,14 +82,17 @@ class PDF_BarangBawaan extends FPDF
|
|||||||
$serial = $item->serial_number ?? '-';
|
$serial = $item->serial_number ?? '-';
|
||||||
$barcode = $item->barcode ?? '-';
|
$barcode = $item->barcode ?? '-';
|
||||||
$jumlah = isset($item->qty_sisa) ? (int)$item->qty_sisa : 1;
|
$jumlah = isset($item->qty_sisa) ? (int)$item->qty_sisa : 1;
|
||||||
|
$server = '';
|
||||||
|
|
||||||
$cellValues = [
|
$cellValues = [
|
||||||
(string)$no,
|
(string)$no,
|
||||||
|
$item->tanggal ?? '-',
|
||||||
$barcode,
|
$barcode,
|
||||||
$namaBarang,
|
$namaBarang,
|
||||||
$serial,
|
$serial,
|
||||||
(string)$jumlah,
|
(string)$jumlah,
|
||||||
$keterangan
|
$keterangan,
|
||||||
|
$server
|
||||||
];
|
];
|
||||||
|
|
||||||
$maxLines = 1;
|
$maxLines = 1;
|
||||||
@@ -121,7 +124,8 @@ class PDF_BarangBawaan extends FPDF
|
|||||||
foreach ($cellValues as $i => $val) {
|
foreach ($cellValues as $i => $val) {
|
||||||
$this->SetXY($currentX, $startY);
|
$this->SetXY($currentX, $startY);
|
||||||
if ($colsMultiCell[$i]) {
|
if ($colsMultiCell[$i]) {
|
||||||
$contentH = $maxLines * $lineH;
|
$colLines = $this->NbLines($this->colWidths[$i], $val);
|
||||||
|
$contentH = $colLines * $lineH;
|
||||||
$offsetY = ($rowH - $contentH) / 2;
|
$offsetY = ($rowH - $contentH) / 2;
|
||||||
$this->SetXY($currentX, $startY + $offsetY);
|
$this->SetXY($currentX, $startY + $offsetY);
|
||||||
$this->MultiCell($this->colWidths[$i], $lineH, $val, 0, $cellAligns[$i]);
|
$this->MultiCell($this->colWidths[$i], $lineH, $val, 0, $cellAligns[$i]);
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
@@ -164,6 +166,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)
|
||||||
{
|
{
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
@@ -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();
|
||||||
@@ -508,4 +531,26 @@ class PeralatanTeknisi_model extends CI_Model {
|
|||||||
{
|
{
|
||||||
return 'GRJN/K/' . date('d/m/Y');
|
return 'GRJN/K/' . date('d/m/Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_log_barang()
|
||||||
|
{
|
||||||
|
return $this->db
|
||||||
|
->select("
|
||||||
|
it.barcode,
|
||||||
|
it.item_id,
|
||||||
|
it.user_id,
|
||||||
|
it.status,
|
||||||
|
it.created_at,
|
||||||
|
it.deleted_at,
|
||||||
|
ke.full_name as teknisi_name,
|
||||||
|
i.kode_detail as item_code,
|
||||||
|
i.nama_barang
|
||||||
|
")
|
||||||
|
->from('item_technician it')
|
||||||
|
->join('k_employees ke', 'ke.id = it.user_id', 'left')
|
||||||
|
->join('items i', 'i.id = it.item_id', 'left')
|
||||||
|
->order_by('it.created_at', 'DESC')
|
||||||
|
->get()
|
||||||
|
->result();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th width="5%">No</th>
|
<th width="5%">No</th>
|
||||||
<th>Kode</th>
|
<th>Kode</th>
|
||||||
|
<th>Urutan Laporan</th>
|
||||||
<th>Nama</th>
|
<th>Nama</th>
|
||||||
<th>Tipe</th>
|
<th>Tipe</th>
|
||||||
<th>Posisi</th>
|
<th>Posisi</th>
|
||||||
@@ -47,6 +48,9 @@
|
|||||||
<label class="fw-semibold mt-2">Nama Akun</label>
|
<label class="fw-semibold mt-2">Nama Akun</label>
|
||||||
<input type="text" class="form-control" id="nama_akun">
|
<input type="text" class="form-control" id="nama_akun">
|
||||||
|
|
||||||
|
<label class="fw-semibold mt-2">Urutan Laporan</label>
|
||||||
|
<input type="number" class="form-control" id="priority">
|
||||||
|
|
||||||
<label class="fw-semibold mt-2">Tipe</label>
|
<label class="fw-semibold mt-2">Tipe</label>
|
||||||
<select class="form-control" id="tipe">
|
<select class="form-control" id="tipe">
|
||||||
<option value="asset">Asset</option>
|
<option value="asset">Asset</option>
|
||||||
@@ -96,7 +100,8 @@ $(function(){
|
|||||||
{ data: 3 },
|
{ data: 3 },
|
||||||
{ data: 4 },
|
{ data: 4 },
|
||||||
{ data: 5 },
|
{ data: 5 },
|
||||||
{ data: 6, orderable:false }
|
{ data: 6 },
|
||||||
|
{ data: 7, orderable:false }
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
processing: `<div class="text-center"><div class="spinner-border text-warning"></div></div>`
|
processing: `<div class="text-center"><div class="spinner-border text-warning"></div></div>`
|
||||||
@@ -108,6 +113,7 @@ $(function(){
|
|||||||
$('#inputId').val('');
|
$('#inputId').val('');
|
||||||
$('#kode_akun').val('');
|
$('#kode_akun').val('');
|
||||||
$('#nama_akun').val('');
|
$('#nama_akun').val('');
|
||||||
|
$('#priority').val('');
|
||||||
$('#tipe').val('asset');
|
$('#tipe').val('asset');
|
||||||
$('#parent_id').val('');
|
$('#parent_id').val('');
|
||||||
$('#modalAccount .modal-title').text('Tambah Akun');
|
$('#modalAccount .modal-title').text('Tambah Akun');
|
||||||
@@ -129,6 +135,7 @@ $(function(){
|
|||||||
id: $('#inputId').val(),
|
id: $('#inputId').val(),
|
||||||
kode_akun: $('#kode_akun').val().trim(),
|
kode_akun: $('#kode_akun').val().trim(),
|
||||||
nama_akun: $('#nama_akun').val().trim(),
|
nama_akun: $('#nama_akun').val().trim(),
|
||||||
|
priority: $('#priority').val().trim(),
|
||||||
tipe: $('#tipe').val(),
|
tipe: $('#tipe').val(),
|
||||||
parent_id: $('#parent_id').val()
|
parent_id: $('#parent_id').val()
|
||||||
};
|
};
|
||||||
@@ -172,6 +179,7 @@ $(function(){
|
|||||||
$('#inputId').val(res.id);
|
$('#inputId').val(res.id);
|
||||||
$('#kode_akun').val(res.kode_akun);
|
$('#kode_akun').val(res.kode_akun);
|
||||||
$('#nama_akun').val(res.nama_akun);
|
$('#nama_akun').val(res.nama_akun);
|
||||||
|
$('#priority').val(res.priority);
|
||||||
$('#tipe').val(res.tipe);
|
$('#tipe').val(res.tipe);
|
||||||
$('#parent_id').val(res.parent_id);
|
$('#parent_id').val(res.parent_id);
|
||||||
|
|
||||||
|
|||||||
@@ -214,9 +214,9 @@
|
|||||||
<input type="hidden" id="delete_id">
|
<input type="hidden" id="delete_id">
|
||||||
<label>Pilih Alasan:</label>
|
<label>Pilih Alasan:</label>
|
||||||
<select id="delete_alasan" class="form-control">
|
<select id="delete_alasan" class="form-control">
|
||||||
<option value="dijual_untung">Dijual (Untung)</option>
|
<option value="dijual">Dijual</option>
|
||||||
<option value="dijual_rugi">Dijual (Rugi)</option>
|
<option value="rusak">Asset Rusak</option>
|
||||||
<option value="dihapus">Dihapus</option>
|
<option value="dihapus">Dihapus (Salah Input)</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="mt-2">Keterangan:</label>
|
<label class="mt-2">Keterangan:</label>
|
||||||
<textarea id="delete_keterangan" class="form-control" rows="3" placeholder="Alasan detail penghapusan..."></textarea>
|
<textarea id="delete_keterangan" class="form-control" rows="3" placeholder="Alasan detail penghapusan..."></textarea>
|
||||||
@@ -559,6 +559,8 @@ $('#btnConfirmDelete').click(function(){
|
|||||||
$('#modalDelete').modal('hide');
|
$('#modalDelete').modal('hide');
|
||||||
table.ajax.reload(null,false);
|
table.ajax.reload(null,false);
|
||||||
Swal.fire('Berhasil','Asset berhasil dihapus','success');
|
Swal.fire('Berhasil','Asset berhasil dihapus','success');
|
||||||
|
}else{
|
||||||
|
Swal.fire('Error',res.message || 'Gagal menghapus asset','error');
|
||||||
}
|
}
|
||||||
},'json').always(()=>{
|
},'json').always(()=>{
|
||||||
btn.prop('disabled', false).html('Hapus');
|
btn.prop('disabled', false).html('Hapus');
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ $('.btn-add-bayar').click(function(){
|
|||||||
|
|
||||||
$('#tableBayar tbody').append(`
|
$('#tableBayar tbody').append(`
|
||||||
<tr>
|
<tr>
|
||||||
<td><select class="form-control account_id">${accountOptionsAssets}</select></td>
|
<td style="width: 60%;"><select class="form-control account_id select-search">${accountOptionsAssets}</select></td>
|
||||||
<td><input type="text" class="form-control debit text-end format-rupiah"></td>
|
<td><input type="text" class="form-control debit text-end format-rupiah"></td>
|
||||||
<td><button class="btn btn-danger btn-remove">X</button></td>
|
<td><button class="btn btn-danger btn-remove">X</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -198,10 +198,15 @@ body {
|
|||||||
<div class="bg-warning text-white p-2 rounded-3 d-flex align-items-center justify-content-center" style="width:38px;height:38px;">
|
<div class="bg-warning text-white p-2 rounded-3 d-flex align-items-center justify-content-center" style="width:38px;height:38px;">
|
||||||
<i class="bi bi-tools fs-5"></i>
|
<i class="bi bi-tools fs-5"></i>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex-grow-1">
|
||||||
<h5 class="mb-0 fw-bold" style="color:#1a1a2e;">Peralatan Teknisi</h5>
|
<h5 class="mb-0 fw-bold" style="color:#1a1a2e;">Peralatan Teknisi</h5>
|
||||||
<small class="text-muted">Kelola barang bawaan, pengembalian, dan transfer antar teknisi</small>
|
<small class="text-muted">Kelola barang bawaan, pengembalian, dan transfer antar teknisi</small>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="<?= base_url('teknisi/log_barang'); ?>" class="btn btn-warning" id="btnLogBarang">
|
||||||
|
<i class="bi bi-journal-text me-1"></i> Log Barang Teknisi
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
@@ -485,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>
|
||||||
@@ -526,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>
|
||||||
@@ -544,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>
|
||||||
@@ -746,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']]
|
||||||
@@ -764,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;
|
||||||
@@ -781,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();
|
||||||
@@ -792,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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -929,7 +995,7 @@ $(function(){
|
|||||||
|
|
||||||
refreshTable(dtKembalikan, kembalikanData);
|
refreshTable(dtKembalikan, kembalikanData);
|
||||||
$('#scanKembalikan').val('').focus();
|
$('#scanKembalikan').val('').focus();
|
||||||
Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar pengembalian', timer:1200, showConfirmButton:false});
|
// Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar pengembalian', timer:1200, showConfirmButton:false});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -970,6 +1036,16 @@ $(function(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r.data.barcode_status === 'sold_out') {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'warning',
|
||||||
|
title: 'Barang Tidak Dapat Dibawa',
|
||||||
|
text: 'Barcode ' + r.data.barcode + ' sudah berstatus SOLD OUT sehingga tidak dapat diproses.'
|
||||||
|
});
|
||||||
|
$('#scanDibawa').val('').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let data = r.data;
|
let data = r.data;
|
||||||
let no = dibawaData.length + 1;
|
let no = dibawaData.length + 1;
|
||||||
|
|
||||||
@@ -983,7 +1059,7 @@ $(function(){
|
|||||||
|
|
||||||
refreshTable(dtDibawa, dibawaData);
|
refreshTable(dtDibawa, dibawaData);
|
||||||
$('#scanDibawa').val('').focus();
|
$('#scanDibawa').val('').focus();
|
||||||
Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar bawaan', timer:1200, showConfirmButton:false});
|
// Swal.fire({icon:'success', text:'Barang ditambahkan ke daftar bawaan', timer:1200, showConfirmButton:false});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.4.1/css/responsive.bootstrap5.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--tech-primary: #ff9800;
|
||||||
|
--tech-primary-light: #fff3e0;
|
||||||
|
--tech-primary-dark: #ff9800;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #f5f7fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tech-card {
|
||||||
|
border: none;
|
||||||
|
border-radius: 14px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tech-card .card-header-custom {
|
||||||
|
background: linear-gradient(135deg, var(--tech-primary), var(--tech-primary-dark));
|
||||||
|
color: #fff;
|
||||||
|
padding: 14px 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tech-card .card-body {
|
||||||
|
padding: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-tech thead th {
|
||||||
|
background: #f8f9fa;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 12px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: .4px;
|
||||||
|
color: #495057;
|
||||||
|
border-bottom: 2px solid #ffcc80;
|
||||||
|
padding: 10px 8px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-tech tbody td {
|
||||||
|
padding: 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-tech td .badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 65px;
|
||||||
|
padding: 0.35em 0.65em;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-tech tbody tr:hover {
|
||||||
|
background: #fff3e0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container-fluid px-3 mt-3">
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center gap-2 mb-3">
|
||||||
|
<div class="bg-warning text-white p-2 rounded-3 d-flex align-items-center justify-content-center" style="width:38px;height:38px;">
|
||||||
|
<i class="bi bi-journal-text fs-5"></i>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
<h5 class="mb-0 fw-bold" style="color:#1a1a2e;">Log Barang Teknisi</h5>
|
||||||
|
<small class="text-muted">Riwayat barang yang pernah dibawa oleh teknisi</small>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="<?= base_url('teknisi'); ?>" class="btn btn-secondary">
|
||||||
|
<i class="bi bi-arrow-left me-1"></i> Kembali
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card tech-card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-tech table-striped w-100" id="tblLogBarang">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Nama Teknisi</th>
|
||||||
|
<th>Kode Barang</th>
|
||||||
|
<th>Barcode</th>
|
||||||
|
<th>Nama Barang</th>
|
||||||
|
<th>Tanggal Dibawa</th>
|
||||||
|
<th>Tanggal Kembali</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('#tblLogBarang').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: false,
|
||||||
|
ajax: {
|
||||||
|
url: "<?= base_url('teknisi/get_log_data'); ?>",
|
||||||
|
dataSrc: 'data'
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{ data: 0 },
|
||||||
|
{ data: 1 },
|
||||||
|
{ data: 2 },
|
||||||
|
{ data: 3 },
|
||||||
|
{ data: 4 },
|
||||||
|
{ data: 5 },
|
||||||
|
{ data: 6 },
|
||||||
|
{ data: 7 }
|
||||||
|
],
|
||||||
|
pageLength: 25,
|
||||||
|
lengthMenu: [
|
||||||
|
[25, 50, 100, -1],
|
||||||
|
[25, 50, 100, 'All']
|
||||||
|
],
|
||||||
|
responsive: true,
|
||||||
|
searching: true,
|
||||||
|
paging: true,
|
||||||
|
ordering: true,
|
||||||
|
info: true,
|
||||||
|
language: {
|
||||||
|
search: "Cari:",
|
||||||
|
lengthMenu: "Tampilkan _MENU_ data",
|
||||||
|
info: "Menampilkan _START_ - _END_ dari _TOTAL_ data",
|
||||||
|
zeroRecords: "Tidak ada data",
|
||||||
|
paginate: {
|
||||||
|
first: "Awal",
|
||||||
|
last: "Akhir",
|
||||||
|
next: "»",
|
||||||
|
previous: "«"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 138 KiB |
Reference in New Issue
Block a user