[456] | 1 | unit fProcedure;
|
---|
[829] | 2 | {Warning: The tab order has been changed in the OnExit event of several controls.
|
---|
| 3 | To change the tab order of lbSection, lbxSection, lbMods, and btnOther you must do it programatically.}
|
---|
[456] | 4 |
|
---|
| 5 | interface
|
---|
| 6 |
|
---|
| 7 | uses
|
---|
| 8 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 9 | fPCEBase, StdCtrls, ComCtrls, CheckLst, ORCtrls, ExtCtrls, Buttons, uPCE, rPCE, ORFn,
|
---|
[829] | 10 | fPCELex, fPCEOther, fPCEBaseGrid, fPCEBaseMain, VA508AccessibilityManager;
|
---|
[456] | 11 |
|
---|
| 12 | type
|
---|
| 13 | TfrmProcedures = class(TfrmPCEBaseMain)
|
---|
| 14 | lblProcQty: TLabel;
|
---|
| 15 | spnProcQty: TUpDown;
|
---|
| 16 | txtProcQty: TCaptionEdit;
|
---|
| 17 | lbMods: TORListBox;
|
---|
| 18 | splRight: TSplitter;
|
---|
| 19 | lblMod: TLabel;
|
---|
| 20 | cboProvider: TORComboBox;
|
---|
| 21 | lblProvider: TLabel;
|
---|
| 22 | procedure txtProcQtyChange(Sender: TObject);
|
---|
| 23 | procedure FormCreate(Sender: TObject);
|
---|
| 24 | procedure FormResize(Sender: TObject); override;
|
---|
| 25 | procedure splRightMoved(Sender: TObject);
|
---|
| 26 | procedure clbListClick(Sender: TObject);
|
---|
| 27 | procedure lbGridSelect(Sender: TObject);
|
---|
| 28 | procedure btnSelectAllClick(Sender: TObject);
|
---|
| 29 | procedure lbModsClickCheck(Sender: TObject; Index: Integer);
|
---|
| 30 | procedure lbSectionClick(Sender: TObject);
|
---|
| 31 | procedure lbxSectionClickCheck(Sender: TObject; Index: Integer);
|
---|
| 32 | procedure btnOtherClick(Sender: TObject);
|
---|
| 33 | procedure btnRemoveClick(Sender: TObject);
|
---|
| 34 | procedure cboProviderNeedData(Sender: TObject; const StartFrom: String;
|
---|
| 35 | Direction, InsertAt: Integer);
|
---|
| 36 | procedure cboProviderChange(Sender: TObject);
|
---|
[829] | 37 | procedure lbxSectionExit(Sender: TObject);
|
---|
| 38 | procedure lbModsExit(Sender: TObject);
|
---|
| 39 | procedure btnOtherExit(Sender: TObject);
|
---|
[456] | 40 | private
|
---|
| 41 | FCheckingCode: boolean;
|
---|
| 42 | FCheckingMods: boolean;
|
---|
| 43 | FLastCPTCodes: string;
|
---|
| 44 | FModsReadOnly: boolean;
|
---|
[829] | 45 | FProviderChanging: boolean;
|
---|
[456] | 46 | FModsROChecked: string;
|
---|
| 47 | function MissingProvider: boolean;
|
---|
| 48 | protected
|
---|
| 49 | procedure UpdateNewItemStr(var x: string); override;
|
---|
| 50 | procedure UpdateControls; override;
|
---|
| 51 | procedure ShowModifiers;
|
---|
| 52 | procedure CheckModifiers;
|
---|
| 53 | public
|
---|
| 54 | function OK2SaveProcedures: boolean;
|
---|
| 55 | procedure InitTab(ACopyProc: TCopyItemsMethod; AListProc: TListSectionsProc);
|
---|
| 56 | end;
|
---|
| 57 |
|
---|
| 58 | var
|
---|
| 59 | frmProcedures: TfrmProcedures;
|
---|
| 60 |
|
---|
| 61 | implementation
|
---|
| 62 |
|
---|
| 63 | {$R *.DFM}
|
---|
| 64 |
|
---|
| 65 | uses
|
---|
[829] | 66 | fEncounterFrame, uConst, rCore, VA508AccessibilityRouter;
|
---|
[456] | 67 |
|
---|
| 68 | const
|
---|
| 69 | TX_PROC_PROV = 'Each procedure requires selection of a Provider before it can be saved.';
|
---|
| 70 | TC_PROC_PROV = 'Missing Procedure Provider';
|
---|
| 71 |
|
---|
| 72 | procedure TfrmProcedures.txtProcQtyChange(Sender: TObject);
|
---|
| 73 | var
|
---|
| 74 | i: integer;
|
---|
| 75 |
|
---|
| 76 | begin
|
---|
| 77 | if(NotUpdating) then
|
---|
| 78 | begin
|
---|
| 79 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 80 | if(lbGrid.Selected[i]) then
|
---|
| 81 | TPCEProc(lbGrid.Items.Objects[i]).Quantity := spnProcQty.Position;
|
---|
| 82 | GridChanged;
|
---|
| 83 | end;
|
---|
| 84 | end;
|
---|
| 85 |
|
---|
| 86 | procedure TfrmProcedures.cboProviderChange(Sender: TObject);
|
---|
| 87 | var
|
---|
| 88 | i: integer;
|
---|
| 89 | begin
|
---|
| 90 | inherited;
|
---|
| 91 | if(NotUpdating) then
|
---|
| 92 | begin
|
---|
| 93 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 94 | if(lbGrid.Selected[i]) then
|
---|
| 95 | TPCEProc(lbGrid.Items.Objects[i]).Provider := cboProvider.ItemIEN;
|
---|
[829] | 96 | FProviderChanging := TRUE; // CQ 11707
|
---|
| 97 | try
|
---|
| 98 | GridChanged;
|
---|
| 99 | finally
|
---|
| 100 | FProviderChanging := FALSE;
|
---|
| 101 | end;
|
---|
[456] | 102 | end;
|
---|
| 103 | end;
|
---|
| 104 |
|
---|
| 105 | procedure TfrmProcedures.FormCreate(Sender: TObject);
|
---|
| 106 | begin
|
---|
| 107 | inherited;
|
---|
| 108 | FTabName := CT_ProcNm;
|
---|
| 109 | FPCEListCodesProc := ListProcedureCodes;
|
---|
| 110 | cboProvider.InitLongList(uProviders.PCEProviderName);
|
---|
| 111 | FPCEItemClass := TPCEProc;
|
---|
| 112 | FPCECode := 'CPT';
|
---|
| 113 | FSectionTabCount := 1;
|
---|
| 114 | FormResize(Self);
|
---|
[829] | 115 | lbMods.HideSelection := TRUE;
|
---|
[456] | 116 | end;
|
---|
| 117 |
|
---|
| 118 | procedure TfrmProcedures.UpdateNewItemStr(var x: string);
|
---|
| 119 | begin
|
---|
| 120 | SetPiece(x, U, pnumProcQty, '1');
|
---|
| 121 | //x := x + U + '1';
|
---|
| 122 | end;
|
---|
| 123 |
|
---|
| 124 | procedure TfrmProcedures.UpdateControls;
|
---|
| 125 | var
|
---|
| 126 | ok, First: boolean;
|
---|
| 127 | SameQty: boolean;
|
---|
| 128 | SameProv: boolean;
|
---|
| 129 | i: integer;
|
---|
| 130 | Qty: integer;
|
---|
| 131 | Prov: int64;
|
---|
| 132 | Obj: TPCEProc;
|
---|
| 133 |
|
---|
| 134 | begin
|
---|
| 135 | inherited;
|
---|
| 136 | if(NotUpdating) then
|
---|
| 137 | begin
|
---|
| 138 | BeginUpdate;
|
---|
| 139 | try
|
---|
| 140 | ok := (lbGrid.SelCount > 0);
|
---|
| 141 | lblProcQty.Enabled := ok;
|
---|
| 142 | txtProcQty.Enabled := ok;
|
---|
| 143 | spnProcQty.Enabled := ok;
|
---|
| 144 | cboProvider.Enabled := ok;
|
---|
| 145 | lblProvider.Enabled := ok;
|
---|
| 146 | if(ok) then
|
---|
| 147 | begin
|
---|
| 148 | First := TRUE;
|
---|
| 149 | SameQty := TRUE;
|
---|
| 150 | SameProv := TRUE;
|
---|
| 151 | Prov := 0;
|
---|
| 152 | Qty := 1;
|
---|
| 153 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 154 | begin
|
---|
| 155 | if lbGrid.Selected[i] then
|
---|
| 156 | begin
|
---|
| 157 | Obj := TPCEProc(lbGrid.Items.Objects[i]);
|
---|
| 158 | if(First) then
|
---|
| 159 | begin
|
---|
| 160 | First := FALSE;
|
---|
| 161 | Qty := Obj.Quantity;
|
---|
| 162 | Prov := Obj.Provider;
|
---|
| 163 | end
|
---|
| 164 | else
|
---|
| 165 | begin
|
---|
| 166 | if(SameQty) then
|
---|
| 167 | SameQty := (Qty = Obj.Quantity);
|
---|
| 168 | if(SameProv) then
|
---|
| 169 | SameProv := (Prov = Obj.Provider);
|
---|
| 170 | end;
|
---|
| 171 | end;
|
---|
| 172 | end;
|
---|
| 173 | if(SameQty) then
|
---|
| 174 | begin
|
---|
| 175 | spnProcQty.Position := Qty;
|
---|
| 176 | txtProcQty.Text := IntToStr(Qty);
|
---|
| 177 | txtProcQty.SelStart := length(txtProcQty.Text);
|
---|
| 178 | end
|
---|
| 179 | else
|
---|
| 180 | begin
|
---|
| 181 | spnProcQty.Position := 1;
|
---|
| 182 | txtProcQty.Text := '';
|
---|
| 183 | end;
|
---|
[829] | 184 | if not FProviderChanging then // CQ 11707
|
---|
| 185 | begin
|
---|
| 186 | if(SameProv) then
|
---|
| 187 | cboProvider.SetExactByIEN(Prov, ExternalName(Prov, 200))
|
---|
| 188 | else
|
---|
| 189 | cboProvider.SetExactByIEN(uProviders.PCEProvider, uProviders.PCEProviderName);
|
---|
| 190 | //cboProvider.ItemIndex := -1; v22.8 - RV
|
---|
| 191 | end;
|
---|
[456] | 192 | end
|
---|
| 193 | else
|
---|
| 194 | begin
|
---|
| 195 | txtProcQty.Text := '';
|
---|
| 196 | cboProvider.ItemIndex := -1;
|
---|
| 197 | end;
|
---|
| 198 | // ShowModifiers;
|
---|
| 199 | finally
|
---|
| 200 | EndUpdate;
|
---|
| 201 | end;
|
---|
| 202 | end;
|
---|
| 203 | end;
|
---|
| 204 |
|
---|
| 205 | procedure TfrmProcedures.FormResize(Sender: TObject);
|
---|
| 206 | var
|
---|
| 207 | v, i: integer;
|
---|
| 208 | s: string;
|
---|
| 209 |
|
---|
| 210 | begin
|
---|
| 211 | inherited;
|
---|
| 212 | FSectionTabs[0] := -(lbxSection.width - LBCheckWidthSpace - MainFontWidth - ScrollBarWidth);
|
---|
| 213 | UpdateTabPos;
|
---|
| 214 | v := (lbMods.width - LBCheckWidthSpace - (4*MainFontWidth) - ScrollBarWidth);
|
---|
| 215 | s := '';
|
---|
| 216 | for i := 1 to 20 do
|
---|
| 217 | begin
|
---|
| 218 | if s <> '' then s := s + ',';
|
---|
| 219 | s := s + inttostr(v);
|
---|
| 220 | if(v<0) then
|
---|
| 221 | dec(v,32)
|
---|
| 222 | else
|
---|
| 223 | inc(v,32);
|
---|
| 224 | end;
|
---|
| 225 | lbMods.TabPositions := s;
|
---|
| 226 | end;
|
---|
| 227 |
|
---|
| 228 | procedure TfrmProcedures.splRightMoved(Sender: TObject);
|
---|
| 229 | begin
|
---|
| 230 | inherited;
|
---|
| 231 | lblMod.Left := lbMods.Left + pnlMain.Left;
|
---|
| 232 | FSplitterMove := TRUE;
|
---|
| 233 | FormResize(Sender);
|
---|
| 234 | end;
|
---|
| 235 |
|
---|
| 236 | procedure TfrmProcedures.clbListClick(Sender: TObject);
|
---|
| 237 | begin
|
---|
| 238 | inherited;
|
---|
| 239 | Sync2Section;
|
---|
| 240 | UpdateControls;
|
---|
| 241 | ShowModifiers;
|
---|
| 242 | end;
|
---|
| 243 |
|
---|
| 244 | procedure TfrmProcedures.lbGridSelect(Sender: TObject);
|
---|
| 245 | begin
|
---|
| 246 | inherited;
|
---|
| 247 | Sync2Grid;
|
---|
| 248 | ShowModifiers;
|
---|
| 249 | end;
|
---|
| 250 |
|
---|
| 251 | procedure TfrmProcedures.btnSelectAllClick(Sender: TObject);
|
---|
| 252 | begin
|
---|
| 253 | inherited;
|
---|
| 254 | Sync2Grid;
|
---|
| 255 | ShowModifiers;
|
---|
| 256 | end;
|
---|
| 257 |
|
---|
| 258 | procedure TfrmProcedures.ShowModifiers;
|
---|
| 259 | const
|
---|
| 260 | ModTxt = 'Modifiers';
|
---|
| 261 | ForTxt = ' for ';
|
---|
| 262 | Spaces = ' ';
|
---|
| 263 | CommonTxt = ' Common to Multiple Procedures';
|
---|
| 264 |
|
---|
| 265 | var
|
---|
| 266 | i, TopIdx: integer;
|
---|
| 267 | // Needed,
|
---|
| 268 | Codes, ProcName, Hint, Msg: string;
|
---|
| 269 | Proc: TPCEProc;
|
---|
| 270 |
|
---|
| 271 | begin
|
---|
| 272 | if(not NotUpdating) then exit;
|
---|
| 273 | Codes := '';
|
---|
| 274 | ProcName := '';
|
---|
| 275 | Hint := '';
|
---|
| 276 | // Needed := '';
|
---|
| 277 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 278 | begin
|
---|
| 279 | if(lbGrid.Selected[i]) then
|
---|
| 280 | begin
|
---|
| 281 | Proc := TPCEProc(lbGrid.Items.Objects[i]);
|
---|
| 282 | Codes := Codes + Proc.Code + U;
|
---|
| 283 | if(ProcName = '') then
|
---|
| 284 | ProcName := Proc.Narrative
|
---|
| 285 | else
|
---|
| 286 | ProcName := CommonTxt;
|
---|
| 287 | if(Hint <> '') then
|
---|
| 288 | Hint := Hint + CRLF + Spaces;
|
---|
| 289 | Hint := Hint + Proc.Narrative;
|
---|
| 290 | // Needed := Needed + Proc.Modifiers;
|
---|
| 291 | end;
|
---|
| 292 | end;
|
---|
| 293 | if(Codes = '') and (lbxSection.ItemIndex >= 0) then
|
---|
| 294 | begin
|
---|
| 295 | Codes := piece(lbxSection.Items[lbxSection.ItemIndex],U,1) + U;
|
---|
| 296 | ProcName := piece(lbxSection.Items[lbxSection.ItemIndex],U,2);
|
---|
| 297 | Hint := ProcName;
|
---|
| 298 | // Needed := piece(lbxSection.Items[lbxSection.ItemIndex],U,4); Don't show expired codes!
|
---|
| 299 | end;
|
---|
| 300 | msg := ModTxt;
|
---|
| 301 | if(ProcName <> '') and (ProcName <> CommonTxt) then
|
---|
| 302 | msg := msg + ForTxt;
|
---|
| 303 | lblMod.Caption := msg + ProcName;
|
---|
| 304 | if(pos(CRLF,Hint)>0) then
|
---|
| 305 | Hint := ':' + CRLF + Spaces + Hint;
|
---|
| 306 | lblMod.Hint := msg + Hint;
|
---|
| 307 |
|
---|
| 308 | if(FLastCPTCodes = Codes) then
|
---|
| 309 | TopIdx := lbMods.TopIndex
|
---|
| 310 | else
|
---|
| 311 | begin
|
---|
| 312 | TopIdx := 0;
|
---|
| 313 | FLastCPTCodes := Codes;
|
---|
| 314 | end;
|
---|
| 315 | ListCPTModifiers(lbMods.Items, Codes, ''); // Needed);
|
---|
| 316 | lbMods.TopIndex := TopIdx;
|
---|
| 317 | CheckModifiers;
|
---|
| 318 | end;
|
---|
| 319 |
|
---|
| 320 | procedure TfrmProcedures.CheckModifiers;
|
---|
| 321 | var
|
---|
| 322 | i, idx, cnt, mcnt: integer;
|
---|
| 323 | Code, Mods: string;
|
---|
| 324 | state: TCheckBoxState;
|
---|
| 325 |
|
---|
| 326 | begin
|
---|
| 327 | FModsReadOnly := TRUE;
|
---|
| 328 | if lbMods.Items.Count < 1 then exit;
|
---|
| 329 | FCheckingMods := TRUE;
|
---|
| 330 | try
|
---|
| 331 | cnt := 0;
|
---|
| 332 | Mods := ';';
|
---|
| 333 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 334 | begin
|
---|
| 335 | if(lbGrid.Selected[i]) then
|
---|
| 336 | begin
|
---|
| 337 | inc(cnt);
|
---|
| 338 | Mods := Mods + TPCEProc(lbGrid.Items.Objects[i]).Modifiers;
|
---|
| 339 | FModsReadOnly := FALSE;
|
---|
| 340 | end;
|
---|
| 341 | end;
|
---|
| 342 | if(cnt = 0) and (lbxSection.ItemIndex >= 0) then
|
---|
| 343 | begin
|
---|
| 344 | Mods := ';' + UpdateModifierList(lbxSection.Items, lbxSection.ItemIndex);
|
---|
| 345 | cnt := 1;
|
---|
| 346 | end;
|
---|
| 347 | for i := 0 to lbMods.Items.Count-1 do
|
---|
| 348 | begin
|
---|
| 349 | state := cbUnchecked;
|
---|
| 350 | if(cnt > 0) then
|
---|
| 351 | begin
|
---|
| 352 | Code := ';' + piece(lbMods.Items[i], U, 1) + ';';
|
---|
| 353 | mcnt := 0;
|
---|
| 354 | repeat
|
---|
| 355 | idx := pos(Code, Mods);
|
---|
| 356 | if(idx > 0) then
|
---|
| 357 | begin
|
---|
| 358 | inc(mcnt);
|
---|
| 359 | delete(Mods, idx, length(Code) - 1);
|
---|
| 360 | end;
|
---|
| 361 | until (idx = 0);
|
---|
| 362 | if mcnt >= cnt then
|
---|
| 363 | State := cbChecked
|
---|
| 364 | else
|
---|
| 365 | if(mcnt > 0) then
|
---|
| 366 | State := cbGrayed;
|
---|
| 367 | end;
|
---|
| 368 | lbMods.CheckedState[i] := state;
|
---|
| 369 | end;
|
---|
| 370 | if FModsReadOnly then
|
---|
| 371 | begin
|
---|
| 372 | FModsROChecked := lbMods.CheckedString;
|
---|
| 373 | lbMods.Font.Color := clInactiveCaption;
|
---|
| 374 | end
|
---|
| 375 | else
|
---|
| 376 | lbMods.Font.Color := clWindowText;
|
---|
| 377 | finally
|
---|
| 378 | FCheckingMods := FALSE;
|
---|
| 379 | end;
|
---|
| 380 | end;
|
---|
| 381 |
|
---|
| 382 | procedure TfrmProcedures.lbModsClickCheck(Sender: TObject; Index: Integer);
|
---|
| 383 | var
|
---|
| 384 | i, idx: integer;
|
---|
| 385 | PCEObj: TPCEProc;
|
---|
| 386 | ModIEN: string;
|
---|
| 387 | DoChk, Add: boolean;
|
---|
| 388 |
|
---|
| 389 | begin
|
---|
| 390 | if FCheckingMods or (Index < 0) then exit;
|
---|
| 391 | if FModsReadOnly then
|
---|
| 392 | begin
|
---|
| 393 | lbMods.CheckedString := FModsROChecked;
|
---|
| 394 | exit;
|
---|
| 395 | end;
|
---|
| 396 | if(NotUpdating) then
|
---|
| 397 | begin
|
---|
| 398 | BeginUpdate;
|
---|
| 399 | try
|
---|
| 400 | DoChk := FALSE;
|
---|
| 401 | Add := (lbMods.Checked[Index]);
|
---|
| 402 | ModIEN := piece(lbMods.Items[Index],U,1) + ';';
|
---|
| 403 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 404 | begin
|
---|
| 405 | if(lbGrid.Selected[i]) then
|
---|
| 406 | begin
|
---|
| 407 | PCEObj := TPCEProc(lbGrid.Items.Objects[i]);
|
---|
| 408 | idx := pos(';' + ModIEN, ';' + PCEObj.Modifiers);
|
---|
| 409 | if(idx > 0) then
|
---|
| 410 | begin
|
---|
| 411 | if not Add then
|
---|
| 412 | begin
|
---|
| 413 | delete(PCEObj.Modifiers, idx, length(ModIEN));
|
---|
| 414 | DoChk := TRUE;
|
---|
| 415 | end;
|
---|
| 416 | end
|
---|
| 417 | else
|
---|
| 418 | begin
|
---|
| 419 | if Add then
|
---|
| 420 | begin
|
---|
| 421 | PCEObj.Modifiers := PCEObj.Modifiers + ModIEN;
|
---|
| 422 | DoChk := TRUE;
|
---|
| 423 | end;
|
---|
| 424 | end;
|
---|
| 425 | end;
|
---|
| 426 | end;
|
---|
| 427 | finally
|
---|
| 428 | EndUpdate;
|
---|
| 429 | end;
|
---|
| 430 | if DoChk then
|
---|
| 431 | GridChanged;
|
---|
| 432 | end;
|
---|
| 433 | end;
|
---|
| 434 |
|
---|
[829] | 435 | procedure TfrmProcedures.lbModsExit(Sender: TObject);
|
---|
| 436 | begin
|
---|
| 437 | inherited;
|
---|
| 438 | if TabIsPressed then
|
---|
| 439 | if btnOther.CanFocus then
|
---|
| 440 | btnOther.SetFocus;
|
---|
| 441 | end;
|
---|
| 442 |
|
---|
[456] | 443 | procedure TfrmProcedures.lbSectionClick(Sender: TObject);
|
---|
| 444 | begin
|
---|
| 445 | inherited;
|
---|
| 446 | ShowModifiers;
|
---|
| 447 | end;
|
---|
| 448 |
|
---|
| 449 | procedure TfrmProcedures.lbxSectionClickCheck(Sender: TObject;
|
---|
| 450 | Index: Integer);
|
---|
| 451 | var
|
---|
| 452 | i: integer;
|
---|
| 453 | begin
|
---|
| 454 | if FCheckingCode then exit;
|
---|
| 455 | FCheckingCode := TRUE;
|
---|
| 456 | try
|
---|
| 457 | inherited;
|
---|
| 458 | Sync2Grid;
|
---|
[829] | 459 | lbxSection.Selected[Index] := True;
|
---|
[456] | 460 | if(lbxSection.ItemIndex >= 0) and (lbxSection.ItemIndex = Index) and
|
---|
| 461 | (lbxSection.Checked[Index]) then
|
---|
| 462 | begin
|
---|
[829] | 463 | UpdateModifierList(lbxSection.Items, Index); // CQ#16439
|
---|
| 464 | lbxSection.Checked[Index] := TRUE;
|
---|
[456] | 465 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 466 | begin
|
---|
| 467 | if(lbGrid.Selected[i]) then
|
---|
| 468 | with TPCEProc(lbGrid.Items.Objects[i]) do
|
---|
| 469 | begin
|
---|
| 470 | if(Category = GetCat) and
|
---|
| 471 | (Pieces(lbxSection.Items[Index], U, 1, 2) = Code + U + Narrative) then
|
---|
| 472 | begin
|
---|
| 473 | { TODO -oRich V. -cEncounters : v21/22 - Added this block to default provider for procedures.}
|
---|
| 474 | if Provider = 0 then Provider := uProviders.PCEProvider;
|
---|
| 475 | { uPCE.TPCEProviderList.PCEProvider function sorts this out automatically: }
|
---|
| 476 | { 1. Current CPRS encounter provider, if present and has active person class as of encounter date. }
|
---|
| 477 | { 2. Current user, if has active person class as of encounter date. }
|
---|
| 478 | { 3. Primary provider for the visit, if defined. }
|
---|
| 479 | { 4. No default. }
|
---|
| 480 | Modifiers := Piece(lbxSection.Items[lbxSection.ItemIndex], U, 4);
|
---|
| 481 | GridChanged;
|
---|
[829] | 482 | lbxSection.Selected[Index] := True; // CQ#15493
|
---|
[456] | 483 | exit;
|
---|
| 484 | end;
|
---|
| 485 | end;
|
---|
| 486 | end;
|
---|
| 487 | end;
|
---|
| 488 | finally
|
---|
| 489 | FCheckingCode := FALSE;
|
---|
| 490 | end;
|
---|
| 491 | end;
|
---|
| 492 |
|
---|
[829] | 493 | procedure TfrmProcedures.lbxSectionExit(Sender: TObject);
|
---|
| 494 | begin
|
---|
| 495 | if TabIsPressed then begin
|
---|
| 496 | if lbMods.CanFocus then
|
---|
| 497 | lbMods.SetFocus;
|
---|
| 498 | end
|
---|
| 499 | else if ShiftTabIsPressed then
|
---|
| 500 | if lbSection.CanFocus then
|
---|
| 501 | lbSection.SetFocus;
|
---|
| 502 | end;
|
---|
| 503 |
|
---|
[456] | 504 | procedure TfrmProcedures.btnOtherClick(Sender: TObject);
|
---|
| 505 | begin
|
---|
| 506 | inherited;
|
---|
| 507 | Sync2Grid;
|
---|
| 508 | ShowModifiers;
|
---|
| 509 | end;
|
---|
| 510 |
|
---|
[829] | 511 | procedure TfrmProcedures.btnOtherExit(Sender: TObject);
|
---|
| 512 | begin
|
---|
| 513 | if TabIsPressed then begin
|
---|
| 514 | if lbGrid.CanFocus then
|
---|
| 515 | lbGrid.SetFocus;
|
---|
| 516 | end
|
---|
| 517 | else if ShiftTabIsPressed then
|
---|
| 518 | if lbMods.CanFocus then
|
---|
| 519 | lbMods.SetFocus;
|
---|
| 520 | end;
|
---|
| 521 |
|
---|
[456] | 522 | procedure TfrmProcedures.btnRemoveClick(Sender: TObject);
|
---|
| 523 | begin
|
---|
| 524 | inherited;
|
---|
| 525 | Sync2Grid;
|
---|
| 526 | ShowModifiers;
|
---|
| 527 | end;
|
---|
| 528 |
|
---|
| 529 | procedure TfrmProcedures.cboProviderNeedData(Sender: TObject;
|
---|
| 530 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
| 531 | begin
|
---|
| 532 | inherited;
|
---|
| 533 | if(uEncPCEData.VisitCategory = 'E') then
|
---|
| 534 | cboProvider.ForDataUse(SubSetOfPersons(StartFrom, Direction))
|
---|
| 535 | else
|
---|
| 536 | cboProvider.ForDataUse(SubSetOfUsersWithClass(StartFrom, Direction,
|
---|
| 537 | FloatToStr(uEncPCEData.PersonClassDate)));
|
---|
| 538 | end;
|
---|
| 539 |
|
---|
| 540 | function TfrmProcedures.OK2SaveProcedures: boolean;
|
---|
| 541 | begin
|
---|
| 542 | Result := TRUE;
|
---|
| 543 | if MissingProvider then
|
---|
| 544 | begin
|
---|
| 545 | InfoBox(TX_PROC_PROV, TC_PROC_PROV, MB_OK or MB_ICONWARNING);
|
---|
| 546 | Result := False;
|
---|
| 547 | end;
|
---|
| 548 | end;
|
---|
| 549 |
|
---|
| 550 | function TfrmProcedures.MissingProvider: boolean;
|
---|
| 551 | var
|
---|
| 552 | i: integer;
|
---|
| 553 | AProc: TPCEProc;
|
---|
| 554 | begin
|
---|
| 555 | { TODO -oRich V. -cEncounters : {v21 - Entry of a provider for each new CPT is now required}
|
---|
| 556 | {Existing CPTs on the encounter will NOT require entry of a provider}
|
---|
| 557 | {Monitor status of new service request #20020203.}
|
---|
| 558 | Result := False;
|
---|
| 559 |
|
---|
| 560 | { Comment out the block below (and the "var" block above) }
|
---|
| 561 | { to allow but not require entry of a provider with each new CPT entered}
|
---|
| 562 | //------------------------------------------------
|
---|
| 563 | for i := 0 to lbGrid.Items.Count - 1 do
|
---|
| 564 | begin
|
---|
| 565 | AProc := TPCEProc(lbGrid.Items.Objects[i]);
|
---|
| 566 | if AProc.fIsOldProcedure then continue;
|
---|
| 567 | if (AProc.Provider = 0) then
|
---|
| 568 | begin
|
---|
| 569 | Result := True;
|
---|
| 570 | lbGrid.ItemIndex := i;
|
---|
| 571 | exit;
|
---|
| 572 | end;
|
---|
| 573 | end;
|
---|
| 574 | //-------------------------------------------------
|
---|
| 575 | end;
|
---|
| 576 |
|
---|
| 577 | procedure TfrmProcedures.InitTab(ACopyProc: TCopyItemsMethod; AListProc: TListSectionsProc);
|
---|
| 578 | var
|
---|
| 579 | i: integer;
|
---|
| 580 | begin
|
---|
| 581 | inherited;
|
---|
| 582 | for i := 0 to lbGrid.Items.Count - 1 do
|
---|
| 583 | TPCEProc(lbGrid.Items.Objects[i]).fIsOldProcedure := True;
|
---|
| 584 | end;
|
---|
| 585 |
|
---|
[829] | 586 | initialization
|
---|
| 587 | SpecifyFormIsNotADialog(TfrmProcedures);
|
---|
| 588 |
|
---|
[456] | 589 | end.
|
---|