/// <summary> /// 构造月结报表表头相同部分 /// </summary> /// <returns></returns> private ReportMonthlyHeaderInfo GetMainHeader() { ReportMonthlyHeaderInfo headerInfo = new ReportMonthlyHeaderInfo(); headerInfo.CreateDate = DateTimeHelper.GetServerDateTime2(); headerInfo.Creator = LoginUserInfo.FullName; headerInfo.ReportMonth = DateTimeHelper.GetServerDateTime2().Month; headerInfo.ReportYear = DateTimeHelper.GetServerDateTime2().Year; headerInfo.YearMonth = DateTimeHelper.GetServerDateTime2().ToString("yyyy年MM月"); return(headerInfo); }
private void ExecuteEachWareMonthlyReport() { #region 构造库房结存月报表(单库房) List <WareHouseInfo> wareList = BLLFactory <WareHouse> .Instance.GetAll(); ReportMonthlyHeaderInfo eachWareHeaderInfo = GetMainHeader(); eachWareHeaderInfo.ReportTitle = string.Format("{0}库房结存月报表", DateTimeHelper.GetServerDateTime2().ToString("yyyy年MM月")); eachWareHeaderInfo.ReportType = 2; int headerID = BLLFactory <ReportMonthlyHeader> .Instance.InsertOrUpdate(eachWareHeaderInfo); if (headerID > 0) { worker.ReportProgress(30); int i = 1; //先删除当月月结的数据,防止重复写入 BLLFactory <ReportMonthlyDetail> .Instance.DeleteByHeaderID(headerID); //重新写入记录 foreach (WareHouseInfo wareInfo in wareList) { ReportMonthlyDetailInfo detailInfo = new ReportMonthlyDetailInfo(); detailInfo.Header_ID = headerID; detailInfo.ReportYear = DateTimeHelper.GetServerDateTime2().Year; detailInfo.ReportMonth = DateTimeHelper.GetServerDateTime2().Month; detailInfo.YearMonth = DateTimeHelper.GetServerDateTime2().ToString("yyyy年MM月"); detailInfo.ItemName = wareInfo.Name;//项目名称为库房名称 detailInfo.CurrentCount = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareCount(StatisticValueType.CurrentCount, wareInfo.Name); detailInfo.CurrentInCount = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareCount(StatisticValueType.CurrentInCount, wareInfo.Name); detailInfo.CurrentInMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareMoney(StatisticValueType.CurrentInMoney, wareInfo.Name); detailInfo.CurrentMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareMoney(StatisticValueType.CurrentMoney, wareInfo.Name); detailInfo.CurrentOutCount = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareCount(StatisticValueType.CurrentOutCount, wareInfo.Name); detailInfo.CurrentOutMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareMoney(StatisticValueType.CurrentOutMoney, wareInfo.Name);; detailInfo.LastCount = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareCount(StatisticValueType.LastCount, wareInfo.Name); detailInfo.LastMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetEachWareMoney(StatisticValueType.LastMoney, wareInfo.Name);; BLLFactory <ReportMonthlyDetail> .Instance.Insert(detailInfo); i++; } worker.ReportProgress(40); } #endregion }
private void ExecuteDeptMonthReport() { #region 构造库房部门结存月结报表 CListItem[] deptArray = DictItemUtil.GetDictByDictType("部门"); ReportMonthlyHeaderInfo deptHeaderInfo = GetMainHeader(); deptHeaderInfo.ReportTitle = string.Format("{0}部门结存月报表", DateTime.Now.ToString("yyyy年MM月")); deptHeaderInfo.ReportType = 1; int headerID = BLLFactory <ReportMonthlyHeader> .Instance.InsertOrUpdate(deptHeaderInfo); if (headerID > 0) { worker.ReportProgress(10); int i = 1; //先删除当月月结的数据,防止重复写入 BLLFactory <ReportMonthlyDetail> .Instance.DeleteByHeaderID(headerID); //重新写入记录 foreach (CListItem deptItem in deptArray) { ReportMonthlyDetailInfo detailInfo = new ReportMonthlyDetailInfo(); detailInfo.Header_ID = headerID; detailInfo.ReportYear = DateTime.Now.Year; detailInfo.ReportMonth = DateTime.Now.Month; detailInfo.YearMonth = DateTime.Now.ToString("yyyy年MM月"); detailInfo.ItemName = deptItem.Value;//项目名称为部门名称 detailInfo.CurrentCount = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptCount(StatisticValueType.CurrentCount, deptItem.Value); detailInfo.CurrentInCount = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptCount(StatisticValueType.CurrentInCount, deptItem.Value); detailInfo.CurrentInMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptMoney(StatisticValueType.CurrentInMoney, deptItem.Value); detailInfo.CurrentMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptMoney(StatisticValueType.CurrentMoney, deptItem.Value); detailInfo.CurrentOutCount = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptCount(StatisticValueType.CurrentOutCount, deptItem.Value); detailInfo.CurrentOutMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptMoney(StatisticValueType.CurrentOutMoney, deptItem.Value);; detailInfo.LastCount = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptCount(StatisticValueType.LastCount, deptItem.Value); detailInfo.LastMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetDeptMoney(StatisticValueType.LastMoney, deptItem.Value);; BLLFactory <ReportMonthlyDetail> .Instance.Insert(detailInfo); i++; } worker.ReportProgress(20); } #endregion }
private void ExecuteEachPartCostMonthlyReport() { #region 构造各车间成本月报表 CListItem[] deptArray = DictItemUtil.GetDictByDictType("部门"); CListItem[] itemTypeArray = DictItemUtil.GetDictByDictType("备件类别"); ReportMonthlyHeaderInfo deptCostHeaderInfo = GetMainHeader(); deptCostHeaderInfo.ReportTitle = string.Format("{0}各车间成本月报表", DateTime.Now.ToString("yyyy年MM月")); deptCostHeaderInfo.ReportType = 4; int headerID = BLLFactory <ReportMonthlyHeader> .Instance.InsertOrUpdate(deptCostHeaderInfo); if (headerID > 0) { worker.ReportProgress(70); int i = 1; int j = 1; //先删除当月月结的数据,防止重复写入 BLLFactory <ReportMonthlyCostDetail> .Instance.DeleteByHeaderID(headerID); //重新写入记录 foreach (CListItem deptItem in deptArray) { foreach (CListItem itemType in itemTypeArray) { ReportMonthlyCostDetailInfo detailInfo = new ReportMonthlyCostDetailInfo(); detailInfo.Header_ID = headerID; detailInfo.ReportYear = DateTime.Now.Year; detailInfo.ReportMonth = DateTime.Now.Month; detailInfo.YearMonth = DateTime.Now.ToString("yyyy年MM月"); detailInfo.DeptName = deptItem.Value; detailInfo.ItemType = itemType.Value; detailInfo.TotalMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetPartMonthlyCost(deptItem.Value, itemType.Value, DateTime.Now.Year, DateTime.Now.Month); //detailInfo.ReportCode = "";// BLLFactory <ReportMonthlyCostDetail> .Instance.Insert(detailInfo); j++; } i++; } worker.ReportProgress(90); } #endregion }
private void ExecuteAllWareItemTypeMonthlyReport() { #region 构造所有库房结存月结报表(含备件属类、备件类别分类) CListItem[] itemBigTypeArray = DictItemUtil.GetDictByDictType("备件属类"); CListItem[] itemTypeArray = DictItemUtil.GetDictByDictType("备件类别"); ReportMonthlyHeaderInfo allWareHeaderInfo = GetMainHeader(); allWareHeaderInfo.ReportTitle = string.Format("{0}库房结存月报表", DateTime.Now.ToString("yyyy年MM月")); allWareHeaderInfo.ReportType = 3; int headerID = BLLFactory <ReportMonthlyHeader> .Instance.InsertOrUpdate(allWareHeaderInfo); if (headerID > 0) { worker.ReportProgress(50); int i = 1; //先删除当月月结的数据,防止重复写入 BLLFactory <ReportMonthlyDetail> .Instance.DeleteByHeaderID(headerID); //重新写入记录 foreach (CListItem bigItem in itemBigTypeArray) { ReportMonthlyDetailInfo detailInfo = new ReportMonthlyDetailInfo(); detailInfo.Header_ID = headerID; detailInfo.ReportYear = DateTime.Now.Year; detailInfo.ReportMonth = DateTime.Now.Month; detailInfo.YearMonth = DateTime.Now.ToString("yyyy年MM月"); detailInfo.ItemName = bigItem.Value;//项目名称为部门名称 detailInfo.CurrentCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeCount(StatisticValueType.CurrentCount, bigItem.Value); detailInfo.CurrentInCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeCount(StatisticValueType.CurrentInCount, bigItem.Value); detailInfo.CurrentInMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeMoney(StatisticValueType.CurrentInMoney, bigItem.Value); detailInfo.CurrentMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeMoney(StatisticValueType.CurrentMoney, bigItem.Value); detailInfo.CurrentOutCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeCount(StatisticValueType.CurrentOutCount, bigItem.Value); detailInfo.CurrentOutMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeMoney(StatisticValueType.CurrentOutMoney, bigItem.Value);; detailInfo.LastCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeCount(StatisticValueType.LastCount, bigItem.Value); detailInfo.LastMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemBigTypeMoney(StatisticValueType.LastMoney, bigItem.Value);; detailInfo.ReportCode = "ItemBigType";//备件属类数据用001表示 BLLFactory <ReportMonthlyDetail> .Instance.Insert(detailInfo); i++; } i = 0; foreach (CListItem itemType in itemTypeArray) { ReportMonthlyDetailInfo detailInfo = new ReportMonthlyDetailInfo(); detailInfo.Header_ID = headerID; detailInfo.ReportYear = DateTime.Now.Year; detailInfo.ReportMonth = DateTime.Now.Month; detailInfo.YearMonth = DateTime.Now.ToString("yyyy年MM月"); detailInfo.ItemName = itemType.Value;//项目名称为部门名称 detailInfo.CurrentCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeCount(StatisticValueType.CurrentCount, itemType.Value); detailInfo.CurrentInCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeCount(StatisticValueType.CurrentInCount, itemType.Value); detailInfo.CurrentInMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeMoney(StatisticValueType.CurrentInMoney, itemType.Value); detailInfo.CurrentMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeMoney(StatisticValueType.CurrentMoney, itemType.Value); detailInfo.CurrentOutCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeCount(StatisticValueType.CurrentOutCount, itemType.Value); detailInfo.CurrentOutMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeMoney(StatisticValueType.CurrentOutMoney, itemType.Value);; detailInfo.LastCount = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeCount(StatisticValueType.LastCount, itemType.Value); detailInfo.LastMoney = BLLFactory <ReportMonthlyDetail> .Instance.GetWareItemTypeMoney(StatisticValueType.LastMoney, itemType.Value);; detailInfo.ReportCode = "ItemType";//备件类别数据用002表示 BLLFactory <ReportMonthlyDetail> .Instance.Insert(detailInfo); i++; } worker.ReportProgress(60); } #endregion }