protected function beforeSave()
 {
     if (strpos($this->schedule_date, '/')) {
         $this->schedule_date = MyFormat::dateConverDmyToYmd($this->schedule_date);
     }
     return parent::beforeSave();
 }
Exemple #2
0
 public function beforeSave()
 {
     $this->dnc_expiry_date = MyFormat::dateConverDmyToYmd($this->dnc_expiry_date);
     $this->keywordsearch = $this->saveKeywordSearch();
     // Aug 02, 2014 ANH DUNG add
     if ($this->listing_type_transaction == ProTransactionsPropertyDetail::VAR_COMPANY) {
         // do some action for company listing
         self::GetInfoMapAd($this);
         return parent::beforeSave();
     }
     if (!empty($this->company_listing_id) && $this->company_listing_id > 0) {
         $this->listing_type_transaction = ProTransactionsPropertyDetail::VAR_INDIVIDUAL_FROM_COMPANY;
     }
     // Aug 02, 2014 ANH DUNG add
     // Jun 02, 2014 ANH DUNG add
     self::getFloorSizeSqft($this);
     self::getAdminId($this);
     self::setSearchPsf($this);
     // Jun 02, 2014 ANH DUNG add
     if (in_array($this->scenario, Listing::$AllScenarioStep1)) {
         // ANH DUNG FIX Jul 01, 2014
         //        if (0) { // ANH DUNG FIX Jul 01, 2014
         self::GetInfoMapAd($this);
     }
     // end if ($this->scenario == 'create_listing_step4' || $this->
     $this->company_listing_id = (int) $this->company_listing_id;
     $this->office_bkank_valuation = (double) $this->office_bkank_valuation;
     return parent::beforeSave();
 }
Exemple #3
0
 protected function beforeSave()
 {
     if (!empty($this->posted) && strpos($this->posted, '/')) {
         $this->posted = MyFormat::dateConverDmyToYmd($this->posted);
     }
     return parent::beforeSave();
 }
 protected function beforeSave()
 {
     if (!empty($this->receipt_date_paid) && strpos($this->receipt_date_paid, '/')) {
         $this->receipt_date_paid = MyFormat::dateConverDmyToYmd($this->receipt_date_paid);
     }
     if ($this->transactions_id) {
         $mTrans = ProTransactions::model()->findByPk($this->transactions_id);
         if ($mTrans) {
             $this->listing_id = $mTrans->listing_id;
         }
     }
     return parent::beforeSave();
 }
Exemple #5
0
 /**
  * @Author: ANH DUNG Sep 12, 2014
  * @Todo: calc report
  * @Param: $model model 
  */
 public static function CalcReportTrans($model)
 {
     $aRes = array();
     if (empty($model->date_from)) {
         $model->date_from = date("d/m/Y");
     }
     if (empty($model->date_to)) {
         $model->date_to = date("d/m/Y");
     }
     $date_from = MyFormat::dateConverDmyToYmd($model->date_from);
     $date_to = MyFormat::dateConverDmyToYmd($model->date_to);
     switch ($model->report_type) {
         case FiInvoice::REPORT_DAILY:
             self::ReportDailyTrans($model, $aRes, $date_from, $date_to);
             break;
         case FiInvoice::REPORT_MONTHLY:
             self::ReportMonthlyTrans($model, $aRes, $date_from, $date_to);
             break;
         case FiInvoice::REPORT_YEARLY:
             self::ReporYearlyTrans($model, $aRes, $date_from, $date_to);
             break;
         default:
             break;
     }
     $_SESSION['REPORT_TRANSACTION'] = $aRes;
     $_SESSION['REPORT_TYPE'] = $model->report_type;
     return $aRes;
 }
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         $prefix_code_invoice = "REC" . date('y') . date('m');
         $this->receipt_no = MyFormat::getNextId('FiInvoiceReceipt', $prefix_code_invoice, 'receipt_no', ProTransactions::LENGTH_TRANS_NO);
         $this->created_by = Yii::app()->user->id;
     }
     if (!empty($this->receipt_date_paid) && strpos($this->receipt_date_paid, '/')) {
         $this->receipt_date_paid = MyFormat::dateConverDmyToYmd($this->receipt_date_paid);
     }
     return parent::beforeSave();
 }
Exemple #7
0
             $model->scanned_employment_pass = CUploadedFile::getInstance($model, 'scanned_employment_pass');
             $model->scanned_passport = CUploadedFile::getInstance($model, 'scanned_passport');
             if (!empty($model->user_id)) {
                 $model->scenario = 'AgentAddTenantExitUid';
             }
             $model->validate();
             if (!$model->hasErrors()) {
                 $oldUser = false;
                 if (!empty($model->user_id)) {
                     $oldUser = true;
                 }
                 ProTransactionsVendorPurchaserDetail::saveOneTenant($model, 0);
                 if ($oldUser) {
                     // không xử lý cho edit tenant nữa, chỉ lưu user_id của tenant thôi,
                     // nên không cần phải copy file qua nữa
                     //                        $mUser = Users::model()->findByPk($model->user_id);
                     //                        Users::copyTwoFileFromUserToTenant($mUser, $model);
                 }
                 //                    $model->type = Users::USER_TENANT;
                 //                    $mUser = Users::saveUserVendorPurchaser($model);
                 //                    $model->user_id = $mUser->id;
                 //                    $model->pass_expiry_date = MyFormat::dateConverDmyToYmd($model->pass_expiry_date);
                 //                    $model->save();
                 //                    ProTransactionsVendorPurchaserDetail::saveSomeFile($model,'scanned_employment_pass');
                 //                    ProTransactionsVendorPurchaserDetail::saveSomeFile($model,'scanned_passport');
                 die('<script type="text/javascript">parent.$.fancybox.close(); parent.fnUpdateBoxTenant();</script>');
             }
         }
         $this->render('CreateTransaction/AgentAddTenant', array('model' => $model));
     } catch (Exception $exc) {
         throw new CHttpException(404, $exc->getMessage());
     }
 }
 public function actionAgentUpdateTenant($id)
 {
     try {
         $oldUser = false;
         $model = $this->loadModelVendorPurchaserDetail($id);
         $uidOld = $model->user_id;
         $model->scenario = 'AgentUpdateTenantFromTenancy';
         if (isset($_GET['from_transactions'])) {
             $model->scenario = 'AgentUpdateTenant';
         }
         if (isset($_GET['add_property']) && $_GET['add_property'] == ProTransactions::ADD_UNLISTED) {
             $model->scenario = 'AgentUpdateTenantUnlisted';
         }
         $oldscanned_employment_pass = $model->scanned_employment_pass;
         $oldscanned_passport = $model->scanned_passport;
         $cmsFormater = new CmsFormatter();
         $model->pass_expiry_date = $cmsFormater->formatDatePickerInput($model->pass_expiry_date);
         if (isset($_POST['ProTransactionsVendorPurchaserDetail'])) {
             $model->attributes = $_POST['ProTransactionsVendorPurchaserDetail'];
             $model->scanned_employment_pass = CUploadedFile::getInstance($model, 'scanned_employment_pass');
             $model->scanned_passport = CUploadedFile::getInstance($model, 'scanned_passport');
             $model->validate();
             if (!$model->hasErrors()) {
                 if ($model->user_id != $uidOld) {
                     $oldUser = true;
                 }
                 if (!is_null($model->scanned_employment_pass)) {
                     ProTransactionsVendorPurchaserDetail::deleteOldFile($model, 'scanned_employment_pass');
                     $model->scanned_employment_pass = ProTransactionsVendorPurchaserDetail::saveSomeFile($model, 'scanned_employment_pass');
 /**
  * @Author: ANH DUNG Apr 21, 2014
  * @Todo: save one record of tenant
  * @Param: $model model ProTransactionsVendorPurchaserDetail
  */
 public static function saveOneTenant($model, $is_default = 0, $needMore = array())
 {
     $model->type = Users::USER_TENANT;
     $model->is_default = $is_default;
     $model->pass_expiry_date = MyFormat::dateConverDmyToYmd($model->pass_expiry_date);
     $mUser = null;
     if (empty($model->user_id)) {
         $mUser = Users::saveUserVendorPurchaser($model, ROLE_TENANT);
         $model->user_id = $mUser->id;
         $model->is_new_user = 1;
     }
     if (isset($needMore['scenario_null'])) {
         $model->scenario = null;
     }
     $model->save();
     //add
     $FileInput = $_FILES["ProTransactionsVendorPurchaserDetail"]["name"]["scanned_employment_pass"];
     $FileInput2 = $_FILES["ProTransactionsVendorPurchaserDetail"]["name"]["scanned_passport"];
     if (!empty($FileInput)) {
         ProTransactionsVendorPurchaserDetail::saveSomeFile($model, 'scanned_employment_pass');
     }
     if (!empty($FileInput2)) {
         ProTransactionsVendorPurchaserDetail::saveSomeFile($model, 'scanned_passport');
     }
     //        if($mUser && $model->is_new_user && $model->id_type!= Users::ID_TYPE_CITIZENSHIP){
     if ($mUser && $model->is_new_user) {
         // save 2 file upload if have to table user
         Users::saveTwoFileOfTenant($mUser, $model);
     }
 }
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->voucher_no = MyFormat::getNextId('FiPaymentVoucher', 'PV', 'voucher_no', FiPaymentVoucher::LENGTH_TRANS_NO);
         $this->created_by = Yii::app()->user->id;
     }
     if (!empty($this->date_paid) && strpos($this->date_paid, '/')) {
         $this->date_paid = MyFormat::dateConverDmyToYmd($this->date_paid);
     }
     $this->total_amount = str_replace(',', '', trim($this->total_amount));
     return parent::beforeSave();
 }
Exemple #10
0
 /**
  * @Author: ANH DUNG Sep 19, 2014
  * @Todo: get summary report of transaction
  * @Param: $model model ProTransaction
  */
 public function SummaryReport()
 {
     if (empty($this->date_from)) {
         $this->date_from = date("d/m/Y");
     }
     if (empty($this->date_to)) {
         $this->date_to = date("d/m/Y");
     }
     $date_from = MyFormat::dateConverDmyToYmd($this->date_from) . " 00:00:00";
     $date_to = MyFormat::dateConverDmyToYmd($this->date_to) . " 23:59:59";
     $criteria = new CDbCriteria();
     $criteria->addBetweenCondition("t.created_date", $date_from, $date_to);
     $criteria->compare('t.admin_approved', 1);
     //        $criteria->addCondition('t.status > 0');
     $criteria->addInCondition('t.status', ProTransactions::$LIST_STATUS_REAL);
     // add on Now 28, 2014
     $criteria->order = "t.id DESC";
     $mTransTemp = new ProTransactions();
     $mTransTemp->date_from = $date_from;
     $mTransTemp->date_to = $date_to;
     // get Gross Commission to Company and pass to session
     ProTransactionsSaveCommission::ReportGetAllClientComm($mTransTemp);
     ProTransactionsSaveCommission::ReportGetAll1st2nd($mTransTemp);
     ProTransactionsSaveCommission::ReportGetAllCommCompany($mTransTemp);
     $_SESSION['DATA_SUMMARY_REPORT'] = new CActiveDataProvider('ProTransactions', array('pagination' => false, 'criteria' => $criteria));
     ProTransactionsSaveCommission::SumReportGetInfoExternalCoBroke($_SESSION['DATA_SUMMARY_REPORT']->data);
     return new CActiveDataProvider('ProTransactions', array('criteria' => $criteria, 'pagination' => array('pageSize' => 50)));
 }
Exemple #11
0
  * @Author: ANH DUNG Mar 13, 2014
  * @Todo: removeScriptTag
  */
 public static function removeScriptTag($string)
 {
     $CHtmlPurifier = new CHtmlPurifier();
     $CHtmlPurifier->options = array('HTML.ForbiddenElements' => array('script', 'style', 'applet'));
     $string = $CHtmlPurifier->purify($string);
     $scriptRemove = array("<script>", "</script>", "script", 'text/javascript');
     return str_replace($scriptRemove, "", $string);
 }
 /**
 * @Author: ANH DUNG Apr 11, 2014
Exemple #12
0
     $criteria->compare('t.role_id', $this->role_id);
     $criteria->compare('t.application_id', 1);
     $criteria->compare('t.status', $this->status);
     $criteria->compare('t.phone', $this->phone, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
 public function searchSubAdmin($criteria = NULL)
 {
     if ($criteria == NULL) {
         $criteria = new CDbCriteria();
     }
     $criteria->compare('t.username', $this->username, true);
     $criteria->compare('t.email', $this->email, true);
     $criteria->compare('t.first_name', $this->first_name, true);
Exemple #13
0
 protected function beforeSave()
 {
     if (!empty($this->approved_date) && strpos($this->approved_date, '/')) {
         $this->approved_date = MyFormat::dateConverDmyToYmd($this->approved_date);
     }
     return parent::beforeSave();
 }