<div class="row"> <?php echo $form->label($model, 'id'); ?> <?php echo $form->textField($model, 'id'); ?> </div> <div class="row"> <?php echo $form->label($model, 'vendor_id'); ?> <?php echo $form->dropDownList($model, 'vendor_id', GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'text'); ?> <?php echo $form->textArea($model, 'text'); ?> </div> <div class="row"> <?php echo $form->label($model, 'create_date');
<?php $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage')); $this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('vendor-mobile-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1><?php echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2)); ?> </h1> <p> You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'vendor-mobile-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'subdistribution_id', 'value' => 'GxHtml::valueEx($data->subdistribution)', 'filter' => GxHtml::listDataEx(Subdistribution::model()->findAllAttributes(null, true))), array('name' => 'vendor_id', 'value' => 'GxHtml::valueEx($data->vendor)', 'filter' => GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true))), array('name' => 'phone_id', 'value' => 'GxHtml::valueEx($data->phone)', 'filter' => GxHtml::listDataEx(Phone::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn'))));
<span class="required">*</span> <?php echo Yii::t('app', 'are required'); ?> . </p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'vendor_id'); ?> <?php echo $form->dropDownList($model, 'vendor_id', GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'vendor_id'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'text'); ?> <?php echo $form->textArea($model, 'text'); ?> <?php echo $form->error($model, 'text'); ?>
echo $form->checkBox($model, 'internal'); ?> <?php echo $form->error($model, 'internal'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'deleted_at'); ?> <?php echo $form->textField($model, 'deleted_at'); ?> <?php echo $form->error($model, 'deleted_at'); ?> </div><!-- row --> <label><?php echo GxHtml::encode($model->getRelationLabel('vendors')); ?> </label> <?php echo $form->checkBoxList($model, 'vendors', GxHtml::encodeEx(GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true)), false, true)); ?> <?php echo GxHtml::submitButton(Yii::t('app', 'Save')); $this->endWidget(); ?> </div><!-- form -->
<?php $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage')); $this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('vendor-note-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1><?php echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2)); ?> </h1> <p> You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'vendor-note-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'vendor_id', 'value' => 'GxHtml::valueEx($data->vendor)', 'filter' => GxHtml::listDataEx(Vendor::model()->findAllAttributes(null, true))), 'text', 'create_date', 'deleted_at', array('class' => 'CButtonColumn'))));
public function actiondeleteVoucherVendor() { if (isset($_POST) && !empty($_POST)) { $distribution = Distribution::model()->findByPk($_POST['distribution_id']); $vendor = Vendor::model()->findByPk($_POST['vendor_id']); $subdistributions = $distribution->subdistributions; $criteria_string = "(0"; foreach ($subdistributions as $subdistribution) { foreach ($subdistribution->distributionVouchers as $ditributioVoucher) { $criteria_string = $criteria_string . ", " . $ditributioVoucher->id; } } $criteria_string = $criteria_string . ")"; $criteria_string2 = "(0"; foreach ($_POST['beneficiaries'] as $ben_id) { $criteria_string2 = $criteria_string2 . ", " . $ben_id; } $criteria_string2 = $criteria_string2 . ")"; $vouchers = Voucher::model()->findAll("vendor_id = " . $vendor->id . " and distribution_voucher_id in " . $criteria_string . " and ben_id in " . $criteria_string2); foreach ($vouchers as $voucher) { $voucher->vendor_id = NULL; $voucher->update(); $voucher->save(); } } }