Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Request["__EVENTTARGET"] == "btnNew" &&
            //Request["__EVENTARGUMENT"] == "MyArgument")
            //{
            //    //do something
            //}

            // Refund_R
            InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(2);

            RefundId = Convert.ToInt32(Request["id"]);

            // find user control
            _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems();
            _radGridInvoiceItems       = InvoiceItemGrid1.GetRadGridInvoiceItems();
            // connect event of invoice Items.
            _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender;
            //_radGridInvoiceItems.MasterTableView.CommandItemSettings.ShowSaveChangesButton = false;

            FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Refund);

            CreditMemoPayout1.SetReadonly(false);

            if (!IsPostBack)
            {
                //// new
                //if (Request["type"] == "0")
                //{
                //    // nothing
                //}
                //else
                //{
                var cRefund = new CRefund();
                var refund  = cRefund.Get(RefundId);
                FileDownloadList1.GetFileDownload(refund.RefundId);

                InvoiceItemGrid1.InvoiceId = refund.InvoiceId;
                InvoiceItemGrid1.SetEditMode(true);

                CreditMemoPayout1.SetCreditVisible(true);
                var cCreditMemoPayout = new CCreditMemoPayout();
                var creditMemoPayout  = cCreditMemoPayout.Get(refund.CreditMemoPayoutId);
                CreditMemoPayout1.SetData(creditMemoPayout);
                //}
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // find user control
            _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems();
            _radGridInvoiceItems       = InvoiceItemGrid1.GetRadGridInvoiceItems();
            _radGridInvoiceItems.MasterTableView.CommandItemSettings.ShowSaveChangesButton = false;
            // Simple
            InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(1);

            if (!IsPostBack)
            {
                InvoiceItemGrid1.SetEditMode(true);

                var cStudent = new CStudent();
                var student  = cStudent.GetStudentList(CurrentSiteLocationId);
                foreach (var stu in student)
                {
                    RadComboBoxMenu.Items.Add(new RadComboBoxItem(cStudent.GetStudentName(stu) + "(" + stu.StudentNo + ")", stu.StudentId.ToString()));
                }
            }
        }
Ejemplo n.º 3
0
        public void GetInvoiceItems()
        {
            var btnConfirm          = RadToolBar1.FindItemByText("Confirm");
            var btnModify           = RadToolBar1.FindItemByText("Modify");
            var btnCancel           = RadToolBar1.FindItemByText("Cancel");
            var btnStudentInvoice   = RadToolBar1.FindItemByText("Student Invoice");
            var btnAgencyInvoice    = RadToolBar1.FindItemByText("Agency Invoice");
            var btnNewSimpleInvoice = RadToolBar1.FindItemByText("New Simple Invoice");

            if (RadGridInvoice.SelectedValue == null)
            {
                _sqlDataSourceInvoiceItems.WhereParameters.Clear();
                _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, "0");
                _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId";

                LinqDataSourceInvoiceHistory.WhereParameters.Clear();
                LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, "0");
                LinqDataSourceInvoiceHistory.Where = "InvoiceId == @InvoiceId";
            }
            else
            {
                var cInvoice = new CInvoice();
                var invoice  = cInvoice.Get(Convert.ToInt32(RadGridInvoice.SelectedValue.ToString()));

                _sqlDataSourceInvoiceItems.WhereParameters.Clear();
                _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, RadGridInvoice.SelectedValue.ToString());
                _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId";

                if (invoice.OriginalInvoiceId != null)
                {
                    LinqDataSourceInvoiceHistory.WhereParameters.Clear();
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, invoice.InvoiceId.ToString());
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceNumber", DbType.String, invoice.InvoiceNumber.Substring(2, 8));
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoicePartialIndex", DbType.Int32, invoice.InvoicePartialIndex.ToString());
                    LinqDataSourceInvoiceHistory.Where = "InvoiceId != @InvoiceId && InvoiceNumber.Contains(@InvoiceNumber) && InvoicePartialIndex < @InvoicePartialIndex";
                }
                else
                {
                    LinqDataSourceInvoiceHistory.WhereParameters.Clear();
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("OriginalInvoiceId", DbType.Int32, "0");
                    LinqDataSourceInvoiceHistory.Where = "InvoiceId == @OriginalInvoiceId";
                }

                ddlFG.SelectedValue = invoice.IsFinancialGurantee.ToString();

                var status      = Convert.ToInt32(invoice.Status);
                var invoiceType = Convert.ToInt32(invoice.InvoiceType);
                var delete      = _radGridInvoiceItems.MasterTableView.GetColumn("DeleteColumn");
                if (status == (int)CConstValue.InvoiceStatus.Pending)
                {
                    switch (invoiceType)
                    {
                    case (int)CConstValue.InvoiceType.Simple:
                    case (int)CConstValue.InvoiceType.General:
                    case (int)CConstValue.InvoiceType.Manual:
                    case (int)CConstValue.InvoiceType.Dormitory:
                    case (int)CConstValue.InvoiceType.Homestay:
                        btnConfirm.Enabled        = true;
                        btnModify.Enabled         = false;
                        btnCancel.Enabled         = true;
                        btnStudentInvoice.Enabled = true;
                        btnAgencyInvoice.Enabled  = true;
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.Batch;
                        delete.Visible = true;
                        ddlFG.Enabled  = true;
                        break;

                    default:
                        btnConfirm.Enabled        = false; //Confirm
                        btnModify.Enabled         = false; //Modify
                        btnCancel.Enabled         = false; //Cancel
                        btnStudentInvoice.Enabled = true;  //Student Invoice Print
                        btnAgencyInvoice.Enabled  = true;  //Agency Invoice Print
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                        delete.Visible = false;
                        ddlFG.Enabled  = false;
                        break;
                    }
                }
                else if (status == (int)CConstValue.InvoiceStatus.Invoiced) //Invoiced
                {
                    switch (invoiceType)
                    {
                    case (int)CConstValue.InvoiceType.Simple:
                    case (int)CConstValue.InvoiceType.General:
                    case (int)CConstValue.InvoiceType.Manual:
                    case (int)CConstValue.InvoiceType.Dormitory:
                    case (int)CConstValue.InvoiceType.Homestay:
                        btnConfirm.Enabled        = false;
                        btnModify.Enabled         = true;
                        btnCancel.Enabled         = true;
                        btnStudentInvoice.Enabled = true;
                        btnAgencyInvoice.Enabled  = true;
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                        delete.Visible = false;
                        ddlFG.Enabled  = false;
                        break;

                    default:
                        btnConfirm.Enabled        = false; //Confirm
                        btnModify.Enabled         = false; //Modify
                        btnCancel.Enabled         = false; //Cancel
                        btnStudentInvoice.Enabled = true;  //Student Invoice Print
                        btnAgencyInvoice.Enabled  = true;  //Agency Invoice Print
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                        delete.Visible = false;
                        ddlFG.Enabled  = false;
                        break;
                    }
                }
                else
                {
                    btnConfirm.Enabled        = false;
                    btnModify.Enabled         = false;
                    btnCancel.Enabled         = false;
                    btnStudentInvoice.Enabled = true;
                    btnAgencyInvoice.Enabled  = true;
                    _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                    _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                    delete.Visible = false;
                    ddlFG.Enabled  = false;
                }

                if (invoice.AgencyId != null)
                {
                    var cAgency = new CAgency();
                    var agency  = cAgency.Get(Convert.ToInt32(invoice.AgencyId));
                    if (agency != null)
                    {
                        tbAgencyName.Text = agency.Name;
                        if (agency.Location != null)
                        {
                            var country = new CCountry().Get((int)agency.Location);
                            tbCountryCity.Text = country.Name;
                        }
                        else
                        {
                            tbCountryCity.Text = string.Empty;
                        }
                        if (agency.ContractStartDate != null && agency.ContractEndDate != null)
                        {
                            tbContractDate.Text = agency.ContractStartDate.Value.Date.ToString("MM-dd-yyyy") + " - " + agency.ContractEndDate.Value.Date.ToString("MM-dd-yyyy");
                        }
                        tbCommissionRate.Text = invoice.AgencyRate + "%";
                        tbDescription.Text    = agency.Comment;
                    }
                }
                else
                {
                    tbAgencyName.Text     = "Direct Student";
                    tbCountryCity.Text    = string.Empty;
                    tbContractDate.Text   = string.Empty;
                    tbCommissionRate.Text = string.Empty;
                    tbDescription.Text    = string.Empty;
                }

                if (_radGridInvoiceItems.MasterTableView.EditMode == GridEditMode.Batch)
                {
                    InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(invoice.InvoiceType);
                }
            }

            _radGridInvoiceItems.Rebind();
            RadGridInvoiceHistory.Rebind();
        }