Ver Mensaje Individual
  #7  
Antiguo 21-07-2006
Avatar de kuan-yiu
[kuan-yiu] kuan-yiu is offline
Miembro Premium
 
Registrado: jun 2006
Ubicación: Galicia. España.
Posts: 1.017
Reputación: 19
kuan-yiu Va camino a la fama
Que curioso, acabo de hacer una segunda versión de la función que toma detalles que todos me habéis indicado y que se parece mucho a la tuya Lepe
Código Delphi [-]
{ Compara las fechas para asegurar que no son incongruentes entre si. }
function TfEditPpto.fechasValidas: Boolean;
var
  fec1,fec2,fec3, fec4: TDateTime;
  condi: Boolean;
begin
// Primero se transforman todos los datos.
  fec1 := StrToDateDef(fecha_creacion.Text, 0);
  fec2 := StrToDateDef(fecha_aprobacion.Text, 0);
  fec3 := StrToDateDef(fecha_emision_f_ant.Text, 0);
  fec4 := StrToDateDef(fecha_emision_f.Text, 0);
// Determina si las fechas son válidas.
  condi := TRUE;
  if (fec2>0) then
    condi := condi and (fec1<=fec2);
  if (fec3>0) then
  begin
    condi := condi and (fec2<=fec3);
    if (fec4>0) then
      condi := condi and (fec3<=fec4);
  end
  else
    if (fec4>0) then
      condi := condi and (fec2<=fec4);
  result := condi;
end;
Esta ya me gusta más, ¡¡MUCHAS GRACIAS A TODOS!!
Responder Con Cita