Ejemplo n.º 1
0
        /// <summary>
        /// 编辑单据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string EditNoticeBill(NoticeBillModel model)
        {
            var filter = Builders <NoticeBillModel> .Filter.Eq("BillNo", model.BillNo);

            var result = MongoDBHelper.NoticeBill.FindOneAndReplace(filter, model);

            return(result != null ? "Success" : "Fail");
        }
Ejemplo n.º 2
0
        public ActionResult NoticeBill(string BillNo = null, string Mode = null, string IsCopy = null)
        {
            NoticeBill             NB_Bl     = new NoticeBill();
            List <NoticeBillModel> modellist = NB_Bl.FindSuitableData("良");
            FeeBillModelRef        model     = new FeeBillModelRef();

            if (!string.IsNullOrEmpty(BillNo))
            {
                //草稿箱功能(暂时还没有)
                if (BillNo.Contains("CK"))
                {
                    //暂时没处理
                }
                //编辑功能
                else if (BillNo.Contains("FT"))
                {
                    NoticeBillModel NoticeModel = NB_Bl.GetBillModel(BillNo);
                    model.ModelString     = Public.JsonSerializeHelper.SerializeToJson(NoticeModel);
                    model.BillNo          = NoticeModel.BillNo;
                    model.PersonInfo      = NoticeModel.PersonInfo;
                    model.Owner           = NoticeModel.Owner;
                    model.WorkNumber      = NoticeModel.WorkNumber;
                    model.Remark          = NoticeModel.Remark;
                    model.TransactionDate = NoticeModel.TransactionDate;
                    if (!string.IsNullOrEmpty(IsCopy))
                    {
                        model.IsCopy = 1;

                        //复制即累加次数
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic.Add("CopyCount", (model.CopyCount + 1).ToString());
                        var status = NB_Bl.PublicEditMethod(model.BillNo, dic);
                    }
                }
            }
            model.PageName   = "Notice";
            model.CommitType = CommitType.付款通知书;
            return(View(model));
        }
Ejemplo n.º 3
0
        public string CreateNoticeBill(NoticeBillModel postbill)
        {
            this.Request.Url.AbsoluteUri.ToString();

            string result = "Fail";

            //检查
            if (string.IsNullOrEmpty(postbill.COST_ACCOUNT))
            {
                result = "成本中心为空";
                return(result);
            }

            if (postbill.Items == null || postbill.Items.Count < 1)
            {
                result = "缺少报销项";
                return(result);
            }
            else
            {
                postbill.TotalMoney = postbill.Items.Sum(all => all.money) + postbill.Items.Sum(all => all.taxmoney);
            }
            if (postbill.Photos == null || postbill.Photos.Count < 1)
            {
                result = "缺少发票照片";
                return(result);
            }
            if (postbill.ProviderInfo == null || string.IsNullOrEmpty(postbill.ProviderInfo.BankName) || string.IsNullOrEmpty(postbill.ProviderInfo.BankNo) || string.IsNullOrEmpty(postbill.ProviderInfo.ProviderName))
            {
                result = "供应商信息缺失";
                return(result);
            }

            int Grade = GetSubjectCode(postbill.PersonInfo.CompanyCode, postbill.ProviderInfo.ProviderName);

            if (Grade != 3)
            {
                //验证支行的准确性
                var ResultInfo = GetSubbranchBankCode(postbill.ProviderInfo.BankName);
                if (string.IsNullOrEmpty(ResultInfo))
                {
                    result = "支行数据错误,输入关键地名选择提示支行勿手工录入";
                    return(result);
                }
                postbill.ProviderInfo.SubbranchBankCode = ResultInfo;
            }

            foreach (var item in postbill.Items)
            {
                var value = DbContext.FEE_ACCOUNT.Where(c => c.NAME == item.name || c.OLDNAME == item.name).Select(c => c.IS_MARKET).FirstOrDefault();
                if (value == null)
                {
                    item.IsMarket = 0;
                }
                else
                {
                    item.IsMarket = Convert.ToInt32(item.IsMarket);
                }
            }

            var obj = GetBrandFromCosterCenterNew(postbill.PersonInfo.CostCenter);

            if (postbill.PersonInfo.IsHeadOffice == 0)
            {
                var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postbill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                if (DicModel != null)
                {
                    if (DicModel.PARTBRAND == 1)  //分品牌
                    {
                        if (postbill.PersonInfo.Brand == null || postbill.PersonInfo.Brand.Count < 1)
                        {
                            result = "记账品牌至少选择一项!";
                            return(result);
                        }
                        int brandcount = 0;
                        foreach (var item in postbill.PersonInfo.Brand)
                        {
                            if (DicModel.BRANDLIST.Contains(item))
                            {
                                brandcount++;
                            }
                        }
                        if (brandcount >= 2)
                        {
                            result = DicModel.BRANDLIST + "只能选择一项!";
                            return(result);
                        }
                    }
                }

                //增加店柜品牌属性
                if (!string.IsNullOrEmpty(postbill.PersonInfo.ShopCode))
                {
                    postbill.ShopLogo = DbContext.SHOP.Where(c => c.CODE == postbill.PersonInfo.ShopCode).Select(x => x.SHOPLOGO).FirstOrDefault();
                }
            }
            try
            {
                SpecialAttribute Spe = new SpecialAttribute()
                {
                    Funds = postbill.SpecialAttribute.Funds, Agent = postbill.SpecialAttribute.Agent, Check = postbill.SpecialAttribute.Check
                };

                var lable = PublicDemand(postbill.PersonInfo.IsHeadOffice, postbill.BillsType, postbill.PersonInfo.DepartmentCode, obj, postbill.Items, Spe, postbill.DepartmentName);


                //PackClass PackString = new PackClass() { Creator = postbill.Creator, BillsType = postbill.BillsType, Brand = postbill.PersonInfo.Brand, CompanyCode = postbill.PersonInfo.CompanyCode, CostCenter = postbill.PersonInfo.CostCenter, Department = postbill.PersonInfo.Department, DepartmentCode = postbill.PersonInfo.DepartmentCode, IsHeadOffice = postbill.PersonInfo.IsHeadOffice, Items = postbill.Items.Select(x => x.name).ToList(), IsUrgent = postbill.IsUrgent };

                //Dictionary<string, string> dic = new Dictionary<string, string>();

                //string pack = Public.JsonSerializeHelper.SerializeToJson(PackString);

                //dic.Add("pack", pack);

                //string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                Dictionary <string, string> dic = new Dictionary <string, string>();
                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                string MaxNumber = new NoticeBill().GenerateMaxBillNo();



                try
                {
                    string sql = " insert into FEE_BILLNO (BILLNO) values('" + MaxNumber + "')";
                    int    num = DbContext.Database.ExecuteSqlCommand(sql);
                    if (num < 1)
                    {
                        DeleteInvalidBillNo(MaxNumber);
                        result = "服务器繁忙!请重新提交";
                        return(result);
                    }
                }
                catch
                {
                    result = "服务器繁忙!请重新提交";
                    return(result);
                }

                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                string objectID = string.Empty;
                try
                {
                    objectID = proxy.NewWorkFlowInstance(lable.CODE, postbill.Creator, MaxNumber, dicString);
                }
                catch
                {
                    DeleteInvalidBillNo(MaxNumber);
                    result = "服务内部出错,请联系数控中心";
                    return(result);
                }

                CommitPorviderInfo(postbill.ProviderInfo, postbill.Creator);
                postbill.CreateTime = DateTime.Now;
                postbill.Status     = 0;
                postbill.WorkFlowID = objectID;
                postbill.BillsItems = postbill.Items;
                postbill.BillNo     = MaxNumber;
                new NoticeBill().CreateNoticeBill(postbill);
                result = MaxNumber;
            }
            catch
            {
                result = "Fail";
            }
            return(result);
        }
Ejemplo n.º 4
0
        public string EditNoticeBillContent(NoticeBillModel postbill)
        {
            this.Request.Url.AbsoluteUri.ToString();

            string result = "Fail";

            if (string.IsNullOrEmpty(postbill.COST_ACCOUNT))
            {
                result = "成本中心为空";
                return(result);
            }

            if (postbill.Items == null || postbill.Items.Count < 1)
            {
                result = "缺少报销项";
                return(result);
            }
            else
            {
                postbill.TotalMoney = postbill.Items.Sum(all => all.money) + postbill.Items.Sum(all => all.taxmoney);
            }
            if (postbill.Photos == null || postbill.Photos.Count < 1)
            {
                result = "缺少发票照片";
                return(result);
            }
            if (postbill.ProviderInfo == null || string.IsNullOrEmpty(postbill.ProviderInfo.BankName) || string.IsNullOrEmpty(postbill.ProviderInfo.BankNo) || string.IsNullOrEmpty(postbill.ProviderInfo.ProviderName))
            {
                result = "供应商信息缺失";
                return(result);
            }
            int Grade = GetSubjectCode(postbill.PersonInfo.CompanyCode, postbill.ProviderInfo.ProviderName);

            if (Grade != 3)
            {
                //验证支行的准确性
                var ResultInfo = GetSubbranchBankCode(postbill.ProviderInfo.BankName);
                if (string.IsNullOrEmpty(ResultInfo))
                {
                    result = "支行数据错误,输入关键地名选择提示支行勿手工录入";
                    return(result);
                }
                postbill.ProviderInfo.SubbranchBankCode = ResultInfo;
            }

            var obj = GetBrandFromCosterCenterNew(postbill.PersonInfo.CostCenter);

            if (postbill.PersonInfo.IsHeadOffice == 0)
            {
                var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postbill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                if (DicModel != null)
                {
                    if (DicModel.PARTBRAND == 1)  //分品牌
                    {
                        if (postbill.PersonInfo.Brand == null || postbill.PersonInfo.Brand.Count < 1)
                        {
                            result = "记账品牌至少选择一项!";
                            return(result);
                        }
                        int brandcount = 0;
                        foreach (var item in postbill.PersonInfo.Brand)
                        {
                            if (DicModel.BRANDLIST.Contains(item))
                            {
                                brandcount++;
                            }
                        }
                        if (brandcount >= 2)
                        {
                            result = DicModel.BRANDLIST + "只能选择一项!";
                            return(result);
                        }
                    }
                }
            }
            try
            {
                SpecialAttribute Spe = new SpecialAttribute()
                {
                    Funds = postbill.SpecialAttribute.Funds, Agent = postbill.SpecialAttribute.Agent, Check = postbill.SpecialAttribute.Check
                };

                var lable = PublicDemand(postbill.PersonInfo.IsHeadOffice, postbill.BillsType, postbill.PersonInfo.DepartmentCode, obj, postbill.Items, Spe, postbill.DepartmentName);

                Dictionary <string, string> dic = new Dictionary <string, string>();

                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                var oldModel = new NoticeBill().GetBillModel(postbill.BillNo);
                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                string objectID = proxy.NewWorkFlowInstance(lable.CODE, postbill.Creator, oldModel.BillNo, dicString);

                CommitPorviderInfo(postbill.ProviderInfo, postbill.Creator);


                postbill.BillNo         = oldModel.BillNo;
                postbill.Id             = oldModel.Id;
                postbill.WorkFlowID     = objectID;
                postbill.CreateTime     = oldModel.CreateTime;
                postbill.Status         = oldModel.Status;
                postbill.ApprovalPost   = oldModel.ApprovalPost;
                postbill.ApprovalStatus = oldModel.ApprovalStatus;
                postbill.ApprovalTime   = oldModel.ApprovalTime;
                postbill.BillsItems     = postbill.Items;

                string status = new NoticeBill().EditNoticeBill(postbill);
                if (status != "Success")
                {
                    result = "编辑失败";
                    return(result);
                }

                result = "Success";
            }
            catch
            {
                result = "Fail";
            }
            return(result);
        }
Ejemplo n.º 5
0
 public void CreateNoticeBill(NoticeBillModel pNoticeBill)
 {
     //pNoticeBill.BillNo = GenerateMaxBillNo();
     MongoDBHelper.NoticeBill.InsertOne(pNoticeBill);
 }