예제 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("Account Name must have a value.", "New Account", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            clsAccountInfo ac = new clsAccountInfo(Convert.ToInt32(lblAccountId.Text));

            if (ac != null && ac.AccountId > 0)
            {
                ac.CreditLimit = Convert.ToDouble(txtLimit.Text);
            }
            else
            {
                ac.AccountId   = Convert.ToInt32(lblAccountId.Text);
                ac.AccountName = txtName.Text.Trim();
                if (txtLimit.Text.Trim() != "")
                {
                    ac.CreditLimit = Convert.ToDouble(txtLimit.Text);
                }
                else
                {
                    ac.CreditLimit = 0;
                }
            }
            if (ac.Save())
            {
                ClearFields();
            }
            DisplayAccounts();
        }
예제 #2
0
        private void AddItemToGrid(clsAccountInfo act)
        {
            int rowidx = dgvAccounts.Rows.Add();

            dgvAccounts.Rows[rowidx].Cells[0].Value = act.AccountId;
            dgvAccounts.Rows[rowidx].Cells[1].Value = act.AccountName;
            dgvAccounts.Rows[rowidx].Cells[2].Value = act.CreditLimit;
        }
예제 #3
0
        private void AddItemToGrid(clsAccountInfo act)
        {
            int rowidx = dgvAccounts.Rows.Add();

            dgvAccounts.Rows[rowidx].Cells[0].Value = act.AccountId;
            dgvAccounts.Rows[rowidx].Cells[1].Value = act.AccountName;
            dgvAccounts.Rows[rowidx].Cells[2].Value = act.CreditLimit;
            dgvAccounts.Rows[rowidx].Cells[3].Value = act.PrincipalBalance;
            dgvAccounts.Rows[rowidx].Cells[4].Value = act.TotalInterest;
            dgvAccounts.Rows[rowidx].Cells[5].Value = act.AccountReceivable;
        }
예제 #4
0
 private void DisplayAccounts()
 {
     if (txtName.Text.Trim() == "")
     {
         return;
     }
     accounts = clsAccountInfo.GetAccounts(txtName.Text.Trim());
     if (accounts != null)
     {
         if (accounts.Count == 1)
         {
             SelectedAccount = accounts[0];
             DialogResult    = System.Windows.Forms.DialogResult.OK;
         }
         else
         {
             dgvAccounts.Rows.Clear();
             foreach (clsAccountInfo a in accounts)
             {
                 AddItemToGrid(a);
             }
         }
     }
 }
예제 #5
0
        private void SelectAcnt()
        {
            if (dgvAccounts.Rows.Count >= 1)
            {
                SelectedAccount = GetAccountInfo(Convert.ToInt32(dgvAccounts.SelectedRows[0].Cells[0].Value));
                if (AmountToCHarge > 0 && (SelectedAccount.AccountReceivable + AmountToCHarge > SelectedAccount.CreditLimit && SelectedAccount.CreditLimit > 0))
                {
                    if (MessageBox.Show("Credit has exceeded the limit. Would you like to continue?", "Credit Limit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (GetApproval(UserAccess.Manager) == false)
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }
예제 #6
0
        private bool CancelPayment()
        {
            if (!clsUtil.GetApproval(m_user, UserAccess.Manager))
            {
                return(false);
            }
            frmSelectAccounts acct = new frmSelectAccounts(0, m_user);

            if (acct.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                clsAccountInfo a = acct.SelectedAccount;

                frmInput input = new frmInput();
                input.Title         = "Retrieve Payment Info";
                input.Caption       = "Payment Reference";
                input.IsHiddenInput = false;
                input.IsNumericOnly = true;
                input.withDecimal   = false;
                input.Value         = "";
                if (input.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    clsPaymentInfo payment = clsPaymentInfo.GetPayment(Convert.ToInt32(input.Value));
                    if (payment != null)
                    {
                        clsChargedTransaction charges = clsChargedTransaction.GetChargedTransaction(payment.OrNum);

                        if (charges != null && payment.PaymentId != 0 && payment.AccountId == a.AccountId)
                        {
                            if (payment.Remarks.ToLower().Contains("interest"))
                            {
                                MessageBox.Show("Interest payment cancellation not allowed!", "Cancel Payment", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            }
                            else if (MessageBox.Show(string.Format("Are you sure you want to cancel payment?\nRefno:{0}\nRemarks:{1}\nAmount:P {2:0.00}", payment.PaymentId, payment.Remarks, payment.AmountPaid), "Cancel Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                            {
                                if (payment.Remarks.ToLower().Contains("principal"))
                                {
                                    a.PrincipalBalance += payment.AmountPaid;
                                    a.Save();
                                    charges.TransBalance += payment.AmountPaid;
                                    charges.SaveChargeTransaction();

                                    if (clsPaymentInfo.CancelPayment(payment.PaymentId))
                                    {
                                        MessageBox.Show("Payment successfully cancelled!", "Cancel Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    }
                                    else
                                    {
                                        MessageBox.Show("Cancel Payment did not succeed!", "Cancel Payment", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Payment Reference not found under this account", "Cancel Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            return(false);
        }