Exemple #1
0
        private void ComputeCf()
        {
            string[] GroupbyField = { "处方号" };
            string[] ComputeField = { };
            string[] CField       = { };

            DataTable tb = (DataTable)this.myDataGrid1.DataSource;
            DataTable tab;

            DataRow[] selrow = tb.Select("发药='◆' and cjid<>''");
            //DataRow[] selrow=tb.Select("发药='◆' and cjid<>'' and charge_bit='1'");
            DataTable tbsel = tb.Clone();

            for (int w = 0; w <= selrow.Length - 1; w++)
            {
                tbsel.ImportRow(selrow[w]);
            }
            tab = FunBase.GroupbyDataTable(tbsel, GroupbyField, ComputeField, CField, null);
            //this.lblbz.Text = "处方数:" + tab.Rows.Count.ToString() + " 张";

            string[]  GroupbyField1 = { "dept_ly" };
            string[]  ComputeField1 = { };
            string[]  CField1       = { };
            DataTable tbsel1        = tb.Clone();

            for (int w = 0; w <= selrow.Length - 1; w++)
            {
                tbsel1.ImportRow(selrow[w]);
            }
            tab = FunBase.GroupbyDataTable(tbsel1, GroupbyField1, ComputeField1, CField1, null);
            string ss = "";

            for (int i = 0; i <= tab.Rows.Count - 1; i++)
            {
                ss = ss + " " + Yp.SeekDeptName(Convert.ToInt32(tab.Rows[i]["dept_ly"]), InstanceForm.BDatabase);
            }
            //this.lblbz.Text = lblbz.Text + " 科室:" + ss.ToString();
        }
Exemple #2
0
        private void DataPrint(DataRow row)
        {
            if (row == null)
            {
                return;
            }
            //int bk = this.rdodq.Checked == true ? 0 : 1;
            int    fybz   = cbyfyjs.Checked == false ? 0 : 1;
            string sfrq1  = "";
            string sfrq2  = "";
            string fyrq1  = "";
            string fyrq2  = "";
            string brxxid = row["brxxid"].ToString();
            string fph    = row["发票号"].ToString();

            sfrq1 = dateTimePicker1.Value.ToShortDateString();
            sfrq2 = dateTimePicker1.Value.ToShortDateString();
            fyrq1 = "";
            fyrq2 = "";

            //this.cfmxTable = MZYF.SelectMzcfk("Fun_ts_yf_mzfy", InstanceForm.BCurrentDept.DeptId, Guid.Empty, row["姓名"].ToString(),
            //fph, 0, fyrq1, fyrq2, 0, fybz, "", sfrq1, sfrq2, 0, "", "", 0, 0, "", "", "", 0, 0, Guid.Empty, new Guid(brxxid), 0, InstanceForm.BDatabase);
            //if (cfmxTable == null || cfmxTable.Rows.Count == 0)
            //    return;
            //DataTable datalist = this.cfmxTable.Copy();
            DataTable retTable = MZYF.SelectMzcfk("Fun_ts_yf_mzfy", InstanceForm.BCurrentDept.DeptId, Guid.Empty, row["姓名"].ToString(),
                                                  fph, 0, fyrq1, fyrq2, 0, fybz, "", sfrq1, sfrq2, 0, "", "", 0, 0, "", "", "", 0, 0, Guid.Empty, new Guid(brxxid), 0, InstanceForm.BDatabase);

            this.cfmxTable = retTable.Clone();
            DataRow[] retRows = retTable.Select(string.Format(" cfxh = '{0}'", row["处方ID"]));
            if (retRows != null && retRows.Length > 0)
            {
                foreach (DataRow tmp in retRows)
                {
                    this.cfmxTable.Rows.Add(tmp.ItemArray);
                }
            }
            if (this.cfmxTable.Rows.Count == 0)
            {
                MessageBox.Show("未找到处方明细", "提示");
                return;
            }
            DataTable datalist = this.cfmxTable.Copy();

            #region
            //this.AddPresc(dataSouce);
            //YpConfig ypconfig = new YpConfig(InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase);
            ////分组处方
            //DataRow[] selrow;
            //if (ypconfig.门诊发药后才能打印处方 == true)
            //    selrow = tb.Select("( 发药='√') and ypid<>''");
            //else
            //    selrow = tb.Select("(发药='◆' or  发药='√') and ypid<>''");
            //DataTable tbsel = tb.Clone();
            //for (int w = 0; w <= selrow.Length - 1; w++)
            //    tbsel.ImportRow(selrow[w]);
            #endregion
            DataTable tbcf;
            if (cbyfyjs.Checked == false) //如果为未发药就取总金额,已发药则取求和值
            {
                string[] GroupbyField = { "cfxh", "发票号", "总金额", "诊断", "门诊号" };
                string[] ComputeField = { };
                string[] CField       = { };
                tbcf = FunBase.GroupbyDataTable(datalist, GroupbyField, ComputeField, CField, null);
            }
            else
            {
                string[] GroupbyField = { "cfxh", "发票号", "诊断", "门诊号" };
                string[] ComputeField = { "金额" };
                string[] CField       = { "sum" };
                tbcf = FunBase.GroupbyDataTable(datalist, GroupbyField, ComputeField, CField, null);
            }

            //SystemCfg cfg8035 = new SystemCfg(8035);
            //if (cfg8035.Config == "1")
            //{
            //处方
            for (int i = 0; i <= tbcf.Rows.Count - 1; i++)
            {
                TrasenFrame.Forms.UcReportView urv = new UcReportView();
                this.PrintCf(tbcf.Rows[i], 1, urv);
            }
            //}
            //else
            //{
            //    //处方
            //    for (int i = 0; i <= tbcf.Rows.Count - 1; i++)
            //    {
            //        this.PrintCf(tbcf.Rows[i], 1);
            //    }
            //}
        }
Exemple #3
0
        public bool Print(string brkh, int Dept_Id, out string reslutMsg)
        {
            int    fybz  = 0;
            string sfrq1 = "";
            string sfrq2 = "";
            string fyrq1 = "";
            string fyrq2 = "";
            string fph   = "";

            sfrq1 = DateTime.Now.ToShortDateString();
            sfrq2 = DateTime.Now.ToShortDateString();
            fyrq1 = "";
            fyrq2 = "";
            string    sql      = string.Format("select distinct BRXXID from YY_KDJB where KH= '{0}'", brkh);
            DataTable brxxInfo = DB.GetDataTable(sql);

            if (brxxInfo == null || brxxInfo.Rows.Count == 0)
            {
                reslutMsg = "未找到病人信息";
                return(false);
            }
            brxxid = brxxInfo.Rows[0][0].ToString();

            sql = string.Format("select NAME from JC_DEPT_PROPERTY where DEPT_ID = {0}", Dept_Id);
            DataTable deptInfo = DB.GetDataTable(sql);

            if (deptInfo == null || deptInfo.Rows.Count == 0)
            {
                reslutMsg = "未找到科室";
                return(false);
            }
            deptName = deptInfo.Rows[0][0].ToString();

            //this.cfmxTable = MZYF.SelectMzcfk("Fun_ts_yf_mzfy", Dept_Id, Guid.Empty, "", fph, 0, fyrq1, fyrq2, 0, fybz, "", sfrq1, sfrq2, 0, "", "", 0, 0, "", "", "", 0, 0, Guid.Empty, new Guid(brxxid), 0, DB);
            this.cfmxTable = MZYF.PrintMzcfk("Fun_ts_yf_mzfy", Dept_Id, Guid.Empty, "", fph, 0, fyrq1, fyrq2, 0, fybz, "", sfrq1, sfrq2, 0, "", "", 0, 0, "", "", "", 0, 0, Guid.Empty, new Guid(brxxid), 0, DB);

            DataRow[] retRows  = cfmxTable.Select("  byscf = 1");      //只打印电子处方  2014-12-16
            DataTable datalist = this.cfmxTable.Clone();

            if (retRows != null && retRows.Length > 0)
            {
                foreach (DataRow tmpRow in retRows)
                {
                    datalist.ImportRow(tmpRow);
                }
            }
            else
            {
                reslutMsg = "未找到电子处方明细";
                return(false);
            }

            #region
            //this.AddPresc(dataSouce);
            //YpConfig ypconfig = new YpConfig(InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase);
            ////分组处方
            //DataRow[] selrow;
            //if (ypconfig.门诊发药后才能打印处方 == true)
            //    selrow = tb.Select("( 发药='√') and ypid<>''");
            //else
            //    selrow = tb.Select("(发药='◆' or  发药='√') and ypid<>''");
            //DataTable tbsel = tb.Clone();
            //for (int w = 0; w <= selrow.Length - 1; w++)
            //    tbsel.ImportRow(selrow[w]);
            #endregion

            //if (cbyfyjs.Checked == false) //如果为未发药就取总金额,已发药则取求和值
            //{
            string[]  GroupbyField = { "cfxh", "发票号", "总金额", "诊断", "门诊号" };
            string[]  ComputeField = { };
            string[]  CField       = { };
            DataTable tbcf         = FunBase.GroupbyDataTable(datalist, GroupbyField, ComputeField, CField, null);
            //}
            //else
            //{
            //    string[] GroupbyField ={ "cfxh", "发票号", "诊断", "门诊号" };
            //    string[] ComputeField ={ "金额" };
            //    string[] CField ={ "sum" };
            //    tbcf = FunBase.GroupbyDataTable(datalist, GroupbyField, ComputeField, CField, null);
            //}

            //SystemCfg cfg8035 = new SystemCfg(8035);
            //if (cfg8035.Config == "1")
            //{
            //处方

            int number = 0;
            for (int i = 0; i < tbcf.Rows.Count; i++)
            {
                UcReportView urv = new UcReportView();
                urv.db = PrescriptionPrint.DB;
                if (this.PrintCf(tbcf.Rows[i], 1, urv) == false)
                {
                    number++;
                }
            }
            reslutMsg = "";
            if (number == tbcf.Rows.Count)
            {
                return(false);
            }
            else
            {
                return(true);
            }
            //}
            //else
            //{
            //    //处方
            //    for (int i = 0; i <= tbcf.Rows.Count - 1; i++)
            //    {
            //        this.PrintCf(tbcf.Rows[i], 1);
            //    }
            //}
        }
Exemple #4
0
        //汇总药品数量
        private void computeTld(string fyrq)
        {
            bool bGrpByDeptLy = false;

            bGrpByDeptLy = _menuTag.Function_Name.Trim().Equals("Fun_ts_yf_zyfy_cf_ZCY");//中草药上传不按照领药科室分组
            DataTable tb = (DataTable)this.myDataGrid1.DataSource;

            string[] GroupbyField = { "剂型", "品名", "商品名", "规格", "厂家", "单价", "货号", "cjid", "zxdw", "dwbl", "dept_ly" };
            bGrpByDeptLy = true;
            if (bGrpByDeptLy)
            {
                GroupbyField = new string[] { "剂型", "品名", "商品名", "规格", "厂家", "单价", "货号", "cjid", "zxdw", "dwbl" };
            }

            string[] ComputeField = { "ypsl", "金额" };
            string[] CField       = { "sum", "sum" };

            //			TrasenFrame.Classes.TsSet xcset=new TrasenFrame.Classes.TsSet();
            //			xcset.TsDataTable=tb;
            //汇总每个统领分类
            //			DataTable tab=xcset.GroupTable(GroupbyField,ComputeField,CField,"发药='◆' and ypsl<>0");

            DataTable tab;

            DataRow[] selrow;

            if (this.tabControl1.SelectedTab == this.tabPage2)
            {
                selrow = tb.Select("ypsl<>0");
                //selrow = tb.Select("发药='√' and ypsl<>0");
            }
            else
            {
                //if (fyrq != "")
                //    selrow = tb.Select("发药='√' and ypsl<>0 and 发药日期='" + Convertor.IsNull(butfy.Tag, "") + "'");
                //else
                selrow = tb.Select("发药='◆' and ypsl<>0");
            }

            DataTable tbsel = tb.Clone();

            for (int w = 0; w <= selrow.Length - 1; w++)
            {
                tbsel.ImportRow(selrow[w]);
            }
            tab = FunBase.GroupbyDataTable(tbsel, GroupbyField, ComputeField, CField, null);

            DataTable mytb = (DataTable)this.myDataGrid2.DataSource;

            mytb.Rows.Clear();

            DataRow[] Rows = tab.Select("", "剂型");
            decimal   dSum = 0M;

            //添加数据
            for (int x = 0; x <= Rows.Length - 1; x++)
            {
                DataRow row = mytb.NewRow();
                row["序号"]  = mytb.Rows.Count + 1;
                row["剂型"]  = Rows[x]["剂型"];
                row["品名"]  = Rows[x]["品名"];
                row["商品名"] = Rows[x]["商品名"];
                row["规格"]  = Rows[x]["规格"];
                row["厂家"]  = Rows[x]["厂家"];
                row["单价"]  = Rows[x]["单价"];
                //row["库存数"] = Rows[x]["库存数"];
                row["领药数"] = Rows[x]["ypsl"];
                //decimal kcl = Convert.ToDecimal(Rows[x]["库存数"]);
                decimal ypsl = Convert.ToDecimal(Rows[x]["ypsl"]);
                decimal dwbl = Convert.ToDecimal(Rows[x]["dwbl"]);
                //row["缺药数"] = (kcl - ypsl) < 0 ? System.Math.Abs(kcl - ypsl) : 0;
                row["单位"] = Yp.SeekYpdw(Convert.ToInt32(Rows[x]["zxdw"]), InstanceForm.BDatabase);
                Ypcj cj = new Ypcj(Convert.ToInt32(Rows[x]["cjid"]), InstanceForm.BDatabase);
                row["药库单位"] = Convert.ToDouble(Math.Round(ypsl / dwbl, 3)).ToString() + cj.S_YPDW;
                row["金额"]   = Rows[x]["金额"];
                row["货号"]   = Rows[x]["货号"];
                row["cjid"] = Rows[x]["cjid"];
                row["dwbl"] = Rows[x]["dwbl"];
                if (!bGrpByDeptLy)
                {
                    row["领药科室"] = Yp.SeekDeptName(Convert.ToInt32(Rows[x]["dept_ly"]), InstanceForm.BDatabase);
                }
                mytb.Rows.Add(row);
                dSum += decimal.Parse(Rows[x]["金额"].ToString().Trim());
            }

            DataRow rAll = mytb.NewRow();

            rAll["品名"] = "总金额";
            rAll["金额"] = dSum;
            mytb.Rows.Add(rAll);
        }