<?php if (strtolower($this->action->id) == 'verdocumento') { $proveedor = Docompra::model()->search_por_compra($filtro); } else { $proveedor = Docompratemp::model()->search_por_compra($filtro); } $descuento = $model->descuento + 0; //var_dump($descuento);yii::app()->end(); ?> <div id="AjFlash" class="flash-regular"></div> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'detalle-grid', 'dataProvider' => $proveedor, 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'summaryText' => '>', 'columns' => array(array('class' => 'CCheckBoxColumn', 'selectableRows' => 20, 'value' => '$data->idtemp', 'checkBoxHtmlOptions' => array('name' => 'cajita[]')), array('name' => 'st.', 'header' => 'st', 'type' => 'raw', 'value' => 'CHtml::image(Yii::app()->getTheme()->baseUrl.Yii::app()->params["rutatemaimagenes"].$data->coddocu.$data->estadodetalle.".png")'), 'codentro', 'codigoalma', 'item', 'cant', 'ums.desum', 'codart', 'descri', array('name' => 'texto', 'type' => 'raw', 'header' => 't', 'value' => '(!empty($data->detalle))?CHtml::image(Yii::app()->getTheme()->baseUrl.Yii::app()->params["rutatemaimagenes"]."texto.png","hola"):""'), 'punit', array('name' => 'Bruto', 'header' => 'Bruto', 'value' => 'Mifactoria::decimal($data->cant*($data->punit),2)', 'footer' => Chtml::openTag("span", array("class" => "label label-info")) . MiFactoria::decimal(Docompratemp::getTotal($proveedor)["bruto"], 2) . CHTml::CloseTag("span")), array('name' => 'Descuento', 'visible' => $descuento > 0 ? true : false, 'header' => 'Dcto', 'value' => 'Mifactoria::decimal($data->cant*$data->punit*($data->ocompra->descuento/100),2)', 'footer' => Chtml::openTag("span", array("class" => "label label-info")) . MiFactoria::decimal(Docompratemp::getTotal($proveedor)["descuento"], 2) . CHTml::CloseTag("span")), array('name' => 'potal', 'value' => 'Mifactoria::decimal(($data->punit*(1-$data->ocompra->descuento/100))*$data->cant,2)', 'footer' => Chtml::openTag("span", array("class" => "label label-info")) . MiFactoria::decimal(Docompratemp::getTotal($proveedor)["total"], 2) . CHTml::CloseTag("span")), array('class' => 'CButtonColumn', 'buttons' => array('view' => array('visible' => 'false'), 'update' => array('visible' => $this->eseditable($model->{$this->campoestado}) ? 'false' : 'true', 'url' => '$this->grid->controller->createUrl("/Ocompra/Modificadetalle/", array("id"=>$data->idtemp, "asDialog"=>1, "gridId"=>$this->grid->id ) )', 'click' => 'function(){ $("#cru-detalle").attr("src",$(this).attr("href")); $("#cru-dialogdetalle").dialog("open"); return false; }', 'imageUrl' => '' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemagrid'] . 'update.png', 'label' => 'Actualizar Item'), 'delete' => array('visible' => $this->eseditable($model->{$this->campoestado}) ? 'false' : 'true', 'url' => '$this->grid->controller->createUrl("/Ocompra/borraitem", array("identi"=>$data->id,"idcabecera"=>$data->hidguia))', 'options' => array('ajax' => array('type' => 'GET', 'success' => "js:function() { \$.fn.yiiGridView.update('detalle-grid'); }", 'url' => 'js:$(this).attr("href")')), 'imageUrl' => '' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemaimagenes'] . 'borrador.png', 'label' => 'Borrary'))))));
<div class="row"> <?php $datos1 = CHtml::listData(Docompratemp::model()->findAll("hidguia=:hu", array(":hu" => $model->idguia)), 'id', 'descri'); echo CHtml::DropDownList('selector_item', '', $datos1, array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('Ocompra/cargaentregas'), 'update' => '#division_entregas'), 'prompt' => 'Seleccione un item')); ?> <?php echo $form->HiddenField($model, 'idguia'); ?> </div> <div id="division_entregas"> </div>
public function actionModificadetalle($id) { $model = Docompratemp::Model()->findByPk(MiFactoria::cleanInput((int) $id)); if ($model === null) { throw new CHttpException(404, 'No se encontro ningun documento para estos datos'); } //colocar el escenario correcto if ($model->iddesolpe > 0) { $model->setScenario('ingresodesolpe'); } if (isset($_POST['Docompratemp'])) { $model->attributes = $_POST['Docompratemp']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } //$this->redirect(array('view','id'=>$model->n_guia)); } if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('_form_detalle', array('model' => $model)); }
public function hayitemsolpe($iddesolpe, $idcompra) { //como parametro el IDDSOLPE $matrizv = Docompratemp::model()->findAll("hidguia=:vidguia and iddesolpe=:xido and idusertemp=:sesione", array(":vidguia" => $idcompra, ":sesione" => Yii::app()->user->id, ":xido" => $iddesolpe)); return count($matrizv) == 0 ? false : true; }