Procedure

ValidateSchedule

Module

fODMedNVA

Last Modified

7/15/2014 3:26:42 PM

Scope

Local

Local subprogram to

Validate

Declaration

procedure ValidateSchedule(const x: string; AnInstance: Integer);

Calls Hierarchy


ValidateSchedule
 ├TfrmODMedNVA.ValueOfResponse
 │ └TResponses.IValueFor
 ├ValidSchedule
 └SetError

Calls

Name Declaration Comments
SetError procedure SetError(const x: string); -
ValidSchedule function ValidSchedule(const x: string; PSType: Char = 'I'): Integer; -
TfrmODMedNVA.ValueOfResponse function ValueOfResponse(FieldID: Integer; AnInstance: Integer = 1): string; -


Source

501     procedure ValidateSchedule(const x: string; AnInstance: Integer);
502     const
503       SCH_BAD = 0;
504       SCH_NO_RTN = -1;
505     var
506       ValidLevel: Integer;
507       ARoute, ADrug: string;
508     begin
509       ARoute := ValueOfResponse(FLD_ROUTE_ID, AnInstance);
510       ADrug  := ValueOfResponse(FLD_DRUG_ID,  AnInstance);
511    {  if (Length(x) = 0) and (not FNonVADlg) then SetError(TX_NO_SCHED)
512       else if (Length(x) = 0) and FNonVADlg and ScheduleRequired(txtMed.Tag, ARoute, ADrug)
513       then SetError(TX_NO_SCHED);
514   }
515       if Length(x) > 0 then
516       begin
517         ValidLevel := ValidSchedule(x, 'O');
518         if ValidLevel = SCH_NO_RTN then
519         begin
520           if Pos('"', x) > 0                              then SetError(TX_SCH_QUOTE);
521           if Copy(x, 1, 1) = '-'                          then SetError(TX_SCH_MINUS);
522           if Pos(' ', Copy(x, Pos(' ', x) + 1, 999)) > 0  then SetError(TX_SCH_SPACE);
523           if Length(x) > 70                               then SetError(TX_SCH_LEN);
524           if (Pos('P RN', x) > 0) or (Pos('PR N', x) > 0) then SetError(TX_SCH_PRN);
525           if Pos('Q0', x) > 0                             then SetError(TX_SCH_ZERO);
526           if TrimLeft(x) <> x                             then SetError(TX_SCH_LSP);
527         end;
528         if ValidLevel = SCH_BAD then SetError(TX_SCH_NS);
529       end;
530     end;