/**
  * Lists all models.
  */
 public function actionIndex()
 {
     parent::actionIndex();
     $deliveryadvicedetail = new Deliveryadvicedetail('search');
     $deliveryadvicedetail->unsetAttributes();
     // clear any default values
     if (isset($_GET['Deliveryadvicedetail'])) {
         $deliveryadvicedetail->attributes = $_GET['Deliveryadvicedetail'];
     }
     $product = new Product('search');
     $product->unsetAttributes();
     // clear any default values
     if (isset($_GET['Product'])) {
         $product->attributes = $_GET['Product'];
     }
     $unitofmeasure = new Unitofmeasure('search');
     $unitofmeasure->unsetAttributes();
     // clear any default values
     if (isset($_GET['Unitofmeasure'])) {
         $unitofmeasure->attributes = $_GET['Unitofmeasure'];
     }
     $sloc = new Sloc('search');
     $sloc->unsetAttributes();
     // clear any default values
     if (isset($_GET['Sloc'])) {
         $sloc->attributes = $_GET['Sloc'];
     }
     $requestedby = new Requestedby('search');
     $requestedby->unsetAttributes();
     // clear any default values
     if (isset($_GET['Requestedby'])) {
         $requestedby->attributes = $_GET['Requestedby'];
     }
     $model = new Deliveryadvice('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Deliveryadvice'])) {
         $model->attributes = $_GET['Deliveryadvice'];
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
         unset($_GET['pageSize']);
         // would interfere with pager and repetitive page size change
     }
     $this->render('index', array('model' => $model, 'deliveryadvicedetail' => $deliveryadvicedetail, 'product' => $product, 'unitofmeasure' => $unitofmeasure, 'sloc' => $sloc, 'requestedby' => $requestedby));
 }
 public function actionGeneratedetail1()
 {
     if (isset($_POST['id'])) {
         $delv = Deliveryadvice::model()->findbypk($_POST['id']);
         $header;
         if ($delv != null) {
             $header = $delv->headernote;
         }
         $connection = Yii::app()->db;
         $transaction = $connection->beginTransaction();
         try {
             $sql = 'call GeneratePRDA(:vid, :vhid)';
             $command = $connection->createCommand($sql);
             $command->bindvalue(':vid', $_POST['id'], PDO::PARAM_INT);
             $command->bindvalue(':vhid', $_POST['hid'], PDO::PARAM_INT);
             $command->execute();
             $transaction->commit();
             if (Yii::app()->request->isAjaxRequest) {
                 echo CJSON::encode(array('status' => 'success', 'headernote' => $header, 'div' => "Data generated"));
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             if (Yii::app()->request->isAjaxRequest) {
                 echo CJSON::encode(array('status' => 'failure', 'div' => $e->getMessage()));
             }
         }
     }
     Yii::app()->end();
 }
Ejemplo n.º 3
0
		<?php 
echo $form->error($model, 'headernote');
?>
	</div>
		</td>
        
        <td>
           <div class="row">
		<?php 
echo $form->labelEx($model, 'deliveryadviceid');
echo $form->hiddenField($model, 'deliveryadviceid');
?>
        <input type="text" name="dano" id="dano" readonly >
    <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'da_dialog', 'options' => array('title' => Yii::t('app', 'Request Form'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$deliveryadvice = new Deliveryadvice('searchwfstatus');
$deliveryadvice->unsetAttributes();
// clear any default values
if (isset($_GET['Deliveryadvice'])) {
    $deliveryadvice->attributes = $_GET['Deliveryadvice'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'da-grid', 'dataProvider' => $deliveryadvice->searchwfstatus(), 'filter' => $deliveryadvice, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
          array("name" => "send_absschedule",
          "id" => "send_absschedule",
          "onClick" => "$(\\"#da_dialog\\").dialog(\\"close\\"); $(\\"#dano\\").val(\\"$data->dano\\");
          $(\\"#Prheader_deliveryadviceid\\").val(\\"$data->deliveryadviceid\\");
                generatedata2();
		  "))'), array('name' => 'deliveryadviceid', 'visible' => false, 'value' => '$data->deliveryadviceid'), 'dano', 'headernote', array('name' => 'dadate', 'type' => 'raw', 'value' => 'date(Yii::app()->params["dateviewfromdb"], strtotime($data->dadate))'), array('name' => 'useraccessid', 'value' => '($data->useraccess!==null)?$data->useraccess->username:""'))));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("da-grid");$("#da_dialog").dialog("open"); return false;'));
?>
 /**
  * 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 = Deliveryadvice::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }