예제 #1
0
 private void btnFilter_Click(object sender, EventArgs e)
 {
     using (mFilterDir fildir = new mFilterDir())
     {
         fildir.ShowDialog();
         if (fildir.Searched == true)
         {
             try
             {
                 customer           = new VO.CustomersVO();
                 customer.Balance   = fildir.FilterAmount;
                 String[,] grabData = customer.ReadCustomersFilts();
                 dataGridView1.Rows.Clear();
                 for (int x = 0; x < grabData.GetLength(1); x++)
                 {
                     dataGridView1.Rows.Add(grabData[0, x].ToString(), grabData[1, x].ToString(), grabData[2, x].ToString(), grabData[3, x].ToString(), grabData[4, x].ToString(), Convert.ToDouble(grabData[5, x].ToString()));
                 }
             }
             catch (Exception)
             {
                 MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
예제 #2
0
        private void btnAProceed_Click(object sender, EventArgs e)
        {
            customers             = new VO.CustomersVO();
            customers.Custcode    = txtBoxCustCode.Text;
            customers.Companyname = txtBoxCompany.Text;
            String[] getScammer      = customers.ReadCheckoutInfo();
            Double   creditlimit     = 0;
            Double   customerbalance = 0;
            Double   currentbalance  = 0;

            customerbalance = Convert.ToDouble(getScammer[0]);
            creditlimit     = Convert.ToDouble(getScammer[1]);
            currentbalance  = customerbalance + Convert.ToDouble(lblTotalAmountAR.Text);
            //
            if (creditlimit == 0)
            {
                Custcode = txtBoxCustCode.Text;
                Company  = txtBoxCompany.Text;
                IsARTX   = true;
                this.Close();
            }
            if (creditlimit >= currentbalance)
            {
                Custcode = txtBoxCustCode.Text;
                Company  = txtBoxCompany.Text;
                IsARTX   = true;
                this.Close();
            }
            else
            {
                cstDlgAlert alert = new cstDlgAlert();
                alert.MsgDiri = "Account has Exceeded \nP " + creditlimit.ToString("#,###,##0.00") + " Credit Limit";
                alert.ShowDialog();
            }
        }
예제 #3
0
 private void chkBoxLoadAll_CheckedChanged(object sender, EventArgs e)
 {
     if (chkBoxLoadAll.Checked == true)
     {
         try
         {
             customer           = new VO.CustomersVO();
             customer.Custcode  = Custcode;
             String[,] grabData = customer.ReadPaymentsAll();
             dataGridView1.Rows.Clear();
             for (int x = 0; x < grabData.GetLength(1); x++)
             {
                 dataGridView1.Rows.Add(Convert.ToDateTime(grabData[0, x]).ToString("M/dd/yyyy"), Convert.ToDateTime(grabData[1, x]).ToString("h:mm:ss tt"), Convert.ToDouble(grabData[2, x]));
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         LoadDefualt();
     }
 }
예제 #4
0
 private void txtBoxAmount_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         try
         {
             DialogResult dlg = MessageBox.Show("Do you wish to Proceed the Payment", "Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dlg == System.Windows.Forms.DialogResult.Yes)
             {
                 Double prePayable = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[2].Value);
                 Double preBalance = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[4].Value);
                 customer            = new VO.CustomersVO();
                 customer.Balance    = Convert.ToDouble(txtBoxAmount.Text);
                 customer.AmountPaid = Convert.ToDouble(txtBoxAmount.Text);
                 customer.Custcode   = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                 customer.DebitToAccount();
                 dataGridView1.SelectedRows[0].Cells[3].Value = Convert.ToDouble(txtBoxAmount.Text);
                 dataGridView1.SelectedRows[0].Cells[4].Value = preBalance - Convert.ToDouble(txtBoxAmount.Text);
                 if (Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[4].Value) == 0)
                 {
                     dataGridView1.SelectedRows[0].Cells[2].Value = Convert.ToDouble(0);
                 }
                 PrintPayments();
                 txtBoxAmount.Clear();
                 btnPay.Enabled = false;
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Please Your Database Server!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
예제 #5
0
        private void btnPing_Click(object sender, EventArgs e)
        {
            Double Init;
            Double Finale;

            customer = new VO.CustomersVO();
            DialogResult dlg = MessageBox.Show("Do you wish to Ping this Account?\nThis will be Undone!", "Ping Interest", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            try
            {
                if (dlg == System.Windows.Forms.DialogResult.Yes)
                {
                    customer.Custcode = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                    Init             = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[5].Value) * customer.getIR();
                    Finale           = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[5].Value) + Init;
                    customer.Balance = Finale;
                    customer.PingInterest();
                    dataGridView1.SelectedRows[0].Cells[5].Value = Finale.ToString("#,###,##0.00");
                    btnPing.Enabled = false;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ping Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            customers = new VO.CustomersVO();
            DialogResult dr = MessageBox.Show("Do you wish to Continue Updating?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                Activity = true;
                customers.Companyname = txtBoxCompany.Text;
                customers.Firstname   = txtBoxFirst.Text;
                customers.Middlename  = txtBoxMiddle.Text;
                customers.Lastname    = txtBoxLast.Text;
                customers.Email       = txtBoxEmail.Text;
                customers.Phone_no    = txtBoxPhone.Text;
                customers.Address     = txtBoxAddress.Text;
                customers.City        = txtBoxCity.Text;
                customers.Province    = txtBoxProv.Text;
                customers.Zip_code    = txtBoxZip.Text;
                customers.Custcode    = txtBoxCustomerCode.Text;
                Company = txtBoxCompany.Text;
                First   = txtBoxFirst.Text;
                Middle  = txtBoxMiddle.Text;
                Last    = txtBoxLast.Text;
                customers.UpdateCustomers();
                this.Close();
            }
        }
예제 #7
0
        private void mEditDirectory_Load(object sender, EventArgs e)
        {
            customers          = new VO.CustomersVO();
            customers.Custcode = Custcode;
            String[] getScam = customers.ReadEdits();
            txtBoxCustomerCode.Text = getScam[0].ToString();
            txtBoxCompany.Text      = getScam[1].ToString();
            txtBoxFirst.Text        = getScam[2].ToString();
            txtBoxMiddle.Text       = getScam[3].ToString();
            txtBoxLast.Text         = getScam[4].ToString();
            txtBoxEmail.Text        = getScam[5].ToString();
            txtBoxPhone.Text        = getScam[6].ToString();
            txtBoxAddress.Text      = getScam[7].ToString();
            txtBoxCity.Text         = getScam[8].ToString();
            txtBoxProv.Text         = getScam[9].ToString();
            txtBoxZip.Text          = getScam[10].ToString();
            mskTIN.Text             = getScam[11].ToString();
            mskSSS.Text             = getScam[12].ToString();
            txtBoxCreditLimit.Text  = Convert.ToDouble(getScam[13]).ToString("#,###,##0.00");
            if (getScam[14].ToString() == "30")
            {
                cBoxNetDays.Text = "1-30";
            }
            if (getScam[14].ToString() == "60")
            {
                cBoxNetDays.Text = "31-60";
            }
            if (getScam[14].ToString() == "90")
            {
                cBoxNetDays.Text = "61-90";
            }
            if (getScam[14].ToString() == "120")
            {
                cBoxNetDays.Text = "91+";
            }
            if (getScam[15].ToString() == "1")
            {
                cBoxSuspended.Checked = true;
            }
            else
            {
                cBoxSuspended.Checked = false;
            }
            String x = Convert.ToDouble(getScam[16]).ToString("#0.##%");

            txtBoxIR.Text        = x.Replace("%", "");
            dateTimePicker1.Text = Convert.ToDateTime(getScam[17]).ToString("MM/dd/yyyy");
            if (getScam[18].ToString() == "1")
            {
                cBoxSummary.Checked = true;
            }
            else
            {
                cBoxSummary.Checked = false;
            }
        }
예제 #8
0
        private void LoadSummary()
        {
            custvo             = new VO.CustomersVO();
            String[,] grabData = custvo.ReadAged();
            Double current = 0;
            Double thirty  = 0;
            Double sixty   = 0;
            Double ninty   = 0;
            Double over    = 0;

            try
            {
                dataGridView1.Rows.Clear();
                for (int otin = 0; otin < grabData.GetLength(1); otin++)
                {
                    TimeSpan ts = Convert.ToDateTime(dtSelect.Value) - Convert.ToDateTime(grabData[2, otin]);
                    if (ts.TotalDays >= 1 && ts.TotalDays < 31)
                    {
                        thirty = Convert.ToDouble(grabData[3, otin]);
                    }
                    else if (ts.TotalDays >= 31 && ts.TotalDays < 61)
                    {
                        sixty = Convert.ToDouble(grabData[3, otin]);
                    }
                    else if (ts.TotalDays >= 61 && ts.TotalDays < 91)
                    {
                        ninty = Convert.ToDouble(grabData[3, otin]);
                    }
                    else if (ts.TotalDays >= 91)
                    {
                        over = Convert.ToDouble(grabData[3, otin]);
                    }
                    else
                    {
                        current = Convert.ToDouble(grabData[3, otin]);
                    }
                    dataGridView1.Rows.Add(grabData[0, otin], grabData[1, otin], Convert.ToDateTime(grabData[2, otin]).ToString("MM/dd/yyyy"), Convert.ToDouble(grabData[3, otin]).ToString("#,###,##0.00"), current.ToString("#,###,##0.00"), thirty.ToString("#,###,##0.00"), sixty.ToString("#,###,##0.00"), ninty.ToString("#,###,##0.00"), over.ToString("#,###,##0.00"));
                    current = 0;
                    thirty  = 0;
                    sixty   = 0;
                    ninty   = 0;
                    over    = 0;
                }
                lblOutstanding.Text = CellSumOutstanding().ToString("#,###,##0.00");
                lblCurrent.Text     = CellSumCurrent().ToString("#,###,##0.00");
                lbl30.Text          = CellSumThirty().ToString("#,###,##0.00");
                lbl60.Text          = CellSumSixty().ToString("#,###,##0.00");
                lbl90.Text          = CellSumNinty().ToString("#,###,##0.00");
                lblOver.Text        = CellSumOver().ToString("#,###,##0.00");
            }
            catch (Exception)
            {
                MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #9
0
 private void txtBoxCompany_KeyDown(object sender, KeyEventArgs e)
 {
     customers = new VO.CustomersVO();
     if (e.KeyCode == Keys.Enter)
     {
         customers.Companyname = txtBoxCompany.Text;
         customers.DisplayCustomerCode();
         txtBoxCustCode.Text = customers.DisplayCustomerCode();
         btnAProceed.Focus();
     }
 }
예제 #10
0
 private void txtBoxCustomerCode_TextChanged(object sender, EventArgs e)
 {
     customers          = new VO.CustomersVO();
     customers.Custcode = txtBoxCustomerCode.Text;
     if (found == customers.CheckCustCode())
     {
         txtBoxCompany.ReadOnly = true;
         txtBoxFirst.ReadOnly   = true;
         txtBoxMiddle.ReadOnly  = true;
         txtBoxLast.ReadOnly    = true;
         txtBoxEmail.ReadOnly   = true;
         txtBoxPhone.ReadOnly   = true;
         txtBoxAddress.ReadOnly = true;
         txtBoxCity.ReadOnly    = true;
         txtBoxProv.ReadOnly    = true;
         txtBoxZip.ReadOnly     = true;
         //
         txtBoxCompany.Clear();
         txtBoxFirst.Clear();
         txtBoxMiddle.Clear();
         txtBoxLast.Clear();
         txtBoxEmail.Clear();
         txtBoxPhone.Clear();
         txtBoxAddress.Clear();
         txtBoxCity.Clear();
         txtBoxProv.Clear();
         txtBoxZip.Clear();
         lblWarning.Text = "Customer Code has been Existed!";
     }
     else
     {
         txtBoxCompany.ReadOnly = false;
         txtBoxFirst.ReadOnly   = false;
         txtBoxMiddle.ReadOnly  = false;
         txtBoxLast.ReadOnly    = false;
         txtBoxEmail.ReadOnly   = false;
         txtBoxPhone.ReadOnly   = false;
         txtBoxAddress.ReadOnly = false;
         txtBoxCity.ReadOnly    = false;
         txtBoxProv.ReadOnly    = false;
         txtBoxZip.ReadOnly     = false;
         lblWarning.Text        = "";
     }
     if (txtBoxCustomerCode.Text != "" && txtBoxCompany.Text != "" && txtBoxFirst.Text != "" && txtBoxMiddle.Text != "" && txtBoxLast.Text != "" && txtBoxPhone.Text != "" && txtBoxAddress.Text != "" && txtBoxCity.Text != "" && txtBoxProv.Text != "" && Convert.ToDouble(txtBoxIR.Text) != 0)
     {
         btnSave.Enabled = true;
     }
     else
     {
         btnSave.Enabled = false;
     }
 }
예제 #11
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Are you sure you want to Delete Your Selected Record?\nAll Trasactions Under your Selected Customer Code will be Wiped Out!\nThis Can't be Undo!", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            customer = new VO.CustomersVO();
            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                customer.Custcode = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                customer.DeleteCustomers();
                dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
                btnDelete.Enabled = false;
            }
        }
예제 #12
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            VO.PosVO pos = new VO.PosVO();
            frmLogin fl  = new frmLogin();

            try
            {
                DialogResult dlg = MessageBox.Show("Do you wish to Proceed the Payment", "Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dlg == System.Windows.Forms.DialogResult.Yes)
                {
                    Double prePayable = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[2].Value);
                    Double preBalance = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[4].Value);
                    customer              = new VO.CustomersVO();
                    pos.Pos_terminal      = fl.tN;
                    customer.Pos_terminal = fl.tN;
                    customer.Pos_orno     = pos.GetOrNo();
                    customer.Custcode     = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                    customer.Customer     = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
                    customer.Pos_user     = frmLogin.User.user_name;
                    customer.Balance      = Convert.ToDouble(txtBoxAmount.Text);
                    if (customer.JustCheckVat() == true)
                    {
                        customer.Vatable = Convert.ToDouble(txtBoxAmount.Text);
                    }
                    else
                    {
                        customer.Vatable = 0;
                    }
                    customer.AmountPaid = Convert.ToDouble(txtBoxAmount.Text);
                    customer.Custcode   = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                    customer.DebitToAccount();
                    customer.PayToSale(); //NEW
                    dataGridView1.SelectedRows[0].Cells[3].Value = Convert.ToDouble(txtBoxAmount.Text);
                    dataGridView1.SelectedRows[0].Cells[4].Value = preBalance - Convert.ToDouble(txtBoxAmount.Text);
                    if (Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[4].Value) == 0)
                    {
                        dataGridView1.SelectedRows[0].Cells[2].Value = Convert.ToDouble(0);
                    }
                    drawer = new Conf.Drawer();
                    drawer.Open();
                    PrintPayments();
                    txtBoxAmount.Clear();
                    btnPay.Enabled = false;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please Your Database Server!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #13
0
 private void txtBoxCompany_TextChanged(object sender, EventArgs e)
 {
     customers             = new VO.CustomersVO();
     customers.Custcode    = txtBoxCustCode.Text;
     customers.Companyname = txtBoxCompany.Text;
     customers.Correct();
     if (txtBoxCustCode.Text != "" && txtBoxCompany.Text != "" && customers.Correct() == true)
     {
         btnAProceed.Visible = true;
     }
     else
     {
         btnAProceed.Visible = false;
     }
 }
예제 #14
0
 private void mEditDirectory_Load(object sender, EventArgs e)
 {
     customers          = new VO.CustomersVO();
     customers.Custcode = Custcode;
     String[] getScam = customers.ReadEdits();
     txtBoxCustomerCode.Text = getScam[0].ToString();
     txtBoxCompany.Text      = getScam[1].ToString();
     txtBoxFirst.Text        = getScam[2].ToString();
     txtBoxMiddle.Text       = getScam[3].ToString();
     txtBoxLast.Text         = getScam[4].ToString();
     txtBoxEmail.Text        = getScam[5].ToString();
     txtBoxPhone.Text        = getScam[6].ToString();
     txtBoxAddress.Text      = getScam[7].ToString();
     txtBoxCity.Text         = getScam[8].ToString();
     txtBoxProv.Text         = getScam[9].ToString();
     txtBoxZip.Text          = getScam[10].ToString();
 }
예제 #15
0
 private void LoadData()
 {
     customer           = new VO.CustomersVO();
     String[,] grabData = customer.ReadCustomers();
     try
     {
         dataGridView1.Rows.Clear();
         for (int x = 0; x < grabData.GetLength(1); x++)
         {
             dataGridView1.Rows.Add(grabData[0, x].ToString(), grabData[1, x].ToString(), grabData[2, x].ToString(), grabData[3, x].ToString(), grabData[4, x].ToString(), Convert.ToDouble(grabData[5, x].ToString()), Convert.ToDateTime(grabData[6, x]).ToString("MM/dd/yyyy"));
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #16
0
 private void mdiPayment_Load(object sender, EventArgs e)
 {
     try
     {
         ConfigCheck();
         customer           = new VO.CustomersVO();
         String[,] grabData = customer.ReadCustomersPayment();
         dataGridView1.Rows.Clear();
         for (int x = 0; x < grabData.GetLength(1); x++)
         {
             dataGridView1.Rows.Add(grabData[0, x].ToString(), grabData[1, x].ToString(), Convert.ToDouble(grabData[2, x]), Convert.ToDouble(grabData[3, x]), Convert.ToDouble(grabData[4, x]));
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #17
0
 private void LoadDefualt()
 {
     try
     {
         customer           = new VO.CustomersVO();
         customer.Custcode  = Custcode;
         customer.Today     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
         String[,] grabData = customer.ReadPaymentsDefualt();
         dataGridView1.Rows.Clear();
         for (int x = 0; x < grabData.GetLength(1); x++)
         {
             dataGridView1.Rows.Add(Convert.ToDateTime(grabData[0, x]).ToString("M/dd/yyyy"), Convert.ToDateTime(grabData[1, x]).ToString("h:mm:ss tt"), Convert.ToDouble(grabData[2, x]));
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #18
0
 private void PrintAge()
 {
     custvo                 = new VO.CustomersVO();
     label1.Visible         = false;
     lblOutstanding.Visible = false;
     lblCurrent.Visible     = false;
     lbl30.Visible          = false;
     lbl60.Visible          = false;
     lbl90.Visible          = false;
     lblOver.Visible        = false;
     try
     {
         DataSet   ds = new DataSet();
         DataTable dt = new DataTable();
         dt.Columns.Add("customer", typeof(String));
         dt.Columns.Add("terms", typeof(Int32));
         dt.Columns.Add("duedate", typeof(String));
         dt.Columns.Add("outstanding", typeof(Double));
         dt.Columns.Add("current", typeof(Double));
         dt.Columns.Add("thirty", typeof(Double));
         dt.Columns.Add("sixty", typeof(Double));
         dt.Columns.Add("ninty", typeof(Double));
         dt.Columns.Add("over", typeof(Double));
         //
         foreach (DataGridViewRow dcoe in dataGridView1.Rows)
         {
             dt.Rows.Add(dcoe.Cells[0].Value, dcoe.Cells[1].Value, dcoe.Cells[2].Value, dcoe.Cells[3].Value, dcoe.Cells[4].Value, dcoe.Cells[5].Value, dcoe.Cells[6].Value, dcoe.Cells[7].Value, dcoe.Cells[8].Value);
         }
         ds.Tables.Add(dt);
         ds.WriteXmlSchema("aging.xml");
         crystalReportViewer1.Visible = true;
         btnReturn.Visible            = true;
         //Execute To CReports
         rptAging aging = new rptAging();
         aging.SetDataSource(ds);
         aging.SetParameterValue("DataParam", dtSelect.Text);
         aging.SetParameterValue("prepareParam", custvo.first() + " " + custvo.middle() + " " + custvo.last());
         crystalReportViewer1.ReportSource = aging;
     }
     catch (Exception)
     {
     }
 }
예제 #19
0
 private void from_ValueChanged(object sender, EventArgs e)
 {
     try
     {
         customer          = new VO.CustomersVO();
         customer.Custcode = Custcode;
         String a = Convert.ToDateTime(dfrom.Text).ToString("yyyy-MM-dd");
         String b = Convert.ToDateTime(dto.Text).ToString("yyyy-MM-dd");
         customer.From      = Convert.ToDateTime(a);
         customer.To        = Convert.ToDateTime(b);
         String[,] grabData = customer.ReadPaymentsDateFilter();
         dataGridView1.Rows.Clear();
         for (int x = 0; x < grabData.GetLength(1); x++)
         {
             dataGridView1.Rows.Add(Convert.ToDateTime(grabData[0, x]).ToString("M/dd/yyyy"), Convert.ToDateTime(grabData[1, x]).ToString("h:mm:ss tt"), Convert.ToDouble(grabData[2, x]));
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #20
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            customers = new VO.CustomersVO();
            DialogResult dr = MessageBox.Show("Do you wish to Continue Updating?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            try
            {
                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    Activity = true;
                    customers.Companyname = txtBoxCompany.Text;
                    customers.Firstname   = txtBoxFirst.Text;
                    customers.Middlename  = txtBoxMiddle.Text;
                    customers.Lastname    = txtBoxLast.Text;
                    customers.Email       = txtBoxEmail.Text;
                    customers.Phone_no    = txtBoxPhone.Text;
                    customers.Address     = txtBoxAddress.Text;
                    customers.City        = txtBoxCity.Text;
                    customers.Province    = txtBoxProv.Text;
                    customers.Zip_code    = txtBoxZip.Text;
                    customers.Tin         = mskTIN.Text;
                    customers.Sss         = mskSSS.Text;
                    if (txtBoxCreditLimit.Text != "")
                    {
                        customers.Creditlimit = Convert.ToDouble(txtBoxCreditLimit.Text);
                    }
                    else
                    {
                        customers.Creditlimit = 0;
                    }
                    if (cBoxNetDays.Text == "1-30")
                    {
                        customers.Netdays = 30;
                    }
                    if (cBoxNetDays.Text == "31-60")
                    {
                        customers.Netdays = 60;
                    }
                    if (cBoxNetDays.Text == "61-90")
                    {
                        customers.Netdays = 90;
                    }
                    if (cBoxNetDays.Text == "91+")
                    {
                        customers.Netdays = 120;
                    }
                    if (cBoxSuspended.Checked == true)
                    {
                        customers.Is_suspended = 1;
                    }
                    else
                    {
                        customers.Is_suspended = 0;
                    }
                    if (cBoxSummary.Checked == true)
                    {
                        customers.Has_summary = 1;
                    }
                    else
                    {
                        customers.Has_summary = 0;
                    }
                    if (txtBoxIR.Text != "")
                    {
                        customers.Interest_rate = Convert.ToDouble(txtBoxIR.Text);
                    }
                    else
                    {
                        customers.Interest_rate = 0;
                    }
                    customers.Due_date = dateTimePicker1.Text;
                    customers.Custcode = txtBoxCustomerCode.Text;
                    Company            = txtBoxCompany.Text;
                    First  = txtBoxFirst.Text;
                    Middle = txtBoxMiddle.Text;
                    Last   = txtBoxLast.Text;
                    customers.UpdateCustomers();
                    this.Close();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Check your Input and Try Again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }