/// <summary> /// 根据类型获取部门的汇总金额 /// </summary> /// <param name="valueType"></param> /// <returns></returns> public decimal GetDeptMoney(StatisticValueType valueType, string deptName) { decimal result = 0M; string sql = string.Format("Select Sum(Amount) from WM_PurchaseDetail d inner join WM_PurchaseHeader h on d.PurchaseHead_ID = h.ID Where d.Dept='{0}' ", deptName); //if (valueType == StatisticValueType.CurrentMoney) //{ // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", DateTimeHelper.GetServerDateTime2().Year, DateTimeHelper.GetServerDateTime2().Month); //} //else if (valueType == StatisticValueType.CurrentInMoney) //{ // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='入库' ", DateTimeHelper.GetServerDateTime2().Year, DateTimeHelper.GetServerDateTime2().Month); //} //else if (valueType == StatisticValueType.CurrentOutMoney) //{ // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='出库' ", DateTimeHelper.GetServerDateTime2().Year, DateTimeHelper.GetServerDateTime2().Month); //} //else if (valueType == StatisticValueType.LastMoney) //{ // DateTime lastMonth = DateTimeHelper.GetServerDateTime2().AddMonths(-1); // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", lastMonth.Year, lastMonth.Month); //} string value = baseDal.SqlValueList(sql); if (!string.IsNullOrEmpty(value)) { result = Convert.ToDecimal(value); } return(result); }
/// <summary> /// 根据类型获取部门的汇总数量 /// </summary> /// <param name="valueType"></param> /// <returns></returns> public int GetDeptCount(StatisticValueType valueType, string deptName) { int result = 0; string sql = string.Format("Select Sum(Quantity) from WM_PurchaseDetail d inner join WM_PurchaseHeader h on d.PurchaseHead_ID = h.ID Where d.Dept='{0}' ", deptName); if (valueType == StatisticValueType.CurrentCount) { sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", DateTime.Now.Year, DateTime.Now.Month); } else if (valueType == StatisticValueType.CurrentInCount) { sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='入库' ", DateTime.Now.Year, DateTime.Now.Month); } else if (valueType == StatisticValueType.CurrentOutCount) { sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='出库' ", DateTime.Now.Year, DateTime.Now.Month); } else if (valueType == StatisticValueType.LastCount) { DateTime lastMonth = DateTime.Now.AddMonths(-1); sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", lastMonth.Year, lastMonth.Month); } string value = baseDal.SqlValueList(sql); if (!string.IsNullOrEmpty(value)) { result = Convert.ToInt32(value); } return(result); }
/// <summary> /// 根据类型获取所有库房的备件属类的汇总数量 /// </summary> /// <param name="valueType"></param> /// <returns></returns> public int GetWareItemBigTypeCount(StatisticValueType valueType, string itemBigType) { int result = 0; string sql = string.Format("Select Sum(Quantity) from WM_PurchaseDetail d inner join WM_PurchaseHeader h on d.PurchaseHead_ID = h.ID Where ItemBigType='{0}' ", itemBigType); //if (valueType == StatisticValueType.CurrentCount) //{ // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", DateTimeHelper.GetServerDateTime2().Year, DateTimeHelper.GetServerDateTime2().Month); //} //else if (valueType == StatisticValueType.CurrentInCount) //{ // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='入库' ", DateTimeHelper.GetServerDateTime2().Year, DateTimeHelper.GetServerDateTime2().Month); //} //else if (valueType == StatisticValueType.CurrentOutCount) //{ // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='出库' ", DateTimeHelper.GetServerDateTime2().Year, DateTimeHelper.GetServerDateTime2().Month); //} //else if (valueType == StatisticValueType.LastCount) //{ // DateTime lastMonth = DateTimeHelper.GetServerDateTime2().AddMonths(-1); // sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", lastMonth.Year, lastMonth.Month); //} string value = baseDal.SqlValueList(sql); if (!string.IsNullOrEmpty(value)) { result = Convert.ToInt32(value); } return(result); }
/// <summary> /// 根据类型获取所有库房的备件属类的汇总金额 /// </summary> /// <param name="valueType"></param> /// <returns></returns> public decimal GetWareItemBigTypeMoney(StatisticValueType valueType, string itemBigType) { decimal result = 0M; string sql = string.Format("Select Sum(Amount) from WM_PurchaseDetail d inner join WM_PurchaseHeader h on d.PurchaseHead_ID = h.ID Where ItemBigType='{0}' ", itemBigType); if (valueType == StatisticValueType.CurrentMoney) { sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", DateTime.Now.Year, DateTime.Now.Month); } else if (valueType == StatisticValueType.CurrentInMoney) { sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='入库' ", DateTime.Now.Year, DateTime.Now.Month); } else if (valueType == StatisticValueType.CurrentOutMoney) { sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} and h.OperationType='出库' ", DateTime.Now.Year, DateTime.Now.Month); } else if (valueType == StatisticValueType.LastMoney) { DateTime lastMonth = DateTime.Now.AddMonths(-1); sql += string.Format(" AND h.CreateYear={0} and h.CreateMonth={1} ", lastMonth.Year, lastMonth.Month); } string value = baseDal.SqlValueList(sql); if (!string.IsNullOrEmpty(value)) { result = Convert.ToDecimal(value); } return(result); }