Problema Resuelto:
Tengo lo siguiente:
MaskEdit1 = Formato(99/99/9999) es la fecha de Salida
MaskEdit2 = Formato(99/99/9999) esl la fecha de Retorno
MaskEdit3 = Formato (99:99) es la Hora de Salida
MaskEdit4 = Formato (99:99) es la hora de Retorno
Combobox1 = am ó pm del dia de salida
Combobox2 = am ó pm del dia de retorno
Edit1 = son los dias completos (que ameritan todas las comidas del dia).
Edit2 = son las horas restantes para que acabe el dia de salida
Edit3 = son las horas restantes para que acabe el dia de retorno
Edit4 = Total desayunos
Edit5 = Total Almuerzos
Edit6 = Total Cena
Button1 = Cálculos
Button2 = Cerrar
Código del Form
Código Delphi
[-]
procedure TForm1.FormCreate(Sender: TObject);
begin
MaskEdit1.Text:='';
MaskEdit2.Text:='';
MaskEdit3.Text:='';
MaskEdit4.Text:='';
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='0';
edit5.Text:='0';
edit6.Text:='0';
ComboBox1.Text:='am';
ComboBox2.Text:='am';
end;
Código del Boton Calcular
Código Delphi
[-]
procedure TForm15.Button1Click(Sender: TObject);
var
Fecha, Horas, Horae:String;
des, dest, almt, cent, alm, cen:Integer;
begin
des:=0;
alm:=0;
cen:=0;
Fecha := IntToSTr(DaysBetween(StrToDate(MaskEdit2.Text), StrToDate(MaskEdit1.Text)));
Horas := IntToSTr(HoursBetween(StrToDateTime(MaskEdit3.Text), StrToDateTime('12:00')));
Horae := IntToStr(HoursBetween(StrToDateTime(MaskEdit4.Text),StrToDateTime('12:00')));
edit1.Text:=Fecha;
edit4.Text:='0';
if ComboBox1.Text='am' then
begin
edit2.Text:=IntToStr(StrToInt(Horas)+12);
end
else
begin
edit2.Text:=IntToStr(StrToInt(Horas));
end;
if ComboBox2.Text='am' then
begin
edit3.Text:=IntToStr(StrToInt(Horae)+12);
end
else
begin
edit3.Text:=IntToStr(StrToInt(Horae));
end;
if StrToInt(edit2.Text)<=15 then
begin
des:=1;
end;
if StrToInt(edit3.Text)<=15 then
begin
des:=des+1;
end;
if StrToInt(edit2.Text)<=12 then
begin
alm:=1;
end;
if StrToInt(edit3.Text)<=12 then
begin
alm:=alm+1;
end;
if StrToInt(edit3.Text)<=6 then
begin
cen:=1;
end;
if StrToInt(edit3.Text)<=6 then
begin
cent:=cen+1;
end;
dest:=StrToInt(edit1.Text);
almt:=StrToInt(edit1.Text);
cent:=StrToInt(edit1.Text);
edit4.Text:=IntToStr(des+dest);
edit5.Text:=IntToStr(alm+almt);
edit6.Text:=IntToStr(cen+cent);
end;
Código del Boton Cerrar
Código Delphi
[-]
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
jejeje creo que me he ido por algo un tanto complicado pero fué la única forma que me surgio la solución
espero que a alguien más le sirva