예제 #1
0
    private void FillPayments()
    {
        // get by entity id : 224413

        DataTable dt = CreditDB.GetUnusedVouchers(224413);

        lstPayments.DataSource = dt;
        lstPayments.DataBind();

        for (int i = lstPayments.Items.Count - 1; i >= 0; i--)
        {
            TextBox txtAmount = (TextBox)lstPayments.Items[i].FindControl("txtAmount");
            Utilities.SetEditControlBackColour(txtAmount, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        }

        //if (lstPayments.Items.Count > 0)
        //{
        //    TextBox txtReceiptPaymentTypeAmount = (TextBox)lstPayments.Items[0].FindControl("txtAmount");
        //    SetFocus(txtReceiptPaymentTypeAmount);
        //}
    }
예제 #2
0
    private void FillEmptyAddForm()
    {
        Invoice invoice = InvoiceDB.GetByID(GetFormID());

        if (invoice == null)
        {
            HideTableAndSetErrorMessage("Invalid invoice ID");
            return;
        }

        lblInvoiceNbr.Text  = invoice.InvoiceID.ToString();
        lblAmountOwing.Text = "$" + invoice.TotalDue.ToString();


        DataTable dt = DBBase.GetGenericDataTable(null, "ReceiptPaymentType", "receipt_payment_type_id", "descr");

        // add column for displaying data in first few rows with invoice id and invoice amount owing
        dt.Columns.Add("text");
        dt.Columns.Add("tab_index");
        for (int i = dt.Rows.Count - 1; i >= 0; i--)
        {
            dt.Rows[i]["text"] = "";
            if (Convert.ToInt32(dt.Rows[i]["receipt_payment_type_id"]) == 363)
            {
                dt.Rows.RemoveAt(i);
            }
        }

        lstPayments.DataSource = dt;
        lstPayments.DataBind();

        for (int i = lstPayments.Items.Count - 1; i >= 0; i--)
        {
            Label   lblReceiptPaymentTypeID     = (Label)lstPayments.Items[i].FindControl("lblTypeID");
            TextBox txtReceiptPaymentTypeAmount = (TextBox)lstPayments.Items[i].FindControl("txtAmount");
            Button  btnWebPay = (Button)lstPayments.Items[i].FindControl("btnWebPay");

            if (lblReceiptPaymentTypeID.Text != "133" && lblReceiptPaymentTypeID.Text != "362")
            {
                btnWebPay.Visible = false;
            }

            if (((SystemVariables)Session["SystemVariables"])["EziDebit_Enabled"].Value != "1")
            {
                btnWebPay.Visible = false;
            }

            Utilities.SetEditControlBackColour(txtReceiptPaymentTypeAmount, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        }

        if (lstPayments.Items.Count > 0)
        {
            TextBox txtReceiptPaymentTypeAmount = (TextBox)lstPayments.Items[0].FindControl("txtAmount");
            SetFocus(txtReceiptPaymentTypeAmount);
        }



        int entityID = -1;

        if (invoice.PayerOrganisation != null)
        {
            entityID = invoice.PayerOrganisation.EntityID;
        }
        else if (invoice.PayerPatient != null)
        {
            entityID = invoice.PayerPatient.Person.EntityID;
        }
        else if (invoice.Booking != null && invoice.Booking.Patient != null)
        {
            entityID = BookingDB.GetByID(invoice.Booking.BookingID).Patient.Person.EntityID;
        }

        DataTable dt_vouchers = CreditDB.GetUnusedVouchers(entityID);

        lstVouchers.DataSource = dt_vouchers;
        lstVouchers.DataBind();

        for (int i = lstVouchers.Items.Count - 1; i >= 0; i--)
        {
            TextBox txtAmount = (TextBox)lstVouchers.Items[i].FindControl("txtAmount");
            Utilities.SetEditControlBackColour(txtAmount, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        }

        if (lstVouchers.Items.Count == 0)
        {
            divVouchers.Visible = false;
        }



        Utilities.SetEditControlBackColour(txtCreditNoteTotal, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        Utilities.SetEditControlBackColour(txtCreditCardReason, true, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);

        btnSubmit.Text    = "Add Payment(s)";
        btnCancel.Visible = true;
    }