public function actionTest()
 {
     $data = array();
     $paid_amt = JaheratAvakTable::model()->findAll(array('condition' => 'bill_no_of_jaharat="' . $_REQUEST['JaheratAvakTable']['bill_no_of_jaharat'] . '"'));
     $data = Jaharat::model()->findByAttributes(array('jaharat_biil_no' => $_REQUEST['JaheratAvakTable']['bill_no_of_jaharat']));
     $paid_amount = 0;
     if ($paid_amt) {
         foreach ($paid_amt as $p) {
             $paid_amount += $p['amount'];
         }
     } else {
         $paid_amount = 0;
     }
     if ($data) {
         $name = PartyMaster::model()->findByPk($data['party_no'])->party_name;
         $bill_date = $data->jaharat_bill_date;
         $net_amount = $data->jaharat_net_amount - $paid_amount;
     } else {
         $net_amount = '';
     }
     if ($data['jaharat_net_amount'] == $paid_amount) {
         $net_amount = 'No Unpaid Amount';
     }
     echo CJSON::encode(array('unpaid_amt' => $net_amount, 'paid_amt' => $paid_amount, 'bdate' => $bill_date, 'pname' => $data['party_no'] . " " . $name));
 }
 /**
  * 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 = PartyMaster::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }