示例#1
0
 /// <summary>
 /// Constructor för OrderCOM
 /// </summary>
 public OrderCOM()
 {
     mOGA = new GarpGenericDB("OGA");
     mOGF = new GarpGenericDB("OGF");
     mOGL = new GarpGenericDB("OGL");
     mOGR = new GarpGenericDB("OGR");
     mKA = new GarpGenericDB("KA");
     mHKL = new GarpGenericDB("HKL");
     mHKA = new GarpGenericDB("HKA");
 }
示例#2
0
        public OrderRowCOM()
        {
            mOGR = new GarpGenericDB("OGR");
            mOGR2 = new GarpGenericDB("OGR2");
            mOGA = new GarpGenericDB("OGA");
            mAGA = new GarpGenericDB("AGA");
            mAGT = new GarpGenericDB("AGT");
            mHKA = new GarpGenericDB("HKA");
            mHKR = new GarpGenericDB("HKR");
            mKR = new GarpGenericDB("KR");
            mOGR_Search = new GarpGenericDB("OGR");
            oProduct = new ProductCOM();
            oOrText = new OrderRowText();

            mHKA.index = 2;
        }
示例#3
0
 protected CustomerCOM()
 {
     mKA = new GarpGenericDB("KA");
     mKA_Search = new GarpGenericDB("KA");
     oPricelist = new Prislista();
 }
示例#4
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            mOGA = new GarpGenericDB("OGA");
            mOGR = new GarpGenericDB("OGR");
            mOGK = new GarpGenericDB("OGK");
            mI2H = new GarpGenericDB("I2H");
            mI2R = new GarpGenericDB("I2R");
            mI2T = new GarpGenericDB("I2T");

            if (string.IsNullOrEmpty(txtOnr.Text))
            {
                if(MessageBox.Show(this, "Vill du lägga på kundtext på samtliga olevererade order?", "Uppdatera order", MessageBoxButtons.YesNo ) == System.Windows.Forms.DialogResult.Yes)
                {
                    allOrder();
                    MessageBox.Show("Klart");
                }
            }
            else
            {
                justOneOrder(txtOnr.Text);
                MessageBox.Show("Klart");
            }
        }
示例#5
0
        /// <summary>
        /// Saves information that is common for all rows on a AidId
        /// 
        /// </summary>
        private void saveCommonOrderRow(OrderRowDefinitions.OrderRow or, ref GarpGenericDB data)
        {
            data.find(or.OrderNo);
            data.next();

            while (data.getValue("ONR").Equals(or.OrderNo) && !data.EOF)
            {
                if ((getFormatedAidId(data.getValue("NX1")) == or.AidNr) && (!isEgenAvgift(data.getValue("ANR"))))
                {
                    fillCommonOrderRowFields(or, data);
                }
                data.next();
            }
        }
示例#6
0
        private OrderRowDefinitions.OrderRow fillOrderRow(ref GarpGenericDB data)
        {
            mOGR2.find(data.getValue("ONR").PadRight(6) + data.getValue("RDC").PadLeft(3));

            OrderRowDefinitions.OrderRow or = new OrderRowDefinitions.OrderRow();
            fillFieldsFromOtherTables(data.getValue("ONR"), data.getValue("RDC"));

            or.OrderNo = data.getValue("ONR");
            or.Rad = data.getValue("RDC");
            or.AidNr = getFormatedAidId(data.getValue("NX1"));
            or.Artikel = data.getValue("ANR");
            or.ProductName = oProduct.getNameById(data.getValue("ANR"));
            or.Antal = data.getValue("ORA");

            if (isInternalProduct(or.Artikel))
                or.APris = mOGR.getValue("LVP");
            else
                or.APris = mOGR.getValue("PRI");

            or.LevTid = data.getValue("LDT");
            or.InkStat = data.getValue("INK");
            or.Enhet = data.getValue("ENH");
            or.AidDate = getFormatedAidDate(data.getValue("DIM"));
            or.Prodstatus = oProdStat.getTable(data.getValue("RES")).TX1;
            or.SelectedHandler = data.getValue("BNX");
            or.Levstatus = data.getValue("LVF");
            //or.DeliverMode = getDeliverMode(or.OrderNo);
            or.Text = orText.getTexts(or.OrderNo, or.Rad);
            or.AidsText = orText.getAidsText(or.OrderNo, or.Rad);
            or.ViewInList = mOGR.getValue("X1F").Equals("x") ? true : false;
            or.Warrenty = mOGR.getValue("RBK").Equals("G") ? true : false;
            or.Beloppsrad = mOGR.getValue("BRA").Equals("*") ? true : false;
            or.DeliverDate = GCF.noNULL(mDeliverDate);
            or.InvoiceNo = GCF.noNULL(mInvoiceNo);;
            or.InvoiceDate = GCF.noNULL(mInvoiceDate);;
            or.Thord_NeedStep = mOGR2.getValue("C2A");
            or.AidPriority = mOGR2.getValue("C2B");

            try
            {
                or.AidOid = 0;
                int.TryParse(mOGR2.getValue("NU5"), out or.AidOid);
            }
            catch(Exception e)
            {
                or.AidOid = 0;
            }

            try
            {
                or.PartOid = 0;
                int.TryParse(mOGR2.getValue("NU6"), out or.PartOid);
            }
            catch (Exception e)
            {
                or.PartOid = 0;
            }

            or.CreatedInThord = data.getValue("X2F").Equals("1") ? true : false;
            or.FirstTimePatient = mOGR2.getValue("C1A").Equals("1") ? true : false;
            or.EA_ProductGroup = mOGR.getValue("EXT");
            or.ProductionTitle = mOGR2.getValue("C20") + mOGR2.getValue("C10");
            or.Urgent = mOGR2.getValue("C1B").Equals("1") ? true : false;
            or.Priority = mOGR2.getValue("C1C");

            string[] s = { "yyMMdd", "yyyyMMdd", "yyyy-MM-dd" };
            try
            {
                DateTime dt;
                DateTime.TryParseExact(mOGR2.getValue("C06"), s, new CultureInfo("sv-SE"), DateTimeStyles.AssumeLocal, out dt);

                if (dt.AddYears(50) < DateTime.Now)
                    or.PromisedDeliverDate = null;
                else
                    or.PromisedDeliverDate = dt;
            }
            catch { or.PromisedDeliverDate = null; }

            try
            {
                DateTime dt;
                DateTime.TryParseExact(mOGR2.getValue("C07").Trim(), s, new CultureInfo("sv-SE"), DateTimeStyles.AssumeLocal, out dt);

                if (dt.AddYears(50) < DateTime.Now)
                    or.ConditionDate = null;
                else
                    or.ConditionDate = dt;
            }
            catch { or.ConditionDate = null; }

            or.Holder = mOGR2.getValue("C05") == "" ? null : mOGR2.getValue("C05");
            return or;
        }
示例#7
0
        private void fillGarpTableFields(OrderRowDefinitions.OrderRow or, ref GarpGenericDB data)
        {
            data.setValue("ANR", or.Artikel);
            data.setValue("ORA", or.Antal.Replace(",", "."));

            if (isInternalProduct(or.Artikel))
            {
                if (GCF.noNULL(or.APris).Equals(""))
                    mOGR.setValue("LVP", "0");
                else
                    mOGR.setValue("LVP", or.APris.Replace(",", "."));

                mOGR.setValue("LPF", "F");

                // PRI is always zero on internal products
                mOGR.setValue("PRI", "0");
            }
            else
            {
                if (GCF.noNULL(or.APris).Equals(""))
                    mOGR.setValue("PRI", "0");
                else
                    mOGR.setValue("PRI", or.APris.Replace(",", "."));
            }

            //data.setValue("PRI", or.APris);

            try
            {
                if (!GCF.noNULL(or.LevTid).Equals(""))
                    data.setValue("LDT", or.LevTid);
            }
            catch { }

            if (GCF.noNULL(or.AidDate).Trim() != "")
                mOGR.setValue("DIM", "1" + or.AidDate);
            else
                mOGR.setValue("DIM", GCF.noNULL(or.AidDate));

            data.setValue("RES", oProdStat.getIdByTX1(or.Prodstatus));
            data.setValue("BNX", or.SelectedHandler);
            data.setValue("INK", or.InkStat);

            if (or.ViewInList)
                data.setValue("X1F", "x");
            else
                data.setValue("X1F", "0");

            if (or.Warrenty)
            {
                data.setValue("RAB", "-100");
                data.setValue("RBK", "G");
            }
            else
            {
                data.setValue("RAB", "");
                data.setValue("RBK", "");
            }

            if (or.Beloppsrad)
                data.setValue("BRA", "*");
            else
                data.setValue("BRA", "");

            mOGR2.setValue("C2A", or.Thord_NeedStep);
            mOGR2.setValue("NU5", or.AidOid.ToString());
            mOGR2.setValue("NU6", or.PartOid.ToString());

            data.setValue("EXT", or.EA_ProductGroup);

            mOGR2.setValue("C1C", or.Priority);
            mOGR2.setValue("C2B", or.AidPriority);

            // ********* Producktions, vet inte ens om dett blir aktuellt ************
            if (GCF.noNULL(or.ProductionTitle).Length > 20)
            {
                mOGR2.setValue("C20", or.ProductionTitle.Substring(0, 20));
                mOGR2.setValue("C10", or.ProductionTitle.Substring(20));
            }
            else
            {
                mOGR2.setValue("C20", or.ProductionTitle);
                mOGR2.setValue("C10", "");
            }

            try
            {
                if (or.Urgent)
                    mOGR2.setValue("C1B", "1");
                else
                    mOGR2.setValue("C1B", "0");
            }
            catch { mOGR2.setValue("C1B", "0"); }

            string[] s = { "yyMMdd", "yyyyMMdd", "yyyy-MM-dd" };
            try
            {
                mOGR2.setValue("C06", or.PromisedDeliverDate.HasValue ? or.PromisedDeliverDate.Value.ToString("yyMMdd") : "");
            }
            catch { mOGR2.setValue("C06", DateTime.Today.ToString("yyMMdd")); }

            try
            {
                mOGR2.setValue("C07", or.ConditionDate.HasValue ? or.ConditionDate.Value.ToString("yyMMdd") : "");
            }
            catch { mOGR2.setValue("C07", DateTime.Today.ToString("yyMMdd")); }
        }
示例#8
0
        private void fillCommonOrderRowFields(OrderRowDefinitions.OrderRow or, GarpGenericDB data)
        {
            mOGR.setValue("LDT", GCF.noNULL(or.LevTid));
            mOGR.setValue("DIM", !GCF.noNULL(or.AidDate).Equals("") ? "1" + or.AidDate : or.AidDate);
            mOGR.setValue("RES",oProdStat.getIdByTX1(GCF.noNULL(or.Prodstatus)));
            mOGR.setValue("BNX", or.SelectedHandler);
            //mOGA.setValue("LSE", !GCF.noNULL(GCF.noNULL(or.DeliverMode)).Equals("") ? oDelM.getKeyByName(or.DeliverMode) : "");

            if (or.Warrenty)
            {
                mOGR.setValue("RAB", "-100");
                mOGR.setValue("RBK", "G");
            }
            else
            {
                mOGR.setValue("RAB", "");
                mOGR.setValue("RBK", "");
            }

            if(mOGR2.find(or.OrderNo.PadRight(6) + or.Rad.PadLeft(3)))
            {
                mOGR2.setValue("C2A", GCF.noNULL(or.Thord_NeedStep));
                mOGR2.setValue("C1A", or.FirstTimePatient ? "1" : "0");
            }

            orText.saveAidsText(or.OrderNo, or.Rad, or.AidsText);
        }
示例#9
0
 public void setWarranty(bool value, ref GarpGenericDB data)
 {
     if (value)
     {
         data.setValue("RAB", "-100");
         data.setValue("RBK", "G");
     }
     else
     {
         data.setValue("RAB", "");
         data.setValue("RBK", "");
     }
 }
示例#10
0
        public void runReport(string gen, string id, string idx)
        {
            GarpGenericDB o = new GarpGenericDB("OGR");

            try
            {
                Garp.IReport dokNotice = o.getApp.ReportGenerators.Item(gen).Reports.Item(id.Trim());
                dokNotice.RangeFrom = idx;
                dokNotice.RangeTo = idx;
                dokNotice.Run();
            }
            catch { }
        }
示例#11
0
        private void btnCopDoc2_Click(object sender, EventArgs e)
        {
            Config.CopDoc cd = Config.getCopDoc[1];
            GarpGenericDB garp;
            Process copdoc = new Process();

            if (cd.Table.Equals("OGA"))
            {
                garp = new GarpGenericDB(cd.Table);

                // If we found the post searched for
                if (garp.find(txtONR.Text))
                {
                    cd.Arguments = cd.Arguments.Replace("{" + cd.Table + ";", "");
                    cd.Arguments = cd.Arguments.Replace(cd.Field + "}", "\"" + garp.getValue(cd.Field) + "\"");

                    copdoc.StartInfo.FileName = cd.Path;
                    copdoc.StartInfo.Arguments = cd.Arguments;
                    try
                    {
                        Log4Net.Logger.loggInfo("CopDoc started with following string: " + copdoc.StartInfo.FileName + " " + copdoc.StartInfo.Arguments, Config.User, "frmMain.btnCopDoc1_Click()");
                        copdoc.Start();
                    }
                    catch (Exception ex)
                    {
                        Log4Net.Logger.loggError(ex, "Error when starting CopDoc Path:" + cd.Path + " Arguments:" + cd.Arguments, Config.User, "frmMain.btnCopDoc1_Click");
                        MessageBox.Show(this, "Det gick inte att starta CopDoc", "CopDoc", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(this, "Hittade inte den eftersökta patienten i Garp", "Patient hittades ej", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (cd.Table.Equals("KA"))
            {
                garp = new GarpGenericDB(cd.Table);

                // If we found the post searched for
                if (garp.find(txtKNR.Text))
                {
                    cd.Arguments = cd.Arguments.Replace("{" + cd.Table + ";", "");
                    cd.Arguments = cd.Arguments.Replace(cd.Field + "}", garp.getValue(cd.Field));

                    copdoc.StartInfo.FileName = cd.Path;
                    copdoc.StartInfo.Arguments = cd.Arguments;
                    try
                    {
                        copdoc.Start();
                    }
                    catch (Exception ex)
                    {
                        Log4Net.Logger.loggError(ex, "Error when starting CopDoc Path:" + cd.Path + " Arguments:" + cd.Arguments, Config.User, "frmMain.btnCopDoc1_Click");
                        MessageBox.Show(this, "Det gick inte att starta CopDoc", "CopDoc", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(this, "Hittade inte den eftersökta patienten i Garp", "Patient hittades ej", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

            }
        }
示例#12
0
        public PurchaseDefenitions[] getAllPurchaseOrders(string cust_onr)
        {
            GarpGenericDB IGA = new GarpGenericDB("IGA");
            GarpGenericDB IGF = new GarpGenericDB("IGF");
            GarpGenericDB LA = new GarpGenericDB("LA");
            PurchaseDefenitions purchase;
            ArrayList alPurchase = new ArrayList();

            IGF.first();

            while (!IGF.EOF)
            {
                if (GCF.noNULL(IGF.getValue("TX3")).StartsWith(cust_onr.Trim()))
                {
                    purchase = new PurchaseDefenitions();
                    purchase.IO_No = IGF.getValue("ONR").Trim();
                    purchase.CustomerOrderNo = IGF.getValue("TX3");

                    if (IGA.find(IGF.getValue("ONR")))
                    {
                        purchase.IO_Status = IGA.getValue("LEF");
                        purchase.SupplierNo = IGA.getValue("LNR");

                        if (LA.find(IGA.getValue("LNR")))
                            purchase.SupplierName = LA.getValue("NAM");
                    }
                    alPurchase.Add(purchase);
                }

                IGF.next();
            }
            return (PurchaseDefenitions[])alPurchase.ToArray(typeof(PurchaseDefenitions));
        }