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();
     }
 }