public function getAllitems(Request $req) { if ($req->ajax()) { $res = []; $items = ref_jabatan::where('nm_jabatan', $req->src)->paginate(10); $out = ''; if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr class="item_' . $item->id . ' items"> <td>' . $no . '</td> <td>' . $item->nm_jabatan . '</td> <td> <div> ' . \Format::indoDate($item->created_at) . ' </div> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="3">Tidak ditemukan</td> </tr> '; } $res['data'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAlladj(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_penyesuaian_stok::show($req->all())->paginate($req->limit); $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr> <td>' . $no . '</td> <td> ' . $item->no_penyesuaian_stok . ' <div class="link"> <small>[ <a target="_blank" href="' . url('/stockadj/print/' . $item->id_penyesuaian_stok) . '">Print</a> ] </small> </div> </td> <td> ' . $item->nm_depan . ' ' . $item->nm_belakang . '<br /> <small class="text-muted">' . \Format::indoDate($item->created_at) . ' at ' . \Format::jam($item->created_at) . '</small> </td> <td>' . \Format::hari($item->tanggal) . ', ' . \Format::indoDate($item->tanggal) . '</td> </tr> '; $no++; } $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAllfeedback(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_feedback::me($req->all())->paginate($req->limit); if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $status = $item->status == 1 ? 'Open' : 'Closed'; $out .= ' <tr> <td>' . $no . '</td> <td> <a href="' . url('/feedback/jawab/' . $item->id_feedback) . '">#' . $item->kode . '</a> </td> <td> <a href="' . url('/feedback/jawab/' . $item->id_feedback) . '">' . $item->title . '</a> </td> <td>' . $status . '</td> <td> ' . \Format::indoDate($item->created_at) . '<br /> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> <td>' . $item->nm_depan . '</td> <td class="text-right"><span class="badge">' . $item->notif . '</span></td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="7">Tidak ditemukan</td> </tr> '; } $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAllgudang(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = ref_gudang::listgudang($req->all())->paginate($req->limit); if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; $permission = \Auth::user()->permission; foreach ($items as $item) { $link = $permission > 2 ? '<small>[<a href="' . url('/gudang/edit/' . $item->id_gudang) . '">Rubah</a> |<a href="javascript:void(0);" onclick="del({{ $item->id_gudang }});" class="text-danger">Hapus</a> ]</small>' : ''; $out .= ' <tr class="item-' . $item->id_gudang . '"> <td>' . $no . '</td> <td> ' . $item->kode_gudang . '<br /> ' . $link . ' </td> <td> ' . $item->nm_gudang . ' </td> <td> ' . \Format::indoDate($item->created_at) . '<br /> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> <?php $no++; ?> </tr> '; } } else { $out = ' <tr> <td colspan="4">Tidak ditemukan</td> </tr> '; } } $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); }
public function getAllitems(Request $req) { if ($req->ajax()) { $res = []; $items = ref_konversi_satuan::join('ref_satuan AS a', 'a.id_satuan', '=', 'ref_konversi_satuan.id_satuan_max')->join('ref_satuan AS b', 'b.id_satuan', '=', 'ref_konversi_satuan.id_satuan_min')->join('data_barang', 'data_barang.id_barang', '=', 'ref_konversi_satuan.id_barang')->select('data_barang.nm_barang', 'a.nm_satuan as satuan_max', 'b.nm_satuan as satuan_min', 'ref_konversi_satuan.qty', 'ref_konversi_satuan.id', 'ref_konversi_satuan.created_at')->paginate(10); $out = ''; if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr class="item_' . $item->id . ' items"> <td>' . $no . '</td> <td>' . $item->nm_barang . '</td> <td> <a href="javascript:;" title="' . $item->id_satuan_max . '" data-toggle="tooltip" data-placement="bottom">' . $item->satuan_max . '</a> </td> <td>' . $item->satuan_min . '</td> <td>' . $item->qty . '</td> <td> <div> ' . \Format::indoDate($item->created_at) . ' </div> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="6">Tidak ditemukan</td> </tr> '; } $res['data'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getGetlogs(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_aktivitas::show($req->all())->paginate($req->limit); if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr> <td>' . $no . '</td> <td> ' . $item->nm_depan . ' ' . $item->nm_belakang . ' <div><small class="text-muted">Dept. ' . $item->nm_departemen . '</small></div> </td> <td> ' . \Format::indoDate($item->created_at) . ' <div><small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small></div> </td> <td> <small>' . $item->keterangan . '</small> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="4">Tidak ditemukan</td> <tr> '; } $res['pagin'] = $items->render(); $res['content'] = $out; return json_encode($res); } }
public function getAllitems(Request $req) { if ($req->ajax()) { $res = []; $items = ref_klasifikasi::where('kode', $req->src)->orWhere('nm_klasifikasi', $req->src)->paginate(10); $out = ''; if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr class="item_' . $item->id . ' items"> <td>' . $no . '</td> <td>' . $item->kode . '</td> <td> <a href="javascript:;" title="' . $item->id_klasifikasi . '" data-toggle="tooltip" data-placement="bottom">' . $item->nm_klasifikasi . '</a> </td> <td> <div> ' . \Format::indoDate($item->created_at) . ' </div> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="4">Tidak ditemukan</td> </tr> '; } $res['data'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAllretur(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_retur::forvendor($req->id, $req->all())->paginate($req->limit); if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr> <td>' . $no . '</td> <td>' . $item->no_retur . '</td> <td>' . $item->no_po . '</td> <td> </td> <td> ' . \Format::indoDate2($item->created_at) . '<br /> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> <td> <a class="btn btn-white" href="' . url('returvendor/print/' . $item->id_retur) . '" target="_blank"><i class="fa fa-print"></i></a> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="5">Tidak ditemukan!</td> </tr> '; } $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAllspb(Request $req) { if ($req->ajax()) { $result = []; $items = data_spb::alldepartement($req->kode, $req->status, $req->dep, $req->deadline, $req->surat)->paginate($req->limit); $out = ''; $status = [1 => 'Baru', 2 => 'Proses', 3 => 'Selesai', 4 => 'Batal']; if (count($items) > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $acc = $item->id_acc > 0 ? '<i class="fa fa-check" title="Telah disetujui Kepala"></i>' : '<i class="fa fa-warning" title="Belum disetujui Kepala"></i>'; $tipe = $item->tipe == 1 ? 'PMO' : 'PMB'; $out .= ' <tr class="spb_' . $item->id_spb . '"> <td>' . $no . '</td> <td> <div> ' . $item->no_spb . ' <span class="pull-right">' . $acc . '</span></div> <div class="link text-muted"> <small> [ <a href="#" onclick="detailspb(' . $item->id_spb . ');" data-toggle="modal" data-target="#detail">Lihat</a> <!-- | <a href="' . url('/pmbumum/printspb/' . $item->id_spb) . '" target="_blank">Print</a> --> ] </small> </div> </td> <td> <div>' . $item->nm_depan . ' ' . $item->nm_belakang . '</div> <div class="text-muted"><small>Dept : ' . $item->nm_departemen . '</small></div> </td> <td>' . $tipe . '</td> <td> <div>' . \Format::indoDate($item->created_at) . '</div> <div class="text-muted"><small>' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small></div> </td> <td class="text-center">' . $status[$item->status] . '</td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="5">Tidak ditemukan</td> </tr> '; } $result['data'] = $out; $result['pagin'] = $items->render(); return json_encode($result); } else { return redirect('/pmbumum'); } }
public function getAllitems(Request $req) { if ($req->ajax()) { $res = []; $items = data_karyawan::details()->where('NIK', 'like', $req->kode . "%")->where('nm_depan', 'like', $req->src . "%")->paginate(10); $out = ''; if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr class="item_' . $item->id . ' items"> <td>' . $no . '</td> <td> <a href="javascript:;" title="' . $item->nm_depan . '" data-toggle="tooltip" data-placement="bottom">' . $item->nm_depan . ' ' . $item->nm_belakang . '</a> <div style="display:none;" class="tbl-opsi"> <small>[ <a href="' . url('karyawan/review/' . $item->id_karyawan) . '">Lihat</a> | <a href="' . url('karyawan/review/' . $item->id_karyawan) . '">Detail</a> ]</small> </div> </td> <td>' . $item->NIK . '</td> <td>' . $item->nm_jabatan . '</td> <td> <div> ' . \Format::indoDate($item->created_at) . ' </div> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> <td>' . $item->nm_status . '</td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="4">Tidak ditemukan</td> </tr> '; } $res['data'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAllpo(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $status = [1 => 'Baru', 2 => 'Proses']; $stat = $req->status == 0 ? [1, 2] : [$req->status]; $items = data_po::forspbm($req->all(), $stat)->paginate($req->limit); if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $out .= ' <tr> <td>' . $no . '</td> <td> ' . $item->no_po . ' <div class="text-muted link"> <small> [<a href="' . url('/gr/creategr/' . $item->id_po) . '">Proses</a>] </small> </div> </td> <td> ' . \Format::indoDate($item->created_at) . ' <div><small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small></div> </td> <td> ' . $item->nm_vendor . ' <div><small class="text-muted">dedline ' . \Format::hari($item->deadline) . ', ' . \Format::indoDate($item->deadline) . '</small></div> </td> <td>' . $status[$item->status] . '</td> </tr> '; $no++; } } else { $out = '<tr> <td colspan="5">Tidak ditemukan</td> </tr>'; } $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getGetallprq(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_prq::listprq($req->all(), $req->status)->paginate($req->limit); $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; $status = [1 => 'Baru', 2 => 'Proses', 3 => 'Selesai', 4 => 'Hapus']; if ($items->total() > 0) { foreach ($items as $item) { $class = strtotime($item->target) > strtotime(date('Y-m-d')) ? '' : 'class=text-danger'; $selisih = strtotime($item->target) > strtotime(date('Y-m-d')) ? '<small class="text-muted">' . \Format::selisih_hari($item->target, date('Y-m-d')) . 'hari dari sekarang</small>' : ''; $tipe = $item->tipe == 1 ? 'Obat' : 'Barang'; $tanda = empty($item->id_acc) ? '<i class="fa fa-times text-muted pull-right" title="Belum terverifikasi"></i>' : '<i title="Terverifikasi" class="fa fa-check-circle text-success pull-right"></i>'; $edit = $item->status < 2 ? '| <a href="' . url('/prq/edit/' . $item->id_prq) . '">Edit</a>' : ''; $del = \Auth::user()->permission > 1 && $item->status < 2 ? '| <a href="javascript:;" onclick="hapusprq(' . $item->id_prq . ');" class="text-danger">Hapus</a>' : ''; if (!empty($item->tgl_approval) || $item->tgl_approval != '0000-00-00 00:00:00') { $tgl_approval = ' <div>' . \Format::indoDate2($item->tgl_approval) . '</div> <div class="text-muted"><small>' . \Format::hari($item->tgl_approval) . ', ' . \Format::jam($item->tgl_approval) . '</small></div> '; } else { $tgl_approval = '<center>-</center>'; } $out .= ' <tr class="item-prq-' . $item->id_prq . '"> <td>' . $no . '</td> <td> <div> ' . $item->no_prq . ' ' . $tanda . ' </div> <div class="links"> <small> [ <a href="#" data-toggle="modal" data-target="#detailprq" onclick="detailprq(' . $item->id_prq . ')">Lihat</a> ' . $edit . ' ' . $del . ' ] </small> </div> </td> <td> <div ' . $class . '> ' . \Format::indoDate2($item->target) . '</div> ' . $selisih . ' </td> <td title="' . $item->nm_depan . ' ' . $item->nm_belakang . '"> ' . \Format::substr($item->nm_depan . ' ' . $item->nm_belakang, 10) . ' <div><small class="text-muted">' . \Format::indoDate($item->created_at) . '</small></div> </td> <td>' . $tipe . '</td> <td>' . $tgl_approval . '</td> <td>' . $status[$item->status] . '</td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="7">Tidak ditemukan</td> </tr> '; } $res['pagin'] = $items->render(); $res['content'] = $out; return json_encode($res); } }
public function getAllskb(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_skb::retur($req->all())->paginate($req->limit); if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { $tipe = $item->tipe == 1 ? 'Obat' : 'Barang'; $out .= ' <tr> <td>' . $no . '</td> <td> <div>' . $item->no_skb . '</div> <div class="link text-muted"> <small> [ <a href="' . url('/returgudang/create/' . $item->id_skb) . '">Proses</a> | <a href="' . url('/skb/print/' . $item->id_skb) . '" target="_blank">Print</a> ] </small> </div> </td> <td>' . $item->no_spb . '</td> <td>' . $tipe . '</td> <td>' . $item->nm_departemen . '</td> <td> ' . \Format::indoDate($item->created_at) . '<br /> <small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small> </td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="6">Tidak ditemukan</td> </tr> '; } $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getLogharga(Request $req) { if ($req->ajax()) { $res = []; $items = data_po_item::join('data_po', 'data_po.id_po', '=', 'data_po_item.id_po')->where('data_po.id_vendor', $req->vendor)->whereIn('data_po.status', [1, 2, 3])->where('data_po_item.id_item', $req->id_barang)->orderby('data_po_item.id_po_item', 'desc')->select('data_po.no_po', 'data_po.id_po', 'data_po.created_at', 'data_po.status', 'data_po_item.harga')->paginate(10); $status = [1 => 'Baru', 2 => 'Proses', 3 => 'Selesai']; $out = '<table class="table table-striped" > <thead> <tr> <th>PO</th> <th>Tanggal</th> <th>Status</th> <th class="text-right">Harga</th> </tr> </thead> <tbody> '; if ($items->total() > 0) { foreach ($items as $item) { $out .= '<tr> <td> <a href="' . url('/po/print/' . $item->id_po) . '" target="_blank">' . $item->no_po . '</a> </td> <td> ' . \Format::indoDate($item->created_at) . '<br /> <div><small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small></div> </td> <td>' . $status[$item->status] . '</td> <td class="text-right">' . number_format($item->harga, 0, ',', '.') . '</td> </tr>'; } } else { $out .= '<tr> <td colspan="4">Tidak ditemukan</td> <tr>'; } $out .= '</tbody></table>'; $vendor = data_vendor::find($req->vendor); $barang = data_barang::find($req->id_barang); $res['vendor'] = $vendor->nm_vendor; $res['kode'] = $barang->kode; $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getAllitems(Request $req) { if ($req->ajax()) { $res = []; $items = data_recruitment::where('posisi', 'like', $req->src . "%")->paginate(10); $out = ''; if ($items->total() > 0) { $no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1; foreach ($items as $item) { if ($item->status == 1) { $status = "Aktif"; } else { $status = "Tidak Aktif"; } $out .= ' <tr class="item_' . $item->id . ' items"> <td>' . $no . '</td> <td> <a href="javascript:;" title="' . $item->posisi . '" data-toggle="tooltip" data-placement="bottom">' . $item->posisi . '</a> <div style="display:none;" class="tbl-opsi"> <small>[ <a href="' . url('recruitment/detail/' . $item->id) . '">Lihat</a> | <a href="' . url('recruitment/update/' . $item->id) . '">Edit</a> ]</small> </div> </td> <td> <div>' . \Format::indoDate($item->date_open) . ' s/d ' . \Format::indoDate($item->date_close) . '</div> <small class="text-muted">' . \Format::hari($item->date_open) . ', ' . \Format::jam($item->date_open) . '</small> </td> <td>' . $item->estimasi_gaji . '</td> <td>' . $status . '</td> </tr> '; $no++; } } else { $out = ' <tr> <td colspan="4">Tidak ditemukan</td> </tr> '; } $res['data'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function postDetailspb(Request $req) { if ($req->ajax()) { $result = []; $out = ''; $spb = data_spb::find($req->id); if ($spb->status > 2) { $items = data_spb_item::join('data_barang', 'data_barang.id_barang', '=', 'data_spb_item.id_item')->join('ref_satuan', 'ref_satuan.id_satuan', '=', 'data_barang.id_satuan')->where('data_spb_item.id_spb', $req->id)->whereIn('data_spb_item.status', [1, 2])->select('data_spb_item.*', 'data_barang.nm_barang', 'data_barang.kode', 'data_barang.in', 'data_barang.out', 'ref_satuan.nm_satuan')->get(); } else { $items = data_spb_item::join('data_barang', 'data_barang.id_barang', '=', 'data_spb_item.id_item')->join('ref_satuan', 'ref_satuan.id_satuan', '=', 'data_spb_item.id_satuan')->where('data_spb_item.id_spb', $req->id)->where('data_spb_item.status', 1)->select('data_spb_item.*', 'data_barang.nm_barang', 'data_barang.kode', 'data_barang.in', 'data_barang.out', 'ref_satuan.nm_satuan')->get(); } if ($spb->id_acc > 0) { $me = data_karyawan::find($spb->id_acc); $out .= '<div class="grid simple"> <div class="grid-title no-border"></div> <div class="grid-body no-border"> <b>Disetujui Oleh : </b> ' . $me->nm_depan . ' ' . $me->nm_belakang . '<br /> <small class="text-muted">' . \Format::hari($spb->tgl_approval) . ', ' . \Format::indoDate2($spb->tgl_approval) . ' ' . \Format::jam($spb->tgl_approval) . '</small> </div> </div> '; } $out .= '<div class="grid simple"> <div class="grid-title no-border"> <h4>' . count($items) . ' barang <strong>ditemukan</strong></4><br /> <small>Deadline : ' . \Format::indoDate($spb->deadline) . '</small> </div> <div class="grid-body no-border"> <table class="table table-striped"> <thead> <tr> <th>Kode</th> <th>Barang</th> <th>Sisa</th> <th class="text-right">Qty</th> </tr> </thead> <tbody> '; foreach ($items as $item) { $out .= ' <tr> <td>' . $item->kode . '</td> <td>' . \Format::substr($item->nm_barang, 20) . '</td> <td>' . number_format($item->in - $item->out, 0, ',', '.') . ' ' . $item->nm_satuan . '</td> <td class="text-right">' . number_format($item->qty_lg, 0, ',', '.') . ' ' . $item->nm_satuan . '</td> </tr> '; } $out .= ' </tbody> </table> </div> </div>'; $btn = \Auth::user()->permission > 2 && $spb->status < 2 && empty($spb->id_acc) ? '<button data-loading-text="<i class=\'fa fa-circle-o-notch fa-spin\'></i> Proses..." class="btn btn-primary btn-accspb" onclick="acc(' . $req->id . ');"><i class="fa fa-check"></i> Setujui</button>' : ''; $result['kode'] = $spb->no_spb; $result['content'] = $out; $result['button'] = $btn; return json_encode($result); } }
public function getLoadpo(Request $req) { if ($req->ajax()) { $res = []; $out = ''; $items = data_po::active($req->all())->paginate(5); $total = $items->total(); $status = [1 => 'Baru', 2 => 'Proses', 3 => 'Selesai']; if ($total > 0) { foreach ($items as $item) { $out .= ' <tr class="po-' . $item->id_po . '"> <td>' . $item->no_po . '</td> <td>' . \Format::hari($item->created_at) . ', ' . \Format::indoDate2($item->created_at) . '</td> <td>' . $status[$item->status] . '</td> <td class="text-right"><button onclick="add_itempo(' . $item->id_po . ');" class="btn btn-po-' . $item->id_po . ' btn-white btn-small"><i class="fa fa-plus"></i></button></td> </tr> '; } } else { $out = ' <tr> <td colspan="4">Tidak ditemukan</td> </tr> '; } $res['total'] = $total; $res['content'] = $out; $res['pagin'] = $items->render(); return json_encode($res); } }
public function getLogharga(Request $req) { if ($req->ajax()) { $res = []; $harga = data_harga::join('data_karyawan', 'data_karyawan.id_karyawan', '=', 'data_harga.id_karyawan')->leftJoin('data_po', 'data_po.id_po', '=', 'data_harga.id_po')->where('data_harga.id_barang', $req->id)->where('data_harga.tipe', $req->tipe)->orderby('data_harga.id_harga', 'desc')->select('data_harga.*', 'data_karyawan.nm_depan', 'data_karyawan.nm_belakang', 'data_po.no_po', 'data_po.id_po')->paginate(10); $hpo = $req->tipe == 1 ? '<th>PO</th>' : ''; $out = '<table class="table table-striped"> <thead> <tr> <th>Tanggal</th> <th class="text-right">Harga</th> <th>Oleh</th> ' . $hpo . ' <tr> </thead> <tbody> '; if ($harga->total() > 0) { foreach ($harga as $item) { $po = $item->no_po == null ? '-' : '<a href="' . url('/po/print/' . $item->id_po) . '" target="_blank">' . $item->no_po . '</a>'; $tpo = $req->tipe == 1 ? '<td>' . $po . '</td>' : ''; $out .= ' <tr title="' . $item->keterangan . '"> <td> ' . \Format::indoDate($item->created_at) . ' <div><small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small></div> </td> <td class="text-right">' . number_format($item->harga, 0, ',', '.') . '</td> <td>' . $item->nm_depan . ' ' . $item->nm_belakang . '</td> ' . $tpo . ' </tr> '; } } else { $out .= '<tr> <td colspan="4">Tidak ditemukan</td> </tr>'; } $out .= '</tbody><table>'; $res['pagin'] = $harga->render(); $res['content'] = $out; return json_encode($res); } }