Exemple #1
0
        private void FormCaiGou_Load(object sender, EventArgs e)
        {
            string str = CDBOperate.GetDBConnectFromTxt();

            this.txtDbConn.Text = str;
            InitRemoteConnection();
        }
Exemple #2
0
 private void UploadPur(Object rows)
 {
     try
     {
         CDBOperate dbobj = new CDBOperate();
         DataGridViewRowCollection dgvrows = rows as DataGridViewRowCollection;
         foreach (DataGridViewRow r in dgvrows)
         {
             string bm   = r.Cells[2].Value == null ? "" : r.Cells[2].Value.ToString();
             string mc   = r.Cells[3].Value == null ? "" : r.Cells[3].Value.ToString();
             string sccj = r.Cells[4].Value == null ? "" : r.Cells[4].Value.ToString();
             string gg   = r.Cells[5].Value == null ? "" : r.Cells[5].Value.ToString();
             string jhdw = r.Cells[6].Value == null ? "" : r.Cells[6].Value.ToString();
             double yssl = 0;
             if (Double.TryParse(r.Cells[7].Value.ToString(), out yssl))
             {
                 dbobj.UploadPur(remoteConn, bm, mc, sccj, gg, jhdw, yssl, dm);
             }
         }
         this.Invoke((MethodInvoker) delegate()
         {
             btnLoadPur.Enabled = false;
             MessageBox.Show("上传完成");
             formLoading.Dispose();
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         this.Invoke((MethodInvoker) delegate()
         {
         });
     }
 }
Exemple #3
0
        //private void btnSearchUnsalable_Click(object sender, EventArgs e)
        //{

        //}
        //private void SelectUnsalableItems()
        //{
        //    try
        //    {
        //        CDBOperate dbobj = new CDBOperate();
        //        DataTable dbtable = dbobj.GetUnSalableDrug(thisConn, begindate, enddate, buydate,unsaleNum);
        //        this.Invoke((MethodInvoker)delegate()
        //        {
        //            dgvDrugSearch.DataSource = dbtable;
        //            stripLabelInfo.Text = "查询滞销药品.";
        //            formLoading.Dispose();
        //        });
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //        this.Invoke((MethodInvoker)delegate()
        //        {
        //            stripLabelInfo.Text = "";
        //            formLoading.Dispose();
        //        });
        //    }
        //}

        private void UpdatePercentage(object gsbm)
        {
            string sgsbm = gsbm as string;

            try
            {
                CDBOperate dbobj = new CDBOperate();
                dbobj.UpdatePercentage(thisConn, sgsbm);
                this.Invoke((MethodInvoker) delegate()
                {
                    stripLabelInfo.Text = "更新参考提成完成.";
                    if (DialogResult.OK == MessageBox.Show("更新成功!"))
                    {
                        formLoading.Dispose();
                    }
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Invoke((MethodInvoker) delegate()
                {
                    stripLabelInfo.Text = "";
                    formLoading.Dispose();
                });
            }
        }
Exemple #4
0
 private void UpdateBuyGive()
 {
     try
     {
         CDBOperate dbobj = new CDBOperate();
         dbobj.UpdatePinMingPPC(thisConn, dm);
         this.Invoke((MethodInvoker) delegate()
         {
             stripLabelInfo.Text = "品种更新完成.";
             if (DialogResult.OK == MessageBox.Show("更新成功!"))
             {
                 formLoading.Dispose();
             }
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         this.Invoke((MethodInvoker) delegate()
         {
             stripLabelInfo.Text = "";
             formLoading.Dispose();
         });
     }
 }
Exemple #5
0
 private void btnLoadPur_Click(object sender, EventArgs e)
 {
     //2.从数据库中选择需要采购的数据,自动生成
     if (MessageBox.Show("将会进行初始化,是否继续", "是否删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         if (dgvPur.Rows.Count > 0)
         {
             dgvPur.Rows.Clear();
         }
         CDBOperate dbobj   = new CDBOperate();
         DataTable  dbtable = dbobj.SelectNeedBuy(thisConn);
         foreach (DataRow r in dbtable.Rows)
         {
             DataGridViewRow nrow = new DataGridViewRow();
             nrow.CreateCells(dgvPur);
             nrow.Cells[2].Value = r["bm"];
             nrow.Cells[3].Value = r["mc"];
             nrow.Cells[4].Value = r["sccj"];
             nrow.Cells[5].Value = r["gg"];
             nrow.Cells[6].Value = r["jhdw"];
             nrow.Cells[7].Value = r["yysl"];
             dgvPur.Rows.Add(nrow);
         }
     }
 }
Exemple #6
0
 void form_setConnectEventAfterOpen()
 {
     thisConn = CDBOperate.GetConnection();
     if (!CDBOperate.TryConnect(thisConn))
     {
         MessageBox.Show("数据库连接错误");
     }
 }
Exemple #7
0
        /// <summary>
        /// 往配置文件里写数据
        /// /
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSet_Click(object sender, EventArgs e)
        {
            //往文件里写配置文件
            string connstr = txtDatabase.Text;

            if (CDBOperate.WriteDBConnect2Txt(connstr))
            {
                MessageBox.Show("更改成功");
            }
        }
Exemple #8
0
 void form_setConnectEvent()
 {
     thisConn = CDBOperate.GetConnection();
     if (CDBOperate.TryConnect(thisConn))
     {
         InitializeComponent();
     }
     else
     {
         this.Close();
     }
 }
Exemple #9
0
 private void FormSelectGYS_Load(object sender, EventArgs e)
 {
     try
     {
         CDBOperate dbobj   = new CDBOperate();
         DataTable  dbtable = dbobj.SelectGYS(thisConn, "");
         this.dgvGYS.DataSource = dbtable;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #10
0
        public FormGenerateXml(SqlConnection thisConn)
        {
            InitializeComponent();
            this.thisConn   = thisConn;
            txtXmlPath.Text = CDBOperate.GetZxXmlPathFromTxt();
            txtComCode.Text = CDBOperate.GetZxXmlComcodeFromTxt();
            txtComName.Text = CDBOperate.GetZxXmlComnameFromTxt();


            lbdate_in.Text   = CDBOperate.GetSettingInfo("ZxUploadXmlDateIn");
            lbdate_init.Text = CDBOperate.GetSettingInfo("ZxUploadXmlDateInit");
            lbdate_out.Text  = CDBOperate.GetSettingInfo("ZxUploadXmlDateOut");
        }
Exemple #11
0
 private void FormSelectGYS_Load(object sender, EventArgs e)
 {
     try
     {
         CDBOperate dbobj   = new CDBOperate();
         DataTable  dbtable = dbobj.SelectMedicineDetailByVIP(thisConn, vipbm, dm, ypbm, begindate, enddate);
         this.dgvMediDetail.DataSource = dbtable;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #12
0
 private string zxXmlPath;        //上传中心的xml目录
 public FormMain()
 {
     thisConn = CDBOperate.GetConnection();
     if (CDBOperate.TryConnect(thisConn))
     {
         InitializeComponent();
     }
     else
     {
         FormSetting form = new FormSetting();
         form.setConnectEvent += form_setConnectEvent;
         form.setSettingEvent += form_setSettingEvent;
         form.ShowDialog();
     }
 }
        private void txtPurBm_TextChanged(object sender, EventArgs e)
        {
            string bm = this.txtPurBm.Text;

            try
            {
                CDBOperate dbobj   = new CDBOperate();
                DataTable  dbtable = dbobj.SelectMedicine(thisConn, bm);
                this.dgvDrugInfo2.DataSource = dbtable;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #14
0
        private void txtGYS_TextChanged(object sender, EventArgs e)
        {
            string gys = txtGYS.Text;

            try
            {
                CDBOperate dbobj   = new CDBOperate();
                DataTable  dbtable = dbobj.SelectGYS(thisConn, gys);
                this.dgvGYS.DataSource = dbtable;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #15
0
        private void FormSetting_Load(object sender, EventArgs e)
        {
            string str = CDBOperate.GetDBConnectFromTxt();

            txtDatabase.Text = str;
            string dianma = CDBOperate.GetDianMa();

            txtDM.Text = dianma;
            string remotedb = CDBOperate.GetRemoteDBConnectFromTxt();

            this.txtRemoteDb.Text = remotedb;

            this.txt_zx_xml_comcode.Text = CDBOperate.GetZxXmlComcodeFromTxt();
            this.txt_zx_xml_comname.Text = CDBOperate.GetZxXmlComnameFromTxt();
            this.txt_zx_xml_path.Text    = CDBOperate.GetZxXmlPathFromTxt();
        }
Exemple #16
0
        private void cboxTypeSelect_SelectedIndexChanged(object sender, EventArgs e)
        {
            tstatusLabel.Text = "正在查询 ...";
            CDBOperate dbobj   = new CDBOperate();
            DataTable  dbtable = dbobj.SelectYxqx(thisConn, cboxTypeSelect.SelectedIndex);

            this.dgviewTbInfo.DataSource = dbtable;
            tstatusLabel.Text            = "就绪.";
            if (dgviewTbInfo.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgviewTbInfo.SelectedRows[0];

                if (row.Cells[0].Value != null)
                {
                    this.txtLsh.Text = row.Cells[0].Value.ToString();
                }
                else
                {
                    txtLsh.Text = "";
                }

                if (row.Cells[1].Value != null)
                {
                    this.txtCode.Text = row.Cells[1].Value.ToString();
                }
                else
                {
                    txtCode.Text = "";
                }
                if (row.Cells[2].Value != null)
                {
                    this.txtMc.Text = row.Cells[2].Value.ToString();
                }
                else
                {
                    txtMc.Text = "";
                }
                if (row.Cells[6].Value != null)
                {
                    this.txtYxqx.Text = row.Cells[6].Value.ToString();
                }
                else
                {
                    txtYxqx.Text = "";
                }
            }
        }
Exemple #17
0
        private void SelectUnsalableItems()
        {
            try
            {
                CDBOperate dbobj = new CDBOperate();
                //DataTable dbtable = dbobj.GetUnSalableDrug(thisConn, begindate, enddate, buydate, unsaleNum);
                List <DataTable> dtlist     = dbobj.GetUnSalableDrug(thisConn, begindate, enddate, buydate, unsaleNum);//西药
                String           info       = dbobj.GetUnSalableDrug_ZongDian(thisConn);
                DataTable        dtzhongyao = dbobj.GetUnSalableDrug_ZhongYao(thisConn);

                String info2 = dbobj.GetUnSalableDrug_ZongDian_Zhongyao(thisConn);

                this.Invoke((MethodInvoker) delegate()
                {
                    dgvDrug.DataSource          = dtlist[0];
                    dgv_yanzhong.DataSource     = dtlist[1];
                    this.dgv_zhixiao.DataSource = dtlist[2];
                    this.dgv_jianyi.DataSource  = dtlist[3];
                    formLoading.Dispose();
                    for (int i = 0; i < dgvDrug.Columns.Count; i++)
                    {
                        dgvDrug.Columns[i].ReadOnly = true;
                    }
                    if (dgvDrug.SelectedRows.Count > 0 && dgvDrug.SelectedRows[0] != null)
                    {
                        DataGridViewRow row = dgvDrug.SelectedRows[0];
                        UpdateCurrentText(row);
                    }
                    //总店
                    labelinfo.Text = info;
                    //中药
                    dgv_zhongyao.DataSource = dtzhongyao;
                    //总店中药
                    rtxt_zhongyao.Text = info2;
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Invoke((MethodInvoker) delegate()
                {
                    formLoading.Dispose();
                });
            }
        }
Exemple #18
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            CDBOperate dbobj   = new CDBOperate();
            DataTable  dbtable = dbobj.SelectSpxx(thisConn, txtPurName.Text);

            if (dgvPurSelect.Columns.Count == 0)
            {
                DataGridViewCheckBoxColumn newColumn = new DataGridViewCheckBoxColumn();
                newColumn.HeaderText = "*";
                dgvPurSelect.Columns.Insert(0, newColumn);
                dgvPurSelect.Columns[0].Width = 30;
            }
            this.dgvPurSelect.DataSource = dbtable;
            for (int i = 1; i < dgvPurSelect.Columns.Count; i++)
            {
                dgvPurSelect.Columns[i].ReadOnly = true;
            }
        }
Exemple #19
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            CDBOperate dbobj   = new CDBOperate();
            DataTable  dbtable = dbobj.SelectSpxxByName(thisConn, this.txtDrugName.Text);

            this.dgvDrug.DataSource = dbtable;

            /*
             *
             * if (this.dgvDrug.Columns.Count == 0)
             * {
             *  DataGridViewCheckBoxColumn newColumn = new DataGridViewCheckBoxColumn();
             *  newColumn.HeaderText = "*";
             *  dgvDrug.Columns.Insert(0, newColumn);
             *  dgvDrug.Columns[0].Width = 30;
             * }
             */
        }
 private void cDoubleBufferDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1 && dgvStatis.SelectedRows.Count > 0 && dgvStatis.SelectedRows[0] != null)
     {
         try
         {
             DataGridViewRow row = dgvStatis.SelectedRows[0];
             //查询该药品的单品汇总
             string     dm    = row.Cells[0].Value.ToString();
             string     bm    = txtYpBm.Text;
             CDBOperate dbobj = new CDBOperate();
             DataTable  dt    = dbobj.SelectSingMedicineDetail(thisConn, bm, dm, this.dtpkBegindate.Value, this.dtpkEnddate.Value);
             this.dgvDetail.DataSource = dt;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Exemple #21
0
 private void SelectGYS()
 {
     try
     {
         CDBOperate dbobj   = new CDBOperate();
         DataTable  dbtable = dbobj.GetGYS(thisConn, dm, gysmc, gysbm);
         this.Invoke((MethodInvoker) delegate()
         {
             dgvDrugSearch.DataSource = dbtable;
             stripLabelInfo.Text      = "查询完成.";
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         this.Invoke((MethodInvoker) delegate()
         {
             stripLabelInfo.Text = "";
         });
     }
 }
Exemple #22
0
 private void SelectVIPMedicine()
 {
     try
     {
         CDBOperate dbobj   = new CDBOperate();
         DataTable  dbtable = dbobj.SelectMedicineByVIP(thisConn, dm, ypbm, begindate, enddate);
         this.Invoke((MethodInvoker) delegate()
         {
             dgvDrugSearch.DataSource = dbtable;
             stripLabelInfo.Text      = "查询完成.";
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         this.Invoke((MethodInvoker) delegate()
         {
             stripLabelInfo.Text = "";
         });
     }
 }
Exemple #23
0
 private void UpdateScore()
 {
     try
     {
         CDBOperate dbobj   = new CDBOperate();
         DataTable  dbtable = dbobj.UpdateScore(thisConn, dm);
         this.Invoke((MethodInvoker) delegate()
         {
             dgvDrugSearch.DataSource = dbtable;
             stripLabelInfo.Text      = "更新不积分品种完成.";
             formLoading.Dispose();
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         this.Invoke((MethodInvoker) delegate()
         {
             stripLabelInfo.Text = "";
             formLoading.Dispose();
         });
     }
 }
        private void dgvDrugInfo2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && dgvDrugInfo2.SelectedRows.Count > 0 && dgvDrugInfo2.SelectedRows[0] != null)
            {
                DataGridViewRow row = dgvDrugInfo2.SelectedRows[0];
                string          bm  = row.Cells[0].Value.ToString();
                this.txtPurNameSelect.Text = row.Cells[1].Value.ToString();
                this.txtYpBm.Text          = bm;
                try
                {
                    //查询该药品的单品汇总
                    CDBOperate dbobj = new CDBOperate();
                    DataTable  dt    = dbobj.SelectSingMedicineStatis(thisConn, bm, this.dtpkBegindate.Value, this.dtpkEnddate.Value);
                    dgvStatis.DataSource = dt;

                    dgvDetail.DataSource = null;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemple #25
0
        private void ExportXmlIn(string filePath, string senderId, string senderName, DateTime generateDate)
        {
            CXmlEnv xmlEnv = new CXmlEnv();

            xmlEnv.MESSAGE_TYPE  = "in";
            xmlEnv.SENDER_ID     = senderId;
            xmlEnv.SENDERNAME    = senderName;
            xmlEnv.GENERATE_DATE = generateDate;
            xmlEnv.SOFTTYPE      = "1";
            xmlEnv.SEND_TIME     = DateTime.Now;

            CDBOperate     db          = new CDBOperate();
            List <CXmlIn>  xmlinList   = db.GetXmlInsList(thisConn, Convert.ToDateTime(xmlEnv.GENERATE_DATE.ToShortDateString()));
            XmlDocument    doc         = new XmlDocument();
            XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "utf-8", "");//xml文档声明部分

            doc.AppendChild(declaration);
            XmlElement root = doc.CreateElement("SIGNATURE", "www.hebfdea.com");

            doc.AppendChild(root);
            XmlElement obj = doc.CreateElement("OBJECT", doc.DocumentElement.NamespaceURI);

            root.AppendChild(obj);
            XmlElement package = doc.CreateElement("PACKAGE", doc.DocumentElement.NamespaceURI);

            obj.AppendChild(package);
            XmlElement env = doc.CreateElement("ENVELOPINFO", doc.DocumentElement.NamespaceURI);

            package.AppendChild(env);

            XmlElement version = doc.CreateElement("VERSION", doc.DocumentElement.NamespaceURI);

            version.InnerText = xmlEnv.VERSION;
            env.AppendChild(version);

            XmlElement messgageid = doc.CreateElement("MESSAGE_ID", doc.DocumentElement.NamespaceURI);

            messgageid.InnerText = xmlEnv.MESSAGE_ID;
            env.AppendChild(messgageid);

            XmlElement filename = doc.CreateElement("FILE_NAME", doc.DocumentElement.NamespaceURI);

            filename.InnerText = xmlEnv.FILE_NAME;
            env.AppendChild(filename);

            XmlElement msgtype = doc.CreateElement("MESSAGE_TYPE", doc.DocumentElement.NamespaceURI);

            msgtype.InnerText = xmlEnv.MESSAGE_TYPE;
            env.AppendChild(msgtype);

            XmlElement SENDER_ID = doc.CreateElement("SENDER_ID", doc.DocumentElement.NamespaceURI);

            SENDER_ID.InnerText = xmlEnv.SENDER_ID;
            env.AppendChild(SENDER_ID);

            XmlElement SEND_TIME = doc.CreateElement("SEND_TIME", doc.DocumentElement.NamespaceURI);

            SEND_TIME.InnerText = xmlEnv.SEND_TIME.ToString("yyyy-MM-dd HH:mm:ss");
            env.AppendChild(SEND_TIME);
            XmlElement RECEIVER_ID = doc.CreateElement("RECEIVER_ID", doc.DocumentElement.NamespaceURI);

            RECEIVER_ID.InnerText = xmlEnv.RECEIVER_ID;
            env.AppendChild(RECEIVER_ID);

            XmlElement SOFTTYPE = doc.CreateElement("SOFTTYPE", doc.DocumentElement.NamespaceURI);

            SOFTTYPE.InnerText = xmlEnv.SOFTTYPE;
            env.AppendChild(SOFTTYPE);

            XmlElement SENDERNAME = doc.CreateElement("SENDERNAME", doc.DocumentElement.NamespaceURI);

            SENDERNAME.InnerText = xmlEnv.SENDERNAME;
            env.AppendChild(SENDERNAME);

            //添加数据
            XmlElement datainfo = doc.CreateElement("DATAINFO", doc.DocumentElement.NamespaceURI);

            package.AppendChild(datainfo);
            foreach (CXmlIn xin in xmlinList)
            {
                XmlElement rowinfo = doc.CreateElement("ROWINFO", doc.DocumentElement.NamespaceURI);
                datainfo.AppendChild(rowinfo);
                XmlElement i_item_code = doc.CreateElement("I_ITEM_CODE", doc.DocumentElement.NamespaceURI);
                i_item_code.InnerText = xin.I_ITEM_CODE;
                rowinfo.AppendChild(i_item_code);

                XmlElement YPPH = doc.CreateElement("YPPH", doc.DocumentElement.NamespaceURI);
                YPPH.InnerText = xin.YPPH;
                rowinfo.AppendChild(YPPH);

                XmlElement VDATE = doc.CreateElement("VDATE", doc.DocumentElement.NamespaceURI);
                VDATE.InnerText = xin.VDATE;
                rowinfo.AppendChild(VDATE);

                XmlElement PACKAGE = doc.CreateElement("PACKAGE", doc.DocumentElement.NamespaceURI);
                PACKAGE.InnerText = xin.PACKAGE;
                rowinfo.AppendChild(PACKAGE);

                XmlElement UNIT = doc.CreateElement("UNIT", doc.DocumentElement.NamespaceURI);
                UNIT.InnerText = xin.UNIT;
                rowinfo.AppendChild(UNIT);

                XmlElement NUM = doc.CreateElement("NUM", doc.DocumentElement.NamespaceURI);
                NUM.InnerText = xin.NUM.ToString();
                rowinfo.AppendChild(NUM);

                XmlElement JZ_DATE = doc.CreateElement("JZ_DATE", doc.DocumentElement.NamespaceURI);
                JZ_DATE.InnerText = xin.JZ_DATE.ToString("yyyy-MM-dd HH:mm:ss");
                rowinfo.AppendChild(JZ_DATE);

                XmlElement FPH = doc.CreateElement("FPH", doc.DocumentElement.NamespaceURI);
                FPH.InnerText = xin.FPH;
                rowinfo.AppendChild(FPH);

                XmlElement I_MER_CODE = doc.CreateElement("I_MER_CODE", doc.DocumentElement.NamespaceURI);
                I_MER_CODE.InnerText = xin.I_MER_CODE;
                rowinfo.AppendChild(I_MER_CODE);

                XmlElement MER_NAME = doc.CreateElement("MER_NAME", doc.DocumentElement.NamespaceURI);
                MER_NAME.InnerText = xin.MER_NAME;
                rowinfo.AppendChild(MER_NAME);

                XmlElement MERA_CODE = doc.CreateElement("MERA_CODE", doc.DocumentElement.NamespaceURI);
                MERA_CODE.InnerText = xin.MERA_CODE;
                rowinfo.AppendChild(MERA_CODE);

                XmlElement BILL_TYPE = doc.CreateElement("BILL_TYPE", doc.DocumentElement.NamespaceURI);
                BILL_TYPE.InnerText = xin.BILL_TYPE;
                rowinfo.AppendChild(BILL_TYPE);
            }
            doc.Save(filePath + "\\" + xmlEnv.FILE_NAME);
        }