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


PHP Format::convertSatuan方法代码示例

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


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

示例1: 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

示例2: 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

示例3: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $spb = data_spb::find($this->req['id_spb']);
         $item = data_spb_item::whereId_spb($this->req['id_spb'])->select('id_gudang')->first();
         $gudang = $item->id_gudang;
         foreach ($this->req['id_barang'] as $i => $id) {
             if (!empty($this->req['qty'][$i])) {
                 $items = data_spb_item::firstOrCreate(['id_spb' => $this->req['id_spb'], 'id_item' => $id, 'status' => 1]);
                 $qty = \Format::convertSatuan($id, $this->req['satuan'][$i], $this->req['id_satuan'][$i]) * $this->req['qty'][$i];
                 $items->update(['id_gudang' => $gudang, 'qty_awal' => $qty, 'qty' => $qty, 'qty_lg' => $this->req['qty'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i]]);
             }
         }
         \Loguser::create('Menambahkan item tambahan terhadap PMB/PMO No. ' . $spb->no_spb);
         \DB::commit();
         return ['res' => true, 'label' => 'success', 'err' => $spb->no_spb . ' berhasil ditambahkan!'];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['res' => false, 'label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:27,代码来源:AdditemSPBJob.php

示例4: 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

示例5: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     try {
         \DB::begintransaction();
         $spb = data_spb::find($this->req['id_spb']);
         $spb->keterangan = $this->req['ket'];
         $spb->deadline = date('Y-m-d', strtotime($this->req['deadline']));
         $spb->save();
         data_spb_item::where('id_spb', $this->req['id_spb'])->delete();
         $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]]);
             }
         }
         \Loguser::create('Melakukan perubahan terhadap data PMB/PMO No. ' . $spb->no_spb);
         \DB::commit();
         return ['label' => 'success', 'err' => 'Sukses, No ' . $spb->no_spb . ' berhasil diperbaharui.'];
     } catch (\Exception $e) {
         \DB::rollback();
         return ['label' => 'danger', 'err' => $e->getMessage()];
     }
 }
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:29,代码来源:EditSPBJob.php

示例6: number_format

													{{ $item->nm_barang }}
													<div class="text-muted"><small>{{ $item->kode }}</small></div>
												</td>
												<td class="text-right">
													{{ number_format($item->req_qty,0,',','.') }} {{ $item->nm_satuan }}
													<div class="text-muted">
														<small>{{ number_format( $qty ,0,',','.') }} {{ $item->satuan_default }}</small>
													</div>
												</td>
												<td class="text-right">
													<i class="fa fa-check"></i>
												</td>
											</tr>
										@else
											<?php 
$qty = Format::convertSatuan($item->id_item, $item->id_satuan, $item->id_satuan_default) * $item->qty;
?>
											<tr>
												<td title="{{ $item->nm_barang }}">
													{{ $item->nm_barang }}
													<div class="text-muted"><small>{{ $item->kode }}</small></div>
													<br />
													
													<input type="hidden" name="bonus[]" value="0">
													<input type="hidden" name="id_po_item[]" value="{{ $item->id_po_item }}">
													<input type="hidden" name="id_barang[]" value="{{ $item->id_item }}">
													<input type="hidden" name="barang_sesuai[]" value="1">
													<input type="hidden" name="req_qty[]" value="{{ $item->qty }}">

													<input type="hidden" name="id_satuan[]" value="{{ $item->id_satuan }}">
													<input type="hidden" name="id_satuan_default[]" value="{{ $item->id_satuan_default }}">
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:31,代码来源:Creategr.blade.php

示例7:

							<table class="table table-bordered">
								<thead>
									<tr>
										<th width="15%">Kode</th>
										<th width="15%">Nama Barang</th>
										<th width="10%" class="text-right">Sisa</th>
										<th width="10%" class="text-right">Req Qty</th>
										<th width="10%" class="text-right">Realisasi</th>
										<th width="20%" class="text-right">Acc Qty</th>
										<th width="30%">Ket.</th>
									</tr>
								</thead>
								<tbody>
									@foreach($items as $item)
										<?php 
$conver = Format::convertSatuan($item->id_item, $item->id_satuan, $item->id_satuan_barang);
?>
										<tr>
											<!-- kode -->
											<td>
												{{ $item->kode }}
												<input type="hidden" name="id_items[]" value="{{ $item->id_spb_item }}">
												<input type="hidden" name="id_barang[]" value="{{ $item->id_item }}">
												<input type="hidden" name="id_gudang[]" value="{{ $item->id_gudang }}">
												<input type="hidden" name="kets[]" value="{{ $item->keterangan }}">
												<input type="hidden" name="sisa[]" value="{{ ($item->in - $item->out) }}">

												<input type="hidden" name="id_satuan_barang[]" value="{{ $item->id_satuan_barang }}">
												<input type="hidden" name="id_satuan[]" value="{{ $item->id_satuan }}">

												<input type="hidden" name="qty_lg[]" value="{{ $item->qty_lg }}">
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:31,代码来源:ProcessSPB.blade.php


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