public function actionIndex() { $model = new fReport(); if (isset($_POST['fReport'])) { $model->attributes = $_POST['fReport']; if ($model->validate()) { $modelReport = tAccountReport::model()->findByPk((int) $model->report_id); $pdf = new $modelReport->link('P', 'mm', 'A4'); //$pdf=new profitlost1('P','mm','A4'); //$pdf=new balanceSheet1('P','mm','A4'); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 12); $pdf->report($model->periode_date, $model->report_id); $pdf->Output(); } } $this->render('index', array('model' => $model)); }
<?php $this->breadcrumbs = array('Financial Statement' => array('index'), 'index'); ?> <div class="page-header"> <h1><?php echo CHtml::image(Yii::app()->request->baseUrl . '/images/icon/report.png'); ?> Financial Statement</h1> </div> <?php $this->widget('bootstrap.widgets.BootGridView', array('id' => 't-account-report-grid', 'dataProvider' => tAccountReport::model()->search(), 'itemsCssClass' => 'table table-striped table-bordered', 'template' => '{items}{pager}', 'columns' => array(array('class' => 'CButtonColumn', 'template' => '{report}', 'buttons' => array('report' => array('label' => '<i class="icon-print"></i> Report', 'url' => 'Yii::app()->createUrl($data->link)'))), 'title', 'description'))); ?> <br />
<?php echo $form->errorSummary($model); ?> <div class="control-group"> <?php echo $form->labelEx($model, 'periode_date', array('class' => 'control-label')); ?> <div class="controls"> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'value' => CTimestamp::formatDate('yyyy-MM-dd', $model->periode_date), 'attribute' => 'periode_date', 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yymm'), 'htmlOptions' => array())); ?> </div> </div> <?php echo $form->dropDownListRow($model, 'report_id', tAccountReport::accountReportList()); ?> <div class="form-actions"> <?php echo CHtml::htmlButton('<i class="icon-print"></i> Report', array('class' => 'btn', 'type' => 'submit')); ?> </div> <?php $this->endWidget(); ?>