/** * Displays the specified inventory item. * * @param int|string $id * * @return \Illuminate\View\View */ public function show($id) { $item = $this->inventory->find($id); $variants = $this->presenter->tableVariants($item); $stocks = $this->presenter->tableStocks($item); $navbarProfile = $this->presenter->navbarProfile($item); $navbarVariants = $this->presenter->navbarVariants($item); $navbarStocks = $this->presenter->navbarStocks($item); return view('inventory.show', compact('item', 'stocks', 'variants', 'navbarProfile', 'navbarVariants', 'navbarStocks')); }
public function test() { //$item = Inventory::find(1); $result = Inventory::find(1); echo json_encode($result->getTotalStockQuantity()); dd($result); //return view('test', compact('result')); }
public function actionReport($id) { // get your HTML raw content without any layouts or scripts $model = Inventory::find()->where(['id' => $id])->one(); $content = $this->renderPartial('_reportView', ['model' => $model]); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => []]); // return the pdf output as per the destination setting return $pdf->render(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Inventory::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['budget_id' => $this->budget_id, 'productuser_id' => $this->productuser_id, 'partner_id' => $this->partner_id, 'department_id' => $this->department_id, 'bill_no' => $this->bill_no, 'd_date' => $this->d_date, 'date_accept' => $this->date_accept]); $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'inventory', $this->inventory])->andFilterWhere(['like', 'file', $this->file]); return $dataProvider; }
public function ChangeStatus($id) { if (Auth::check()) { if (User::isSuperAdmin()) { $entity = Inventory::find($id); } if ($entity) { $data = array(); $audit = new AuditsController(); if ($entity->status == 'Active') { array_push($data, 'status'); array_push($data, $entity->status); array_push($data, 'Inactive'); $entity->status = 'Inactive'; $msg = 'disable'; } elseif ($entity->status == 'Inactive') { array_push($data, 'status'); array_push($data, $entity->status); array_push($data, 'Active'); $entity->status = 'Active'; $msg = 'actived'; } $audit->store('inventory', $id, $data, 'edit'); $entity->save(); return $msg; } return 'please Select your Client'; } return Redirect::to(url('user/login')); }
public function SubAudit($audit) { $audit_obj = array(); foreach ($audit as $index) { $entity_obj = null; switch ($index->entity_type) { case 'user': if (in_array('VIEW_USER', $this->permission)) { $entity_obj = User::find($index->entity_id); } break; case 'company': if (User::isSuperAdmin()) { $entity_obj = \App\Models\Company::find($index->entity_id); } break; case 'inventory': if (User::isSuperAdmin()) { $entity_obj = Inventory::find($index->entity_id); } break; case 'client': if (in_array('VIEW_CLIENT', $this->permission)) { $entity_obj = Client::find($index->entity_id); } break; case 'advertiser': if (in_array('VIEW_ADVERTISER', $this->permission)) { $entity_obj = Advertiser::with('GetClientID')->find($index->entity_id); } break; case 'creative': if (in_array('VIEW_CREATIVE', $this->permission)) { $entity_obj = Creative::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'campaign': if (in_array('VIEW_CAMPAIGN', $this->permission)) { $entity_obj = Campaign::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'offer': if (in_array('VIEW_OFFER', $this->permission)) { $entity_obj = Offer::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'pixel': if (in_array('VIEW_PIXEL', $this->permission)) { $entity_obj = Pixel::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'targetgroup': if (in_array('VIEW_TARGETGROUP', $this->permission)) { $entity_obj = Targetgroup::find($index->entity_id); } break; case 'targetgroup_geolocation_map': if (in_array('VIEW_TARGETGROUP', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = Geolocation::find($index->after_value); } else { $entity_obj = Geolocation::find($index->entity_id); } } break; case 'targetgroup_creative_map': if (in_array('VIEW_TARGETGROUP', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = Creative::find($index->after_value); } else { $entity_obj = Creative::find($index->entity_id); } } break; case 'targetgroup_segment_map': if (in_array('VIEW_TARGETGROUP', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = Segment::find($index->after_value); } else { $entity_obj = Segment::find($index->entity_id); } } break; case 'targetgroup_geosegment_map': if (in_array('VIEW_TARGETGROUP', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = GeoSegmentList::find($index->after_value); } else { $entity_obj = GeoSegmentList::find($index->entity_id); } } break; case 'targetgroup_bwlist_map': if (in_array('VIEW_TARGETGROUP', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = BWList::find($index->after_value); } else { $entity_obj = BWList::find($index->entity_id); } } break; case 'targetgroup_bidprofile_map': if (in_array('VIEW_TARGETGROUP', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = Bid_Profile::find($index->after_value); } else { $entity_obj = Bid_Profile::find($index->entity_id); } } break; case 'geosegment': if (in_array('VIEW_GEOSEGMENTLIST', $this->permission)) { $entity_obj = GeoSegmentList::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'geosegmententrie': if (in_array('VIEW_GEOSEGMENTLIST', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = GeoSegment::find($index->after_value); } else { $entity_obj = GeoSegment::find($index->entity_id); } } break; case 'bwlist': if (in_array('VIEW_BWLIST', $this->permission)) { $entity_obj = BWList::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'bwlistentrie': if (in_array('VIEW_BWLIST', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = BWEntries::find($index->after_value); } else { $entity_obj = BWEntries::find($index->entity_id); } } break; case 'bid_profile': if (in_array('VIEW_BIDPROFILE', $this->permission)) { $entity_obj = Bid_Profile::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'bid_profile_entry': if (in_array('VIEW_BIDPROFILE', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = Bid_Profile::where('id', $index->after_value)->first(); } else { $entity_obj = Bid_Profile_Entry::with('getParent')->find($index->entity_id); } } break; case 'modelTable': if (in_array('VIEW_MODEL', $this->permission)) { if ($index->audit_type == 'del') { $entity_obj = BWList::where('id', $index->after_value)->first(); } else { $entity_obj = ModelTable::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } } break; case 'offer_pixel_map': if (in_array('VIEW_OFFER', $this->permission)) { $entity_obj = Pixel::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'advertiser_model_map': if (in_array('VIEW_ADVERTISER', $this->permission)) { $entity_obj = ModelTable::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'positive_offer_model': if (in_array('VIEW_MODEL', $this->permission)) { $entity_obj = Offer::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; case 'negative_offer_model': if (in_array('VIEW_MODEL', $this->permission)) { $entity_obj = Offer::with(['getAdvertiser' => function ($q) { $q->with('GetClientID'); }])->find($index->entity_id); } break; } if (!is_null($entity_obj)) { array_push($audit_obj, $index); array_push($audit_obj, $entity_obj); } } return $audit_obj; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $staff = Inventory::find($id); $staff->delete(); return redirect()->route('inventory.index')->withMessage('Inventory Item Deleted')->withStatus('success'); }
} ?> <?php $form = ActiveForm::begin(['action' => 'index.php?r=inventory/process']); ?> <div class="panel panel-info"> <div class="panel panel-heading"> นำเข้าพัสดุ กรอกรายละเอียดในการส่งสินค้า </div> <div class="panel panel-body"> <div class="row"> <div class="col-md-3"> <?php $count = \app\models\Inventory::find()->where(['inventory' => 'i'])->count() + 1; ?> <?php echo $form->field($model, 'id')->textInput(['value' => date('Ymd-') . $count]); ?> </div> <div class="col-md-2"> <?php echo $form->field($model, 'd_date')->widget(DatePicker::className(), ['clientOptions' => ['changeMonth' => true, 'changeYear' => true], 'dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]); ?> </div> <div class="col-md-3"> <?php echo $form->field($model, 'bill_no')->textInput(); ?>