Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TForm_MainPrompt.FormActivate(Sender: TObject);
begin
StatusBar1.Visible:= False;
Form_MainPrompt.Edit_CitationNumber.Text:= '';
[b]Edit_CitationNumber.SetFocus;[/b]
.....
end;
procedure TForm_MainPrompt.Edit_CitationNumberExit(Sender: TObject);
var
sImagePath, agency, num, digit: string;
agencyint, numint, digitint: integer;
begin
firsttime:= False;
citationonfile:= False;
citationonfileMisd:= False;
citationonfileTraffic:= False;
processingimage:= False;
processingimageUpdate:= False;
processingimageMisd:= False;
processingimageTraffic:= False;
Form_CitationEntry.Panel3.visible:= False;
Form_MisdemeanorEntry.Panel2.visible:= False;
err:= 'N';
Edit_CitationNumber.Color:= clWindow;
if Edit_CitationNumber.Text = ''
then Exit;
DModule.TbCitation.Active:= False;
DModule.TbCitation.Active:= True;
if SaveOnce = False
then savecitation:= Edit_CitationNumber.Text;
SaveOnce:= True;
// put Generic edits here
// CitationCheck is filled in CitationEntryValidation from screen field
CitationEntryValidation;
if Err = 'Y'
then Exit;
if DModule.TbCitation.FindKey([Edit_CitationNumber.Text])
then
begin
// this check in case duplicate cit numbers have been used by officers:
Beep;
if MessageDlg('Citation ' + Edit_CitationNumber.Text +
' is already in the system.' + #13#13 +
' Do you want to continue ?',
mtConfirmation, [mbYes, mbNo], 0) <> mrYes
then
begin
Form_MainPrompt.Edit_CitationNumber.SetFocus;
Exit;
end;
if DModule.TbScannum.FindKey([Edit_CitationNumber.Text])
then
begin
if DModule.TbImagePath.FindKey([DModule.TbScannumDOCUMENTID.Value])
then
begin
processingimageUpdate:= True;
if IsNumeric(Edit_CitationNumber.Text)
then
begin
processingimageTraffic:= True;
citationonfileTraffic:= True;
// Load traffic image into panel 3
Form_CitationEntry.Panel3.visible:= True;
sImagePath:= DModule.TbImagePathPATH.Value;
Try
Form_CitationEntry.Lead1.Load(sImagePath, 0, 0, 1);
Except
showmessage('Couldn''t find image');
End;
Form_CitationEntry.Edit_CitationNumber.Text:=
Edit_CitationNumber.Text;
// preset COMMVEH, etc.
PresetNewFields(DModule.TbCitation);
SetupTrafficImage;
StatusBar1.visible:= False;
Form_CitationEntry.Show;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end
else
begin
citationonfileMisd:= True;
processingimageMisd:= True;
// Load traffic image into panel 2
Form_MisdemeanorEntry.Panel2.visible:= True;
sImagePath:= DModule.TbImagePathPATH.Value;
Try
Form_MisdemeanorEntry.Lead1.Load(sImagePath, 0, 0, 1);
Except
showmessage('Couldn''t find image');
End;
Form_MisdemeanorEntry.Edit_CitationNumberMisd.Text:=
Edit_CitationNumber.Text;
SetupMisdemeanorImage;
StatusBar1.visible:= False;
Form_MisdemeanorEntry.Show;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end;
end;
end;
if not DModule.TbScannum.FindKey([Edit_CitationNumber.Text])
then
begin
if IsNumeric(Edit_CitationNumber.Text)
then // Traffic:
begin
citationonfileTraffic:= True;
Form_CitationEntry.Edit_CitationNumber.Text:=
Edit_CitationNumber.Text;
// preset COMMVEH and other fields:
PresetNewFields(DModule.TbCitation);
Form_CitationEntry.Panel3.visible:= False;
Form_CitationEntry.Showmodal;
StatusBar1.visible:= False;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end
else // Misdemeanor:
begin
citationonfileMisd:= True;
Form_MisdemeanorEntry.Panel2.visible:= False;
Form_MisdemeanorEntry.Edit_CitationNumberMisd.Text:=
Edit_CitationNumber.Text;
Form_MisdemeanorEntry.Showmodal;
StatusBar1.visible:= False;
Edit_CitationNumber.Text:= '';
Btn_FetchNextImage.SetFocus;
savecitation:= '';
SaveOnce:= False;
Exit;
end;
end;
end;
// not on file
// check if scanned
if not DModule.TbCitation.FindKey([Edit_CitationNumber.Text])
then
begin
Unit_Validate.CheckChgct(CitationCheck, err);
if Err = 'Y'
then
begin
ShowMessage('Citation Number Already Entered On A Case');
Edit_CitationNumber.SetFocus;
Exit;
end;
if IsNumeric(Edit_CitationNumber.Text)
then
begin
Form_CitationEntry.Edit_CitationNumber.Text:= Edit_CitationNumber.Text;
citationonfileTraffic:= False;
// extract 3 parts of citation so you can look for a unprocessed image for 3
// part citation number. check on the length
if length(Edit_CitationNumber.Text) = 15
then
begin
agency:= Copy(Edit_CitationNumber.Text, 1, 5);
num:= Copy(Edit_CitationNumber.Text, 6, 9);
digit:= Copy(Edit_CitationNumber.Text, 15, 1);
end;
if length(Edit_CitationNumber.Text) = 13
then
begin
agency:= Copy(Edit_CitationNumber.Text, 1, 5);
num:= Copy(Edit_CitationNumber.Text, 6, 7);
digit:= Copy(Edit_CitationNumber.Text, 13, 1);
end;
agencyint:= StrToInt(agency);
numint:= StrToInt(num);
digitint:= StrToInt(digit);
// Format the 3 fields in the file from the citnum field if needed
if DModule.TbScannum.FindKey([Edit_CitationNumber.Text])
then
begin
if Dmodule.TbScannumCOUNTYAGN.Value = 0
then
begin
imageid:= DModule.TbScannumDOCUMENTID.Value;
if DModule.TbAllimages.FindKey([imageid])
then
begin
if not (DModule.TbAllimages.state in [dsEdit])
then DModule.TbAllimages.Edit;
DModule.TbAllimagesCOUNTYAGN.Value:= agencyint;
DModule.TbALLimagesCITNBR9.Value:= numint;
DModule.TbAllimagesCHKDGT.Value:= digitint;
DModule.TbAllimages.Post;
end;
end;
end;
if DModule.TbScannm3.FindKey([agencyint, numint, digitint])
then
begin
// Check if already entered as 13 long since the 3 field will look the same.
// for 13 or 15 long citations.
if (DModule.TbScannm3STATUSCODE.Value = 1) and
(length(DModule.TbScannm3CITNUM.Value) = 13)
then
begin
if length(Edit_CitationNumber.Text) = 15
then
begin
ShowMessage('The Citation Was Entered w/o The 2 Zeros');
Edit_CitationNumber.SetFocus;
Edit_CitationNumber.Text:='';
Exit;
end;
end;
if (DModule.TbScannm3STATUSCODE.Value <> 5) and
(DModule.TbScannm3STATUSCODE.Value <> 8)
then
begin
processingimageTraffic:= True;
CheckForOpenScannedImage;
// preset COMMVEH and other fields:
PresetNewFields(DModule.TbScannm3);
Form_CitationEntry.Show;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end;
if (DModule.TbScannm3STATUSCODE.Value = 5) or
(DModule.TbScannm3STATUSCODE.Value = 8)
then
begin
ShowMessage('Image/Citation Has Been Inactivated');
Edit_CitationNumber.SetFocus;
Edit_CitationNumber.Text:='';
Exit;
end;
end;
// extract 3 parts of citation so you can look for a unprocessed image for 3
// part citation number. check on the length
if length(savecitation) = 15
then
begin
agency:= Copy(savecitation, 1, 5);
num:= Copy(savecitation, 6, 9);
digit:= Copy(savecitation, 15, 1);
end;
if length(savecitation) = 13
then
begin
agency:= Copy(savecitation, 1, 5);
num:= Copy(savecitation, 6, 7);
digit:= Copy(savecitation, 13, 1);
end;
agencyint:= StrToInt(agency);
numint:= StrToInt(num);
digitint:= StrToInt(digit);
// try original entry Savecitation
if DModule.TbScannm3.FindKey([agencyint, numint, digitint])
then
begin
if (DModule.TbScannm3STATUSCODE.Value <> 5) and
(DModule.TbScannm3STATUSCODE.Value <> 8)
then
begin
// from Edit_CitationNumber field
if length(Edit_CitationNumber.Text)= 15
then
begin
agency:= Copy(Edit_CitationNumber.Text, 1, 5);
num:= Copy(Edit_CitationNumber.Text, 6, 9);
digit:= Copy(Edit_CitationNumber.Text, 15, 1);
end;
if length(Edit_CitationNumber.Text) = 13
then
begin
agency:= Copy(Edit_CitationNumber.Text, 1, 5);
num:= Copy(Edit_CitationNumber.Text, 6, 7);
digit:= Copy(Edit_CitationNumber.Text, 13, 1);
end;
agencyint:= StrToInt(agency);
numint:= StrToInt(num);
digitint:= StrToInt(digit);
if not (DModule.TbScannm3.state in [dsEdit])
then DModule.TbScannm3.Edit;
{ TODO : where do these get posted? }
DModule.TbScannm3COUNTYAGN.Value:= agencyint;
DModule.TbScannm3CITNBR9.Value:= numint;
DModule.TbScannm3CHKDGT.Value:= digitint;
processingimageTraffic:= True;
CheckForOpenScannedImage;
// preset COMMVEH and other fields:
PresetNewFields(DModule.TbScannm3);
Form_CitationEntry.Show;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end;
if (DModule.TbScannm3STATUSCODE.Value = 5) or
(DModule.TbScannm3STATUSCODE.Value = 8)
then
begin
ShowMessage('Image/Citation Has Been Inactivated');
Edit_CitationNumber.SetFocus;
Edit_CitationNumber.Text:= '';
Exit;
end;
end;
// if different use update fields in cmpscancit:
[b][COLOR=red]if not DModule.TbScannm3.FindKey([agencyint, numint, digitint])[/color][/b]
then
begin
PresetToUnknown; // Preset new fields to unknown.
Form_CitationEntry.Showmodal;
StatusBar1.visible:= False;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end;
end;
if not IsNumeric(Edit_CitationNumber.Text)
then
begin
Form_MisdemeanorEntry.Edit_CitationNumberMisd.Text:=
Edit_CitationNumber.Text;
citationonfileMisd:= False;
if DModule.TbScannum.FindKey([Edit_CitationNumber.Text])
then
begin
processingimageMisd:= True;
CheckForOpenScannedImage;
Form_MisdemeanorEntry.Show;
StatusBar1.visible:= False;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end
else
begin
Form_MisdemeanorEntry.Showmodal;
StatusBar1.visible:= False;
Edit_CitationNumber.Text:= '';
savecitation:= '';
SaveOnce:= False;
Exit;
end;
end;
end;
StatusBar1.visible:= False;
Form_MainPrompt.Edit_CitationNumber.Text:= '';
Btn_FetchNextImage.SetFocus;
end;
Good luck working with R’s code. There are huge blocks that never get executed, meaningless variable names, cut and paste instead of subroutines, and worst of all, no way to test except in production. It calls various unidentified RPG programs that don’t do anything you couldn’t do with a line or two of Delphi code. (I realize you already know this, but it’s fun to rant).
I disagree. For a lot of people (if not most) there's a big, conceptual disconnect. And that makes for a lot of bad OO code, which leads to development and maintenance problems and the associated costs.If OOP is so much better, that's really the hill you have to climb in selling it. Not the logical concept of it, but more practical concerns.
And that makes for a lot of bad OO code, which leads to development and maintenance problems and the associated costs.