/// <summary> /// 返回未发药的处方 /// </summary> /// <param name="patlistid">病人列表ID</param> /// <returns></returns> public DataTable GetNotSendDurgPresDataTable() { try { IpresDao ipD = DaoFactory.GetObject <IpresDao>(typeof(PresDao)); ipD.oleDb = oleDb; DataTable dt = ipD.GetNotSendDurgPresDataTable(this.PatListID); List <ZY_PresOrder> zyPres = new List <ZY_PresOrder>(); for (int i = 0; i < dt.Rows.Count; i++) { ZY_PresOrder zyp1 = new ZY_PresOrder(); zyp1 = (ZY_PresOrder)HIS.SYSTEM.PubicBaseClasses.ApiFunction.DataTableToObject(dt, i, zyp1); zyp1.Sell_Price = Convert.ToDecimal(zyp1.Sell_Price.ToString("0.00")); zyp1.Tolal_Fee = Convert.ToDecimal(zyp1.Tolal_Fee.ToString("0.00")); zyp1.LoadData(); zyPres.Add(zyp1); } return(HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(zyPres)); } catch (System.Exception e) { throw new Exception(e.Message); } }
public void BackPres(int zypresorderid, ZY_PresOrder zyPresOrder) { try { oleDb.BeginTransaction(); string strWhere = "PRESORDERID =" + zypresorderid; string filedvalue = "RECORD_FLAG = 2"; BindEntity <ZY_PresOrder> .CreateInstanceDAL(oleDb).Update(strWhere, filedvalue); BindEntity <ZY_PresOrder> .CreateInstanceDAL(oleDb).Add(zyPresOrder); oleDb.CommitTransaction(); } catch (System.Exception e) { oleDb.RollbackTransaction(); throw new Exception(e.Message); } }
/// <summary> /// 清零病人操作 /// </summary> /// <param name="PatListID">病人列表ID</param> /// <returns>true成功false失败</returns> public bool ClearPatData(int PatListID) { if (!CheckPatCost(PatListID)) { try { ZY_PresOrder zyP = new ZY_PresOrder(oleDb); zyP.ClearPatPresData(PatListID); } catch { return(false); } return(true); } else { throw new Exception("该病人已经做了结算操作,不能再清零!"); } }
/// <summary> /// 清零病人的所有费用数据 /// </summary> /// <param name="patListID">病人列表ID</param> public void ClearPatPresData(int patListID) { string strWhere = "PATLISTID =" + patListID + " and CHARGE_FLAG = 1"; List <ZY_PresOrder> zy_polist = BindEntity <ZY_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere); List <ZY_PresOrder> zy_polist_x = zy_polist.FindAll(delegate(ZY_PresOrder x) { return(x.OldID == 0); }); List <ZY_PresOrder> zy_polist_y = zy_polist.FindAll(delegate(ZY_PresOrder x) { return(x.OldID > 0); }); List <ZY_PresOrder> zy_polist_z = new List <ZY_PresOrder>(); for (int x = 0; x < zy_polist_x.Count; x++) { for (int y = 0; y < zy_polist_y.Count; y++) { if (zy_polist_x[x].PresOrderID == zy_polist_y[y].OldID) { zy_polist_x[x].Amount = zy_polist_x[x].Amount + zy_polist_y[y].Amount; zy_polist_x[x].Tolal_Fee = zy_polist_x[x].Tolal_Fee + zy_polist_y[y].Tolal_Fee; } } ZY_PresOrder zypresorder = new ZY_PresOrder(); zypresorder = zy_polist_x[x]; zypresorder.OldID = zy_polist_x[x].PresOrderID; zypresorder.PresOrderID = 0; zypresorder.Amount = 0 - zy_polist_x[x].Amount; zypresorder.Tolal_Fee = 0 - zy_polist_x[x].Tolal_Fee; zypresorder.Record_Flag = 1; zypresorder.PassID = 0; zypresorder.CostDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime; if (zypresorder.Amount != 0 && zypresorder.Tolal_Fee != 0) { zy_polist_z.Add(zypresorder); } } BackPres(zy_polist_z); }