コード例 #1
0
 public static function deleteByGlobalEnquiryId($enquiry_global_id)
 {
     $criteria = new CDbCriteria();
     $criteria->compare("t.enquiry_global_id", $enquiry_global_id);
     $models = self::model()->findAll($criteria);
     ProTransactions::deleteArrModel($models);
 }
コード例 #2
0
ファイル: TenantController.php プロジェクト: jasonhai/onehome
 /**
  * <Create By Jason>
  * <TO show list of tenancies detail in tenant user>
  */
 public function actionTenancies_Detail()
 {
     try {
         $this->pageTitle = 'Tenancies Details - ' . Yii::app()->params['title'];
         $this->layout = 'application.views.layouts.layout_user';
         if (!isset(Yii::app()->user->id)) {
             $this->redirect(Yii::app()->createAbsoluteUrl('/'));
         }
         if (!isset($_GET['transaction_id'])) {
             $_GET['transaction_id'] = 0;
         }
         //HTram add: to load call log by role users
         $role_id = '';
         if (isset(Yii::app()->user->id)) {
             $role_id = Yii::app()->user->roleid;
         }
         $calllog = ProCallLog::getListCallLog($_GET['transaction_id'], $role_id);
         //
         $document = ProTransactionsPropertyDocument::getListDocument($_GET['transaction_id']);
         $transaction = ProTransactions::getByPk($_GET['transaction_id']);
         $report = ProReportDefect::getListReport($_GET['transaction_id']);
         $landlordInformation = ProTransactionsVendorPurchaserDetail::getTenancyInformation($_GET['transaction_id'], TYPE_LANDLORD);
         $mAirconService = new ProAirconService();
         $mAirconService->transaction_id = $_GET['transaction_id'];
         MyFormat::CheckValidRequest($transaction);
         $this->render('tenancies_detail', array('report' => $report, 'transaction' => $transaction, 'document' => $document, 'calllog' => $calllog, 'landlordInformation' => $landlordInformation, 'mAirconService' => $mAirconService));
     } catch (Exception $exc) {
         throw new CHttpException('404', $exc->getMessage());
     }
 }
コード例 #3
0
ファイル: Listing.php プロジェクト: jasonhai/onehome
 /**
  * @Author: ANH DUNG Jan 22, 2015
  * @Todo: update id cua admin tao company listing vao id listing saleperson pick
  * @Param: column company_listing_user_created
  */
 public static function UpdateIdAdminCreateCompanylisting()
 {
     // 1. update table listing
     $criteria = new CDbCriteria();
     $criteria->addCondition('t.company_listing_id IS NOT NULL AND t.company_listing_id<>"" ');
     $models = Listing::model()->findAll($criteria);
     foreach ($models as $model) {
         $mCompanyListing = Listing::model()->findByPk($model->company_listing_id);
         if ($mCompanyListing) {
             $model->company_listing_user_created = $mCompanyListing->user_id;
             $model->update(array('company_listing_user_created'));
             // 2. update table transaction
             $c2 = new CDbCriteria();
             $c2->compare('listing_id', $model->id);
             ProTransactions::model()->updateAll(array('company_listing_user_created' => $model->company_listing_user_created), $c2);
         }
     }
 }
コード例 #4
0
 /**
  * @Author: ANH DUNG Feb 03, 2015
  * @Todo: update tenancy
  * @Param: $id
  * @sample link: /admin/tenancy/update/add_property/1/id/555/type/1/listing_id/0/user_id/266
  */
 public function actionUpdate($id)
 {
     try {
         $mTransactions = $this->loadModel($id);
         ProTransactions::CanUpdateTrans($mTransactions);
         if (isset($_GET['user_id'])) {
             // Jan 02, 2014 For backend
             //                $this->ValidateLinkRecord($add_property, $listing_id); // OPEN IT
             $add_property = isset($_GET['add_property']) ? $_GET['add_property'] : $mTransactions->add_property;
             //                ProTransactions::GetSomeInfoRecord($mTransactions, $add_property);
             ProTransactions::GetSomeInfoRecordWithNoOverideModel($mTransactions, $add_property);
             ProTransactions::HandlePost($mTransactions);
         }
         $this->render('update/record_existing_tenancy', array('mTransactions' => $mTransactions, 'actions' => $this->listActionsCanAccess));
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
コード例 #5
0
 public static function deleteByXXXXX($enquiry_global_id)
 {
     // chưa biết là delete theo cái nào
     $criteria = new CDbCriteria();
     $criteria->compare("t.enquiry_global_id", $enquiry_global_id);
     $models = self::model()->findAll($criteria);
     ProTransactions::deleteArrModel($models);
 }
コード例 #6
0
 public function OverideModel($model)
 {
     if (isset(Yii::app()->user->id)) {
         $cmsFormater = new CmsFormatter();
         $mUser = Users::model()->findByPk(Yii::app()->user->id);
         $model->fullname = $cmsFormater->formatFullNameRegisteredUsers($mUser);
         $model->nric = $mUser->nric_passportno_roc;
         $model->contact_no = $mUser->phone;
         $model->email = $mUser->email;
         if (Yii::app()->user->role_id == ROLE_LANDLORD || Yii::app()->user->role_id == ROLE_TENANT) {
             $model->contact_no = $mUser->contact_no;
             $model->email = $mUser->email_not_login;
         }
         if (Yii::app()->user->role_id == ROLE_AGENT) {
             $model->email = $mUser->email_not_login;
         }
     }
     $mTrans = ProTransactions::model()->findByPk($model->transaction_id);
     if (is_null($mTrans)) {
         return;
     }
     $mListing = Listing::model()->findByPk($mTrans->listing_id);
     if (is_null($mListing)) {
         return;
     }
     $model->property_name_or_address = $mListing->property_name_or_address;
     $model->unit_from = $mListing->unit_from;
     $model->unit_to = $mListing->unit_to;
     $model->postal_code = $mListing->postal_code;
     $model->location_id = $mListing->location_id;
     $model->property_type_id = $mListing->property_type_1;
     $model->tenure = $mListing->tenure;
     $model->floor_area = $mListing->floor_area;
     $model->of_bedroom_from = $mListing->of_bedroom;
     $model->of_bathrooms_from = $mListing->of_bathrooms;
 }
コード例 #7
0
ファイル: CmsFormatter.php プロジェクト: jasonhai/onehome
     }
 }
 /**
  * @param $value
  * @return bool|string
  * <Jason>
  * <Input Y-m-d H:i:s - d F Y / H:M hrs >
  */
 public function formatDateTimeReport($value)
 {
     if ($value == '0000-00-00' || $value == '0000-00-00 00:00:00' || is_null($value)) {
         return '';
     } else {
コード例 #8
0
ファイル: AgentController.php プロジェクト: jasonhai/onehome
 /**
  * @Author: ANH DUNG Feb 11, 2015
  * @Todo: delete tenancy
  * @Param: $id
  */
 public function actionDelete_tenancy($id)
 {
     try {
         if (Yii::app()->request->isPostRequest) {
             // we only allow deletion via POST request
             $model = MyFormat::loadModelByClass($id, 'ProTransactions');
             if ($model && ProTransactions::CanDeleteTenancy($model)) {
                 if ($model->delete()) {
                     Yii::log("Delete record " . print_r($model->attributes, true), 'info');
                 }
             }
             // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
             if (!isset($_GET['ajax'])) {
                 $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
             }
         } else {
             Yii::log("Invalid request. Please do not repeat this request again.");
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException(400, $e->getMessage());
     }
 }
コード例 #9
0
 /**
  * @Author: ANH DUNG Jul 16, 2014
  * @Todo: to gen receipt for transaction
  * @Param: $model model ProTransactionsInvoice::
  * @Param: $mTransaction
  */
 public static function DoGenReceipt($model, $mTransaction)
 {
     $prefix_code = self::getPrefix(ProTransactionsInvoice::TYPE_RECEIPT);
     $model->invoice_number = MyFormat::getNextId('ProTransactionsInvoice', $prefix_code, 'invoice_number', self::getLengthInvoiceNo());
     $model->invoice_type = ProTransactionsInvoice::TYPE_RECEIPT;
     $model->invoice_template = ProTransactionsInvoice::TEMPLATE_6_RECEIPT;
     $model->type = $mTransaction->type;
     $model->save();
     // *** 1. update status table transaction
     ProTransactions::UpdateStatusTrans($mTransaction->id, STATUS_GEN_RECEIPT);
     // *** 2. update status table save commission
     // 1. update cột status receipt qua table saveCommission để chạy thống kê
     // 2. update cột received_on
     ProTransactionsSaveCommission::UpdateStatusOfCommission($mTransaction, $model->receipt_date_paid, STATUS_GEN_RECEIPT);
 }
コード例 #10
0
 public function run($arg)
 {
     //        Yii::app()->setting->setDbItem('last_working', "xxxxxxxxxxxx");die;
     ProTransactions::CronSendMailTenancyExpiring();
 }
コード例 #11
0
 /**
  * @Author: ANH DUNG Feb 02 2015
  * @Todo: update old data  for change Feb 02, 2015 Receivable Gross Commission should be rental + 7% GST
  * ProTransactionsSaveCommission::Feb02UpdateOldData();
  */
 public static function Feb02UpdateOldData()
 {
     $AllTrans = ProTransactions::model()->findAll();
     foreach ($AllTrans as $mTransactions) {
         if ($mTransactions->type == ProTransactions::FOR_RENT) {
             $price = 0;
             $receivable_gross_commission = 0;
             self::ForRentCalcSomething($mTransactions, $price, $receivable_gross_commission);
             ProTransactionsSaveCommission::model()->updateAll(array('price' => $price, 'receivable_gross_commission' => $receivable_gross_commission), "`transactions_id`={$mTransactions->id}");
         }
     }
     echo count($AllTrans);
     die;
 }
コード例 #12
0
ファイル: ProTransactions.php プロジェクト: jasonhai/onehome
 public static function GetSomeInfoRecordWithNoOverideModel($mTransactions, $add_property)
 {
     $mTransactions->add_property = $add_property;
     $mTransactions->type = isset($_GET['type']) ? $_GET['type'] : ProTransactions::FOR_RENT;
     $mTransactions->listing_autocompelte = '';
     if (isset($_GET['listing_id']) && $_GET['listing_id']) {
         $mTransactions->listing_id = $_GET['listing_id'];
         $mTransactions->listing_autocompelte = $mTransactions->listing ? $mTransactions->listing->property_name_or_address : '';
     }
     $mTransactions->mPropertyDetail = $mTransactions->rPropertyDetail ? $mTransactions->rPropertyDetail : new ProTransactionsPropertyDetail();
     $mTransactions->aModelPropertyDocument = count($mTransactions->rPropertyDocument) ? $mTransactions->rPropertyDocument : ProTransactionsPropertyDocument::getDefaultArrayForCreate($mTransactions->type);
     $mTransactions->mTenatDefault = $mTransactions->rTenantDefault ? $mTransactions->rTenantDefault : new ProTransactionsVendorPurchaserDetail();
     $mTransactions->mLandlord = new ProTransactionsVendorPurchaserDetail();
     $mTransactions->mTenant = new ProTransactionsVendorPurchaserDetail();
     $mTransactions->mVendor = new ProTransactionsVendorPurchaserDetail();
     $mTransactions->mPurchaser = new ProTransactionsVendorPurchaserDetail();
     $mTransactions->mBillTo = new ProTransactionsBillTo();
     $mTransactions->mPropertyDetail->scenario = 'CreateTransactionTenancyOnly';
     $mTransactions->mTenatDefault->scenario = 'AgentAddTenantFromTenancy';
     $mTransactions->scenario = 'CreateTransactionForRentRecordTenancy_new';
     // for rent //CreateTransactionForRentRecordTenancy
     ProTransactions::copyFromListingToTransaction($mTransactions);
     ProTransactions::convertToUserDate($mTransactions);
     // Feb 02, 2015 , fix for update transaction
     $cAction = Yii::app()->controller->action->id;
     if ($cAction == 'update' && ProTransactions::IsTenancyTransaction($mTransactions)) {
         $mTransactions->mBillTo = $mTransactions->rBillTo ? $mTransactions->rBillTo : new ProTransactionsBillTo();
         $mTransactions->mBillTo->scenario = 'CreateVendorPurchaser';
     }
     // Feb 02, 2015 , fix for update transaction
 }
コード例 #13
0
 //save ProTransactionsPropertyDocument
 /*Closed by HTram, because it were uploaded by ajax at the form
 ProTransactionsPropertyDocument::saveRecord($mTransactions);
  * 
  */
 // 1. email to all new user trong table pro_pro_transactions_vendor_purchaser_detail
 // Fix Aug 08, 2014 hàm này đã move vào admin (ProTransactions::UpdateAdminStatus) khi admin approve trong backend thì mới send
 // Dec 01, 2014 Once tenancy is submitted, admin need to approve.
 //  Once admin approved, LL and Tenant account will automatically send an email with Login ID and Password (generated) to Tenant and LL.
 //                    ProTransactionsVendorPurchaserDetail::sendMailToNewUser($mTransactions->id, $mTransactions);
 //                    ProTransactionsVendorPurchaserDetail::updateRoleUserAfterCreateUpdateTransaction($mTransactions->id);
 // Fix Aug 08, 2014
 // 2. delete all table pro_pro_transactions_vendor_purchaser_detail với transactions_id ko có id nằm trong mảng submit lên
 // không xử lý kiểu này nữa, khi tạo tenant hoặc landlord ở dưới thì mặc định là tạo mới trên hệ thống rồi
 // logic này đúng
 $mTransactions = ProTransactions::LoadModelRelationByPk($mTransactions->id);
 //               Close Dec 01, 2014 ProTransactionsBillTo::UpdateBillTo($mTransactions);
 // Jun 16, 2014 đưa bill to lên trên save commission thì mới có đc rExternalCoBrokeCommission
 // chỗ này find lại model của transaction để lấy hết relation - single query
 //               Close Dec 01, 2014                $mTransactions = ProTransactions::LoadModelRelationByPk($mTransactions->id);
 //               Close Dec 01, 2014                ProTransactionsSaveCommission::saveOneTransaction($mTransactions);
 // đoạn này phải find lại model vì bên trên find có with thì
 // dữ liệu cập nhật ở hàm UpdateBillTo bên trên sẽ ko có trong model này => phải find lại
 // AutoGenInvoice
 //               Close Dec 01, 2014 ProTransactionsInvoice::AutoGenInvoice($mTransactions);
 //               Close Dec 01, 2014 Listing::SetStatusPastListing($mTransactions->listing_id);
 Yii::app()->user->setFlash('success', 'Your tenancy has been created successfully');
コード例 #14
0
ファイル: AdSidebar.php プロジェクト: jasonhai/onehome
<?php

$LinkLogout = Yii::app()->createAbsoluteUrl('site/logout');
$LinkSubmitTestimonial = Yii::app()->createAbsoluteUrl('member/member_profile/submitTestimonials');
$LinkEditAccount = '';
if (Yii::app()->user->role_id == ROLE_LANDLORD) {
    // for landlord
    $LinkEditAccount = Yii::app()->createAbsoluteUrl('member/landlord/myprofile');
    $ListOfTenancies = ProTransactions::getListTenanciesLandlord(array('limit' => ProTransactions::LIMIT_PROPERTIES));
    $LinkViewAllTenancies = Yii::app()->createAbsoluteUrl('member/landlord/property');
}
$ListOfProperties = ProEngageUs::getListEngage(array('limit' => ProTransactions::LIMIT_PROPERTIES));
$cmsFormater = new CmsFormatter();
if (Yii::app()->user->role_id == ROLE_TENANT) {
    $LinkEditAccount = Yii::app()->createAbsoluteUrl('member/tenant/myprofile');
    $ListOfTenancies = ProTransactions::getListTenancies(array('limit' => ProTransactions::LIMIT_PROPERTIES));
    $LinkViewAllTenancies = Yii::app()->createAbsoluteUrl('member/tenant/property');
}
$LinkMyshortlist = Yii::app()->createAbsoluteUrl('member/member_profile/myshortlist');
$LinkEngageus = Yii::app()->createAbsoluteUrl('member/member_profile/engageus');
?>

<!--  aside -->
<aside class="sidebar">
    <!-- box -->
    <div class="box-7">
            <div class="user-wrap clearfix">
<!--            <div class="image">
                <img src="img/user.jpg" alt="image" />
            </div>-->
            <div class="content" style="margin-left: 0;">
コード例 #15
0
ファイル: SiteController.php プロジェクト: jasonhai/onehome
 $returnUrl = '';
 if (isset($_GET['returnUrl'])) {
     $returnUrl = $_GET['returnUrl'];
 }
 // collect user input data
 if (isset($_POST['LoginForm'])) {
     $model->attributes = $_POST['LoginForm'];
     $model->nric = trim($model->nric);
コード例 #16
0
                <?php 
echo $form->error($model, 'postal_code');
?>
            </div>

            <div class="clearfix output">
                <a href="javascript:void(0)" class="btn-2 iframe_close">Cancel</a>
                <input type="submit" class="btn-3" value="Submit" />
            </div>

<?php 
$this->endWidget();
?>

<?php 
// Feb 03,2015 for calc gst at BE when update trans or tenancy
$sUidGst = 0;
if ($model->transactions_id) {
    $mTransactions = ProTransactions::model()->findByPk($model->transactions_id);
    $sUidGst = $mTransactions->user_id;
}
?>
        
        
<script>
    $(function(){
        $('.iframe_close').on('click', function(){
            parent.$.fancybox.close();
        });
    });
</script>
コード例 #17
0
<div class="box-5">
    <div class="title clearfix">
        <div class="f-left w-2 fixErrorSummary">
            <h4>Landlord’s Details</h4>
            <?php 
echo $form->errorSummary($mTransactions->mLandlord);
?>
        </div> 
        <?php 
if (ProTransactions::IsTenancyTransaction($mTransactions)) {
    ?>
            <a data-fancybox-type="iframe" href="<?php 
    echo Yii::app()->createAbsoluteUrl('ajax/agentAddLandlord', array('from_transactions' => 1, 'transactions_id' => $mTransactions->id));
    ?>
" class="btn-1 f-right AddVendorDetails">Add Landlord</a>
        <?php 
} else {
    ?>
            <a data-fancybox-type="iframe" href="<?php 
    echo Yii::app()->createAbsoluteUrl('ajax/agentAddLandlord', array('transactions_id' => $mTransactions->id));
    ?>
" class="btn-1 f-right AddVendorDetails">Add Landlord</a>
        <?php 
}
// end if(isset($_GET['add_property'])
?>
        
    </div>

    <div class="content table_scroll padding_0 ">    
        <?php 
コード例 #18
0
ファイル: print_invoice.php プロジェクト: jasonhai/onehome
//	array('label'=>$headText, 'url'=>array($headLink)),
//);
$this->menu = array(array('label' => $headText, 'url' => $headLinkBreck));
$cmsFormater = new CmsFormatter();
$mBillTo = $mTransactions->rBillTo;
$mTransPropertyDetail = $mTransactions->rPropertyDetail;
$text1 = "Being co-broke commission due to us for services rendered in connection with the lease of the above-mentioned property.";
$InvoiceNumber = $model->invoice_number;
$InvoiceDate = $cmsFormater->formatDate($mTransactions->created_date);
//$Property = Listing::getViewDetailPropertyType($mTransactions->rListing);
// 9
//$PropertyName = $mTransactions->rPropertyDetail->rPropertyType?$mTransactions->rPropertyDetail->rPropertyType->name:'';
// hình như ko dùng cái $PropertyName bên trên
$PropertyName = ProTransactionsInvoice::getPropertyName($model) . " " . $mTransPropertyDetail->unit_no;
$LanlordName = ProTransactions::getInvoiceLanlordName($mTransactions);
$TenantName = ProTransactions::getInvoiceTenantName($mTransactions);
$TransactionNo = $mTransactions->transactions_no;
// 8
$ClientType = ProTransactions::$aClientSaleDetail[$mTransactions->client_type_id];
// 10
/** Oct 02, 2014 xu ly cho bill to solicitor is selected - hien tai moi lam invoice normal template 1 */
$VendorsName = '';
$SolicitorName = "";
$SolicitorAddress = '';
if ($mTransactions->invoice_bill_to == ProTransactions::BILL_TO_SOLICITOR) {
    $VendorsName = ProTransactionsVendorPurchaserDetail::getVendorNameForSolicitor($mTransactions);
    $SolicitorAddress = $mBillTo->billing_address;
    $SolicitorName = $mBillTo->attn_to;
}
/** Oct 02, 2014 xu ly cho bill to solicitor is selected - hien tai moi lam invoice normal template 1 */
// invoice normal