Exemple #1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            if (ValidateInput())
            {
                clsSubDAccount subd = clsSubDAccount.GetSubDAccount(txtMobileNum.Text);

                clsLoadWalletTransaction wallet = new clsLoadWalletTransaction();
                wallet.Load_Id            = m_LoadAccount.LoadId;
                wallet.UserId             = myPosWide.m_user.UserId;
                wallet.SubDId             = subd != null ? subd.Id_subdAccounts : 0;
                wallet.Timestamp          = DateTime.Now;
                wallet.LoadAmount         = double.Parse(txtLoadAmount.Text);
                wallet.MobileNum          = txtMobileNum.Text;
                wallet.DiscountPercentage = double.Parse(txtDisCount.Text);
                wallet.AmtDue             = double.Parse(txtAmtDue.Text);

                frmInput input     = new frmInput();
                double   amountdue = wallet.AmtDue;
                input.Title   = "Payment";
                input.Value   = amountdue.ToString("0.00");
                input.Caption = "Enter Tendered Amount";

                if (input.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (Convert.ToDouble(input.Value) >= amountdue)
                    {
                        wallet.TenderedAmount = Convert.ToDouble(input.Value);
                        if (wallet.Save())
                        {
                            Clear();
                            m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId);
                            wallet.PrintReceipt();
                            RefreshAccount();
                        }
                        else
                        {
                            MessageBox.Show("Transaction not saved.", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("Amount entered is less than the Amount Due. Charge to Sub-D Account?", "Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
                        {
                            wallet.TenderedAmount = Convert.ToDouble(input.Value);
                            if (wallet.Save())
                            {
                                Clear();
                                m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId);
                                wallet.PrintReceipt();
                                RefreshAccount();
                            }
                            else
                            {
                                MessageBox.Show("Transaction not saved.", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void AddItemToGrid(clsLoadWalletTransaction hist)
        {
            clsLoadAccount load   = clsLoadAccount.GetLoadAccount(hist.Load_Id);
            int            rowidx = dgvTrans.Rows.Add();

            dgvTrans.Rows[rowidx].Cells[0].Value = hist.Timestamp;
            dgvTrans.Rows[rowidx].Cells[1].Value = load.Description;
            dgvTrans.Rows[rowidx].Cells[2].Value = hist.MobileNum;
            dgvTrans.Rows[rowidx].Cells[3].Value = hist.LoadAmount;
            dgvTrans.Rows[rowidx].Cells[4].Value = hist.DiscountPercentage;
            dgvTrans.Rows[rowidx].Cells[5].Value = hist.AmtDue;

            dgvTrans.Rows[rowidx].Cells[6].Value = hist.Username;
        }