//取消结算 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); } }
public FrmTicketManage() { InitializeComponent(); base.HIS_DoubleClick += new lvPatList_DoubleClickEvent(FrmTicketManage_HIS_DoubleClick); //btSearch_Click(null, null); this.dgCost.AutoGenerateColumns = false; this.dgCost.DataSource = null; this.txtFP.Enabled = false; zyCostMaster = new ZY_CostMaster(); }
public FrmCostController(IFrmCostView _view) { IfrmCostView = _view; _dataSet = new DataSet(); user = IfrmCostView.currentUser; dept = IfrmCostView.currentDept; zyCostMaster = new ZY_CostMaster(); zyPatlist = new ZY_PatList(); LoadINFO(); zyConfig008 = HIS.ZY_BLL.OP_ZYConfigSetting.GetConfigValue("008"); }
public FrmBadTicketManager(string empcode) { InitializeComponent(); EmpCode = empcode; zyCostMaster = new ZY_CostMaster(); this.dgvNow.AutoGenerateColumns = false; this.dgvHistroy.AutoGenerateColumns = false; this.dgvNow.DataSource = zyCostMaster.GetBadTicket(false, EmpCode, null, null); this.dgvHistroy.DataSource = zyCostMaster.GetBadTicket(true, EmpCode, this.dtBdate.Value, this.dteDate.Value); this.tabControl1.SelectedIndex = 0; }
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> /// <param name="Bdate">结算开始时间</param> /// <param name="Edate">结算结束时间</param> /// <returns></returns> public DataTable GetTicketData(DateTime Bdate, DateTime Edate) { try { DataTable dt = null; //List<ZY_CostMaster_Son> zyCostMSL = new List<ZY_CostMaster_Son>(); List <ZY_CostMaster> zyCostML = null; string str = "date(COSTDATE) >='" + Bdate.Date + "' and date(COSTDATE) <='" + Edate.Date + "' order by COSTDATE"; zyCostML = BindEntity <ZY_CostMaster> .CreateInstanceDAL(oleDb).GetListArray(str); if (zyCostML != null) { DataTable dtPatType = BindEntity <object> .CreateInstanceDAL(oleDb, "BASE_PATIENTTYPE").GetList(""); for (int i = 0; i < zyCostML.Count; i++) { zyCostML[i].LoadData(); DataRow[] drs = dtPatType.Select("code = '" + zyCostML[i].PatType + "'"); if (drs.Length != 0) { zyCostML[i].PatType = drs[0]["name"].ToString(); } } ZY_CostMaster zyCostMS = new ZY_CostMaster(oleDb); zyCostMS.TicketCode = "合计"; zyCostMS.Total_Fee = zyCostML.Sum(x => x.Total_Fee); zyCostMS.Deptosit_Fee = zyCostML.Sum(x => x.Deptosit_Fee); zyCostMS.Self_Fee = zyCostML.Sum(x => x.Self_Fee); zyCostMS.Village_Fee = zyCostML.Sum(x => x.Village_Fee); zyCostMS.Favor_Fee = zyCostML.Sum(x => x.Favor_Fee); zyCostMS.Money_Fee = zyCostML.Sum(x => x.Money_Fee); zyCostMS.Pos_Fee = zyCostML.Sum(x => x.Pos_Fee); zyCostML.Add(zyCostMS); dt = HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyCostML); } return(dt); } catch (System.Exception e) { throw new Exception(e.Message); } }
//补打 private void toolAgain_Click(object sender, EventArgs e) { //if (base.zy_PatList == null) return; if (this.dgCost.DataSource == 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; } string value = GWMHIS.BussinessLogicLayer.Forms.DlgInputBoxStatic.InputBox("输入补打的发票号", "补打发票", ""); if (value != null) { int CostMasterID = zyCostMaster.Again_Ticket(zyCostM.CostMasterID, value);// add zenghao if (CostMasterID != 0) { MessageBox.Show("补打发票成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.BindCostData(base.zy_PatList.PatListID, null, null,null); //this.dgCost.CurrentCell. = ((DataTable)dgCost.DataSource).Rows.Count - 1; Print(CostMasterID); } else { MessageBox.Show("补打发票失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
private int CostPat(int costType, FrmCostDiag fcd) { try { ZY_PresOrder zypo = new ZY_PresOrder(); zypo.PatListID = zyPatlist.PatListID; if (zyConfig008 != 0) { DataTable dt1 = zypo.GetNotSendDurgPresDataTable(); if (dt1.Rows.Count > 0) { throw new Exception("该病人还有未发药的费用!"); } } if (costType != 1) { if (costType == 2) { zyPatlist.PatType = "4"; } else if (costType == 3) { zyPatlist.PatType = "5"; } } ZY_CostMaster zy_CostM = new ZY_CostMaster(); zy_CostM.PatID = zyPatlist.PatID; zy_CostM.PatListID = zyPatlist.PatListID; zy_CostM.Ntype = costType; zy_CostM.Discharge_date = XcDate.ServerDateTime.Date; zy_CostM.Discharge_bdate = zyPatlist.CureDate.Date; //入院日期 zy_CostM.Discharge_edate = zyPatlist.OutDate; //出院日期 zy_CostM.TicketNum = zyCostMaster.GetNewTicketNO(XcDate.ServerDateTime); //? zy_CostM.TicketCode = IfrmCostDiagView.tbTicketNO; //fcd.TicketNo.Trim(); zy_CostM.ChargeCode = user.EmployeeID.ToString(); zy_CostM.Ticket_Flag = (int)IfrmCostDiagView.Ptt; zy_CostM.CostDate = XcDate.ServerDateTime; zy_CostM.Record_Flag = 0; //农合结算 //decimal villageFee = HIS.ZY_BLL.OP_CostManage.NccmCheck_CostPat(zy_CostM, base.zy_PatList); //if (villageFee != 0) // Op_PatFee.SetvillageFee(ref patFee, villageFee); zy_CostM.Total_Fee = Convert.ToDecimal(patFee.costFee.ToString("0.00")); zy_CostM.Deptosit_Fee = Convert.ToDecimal(patFee.chargeFee.ToString("0.00")); zy_CostM.Self_Fee = Convert.ToDecimal(patFee.selfFee.ToString("0.00")); zy_CostM.Village_Fee = Convert.ToDecimal(patFee.villageFee.ToString("0.00")); zy_CostM.Favor_Fee = Convert.ToDecimal(patFee.faoverFee.ToString("0.00")); zy_CostM.Pos_Fee = IfrmCostDiagView.tbPos; zy_CostM.Money_Fee = IfrmCostDiagView.tbFee; zy_CostM.Reality_Fee = zy_CostM.Pos_Fee + zy_CostM.Money_Fee;//实收金额=pos金额+现金金额 zy_CostM.Village_Type = 3; if (_patType.Trim() == "01") { zy_CostM.Village_Type = 3; } else if (_patType.Trim() == "02") { zy_CostM.Village_Type = 2; } else if (_patType.Trim() == "03") { zy_CostM.Village_Type = 0; } else if (_patType.Trim() == "04") { zy_CostM.Village_Type = 1; } else if (_patType.Trim() == "05") { zy_CostM.Village_Type = 3; } else if (_patType.Trim() == "06") { zy_CostM.Village_Type = 3; } zy_CostM.PatType = _patType; zy_CostM.WorkUnit = WorkUnit; zy_CostM.WorkUnit_Fee = workUnit_Fee; zy_CostM.NotWorkUnit_Fee = zy_CostM.Village_Fee - workUnit_Fee; zy_CostM.Ration_Fee = Ration_Fee; zy_CostM.MoreRation_Fee = Ration_Fee != 0 ? (Ration_Fee - zy_CostM.Village_Fee) : 0; zy_CostM.SelfDrug_Fee = Convert.ToDecimal(IfrmCostView.selfDrugFee); //TicketNum = zy_CostM.TicketNum;//add zenghao 090209 DataTable dt = zyCostMaster.GetPatBigItemOrderFee(); List <ZY_CostOrder> zy_CostOL = new List <ZY_CostOrder>(); for (int i = 0; i < dt.Rows.Count; i++) { ZY_CostOrder zy_CostO = new ZY_CostOrder(); zy_CostO.PatID = zyPatlist.PatID; zy_CostO.PatListID = zyPatlist.PatListID; zy_CostO.TicketNum = zy_CostM.TicketNum; zy_CostO.TicketCode = zy_CostM.TicketCode; zy_CostO.BigItemCode = dt.Rows[i]["itemtype"].ToString(); zy_CostO.Total_Fee = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[i]["tolal_fee"]).ToString("0.00")); zy_CostOL.Add(zy_CostO); } zyCostMaster.CostPat(zy_CostM, zy_CostOL, zyPatlist); return(zy_CostM.CostMasterID); } catch (Exception err) { throw new Exception(err.Message); } }
public FrmBadTicketManager() { InitializeComponent(); zyCostMaster = new ZY_CostMaster(); }
/// <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); }
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 }