Procedure

TfrmODBBank.calWantTimeChange

Module

fODBBank

Last Modified

7/15/2014 3:26:40 PM

Visibility

Public/Published

Owner

TfrmODBBank

Declaration

procedure calWantTimeChange(Sender: TObject);

Calls Hierarchy


TfrmODBBank.calWantTimeChange
 ├FMNow
 ├TResponses.Update
 │ ├TResponses.FindResponseByName
 │ └TResponses.IENForPrompt
 ├TfrmODBBank.ValidCollTime
 │ └StrToFMDateTime
 ├TResponses.GetOrderText
 │ ├TResponses.NextInstance
 │ ├TResponses.FindResponseByName
 │ ├TResponses.FormatResponse
 │ │ └TResponses.FindResponseByIEN
 │ └TResponses.AppendChildren
 │   ├TResponses.FindPromptByIEN
 │   ├TResponses.FindResponseByIEN
 │   └TResponses.FormatResponse...
 ├TfrmODBBank.ExtractSpecimen
 ├TfrmODBBank.ExtractSpecimens
 └TfrmODBBank.SpecimenNeeded
   └TfrmODBBank.ExtractSpecimen

Calls

Name Declaration Comments
TfrmODBBank.ExtractSpecimen procedure ExtractSpecimen(OutList:TStrings; AList:TStrings); -
TfrmODBBank.ExtractSpecimens procedure ExtractSpecimens(OutList:TStrings; AList:TStrings); -
FMNow function FMNow: TFMDateTime; -
TResponses.GetOrderText function GetOrderText: string; -
TfrmODBBank.SpecimenNeeded function SpecimenNeeded(OutList:TStrings; AList:TStrings; CompID:integer): Boolean; -
TResponses.Update procedure Update(const APromptID: string; AnInstance: Integer; const AnIValue, AnEValue: string); -
TfrmODBBank.ValidCollTime function ValidCollTime(UserEntry: string): string; -


Source

3886  procedure TfrmODBBank.calWantTimeChange(Sender: TObject);
3887  var
3888    i: integer;
3889    aList: TStringList;
3890    aSpecimen, aSpecimenUID, aSpecimenReq: string;
3891    aChanging: Boolean;
3892  begin
3893    inherited;
3894    aList := TStringList.Create;
3895    aChanging := changing;
3896    try
3897    aSpecimen := '';
3898    aSpecimenUID := '';
3899    aSpecimenReq := '';
3900    if uSelectedItems.Count > 0 then
3901      begin
3902        with calWantTime do if not changing then
3903          begin
3904            if FMDateTime = 0 then
3905              begin
3906                ShowMsg('Invalid Date/Time entered');
3907                changing := true;
3908                calWantTime.Text := '';
3909                changing := aChanging;
3910                Exit;
3911              end
3912            else
3913              begin
3914                // date/time was entered
3915                if (UpperCase(Text) <> 'NOW') and not(Trunc(FMNow) = Trunc(FMDateTime)) and (FMDateTime < FMNow) then
3916                  begin
3917                    ShowMsg('Date/Time Wanted must be a future Date/Time');
3918                    changing := true;
3919                    calWantTime.Text := '';
3920                    changing := aChanging;
3921                    Exit;
3922                  end;
3923              end;
3924          end;
3925        if Length(calWantTime.Text) > 0 then Responses.Update('DATETIME',1,ValidCollTime(calWantTime.Text),calWantTime.Text);
3926        memOrder.Text := Responses.OrderText;
3927        aList.Clear;
3928        ExtractSpecimen(aList, uVBECList);
3929        if aList.Count > 0 then
3930        begin
3931          aSpecimen := piece(aList[0], '^', 1);
3932          aSpecimenUID := piece(aList[0], '^', 2);
3933        end;
3934        aList.Clear;
3935        ExtractSpecimens(aList, uVBECList);    //Get specimen values to pass back to Server
3936        for i := 0 to aList.Count - 1 do
3937          begin
3938            if (StrToInt(piece(aList[i],'^',1)) = aLabTest.ItemID) then
3939              begin
3940                aSpecimenReq := piece(aList[i],'^',2);
3941                if (SpecimenNeeded(aList, uVBECList, aLabTest.ItemID)) then
3942                  aSpecimenUID := '';
3943                break;
3944              end;
3945          end;
3946        Responses.Update('SPECSTS', 1, aSpecimenReq + '^' + aSpecimen + '^' + aSpecimenUID, aSpecimenReq);
3947      end;
3948    finally
3949      aList.Free;
3950    end;
3951  end;