// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
//                    INICIO RUTINA: comparar_fecha con la del sistema
//                    valida si fecha <, <=, >, >=, = a fecha del sistema
//                    Previamente la fecha debe llegar logica
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


function V00_comparar_fsys(in_cadena,in_tipo)
{

  if ((in_tipo != "=") && (in_tipo != "<") && (in_tipo != "<=") && (in_tipo != ">") && (in_tipo != ">="))
    {  alert(' error en el campo de comparacion ');
       return false;
    }

w_hoy = new Date()


//  w_hoy_date = w_hoy
//  w_hoy_date = new Date((w_hoy.getMonth()+1)+'/'+w_hoy.getDate()+'/'+w_hoy.getFullYear());
  w_hoy_date = new Date(w_hoy.getFullYear(),w_hoy.getMonth(),w_hoy.getDate(),0,0,0);
  w_expreg= /(^\d{1,2})([\/-])(\d{1,2})([\/-])(\d{4}$)/

  w_fecha = w_expreg.exec(in_cadena)


//  w_fecha_date =new Date(w_fecha[3]+'/'+w_fecha[1]+'/'+w_fecha[5]);
  w_fecha_date =new Date(w_fecha[5],w_fecha[3]-1,w_fecha[1],0,0,0);



//  alert ('la incadena      =' + w_fecha)
//  alert ('la w_fecha       =' + w_fecha)
//  alert ('la w_hoy_date    =' + w_hoy_date)
//  alert ('la w_fecha_date=' + w_fecha_date + ' la w_hoy_date    =' + w_hoy_date)
//  alert ('la w_fecha_date=' + w_fecha_date.getTime() + ' la w_hoy_date    =' + w_hoy_date.getTime())
//  alert ('el in_tipo es' + in_tipo)

//  if (w_fecha_date.getTime() == w_hoy_date.getTime())
//     alert('fechas iguales');

//  if (w_fecha_date.getTime() != w_hoy_date.getTime())
//    alert('fechas distintas');

//  if (w_fecha_date.getTime() > w_hoy_date.getTime())
//    alert('w_fecha_date > w_hoy_date');

//  if (w_fecha_date.getTime() < w_hoy_date.getTime())
//    alert('w_fecha_date < w_hoy_date');

  if ((in_tipo == "=") && (w_fecha_date.getTime() == w_hoy_date.getTime() ))
     return true;

  if ((in_tipo == "<") && (w_fecha_date.getTime() < w_hoy_date.getTime() ))
     return true;

  if ((in_tipo == ">") && (w_fecha_date.getTime() > w_hoy_date.getTime() ))
     return true;

  if ((in_tipo == "<=") && (w_fecha_date.getTime() <= w_hoy_date.getTime() ))
     return true;

  if ((in_tipo == ">=") && (w_fecha_date.getTime() >= w_hoy_date.getTime() ))
     return true;

//alert(' salimos de la rutina de validar tipo dato')

	return false;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
//                    INICIO RUTINA: comparar_fechas con la del sistema
//                    valida si fecha <, <=, >, >=, = a fecha del sistema
//                    Previamente la fecha debe llegar logica
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


function V00_comparar_fechas(in_cadena1,in_cadena2,in_tipo)
{

  if ((in_tipo != "=") && (in_tipo != "<") && (in_tipo != "<=") && (in_tipo != ">") && (in_tipo != ">="))
    {  alert(' error en el campo de comparacion ');
       return false;
    }

  w_expreg= /(^\d{1,2})([\/-])(\d{1,2})([\/-])(\d{4}$)/

  w_fecha1 = w_expreg.exec(in_cadena1)

  w_fecha1_date =new Date(w_fecha1[3]+'/'+w_fecha1[1]+'/'+w_fecha1[5]);

  w_fecha2 = w_expreg.exec(in_cadena2)

  w_fecha2_date =new Date(w_fecha2[3]+'/'+w_fecha2[1]+'/'+w_fecha2[5]);

//  alert ('la incadena      =' + w_fecha1 + w_fecha2)
//  alert ('la w_fecha       =' + w_fecha1 + w_fecha2)
//  alert ('la w_fecha_date=' + w_fecha1_date + ' ' + w_fecha2_date)
//  alert ('el in_tipo es' + in_tipo)

//  if (w_fecha1_date.getTime() == w_fecha2_date.getTime())
//     alert('fechas iguales');

//  if (w_fecha1_date.getTime() != w_fecha2_date.getTime())
//    alert('fechas distintas');

//  if (w_fecha1_date.getTime() > w_fecha2_date.getTime())
//    alert('w_fecha1 > w_fecha2');

//  if (w_fecha1_date.getTime() < w_fecha2_date.getTime())
//    alert('w_fecha1 < w_fecha2');

  if ((in_tipo == "=") && (w_fecha1_date.getTime() == w_fecha2_date.getTime()))
     return true;

  if ((in_tipo == "<") && (w_fecha1_date.getTime() < w_fecha2_date.getTime()))
     return true;

  if ((in_tipo == ">") && (w_fecha1_date.getTime() > w_fecha2_date.getTime()))
     return true;

  if ((in_tipo == "<=") && (w_fecha1_date.getTime() <= w_fecha2_date.getTime()))
     return true;

  if ((in_tipo == ">=") && (w_fecha1_date.getTime() >= w_fecha2_date.getTime()))
     return true;

// alert(' salimos de la rutina de validar tipo dato')

	return false;
}
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
//                    INICIO RUTINA: xxxx
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
//                    INICIO RUTINA: xxxx
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//


