public function actionViewFinv($finv_id, $ajax = false) { if ($ajax) { $a = explode('-', $ajax); $model = new FixrFiitXRef(); $model->fixr_fiit_id = end($a); $this->renderPartial('_fixr_grid', array('model' => $model, 'sub_grid_id' => $ajax)); return; } $model = FinvInvoice::model()->findByPk($finv_id); $this->render('viewFinv', array('model' => $model)); }
?> <?php //$this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs)) ?> <div class="clearfix"> <div class="btn-toolbar pull-left"> <div class="btn-group"> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('D2finvModule.crud_static', 'Create'), 'icon' => 'icon-plus', 'size' => 'large', 'type' => 'success', 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess('D2finv.FiitInvoiceItem.*') || Yii::app()->user->checkAccess('D2finv.FiitInvoiceItem.Create'))); ?> </div> <div class="btn-group"> <h1> <i class=""></i> <?php echo Yii::t('D2finvModule.model', 'Fiit Invoice Items'); ?> </h1> </div> </div> </div> <?php Yii::beginProfile('FiitInvoiceItem.view.grid'); ?> <?php $this->widget('TbGridView', array('id' => 'fiit-invoice-item-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{summary}{pager}{items}{pager}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'CLinkColumn', 'header' => '', 'labelExpression' => '$data->itemLabel', 'urlExpression' => 'Yii::app()->controller->createUrl("view", array("fiit_id" => $data["fiit_id"]))'), array('class' => 'editable.EditableColumn', 'name' => 'fiit_id', 'editable' => array('url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_finv_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FinvInvoice::model()->findAll(array('limit' => 1000)), 'finv_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_desc', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_debet_facn_code', 'editable' => array('url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_credit_facn_code', 'editable' => array('url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_fprc_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FprcProductCategory::model()->findAll(array('limit' => 1000)), 'fprc_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_quantity', 'editable' => array('url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_fqnt_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FqntQuantity::model()->findAll(array('limit' => 1000)), 'fqnt_id', 'itemLabel'))), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'Yii::app()->user->checkAccess("D2finv.FiitInvoiceItem.View")'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'Yii::app()->user->checkAccess("D2finv.FiitInvoiceItem.Delete")')), 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("fiit_id" => $data->fiit_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("fiit_id" => $data->fiit_id))', 'viewButtonOptions' => array('data-toggle' => 'tooltip'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'))))); Yii::endProfile('FiitInvoiceItem.view.grid');
public function beforeSave() { if (!$this->isNewRecord && !FinvInvoice::model()->findByPk($this->primaryKey)) { return false; } return parent::beforeSave(); }
'); } if (!$ajax || $ajax == 'fiit-invoice-item-grid') { Yii::beginProfile('fiit_fqnt_id.view.grid'); ?> <h3 class="rel_grid"> <?php echo Yii::t('D2finvModule.model', 'Fiit Invoice Item'); ?> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'ajaxButton', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-plus', 'url' => array('//d2finv/fiitInvoiceItem/ajaxCreate', 'field' => 'fiit_fqnt_id', 'value' => $modelMain->primaryKey, 'ajax' => 'fiit-invoice-item-grid'), 'ajaxOptions' => array('success' => 'function(html) {$.fn.yiiGridView.update(\'fiit-invoice-item-grid\');}'), 'htmlOptions' => array('title' => Yii::t('D2finvModule.crud_static', 'Add new record'), 'data-toggle' => 'tooltip'))); ?> </h3> <?php if (empty($modelMain->fiitInvoiceItems)) { $model = new FiitInvoiceItem(); $model->fiit_fqnt_id = $modelMain->primaryKey; $model->save(); unset($model); } $model = new FiitInvoiceItem(); $model->fiit_fqnt_id = $modelMain->primaryKey; // render grid view $this->widget('TbGridView', array('id' => 'fiit-invoice-item-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => ' ', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'fiit_finv_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FinvInvoice::model()->findAll(array('limit' => 1000)), 'finv_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_desc', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_debet_facn_code', 'editable' => array('url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_credit_facn_code', 'editable' => array('url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_fprc_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FprcProductCategory::model()->findAll(array('limit' => 1000)), 'fprc_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_quantity', 'editable' => array('url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_price', 'editable' => array('url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'fiit_amt', 'editable' => array('url' => $this->createUrl('//d2finv/fiitInvoiceItem/editableSaver'))), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'Yii::app()->user->checkAccess("D2finv.FqntQuantity.DeletefiitInvoiceItems")')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2finv/fiitInvoiceItem/delete", array("fiit_id" => $data->fiit_id))', 'deleteButtonOptions' => array('data-toggle' => 'tooltip'))))); ?> <?php Yii::endProfile('FiitInvoiceItem.view.grid'); }
public function loadModel($id) { $m = FinvInvoice::model(); // apply scope, if available $scopes = $m->scopes(); if (isset($scopes[$this->scope])) { $m->{$this->scope}(); } $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('FinvModule.crud_static', 'The requested page does not exist.')); } return $model; }
public function afterDelete() { $finv = FinvInvoice::model()->findByPk($this->fiit_finv_id); $finv->save(); parent::afterDelete(); }
<div class="row"> <div class="span5"> <h2> <?php echo Yii::t('D2finvModule.crud_static', 'Data'); ?> <small> #<?php echo $model->fiit_id; ?> </small> </h2> <?php $this->widget('TbDetailView', array('data' => $model, 'attributes' => array(array('name' => 'fiit_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_id', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_finv_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FinvInvoice::model()->findAll(array('limit' => 1000)), 'finv_id', 'itemLabel'), 'attribute' => 'fiit_finv_id'), true)), array('name' => 'fiit_desc', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_desc', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_debet_facn_code', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_debet_facn_code', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_credit_facn_code', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_credit_facn_code', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_fprc_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FprcProductCategory::model()->findAll(array('limit' => 1000)), 'fprc_id', 'itemLabel'), 'attribute' => 'fiit_fprc_id'), true)), array('name' => 'fiit_quantity', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_quantity', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_fqnt_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FqntQuantity::model()->findAll(array('limit' => 1000)), 'fqnt_id', 'itemLabel'), 'attribute' => 'fiit_fqnt_id'), true)), array('name' => 'fiit_price', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_price', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_amt', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_amt', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_vat', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_vat', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_total', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'fiit_total', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver')), true)), array('name' => 'fiit_fvat_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2finv/fiitInvoiceItem/editableSaver'), 'source' => CHtml::listData(FvatVat::model()->findAll(array('limit' => 1000)), 'fvat_id', 'itemLabel'), 'attribute' => 'fiit_fvat_id'), true))))); ?> </div> <div class="span7"> <div class="well"> <?php $this->renderPartial('_view-relations_grids', array('modelMain' => $model, 'ajax' => false)); ?> </div> </div> </div> <?php echo $cancel_buton;