예제 #1
0
									<th>Material</th>
									<th>Spesifikasi</th>
									<!-- <th>Warna</th> -->
									<th>Diretur</th>
									<th>Alasan</th>
									<th>Telah Diterima</th>
									<th>Kekurangan</th>
									<th>Diterima</th>
									<th>Satuan</th>
									<th>Status</th>
								</tr>
							</thead>
							<tbody>
								@foreach($sub as $row)
								<?php 
$diterima = countReturDiterima($row->returpeners_id);
$rest = $row->returpeners_jml - $diterima;
?>
								<tr>
									<td class="mat_nama">
										<input type="hidden" name="returpeners_id[]" value="{{ $row->returpeners_id }}" />
										{{ $row->mat_nama }}
									</td>
									<td class="mat_spesifikasi text-center">{{ $row->mat_spesifikasi }}</td>
									<!-- <td class="warna text-center">{{ $row->wrn_nama }}</td> -->
									<td class="returpeners_jml text-center">{{ $row->returpeners_jml }}</td>
									<td class="returpeners_reason">{{ $row->returpeners_reason }}</td>
									<td class="diterima text-center">{{ $diterima }}</td>
									<td class="kekurangan text-center">{{ ($rest <= 0 ? '-' : $rest) }}</td>
									<td class="retur_diterima text-center">
										@if($rest > 0)
예제 #2
0
 public function acceptanceReturAcceptanceStore(Request $req)
 {
     $parentData = ['returpener_id' => $req->input('returpener_id'), 'peneretur_date' => $req->input('peneretur_date'), 'userid_input' => $this->_user->hak_akses, 'qa_check' => 1, 'visibility' => 1];
     $parent = Peneretur::create($parentData);
     foreach ($_POST['returpeners_id'] as $returpeners_id) {
         if (!empty($_POST['penereturs_jml_' . $returpeners_id])) {
             $vals = ['peneretur_id' => $parent->peneretur_id, 'returpeners_id' => $returpeners_id, 'penereturs_jml' => $_POST['penereturs_jml_' . $returpeners_id]];
             Penereturs::create($vals);
             if (!empty($_POST['mat_id_' . $returpeners_id])) {
                 $mat = MatModel::find($_POST['mat_id_' . $returpeners_id]);
                 $mat->mat_stock_akhir = $mat->mat_stock_akhir + $_POST['penereturs_jml_' . $returpeners_id];
                 $mat->save();
             }
         }
     }
     #Checking for update is_closed
     $sub = Returpeners::fetch($req->input('returpener_id'));
     $el = array();
     foreach ($sub as $row) {
         $diterima = countReturDiterima($row->returpeners_id);
         $rest = $row->returpeners_jml - $diterima;
         if ($rest > 0) {
             array_push($el, 'open');
         }
     }
     if (!in_array('open', $el)) {
         $get = Returpener::find($req->input('returpener_id'));
         $get->is_closed = 1;
         $get->save();
     }
     #End of checking
     Session::flash('inserted', '<div class="info success">Penerimaan Returan Material telah diinput.</div>');
     return redirect('material/acceptance/retur/acceptance');
 }