Esempio n. 1
0
 /**
  * @Author: ANH DUNG Aug 05, 2014
  * @Todo: CompanyEditContact at grid
  * @Param: $id list id 1,2,3 ...
  */
 public function actionCompanyUpdateDncExpiryDate($id)
 {
     try {
         $id = $this->FormatListId($id);
         $dnc_expiry_date = MyFormat::dateConverDmyToYmdForSeach(isset($_GET['dnc_expiry_date']) ? $_GET['dnc_expiry_date'] : '');
         if (MyFormat::isValidDate($dnc_expiry_date)) {
             Listing::UpdateDncExpiryDateByListId($id, $dnc_expiry_date);
         }
     } catch (Exception $ex) {
         echo $exc->getMessage();
         die;
     }
 }
Esempio n. 2
0
 /**
  * @Author: ANH DUNG Aug 05, 2014
  */
 public function SearchCompanyBE()
 {
     $cRole = Yii::app()->user->role_id;
     $cUid = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $company_listing_type = 1;
     if (isset($_GET['company_listing_type']) && $_GET['company_listing_type'] == 2) {
         $company_listing_type = 2;
     }
     $criteria->compare('t.company_listing_type', $company_listing_type);
     // Immediate or Follow up
     $criteria->compare('t.status', $this->status);
     // active inactive listing trong admin
     $criteria->compare('t.property_name_or_address', $this->property_name_or_address, true);
     $criteria->compare('t.keywordsearch', $this->keywordsearch, true);
     $criteria->compare('t.property_type_1', $this->property_type_1);
     if (is_array($this->location_id) && $this->location_id) {
         $criteria->addInCondition('t.location_id', $this->location_id);
     }
     $criteria->compare('t.property_type_2', $this->property_type_2);
     $criteria->compare('t.listing_description', $this->listing_description, true);
     $criteria->compare('t.listing_type', $this->listing_type);
     // sale / rent
     $criteria->compare('t.listing_type_transaction', ProTransactionsPropertyDetail::VAR_COMPANY);
     if (trim($this->company_listing_keywordsearch) != "") {
         $criteria->compare('CONCAT( t.property_name_or_address, " ",  t.company_owner_name) ', $this->company_listing_keywordsearch, true);
     }
     $criteria->compare('t.user_id', $this->user_id);
     // Jan 23, 2015 limit Telemarketer should see their own immediate and follow-up listing only. Listing of other telemarketers should be hidden.
     if ($cRole != ROLE_ADMIN && (Yii::app()->user->id != ID_USER_SHOW_FULL_LISTING_1 && Yii::app()->user->id != ID_USER_SHOW_FULL_LISTING_1)) {
         $criteria->compare('t.user_id', $cUid);
     }
     // Jan 23, 2015 limit Telemarketer should see their own immediate and follow-up listing only. Listing of other telemarketers should be hidden.
     if ($cRole == ROLE_TELEMARKETER) {
         $criteria->addCondition('t.company_listing_status<>' . Listing::DELETE);
     }
     //        $criteria->addInCondition('t.location_id', ProAgentDistrict::GetByAgentId(Yii::app()->user->id));
     $dnc_expiry_date = MyFormat::dateConverDmyToYmdForSeach($this->dnc_expiry_date);
     if (!empty($this->dnc_expiry_date)) {
         $criteria->compare('t.dnc_expiry_date', $dnc_expiry_date);
     }
     $pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
     if (isset($_GET['pageSize']) && !empty($_GET['pageSize'])) {
         $pageSize = (int) $_GET['pageSize'];
     }
     $_SESSION['data-excel'] = new CActiveDataProvider($this, array('pagination' => false, 'criteria' => $criteria));
     $_SESSION['data_excel_company_listing_type'] = $company_listing_type;
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => array('id' => 'DESC')), 'pagination' => array('pageSize' => $pageSize)));
 }
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id, true);
     $criteria->compare('t.transactions_id', $this->transactions_id, true);
     $criteria->compare('t.invoice_number', $this->invoice_number, true);
     $criteria->compare('t.invoice_type', $this->invoice_type);
     $criteria->compare('t.invoice_template', $this->invoice_template);
     $criteria->compare('t.trans_bill_to_id', $this->trans_bill_to_id, true);
     $criteria->compare('t.type', $this->type);
     $criteria->compare('t.client_type_id', $this->client_type_id);
     $criteria->compare('t.invoice_bill_to', $this->invoice_bill_to);
     $date_from = '';
     $date_to = '';
     if (!empty($this->date_from)) {
         $date_from = MyFormat::dateConverDmyToYmdForSeach($this->date_from) . " 00:00:00";
     }
     if (!empty($this->date_to)) {
         $date_to = MyFormat::dateConverDmyToYmdForSeach($this->date_to) . " 23:59:00";
     }
     if (!empty($date_from) && empty($date_to)) {
         $criteria->addCondition("t.created_date>='{$date_from}'");
     }
     if (empty($date_from) && !empty($date_to)) {
         $criteria->addCondition("t.created_date<='{$date_to}'");
     }
     if (!empty($date_from) && !empty($date_to)) {
         $criteria->addBetweenCondition("t.created_date", $date_from, $date_to);
     }
     $aWith = array();
     if (trim($this->transactions_no) != "") {
         $criteria->compare('rTransaction.transactions_no', trim($this->transactions_no), true);
     }
     if (trim($this->property_address) != "") {
         $criteria->compare('rListing.property_name_or_address', trim($this->property_address), true);
         $aWith[] = 'rListing';
     }
     if (count($aWith)) {
         $criteria->with = $aWith;
         $criteria->together = true;
     }
     $criteria->order = 't.id DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => 50)));
 }
Esempio n. 4
0
 public function searchMixed()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id, true);
     $criteria->compare('t.invoice_no', trim($this->invoice_no), true);
     $criteria->compare('t.transactions_no', trim($this->transactions_no), true);
     $criteria->compare('t.bill_to', $this->bill_to);
     $criteria->compare('t.user_id', $this->user_id, true);
     $criteria->compare('t.user_name', $this->user_name, true);
     $criteria->compare('t.user_billing_address', $this->user_billing_address, true);
     $criteria->compare('t.user_postal_code', $this->user_postal_code, true);
     $criteria->compare('t.total_amount_due', $this->total_amount_due, true);
     $criteria->compare('t.status', $this->status);
     $date_from = '';
     $date_to = '';
     if (!empty($this->date_from)) {
         $date_from = MyFormat::dateConverDmyToYmdForSeach($this->date_from) . " 00:00:00";
     }
     if (!empty($this->date_to)) {
         $date_to = MyFormat::dateConverDmyToYmdForSeach($this->date_to) . " 23:59:00";
     }
     if (!empty($date_from) && empty($date_to)) {
         $criteria->addCondition("t.created_date>='{$date_from}'");
     }
     if (empty($date_from) && !empty($date_to)) {
         $criteria->addCondition("t.created_date<='{$date_to}'");
     }
     if (!empty($date_from) && !empty($date_to)) {
         $criteria->addBetweenCondition("t.created_date", $date_from, $date_to);
     }
     if (!empty($this->keyword)) {
         $criteria->compare('rDetail.description', $this->keyword, true);
         $criteria->with = array('rDetail');
         $criteria->together = true;
     }
     $criteria->order = "t.created_date desc";
     $fiInvoices = static::model()->findAll($criteria);
     $c2 = new CDbCriteria();
     $c2->compare('invoice_number', trim($this->invoice_no), true);
     $c2->compare('invoice_type', ProTransactionsInvoice::TYPE_INVOICE);
     $c2->order = 'created_date desc';
     $invoices = ProTransactionsInvoice::model()->findAll($c2);
     $mixedInvoice = array();
     $f = Yii::app()->format;
     foreach ($fiInvoices as $invoice) {
         $data = array('id' => $invoice->id, 'invoice_no' => $invoice->invoice_no, 'created_date' => $invoice->created_date, 'transactions_no' => $invoice->transactions_no, 'property_address' => $f->formatInvoicePropertyAddress($invoice), 'total_amount_due_gst' => $f->formatPrice($invoice->total_amount_due_gst), 'status' => FiInvoice::$STA_STATUS[$invoice->status], 'receipt' => $f->formatInvoiceGenReceipt($invoice), 'viewUrl' => Yii::app()->createAbsoluteUrl('admin/fiInvoice/view', array('id' => $invoice->id)), 'deleteUrl' => Yii::app()->createAbsoluteUrl('admin/fiInvoice/delete', array('id' => $invoice->id)));
         if (FiInvoice::CanUpdate($invoice)) {
             $data['updateUrl'] = Yii::app()->createAbsoluteUrl('admin/fiInvoice/update', array('id' => $invoice->id));
         }
         $mixedInvoice[] = $data;
     }
     foreach ($invoices as $invoice) {
         $mixedInvoice[] = array('id' => $invoice->id + 200000, 'invoice_no' => $invoice->invoice_number, 'created_date' => $invoice->created_date, 'transactions_no' => $invoice->rTransaction->transactions_no, 'property_address' => $invoice->rTransaction->rPropertyDetail->property_name_or_address, 'total_amount_due_gst' => $f->formatTransactionPropertyPrice($invoice->rTransaction), 'viewUrl' => Yii::app()->createAbsoluteUrl('admin/transactions/viewInvoice', array('id' => $invoice->id)));
     }
     return new CArrayDataProvider($mixedInvoice, array('sort' => array('defaultOrder' => 'created_date DESC', 'attributes' => array('created_date', 'invoice_no')), 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']))));
 }
 public function searchFeListDownline()
 {
     $criteria = new CDbCriteria();
     $aWith = array('rTransaction', 'rUser', 'rSalePerson', 'rPropertyType', 'rListing');
     //            $criteria->with = $aWith;
     //            $criteria->together = true;// Single Query - together is false => Multiple Query
     $criteria->compare('t.user_id', Yii::app()->user->id);
     $criteria->compare('t.transactions_no', $this->transactions_no, true);
     $criteria->compare('t.property_type_id', $this->property_type_id);
     //            $criteria->compare('t.is_internal_co_broke', ProTransactions::INTERNAL_CO_BROKE);
     $criteria->addCondition(' ( t.is_internal_co_broke = ' . ProTransactions::INTERNAL_CO_BROKE . ' ) OR ' . ' ( t.is_internal_co_broke = ' . ProTransactions::IS_NOT_INTERNAL_CO_BROKE . ' AND ' . ' t.type <> ' . ProTransactions::TYPE_CONSULTANT . ')  ');
     $submitted_date = MyFormat::dateConverDmyToYmdForSeach($this->submitted_date_downline);
     if (!empty($submitted_date)) {
         $criteria->compare('t.submitted_date', $submitted_date, true);
     }
     if (isset($this->status) && $this->status != 1) {
         $criteria->compare('t.status', $this->status);
     }
     $criteria->order = 't.id DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => 10)));
 }
Esempio n. 6
0
 /**
  * @Author: ANH DUNG Jan 13, 2015
  * @Todo: BE search list tenancies draft by transaction 
  */
 public function getBEListTenanciesDraft()
 {
     $cUid = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->compare('t.status', STATUS_TENANCY_DRAFT);
     $criteria->compare('t.created_by', $cUid);
     $criteria->compare('t.is_admin_created', 1);
     $aWith = array();
     //        $criteria->with = array('rVendorPurchaserDetail');
     //        $criteria->compare('rVendorPurchaserDetail.user_id', $current_user_id);
     if (trim($this->sPropertyName) != '') {
         $aWith[] = 'listing';
         $criteria->compare('listing.property_name_or_address', $this->sPropertyName, true);
     }
     if (count($aWith)) {
         $criteria->with = $aWith;
         $criteria->together = true;
     }
     $tenancy_agreement_date = MyFormat::dateConverDmyToYmdForSeach($this->tenancy_agreement_date);
     if (!empty($this->tenancy_agreement_date)) {
         $criteria->compare('t.tenancy_agreement_date', $tenancy_agreement_date);
     }
     $commencement_date = MyFormat::dateConverDmyToYmdForSeach($this->commencement_date);
     if (!empty($this->commencement_date)) {
         $criteria->compare('t.commencement_date', $commencement_date);
     }
     $expiring_date = MyFormat::dateConverDmyToYmdForSeach($this->expiring_date);
     if (!empty($this->expiring_date)) {
         $criteria->compare('t.expiring_date', $expiring_date);
     }
     $created_date = MyFormat::dateConverDmyToYmdForSeach($this->created_date);
     if (!empty($this->created_date)) {
         $criteria->compare('t.created_date', $created_date, true);
     }
     $criteria->compare('t.tenancy_amount', $this->tenancy_amount, true);
     $criteria->compare('t.deposit_payable', $this->deposit_payable, true);
     $criteria->compare('t.months_rent', $this->months_rent, true);
     $criteria->order = "t.id DESC";
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']))));
 }