Procedure

SetupORDIALOG

Module

rODBase

Last Modified

7/15/2014 3:26:42 PM

Comments

Common Internal Calls

Scope

Global

Declaration

procedure SetupORDIALOG(AParam: TParamRecord; ResponseList: TList; IsIV: boolean = False);

Called-By Hierarchy


                                                   SetupORDIALOG
                                                 PutQuickOrder┤ 
                                   TResponses.SaveQuickOrder┘ │ 
                                          SaveAsQuickOrder┘   │ 
                                          QuickOrderSave┘     │ 
                       TfrmOrders.mnuOptSaveQuickClick┘       │ 
                                                   PutNewOrder┘ 
                                        TResponses.SaveOrder┘   
                                      TfrmODBase.ValidSave┘     
                               TfrmODBase.cmdAcceptClick┤       
                                   ActivateOrderDialog┘ │       
                           TfrmRemDlg.btnFinishClick┤   │       
           TfrmConsults.mnuActNewConsultRequestClick┤   │       
                   TfrmConsults.cmdNewConsultClick┘ │   │       
                TfrmConsults.mnuActNewProcedureClick┤   │       
                      TfrmConsults.cmdNewProcClick┘ │   │       
                                        ChangeOrders┤   │       
                      TfrmOrders.mnuActChangeClick┤ │   │       
                        TfrmMeds.mnuActChangeClick┘ │   │       
                                     ChangeOrdersEvt┤   │       
                                          CopyOrders┤   │       
                        TfrmOrders.mnuActCopyClick┤ │   │       
                          TfrmMeds.mnuActCopyClick┤ │   │       
                           TfrmODActive.btnOKClick┘ │   │       
                                      TransferOrders┤   │       
                        TfrmOrders.mnuActCopyClick┤ │   │       
                          TfrmMeds.mnuActCopyClick┤ │   │       
                           TfrmODActive.btnOKClick┘ │   │       
                            TfrmOrders.lstWriteClick┤   │       
               TfrmOrders.PlaceOrderForDefaultDialog┤   │       
                  TfrmOrders.DisplayDefaultDlgList┤ │   │       
                       TfrmOrders.ResetOrderPage┘ │ │   │       
               TfrmOrders.btnDelayedOrderClick┘   │ │   │       
                                 DisplayEvntDialog┤ │   │       
                             SetDelayEventForMed┘ │ │   │       
                      TfrmMeds.mnuActCopyClick┘   │ │   │       
                                 DisplayEvntDialog┤ │   │       
                                  SetViewForCopy┘ │ │   │       
                    TfrmOrders.mnuActCopyClick┘   │ │   │       
                                 DisplayEvntDialog┘ │   │       
                                ExecuteChangeEvt┘   │   │       
                 TfrmOrders.mnuActChgEvntClick┘     │   │       
                             TfrmMeds.mnuActNewClick┤   │       
                           TfrmOMNavA.ActivateDialog┤   │       
                         TfrmOMNavA.grdMenuKeyDown┤ │   │       
                         TfrmOMNavA.grdMenuMouseUp┘ │   │       
                                TfrmOMSet.DoNextItem┘   │       
                              TfrmOMSet.InsertList┤     │       
                               ActivateOrderList┘ │     │       
                     TfrmRemDlg.btnFinishClick┤   │     │       
                             ActivateOrderHTML┤   │     │       
                    TfrmOrders.lstWriteClick┤ │   │     │       
    TfrmOrders.PlaceOrderForDefaultDialog...┘ │   │     │       
                              ActivateOrderSet┤   │     │       
                   TfrmRemDlg.btnFinishClick┤ │   │     │       
TfrmConsults.mnuActNewConsultRequestClick...┤ │   │     │       
     TfrmConsults.mnuActNewProcedureClick...┤ │   │     │       
                    TfrmOrders.lstWriteClick┤ │   │     │       
    TfrmOrders.PlaceOrderForDefaultDialog...┤ │   │     │       
                     TfrmMeds.mnuActNewClick┤ │   │     │       
                TfrmOMNavA.ActivateDialog...┤ │   │     │       
                     TfrmOMSet.DoNextItem...┘ │   │     │       
                       TfrmOMNavA.DoSelectList┘   │     │       
                     TfrmOMNavA.grdMenuKeyUp┤     │     │       
                   TfrmOMNavA.grdMenuMouseUp┘     │     │       
                                        SkipToNext┤     │       
                         TfrmOMSet.DoNextItem...┘ │     │       
                            TfrmOMSet.UMDelayEvent┘     │       
                               TfrmODBase.FormCloseQuery┤       
                                     TfrmODBase.TabClose┤       
                            TfrmODAllergy.cmdAcceptClick┘       

Called-By

Name Declaration Comments
PutNewOrder procedure PutNewOrder(var AnOrder: TOrder; ConstructOrder: TConstructOrder; OrderSource: string); -
PutQuickOrder procedure PutQuickOrder(var NewIEN: Integer; const CRC, DisplayName: string; DGroup: Integer; ResponseList: TList); -


Source

145   procedure SetupORDIALOG(AParam: TParamRecord; ResponseList: TList; IsIV: boolean = False);
146   const
147     MAX_STR_LEN = 74;
148   var
149     i,j,ALine,odIdx,piIdx : Integer;
150     Subs, x, ODtxt, thePI: string;
151     WPStrings: TStringList;
152     IVDuration, IVDurVal: string;
153   begin
154     piIdx := 0;
155     odIdx := 0;
156     IVDuration := '';
157     IVDurVal := '';
158     AParam.PType := list;
159     for j := 0 to ResponseList.Count - 1 do
160     begin
161       if TResponse(ResponseList.Items[j]).PromptID = 'SIG' then
162       begin
163         ODtxt := TResponse(ResponseList.Items[j]).EValue;
164         odIdx := j;
165       end;
166       if TResponse(ResponseList.Items[j]).PromptID = 'PI' then
167         thePI := TResponse(ResponseList.Items[j]).EValue;
168       if Length(Trim(thePI)) > 0 then
169         piIdx := Pos(thePI, ODtxt);
170       if piIdx > 0 then
171       begin
172         Delete(ODtxt,piIdx,Length(thePI));
173         TResponse(ResponseList.Items[odIdx]).EValue := ODtxt;
174       end;
175       if (IsIV and (TResponse(ResponseList.Items[j]).PromptID = 'DAYS')) then
176       begin
177         IVDuration := TResponse(ResponseList.Items[j]).EValue;
178         if (Length(IVDuration) > 1) then
179         begin
180           if (Pos('TOTAL',upperCase(IVDuration))>0) or (Pos('FOR',upperCase(IVDuration))>0) then continue;
181           if (Pos('H',upperCase(IVDuration))>0)  then
182           begin
183             IVDurVal := Copy(IVDuration,1,length(IVDuration)-1);
184             TResponse(ResponseList.Items[j]).IValue := 'for ' + IVDurVal + ' hours';
185           end
186           else if (Pos('D',upperCase(IVDuration))>0) then
187           begin
188             if Pos('DOSES', upperCase(IVDuration)) > 0 then
189               begin
190                 IVDurVal := Copy(IVDuration, 1, length(IVDuration)-5);
191                 TResponse(ResponseList.Items[j]).IValue := 'for a total of ' + IVDurVal + ' doses';
192               end
193             else
194               begin
195                 IVDurVal := Copy(IVDuration,1,length(IVDuration)-1);
196                 TResponse(ResponseList.Items[j]).IValue := 'for ' + IVDurVal + ' days';
197               end;
198           end
199           else if ((Pos('ML',upperCase(IVDuration))>0) or (Pos('CC',upperCase(IVDuration))>0)) then
200           begin
201             IVDurVal := Copy(IVDuration,1,length(IVDuration)-2);
202             TResponse(ResponseList.Items[j]).IValue := 'with total volume ' + IVDurVal + 'ml';
203           end
204           else if (Pos('L',upperCase(IVDuration))>0) then
205           begin
206             IVDurVal := Copy(IVDuration,0,length(IVDuration)-1);
207             TResponse(ResponseList.Items[j]).IValue := 'with total volume ' + IVDurVal + 'L';
208           end;
209         end;
210       end;
211     end;
212   
213     with AParam, ResponseList do for i := 0 to Count - 1 do
214     begin
215       with TResponse(Items[i]) do
216       begin
217         Subs := IntToStr(PromptIEN) + ',' + IntToStr(Instance);
218         if IValue = TX_WPTYPE then
219         begin
220           WPStrings := TStringList.Create;
221           try
222             WPStrings.Text := EValue;
223             LimitStringLength(WPStrings, MAX_STR_LEN);
224             x := 'ORDIALOG("WP",' + Subs + ')';
225             Mult[Subs] := x;
226             for ALine := 0 to WPStrings.Count - 1 do
227             begin
228               x := '"WP",' + Subs + ',' + IntToStr(ALine+1) + ',0';
229               Mult[x] := WPStrings[ALine];
230             end; {for}
231           finally
232             WPStrings.Free;
233           end; {try}
234         end
235         else Mult[Subs] := IValue;
236       end; {with TResponse}
237     end; {with AParam}
238   end;