/** * Execute the job. * * @return void */ public function handle() { $v = data_vendor::find($this->req['id_vendor']); $v->update(['nm_vendor' => $this->req['nm_vendor'], 'pemilik' => $this->req['nama_pemilik'], 'alamat' => $this->req['alamat'], 'telpon' => $this->req['telpon'], 'fax' => $this->req['fax'], 'email' => $this->req['email'], 'website' => $this->req['website']]); \Loguser::create('Melakukan perubahan terhadap data Penyedia Kode. ' . $v->kode); return $this->req; }
/** * Execute the job. * * @return void */ public function handle() { $v = data_vendor::create(['nm_vendor' => $this->req['nm_vendor'], 'pemilik' => $this->req['nama_pemilik'], 'alamat' => $this->req['alamat'], 'telpon' => $this->req['telpon'], 'fax' => $this->req['fax'], 'id_karyawan' => \Me::data()->id_karyawan, 'email' => $this->req['email'], 'website' => $this->req['website']]); $format = 'VDR-'; $v->kode = $format . \Format::code($v->id_vendor); $v->save(); \Loguser::create('Menambahkan data Penyedia dengan Kode. ' . $v->kode); return $v; }
public function getAlamat(Request $req) { if ($req->ajax()) { $res = []; $vendor = data_vendor::find($req->id); if ($vendor == null) { $res['alamat'] = ''; } else { $res['alamat'] = $vendor->alamat; } return json_encode($res); } }
public function getVendors(Request $req) { if ($req->ajax()) { $res = []; $out = '<option value="">-Pilih Supplier-</option>'; $items = data_vendor::where('status', 1)->get(); foreach ($items as $item) { $select = $req->select == $item->id_vendor ? 'selected="selected"' : ''; $out .= '<option value="' . $item->id_vendor . '" ' . $select . '>' . $item->nm_vendor . '</option>'; } $res['content'] = $out; return json_encode($res); } }
public function getRetur($id = 0) { if (empty($id)) { return abort(404); } $vendor = data_vendor::find($id); if ($vendor == null) { return abort(404); } $items = data_retur::forvendor($id, [], [1, 2, 3])->paginate(10); $status = [1 => 'Baru', 2 => 'Proses', 3 => 'Selesai']; return view('Pembelian.Vendor.Retur', ['vendor' => $vendor, 'items' => $items, 'status' => $status]); }
public function getPrint($id) { $items = data_sph_item::join('data_prq', 'data_prq.id_prq', '=', 'data_sph_item.id_prq')->join('data_barang', 'data_barang.id_barang', '=', 'data_sph_item.id_item')->join('ref_satuan', 'ref_satuan.id_satuan', '=', 'data_barang.id_satuan')->where('data_sph_item.id_sph', $id)->select('data_prq.no_prq', 'data_barang.nm_barang', 'data_barang.id_barang', 'data_barang.kode', 'data_barang.in', 'data_barang.out', 'data_sph_item.*', 'ref_satuan.nm_satuan')->get(); $sph = data_sph::find($id); $vendor = data_vendor::find($sph->id_vendor); $grup = data_sph_grup::whereId_sph_grup($sph->id_sph_grup)->select('status')->first(); /* Matematika */ $subtotal = 0; foreach ($items as $item) { $subtotal += ($item->harga - $item->harga * $item->diskon / 100) * $item->qty; } $diskon = $subtotal * $sph->diskon / 100; $aftdiskon = $subtotal - $diskon; $ppn = $aftdiskon * $sph->ppn / 100; $pph = $aftdiskon * $sph->pph / 100; $grandtotal = $aftdiskon + $ppn + $pph + $sph->adjustment; $matematika = ['subtotal' => $subtotal, 'diskon' => $diskon, 'aftdiskon' => $aftdiskon, 'ppn' => $ppn, 'pph' => $pph, 'grandtotal' => $grandtotal]; // Status SPH $status = $grup->status == 2 && $sph->status == 1 ? true : false; return view('Print.Pembelian.SPH.PrintSPH', ['items' => $items, 'sph' => $sph, 'vendor' => $vendor, 'mtk' => $matematika, 'status' => $status]); }
public function getCreate() { $items = data_prq_item::join('data_prq', 'data_prq.id_prq', '=', 'data_prq_item.id_prq')->join('data_barang', 'data_barang.id_barang', '=', 'data_prq_item.id_barang')->join('ref_satuan', 'ref_satuan.id_satuan', '=', 'data_prq_item.id_satuan')->join('ref_satuan AS b', 'b.id_satuan', '=', 'data_barang.id_satuan')->whereIn('data_prq_item.id_prq_item', $this->ids)->select('data_prq.no_prq', 'data_prq.id_prq', 'data_barang.nm_barang', 'data_barang.kode', 'data_barang.in', 'data_barang.out', 'data_prq_item.*', 'ref_satuan.nm_satuan', 'b.nm_satuan AS default_satuan', 'b.id_satuan AS default_id_satuan')->get(); if (count($items) < 1) { return redirect('/po/select')->withNotif(['label' => 'danger', 'err' => 'Anda belum memilih item barang untuk dijadikan SPH']); } $vendors = data_vendor::whereStatus(1)->get(); $ids = []; foreach ($items as $i) { $ids[] = $i->id_barang; } $ids = json_encode($ids); return view('Pembelian.PO.Create', ['items' => $items, 'vendors' => $vendors, 'id' => 0, 'no_sph' => 0, 'ids' => $ids]); }