Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 117, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("财务发票列表", "FinanceInvoiceList.aspx");
                this.navigation1.Routes.Add("财务发票修改", string.Empty);
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                int fundsInvoiceId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out fundsInvoiceId))
                    Response.Redirect("FinanceInvoiceList.aspx");

                //获取财务发票
                NFMT.Invoice.BLL.FinanceInvoiceBLL financeInvoiceBLL = new NFMT.Invoice.BLL.FinanceInvoiceBLL();
                result = financeInvoiceBLL.Get(user, fundsInvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect("FinanceInvoiceList.aspx");
                NFMT.Invoice.Model.FinanceInvoice fundsInvoice = result.ReturnValue as NFMT.Invoice.Model.FinanceInvoice;
                if (fundsInvoice == null || fundsInvoice.FinanceInvoiceId <= 0)
                    Response.Redirect("FinanceInvoiceList.aspx");

                this.curFundsInvoice = fundsInvoice;

                //获取主发票信息
                NFMT.Operate.BLL.InvoiceBLL invoiceBLL = new NFMT.Operate.BLL.InvoiceBLL();
                result = invoiceBLL.Get(user, fundsInvoice.InvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect("FinanceInvoiceList.aspx");
                NFMT.Operate.Model.Invoice invoice = result.ReturnValue as NFMT.Operate.Model.Invoice;
                if (invoice == null || invoice.InvoiceId <= 0)
                    Response.Redirect("FinanceInvoiceList.aspx");

                this.curInvoice = invoice;

                NFMT.Invoice.BLL.FinBusInvAllotDetailBLL finBusInvAllotDetailBLL = new NFMT.Invoice.BLL.FinBusInvAllotDetailBLL();
                result = finBusInvAllotDetailBLL.GetBIds(user, fundsInvoice.FinanceInvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect("FinanceInvoiceList.aspx");

                this.hidsids.Value = result.ReturnValue.ToString();

                string dirStr = "开出";
                if (invoice.InvoiceDirection == 34)
                {
                    dirStr = "收入";
                    outSelf = 0;
                    inSelf = 1;
                }
                invoiceDirection = invoice.InvoiceDirection;
                //title init
                this.titInvDate.InnerHtml = string.Format("{0}日期:", dirStr);

                //attach
                this.attach1.BusinessIdValue = this.curInvoice.InvoiceId;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string redirectUrl = "FinanceInvoiceList.aspx";

                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 117, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("财务发票列表", redirectUrl);
                this.navigation1.Routes.Add("财务发票修改", string.Empty);
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                finInvoiceId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out finInvoiceId))
                    this.WarmAlert("参数错误", redirectUrl);

                //获取财务票
                NFMT.Invoice.BLL.FinanceInvoiceBLL financeInvoiceBLL = new NFMT.Invoice.BLL.FinanceInvoiceBLL();
                result = financeInvoiceBLL.Get(user, finInvoiceId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                curFundsInvoice = result.ReturnValue as NFMT.Invoice.Model.FinanceInvoice;
                if (curFundsInvoice == null || curFundsInvoice.FinanceInvoiceId <= 0)
                    this.WarmAlert("获取财务票误错", redirectUrl);

                //获取发票
                NFMT.Operate.BLL.InvoiceBLL invoiceBLL = new NFMT.Operate.BLL.InvoiceBLL();
                result = invoiceBLL.Get(user, curFundsInvoice.InvoiceId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                curInvoice = result.ReturnValue as NFMT.Operate.Model.Invoice;
                if (curInvoice == null || curInvoice.InvoiceId <= 0)
                    this.WarmAlert("获取发票误错", redirectUrl);

                //获取开票申请ID
                NFMT.Invoice.BLL.InvoiceApplyFinanceBLL invoiceApplyFinanceBLL = new NFMT.Invoice.BLL.InvoiceApplyFinanceBLL();
                result = invoiceApplyFinanceBLL.GetInvApplyIdByFinInvId(user, finInvoiceId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                invoiceApplyId = (int)result.ReturnValue;

                //获取下方的id
                NFMT.Invoice.BLL.InvoiceApplyBLL invoiceApplyBLL = new NFMT.Invoice.BLL.InvoiceApplyBLL();
                result = invoiceApplyBLL.GetBIidsByInvApplyIdExceptFinInvoice(user, invoiceApplyId, finInvoiceId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);
                this.hiddownIds.Value = result.ReturnValue == null ? "" : result.ReturnValue.ToString();

                //获取上方的id
                NFMT.Invoice.BLL.FinBusInvAllotDetailBLL finBusAllotDetailBLL = new NFMT.Invoice.BLL.FinBusInvAllotDetailBLL();
                result = finBusAllotDetailBLL.GetBIds(user, finInvoiceId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);
                this.hidupIds.Value = result.ReturnValue.ToString();

                string dirStr = "开出";
                this.titInvDate.InnerHtml = string.Format("{0}日期:", dirStr);
                this.attach1.BusinessIdValue = this.curInvoice.InvoiceId;
            }
        }