Beispiel #1
0
        //受理通过
        protected void btn_Pass_Click(object sender, EventArgs e)
        {
            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));

            if (model.State != (int)CostReportState.NoAuditing)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            bool isPayBill = false;//是否将票据设置成付款完成

            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model, out isPayBill);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Paying)
            {
                isPayBill = true;
                //已扣款核销
                PayVerification(model);
            }
            model.AuditingMemo = txt_AuditingMemo.Text;
            model.AcceptDate   = DateTime.Now;

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReportBill.Updatelmshop_CostReportBillForPassByReportId(model.ReportId, true);
                    if (isPayBill)
                    {
                        _utility.UpdateFieldByPk("lmShop_CostReportBill", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                    }
                    _costReport.UpdateReport(model);

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
            }
            #endregion
        }
        //作废
        protected void btn_Del_Click(object sender, EventArgs e)
        {
            var reportId       = ((Button)sender).CommandArgument;
            var costReportInfo = _costReport.GetReportByReportId(new Guid(reportId));

            if (!(costReportInfo.State.Equals((int)CostReportState.Auditing) || costReportInfo.State.Equals((int)CostReportState.AuditingNoPass) || (costReportInfo.ReportKind.Equals((int)CostReportKind.Later) && costReportInfo.State.Equals((int)CostReportState.InvoiceNoPass))))
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    var memo = WebControl.RetrunUserAndTime("[【作废申报】:申报作废;]");
                    _costReport.UpdateReport(new Guid(reportId), (int)CostReportState.Cancel, string.Empty, memo, Guid.Empty);

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, new Guid(reportId), costReportInfo.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    RG_Report.Rebind();
                    ts.Complete();
                }
                catch
                {
                    MessageBox.AppendScript(this, "作废申报失败!");
                }
            }
        }
Beispiel #3
0
        protected void Finish(CostReportInfo model)
        {
            decimal realityCost = model.RealityCost;//当是预借款最后一次时,判断金额大小之后,RealityCost的值已经被改变,故此处需要用一个变量提前暂存

            #region 结算账号
            IBankAccounts bankAccounts    = new BankAccounts(GlobalConfig.DB.FromType.Read);
            var           bankAccountInfo = bankAccounts.GetBankAccounts(model.PayBankAccountId);
            string        payBankAccount  = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model, payBankAccount);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model, payBankAccount);
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    _costReport.UpdatePayCostAndExecuteDate(model.ReportId, realityCost);
                    _utility.UpdateFieldByPk("lmShop_CostReportAmount", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                    _utility.UpdateFieldByPk("lmShop_CostReportBill", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                    model.RealityCost = realityCost;
                    string errorMessage;
                    bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                    if (!result)
                    {
                        throw new Exception(errorMessage);
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
        protected void AcceptPass(CostReportInfo model)
        {
            bool isPayBill = false;//是否将票据设置成付款完成

            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model, out isPayBill);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Paying)
            {
                //已扣款核销
                PayVerification(model);
            }
            model.AcceptDate = DateTime.Now;

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReportBill.Updatelmshop_CostReportBillForPassByReportId(model.ReportId, true);
                    if (isPayBill)
                    {
                        _utility.UpdateFieldByPk("lmShop_CostReportBill", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                    }
                    _costReport.UpdateReport(model);
                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
            #endregion
        }
        protected void AuditPass(CostReportInfo model)
        {
            bool execute = false;

            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Paying)
            {
                execute = true;
                //已扣款核销
                PayVerification(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model);
            }
            else if (model.ReportKind == (int)CostReportKind.FeeIncome)
            {
                //费用收入
                FeeIncome(model);
            }

            model.AuditingMan  = Personnel.PersonnelId;
            model.AuditingDate = DateTime.Now;

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    if (execute)
                    {
                        _costReport.UpdatePayCostAndExecuteDate(model.ReportId, model.RealityCost);
                        string errorMessage;
                        bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                        if (!result)
                        {
                            throw new Exception(errorMessage);
                        }
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
        protected void PayAndReceive(CostReportInfo model)
        {
            bool    execute         = false;             //是否执行完成操作
            bool    need            = false;             //是否需要完成
            decimal realityCost     = model.RealityCost; //当是预借款最后一次时,判断金额大小之后,RealityCost的值已经被改变,故此处需要用一个变量提前暂存
            var     bankAccountInfo = _bankAccounts.GetBankAccounts(model.PayBankAccountId);

            #region 结算账号
            string payBankAccount = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            if (model.CostType.Equals(1) || (model.CostType.Equals(2) && (bankAccountInfo != null && !bankAccountInfo.IsFinish)))
            {
                //在申请页面完成
                need = true;
            }
            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model, need, payBankAccount, out execute);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model, need, payBankAccount);
            }
            else if (model.ReportKind == (int)CostReportKind.FeeIncome)
            {
                execute = true;
                //费用收入
                FeeIncome(model, payBankAccount);
            }

            if (bankAccountInfo != null && bankAccountInfo.IsMain)
            {
                model.IsOut = true;
            }
            else
            {
                model.IsOut = false;
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);
                    if (execute || need)
                    {
                        _costReport.UpdatePayCostAndExecuteDate(model.ReportId, realityCost);
                        _utility.UpdateFieldByPk("lmShop_CostReportAmount", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                        _utility.UpdateFieldByPk("lmShop_CostReportBill", "IsPay", new object[] { true }, "ReportId", model.ReportId.ToString());
                        model.RealityCost = realityCost;
                        string errorMessage;
                        bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                        if (!result)
                        {
                            throw new Exception(errorMessage);
                        }
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
Beispiel #7
0
        //审核通过
        protected void btn_Pass_Click(object sender, EventArgs e)
        {
            #region 验证数据
            var errorMsg = CheckData();
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));
            if (model.State != (int)CostReportState.Auditing)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            bool execute = false;
            if (model.ReportKind == (int)CostReportKind.Before)
            {
                //预借款
                BeforeLoan(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Paying)
            {
                execute = true;
                //已扣款核销
                PayVerification(model);
            }
            else if (model.ReportKind == (int)CostReportKind.Later)
            {
                //凭证报销
                VoucherPay(model);
            }
            else if (model.ReportKind == (int)CostReportKind.FeeIncome)
            {
                //费用收入
                FeeIncome(model);
            }

            model.AssumeBranchId = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId  = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId   = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.AuditingMan    = Personnel.PersonnelId;
            model.AuditingDate   = DateTime.Now;
            model.AuditingMemo   = txt_AuditingMemo.Text;

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    if (execute)
                    {
                        _costReport.UpdatePayCostAndExecuteDate(model.ReportId, model.RealityCost);
                        string errorMessage;
                        bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                        if (!result)
                        {
                            throw new Exception(errorMessage);
                        }
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
Beispiel #8
0
        //保存数据
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            #region 60s内禁止重复提交
            if (!_submitController.Enabled)
            {
                MessageBox.AppendScript(this, "alert('程序正在处理中,请稍候...');ParentCloseAndRebind();");
                return;
            }
            #endregion

            #region 验证数据
            var errorMsg = CheckData();
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            #region 赋值
            CostReportInfo model;
            var            reportId = Request.QueryString["ReportId"];
            if (string.IsNullOrEmpty(reportId))//添加
            {
                model = new CostReportInfo {
                    ReportId = Guid.NewGuid()
                };
                EditCostReportModel(model, Personnel);
            }
            else//修改
            {
                model = _costReport.GetReportByReportId(new Guid(reportId));
                if (model.State != (int)CostReportState.Auditing &&
                    model.State != (int)CostReportState.AuditingNoPass)
                {
                    MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                    return;
                }
                EditCostReportModel(model, Personnel);
            }
            #endregion

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    if (string.IsNullOrEmpty(reportId))//添加
                    {
                        string errorMessage;
                        var    result = _costReport.InsertReport(model, out errorMessage);
                        if (!result)
                        {
                            MessageBox.Show(this, "申报失败!" + errorMessage);
                        }
                    }
                    else//修改
                    {
                        _costReport.UpdateReport(model);
                    }

                    //添加日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.Add.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ ParentCloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");

                    #region 60s内禁止重复提交
                    _submitController.Submit();
                    #endregion
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
            }
            #endregion
        }
Beispiel #9
0
        //付款
        protected void btn_Pay_Click(object sender, EventArgs e)
        {
            #region 验证数据
            var errorMsg = CheckData();
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));
            if (model.State != (int)CostReportState.WaitVerify)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            var bankAccountInfo = _bankAccounts.GetBankAccounts(new Guid(rcb_PayBankAccount.SelectedValue));

            #region 结算账号
            string payBankAccount = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            //费用收入(押金)
            FeeIncome(model, payBankAccount);

            #region 额外可修改的项
            UpdateItem(model);
            #endregion

            model.AssumeBranchId   = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId    = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId     = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.PayBankAccountId = string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue) ? Guid.Empty : new Guid(rcb_PayBankAccount.SelectedValue);
            model.AssumeFilialeId  = string.IsNullOrEmpty(ddl_AssumeFiliale.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeFiliale.SelectedValue);
            model.Poundage         = string.IsNullOrEmpty(txt_Poundage.Text) ? 0 : decimal.Parse(txt_Poundage.Text);
            model.TradeNo          = txt_TradeNo.Text;
            model.AuditingMemo     = txt_AuditingMemo.Text;
            if (bankAccountInfo != null && bankAccountInfo.IsMain)
            {
                model.IsOut = true;
            }
            else
            {
                model.IsOut = false;
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    _costReport.UpdatePayCostAndExecuteDate(model.ReportId, model.ReportCost);
                    string errorMessage;
                    bool   result = ExecuteFinishHandle(model, Personnel, out errorMessage);
                    if (!result)
                    {
                        throw new Exception(errorMessage);
                    }

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }