/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PurchaseOrder::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'create_uid' => $this->create_uid, 'create_date' => $this->create_date, 'write_date' => $this->write_date, 'write_uid' => $this->write_uid, 'journal_id' => $this->journal_id, 'date_order' => $this->date_order, 'partner_id' => $this->partner_id, 'dest_address_id' => $this->dest_address_id, 'fiscal_position' => $this->fiscal_position, 'amount_untaxed' => $this->amount_untaxed, 'location_id' => $this->location_id, 'company_id' => $this->company_id, 'amount_tax' => $this->amount_tax, 'pricelist_id' => $this->pricelist_id, 'warehouse_id' => $this->warehouse_id, 'payment_term_id' => $this->payment_term_id, 'date_approve' => $this->date_approve, 'amount_total' => $this->amount_total, 'shipped' => $this->shipped, 'validator' => $this->validator, 'minimum_planned_date' => $this->minimum_planned_date, 'rm_sent' => $this->rm_sent, 'port_moved0' => $this->port_moved0, 'duedate' => $this->duedate, 'scheduleddate' => $this->scheduleddate, 'print_line' => $this->print_line, 'attention' => $this->attention]); $query->andFilterWhere(['like', 'origin', $this->origin])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'partner_ref', $this->partner_ref])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'invoice_method', $this->invoice_method])->andFilterWhere(['like', 'subcont_type', $this->subcont_type])->andFilterWhere(['like', 'yourref', $this->yourref])->andFilterWhere(['like', 'note', $this->note])->andFilterWhere(['like', 'other', $this->other])->andFilterWhere(['like', 'jenis', $this->jenis])->andFilterWhere(['like', 'type_permintaan', $this->type_permintaan])->andFilterWhere(['like', 'no_fpb', $this->no_fpb])->andFilterWhere(['like', 'term_of_payment', $this->term_of_payment])->andFilterWhere(['like', 'port', $this->port])->andFilterWhere(['like', 'delivery', $this->delivery])->andFilterWhere(['like', 'after_shipment', $this->after_shipment])->andFilterWhere(['like', 'total_price', $this->total_price])->andFilterWhere(['like', 'shipment_to', $this->shipment_to]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PurchaseOrder::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(['purchaseorder_id' => $this->purchaseorder_id, 'purchaseorder_no' => $this->purchaseorder_no, 'purchaseorder_date' => $this->purchaseorder_date, 'purchaseorder_date_transaction' => $this->purchaseorder_date_transaction, 'purchaseorder_date_delete' => $this->purchaseorder_date_delete, 'purchaseorder_customerid' => $this->purchaseorder_customerid, 'purchaseorder_supplierid' => $this->purchaseorder_supplierid, 'purchaseorder_supplier_quotation_no' => $this->purchaseorder_supplier_quotation_no, 'purchaseorder_createid' => $this->purchaseorder_createid, 'purchaseorder_charge' => $this->purchaseorder_charge, 'purchaseorder_tax_percent' => $this->purchaseorder_tax_percent, 'purchaseorder_tax_amount' => $this->purchaseorder_tax_amount, 'purchaseorder_revision' => $this->purchaseorder_revision, 'purchaseorder_parts_total' => $this->purchaseorder_parts_total, 'purchaseorder_deleteid' => $this->purchaseorder_deleteid, 'purchaseorder_creditorid' => $this->purchaseorder_creditorid, 'purchaseorder_purchase_return' => $this->purchaseorder_purchase_return, 'purchaseorder_payment_paid_thus_far' => $this->purchaseorder_payment_paid_thus_far, 'purchaseorder_outstanding_amount' => $this->purchaseorder_outstanding_amount, 'purchaseorder_projectid' => $this->purchaseorder_projectid, 'purchaseorder_gst_payable' => $this->purchaseorder_gst_payable, 'purchaseorder_total_amount' => $this->purchaseorder_total_amount]); $query->andFilterWhere(['like', 'purchaseorder_createname', $this->purchaseorder_createname])->andFilterWhere(['like', 'purchaseorder_remark', $this->purchaseorder_remark])->andFilterWhere(['like', 'purchaseorder_system', $this->purchaseorder_system])->andFilterWhere(['like', 'purchaseorder_partno', $this->purchaseorder_partno])->andFilterWhere(['like', 'purchaseorder_update_stock_status', $this->purchaseorder_update_stock_status])->andFilterWhere(['like', 'purchaseorder_status', $this->purchaseorder_status])->andFilterWhere(['like', 'purchaseorder_tax_label', $this->purchaseorder_tax_label])->andFilterWhere(['like', 'purchaseorder_printed_status', $this->purchaseorder_printed_status])->andFilterWhere(['like', 'purchaseorder_payment_status', $this->purchaseorder_payment_status])->andFilterWhere(['like', 'purchaseorder_no_user_format', $this->purchaseorder_no_user_format])->andFilterWhere(['like', 'purchaseorder_auto_generate', $this->purchaseorder_auto_generate]); return $dataProvider; }
public function search($input) { $query = PurchaseOrder::query(); $columns = Schema::getColumnListing('purchaseOrders'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } return [$query->get(), $attributes]; }
/** * @return \yii\db\ActiveQuery */ public function getPurchaseOrders() { return $this->hasMany(PurchaseOrder::className(), ['pricelist_id' => 'id']); }
/** * Finds the PurchaseOrder model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return PurchaseOrder the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = PurchaseOrder::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getOrder() { return $this->hasOne(PurchaseOrder::className(), ['id' => 'order_id']); }
/** * @return \yii\db\ActiveQuery */ public function getPurchaseOrders() { return $this->hasMany(PurchaseOrder::className(), ['payment_term_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getPurchaseOrders() { return $this->hasMany(PurchaseOrder::className(), ['attention' => 'id']); }