Order::search PHP Method

    public function search()
    {
        $criteria = new CDbCriteria();
        $criteria->with = ['delivery', 'payment', 'client', 'status'];
        $criteria->compare('t.id', $this->id);
        $criteria->compare('t.name', $this->name, true);
        $criteria->compare('delivery_id', $this->delivery_id);
        $criteria->compare('delivery_price', $this->delivery_price);
        $criteria->compare('payment_method_id', $this->payment_method_id);
        $criteria->compare('paid', $this->paid);
        $criteria->compare('payment_time', $this->payment_time);
        $criteria->compare('payment_details', $this->payment_details, true);
        $criteria->compare('total_price', $this->total_price);
        $criteria->compare('total_price', $this->total_price);
        $criteria->compare('discount', $this->discount);
        $criteria->compare('coupon_discount', $this->coupon_discount);
        $criteria->compare('separate_delivery', $this->separate_delivery);
        $criteria->compare('t.status_id', $this->status_id);
        $criteria->compare('date', $this->date, true);
        $criteria->compare('t.user_id', $this->user_id);
        $criteria->compare('phone', $this->phone, true);
        $criteria->compare('email', $this->email, true);
        $criteria->compare('comment', $this->comment, true);
        $criteria->compare('ip', $this->ip, true);
        $criteria->compare('url', $this->url, true);
        $criteria->compare('note', $this->note, true);
        $criteria->compare('modified', $this->modified, true);
        $criteria->compare('t.manager_id', $this->manager_id);
        if (null !== $this->couponId) {
            $criteria->with['couponsIds'] = ['together' => true];
            $criteria->addCondition('couponsIds.coupon_id = :id');
            $criteria->params = CMap::mergeArray($criteria->params, [':id' => $this->couponId]);
        }
        if (null !== $this->name) {
            $clientCriteria = new CDbCriteria();
            $clientCriteria->with['client'] = ['together' => true];
            $clientCriteria->addSearchCondition('client.last_name', $this->name, true, 'OR');
            $clientCriteria->addSearchCondition('client.first_name', $this->name, true, 'OR');
            $clientCriteria->addSearchCondition('client.middle_name', $this->name, true, 'OR');
            $clientCriteria->addSearchCondition('client.nick_name', $this->name, true, 'OR');
            $criteria->mergeWith($clientCriteria, 'OR');
        }
        return new CActiveDataProvider(__CLASS__, ['criteria' => $criteria, 'sort' => ['defaultOrder' => $this->getTableAlias() . '.id DESC']]);
    }

Usage Example

Beispiel #1
0
 public function search()
 {
     $objOrder = new Order();
     $objOrder->setPatientIdentification(request_var("identification"));
     $objOrder->setTurn(request_var("turn"));
     $objOrder->setPatientLastname(request_var("lastname"));
     $objOrder->setPatientFirstname(request_var("firstname"));
     $objOrder->setInitDate(request_var("initDate"));
     $objOrder->setEndDate(request_var("endDate"));
     $objOrder->setHallId(request_var("hall"));
     $objOrder->setOfficeId(request_var("office"));
     $_response = $objOrder->search();
     $arrResult = array();
     $_response = $_response["ConsultarOrdenWebSigLabResult"];
     if (is_array($_response) && count($_response)) {
         foreach ($_response as $_order) {
             foreach ($_order as $_value) {
                 if (is_array($_value)) {
                     $ordId = $_value["EmpId"] . "@" . $_value["OficinaId"] . "@" . $_value["OrdId"];
                     $arrResult[] = array("Id" => "<a href='#' onclick='viewResult(\"{$ordId}\");'><img src='../img/search.png' /></a>", "PacIdentificacion" => $_value["PacIdentificacion"], "PacApellido" => utf8_encode($_value["PacApellido"] . " " . $_value["PacNombre"]), "OrdTurno" => $_value["OrdTurno"], "OrdFecha" => Util::formatDBWEB(substr($_value["OrdFecha"], 0, 10)), "TipoOrdenDescripcion" => $_value["TipoOrdenDescripcion"], "MedApellido" => utf8_encode($_value["MedApellido"] . " " . $_value["MedNombre"]), "SalaHosp" => $_value["SalaHospDescripcion"]);
                 } else {
                     $ordId = $_order["EmpId"] . "@" . $_order["OficinaId"] . "@" . $_order["OrdId"];
                     $arrResult[] = array("Id" => "<a href='#' onclick='viewResult(\"{$ordId}\");'><img src='../img/search.png' /></a>", "PacIdentificacion" => $_order["PacIdentificacion"], "PacApellido" => utf8_encode($_order["PacApellido"] . " " . $_order["PacNombre"]), "OrdTurno" => $_order["OrdTurno"], "OrdFecha" => Util::formatDBWEB(substr($_order["OrdFecha"], 0, 10)), "TipoOrdenDescripcion" => $_value["TipoOrdenDescripcion"], "MedApellido" => utf8_encode($_order["MedApellido"] . " " . $_order["MedNombre"]), "SalaHosp" => $_order["SalaHospDescripcion"]);
                     break;
                 }
             }
         }
     }
     echo json_encode($arrResult);
 }
All Usage Examples Of Order::search