| [459] | 1 | unit fPrintList; | 
|---|
|  | 2 |  | 
|---|
|  | 3 | interface | 
|---|
|  | 4 |  | 
|---|
|  | 5 | uses | 
|---|
|  | 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
|---|
|  | 7 | Dialogs, fAutoSz, StdCtrls, ORCtrls, fConsult513Prt; | 
|---|
|  | 8 |  | 
|---|
|  | 9 | type | 
|---|
|  | 10 | TfrmPrintList = class(TfrmAutoSz) | 
|---|
|  | 11 | lbIDParents: TORListBox; | 
|---|
|  | 12 | cmdOK: TButton; | 
|---|
|  | 13 | cmdCancel: TButton; | 
|---|
|  | 14 | lblListName: TLabel; | 
|---|
|  | 15 | procedure FormCreate(Sender: TObject); | 
|---|
|  | 16 | procedure cmdCancelClick(Sender: TObject); | 
|---|
|  | 17 | procedure cmdOKClick(Sender: TObject); | 
|---|
|  | 18 |  | 
|---|
|  | 19 | private | 
|---|
|  | 20 | { Private declarations } | 
|---|
|  | 21 | FParentNode: string; | 
|---|
|  | 22 | public | 
|---|
|  | 23 | { Public declarations } | 
|---|
|  | 24 | function SelectParentFromList(ATree: TORTreeView; PageID: Integer): string; | 
|---|
|  | 25 | end; | 
|---|
|  | 26 |  | 
|---|
|  | 27 | var | 
|---|
|  | 28 | frmPrintList: TfrmPrintList; | 
|---|
|  | 29 | HLDPageID: Integer; | 
|---|
|  | 30 |  | 
|---|
|  | 31 | implementation | 
|---|
|  | 32 |  | 
|---|
|  | 33 | {$R *.dfm} | 
|---|
|  | 34 | uses | 
|---|
|  | 35 | uTIU, rTIU, uConst, fNotes, fNotePrt, ORFn, fConsults, fDCSumm, fFrame; | 
|---|
|  | 36 |  | 
|---|
|  | 37 | procedure TfrmPrintList.FormCreate(Sender: TObject); | 
|---|
|  | 38 | begin | 
|---|
|  | 39 | inherited; | 
|---|
|  | 40 | FParentNode := ''; | 
|---|
|  | 41 | end; | 
|---|
|  | 42 |  | 
|---|
|  | 43 | procedure TfrmPrintList.cmdCancelClick(Sender: TObject); | 
|---|
|  | 44 | begin | 
|---|
|  | 45 | inherited; | 
|---|
|  | 46 | FParentNode := ''; | 
|---|
|  | 47 | Close; | 
|---|
|  | 48 | end; | 
|---|
|  | 49 |  | 
|---|
|  | 50 | procedure TfrmPrintList.cmdOKClick(Sender: TObject); | 
|---|
|  | 51 | begin | 
|---|
|  | 52 | inherited; | 
|---|
|  | 53 | case HLDPageID of | 
|---|
|  | 54 | CT_NOTES:        frmNotes.RequestMultiplePrint(Self); | 
|---|
|  | 55 | CT_CONSULTS:     frmConsults.RequestMultiplePrint(Self); | 
|---|
|  | 56 | CT_DCSUMM:       frmDCSumm.RequestMultiplePrint(Self); | 
|---|
|  | 57 | end; {case} | 
|---|
|  | 58 | FParentNode := lbIDParents.ItemID; | 
|---|
|  | 59 | Close; | 
|---|
|  | 60 | end; | 
|---|
|  | 61 |  | 
|---|
|  | 62 | function TfrmPrintList.SelectParentFromList(ATree: TORTreeView; PageID: Integer): string; | 
|---|
|  | 63 | var | 
|---|
|  | 64 | frmPrintList: TfrmPrintList; | 
|---|
|  | 65 | i, AnImg: integer; | 
|---|
|  | 66 | x: string; | 
|---|
|  | 67 | tmpList: TStringList; | 
|---|
|  | 68 | strObj: TStringList; | 
|---|
|  | 69 | begin | 
|---|
|  | 70 | HLDPageID := PageID; | 
|---|
|  | 71 | frmPrintList := TfrmPrintList.Create(Application); | 
|---|
|  | 72 | frmPrintList.Parent := Self; | 
|---|
|  | 73 | tmpList := TStringList.Create; | 
|---|
|  | 74 | try | 
|---|
|  | 75 | ResizeFormToFont(TForm(frmPrintList)); | 
|---|
|  | 76 | for i := 0 to ATree.Items.Count - 1 do | 
|---|
|  | 77 | begin | 
|---|
|  | 78 | AnImg := TORTreeNode(ATree.Items.Item[i]).ImageIndex; | 
|---|
|  | 79 | if AnImg in [IMG_SINGLE, IMG_PARENT,IMG_IDNOTE_SHUT, IMG_IDNOTE_OPEN, | 
|---|
|  | 80 | IMG_IDPAR_ADDENDA_SHUT, IMG_IDPAR_ADDENDA_OPEN] then | 
|---|
|  | 81 | begin | 
|---|
|  | 82 | x := TORTreeNode(ATree.Items.Item[i]).Stringdata; | 
|---|
|  | 83 | strObj := TStringList.Create; | 
|---|
|  | 84 | strObj.Insert(0,x); | 
|---|
|  | 85 | tmpList.AddObject(x, strObj)  // notes and dc/summs & Consults | 
|---|
|  | 86 | end; {if} | 
|---|
|  | 87 | end; {for} | 
|---|
|  | 88 |  | 
|---|
|  | 89 | frmPrintList.lbIDParents.Sorted := FALSE; | 
|---|
|  | 90 |  | 
|---|
|  | 91 | case PageID of | 
|---|
|  | 92 | CT_NOTES: | 
|---|
|  | 93 | begin | 
|---|
|  | 94 | SortByPiece(tmpList, U, 3); | 
|---|
|  | 95 | InvertStringList(tmpList); | 
|---|
|  | 96 | for i := 0 to tmpList.Count - 1 do | 
|---|
|  | 97 | begin | 
|---|
|  | 98 | x := tmpList[i]; | 
|---|
|  | 99 | tmpList[i] := (MakeNoteDisplayText(x)); | 
|---|
|  | 100 | end; | 
|---|
|  | 101 | frmPrintList.lblListName.Caption := 'Select Notes to be printed.'; | 
|---|
|  | 102 | end; | 
|---|
|  | 103 | CT_CONSULTS: | 
|---|
|  | 104 | begin | 
|---|
|  | 105 | SortByPiece(tmpList, U, 11); | 
|---|
|  | 106 | InvertStringList(tmpList); | 
|---|
|  | 107 | for i := 0 to tmpList.Count - 1 do | 
|---|
|  | 108 | begin | 
|---|
|  | 109 | x := tmpList[i]; | 
|---|
|  | 110 | tmpList[i] := (MakeConsultDisplayText(x)); | 
|---|
|  | 111 | end; | 
|---|
|  | 112 | frmPrintList.lblListName.Caption := 'Select Consults to be printed.'; | 
|---|
|  | 113 | end; | 
|---|
|  | 114 | CT_DCSUMM: | 
|---|
|  | 115 | begin | 
|---|
|  | 116 | SortByPiece(tmpList, U, 3); | 
|---|
|  | 117 | InvertStringList(tmpList); | 
|---|
|  | 118 | for i := 0 to tmpList.Count - 1 do | 
|---|
|  | 119 | begin | 
|---|
|  | 120 | x := tmpList[i]; | 
|---|
|  | 121 | tmpList[i] := (MakeNoteDisplayText(x)); | 
|---|
|  | 122 | end; | 
|---|
|  | 123 | frmPrintList.lblListName.Caption := 'Select Discharge Summaries to be printed.'; | 
|---|
|  | 124 | end; | 
|---|
|  | 125 | end; //case | 
|---|
|  | 126 |  | 
|---|
|  | 127 | frmPrintList.lbIDParents.Items.Assign(tmpList); | 
|---|
|  | 128 | frmPrintList.ShowModal; | 
|---|
|  | 129 | Result := frmPrintList.FParentNode; | 
|---|
|  | 130 | finally | 
|---|
|  | 131 | tmpList.Free; | 
|---|
|  | 132 | frmPrintList.Release; | 
|---|
|  | 133 | end; | 
|---|
|  | 134 | end; | 
|---|
|  | 135 |  | 
|---|
|  | 136 | end. | 
|---|