Procedure

TfrmDCSummProperties.lstAdmissionsChange

Module

fDCSummProps

Last Modified

7/15/2014 3:26:36 PM

Visibility

Public/Published

Owner

TfrmDCSummProperties

Declaration

procedure lstAdmissionsChange(Sender: TObject);

Calls Hierarchy


TfrmDCSummProperties.lstAdmissionsChange
 ├ActOnDCDocument
 ├GetDCSummForEdit
 │ ├FindInt
 │ ├FindExt
 │ ├FindDT
 │ └FindInt64
 ├ListDCSummTitlesShort
 │ └LoadDCSummTitles
 │   └TDCSummTitles.Create
 ├LoadDCUrgencies
 └OneNotePerVisit

Calls

Name Declaration Comments
ActOnDCDocument procedure ActOnDCDocument(var AuthSts: TActionRec; IEN: Integer; const ActionName: string); -
GetDCSummForEdit procedure GetDCSummForEdit(var EditRec: TEditDCSummRec; IEN: Integer); -
ListDCSummTitlesShort procedure ListDCSummTitlesShort(Dest: TStrings); -
LoadDCUrgencies function LoadDCUrgencies: TStrings; -
OneNotePerVisit function OneNotePerVisit(NoteEIN: Integer; DFN: String;VisitStr: String): boolean; -


Source

476   procedure TfrmDCSummProperties.lstAdmissionsChange(Sender: TObject);
477   var
478     x: string;
479     AnEditSumm: TEditDCSummRec;
480     ActionSts: TActionRec;
481   begin
482     if lstAdmissions.ItemIndex < 0 then Exit;
483     x := lstAdmissions.Items[lstAdmissions.ItemIndex];
484     if (StrToIntDef(Piece(x, U, 7), 0) = 2) then
485       begin
486         { Prompt for edit first - proceed as below if yes, else proceed as if '1'}
487         if InfoBox(TX_EDIT_EXISTING, TC_EDIT_EXISTING, MB_YESNO) = MRYES then
488         begin
489           FillChar(AnEditSumm, SizeOf(AnEditSumm), 0);
490           FEditIEN := StrToInt(Piece(x,U,6));
491           ActOnDCDocument(ActionSts, FEditIEN, 'EDIT RECORD');
492           if not ActionSts.Success then
493           begin
494             InfoBox(ActionSts.Reason, TX_IN_AUTH, MB_OK);
495             lstAdmissions.ItemIndex := -1;
496             Exit;
497           end;
498           GetDCSummForEdit(AnEditSumm, FEditIEN);
499           EditLines.Assign(AnEditSumm.Lines);
500           cboNewTitle.InitLongList(AnEditSumm.TitleName);
501           ListDCSummTitlesShort(cboNewTitle.Items);
502           if AnEditSumm.Title > 0 then cboNewTitle.SelectByIEN(AnEditSumm.Title);
503           cboAuthor.InitLongList(AnEditSumm.DictatorName);
504           if AnEditSumm.Dictator > 0 then cboAuthor.SelectByIEN(AnEditSumm.Dictator);
505           FastAssign(LoadDCUrgencies, cboUrgency.Items);
506           cboUrgency.SelectByID('R');
507           cboAttending.InitLongList(AnEditSumm.AttendingName);
508           if AnEditSumm.Attending > 0 then cboAttending.SelectByIEN(AnEditSumm.Attending);
509           calSumm.FMDateTime := AnEditSumm.DictDateTime;
510         end
511         else // if user answers NO to edit existing document, can new one be created?
512           begin
513             FVisitStr := Piece(x, U, 2) + ';' + Piece(x, U, 1) + ';H';
514             if (OneNotePerVisit(cboNewTitle.ItemIEN, Patient.DFN, FVisitStr)) then
515             begin
516               FEditIEN := 0;
517               InfoBox(TX_NO_MORE_SUMMS, TC_NO_EDIT, MB_OK);
518               lstAdmissions.ItemIndex := -1;
519             end;
520           end;
521       end
522     else if Piece(x, U, 7) = '1' then
523       begin
524         FVisitStr := Piece(x, U, 2) + ';' + Piece(x, U, 1) + ';H';
525         if (OneNotePerVisit(cboNewTitle.ItemIEN, Patient.DFN, FVisitStr)) then
526         begin
527           FEditIEN := 0;
528           InfoBox(TX_NO_MORE_SUMMS, TC_NO_EDIT, MB_OK);
529           lstAdmissions.ItemIndex := -1;
530         end;
531       end
532     else
533       begin
534         FEditIEN := 0;
535   (*      cboNewTitle.ItemIndex := -1;
536         cboAttending.ItemIndex := -1;
537         calSumm.FMDateTime := FMNow;*)
538       end;
539   end;