/// <summary> /// 病人入院登记 /// </summary> public string PatRegister() { Hashtable hashtable = new Hashtable(); hashtable.Add("GRBM", getgrbm()); hashtable.Add("Ywlb", getywlb()); hashtable.Add("Zyfs", "0"); hashtable.Add("Djsj", DateTime.Now.ToString("yyyy-MM-dd")); hashtable.Add("Zyksbh", ZyPatlist.CureDeptCode); hashtable.Add("Zyksmc", BaseNameFactory.GetName(baseNameType.科室名称, ZyPatlist.CureDeptCode)); hashtable.Add("Zybqbh", ""); hashtable.Add("Zybqmc", ""); hashtable.Add("Zybcbh", ZyPatlist.BedCode); hashtable.Add("Cwlb", "0"); hashtable.Add("Zyh", ZyPatlist.CureNo); hashtable.Add("ICD_RY", ZyPatlist.DiseaseCode); hashtable.Add("RYZT_ID", ZyPatlist.CureState); hashtable.Add("DJRDM", EmpID); hashtable.Add("DJRMC", Name); hashtable.Add("YWID", getywid()); hashtable.Add("YLZH", ZyPatlist.patientInfo.MediCard); hashtable.Add("RYSJ", ZyPatlist.CureDate.ToString("yyyy-MM-dd")); hashtable.Add("YSDM", ZyPatlist.CureDocCode); hashtable.Add("YSMC", BaseNameFactory.GetName(baseNameType.用户名称, ZyPatlist.CureDocCode)); string id = zy_sys.Register(hashtable).ToString(); ZyPatlist.Nccm_NO += id; ErrMessage = zy_sys.ErrMessage; //[20100621.1.06] ipatdao.UpdatePatinfo(ZyPatlist.PatID.ToString(), ZyPatlist.PatListID.ToString(), ZyPatlist.patientInfo.PatName, getgrbm(), getywlb(), getywid(), id, ZyPatlist.DiseaseCode, ZyPatlist.DiseaseName); return(id); }
//绑定预交金 public void BindDataGrid() { this.tbInpatNo.Text = base.zy_PatList.CureNo; this.tbpatName.Text = base.zy_PatList.patientInfo.PatName; this.tbpatDept.Text = base.zy_PatList.CurrDeptCode.Trim() == "" ? BaseNameFactory.GetName(baseNameType.科室名称, base.zy_PatList.CureDeptCode) : BaseNameFactory.GetName(baseNameType.科室名称, base.zy_PatList.CurrDeptCode);//当前科室代码 this.tbbedno.Text = base.zy_PatList.BedCode; DataTable dt = zy_ChargeList.GetPatChargeList(); decimal dec = 0; for (int i = 0; i < dt.Rows.Count; i++) { dec += Convert.ToDecimal(dt.Rows[i]["Total_Fee"]); } this.label9.Text = dec.ToString(); IcostManager icM = ObjectFactory.GetObject <IcostManager>(typeof(ZY_CostMaster)); icM.PatListID = zy_PatList.PatListID; PatFee patFee = icM.GetPatFee(); this.lbChargeTolFee.Text = patFee.chargeFee.ToString(); this.lbCoseTolFee.Text = patFee.costFee.ToString(); this.lbExtFee.Text = patFee.surplusFee.ToString(); this.dgBill.AutoGenerateColumns = false; this.dgBill.DataSource = dt; this.dgBill.SelectRow(dt.Rows.Count - 1); }
private void btPrint_Click(object sender, EventArgs e) { if (this.dgvDrug.CurrentCell != null) { DataTable dt = (DataTable)this.dgvDrug.DataSource; int RowIndex = this.dgvDrug.CurrentCell.RowIndex; Report = new grproLib.GridppReport(); Report.LoadFromFile(HIS.SYSTEM.PubicBaseClasses.Constant.ApplicationDirectory + "\\report\\护士统领汇总单据.grf"); Report.ParameterByName("UserName").AsString = data[6]; Report.ParameterByName("ExeTime").AsString = data[0]; Report.ParameterByName("DeptName").AsString = BaseNameFactory.GetName(baseNameType.科室名称, data[1]); Report.ParameterByName("DispDept").AsString = BaseNameFactory.GetName(baseNameType.科室名称, data[2]); Report.ParameterByName("Printer").AsString = _currentUser.Name; Report.ParameterByName("PrintTime").AsString = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime.ToString(); Report.ParameterByName("HospitalName").AsString = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName; //List<string> patNames = new List<string>(); //int masterID = Convert.ToInt32(dsMessageData.dtMessageMaster.Rows[RowIndex]["DRUGMESSAGEID"].ToString().Trim()); //string patname = ""; //DataRow[] drs = dsMessageData.dtMessageOrder.Select("masterid=" + masterID); //for (int i = 0; i < drs.Length; i++) //{ // string patS = patNames.Find(delegate(string y) { return y == drs[i]["patname"].ToString(); }); // if (patS == null) // { // patNames.Add(drs[i]["patname"].ToString()); // patname += drs[i]["patname"].ToString() + ","; // } //} //if (patname != "") patname = patname.Substring(0, patname.Length - 1); Report.ParameterByName("PatientNames").AsString = ""; Report.FetchRecord += new grproLib._IGridppReportEvents_FetchRecordEventHandler(Report_FetchRecord); Report.PrintPreview(false); } }
///得到结账记录 /// </summary> /// <param name="AccountID">结账号</param> /// <returns></returns> public ZY_Account GetAccount(int AccountID) { ZY_Account zyAccount = BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).GetModel(AccountID); zyAccount.AccountName = BaseNameFactory.GetName(baseNameType.用户名称, zyAccount.AccountCode);//HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(zyAccount.AccountCode); return(zyAccount); }
/// <summary> /// 上传费用 /// </summary> public bool UploadPresOrder() { Hashtable hashtable = new Hashtable(); hashtable.Add("Ywid", getywid()); hashtable.Add("Id", getid()); hashtable.Add("Grbm", getgrbm()); hashtable.Add("Ywlb", getywlb()); hashtable.Add("Lrrdm", EmpID); hashtable.Add("Lrrxm", Name); hashtable.Add("Lrsj", DateTime.Now.ToString("yyyy-MM-dd")); hashtable.Add("Cfh", ZyPatlist.PatListID.ToString()); hashtable.Add("zyh", ZyPatlist.CureNo); hashtable.Add("jzks", BaseNameFactory.GetName(baseNameType.科室名称, ZyPatlist.CurrDeptCode)); hashtable.Add("empid", EmpID); hashtable.Add("name", Name); DataTable dt = GetPresOrderNoPass(); hashtable.Add("dt", dt); bool b = zy_sys.UploadzyPatFee(hashtable); if (b) { ipatdao.UpdatePresOrderPassID(dt); } else { ErrMessage = zy_sys.ErrMessage; } return(b); }
//取消结算 private void toolCanel_Click(object sender, EventArgs e) { try { if (base.zy_PatList == null) { return; } if (this.dgCost.CurrentCell == null) { return; } DataTable dt = ((DataTable)this.dgCost.DataSource).DefaultView.ToTable(); int row = this.dgCost.CurrentCell.RowIndex; if (dt.Rows.Count > 0 && row >= 0) { if (MessageBox.Show("确定要取消该次结算吗?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK) { ZY_CostMaster zyCostM = new ZY_CostMaster(); zyCostM = (ZY_CostMaster)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, row, zyCostM); if (zyCostM.Record_Flag != 0) { MessageBox.Show("该条结算记录可能被取消,不能对其进行操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (zyCostMaster.CheckCanelCost(zyCostM.PatListID, zyCostM.CostMasterID) == false) { MessageBox.Show("不能取消该条结算记录,请操作下面的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (zyCostMaster.Check_CanelCostPat(zyCostM) == false) { MessageBox.Show("该中途结算已经结帐,不能取消!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (HIS.ZY_BLL.OP_ZYConfigSetting.GetConfigValue("006") == 0) { if (zyCostM.ChargeCode.Trim() != base.currentUser.EmployeeID.ToString()) { MessageBox.Show("您没有权限取消【" + BaseNameFactory.GetName(baseNameType.用户名称, zyCostM.ChargeCode) + "】结算的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } //zyCostMaster.NccmCheck_CanelCostPat(base.zy_PatList, zyCostM.Nccm_NO); zyCostM.ChargeCode = currentUser.EmployeeID.ToString();//update zh 090604 zyCostMaster.CanelCostPat(zyCostM); MessageBox.Show("取消结算成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.BindCostData(base.zy_PatList.PatListID, null, null, null); } } } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 根据结算ID数组得到交款对象集(交款表汇总-打印结算交款表用) /// </summary> /// <param name="AccountIDs">结算ID数组</param> /// <returns>交款对象集</returns> public List <ZY_Account> GetAccounts(int[] AccountIDs, int type) { List <ZY_Account> zyAccounts = BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).GetListArray(" AccountType=" + type + " and accountid in (" + CommMethod.ToString(AccountIDs) + ")"); for (int i = 0; i < zyAccounts.Count; i++) { zyAccounts[i].AccountName = BaseNameFactory.GetName(baseNameType.用户名称, zyAccounts[i].AccountCode); } return(zyAccounts); }
private void GetCostData(List <ZY_ChargeList> zy_chargelist, List <ZY_CostMaster> zy_costmaster) { #region 第四步:结算的DataGrid数据 List <ZY_CostMaster> zyCostlistW = zy_costmaster.Count > 0 ? zy_costmaster.FindAll(x => x.Reality_Fee >= 0) : (new List <ZY_CostMaster>()); List <ZY_CostMaster> zyCostlistB = zy_costmaster.Count > 0 ? zy_costmaster.FindAll(x => x.Reality_Fee < 0) : (new List <ZY_CostMaster>()); List <ZY_CostMaster> zyCostlistSonW = new List <ZY_CostMaster>(); List <ZY_CostMaster> zyCostlistSonB = new List <ZY_CostMaster>(); List <ZY_ChargeList> zyChargeSonCost = new List <ZY_ChargeList>(); for (int i = 0; i < zyCostlistW.Count; i++) { ZY_CostMaster zyCostlistson = zyCostlistW[i]; zyCostlistson.UserName = BaseNameFactory.GetName(baseNameType.用户名称, zyCostlistson.ChargeCode); zyCostlistSonW.Add(zyCostlistson); } //汇总 ZY_CostMaster zyCostlistSonW1 = new ZY_CostMaster(); zyCostlistSonW1.TicketNum = "合计"; zyCostlistSonW1.Total_Fee = zyCostlistSonW.Sum(x => x.Total_Fee); zyCostlistSonW1.Reality_Fee = zyCostlistSonW.Sum(x => x.Reality_Fee); zyCostlistSonW1.Village_Fee = zyCostlistSonW.Sum(x => x.Village_Fee); zyCostlistSonW1.Favor_Fee = zyCostlistSonW.Sum(x => x.Favor_Fee); zyCostlistSonW.Add(zyCostlistSonW1); costAllData.GoodCostList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyCostlistSonW); for (int i = 0; i < zyCostlistB.Count; i++) { ZY_CostMaster zyCostlistson = zyCostlistB[i]; zyCostlistson.UserName = BaseNameFactory.GetName(baseNameType.用户名称, zyCostlistson.ChargeCode); zyCostlistSonB.Add(zyCostlistson); } //汇总 ZY_CostMaster zyCostlistSonB1 = new ZY_CostMaster(); zyCostlistSonB1.TicketNum = "合计"; zyCostlistSonB1.Total_Fee = zyCostlistSonB.Sum(x => x.Total_Fee); zyCostlistSonB1.Reality_Fee = zyCostlistSonB.Sum(x => x.Reality_Fee); zyCostlistSonB1.Village_Fee = zyCostlistSonB.Sum(x => x.Village_Fee); zyCostlistSonB1.Favor_Fee = zyCostlistSonB.Sum(x => x.Favor_Fee); zyCostlistSonB.Add(zyCostlistSonB1); costAllData.BadCostList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyCostlistSonB); costAllData.ChargeList = null; costAllData.TypeCostData = null; costAllData.CostData = null; #endregion }
/// <summary> /// 加载属性数据 /// </summary> public void LoadData()// { this.rowno = 0; this.DeptName = BaseNameFactory.GetName(baseNameType.科室名称, this.PresDeptCode); //HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetDeptName(this.PresDeptCode); this.DocName = BaseNameFactory.GetName(baseNameType.用户名称, this.PresDocCode); //HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(this.PresDocCode); this.ExecDept = BaseNameFactory.GetName(baseNameType.科室名称, this.ExecDeptCode); //HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetDeptName(this.ExecDeptCode); this.CostName = BaseNameFactory.GetName(baseNameType.用户名称, this.ChargeCode); //HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(this.ChargeCode); if (this.PresType.Trim() != "1" && this.PresType.Trim() != "2") { this.SmallNum = Amount; this.BigNum = 0; } else { this.SmallNum = this.Amount % this.RelationNum; this.BigNum = Convert.ToInt32((this.Amount - this.SmallNum) / this.RelationNum); } this.NCMS_CODE = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetNCMS_CODE(this.ItemID, Convert.ToInt32(this.PresType) >= 4 ? "2" : "1"); }
private void GetChargeData(List <ZY_ChargeList> zy_chargelist, List <ZY_CostMaster> zy_costmaster) { #region 第三步: 预交金的DataGrid数据 List <ZY_ChargeList> zyChargelistW = zy_chargelist.Count > 0 ? zy_chargelist.FindAll(x => x.Record_Flag != 2) : (new List <ZY_ChargeList>()); List <ZY_ChargeList> zyChargelistB = zy_chargelist.Count > 0 ? zy_chargelist.FindAll(x => x.Record_Flag == 2) : (new List <ZY_ChargeList>()); List <ZY_ChargeList> zyChargelistSonW = new List <ZY_ChargeList>(); List <ZY_ChargeList> zyChargelistSonB = new List <ZY_ChargeList>(); //汇总预交金账单 for (int i = 0; i < zyChargelistW.Count; i++) { ZY_ChargeList zyChargelistson = zyChargelistW[i]; zyChargelistson.ChargeUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyChargelistson.ChargeCode); zyChargelistSonW.Add(zyChargelistson); } //汇总 ZY_ChargeList zyChargelist1 = new ZY_ChargeList(); zyChargelist1.BillNo = "合计"; zyChargelist1.Total_Fee = zyChargelistSonW.Sum(x => x.Total_Fee); zyChargelistSonW.Add(zyChargelist1); chargeAllData.GoodChargeList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyChargelistSonW); for (int i = 0; i < zyChargelistB.Count; i++) { ZY_ChargeList zyChargelistson = zyChargelistB[i]; zyChargelistson.ChargeUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyChargelistson.ChargeCode); zyChargelistSonB.Add(zyChargelistson); } //汇总 ZY_ChargeList zyChargelist2 = new ZY_ChargeList(); zyChargelist2.BillNo = "合计"; zyChargelist2.Total_Fee = zyChargelistSonB.Sum(x => x.Total_Fee); zyChargelistSonB.Add(zyChargelist2); chargeAllData.BadChargeList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyChargelistSonB); //汇总结算 costAllData.CostData = null; #endregion }
/// <summary> /// 病人结算 /// </summary> public DataSet PatCost() { Hashtable hashtable = new Hashtable(); hashtable.Add("Ywid", getywid()); hashtable.Add("Id", getid()); hashtable.Add("Ywlb", getywlb()); //hashtable.Add("Grbm", getgrbm()); hashtable.Add("DJRDM", EmpID); hashtable.Add("DJRMC", Name); hashtable.Add("RYSJ", ZyPatlist.CureDate.ToString("yyyy-MM-dd")); hashtable.Add("Zyksbh", ZyPatlist.CureDeptCode); hashtable.Add("Zyksmc", BaseNameFactory.GetName(baseNameType.科室名称, ZyPatlist.CureDeptCode)); hashtable.Add("Zybqbh", ""); hashtable.Add("Zybqmc", ""); hashtable.Add("Zybcbh", ZyPatlist.BedCode); hashtable.Add("Cwlb", "0"); hashtable.Add("Zyh", ZyPatlist.CureNo); hashtable.Add("ICD_RY", ZyPatlist.DiseaseCode); hashtable.Add("RYZT_ID", ZyPatlist.CureState); hashtable.Add("Icd_zy", ZyPatlist.OutDiagnCode); hashtable.Add("Cyrq", ZyPatlist.OutDate.ToString("yyyy-MM-dd") == "0001-01-01" ? DateTime.Now.ToString("yyyy-MM-dd") : ZyPatlist.OutDate.ToString("yyyy-MM-dd")); hashtable.Add("Zyfs", "0"); hashtable.Add("Jssj", DateTime.Now.ToString("yyyy-MM-dd")); hashtable.Add("Jsr", EmpID); hashtable.Add("Jsrxm", Name); hashtable.Add("OPERATION_CODE", ""); hashtable.Add("Cyzt", ZyPatlist.Out_Flag); hashtable.Add("Jsdh", ZyPatlist.PatListID.ToString()); hashtable.Add("YSDM", ZyPatlist.CureDocCode); hashtable.Add("YSMC", BaseNameFactory.GetName(baseNameType.用户名称, ZyPatlist.CureDocCode)); hashtable.Add("Zfy", ipatdao.GetPatAllFee(ZyPatlist.PatListID).ToString("0.00")); hashtable.Add("Ylzh", ZyPatlist.patientInfo.MediCard); hashtable.Add("JSBZ", "0"); hashtable.Add("QTBCFS", "1"); DataSet ds = (DataSet)zy_sys.Charge(hashtable); ErrMessage = zy_sys.ErrMessage; return(ds); }
/// <summary> /// 重新入院登记 /// </summary> public bool RestPatRegister() { Hashtable hashtable = new Hashtable(); hashtable.Add("YWID", getywid()); hashtable.Add("id", getid()); hashtable.Add("Ywlb", getywlb()); hashtable.Add("GRBM", getgrbm()); hashtable.Add("DJRDM", EmpID); hashtable.Add("DJRMC", Name); hashtable.Add("RYSJ", ZyPatlist.CureDate.ToString("yyyy-MM-dd")); hashtable.Add("Zyksbh", ZyPatlist.CureDeptCode); hashtable.Add("Zyksmc", BaseNameFactory.GetName(baseNameType.科室名称, ZyPatlist.CureDeptCode)); hashtable.Add("Zybqbh", ""); hashtable.Add("Zybqmc", ""); hashtable.Add("Zybcbh", ZyPatlist.BedCode); hashtable.Add("Cwlb", "0"); hashtable.Add("Zyh", ZyPatlist.CureNo); hashtable.Add("ICD_RY", ZyPatlist.DiseaseCode); hashtable.Add("RYZT_ID", ZyPatlist.CureState); hashtable.Add("Bz", ""); hashtable.Add("Icd_zy", ZyPatlist.OutDiagnName); hashtable.Add("Cyrq", ZyPatlist.OutDate.ToString("yyyy-MM-dd")); hashtable.Add("Zyfs", "0"); hashtable.Add("Jssj", DateTime.Now.ToString("yyyy-MM-dd")); hashtable.Add("Jsr", EmpID); hashtable.Add("Jsrxm", Name); hashtable.Add("OPERATION_CODE", ""); hashtable.Add("Cyzt", ZyPatlist.Out_Flag); hashtable.Add("Jsdh", ""); hashtable.Add("YSDM", ZyPatlist.CureDocCode); hashtable.Add("YSMC", BaseNameFactory.GetName(baseNameType.用户名称, ZyPatlist.CureDocCode)); bool b = zy_sys.AlterRegister(hashtable); if (b == false) { ErrMessage = zy_sys.ErrMessage; } return(b); }
/// <summary> /// 加载上面数据 /// </summary> public void LoadData() { this.UserName = BaseNameFactory.GetName(baseNameType.用户名称, this.ChargeCode);//HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(this.ChargeCode); this.CureNo = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetCureNo(this.PatListID); this.PatName = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetPatName(this.PatID); // this.DeptName = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetPatDept(this.PatListID); IcostDao costdao = DaoFactory.GetObject <IcostDao>(typeof(CostDao)); //显示病人当前在院科室 costdao.oleDb = oleDb; this.DeptName = costdao.GetDeptName(this.PatListID); if (this.Ntype == 1) { this.CostType = "中途"; } else if (this.Ntype == 2) { this.CostType = "出院"; } else { this.CostType = "欠费"; } }
/// <summary> /// 取消结算 /// </summary> public bool CancelPatCost() { Hashtable hashtable = new Hashtable(); hashtable.Add("Ywid", getywid()); hashtable.Add("Id", getid()); hashtable.Add("Ywlb", getywlb()); //hashtable.Add("Grbm", getgrbm()); hashtable.Add("DJRDM", EmpID); hashtable.Add("DJRMC", Name); hashtable.Add("RYSJ", ZyPatlist.CureDate.ToString("yyyy-MM-dd")); hashtable.Add("Zyksbh", ZyPatlist.CureDeptCode); hashtable.Add("Zyksmc", BaseNameFactory.GetName(baseNameType.科室名称, ZyPatlist.CureDeptCode)); hashtable.Add("Zybqbh", ""); hashtable.Add("Zybqmc", ""); hashtable.Add("Zybcbh", ZyPatlist.BedCode); hashtable.Add("Cwlb", "0"); hashtable.Add("Zyh", ZyPatlist.CureNo); hashtable.Add("ICD_RY", ZyPatlist.DiseaseCode); hashtable.Add("RYZT_ID", ZyPatlist.CureState); hashtable.Add("Icd_zy", ZyPatlist.OutDiagnCode); hashtable.Add("Cyrq", ZyPatlist.OutDate.ToString("yyyy-MM-dd")); hashtable.Add("Zyfs", "0"); hashtable.Add("Jssj", DateTime.Now.ToString("yyyy-MM-dd")); hashtable.Add("Jsr", EmpID); hashtable.Add("Jsrxm", Name); hashtable.Add("OPERATION_CODE", ""); hashtable.Add("Cyzt", ZyPatlist.Out_Flag); hashtable.Add("Jsdh", ZyPatlist.PatListID.ToString()); hashtable.Add("YSDM", ZyPatlist.CureDocCode); hashtable.Add("YSMC", BaseNameFactory.GetName(baseNameType.用户名称, ZyPatlist.CureDocCode)); bool b = zy_sys.CancelCharge(hashtable); ErrMessage = zy_sys.ErrMessage; return(b); }
private void GetText(List <ZY_Account> zyAccountlist, DateTime BeginDate, DateTime EndDate) { zyAccountSonlistCharge = new List <ZY_Account>(); zyAccountSonlistCost = new List <ZY_Account>(); AccountIDCharge = new List <string>(); AccountIDCost = new List <string>(); chargeAllText = new ChargeAllText(); chargeAllData = new ChargeAllData(); costAllText = new CostAllText(); costAllData = new CostAllData(); if (zyAccountlist != null && zyAccountlist.Count > 0) { //ChargeAllText chargeAllText = new ChargeAllText(); decimal _OrderAllFee = 0; int _OrderAllNum = 0; decimal _BackAllFee = 0; int _BackAllNum = 0; decimal _AllFee = 0; decimal _Menoy = 0; decimal _POS = 0; //CostAllText costAllText = new CostAllText(); decimal _receiveFee = 0; int _receiveNum = 0; decimal _retreatFee = 0; int _retreatNum = 0; decimal _AllFee1 = 0; decimal _Menoy1 = 0; decimal _POS1 = 0; decimal _costFee = 0; decimal _faoverFee = 0; for (int i = 0; i < zyAccountlist.Count; i++) { ZY_Account zyAS = zyAccountlist[i]; zyAS.AccountName = BaseNameFactory.GetName(baseNameType.用户名称, zyAS.AccountCode); if (zyAccountlist[i].AccountType == 0)//预交金 { zyAccountSonlistCharge.Add(zyAS); AccountIDCharge.Add(zyAS.AccountID.ToString()); _OrderAllFee += zyAS.WTicketFee; _OrderAllNum += zyAS.WTicketNum; _BackAllFee += zyAS.BTicketFee; _BackAllNum += zyAS.BTicketNum; _AllFee += zyAS.Total_Fee; _Menoy += zyAS.Cash_Fee; _POS += zyAS.POS_Fee; } else if (zyAccountlist[i].AccountType == 1)//结算 { zyAccountSonlistCost.Add(zyAS); AccountIDCost.Add(zyAS.AccountID.ToString()); _receiveFee += zyAS.WTicketFee; _receiveNum += zyAS.WTicketNum; _retreatFee += zyAS.BTicketFee; _retreatNum += zyAS.BTicketNum; _AllFee1 += zyAS.Total_Fee + zyAS.CostFee + zyAS.FaoverFee; _Menoy1 += zyAS.Cash_Fee; _POS1 += zyAS.POS_Fee; _costFee += zyAS.CostFee; _faoverFee += zyAS.FaoverFee; } } //第二步:获取预交金和结算界面的text控件的值 chargeAllText.OrderAllFee = _OrderAllFee.ToString(); chargeAllText.OrderAllNum = _OrderAllNum.ToString(); chargeAllText.BackAllFee = _BackAllFee.ToString(); chargeAllText.BackAllNum = _BackAllNum.ToString(); chargeAllText.AllFee = _AllFee.ToString(); chargeAllText.Menoy = _Menoy.ToString(); chargeAllText.POS = _POS.ToString(); costAllText.receiveFee = _receiveFee.ToString(); costAllText.receiveNum = _receiveNum.ToString(); costAllText.retreatFee = _retreatFee.ToString(); costAllText.retreatNum = _retreatNum.ToString(); costAllText.AllFee = _AllFee1.ToString(); costAllText.Menoy = _Menoy1.ToString(); costAllText.POS = _POS1.ToString(); costAllText.costFee = _costFee.ToString(); costAllText.faoverFee = _faoverFee.ToString(); costAllText.lbAllFee = zyAccount.GetAllChargeFee(BeginDate, EndDate, zyAccountlist).ToString("0.00");//? //得到树的结构 List <string> accountCodes = new List <string>(); for (int i = 0; i < zyAccountlist.Count; i++) { if (accountCodes.Contains(zyAccountlist[i].AccountCode) == false) { accountCodes.Add(zyAccountlist[i].AccountCode); } } CostEmps = new CostEmp[accountCodes.Count]; for (int i = 0; i < CostEmps.Length; i++) { CostEmps[i].EmpID = accountCodes[i]; CostEmps[i].EmpName = BaseNameFactory.GetName(baseNameType.用户名称, accountCodes[i]); //预交金 List <ZY_Account> zyas = zyAccountSonlistCharge.FindAll(x => x.AccountCode == accountCodes[i]); CostEmps[i].Chargedates = new DateTime[zyas.Count]; CostEmps[i].ChargeAccountIDs = new int[zyas.Count]; for (int j = 0; j < zyas.Count; j++) { //CostEmps[i].EmpName = zyas[j].AccountName; CostEmps[i].Chargedates[j] = zyas[j].AccountDate; CostEmps[i].ChargeAccountIDs[j] = zyas[j].AccountID; } //结算 List <ZY_Account> zyas1 = zyAccountSonlistCost.FindAll(x => x.AccountCode == accountCodes[i]); CostEmps[i].Costdates = new DateTime[zyas1.Count]; CostEmps[i].CostAccountIDs = new int[zyas1.Count]; for (int j = 0; j < zyas1.Count; j++) { //CostEmps[i].EmpName = zyas1[j].AccountName; CostEmps[i].Costdates[j] = zyas1[j].AccountDate; CostEmps[i].CostAccountIDs[j] = zyas1[j].AccountID; } } } }
/// <summary> /// 根据结算ID得到发票内容 /// </summary> /// <param name="invoice">发票内容</param> /// <param name="CostMasterID">结算ID</param> protected void GetInvoiceInfo(AbstractInvoice invoice, int CostMasterID) { zyCM = BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).GetModel(CostMasterID); zyPL = BindEntity <ZY_PatList> .CreateInstanceDAL(oleDb).GetModel(zyCM.PatListID); invoice.病人姓名 = zyPL.patientInfo.PatName; invoice.发票号 = zyCM.TicketCode; invoice.住院号 = zyPL.CureNo; invoice.科室 = zyPL.CurrDeptCode.Trim() == "" ? BaseNameFactory.GetName(baseNameType.科室名称, zyPL.CureDeptCode) : BaseNameFactory.GetName(baseNameType.科室名称, zyPL.CurrDeptCode);// HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetDeptName(zyPL.CureDeptCode); invoice.床位号 = zyPL.BedCode; invoice.入院日期 = zyPL.CureDate; invoice.出院日期 = zyPL.OutDate; invoice.住院天数 = zyPL.ReaLiveNum; DateTime PrintDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime; invoice.年 = PrintDate.Date.Year.ToString(); invoice.月 = PrintDate.Date.Month.ToString(); invoice.日 = PrintDate.Date.Day.ToString(); if (zyCM.Ticket_Flag == 1) { invoice.总费用 = zyCM.Total_Fee.ToString("0.00"); } else if (zyCM.Ticket_Flag == 2) { invoice.总费用 = zyCM.Self_Fee.ToString("0.00"); } else { invoice.总费用 = zyCM.Total_Fee.ToString("0.00"); } invoice.预交金 = zyCM.Deptosit_Fee.ToString(); if (zyCM.Ntype == 1) { invoice.补收 = "0"; invoice.应退 = "0"; invoice.费 = "0"; //zyT.出院日期 = null; } else if (zyCM.Ntype == 2) { if (zyCM.Reality_Fee <= 0) { invoice.应退 = Convert.ToString(0 - zyCM.Reality_Fee); invoice.补收 = "0"; } else { invoice.补收 = zyCM.Reality_Fee.ToString(); invoice.应退 = "0"; } invoice.费 = "0"; } else if (zyCM.Ntype == 3) { invoice.补收 = zyCM.Reality_Fee.ToString(); invoice.应退 = "0"; invoice.费 = Convert.ToString(zyCM.Self_Fee - zyCM.Deptosit_Fee - zyCM.Reality_Fee); } invoice.收费员 = BaseNameFactory.GetName(baseNameType.用户名称, zyCM.ChargeCode);//HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(zyCM.ChargeCode); invoice.发票流水号 = zyCM.TicketNum; Iinvoice itD = DaoFactory.GetObject <Iinvoice>(typeof(InvoiceDao)); itD.oleDb = oleDb; invoice.发票项目费用 = itD.GetInvoiceInfo(CostMasterID); }
/// <summary> /// 得到病人的全部预交金 /// </summary> /// <returns></returns> public DataTable GetPatChargeList() { try { //Dal.ZY_DAL zy_ChargeList = new HIS.DAL.ZY_DAL(); //zy_ChargeList._OleDB = oleDb; string str = "PATLISTID =" + this.PatListID; List <ZY_ChargeList> zyChargeList = BindEntity <ZY_ChargeList> .CreateInstanceDAL(oleDb).GetListArray(str); //List<ZY_ChargeList_Son> zyChargeListSon = new List<ZY_ChargeList_Son>(); for (int i = 0; i < zyChargeList.Count; i++) { // ZY_ChargeList_Son _zyChargeSon = new ZY_ChargeList_Son(); // _zyChargeSon = (ZY_ChargeList_Son)HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjectToObj(zyChargeList[i], _zyChargeSon); if (zyChargeList[i].FeeType == 0) { zyChargeList[i].ChargeType = "现金"; } else if (zyChargeList[i].FeeType == 1) { zyChargeList[i].ChargeType = "POS"; } if (zyChargeList[i].Record_Flag == 0) { if (zyChargeList[i].Delete_Flag == 0) { zyChargeList[i].DelType = "正常"; } else { zyChargeList[i].DelType = "正常 【已结算】"; } } else if (zyChargeList[i].Record_Flag == 1) { if (zyChargeList[i].Total_Fee < 0) { if (zyChargeList[i].Delete_Flag == 0) { zyChargeList[i].DelType = "作废"; } else { zyChargeList[i].DelType = "作废 【已结算】"; } } else { if (zyChargeList[i].Delete_Flag == 0) { zyChargeList[i].DelType = "被作废"; } else { zyChargeList[i].DelType = "被作废【已结算】"; } } } else if (zyChargeList[i].Record_Flag == 2) { if (zyChargeList[i].Total_Fee < 0) { if (zyChargeList[i].Delete_Flag == 0) { zyChargeList[i].DelType = "退费"; } else { zyChargeList[i].DelType = "退费 【已结算】"; } } else { if (zyChargeList[i].Delete_Flag == 0) { zyChargeList[i].DelType = "被退费"; } else { zyChargeList[i].DelType = "被退费【已结算】"; } } } //else if (zyChargeList[i].Record_Flag == 3) //{ // zyChargeList[i].DelType = "中结"; //} zyChargeList[i].ChargeUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyChargeList[i].ChargeCode);//HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(zyChargeList[i].ChargeCode);//? //(new GWMHIS.BussinessLogicLayer.Classes.User(Convert.ToInt64(zyChargeList[i].ChargeCode))).Name; if (zyChargeList[i].AccountID == 0) { zyChargeList[i].AccountUserName = ""; } else { ZY_Account zyAccount = BindEntity <ZY_Account> .CreateInstanceDAL(oleDb).GetModel(zyChargeList[i].AccountID); //zyChargeList[i].AccountUserName = //HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(zyAccount.AccountCode); zyChargeList[i].AccountUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyAccount.AccountCode);//HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetUserName(zyAccount.AccountCode); zyChargeList[i].AccountDate = zyAccount.AccountDate; } //zyChargeListSon.Add(_zyChargeSon); } return(HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyChargeList)); } catch (System.Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 统计报表(NAME,DATE,NUM) /// </summary> /// <param name="ViewType">0-按医生 1-按科室</param> /// <param name="beginDate"></param> /// <param name="endDate"></param> /// <returns></returns> public static DataSet GetRegisterReport(int ViewType, DateTime beginDate, DateTime endDate) { DataTable tbReg = GetRegisterData(beginDate, endDate); DataTable tbResultByName = new DataTable(); tbResultByName.TableName = "TB_A"; tbResultByName.Columns.Add("CODE", Type.GetType("System.String")); tbResultByName.Columns.Add("NAME", Type.GetType("System.String")); tbResultByName.Columns.Add("NUM", Type.GetType("System.Int32")); tbResultByName.Columns.Add("MONEY", Type.GetType("System.Decimal")); DataTable tbResultByDate = new DataTable(); tbResultByDate.TableName = "TB_B"; tbResultByDate.Columns.Add("DATE", Type.GetType("System.String")); tbResultByDate.Columns.Add("NUM", Type.GetType("System.Int32")); string fileName = ""; if (ViewType == 0) { fileName = "PRESDOCCODE"; } else { fileName = "PRESDEPTCODE"; } for (int i = 0; i < tbReg.Rows.Count; i++) { string code = tbReg.Rows[i][fileName].ToString().Trim(); DataRow[] drs = tbResultByName.Select("CODE='" + code + "'"); if (drs.Length == 0) { DataRow dr = tbResultByName.NewRow(); dr["CODE"] = code; if (ViewType == 0) { dr["NAME"] = code == "" ? "未指定" : BaseNameFactory.GetName(baseNameType.用户名称, code);//HIS.MZ_BLL.BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(code));// PublicDataReader.GetEmployeeNameById(Convert.ToInt32(code)); } else { dr["NAME"] = code == "" ? "未指定" : BaseNameFactory.GetName(baseNameType.科室名称, code);//HIS.MZ_BLL.BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(code)); //PublicDataReader.GetDeptNameById(Convert.ToInt32(code)); } dr["NUM"] = tbReg.Rows[i]["REGNUM"]; //dr["MONEY"] = tbReg.Rows[i]["MONEY"]; tbResultByName.Rows.Add(dr); } else { drs[0]["NUM"] = Convert.ToInt32(tbReg.Rows[i]["REGNUM"]) + (Convert.IsDBNull(drs[0]["NUM"]) ? 0 : Convert.ToInt32(drs[0]["NUM"])); //drs[0]["MONEY"] = Convert.ToInt32( tbReg.Rows[i]["REGNUM"] ) + ( Convert.IsDBNull( drs[0]["MONEY"] ) ? 0 : Convert.ToDecimal( drs[0]["MONEY"] ) ); } //日期 drs = tbResultByDate.Select("DATE='" + Convert.ToDateTime(tbReg.Rows[i]["PRESDATE"]).ToString("yyyy-MM-dd") + "'"); if (drs.Length == 0) { DataRow dr = tbResultByDate.NewRow(); dr["DATE"] = Convert.ToDateTime(tbReg.Rows[i]["PRESDATE"]).ToString("yyyy-MM-dd"); dr["NUM"] = tbReg.Rows[i]["REGNUM"]; tbResultByDate.Rows.Add(dr); } else { int num = Convert.IsDBNull(drs[0]["NUM"]) ? 0 : Convert.ToInt32(drs[0]["NUM"]); int num1 = Convert.IsDBNull(tbReg.Rows[i]["REGNUM"]) ? 0 : Convert.ToInt32(tbReg.Rows[i]["REGNUM"]); num = num + num1; drs[0]["NUM"] = num; } } DataSet dsResult = new DataSet(); dsResult.Tables.Add(tbResultByName); dsResult.Tables.Add(tbResultByDate); return(dsResult); }
//打印主功能 private void PrintMain(bool IsPreview, string presdeptcode) { Report = new grproLib.GridppReport(); IcostManager icM = ObjectFactory.GetObject <IcostManager>(typeof(ZY_CostMaster)); icM.PatListID = zy_pat.PatListID; PatFee patFee = icM.GetPatFee(this.dtpE.Value.Date); if (this.radioButton1.Checked) { Report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院费用清单_汇总.grf"); } else if (this.radioButton2.Checked) { Report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院费用清单_核算.grf"); } else if (this.radioButton3.Checked) { Report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院费用清单.grf"); } else if (this.radioButton4.Checked) { Report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院费用清单_汇总分组.grf"); } else if (this.radioButton5.Checked) { Report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院费用一日清单.grf"); } if (checkBox1.Checked == true) { Report.ParameterByName("费用时间").AsString = this.dtpB.Value.ToString("yyyy-MM-dd HH:mm:ss") + "至" + this.dtpE.Value.ToString("yyyy-MM-dd HH:mm:ss"); } else { string date1, date2; if (zy_pat.OutDate.Date.ToString("yyyy-MM-dd") == "0001-01-01") { date2 = "至今"; } else { date2 = zy_pat.OutDate.Date.ToString("yyyy-MM-dd") + " 23:59:59"; } date1 = zy_pat.CureDate.ToString("yyyy-MM-dd HH:mm:ss"); Report.ParameterByName("费用时间").AsString = date1 + "至" + date2; } if (this.radioButton5.Checked) { Report.ParameterByName("费用时间").AsString = this.dtpB.Value.ToString("yyyy-MM-dd HH:mm:ss"); } Report.ParameterByName("CureNo").AsString = zy_pat.CureNo; Report.ParameterByName("PatCaseNo").AsString = zy_pat.patientInfo.PatCaseNo; Report.ParameterByName("PatName").AsString = zy_pat.patientInfo.PatName; string DateStr = zy_pat.OutDate.Date.ToString("yyyy-MM-dd"); if (DateStr == "0001-01-01") { DateStr = zy_pat.CureDate.Date.ToString("yyyy-MM-dd"); } else { DateStr = zy_pat.CureDate.Date.ToString("yyyy-MM-dd") + "至" + DateStr; } Report.ParameterByName("MarkDate").AsString = DateStr; Report.ParameterByName("BedCode").AsString = zy_pat.BedCode; if (presdeptcode == null) { Report.ParameterByName("住院科室").AsString = BaseNameFactory.GetName(baseNameType.科室名称, zy_pat.CurrDeptCode); } else { Report.ParameterByName("住院科室").AsString = BaseNameFactory.GetName(baseNameType.科室名称, presdeptcode); } Report.ParameterByName("WorkName").AsString = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName; if (zy_pat.PatType == "4" || zy_pat.PatType == "5") { //Report.ParameterByName("累计交费").AsString = "0"; //try //{ // ZY_CostMaster zyCM = new ZY_CostMaster(); // Report.ParameterByName("农合医保记账").AsString = zyCM.GetSumVillage_Fee(zy_pat.PatListID).ToString("0.00"); //} //catch { } //Report.ParameterByName("余额").AsString = "0"; icM = icM.GetCostMaster(zy_pat.PatListID); Report.ParameterByName("累计交费").AsString = icM.Deptosit_Fee.ToString(); Report.ParameterByName("累计记账").AsString = icM.Total_Fee.ToString(); Report.ParameterByName("余额").AsString = Convert.ToString(icM.Deptosit_Fee - icM.Total_Fee); } else { Report.ParameterByName("累计交费").AsString = patFee.chargeFee.ToString(); Report.ParameterByName("累计记账").AsString = patFee.costFee.ToString(); Report.ParameterByName("余额").AsString = patFee.surplusFee.ToString(); } //ShowItemData(); 移动在Print()中 try { Report.ParameterByName("甲类总金额").AsString = firstFee.ToString(); Report.ParameterByName("乙类总金额").AsString = secondFee.ToString(); Report.ParameterByName("本次优惠").AsString = AllDec.ToString(); Report.ParameterByName("担保金额").AsString = zy_pat.DbFee.ToString("0.00"); //Report.ParameterByName("自付金额").AsString = Convert.ToString(patFee.costFee - firstFee - secondFee); } catch { } if (this.radioButton5.Checked) { for (int i = 0; i < ItemDt.Rows.Count; i++) { for (int j = 1; j <= Report.Parameters.Count; j++) { if (ItemDt.Rows[i]["itemname"].ToString().Trim() == Report.Parameters[j].Name) { Report.Parameters[j].Value = ItemDt.Rows[i]["Tolal_Fee"].ToString(); } } } } else { Report.FetchRecord += new grproLib._IGridppReportEvents_FetchRecordEventHandler(Report_FetchRecord); } if (IsPreview) { Report.PrintPreview(false); } else { Report.Print(false); } }
private void GetCostData() { #region 第四步:结算的DataGrid数据 costAllData.CostData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyAccountSonlistCost); List <ZY_CostMaster> zyCostlistW = AccountIDCost.Count > 0 ? zyAccount.GetCostData(AccountIDCost.ToArray(), 0) : (new List <ZY_CostMaster>()); List <ZY_CostMaster> zyCostlistB = AccountIDCost.Count > 0 ? zyAccount.GetCostData(AccountIDCost.ToArray(), 1) : (new List <ZY_CostMaster>()); List <ZY_ChargeList> zyChargelistCost = AccountIDCost.Count > 0 ? zyAccount.GetChargeData(AccountIDCost.ToArray(), 2) : (new List <ZY_ChargeList>()); if (AccountIDCost.Count > 0) { DataTable TypeCostData = zyAccount.GetBIGItemData(AccountIDCost.ToArray()); DataRow dr = TypeCostData.NewRow(); dr["itemname"] = "合计"; decimal dec = 0; for (int i = 0; i < TypeCostData.Rows.Count; i++) { dec += Convert.ToDecimal(TypeCostData.Rows[i]["total_fee"]); } dr["total_fee"] = dec; TypeCostData.Rows.Add(dr);//汇总 costAllData.TypeCostData = TypeCostData; } else { costAllData.TypeCostData = null; } List <ZY_CostMaster> zyCostlistSonW = new List <ZY_CostMaster>(); List <ZY_CostMaster> zyCostlistSonB = new List <ZY_CostMaster>(); List <ZY_ChargeList> zyChargeSonCost = new List <ZY_ChargeList>(); for (int i = 0; i < zyCostlistW.Count; i++) { ZY_CostMaster zyCostlistson = zyCostlistW[i]; zyCostlistson.UserName = BaseNameFactory.GetName(baseNameType.用户名称, zyCostlistson.ChargeCode); zyCostlistSonW.Add(zyCostlistson); } //汇总 ZY_CostMaster zyCostlistSonW1 = new ZY_CostMaster(); zyCostlistSonW1.TicketNum = "合计"; zyCostlistSonW1.Total_Fee = zyCostlistSonW.Sum(x => x.Total_Fee); zyCostlistSonW1.Reality_Fee = zyCostlistSonW.Sum(x => x.Reality_Fee); zyCostlistSonW1.Village_Fee = zyCostlistSonW.Sum(x => x.Village_Fee); zyCostlistSonW1.Favor_Fee = zyCostlistSonW.Sum(x => x.Favor_Fee); zyCostlistSonW.Add(zyCostlistSonW1); costAllData.GoodCostList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyCostlistSonW); for (int i = 0; i < zyCostlistB.Count; i++) { ZY_CostMaster zyCostlistson = zyCostlistB[i]; zyCostlistson.UserName = BaseNameFactory.GetName(baseNameType.用户名称, zyCostlistson.ChargeCode); zyCostlistSonB.Add(zyCostlistson); } //汇总 ZY_CostMaster zyCostlistSonB1 = new ZY_CostMaster(); zyCostlistSonB1.TicketNum = "合计"; zyCostlistSonB1.Total_Fee = zyCostlistSonB.Sum(x => x.Total_Fee); zyCostlistSonB1.Reality_Fee = zyCostlistSonB.Sum(x => x.Reality_Fee); zyCostlistSonB1.Village_Fee = zyCostlistSonB.Sum(x => x.Village_Fee); zyCostlistSonB1.Favor_Fee = zyCostlistSonB.Sum(x => x.Favor_Fee); zyCostlistSonB.Add(zyCostlistSonB1); costAllData.BadCostList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyCostlistSonB); for (int i = 0; i < zyChargelistCost.Count; i++) { ZY_ChargeList zyChargelistson = zyChargelistCost[i]; zyChargelistson.ChargeUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyChargelistson.ChargeCode); zyChargeSonCost.Add(zyChargelistson); } //汇总 ZY_ChargeList zyChargeSonCost1 = new ZY_ChargeList(); zyChargeSonCost1.BillNo = "合计"; zyChargeSonCost1.Total_Fee = zyChargeSonCost.Sum(x => x.Total_Fee); zyChargeSonCost.Add(zyChargeSonCost1); costAllData.ChargeList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyChargeSonCost); costAllText.deptosit_fee = Convert.ToString(zyCostlistW.Sum(x => x.Deptosit_Fee) + zyCostlistB.Sum(x => x.Deptosit_Fee)); costAllText.lbRoundFee = Convert.ToString(Convert.ToDecimal(CostAllText.lbAllFee) - Convert.ToDecimal(CostAllText.deptosit_fee) - Convert.ToDecimal(CostAllText.AllFee)); #endregion }
//绑定病人列表 private void BindLvPatList() { string DeptCode = null; string CureNo = null; string PatName = null; DateTime?Bdate = null; DateTime?Edate = null; bool IsIn = true; if (this.chbDept.Checked) { DeptCode = this.cbDept.SelectedValue.ToString().Trim(); } if (this.checkBox3.Checked) { CureNo = this.tbInpatNo.Text; } if (this.checkBox4.Checked) { PatName = this.textBox1.Text.Trim(); } if (this.checkBox2.Checked) { Bdate = this.dtpBdate.Value; Edate = this.dtpEdate.Value; } IsIn = this.cb_pattype.SelectedIndex == 0 ? true : false; this.lvPatList.Items.Clear(); List <ZY_PatList> zypatlist = null; //ZY_PatList zy_Patlist = new ZY_PatList(); BindPatListVal bplv = new BindPatListVal(); bplv.IsIn = IsIn; bplv.DeptCode = DeptCode; bplv.Bdate = Bdate; bplv.Edate = Edate; bplv.CureNo = CureNo; bplv.PatName = PatName; bplv.IsCost = this.cb_pattype.SelectedIndex == 1 ? true : false; zy_PatList.bindPatListVal = bplv; zy_PatList.bindPatListType = BindPatListType.费用清单病人列表; zypatlist = zy_PatList.BindPatList(); if (zypatlist.Count == 0) { MessageBox.Show("未找到任何病人!"); return; } IcostManager icM = ObjectFactory.GetObject <IcostManager>(typeof(ZY_CostMaster)); for (int i = 0; i < zypatlist.Count; i++) { bool b = true;//false 欠费病人 ListViewItem lstViewItem = new ListViewItem(); lstViewItem.SubItems.Clear(); lstViewItem.Tag = zypatlist[i]; lstViewItem.SubItems[0].Text = zypatlist[i].CureNo; lstViewItem.SubItems.Add(zypatlist[i].BedCode); lstViewItem.SubItems.Add(zypatlist[i].patientInfo.PatName); lstViewItem.SubItems.Add(zypatlist[i].patientInfo.PatSex); if (zypatlist[i].PatType == "4" || zypatlist[i].PatType == "5") { icM = icM.GetCostMaster(zypatlist[i].PatListID); lstViewItem.SubItems.Add(icM.Deptosit_Fee.ToString()); lstViewItem.SubItems.Add(icM.Total_Fee.ToString());//HIS.ZY_BLL.OP_CostManage.GetSumVillage_Fee(zypatlist[i].PatListID).ToString("0.00")); lstViewItem.SubItems.Add(Convert.ToString(icM.Deptosit_Fee - icM.Total_Fee)); } else { icM.PatListID = zypatlist[i].PatListID; PatFee patFee = icM.GetPatFee(); lstViewItem.SubItems.Add(patFee.chargeFee.ToString()); lstViewItem.SubItems.Add(patFee.costFee.ToString()); lstViewItem.SubItems.Add(patFee.surplusFee.ToString()); if (patFee.surplusFee < 0) { b = false;//欠费病人 } } lstViewItem.SubItems.Add(zypatlist[i].patientInfo.PatBriDate.ToString("yyyy-MM-dd")); lstViewItem.SubItems.Add(BaseNameFactory.GetName(baseNameType.科室名称, zypatlist[i].CurrDeptCode)); lstViewItem.SubItems.Add(zypatlist[i].patientInfo.ACCOUNTTYPE); lstViewItem.SubItems.Add(zypatlist[i].CureDate.Date.ToString("yyyy-MM-dd")); string strOutDate = zypatlist[i].OutDate.Date.ToString("yyyy-MM-dd"); strOutDate = strOutDate == "0001-01-01" ? "至今" : strOutDate; lstViewItem.SubItems.Add(strOutDate); if (zypatlist[i].OutDate.ToString("yyyy-MM-dd") == "0001-01-01") { //this.tbNum.Text = ts.Days.ToString(); lstViewItem.SubItems.Add("0"); } else { TimeSpan ts = zypatlist[i].OutDate - zypatlist[i].CureDate; lstViewItem.SubItems.Add(ts.Days.ToString()); } //[20100624.1.10] if (this.cbQF.Checked == true)//欠费病人显示 { if (b == false) { this.lvPatList.Items.Add(lstViewItem); } } else { this.lvPatList.Items.Add(lstViewItem); } } }
/// <summary> /// 获取科室分类数据 /// </summary> /// <param name="AccountID">交款ID</param> /// <returns></returns> public DataTable GetAccountDeptOrderData(int AccountID) { DataTable dt = new DataTable(); string strWhere = "Accountid=" + AccountID; DataTable DeptDT = BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).GetList(strWhere, "CostMasterID", "PatlistID"); //建列 DataColumn column; ArrayList al = new ArrayList(); for (int i = 0; i < DeptDT.Rows.Count; i++) { string deptcode = BindEntity <ZY_PatList> .CreateInstanceDAL(oleDb).GetFieldValue("curedeptcode", "patlistid=" + DeptDT.Rows[i]["patlistid"] + "").ToString(); if (!al.Contains(deptcode)) { al.Add(deptcode); } } column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "费用项目"; //column.ReadOnly = true; dt.Columns.Add(column); for (int i = 0; i < al.Count; i++) { string deptName = BaseNameFactory.GetName(baseNameType.科室名称, al[i].ToString());//HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.GetDeptName(al[i].ToString()); column = new DataColumn(); column.DataType = System.Type.GetType("System.Decimal"); column.ColumnName = deptName; //column.ReadOnly = true; dt.Columns.Add(column); } column = new DataColumn(); column.DataType = System.Type.GetType("System.Decimal"); column.ColumnName = "合计"; //column.ReadOnly = true; dt.Columns.Add(column); //添加行 IaccountDao itD = DaoFactory.GetObject <IaccountDao>(typeof(AccountDao)); itD.oleDb = oleDb; DataTable ItemDT = itD.GetAccountDeptOrderData(AccountID); ArrayList alrow = new ArrayList(); DataRow row = null; for (int i = 0; i < ItemDT.Rows.Count; i++) { if (!alrow.Contains(ItemDT.Rows[i]["itemname"])) { alrow.Add(ItemDT.Rows[i]["itemname"]); row = dt.NewRow(); int rowid = alrow.Count - 1; row["费用项目"] = ItemDT.Rows[i]["itemname"].ToString(); row[ItemDT.Rows[i]["deptname"].ToString()] = Convert.ToDecimal(ItemDT.Rows[i]["total_fee"]); row["合计"] = Convert.ToDecimal(ItemDT.Rows[i]["total_fee"]); dt.Rows.Add(row); } else { #if DEBUG if (i == 28) { break; } #endif int rowid = alrow.IndexOf(ItemDT.Rows[i]["itemname"]); dt.Rows[rowid][ItemDT.Rows[i]["deptname"].ToString()] = Convert.ToDecimal(dt.Rows[rowid][ItemDT.Rows[i]["deptname"].ToString()].ToString() == "" ? "0" : dt.Rows[rowid][ItemDT.Rows[i]["deptname"].ToString()].ToString()) + Convert.ToDecimal(ItemDT.Rows[i]["total_fee"]); dt.Rows[rowid]["合计"] = Convert.ToDecimal(dt.Rows[rowid]["合计"]) + Convert.ToDecimal(ItemDT.Rows[i]["total_fee"]); } } CreateDataTableRowAll(dt); return(dt); }
private void GetText(List <ZY_ChargeList> zy_chargelist, List <ZY_CostMaster> zy_costmaster) { chargeAllText = new ChargeAllText(); chargeAllData = new ChargeAllData(); costAllText = new CostAllText(); costAllData = new CostAllData(); //预交金 decimal _OrderAllFee = 0; int _OrderAllNum = 0; decimal _BackAllFee = 0; int _BackAllNum = 0; decimal _AllFee = 0; decimal _Menoy = 0; decimal _POS = 0; //结算 decimal _receiveFee = 0; int _receiveNum = 0; decimal _retreatFee = 0; int _retreatNum = 0; decimal _AllFee1 = 0; decimal _Menoy1 = 0; decimal _POS1 = 0; decimal _costFee = 0; decimal _faoverFee = 0; decimal _deptosit_fee = 0; if (zy_chargelist != null && zy_chargelist.Count > 0) { _OrderAllFee = zy_chargelist.FindAll(x => x.Record_Flag != 2).Sum(x => x.Total_Fee); _OrderAllNum = zy_chargelist.FindAll(x => x.Record_Flag == 0).Count; _BackAllFee = zy_chargelist.FindAll(x => x.Record_Flag == 2).Sum(x => x.Total_Fee); _BackAllNum = zy_chargelist.FindAll(x => x.Record_Flag == 2).Count; _AllFee = zy_chargelist.Sum(x => x.Total_Fee); _Menoy = zy_chargelist.FindAll(x => x.FeeType == 0).Sum(x => x.Total_Fee); _POS = zy_chargelist.FindAll(x => x.FeeType == 1).Sum(x => x.Total_Fee); } if (zy_costmaster != null && zy_costmaster.Count > 0) { _receiveFee = zy_costmaster.FindAll(x => x.Reality_Fee >= 0).Sum(x => x.Total_Fee); _receiveNum = zy_costmaster.FindAll(x => x.Reality_Fee >= 0 && x.Record_Flag == 0).Count; _retreatFee = zy_costmaster.FindAll(x => x.Reality_Fee < 0).Sum(x => x.Total_Fee); _retreatNum = zy_costmaster.FindAll(x => x.Reality_Fee < 0 && x.Record_Flag == 0).Count; _AllFee1 = zy_costmaster.Sum(x => (x.Reality_Fee + x.Village_Fee + x.Favor_Fee));//结算金额=实收金额+记账金额+优惠金额 _Menoy1 = zy_costmaster.Sum(x => x.Money_Fee); _POS1 = zy_costmaster.Sum(x => x.Pos_Fee); _costFee = zy_costmaster.Sum(x => x.Village_Fee); _faoverFee = zy_costmaster.Sum(x => x.Favor_Fee); _deptosit_fee = zy_costmaster.Sum(x => x.Deptosit_Fee); } //第二步:获取预交金和结算界面的text控件的值 chargeAllText.OrderAllFee = _OrderAllFee.ToString(); chargeAllText.OrderAllNum = _OrderAllNum.ToString(); chargeAllText.BackAllFee = _BackAllFee.ToString(); chargeAllText.BackAllNum = _BackAllNum.ToString(); chargeAllText.AllFee = _AllFee.ToString(); chargeAllText.Menoy = _Menoy.ToString(); chargeAllText.POS = _POS.ToString(); costAllText.receiveFee = _receiveFee.ToString(); costAllText.receiveNum = _receiveNum.ToString(); costAllText.retreatFee = _retreatFee.ToString(); costAllText.retreatNum = _retreatNum.ToString(); costAllText.AllFee = _AllFee1.ToString(); costAllText.Menoy = _Menoy1.ToString(); costAllText.POS = _POS1.ToString(); costAllText.costFee = _costFee.ToString(); costAllText.faoverFee = _faoverFee.ToString(); costAllText.lbAllFee = (_AllFee1 + _deptosit_fee).ToString(); costAllText.deptosit_fee = _deptosit_fee.ToString(); costAllText.lbRoundFee = "0"; //得到树的结构 List <string> accountCodes = new List <string>(); for (int i = 0; i < zy_chargelist.Count; i++) { if (accountCodes.Contains(zy_chargelist[i].ChargeCode) == false) { accountCodes.Add(zy_chargelist[i].ChargeCode); } } for (int j = 0; j < zy_costmaster.Count; j++) { if (accountCodes.Contains(zy_costmaster[j].ChargeCode) == false) { accountCodes.Add(zy_costmaster[j].ChargeCode); } } CostEmps = new CostEmp[accountCodes.Count]; for (int i = 0; i < CostEmps.Length; i++) { CostEmps[i].EmpID = accountCodes[i]; CostEmps[i].EmpName = BaseNameFactory.GetName(baseNameType.用户名称, accountCodes[i]); //预交金 CostEmps[i].Chargedates = new DateTime[1]; CostEmps[i].ChargeAccountIDs = new int[1]; CostEmps[i].Chargedates[0] = DateTime.Now; CostEmps[i].ChargeAccountIDs[0] = 0; //结算 CostEmps[i].Costdates = new DateTime[1]; CostEmps[i].CostAccountIDs = new int[1]; CostEmps[i].Costdates[0] = DateTime.Now; CostEmps[i].CostAccountIDs[0] = 0; } }
private void GetChargeData() { #region 第三步: 预交金的DataGrid数据 List <ZY_ChargeList> zyChargelistW = AccountIDCharge.Count > 0 ? zyAccount.GetChargeData(AccountIDCharge.ToArray(), 0) : (new List <ZY_ChargeList>()); List <ZY_ChargeList> zyChargelistB = AccountIDCharge.Count > 0 ? zyAccount.GetChargeData(AccountIDCharge.ToArray(), 1) : (new List <ZY_ChargeList>()); List <ZY_ChargeList> zyChargelistSonW = new List <ZY_ChargeList>(); List <ZY_ChargeList> zyChargelistSonB = new List <ZY_ChargeList>(); //汇总预交金账单 ZY_Account zy_AS = new ZY_Account(); zy_AS.AccountName = "合计"; zy_AS.WTicketFee = zyAccountSonlistCharge.Sum(x => x.WTicketFee); zy_AS.WTicketNum = zyAccountSonlistCharge.Sum(x => x.WTicketNum); zy_AS.BTicketFee = zyAccountSonlistCharge.Sum(x => x.BTicketFee); zy_AS.BTicketNum = zyAccountSonlistCharge.Sum(x => x.BTicketNum); zy_AS.Total_Fee = zyAccountSonlistCharge.Sum(x => x.Total_Fee); zy_AS.Cash_Fee = zyAccountSonlistCharge.Sum(x => x.Cash_Fee); zy_AS.POS_Fee = zyAccountSonlistCharge.Sum(x => x.POS_Fee); zyAccountSonlistCharge.Add(zy_AS); chargeAllData.ChargeData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyAccountSonlistCharge); for (int i = 0; i < zyChargelistW.Count; i++) { ZY_ChargeList zyChargelistson = zyChargelistW[i]; zyChargelistson.ChargeUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyChargelistson.ChargeCode); zyChargelistSonW.Add(zyChargelistson); } //汇总 ZY_ChargeList zyChargelist1 = new ZY_ChargeList(); zyChargelist1.BillNo = "合计"; zyChargelist1.Total_Fee = zyChargelistSonW.Sum(x => x.Total_Fee); zyChargelistSonW.Add(zyChargelist1); chargeAllData.GoodChargeList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyChargelistSonW); for (int i = 0; i < zyChargelistB.Count; i++) { ZY_ChargeList zyChargelistson = zyChargelistB[i]; zyChargelistson.ChargeUserName = BaseNameFactory.GetName(baseNameType.用户名称, zyChargelistson.ChargeCode); zyChargelistSonB.Add(zyChargelistson); } //汇总 ZY_ChargeList zyChargelist2 = new ZY_ChargeList(); zyChargelist2.BillNo = "合计"; zyChargelist2.Total_Fee = zyChargelistSonB.Sum(x => x.Total_Fee); zyChargelistSonB.Add(zyChargelist2); chargeAllData.BadChargeList = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyChargelistSonB); //汇总结算 ZY_Account zy_ASC = new ZY_Account(); zy_ASC.AccountName = "合计"; zy_ASC.WTicketFee = zyAccountSonlistCost.Sum(x => x.WTicketFee); zy_ASC.WTicketNum = zyAccountSonlistCost.Sum(x => x.WTicketNum); zy_ASC.BTicketFee = zyAccountSonlistCost.Sum(x => x.BTicketFee); zy_ASC.BTicketNum = zyAccountSonlistCost.Sum(x => x.BTicketNum); zy_ASC.Total_Fee = zyAccountSonlistCost.Sum(x => x.Total_Fee); zy_ASC.Cash_Fee = zyAccountSonlistCost.Sum(x => x.Cash_Fee); zy_ASC.POS_Fee = zyAccountSonlistCost.Sum(x => x.POS_Fee); zy_ASC.CostFee = zyAccountSonlistCost.Sum(x => x.CostFee); zy_ASC.FaoverFee = zyAccountSonlistCost.Sum(x => x.FaoverFee); zyAccountSonlistCost.Add(zy_ASC); costAllData.CostData = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyAccountSonlistCost); #endregion }