Function

ValidateDrugAutoAccept

Module

rODMeds

Last Modified

7/15/2014 3:26:42 PM

Comments

Function ValidateDaySupplyandQuantity(DaySupply, Quantity: integer): boolean;
function ValidateMaxQuantity(Quantity: integer): boolean;

Scope

Interfaced

Declaration

function ValidateDrugAutoAccept(tempDrug, tempUnit, tempSch, tempDur: string; OI, tempSupply, tempRefills: integer; tempQuantity: Double): boolean;

Calls Hierarchy


ValidateDrugAutoAccept
 ├DefaultDays
 ├DaysToQty
 └CalcMaxRefills

Called-By Hierarchy


                                  ValidateDrugAutoAccept
                                   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┘     

Calls

Name Declaration Comments
CalcMaxRefills function CalcMaxRefills(const Drug: string; Days, OrdItem: Integer; Discharge: Boolean): Integer; -
DaysToQty function DaysToQty(DaysSupply: Integer; const UnitsPerDose, Schedule, Duration, Drug: string): Integer; -
DefaultDays function DefaultDays(const ADrug, UnitStr, SchedStr: string; OI : Integer): Integer; -

Called-By

Name Declaration Comments
ActivateOrderDialog function ActivateOrderDialog(const AnID: string; AnEvent: TOrderDelayEvent; AnOwner: TComponent; ARefNum: Integer; ANeedVerify: boolean = True): Boolean; -


Source

373   function ValidateDrugAutoAccept(tempDrug, tempUnit, tempSch, tempDur: string; OI, tempSupply, tempRefills: integer; tempQuantity: Double): boolean;
374   var
375   daySupply, Refills: integer;
376   Quantity: Double;
377   begin
378     Result := True;
379     if uDrugHasMaxData.CaptureMaxData = false then exit;
380     daySupply := DefaultDays(tempDrug, tempUnit, tempSch, OI);
381     if (tempSupply > daySupply) and (uDrugHasMaxData.MaxSupply > 0) then
382       begin
383         infoBox('For this medication Day Supply cannot be greater then ' + InttoStr(uDrugHasMaxData.MaxSupply), 'Cannot Save Error', MB_OK);
384         Result := false;
385         uDrugHasMaxData.CaptureMaxData := false;
386         Exit;
387       end;
388     Quantity := DaysToQty(daySupply, tempUnit, tempSch, tempDur, tempDrug);
389     if (tempQuantity > Quantity) and (uDrugHasMaxData.MaxQuantity > 0) then
390       begin
391         infoBox('For this medication Quantity cannot be greater then ' + InttoStr(uDrugHasMaxData.MaxQuantity), 'Cannot Save Error', MB_OK);
392         Result := false;
393         uDrugHasMaxData.CaptureMaxData := false;
394         Exit;
395       end;
396     Refills := CalcMaxRefills(tempDrug, daySupply, OI, false);
397     if tempRefills > Refills then
398       begin
399         infoBox('For this medication Quantity cannot be greater then ' + InttoStr(uDrugHasMaxData.MaxRefills), 'Cannot Save Error', MB_OK);
400         Result := false;
401         uDrugHasMaxData.CaptureMaxData := false;
402         Exit;
403       end;
404   end;