当前位置: 首页>>代码示例>>PHP>>正文


PHP Invoice::find方法代码示例

本文整理汇总了PHP中app\models\Invoice::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::find方法的具体用法?PHP Invoice::find怎么用?PHP Invoice::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Invoice的用法示例。


在下文中一共展示了Invoice::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionInvoice

 public function actionInvoice($id)
 {
     if (Yii::$app->user->identity->type == 'normal') {
         return $this->redirect(['update', 'id' => $id]);
     }
     $admin_id = Yii::$app->user->identity->id;
     $model = $this->findModel($id);
     $invoice = Invoice::find();
     $invoice = $invoice->where('job_id=' . $id);
     $invoice = $invoice->orderBy('id DESC');
     $invoice = $invoice->asArray();
     $invoice = $invoice->limit(1);
     $invoice = $invoice->all();
     // $companies = Company::find();
     // if(Yii::$app->user->identity->type=='normal'){
     //     $companies = $companies->innerJoin('wolf_admin_to_company wc','wc.company_id=wolf_company.company_id');
     //     $companies = $companies->where('admin_id='.$admin_id);
     // }
     // $companies = $companies->orderBy('company_name');
     // $companies = $companies->asArray();
     // $companies = $companies->all();
     $jobScheduleSearch = new JobScheduleSearch(['job_id' => $id]);
     $scheduleData = $jobScheduleSearch->search(Yii::$app->request->getQueryParams());
     $scheduleData->pagination->pageSize = -1;
     //infinite value
     return $this->render('invoice', ['model' => $this->findModel($id), 'scheduleData' => $scheduleData, 'jobScheduleSearch' => $jobScheduleSearch, 'invoice' => $invoice]);
 }
开发者ID:sindotnet,项目名称:cona,代码行数:27,代码来源:JobController.php

示例2: update

 public function update($id, Request $request)
 {
     $invoice = Invoice::find($id);
     $rules = $invoice->getValidatorRules();
     $validator = $this->validate($request, $rules);
     if ($validator) {
         return response()->json($validator, '404');
     }
     $input = $request->all();
     $invoice->update($input);
     /**
     |-----------------------------------------------------
     | Add customer to invoice
     |-----------------------------------------------------
     */
     $customer_id = $request->get('customer')['id'];
     $customer = Customer::find($customer_id);
     $invoice->updateCustomerWithShippingAddress($customer);
     /**
     |-----------------------------------------------------
     | Add list products to invoice
     |-----------------------------------------------------
     */
     $invoice->addProductItems($request->get('items'));
     /**
     |-----------------------------------------------------
     | Save to Db
     |-----------------------------------------------------
     */
     redirect()->route('sale.invoice.show', [$invoice], 302);
 }
开发者ID:noodle-learns-programming,项目名称:laravel,代码行数:31,代码来源:InvoiceController.php

示例3: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Invoice::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(['id' => $this->id, 'zip' => $this->zip]);
     $query->andFilterWhere(['like', 'business_name', $this->business_name])->andFilterWhere(['like', 'rfc', $this->rfc])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
开发者ID:basp91,项目名称:isics-register,代码行数:21,代码来源:InvoiceSearch.php

示例4: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Invoice::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(['id' => $this->id, 'job_id' => $this->job_id, 'company_id' => $this->company_id, 'invoice_date' => $this->invoice_date]);
     $query->andFilterWhere(['like', 'invoice_no', $this->invoice_no]);
     return $dataProvider;
 }
开发者ID:sindotnet,项目名称:cona,代码行数:21,代码来源:InvoiceSearch.php

示例5: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = InvoiceModel::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(['id' => $this->id, 'amount' => $this->amount]);
     if (isset($params['user'])) {
         $query->andFilterWhere(['user_name' => $params['user']]);
     }
     $query->andFilterWhere(['like', 'user_name', $this->user_name])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
开发者ID:kissarat,项目名称:yii2-template,代码行数:24,代码来源:Invoice.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $admin = \Auth::User();
         if (!$admin) {
             return $this->failResponse('admin not logged in');
         }
         $invoiceObj = Invoice::find($id);
         if (count($invoiceObj) == 0) {
             return $this->failResponse('customer id not found');
         }
         $invoiceObj->delete();
         return $this->successResponse('customer deleted successfully');
     } catch (\Exception $e) {
         Log::error("error in customer controller");
         return $this->failResponse($e->getMessage());
     }
 }
开发者ID:prathyushasahusoft,项目名称:Angular-Scripts,代码行数:24,代码来源:invoiceController.php


注:本文中的app\models\Invoice::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。