Ignore:
Timestamp:
May 7, 2015, 12:34:29 PM (9 years ago)
Author:
healthsevak
Message:

Updating the working copy to CPRS version 28

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/fPrintLocation.pas

    r830 r1679  
    2525    cboEncLoc: TComboBox;
    2626    procedure pnlFieldsResize(Sender: TObject);
    27     //procedure FormCreate(Sender: TObject);
    2827    procedure orderGridMouseDown(Sender: TObject; Button: TMouseButton;
    2928      Shift: TShiftState; X, Y: Integer);
     
    3837    procedure FormResize(Sender: TObject);
    3938    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     39    procedure FormDestroy(Sender: TObject);
    4040  private
    4141    { Private declarations }
     42    CLoc,WLoc: string;
     43    CIEN,WIEN: integer;
    4244    function ValFor(FieldID, ARow: Integer): string;
    4345    procedure ShowEditor(ACol, ARow: Integer; AChar: Char);
    4446    procedure ProcessClinicOrders(WardList, ClinicList: TStringList; WardIEN, ClinicIEN: integer; ContainsIMO: boolean);
    4547    procedure rpcChangeOrderLocation(pOrderList:TStringList; ContainsIMO: boolean);
     48    function ClinicText(ALoc: integer): string;
    4649  public
    4750     { Public declarations }
    48   CLoc,WLoc: string;
    4951  CloseOK: boolean;
    5052  DisplayOrders: boolean;
     
    5355             var wardIEN: integer; var wardLocation: string; ContainsIMOOrders: boolean; displayEncSwitch: boolean = false);
    5456  procedure SwitchEncounterLoction(pEncounterLoc: integer; pEncounterLocName, pEncounterLocText: string; pEncounterDT: TFMDateTime; pEncounterVC: Char);
     57  function rpcIsPatientOnWard(Patient: string): string;
    5558  end;
    5659
     
    7376COL_LOCATION  = 2;
    7477TAB           = #9;
    75   LOCATION_CHANGE_1 = 'This patient is currently admitted to ward';
    76   LOCATION_CHANGE_2 = 'These orders are written at clinic';
    77   LOCATION_CHANGE_3 = 'What Location are these orders associated with?';
    78   LOCATION_CHANGE_4 = 'The encounter location is currently at clinic';
     78  LOCATION_CHANGE_1  = 'The patient is admitted to ward';
     79  LOCATION_CHANGE_2  = 'You have the chart open to a clinic location of';
     80  LOCATION_CHANGE_2W = 'You have the chart open with the patient still on ward';
     81  LOCATION_CHANGE_3  = 'What Location are these orders associated with?';
     82  LOCATION_CHANGE_4  = 'The patient has now been admitted to ward: ';
    7983
    8084
     
    179183end;
    180184
     185procedure TfrmPrintLocation.FormDestroy(Sender: TObject);
     186begin
     187  inherited;
     188  frmPrintLocation := nil;
     189end;
     190
    181191procedure TfrmPrintLocation.FormResize(Sender: TObject);
    182192begin
     
    185195end;
    186196
    187 (*procedure TfrmPrintLocation.FormCreate(Sender: TObject);
    188 var
    189   ListCount: Integer;
    190   x: string;
    191 begin
    192    inherited;
    193    with OrderGrid do
    194      begin
    195        ColWidths[0] := 8;
    196        ColWidths[1] := 50;
    197        ColWidths[2] := 50;
    198        Cells[1,0] := 'Order';
    199        Cells[2,0] := 'Location';
    200      end;
    201    //TAccessibleStringGrid.WrapControl(OrderGrid);
    202 
    203 end;  *)
     197function TfrmPrintLocation.ClinicText(ALoc: integer): string;
     198begin
     199  if SCallV('ORIMO ISCLOC', [ALoc]) = '1' then Result := LOCATION_CHANGE_2
     200  else Result := LOCATION_CHANGE_2W
     201end;
    204202
    205203procedure TfrmPrintLocation.OrderGridDrawCell(Sender: TObject; ACol,
     
    251249        if frmPrintLocation.DisplayOrders = false then
    252250          begin
    253             lblText.Caption := lblText.Caption + LOCATION_CHANGE_4 + ': ' + frmPrintLocation.CLoc + CRLF;
     251            if frmPrintlocation.CLoc = '' then
     252              begin
     253                lblText.Caption := LOCATION_CHANGE_4 + frmPrintLocation.WLoc + CRLF;
     254                cboEncLoc.Enabled := false;
     255                lblEncounter.Enabled := false;
     256              end
     257            else lblText.Caption := lblText.Caption + ClinicText(frmPrintLocation.CIEN) + ': ' + frmPrintLocation.CLoc + CRLF;
    254258            btnClinic.Visible := false;
    255259            btnWard.Visible := false;
     
    265269        else
    266270          begin
    267             lblText.Caption := lblText.Caption + LOCATION_CHANGE_2 + ': ' + frmPrintLocation.CLoc + CRLF + CRLF;
     271            lblText.Caption := lblText.Caption + ClinicText(frmPrintLocation.CIEN) + ': ' + frmPrintLocation.CLoc + CRLF + CRLF;
    268272            lblText.Caption := lblText.Caption + LOCATION_CHANGE_3;
    269             lblText.Caption := lblText.Caption + CRLF + 'One clinic location allowed; ' + frmPrintLocation.CLoc + ' will be used';
     273            //lblText.Caption := lblText.Caption + CRLF + 'One clinic location allowed; ' + frmPrintLocation.CLoc + ' will be used';
    270274            btnClinic.Caption := 'All ' + frmPrintLocation.CLoc;
    271275            btnWard.Caption := 'All ' + frmPrintLocation.WLoc;
     
    335339begin
    336340  frmPrintLocation := TfrmPrintLocation.Create(Application);
     341  try
    337342  frmPrintLocation.DisplayOrders := true;
    338343  frmPrintLocation.CloseOK := false;
     
    345350  frmPrintLocation.Cloc := pEncounterLocName;
    346351  frmPrintLocation.WLoc := WardLocation;
     352  frmPrintLocation.CIEN := pEncounterLoc;
     353  frmPrintLocation.WIEN := wardIEN;
    347354  ResizeAnchoredFormToFont(frmPrintLocation);
    348355  frmPrintLocation.orderGrid.DefaultRowHeight := frmPrintLocation.cbolocation.Height;
     
    369376  if frmPrintLocation.cboEncLoc.ItemIndex = cidx then
    370377    begin
    371       //Encounter.Location := pEncounterLoc;
    372       //Encounter.LocationName := pEncounterLocName;
    373       //Encounter.LocationText := pEncounterLocText;
    374378      uCore.Encounter.EncounterSwitch(pEncounterLoc, pEncounterLocName, pEncounterLocText, pEncounterDT, pEncounterVC);
    375379      fframe.frmFrame.DisplayEncounterText;
    376       //fframe.frmFrame.DoNotChangeEncWindow := true;
    377380      fframe.frmFrame.OrderPrintForm := True;
    378381    end
    379382  else if frmPrintLocation.cboEncLoc.ItemIndex = widx then
    380383    begin
    381     uCore.Encounter.EncounterSwitch(WardIEN, WardLocation, '', Patient.AdmitTime, 'H');
    382    (* Encounter.Location := WardIEN;
    383     Encounter.DateTime := Patient.AdmitTime;
    384     Encounter.VisitCategory := 'H';
    385     Encounter.Location := WardIEN;
    386     Encounter.LocationName := WardLocation; *)
    387       //fframe.frmFrame.DoNotChangeEncWindow := false;
     384    uCore.Encounter.EncounterSwitch(WardIEN, WardLocation, WardLocation, Patient.AdmitTime, 'H');
    388385      fFrame.frmFrame.DisplayEncounterText;
    389386    end;
    390   frmPrintLocation.Close;
     387  finally
     388   frmPrintLocation.Destroy;
     389  end;
    391390end;
    392391
     
    422421
    423422
     423function TfrmPrintLocation.rpcIsPatientOnWard(Patient: string): string;
     424begin
     425  //Ward Loction Name^Ward Location IEN
     426  result := sCallV('ORWDX1 PATWARD',[Patient]);
     427end;
     428
    424429procedure TfrmPrintLocation.ShowEditor(ACol, ARow: Integer; AChar: Char);
    425430var
    426431  tmpText: string;
    427   //Index: integer;
    428432
    429433  procedure PlaceControl(AControl: TWinControl);
     
    455459begin
    456460  inherited;
    457   //if AChar = ' ' then AChar := #0;
    458461  if ARow = 0 then Exit;
    459   //with OrderGrid do if (Acol > COL_ORDER) and (ValFor(COL_ORDER, ARow) = '') then Exit;
    460   //if (ACol = COL_Order) and (ARow > 1) and (ValFor(COL_Order, ARow-1) = '') then Exit;
    461462  Case ACol of
    462463  COL_LOCATION: begin
     
    475476Asvc, WardLocation: string;
    476477begin
    477   //frmPrintLocation.Caption := 'Refresh Encounter Location Form';
    478478  frmPrintLocation := TfrmPrintLocation.Create(Application);
     479  try
    479480  frmPrintLocation.DisplayOrders := false;
    480481  frmPrintLocation.CloseOK := false;
     
    484485  frmPrintLocation.Cloc := pEncounterLocName;
    485486  frmPrintLocation.WLoc := WardLocation;
     487  frmPrintLocation.CIEN := pEncounterLoc;
     488  frmPrintLocation.WIEN := wardIEN;
    486489  ResizeAnchoredFormToFont(frmPrintLocation);
    487490  frmPrintLocation.cboEncLoc.Items.Add(frmPrintLocation.CLoc);
     
    491494  cidx := frmPrintLocation.cboEncLoc.Items.IndexOf(frmPrintLocation.CLoc);
    492495  widx := frmPrintLocation.cboEncLoc.Items.IndexOf(frmPrintLocation.WLoc);
     496  if frmPrintLocation.cboEncLoc.Enabled = FALSE then frmPrintLocation.cboEncLoc.ItemIndex := widx;
     497 
    493498  if frmPrintLocation.cboEncLoc.ItemIndex = cidx then
    494499    begin
     
    497502      Encounter.LocationText := pEncounterLocText;
    498503      fframe.frmFrame.DisplayEncounterText;
    499       //fframe.frmFrame.DoNotChangeEncWindow := true;
    500504    end
    501505  else if frmPrintLocation.cboEncLoc.ItemIndex = widx then
    502506    begin
    503507      uCore.Encounter.EncounterSwitch(WardIEN, WardLocation, '', Patient.AdmitTime, 'H');
    504       (*Encounter.Location := WardIEN;
    505       Encounter.LocationName := WardLocation; *)
    506       //fframe.frmFrame.DoNotChangeEncWindow := false;
    507508      fFrame.frmFrame.DisplayEncounterText;
    508509    end;
    509   frmPrintLocation.Close;
     510  finally
     511    frmPrintLocation.Destroy;
     512  end;
    510513end;
    511514
Note: See TracChangeset for help on using the changeset viewer.