private void rdolog_CheckedChanged(object sender, System.EventArgs e) { if (this.rdolog.Checked == true) { FunBase.CsDataGrid(this.myDataGrid1, this.myDataGrid1.TableStyles[0], "Tb"); this.dtpdjsj1.Visible = true; this.dtpdjsj2.Visible = true; this.label1.Visible = true; this.label2.Visible = true; this.butsave.Visible = false; } else { FunBase.CsDataGrid(this.myDataGrid1, this.myDataGrid1.TableStyles[1], "Tb2"); this.dtpdjsj1.Visible = false; this.dtpdjsj2.Visible = false; this.label1.Visible = false; this.label2.Visible = false; this.butsave.Visible = true; } }
private void fpgsymaster_detail(string YKYFFlag, string YPLXFlag, string strFromTime, string StrToTime) { try { // 1 药房 2 药库 string ssql = string.Empty; if (YKYFFlag == "1") { ssql = @" select A.ypmc AS YPNAME,SUM(CONVERT(float, ypkcl)) AS YPSL,A.ypdw AS YPDW, SUM(Tpfzje) AS PFJZJE, (select dbo.fun_getDeptname(A.Deptid)) AS DEPTNAME, (select GHDWMC from YP_GHDW where BDELETE=0 and id=C.gysid) AS GYSNAME from yk_tjgysmx as A left join YP_YPCJD as B on A.ypid=B.CJID left join yk_tjgyszb AS C on A.zbId=C.Id left join YP_YJKS AS D on A.Deptid=D.DEPTID where D.KSLX='药房' and B.N_YPLX='" + YPLXFlag + "' and C.tjsj>='" + strFromTime + "' and C.tjsj<'" + StrToTime + "' group by A.ypmc,A.ypdw,A.Deptid,C.gysid "; } if (YKYFFlag == "2") { ssql = @"select A.ypmc AS YPNAME,SUM(CONVERT(float, ypkcl)) AS YPSL,A.ypdw AS YPDW, SUM(Tpfzje) AS PFJZJE, (select dbo.fun_getDeptname(A.Deptid)) AS DEPTNAME, (select GHDWMC from YP_GHDW where BDELETE=0 and id=C.gysid) AS GYSNAME from yk_tjgysmx as A left join YP_YPCJD as B on A.ypid=B.CJID left join yk_tjgyszb AS C on A.zbId=C.Id left join YP_YJKS AS D on A.Deptid=D.DEPTID where D.KSLX='药库' and B.N_YPLX='" + YPLXFlag + "' and C.tjsj>='" + strFromTime + "' and C.tjsj<'" + StrToTime + "' group by A.ypmc,A.ypdw,A.Deptid,C.gysid "; } DataTable tbmx = InstanceForm.BDatabase.GetDataTable(ssql); this.GrdiDetail.AutoGenerateColumns = false; FunBase.AddRowtNo(tbmx); tbmx.TableName = "tbmx"; this.GrdiDetail.DataSource = tbmx; //this.GrdiDetail.TableStyles[0].MappingName = "tbmx"; } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message); } }
/// <summary> /// 应用程序的主入口点。 /// </summary> private void Frmxspm_Load(object sender, System.EventArgs e) { try { dtp1.Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase); dtp2.Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase); //初始化 FunBase.CsDataGrid(this.myDataGrid1, this.myDataGrid1.TableStyles[0], "Tb"); this.rdo1.Checked = true; Yp.AddCmbYjks(false, InstanceForm.BCurrentDept.DeptId, cmbyjks, InstanceForm.BDatabase); Yp.AddcmbYear(Convert.ToInt32(cmbyjks.SelectedValue), cmbyear, InstanceForm.BDatabase); Yp.AddCmbLyks(Convert.ToInt32(cmbyjks.SelectedValue), cmblyks, true, InstanceForm.BDatabase); cmblyks.Text = "全部"; } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message); } }
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(); }
/// <summary> /// /// </summary> /// <param name="YKYFFlag"></param> /// <param name="strFromTime"></param> /// <param name="StrToTime"></param> private void fpgsymaster(string YKYFFlag, string strFromTime, string StrToTime) { try { // 1 药房 2 药库 string ssql = string.Empty; if (YKYFFlag == "1") { ssql = @"select (CASE B.N_YPLX WHEN '1' THEN '西药' WHEN '2' THEN '中成药' WHEN '3' THEN '中草药' WHEN '5' THEN '其它' END) AS YPLXNAME, B.N_YPLX AS YPLX, SUM(Tpfzje) as pfjzje,'药房' AS DeptName from yk_tjgysmx as A left join YP_YPCJD as B on A.ypid=B.CJID left join yk_tjgyszb AS C on A.zbId=C.Id left join YP_YJKS AS D on A.Deptid=D.DEPTID where D.KSLX='药房' and C.tjsj>='" + strFromTime + "' and C.tjsj<'" + StrToTime + "' group by B.N_YPLX "; } if (YKYFFlag == "2") { ssql = @"select (CASE B.N_YPLX WHEN '1' THEN '西药' WHEN '2' THEN '中成药' WHEN '3' THEN '中草药' WHEN '5' THEN '其它' END) AS YPLXNAME, B.N_YPLX AS YPLX, SUM(Tpfzje) as pfjzje,'药库' AS DeptName from yk_tjgysmx as A left join YP_YPCJD as B on A.ypid=B.CJID left join yk_tjgyszb AS C on A.zbId=C.Id left join YP_YJKS AS D on A.Deptid=D.DEPTID where D.KSLX='药库' and C.tjsj>='" + strFromTime + "' and C.tjsj<'" + StrToTime + "' group by B.N_YPLX "; } DataTable tbmx = InstanceForm.BDatabase.GetDataTable(ssql); this.dg_whmx.AutoGenerateColumns = false; FunBase.AddRowtNo(tbmx); tbmx.TableName = "tbmx"; this.dg_whmx.DataSource = tbmx; //this.GrdiDetail.TableStyles[0].MappingName = "tbmx"; } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message); } }
private void buttj_Click(object sender, System.EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); this.buttj.Enabled = false; ParameterEx[] parameters = new ParameterEx[6]; parameters[0].Value = Convert.ToInt32(cmbyjks.SelectedValue); parameters[1].Value = dtp1.Value.ToShortDateString() + " 00:00:00"; parameters[2].Value = dtp2.Value.ToShortDateString() + " 23:59:59"; parameters[3].Value = Convert.ToInt32(cmbyplx.SelectedValue); parameters[4].Value = cmbypsx.SelectedIndex; parameters[0].Text = "@deptid"; parameters[1].Text = "@rq1"; parameters[2].Text = "@rq2"; parameters[3].Text = "@yplx"; parameters[4].Text = "@type"; parameters[5].Text = "@deptid_ck"; parameters[5].Value = Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0")); DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YK_TJ_GZYPTJ", parameters, 30); FunBase.AddRowtNo(tb); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.buttj.Enabled = true; } catch (System.Exception err) { this.buttj.Enabled = true; MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
private void AddData(string ss) { DataTable myTb = new DataTable(); string ssql = ""; if (ss.Trim() == "") { ssql = "select 0 序号,mc 名称,pym 拼音码,wbm 五笔码,id from yp_zbzt"; } else { ssql = "select 0 序号,mc 名称,pym 拼音码,wbm 五笔码,id from yp_zbzt where pym like '" + txtdm.Text.Trim() + "%' or wbm like '" + txtdm.Text.Trim() + "%' or mc like '%" + txtdm.Text.Trim() + "%' "; } myTb = InstanceForm.BDatabase.GetDataTable(ssql); FunBase.AddRowtNo(myTb); myTb.TableName = "Tb"; this.myDataGrid1.DataSource = myTb; this.myDataGrid1.TableStyles[0].MappingName = "Tb"; DataRow row = myTb.NewRow(); row["序号"] = myTb.Rows.Count + 1; myTb.Rows.Add(row); }
private void Frmkccx_Load(object sender, System.EventArgs e) { this.dtp1.Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase); this.dtp2.Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase); FunBase.CsDataGrid(this.myDataGrid1, this.myDataGrid1.TableStyles[0], "Tb"); //Yp.AddcmbYear(InstanceForm.BCurrentDept.DeptId, this.cmbypzlx, InstanceForm.BDatabase); this.rdo1.Checked = true; // Yp.AddCmbYplx(true,InstanceForm.BCurrentDept.DeptId,this.cmbyplx,InstanceForm.BDatabase); Yp.AddcmbYjks(true, cmbyjks, DeptType.药房, InstanceForm.BDatabase, InstanceForm._menuTag.Jgbm); if (YpConfig.kslx(InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase) != DeptType.未知) { cmbyjks.SelectedValue = InstanceForm.BCurrentDept.DeptId; cmbyjks.Enabled = false; } Yp.AddcmbYear(Convert.ToInt32(cmbyjks.SelectedValue), cmbyear, InstanceForm.BDatabase); s = new YpConfig(Convert.ToInt32(cmbyjks.SelectedValue), InstanceForm.BDatabase); }
private void butref_Click(object sender, System.EventArgs e) { try { string ssql = ""; int yplx = Convert.ToInt32(cmbyplx.SelectedValue); if (this.rdo1.Checked == true) { ssql = "select 0 序号,yppm 品名,ypgg 规格,dbo.fun_yp_sccj(sccj) 厂家,pfj 批发价,lsj 零售价," + " cast(kcxx*(dwbl/ydwbl) as decimal(10,3)) 下限,kcl 库存量," + "((cast(kcxx*(dwbl/ydwbl) as decimal(10,3)))-kcl) 低于下限,dbo.fun_yp_ypdw(zxdw) 单位,shh 货号,a.cjid " + " from yp_kcsxx a,YF_kcmx b ,vi_yp_ypcd c" + " where a.cjid=b.cjid and a.deptid=b.deptid and b.cjid=c.cjid and b.deptid=" + Convert.ToInt32(cmbyjks.SelectedValue) + " and b.bdelete=0 and ((cast(kcxx*(dwbl/ydwbl) as decimal(10,3)))-kcl)> 0"; } else { ssql = "select 0 序号,yppm 品名,ypgg 规格,dbo.fun_yp_sccj(sccj) 厂家,pfj 批发价,lsj 零售价," + " cast(kcsx*(dwbl/ydwbl) as decimal(10,3)) 上限,kcl 库存量," + "(kcl-(cast(kcsx*(dwbl/ydwbl) as decimal(10,3)))) 高于上限,dbo.fun_yp_ypdw(zxdw) 单位,shh 货号,a.cjid " + " from yp_kcsxx a,YF_kcmx b ,vi_yp_ypcd c" + " where a.cjid=b.cjid and a.deptid=b.deptid and b.cjid=c.cjid and b.deptid=" + Convert.ToInt32(cmbyjks.SelectedValue) + " and b.bdelete=0 and (kcl-(cast(kcsx*(dwbl/ydwbl) as decimal(10,3))))>0 "; } if (yplx > 0) { ssql = ssql + " and yplx=" + yplx + ""; } DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql); FunBase.AddRowtNo(tb); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message); } }
private void SelectCf(string hzxm, long fph, string date1, string date2, int deptid) { string ssql = "select '0' 序号,a.fph 发票号,hzxm 姓名,patientno 门诊号," + "yppm 品名,ypgg 规格,ypcj 厂家,lsj 单价,ypsl 数量,ypdw 单位,lsje 金额,fyrq 退药日期,dbo.fun_getempname(fyr) 退药人," + "dbo.fun_getdeptname(ksdm) 科室,dbo.fun_getempname(ysdm) 医生,ydwbl,yphh 货号,dbo.fun_getdeptname(a.deptid) 退药药房,a.TYYY as 退药原因 " + "from vi_yf_fy a,vi_yf_fymx b where a.id=b.fyid " + "and jzcfbz=0 and zje<0 "; if (hzxm.Trim() != "") { ssql = ssql + " and a.hzxm like '%" + hzxm + "%'"; } if (fph != 0) { ssql = ssql + " and a.fph=" + fph + ""; } if (date1.Trim() != "") { ssql = ssql + " and fyrq>='" + date1 + " 00:00:00' and fyrq<='" + date2 + " 23:59:59'"; } if (deptid > 0) { ssql = ssql + " and a.deptid=" + deptid + ""; } ssql = ssql + " order by a.fyrq,a.fph"; DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql); tb.TableName = "Tb"; FunBase.AddRowtNo(tb); decimal je = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(金额)", ""), "0")); DataRow row = tb.NewRow(); row["序号"] = "小计"; row["金额"] = je.ToString(); tb.Rows.Add(row); this.myDataGrid1.DataSource = tb; }
private void butref_Click(object sender, System.EventArgs e) { try { string ssql = "select 0 序号,dbo.fun_getdeptname(deptid) 仓库名称,jhcgrq 计划采购日期,djh 单据号,djsj 登记时间,dbo.fun_getempname(djy) 登记员," + " shrq as 审核时间,dbo.fun_getempname(SHy) 审核员,bz 备注,id from yf_cg " + " where djsj>='" + dtp1.Value.ToShortDateString() + " 00:00:00' and djsj<='" + dtp2.Value.ToShortDateString() + " 23:59:59' "; if (this.rdo1.Checked == true) { ssql = ssql + " and shbz=0 "; } else { ssql = ssql + " and shbz=1 "; } if (Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0")) > 0) { ssql = ssql + "and deptid=" + Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0")) + ""; } else { ssql = ssql + " and deptid in( select deptid from yp_yjks_gx where p_deptid=" + InstanceForm.BCurrentDept.DeptId + " )"; } DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql); FunBase.AddRowtNo(tb); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; FunBase.myGridSelect(this.myDataGrid1, this.myDataGrid1.TableStyles[0].GridColumnStyles); } catch (System.Exception err) { MessageBox.Show(err.Message); } }
private void AddData(string ss) { DataTable myTb = new DataTable(); string ssql = ""; if (ss.Trim() == "") { ssql = "select 0 序号,mc 名称,ywm 英文名,pym 拼音码,wbm 五笔码,(select name from yp_tlfl where code=tlfl) 统领分类,tlfl,(select jxmc from yp_ypjxdl where jxbm=jxdl) 剂型大类,jxdl,id from yp_ypjx"; } else { ssql = "select 0 序号,mc 名称,ywm 英文名,pym 拼音码,wbm 五笔码,(select name from yp_tlfl where code=tlfl) 统领分类,tlfl,(select jxmc from yp_ypjxdl where jxbm=jxdl) 剂型大类,jxdl,id from yp_ypjx where pym like '" + txtdm.Text.Trim() + "%' or wbm like '" + txtdm.Text.Trim() + "%' or mc like '%" + txtdm.Text.Trim() + "%' "; } myTb = InstanceForm.BDatabase.GetDataTable(ssql); FunBase.AddRowtNo(myTb); myTb.TableName = "Tb"; this.myDataGrid1.DataSource = myTb; this.myDataGrid1.TableStyles[0].MappingName = "Tb"; DataRow row = myTb.NewRow(); row["序号"] = myTb.Rows.Count + 1; myTb.Rows.Add(row); myTb.AcceptChanges(); }
private void butcx_Click(object sender, System.EventArgs e) { try { string ssql = "select kslx from yp_yjks where deptid=" + _DeptID + ""; DataTable tab = InstanceForm.BDatabase.GetDataTable(ssql); if (tab.Rows.Count == 0) { return; } string procname = "SP_Yk_TJ_PJRXSLTJ"; if (tab.Rows[0]["kslx"].ToString().Trim() == "药房") { procname = "SP_YF_TJ_PJRXSLTJ"; } ParameterEx[] parameters = new ParameterEx[4]; parameters[0].Value = this.dtp1.Value.ToShortDateString(); parameters[1].Value = this.dtp2.Value.ToShortDateString(); parameters[2].Value = Convert.ToInt32(cmbyplx.SelectedValue); parameters[3].Value = _DeptID; parameters[0].Text = "@dtp1"; parameters[1].Text = "@dtp2"; parameters[2].Text = "@yplx"; parameters[3].Text = "@deptid"; DataTable tb = InstanceForm.BDatabase.GetDataTable(procname, parameters, 30); FunBase.AddRowtNo(tb); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; } catch (System.Exception err) { MessageBox.Show(err.ToString()); } }
/// <summary> /// 应用程序的主入口点。 /// </summary> private void Frmxspm_Load(object sender, System.EventArgs e) { try { dtp1.Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase); dtp2.Value = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase); //初始化 FunBase.CsDataGrid(this.myDataGrid1, this.myDataGrid1.TableStyles[0], "Tb"); Yp.AddcmbYjks(cmbyjks, DeptType.药房, InstanceForm.BDatabase, InstanceForm._menuTag.Jgbm); if (YpConfig.kslx(InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase) != DeptType.未知) { cmbyjks.SelectedValue = InstanceForm.BCurrentDept.DeptId; cmbyjks.Enabled = false; } } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message); } }
private void btnRefresh_Click(object sender, EventArgs e) { try { ParameterEx[] parameters = new ParameterEx[12]; parameters[0].Value = 0; parameters[1].Value = InstanceForm.BCurrentDept.WardId.Trim(); parameters[2].Value = rdorq1.Checked == true?"": this.dateTimePicker1.Value.ToShortDateString() + " 00:00:01"; parameters[3].Value = rdorq1.Checked == true ? "" : this.dateTimePicker2.Value.ToShortDateString() + " 23:59:59"; int bprint = 8; if (rdowdy.Checked == true) { bprint = 3; } if (rdoydy.Checked == true) { bprint = 4; } parameters[4].Value = bprint; parameters[5].Value = txtzyh.Text.Trim(); parameters[6].Value = txtcwh.Text.Trim(); parameters[7].Value = txtname.Text.Trim(); parameters[8].Value = txttxm.Text.Trim(); parameters[9].Value = rdorq1.Checked == false ? "" : this.dateTimePicker1.Value.ToShortDateString() + " 00:00:01"; parameters[10].Value = rdorq1.Checked == false ? "" : this.dateTimePicker2.Value.ToShortDateString() + " 23:59:59"; parameters[11].Value = InstanceForm.BCurrentDept.DeptId; parameters[0].Text = "@lx"; parameters[1].Text = "@wardid"; parameters[2].Text = "@sqrq1"; parameters[3].Text = "@sqrq2"; parameters[4].Text = "@dybz"; parameters[5].Text = "@zyh"; parameters[6].Text = "@cwh"; parameters[7].Text = "@name"; parameters[8].Text = "@txm"; parameters[9].Text = "@qrrq1"; parameters[10].Text = "@qrrq2"; parameters[11].Text = "@zxks"; DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_zyhs_getjchy", parameters, 30); FunBase.AddRowtNo(tb); tb.TableName = "Tb"; //if (rdorq2.Checked == true) //{ // for (int i = 0; i <= tb.Rows.Count - 1; i++) // tb.Rows[i]["选择"] = (short)1; //} this.myDataGrid1.DataSource = tb; FunBase.myGridSelect(this.myDataGrid1, this.myDataGrid1.TableStyles[0].GridColumnStyles); //if (rdowdy.Checked == true && tb.Rows.Count != 0) //{ // if (MessageBox.Show("您要确认该费用吗?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) // { // this.btnfyqr_Click(sender, e); // txttxm.Focus(); // txttxm.SelectAll(); // } //} } catch (System.Exception err) { MessageBox.Show(err.ToString()); } }
private void frmjyd_Load(object sender, EventArgs e) { //初始化 FunBase.CsDataGrid(this.myDataGrid1, this.myDataGrid1.TableStyles[0], "Tb"); }
private void butcx_Click(object sender, System.EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); ParameterEx[] parameters = new ParameterEx[6]; parameters[0].Value = Convert.ToInt32(cmbyjks.SelectedValue); parameters[1].Value = dtp1.Value.ToShortDateString() + " 00:00:00"; parameters[2].Value = dtp2.Value.ToShortDateString() + " 23:59:59"; parameters[3].Value = 0; //Convert.ToInt32(cmbyplx.SelectedValue); parameters[0].Text = "@deptid"; parameters[1].Text = "@rq1"; parameters[2].Text = "@rq2"; parameters[3].Text = "@yplx"; parameters[4].Text = "@year"; parameters[5].Text = "@month"; if (rdo1.Checked == true) { parameters[4].Value = 0; parameters[5].Value = 0; } else { parameters[4].Value = Convert.ToInt32(cmbyear.Text); parameters[5].Value = Convert.ToInt32(cmbmonth.Text); } DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_Yf_TJ_TJHZ", parameters, 30); FunBase.AddRowtNo(tb); object je = tb.Compute("sum(调零售金额)", ""); decimal sumtlsje = Convert.ToDecimal(Convertor.IsNull(je, "0")); object je1 = tb.Compute("sum(调零售金额)", "调零售金额>0"); decimal sumtyje = Convert.ToDecimal(Convertor.IsNull(je1, "0")); object je2 = tb.Compute("sum(调零售金额)", "调零售金额<0"); decimal sumtkje = Convert.ToDecimal(Convertor.IsNull(je2, "0")); DataRow newrow = tb.NewRow(); newrow["序号"] = "合计"; newrow["调零售金额"] = sumtlsje.ToString("0.00"); tb.Rows.Add(newrow); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.statusBar1.Panels[0].Text = "调零售金额合计:" + sumtlsje.ToString("0.00"); this.statusBar1.Panels[1].Text = "调盈金额:" + sumtyje.ToString("0.00"); this.statusBar1.Panels[2].Text = "调亏金额:" + sumtkje.ToString("0.00"); } catch (System.Exception err) { MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
private void buttj_Click(object sender, EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); this.buttj.Enabled = false; ParameterEx[] parameters = new ParameterEx[7]; parameters[0].Value = Convert.ToInt32(cmbyjks.SelectedValue); parameters[1].Value = dtp1.Value.ToShortDateString() + " 00:00:00"; parameters[2].Value = dtp2.Value.ToShortDateString() + " 23:59:59"; parameters[3].Value = 0;//Convert.ToInt32(cmbyplx.SelectedValue); parameters[0].Text = "@deptid"; parameters[1].Text = "@rq1"; parameters[2].Text = "@rq2"; parameters[3].Text = "@yplx"; parameters[4].Text = "@year"; parameters[5].Text = "@month"; parameters[6].Text = "@deptid_ck"; parameters[6].Value = Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0")); if (rdo1.Checked == true)//按日期 { parameters[4].Value = 0; parameters[5].Value = 0; } else//按月份 { parameters[4].Value = Convert.ToInt32(cmbyear.Text); parameters[5].Value = Convert.ToInt32(cmbmonth.Text); } DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YK_TJ_RKHZ_JY", parameters, 30); FunBase.AddRowtNo(tb); decimal sumypsl = 0; //数量 decimal sumpfje = 0; //批发金额 decimal sumlsje = 0; //零售金额 for (int i = 0; i <= tb.Rows.Count - 1; i++) { sumypsl = sumypsl + Convert.ToDecimal(tb.Rows[i]["数量"]); sumpfje = sumpfje + Convert.ToDecimal(tb.Rows[i]["批发金额"]); sumlsje = sumlsje + Convert.ToDecimal(tb.Rows[i]["零售金额"]); } DataRow newrow = tb.NewRow(); newrow["数量"] = sumypsl.ToString("0.00"); newrow["批发金额"] = sumpfje.ToString("0.00"); newrow["零售金额"] = sumlsje.ToString("0.00"); newrow["批发价"] = ""; newrow["零售价"] = ""; newrow["货号"] = ""; newrow["品名"] = ""; newrow["规格"] = ""; newrow["厂家"] = ""; newrow["送货单位"] = ""; newrow["序号"] = "合计"; tb.Rows.Add(newrow); this.statusBar1.Panels[0].Text = "数量:" + sumypsl.ToString("0.00"); this.statusBar1.Panels[1].Text = "批发金额:" + sumpfje.ToString("0.00"); this.statusBar1.Panels[2].Text = "零售金额:" + sumlsje.ToString("0.00"); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.buttj.Enabled = true; } catch (System.Exception err) { this.buttj.Enabled = true; MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
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); // } //} }
public void AddData(string ss, myDataGrid.myDataGrid mydataGrid) { DataTable myTb = new DataTable(); string ssql = ""; ssql = "select kslx from yp_yjks where deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ""; DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql); if (tb.Rows.Count == 0) { MessageBox.Show("设置库存上下限时,请以药房药库身份登陆", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } string tablename = ""; string kslx = ""; if (tb.Rows.Count > 0) { kslx = tb.Rows[0]["kslx"].ToString().Trim(); } if (kslx == "药房") { tablename = "yf_kcmx"; } else { tablename = "yk_kcmx"; } if (chkall.Checked == false) { ssql = "select 0 序号,yppm 品名,ypgg 规格,s_sccj 厂家,pfj 批发价,lsj 零售价,cast(kcl/dwbl as float) 库存量," + " dbo.fun_yp_ypdw(ypdw) 单位,(case when kcsx=0 then null else kcsx end) 上限,(case when kcxx=0 then null else kcxx end) 下限,shh 货号,a.cjid,c.id kcsxxid,ypdw nypdw,1 dwbl " + " from " + tablename.Trim() + " a inner join vi_yp_ypcd b on a.cjid=b.cjid and a.bdelete=0 and a.deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + " left join (select * from yp_kcsxx where deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ") c on b.cjid=c.cjid " + "where a.deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ""; if (ss.Trim() != "") { ssql = ssql + " and A.ggid in(select ggid from yp_ypbm where upper(pym) like '" + ss.Trim().ToUpper() + "%' or ypbm like '%" + ss.Trim() + "%')"; } } else { //if (tb.Rows[0]["kslx"].ToString().Trim()=="药房") tablename="yf_kcmx";else tablename="yk_kcmx"; ssql = "select 0 序号,yppm 品名,ypgg 规格,s_sccj 厂家,pfj 批发价,lsj 零售价,cast(kcl/dwbl as float) 库存量," + " dbo.fun_yp_ypdw(ypdw) 单位,(case when kcsx=0 then null else kcsx end) 上限,(case when kcxx=0 then null else kcxx end) 下限,shh 货号,a.cjid,c.id kcsxxid,ypdw nypdw,1 dwbl " + " from " + tablename.Trim() + " a inner join vi_yp_ypcd b on a.cjid=b.cjid and a.bdelete=0 and a.deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + " left join (select * from yp_kcsxx where deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ") c on b.cjid=c.cjid " + " where a.ggid>0 "; if (ss.Trim() != "") { ssql = ssql + " and A.ggid in(select ggid from yp_ypbm where upper(pym) like '" + ss.Trim().ToUpper() + "%' or ypbm like '%" + ss.Trim() + "%')"; } ssql = ssql + " union all select 0 序号,yppm 品名,ypgg 规格,s_sccj 厂家,pfj 批发价,lsj 零售价,0 库存量," + " dbo.fun_yp_ypdw(ypdw) 单位,(case when kcsx=0 then null else kcsx end) 上限,(case when kcxx=0 then null else kcxx end) 下限,shh 货号,a.cjid,coalesce(B.id,0) kcsxxid,ypdw nypdw,1 dwbl " + " from vi_yp_ypcd a left join (select * from yp_kcsxx where deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ") b on a.cjid=b.cjid " + "where a.ypzlx in(select ypzlx from yp_gllx where deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ") and a.cjid not in(select cjid from " + tablename.Trim() + " where deptid=" + Convert.ToInt32(Convertor.IsNull(cmbyjks.SelectedValue, "0")) + ") "; if (ss.Trim() != "") { ssql = ssql + " and A.ggid in(select ggid from yp_ypbm where upper(pym) like '" + ss.Trim().ToUpper() + "%' or ypbm like '%" + ss.Trim() + "%')"; } } myTb = InstanceForm.BDatabase.GetDataTable(ssql); FunBase.AddRowtNo(myTb); myTb.TableName = "Tb"; mydataGrid.DataSource = myTb; mydataGrid.TableStyles[0].MappingName = "Tb"; }
private void button1_Click(object sender, EventArgs e) { DateTime date1 = DateTime.Parse(this.dateTimePicker1.Value.ToShortDateString() + " 00:00:00"); DateTime date2 = DateTime.Parse(this.dateTimePicker2.Value.AddDays(1).ToShortDateString() + " 00:00:00"); if (暂存药品上传 == wizard1.SelectedPage) { DataTable tmpable; DataTable Yptable = null; DataTable tbyf = (DataTable)this.cmbZxyf.DataSource; if (this.cmbZxyf.SelectedValue.ToString() == "-1") { for (int i = 1; i < tbyf.Rows.Count; i++) { tmpable = ZcyBill.ZYHS_YPFY_SELECT(9, 0, InstanceForm.BCurrentDept.WardDeptId == 0 ? InstanceForm.BCurrentDept.DeptId : InstanceForm.BCurrentDept.WardDeptId, InstanceForm.BCurrentDept.WardId, Guid.Empty, 0, Convert.ToInt32(tbyf.Rows[i]["DEPTID"].ToString()) , date1, date2); if (Yptable == null) { Yptable = tmpable.Clone(); } for (int j = 0; j < tmpable.Rows.Count; j++) { Yptable.ImportRow(tmpable.Rows[j]); } tmpable = ZcyBill.ZYHS_YPFY_SELECT(9, 1, InstanceForm.BCurrentDept.WardDeptId == 0 ? InstanceForm.BCurrentDept.DeptId : InstanceForm.BCurrentDept.WardDeptId, InstanceForm.BCurrentDept.WardId, Guid.Empty, 0, Convert.ToInt32(tbyf.Rows[i]["DEPTID"].ToString()) , date1, date2); for (int j = 0; j < tmpable.Rows.Count; j++) { Yptable.ImportRow(tmpable.Rows[j]); } } } else { tmpable = ZcyBill.ZYHS_YPFY_SELECT(9, 0, InstanceForm.BCurrentDept.WardDeptId == 0 ? InstanceForm.BCurrentDept.DeptId : InstanceForm.BCurrentDept.WardDeptId, InstanceForm.BCurrentDept.WardId, Guid.Empty, 0, Convert.ToInt32(this.cmbZxyf.SelectedValue.ToString()) , date1, date2); if (Yptable == null) { Yptable = tmpable.Clone(); } for (int j = 0; j < tmpable.Rows.Count; j++) { Yptable.ImportRow(tmpable.Rows[j]); } tmpable = ZcyBill.ZYHS_YPFY_SELECT(9, 1, InstanceForm.BCurrentDept.WardDeptId == 0 ? InstanceForm.BCurrentDept.DeptId : InstanceForm.BCurrentDept.WardDeptId, InstanceForm.BCurrentDept.WardId, Guid.Empty, 0, Convert.ToInt32(this.cmbZxyf.SelectedValue.ToString()) , date1, date2); for (int j = 0; j < tmpable.Rows.Count; j++) { Yptable.ImportRow(tmpable.Rows[j]); } } FunBase.AddRowtNo(Yptable); this.dataGridView1.DataSource = Yptable; for (int j = 14; j < this.dataGridView1.Columns.Count; j++) { this.dataGridView1.Columns[j].SortMode = DataGridViewColumnSortMode.NotSortable; if (j >= 14) { this.dataGridView1.Columns[j].Visible = false; } else { this.dataGridView1.Columns[j].SortMode = DataGridViewColumnSortMode.NotSortable; } } this.dataGridView1.Columns["数量"].DefaultCellStyle.BackColor = Color.WhiteSmoke; this.dataGridView1.Columns["数量"].DefaultCellStyle.ForeColor = Color.Blue; this.dataGridView1.ReadOnly = true; //增加一行合计 DataRow r = Yptable.NewRow(); decimal hjje = 0; for (int i = 0; i < Yptable.Rows.Count; i++) { hjje += decimal.Parse(Yptable.Rows[i]["金额"].ToString()); } r["类型"] = "合计"; r["金额"] = hjje; Yptable.Rows.Add(r); this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Yellow; this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].DefaultCellStyle.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Blue; this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].ReadOnly = true; } else { int ls = 9990; this.dataGridView2.DataSource = ZcyBill.Getzcysjjl(date1, date2, InstanceForm.BCurrentDept.WardDeptId == 0 ? InstanceForm.BCurrentDept.DeptId : InstanceForm.BCurrentDept.WardDeptId); for (int j = 0; j < this.dataGridView2.Columns.Count; j++) { this.dataGridView2.Columns[j].SortMode = DataGridViewColumnSortMode.NotSortable; if (this.dataGridView2.Columns[j].Name.Trim() == "cjid") { ls = j; } if (j >= ls) { this.dataGridView2.Columns[j].Visible = false; } } } }
private void buttj_Click(object sender, System.EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); this.buttj.Enabled = false; ParameterEx[] parameters = new ParameterEx[8]; parameters[0].Value = Convert.ToInt32(cmbyjks.SelectedValue); parameters[1].Value = dtp1.Value.ToShortDateString() + " 00:00:00"; parameters[2].Value = dtp2.Value.ToShortDateString() + " 23:59:59"; parameters[3].Value = 0; //Convert.ToInt32(cmbyplx.SelectedValue); if (_menuTag.Function_Name.Trim() == "Fun_ts_yk_tjbb_bshz") { parameters[6].Value = "006"; } else { parameters[6].Value = "007"; } parameters[7].Value = Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0")); parameters[0].Text = "@deptid"; parameters[1].Text = "@rq1"; parameters[2].Text = "@rq2"; parameters[3].Text = "@yplx"; parameters[4].Text = "@year"; parameters[5].Text = "@month"; parameters[6].Text = "@ywlx"; parameters[7].Text = "@deptid_ck"; if (rdo1.Checked == true) { parameters[4].Value = 0; parameters[5].Value = 0; } else { parameters[4].Value = Convert.ToInt32(cmbyear.Text); parameters[5].Value = Convert.ToInt32(cmbmonth.Text); } DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YK_TJ_BSBYHZ", parameters, 30); FunBase.AddRowtNo(tb); decimal sumje = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(零售金额)", ""), "0")); decimal sumjhje = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(进货金额)", ""), "0")); decimal sumjlce = sumje - sumjhje; DataRow newrow = tb.NewRow(); newrow["序号"] = "合计"; newrow["零售金额"] = sumje.ToString("0.00"); newrow["进货金额"] = sumjhje.ToString("0.00"); tb.Rows.Add(newrow); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.buttj.Enabled = true; this.statusBar1.Panels[0].Text = "进货金额:" + sumjhje.ToString("0.00"); this.statusBar1.Panels[1].Text = "零售金额:" + sumje.ToString("0.00"); this.statusBar1.Panels[2].Text = "进零差额:" + sumjlce.ToString("0.00"); } catch (System.Exception err) { this.buttj.Enabled = true; MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
private void buttj_Click(object sender, System.EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); this.buttj.Enabled = false; ParameterEx[] parameters = new ParameterEx[5]; parameters[0].Value = dtp1.Value.ToShortDateString(); parameters[1].Value = dtp2.Value.ToShortDateString(); parameters[2].Value = InstanceForm.BCurrentDept.DeptId; parameters[3].Value = Convert.ToInt32(Convertor.IsNull(txtdm.Tag, "0")); parameters[4].Value = this.rdoje.Checked == true ? 1 : 0; parameters[0].Text = "@dtp1"; parameters[1].Text = "@dtp2"; parameters[2].Text = "@deptid"; parameters[3].Text = "@cjid"; parameters[4].Text = "@type"; DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YF_tj_zyjytj", parameters, 30); FunBase.AddRowtNo(tb); if (this.rdosl.Checked == true) { tb.TableName = "Tb"; } else { tb.TableName = "Tb1"; } this.myDataGrid1.DataSource = tb; decimal sumlsje = 0; decimal sumzs = 0; for (int i = 0; i <= tb.Rows.Count - 1; i++) { if (rdoje.Checked == true) { sumzs = sumzs + Convert.ToDecimal(tb.Rows[i]["单据张数"]); } else { sumzs = sumzs + Convert.ToDecimal(tb.Rows[i]["数量"]); } sumlsje = sumlsje + Convert.ToDecimal(tb.Rows[i]["金额"]); } if (rdoje.Checked == true) { this.statusBar1.Panels[0].Text = "总张数 " + sumzs.ToString("0"); } else { this.statusBar1.Panels[0].Text = "总数量 " + sumzs.ToString("0.00"); } this.statusBar1.Panels[1].Text = "总金额 " + sumlsje.ToString("0.00"); this.buttj.Enabled = true; } catch (System.Exception err) { this.buttj.Enabled = true; MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
private void buttj_Click(object sender, System.EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); this.buttj.Enabled = false; ParameterEx[] parameters = new ParameterEx[7]; parameters[0].Value = Convert.ToInt32(cmbyjks.SelectedValue); parameters[1].Value = dtp1.Value.ToShortDateString() + " 00:00:00"; parameters[2].Value = dtp2.Value.ToShortDateString() + " 23:59:59"; parameters[3].Value = 0; parameters[0].Text = "@deptid"; parameters[1].Text = "@rq1"; parameters[2].Text = "@rq2"; parameters[3].Text = "@yplx"; parameters[4].Text = "@year"; parameters[5].Text = "@month"; parameters[6].Text = "@qfy"; if (rdo1.Checked == true) { parameters[4].Value = 0; parameters[5].Value = 0; } else { parameters[4].Value = Convert.ToInt32(cmbyear.Text); parameters[5].Value = Convert.ToInt32(cmbmonth.Text); } parameters[6].Value = Convert.ToInt32(checkBox1.Checked); DataTable tb = InstanceForm.BDatabase.GetDataTable("SP_YF_TJ_CKHZ", parameters, 30); FunBase.AddRowtNo(tb); decimal sumjhje = 0; decimal sumpfje = 0; decimal sumlsje = 0; decimal sumplce = 0; decimal sumjlce = 0; long sumdjzs = 0; for (int i = 0; i <= tb.Rows.Count - 1; i++) { sumjhje = sumjhje + Convert.ToDecimal(tb.Rows[i]["进货金额"]); sumpfje = sumpfje + Convert.ToDecimal(tb.Rows[i]["批发金额"]); sumlsje = sumlsje + Convert.ToDecimal(tb.Rows[i]["零售金额"]); sumjlce = sumjlce + Convert.ToDecimal(tb.Rows[i]["进零差额"]); sumplce = sumplce + Convert.ToDecimal(tb.Rows[i]["批零差额"]); sumdjzs = sumdjzs + Convert.ToInt64(tb.Rows[i]["单据张数"]); } DataRow newrow = tb.NewRow(); newrow["进货金额"] = sumjhje.ToString("0.00"); newrow["批发金额"] = sumpfje.ToString("0.00"); newrow["零售金额"] = sumlsje.ToString("0.00"); newrow["进零差额"] = sumjlce.ToString("0.00"); newrow["批零差额"] = sumplce.ToString("0.00"); newrow["单据张数"] = sumdjzs.ToString(); newrow["序号"] = "合计"; tb.Rows.Add(newrow); this.statusBar1.Panels[0].Text = "进货金额:" + sumjhje.ToString("0.00"); this.statusBar1.Panels[1].Text = "零售金额:" + sumlsje.ToString("0.00"); this.statusBar1.Panels[2].Text = "进零差额:" + sumjlce.ToString("0.00"); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.buttj.Enabled = true; } catch (System.Exception err) { this.buttj.Enabled = true; MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
private void butcx_Click(object sender, System.EventArgs e) { try { DataTable tbmx = (DataTable)this.myDataGrid2.DataSource; tbmx.Rows.Clear(); DataTable tb = new DataTable("Tb"); string ssql = "select * from (select 0 序号,yppm 品名,ypspm 商品名,ypgg 规格,s_sccj 厂家,pfj 批发价,lsj 零售价," + " cast(sum(kcl/dwbl) as decimal(12,3)) 总库存,dbo.fun_yp_ypdw(ypdw) 单位,cast(sum(pfj*kcl/dwbl) as decimal(18,2)) 批发金额," + " cast(sum(lsj*kcl/dwbl) as decimal(14,2)) 零售金额,shh 货号,cjid from " + " vi_yp_kcmx a where deptid<>0 "; if (chkyplx.Checked == true && Convertor.IsNull(cmbyplx.SelectedValue, "") != "0") { ssql = ssql + " and yplx=" + Convert.ToInt32(Convertor.IsNull(cmbyplx.SelectedValue, "0")) + " "; } if (chkypzlx.Checked == true) { ssql = ssql + " and ypzlx=" + Convert.ToInt32(Convertor.IsNull(cmbypzlx.SelectedValue, "0")) + " "; } if (chkjx.Checked == true) { ssql = ssql + " and ypjx=" + Convert.ToInt32(Convertor.IsNull(cmbjx.SelectedValue, "0")) + " "; } if (Convert.ToInt32(cmbjgbm.SelectedValue) > 0) { ssql = ssql + " and jgbm=" + Convert.ToInt64(cmbjgbm.SelectedValue) + " "; } if (chkqjy.Checked == true) { ssql = ssql + " and bdelete_kc=1"; } if (chkqkcwl.Checked == false && chkqjy.Checked == false) { ssql = ssql + " and (( kcl<>0 ))"; } if (txtdm.Text.Trim() != "") { ssql = ssql + " and ggid in(select ggid from yp_ypbm where Upper(pym) like '" + txtdm.Text.Trim().ToUpper() + "%' or Upper(wbm) like '" + txtdm.Text.Trim().ToUpper() + "%'" + " or Upper(szm) like '" + txtdm.Text.Trim().ToUpper() + "%' or ypbm like '%" + txtdm.Text.Trim() + "%')"; } ssql = ssql + " group by yppm,ypspm,ypgg,s_sccj,pfj,lsj,ypdw,shh,cjid ) a"; if (chkqkcwl.Checked == true) { ssql = ssql + " where 总库存=0 "; } ssql = ssql + " order by 货号"; //tb = InstanceForm.BDatabase.GetDataTable(ssql); ParameterEx[] parameters = new ParameterEx[1]; parameters[0].Value = ssql; parameters[0].Text = "@SSQL"; tb = InstanceForm.BDatabase.GetDataTable("SP_YP_EXECSQL", parameters, 30); FunBase.AddRowtNo(tb); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.myDataGrid1.TableStyles[0].MappingName = "Tb"; decimal sumpfje = 0; decimal sumlsje = 0; decimal sumplce = 0; for (int i = 0; i <= tb.Rows.Count - 1; i++) { sumpfje = sumpfje + Convert.ToDecimal(tb.Rows[i]["批发金额"]); sumlsje = sumlsje + Convert.ToDecimal(tb.Rows[i]["零售金额"]); } sumplce = sumlsje - sumpfje; this.statusBar1.Panels[0].Text = "批发金额 " + sumpfje.ToString("0.00"); this.statusBar1.Panels[1].Text = "零售金额 " + sumlsje.ToString("0.00"); this.statusBar1.Panels[2].Text = "批零差额 " + sumplce.ToString("0.00"); } catch (System.Exception err) { MessageBox.Show("对不起,发生错误" + err.Message); } }
private void butdel_Click(object sender, System.EventArgs e) { Guid log_djid = Guid.Empty; ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log(); DataTable tb = (DataTable)this.myDataGrid1.DataSource; try { int nrow = this.myDataGrid1.CurrentCell.RowNumber; if (nrow > tb.Rows.Count - 1) { return; } int ID = Convert.ToInt32(Convertor.IsNull(tb.Rows[nrow]["id"], "-1")); int FID = Convert.ToInt32(Convertor.IsNull(tb.Rows[nrow]["Fid"], "0")); if (MessageBox.Show("您确定要删除" + tb.Rows[nrow]["名称"].ToString() + "这个分类吗 ?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes) { return; } //看是否有子节点 string ssql = "select * from yp_ylfl where fid=" + ID + ""; DataTable tab = InstanceForm.BDatabase.GetDataTable(ssql); if (tab.Rows.Count > 0) { MessageBox.Show("对不起,当前节点还有子节点,请先删除子节点", "删除", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //看是否使用 ssql = "select * from yp_ypggd where ylfl=" + ID + ""; DataTable tab1 = InstanceForm.BDatabase.GetDataTable(ssql); if (tab1.Rows.Count > 0) { MessageBox.Show("对不起,这个分类在药品词典中已经使用了,不能删除"); return; } InstanceForm.BDatabase.BeginTransaction(); //删除 ssql = "delete from yp_ylfl where id=" + ID + ""; InstanceForm.BDatabase.DoCommand(ssql); //更新叶节点标记 if (FID > 0) { ssql = "select * from yp_ylfl where fid=" + FID + ""; DataTable ftab = InstanceForm.BDatabase.GetDataTable(ssql); if (ftab.Rows.Count == 0) { ssql = "update yp_ylfl set yjdbz=1 where id=" + FID + ""; InstanceForm.BDatabase.DoCommand(ssql); } } //三院数据处理_____保存日志 if (ID > 0) { string bz = "删除药理分类 【" + tb.Rows[nrow]["名称"].ToString() + "】 "; ts.Save_log(ts_HospData_Share.czlx.yp_药品基础数据单表修改, bz, "yp_ylfl", "id", ID.ToString(), InstanceForm._menuTag.Jgbm, 0, "", out log_djid, InstanceForm.BDatabase); } InstanceForm.BDatabase.CommitTransaction(); DataRow row = tb.Rows[nrow]; tb.Rows.Remove(row); } catch (System.Exception err) { InstanceForm.BDatabase.RollbackTransaction(); MessageBox.Show("发生错误" + err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { //三院数据处理 string errtext = ""; ts_HospData_Share.ts_update_type ty = new ts_HospData_Share.ts_update_type((int)ts_HospData_Share.czlx.yp_药品基础数据单表修改, InstanceForm.BDatabase); if (ty.Bzx == 1) { ts.Pexec_log(log_djid, InstanceForm.BDatabase, out errtext); } MessageBox.Show("删除成功" + errtext); AddTreeViewNode(this.treeView1.SelectedNode); this.treeView1.SelectedNode.Expand(); FunBase.AddRowtNo(tb); } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
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); // } //} }
private void buttj_Click(object sender, System.EventArgs e) { try { this.Cursor = PubStaticFun.WaitCursor(); this.buttj.Enabled = false; ParameterEx[] parameters = new ParameterEx[7]; int ntype = 0; if (rdomz.Checked == true) { ntype = 1; } if (rdozy.Checked == true) { ntype = 2; } parameters[0].Value = ntype; parameters[1].Value = dtp1.Value.ToString(); parameters[2].Value = dtp2.Value.ToString(); parameters[3].Value = Convert.ToInt32(cmbyjks.SelectedValue); parameters[4].Value = Convertor.IsNull(txtdm.Tag, "0"); parameters[5].Value = Convertor.IsNull(txtmb.Tag, "0"); int bk = 0; if (rdols.Checked == true) { bk = 1; } if (rdoall_bf.Checked == true) { bk = 2; } parameters[6].Text = "@bk"; parameters[6].Value = bk; parameters[0].Text = "@type"; parameters[1].Text = "@dtp1"; parameters[2].Text = "@dtp2"; parameters[3].Text = "@deptid"; parameters[4].Text = "@cjid"; parameters[5].Text = "@mbid"; parameters[6].Text = "@bk"; DataView dv = new DataView(); dv = InstanceForm.BDatabase.GetDataTable("SP_YF_tj_ypxhtj", parameters, 60).DefaultView; FunBase.AddRowtNo(dv.Table); DataTable tb = dv.Table; decimal sumpfje = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(批发金额)", ""), "0")); decimal sumlsje = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(零售金额)", ""), "0")); decimal sumplce = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(批零差额)", ""), "0")); decimal sumkcpfje = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(库存批发金额)", ""), "0")); decimal sumkclsje = Convert.ToDecimal(Convertor.IsNull(tb.Compute("sum(库存零售金额)", ""), "0")); this.statusBar1.Panels[0].Text = "批发金额 " + sumpfje.ToString("0.00"); this.statusBar1.Panels[1].Text = "零售金额 " + sumlsje.ToString("0.00"); this.statusBar1.Panels[2].Text = "批零差额 " + sumplce.ToString("0.00"); this.statusBar1.Panels[3].Text = "库存批发金额 " + sumkcpfje.ToString("0.00"); this.statusBar1.Panels[4].Text = "库存零售金额 " + sumkclsje.ToString("0.00"); this.buttj.Enabled = true; DataRow row = tb.NewRow(); row["序号"] = "合计"; row["批发金额"] = sumpfje.ToString(); row["零售金额"] = sumlsje.ToString(); row["批零差额"] = sumplce.ToString(); row["库存批发金额"] = sumkcpfje.ToString(); row["库存零售金额"] = sumkclsje.ToString(); tb.Rows.Add(row); tb.TableName = "Tb"; this.myDataGrid1.DataSource = dv; } catch (System.Exception err) { this.buttj.Enabled = true; MessageBox.Show(err.Message); } finally { this.Cursor = Cursors.Arrow; } }
private void butsave_Click(object sender, System.EventArgs e) { ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log(); Guid log_djid = Guid.Empty; DataTable tb = (DataTable)this.myDataGrid1.DataSource; string[] ss = new string[tb.Rows.Count]; this.Cursor = PubStaticFun.WaitCursor(); string ssql = ""; long fid = 0; string flbh = ""; string flmc = ""; int pxid = 0; string flms = ""; int bdelete = 0; string pym = ""; string wbm = ""; string hwbh = ""; string yhwbh = ""; try { if (this.treeView1.SelectedNode == null) { MessageBox.Show("请选择节点", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } bool bmodif = false; for (int i = 0; i <= tb.Rows.Count - 1; i++) { hwbh = tb.Rows[i]["货位编号"].ToString().Trim(); yhwbh = tb.Rows[i]["原货位编号"].ToString().Trim(); if (hwbh != yhwbh && Convert.ToInt32(Convertor.IsNull(tb.Rows[i]["id"], "0")) > 0) { bmodif = true; } } if (bmodif == true) { if (MessageBox.Show("您对货位编号进行了修改,此修改将影响所有该分类药品的货号,您确定吗 ?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } this.butsave.Enabled = false; InstanceForm.BDatabase.BeginTransaction(); for (int i = 0; i <= tb.Rows.Count - 1; i++) { int ID = Convert.ToInt32(Convertor.IsNull(tb.Rows[i]["id"], "0")); fid = Convert.ToInt64(Convertor.IsNull(tb.Rows[i]["fid"], "0")); hwbh = tb.Rows[i]["货位编号"].ToString().Trim(); yhwbh = tb.Rows[i]["原货位编号"].ToString().Trim(); flbh = tb.Rows[i]["编号"].ToString().Trim(); flmc = tb.Rows[i]["名称"].ToString().Trim(); flms = tb.Rows[i]["描述"].ToString().Trim(); bdelete = Convert.ToInt32(Convertor.IsNull(tb.Rows[i]["禁用"], "0")); pym = tb.Rows[i]["拼音码"].ToString().Trim(); wbm = tb.Rows[i]["五笔码"].ToString().Trim(); if (flmc.Trim() != "") { if (ID == 0) { ssql = "insert into yp_ylfl(fid,flbh,flmc,flms,bdelete,pym,wbm,yjdbz,hwbh) values(" + fid + ",'" + flbh + "','" + flmc + "'" + ",'" + flms + "'," + bdelete + ",'" + pym + "','" + wbm + "',1,'" + hwbh + "') "; } else { ssql = "update yp_ylfl set fid=" + fid + ",flbh='" + flbh + "',flmc='" + flmc + "',flms='" + flms + "',bdelete=" + bdelete + ",pym='" + pym + "',wbm='" + wbm + "',hwbh='" + hwbh + "' where id=" + ID + " "; //如果更改了货位编码,则重新生成药品货位号 int _errcode = 0; string _errtext = ""; if (hwbh.Trim() != yhwbh.Trim()) { string ssql1 = "select ggid from yp_ypggd where ylfl=" + ID + ""; DataTable tab = InstanceForm.BDatabase.GetDataTable(ssql1); Ypcj cj = new Ypcj(); for (int j = 0; j <= tab.Rows.Count - 1; j++) { cj.Update_shh(Convert.ToInt32(tab.Rows[j]["ggid"]), out _errcode, out _errtext, InstanceForm.BDatabase); if (_errcode != 0) { throw new Exception("重新生成药品货位编号时发生错误"); } } } } //三院数据处理 if (ID == 0) { InstanceForm.BDatabase.DoCommand(ssql); long newid = Convert.ToInt64(InstanceForm.BDatabase.GetDataTable("select @@IDENTITY").Rows[0][0]); ts.Save_log(ts_HospData_Share.czlx.yp_药品基础数据单表修改, InstanceForm.BCurrentUser.Name + "添加药理分类 【" + flmc + " 】", "yp_ylfl", "id", newid.ToString(), InstanceForm._menuTag.Jgbm, 0, "", out log_djid, InstanceForm.BDatabase); ss[i] = log_djid.ToString(); } else { string _ssql = "select * from yp_ylfl where id=" + ID + " and flmc='" + flmc + "' and pym='" + pym + "'"; DataTable tb_x = InstanceForm.BDatabase.GetDataTable(_ssql); if (tb_x.Rows.Count == 0) { ts.Save_log(ts_HospData_Share.czlx.yp_药品基础数据单表修改, InstanceForm.BCurrentUser.Name + "修改药理分类 【" + flmc + " 】", "yp_ylfl", "id", ID.ToString(), InstanceForm._menuTag.Jgbm, 0, "", out log_djid, InstanceForm.BDatabase); ss[i] = log_djid.ToString(); } InstanceForm.BDatabase.DoCommand(ssql); } ssql = "update yp_ylfl set yjdbz=0 where id=" + fid + ""; InstanceForm.BDatabase.DoCommand(ssql); } } InstanceForm.BDatabase.CommitTransaction(); } catch (System.Exception err) { this.butsave.Enabled = true; InstanceForm.BDatabase.RollbackTransaction(); MessageBox.Show("发生错误" + err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { //三院数据处理 string msg = ""; for (int i = 0; i <= ss.Length - 1; i++) { if (Convertor.IsNull(ss[i], "") == "") { continue; } string errtext = ""; ts_HospData_Share.ts_update_log tss = new ts_HospData_Share.ts_update_log(); ts_HospData_Share.ts_update_type ty = new ts_HospData_Share.ts_update_type((int)ts_HospData_Share.czlx.yp_药品基础数据单表修改, InstanceForm.BDatabase); if (ty.Bzx == 1) { tss.Pexec_log(new Guid(ss[i]), InstanceForm.BDatabase, out errtext); msg = msg + errtext; } } AddTreeViewNode(this.treeView1.SelectedNode); this.treeView1.SelectedNode.Expand(); string sss = ""; sss = "select 0 序号,hwbh 货位编号,hwbh 原货位编号,flbh 编号,flmc 名称,pym 拼音码,wbm 五笔码,flms 描述,dbo.fun_yp_ylfl(fid) 所属上级编目,cast(bdelete as smallint) 禁用,fid,id,yjdbz from yp_ylfl where fid=" + fid + " order by fid "; tb = InstanceForm.BDatabase.GetDataTable(sss); tb.TableName = "Tb"; this.myDataGrid1.DataSource = tb; this.myDataGrid1.TableStyles[0].MappingName = "Tb"; // this.myDataGrid1.CaptionText="当前节点:"+e.Node.Text.Trim();; FunBase.AddRowtNo(tb); MessageBox.Show("保存成功" + msg); this.butsave.Enabled = true; } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Arrow; } }
//汇总药品数量 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); }