Exemplo n.º 1
0
 public function acceptanceStore(Request $req)
 {
     $vals = ['po_id' => $_POST['po_id'], 'pener_date' => now(), 'userid_input' => Auth::user()->user_id, 'visibility' => 1];
     $pener = Pener::create($vals);
     foreach ($_POST['pos_id'] as $pos_id) {
         if (!empty($_POST['peners_jml_' . $pos_id])) {
             $vals = ['pener_id' => $pener->pener_id, 'pos_id' => $pos_id, 'peners_jml' => $_POST['peners_jml_' . $pos_id]];
             Peners::create($vals);
             if (!empty($_POST['mat_id_' . $pos_id])) {
                 $mat = MatModel::find($_POST['mat_id_' . $pos_id]);
                 $mat->mat_stock_akhir = $mat->mat_stock_akhir + $_POST['peners_jml_' . $pos_id];
                 $mat->save();
             }
         }
     }
     #Checking for update po_status
     $sub = Po_sub::fetchDetail($_POST['po_id']);
     $el = array();
     foreach ($sub as $row) {
         $diterima = countDiterima($row->pos_id);
         $rest = $row->pbs_jml - $diterima;
         if ($rest > 0) {
             array_push($el, 'open');
         }
     }
     if (!in_array('open', $el)) {
         $rec = Po::find($_POST['po_id']);
         $rec->po_status = 2;
         $rec->save();
     }
     #End of checking
     Session::flash('inserted', '<div class="info success">Penerimaan material berhasil diinput.</div>');
     return redirect('material/acceptance');
 }
Exemplo n.º 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $data = ['head' => PoModel::getDetail($id), 'sub' => Po_sub::fetchDetail($id), 'role' => $this->role];
     return view('po.show', $data);
 }
Exemplo n.º 3
0
 public function po($po_id)
 {
     $data = ['asset' => new Assets(), 'title' => 'Print Purchasing Order', 'head' => PoModel::getDetail($po_id), 'sub' => Po_sub::fetchDetail($po_id)];
     return view('printing.po', $data);
 }