Ejemplo n.º 1
0
        /// <summary>
        /// Lägger upp ett nytt orderhuvud och sparar detta. Om användare
        /// ångrar sig måste en removeOH göras.
        /// </summary>
        /// <param name="knr"></param>
        /// <returns></returns>
        public OrderHeadDefinition addOH(string knr, string numberset)
        {
            if (numberset.Equals(""))
                numberset = "A";

            doInsert(knr, numberset);
            OrderHeadDefinition o = new OrderHeadDefinition();
            fillOH(ref o);
            return o;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Kontrollera om ordern är ändrad
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public bool isOrderHeadChanged(OrderHeadDefinition oCurrent, OrderHeadDefinition oNew)
        {
            bool isOrderChanged = false;

              try
              {
            if (!oCurrent.PatientNo.Trim().Equals(oNew.PatientNo.Trim()))
              isOrderChanged = true;

            if (!oCurrent.InvoiceCustomer.Trim().Equals(oNew.InvoiceCustomer.Trim()))
              isOrderChanged = true;

            if (!oCurrent.Clinik.Trim().Equals(oNew.Clinik.Trim()))
              isOrderChanged = true;

            if (!oCurrent.SelOrdinator.Trim().Equals(oNew.SelOrdinator.Trim()))
              isOrderChanged = true;

            if (!oCurrent.Ordination.Trim().Equals(oNew.Ordination.Trim()))
              isOrderChanged = true;

            if (!oCurrent.YourReference.Trim().Equals(oNew.YourReference.Trim()))
              isOrderChanged = true;

            if (!oCurrent.Diagnose.Trim().Equals(oNew.Diagnose.Trim()))
              isOrderChanged = true;

            if (!oCurrent.Notation.Trim().Equals(oNew.Notation.Trim()))
              isOrderChanged = true;

            if (!oCurrent.DiagnoseCode.Trim().Equals(oNew.DiagnoseCode.Trim()))
              isOrderChanged = true;

            if (oCurrent.ValidFrom.CompareTo(oNew.ValidFrom) != 0)
              isOrderChanged = true;

            if (oCurrent.ReferralDate.CompareTo(oNew.ReferralDate) != 0)
            isOrderChanged = true;

            if (oCurrent.ValidYearsCount.CompareTo(oNew.ValidYearsCount) != 0)
              isOrderChanged = true;

            if (!oCurrent.AidCount.Trim().Equals(oNew.AidCount.Trim()))
              isOrderChanged = true;

            if (!oCurrent.Signature.Trim().Equals(oNew.Signature.Trim()))// || oCurrent.Signature.Equals(""))
              isOrderChanged = true;

            if (!oCurrent.Pricelist.Trim().Equals(oNew.Pricelist.Trim()))
              isOrderChanged = true;
              }
              catch { }

              return isOrderChanged;
        }
Ejemplo n.º 3
0
        public OrderHeadDefinition(OrderHeadDefinition copyFrom)
        {
            // get all the fields in the class
            FieldInfo[] fields_of_class = this.GetType().GetFields(
              BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

            // copy each value over to 'this'
            foreach (FieldInfo fi in fields_of_class)
            {
                fi.SetValue(this, fi.GetValue(copyFrom));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Lägger upp ett nytt orderhuvud och sparar detta. Om användare
        /// ångrar sig måste en removeOH göras.
        /// </summary>
        /// <param name="knr"></param>
        /// <returns></returns>
        public OrderHeadDefinition addOH(string knr)
        {
            string numberset = Config.getNumberSerie();

            if(GCF.noNULL(numberset).Equals(""))
            {
                numberset = "A";
                Log4Net.Logger.loggCritical("Could not get nunberset from Config, fallback too numberset A", Config.User, "GarpFunctions.addOH(string knr)");
            }

            if (doInsert(knr, Config.getNumberSerie()))
            {
                OrderHeadDefinition o = new OrderHeadDefinition();
                fillOH(ref o);
                return o;
            }
            else
                return null;
        }
Ejemplo n.º 5
0
        public static ListViewItem[] convertToThordListView(OrderHeadDefinition[] o)
        {
            ArrayList al = new ArrayList();
            ListViewItem[] lw = new ListViewItem[o.Length];

            for (int i = 0; i < lw.Length; i++)
            {
                lw[i] = new ListViewItem(o[i].OrderNo);
                lw[i].SubItems.Add(o[i].PatientsSSN);
                lw[i].SubItems.Add(o[i].ValidFrom.ToString());
                lw[i].SubItems.Add(o[i].ValidYearsCount.ToString());
                if (o[i].isClosed)
                    lw[i].SubItems.Add("Stängd");
                else
                    lw[i].SubItems.Add("");
                lw[i].SubItems.Add(o[i].Priority);
                lw[i].SubItems.Add(o[i].RekvNo);
                lw[i].SubItems.Add(o[i].Ordination);
                lw[i].SubItems.Add(o[i].Priority + o[i].ValidFrom);
            }

            return lw;
        }
Ejemplo n.º 6
0
        public static ListViewItem[] convertToListView(OrderHeadDefinition[] o)
        {
            ArrayList al = new ArrayList();
            ListViewItem[] lw = new ListViewItem[o.Length];

            for (int i = 0; i < lw.Length; i++)
            {
                lw[i] = new ListViewItem(o[i].OrderNo);
                lw[i].SubItems.Add(o[i].ValidFrom.ToString("yyyy-MM-dd"));
                lw[i].SubItems.Add(o[i].ValidFrom.AddYears(o[i].ValidYearsCount).ToString("yyyy-MM-dd"));

                // Check if order is valid, wihtin valid date range
                if (DateTime.Today.CompareTo(o[i].ValidFrom) >= 0 && DateTime.Today.CompareTo(o[i].ValidFrom.AddYears(o[i].ValidYearsCount)) <= 0)
                {
                    lw[i].BackColor = System.Drawing.Color.LightGreen;
                }
                else
                {
                    lw[i].BackColor = System.Drawing.Color.White;
                }

                if (o[i].isClosed)
                {
                    lw[i].SubItems.Add("Stängd");
                    lw[i].BackColor = System.Drawing.Color.LightCoral;
                }
                else
                {
                    lw[i].SubItems.Add("");
                    //lw[i].BackColor = System.Drawing.Color.White;
                }
                lw[i].SubItems.Add(o[i].Priority);
                lw[i].SubItems.Add(o[i].RekvNo);
                lw[i].SubItems.Add(o[i].Ordination);
            }

            return lw;
        }
Ejemplo n.º 7
0
        protected OrderHeadDefinition[] getAllOrdersWithOty(string oty)
        {
            ArrayList arr = new ArrayList();
            OrderHeadDefinition oh = new OrderHeadDefinition();
            GarpGenericDB.FilterItem[] filter = new GarpGenericDB.FilterItem[2];
            GarpGenericDB.FilterItem f;

            f = new GarpGenericDB.FilterItem();
            f.Type = GarpGenericDB.ItemType.Field;
            f.Ucase = false;
            f.Value = "OTY";
            filter[1] = f;

            f = new GarpGenericDB.FilterItem();
            f.Type = GarpGenericDB.ItemType.Constant;
            f.FieldType = "C";
            f.Ucase = false;
            f.Value = oty;
            filter[0] = f;

            mOGA.index = 1;
            mOGA.setFilter(filter, "1=2");

            while (!EOF)
            {
                // Hoppa över order med ordertyp "E" (Egenavgiftsorder)
                if (OTY.Equals(oty))
                {
                    mOGF.find(ONR);
                    mOGL.find(ONR);
                    oText.findTexts(ONR);

                    oh = new OrderHeadDefinition();
                    oh.OrderNo = ONR;
                    oh.PatientsSSN = SocialSequrityNumber;
                    oh.ValidFrom = ValidFrom;
                    oh.ValidYearsCount = ValidYearsCount;
                    oh.isClosed = FRY;
                    oh.RekvNo = RekvNr;
                    oh.Ordination = Ordination;
                    oh.Priority = Priority;
                    arr.Add(oh);
                }
                next();
            }
            mOGA.deactivateFilter();

            return (OrderHeadDefinition[])arr.ToArray(typeof(OrderHeadDefinition));
        }
Ejemplo n.º 8
0
 private bool updateForm(OrderHeadDefinition o)
 {
     return updateForm(oCust.getPatientByCust(o.PatientNo), o);
 }
Ejemplo n.º 9
0
        private bool updateForm(PatientDefenition p, OrderHeadDefinition o)
        {
            try
            {
                // Do not execute when already in progress
                if (bFormUpdateInProgress)
                    return false;
                else
                    bFormUpdateInProgress = true;

                // If current OH couldnt be saved then abort.
                if (!saveOrder(true))
                {
                    try
                    {
                        txtONR.Text = GCF.noNULL(frmControler.CurrentOH.OrderNo);
                        txtPNR.Text = GCF.noNULL(frmControler.CurrentPatient.SSN);
                        bFormUpdateInProgress = false;
                        Log4Net.Logger.loggWarning("In updateForm the saveOrder(true) failed on order " + frmControler.CurrentOH.OrderNo + " when trying to update order " + o.OrderNo, Config.User, "");
                        return false;
                    }
                    catch (Exception e)
                    {
                        Log4Net.Logger.loggWarning("Problem with saveorder in updateForm", Config.User, "");
                        return false;
                    }
                }

                // Deaktivera sparafunktionen
                ignoreSave = true;

                try
                {
                    // Move current patient to last patient befor update of new patient
                    // (if not currentpatient is emty or the same as the one to update form with)
                    if (!frmControler.CurrentPatient.PatientNo.Trim().Equals("") && !frmControler.CurrentPatient.PatientNo.Trim().Equals(p.PatientNo.Trim()))
                        frmControler.LastPatient = new PatientDefenition(frmControler.CurrentPatient);
                }
                catch (Exception e)
                {
                    Log4Net.Logger.loggWarning("Problem moving current patient to last patient", Config.User, "updateForm()");
                }

                // If current order is the same as the new order, update definition after save
                if (o.OrderNo.Trim().Equals(frmControler.CurrentOH.OrderNo))
                    o = oOH.getOrder(o.OrderNo);

                try
                {
                    // Save current orderhead and patient
                    frmControler.CurrentOH = new OrderHeadDefinition(o);
                    frmControler.CurrentPatient = new PatientDefenition(p);
                }
                catch (Exception e)
                {
                    Log4Net.Logger.loggWarning("Problem saving current orderhead and patient", Config.User, "updateForm()");
                }

                try
                {
                    // Patient
                    txtKNR.Text = p.PatientNo;
                    txtPNR.Text = p.SSN;
                    txtLN.Text = p.LastName;
                    txtSN.Text = p.SureName;
                    txtADD.Text = p.Address;
                    txtORT.Text = p.PoCity;
                    txtTelBostad.Text = p.TelHome;
                    txtTelArbete.Text = p.TelWork;
                    txtTelMobil.Text = p.TelMobile;
                    txtTelSMS.Text = p.TelSMS;
                    chkCopDok.Enabled = true;
                    chkJournal.Enabled = true;
                    chkDeceased.Enabled = true;
                    chkJournal.Checked = p.Journal;
                    chkCopDok.Checked = p.CopDok;
                    chkDeceased.Checked = p.Deceased;
                    txtANM.Text = p.Remark;

                    if (p.OpenBalance > 0)
                    {
                        txtPNR.BackColor = Color.Salmon;
                        toolTip1.SetToolTip(txtPNR, "Öppet saldo: " + p.OpenBalance + ":-");
                    }
                    else
                    {
                        txtPNR.BackColor = Color.White;
                        toolTip1.SetToolTip(txtPNR, "");
                    }

                }
                catch (Exception e)
                {
                    Log4Net.Logger.loggWarning("Problem setting values on patient", Config.User, "updateForm()");
                }

                try
                {
                    // OH
                    if (o.isClosed)
                    {
                        pnlOrderStat.Text = "### Ordern är stängd ###";
                        btnCloseOrder.Text = "&Öppna order";
                    }
                    else
                    {
                        pnlOrderStat.Text = "";
                        btnCloseOrder.Text = "&Stäng order";
                    }

                    // If OH is delivererd, or partly delivered, we do not allow changes of these fields  ## JB 2010-05-19
                    if (o.CanChangeInvoiceCustomer)
                    {
                        txtFKN.Enabled = true;
                        txtKlinik.Enabled = true;
                    }
                    else
                    {
                        txtFKN.Enabled = false;
                        txtKlinik.Enabled = false;
                    }

                    txtONR.Text = o.OrderNo;
                    txtODT.Text = o.OrderDate;
                    txtFKN.Text = o.InvoiceCustomer;
                    txtFKN_NAM.Text = o.InvoiceCustomerName;
                    txtKlinik.Text = o.Clinik;
                    txtKlinikNamn.Text = o.ClinikName;
                    cboOrdinator.Items.Clear();
                    cboOrdinator.Text = "";
                    cboSignature.Text = "";

                    // ReferralDate (arrived at OTA)
                    try
                    {
                        dtOTADate.Value = o.ReferralDate;
                    }
                    catch (Exception ex)
                    {
                        Log4Net.Logger.loggError(ex, "Error while handling datetime ReferralDate", Config.User, "frmMain.updateForm");
                    }

                    // Hide combobox if signature is not found (and signature is not "")
                    //2009-05-06:JB if ((cboSignature.FindStringExact(o.Signature.Trim()) == -1) && !o.Signature.Trim().Equals(""))
                    if (!o.Signature.Trim().Equals(""))
                    {
                        cboSignature.Visible = false;
                        txtSignature.Visible = true;
                        txtSignature.Text = o.Signature;
                    }
                    else
                    {
                        cboSignature.Visible = true;
                        txtSignature.Visible = false;
                        try
                        {
                            cboSignature.SelectedIndex = cboSignature.FindStringExact(o.Signature);
                        }
                        catch (Exception e)
                        {
                            Log4Net.Logger.loggWarning("Problem setting signature on OH", Config.User, "updateForm()");
                        }
                    }

                    try
                    {
                        if (o.Ordinator != null)
                        {
                            cboOrdinator.Items.Add("");
                            cboOrdinator.Items.AddRange(o.Ordinator);
                        }

                        int idx = cboOrdinator.FindString(o.SelOrdinator);
                        if (idx != -1)
                            cboOrdinator.SelectedIndex = idx;
                    }
                    catch (Exception e)
                    {
                        Log4Net.Logger.loggWarning("Problem setting ordinator on OH", Config.User, "updateForm()");
                    }

                    txtERF.Text = o.YourReference;
                    labRemissNr.Text = o.ReferralNo;
                    txtDiagID.Text = o.DiagnoseCode;
                    try { txtDiagTxt.Text = oDiagnos.getDiagnosById(txtDiagID.Text.Trim()); }
                    catch { txtDiagTxt.Text = ""; Log4Net.Logger.loggWarning("Problem setting diag on OH", Config.User, "updateForm()");  }
                    txtOrdination.Text = o.Ordination;
                    txtTillagg.Text = o.Diagnose;
                    txtNotering.Text = o.Notation;

                    try
                    {
                        dtpGilltigFrom.Value = o.ValidFrom;
                        txtGilltigFrom.Text = o.ValidFrom.ToString("yyMMdd");
                        txtYears.Text = o.ValidYearsCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        Log4Net.Logger.loggError(ex, "Error while handling datetime", Config.User, "frmMain.updateForm");
                    }

                    try
                    {
                        txtEndDate.Text = dtpGilltigFrom.Value.AddYears(int.Parse(txtYears.Text)).ToString("yyMMdd");
                    }
                    catch { }
                    txtAidCount.Text = o.AidCount;
                    cboPrislista.Text = oPrislista.getPriceListById(o.Pricelist);

                    tabctrlRow.SelectedIndex = 0;

                    try
                    {
                        lwOr.Items.Clear();
                        lwOr.Items.AddRange(Definitions.Aid.convertToListView(oOR.getAllAid(frmControler.CurrentOH.OrderNo), oOR));
                    }
                    catch (Exception e)
                    {
                        Log4Net.Logger.loggError(e, "Error while handling aids", Config.User, "updateForm");
                        Log4Net.Logger.loggInfo("Ordernummer: " + frmControler.CurrentOH.OrderNo, "", "");
                    }

                    try
                    {
                        if (lwOr.Items.Count > 0)
                            lwOr.Items[0].Selected = true;

                        clearOrderrowDetailPane(true);
                    }
                    catch
                    {
                        clearOrderrowDetailPane(true);
                    }

                    // Get unbound errand if orderno is given
                    if (!frmControler.CurrentOH.OrderNo.Trim().Equals(""))
                    {
                        if (oErr.getUnboundErrands(txtKNR.Text, frmControler.CurrentOH.OrderNo).Length > 0)
                        {
                            frmDiagUnboundErrand oDue = new frmDiagUnboundErrand(txtKNR.Text, frmControler.CurrentOH.OrderNo);
                            oDue.ShowDialog();
                        }
                    }

                    lwErrand.Items.Clear();
                    lwErrand.Items.AddRange(ErrandFunc.Errand.convertToErrand(oErr.getErrands(txtKNR.Text, frmControler.CurrentOH.OrderNo)));

                    // Kontrollera om vi skall enabla groupboxarna för OH och OR eller ej
                    if (o.OrderNo.Trim() == "")
                    {
                        grbOH.Enabled = false;
                        grbOr.Enabled = false;
                        tabctrlRow.Enabled = false;
                    }
                    else
                    {
                        grbOH.Enabled = true;
                        grbOr.Enabled = true;
                        tabctrlRow.Enabled = true;
                        //cboOrdinator.Focus();
                    }

                    if (!p.DoesExist)
                        grbTid.Enabled = false;
                    else
                        grbTid.Enabled = true;

                    // Aktivera sparafunktionen
                    ignoreSave = false;

                    bFormUpdateInProgress = false;
                    grbOH.ForeColor = grbPatient.ForeColor;
                }
                catch (Exception e)
                {
                    Log4Net.Logger.loggWarning("Problem setting values on OH", Config.User, "updateForm()");
                    return false;
                }

                Log4Net.Logger.loggInfo("Successfully updated order " + frmControler.CurrentOH.OrderNo + " on patient " + GCF.noNULL(frmControler.CurrentPatient.PatientNo), Config.User, "");
                return true;
            }
            catch (Exception ex)
            {
                Log4Net.Logger.loggError(ex, "Error in updateForm", Config.User, "");
                bFormUpdateInProgress = false;
                return false;
            }
        }
Ejemplo n.º 10
0
        public OrderHeadDefinition[] getPatientsAllOH(string knr)
        {
            ArrayList arr = new ArrayList();
            OrderHeadDefinition oh;

            if (findCustFirstOrder(knr))
            {
                while ((Patient.Trim() == knr.Trim()) && (!EOF))
                {
                    // Hoppa över order med ordertyp "E" (Egenavgiftsorder)
                    if (!OTY.Equals("E"))
                    {
                        oh = new OrderHeadDefinition();

                        oh.OrderNo = ONR;
                        oh.ValidFrom = ValidFrom;
                        oh.ValidYearsCount = ValidYearsCount;
                        oh.isClosed = FRY;
                        oh.RekvNo = RekvNr;
                        oh.Priority = Priority;
                        oh.Ordination = Ordination;

                        arr.Add(oh);
                    }
                    next();
                }
            }
            return (OrderHeadDefinition[])arr.ToArray(typeof(OrderHeadDefinition)); //OrderHeadDefinition.convertFromArray(arr);
        }
Ejemplo n.º 11
0
 private void fillOH(ref OrderHeadDefinition o, bool clear)
 {
     o.OrderNo = "";
     o.OrderType = "";
     o.PaymentCondition = "";
     o.OrderDate = "";
     o.PatientNo = "";
     o.InvoiceCustomer = "";
     o.Clinik = "";
     o.ClinikName = "";
     o.YourReference = "";
     o.Ordinator = new string[0];
     o.SelOrdinator = "";
     o.Ordination = "";
     o.DiagnoseCode = "";
     o.Diagnose = "";
     o.Notation = "";
     o.OHtext = "";
     o.ValidFrom = DateTime.Now;
     o.ValidYearsCount = 0;
     o.AidCount = "";
     o.Signature = "";
     o.Pricelist = "";
     o.RekvNo = "";
     o.KombikaCode = "";
     o.ReferralNo = "";
     o.AidType = "";
     o.Priority = "";
     o.isClosed = false;
     o.ReferralDate = DateTime.Now;
 }
Ejemplo n.º 12
0
 private void fillOH(ref OrderHeadDefinition o)
 {
     o.OrderNo = ONR;
     o.OrderType = OTY;
     o.PaymentCondition = BVK;
     o.OrderDate = ODT;
     o.PatientNo = Patient;
     o.InvoiceCustomer = (((FKN == null) || (FKN == Patient)) ? "" : FKN);
     o.InvoiceCustomerName = FakKnrNamn;
     o.Clinik = Klinik;
     o.ClinikName = KlinikNamn;
     o.YourReference = ErReferens;
     o.Ordinator = getOrdinatorsOnCustomer(Klinik);
     o.SelOrdinator = (Ordinator == null ? "" : Ordinator);
     o.Ordination = (Ordination == null ? "" : Ordination);
     o.DiagnoseCode = Diagnoskod;
     o.Diagnose = Tillagg;
     o.Notation = Notering;
     o.OHtext = OHText;
     o.ValidFrom = ValidFrom;
     o.ValidYearsCount = ValidYearsCount;
     o.AidCount = X1F;
     o.Signature = (Signature == null ? "" : Signature);
     o.Pricelist = Prislista;
     o.RekvNo = RekvNr;
     o.KombikaCode = KombikaCode;
     o.ReferralNo = ReferralNr;
     o.ReferralDate = ReferralDate;
     o.AidType = AidType;
     o.Priority = Priority;
     o.isClosed = FRY;
     o.PatientsSSN = SocialSequrityNumber;
     o.ReferralNo = ReferralNr;
     o.DeliverStatus = DeliverStatus;
     o.CanChangeInvoiceCustomer = CanChangeInvoiceCustomer;
 }
Ejemplo n.º 13
0
        public bool saveOH(OrderHeadDefinition o)
        {
            if (findOrder(o.OrderNo))
            {
                if (!FRY)
                {
                    OTY = o.OrderType;
                    Patient = o.PatientNo;
                    FKN = (o.InvoiceCustomer == "" ? Patient : o.InvoiceCustomer);
                    BVK = o.PaymentCondition;
                    Klinik = o.Clinik;
                    KlinikNamn = o.ClinikName;
                    ErReferens = o.YourReference;
                    Ordination = o.Ordination;
                    Diagnoskod = o.DiagnoseCode;
                    Notering = o.Notation;
                    OHText = o.OHtext;
                    Tillagg = o.Diagnose;
                    ValidFrom = o.ValidFrom;
                    ValidYearsCount = o.ValidYearsCount;
                    X1F = o.AidCount;
                    Signature = o.Signature;
                    Prislista = o.Pricelist;
                    KombikaCode = o.KombikaCode;
                    ReferralNr = o.ReferralNo;
                    ReferralDate = o.ReferralDate;
                    AidType = o.AidType;
                    FRY = o.isClosed;
                    Priority = o.Priority;
                    doPost();
                    findOrder(o.OrderNo); // Do findorder again after post, we heve problems with texts otherwise.
                    Ordinator = o.SelOrdinator;
                    doPost();
                }
                else
                {
                    mErrorMsg = "Order " + o.OrderNo.Trim() + " är fryst och kan inte sparas";
                    return false;
                }
            }
            else
            {
                mErrorMsg = "Order " + o.OrderNo.Trim() + " was not found, may be deleted";
                return false;
            }

            return true;
        }
Ejemplo n.º 14
0
        public OrderHeadDefinition getPatientsLastOH(string knr)
        {
            OrderHeadDefinition o = new OrderHeadDefinition();

            if (findLastOrder(knr))
                fillOH(ref o);
            else
                fillOH(ref o, true);
            return o;
        }
Ejemplo n.º 15
0
 private FormControler()
 {
     currentOH = new OrderHeadDefinition();
       currentPatient = new PatientDefenition();
       lastPatient = new PatientDefenition();
 }
Ejemplo n.º 16
0
        private OrderHeadDefinition fillOH(OrderHeadDefinition currentOH)
        {
            OrderHeadDefinition o = currentOH;

            if (o.PatientNo.Trim().Equals("") && !o.OrderNo.Trim().Equals(""))
            {
                if (!frmControler.CurrentPatient.PatientNo.Trim().Equals(""))
                {
                    o.PatientNo = frmControler.CurrentPatient.PatientNo;
                    Log4Net.Logger.loggWarning("In fillOH on order " + frmControler.CurrentOH.OrderNo + " Patient was emty, this is not good! Instead patient " + frmControler.CurrentPatient.PatientNo + " was used", Config.User, "");
                }
                else
                {
                    Log4Net.Logger.loggCritical("No patient found either in order or current patient ( orderno: " + frmControler.CurrentOH.OrderNo + " )", Config.User, "");
                }
            }

            //o.PatientNo = o.PatientNo == "" ? currentPatient.CustNr : o.PatientNo;
            o.InvoiceCustomer = txtFKN.Text;
            o.Clinik = txtKlinik.Text;
            o.ClinikName = txtKlinikNamn.Text;
            o.ReferralDate = dtOTADate.Value;
            if (cboOrdinator.Text.Contains("("))
                o.SelOrdinator = cboOrdinator.Text.Substring(0, cboOrdinator.Text.IndexOf("("));
            else
                o.SelOrdinator = cboOrdinator.Text;
            o.YourReference = txtERF.Text;
            o.DiagnoseCode = txtDiagID.Text;
            o.Ordination = txtOrdination.Text;
            o.Diagnose = txtTillagg.Text;
            o.Notation = txtNotering.Text;
            o.OrderType = "1";
            o.ValidFrom = dtpGilltigFrom.Value;
            int i;
            try
            {
                if (int.TryParse(txtYears.Text, out i))
                    o.ValidYearsCount = i;
                else
                {
                    o.ValidYearsCount = 0;
                    //Log4Net.Logger.loggCritical("Could not convert ValidYearsCount to Int, string value " + txtYears.Text, Config.User, "frmMain.fillOH");
                }
            }
            catch (Exception ex)
            {
                Log4Net.Logger.loggError(ex, "Error while parsing date", Config.User, "frmMain.fillOH");
            }
            o.AidCount = txtAidCount.Text;
            if (cboSignature.Visible)
                o.Signature = cboSignature.Text;
            else
                o.Signature = txtSignature.Text;

            try
            {
                if(cboPrislista.Text.Length >= 1)
                    o.Pricelist = cboPrislista.Text.Substring(0, 1);
            }
            catch
            {
                Log4Net.Logger.loggCritical("Problem while setting pricelist", Config.User, "frmMain.fillOH");
            }

            return o;
        }
Ejemplo n.º 17
0
        public OrderHeadDefinition getOrder(string onr)
        {
            OrderHeadDefinition o = new OrderHeadDefinition();

            if (findOrder(onr))
                fillOH(ref o);
            else
                fillOH(ref o, true);

            return o;
        }