예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int organisationID = Convert.ToInt32(Request.QueryString["OrganisationID"].ToString());

                // Set the page title.
                this.Master.WizardTitle = string.Format("Approve Organisation");

                lblUnnaprovedOrganisation.Text      = string.Format("Please approve the Organisation");
                lblUnnaprovedOrganisation.Font.Bold = true;

                Facade.Organisation facOrganisation = new Orchestrator.Facade.Organisation();
                this.Organisation = facOrganisation.GetForIdentityId(organisationID);
                string organisationName = string.IsNullOrWhiteSpace(this.Organisation.OrganisationName) ? "Unnamed" : this.Organisation.OrganisationName;

                lblNameAndStatus.Text = "<b>Name:</b> " + organisationName;
                lblNameAndStatus.Text = lblNameAndStatus.Text + "<br /><br /><b>Status:</b> " + this.Organisation.IdentityStatus.ToString();

                string jsInjection = @"
                try { resizeTo(630, 730); }
                catch (err) { }
                window.focus();
                moveTo(30, 20);";

                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "ApproveOnly", jsInjection, true);
            }
        }
        private void PopulateInvoiceExtra()
        {
            Facade.IInvoiceExtra facInvoiceExtra = new Facade.Invoice();

            if (m_invoiceExtra == null)
            {
                m_invoiceExtra = new Entities.InvoiceExtra();
            }

            if (lblInvoiceNo.Text != Orchestrator.Globals.Constants.UNALLOCATED_INVOICE_ID)
            {
                m_invoiceExtra.InvoiceId   = int.Parse(lblInvoiceNo.Text);
                m_invoiceExtra.CreatedDate = Convert.ToDateTime(lblDateCreated.Text);
            }
            else
            {
                m_invoiceExtra.CreatedDate = DateTime.Now;
            }

            // Set the account code.
            Entities.Organisation orgClient = null;
            Facade.Organisation   facOrg    = new Orchestrator.Facade.Organisation();
            orgClient = facOrg.GetForIdentityId(m_identityId);
            m_invoiceExtra.AccountCode = orgClient.AccountCode;
            //

            m_invoiceExtra.InvoiceDate         = this.rdiInvoiceDate.SelectedDate.Value;
            m_invoiceExtra.InvoiceType         = eInvoiceType.Extra;
            m_invoiceExtra.ClientInvoiceAmount = Decimal.Parse(txtAmountNet.Text, NumberStyles.Currency);
            m_invoiceExtra.InvoiceDetails      = txtInvoiceDetails.Text;
            m_invoiceExtra.CreatedDate         = DateTime.Now;
            m_invoiceExtra.NominalCode         = cboNominalCode.SelectedValue;

            if (chkOverrideAmount.Checked)
            {
                m_invoiceExtra.OverrideReason           = txtReasonForOverride.Text;
                m_invoiceExtra.OverrideTotalAmountGross = Decimal.Parse(txtOverrideAmountGross.Text, NumberStyles.Currency);
                m_invoiceExtra.OverrideTotalAmountNet   = Decimal.Parse(txtOverrideAmountNet.Text, NumberStyles.Currency);
                m_invoiceExtra.OverrideTotalAmountVAT   = Decimal.Parse(txtOverrideAmountVAT.Text, NumberStyles.Currency);
            }
            else
            {
                m_invoiceExtra.OverrideReason           = string.Empty;
                m_invoiceExtra.OverrideTotalAmountGross = 0;
                m_invoiceExtra.OverrideTotalAmountNet   = 0;
                m_invoiceExtra.OverrideTotalAmountVAT   = 0;
            }

            m_invoiceExtra.Extras = facInvoiceExtra.GetExtraCollectionForExtraIds(Convert.ToString(ViewState["ExtraIdCSV"]));

            int     vatNo = 0, vatType;
            decimal vatRate = 0.00M;

            vatType = int.Parse(cboVATType.SelectedValue);

            // Vat Rate and Vat Type
            Facade.IInvoice facInv = new Facade.Invoice();
            facInv.GetVatRateForVatType((eVATType)vatType, m_invoiceExtra.InvoiceDate, out vatNo, out vatRate);
            m_invoiceExtra.VatRate = vatRate;
            m_invoiceExtra.VatNo   = vatNo;

            if (chkPostToExchequer.Checked)
            {
                m_invoiceExtra.Posted = true;
            }
            else
            {
                m_invoiceExtra.Posted = false;
            }

            if (chkDelete.Checked)
            {
                m_invoiceExtra.ForCancellation = true;
            }
            else
            {
                m_invoiceExtra.ForCancellation = false;
            }
        }