maintenance: title: Create Now And Then Orders;; mlmname: FORM_NOW_AND_THEN;; arden: version 2;; version: 5.00;; institution: St Clair Now And Then MLM;; author: Robert Spence, Eclipsys Corp Ext 7461;; specialist: Teresa Spicuzza, Eclipsys Corp Ext 7448;; date: 2010-02-09;; validation: testing;; library: purpose: Set Scheduled time to the next hour and gray out when user picks {{{SINGLE-QUOTE}}}Start Now{{{SINGLE-QUOTE}}} if in the start and then list Note: SCH Hospital Policy is to give now dose within the hour. Rounding to the next hour is approved and leads to better scheduling times. If in Admin and then list, flag for on order submit MLM to create extra order using 5.0 objects plus This MLM is also called from Form_Med_Irreg_Sched and FORM_HOLDORDER_REQUESTEDTIME ;; explanation: This MLM is called from Zosyn and other forms for meds Form: PRX_ljBnPrDsUa Change history 09.24.2010 DW Added routine for Hold session date handling 11.3.2010 TMS Added logic for hold session to remove stat frequency and change priority to scheduled/start time 02.24.2012 JP Added achanawala to user list to review mlm logic 01.30.2013 TMS MLM Revised to provide now dosing for non QxH orders. Previous version only used for interval dosing now a separate now order is generated and the order it is called from is scheduled for the next appropriate dose for frequency with static admin times, i.e, BID, TID, etc. CSR 26926 08.12.2013 TMS Added call to Form_RX_ORM_Instruct to populate fields for ORM instructions. CSR 31639 09.16.2013 TMS Modified alert message 10.08.2013 TMS Modified to enable now and then checkbox to all physcians an physician extenders. Changed the schedules with hourly intervals (QnH) to behave the same as the static schedules (BID) by creating a separate now order and scheduling the ongoing order for the correct time. CSR 26926 11.07.2013 TMS Commented out the users who can use the "now and then" functionality to allow nurses, secretaries and pharmacists access. CSR 26926 02.21.2104 TMS Update MLM to include Stat and Then functionality, enable use with PRN Orders. Added hidden field on forms to set to true when addl dose is created from MLM to eliminate user rechecking box upon reopening order and creating another now/stat order. Updated one time/day frequency logic to only present next dose pop up box when present time is past scheduled time of the day for the selected frequency. CSR 31883 02.21.2014 JML Modified MLM to use Total Doses UDDI to populate StopAfter as requested by PRISM CSR 31883 12.10.2014 TMS Added mlm call to FORM_Rx_HazWaste_DispInstruct on form open. CSR 31995 05.11.2015 TMS Added mlm call to FORM_RX_Stop_Date{{{SINGLE-QUOTE}}} for orders scheduled as Pre Op CSR 30589 and Added PRX_ResetDiluent as a new field to get passed to SCH_Now_and_Then_Generate_Order HD1663579 11.11.2015 TMS Added mlm call to FORM_ID_RepeatOrders_Rx if order name = "MethylPREDNISolone 4mg Dose Pak Tab" HD1855646 08.07.2017 SZ CSR #31162: Neonatal Morphine Dose/Volume Label (added section to call MLM: FORM_RX_NEONATAL_MORPHINE_LABEL) 11.09.2017 SZ CSR #33689: CPOE-VTE auto schedule (Added triggers to call mlm FORM_VTE_SCHEDULING) ;; keywords: Called MLMs, Form fields, Now and Then ;; knowledge: type: data-driven;; data: // This MLM is passed three arguments, of types // communication_type, form_type and client info object respectively. (this_communication, // Communication object this_form, // Form object client_info_obj //Arden ClientInfo object ) := argument; log_execution_info := false; standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; SCH_NOW_AND_THEN_FREQUENCY := MLM {{{SINGLE-QUOTE}}}SCH_NOW_AND_THEN_FREQUENCY{{{SINGLE-QUOTE}}}; SCH_NOW_AND_THEN_GENERATE_ORDER := MLM {{{SINGLE-QUOTE}}}SCH_NOW_AND_THEN_GENERATE_ORDER{{{SINGLE-QUOTE}}}; multidosemlm:= MLM {{{SINGLE-QUOTE}}}Form_Worx_Item_code_Per_Dose{{{SINGLE-QUOTE}}}; WorxRoute:= MLM {{{SINGLE-QUOTE}}}FORM_POPULATE_WORXROUTE_WITH_ORDERROUTECODE{{{SINGLE-QUOTE}}}; LovenoxCalc := MLM {{{SINGLE-QUOTE}}}Form_Lovenox_CalcDose_Simple{{{SINGLE-QUOTE}}}; LovenoxCalcCrCl := MLM {{{SINGLE-QUOTE}}}Form_Lovenox_Dose_calc{{{SINGLE-QUOTE}}}; HoldOrders := MLM {{{SINGLE-QUOTE}}}Form_HoldOrder_RequestedTime{{{SINGLE-QUOTE}}}; VancomycinCalc := MLM {{{SINGLE-QUOTE}}}Form_Vancomycin_WtBased{{{SINGLE-QUOTE}}}; HaloperidolOrders := MLM {{{SINGLE-QUOTE}}}Form_Haloperidol_IV_Orders{{{SINGLE-QUOTE}}}; MedicationReason := MLM {{{SINGLE-QUOTE}}}Form_RX_ORM_Instruct{{{SINGLE-QUOTE}}}; //*** CSR 31883 Change PediatricDosing := MLM {{{SINGLE-QUOTE}}}FORM_RX_PEDIATRIC_ACETAMINOPHEN{{{SINGLE-QUOTE}}}; DisposalInstruct := MLM {{{SINGLE-QUOTE}}}FORM_Rx_HazWaste_DispInstruct{{{SINGLE-QUOTE}}}; PreopStopAfter := MLM {{{SINGLE-QUOTE}}}FORM_RX_Stop_Date{{{SINGLE-QUOTE}}}; RepeatOrders := MLM {{{SINGLE-QUOTE}}}FORM_ID_RepeatOrders_Rx{{{SINGLE-QUOTE}}}; NeonatalMorphineLabel:= MLM {{{SINGLE-QUOTE}}}FORM_RX_NEONATAL_MORPHINE_LABEL{{{SINGLE-QUOTE}}}; // SZ CSR #31162 - Neonatal Morphine Dose/Volume Label //CSR 33689 SZ Change VTE_Med_Scheduling := MLM {{{SINGLE-QUOTE}}}FORM_VTE_SCHEDULING{{{SINGLE-QUOTE}}}; VTE_OSName := ("VTE Prophylaxis Orders (Medical & Surgical Patients)", "CCM Admission Orders", "Heparin Inj (SQ)", "Heparin Inj - 5,000 units SQ Q8H", "Heparin Inj - SQ", "Post Cardiac Arrest Induced Hypothermia", "Enoxaparin", //below are all Order Sets with "VTE Prophylaxis Orders (Medical & Surgical Patients)" embedded within them "Admission Orders - TIA Resolving Deficit", "Admission Orders - Acute Ischemic Stroke (Fixed Deficit)", "zzzAmputation Post Op", "Post Op ENT Surgery", "Post Op Cardiac/Peripheral Catheterization", "Nephrology (CPOE OS)", "CVSU Common OS", "ENT Admission", "Admission Orders - Urology", "Wound Debridement Post Op Orders", "Post Op Cardiac/Peripheral Diagnostic Catheterization", "Admission Orders - Chest Pain", "Post Op Open Chole", "Post Op Laparoscopic Colon Resection.", "Gastric Bypass Post Op", "Post Op Lap Chole", "Post Op Appendectomy", "Transition Orders - CHF", "Transition Orders - Chest Pain", "Transition Orders - COPD", "Transition Orders - Pneumonia", "Transition Orders - General Orders", "Observation Common Orders", "Transition Orders - Cellulitis", "Transition Orders - UTI", "Post Op General Surgery", "CVSU Common - Post Open Heart Progressive Care OS", "Transition Orders - PE", "Transition Orders - Afib", "Transition Orders - GI Bleed", "Transition Orders - Hip Fracture", "Post Op Colon Resection", "Internal Medicine Order Set", "Admission Orders - CHF", "Post Op Lap Nephrectomy", "Warfarin Orders", "Rivaroxaban"); VTE_OName := ("Heparin Inj", "Enoxaparin Inj", "Rivaroxaban 10mg Tab"); include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; error_message:=""; local_session := CDS_SESSION.local; field_list:= this_form.fields; str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; CallingField :=this_communication.CallingFieldName; CallingEvent := this_communication.CallingEvent; FormType := this_communication.FormType; form_name := this_form.Name; PrimaryObjdetail:=this_communication.PrimaryObj; MedicationOrder_dest := destination { ObjectsPlus } with [ alert_type := "Warning", short_message := "Object created by MLM, placed on worksheet", priority := "low", scope := "chart", rule_group := "Order Object", rule_number := 2010 ]; zz:= field_list.Records__; p:=this_communication.CallingFieldName; //**** CSR 31883 CHANGE StartNow := first of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" ); STATandThen := first of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then"); TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses"); AddlDoseOrdered := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Addl Dose"); StopAfter := first of (field_list.Value WHERE field_list.DataItemName="StopAfter" AND field_list.Label= "Stop After"); RequestedDate := first of (field_list WHERE field_list.DataItemName="RequestedDate" AND field_list.Control_MultiFieldOccNum=1 ); RequestedTime := first of (field_list.Value WHERE field_list.DataItemName="RequestedTime" AND field_list.Control_MultiFieldOccNum=1 ); dose := first of (field_list.Value WHERE field_list.DataItemName="DosageLow" AND field_list.Control_MultiFieldOccNum=1 ); dosehigh := first of (field_list.Value WHERE field_list.DataItemName="DosageHigh" AND field_list.Control_MultiFieldOccNum=1 ); Uom := first of (field_list.Value WHERE field_list.DataItemName="Uom" AND field_list.Control_MultiFieldOccNum=1 ); PRN_field := first of (field_list WHERE field_list.DataItemName="IsPrn" AND field_list.Control_MultiFieldOccNum=1 ); PRN := PRN_field.value; OrderRouteCode := first of (field_list.Value WHERE field_list.DataItemName="OrderRouteCode" AND field_list.Control_MultiFieldOccNum=1 ); Comm := last of (field_list where field_list.DataItemName = "PRX_NoteComment0"); session_type := PrimaryObjdetail.internalprocessingtype; regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode"); FrequencyCode := regular_freq.value; Frequency := FrequencyCode.FrequencySummary; WORxRoute_field := first of (field_list where field_list.DataItemName = "PRX_WORx_Route"); WORxRouteCode:= WorxRoute_field.value; InjRoutes := ("SQ", "IM", "IV PUSH", "IV", "Intradermally", "Intrathecally", "Intra-articular"); form_drug_field := first of (field_list where field_list.DataItemName = "PRX_DrugNameforMLM"); RxInstruct := first of (field_list.Value where field_list.DataItemname = "PRX_NoteComment0"); UserInstruct := first of (field_list.Value where field_list.DataItemname = "AdminInstructions"); PRX_PRN_Reason_field := first of (field_list where field_list.DataItemName = "PRX_PRNCONDITION"); // new fields Nonchemical_Restraint_Ind := first of (field_list.Value where field_list.DataItemname = "NUR_Nonchemical Restraint Ind"); ADMINS_AppSite := first of (field_list.Value where field_list.DataItemname = "PRX_ADMINS_AppSite"); ADMINS_GiveWith := first of (field_list.Value where field_list.DataItemname = "PRX_ADMINS_GiveWith"); AltPrintLocation := first of (field_list.Value where field_list.DataItemname = "PRX_AltPrintLocation"); BRANDNAME := first of (field_list.Value where field_list.DataItemname = "PRX_BRANDNAME"); Concentration := first of (field_list.Value where field_list.DataItemname = "PRX_Concentration"); CONCSTRENGTHUOM := first of (field_list.Value where field_list.DataItemname = "PRX_CONCSTRENGTHUOM"); CONCSTRVOLUMEUOM := first of (field_list.Value where field_list.DataItemname = "PRX_CONCSTRVOLUMEUOM"); DrugNameforMLM := first of (field_list.Value where field_list.DataItemname = "PRX_DrugNameforMLM"); NOTECOMMENT1 := first of (field_list.Value where field_list.DataItemname = "PRX_NOTECOMMENT1"); NOTECOMMENT2 := first of (field_list.Value where field_list.DataItemname = "PRX_NOTECOMMENT2"); NOTECOMMENT7 := first of (field_list.Value where field_list.DataItemname = "PRX_NOTECOMMENT7"); NOTECOMMENT8 := first of (field_list.Value where field_list.DataItemname = "PRX_NOTECOMMENT8"); OmitMessage := first of (field_list.Value where field_list.DataItemname = "PRX_OmitMessage"); PRNCONDITION := first of (field_list.Value where field_list.DataItemname = "PRX_PRNCONDITION"); TP_Application_Site := first of (field_list.Value where field_list.DataItemname = "PRX_TP_Application_Site"); Chemical_Restraint := first of (field_list.Value where field_list.DataItemname = "NUR_Chemical Restraint"); Not_Chemical_Restraint := first of (field_list.Value where field_list.DataItemname = "NUR_Not Chemical Restraint"); Aerochamber := first of (field_list.Value where field_list.DataItemname = "PRX_Aerochamber"); AutoVerify := first of (field_list.Value where field_list.DataItemname = "PRX_AutoVerify"); AWP := first of (field_list.Value where field_list.DataItemname = "PRX_AWP"); Inspirese := first of (field_list.Value where field_list.DataItemname = "PRX_Inspirese"); PrebuiltOrder := first of (field_list.Value where field_list.DataItemname = "PRX_PrebuiltOrder"); Pt_to_Admin := first of (field_list.Value where field_list.DataItemname = "PRX_Pt_to_Admin"); Resp_to_Admin := first of (field_list.Value where field_list.DataItemname = "PRX_Resp_to_Admin"); CONCSTRENGTH := first of (field_list.Value where field_list.DataItemname = "PRX_CONCSTRENGTH"); CONCSTRVOLUME := first of (field_list.Value where field_list.DataItemname = "PRX_CONCSTRVOLUME"); PhysReqNaCl := first of (field_list.Value where field_list.DataItemname = "PRX_ResetDiluent"); BaseSolutionprop := first of (field_list where field_list.DataItemname = "BaseSolution"); BaseSolutionFld := basesolutionprop.value; // start add in // Worx Drug code worxcoderaw:= first of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE"); worxcode:= worxcoderaw.value; // end add in continue_checking_order := TRUE; /* //commented out to make available to all users fire_on_User := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT"); // Get the current user{{{SINGLE-QUOTE}}}s occupation userguid := this_communication.UserGUID; UserCode := read last {"Select occupationcode " ||" From cv3user with (nolock) " ||" Where Guid = " || SQL(userguid) }; continue_checking_order := UserCode in fire_on_User; */ // if CallingEvent ="FormOpen" then //****CSR 31883 CHANGE // (this_communication, this_form) := call PediatricDosing WITH this_communication, this_form, client_info_obj; // if continue_checking_order = false then // StartNow.control_visible := FALSE; // STATandThen.control_visible := FALSE; // else // StartNow.Control_Visible := true; // STATandThen.Control_Visible := true; // TotalDosing.Control_Visible := true; // TotalDosing.Control_Read_Only := true; // endif; // endif; // added for hold session to set requested time to scheduled/start time with no time specified if session_type = "Hold" and CallingEvent = "FormClose" then (this_communication, this_form, client_info_obj) := call HoldOrders with (this_communication, this_form, client_info_obj); endif; if CallingEvent = "FormClose" then If OrderRouteCode in InjRoutes then (this_communication, this_form, client_info_obj) := call WorxRoute with (this_communication, this_form, client_info_obj); endif; If frequency = "Pre Op" then (this_communication, this_form, client_info_obj) := call PreopStopAfter with (this_communication, this_form, client_info_obj); endif; If exists form_drug_field and form_drug_field.value is not null then (this_communication, this_form, client_info_obj) := call multidosemlm with (this_communication, this_form, client_info_obj); endif; If PrimaryObjdetail.Name = "Enoxaparin Inj" then (this_communication, this_form, client_info_obj) := call LovenoxCalc with (this_communication, this_form, client_info_obj); endif; If PrimaryObjdetail.Name = "Enoxaparin Inj." then (this_communication, this_form, client_info_obj) := call LovenoxCalcCrCl with (this_communication, this_form, client_info_obj); endif; //CSR 33689 SZ Change If (PrimaryObjdetail.Name in VTE_OName) and (PrimaryObjdetail.OrderSetName in VTE_OSName) then (this_communication, this_form, client_info_obj) := call VTE_Med_Scheduling with (this_communication, this_form, client_info_obj); endif; If PrimaryObjdetail.Name = "Vancomycin:" then (this_communication, this_form, client_info_obj) := call VancomycinCalc with (this_communication, this_form, client_info_obj); endif; If PrimaryObjdetail.Name = "Haloperidol Inj" or PrimaryObjdetail.Name = "Haloperidol:" then (this_communication, this_form, client_info_obj) := call HaloperidolOrders with (this_communication, this_form, client_info_obj); endif; If PrimaryObjdetail.Name = "MethylPREDNISolone 4mg Dose Pak Tab" then (this_communication, this_form) := call RepeatOrders with (this_communication, this_form, client_info_obj); endif; // SZ CSR #31162 - Neonatal Morphine Dose/Volume Label If PrimaryObjdetail.Name = "Morphine Oral Solution Nursery (0.4mg/ml)" then (this_communication, this_form) := call NeonatalMorphineLabel with (this_communication, this_form, client_info_obj); endif; // Call MLM to add medication reason to RX Comments field for ORM (this_communication, this_form, client_info_obj) := call MedicationReason with (this_communication, this_form, client_info_obj); // Call MLM to check for waste disposal instructions (this_communication, this_form, client_info_obj) := call DisposalInstruct with (this_communication, this_form, client_info_obj); if session_type = "standard" then if continue_checking_order = true then if exists(StartNow) or (StatandThen) then FreqRules := (); FreqRules := read { "select value from cv3userdictionaryvalue v with (nolock)" || " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_Dosing Frequency{{{SINGLE-QUOTE}}} " || " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} " }; if (((StartNow.Value = true) or (STATandThen.Value = true)) and AddlDoseOrdered.value = false) then if StartNow.Value = true then NewOrderFreq := "Now"; MsgFreq1 := "NOW"; MsgFreq2 := "now"; else NewOrderFreq := "STAT"; MsgFreq1 := "STAT"; MsgFreq2 := "stat"; endif; freqfound:=(); NumMembs:= count FreqRules; for k in (1 seqto (NumMembs)) do listings := call str_parse with FreqRules[k],"|"; tempstr:=first of (listings); if tempstr = FrequencyCode.FrequencySummary then freqname := tempstr; if exists(listings[2]) then freqfound := freqfound,listings[2]; proctype := listings [2];endif; if exists(listings[3]) then freqfound := freqfound,listings[3]; plusminusvalue := listings [3];endif; endif; enddo; If FrequencyCode.FrequencySummary = "" or FrequencyCode.FrequencySummary = "" or FrequencyCode.FrequencySummary = "" or FrequencyCode.FrequencySummary is null or proctype is null then StartNow.Value := false; StartNow.control_read_only := true; STATandThen.Value := false; STATandThen.control_read_only := true; endif; if proctype = "S" then spanhourfromnow := (now + 30 minute); plusminus := (plusminusvalue as number); newstarttime := (spanhourfromnow as time) + (plusminus hour) ; newhr := extract hour newstarttime; if hr < 10 then hr := "0" || hr; endif; newyr := extract year newstarttime; newmn := extract month newstarttime; if mn < 10 then mn := "0" || mn; endif; newdd := extract day newstarttime; if dd < 10 then dd := "0" || dd; endif; filldate := newyr || "-" || newmn || "-" || newdd || " 00:00:00"; filltime := newhr || ":00:00"; hourtest := filltime; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := filltime; RequestedDate.value := filldate; RequestedDate.control_read_only := True; RequestedTime.control_read_only := True; makenow := true; /* ********* CSR 31883 Change if( StartNow.Value = true AND StopAfter.option = "Times") Then if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then Value1 := (StopAfter.NUMBER As number) + 1; WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Now and Then with " || Frequency || " and Stop After " || (StopAfter.NUMBER As number) || " Times will result in " || Value1 || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; endif; endif; if( StatandThen.Value = true AND StopAfter.option = "Times") Then if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then Value1 := (StopAfter.NUMBER As number) + 1; WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Stat and Then with " || Frequency || " and Stop After " || (StopAfter.NUMBER As number) || " Times will result in " || Value1 || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; endif; endif; */ endif; if proctype = "A" then blnUpdateFrequency := true; (Hour1,Hour2,Hour3,Hour4,Hour5) := Read last { " SELECT ISNULL([Hour1],{{{SINGLE-QUOTE}}}-99{{{SINGLE-QUOTE}}}) AS Hour1 , ISNULL([Hour2],{{{SINGLE-QUOTE}}}-99{{{SINGLE-QUOTE}}}) AS Hour2 " || " , ISNULL([Hour3],{{{SINGLE-QUOTE}}}-99{{{SINGLE-QUOTE}}}) AS Hour3 , ISNULL([Hour4],{{{SINGLE-QUOTE}}}-99{{{SINGLE-QUOTE}}}) AS Hour4 " || " , ISNULL([Hour5],{{{SINGLE-QUOTE}}}-99{{{SINGLE-QUOTE}}}) AS Hour5 FROM ( select {{{SINGLE-QUOTE}}}Hour{{{SINGLE-QUOTE}}}+CAST ((ROW_NUMBER() OVER( ORDER By ScheduledTime )) AS Varchar) As Hourd,ScheduledTime from CV3FixedScheduleDefinition " || " INNER JOIN CV3CodedFreqTranslation (NOLOCK) ON CV3FixedScheduleDefinition.ParentGUID = CV3CodedFreqTranslation.GUID " || " WHERE CV3CodedFreqTranslation.FrequencyCode = " || SQL(Frequency) || " AND CV3CodedFreqTranslation.Active = 1 and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}" || "AND CV3FixedScheduleDefinition.Active = 1 ) p PIVOT ( SUM(ScheduledTime) FOR [Hourd] IN ([Hour1] " || " , [Hour2] , [Hour3] , [Hour4] , [Hour5]) ) AS pvt " }; if ( (Hour1 As string) <> "-99") THen If ( (Hour1 As number) <= 999) THen if((Hour1 As number) = "0") then Hour1 := "0000"; else Hour1 := "0" || (Hour1 As string); endif; endif; schedhour1 := substring 2 characters starting at 1 from (Hour1 As string); schedmin1 := substring 2 characters starting at 3 from (Hour1 As string); if (schedhour1 as number) >= 12 then timeofday1 := "PM"; if (schedhour1 as number) >= 13 then schedhour1 := (schedhour1 as number) - 12; endif; else timeofday1 := "AM"; if (schedhour1 as number) = 00 then schedhour1 := 12; endif; if (schedhour1 as number) <= 9 then schedhour1 := substring 1 characters starting at 2 from schedhour1; endif; endif; Hour1Txt := schedhour1 || ":" || schedmin1 || timeofday1; endif; if ( (Hour2 As string) <> "-99") THen If ( (Hour2 As number) <= 999) THen if((Hour2 As number) = 0) then Hour2 := "0000"; else Hour2 := "0" || (Hour2 As string); endif; endif; schedhour2 := substring 2 characters starting at 1 from (Hour2 as string); schedmin2 := substring 2 characters starting at 3 from (Hour2 as string); if (schedhour2 as number) >= 12 then timeofday2 := "PM"; if (schedhour2 as number) >= 13 then schedhour2 := (schedhour2 as number) - 12; endif; else timeofday2 := "AM"; if (schedhour2 as number) = 00 then schedhour2 := 12; endif; if (schedhour2 as number) <= 9 then schedhour2 := substring 1 characters starting at 2 from schedhour2; endif; endif; hour2Txt := schedhour2 || ":" || schedmin2 || timeofday2; endif; if ( (Hour3 As string) <> "-99") THen If ( (Hour3 As number) <= 999) THen if((Hour3 As number) = 0) then Hour3 := "0000"; else Hour3 := "0" || (Hour3 As string); endif; endif; schedhour3 := substring 2 characters starting at 1 from (Hour3 As string); schedmin3 := substring 2 characters starting at 3 from (Hour3 As string); if (schedhour3 as number) >= 12 then timeofday3 := "PM"; if (schedhour3 as number) >= 13 then schedhour3 := (schedhour3 as number) - 12; endif; else timeofday3 := "AM"; if (schedhour3 as number) = 00 then schedhour3 := 12; endif; if (schedhour3 as number) <= 9 then schedhour3 := substring 1 characters starting at 2 from schedhour3; endif; endif; hour3Txt := schedhour3 || ":" || schedmin3 || timeofday3; endif; if ( (Hour4 As string) <> "-99") THen If ( (Hour4 As number) <= 999) THen if((Hour4 As number) = 0) then Hour4 := "0000"; else Hour4 := "0" || (Hour4 as string); endif; endif; schedhour4 := substring 2 characters starting at 1 from (Hour4 as string); schedmin4 := substring 2 characters starting at 3 from (Hour4 as string); if (schedhour4 as number) >= 12 then timeofday4 := "PM"; if (schedhour4 as number) >= 13 then schedhour4 := (schedhour4 as number) - 12; endif; else timeofday4 := "AM"; if (schedhour4 as number) = 00 then schedhour4 := 12; endif; if (schedhour4 as number) <= 9 then schedhour4 := substring 1 characters starting at 2 from schedhour4; endif; endif; hour4Txt := schedhour4 || ":" || schedmin4 || timeofday4; endif; if ( (Hour5 As String) <> "-99") THen If ( (Hour5 As number) <= 999) THen if((Hour5 As number) = 0) then Hour5 := "0000"; else Hour5 := "0" || (Hour5 as string); endif; endif; schedhour5 := substring 2 characters starting at 1 from (Hour5 as string); schedmin5 := substring 2 characters starting at 3 from (Hour5 as string); if (schedhour5 as number) >= 12 then timeofday5 := "PM"; if (schedhour5 as number) >= 13 then schedhour5 := (schedhour5 as number) - 12; endif; else timeofday5 := "AM"; if (schedhour5 as number) = 00 then schedhour5 := 12; endif; if (schedhour5 as number) <= 9 then schedhour5 := substring 1 characters starting at 2 from schedhour5; endif; endif; hour5Txt := schedhour5 || ":" || schedmin5 || timeofday5; endif; Hour1 := (Hour1 as string); Hour2 := (Hour2 as string); Hour3 := (Hour3 as string); Hour4 := (Hour4 as string); Hour5 := (Hour5 as string); if( blnUpdateFrequency = true AND (StartNow.Value = true or StatandThen.Value = true)) then /* *********** CSR 31883 Change if( StartNow.Value = true AND StopAfter.option = "Times") Then if((StopAfter.NUMBER) is not null AND (StopAfter.NUMBER) <> "" AND (StopAfter.NUMBER As number) >= 1) Then Value1 := (StopAfter.NUMBER As number) + 1; WarningResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Selecting Start Now with " || Frequency || " and Stop After " || (StopAfter.NUMBER As number) || " Times will result in " || Value1 || " doses being administered.","Alert","Ok" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}},"Warning" As {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}}; endif; endif; */ plusminus := plusminusvalue; eMinute := extract minute now; if( length( (eMinute As String)) = 1) then eminute := "0" || ( (eMinute As String)) ; else eminute := extract minute now; endif; Currenthour := extract hour now || eminute; blnUpdateFrequency := false; Hour1Rangemax := (Hour1 as number) + (Plusminus|| "00" As number) ; Hour1Rangemin := (Hour1 as number) - (Plusminus|| "00" As number) ; Hour2Rangemax := (Hour2 as number) + (Plusminus|| "00" As number); Hour2Rangemin := (Hour2 as number) - (Plusminus|| "00" As number) ; endif; endif; //End If procType = A // Get Current worksheet info ***** START ***** // Get the currently logged on user Active_ClientVisitGUID := this_communication.ClientVisitGUID; Active_OrderGUID:= PrimaryObjdetail.GUID; Active_SignificiantDtm:= Now; location_guid := read last {"select CurrentLocationGUID from CV3ClientVisit where GUID=" || SQL(Active_ClientVisitGUID)}; //TRY try //----------------------------------------------------------- // Retrieve current order entry batch. // The companion order can be added only if the parent order // belongs to the order entry batch // object owned by the OrderEntryWorksheet. //----------------------------------------------------------- worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent; if worksheetInfo is NULL OR "OrderEntryWorksheet" <> (worksheetInfo.OrderBatchOwner as String) then z:=0; endif; //------------------------------------------------------------ // Get the .NET version of the Client Visit object. // Needed to create new ObjectsPlus object //------------------------------------------------------------ client_visit_obj := call {{{SINGLE-QUOTE}}}ClientVisit{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((Active_ClientVisitGUID as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}) ; //----------------------------------------------------------- // Check the order entry worksheet. If there are no entries // already on the worksheet set the initial values for // the worksheet. //----------------------------------------------------------- if worksheetInfo.UnsubmittedOrdersCount = 0 then // If there are no orders on the worksheet set // defaults that will be used to create the orders WSSessionType := "Standard"; WSSessionReason := "Orders created by MLM"; WSRequestedBySource := ""; // Set the session type and reason on the worksheet void := call worksheetInfo.SetSessionType with (WSSessionType, WSSessionReason); // Set the requesting source string worksheetInfo.RequestedBySource := WSRequestedBySource; //Get the current user as the default care provider WSRequestedBy_obj := call {{{SINGLE-QUOTE}}}CareProvider{{{SINGLE-QUOTE}}}.FindById with ( user_IDType, user_IDCode ); //Set the requesting provider worksheetInfo.RequestedBy := WSRequestedBy_obj; // Get the location that will be used for the orders. WSlocation_obj := call {{{SINGLE-QUOTE}}}Location{{{SINGLE-QUOTE}}}.FindByPrimaryKey with ((location_guid as number) as {{{SINGLE-QUOTE}}}Int64{{{SINGLE-QUOTE}}}); //Set the expected release location group worksheetInfo.ExpectedReleaseLocationGroup := WSlocation_obj; //Dispose RequestedBy CareProvider if( WSRequestedBy_obj is NOT NULL ) then void := call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif; //Dispose ExpectedReleaseLocationGroup if( WSlocation_obj is NOT NULL ) then void := call WSlocation_obj.Dispose; WSlocation_obj:= null; endif; else //If there are orders on the worksheet retrieve the default values // on the worksheet. // These values are not required for this sample MLM however they // contain useful information that can be used in the logic of an // MLM. WSSessionType := worksheetInfo.SessionType; WSSessionReason := worksheetInfo.SessionReason; WSRequestedBySource := worksheetInfo.RequestedBySource; WSRequestedBy_obj := worksheetInfo.RequestedBy; WSlocation_obj := worksheetInfo.ExpectedReleaseLocationGroup; endif; endtry; catch Exception ex error_occurred := true; error_message := "{{+R}}Common Data:{{-R}}\n" || ex.Message || "\n\n"; if( worksheetInfo is NOT NULL ) then void := call worksheetInfo.Dispose; worksheetInfo:= null; endif; if( client_visit_obj is NOT NULL ) then void := call client_visit_obj.Dispose; client_visit_obj:= null; endif; if( WSRequestedBy_obj is NOT NULL ) then void := call WSRequestedBy_obj.Dispose; WSRequestedBy_obj:= null; endif; if( WSlocation_obj is NOT NULL ) then void := call WSlocation_obj.Dispose; WSlocation_obj:= null; endif; // If unable to initialize starting data, do not continue // with the creation of any orders. // Still conclude true as the error message needs to // be displayed as an error. //conclude true; endcatch; // QxH schedules if ((proctype = "S")or (makenow = true)) Then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hourtest, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Now, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := filldate; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hourtest; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; elseif proctype = "A" then //BID Schedules if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 = "-99" AND Hour4 = "-99" AND Hour5 = "-99" ) then if( (Currenthour As number) < (Hour1Rangemin As Number)) then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult as string) = "No") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; if((dialogResult as string) = "Yes") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour2, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //if( (Currenthour As number) < (Hour1Rangemin As Number)) if( (Currenthour AS Number) >= (Hour1Rangemin AS Number) AND (Currenthour AS Number) <= (Hour1Rangemax AS Number) ) then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour2, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; //(Currenthour AS Number) >= (Hour1Rangemin AS Number) AND (Currenthour AS Number) <= (Hour1Rangemax AS Number) ) then if( (Currenthour AS Number) > (Hour1Rangemax AS Number) AND (Currenthour AS Number) < (Hour2Rangemin As Number)) then Active_SignificantPlusOneDtm := Active_SignificiantDtm + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour2Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult2 as string) = "No") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour2, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; if((dialogResult2 as string) = "Yes") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm , RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //Currenthour AS Number) > (Hour1Rangemax AS Number) AND (Currenthour AS Number) < (Hour2Rangemin As Number)) then if( (Currenthour AS Number) >= (Hour2Rangemin AS Number) AND (Currenthour AS Number) <= (Hour2Rangemax As Number) ) then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm , RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; if((Currenthour AS Number) > (Hour2Rangemax As Number) AND (Currenthour AS Number) <= 2359) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " dose on " || Active_SignificantPlusOneISODate || "?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult3 as string) = "No") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm , RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; if((dialogResult3 as string) = "Yes") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour2, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificiantDtm , RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //Currenthour AS Number) > (Hour2Rangemax As Number) AND (Currenthour AS Number) <= 2359) then endif; // if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 = "-99" AND Hour4 = "-99" AND Hour5 = "-99 // Daily Schedules if( Hour1 <> "-99" AND Hour2 = "-99" AND Hour3 = "-99" AND Hour4 = "-99" AND Hour5 = "-99" ) then if( (Currenthour As number) < (Hour1Rangemin As Number)) then Active_SignificantPlusOneDtm1x := Now; Active_SignificantPlusTwoDtm1x := Active_SignificantPlusOneDtm1x + 1 day; Active_SignificantPlusOneISODate1x := (extract month Active_SignificantPlusOneDtm1x) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm1x) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm1x) formatted with "%04d" ; Active_SignificantPlusTwoISODate1x := (extract month Active_SignificantPlusTwoDtm1x) formatted with "%02d" || "-" || (extract day Active_SignificantPlusTwoDtm1x) formatted with "%02d" || "-" || (extract year Active_SignificantPlusTwoDtm1x) formatted with "%04d" ; dialogResult4 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " dose on " || Active_SignificantPlusOneISODate1x || "?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " ||Active_SignificantPlusTwoISODate1x ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate1x ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4 as string) = "No") then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificantPlusOneISODate1x, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificantPlusOneDtm1x; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; if((dialogResult4 as string) = "Yes") then Active_SignificantPlusOneDtm1x := Active_SignificantPlusOneDtm1x + 1 day; zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificantPlusOneDtm1x , RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificantPlusOneDtm1x ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //if( (Currenthour As number) < (Hour1Rangemin As Number)) if( (Currenthour AS Number) >= (Hour1Rangemin AS Number) AND (Currenthour AS Number) <= (Hour1Rangemax AS Number) ) then Active_SignificantPlusOneDtm1x := Now; Active_SignificantPlusTwoDtm1x := Active_SignificantPlusOneDtm1x + 1 day; Active_SignificantPlusOneISODate1x := (extract month Active_SignificantPlusOneDtm1x) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm1x) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm1x) formatted with "%04d" ; Active_SignificantPlusTwoISODate1x := (extract month Active_SignificantPlusTwoDtm1x) formatted with "%02d" || "-" || (extract day Active_SignificantPlusTwoDtm1x) formatted with "%02d" || "-" || (extract year Active_SignificantPlusTwoDtm1x) formatted with "%04d" ; zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificantPlusOneISODate1x, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificantPlusTwoISODate1x; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; if (Currenthour AS Number) > (Hour1Rangemax AS Number) then Active_SignificantPlusOneDtm1x := Now + 1 day; Active_SignificantPlusTwoDtm1x := Active_SignificantPlusOneDtm1x + 1 day; Active_SignificantPlusOneISODate1x := (extract month Active_SignificantPlusOneDtm1x) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm1x) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm1x) formatted with "%04d" ; //tms remove pop up box for one time/day order to start on a different day then now/stat order /* Active_SignificantPlusTwoISODate1x := (extract month Active_SignificantPlusTwoDtm1x) formatted with "%02d" || "-" || (extract day Active_SignificantPlusTwoDtm1x) formatted with "%02d" || "-" || (extract year Active_SignificantPlusTwoDtm1x) formatted with "%04d" ; dialogResult4 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "2Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " dose on " || Active_SignificantPlusOneISODate1x || "?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " ||Active_SignificantPlusTwoISODate1x ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate1x ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4 as string) = "No") then */ zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificantPlusOneISODate1x, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; RequestedDate.Value := Active_SignificantPlusOneDtm1x; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; //tms remove pop up box for one time/day order to start on a different day then now/stat order // endif; /* if((dialogResult4 as string) = "Yes") then Active_SignificantPlusOneDtm1x := Active_SignificantPlusOneDtm1x + 1 day; zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour1, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Active_SignificantPlusOneDtm1x , RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, client_visit_obj; StartNow.Value := false; RequestedDate.Value := Active_SignificantPlusOneDtm1x ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; endif; */ endif; //if ((Currenthour AS Number) > (Hour1 As Number)) Then endif; // if daily order //TID Schedules if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 <> "-99" AND Hour4 = "-99" AND Hour5 = "-99" ) then Hour3Rangemax := (Hour3 as number) + (Plusminus|| "00" As number); Hour3Rangemin := (Hour3 as number) - (Plusminus|| "00" As number) ; Active_SignificiantDtm3x := Now; Hour3x := 0000; b3x := false; if( (Currenthour As number) < (Hour1Rangemin As Number)) then dialogResult3x1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1 || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult3x1 as string) = "No") then Active_SignificiantDtm3x := Active_SignificiantDtm; Hour3x := Hour1; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b3x := true; endif; if((dialogResult3x1 as string) = "Yes") then Active_SignificiantDtm3x := Active_SignificiantDtm; Hour3x := Hour2; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b3x := true; endif; endif; if( (Currenthour AS Number) >= (Hour1Rangemin AS Number) AND (Currenthour AS Number) <= (Hour1Rangemax AS Number) ) then Active_SignificiantDtm3x := Active_SignificiantDtm; Hour3x := Hour2; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b3x := true; endif; if( (Currenthour AS Number) > (Hour1Rangemax AS Number) AND (Currenthour AS Number) < (Hour2Rangemin As Number)) then dialogResult3x2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour2Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour3Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult3x2 as string) = "No") then Active_SignificiantDtm3x := Active_SignificiantDtm; Hour3x := Hour2; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b3x := true; endif; if((dialogResult3x2 as string) = "Yes") then Active_SignificiantDtm3x := Active_SignificiantDtm ; Hour3x := Hour3; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b3x := true; endif; endif; if( (Currenthour AS Number) >= (Hour2Rangemin AS Number) AND (Currenthour AS Number) <= (Hour2Rangemax As Number) ) then Active_SignificiantDtm3x := Active_SignificiantDtm ; Hour3x := Hour3; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b3x := true; endif; if( (Currenthour AS Number) > (Hour2Rangemax AS Number) AND (Currenthour AS Number) < (Hour3Rangemin As Number)) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult3x3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour3Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour3Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult3x3 as string) = "No") then Active_SignificiantDtm3x := Active_SignificiantDtm; Hour3x := Hour3; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b3x := true; endif; if((dialogResult3x3 as string) = "Yes") then Active_SignificiantDtm3x := Active_SignificiantDtm ; Hour3x := Hour1; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b3x := true; endif; endif; if( (Currenthour AS Number) >= (Hour3Rangemin AS Number) AND (Currenthour AS Number) <= (Hour3Rangemax As Number) ) then Active_SignificiantDtm3x := Active_SignificiantDtm + 1 day; Hour3x := Hour1; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm + 1 day ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b3x := true; endif; if((Currenthour AS Number) > (Hour3Rangemax As Number) AND (Currenthour AS Number) <= 2359) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult3x4 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ||" dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult3x4 as string) = "No") then Active_SignificiantDtm3x := Active_SignificiantDtm + 1 day; Hour3x := Hour1; StartNow.Value := false; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b3x := true; endif; if((dialogResult3x4 as string) = "Yes") then Active_SignificiantDtm3x := Active_SignificiantDtm + 1 day; Hour3x := Hour2; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b3x := true; endif; endif; if(b3x = true) Then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour3x, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Now, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 <> "-99" AND Hour4 = "-99" AND Hour5 = "-99" ) then //QID Schedules if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 <> "-99" AND Hour4 <> "-99" AND Hour5 = "-99" ) then Hour3Rangemax := (Hour3 as number) + (Plusminus|| "00" As number); Hour3Rangemin := (Hour3 as number) - (Plusminus|| "00" As number) ; Hour4Rangemax := (Hour4 as number) + (Plusminus|| "00" As number); Hour4Rangemin := (Hour4 as number) - (Plusminus|| "00" As number) ; Active_SignificiantDtm4x := Now; Hour4x := 0000; b4x := false; if( (Currenthour As number) < (Hour1Rangemin As Number)) then dialogResult4x1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4x1 as string) = "No") then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour1; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b4x := true; endif; if((dialogResult4x1 as string) = "Yes") then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour2; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b4x := true; endif; endif; if( (Currenthour AS Number) >= (Hour1Rangemin AS Number) AND (Currenthour AS Number) <= (Hour1Rangemax AS Number) ) then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour2; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b4x := true; endif; if( (Currenthour AS Number) > (Hour1Rangemax AS Number) AND (Currenthour AS Number) < (Hour2Rangemin As Number)) then dialogResult4x2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour2Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour3Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4x2 as string) = "No") then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour2; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b4x := true; endif; if((dialogResult4x2 as string) = "Yes") then Active_SignificiantDtm4x := Active_SignificiantDtm ; Hour4x := Hour3; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b4x := true; endif; endif; if( (Currenthour AS Number) >= (Hour2Rangemin AS Number) AND (Currenthour AS Number) <= (Hour2Rangemax As Number) ) then Active_SignificiantDtm4x := Active_SignificiantDtm ; Hour4x := Hour3; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b4x := true; endif; if( (Currenthour AS Number) > (Hour2Rangemax AS Number) AND (Currenthour AS Number) < (Hour3Rangemin As Number)) then dialogResult4x3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour3Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour4Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour3Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4x3 as string) = "No") then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour3; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b4x := true; endif; if((dialogResult4x3 as string) = "Yes") then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour4; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour4; b4x := true; endif; endif; if( (Currenthour AS Number) >= (Hour3Rangemin AS Number) AND (Currenthour AS Number) <= (Hour3Rangemax As Number) ) then Active_SignificiantDtm4x := Active_SignificiantDtm ; Hour4x := Hour4; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour4; b4x := true; endif; if( (Currenthour AS Number) > (Hour3Rangemax AS Number) AND (Currenthour AS Number) < (Hour4Rangemin As Number)) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult4x4 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour4Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour4Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4x4 as string) = "No") then Active_SignificiantDtm4x := Active_SignificiantDtm; Hour4x := Hour4; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour4; b4x := true; endif; if((dialogResult4x4 as string) = "Yes") then Active_SignificiantDtm4x := Active_SignificiantDtm + 1 day; Hour4x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b4x := true; endif; endif; if( (Currenthour AS Number) >= (Hour4Rangemin AS Number) AND (Currenthour AS Number) <= (Hour4Rangemax As Number) ) then Active_SignificiantDtm4x := Active_SignificiantDtm + 1 day ; Hour4x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b4x := true; endif; if((Currenthour AS Number) > (Hour4Rangemax As Number) AND (Currenthour AS Number) <= 2359) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult4x5 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " on " || Active_SignificantPlusOneISODate || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult4x5 as string) = "No") then Active_SignificiantDtm4x := Active_SignificiantDtm + 1 day; Hour4x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b4x := true; endif; if((dialogResult4x5 as string) = "Yes") then Active_SignificiantDtm4x := Active_SignificiantDtm + 1 day; Hour4x := Hour2; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b4x := true; endif; endif; if(b4x = true) Then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour4x, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Now, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 <> "-99" AND Hour4 <> "-99" AND Hour5 = "-99" ) then //5x/day Schedules if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 <> "-99" AND Hour4 <> "-99" AND Hour5 <> "-99" ) then Hour3Rangemax := (Hour3 as number) + (Plusminus|| "00" As number); Hour3Rangemin := (Hour3 as number) - (Plusminus|| "00" As number) ; Hour4Rangemax := (Hour4 as number) + (Plusminus|| "00" As number); Hour4Rangemin := (Hour4 as number) - (Plusminus|| "00" As number) ; Hour5Rangemax := (Hour5 as number) + (Plusminus|| "00" As number); Hour5Rangemin := (Hour5 as number) - (Plusminus|| "00" As number) ; Active_SignificiantDtm5x := Now; Hour5x := 0000; b5x := false; if( (Currenthour As number) < (Hour1Rangemin As Number)) then dialogResult5x1 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult5x1 as string) = "No") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour1; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b5x := true; endif; if((dialogResult5x1 as string) = "Yes") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour2; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b5x := true; endif; endif; if( (Currenthour AS Number) >= (Hour1Rangemin AS Number) AND (Currenthour AS Number) <= (Hour1Rangemax AS Number) ) then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour2; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b5x := true; endif; if( (Currenthour AS Number) > (Hour1Rangemax AS Number) AND (Currenthour AS Number) < (Hour2Rangemin As Number)) then dialogResult5x2 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour2Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour3Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult5x2 as string) = "No") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour2; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b5x := true; endif; if((dialogResult5x2 as string) = "Yes") then Active_SignificiantDtm5x := Active_SignificiantDtm ; Hour5x := Hour3; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b5x := true; endif; endif; if( (Currenthour AS Number) >= (Hour2Rangemin AS Number) AND (Currenthour AS Number) <= (Hour2Rangemax As Number) ) then Active_SignificiantDtm5x := Active_SignificiantDtm ; Hour5x := Hour3; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b5x := true; endif; if( (Currenthour AS Number) > (Hour2Rangemax AS Number) AND (Currenthour AS Number) < (Hour3Rangemin As Number)) then dialogResult5x3 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour3Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour4Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour3Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult5x3 as string) = "No") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour3; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour3; b5x := true; endif; if((dialogResult5x3 as string) = "Yes") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour4; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour4; b5x := true; endif; endif; if( (Currenthour AS Number) >= (Hour3Rangemin AS Number) AND (Currenthour AS Number) <= (Hour3Rangemax As Number) ) then Active_SignificiantDtm5x := Active_SignificiantDtm ; Hour5x := Hour4; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour4; b5x := true; endif; if( (Currenthour AS Number) > (Hour3Rangemax AS Number) AND (Currenthour AS Number) < (Hour4Rangemin As Number)) then dialogResult5x4 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour4Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour5Txt ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour4Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult5x4 as string) = "No") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour4; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour4; b5x := true; endif; if((dialogResult5x4 as string) = "Yes") then Active_SignificiantDtm5x := Active_SignificiantDtm + 1 day; Hour5x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b5x := true; endif; endif; if( (Currenthour AS Number) >= (Hour4Rangemin AS Number) AND (Currenthour AS Number) <= (Hour4Rangemax As Number) ) then Active_SignificiantDtm5x := Active_SignificiantDtm ; Hour5x := Hour5; RequestedDate.Value := Active_SignificiantDtm ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour5; b5x := true; endif; if( (Currenthour AS Number) > (Hour4Rangemax AS Number) AND (Currenthour AS Number) < (Hour5Rangemin As Number)) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult5x5 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}"|| MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour5Txt || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour5Txt ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult5x5 as string) = "No") then Active_SignificiantDtm5x := Active_SignificiantDtm; Hour5x := Hour5; RequestedDate.Value := Active_SignificiantDtm; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour5; b5x := true; endif; if((dialogResult5x5 as string) = "Yes") then Active_SignificiantDtm5x := Active_SignificiantDtm + 1 day; Hour5x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b5x := true; endif; endif; if( (Currenthour AS Number) >= (Hour5Rangemin AS Number) AND (Currenthour AS Number) <= (Hour5Rangemax As Number) ) then Active_SignificiantDtm5x := Active_SignificiantDtm + 1 day ; Hour5x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day ; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b5x := true; endif; if((Currenthour AS Number) > (Hour5Rangemax As Number) AND (Currenthour AS Number) <= 2359) then Active_SignificantPlusOneDtm := Now + 1 day; Active_SignificantPlusOneISODate := (extract month Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract day Active_SignificantPlusOneDtm) formatted with "%02d" || "-" || (extract year Active_SignificantPlusOneDtm) formatted with "%04d" ; dialogResult5x6 := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Do you want the {{{SINGLE-QUOTE}}}" || MsgFreq1 || "{{{SINGLE-QUOTE}}} dose to replace the " || Hour1Txt || " on " || Active_SignificantPlusOneISODate || " dose?" ||" .\n\n Choose YES to give a " || MsgFreq2 || " dose and then start at " || Hour2Txt || " on " || Active_SignificantPlusOneISODate ||" .\n\n Choose NO to give a " || MsgFreq2 || " dose and then start at " || Hour1Txt || " on " || Active_SignificantPlusOneISODate ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; if((dialogResult5x4 as string) = "No") then Active_SignificiantDtm5x := Active_SignificiantDtm + 1 day; Hour5x := Hour1; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour1; b5x := true; endif; if((dialogResult5x4 as string) = "Yes") then Active_SignificiantDtm5x := Active_SignificiantDtm + 1 day; Hour5x := Hour2; RequestedDate.Value := Active_SignificiantDtm + 1 day; RequestedTime.ReqTimeCode := "Scheduled/Start Time"; RequestedTime.ReqTimeValue := Hour2; b5x := true; endif; endif; if(b5x = true) Then zz_call := call SCH_NOW_AND_THEN_GENERATE_ORDER with PrimaryObjdetail.Name, PrimaryObjdetail.Modifier, NewOrderFreq, Hour5x, dose, dosehigh, Uom, PRN, OrderRouteCode, worksheetInfo, Active_OrderGUID, Now, RxInstruct, UserInstruct, WorxRouteCode, WorxCode, Nonchemical_Restraint_Ind, ADMINS_AppSite, ADMINS_GiveWith, AltPrintLocation, BRANDNAME, Concentration, CONCSTRENGTHUOM, CONCSTRVOLUMEUOM, DrugNameforMLM, NOTECOMMENT1, NOTECOMMENT2, NOTECOMMENT7, NOTECOMMENT8, OmitMessage, PRNCONDITION, TP_Application_Site, Chemical_Restraint, Not_Chemical_Restraint, Aerochamber, AutoVerify,AWP, Inspirese, PrebuiltOrder, Pt_to_Admin, Resp_to_Admin, CONCSTRENGTH, CONCSTRVOLUME, BaseSolutionFld.Name, BaseSolutionFld.Dose, BaseSolutionFld.Uom, PhysReqNaCl, client_visit_obj; StartNow.Control_Read_Only := true; StatandThen.Control_Read_Only := true; AddlDoseOrdered.value := true; // PRN_field.Control_Read_Only := true; regular_freq.control_Read_Only := true; endif; endif; //if( Hour1 <> "-99" AND Hour2 <> "-99" AND Hour3 <> "-99" AND Hour4 <> "-99" AND Hour5 <> "-99" ) then endif; //if( blnUpdateFrequency = true AND this_communication.DisplayForm if proctype is null then // if start now = true //else // if start now = true RequestedTime.ReqTimeCode := NULL; RequestedTime.ReqTimeValue := NULL; RequestedDate.value := NULL; RequestedDate.control_read_only := false; RequestedTime.control_read_only := false; StartNow.Value := false; StartNow.control_read_only := true; StatandThen.Value := false; StatandThen.control_read_only := true; endif; endif; //if (StartNow.Value = true) or (STATandThen.Value = true) endif; //if exists(StartNow) or (StatandThen) endif; //if continue_checking_order = true endif; // if session_type = "standard" endif; //if (CallingEvent = "FormClose") ;; evoke: // No evoke statement ;; logic: conclude true; ;; action: // This MLM returns two parameters, of types communication_type and form_type respectively. return this_communication, this_form; ;; end: