Esempio n. 1
0
 public override DataTable LoadDrugInfo(int doseId, int typeId, int deptId)
 {
     try
     {
         string strWhere = "";
         if (typeId != 0)
         {
             strWhere += "TypeDicID=" + typeId.ToString();
         }
         if (doseId != -1)
         {
             if (typeId == 0)
             {
                 strWhere += "DoseDicID=" + doseId.ToString();
             }
             else
             {
                 strWhere += " AND DoseDicID=" + doseId.ToString();
             }
         }
         HIS.DAL.YP_Dal ypDal = new YP_Dal();
         ypDal._oleDb = oleDb;
         return(ypDal.YF_GetDrugInfo(strWhere, deptId));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
        /// <summary>
        /// 设置月结日
        /// </summary>
        /// <param name="accountDay">新设置的月结日</param>
        /// <param name="deptId">部门ID</param>
        public static void SetAccountDay(int accountDay, int deptId)
        {
            try
            {
                YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                oleDb.BeginTransaction();
                //获取月结类型的全局参数
                IBaseDAL <YP_CONFIG> appDal = BindEntity <YP_CONFIG> .CreateInstanceDAL(oleDb);

                YP_CONFIG accDay = appDal.GetModel("CODE='008' AND DeptID=" + deptId);
                if (accDay != null)
                {
                    accDay.VALUE = accountDay.ToString();
                    appDal.Update(accDay);
                }
                else
                {
                    throw new Exception("药品系统参数表未进行初始化设置");
                }
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }
        /// <summary>
        /// 删除单据
        /// </summary>
        /// <param name="billMaster">单据头表</param>
        public override void DelBill(BillMaster billMaster)
        {
            try
            {
                YP_OutMaster outStore = (YP_OutMaster)billMaster;
                oleDb.BeginTransaction();
                YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                IBaseDAL <YP_OutMaster> ykmasterDao = BindEntity <YP_OutMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YK_OUTMASTER);

                //删除表头信息
                ykmasterDao.Update(BLL.Tables.yk_outmaster.MASTEROUTSTORAGEID + oleDb.EuqalTo() + outStore.MasterOutStorageID,
                                   BLL.Tables.yf_outmaster.DEL_FLAG + oleDb.EuqalTo() + "1");
                if (outStore.OpType == ConfigManager.OP_YK_OUTTOYF)
                {
                    IBaseDAL <YP_InMaster> yfmasterDao = BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_INMASTER);

                    //删除表头信息
                    YP_InMaster deleteMaster = yfmasterDao.GetModel("BillNum=" + outStore.RelationNum.ToString()
                                                                    + " AND OpType='" + ConfigManager.OP_YF_APPLYIN + "'"
                                                                    + " AND DeptID=" + outStore.OutDeptId.ToString());
                    if (deleteMaster != null)
                    {
                        deleteMaster.Del_Flag = 1;
                        yfmasterDao.Update(deleteMaster);
                    }
                }
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 删除药房期初入库单
        /// </summary>
        /// <param name="billMaster">药房期初入库单表头</param>
        public override void DelBill(BillMaster billMaster)
        {
            try
            {
                YP_InMaster inStore = (YP_InMaster)billMaster;
                oleDb.BeginTransaction();
                IBaseDAL <YP_InMaster> yfInMaster = BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YF_INMASTER);

                yfInMaster.Update(BLL.Tables.yf_inmaster.MASTERINSTORAGEID + oleDb.EuqalTo() + inStore.MasterInStorageID,
                                  BLL.Tables.yf_inmaster.DEL_FLAG + oleDb.EuqalTo() + "1");
                YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                int deleteID = ypDal.YK_Outmaster_GetIDByBillNum(inStore.BillNum, inStore.DeptID);
                //做关联删除
                if (deleteID != -1)
                {
                    IBaseDAL <YP_OutMaster> ykOutMaster = BindEntity <YP_OutMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YK_OUTMASTER);

                    ykOutMaster.Update(BLL.Tables.yk_outmaster.MASTEROUTSTORAGEID + oleDb.EuqalTo() + deleteID,
                                       BLL.Tables.yk_outmaster.DEL_FLAG + oleDb.EuqalTo() + "1");
                }
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }
        /// <summary>
        /// 修改盘点单据
        /// </summary>
        /// <param name="billMaster">盘点单表头</param>
        /// <param name="listOrder">盘点单明细列表</param>
        /// <param name="deptId">药剂科室ID</param>
        public override void UpdateBill(BillMaster billMaster, List <BillOrder> listOrder, long deptId)
        {
            try
            {
                YP_CheckMaster masterCheck = (YP_CheckMaster)billMaster;
                ComputeMasterFee(masterCheck, listOrder);
                oleDb.BeginTransaction();
                //声明操作对象
                HIS.DAL.YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                YP_CheckOrder checkOrder = new YP_CheckOrder();
                BindEntity <HIS.Model.YP_CheckMaster> .CreateInstanceDAL(oleDb, Tables.YF_CHECKMASTER).Update(masterCheck);

                foreach (BillOrder order in listOrder)
                {
                    checkOrder = (YP_CheckOrder)order;
                    BindEntity <HIS.Model.YP_CheckOrder> .CreateInstanceDAL(oleDb, Tables.YF_CHECKORDER).Update(checkOrder);
                }
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 月结对账算法
        /// </summary>
        /// <param name="accountList">月末未结算的各药品最后一笔台帐记录</param>
        protected DataTable CheckAccount(List <YP_Account> accountList)
        {
            DataTable wrongDt    = base.BuildWrongDataTable();
            Hashtable makerdicDt = new Hashtable();

            foreach (YP_Account act in accountList)
            {
                if (!makerdicDt.ContainsKey(act.MakerDicID))
                {
                    makerdicDt.Add(act.MakerDicID, act);
                }
                else if (act.MAccountID > ((YP_Account)(makerdicDt[act.MakerDicID])).MAccountID)
                {
                    makerdicDt[act.MakerDicID] = act;
                }
            }
            foreach (object makerDicId in makerdicDt)
            {
                YP_Dal dal = new YP_Dal();
                dal._oleDb = oleDb;
                YP_Account hashValue = (YP_Account)((DictionaryEntry)makerDicId).Value;
                _makerDicId = hashValue.MakerDicID;
                List <YP_Account> actList    = accountList.FindAll(match);
                decimal           balanceFee = 0;
                decimal           storeFee   = dal.YF_GetDrugFee(hashValue.DeptID, hashValue.MakerDicID);
                decimal           storeNum   = StoreFactory.GetQuery(ConfigManager.YF_SYSTEM).QueryNum(hashValue.MakerDicID,
                                                                                                       hashValue.DeptID);
                foreach (YP_Account act in actList)
                {
                    if (act.AccountType == 0)
                    {
                        balanceFee = act.BalanceFee;
                    }
                }
                foreach (YP_Account act in actList)
                {
                    balanceFee += act.LenderFee;
                    balanceFee -= act.DebitFee;
                }

                if (Convert.ToDecimal(Math.Abs(hashValue.BalanceFee - balanceFee)) > 2 ||
                    Convert.ToDecimal(Math.Abs(hashValue.BalanceFee - storeFee)) > 2 ||
                    Math.Abs(hashValue.OverNum - storeNum) > 0)
                {
                    string  drugName = DrugBaseDataBll.GetDurgName(hashValue.MakerDicID);
                    DataRow errorRow = wrongDt.NewRow();
                    errorRow["CHEMNAME"]      = drugName;
                    errorRow["MAKERDICID"]    = hashValue.MakerDicID;
                    errorRow["WRONGFEE"]      = hashValue.BalanceFee - balanceFee;
                    errorRow["STOREWRONGFEE"] = storeFee - hashValue.BalanceFee;
                    errorRow["WRONGNUM"]      = storeNum - hashValue.OverNum;
                    errorRow["BALANCEFEE"]    = hashValue.BalanceFee;
                    errorRow["BALANCENUM"]    = hashValue.OverNum;
                    errorRow["UNIT"]          = hashValue.LeastUnit;
                    errorRow["UNITNUM"]       = hashValue.UnitNum;
                    wrongDt.Rows.Add(errorRow);
                }
            }
            return(wrongDt);
        }
Esempio n. 7
0
 /// <summary>
 /// 加载药房申请入库单明细
 /// </summary>
 /// <param name="billMaster">单据头表</param>
 /// <returns></returns>
 public override DataTable LoadOrder(BillMaster billMaster)
 {
     try
     {
         if (billMaster != null)
         {
             YP_InMaster inStore  = (YP_InMaster)billMaster;
             string      strWhere = "";
             YP_Dal      ypDal    = new YP_Dal();
             ypDal._oleDb = oleDb;
             if (inStore != null)
             {
                 strWhere  = "A.MasterInStorageID=" + inStore.MasterInStorageID.ToString();
                 strWhere += oleDb.And() + "A.DeptID" + oleDb.EuqalTo() + inStore.DeptID;
             }
             else
             {
                 strWhere = "0<>0";
             }
             return(ypDal.YF_Inorder_GetList(strWhere));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 8
0
 public override DataTable GetDrugForStoreLimit(string queryCode, bool isUpperLimt, int deptId, int typeDicId)
 {
     try
     {
         YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         string strWhere = "";
         if (isUpperLimt)
         {
             strWhere += "CURRENTNUM" + oleDb.GreaterThan() + "UPPERLIMIT";
         }
         else
         {
             strWhere += "CURRENTNUM" + oleDb.LessThan() + "LOWERLIMIT";
         }
         if (typeDicId != 0)
         {
             strWhere += oleDb.And() + "TYPEDICID" + oleDb.EuqalTo() + typeDicId.ToString();
         }
         if (queryCode != "")
         {
             strWhere += oleDb.And() + "PYM like '%" + queryCode.ToString() + "%'";
         }
         return(dal.YK_Store_GetList(strWhere, deptId));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
        /// <summary>
        /// 审核调价单
        /// </summary>
        /// <param name="billMaster">调价单头表</param>
        /// <param name="auditerID">审核人员ID</param>
        /// <param name="auditDeptID">审核科室ID</param>
        public override void AuditBill(BillMaster billMaster, long auditerID, long auditDeptID)
        {
            try
            {
                HIS.DAL.YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                string       strWhere;
                YP_AdjMaster masterAdj    = (YP_AdjMaster)billMaster;
                string       belongSystem = (masterAdj.OpType == ConfigManager.OP_YF_ADJPRICE ? ConfigManager.YF_SYSTEM : ConfigManager.YK_SYSTEM);
                if (ConfigManager.IsChecking((long)masterAdj.DeptID))
                {
                    string deptName = BaseData.GetDeptName(masterAdj.DeptID.ToString());
                    throw new Exception("[" + deptName + "]" + "库房药品正在盘点中....");
                }
                masterAdj.Audit_Flag = 1;
                masterAdj.Over_Flag  = 1;
                BindEntity <HIS.Model.YP_AdjMaster> .CreateInstanceDAL(oleDb).Update(masterAdj);

                strWhere = Tables.yp_adjorder.MASTERIADJPRICED + oleDb.EuqalTo() + masterAdj.MasterAdjPriceID;
                List <YP_AdjOrder> orderList = BindEntity <HIS.Model.YP_AdjOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere);

                List <BillOrder> billOrderList = new List <BillOrder>();
                Hashtable        storeTable    = new Hashtable();
                foreach (YP_AdjOrder adjOrder in orderList)
                {
                    YP_StoreNum yp_StoreNum = new YP_StoreNum();
                    decimal     storeNum    = StoreFactory.GetQuery(belongSystem).QueryNum(adjOrder.MakerDicID, adjOrder.DeptID);
                    adjOrder.Audit_Flag    = 1;
                    adjOrder.AdjNum        = storeNum;
                    yp_StoreNum.makerDicId = adjOrder.MakerDicID;
                    if (belongSystem == ConfigManager.YK_SYSTEM)
                    {
                        yp_StoreNum.smallUnit = adjOrder.LeastUnit;
                    }
                    else
                    {
                        yp_StoreNum.smallUnit = ypDal.Unit_GetSmallUnit(adjOrder.MakerDicID);
                    }
                    yp_StoreNum.storeNum = storeNum;
                    storeTable.Add(yp_StoreNum.makerDicId, yp_StoreNum);
                    //计算调赢/亏金额
                    ComputeAdjFee(adjOrder, belongSystem);
                    billOrderList.Add(adjOrder);
                    BindEntity <HIS.Model.YP_AdjOrder> .CreateInstanceDAL(oleDb).Update(adjOrder);
                }
                //记账
                AccountFactory.GetWriter(masterAdj.OpType).WriteAccount(masterAdj, billOrderList, storeTable);
                //更新药典价格
                foreach (YP_AdjOrder adjOrder in orderList)
                {
                    ChangePrice(adjOrder.NewRetailPrice, true, adjOrder.MakerDicID);
                    ChangePrice(adjOrder.NewTradePrice, false, adjOrder.MakerDicID);
                }
            }
            catch (Exception error)
            {
                throw error;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 按病人信息检索已发药明细信息
        /// </summary>
        /// <param name="invoiceNum">发票号</param>
        /// <returns>已发药明细信息</returns>
        public static DataTable QueryRefRecipeOrder(string invoiceNum)
        {
            HIS.DAL.YP_Dal dal = new YP_Dal();
            dal._oleDb = oleDb;
            string strWhere = "E." + Tables.yf_drorder.INVOICENUM + oleDb.EuqalTo() + invoiceNum;

            return(dal.YF_DispenseOrder_GetList(strWhere));
        }
Esempio n. 11
0
 /// <summary>
 /// 加载采购计划单据明细
 /// </summary>
 /// <param name="billMaster">单据头表</param>
 /// <returns></returns>
 public override DataTable LoadOrder(BillMaster billMaster)
 {
     if (billMaster != null)
     {
         YP_PlanMaster master = (YP_PlanMaster)billMaster;
         if (master.PlanMasterId != -1)
         {
             string strWhere = HIS.BLL.Tables.yk_planmaster.PLANMASTERID + oleDb.EuqalTo()
                               + master.PlanMasterId;
             YP_Dal dal = new YP_Dal();
             dal._oleDb = oleDb;
             return(dal.YK_PlanOrder_GetList(strWhere));
         }
         else
         {
             string strWhere = HIS.BLL.Tables.yk_planmaster.PLANMASTERID + oleDb.EuqalTo()
                               + master.PlanMasterId;
             YP_Dal dal = new YP_Dal();
             dal._oleDb = oleDb;
             DataTable  orderDt        = dal.YK_PlanOrder_GetList(strWhere);
             StoreQuery storeQuery     = StoreFactory.GetQuery(ConfigManager.YK_SYSTEM);
             DataTable  lowerStoreDrug = storeQuery.GetDrugForStoreLimit("", false,
                                                                         (int)master.DeptId, 0);
             for (int index = 0; index < lowerStoreDrug.Rows.Count; index++)
             {
                 DataRow limitRow = lowerStoreDrug.Rows[index];
                 decimal stockNum = Convert.ToDecimal(limitRow["UPPERLIMIT"]) -
                                    Convert.ToDecimal(limitRow["CURRENTNUM"]);
                 if (stockNum > 0)
                 {
                     DataRow newRow = orderDt.NewRow();
                     newRow["MAKERDICID"]   = limitRow["MAKERDICID"];
                     newRow["CHEMNAME"]     = limitRow["CHEMNAME"];
                     newRow["SPEC"]         = limitRow["SPEC"];
                     newRow["PRODUCTNAME"]  = limitRow["PRODUCTNAME"];
                     newRow["PLANMASTERID"] = 0;
                     newRow["PLANORDERID"]  = 0;
                     newRow["RETAILPRICE"]  = limitRow["RETAILPRICE"];
                     newRow["TRADEPRICE"]   = limitRow["TRADEPRICE"];
                     newRow["UNIT"]         = limitRow["LEASTUNIT"];
                     newRow["UNITNAME"]     = limitRow["PACKUNITNAME"];
                     newRow["STOCKNUM"]     = stockNum;
                     newRow["RETAILFEE"]    = stockNum * Convert.ToDecimal(newRow["RETAILPRICE"]);
                     newRow["TRADEFEE"]     = stockNum * Convert.ToDecimal(newRow["TRADEPRICE"]);
                     orderDt.Rows.Add(newRow);
                 }
             }
             return(orderDt);
         }
     }
     else
     {
         return(null);
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 保存采购入库单
        /// </summary>
        /// <param name="billMaster">采购入库单表头</param>
        /// <param name="listOrder">采购入库单明细</param>
        /// <param name="deptId">药剂科室ID</param>
        public override void SaveBill(BillMaster billMaster, List <BillOrder> listOrder, long deptId)
        {
            try
            {
                YP_InMaster masterInstore = (YP_InMaster)billMaster;
                YP_InOrder  inStore       = new YP_InOrder();
                oleDb.BeginTransaction();
                //声明操作对象
                IBaseDAL <YP_InMaster> inMasterDao = BindEntity <YP_InMaster> .CreateInstanceDAL(oleDb, BLL.Tables.YK_INMASTER);

                IBaseDAL <YP_InOrder> inOrderDao = BindEntity <YP_InOrder> .CreateInstanceDAL(oleDb, BLL.Tables.YK_INORDER);

                IBaseDAL <YP_Storage> storeDao = BindEntity <YP_Storage> .CreateInstanceDAL(oleDb, BLL.Tables.YK_STORAGE);

                YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                //获取入库单据号
                if (masterInstore.OpType == ConfigManager.OP_YK_INOPTYPE)
                {
                    masterInstore.BillNum = ypDal.YP_Bill_GetBillNum(ConfigManager.OP_YK_INOPTYPE, deptId).BillNum;
                }
                else if (masterInstore.OpType == ConfigManager.OP_YK_BACKSTORE)
                {
                    masterInstore.BillNum = ypDal.YP_Bill_GetBillNum(ConfigManager.OP_YK_BACKSTORE, deptId).BillNum;
                }
                else
                {
                    masterInstore.BillNum = ypDal.YP_Bill_GetBillNum(ConfigManager.OP_YK_FIRSTIN, deptId).BillNum;
                }
                inMasterDao.Add(masterInstore);
                foreach (BillOrder order in listOrder)
                {
                    //遍历DataTable取出明细记录并设置记录的值
                    inStore = (YP_InOrder)order;
                    //计算入库金额
                    masterInstore.RetailFee  += inStore.RetailFee;
                    masterInstore.StockFee   += inStore.StockFee;
                    masterInstore.TradeFee   += inStore.TradeFee;
                    inStore.MasterInStorageID = masterInstore.MasterInStorageID;
                    inStore.BillNum           = masterInstore.BillNum;
                    //依次添加明细记录
                    inOrderDao.Add(inStore);
                }
                inMasterDao.Update(masterInstore);
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }
Esempio n. 13
0
 public override DataTable GetSupportInfo(DateTime?bTime, DateTime?eTime)
 {
     try
     {
         YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         return(dal.GetSupportIOQuery(bTime, eTime));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 14
0
 public override DataTable LoadStoreInfo(int deptId)
 {
     try
     {
         HIS.DAL.YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         return(dal.YK_Store_GetListForSetLimit(deptId));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 15
0
 public override DataTable LoadDrugInfo(int deptId)
 {
     try
     {
         HIS.DAL.YP_Dal drugDao = new YP_Dal();
         drugDao._oleDb = oleDb;
         return(drugDao.YF_GetDrugInfo("", deptId));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 16
0
 public override DataTable GetCheckDrug(int deptId)
 {
     try
     {
         HIS.DAL.YP_Dal drugDao = new YP_Dal();
         drugDao._oleDb = oleDb;
         return(drugDao.YK_GetCheckDrug("", deptId));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 17
0
 /// <summary>
 /// 判断是否盘点中...
 /// </summary>
 /// <param name="deptId">部门ID</param>
 /// <returns></returns>
 public static bool IsChecking(long deptId)
 {
     try
     {
         YP_Dal ypDal = new YP_Dal();
         ypDal._oleDb = oleDb;
         return(ypDal.Config_IsChecking((int)deptId));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 18
0
 /// <summary>
 /// 按入库单据查询其明细各药品类型汇总金额(出库)
 /// </summary>
 /// <param name="inMasterId">入库单头表ID</param>
 /// <returns></returns>
 static public DataTable LoadTotalFeeByOutOrder(int inMasterId)
 {
     try
     {
         string         strWhere = "a." + BLL.Tables.yf_inorder.MASTERINSTORAGEID + oleDb.EuqalTo() + inMasterId;
         HIS.DAL.YP_Dal ypDal    = new YP_Dal();
         ypDal._oleDb = oleDb;
         return(ypDal.YK_Outorder_GetTotalFee(strWhere));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 19
0
 public override DataTable LoadDrugInfo(int deptId)
 {
     try
     {
         HIS.DAL.YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         string str = "DEPTID" + oleDb.EuqalTo() + deptId;
         return(dal.YK_GetDrugInfo(str));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 20
0
        /// <summary>
        /// 按病人信息检索退药消息
        /// </summary>
        /// <param name="queryPat">病人信息</param>
        /// <param name="deptId">部门ID</param>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns></returns>
        public static DataTable QueryRefRecipeOrder(HIS.Model.ZY_PatList queryPat, int deptId, DateTime beginTime, DateTime endTime)
        {
            string betweenTime = "'" + ((DateTime)beginTime).ToString("yyyy-MM-dd") + " 00:00:00' " +
                                 oleDb.And() + " '" + ((DateTime)endTime).ToString("yyyy-MM-dd") + @" 23:59:59'";

            HIS.DAL.YP_Dal dal = new YP_Dal();
            dal._oleDb = oleDb;
            string strWhere = "A." + Tables.yf_drorder.INPATIENTID + oleDb.EuqalTo() + "'" + queryPat.CureNo.ToString() + "'" +
                              oleDb.And() + "A." + Tables.yf_drorder.DRUGOC_FLAG + oleDb.EuqalTo() + "1" +
                              oleDb.And() + "A." + Tables.yf_drorder.DEPTID + oleDb.EuqalTo() + deptId +
                              oleDb.And() + "E." + Tables.yf_drmaster.OPTIME + oleDb.Between() + betweenTime;

            return(dal.YF_DRorder_GetList(strWhere));
        }
Esempio n. 21
0
 /// <summary>
 /// 加载发退药单据头表
 /// </summary>
 /// <param name="condition">查询条件参数信息</param>
 /// <returns>单据头表</returns>
 public override DataTable LoadMaster(Hashtable condition)
 {
     try
     {
         string strWhere = GetSqlWhere(condition);
         YP_Dal ypDal    = new YP_Dal();
         ypDal._oleDb = oleDb;
         return(ypDal.YF_DispenseMaster_GetList(strWhere));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 22
0
        /// <summary>
        /// 写药房期末台帐
        /// </summary>
        /// <param name="accountHis"></param>
        /// <param name="billNum"></param>
        /// <param name="accountDao"></param>
        /// <param name="deptId"></param>
        protected override void WriteBeginDateAccount(YP_AccountHis accountHis, int billNum,
                                                      IBaseDAL <YP_Account> accountDao, int deptId)
        {
            YP_Dal ypDal = new YP_Dal();

            ypDal._oleDb = oleDb;
            YP_Account account     = new YP_Account();
            DataTable  beginDataDt = ypDal.YF_Storage_GetListForAccount(deptId);

            for (int index = 0; index < beginDataDt.Rows.Count; index++)
            {
                DataRow dRow = beginDataDt.Rows[index];
                if (accountHis.RegTime.Month != 12)
                {
                    account.AccountMonth = accountHis.RegTime.Month + 1;
                    account.AccountYear  = accountHis.RegTime.Year;
                }
                else
                {
                    account.AccountMonth = 1;
                    account.AccountYear++;
                }
                account.Balance_Flag     = 0;
                account.BillNum          = billNum;
                account.DeptID           = deptId;
                account.AccountHistoryID = accountHis.AccountHistoryID;
                account.LeastUnit        = Convert.ToInt32(dRow["UNIT"]);
                account.MakerDicID       = Convert.ToInt32(dRow["MAKERDICID"]);
                account.OpType           = ConfigManager.OP_YF_MONTHACCOUNT;
                account.OrderID          = 0;
                account.RegTime          = accountHis.RegTime;
                account.RetailPrice      = Convert.ToDecimal(dRow["RETAILPRICE"]);
                account.StockPrice       = Convert.ToDecimal(dRow["TRADEPRICE"]);
                account.UnitNum          = Convert.ToInt32(dRow["PUNITNUM"]);
                account.OverNum          = Convert.ToInt32(dRow["CURRENTNUM"]);
                account.BalanceFee       = 0;
                int modNum = (Convert.ToInt32(account.OverNum) % Convert.ToInt32(account.UnitNum));
                if (modNum == 0)
                {
                    account.BalanceFee += (account.OverNum / account.UnitNum) * account.RetailPrice;
                }
                else
                {
                    account.BalanceFee += ((account.OverNum - modNum) / account.UnitNum) * account.RetailPrice;
                    account.BalanceFee += (Convert.ToDecimal(modNum) / Convert.ToDecimal(account.UnitNum)) * account.RetailPrice;
                }
                accountDao.Add(account);
            }
        }
Esempio n. 23
0
 /// <summary>
 /// 加载发/退药单据明细
 /// </summary>
 /// <param name="billMaster">单据头表</param>
 /// <returns></returns>
 public override DataTable LoadOrder(BillMaster billMaster)
 {
     try
     {
         YP_DRMaster queryMaster = (YP_DRMaster)billMaster;
         YP_Dal      ypDal       = new YP_Dal();
         ypDal._oleDb = oleDb;
         string strWhere = "A.MASTERDRUGOCID" + oleDb.EuqalTo() + queryMaster.MasterDrugOCID;
         return(ypDal.YF_DispenseOrder_GetList(strWhere));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 24
0
 /// <summary>
 /// 查询指定药库药品的供应商入库历史记录
 /// </summary>
 /// <param name="makerDicId">药品厂家典ID</param>
 /// <returns></returns>
 public DataTable LoadSupportHis(int makerDicId, int deptId)
 {
     try
     {
         string strWhere = "A.MakerDicID" + oleDb.EuqalTo() + makerDicId + oleDb.And()
                           + "B.DeptID" + oleDb.EuqalTo() + deptId;
         YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         return(dal.YK_SupportHis(strWhere));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 25
0
 public override DataTable LoadDrugInfo(int ykDeptId, int yfDeptId)
 {
     try
     {
         HIS.DAL.YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         string strWhere = "DeptID=" + ykDeptId + " AND ";
         strWhere += "TypeDicID in(select TypeDicID from YP_Dept_Yptype where DeptID=";
         strWhere += yfDeptId.ToString() + ")";
         return(dal.YK_GetDrugInfo(strWhere));
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 26
0
 /// <summary>
 /// 结束盘点状态
 /// </summary>
 /// <param name="deptId">部门ID</param>
 public static void EndCheck(long deptId)
 {
     try
     {
         if (IsChecking(deptId))
         {
             YP_Dal ypDal = new YP_Dal();
             ypDal._oleDb = oleDb;
             ypDal.Config_EndChecking((int)deptId);
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 27
0
        /// <summary>
        /// 保存药库盘点单
        /// </summary>
        /// <param name="billMaster">药库盘点单表头</param>
        /// <param name="listOrder">药库盘点单明细列表</param>
        /// <param name="deptId">药剂科室ID</param>
        public override void SaveBill(BillMaster billMaster, List <BillOrder> listOrder, long deptId)
        {
            try
            {
                YP_CheckMaster masterCheck = (YP_CheckMaster)billMaster;
                ComputeMasterFee(masterCheck, listOrder);
                oleDb.BeginTransaction();
                YP_CheckMaster inDBMaster = BindEntity <YP_CheckMaster> .CreateInstanceDAL(oleDb,
                                                                                           Tables.YK_CHECKMASTER).GetModel(masterCheck.MasterCheckID);

                if (inDBMaster.Del_Flag == 1)
                {
                    throw new Exception("当前单据已经被强制清除,无法保证盘存数量的正确性,请重新录入新的盘点单");
                }
                //声明操作对象
                HIS.DAL.YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                YP_CheckOrder checkOrder = new YP_CheckOrder();
                //获取盘点单据号
                int billNum = (ypDal.YP_Bill_GetBillNum(ConfigManager.OP_YK_CHECK, masterCheck.DeptID)).BillNum;
                masterCheck.BillNum  = billNum;
                masterCheck.Del_Flag = 0;
                BindEntity <HIS.Model.YP_CheckMaster> .CreateInstanceDAL(oleDb, Tables.YK_CHECKMASTER).Update(masterCheck);

                foreach (YP_CheckOrder order in listOrder)
                {
                    //遍历DataTable取出明细记录并设置记录的值
                    checkOrder = (YP_CheckOrder)order;
                    checkOrder.MasterCheckID = masterCheck.MasterCheckID;
                    checkOrder.DeptID        = masterCheck.DeptID;
                    checkOrder.BillNum       = masterCheck.BillNum;
                    checkOrder.BillTime      = masterCheck.RegTime;
                    //依次添加明细记录
                    BindEntity <HIS.Model.YP_CheckOrder> .CreateInstanceDAL(oleDb, Tables.YK_CHECKORDER).Add(checkOrder);
                }
                //更新盘点标识位
                ConfigManager.BeginCheck((long)(masterCheck.DeptID));
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }
Esempio n. 28
0
 public override DataTable QueryOrderAccount(int AccountYear, int AccountMonth, int MakerDicID, int deptId)
 {
     try
     {
         DataTable      orderDt;
         HIS.DAL.YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         string str = Tables.yf_account.ACCOUNTYEAR + oleDb.EuqalTo() + AccountYear + oleDb.And() +
                      Tables.yf_account.ACCOUNTMONTH + oleDb.EuqalTo() + AccountMonth + oleDb.And() +
                      Tables.yf_account.MAKERDICID + oleDb.EuqalTo() + MakerDicID + oleDb.And() +
                      Tables.yf_account.DEPTID + oleDb.EuqalTo() + deptId;
         DateTime currentTime = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
         orderDt = dal.YF_Account_GetList(str);
         return(orderDt);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 29
0
 public override decimal QueryTradeFee(int deptId, int drugType)
 {
     try
     {
         HIS.DAL.YP_Dal dal = new YP_Dal();
         dal._oleDb = oleDb;
         decimal storeFee = dal.YK_Store_GetTradeFee(deptId, drugType);
         if (storeFee < 0)
         {
             return(0);
         }
         else
         {
             return(storeFee);
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Esempio n. 30
0
        /// <summary>
        /// 删除盘点单据
        /// </summary>
        /// <param name="billMaster">盘点单表头</param>
        public override void DelBill(BillMaster billMaster)
        {
            try
            {
                YP_CheckMaster master = (YP_CheckMaster)billMaster;
                oleDb.BeginTransaction();
                HIS.DAL.YP_Dal ypDal = new YP_Dal();
                ypDal._oleDb = oleDb;
                IBaseDAL <YP_CheckMaster> checkMaster = BindEntity <HIS.Model.YP_CheckMaster> .CreateInstanceDAL(oleDb,
                                                                                                                 Tables.YF_CHECKMASTER);

                checkMaster.Update(BLL.Tables.yf_checkmaster.MASTERCHECKID + oleDb.EuqalTo() + master.MasterCheckID,
                                   BLL.Tables.yf_checkmaster.DEL_FLAG + oleDb.EuqalTo() + "1");
                oleDb.CommitTransaction();
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                throw error;
            }
        }