Procedure

TfrmPtSel.cboPatientNeedData

Module

fPtSel

Last Modified

7/15/2014 3:26:38 PM

Visibility

Public/Published

Owner

TfrmPtSel

Declaration

procedure cboPatientNeedData(Sender: TObject; const StartFrom: string;
  Direction, InsertAt: Integer);

Calls Hierarchy


TfrmPtSel.cboPatientNeedData
 ├ReadRPLPtList
 └SubSetOfPatients

Calls

Name Declaration Comments
ReadRPLPtList function ReadRPLPtList(RPLJobNumber: string; const StartFrom: string; Direction: Integer) : TStrings; -
SubSetOfPatients function SubSetOfPatients(const StartFrom: string; Direction: Integer): TStrings; -


Source

432   procedure TfrmPtSel.cboPatientNeedData(Sender: TObject; const StartFrom: string;
433     Direction, InsertAt: Integer);
434   var
435     i: Integer;
436     NoAlias, Patient: String;
437     PatientList: TStringList;
438   begin
439     NoAlias := StartFrom;
440     with Sender as TORComboBox do
441     if Items.Count > ShortCount then
442     begin
443       NoAlias := Piece(Items[Items.Count-1], U, 1) + U + NoAlias;
444       if Direction < 0 then
445         NoAlias := Copy(NoAlias, 1, Length(NoAlias) - 1);
446     end;
447     if pos(AliasString, NoAlias) > 0 then
448       NoAlias := Copy(NoAlias, 1, pos(AliasString, NoAlias) - 1);
449     PatientList := TStringList.Create;
450     try
451       begin
452         if (IsRPL  = '1') then // Restricted patient lists uses different feed for long list box:
453           FastAssign(ReadRPLPtList(RPLJob, NoAlias, Direction), PatientList)
454         else
455         begin
456           FastAssign(SubSetOfPatients(NoAlias, Direction), PatientList);
457           for i := 0 to PatientList.Count - 1 do  // Add " - Alias" to alias names:
458           begin
459             Patient := PatientList[i];
460             // Piece 6 avoids display problems when mixed with "RPL" lists:
461             if (Uppercase(Piece(Patient, U, 2)) <> Uppercase(Piece(Patient, U, 6))) then
462             begin
463               SetPiece(Patient, U, 2, Piece(Patient, U, 2) + AliasString);
464               PatientList[i] := Patient;
465             end;
466           end;
467         end;
468         cboPatient.ForDataUse(PatientList);
469       end;
470     finally
471       PatientList.Free;
472     end;
473   end;