Projeto lan Rotinas
procedure TForm1.imprime_entra();
begin
DATA:=DATE;
AssignFile(F,'LPT1');
Rewrite(F);
Writeln(F,'A S S I S T E L L A N H O U S E');
Writeln(F,'Rua Lagoa Mangueira 19');
Writeln(F,'Fone: 3434-2990');
Writeln(F,'');
Writeln(F,DATETOSTR(DATA));
Writeln(F,'');
Writeln(F,'P C = 0'+INTTOSTR(PC));
Writeln(F,'');
Writeln(F,'');
Writeln(F,'ENTRA SAI TEMPO');
Writeln(F,FORMATDATETIME('HH:MM',ENTRA)+' '+FORMATDATETIME('HH:MM',SAI)+' '+FORMATDATETIME('HH:MM',TEMPO));
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
Writeln(F,'');
CloseFile(F);
end;
procedure TForm1.zeravariaveis();
begin
incpc:=0;
contador:=0;
tempo:=strtotime('00:00:00');
end;
procedure TForm1.registratempo();
begin
if incpc = 1 then label1.Caption:=timetostr(tempo);
if incpc = 2 then label2.Caption:=timetostr(tempo);
if incpc = 3 then label3.Caption:=timetostr(tempo);
if incpc = 4 then label4.Caption:=timetostr(tempo);
if incpc = 5 then label5.Caption:=timetostr(tempo);
if incpc = 6 then label6.Caption:=timetostr(tempo);
if incpc = 7 then label7.Caption:=timetostr(tempo);
if incpc = 8 then label8.Caption:=timetostr(tempo);
if incpc = 9 then label9.Caption:=timetostr(tempo);
if incpc = 10 then label10.Caption:=timetostr(tempo);
end;
procedure TForm1.inctempo();
begin
if incpc > 0 then
begin
tempo:=tempo+ strtotime('00:01:00');
contador:=contador+60;
registratempo();
end;
end;
procedure TForm1.dectempo();
begin
if incpc > 0 then
begin
if contador > 0 then
begin
tempo:=tempo - strtotime('00:01:00');
contador:=contador - 60;
registratempo();
end;
end;
end;
procedure TForm1.registrapc1();
begin
hora:=time;
tempopc1:=tempo;
entrapc1:=hora;
saipc1:=entrapc1 + tempopc1;
contatempopc1 := tempo;
contadorpc1 := contador;
timer1.enabled:=true;
zeracorpc();
entra:=entrapc1;
sai:=saipc1;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc2();
begin
hora:=time;
tempopc2:=tempo;
entrapc2:=hora;
saipc2:=entrapc2 + tempopc2;
contatempopc2 := tempo;
contadorpc2 := contador;
timer2.enabled:=true;
zeracorpc();
entra:=entrapc2;
sai:=saipc2;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc3();
begin
hora:=time;
tempopc3:=tempo;
entrapc3:=hora;
saipc3:=entrapc3 + tempopc3;
contatempopc3 := tempo;
contadorpc3 := contador;
timer3.enabled:=true;
zeracorpc();
entra:=entrapc3;
sai:=saipc3;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc4();
begin
hora:=time;
tempopc4:=tempo;
entrapc4:=hora;
saipc4:=entrapc4 + tempopc4;
contatempopc4 := tempo;
contadorpc4 := contador;
timer4.enabled:=true;
zeracorpc();
entra:=entrapc4;
sai:=saipc4;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc5();
begin
hora:=time;
tempopc5:=tempo;
entrapc5:=hora;
saipc5:=entrapc5 + tempopc5;
contatempopc5 := tempo;
contadorpc5 := contador;
timer5.enabled:=true;
zeracorpc();
entra:=entrapc5;
sai:=saipc5;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc6();
begin
hora:=time;
tempopc6:=tempo;
entrapc6:=hora;
saipc6:=entrapc6 + tempopc6;
contatempopc6 := tempo;
contadorpc6 := contador;
timer6.enabled:=true;
zeracorpc();
entra:=entrapc6;
sai:=saipc6;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc7();
begin
hora:=time;
tempopc7:=tempo;
entrapc7:=hora;
saipc7:=entrapc7 + tempopc7;
contatempopc7 := tempo;
contadorpc7 := contador;
timer7.enabled:=true;
zeracorpc();
entra:=entrapc7;
sai:=saipc7;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc8();
begin
hora:=time;
tempopc8:=tempo;
entrapc8:=hora;
saipc8:=entrapc8 + tempopc8;
contatempopc8 := tempo;
contadorpc8 := contador;
timer8.enabled:=true;
zeracorpc();
entra:=entrapc8;
sai:=saipc8;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc9();
begin
hora:=time;
tempopc9:=tempo;
entrapc9:=hora;
saipc9:=entrapc9 + tempopc9;
contatempopc9 := tempo;
contadorpc9 := contador;
timer9.enabled:=true;
zeracorpc();
entra:=entrapc9;
sai:=saipc9;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registrapc10();
begin
hora:=time;
tempopc10:=tempo;
entrapc10:=hora;
saipc10:=entrapc10 + tempopc10;
contatempopc10 := tempo;
contadorpc10 := contador;
timer10.enabled:=true;
zeracorpc();
entra:=entrapc10;
sai:=saipc10;
data:=date;
pc:=incpc;
imprime_entra();
zeravariaveis();
end;
procedure TForm1.registra();
begin
if incpc = 1 then registrapc1();
if incpc = 2 then registrapc2();
if incpc = 3 then registrapc3();
if incpc = 4 then registrapc4();
if incpc = 5 then registrapc5();
if incpc = 6 then registrapc6();
if incpc = 7 then registrapc7();
if incpc = 8 then registrapc8();
if incpc = 9 then registrapc9();
if incpc = 10 then registrapc10();
end;
procedure TForm1.zeracorpc();
begin
panel11.Color:=clmaroon;
panel12.Color:=clmaroon;
panel13.Color:=clmaroon;
panel14.Color:=clmaroon;
panel15.Color:=clmaroon;
panel16.Color:=clmaroon;
panel17.Color:=clmaroon;
panel18.Color:=clmaroon;
panel19.Color:=clmaroon;
panel20.Color:=clmaroon;
end;
procedure TForm1.incmenupc();
begin
zeracorpc();
if incpc = 1 then panel11.Color:=clyellow;
if incpc = 2 then panel12.Color:=clyellow;
if incpc = 3 then panel13.Color:=clyellow;
if incpc = 4 then panel14.Color:=clyellow;
if incpc = 5 then panel15.Color:=clyellow;
if incpc = 6 then panel16.Color:=clyellow;
if incpc = 7 then panel17.Color:=clyellow;
if incpc = 8 then panel18.Color:=clyellow;
if incpc = 9 then panel19.Color:=clyellow;
if incpc =10 then panel20.Color:=clyellow;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = 39 then incpc:=incpc+1;
if key = 37 then incpc:=incpc-1;
if key = 38 then incpc:=incpc-5;
if key = 40 then incpc:=incpc+5;
if incpc < 1 then incpc :=1;
if incpc > 10 then incpc :=10;
incmenupc();
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then registra();
if key = '+' then inctempo();
if key = '-' then dectempo();
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
contatempopc1:=contatempopc1 - strtotime('00:00:01');
contadorpc1:=contadorpc1 - 1;
label1.Caption:=timetostr(contatempopc1);
if contadorpc1 = 0 then
begin
timer1.Enabled:=false;
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
contatempopc2:=contatempopc2 - strtotime('00:00:01');
contadorpc2:=contadorpc2 - 1;
label2.Caption:=timetostr(contatempopc2);
if contadorpc2 = 0 then
begin
timer2.Enabled:=false;
end;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
contatempopc3:=contatempopc3 - strtotime('00:00:01');
contadorpc3:=contadorpc3 - 1;
label3.Caption:=timetostr(contatempopc3);
if contadorpc3 = 0 then
begin
timer3.Enabled:=false;
end;
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
contatempopc4:=contatempopc4 - strtotime('00:00:01');
contadorpc4:=contadorpc4 - 1;
label4.Caption:=timetostr(contatempopc4);
if contadorpc4 = 0 then
begin
timer4.Enabled:=false;
end;
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
contatempopc5:=contatempopc5 - strtotime('00:00:01');
contadorpc5:=contadorpc5 - 1;
label5.Caption:=timetostr(contatempopc5);
if contadorpc5 = 0 then
begin
timer5.Enabled:=false;
end;
end;
procedure TForm1.Timer6Timer(Sender: TObject);
begin
contatempopc6:=contatempopc6 - strtotime('00:00:01');
contadorpc6:=contadorpc6 - 1;
label6.Caption:=timetostr(contatempopc6);
if contadorpc6 = 0 then
begin
timer6.Enabled:=false;
end;
end;
procedure TForm1.Timer7Timer(Sender: TObject);
begin
contatempopc7:=contatempopc7 - strtotime('00:00:01');
contadorpc7:=contadorpc7 - 1;
label7.Caption:=timetostr(contatempopc7);
if contadorpc7 = 0 then
begin
timer7.Enabled:=false;
end;
end;
procedure TForm1.Timer8Timer(Sender: TObject);
begin
contatempopc8:=contatempopc8 - strtotime('00:00:01');
contadorpc8:=contadorpc8 - 1;
label8.Caption:=timetostr(contatempopc8);
if contadorpc8 = 0 then
begin
timer8.Enabled:=false;
end;
end;
procedure TForm1.Timer9Timer(Sender: TObject);
begin
contatempopc9:=contatempopc9 - strtotime('00:00:01');
contadorpc9:=contadorpc9 - 1;
label9.Caption:=timetostr(contatempopc9);
if contadorpc9 = 0 then
begin
timer9.Enabled:=false;
end;
end;
procedure TForm1.Timer10Timer(Sender: TObject);
begin
contatempopc10:=contatempopc10 - strtotime('00:00:01');
contadorpc10:=contadorpc10 - 1;
label10.Caption:=timetostr(contatempopc10);
if contadorpc10 = 0 then
begin
timer10.Enabled:=false;
end;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
timer1.Enabled:=false;
timer2.Enabled:=false;
timer3.Enabled:=false;
timer4.Enabled:=false;
timer5.Enabled:=false;
timer6.Enabled:=false;
timer7.Enabled:=false;
timer8.Enabled:=false;
timer9.Enabled:=false;
timer10.Enabled:=false;
end;