Beispiel #1
0
 public function get_autopart()
 {
     $query = Input::get('query');
     $sp = Sparepart::where('part_number', 'LIKE', '%' . $query . '%')->get();
     $spareparts = array_map(function ($object) {
         return $object->to_array();
     }, $sp);
     return json_encode($spareparts);
 }
Beispiel #2
0
 public function post_stockspart()
 {
     $part_number = Input::get('part_number');
     $sparepart = Sparepart::where('part_number', '=', $part_number)->first();
     $data = array('status' => 0, 'data' => 'null');
     if ($sparepart) {
         $stock = DB::table('stock_sp')->where('pool_id', '=', Auth::user()->pool_id)->where('sparepart_id', '=', $sparepart->id)->first();
         $lists = DB::table('wo_listparts')->where('pool_id', '=', Auth::user()->pool_id)->where('sparepart_id', '=', $sparepart->id)->order_by('inserted_date_set', 'desc')->get();
         $xs = array();
         if ($stock) {
             $no = 1;
             foreach ($lists as $ls) {
                 $xs[] = array($no++, date('d/m/Y', strtotime($ls->inserted_date_set)), $ls->wo_number, Fleet::find($ls->fleet_id)->taxi_number, $ls->qty, $ls->satuan);
             }
             $data = array('status' => 1, 'data' => $stock, 'aaData' => $xs);
         }
     }
     return json_encode($data);
 }
                                  <th class="span1">Qty </th>
                                  <th class="span2" style="text-align: right; padding-right:50px;">Harga Satuan </th>
                                  <th class="span2" style="text-align: right; padding-right:50px;">Sub Total </th>
                                  <th class="span1"></th>
                              </tr>
                            </thead>
                            <tbody>
                            <?php 
$no = 1;
$tot = 0;
?>
                            @if($partitems)
                             
                              @foreach($partitems as $item)
                              <?php 
$partdetail = Sparepart::find($item->sparepart_id);
?>
                              <tr id="row_{{ $item->id }}">
                                  <td>{{ $no }}</td>
                                  <td>{{ $partdetail->part_number }}</td>
                                  <td>{{ $partdetail->name_sparepart }}</td>
                                  <td>{{ $item->qty }}</td>
                                  <td style="text-align: right; padding-right:50px;">{{ number_format($item->price, 2, ',', '.') }}</td>
                                  <td style="text-align: right; padding-right:50px;">{{ number_format(($item->price * $item->qty), 2, ',', '.') }}</td>
                                  <td><a rel="{{ $item->id }}" class="delete_toggler btn btn-mini btn-danger"><i class="icon icon-white icon-remove"></i></a></td>
                              </tr>
                              <?php 
$no++;
$tot = $tot + $item->price * $item->qty;
?>
                              @endforeach
Beispiel #4
0
 public function get_stock()
 {
     $allowed = array('name_sparepart', 'part_number', 'sp_categories_id', 'base_price', 'price', 'qty', 'min_qty');
     // add allowable columns to search on
     $sort = in_array(Input::get('sort'), $allowed) ? Input::get('sort') : 'name_sparepart';
     // if user type in the url a column that doesnt exist app will default to id
     $order = Input::get('order') === 'desc' ? 'desc' : 'asc';
     // default desc
     $keyword = Input::get('q');
     $search = Input::get('search');
     $spareparts = Sparepart::join('sp_categories as cat', 'cat.id', '=', 'spareparts.sp_categories_id')->join('sp_groups as g', 'g.id', '=', 'spareparts.sp_group_id')->order_by($sort, $order);
     $q = null;
     if (Input::has('q')) {
         $spareparts = $spareparts->where($search, 'like', '%' . $keyword . '%');
         $q = '&search=' . $search . '&q=' . $keyword;
     }
     $spareparts = $spareparts->paginate(20, array('spareparts.id', 'name_sparepart', 'part_number', 'sp_categories_id', 'moving', 'base_price', 'price', 'satuan', 'isi_satuan', 'sp_category', 'sp_group', 'qty', 'min_qty'));
     $this->data['querystr'] = '&order=' . (Input::get('order') == 'asc' || null ? 'desc' : 'asc') . $q;
     $this->data['spareparts'] = $spareparts;
     $this->data['searchby'] = $search;
     $this->data['q'] = $keyword;
     $this->data['pagination'] = $spareparts->appends(array('search' => Input::get('search'), 'q' => Input::get('q'), 'sort' => Input::get('sort'), 'order' => Input::get('order')))->links();
     return View::make('themes.modul.' . $this->views . '.stock', $this->data);
 }
Beispiel #5
0
 public function actionSetuju($id)
 {
     $model = $this->loadModel($id);
     $relasi = RelasiPengadaanSparepart::model()->findAllByAttributes(array('ID_PENGADAAN' => $id));
     foreach ($relasi as $rel) {
         $stok = Yii::app()->db->createCommand()->select('STOK')->from('sparepart')->where('ID_SPAREPART=:ID_SPAREPART', array(':ID_SPAREPART' => $rel->ID_SPAREPART))->queryScalar();
         if ($stok == NULL) {
             $stok = $rel->JUMLAH;
         } else {
             $stok = $stok + $rel->JUMLAH;
         }
         Sparepart::model()->updateByPk($rel->ID_SPAREPART, array("STOK" => $stok));
     }
     Pengadaan::model()->updateByPk($id, array("STATUS" => "DISETUJUI KEUANGAN"));
     $this->redirect(array('admin'));
 }
Beispiel #6
0
<?php

/* @var $this PengadaanController */
/* @var $model Pengadaan */
$this->breadcrumbs = array('Pengadaans' => array('index'), 'Create');
$this->menu = array(array('label' => 'List Pengadaan', 'url' => array('index')), array('label' => 'Manage Pengadaan', 'url' => array('admin')));
?>

<h1>Pilih jenis Spare-parts yang akan diadakan</h1>

<?php 
$this->renderPartial('/sparepart/admin', array('model' => Sparepart::model()));
Beispiel #7
0
 public function get_sparepart()
 {
     $query = Input::get('query');
     $fleets = Sparepart::where('part_number', 'LIKE', '%' . $query . '%')->get(array('id', 'part_number', 'name_sparepart'));
     $fleetdatas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets);
     return json_encode($fleetdatas);
 }
Beispiel #8
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Sparepart the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Sparepart::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }