Esempio n. 1
0
        public ActionResult GetAllBillNo(string No)
        {
            List <Models.FeeBillModelRef> ModelList = new List <Models.FeeBillModelRef>();

            List <Models.FeeBillModel> list1 = new Marisfrolg.Fee.BLL.FeeBill().GetBillModelByNo(No);

            foreach (var item in list1)
            {
                Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                {
                    BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                        Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                    }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "费用报销单", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin, Status = item.Status
                };
                ModelList.Add(temp);
            }
            List <Models.NoticeBillModel> list2 = new Marisfrolg.Fee.BLL.NoticeBill().GetBillModelByNo(No);

            foreach (var item in list2)
            {
                Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                {
                    BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                        Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                    }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "付款通知书", Remark = item.Remark, CreateTime = item.CreateTime, ProviderName = item.ProviderInfo.ProviderName, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin, Status = item.Status, MissBill = item.MissBill
                };
                ModelList.Add(temp);
            }
            List <Models.BorrowBillModel> list3 = new Marisfrolg.Fee.BLL.BorrowBill().GetBillModelByNo(No);

            foreach (var item in list3)
            {
                Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                {
                    BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                        Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                    }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "借款单", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin, Status = item.Status, SurplusMoney = item.SurplusMoney
                };
                ModelList.Add(temp);
            }
            List <Models.RefundBillModel> list4 = new Marisfrolg.Fee.BLL.RefundBill().GetBillModelByNo(No);

            foreach (var item in list4)
            {
                Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                {
                    BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                        Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                    }, Owner = item.Owner, TotalMoney = item.RealRefundMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "还款单", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin, Status = item.Status
                };
                ModelList.Add(temp);
            }
            ModelList = ModelList.OrderByDescending(c => c.CreateTime).ToList();

            return(Json(ModelList, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        /// <summary>
        ///  根据单号获取实体对象
        /// </summary>
        /// <param name="BillNo">单号</param>
        /// <param name="type">单据类型</param>
        /// <returns></returns>
        public string GetDataFromBillNo(string BillNo, int Type)
        {
            try
            {
                switch (Type)
                {
                //费用报销单
                case 1:
                    Models.FeeBillModel    FeeModel    = new Marisfrolg.Fee.BLL.FeeBill().GetBillModel(BillNo);
                    Models.FeeBillModelRef FeeRefModel = new Models.FeeBillModelRef();
                    FeeRefModel            = FeeModel.MapTo <Models.FeeBillModel, Models.FeeBillModelRef>();
                    FeeRefModel.StringTime = FeeRefModel.CreateTime.ToString("yyyy-MM-dd");
                    FeeRefModel.PageName   = "FeeBill";
                    return(FeeRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(FeeRefModel));

                //付款通知书
                case 2:
                    Models.NoticeBillModel    NoticeModel    = new Marisfrolg.Fee.BLL.NoticeBill().GetBillModel(BillNo);
                    Models.NoticeBillModelRef NoticeRefModel = new Models.NoticeBillModelRef();
                    NoticeRefModel            = NoticeModel.MapTo <Models.NoticeBillModel, Models.NoticeBillModelRef>();
                    NoticeRefModel.StringTime = NoticeModel.CreateTime.ToString("yyyy-MM-dd");
                    NoticeRefModel.PageName   = "Notice";
                    return(NoticeRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(NoticeRefModel));

                //借款单
                case 3:
                    Models.BorrowBillModel    BorrowModel    = new Marisfrolg.Fee.BLL.BorrowBill().GetBillModel(BillNo);
                    Models.BorrowBillModelRef BorrowRefModel = new Models.BorrowBillModelRef();
                    BorrowRefModel            = BorrowModel.MapTo <Models.BorrowBillModel, Models.BorrowBillModelRef>();
                    BorrowRefModel.StringTime = BorrowModel.CreateTime.ToString("yyyy-MM-dd");
                    BorrowRefModel.PageName   = "BorrowBill";
                    return(BorrowRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(BorrowRefModel));

                //还款单
                case 4:
                    Models.RefundBillModel    RefundModel    = new Marisfrolg.Fee.BLL.RefundBill().GetBillModel(BillNo);
                    Models.RefundBillModelRef RefundRefModel = new Models.RefundBillModelRef();
                    RefundRefModel            = RefundModel.MapTo <Models.RefundBillModel, Models.RefundBillModelRef>();
                    RefundRefModel.StringTime = RefundModel.CreateTime.ToString("yyyy-MM-dd");
                    RefundRefModel.PageName   = "RefundBill";
                    RefundRefModel.TotalMoney = RefundModel.RealRefundMoney;
                    return(RefundRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(RefundRefModel));

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.Write("获取列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return("");
        }
Esempio n. 3
0
        /// <summary>
        /// 获取我审批的任务
        /// </summary>
        /// <param name="Type">任务类型</param>
        /// <returns></returns>
        public string GetMyProcessCount(string Type)
        {
            try
            {
                var employee = Marisfrolg.Public.Common.GetEmployeeInfo();

                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                Dictionary <string, WorkFlowEngine.WorkFlowInstance> dic = new Dictionary <string, WorkFlowEngine.WorkFlowInstance>();
                string result = proxy.GetWorkFlowTaskList(employee.EmployeeNo, "", ref dic);
                if (!string.IsNullOrEmpty(result) && dic.Count > 0)
                {
                    List <MongoDB.Bson.ObjectId> Mylist = dic.Select(c => c.Value).Select(c => c._id).ToList();
                    List <string> WorkFlowList          = new List <string>();
                    foreach (var item in Mylist)
                    {
                        WorkFlowList.Add(item.ToString());
                    }

                    switch (Type)
                    {
                    //未审批的费用报销单
                    case "费用报销单":
                        var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        return(FeeModel.Count.ToString());

                    //未审批的付款通知书
                    case "付款通知书":
                        var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        return(NoticeModel.Count.ToString());

                    //未审批的借款单
                    case "借款单":
                        var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        return(BorrowModel.Count.ToString());

                    //未审批的借款单
                    case "还款单":
                        var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        return(RefundModel.Count.ToString());

                    default:
                        break;
                    }
                }
                return("");
            }
            catch (Exception ex)
            {
                WriteLog.WebGuiInLog("获取我审批的任务" + ex.ToString(), "首页控制器GetMyProcessCount", "");
            }
            return("");
        }
Esempio n. 4
0
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="Type">单据类型</param>
        /// <param name="Time">时间</param>
        /// <param name="WFType">单据状态</param>
        /// <param name="CreateTimeParameters1">开始时间</param>
        /// <param name="CreateTimeParameters2">结束时间</param>
        /// <returns></returns>
        public string GetMyBillList(int Type, int BillBelong, string CreateTimeParameters1 = "", string CreateTimeParameters2 = "", string DepartmentCode = "", string CheckStatus = "", string PrintStatus = "", string IsExport = "", string FeeSortList = "", string OverTimeParameters1 = "", string OverTimeParameters2 = "", string ShopCodeList = "", string BillStatus = "")
        {
            List <string> DepartmentList = new List <string>();

            if (!string.IsNullOrEmpty(DepartmentCode))
            {
                DepartmentList = DepartmentCode.Split(',').ToList();
                DepartmentList.Remove("");
            }
            try
            {
                List <Models.FeeBillModelRef> ModelList = new List <Models.FeeBillModelRef>();
                //时间区间控制
                DateTime startTime = new DateTime(1999, 1, 1);
                DateTime endTime   = new DateTime(2999, 1, 1);
                if (!string.IsNullOrEmpty(CreateTimeParameters1))
                {
                    startTime = Convert.ToDateTime(CreateTimeParameters1);
                }
                if (!string.IsNullOrEmpty(CreateTimeParameters2))
                {
                    endTime = Convert.ToDateTime(CreateTimeParameters2);
                    endTime = endTime.AddDays(1).AddSeconds(-1);
                }

                //根据不同的单据类型调用不同的方法取值
                switch (Type)
                {
                //全部
                case 0:
                    List <Models.FeeBillModel> list1 = new Marisfrolg.Fee.BLL.FeeBill().GetBillForPrint(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    foreach (var item in list1)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                            }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "FeeBill", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin
                        };
                        ModelList.Add(temp);
                    }
                    List <Models.NoticeBillModel> list2 = new Marisfrolg.Fee.BLL.NoticeBill().GetBillForPrint(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    foreach (var item in list2)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                            }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "NoticeBill", Remark = item.Remark, CreateTime = item.CreateTime, ProviderName = item.ProviderInfo.ProviderName, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin, MissBill = item.MissBill
                        };
                        ModelList.Add(temp);
                    }
                    List <Models.BorrowBillModel> list3 = new Marisfrolg.Fee.BLL.BorrowBill().GetMyBillList(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    foreach (var item in list3)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                            }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "BorrowBill", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin
                        };
                        ModelList.Add(temp);
                    }
                    List <Models.RefundBillModel> list4 = new Marisfrolg.Fee.BLL.RefundBill().GetBillForPrint(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    foreach (var item in list4)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice, ShopCode = item.PersonInfo.ShopCode
                            }, Owner = item.Owner, TotalMoney = item.RealRefundMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "RefundBill", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin
                        };
                        ModelList.Add(temp);
                    }
                    ModelList = ModelList.OrderByDescending(c => c.CreateTime).ToList();
                    break;

                //费用报销单
                case 1:
                    List <Models.FeeBillModel>    FeeBill     = new Marisfrolg.Fee.BLL.FeeBill().GetBillForPrint(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    List <Models.FeeBillModelRef> FeeBillList = new List <Models.FeeBillModelRef>();
                    foreach (var item in FeeBill)
                    {
                        Models.FeeBillModelRef FeeModel = new Models.FeeBillModelRef();
                        FeeModel            = item.MapTo <Models.FeeBillModel, Models.FeeBillModelRef>();
                        FeeModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        FeeModel.PageName   = "FeeBill";
                        FeeBillList.Add(FeeModel);
                    }
                    ModelList = FeeBillList.OrderByDescending(c => c.CreateTime).ToList();
                    break;

                //付款通知书
                case 2:
                    List <Models.NoticeBillModel> NoticeBill     = new Marisfrolg.Fee.BLL.NoticeBill().GetBillForPrint(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    List <Models.FeeBillModelRef> NoticeBillList = new List <Models.FeeBillModelRef>();
                    foreach (var item in NoticeBill)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice
                            }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "NoticeBill", Remark = item.Remark, CreateTime = item.CreateTime, ProviderName = item.ProviderInfo.ProviderName, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin, MissBill = item.MissBill
                        };
                        NoticeBillList.Add(temp);
                    }
                    ModelList = NoticeBillList.OrderByDescending(c => c.CreateTime).ToList();
                    break;

                //借款单(所有的借款记录,不论是否还清)
                case 3:
                    List <Models.BorrowBillModel> BorrowBill     = new Marisfrolg.Fee.BLL.BorrowBill().GetMyBillList(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    List <Models.FeeBillModelRef> BorrowBillList = new List <Models.FeeBillModelRef>();
                    foreach (var item in BorrowBill)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice
                            }, Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "BorrowBill", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin
                        };
                        BorrowBillList.Add(temp);
                    }
                    ModelList = BorrowBillList.OrderByDescending(c => c.CreateTime).ToList();
                    break;

                //还款单(加载还款记录)
                case 4:
                    List <Models.RefundBillModel> RefundBill     = new Marisfrolg.Fee.BLL.RefundBill().GetBillForPrint(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    List <Models.FeeBillModelRef> RefundBillList = new List <Models.FeeBillModelRef>();
                    foreach (var item in RefundBill)
                    {
                        Models.FeeBillModelRef temp = new Models.FeeBillModelRef()
                        {
                            BillNo = item.BillNo, PersonInfo = new Models.PersonInfo {
                                Brand = item.PersonInfo.Brand, IsHeadOffice = item.PersonInfo.IsHeadOffice
                            }, Owner = item.Owner, TotalMoney = item.RealRefundMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, PageName = "RefundBill", Remark = item.Remark, CreateTime = item.CreateTime, PrintedCount = item.PrintedCount, Items = item.Items, CopyCount = item.CopyCount, RecycleBin = item.RecycleBin
                        };
                        RefundBillList.Add(temp);
                    }
                    ModelList = RefundBillList.OrderByDescending(c => c.CreateTime).ToList();
                    break;

                //借款单(返回审核通过的借款单)
                case 5:
                    List <Models.BorrowBillModel> NewBorrowBill = new Marisfrolg.Fee.BLL.BorrowBill().GetMyBillList(startTime, endTime, BillBelong, DepartmentList, CheckStatus, PrintStatus);
                    NewBorrowBill = NewBorrowBill.Where(c => c.ApprovalStatus == 2).ToList();
                    List <Models.BorrowBillModelRef> NewBorrowBillList = new List <Models.BorrowBillModelRef>();
                    foreach (var item in NewBorrowBill)
                    {
                        Models.BorrowBillModelRef BorrowModel = new Models.BorrowBillModelRef();
                        BorrowModel            = item.MapTo <Models.BorrowBillModel, Models.BorrowBillModelRef>();
                        BorrowModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        NewBorrowBillList.Add(BorrowModel);
                    }
                    return(Public.JsonSerializeHelper.SerializeToJson(NewBorrowBillList.OrderByDescending(c => c.CreateTime)));

                default:
                    break;
                }

                //费用小项的筛选
                if (!string.IsNullOrEmpty(FeeSortList))
                {
                    List <string> FeeList = FeeSortList.Split(',').ToList();
                    FeeList.Remove("");
                    List <decimal> IntList = new List <decimal>();
                    foreach (var item in FeeList)
                    {
                        IntList.Add(Convert.ToDecimal(item));
                    }
                    FeeList = DbContext.FEE_ACCOUNT.Where(c => IntList.Contains(c.ID)).Select(x => x.NAME).ToList();

                    if (ModelList.Count > 0)
                    {
                        List <Models.FeeBillModelRef> DeleteModel = new List <Models.FeeBillModelRef>();

                        foreach (var item in ModelList)
                        {
                            var IsDelete = true;
                            if (item.BillNo.Contains("HK") || item.Items == null || item.Items.Count == 0)
                            {
                                DeleteModel.Add(item);
                            }
                            else
                            {
                                foreach (var Titem in item.Items)
                                {
                                    if (FeeList.Contains(Titem.name))
                                    {
                                        IsDelete = false;
                                        break;
                                    }
                                }
                                if (IsDelete)
                                {
                                    DeleteModel.Add(item);
                                }
                            }
                        }
                        if (DeleteModel.Count > 0)
                        {
                            foreach (var item in DeleteModel)
                            {
                                ModelList.Remove(item);
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(OverTimeParameters1))
                {
                    DateTime time = Convert.ToDateTime(OverTimeParameters1);
                    List <Models.FeeBillModelRef> DeleteModel = new List <Models.FeeBillModelRef>();

                    if (ModelList.Count > 0)
                    {
                        foreach (var item in ModelList)
                        {
                            DateTime apptime = Convert.ToDateTime(item.ApprovalTime);

                            if (time > apptime)
                            {
                                DeleteModel.Add(item);
                            }
                        }
                        if (DeleteModel.Count > 0)
                        {
                            foreach (var item in DeleteModel)
                            {
                                ModelList.Remove(item);
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(OverTimeParameters2))
                {
                    DateTime time = Convert.ToDateTime(OverTimeParameters2);
                    time = time.AddDays(1).AddSeconds(-1);
                    List <Models.FeeBillModelRef> DeleteModel = new List <Models.FeeBillModelRef>();

                    if (ModelList.Count > 0)
                    {
                        foreach (var item in ModelList)
                        {
                            DateTime apptime = Convert.ToDateTime(item.ApprovalTime);

                            if (time < apptime)
                            {
                                DeleteModel.Add(item);
                            }
                        }
                        if (DeleteModel.Count > 0)
                        {
                            foreach (var item in DeleteModel)
                            {
                                ModelList.Remove(item);
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(ShopCodeList))
                {
                    List <string> Newlist = ShopCodeList.Split(',').ToList();
                    Newlist.Remove("");
                    ModelList = ModelList.Where(c => Newlist.Contains(c.PersonInfo.ShopCode)).ToList();
                }


                if (!string.IsNullOrEmpty(BillStatus))
                {
                    int status = Convert.ToInt32(BillStatus);

                    ModelList = ModelList.Where(c => c.PageName == "NoticeBill" && c.MissBill == status).ToList();
                }

                if (IsExport != "1")
                {
                    return(Public.JsonSerializeHelper.SerializeToJson(ModelList));
                }
                else
                {
                    DataTable dt = new DataTable();
                    dt.Columns.Add("单号");
                    dt.Columns.Add("单据类型");
                    dt.Columns.Add("发生品牌");
                    dt.Columns.Add("业务人");
                    dt.Columns.Add("供应商");
                    dt.Columns.Add("发生金额");
                    dt.Columns.Add("创建日期");
                    dt.Columns.Add("办结日期");
                    dt.Columns.Add("审核状态");
                    dt.Columns.Add("备注");

                    if (ModelList.Count > 0)
                    {
                        string ApprovalStatus = "";
                        string BillType       = "";
                        foreach (var item in ModelList)
                        {
                            DataRow row   = dt.NewRow();
                            string  Brand = "";
                            row["单号"] = item.BillNo;
                            if (item.PageName == "FeeBill")
                            {
                                BillType = "费用报销单";
                            }
                            else if (item.PageName == "NoticeBill")
                            {
                                BillType   = "付款通知书";
                                row["供应商"] = item.ProviderName;
                            }
                            else if (item.PageName == "BorrowBill")
                            {
                                BillType = "借款单";
                            }
                            else if (item.PageName == "RefundBill")
                            {
                                BillType = "还款单";
                            }
                            row["单据类型"] = BillType;
                            if (item.PersonInfo.Brand == null || item.PersonInfo.Brand.Count == 0)
                            {
                                Brand = "无记账品牌";
                            }
                            else
                            {
                                foreach (var item1 in item.PersonInfo.Brand)
                                {
                                    Brand += item1 + ",";
                                }
                                Brand = Brand.Remove(Brand.Length - 1);
                            }
                            row["发生品牌"] = Brand;
                            row["业务人"]  = item.Owner;
                            row["发生金额"] = item.TotalMoney;
                            row["创建日期"] = item.CreateTime;
                            row["办结日期"] = item.ApprovalTime == null ? "" : item.ApprovalTime;
                            if (item.ApprovalStatus == 2)
                            {
                                ApprovalStatus = "通过";
                            }
                            else if (item.ApprovalStatus == 3)
                            {
                                ApprovalStatus = "拒绝";
                            }
                            else
                            {
                                ApprovalStatus = item.ApprovalPost + "审核中";
                            }
                            row["审核状态"] = ApprovalStatus;
                            row["备注"]   = item.Remark;
                            dt.Rows.Add(row);
                        }
                    }
                    string Name = ExportExcel(dt, "我的单据");
                    return(Name);
                }
            }
            catch (Exception ex)
            {
                Logger.Write("获取打印列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return("");
        }
Esempio n. 5
0
        /// <summary>
        /// 获取打印列表
        /// </summary>
        /// <param name="Type">单据类型</param>
        /// <param name="Time">时间</param>
        /// <param name="Page">页码数</param>
        /// <returns></returns>
        public string GetPrintList(int Type, int Time, int Page = 1)
        {
            try
            {
                InfoList list = new InfoList();
                list.pageSize = 10;
                int    totalNumber = 0;
                object ModelList   = null;
                //时间区间控制
                DateTime startTime = new DateTime(1999, 1, 1);
                DateTime endTime   = new DateTime(2999, 1, 1);
                //创建日期
                switch (Time)
                {
                //全部
                case 1:
                    break;

                //当天
                case 2:
                    startTime = DateTime.Now.Date;
                    break;

                //本周
                case 3:
                    startTime = DateTime.Now.Date.AddDays(1 - Convert.ToInt32(DateTime.Now.Date.DayOfWeek.ToString("d")));
                    endTime   = DateTime.Now.Date.AddDays(1 - Convert.ToInt32(DateTime.Now.Date.DayOfWeek.ToString("d"))).AddDays(7);
                    break;

                //本月
                case 4:
                    startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                    endTime   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1);
                    break;

                //上月
                case 5:
                    startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1);
                    endTime   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                    break;

                default:
                    break;
                }
                //根据不同的单据类型调用不同的方法取值
                switch (Type)
                {
                //费用报销单
                case 1:
                    List <Models.FeeBillModel>    FeeBill     = new Marisfrolg.Fee.BLL.FeeBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.FeeBillModelRef> FeeBillList = new List <Models.FeeBillModelRef>();
                    foreach (var item in FeeBill)
                    {
                        Models.FeeBillModelRef FeeModel = new Models.FeeBillModelRef();
                        FeeModel            = item.MapTo <Models.FeeBillModel, Models.FeeBillModelRef>();
                        FeeModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        FeeBillList.Add(FeeModel);
                    }
                    ModelList = FeeBillList;
                    break;

                //付款通知书
                case 2:
                    List <Models.NoticeBillModel>    NoticeBill     = new Marisfrolg.Fee.BLL.NoticeBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.NoticeBillModelRef> NoticeBillList = new List <Models.NoticeBillModelRef>();
                    foreach (var item in NoticeBill)
                    {
                        Models.NoticeBillModelRef NoticeModel = new Models.NoticeBillModelRef();
                        NoticeModel            = item.MapTo <Models.NoticeBillModel, Models.NoticeBillModelRef>();
                        NoticeModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        NoticeBillList.Add(NoticeModel);
                    }
                    ModelList = NoticeBillList;
                    break;

                //借款单(所有的借款记录,不论是否还清)
                case 3:
                    List <Models.BorrowBillModel>    BorrowBill     = new Marisfrolg.Fee.BLL.BorrowBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.BorrowBillModelRef> BorrowBillList = new List <Models.BorrowBillModelRef>();
                    foreach (var item in BorrowBill)
                    {
                        Models.BorrowBillModelRef BorrowModel = new Models.BorrowBillModelRef();
                        BorrowModel            = item.MapTo <Models.BorrowBillModel, Models.BorrowBillModelRef>();
                        BorrowModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        BorrowBillList.Add(BorrowModel);
                    }
                    ModelList = BorrowBillList;
                    break;

                //还款单(加载还款记录)
                case 4:
                    List <Models.RefundBillModel>    RefundBill     = new Marisfrolg.Fee.BLL.RefundBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.RefundBillModelRef> RefundBillList = new List <Models.RefundBillModelRef>();
                    foreach (var item in RefundBill)
                    {
                        Models.RefundBillModelRef RefundModel = new Models.RefundBillModelRef();
                        RefundModel            = item.MapTo <Models.RefundBillModel, Models.RefundBillModelRef>();
                        RefundModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        RefundModel.TotalMoney = RefundModel.RealRefundMoney;
                        RefundBillList.Add(RefundModel);
                    }
                    ModelList = RefundBillList;
                    break;

                default:
                    break;
                }

                double value = (double)totalNumber / list.pageSize;
                list.totalPages  = Math.Ceiling(value);
                list.currentPage = Page;
                list.info        = ModelList;
                return(Public.JsonSerializeHelper.SerializeToJson(list));
            }
            catch (Exception ex)
            {
                Logger.Write("获取打印列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return("");
        }
Esempio n. 6
0
        /// <summary>
        /// 获取我审批的任务
        /// </summary>
        /// <param name="Type">任务类型</param>
        /// <returns></returns>
        public string GetMyProcess(string Type)
        {
            try
            {
                var employee = Marisfrolg.Public.Common.GetEmployeeInfo();

                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                Dictionary <string, WorkFlowEngine.WorkFlowInstance> dic = new Dictionary <string, WorkFlowEngine.WorkFlowInstance>();
                string result = proxy.GetWorkFlowTaskList(employee.EmployeeNo, "", ref dic);
                if (!string.IsNullOrEmpty(result) && dic.Count > 0)
                {
                    List <MongoDB.Bson.ObjectId> Mylist = dic.Select(c => c.Value).Select(c => c._id).ToList();
                    List <string> WorkFlowList          = new List <string>();
                    foreach (var item in Mylist)
                    {
                        WorkFlowList.Add(item.ToString());
                    }

                    switch (Type)
                    {
                    //未审批的费用报销单
                    case "费用报销单":
                        var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.FeeBillModelRef> RefList = new List <Models.FeeBillModelRef>();
                        foreach (var item in FeeModel)
                        {
                            Marisfrolg.Fee.Models.FeeBillModelRef RefModel = new Models.FeeBillModelRef();
                            RefModel = item.MapTo <FeeBillModel, FeeBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            RefList.Add(RefModel);
                        }
                        return(RefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(RefList));

                    //未审批的付款通知书
                    case "付款通知书":
                        var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.NoticeBillModelRef> NoticeRefList = new List <Models.NoticeBillModelRef>();
                        foreach (var item in NoticeModel)
                        {
                            Marisfrolg.Fee.Models.NoticeBillModelRef RefModel = new Models.NoticeBillModelRef();
                            RefModel = item.MapTo <NoticeBillModel, NoticeBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            NoticeRefList.Add(RefModel);
                        }
                        return(NoticeRefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(NoticeRefList));

                    //未审批的借款单
                    case "借款单":
                        var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.BorrowBillModelRef> BorrowRefList = new List <Models.BorrowBillModelRef>();
                        foreach (var item in BorrowModel)
                        {
                            Marisfrolg.Fee.Models.BorrowBillModelRef RefModel = new Models.BorrowBillModelRef();
                            RefModel = item.MapTo <BorrowBillModel, BorrowBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            BorrowRefList.Add(RefModel);
                        }
                        return(BorrowRefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(BorrowRefList));

                    //未审批的借款单
                    case "还款单":
                        var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.RefundBillModelRef> RefundRefList = new List <Models.RefundBillModelRef>();
                        foreach (var item in RefundModel)
                        {
                            Marisfrolg.Fee.Models.RefundBillModelRef RefModel = new Models.RefundBillModelRef();
                            RefModel = item.MapTo <RefundBillModel, RefundBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            RefModel.TotalMoney   = RefModel.RealRefundMoney;
                            RefundRefList.Add(RefModel);
                        }
                        return(RefundRefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(RefundRefList));

                    default:
                        break;
                    }
                }
                return("");
            }
            catch (Exception ex)
            {
                WriteLog.WebGuiInLog("获取我审批的任务" + ex.ToString(), "首页控制器GetMyProcess", "");
            }
            return("");
        }
Esempio n. 7
0
        /// <summary>
        /// 获取我审批过的单据
        /// </summary>
        /// <param name="Type">单据类型</param>
        /// <param name="Time">时间</param>
        /// <param name="EmployeeNo">工号</param>
        /// <returns></returns>
        public object GetApprovalData(int Type, int Time, string EmployeeNo, string departmentID, string StartTime, string EndTime)
        {
            try
            {
                var TempTime1 = DateTime.Now.Date;
                var TempTime2 = DateTime.Now.Date;
                if (Time == 6)
                {
                    TempTime1 = StartTime == "" ? new DateTime(1999, 1, 1) : Convert.ToDateTime(StartTime);
                    TempTime2 = EndTime == "" ? new DateTime(2999, 1, 1) : Convert.ToDateTime(EndTime);
                }
                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                List <WorkFlowInstance>     dic   = new List <WorkFlowInstance>();
                string objectID = proxy.GetWorkFlowListByUserId(EmployeeNo, TempTime1, TempTime2, ref dic);

                if (!string.IsNullOrEmpty(objectID) && dic.Count > 0)
                {
                    List <TempTime> Mylist = new List <TempTime>();
                    foreach (var item in dic)
                    {
                        TempTime Tmp = new TempTime();
                        Tmp.Id = item._id;
                        if (item.Assignments == null)
                        {
                            item.Assignments = new List <Assignment>();
                        }
                        var model = item.Assignments.Where(c => (c.Keyword == 12002 || c.Keyword == 12003 || c.Keyword == 12005) && c.UserCode == EmployeeNo).ToList();
                        if (model != null && model.Count > 0)
                        {
                            Tmp.Time = model.Select(c => c.updatetime).LastOrDefault();
                            Mylist.Add(Tmp);
                        }
                    }
                    List <string> WorkFlowList = new List <string>();
                    foreach (var item in Mylist)
                    {
                        WorkFlowList.Add(item.Id.ToString());
                    }

                    switch (Type)
                    {
                    //获取所有单据(不分类型)
                    case 0:
                        List <FeeBillModelRef> AllModel = new List <FeeBillModelRef>();
                        var Temp1 = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        var Temp2 = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        var Temp3 = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        var Temp4 = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        foreach (var item1 in Temp1)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item1.BillNo, PageName = "费用报销单", Creator = item1.Creator, Owner = item1.Owner, TotalMoney = item1.TotalMoney, StringTime = item1.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item1.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item1.PersonInfo.DepartmentCode, Department = item1.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item1.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        foreach (var item2 in Temp2)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item2.BillNo, PageName = "付款通知书", Creator = item2.Creator, Owner = item2.Owner, TotalMoney = item2.TotalMoney, StringTime = item2.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item2.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item2.PersonInfo.DepartmentCode, Department = item2.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item2.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        foreach (var item3 in Temp3)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item3.BillNo, PageName = "借款单", Creator = item3.Creator, Owner = item3.Owner, TotalMoney = item3.TotalMoney, StringTime = item3.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item3.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item3.PersonInfo.DepartmentCode, Department = item3.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item3.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        foreach (var item4 in Temp4)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item4.BillNo, PageName = item4.RefundType.ToUpper() == "CASH" ? "现金还款" : "费用单还款", Creator = item4.Creator, Owner = item4.Owner, TotalMoney = item4.RealRefundMoney, StringTime = item4.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item4.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item4.PersonInfo.DepartmentCode, Department = item4.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item4.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        if (departmentID == "0")
                        {
                            AllModel = AllModel.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            AllModel = AllModel.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }

                        return(AllModel.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的费用报销单
                    case 1:
                        var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.FeeBillModelRef> RefList = new List <Models.FeeBillModelRef>();
                        foreach (var item in FeeModel)
                        {
                            Marisfrolg.Fee.Models.FeeBillModelRef RefModel = new Models.FeeBillModelRef();
                            RefModel = item.MapTo <FeeBillModel, FeeBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = "费用报销单";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            RefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            RefList = RefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            RefList = RefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(RefList.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的付款通知书
                    case 2:
                        var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.NoticeBillModelRef> NoticeRefList = new List <Models.NoticeBillModelRef>();
                        foreach (var item in NoticeModel)
                        {
                            Marisfrolg.Fee.Models.NoticeBillModelRef RefModel = new Models.NoticeBillModelRef();
                            RefModel = item.MapTo <NoticeBillModel, NoticeBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = "付款通知书";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            NoticeRefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            NoticeRefList = NoticeRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            NoticeRefList = NoticeRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(NoticeRefList.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的借款单
                    case 3:
                        var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.BorrowBillModelRef> BorrowRefList = new List <Models.BorrowBillModelRef>();
                        foreach (var item in BorrowModel)
                        {
                            Marisfrolg.Fee.Models.BorrowBillModelRef RefModel = new Models.BorrowBillModelRef();
                            RefModel = item.MapTo <BorrowBillModel, BorrowBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = "借款单";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            BorrowRefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            BorrowRefList = BorrowRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            BorrowRefList = BorrowRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(BorrowRefList.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的借款单
                    case 4:
                        var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.RefundBillModelRef> RefundRefList = new List <Models.RefundBillModelRef>();
                        foreach (var item in RefundModel)
                        {
                            Marisfrolg.Fee.Models.RefundBillModelRef RefModel = new Models.RefundBillModelRef();
                            RefModel = item.MapTo <RefundBillModel, RefundBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.TotalMoney  = RefModel.RealRefundMoney;
                            RefModel.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = RefModel.RefundType.ToUpper() == "CASH" ? "现金还款" : "费用单还款";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            RefundRefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            RefundRefList = RefundRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            RefundRefList = RefundRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(RefundRefList.OrderBy(c => c.ExamineTime).ToList());

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("获取我审批过的单据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return(null);
        }
Esempio n. 8
0
        public string GetMyProcess(int Type, int Time, string TimeValue1 = "", string TimeValue2 = "")
        {
            DateTime startTime = new DateTime(1999, 1, 1);
            DateTime endTime   = new DateTime(2999, 1, 1);

            //创建日期
            switch (Time)
            {
            //全部
            case 1:
                break;

            //当天
            case 2:
                startTime = DateTime.Now.Date;
                break;

            //本周
            case 3:
                startTime = DateTime.Now.Date.AddDays(1 - Convert.ToInt32(DateTime.Now.Date.DayOfWeek.ToString("d")));
                endTime   = DateTime.Now.Date.AddDays(1 - Convert.ToInt32(DateTime.Now.Date.DayOfWeek.ToString("d"))).AddDays(7);
                break;

            //本月
            case 4:
                startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                endTime   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1);
                break;

            //上月
            case 5:
                startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1);
                endTime   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                break;

            //自定义
            case 6:
                startTime = TimeValue1 == "" ? startTime : Convert.ToDateTime(TimeValue1);
                endTime   = TimeValue2 == "" ? endTime : Convert.ToDateTime(TimeValue2);
                break;

            default:
                break;
            }
            try
            {
                var employee = Marisfrolg.Public.Common.GetEmployeeInfo();

                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                Dictionary <string, WorkFlowEngine.WorkFlowInstance> dic = new Dictionary <string, WorkFlowEngine.WorkFlowInstance>();
                string result = proxy.GetWorkFlowTaskList(employee.EmployeeNo, "", ref dic);
                if (!string.IsNullOrEmpty(result) && dic.Count > 0)
                {
                    List <MongoDB.Bson.ObjectId> Mylist = dic.Select(c => c.Value).Select(c => c._id).ToList();
                    List <string> WorkFlowList          = new List <string>();
                    foreach (var item in Mylist)
                    {
                        WorkFlowList.Add(item.ToString());
                    }

                    switch (Type)
                    {
                    case 0:
                        List <FeeBillModelRef> TempData = new List <FeeBillModelRef>();
                        var list1 = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        foreach (var item in list1)
                        {
                            FeeBillModelRef Temp = new FeeBillModelRef()
                            {
                                PersonInfo = new PersonInfo()
                                {
                                    Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop
                                }, BillNo = item.BillNo, PageName = "FeeBill", Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString
                            };
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID);
                            Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();

                            if (Temp.PostString != null)
                            {
                                Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                Temp.CostTime  = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2);
                            }

                            TempData.Add(Temp);
                        }
                        var list2 = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        foreach (var item in list2)
                        {
                            FeeBillModelRef Temp = new FeeBillModelRef()
                            {
                                PersonInfo = new PersonInfo()
                                {
                                    Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop
                                }, BillNo = item.BillNo, PageName = "NoticeBill", Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString
                            };
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID);
                            Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();

                            if (Temp.PostString != null)
                            {
                                Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                Temp.CostTime  = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2);
                            }

                            TempData.Add(Temp);
                        }
                        var list3 = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        foreach (var item in list3)
                        {
                            FeeBillModelRef Temp = new FeeBillModelRef()
                            {
                                PersonInfo = new PersonInfo()
                                {
                                    Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop
                                }, BillNo = item.BillNo, PageName = "BorrowBill", Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString
                            };
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID);
                            Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();

                            if (Temp.PostString != null)
                            {
                                Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                Temp.CostTime  = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2);
                            }

                            TempData.Add(Temp);
                        }
                        var list4 = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        foreach (var item in list4)
                        {
                            FeeBillModelRef Temp = new FeeBillModelRef()
                            {
                                PersonInfo = new PersonInfo()
                                {
                                    Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop
                                }, BillNo = item.BillNo, PageName = "RefundBill", Owner = item.Owner, TotalMoney = item.RealRefundMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString
                            };
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID);
                            Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();


                            if (Temp.PostString != null)
                            {
                                Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                Temp.CostTime  = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2);
                            }

                            TempData.Add(Temp);
                        }
                        TempData = TempData.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList();
                        return(Public.JsonSerializeHelper.SerializeToJson(TempData));

                    //未审批的费用报销单
                    case 1:
                        var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.FeeBillModelRef> RefList = new List <Models.FeeBillModelRef>();
                        foreach (var item in FeeModel)
                        {
                            Marisfrolg.Fee.Models.FeeBillModelRef RefModel = new Models.FeeBillModelRef();
                            RefModel = item.MapTo <FeeBillModel, FeeBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            RefModel.StringTime   = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName     = "FeeBill";


                            if (RefModel.PostString != null)
                            {
                                RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                RefModel.CostTime  = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2);
                            }

                            RefList.Add(RefModel);
                        }
                        RefList = RefList.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList();
                        return(Public.JsonSerializeHelper.SerializeToJson(RefList));

                    //未审批的付款通知书
                    case 2:
                        var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.NoticeBillModelRef> NoticeRefList = new List <Models.NoticeBillModelRef>();
                        foreach (var item in NoticeModel)
                        {
                            Marisfrolg.Fee.Models.NoticeBillModelRef RefModel = new Models.NoticeBillModelRef();
                            RefModel = item.MapTo <NoticeBillModel, NoticeBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            RefModel.StringTime   = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName     = "NoticeBill";

                            if (RefModel.PostString != null)
                            {
                                RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                RefModel.CostTime  = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2);
                            }

                            NoticeRefList.Add(RefModel);
                        }
                        NoticeRefList = NoticeRefList.Where(c => c.CreateTime >= startTime && c.CreateTime < endTime).OrderByDescending(c => c.CreateTime).ToList();
                        return(Public.JsonSerializeHelper.SerializeToJson(NoticeRefList));

                    //未审批的借款单
                    case 3:
                        var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.BorrowBillModelRef> BorrowRefList = new List <Models.BorrowBillModelRef>();
                        foreach (var item in BorrowModel)
                        {
                            Marisfrolg.Fee.Models.BorrowBillModelRef RefModel = new Models.BorrowBillModelRef();
                            RefModel = item.MapTo <BorrowBillModel, BorrowBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            RefModel.StringTime   = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName     = "BorrowBill";

                            if (RefModel.PostString != null)
                            {
                                RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                RefModel.CostTime  = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2);
                            }

                            BorrowRefList.Add(RefModel);
                        }
                        BorrowRefList = BorrowRefList.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList();
                        return(Public.JsonSerializeHelper.SerializeToJson(BorrowRefList));

                    //未审批的借款单
                    case 4:
                        var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList);
                        List <Marisfrolg.Fee.Models.RefundBillModelRef> RefundRefList = new List <Models.RefundBillModelRef>();
                        foreach (var item in RefundModel)
                        {
                            Marisfrolg.Fee.Models.RefundBillModelRef RefModel = new Models.RefundBillModelRef();
                            RefModel = item.MapTo <RefundBillModel, RefundBillModelRef>();
                            MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID);
                            RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault();
                            RefModel.TotalMoney   = RefModel.RealRefundMoney;
                            RefModel.StringTime   = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName     = "RefundBill";

                            if (RefModel.PostString != null)
                            {
                                RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time;
                                RefModel.CostTime  = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2);
                            }

                            RefundRefList.Add(RefModel);
                        }
                        RefundRefList = RefundRefList.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList();
                        return(Public.JsonSerializeHelper.SerializeToJson(RefundRefList));

                    default:
                        break;
                    }
                }
                return("[]");
            }
            catch (Exception ex)
            {
                Logger.Write("获取未办结单据列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return("[]");
        }