<?php
/* @var $this CreditoController */
/* @var $model Credito */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'credito-_pagar_form-form',
    //'type' => 'horizontal',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'clientOptions' => array(
        'validateOnSubmit' => true,
        'validateOnChange' => true,
        'validateOnType' => true,
        ),
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
));
?>
            <h3>Aprobar pago de préstamo</h3>

    <p class="note">Los campos con <span class="required">*</span> son obligatorios.</p>

    <?php echo $form->errorSummary($model); ?>
        <h3 style="text-align: center">Detalle</h3>

        <table class="table table-bordered table-striped table-hover items table table-striped table-bordered table-condensed" >
            <tr class="info" >
              <td style="text-align: center"><b>C&eacute;dula</b></td>
              <td style="text-align: center"><b>Nombre y Apellido</b></td>
              <td style="text-align: center"><b>Empresa</b></td>
              <td style="text-align: center"><b>Unidad</b></td>
              <td style="text-align: center"><b>Ultimo Sueldo</b></td>
              <td style="text-align: center"><b>Porcentaje</b></td>

              <td style="text-align: center"><b><?php echo 'Fecha de Registro' ?></b></td>
              <td style="text-align: center"><b>Estatus</b></td>
            </tr>
            <tr>
              <td style="text-align: center"><?php echo $model->idAsociado->cedula; ?></td>
              <td style="text-align: center"><?php echo $model->idAsociado->nombre.' '.$model->idAsociado->apellidos; ?></td>
              <td style="text-align: center"><?php echo ($model->idAsociado->lugartrabajo0) ? $model->idAsociado->lugartrabajo0->descripcion : ''; ?></td>
              <td style="text-align: center"><?php echo ($model->idAsociado->unidad) ? $model->idAsociado->unidad->descripcion : ''; ?></td>
              <td style="text-align: center"><?php echo $model->idAsociado->utltimoSueldo($model->idAsociado->idasociado); ?></td>
              <td style="text-align: center"><?php echo ($model->idAsociado->aportes) ? $model->idAsociado->aportes->descripcion : ''; ?></td>
              <td style="text-align: center"><?php echo $model->idAsociado->fechaingreso ?></td>
              <td style="text-align: center"><?php echo ($model->idAsociado->blnborrado == '1') ? 'Inacivo' : 'Activo'; ?></td>
            </tr>
          </table>
        <h3 style="text-align: center">Detalles del cr&eacute;dito </h3>

  <table class="table table-bordered table-striped table-hover items table table-striped table-bordered table-condensed" >
      <tr class="info" >
        <td style="text-align: center"><b>Fecha de la solicitud</b></td>
        <td style="text-align: center"><b>Tipo del cr&eacute;dito</b></td>
        <td style="text-align: center"><b>Cuota a pagar</b></td>
        <td style="text-align: center"><b>Tasa de interes</b></td>
        <td style="text-align: center"><b>Monto del crédito</b></td>
        <td style="text-align: center"><b>N&uacute;mero de cuenta</b></td>
        <td style="text-align: center"><b>Fecha del primer descuento</b></td>
        <td style="text-align: center"><b>Fiador</b></td>
      </tr>
      <tr>
        <td style="text-align: center"><?php echo ($model->fecha_registro) ? date('d-m-Y', strtotime($model->fecha_registro)) : null; ?></td>
        <td style="text-align: center"><?php echo ($model->idTipoCredito) ? $model->idTipoCredito->descripcion : ''; ?></td>
        <td style="text-align: center"><?php echo number_format($model->cuota_pagar, 2, ',', '.') ?></td>
        <td style="text-align: center"><?php echo number_format($model->taza_interes, 3, ',', '.'); ?></td>
        <td style="text-align: center"><?php echo number_format($model->monto_credito, 2, ',', '.'); ?></td>
        <td style="text-align: center"><?php echo $model->cuenta; ?></td>
        <td style="text-align: center"><?php echo ($model->fecha_primer_descuento) ? date('d-m-Y', strtotime($model->fecha_primer_descuento)) : null ?></td>
        <td style="text-align: center"><?php echo ($model->fiador) ? 'Si' : 'No'; ?></td>
      </tr>
    </table>

        <div class="well">
    <div class="row-fluid">
        <?php //echo $form->textFieldRow($model,'banco');?>
 <?php

                Yii::import('application.modules.contable.models.*');
                echo $form->dropDownListRow($modelCreditoSeguimiento,'idBanco',
                CHtml::listData(ParametrosBancos::model()->findAll(array('condition' => 'estatus=true and blnborrado=false')), 'id', 'descripcion'), array('prompt' => '-- Seleccione banco--'));
        ?>
    </div>
    <div class="row-fluid">
        <?php echo $form->textFieldRow($modelCreditoSeguimiento, 'referencia'); ?>
    </div>
            <div class="row-fluid">
        <?php echo $form->labelEx($pago, 'fecha_pago'); ?>
                <?php /*if ($modelCreditoSeguimiento->fecha_registro!='') {
                        $modelCreditoSeguimiento->fecha_registro=date('d-m-Y',strtotime($modelCreditoSeguimiento->fecha_registro));
                        }*/
      $this->widget('zii.widgets.jui.CJuiDatePicker', array(
              'model' => $pago,
              'attribute' => 'fecha_pago',
              'value' => $pago->fecha_pago,
                'language' => 'es',
                'htmlOptions' => array('readonly' => 'readonly', 'style' => 'width:140px'),
                //additional javascript options for the date picker plugin
              'options' => array(
                      'autoSize' => true,
                      'defaultDate' => $pago->fecha_pago,
          //'dateFormat'=>'yy-m-d',
          'dateFormat' => 'dd-mm-yy',
          'buttonImage' => Yii::app()->baseUrl.'/images/calendar.png',
                      'buttonImageOnly' => true,
                      'buttonText' => 'Fecha del pago',
                      'selectOtherMonths' => true,
                      'showAnim' => 'slide',
                      'showButtonPanel' => true,
                      'showOn' => 'button',
                      'maxDate' => '+0D',
                      'showOtherMonths' => true,
                      'changeMonth' => 'true',
                      'changeYear' => 'true',
                  ),
      )); ?>
        <?php echo $form->error($pago, 'fecha_pago'); ?>
    </div>
    <?php if (ParamEscenarios::fechaComprobante(['pago_prestamo' => 4])): ?>
        <div class="row-fluid">
            <?php echo $form->labelEx($model, 'Fecha del comprobante'); ?>
            <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'fecha_comprobante',
                'value' => $model->fecha_comprobante,
                'language' => 'es',
                'htmlOptions' => array('readonly' => 'readonly', 'style' => 'width:140px'),
                'options' => array(
                    'autoSize' => true,
                    'defaultDate' => $model->fecha_comprobante,
                    'dateFormat' => 'dd-mm-yy',
                    'buttonImage' => Yii::app()->baseUrl.'/images/calendar.png',
                    'buttonImageOnly' => true,
                    'buttonText' => 'Fecha del pago',
                    'selectOtherMonths' => true,
                    'showAnim' => 'slide',
                    'showButtonPanel' => true,
                    'showOn' => 'button',
                    'maxDate' => '+0D',
                    'showOtherMonths' => true,
                    'changeMonth' => 'true',
                    'changeYear' => 'true',
                )
            )) ?>
            <?php echo $form->error($pago, 'fecha_comprobante'); ?>
        </div>
    <?php endif ?>
    <div class="row-fluid">
                 <?php echo $form->textAreaRow($modelCreditoSeguimiento, 'observacion', array('style' => 'width: 100%')); ?>
    </div>

    </div>
        <div style="text-align: center">
            <?php $this->widget('bootstrap.widgets.TbButton', array(
                                'buttonType' => 'submit',
                                'type' => 'success',
                                'icon' => 'icon-ok',
                                'label' => 'Generar pago',
            )); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
