public static function getLatestSewadarSerialNumber() { $criteria = new CDbCriteria(); $criteria->select = 'max(serial_no) as serial_no'; $data = Sewadars::model()->find($criteria); return (int) $data->serial_no + 1; }
public function actionCreateList($term, $roll_id) { $query = Sewadars::model()->findAll('sewadar_name LIKE :match', array(':match' => "{$term}%")); $list = array(); foreach ($query as $q) { $data['value'] = $q['sewadar_id']; $data['label'] = $q['sewadar_name'] . " | F/D/S/W : " . $q['father_dauther_son_wife_of'] . " | Address : " . $q['address1'] . " " . $q['address2'] . " " . $q['address3']; $data['name'] = $q['sewadar_name']; $data['href'] = Yii::app()->createUrl('nominalRoll/addSingleData', array('nominal_roll_id' => $roll_id, 'user_id' => $q['sewadar_id'])); $list[] = $data; unset($data); } echo json_encode($list); }
<th align="center" >S. No.</th> <th >Name of<br /> Sewadar/Sewadarni</th> <th>Father/Husband Name</th> <th >Sex</th> <th>Age</th> <th>Center<br /> Token No.</th> <th >Address</th> <th>Contact No.</th> <?php $counter = 2; foreach ($NominalRollDetail as $list) { $data = Sewadars::model()->findByPk($list->sewadar_id); $datetime1 = new DateTime($data->date_of_birth); $datetime2 = new DateTime(date('Y-m-d')); $interval = $datetime1->diff($datetime2); $age = $interval->format('%y'); ?> <tr> <td align="center"><?php echo $counter; ?> </td> <td align="left"> <?php echo $data->sewadar_name; ?> </td> <td align="left"> <?php
/** * 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 = Sewadars::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }