예제 #1
0
 /**
  *
  * @param <type> $id
  */
 public function actionHtml($id)
 {
     if (!is_numeric($id)) {
         throw new CHttpException(400, 'Неверный идентификатор счёта.');
     }
     $data['invoice_fkt'] = $this->loadModel($id);
     if (!is_array($works_pos = Works::model()->worksByOrder($data['invoice_fkt']->order_id, $data['invoice_fkt']->act_id))) {
         Yii::app()->user->setFlash('error', 'Список работ для счёта #' . $data['invoice_fkt']->id . ' пуст');
         $this->redirect(array('view', 'id' => $data['invoice_fkt']->id));
     } else {
         $data['works'] = $works_pos;
     }
     if (is_null($data['client'] = Clients::model()->findByPk($data['invoice_fkt']->client_id))) {
         Yii::app()->user->setFlash('error', 'Данные клиента для счёта #' . $data['invoice_fkt']->id . ' пусты');
         $this->redirect(array('view', 'id' => $data['invoice_fkt']->id));
     }
     if (!is_array($data['settings'] = Config::model()->get_settings())) {
         Yii::app()->user->setFlash('error', 'Основные параметры для счёта #' . $data['invoice_fkt']->id . ' пусты');
         $this->redirect(array('view', 'id' => $data['invoice_fkt']->id));
     }
     $data['body'] = $this->_tmpl_body($data, InvoicesFktTmpl::model()->findByPk($data['invoice_fkt']->template_id));
     $this->layout = false;
     $this->render('html', array('data' => $data));
 }
예제 #2
0
 /**
  * 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 = InvoicesFktTmpl::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #3
0
파일: _form.php 프로젝트: ASDAFF/its-crm
    ?>
		<?php 
    echo $form->dropDownList($model, 'act_id', Acts::model()->listData($model->order_id));
    ?>
	</div>

	<?php 
}
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'template_id');
?>
		<?php 
echo $form->dropDownList($model, 'template_id', CHtml::listData(InvoicesFktTmpl::model()->findAll(), 'id', 'name'));
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'date');
$this->widget('zii.widgets.jui.CJuiDatePicker', array('attribute' => 'date', 'model' => $model, 'value' => $model->date, 'language' => 'ru', 'options' => array('showAnim' => 'fold', 'changeYear' => true, 'changeMonth' => true, 'dateFormat' => 'yy-mm-dd')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'sum');
?>
		<?php