/**
  * Lists all models.
  */
 public function actionIndex()
 {
     parent::actionIndex();
     $grdetail = new Grdetail('search');
     $grdetail->unsetAttributes();
     // clear any default values
     if (isset($_GET['Grdetail'])) {
         $grdetail->attributes = $_GET['Grdetail'];
     }
     $poheader = new Poheader('search');
     $poheader->unsetAttributes();
     // clear any default values
     if (isset($_GET['Poheader'])) {
         $poheader->attributes = $_GET['Poheader'];
     }
     $model = new Grheader('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Grheader'])) {
         $model->attributes = $_GET['Grheader'];
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
         unset($_GET['pageSize']);
         // would interfere with pager and repetitive page size change
     }
     $this->render('index', array('model' => $model, 'poheader' => $poheader, 'grdetail' => $grdetail));
 }
 public function loadModeldetail($id)
 {
     $model = Grdetail::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionGeneratedata()
 {
     if (isset($_POST['id'])) {
         $podetail = Grdetail::model()->findbypk($_POST['id']);
         echo CJSON::encode(array('status' => 'success', 'grno' => $podetail->grheader !== null ? $podetail->grheader->grno : "", 'productid' => $podetail->productid, 'productname' => $podetail->product !== null ? $podetail->product->productname : "", 'slocid' => $podetail->slocid, 'slocdesc' => $podetail->sloc !== null ? $podetail->sloc->description : "", 'buyprice' => $podetail->podetail !== null ? $podetail->podetail->netprice : "", 'buydate' => $podetail->grheader->grdate, 'currencyid' => $podetail->podetail !== null ? $podetail->podetail->currency->currencyid : "", 'currencyname' => $podetail->podetail !== null ? $podetail->podetail->currency->currencyname : "", 'qty' => "1", 'unitofmeasureid' => $podetail->unitofmeasureid, 'uomcode' => $podetail->unitofmeasure !== null ? $podetail->unitofmeasure->uomcode : ""));
         Yii::app()->end();
     }
 }