public static DataTable LoadDispInfo(DateTime beginTime, DateTime endTime, int drugType, bool isRefund, int makerDicId, int isMZZYQY) { try { HIS.DAL.YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; string strWhere = ""; strWhere += "A.RegTime" + oleDb.Between() + "'" + beginTime.ToString() + "'" + oleDb.And() + " '" + endTime.ToString() + "'"; //if (drugType != 0) //{ // if (drugType == 4) drugType = 0;//add zenghao // strWhere += oleDb.And() + "A.TYPEDICID" + oleDb.EuqalTo() + drugType; //} if (makerDicId != 0) { strWhere += oleDb.And() + "A.MAKERDICID" + oleDb.EuqalTo() + makerDicId; } return(dal.LoadDispInfo(strWhere, isMZZYQY, isRefund, drugType)); } catch (Exception error) { throw error; } }
public static DataTable LoadInStoreInfo(DateTime beginTime, DateTime endTime, int deptId, string opType) { HIS.DAL.YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; string strWhere = ""; if (beginTime == endTime) { strWhere += "date(A.RegTime)" + oleDb.Between() + "'" + ((DateTime)beginTime).ToString("yyyy-MM-dd") + " 00:00:00' " + oleDb.And() + " '" + ((DateTime)endTime).ToString("yyyy-MM-dd") + @" 23:59:59'"; } else { strWhere += "date(A.RegTime)" + oleDb.Between() + "'" + beginTime.ToString("yyyy-MM-dd") + " 00:00:00' " + oleDb.And() + " '" + endTime.ToString("yyyy-MM-dd") + "23:59:59 ' "; } if (deptId != 0) { strWhere += oleDb.And() + "A.DeptId" + oleDb.EuqalTo() + deptId.ToString(); } switch (opType) { case "期初入库": strWhere += oleDb.And() + "A.OpType" + oleDb.EuqalTo() + "'" + ConfigManager.OP_YK_FIRSTIN + "'"; break; case "采购入库": strWhere += oleDb.And() + "A.OpType" + oleDb.EuqalTo() + "'" + ConfigManager.OP_YK_INOPTYPE + "'"; break; default: break; } return(dal.LoadInstoreInfo(strWhere)); }
static public void SetManagerDiary(ManagerDiary diray, DateTime beginDate, DateTime endDate) { try { YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; string strWhereCostTime = "a.cost_date between '" + beginDate.Date.ToString("yyyy-MM-dd") + " 00:00:00'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + " 23:59:59'"; string strWherePresTime = "a.presdate between '" + beginDate.Date.ToString("yyyy-MM-dd") + " 00:00:00'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + " 23:59:59'"; string strWhereType = "a.itemcode in ('00','01','02','03')"; diray.Mz_Population = dal.GetMZPopulation(strWhereCostTime); diray.TotalFee_MZ = dal.GetMZTotalFee(strWhereCostTime); diray.TotalFee_MZ_YP = dal.GetMZTotalFee(strWhereCostTime + oleDb.And() + strWhereType); if (diray.Mz_Population != 0) { diray.AverageFee_MZ = diray.TotalFee_MZ / diray.Mz_Population; } int presNum = dal.GetMZPresNum(strWherePresTime); if (presNum != 0) { diray.AveragePresFee_MZ = diray.TotalFee_MZ / presNum; } diray.HSFee = dal.GetMZHSFee(strWhereCostTime); } catch (Exception error) { throw error; } }
static public DataTable LoadZYDeptFee(DateTime beginDate, DateTime endDate) { string strWhereCostTime = "a.costdate between " + "'" + beginDate.Date.ToString("yyyy-MM-dd") + " 00:00:00'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + " 23:59:59'"; YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; return(dal.GetZYDeptFee(strWhereCostTime)); }
/// <summary> /// 加载盘点明细信息 /// </summary> /// <param name="auditNo">盘审单号</param> /// <param name="deptId">部门ID</param> /// <param name="opType">业务类型</param> /// <param name="drugType">药品类型</param> /// <param name="makerDicId">药品编码</param> /// <returns></returns> public static DataTable LoadCheckInfo(int auditNo, int deptId, string deptType, string drugType, int makerDicId) { try { int drugTypeId; string str = ""; switch (drugType) { case "西药": drugTypeId = 1; break; case "中药": drugTypeId = 3; break; case "中成药": drugTypeId = 2; break; case "医用物资": drugTypeId = 4; break; default: drugTypeId = 0; break; } HIS.DAL.YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; str += "f.auditnum" + oleDb.EuqalTo() + auditNo; str += oleDb.And() + "a.deptid" + oleDb.EuqalTo() + deptId; if (drugTypeId != 0) { str += oleDb.And() + "c.typedicid" + oleDb.EuqalTo() + drugTypeId; } if (makerDicId != 0) { str += oleDb.And() + "a.makerdicid" + oleDb.EuqalTo() + makerDicId; } if (deptType == "药房") { return(dal.YF_LoadCheckInfo(str)); } else { return(dal.YK_LoadCheckInfo(str)); } } catch (Exception error) { throw error; } }
static public DataTable GetPatPresOrder(string visitno) { try { string strWhere = "visitno" + oleDb.EuqalTo() + "'" + visitno + "'"; YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; return(dal.GetMZPresOrder(strWhere)); } catch (Exception error) { throw error; } }
static public DataTable LoadZYDocFee(DateTime beginDate, DateTime endDate, string deptCode) { string strWhere = "a.costdate between " + "'" + beginDate.Date.ToString("yyyy-MM-dd") + " 00:00:00'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + " 23:59:59'"; if (deptCode != "") { strWhere += oleDb.And() + "a.presdeptcode" + oleDb.EuqalTo() + "'" + deptCode + "'"; } YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; return(dal.GetZYDocFee(strWhere)); }
static public DataTable LoadZYPatFee(ZY_PatList zyPat) { try { string strWhere = "a.cureno" + oleDb.EuqalTo() + "'" + zyPat.CureNo + "'"; YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; return(dal.GetZYOrderFee(strWhere)); } catch (Exception error) { throw error; } }
/// <summary> /// 查询药品盘点审核单金额信息 /// </summary> /// <param name="beginTime">开始时间</param> /// <param name="endTime">结束时间</param> /// <param name="drugType">药品类型</param> /// <param name="makerDicId">厂家编码</param> /// <returns></returns> public static DataTable LoadCheckBillFee(DateTime beginTime, DateTime endTime, string drugType, int makerDicId) { try { int drugTypeId = 0; switch (drugType) { case "西药": drugTypeId = 1; break; case "中药": drugTypeId = 3; break; case "中成药": drugTypeId = 2; break; case "医用物资": drugTypeId = 4; break; default: drugTypeId = 0; break; } string strWhere = ""; YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; if (beginTime == endTime) { strWhere += "AuditTime" + oleDb.Between() + "'" + ((DateTime)beginTime).ToString("yyyy-MM-dd") + " 00:00:00' " + oleDb.And() + " '" + ((DateTime)endTime).ToString("yyyy-MM-dd") + @" 23:59:59'"; } else { strWhere += "AuditTime" + oleDb.Between() + "'" + beginTime.ToString("yyyy-MM-dd") + " 00:00:00" + "'" + oleDb.And() + " '" + endTime.ToString("yyyy-MM-dd") + " 23:59:59" + "'"; } return(dal.LoadCheckBillFee(strWhere, makerDicId, drugTypeId)); } catch (Exception error) { throw error; } }
static public DataTable LoadItemFeeByDept(DateTime beginDate, DateTime endDate, string itemCode) { try { YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; string strWhere = "cost_date between '" + beginDate.Date.ToString("yyyy-MM-dd") + " 00:00:00'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + " 23:59:59'" + oleDb.And() + "itemcode" + oleDb.EuqalTo() + "'" + itemCode + "'"; return(dal.GetMZItemFeeByDept(strWhere)); } catch (Exception error) { throw error; } }
public static DataTable LoadOutStoreInfo(DateTime beginTime, DateTime endTime, int deptId, string opType) { HIS.DAL.YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; string strWhere = ""; if (beginTime == endTime) { strWhere += "A.RegTime" + oleDb.Between() + "'" + ((DateTime)beginTime).ToString("yyyy-MM-dd") + " 00:00:00' " + oleDb.And() + " '" + ((DateTime)endTime).ToString("yyyy-MM-dd") + @" 23:59:59'"; } else { strWhere += "A.RegTime" + oleDb.Between() + "'" + beginTime.ToString() + "'" + oleDb.And() + " '" + endTime.ToString() + "'"; } if (deptId != 0) { strWhere += oleDb.And() + "A.DeptId" + oleDb.EuqalTo() + deptId.ToString(); } switch (opType) { case "科室出库": strWhere += oleDb.And() + "E.outfee>0" + oleDb.And() + "(A.OpType" + oleDb.EuqalTo() + "'" + ConfigManager.OP_YK_DEPTDRAW + "'" + oleDb.Or() + "A.OpType" + oleDb.EuqalTo() + "'" + ConfigManager.OP_YK_OUTTOYF + "')"; break; case "报损出库": strWhere += oleDb.And() + "A.OpType" + oleDb.EuqalTo() + "'" + ConfigManager.OP_YK_REPORTLOSS + "'"; break; case "药房退库": strWhere += oleDb.And() + "A.OpType" + oleDb.EuqalTo() + "'" + ConfigManager.OP_YK_OUTTOYF + "'" + oleDb.And() + "E.outfee<0"; break; default: break; } return(dal.LoadOutstoreInfo(strWhere)); }
static public void SetManagerDiary(ManagerDiary diray, DateTime beginDate, DateTime endDate) { try { YZCX_Dal dal = new YZCX_Dal(); dal._oleDb = oleDb; string strWhereAdimDATE = "curedate" + oleDb.Between() + "'" + beginDate.Date.ToString("yyyy-MM-dd") + "'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + "'"; string strWhereLeaveDATE = "outdate" + oleDb.Between() + "'" + beginDate.Date.ToString("yyyy-MM-dd") + "'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + "'"; string strWhereCostTime = "a.costdate between " + "'" + beginDate.Date.ToString("yyyy-MM-dd") + " 00:00:00'" + oleDb.And() + "'" + endDate.Date.ToString("yyyy-MM-dd") + " 23:59:59'"; string strWhereType = "a.bigitemtype in ('00','01','02','03')"; diray.AdminNum_ZY = dal.GetZYPopulation(strWhereAdimDATE); diray.LeaveNum_ZY = dal.GetZYPopulation(strWhereLeaveDATE); diray.AtNum_ZY = dal.GetZYCurrentNum(); diray.TotalFee_ZY = dal.GetZYTotalFee(strWhereCostTime); diray.TotalFee_ZY_YP = dal.GetZYTotalFee(strWhereCostTime + oleDb.And() + strWhereType); diray.TotalFee = diray.TotalFee_MZ + diray.TotalFee_ZY; diray.HSFee.PrimaryKey = new DataColumn[] { diray.HSFee.Columns["CODE"] }; diray.TatalDays_ZY = dal.GetZYTotalLeaveDays(beginDate, endDate); DataTable zy_HSFee = dal.GetZYHSFee(strWhereCostTime); for (int index = 0; index < zy_HSFee.Rows.Count; index++) { if (zy_HSFee.Rows[index]["CODE"] != DBNull.Value) { string code = zy_HSFee.Rows[index]["CODE"].ToString(); DataRow findRow = diray.HSFee.Rows.Find(code); if (findRow != null) { findRow["TOTALFEE"] = Convert.ToDecimal(findRow["TOTALFEE"]) + Convert.ToDecimal(zy_HSFee.Rows[index]["TOTAL_FEE"]); } else { DataRow newRow = diray.HSFee.NewRow(); newRow["CODE"] = zy_HSFee.Rows[index]["CODE"]; newRow["TOTALFEE"] = zy_HSFee.Rows[index]["TOTAL_FEE"]; newRow["ITEM_NAME"] = zy_HSFee.Rows[index]["ITEM_NAME"]; diray.HSFee.Rows.Add(newRow); } } else { string code = "0"; DataRow findRow = diray.HSFee.Rows.Find(code); if (findRow != null) { findRow["TOTALFEE"] = Convert.ToDecimal(findRow["TOTALFEE"]) + Convert.ToDecimal(zy_HSFee.Rows[index]["TOTAL_FEE"]); } else { DataRow newRow = diray.HSFee.NewRow(); newRow["CODE"] = "0"; newRow["TOTALFEE"] = zy_HSFee.Rows[index]["TOTAL_FEE"]; newRow["ITEM_NAME"] = "未设置核算项目"; diray.HSFee.Rows.Add(newRow); } } } } catch (Exception error) { throw error; } }