예제 #1
0
        protected void ReimEntry_Click(object sender, EventArgs e)
        {
            string reimIdString = this.ddl_ReimList.SelectedValue;
            if (reimIdString == null || reimIdString == "0")
            {
                Javascript.Alert("您未指定报销项,请核对后再完成此操作!", Page);
            }
            else
            {
                int projectId = int.Parse(this.hf_ProjectId.Value);
                int reimId = int.Parse(reimIdString);
                float reimingValue = CommonUtility.ConvertFormatedFloat("{0:F2}", this.tb_ReimValue.Text.Trim());
                DalOperationAboutReimItem dalReimItem = new DalOperationAboutReimItem();
                DalOperationAboutProjectReimRule dalRule = new DalOperationAboutProjectReimRule();

                float reimedValue = dalReimItem.GetReimItemValue(projectId, reimId);

                ProjectReimRule projectRule = dalRule.GetProjectReimRule(projectId, reimId);

                bool isError = false;
                if (projectRule != null)
                {
                    if (reimingValue > projectRule.reimValue)
                    {
                        isError = true;
                        Javascript.Alert("该项目选择的报销项单次最大金额不超过" + projectRule.reimValue+ "元", Page);
                    }
                    else if (reimingValue + reimedValue > projectRule.maxReimValue)
                    {
                        isError = true;
                        Javascript.Alert("该项目选择的报销项最大报销总金额不超过" + projectRule.maxReimValue + "元,当前您已报销了" + reimedValue + "元", Page);
                    }
                }

                if (!isError) {
                    ReimItem reimItem = new ReimItem()
                    {
                        project = new Project() { id = projectId },
                        reim = new Reim() { id = reimId },
                        value = reimingValue,
                        memo = this.ReimEntryMemo.Text.Trim()
                    };

                    dalReimItem.AddReimItem(reimItem);

                    Javascript.Alert("操作成功!", Page);
                    Javascript.RefreshParentWindowReload(Page);
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string projectId = Request["projectId"];
                string reimId = Request["reimId"];
                if (string.IsNullOrWhiteSpace(projectId) || string.IsNullOrWhiteSpace(reimId))
                {
                    Javascript.Alert("您未指定要查看的报销记录!", Page);
                    Javascript.RefreshParentWindowReload(Page);
                }
                else
                {

                    DalOperationAboutReim dalReim = new DalOperationAboutReim();
                    DalOperationAboutProject dalProject = new DalOperationAboutProject();
                    DalOperationAboutReimItem dalReimItem = new DalOperationAboutReimItem();

                    Project project = dalProject.GetProject(int.Parse(projectId.Trim()));
                    Reim reim = dalReim.GetReim(int.Parse(reimId.Trim()));

                    if (project == null || reim == null)
                    {
                        Javascript.Alert("您指定的项目或报销项不存在!", Page);
                        Javascript.RefreshParentWindowReload(Page);
                    }
                    else {

                        this.ReimEntry_ProjectValue.Text = dalReimItem.GetReimItemValue(int.Parse(projectId), 0).ToString();
                        this.ReimEntry_ProjectReimValue.Text = dalReimItem.GetReimItemValue(int.Parse(projectId.Trim()), int.Parse(reimId.Trim())).ToString();

                        UserCookiesInfo userCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
                        string cookieUserNo = userCookiesInfo.userNo;

                        if (project.userNo == cookieUserNo || isAuth(cookieUserNo))
                        {
                            List<ReimItem> reimItems = dalReimItem.GetReimItemsForProjectAndReim(int.Parse(projectId.Trim()), int.Parse(reimId.Trim()));

                            this.ReimEntry_ProjectName.Text = project.name;
                            this.ReimEntry_ReimName.Text = reim.name;
                            if (reimItems == null || reimItems.Count == 0)
                            {
                                this.ReimEntry_ReimItemList.ShowFooter = true;
                            }
                            else
                            {
                                this.ReimEntry_ReimItemList.DataSource = reimItems;
                                this.ReimEntry_ReimItemList.DataBind();
                                this.ReimEntry_ReimItemList.ShowFooter = false;
                            }
                        }
                        else {

                            Javascript.Alert("您无权查看此页面!", Page);
                            Javascript.RefreshParentWindowReload(Page);
                        }
                    }
                }

            }
        }