<?php
/* @var $this MayorAnaliticoCuentaController */
/* @var $model MayorAnaliticoCuenta */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'mayor-analitico-cuenta-buscaDiarioComprobante-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// See class documentation of CActiveForm for details on this,
	// you need to use the performAjaxValidation()-method described there.
	'enableAjaxValidation'=>false,
)); ?>
<br>
<br>
<br>
<div  class="row-fluid"><div class="span3">
           
        
    </div><div class="span9">	
	<?php echo $form->errorSummary($model); ?>

    <fielset><legend>Título del informe: Diario de comprobantes</legend>
    </fielset>
        <div>
                  <?php echo $form->dropDownListRow($model,'cantidad',array('1'=>'Uno','2'=>'Entre Dos Números','3'=>'Entre Dos Fechas')/*,array('onChange'=>'cantidadOnChange(this)')*/)?>
        </div> <div id="fechas" ><!--style="display:none;"-->
	<div class="row-fluid">
		<?php echo $form->labelEx($model,'fecha_comprobante'); ?>
		<?php //echo $form->textField($model,'fecha_comprobante'); ?>
            <?php
     if ($model->fecha_comprobante!='') {       
      $model->fecha_comprobante=date('d-m-Y',strtotime($model->fecha_comprobante));
      }
      $this->widget('zii.widgets.jui.CJuiDatePicker', array(
              'model'=>$model,
              'attribute'=>'fecha_comprobante',
              'value'=>$model->fecha_comprobante,
				'language' => 'es',
				//'htmlOptions' => array('readonly'=>"readonly",'onchange'=>"busca_numero()"),
                //additional javascript options for the date picker plugin
              'options'=>array(
                      'autoSize'=>true,
                      'defaultDate'=>$model->fecha_comprobante,
          //'dateFormat'=>'yy-m-d',
          'dateFormat'=>'dd-mm-yy',
          'buttonImage'=>Yii::app()->baseUrl.'/images/calendar.png',
                      'buttonImageOnly'=>true,
                      'buttonText'=>'Fecha',
                      'selectOtherMonths'=>true,
                      'showAnim'=>'slide',
                      'showButtonPanel'=>true,
                      'showOn'=>'button',
                      'showOtherMonths'=>true,
               'changeMonth' => 'true',
                  'changeYear' => 'true',
                  ),
      )); ?>
		<?php echo $form->error($model,'fecha_comprobante'); ?>
	</div>
	<div class="row-fluid">
		<?php echo $form->labelEx($model,'fecha_final'); ?>
		<?php //echo $form->textField($model,'fecha_final'); ?>
                <?php
     if ($model->fecha_final!='') {       
      $model->fecha_final=date('d-m-Y',strtotime($model->fecha_final));
      }
      $this->widget('zii.widgets.jui.CJuiDatePicker', array(
              'model'=>$model,
              'attribute'=>'fecha_final',
              'value'=>$model->fecha_final,
				'language' => 'es',
				//'htmlOptions' => array('readonly'=>"readonly",'onchange'=>"busca_numero()"),
                //additional javascript options for the date picker plugin
              'options'=>array(
                      'autoSize'=>true,
                      'defaultDate'=>$model->fecha_final,
          //'dateFormat'=>'yy-m-d',
          'dateFormat'=>'dd-mm-yy',
          'buttonImage'=>Yii::app()->baseUrl.'/images/calendar.png',
                      'buttonImageOnly'=>true,
                      'buttonText'=>'Fecha',
                      'selectOtherMonths'=>true,
                      'showAnim'=>'slide',
                      'showButtonPanel'=>true,
                      'showOn'=>'button',
                      'showOtherMonths'=>true,
               'changeMonth' => 'true',
                  'changeYear' => 'true',
                  ),
      )); ?>
		<?php echo $form->error($model,'fecha_final'); ?>
	</div>
	</div>
            <div id="numeros" class="row-fluid">
            <div class="span3">  
            <?php echo $form->textFieldRow($model,'n_desde')?>
            </div>
            <div class="span3">  
            <?php echo $form->textFieldRow($model,'n_hasta')?>
            </div>
	</div>
       
        
	
<fielset><legend>Datos del comportamiento del informe</legend>
<div>
    <?php echo $form->checkBoxRow($model,'salta_pag');  ?>
</div>
<div>
    <?php echo $form->checkBoxRow($model,'detalla'); /*echo " Incluye Cuentas sin Movimiento."*/ ?>
</div>
<div>
    <?php echo $form->checkBoxRow($model,'repetir');  ?>
</div><br>

</fielset>
	
<br>



	<div class="row-fluid buttons">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
                    'buttonType'=>'submit', 
                    'label'=>'Buscar', 
                    'type' => 'primary',
                    )); 
                
         ?>
            
	</div>
    </div>
    
</div>
</div>
<?php $this->endWidget(); ?>

</div><!-- form -->
<script>
 
 $("#mayor-analitico-cuenta-buscaMayorAnalitico-form").submit(function () {  
    if($("#MayorAnaliticoCuenta_id_cuenta").val().length ==0) {  
       alert("Debe seleccionar Cuenta Desde");  
       return false;  
    } else {
       return true;  
} 
    return false;  
});
 </script>
<script>

/*function cantidadOnChange(sel) {
      if (sel.value=="3"){
           divC = document.getElementById("fechas");
           divC.style.display = "";

           divT = document.getElementById("numeros");
           divT.style.display = "none";

      }else{

           divC = document.getElementById("fechas");
           divC.style.display="none";

           divT = document.getElementById("numeros");
           divT.style.display = "";
      }
}*/
</script>