/// <summary> /// 药品平账 /// </summary> /// <param name="deptId">药剂科室ID</param> public override void BalanceAccount(int deptId) { try { //获取对账错误的药品信息 //触发事件 _monthEvent.CurrentState = MonthAccountState.SystemChecking; AccountHandler(_monthEvent); DataTable wrongAccountDt = SystemCheckAccount(deptId); AccountQuery query = AccountFactory.GetQuery(ConfigManager.YK_SYSTEM); IBaseDAL <YP_Account> accountDao = BindEntity <YP_Account> .CreateInstanceDAL(oleDb, BLL.Tables.YK_ACCOUNT); if (wrongAccountDt.Rows.Count > 0) { //触发事件 _monthEvent.CurrentState = MonthAccountState.WriteAdjAccount; AccountHandler(_monthEvent); AdjAccount(deptId, wrongAccountDt, query, accountDao); } //触发事件 _monthEvent.CurrentState = MonthAccountState.Over; AccountHandler(_monthEvent); } catch (Exception error) { if (oleDb.IsInTransaction) { oleDb.RollbackTransaction(); } throw error; } }
/// <summary> /// 写入台帐 /// </summary> /// <param name="billMaster">单据头表信息</param> /// <param name="orderList">单据明细信息</param> /// <param name="storeTable">库存处理后的最新药品库存信息</param> public override void WriteAccount(BillMaster billMaster, List <BillOrder> orderList, Hashtable storeTable) { try { int actYear = 0, actMonth = 0; decimal storeNum; int smallUnit; YP_CheckMaster master = (YP_CheckMaster)billMaster; IBaseDAL <YP_Account> accountDao = BindEntity <YP_Account> .CreateInstanceDAL(oleDb, HIS.BLL.Tables.YF_ACCOUNT); AccountFactory.GetQuery(ConfigManager.YF_SYSTEM).GetAccountTime(master.AuditTime, ref actYear, ref actMonth, master.DeptID); foreach (YP_CheckOrder order in orderList) { if (order.CheckNum != order.FactNum) { storeNum = ((YP_StoreNum)(storeTable[order.MakerDicID])).storeNum; smallUnit = ((YP_StoreNum)(storeTable[order.MakerDicID])).smallUnit; YP_Account account = BuildAccount(billMaster, order, storeNum, actYear, actMonth, smallUnit); ComputeFee(account); accountDao.Add(account); } } } catch (Exception error) { throw error; } }
/// <summary> /// 写入台帐 /// </summary> /// <param name="billMaster">单据头表信息</param> /// <param name="orderList">单据明细信息</param> /// <param name="storeTable">库存处理后的最新药品库存信息</param> public override void WriteAccount(BillMaster billMaster, List <BillOrder> orderList, System.Collections.Hashtable storeTable) { try { int actYear = 0, actMonth = 0; YP_InMaster master = (YP_InMaster)billMaster; IBaseDAL <YP_Account> accountDao = BindEntity <YP_Account> .CreateInstanceDAL(oleDb, HIS.BLL.Tables.YK_ACCOUNT); AccountFactory.GetQuery(ConfigManager.YK_SYSTEM).GetAccountTime(master.AuditTime, ref actYear, ref actMonth, master.DeptID); foreach (YP_InOrder order in orderList) { string queryKey = order.MakerDicID.ToString() + order.BatchNum.ToString(); decimal storeNum = ((YP_StoreNum)(storeTable[queryKey])).storeNum; int smallUnit = ((YP_StoreNum)(storeTable[queryKey])).smallUnit; YP_Account account = BuildAccount(billMaster, order, storeNum, actYear, actMonth, smallUnit); ComputeFee(account); accountDao.Add(account); } } catch (Exception error) { throw error; } }
/// <summary> /// 写入台帐 /// </summary> /// <param name="billMaster">单据头表信息</param> /// <param name="orderList">单据明细信息</param> /// <param name="storeTable">库存处理后的最新药品库存信息</param> public override void WriteAccount(BillMaster billMaster, List <BillOrder> orderList, Hashtable storeTable) { try { int actYear = 0, actMonth = 0; int smallUnit = 0; decimal storeNum = 0; YP_DRMaster master = (YP_DRMaster)billMaster; AccountFactory.GetQuery(ConfigManager.YF_SYSTEM).GetAccountTime(master.OPTime, ref actYear, ref actMonth, master.DeptID); foreach (YP_DROrder order in orderList) { storeNum = ((YP_StoreNum)(storeTable[order.OrderRecipeID])).storeNum; smallUnit = ((YP_StoreNum)(storeTable[order.OrderRecipeID])).smallUnit; YP_Account account = BuildAccount(billMaster, order, storeNum, actYear, actMonth, smallUnit); ComputeFee(account); } } catch (Exception error) { throw error; } }