当前位置: 首页>>代码示例>>PHP>>正文


PHP Format::code方法代码示例

本文整理汇总了PHP中Format::code方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::code方法的具体用法?PHP Format::code怎么用?PHP Format::code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Format的用法示例。


在下文中一共展示了Format::code方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         if ($this->req['id'] < 1) {
             $group = data_sph_grup::create(['id_pembuat' => \Me::data()->id_karyawan]);
         } else {
             $group = data_sph_grup::find($this->req['id']);
             \Loguser::create('Menambahkan Pengajuan pada SPH No. ' . $group->no_sph);
         }
         $sph = data_sph::create(['id_sph_grup' => $group->id_sph_grup, 'id_vendor' => $this->req['vendor'], 'deadline' => $this->req['deadline'], 'id_pembuat' => \Me::data()->id_karyawan, 'id_acc' => 0, 'diskon' => $this->req['gdiskon'], 'ppn' => $this->req['gppn'], 'adjustment' => $this->req['adjustment'], 'keterangan' => $this->req['ket']]);
         foreach ($this->req['id_prq_item'] as $i => $id_prq_item) {
             data_sph_item::create(['id_sph' => $sph->id_sph, 'id_prq' => $this->req['id_prq'][$i], 'id_item' => $this->req['id_barang'][$i], 'qty' => $this->req['qty'][$i], 'harga' => $this->req['harga'][$i], 'diskon' => $this->req['diskon'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i]]);
             data_prq::find($this->req['id_prq'][$i])->update(['status' => 2]);
         }
         if ($this->req['id'] < 1) {
             $format = 'G-SPH/';
             $group->no_sph = $format . \Format::code($group->id_sph_grup);
             $group->save();
             \Loguser::create('Membuat Surat Pengajuan Harga dengan No. ' . $group->no_sph);
         }
         $fo = 'SPH/';
         $sph->no_sph_item = $fo . \Format::code($sph->id_sph);
         $sph->save();
         \DB::commit();
         return ['status' => true, 'err' => $group];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['status' => false, 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:36,代码来源:CreateSPHJob.php

示例2: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $sph = data_sph::find($this->id);
         $grup = data_sph_grup::whereId_sph_grup($sph->id_sph_grup)->select('status')->first();
         if ($grup->status == 2) {
             throw new \Exception("Maaf SPH No. " . $sph->no_sph_item . " sudah kadaluarsa!", 1);
         }
         $nsph = data_sph::create(['id_sph_grup' => $sph->id_sph_grup, 'id_vendor' => $sph->id_vendor, 'deadline' => $sph->deadline, 'id_pembuat' => \Me::data()->id_karyawan, 'id_acc' => $sph->id_acc, 'diskon' => $sph->diskon, 'ppn' => $sph->ppn, 'pph' => $sph->pph, 'adjustment' => $sph->adjustment]);
         $items = data_sph_item::whereId_sph($this->id)->get();
         foreach ($items as $item) {
             data_sph_item::create(['id_sph' => $nsph->id_sph, 'id_prq' => $item->id_prq, 'id_item' => $item->id_item, 'qty' => $item->qty, 'harga' => $item->harga, 'diskon' => $item->diskon, 'ppn' => $item->ppn, 'pph' => $item->pph, 'id_satuan' => $item->id_satuan]);
         }
         $fo = 'ISPH/';
         $nsph->no_sph_item = $fo . \Format::code($nsph->id_sph);
         $nsph->save();
         \Loguser::create('Menduplikasi data SPH dari No. ' . $sph->no_sph_item);
         \DB::commit();
         return ['err' => 'SPH berhasil di duplikasi dengan No. ' . $nsph->no_sph_item];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:30,代码来源:CopySPHJob.php

示例3: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         //dd($this->req);
         \DB::begintransaction();
         $me = \Me::data()->id_karyawan;
         // Create PO
         $po = data_po::create(['id_sph' => $this->req['id'], 'id_vendor' => $this->req['vendor'], 'deadline' => $this->req['deadline'], 'id_pembuat' => $me, 'id_acc' => 0, 'adjustment' => $this->req['adjustment'], 'diskon' => $this->req['gdiskon'], 'ppn' => $this->req['gppn'], 'keterangan' => $this->req['ket'], 'titipan' => $this->req['titipan']]);
         foreach ($this->req['id_barang'] as $i => $id_barang) {
             data_po_item::create(['id_po' => $po->id_po, 'id_item' => $id_barang, 'req_qty' => $this->req['qty'][$i], 'qty' => $this->req['qty'][$i], 'harga' => $this->req['harga'][$i], 'diskon' => $this->req['diskon'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i], 'id_prq' => $this->req['id_prq'][$i]]);
             data_prq::find($this->req['id_prq'][$i])->update(['status' => 2]);
             // update Harga
             data_barang::find($id_barang)->update(['harga_beli' => $this->req['harga'][$i]]);
             // Update Log harga
             data_harga::create(['id_barang' => $id_barang, 'harga' => $this->req['harga'][$i], 'keterangan' => 'Update berdasarkan PO', 'id_po' => $po->id_po, 'id_karyawan' => $me, 'tipe' => 1]);
             data_prq_item::find($this->req['id_prq_item'][$i])->update(['status' => 2]);
         }
         $format = 'PO-';
         $po->no_po = $format . \Format::code($po->id_po);
         $po->save();
         \Loguser::create('Membuat PO dengan No. PO ' . $po->no_po);
         \DB::commit();
         return ['result' => true, 'err' => 'PO berhasil dibuat dengan No. ' . $po->no_po];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['result' => false, 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:33,代码来源:CreatePOJob.php

示例4: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $me = \Me::data()->id_karyawan;
         $retur = data_retur::create(['tipe' => 2, 'id_po' => $this->req['id_po'], 'id_vendor' => $this->req['id_vendor'], 'id_karyawan' => $me]);
         data_po::find($this->req['id_po'])->update(['status' => 2]);
         foreach ($this->req['id_barang'] as $i => $id_barang) {
             if (!empty($this->req['qty'][$i])) {
                 data_retur_item::create(['id_retur' => $retur->id_retur, 'id_barang' => $id_barang, 'id_satuan' => $this->req['id_satuan'][$i], 'qty' => $this->req['qty'][$i], 'qty_lg' => $this->req['qty'][$i]]);
                 // Log Stok
                 data_log_barang::create(['id_barang' => $id_barang, 'qty' => $this->req['qty'][$i], 'id_gudang' => 0, 'kondisi' => 2, 'tipe' => 5, 'id_parent' => $retur->id_retur, 'id_karyawan' => $me]);
                 // Update stok
                 $barang = data_barang::find($id_barang);
                 $barang->out = $barang->out + $this->req['qty'][$i];
                 $barang->save();
                 // Update data PO items
                 $itm = data_po_item::where('id_po', $this->req['id_po'])->where('id_item', $id_barang)->first();
                 $qpo = $itm->qty + $this->req['qty'][$i];
                 data_po_item::where('id_po', $this->req['id_po'])->where('id_item', $id_barang)->update(['qty' => $qpo, 'status' => 1]);
             }
         }
         $format = 'EX-RTN-';
         $kode = $format . \Format::code($retur->id_retur);
         $retur->no_retur = $kode;
         $retur->save();
         \Loguser::create('Membuat Retur Pembelian dengan No. ' . $kode);
         \DB::commit();
         return ['result' => true, 'label' => 'success', 'err' => 'Return Pembelian berhasil dibuat dengan No. ' . $kode];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['result' => false, 'label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:39,代码来源:CreateReturJob.php

示例5: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     //dd($this->req);
     try {
         \DB::begintransaction();
         $parent_id = empty($this->req['parent_id']) ? 0 : $this->req['parent_id'];
         $file = '';
         if (!empty($_FILES['feed_file']['tmp_name'])) {
             $base_name = date('d_m_Y_') . md5($_FILES['feed_file']['name']) . rand(11111, 99999) . time();
             $fl_name = $base_name . '.png';
             $fl = file_get_contents($_FILES['feed_file']['tmp_name']);
             \Image::make($fl)->save($this->path . $fl_name);
             $file = $fl_name;
         }
         $feed = data_feedback::create(['title' => $this->req['feed_title'], 'ask' => $this->req['feed_ask'], 'link' => $this->req['feed_link'], 'parent_id' => $parent_id, 'file' => $file, 'id_karyawan' => \Me::data()->id_karyawan]);
         $kode = \Format::code($feed->id_feedback);
         $feed->kode = $kode;
         $feed->save();
         if ($parent_id > 0) {
             $up = data_feedback::find($parent_id);
             $up->notif = $up->notif + 1;
             $up->save();
         }
         \Loguser::create('Megisi form feedback Kode. #' . $kode);
         \DB::commit();
         return ['label' => 'success', 'err' => 'Feedback berhasil terkirim dengan Kode. ' . $feed->kode];
     } catch (\Exception $e) {
         \DB::rollback();
         if (file_exists($this->path . $file)) {
             @unlink($this->path . $file);
         }
         return ['label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:39,代码来源:CreateFeedbackJob.php

示例6: handle

 /**
  * 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;
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:14,代码来源:AddVendorJob.php

示例7: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     //dd($this->req);
     try {
         \DB::begintransaction();
         $gr = data_spbm::create(['no_surat_jalan' => $this->req['sj'], 'tgl_terima_barang' => $this->req['tgl_terima'], 'tgl_periksa_barang' => $this->req['tgl_periksa'], 'id_kirim' => $this->req['pengiriman'], 'keterangan' => $this->req['keterangan'], 'id_po' => $this->req['id_po'], 'pemeriksa1' => $this->req['pemeriksa1'], 'pemeriksa2' => $this->req['pemeriksa2'], 'nm_pengirim' => $this->req['nm_pengirim'], 'titipan' => $this->req['titipan'], 'id_karyawan' => \Me::data()->id_karyawan]);
         $statuspo = [];
         foreach ($this->req['id_po_item'] as $i => $id_po_item) {
             if (!empty($this->req['qty_lg'])) {
                 $qty = \Format::convertSatuan($this->req['id_barang'][$i], $this->req['id_satuan'][$i], $this->req['id_satuan_default'][$i]) * $this->req['qty_lg'][$i];
                 data_spbm_item::create(['id_spbm' => $gr->id_spbm, 'id_barang' => $this->req['id_barang'][$i], 'bonus' => $this->req['bonus'][$i], 'id_satuan' => $this->req['id_satuan'][$i], 'qty_lg' => $this->req['qty_lg'][$i], 'qty' => $qty, 'merek' => $this->req['merek'][$i], 'barang_sesuai' => $this->req['barang_sesuai'][$i], 'keterangan' => $this->req['kets'][$i], 'tgl_exp' => $this->req['tgl_exp'][$i], 'sisa' => $qty]);
                 // Perubahan Status Item PO
                 if ($this->req['bonus'][$i] == 0) {
                     $itempo = data_po_item::find($this->req['id_po_item'][$i]);
                     if ($this->req['qty_lg'][$i] >= $this->req['req_qty'][$i]) {
                         $itempo->status = 3;
                         $itempo->qty = $itempo->qty - $this->req['qty_lg'][$i];
                         $itempo->save();
                         // Perubahan status PRQ
                         $count = data_prq_item::where('id_prq', $itempo->id_prq)->where('status', 1)->count();
                         if ($count == 0) {
                             data_prq::find($itempo->id_prq)->update(['status' => 3]);
                         }
                     } else {
                         $statuspo[] = 1;
                         $itempo->status = 2;
                         $itempo->qty = $itempo->qty - $this->req['qty_lg'][$i];
                         $itempo->save();
                     }
                 }
                 // Log Stok
                 data_log_barang::create(['id_barang' => $this->req['id_barang'][$i], 'qty' => $qty, 'keterangan' => 'Good Receive', 'id_gudang' => 0, 'kondisi' => 1, 'tipe' => 2, 'id_parent' => $gr->id_spbm, 'id_karyawan' => \Me::data()->id_karyawan]);
                 // Udate Stok ke data barang
                 $b = data_barang::find($this->req['id_barang'][$i]);
                 $b->in = $b->in + $qty;
                 $b->save();
             }
         }
         // Merubah Status PO
         $po = data_po::find($this->req['id_po']);
         if (count($statuspo) > 0) {
             $po->update(['status' => 2]);
         } else {
             $po->update(['status' => 3]);
         }
         $format = 'GR-';
         $gr->no_spbm = $format . \Format::code($gr->id_spbm);
         $gr->save();
         \Loguser::create('Membuat Permohonan Barang Masuk dengan No. ' . $gr->no_spbm);
         \DB::commit();
         return ['label' => 'seccess', 'err' => 'PO berhasil diproses! dengan No. ' . $gr->no_spbm];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:61,代码来源:CreateSPBMJob.php

示例8: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $id_karyawan = \Me::data()->id_karyawan;
         $barang = data_barang::find($this->req['id']);
         $barang->update(['nm_barang' => $this->req['nm_barang'], 'id_kategori' => $this->req['id_kategori'], 'id_satuan' => $this->req['id_satuan'], 'stok_minimal' => $this->req['stok_minimal'], 'keterangan' => $this->req['keterangan'], 'tipe' => $this->req['tipe'], 'ppn' => $this->req['ppn'], 'harga_beli' => $this->req['harga_beli'], 'harga_jual' => $this->req['harga_jual'], 'id_klasifikasi' => $this->req['id_klasifikasi']]);
         data_barang_detail::where('id_barang', $this->req['id'])->delete();
         if (isset($this->req['labels']) && count($this->req['labels']) > 0) {
             foreach ($this->req['labels'] as $i => $val) {
                 if (strlen($val) > 0 && strlen($this->req['values'][$i]) > 0) {
                     data_barang_detail::create(['id_barang' => $this->req['id'], 'label' => ucwords($val), 'nm_detail' => $this->req['values'][$i]]);
                 }
             }
         }
         ref_konversi_satuan::where('id_barang', $this->req['id'])->delete();
         ref_konversi_satuan::create(['id_barang' => $barang->id_barang, 'id_satuan_max' => $this->req['id_satuan'], 'id_satuan_min' => $this->req['id_satuan'], 'qty' => 1]);
         if (isset($this->req['koversi_satuan']) && count($this->req['koversi_satuan']) > 0) {
             foreach ($this->req['koversi_satuan'] as $i => $id_satuan) {
                 if ($id_satuan > 0) {
                     ref_konversi_satuan::create(['id_barang' => $barang->id_barang, 'id_satuan_max' => $id_satuan, 'id_satuan_min' => $this->req['id_satuan'], 'qty' => $this->req['koversi_qty'][$i]]);
                 }
             }
         }
         if ($this->req['harga_beli'] != $this->req['last_harga']) {
             data_harga::create(['id_barang' => $barang->id_barang, 'harga' => $this->req['harga_beli'], 'keterangan' => 'Update harga dari ' . number_format($this->req['last_harga'], 0, ',', '.'), 'id_karyawan' => $id_karyawan, 'tipe' => 1]);
         }
         if ($this->req['harga_jual'] != $this->req['last_harga_jual']) {
             data_harga::create(['id_barang' => $barang->id_barang, 'harga' => $this->req['harga_jual'], 'keterangan' => 'Update harga dari ' . number_format($this->req['last_harga_jual'], 0, ',', '.'), 'id_karyawan' => $id_karyawan, 'tipe' => 2]);
         }
         // Pengkodean
         $tipe = $this->req['tipe'] == 1 ? 'O-' : 'B-';
         $kat = ref_kategori::find($this->req['id_kategori']);
         $kats = $kat->alias . '-';
         $urut = \Format::code($barang->id_barang);
         $jj = '';
         if ($this->req['tipe'] == 1) {
             $kls = ref_klasifikasi::find($this->req['id_klasifikasi']);
             $jj = '-' . $kls->kode;
         }
         $kode = $tipe . $kats . $urut . $jj;
         $barang->kode = $kode;
         $barang->save();
         \Loguser::create('Melakukan perubahan terhada data master gudang Kode. ' . $barang->kode);
         \DB::commit();
         return ['label' => 'success', 'err' => $this->req['nm_barang'] . ' Berhasil diperbaharui'];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:56,代码来源:UpdateBarangJob.php

示例9: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $titipan = !empty($this->req['titipan']) ? $this->req['vendor'] : 0;
     $prq = data_prq::create(['target' => date('Y-m-d', strtotime($this->req['deadline'])), 'id_pemohon' => \Me::data()->id_karyawan, 'keterangan' => $this->req['ket'], 'tipe' => $this->req['tipe'], 'id_acc' => 0, 'titipan' => $titipan]);
     foreach ($this->req['id_barang'] as $i => $id_barang) {
         if (!empty($this->req['qty'][$i])) {
             data_prq_item::create(['id_prq' => $prq->id_prq, 'id_barang' => $id_barang, 'qty' => $this->req['qty'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i]]);
         }
     }
     $kode = 'PRQ-';
     $prq->no_prq = $kode . \Format::code($prq->id_prq);
     $prq->save();
     \Loguser::create('Membuat PRQ No. ' . $prq->no_prq);
     return $prq;
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:20,代码来源:CreatePRQJob.php

示例10: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $me = \Me::data()->id_karyawan;
         $stok = data_penyesuaian_stok::create(['tipe' => $this->req['tipe'], 'id_karyawan' => $me, 'keterangan' => $this->req['ket'], 'tanggal' => $this->req['tanggal'], 'id_gudang' => $this->req['id_gudang']]);
         if (count($this->req['id_barang']) == 0) {
             throw new \Exception("Barang/Obat tidak ditemukan!", 1);
         }
         $notempty = [];
         foreach ($this->req['id_barang'] as $i => $id_barang) {
             if (!empty($this->req['qty'][$i])) {
                 $notempty[] = 1;
                 $qty = \Format::convertSatuan($id_barang, $this->req['satuan'][$i], $this->req['satuan_default'][$i]) * $this->req['qty'][$i];
                 data_penyesuaian_stok_item::create(['id_penyesuaian_stok' => $stok->id_penyesuaian_stok, 'id_barang' => $id_barang, 'id_satuan' => $this->req['satuan'][$i], 'qty_lg' => $this->req['qty'][$i], 'current_qty' => $this->req['current_qty'][$i], 'new_qty' => $qty, 'keterangan' => $this->req['kets'][$i]]);
             }
             if (count($notempty) == 0) {
                 throw new \Exception("Barang/Obat tidak ditemukan!", 1);
             }
             // Log Stok
             $kondisi = $qty >= $this->req['current_qty'][$i] ? 1 : 2;
             $stok_qty = $this->req['current_qty'][$i] - $qty;
             data_log_barang::create(['id_barang' => $id_barang, 'qty' => abs($stok_qty), 'keterangan' => 'Penyesuaian Stok', 'id_gudang' => $this->req['id_gudang'], 'kondisi' => $kondisi, 'tipe' => 3, 'id_parent' => $stok->id_penyesuaian_stok, 'id_karyawan' => $me]);
             // Stok gudang
             $barang = data_item_gudang::where('id_barang', $id_barang)->where('id_gudang', $this->req['id_gudang'])->first();
             $brg = data_item_gudang::find($barang->id_item_gudang);
             if ($kondisi == 1) {
                 $brg->in = $barang->in + abs($stok_qty);
             } else {
                 $brg->out = $barang->out + abs($stok_qty);
             }
             $brg->save();
         }
         // Code
         $tipe = 'O-';
         $format = $tipe . 'ADJ-SG-' . \Format::code($stok->id_penyesuaian_stok);
         $stok->no_penyesuaian_stok = $format;
         $stok->save();
         \Loguser::create('Melakukan penyesuaian Stok dengan No. ' . $stok->no_penyesuaian_stok);
         \DB::commit();
         return ['result' => true, 'label' => 'success', 'err' => 'Penyesuaian berhasil di buat dengan No. ' . $stok->no_penyesuaian_stok];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['result' => false, 'label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:51,代码来源:CreateAdjustemtJob.php

示例11: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     //dd($this->req);
     $me = \Me::data()->id_karyawan;
     try {
         \DB::begintransaction();
         $faktur = data_faktur::create(['nomor_type' => $this->req['no_po'], 'prefix' => $this->req['prefix'], 'type' => 1, 'id_vendor' => $this->req['supplier'], 'id_po' => $this->req['id_po'], 'tgl_faktur' => date('Y-m-d', strtotime($this->req['tanggal'])), 'duodate' => date('Y-m-d', strtotime($this->req['duodate'])), 'id_payment_terms' => $this->req['terms'], 'ppn' => $this->req['ppn'], 'diskon' => $this->req['diskon'], 'adjustment' => $this->req['adjustment'], 'subtotal' => $this->req['subtotal'], 'total' => $this->req['grandtotal'], 'keterangan' => $this->req['keterangan'], 'status' => 0, 'id_karyawan' => $me]);
         foreach ($this->req['id_barang'] as $i => $id) {
             data_faktur_item::create(['id_faktur' => $faktur->id_faktur, 'id_item' => $id, 'deskripsi' => $this->req['deskripsi'][$i], 'qty' => $this->req['qty'][$i], 'harga' => $this->req['harga'][$i], 'diskon' => $this->req['diskons'][$i], 'total' => $this->req['total'][$i], 'id_po' => $this->req['id_po'], 'id_satuan' => $this->req['id_satuan'][$i]]);
         }
         /* Kode Faktur */
         $no = \Format::code($faktur->id_faktur);
         $faktur->nomor_faktur = $no;
         $faktur->save();
         \DB::commit();
         return ['res' => true, 'label' => 'success', 'err' => '<center>Faktur berhasil dibuat dengan No. #' . $no . '</center>'];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['res' => false, 'label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:26,代码来源:CreateFakturJob.php

示例12: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $spb = data_spb::create(['id_departemen' => \Me::data()->id_departemen, 'id_pemohon' => \Me::data()->id_karyawan, 'keterangan' => $this->req['ket'], 'id_acc' => 0, 'deadline' => date('Y-m-d', strtotime($this->req['deadline'])), 'tipe' => $this->req['tipe']]);
         $gudang = empty($this->req['id_gudang']) ? 0 : $this->req['id_gudang'];
         foreach ($this->req['id_barang'] as $i => $id) {
             if (!empty($this->req['qty'][$i])) {
                 $qty = \Format::convertSatuan($id, $this->req['satuan'][$i], $this->req['id_satuan'][$i]) * $this->req['qty'][$i];
                 data_spb_item::create(['id_spb' => $spb->id_spb, 'id_item' => $id, 'qty_awal' => $qty, 'qty' => $qty, 'qty_lg' => $this->req['qty'][$i], 'keterangan' => $this->req['kets'][$i], 'status' => 1, 'id_gudang' => $gudang, 'id_satuan' => $this->req['satuan'][$i]]);
             }
         }
         $kode = $this->req['tipe'] == 1 ? 'PMO-' : 'PMB-';
         $spb->no_spb = $kode . \Format::code($spb->id_spb);
         $spb->save();
         \Loguser::create('Membuat Pengajuan barang No. ' . $spb->no_spb);
         \DB::commit();
         return ['res' => true, 'label' => 'success', 'err' => 'Permohonan Barang berhasil terkirim dengan Nomor ' . $spb->no_spb];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['res' => false, 'label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:28,代码来源:CreatePMBJob.php

示例13: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $me = \Me::data()->id_karyawan;
         $sph = data_sph::find($this->req['id_sph']);
         $grup = data_sph_grup::whereId_sph_grup($sph->id_sph_grup)->select('status')->first();
         if ($grup->status == 2) {
             throw new \Exception("Maaf SPH No. " . $sph->no_sph_item . " sudah kadaluarsa!", 1);
         }
         // Create PO
         $po = data_po::create(['id_sph' => $this->req['id_sph'], 'id_vendor' => $sph->id_vendor, 'deadline' => $sph->deadline, 'id_pembuat' => $me, 'id_acc' => 0, 'adjustment' => $sph->adjustment, 'diskon' => $sph->diskon, 'ppn' => $sph->ppn, 'keterangan' => $sph->keterangan]);
         $items = data_sph_item::whereId_sph($this->req['id_sph'])->get();
         foreach ($items as $item) {
             data_po_item::create(['id_po' => $po->id_po, 'id_item' => $item->id_item, 'req_qty' => $item->qty, 'qty' => $item->qty, 'harga' => $item->harga, 'diskon' => $item->diskon, 'ppn' => $item->ppn, 'pph' => $item->pph, 'keterangan' => $item->keterangan, 'id_satuan' => $item->id_satuan, 'id_prq' => $item->id_prq]);
             // update Harga
             data_barang::find($item->id_item)->update(['harga_beli' => $item->harga]);
             // Update Log harga
             data_harga::create(['id_barang' => $item->id_item, 'harga' => $item->harga, 'keterangan' => 'Update berdasarkan PO', 'id_po' => $po->id_po, 'id_karyawan' => $me, 'tipe' => 1]);
             data_prq_item::whereId_prq($item->id_prq)->whereId_barang($item->id_item)->update(['status' => 2]);
         }
         $format = 'PO-';
         $po->no_po = $format . \Format::code($po->id_po);
         $po->save();
         // Update data SPH Grup
         data_sph_grup::find($this->req['id_sph_grup'])->update(['status' => 2]);
         // Update data sph
         $sph->status = 2;
         $sph->save();
         \Loguser::create('Menjadikan SPH denga No. ' . $sph->no_sph . ' menjadi PO dengan No. ' . $po->no_po);
         \DB::commit();
         return ['err' => 'Po Berhail di buat dengan No. ' . $po->no_po];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:42,代码来源:SPHtoPOJob.php

示例14: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $me = \Me::data()->id_karyawan;
         $retur = data_retur::create(['tipe' => 1, 'id_gudang_asal' => $this->req['id_gudang'], 'id_karyawan' => $me]);
         foreach ($this->req['id_barang'] as $i => $id_barang) {
             if (!empty($this->req['qty'][$i])) {
                 data_retur_item::create(['id_retur' => $retur->id_retur, 'id_barang' => $id_barang, 'id_satuan' => $this->req['id_satuan'][$i], 'qty' => $this->req['qty'][$i], 'qty_lg' => $this->req['qty'][$i]]);
                 // Log Stok
                 data_log_barang::create(['id_barang' => $id_barang, 'qty' => $this->req['qty'][$i], 'id_gudang' => 0, 'kondisi' => 1, 'tipe' => 4, 'id_parent' => $retur->id_retur, 'id_karyawan' => $me]);
                 // Log Stok
                 data_log_barang::create(['id_barang' => $id_barang, 'qty' => $this->req['qty'][$i], 'id_gudang' => $this->req['id_gudang'], 'kondisi' => 2, 'tipe' => 4, 'id_parent' => $retur->id_retur, 'id_karyawan' => $me]);
                 // Update stok Gudang besat
                 $barang = data_barang::find($id_barang);
                 $barang->in = $barang->in + $this->req['qty'][$i];
                 $barang->save();
                 // Update Stok sub gudang
                 $gudang = data_item_gudang::where('id_barang', $id_barang)->where('id_gudang', $this->req['id_gudang'])->first();
                 $gd = data_item_gudang::find($gudang->id_item_gudang);
                 $gd->out = $gudang->out + $this->req['qty'][$i];
                 $gd->save();
             }
         }
         $format = 'IN-RTN-';
         $kode = $format . \Format::code($retur->id_retur);
         $retur->no_retur = $kode;
         $retur->save();
         \Loguser::create('Membuat Retur Gudang dengan No. ' . $kode);
         \DB::commit();
         return ['result' => true, 'label' => 'success', 'err' => 'Return Gudang berhasil dibuat dengan No. ' . $kode];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['result' => false, 'label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:41,代码来源:CreateReturGudangJob.php


注:本文中的Format::code方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。