Procedure

TfrmODChangeUnreleasedRenew.btnOKClick

Module

fODChangeUnreleasedRenew

Last Modified

7/15/2014 3:26:40 PM

Visibility

Public/Published

Owner

TfrmODChangeUnreleasedRenew

Declaration

procedure btnOKClick(Sender: TObject);


Source

139   procedure TfrmODChangeUnreleasedRenew.btnOKClick(Sender: TObject);
140   var
141     NumRefills: Integer;
142     x, ErrMsg: string;
143   begin
144     inherited;
145     if panel2.Visible then
146     begin
147       NumRefills := StrToIntDef(edtRefill.Text, -1);
148       if (NumRefills < 0) or (NumRefills > MaxRefills) then
149       begin
150         InfoBox(TX_ERR_REFILL + IntToStr(MaxRefills), TC_ERR_REFILL, MB_OK);
151         Exit;
152       end;
153     end
154     else if panel3.Visible then
155     begin
156       ErrMsg := '';
157       txtStart.Validate(x);
158       if Length(x) > 0   then ErrMsg := ErrMsg + TX_BAD_START + CRLF;
159       with txtStop do
160       begin
161         Validate(x);
162         if Length(x) > 0 then ErrMsg := ErrMsg + TX_BAD_STOP + CRLF;
163         if (Length(Text) > 0) and (FMDateTime <= txtStart.FMDateTime)
164                          then ErrMsg := ErrMsg + TX_STOPSTART;
165       end;
166       if Length(ErrMsg) > 0 then
167       begin
168         InfoBox(ErrMsg, TC_INVALID_DATE, MB_OK);
169         Exit;
170       end;
171     end;
172     OKPressed := True;
173     Close;
174   end;