示例#1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $po_no = trim($request->input('po_no'));
     $path = explode('/', $po_no);
     $values = ['pb_id' => $request->input('pb_id'), 'po_no' => $po_no, 'po_tgl_buat' => $request->input('po_tgl_buat'), 'po_tgl_kedatangan' => $request->input('po_tgl_kedatangan'), 'po_note' => trim($request->input('po_note')), 'po_is_ppn' => $path[0] == 'P' ? 1 : 2, 'po_is_use_ppn' => $request->input('po_is_use_ppn'), 'po_status' => 1, 'po_sudden' => 2];
     $po = PoModel::create($values);
     for ($x = 0; $x < count($_POST['pbs_id']); $x++) {
         $values = ['po_id' => $po->po_id, 'pbs_id' => $_POST['pbs_id'][$x], 'pos_harga' => $_POST['pos_harga'][$x], 'pos_discount' => $_POST['pos_discount'][$x]];
         Po_sub::create($values);
     }
     $pb = Pb::find($request->input('pb_id'));
     $pb->pb_status = 4;
     $pb->save();
     if (isset($_POST['save'])) {
         Session::flash('inserted', '<div class="info success">PO dengan nomor <strong>' . $po_no . '</strong> berhasil dibuat.</div>');
         return redirect('po');
     } elseif (isset($_POST['save_print'])) {
         return redirect('printing/po/' . $po->po_id);
     }
 }
示例#2
0
 public function requestUpdate(Request $req)
 {
     $rec = Pb::find($_POST['pb_id']);
     $rec->pb_no = trim($req->input('pb_no'));
     $rec->pb_tgl_butuh = $req->input('pb_tgl_butuh');
     $rec->sup_id = $req->input('sup_id');
     $rec->pb_note = trim($req->input('pb_note'));
     $rec->userid_edit = Auth::user()->user_id;
     $rec->save();
     #delete the sub first
     Pbs::where('pb_id', $_POST['pb_id'])->delete();
     #insert all new data
     $x = 0;
     foreach ($_POST['mat_id'] as $val) {
         $values = ['pb_id' => $_POST['pb_id'], 'mat_id' => $val, 'pbs_jml' => $_POST['pbs_jml'][$x]];
         Pbs::create($values);
         $x++;
     }
     Session::flash('updated', '<div class="info success">Permintaan material berhasil diubah.</div>');
     return redirect('material/request/edit/' . $_POST['pb_id']);
 }
示例#3
0
 public function requestCancel($pb_id)
 {
     $pb = Pb::find($pb_id);
     $pb->visibility = 2;
     $pb->save();
     Session::flash('canceled', '<div class="info warning">Permintaan Barang telah dibatalkan.</div>');
     return redirect('material/request');
 }