protected function loadCSModel($id)
 {
     $model = RateCompanyService::model()->findByPk($id);
     if (!$model) {
         $this->thrown;
     }
     return $model;
 }
 /**
  * Return all incomplete JNE orders
  * 
  * @return Shipment[]
  */
 private function getAllJneIncompleteOrders()
 {
     $jne_service_ids = RateCompanyService::getJNEServiceId();
     $criteria = new CDbCriteria();
     $criteria->params = array(':status_POD' => ShipmentStatus::POD);
     $criteria->condition = 'shipping_status != :status_POD AND carrier_awb !=""';
     $criteria->addInCondition('service_id', $jne_service_ids);
     return Shipment::model()->findAll($criteria);
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = RateCompanyService::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #4
0
<div class="form">
	<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'FRatePrice-Form', 'enableClientValidation' => true, 'enableAjaxValidation' => true));
?>

	<h4 class="ui-box-header ui-corner-all">Rate Price</h4>

	<div class="row"><?php 
echo $form->label($model, 'companyService');
?>
</div>
	<div class="row"><?php 
echo $form->dropDownList($model, 'companyService', CHtml::listData(RateCompanyService::model()->findAll(), 'id', 'name', 'company.name'), array('prompt' => '-- Choose Service --'));
?>
    <div class="row"><?php 
echo $form->error($model, 'companyService');
?>
</div>
	</div>

	<div class="row"><?php 
echo $form->label($model, 'origin');
?>
</div>
	<div class="row"><?php 
echo $form->dropDownList($model, 'origin', CHtml::listData(Origins::model()->findAll(), 'id', 'name'), array('prompt' => '-- Choose Origin --'));
?>
	</div>
	<div class="row"><?php 
echo $form->error($model, 'origin');
?>
 public function actionGetExtAvailableProduct()
 {
     if (Yii::app()->request->isAjaxRequest) {
         if (isset($_POST['company_id'])) {
             $result = array('status' => 'error', 'data' => '');
             $data = array();
             $product_service = RateCompanyService::model()->findByAttributes(array('company_id' => $_POST['company_id']));
             if ($product_service instanceof RateCompanyService) {
                 $data['service_type'] = $product_service->productService->product->name;
                 $result['status'] = 'success';
                 $result['data'] = $data;
             }
             echo CJSON::encode($result);
             Yii::app()->end();
         }
     }
 }
 public static function getAvailableService($company_service_id)
 {
     $inCondition = array();
     $serviceCompany = RateCompanyService::model()->findByPk($company_service_id);
     if ($serviceCompany->rateCompany->is_city) {
         array_push($inCondition, self::ProductCityCourier);
     }
     if ($serviceCompany->rateCompany->is_domestic) {
         array_push($inCondition, self::ProductDomestic);
     }
     if ($serviceCompany->rateCompany->is_international) {
         array_push($inCondition, self::ProductInternational);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('product_id', $inCondition);
     return ProductService::model()->findAll($criteria);
 }