Ejemplo n.º 1
0
        public void m_mthFindChargeItem()
        {
            if (this.m_objViewer.m_txtFind.Text.Trim() == "")
            {
                MessageBox.Show("请输入查询条件!");
                this.m_objViewer.m_txtFind.Select();
                return;
            }
            DataTable m_dt;

            long   strRet    = objSvc.m_mthFindChargeItem(this.m_objViewer.m_cmbFind.Tag.ToString().Trim(), this.m_objViewer.m_txtFind.Text.Trim(), out m_dt, this.m_objViewer.cmbCatType.SelectItemValue);
            string strFirtID = "";          //记录第一行的ID
            int    location  = -1;

            if (strRet > 0 && m_dt.Rows.Count > 0)
            {
                this.m_objViewer.m_btFind.Enabled = false;
                dwtProcessBar obj = new dwtProcessBar();
                obj.m_mthSetMaxValue(m_dt.Rows.Count);
                obj.Show();
                obj.Update();
                dt.Rows.Clear();
                while (m_dt.Rows.Count > 0)
                {
                    strFirtID = m_dt.Rows[m_dt.Rows.Count - 1]["ITEMID_CHR"].ToString().Trim();
                    DataRow dr = dt.NewRow();
                    dr["ID"]   = strFirtID;
                    dr["项目编号"] = m_dt.Rows[m_dt.Rows.Count - 1]["ITEMCODE_VCHR"].ToString().Trim();
                    dr["单价"]   = m_dt.Rows[m_dt.Rows.Count - 1]["ITEMPRICE_MNY"].ToString().Trim();
                    dr["项目名称"] = m_dt.Rows[m_dt.Rows.Count - 1]["ITEMNAME_VCHR"].ToString().Trim();
                    location   = this.m_mthGetIndex(m_dt.Rows[m_dt.Rows.Count - 1]["COPAYID_CHR"].ToString().Trim());
                    if (location > -1)
                    {
                        dr[location + 4] = m_dt.Rows[m_dt.Rows.Count - 1]["PRECENT_DEC"].ToString().Trim();
                    }
                    else
                    {
                        MessageBox.Show("数据不正确!");
                        return;
                    }
                    m_dt.Rows.RemoveAt(m_dt.Rows.Count - 1);
                    obj.m_mthAdd();
                    for (int i = m_dt.Rows.Count - 1; i > -1; i--)
                    {
                        if (strFirtID == m_dt.Rows[i]["ITEMID_CHR"].ToString().Trim())
                        {
                            location = this.m_mthGetIndex(m_dt.Rows[i]["COPAYID_CHR"].ToString().Trim());
                            if (location > -1)
                            {
                                dr[location + 4] = m_dt.Rows[i]["PRECENT_DEC"].ToString().Trim();
                            }
                            else
                            {
                                MessageBox.Show("数据不正确!");
                                return;
                            }
                            m_dt.Rows.RemoveAt(i);
                            obj.m_mthAdd();
                        }
                    }
                    dt.Rows.Add(dr);
                }
                if (obj != null)
                {
                    obj.Close();
                }
            }
            dt.AcceptChanges();
            this.m_objViewer.m_btFind.Enabled = true;
        }
Ejemplo n.º 2
0
        public void m_mthCreatFile()
        {
            if (objArr == null || objArr.Length == 0)
            {
                return;
            }
            SaveFileDialog objDlg = new SaveFileDialog();

            objDlg.Title           = "请选择保存路径";
            objDlg.OverwritePrompt = true;
            objDlg.CheckPathExists = true;
            objDlg.AddExtension    = true;
            objDlg.FileName        = "文件名";
            objDlg.DefaultExt      = "emr";
            objDlg.Filter          = "灏瀚处方文件 (*.emr)|*.emr|所有文件 (*.*)|*.*";
            if (objDlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string[] strPath = objDlg.FileName.Split('\\');
            string   strpath = "";

            for (int p = 0; p < strPath.Length - 1; p++)
            {
                strpath += strPath[p] + "\\";
            }
            dwtProcessBar objProcessBar = new dwtProcessBar("正在生成文件,请稍候...");

            objProcessBar.IsCanCancel = true;
            objProcessBar.m_mthSetMaxValue(objArr.Length);
            try
            {
                objProcessBar.Show();
                for (int i = 0; i < objArr.Length; i++)
                {
                    if (objProcessBar.IsCancel)
                    {
                        break;
                    }
                    clsOutpatientPrintRecipe_VO m_objSetValue = m_mthGetPrintVo(objArr[i].Trim());
                    string path = strpath;
                    path += m_objSetValue.m_strDiagDrName + m_objSetValue.m_strPatientType.Replace("/", "") + m_objSetValue.strInvoiceNO + ".emr";
                    IFormatter objForm   = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    Stream     objStream = new System.IO.FileStream(path, FileMode.Create);
                    objForm.Serialize(objStream, m_objSetValue);
                    objStream.Flush();
                    objStream.Close();
                    objProcessBar.m_mthAdd();
                    Application.DoEvents();
                }
                objProcessBar.Hide();
                MessageBox.Show("文件生成成功\n共生成了" + objProcessBar.GetValue.ToString() + "个文件");
                objProcessBar.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
//				MessageBox.Show("无法保存文件,请检查文件名是否与只读文件重名或磁盘空间不足。");
                objProcessBar.Close();
            }
        }