Exemplo n.º 1
0
        public ActionResult AddRec()
        {
            string CompanyID = this.CompanyID;
            string SnNum     = WebUtil.GetQueryStringValue <string>("SnNum", string.Empty);

            FinanceBillEntity entity = null;

            if (!SnNum.IsEmpty())
            {
                ITopClient client = new TopClientDefault();
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("CompanyID", CompanyID);
                dic.Add("SnNum", SnNum);
                string result = client.Execute(FinanceBillApiName.FinanceBillApiName_Single, dic);

                if (!result.IsEmpty())
                {
                    DataResult <FinanceBillEntity> dataResult = JsonConvert.DeserializeObject <DataResult <FinanceBillEntity> >(result);
                    entity = dataResult.Result;
                }
            }

            if (entity.IsNull())
            {
                entity                = new FinanceBillEntity();
                entity.CreateTime     = DateTime.Now;
                entity.CreateUser     = this.LoginUser.UserNum;
                entity.CreateUserName = this.LoginUser.UserName;
                entity.LastTime       = DateTime.Now.AddMonths(2);
            }
            entity.FromName = entity.FromName.IsEmpty() ? "公司" : entity.FromName;
            ViewBag.Entity  = entity;

            string CateList = DropDownHelper.GetFinanceCate(entity.CateNum, this.CompanyID);

            ViewBag.CateList = CateList;

            return(View());
        }
Exemplo n.º 2
0
        public ActionResult AddPay()
        {
            string CompanyID = this.CompanyID;
            string SnNum     = WebUtil.GetQueryStringValue <string>("SnNum", string.Empty);
            string BillSnNum = WebUtil.GetQueryStringValue <string>("BillSnNum", string.Empty);

            FinancePayEntity entity = null;

            if (!SnNum.IsEmpty())
            {
                ITopClient client = new TopClientDefault();
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("CompanyID", CompanyID);
                dic.Add("SnNum", SnNum);
                string result = client.Execute(FinancePayApiName.FinancePayApiName_Single, dic);

                if (!result.IsEmpty())
                {
                    DataResult <FinancePayEntity> dataResult = JsonConvert.DeserializeObject <DataResult <FinancePayEntity> >(result);
                    entity = dataResult.Result;
                }
            }

            if (entity.IsNull())
            {
                entity                = new FinancePayEntity();
                entity.CreateTime     = DateTime.Now;
                entity.CreateUser     = this.LoginUser.UserNum;
                entity.CreateUserName = this.LoginUser.UserName;
                entity.PayTime        = DateTime.Now;
            }
            ViewBag.PayTypeList = EnumHelper.GetOptions <EPayType>(entity.PayType);
            entity.BillSnNum    = BillSnNum;
            ViewBag.Entity      = entity;


            //加载应收数据项
            FinanceBillEntity billEnity = null;

            if (!SnNum.IsEmpty())
            {
                ITopClient client = new TopClientDefault();
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("CompanyID", CompanyID);
                dic.Add("SnNum", BillSnNum);
                string result = client.Execute(FinanceBillApiName.FinanceBillApiName_Single, dic);

                if (!result.IsEmpty())
                {
                    DataResult <FinanceBillEntity> dataResult = JsonConvert.DeserializeObject <DataResult <FinanceBillEntity> >(result);
                    billEnity = dataResult.Result;
                }
            }
            if (billEnity.IsNull())
            {
                billEnity                = new FinanceBillEntity();
                billEnity.CreateTime     = DateTime.Now;
                billEnity.CreateUser     = this.LoginUser.UserNum;
                billEnity.CreateUserName = this.LoginUser.UserName;
                billEnity.LastTime       = DateTime.Now.AddMonths(2);
            }
            ViewBag.BillEntity = billEnity;

            return(View());
        }