?> <?php echo $form->dropDownList($model, 'ForPago', array('Debito', 'Credito', 'Efectivo', 'Cheque', 'Vale')); ?> <?php echo $form->error($model, 'ForPago'); ?> </th> </div> <?php // see http://www.yiiframework.com/doc/guide/1.1/en/form.table // Note: Can be a route to a config file too, // or create a method 'getMultiModelForm()' in the member model $memberFormConfig = array('elements' => array('CodProducto' => array('type' => 'text', 'maxlength' => 80, 'class' => 'CodProducto', 'style' => 'WIDTH:90px'), 'Descripcion' => array('type' => 'zii.widgets.jui.CJuiAutoComplete', 'source' => $this->createUrl('venta/autocomplete'), 'options' => array('showAnim' => 'fold', 'size' => '80', 'minLength' => '2', 'select' => "js:function(event, ui) { \n var nomobj_texto = this.id; //El identificador del campo en mi caso #Detallecompra_Descripcion \n var indexid = nomobj_texto.substring(24,nomobj_texto.length); \n \$('#Detalleventa_CodProducto'+indexid).val(ui.item.id); // HTML-Id del campo\n \$('#Detalleventa_Precio'+indexid).val(ui.item.precio);\n \$('#Detalleventa_Saldo'+indexid).val(ui.item.saldo);\n \$('#Detalleventa_UniMedida'+indexid).val(ui.item.unidad); \n \$('#Detalleventa_Exento'+indexid).val(0); \n \$('#Detalleventa_Descuento'+indexid).val(0); \n \$('#contador').html(indexid);\n \n }"), 'htmlOptions' => array('size' => 120, 'placeholder' => 'Buscar ...', 'title' => 'Indique el producto.')), 'Cantidad' => array('type' => 'text', 'maxlength' => 120, 'class' => 'Cantidad', 'style' => 'WIDTH:60px'), 'Precio' => array('type' => 'text', 'maxlength' => 120, 'class' => 'Precio', 'style' => 'WIDTH:80px'), 'UniMedida' => array('type' => 'text', 'maxlength' => 8, 'class' => 'UniMedida', 'size' => 8, 'style' => 'WIDTH:55px', 'readonly' => true), 'Saldo' => array('type' => 'text', 'maxlength' => 10, 'class' => 'Saldo', 'size' => 8, 'style' => 'WIDTH:80px', 'readonly' => true, 'hide' => true), 'Iva' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'style' => 'WIDTH:55px', 'class' => 'Iva'), 'Descuento' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'class' => 'Descuento', 'style' => 'WIDTH:80px', 'value' => 0), 'Exento' => array('type' => 'text', 'maxlength' => 10, 'class' => 'Exento', 'size' => 8, 'style' => 'WIDTH:80px', 'value' => 0), 'Subtotal' => array('type' => 'text', 'maxlength' => 10, 'class' => 'Subtotal', 'size' => 8, 'style' => 'WIDTH:80px'))); $this->widget('ext.multimodelform.MultiModelForm', array('id' => 'id_member', 'formConfig' => $memberFormConfig, 'model' => $member, 'tableView' => true, 'validatedItems' => $validatedMembers, 'jsAfterNewId' => MultiModelForm::afterNewIdAutoComplete($memberFormConfig['elements']['Descripcion']), 'addItemText' => 'Agregar', 'removeText' => 'Quitar', 'removeConfirm' => 'Desea quitar la fila seleccionada', 'data' => $member->findAll('NumVenta=:groupId', array(':groupId' => $model->NumVenta)))); ?> <th> <div class="required"> <?php echo $form->labelEx($model, 'TotExento'); ?> <?php echo $form->textField($model, 'TotExento'); ?> <?php echo $form->error($model, 'TotExento'); ?> </div>
?> </th> <th> <label>Sin iva</label> <input type="checkbox" id="iva"/> </th> </table> <div class="table-responsive"> <table class="table"> <?php echo CHtml::script('function alertIds(newElem,sourceElem) {alert(newElem.attr("id"));}'); $memberFormConfig = array('elements' => array('CodProducto' => array('type' => 'text', 'size' => '10', 'maxlength' => 10, 'style' => 'WIDTH:100px', 'readonly' => TRUE, 'class' => 'CodProducto'), 'Descripcion' => array('type' => 'zii.widgets.jui.CJuiAutoComplete', 'source' => $this->createUrl('compra/autocomplete'), 'options' => array('showAnim' => 'fold', 'common_id_string' => 'Descripcion', 'size' => '120', 'minLength' => '2', 'select' => "js:function(event, ui) { \n var nomobj_texto = this.id; //El identificador del campo en mi caso #Detallecompra_Descripcion \n var indexid = nomobj_texto.substring(25,nomobj_texto.length); \n \$('#Detallecompra_CodProducto'+indexid).val(ui.item.id); \n \$('#Detallecompra_Precio'+indexid).val(ui.item.Precio); \n \$('#Detallecompra_UniMedida'+indexid).val(ui.item.UniMedida);\n \$('#Detallecompra_Saldo'+indexid).val(ui.item.Saldo); \n \$('#Detallecompra_Descuento'+indexid).val(0);\n \$('#Detallecompra_Exento'+indexid).val(0);\n \$('#contador').html(indexid);\n }"), 'htmlOptions' => array('size' => 30, 'onFocus' => "init(this.id)", 'placeholder' => 'Buscar ...', 'title' => 'Indique el producto.')), 'Cantidad' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'style' => 'WIDTH:70px', 'class' => 'Cantidad'), 'Precio' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'style' => 'WIDTH:70px', 'class' => 'Precio'), 'UniMedida' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'style' => 'WIDTH:70px', 'readonly' => TRUE, 'class' => 'UniMedida'), 'Iva' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'style' => 'WIDTH:70px', 'class' => 'Iva'), 'Descuento' => array('type' => 'text', 'maxlength' => 8, 'size' => 8, 'style' => 'WIDTH:70px', 'class' => 'Descuento'), 'Exento' => array('type' => 'text', 'maxlength' => 10, 'size' => 8, 'style' => 'WIDTH:70px', 'class' => 'Exento'), 'Subtotal' => array('type' => 'text', 'maxlength' => 10, 'size' => 8, 'style' => 'WIDTH:70px', 'class' => 'Subtotal', 'readonly' => true), 'Saldo' => array('type' => 'text', 'maxlength' => 10, 'size' => 8, 'style' => 'WIDTH:70px', 'readonly' => true, 'class' => 'Saldo'))); $this->widget('ext.multimodelform.MultiModelForm', array('id' => 'id_member', 'formConfig' => $memberFormConfig, 'model' => $member, 'tableView' => true, 'validatedItems' => $validatedMembers, 'jsAfterNewId' => MultiModelForm::afterNewIdAutoComplete($memberFormConfig['elements']['Descripcion']), 'data' => $member->findAll('NumCompra=:groupId', array(':groupId' => $model->NumCompra)), 'showAddItemOnError' => false, 'addItemText' => 'Agregar', 'removeText' => 'Eliminar', 'removeConfirm' => '¿ Eliminar el producto seleccionado ?')); ?> </table> </div> <div class="table-responsive"> <table class="table"> <tr> <?php echo $form->labelEx($model, 'TotIva'); ?> <?php echo $form->textField($model, 'TotIva', array('size' => 10, 'maxlength' => 10)); ?>