Example #1
0
<div class="form">

	<div class="row">	 
	<label>Transaction Type</label>
	<?php 
echo CHtml::dropDownList('transaction_type', '', CHtml::listData(TransactionType::model()->findAll(), 'id', 'type'), array('empty' => '-- select transcation type --'));
?>
	</div>
	<div class="row">
	<label>Component Name</label>
	<?php 
$this->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => new Components(), 'attribute' => 'component_name', 'sourceUrl' => array('/transactions/componentstransaction/cekcomponents'), 'options' => array('minLength' => '1', 'search' => 'js:function(event, ui){
                        $(\'#hospital_id\').val(-1);
                       }', 'select' => 'js:function(event, ui){
                        	document.getElementById(\'keterangan\').innerHTML = \'Code : \'+ui.item.code;
                        	document.getElementById(\'component_id\').value = ui.item.id;
                        }'), 'htmlOptions' => array('style' => 'height:25px;width:200px;padding:0px 5px;', 'class' => 'mf'), 'htmlOptions' => array('style' => 'width:50%;')));
?>
		<input type="hidden" name="component_id" id="component_id">
		</div>
	
	<div class="row">
	<b id="keterangan">
	</b></div>	
	
	<div class="row">	 
		<label>From Warehouse</label>
		<?php 
echo CHtml::dropDownList('warehouse_from', '', CHtml::listData(Warehouse::model()->findAll(), 'id', 'name_warehouse'), array('empty' => '-- select warehouse --'));
?>
	</div>
Example #2
0
<?php

/***********************************************************************************
 * The contents of this file are subject to the Mozilla Public License Version 2.0
 * ("License"); You may not use this file except in compliance with the Mozilla Public License Version 2.0
 * The Original Code is:  Linet 3.0 Open Source
 * The Initial Developer of the Original Code is Adam Ben Hur.
 * All portions are Copyright (C) Adam Ben Hur.
 * All Rights Reserved.
 ************************************************************************************/
$dateisOn = $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'Transactions[from_date]', 'language' => substr(Yii::app()->language, 0, 2), 'value' => $model->from_date, 'options' => array('showAnim' => 'fold', 'dateFormat' => Yii::app()->locale->getDateFormat('short'), 'changeMonth' => 'true', 'changeYear' => 'true', 'constrainInput' => 'false'), 'htmlOptions' => array('placeholder' => Yii::t('app', 'From Date'))), true) . $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'Transactions[to_date]', 'language' => substr(Yii::app()->language, 0, 2), 'value' => $model->to_date, 'options' => array('showAnim' => 'fold', 'dateFormat' => Yii::app()->locale->getDateFormat('short'), 'changeMonth' => 'true', 'changeYear' => 'true', 'constrainInput' => 'false'), 'htmlOptions' => array('placeholder' => Yii::t('app', 'To Date'))), true);
$this->beginWidget('MiniForm', array('header' => Yii::t('app', "Transactions")));
$yiidbdatetime = Yii::app()->locale->getDateFormat('yiidbdatetime');
$phpdatetime = Yii::app()->locale->getDateFormat('phpdatetime');
$this->widget('EExcelView', array('id' => 'transactions-grid', 'dataProvider' => $model->search(), 'ajaxUpdate' => true, 'ajaxType' => 'POST', 'afterAjaxUpdate' => "function() {\n\t\t\t\t\t\tjQuery('#Transactions_from_date').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['" . substr(Yii::app()->language, 0, 2) . "'], {'showAnim':'fold','dateFormat':'" . Yii::app()->locale->getDateFormat('short') . "','changeMonth':'true','showButtonPanel':'true','changeYear':'true','constrainInput':'false'}));\n\t\t\t\t\t\tjQuery('#Transactions_to_date').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['" . substr(Yii::app()->language, 0, 2) . "'], {'showAnim':'fold','dateFormat':'" . Yii::app()->locale->getDateFormat('short') . "','changeMonth':'true','showButtonPanel':'true','changeYear':'true','constrainInput':'false'}));\n                                }", 'filter' => $model, 'columns' => array(array('name' => 'num', 'htmlOptions' => array('style' => 'width:8%;')), array('name' => 'type', 'filter' => CHtml::listData(TransactionType::model()->findAll(), 'id', 'name'), 'value' => 'Yii::t("app",$data->Type->name)', 'htmlOptions' => array('style' => 'width:15%;')), array('name' => 'account_id', 'filter' => CHtml::listData(Accounts::model()->findAll(), 'id', 'name'), 'value' => 'CHtml::link(CHtml::encode(isset($data->Account)?$data->Account->name:$data->account_id),Yii::app()->createAbsoluteUrl("/accounts/transaction/".$data->account_id))', 'type' => 'raw', 'htmlOptions' => array('style' => 'width:15%;')), array('name' => 'refnum1', 'value' => '$data->refnumDocsLink()', 'filter' => '', 'type' => 'raw'), array('name' => 'refnum2', 'value' => 'CHtml::encode($data->refnum2)', 'type' => 'raw'), 'details', array('name' => 'valuedate', 'filter' => $dateisOn, 'value' => 'date("' . $phpdatetime . '",CDateTimeParser::parse($data->valuedate,"' . $yiidbdatetime . '"))', 'htmlOptions' => array('style' => 'width:8%;')), array('name' => 'reg_date', 'filter' => '', 'value' => 'date("' . $phpdatetime . '",CDateTimeParser::parse($data->reg_date,"' . $yiidbdatetime . '"))', 'htmlOptions' => array('style' => 'width:8%;')), array('header' => Yii::t('app', 'Debit'), 'cssClassExpression' => "'number'", 'name' => 'sum', 'filter' => '', 'value' => '($data->sum<0)?$data->sum:""'), array('header' => Yii::t('app', 'Credit'), 'cssClassExpression' => "'number'", 'name' => 'sum', 'filter' => '', 'value' => '($data->sum>0)?$data->sum:""'))));
?>
<div class="row form-actions">
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'buttonType' => 'ajaxButton', "icon" => "glyphicon glyphicon-print", 'label' => Yii::t('app', "Print")));
?>
    

</div>
<?php 
$this->endWidget();
//miniform
?>

<script type="text/javascript">
    jQuery(document).ready(function() {
        $("#yt0").click(function(e) {
 public function actionAddbuild()
 {
     if (isset($_POST['goods_id'])) {
         $components = GoodsBuild::model()->findAllByAttributes(array('goods_id' => $_POST['goods_id']));
         $type = TransactionType::model()->findByPk(1);
         $arModels = array();
         foreach ($components as $model) {
             $arModels[] = array('component_id' => $model->component_id, 'component_name' => $model->component->component_name, 'warehouse_from' => $model->warehouse->warehouse_from, 'warehouse_to' => $model->warehouse->warehouse_to, 'component_qty' => $model->component_qty, 'type' => $type->type);
         }
         echo CJSON::encode($arModels);
     }
 }
 /**
  * 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 = TransactionType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }