Ejemplo n.º 1
0
        public static object GetMedicationBalance(string JMMedPrescriptionID, string MedicationType)
        {
            JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();

            objJMMMedPrescriptionHist.JMMedPrescriptionID = KPIHlp.CVI64(JMMedPrescriptionID);
            objJMMMedPrescriptionHist.MedicationType      = MedicationType;
            objJMMMedPrescriptionHist.CurQuantity         = new JMMMedPrescriptionHistBL().GetMedicationBalance(ref objJMMMedPrescriptionHist);
            return((new System.Web.Script.Serialization.JavaScriptSerializer()).Serialize(objJMMMedPrescriptionHist));
        }
Ejemplo n.º 2
0
        private bool Save()
        {
            try
            {
                JMMMedPrescription objJMMMedPrescription = new JMMMedPrescriptionBL().Select(KPIHlp.CVI64(hdnPrescriptionID.Value));

                JMMMedPrescriptionHist objJMMMedPrescriptionHist = ReadScr(ref objJMMMedPrescription);
                objJMMMedPrescription.JMMedPrescriptionID = KPIHlp.CVI64(hdnPrescriptionID.Value);


                if (objJMMMedPrescriptionHist != null && objJMMMedPrescription != null)
                {
                    if (Request.QueryString.Get("Flag") != null && Request.QueryString.Get("Flag") != string.Empty)
                    {
                        if (hdnMode.Value == UIMode.ADD.ToString())
                        {
                            new JMMMedPrescriptionHistBL().Manage(objJMMMedPrescriptionHist);
                            ShowMsg(MsgType.Success, FrwkMsg.ADD_SUCCESS);
                            hdnMedPresHisID.Value = objJMMMedPrescriptionHist.JMMedPrescriptionHistID.Value.ToString();
                            AutoUpdateParent();
                        }
                        else
                        {
                            ShowMsg(MsgType.Success, FrwkMsg.UPD_SUCCESS);
                        }
                        hdnMode.Value      = UIMode.INQ.ToString();
                        blnForceModeChange = true;
                    }
                    else
                    {
                        if (hdnMode.Value == UIMode.ADD.ToString())
                        {
                            new JMMMedPrescriptionHistBL().Manage(objJMMMedPrescriptionHist);
                            ShowMsg(MsgType.Success, FrwkMsg.ADD_SUCCESS);
                            hdnMedPresHisID.Value = string.Empty; //objJMMMedPrescriptionHist.JMMedPrescriptionHistID.Value.ToString();
                            ClearData();
                            cddDrug.DropDown.Items.Clear();
                            cddDrug.DropDown.DataTextField  = "Description";
                            cddDrug.DropDown.DataValueField = "ID";
                            cddDrug.DropDown.DataBind();

                            ListItem objItem1 = new ListItem("--", "");
                            cddDrug.DropDown.Items.Insert(0, objItem1);
                            AddClientOnLoadScript("fn_ClearData();");
                        }
                    }
                }
            }
            catch (KPIException objKPIError)
            {
                ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objKPIError);
            }
            return(true);
        }
Ejemplo n.º 3
0
 protected void ReadScr(ref JMMMedPrescriptionHist objJMMMedPrescriptionHist)
 {
     try
     {
         usrMedMarBasicSrch objusrMedMarBasicSrch = (usrMedMarBasicSrch)this.tabSuspSrch.Tabs.FindTabFromKey("BSC").FindControl("usrMedMarBasicSrch");
         objusrMedMarBasicSrch.ReadScr(ref objJMMMedPrescriptionHist);
     }
     catch (Exception objErr)
     {
         ShowMsg(MsgType.Error, FrwkMsg.PAGE_ERR, objErr);
     }
 }
Ejemplo n.º 4
0
        public static string GetMedPassHistory(List <string> arr)
        {
            JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();

            if (KPIHlp.CVI64(arr[0]) != long.MinValue)
            {
                objJMMMedPrescriptionHist.JMBuildID = KPIHlp.CVI64(arr[0]);
            }
            if (KPIHlp.CVI64(arr[1]) != long.MinValue)
            {
                objJMMMedPrescriptionHist.JMPodID = KPIHlp.CVI64(arr[1]);
            }
            if (KPIHlp.CVI64(arr[2]) != long.MinValue)
            {
                objJMMMedPrescriptionHist.JMCellID = KPIHlp.CVI64(arr[2]);
            }
            if (KPIHlp.CVI64(arr[3]) != Int16.MinValue)
            {
                objJMMMedPrescriptionHist.IsActive = KPIHlp.CVI16(arr[3]);
            }
            if (KPIHlp.CVI64(arr[4]) != long.MinValue)
            {
                objJMMMedPrescriptionHist.JurisID = KPIHlp.CVI32(arr[4]);
            }

            if (objJMMMedPrescriptionHist.JMBuildID.HasValue && !objJMMMedPrescriptionHist.JMPodID.HasValue)
            {
                objJMMMedPrescriptionHist.JMBuildID = long.MinValue;
            }

            DataSet ds = new JMMMedPrescriptionHistBL().GetMedPassHistory(ref objJMMMedPrescriptionHist);

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
            Dictionary <string, object>         row;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                row = new Dictionary <string, object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    row.Add(col.ColumnName, dr[col]);
                }
                rows.Add(row);
            }
            return(serializer.Serialize(rows));
        }
Ejemplo n.º 5
0
        public void ReadScr(ref JMMMedPrescriptionHist objJMMMedPrescriptionHist)
        {
            try
            {
                if (State.gMultiJuris == true && lstJuris.JurisID != 0)
                {
                    objJMMMedPrescriptionHist.JurisID = lstJuris.JurisID;
                }
                else if (!State.gMultiJuris)
                {
                    objJMMMedPrescriptionHist.JurisID = State.sJurisID;
                }
                objJMMMedPrescriptionHist.Drug             = lupPrescription.CodeValue;
                objJMMMedPrescriptionHist.NameID           = NamCtrlSPIN.KPIID;
                objJMMMedPrescriptionHist.ActivityFromDttm = dttmFromDate.DateValue;
                objJMMMedPrescriptionHist.ActivityToDttm   = dttmToDate.DateValue;
                objJMMMedPrescriptionHist.MarPFID          = lupBy.KPIID > 0 ? lupBy.KPIID : long.MinValue;
                objJMMMedPrescriptionHist.OwnerSubAgencyID = KPIHlp.CVI64(cddSubAgency.CodeValue);

                #region GetDocumentTypeList
                StringBuilder SBIDocType = new StringBuilder();
                if (radStatus.CheckedItems.Count > 0)
                {
                    for (int i = 0; i < radStatus.CheckedItems.Count; i++)
                    {
                        if (i == radStatus.CheckedItems.Count - 1)
                        {
                            SBIDocType.Append(radStatus.CheckedItems[i].Value);
                        }
                        else
                        {
                            SBIDocType.Append(radStatus.CheckedItems[i].Value + ",");
                        }
                    }
                    objJMMMedPrescriptionHist.Status = string.Format("'{0}'", Regex.Replace(SBIDocType.ToString(), @",", "','"));
                }

                #endregion
            }
            catch (Exception objError)
            {
                ((BasePage)this.Page).ShowMsg(MsgType.Error, FrwkMsg.PAGE_ERR, objError);
            }
        }
Ejemplo n.º 6
0
        public void ReadAddMode()
        {
            try
            {
                JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();
                objJMMMedPrescriptionHist.JMMScheduleEventsID = KPIHlp.CVI64(hdnJMMScheduleEventsID.Value);
                objJMMMedPrescriptionHist.JMMedPrescriptionID = KPIHlp.CVI64(hdnPrescriptionID.Value);

                JMMScheduleEvents objJMMScheduleEvents = null;
                if (objJMMMedPrescriptionHist.JMMScheduleEventsID.HasValue)
                {
                    objJMMScheduleEvents = new JMMScheduleEventsBL().Select(objJMMMedPrescriptionHist.JMMScheduleEventsID.Value);
                    if (objJMMScheduleEvents != null)
                    {
                        cddDispense.KPISelectedCodeValue = objJMMScheduleEvents.MedicationType; //Request.QueryString.Get("MedicationType") == null ? string.Empty : Request.QueryString.Get("MedicationType").Trim();
                        //txtDispense.Text = objJMMScheduleEvents.Dispense.HasValue ? objJMMScheduleEvents.Dispense.ToString() : "0";// Request.QueryString.Get("Dispense") == null ? string.Empty : Request.QueryString.Get("Dispense").Trim();

                        txtInstructions.Text = objJMMScheduleEvents.Instructions;
                        objJMMMedPrescriptionHist.MedicationType = objJMMScheduleEvents.MedicationType;// Request.QueryString.Get("MedicationType") == null ? string.Empty : Request.QueryString.Get("MedicationType").Trim();
                    }
                }



                objJMMMedPrescriptionHist = new JMMMedPrescriptionHistBL().GetLastAdministered(objJMMMedPrescriptionHist.JMMedPrescriptionID.Value);  //objJMMMedPrescriptionHist.MedPresSchID

                if (objJMMMedPrescriptionHist != null && objJMMMedPrescriptionHist.ActivityDttm.HasValue)
                {
                    dttmLstAdministered.DateValue = objJMMMedPrescriptionHist.ActivityDttm.Value;
                }
            }
            catch (KPIException objKPIError)
            {
                ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objKPIError);
            }
        }
Ejemplo n.º 7
0
        protected DataSet GetData(bool blnExcel)
        {
            JMMMedPrescriptionHist   objJMMMedPrescriptionHist   = new JMMMedPrescriptionHist();
            JMMMedPrescriptionHistBL objJMMMedPrescriptionHistBL = new JMMMedPrescriptionHistBL();
            DataSet objDs = new DataSet();

            try
            {
                ReadScr(ref objJMMMedPrescriptionHist);
                iGrdPageSize = GrdPageSize(this.Page, 220);
                objJMMMedPrescriptionHist.iPageSize = iGrdPageSize;


                if (!blnExcel)
                {
                    objJMMMedPrescriptionHist.iPageSize = iGrdPageSize;
                    if (grdMarhistory.KPICurrentGrdPageIndex <= 0)
                    {
                        grdMarhistory.KPICurrentGrdPageIndex = 1;
                    }
                    objJMMMedPrescriptionHist.iPageNo = grdMarhistory.KPICurrentGrdPageIndex;
                }
                else
                {
                    objJMMMedPrescriptionHist.iPageNo   = 1;
                    objJMMMedPrescriptionHist.iPageSize = iExcelPageSize;
                }
                objDs = objJMMMedPrescriptionHistBL.getMarHistoryDetails(objJMMMedPrescriptionHist);
                KPITrace.Debug(TraceWeight.Five, "Retrieving info from Maillog DB");
            }
            catch (Exception objExp)
            {
                ShowMsg(MsgType.Error, FrwkMsg.PAGE_ERR, objExp);
            }
            return(objDs);
        }
Ejemplo n.º 8
0
 protected void PrintMarHistory()
 {
     try
     {
         JMMMedPrescriptionHist   objJMMMedPrescriptionHist   = new JMMMedPrescriptionHist();
         JMMMedPrescriptionHistBL objJMMMedPrescriptionHistBL = new JMMMedPrescriptionHistBL();
         State.PageSelectedSubAgency = -1;
         usrMedMarBasicSrch   objusrMedMarBasicSrch = (usrMedMarBasicSrch)this.tabSuspSrch.Tabs.FindTabFromKey("BSC").FindControl("usrMedMarBasicSrch");
         KPICodedDropDownList SubAgency             = ((KPICodedDropDownList)objusrMedMarBasicSrch.FindControl("cddSubAgency"));
         if (SubAgency != null && !string.IsNullOrWhiteSpace(SubAgency.CodeValue))
         {
             State.PageSelectedSubAgency = Convert.ToInt64(SubAgency.CodeValue);
         }
         //
         ReadScr(ref objJMMMedPrescriptionHist);
         objJMMMedPrescriptionHistBL.MarHistoryPrintSrch(objJMMMedPrescriptionHist);
         PrintReport();
         KPITrace.Debug(TraceWeight.Five, "Retrieving info from MarHistorySearch DB");
     }
     catch (Exception objErr)
     {
         ShowMsg(MsgType.Error, FrwkMsg.PAGE_ERR, objErr);
     }
 }
Ejemplo n.º 9
0
        protected DataSet GetData(bool blnExcel)
        {
            DataSet ds = new DataSet();

            try
            {
                JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();

                objJMMMedPrescriptionHist.JMBuildID = cddBuilding.CodeValue == null ? long.MinValue : KPIHlp.CVI64(cddBuilding.CodeValue);
                objJMMMedPrescriptionHist.JMPodID   = luppod.KPIID;
                objJMMMedPrescriptionHist.JMCellID  = lupcell.KPIID;
                objJMMMedPrescriptionHist.JurisID   = KPIHlp.CVI32(hdnJurisId.Value);
                DateTime Curdate = DateTime.Now;
                objJMMMedPrescriptionHist.IsActive = chkShowall.Checked ? KPIHlp.CVI16("1") : KPIHlp.CVI16("0");

                if (objJMMMedPrescriptionHist.JMBuildID.HasValue && !objJMMMedPrescriptionHist.JMPodID.HasValue)
                {
                    objJMMMedPrescriptionHist.JMBuildID = long.MinValue;
                }

                ds = new JMMMedPrescriptionHistBL().GetMedPassHistory(ref objJMMMedPrescriptionHist);

                grdMedreqlist.DataSource = ds;
                grdMedreqlist.DataBind();

                if (grdMedreqlist.Rows.Count <= 0 && String.IsNullOrWhiteSpace(hdnAutoLoad.Value))
                {
                    ShowMsg(MsgType.Error, FrwkMsg.NO_RECORD_FOUND);
                }
            }
            catch (Exception objError)
            {
                ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError);
            }
            return(ds);
        }
Ejemplo n.º 10
0
        protected void LoadData()
        {
            JMMMedVisit objMedVisit = new JMMMedVisit();
            string      strhdnMode = UIMode.ADD.ToString();
            long        NameID, JMBookingID;

            try
            {
                if (Request.QueryString.Get("JMMedPrescriptionID") != null && Request.QueryString.Get("JMMedPrescriptionID") != string.Empty)
                {
                    hdnPrescriptionID.Value = Request.QueryString.Get("JMMedPrescriptionID").Trim();
                }


                //hdnSchID.Value = Request.QueryString.Get("JMPrescriptionSchduleID") == null ? string.Empty : Request.QueryString.Get("JMPrescriptionSchduleID").Trim();
                NameID = Request.QueryString.Get("NameID") == null ? long.MinValue : KPIHlp.CVI64(Request.QueryString.Get("NameID").Trim());
                if (Request.QueryString.Get("JMMedPrescriptionHistID") != null && Request.QueryString.Get("JMMedPrescriptionHistID") != string.Empty)
                {
                    hdnMedPresHisID.Value = Request.QueryString.Get("JMMedPrescriptionHistID").Trim();
                    hdnMode.Value         = UIMode.INQ.ToString();
                }

                hdnJMMScheduleEventsID.Value = Request.QueryString.Get("JMMScheduleEventsID") == null ? string.Empty : Request.QueryString.Get("JMMScheduleEventsID").Trim();
                hdnJurisId.Value             = Request.QueryString.Get("JurisID") == null?GetPageJuris().ToString() : Request.QueryString.Get("JurisID").Trim();

                try
                {
                    if (NameID > 0)
                    {
                        NamCtrlSPIN.KPIID = NameID;
                        imgFrontView.GenerateImage(true, ImgType.FrontView, ImgRefType.Names, NameID, short.MinValue);
                    }
                }
                catch (KPIException objKPIError)
                {
                    throw objKPIError;
                }
            }
            catch (Exception objError)
            {
                ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError);
            }

            if (hdnMode.Value == UIMode.INQ.ToString()) //Added by jeyaganesh
            {
                blnForceModeChange = true;
                JMMMedPrescription     objJMMMedPrescription     = new JMMMedPrescription();
                JMMMedPrescriptionBL   objJMMMedPrescriptionBL   = new JMMMedPrescriptionBL();
                JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();
                KPITxtBL objKPITxtBL = new KPITxtBL();


                try
                {
                    objJMMMedPrescriptionHist = new JMMMedPrescriptionHistBL().Select(KPIHlp.CVI64(hdnMedPresHisID.Value));


                    if (objJMMMedPrescriptionHist != null && objJMMMedPrescriptionHist.JMMedPrescriptionHistID.HasValue)
                    {
                        txtNotes.Text   = objKPITxtBL.GetDisplayText(objJMMMedPrescriptionHist.JMMedPrescriptionHistID.Value, TxtType.JmMed_MedHisCmnts);
                        txtDrug.Text    = new CodedBL().GetCodeDescription(6007, objJMMMedPrescriptionHist.Drug, objJMMMedPrescriptionHist.JurisID.Value);
                        txtDosage.Text  = objJMMMedPrescriptionHist.Dosage;
                        txtBalance.Text = objJMMMedPrescriptionHist.CurQuantity.HasValue ? objJMMMedPrescriptionHist.CurQuantity.Value.ToString() : string.Empty;
                        if (!String.IsNullOrWhiteSpace(txtBalance.Text) && KPIHlp.CVI32(txtBalance.Text) <= 5)
                        {
                            txtBalance.ForeColor = System.Drawing.Color.Red;
                            tdComments.Attributes.Add("class", "req");
                        }

                        imgMedSignature.Style.Add("pointer-events", "none");
                        if (objJMMMedPrescriptionHist.Dispense.HasValue && objJMMMedPrescriptionHist.Dispense.Value > 0)
                        {
                            txtDispense.Text = objJMMMedPrescriptionHist.Dispense.HasValue ? objJMMMedPrescriptionHist.Dispense.Value.ToString() : String.Empty;
                        }
                        else
                        {
                            txtDispense.Text = string.Empty;
                        }

                        cddDispense.KPISelectedCodeValue = objJMMMedPrescriptionHist.MedicationType;

                        if (objJMMMedPrescriptionHist.LastAdministeredDttm.HasValue)
                        {
                            dttmLstAdministered.DateValue = objJMMMedPrescriptionHist.LastAdministeredDttm.Value;
                        }
                        else
                        {
                            if (dttmLstAdministered.DateValue == DateTime.MinValue)
                            {
                                dttmLstAdministered.DateValue = new JMMMedPrescriptionHistBL().GetLastAdministeredDttm(ref objJMMMedPrescriptionHist);
                            }
                        }
                        if (objJMMMedPrescriptionHist.ActivityDttm.HasValue)
                        {
                            dttmDateTime.DateValue = objJMMMedPrescriptionHist.ActivityDttm.Value;
                        }
                        if (objJMMMedPrescriptionHist.MarPFID.HasValue)
                        {
                            lupPFNo.KPIID = objJMMMedPrescriptionHist.MarPFID.Value;
                        }
                        cddMethodAdmin.KPISelectedCodeValue = objJMMMedPrescriptionHist.MethodAdministered;
                        cddStatus.KPISelectedCodeValue      = objJMMMedPrescriptionHist.Status;
                        if (objJMMMedPrescriptionHist.MarPFSignID.HasValue)
                        {
                            hdnMarSignId.Value = objJMMMedPrescriptionHist.MarPFSignID.ToString();
                            imgMedSignature.GenerateImage(true, ImgType.Signature, ImgRefType.JMMMarInmateOfficer, objJMMMedPrescriptionHist.MarPFSignID.Value, short.MinValue);
                        }
                        else
                        {
                            hdnMarSignId.Value = string.Empty;
                        }

                        txtInstructions.Text = objJMMMedPrescriptionHist.Instructions;
                    }
                }
                catch (Exception objError)
                {
                    ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError);
                }
            }
            else
            {
                hdnMode.Value = UIMode.ADD.ToString();
                txtDrug.Text  = Request.QueryString.Get("Drug") == null ? string.Empty : Request.QueryString.Get("Drug").Trim();

                if (!String.IsNullOrWhiteSpace(txtDrug.Text))
                {
                    txtDrug.Text = new CodedBL().GetCodeDescription(6007, txtDrug.Text, KPIHlp.CVI32(hdnJurisId.Value));
                }

                txtDosage.Text = Request.QueryString.Get("Dosage") == null?string.Empty: Request.QueryString.Get("Dosage").Trim();
                //txtBalance.Text = Request.QueryString.Get("CurQuantity") == null ? string.Empty : Request.QueryString.Get("CurQuantity").Trim();

                JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();
                objJMMMedPrescriptionHist.JMMedPrescriptionID = KPIHlp.CVI64(hdnPrescriptionID.Value);
                txtBalance.Text = new JMMMedPrescriptionHistBL().GetMedicationBalance(ref objJMMMedPrescriptionHist).ToString();

                hdnPrescriptionID.Value = Request.QueryString.Get("JMMedPrescriptionID") == null ? string.Empty : Request.QueryString.Get("JMMedPrescriptionID").Trim();
                JMBookingID             = Request.QueryString.Get("JMBookingID") == null ? long.MinValue : KPIHlp.CVI64(Request.QueryString.Get("JMBookingID").Trim());


                lupPFNo.KPIID = State.sPFID;


                ReadAddMode();
            }
        }
Ejemplo n.º 11
0
        private JMMMedPrescriptionHist ReadScr(ref JMMMedPrescription objJMMMedPrescription)
        {
            JMMMedPrescriptionHist objJMMMedPrescriptionHist = new JMMMedPrescriptionHist();

            try
            {
                if (ValidateScr())
                {
                    objJMMMedPrescriptionHist.JMMedPrescriptionID   = objJMMMedPrescription.JMMedPrescriptionID;
                    objJMMMedPrescriptionHist.JurisID               = objJMMMedPrescription.JurisID;
                    objJMMMedPrescriptionHist.JMBookingID           = objJMMMedPrescription.JMBookingID;
                    objJMMMedPrescriptionHist.JMMedicalHistID       = objJMMMedPrescription.JMMedicalHistID;
                    objJMMMedPrescriptionHist.JMMedVisitID          = objJMMMedPrescription.JMMedVisitID;
                    objJMMMedPrescriptionHist.PrescribedDttm        = objJMMMedPrescription.PrescribedDttm;
                    objJMMMedPrescriptionHist.PrescribingDoctorID   = objJMMMedPrescription.PrescribingDoctorID;
                    objJMMMedPrescriptionHist.MedicalPrescriptionNo = objJMMMedPrescription.MedicalPrescriptionNo;
                    objJMMMedPrescriptionHist.Prescription          = objJMMMedPrescription.Prescription;
                    objJMMMedPrescriptionHist.Drug               = objJMMMedPrescription.Drug;
                    objJMMMedPrescriptionHist.Dosage             = objJMMMedPrescription.Dosage;
                    objJMMMedPrescriptionHist.PrescribedAmt      = objJMMMedPrescription.PrescribedAmt;
                    objJMMMedPrescriptionHist.PrescribedDuration = objJMMMedPrescription.PrescribedDuration;
                    objJMMMedPrescriptionHist.CurQuantity        = KPIHlp.CVI32(txtBalance.Text); //objJMMMedPrescription.CurQuantity;
                    objJMMMedPrescriptionHist.RefillBal          = objJMMMedPrescription.RefillBal == short.MinValue ? 0 : objJMMMedPrescription.RefillBal;
                    objJMMMedPrescriptionHist.IsGeneric          = objJMMMedPrescription.IsGeneric;
                    objJMMMedPrescriptionHist.Times              = objJMMMedPrescription.Times;

                    if (String.IsNullOrWhiteSpace(Request.QueryString.Get("Flag")))
                    {
                        objJMMMedPrescriptionHist.IsPersonalProp = 1;
                    }
                    else
                    {
                        objJMMMedPrescriptionHist.IsPersonalProp = objJMMMedPrescription.IsPersonalProp;
                    }
                    objJMMMedPrescriptionHist.MedicationType = cddDispense.CodeValue;
                    objJMMMedPrescriptionHist.UseEndedDttm   = objJMMMedPrescription.UseEndedDttm;


                    objJMMMedPrescriptionHist.CreatedPFID  = objJMMMedPrescription.CreatedPFID;
                    objJMMMedPrescriptionHist.CreatedDttm  = objJMMMedPrescription.CreatedDttm;
                    objJMMMedPrescriptionHist.ModifiedPFID = objJMMMedPrescription.ModifiedPFID;
                    objJMMMedPrescriptionHist.ModifiedDttm = objJMMMedPrescription.ModifiedDttm;
                    objJMMMedPrescriptionHist.Custom1      = objJMMMedPrescription.Custom1;
                    objJMMMedPrescriptionHist.Custom2      = objJMMMedPrescription.Custom2;
                    objJMMMedPrescriptionHist.Dispense     = KPIHlp.CVI32(txtDispense.Text);

                    objJMMMedPrescriptionHist.JMMScheduleEventsID     = KPIHlp.CVI64(hdnJMMScheduleEventsID.Value);
                    objJMMMedPrescriptionHist.JMMedPrescriptionHistID = KPICounter.GetCounterID(objJMMMedPrescriptionHist.JurisID.Value);

                    objJMMMedPrescriptionHist.ActivityDttm = dttmDateTime.DateValue;
                    if (lupPFNo.KPIID != long.MinValue)
                    {
                        objJMMMedPrescriptionHist.MarPFID = lupPFNo.KPIID;
                    }
                    if (KPIHlp.CVI64(hdnMarSignId.Value) != long.MinValue)
                    {
                        objJMMMedPrescriptionHist.MarPFSignID = KPIHlp.CVI64(hdnMarSignId.Value);
                    }
                    objJMMMedPrescriptionHist.MethodAdministered = cddMethodAdmin.CodeValue;
                    if (objJMMMedPrescriptionHist.CurQuantity == 0 && String.IsNullOrWhiteSpace(objJMMMedPrescriptionHist.MethodAdministered))
                    {
                        objJMMMedPrescriptionHist.Status = "MEU";
                    }
                    else
                    {
                        objJMMMedPrescriptionHist.Status = cddStatus.CodeValue;
                    }
                    objJMMMedPrescriptionHist.MedicationNotes = txtNotes.Text;
                    objJMMMedPrescriptionHist.Instructions    = txtInstructions.Text;
                    if (dttmLstAdministered.DateValue != DateTime.MinValue)
                    {
                        objJMMMedPrescriptionHist.LastAdministeredDttm = dttmLstAdministered.DateValue;
                    }
                }
            }
            catch (Exception objError)
            {
                ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError);
            }
            return(objJMMMedPrescriptionHist);
        }