Example #1
0
 private void getDataSelect()
 {
     pos              = new VO.PosVO();
     pos.Pos_orno     = Convert.ToInt32(txtBoxOR.Text);
     pos.Pos_terminal = cBTerminal.Text;
     try
     {
         String[,] grabData = pos.ReadRefunData();
         dataGridView1.Rows.Clear();
         for (int x = 0; x < grabData.GetLength(1); x++)
         {
             Double priceDetect = 0;
             if (pos.checkWS() == true) //If Wholesale
             {
                 priceDetect = Convert.ToDouble(grabData[4, x]);
             }
             else
             {
                 priceDetect = Convert.ToDouble(grabData[3, x]);
             }
             dataGridView1.Rows.Add(grabData[0, x].ToString(), grabData[1, x].ToString(), grabData[2, x].ToString(), priceDetect, Convert.ToDouble(grabData[5, x]), Convert.ToDouble(grabData[6, x]), grabData[7, x].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #2
0
 private void txtBoxTender_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (Regex.IsMatch(txtBoxTender.Text, r.Amount()))
         {
             if (GetAmount <= Convert.ToDouble(txtBoxTender.Text))
             {
                 pos = new VO.PosVO();
                 frmLogin fl = new frmLogin();
                 pos.Pos_terminal = fl.tN;
                 TenderAmount     = Convert.ToDouble(txtBoxTender.Text);
                 pos.IncAmt       = TenderAmount;
                 pos.IncD();
                 ChangeDue  = TenderAmount - getAmount;
                 pos.DecAmt = ChangeDue;
                 pos.DecD();
                 IsCashTX = true;
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Insufficient Amount!\nPlease Try Again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Please Enter Tender Amount Propery!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Example #3
0
        private void txtBoxTender_KeyDown(object sender, KeyEventArgs e)
        {
            cstDlgAlert alert = new cstDlgAlert();

            if (e.KeyCode == Keys.Enter)
            {
                if (Regex.IsMatch(txtBoxTender.Text, r.Amount()))
                {
                    if (GetAmount <= Convert.ToDouble(txtBoxTender.Text))
                    {
                        pos = new VO.PosVO();
                        frmLogin fl = new frmLogin();
                        pos.Pos_terminal = fl.tN;
                        TenderAmount     = Convert.ToDouble(txtBoxTender.Text);
                        pos.IncAmt       = TenderAmount;
                        pos.IncD();
                        ChangeDue  = TenderAmount - getAmount;
                        pos.DecAmt = ChangeDue;
                        pos.DecD();
                        IsCashTX = true;
                        this.Close();
                    }
                    else
                    {
                        alert.MsgDiri = "Insufficient Amount!";
                        alert.ShowDialog();
                    }
                }
                else
                {
                    alert.MsgDiri = "Please Enter Tender Amount Properly!";
                    alert.ShowDialog();
                }
            }
        }
Example #4
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);
            }
        }