コード例 #1
0
        public DialogResult ShowNoControl(IWin32Window owner, out decimal RetValue, decimal InitValue = 0, string Caption = "")
        {
            DialogResult result = System.Windows.Forms.DialogResult.Cancel;

            try
            {
                NoControl clsNoControl = new NoControl();
                clsNoControl.TerminalDetails = mclsTerminalDetails;
                clsNoControl.Caption = Caption;
                clsNoControl.NoValue = InitValue;
                clsNoControl.ShowDialog(owner);
                RetValue = decimal.TryParse(clsNoControl.NoValue.ToString(), out RetValue) ? RetValue : 0;
                result = clsNoControl.Result;
                clsNoControl.Close();
                clsNoControl.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
            return result;
        }
コード例 #2
0
		private void CreditVerificationWnd_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
            DialogResult result; 
            keyCommand = e.KeyData;
			switch (e.KeyData)
			{
				case Keys.Escape:
					dialog = DialogResult.Cancel;
					this.Hide(); 
					break;

                case Keys.Enter:
                    dialog = DialogResult.OK;
                    this.Hide();
                    break;

                case Keys.F3:
                    if (mContactDetails.ContactID == 0) return;
                    CreditSalesWnd clsCreditSalesWnd = new CreditSalesWnd();
                    clsCreditSalesWnd.TerminalDetails = TerminalDetails;
                    clsCreditSalesWnd.SysConfigDetails = SysConfigDetails;
                    clsCreditSalesWnd.CustomerDetails = mContactDetails;
                    clsCreditSalesWnd.ShowDialog(this);
                    clsCreditSalesWnd.Close();
                    clsCreditSalesWnd.Dispose();
                    break;

                case Keys.F4:
                    if (mContactDetails.ContactID == 0) return;
                    CreditPaymentsWnd clsCreditPaymentsWnd = new CreditPaymentsWnd();
                    clsCreditPaymentsWnd.TerminalDetails = TerminalDetails;
                    clsCreditPaymentsWnd.SysConfigDetails = SysConfigDetails;
                    clsCreditPaymentsWnd.CustomerDetails = mContactDetails;
                    clsCreditPaymentsWnd.CashierID = CashierID;
                    clsCreditPaymentsWnd.ShowDialog(this);
                    result = clsCreditPaymentsWnd.Result;
                    clsCreditPaymentsWnd.Close();
                    clsCreditPaymentsWnd.Dispose();

                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        LoadData();
                        txtScan.Text = mContactDetails.CreditDetails.CreditCardNo;
                    }
                    break;

                case Keys.F6:
                    Data.ContactDetails details;
				    ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                    clsContactWnd.EnableContactAddUpdate = true;
                    clsContactWnd.TerminalDetails = TerminalDetails;
				    clsContactWnd.ContactGroupCategory = Data.ContactGroupCategory.CUSTOMER;
				    clsContactWnd.ShowDialog(this);
				    details = clsContactWnd.Details;
				    result = clsContactWnd.Result;
				    clsContactWnd.Close();
				    clsContactWnd.Dispose();
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        switch (SysConfigDetails.CreditPaymentType)
                        {
                            case CreditPaymentType.Houseware:
                                LoadData();
                                txtScan.Text = details.CreditDetails.CreditCardNo;
                                break;
                            case CreditPaymentType.Normal:
                            case CreditPaymentType.MPC:
                            default:
                                txtScan.Text = details.ContactCode;
                                LoadData();
                                txtScan.Text = details.ContactCode;
                                break;
                        }
                        
                    }
                    break;

                case Keys.F7:
                    if (mContactDetails.ContactID != 0 && mboCreditAmountDueAdjustment)
                    {
                        if (mContactDetails.CreditDetails.CardTypeDetails.WithGuarantor)
                        {
                            CreditBillWGuaWnd clsCreditBillWGuaWnd = new CreditBillWGuaWnd();
                            clsCreditBillWGuaWnd.CreditorDetails = mContactDetails;
                            clsCreditBillWGuaWnd.GuarantorDetails = mGuarantorDetails;
                            clsCreditBillWGuaWnd.TerminalDetails = TerminalDetails;
                            clsCreditBillWGuaWnd.ShowDialog(this);
                            result = clsCreditBillWGuaWnd.Result;
                            clsCreditBillWGuaWnd.Close();
                            clsCreditBillWGuaWnd.Dispose();
                        }
                        else 
                        {
                            CreditBillNoGuaWnd clsCreditBillNoGuaWnd = new CreditBillNoGuaWnd();
                            clsCreditBillNoGuaWnd.CreditorDetails = mContactDetails;
                            clsCreditBillNoGuaWnd.GuarantorDetails = mGuarantorDetails;
                            clsCreditBillNoGuaWnd.TerminalDetails = TerminalDetails;
                            clsCreditBillNoGuaWnd.ShowDialog(this);
                            result = clsCreditBillNoGuaWnd.Result;
                            clsCreditBillNoGuaWnd.Close();
                            clsCreditBillNoGuaWnd.Dispose();
                        }
                        if (result == System.Windows.Forms.DialogResult.OK)
                        {
                            Methods.InsertAuditLog(TerminalDetails, CashierName, AccessTypes.CreditAmountDueAdjustment, "Adjust the billing statement of " + mContactDetails.ContactName + ".");

                            MessageBox.Show("Billing has been adjusted.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            LoadData();
                            txtScan.Text = mContactDetails.CreditDetails.CreditCardNo;
                        }
                    }
                    break;
                case Keys.F8:
                    if (mContactDetails.ContactID != 0 && mboCreditAmountDueAdjustment)
                    {
                        NoControl clsNoControl = new NoControl();
                        clsNoControl.Caption = "Enter new current Credit amount.";
                        clsNoControl.NoValue = mContactDetails.Credit;
                        clsNoControl.ShowDialog(this);
                        result = clsNoControl.Result;
                        decimal decAmount = clsNoControl.NoValue;
                        clsNoControl.Close();
                        clsNoControl.Dispose();
                        if (result == System.Windows.Forms.DialogResult.OK)
                        {
                            if (MessageBox.Show("Are you sure you want adjust the credit balance of " + mContactDetails.ContactName + " from: " + mContactDetails.Credit.ToString("#,##0.#0") + " to " + decAmount.ToString("#,##0.#0"), "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                            {
                                AceSoft.RetailPlus.Client.LocalDB clsLocalConnection = new AceSoft.RetailPlus.Client.LocalDB();
                                clsLocalConnection.GetConnection();

                                Data.Creditors clsCreditors = new Data.Creditors(clsLocalConnection.Connection, clsLocalConnection.Transaction);

                                clsCreditors.AutoAdjustCredit(mContactDetails, decAmount);

                                clsLocalConnection.CommitAndDispose();

                                Methods.InsertAuditLog(TerminalDetails, CashierName, AccessTypes.CreditAmountDueAdjustment, "Adjust the credit balance of " + mContactDetails.ContactName + " from: " + mContactDetails.Credit.ToString("#,##0.#0") + " to " + decAmount.ToString("#,##0.#0"));

                                MessageBox.Show("Current credit has been adjusted.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                LoadData();
                                txtScan.Text = mContactDetails.CreditDetails.CreditCardNo;
                            }
                        }
                    }
                    break;
                case Keys.F11:
                    if (!lblF11.Visible) return;
                    if (dgvItems.Rows.Count > 0)
                    {
                        PrintSOA();
                    }
                    break;
				case Keys.F12:
                    if (mContactDetails.ContactID == 0)
                    {
                        MessageBox.Show("Please select a valid card to print the verification slip.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (mContactDetails.CreditDetails.CardTypeDetails.WithGuarantor && !mGuarantorDetails.CreditDetails.CreditActive)
                    {
                        MessageBox.Show("Sorry printing verification slip is not allowed. Your GUARANTOR credit status InActive.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (mContactDetails.CreditDetails.ExpiryDate < new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23,59,59))
                    {
                        MessageBox.Show("Sorry printing verification slip is not allowed. Your card is already expired.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (!mContactDetails.CreditDetails.CreditActive)
                    {
                        MessageBox.Show("Sorry printing verification slip is not allowed for InActive Credit Cards.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        dialog = DialogResult.OK;
                        this.Hide();
                    }
					break;
			}
		}