$this->widget('CMaskedTextField', array('mask' => '99:99', 'model' => $model, 'attribute' => 'difftimeout', 'htmlOptions' => array('style' => 'height:20px', 'size' => '5')));
?>
		<?php 
echo $form->error($model, 'difftimeout');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'absstatusid');
?>
    <?php 
echo $form->hiddenField($model, 'absstatusid');
?>
    <input type="text" name="stat_name" id="stat_name" readonly value="<?php 
echo Absstatus::model()->findByPk($model->absstatusid) !== null ? Absstatus::model()->findByPk($model->absstatusid)->shortstat : '';
?>
">
    <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'absstatus_dialog', 'options' => array('title' => Yii::t('app', 'Absence Status'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$this->widget('zii.widgets.grid.CGridView', array('id' => 'absstatus-grid', 'dataProvider' => $absstatus->searchwstatus(), 'filter' => $absstatus, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
          array("name" => "send_absstatus",
          "id" => "send_absstatus",
          "onClick" => "$(\\"#absstatus_dialog\\").dialog(\\"close\\"); $(\\"#stat_name\\").val(\\"$data->shortstat\\"); $(\\"#Absrule_absstatusid\\").val(\\"$data->absstatusid\\");"))'), array('name' => 'absstatusid', 'visible' => false, 'value' => '$data->absstatusid', 'htmlOptions' => array('width' => '1%')), 'shortstat', 'longstat', array('class' => 'CCheckBoxColumn', 'name' => 'isin', 'header' => 'Is In', 'checked' => '$data->isin', 'selectableRows' => '0'), 'priority', array('class' => 'CCheckBoxColumn', 'name' => 'recordstatus', 'selectableRows' => '0', 'header' => 'Record Status', 'checked' => '$data->recordstatus'))));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#absstatus_dialog").dialog("open"); return false;'));
?>
		<?php 
echo $form->error($model, 'absstatusid');
?>
	</div>
 /**
  * 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 = Absstatus::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionDownload()
 {
     parent::actionDownload();
     $pdf = new PDF();
     $pdf->title = 'Absence Schedule List';
     $pdf->AddPage('L');
     $pdf->setFont('Arial', 'B', 12);
     // definisi font
     $pdf->setFont('Arial', 'B', 8);
     // menuliskan tabel
     $header = array('No', 'ID', 'Schedule Name', 'Absence In', 'Absence Out', 'Status', 'Wage Name', 'Currency', 'Insentif');
     $model = new Absschedule('searchwstatus');
     $dataprovider = $model->searchwstatus();
     $dataprovider->pagination = false;
     $data = $dataprovider->getData();
     $cols = $dataprovider->getKeys();
     $dataku = array(count($data));
     //var_dump($dataku);
     $w = array(20, 25, 30, 30, 30, 30, 30, 30, 30);
     $pdf->SetTableHeader();
     //Header
     for ($i = 0; $i < count($header); $i++) {
         $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true);
     }
     $pdf->Ln();
     $pdf->SetTableData();
     //Data
     $fill = false;
     foreach ($data as $n => $datas) {
         $pdf->Cell($w[0], 6, $n, 'LR', 0, 'C', $fill);
         $pdf->Cell($w[1], 6, $datas['absscheduleid'], 'LR', 0, 'C', $fill);
         $pdf->Cell($w[2], 6, $datas['absschedulename'], 'LR', 0, 'C', $fill);
         $pdf->Cell($w[3], 6, $datas['absin'], 'LR', 0, 'C', $fill);
         $pdf->Cell($w[4], 6, $datas['absout'], 'LR', 0, 'C', $fill);
         $pdf->Cell($w[5], 6, Absstatus::model()->findByPk($datas['absstatusid'])->shortstat, 'LR', 0, 'C', $fill);
         $pdf->Cell($w[6], 6, Wagetype::model()->findByPk($datas['wagetypeid'])->wagename, 'LR', 0, 'C', $fill);
         $pdf->Cell($w[7], 6, Currency::model()->findByPk($datas['currencyid'])->currencyname, 'LR', 0, 'C', $fill);
         $pdf->Cell($w[8], 6, number_format($datas['insentif']), 'LR', 0, 'C', $fill);
         $pdf->Ln();
         $fill = !$fill;
     }
     $pdf->Cell(array_sum($w), 0, '', 'T');
     // me-render ke browser
     $pdf->Output();
 }
 public function actionDownload()
 {
     parent::actionDownload();
     $pdf = new PDF();
     $pdf->title = 'Absence Status List';
     $pdf->AddPage('P');
     $pdf->setFont('Arial', 'B', 12);
     // definisi font
     $pdf->setFont('Arial', 'B', 8);
     // menuliskan tabel
     $header = array('No', 'ID', 'Short Status', 'Long Status', 'Priority');
     $model = new Absstatus('searchwstatus');
     $dataprovider = $model->searchwstatus();
     $dataprovider->pagination = false;
     $data = $dataprovider->getData();
     $cols = $dataprovider->getKeys();
     $dataku = array(count($data));
     //var_dump($dataku);
     $w = array(20, 25, 30, 40, 50);
     $pdf->SetTableHeader();
     //Header
     for ($i = 0; $i < count($header); $i++) {
         $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true);
     }
     $pdf->Ln();
     $pdf->SetTableData();
     //Data
     $fill = false;
     $i = 0;
     foreach ($data as $datas) {
         $i = $i + 1;
         $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill);
         $pdf->Cell($w[1], 6, $datas['absstatusid'], 'LR', 0, 'L', $fill);
         $pdf->Cell($w[2], 6, $datas['shortstat'], 'LR', 0, 'C', $fill);
         $pdf->Cell($w[3], 6, $datas['longstat'], 'LR', 0, 'L', $fill);
         $pdf->Cell($w[4], 6, $datas['priority'], 'LR', 0, 'C', $fill);
         $pdf->Ln();
         $fill = !$fill;
     }
     $pdf->Cell(array_sum($w), 0, '', 'T');
     // me-render ke browser
     $pdf->Output('absencestatus.pdf', 'D');
 }
 public function actionUpload()
 {
     parent::actionUpload();
     $folder = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/upload/';
     // folder for uploaded files
     $file = $folder . basename($_FILES['uploadfile']['name']);
     if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
         $row = 0;
         if (($handle = fopen($file, "r")) !== FALSE) {
             while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                 if ($row > 0) {
                     $model = Employeetype::model()->findByPk((int) $data[0]);
                     if ($model === null) {
                         $model = new Employeetype();
                     }
                     $model->employeetypeid = (int) $data[0];
                     $model->employeetypename = $data[1];
                     $snro = Snro::model()->findbyattributes(array('description' => $data[2]));
                     if ($snro != null) {
                         $model->snroid = $snro->snroid;
                     }
                     $snro = Snro::model()->findbyattributes(array('description' => $data[3]));
                     if ($snro != null) {
                         $model->sicksnroid = $snro->snroid;
                     }
                     $snro = Absstatus::model()->findbyattributes(array('shortstat' => $data[4]));
                     if ($snro != null) {
                         $model->sickstatusid = $snro->absstatusid;
                     }
                     $model->recordstatus = (int) $data[5];
                     try {
                         if (!$model->save()) {
                             $this->messages = $this->messages . Catalogsys::model()->getcatalog(' upload error at ' . $data[0]);
                         }
                     } catch (Exception $e) {
                         $this->messages = $this->messages . $e->getMessage();
                     }
                 }
                 $row++;
             }
         } else {
             $this->messages = $this->messages . ' memory or harddisk full';
         }
         fclose($handle);
     } else {
         $this->messages = $this->messages . ' check your directory permission';
     }
     if ($this->messages == '') {
         $this->messages = 'success';
     }
     echo $this->messages;
 }