Example #1
0
 public function post_verifikasipartkeluar()
 {
     $id = Input::get('id');
     $itempart = Wopart::find($id);
     $stock = Stock::where('pool_id', '=', Auth::user()->pool_id)->where('sparepart_id', '=', $itempart->sparepart_id)->first();
     if ($stock) {
         if ($stock->qty >= $itempart->qty) {
             $x = Trackinginventory::create(array('pool_id' => Auth::user()->pool_id, 'sparepart_id' => $itempart->sparepart_id, 'qty' => $itempart->qty * -1, 'user_id' => Auth::user()->id, 'note' => 'Part Keluar melalui WO dengan id wo ' . $itempart->wo_id));
             if ($x) {
                 $itempart->telah_dikeluarkan = 1;
                 $itempart->save();
                 return 'Part berhasil di keluarkan';
             }
         } else {
             return 'Part gagal di keluarkan mungkin karna stock tidak tercukupi!';
         }
     } else {
         return 'Part gagal di keluarkan mungkin karna stock tidak tersedia!';
     }
 }
Example #2
0
 public function get_part_item_remove($item_id = null, $wo_id = null)
 {
     $s = Wopart::find($item_id);
     $s->delete();
 }