/**
  * 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 = Purchasingorg::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 = 'Purchasing Group List';
     $pdf->AddPage('P');
     $pdf->setFont('Arial', 'B', 12);
     // definisi font
     $pdf->setFont('Arial', 'B', 8);
     // menuliskan tabel
     $header = array('No', 'ID', 'Purchasing Organization', 'Purchasing Group Code', 'Description');
     $model = new Purchasinggroup('searchwstatus');
     $dataprovider = $model->searchwstatus();
     $dataprovider->pagination = false;
     $data = $dataprovider->getData();
     $cols = $dataprovider->getKeys();
     $dataku = array(count($data));
     //var_dump($dataku);
     $w = array(10, 15, 50, 40, 70);
     $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['purchasinggroupid'], 'LR', 0, 'L', $fill);
         $pdf->Cell($w[2], 6, Purchasingorg::model()->findbypk($datas['purchasingorgid'])->purchasingorgcode, 'LR', 0, 'L', $fill);
         $pdf->Cell($w[3], 6, $datas['purchasinggroupcode'], 'LR', 0, 'L', $fill);
         $pdf->Cell($w[4], 6, $datas['description'], 'LR', 0, 'L', $fill);
         $pdf->Ln();
         $fill = !$fill;
     }
     $pdf->Cell(array_sum($w), 0, '', 'T');
     // me-render ke browser
     $pdf->Output('purchasinggroup.pdf', 'D');
 }
Ejemplo n.º 3
0
?>
      <div id="toolbarform">
<?php 
$this->widget('ToolbarButton', array('isSave' => true, 'UrlSave' => 'purchasinggroup/write', 'isCancel' => true, 'UrlCancel' => 'purchasinggroup/cancelwrite'));
?>
</div> 
<?php 
echo $form->hiddenField($model, 'purchasinggroupid');
?>
	<div class="row">
		<?php 
echo $form->labelEx($model, 'purchasingorgid');
echo $form->hiddenField($model, 'purchasingorgid');
?>
	  <input type="text" name="purchasingorgcode" id="purchasingorgcode" readonly value="<?php 
echo Purchasingorg::model()->findByPk($model->purchasingorgid) !== null ? Purchasingorg::model()->findByPk($model->purchasingorgid)->purchasingorgcode : '';
?>
">
    <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'purchasingorg_dialog', 'options' => array('title' => Yii::t('app', 'Purchasing Organization'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$this->widget('zii.widgets.grid.CGridView', array('id' => 'absschedule-grid', 'dataProvider' => $purchasingorg->Searchwstatus(), 'filter' => $purchasingorg, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
          array("name" => "send_absschedule",
          "id" => "send_absschedule",
          "onClick" => "$(\\"#purchasingorg_dialog\\").dialog(\\"close\\"); $(\\"#purchasingorgcode\\").val(\\"$data->purchasingorgcode\\"); $(\\"#Purchasinggroup_purchasingorgid\\").val(\\"$data->purchasingorgid\\");
		  "))'), array('name' => 'purchasingorgid', 'visible' => false, 'value' => '$data->purchasingorgid', 'htmlOptions' => array('width' => '1%')), 'purchasingorgcode', 'description')));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#purchasingorg_dialog").dialog("open"); return false;'));
?>
		<?php 
echo $form->error($model, 'purchasingorgid');
?>