Exemplo n.º 1
0
        private void ContactAdd()
        {
            Data.ContactDetails details = new Data.ContactDetails();

            System.Windows.Forms.DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

            switch (SysConfigDetails.ContactAddWndType)
            {
                case ContactAddWndType.ContactAddWnd:
                    ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                    clsContactAddWnd.Caption = "Please enter customer name for deposit.";
                    clsContactAddWnd.ContactDetails = details;
                    clsContactAddWnd.TerminalDetails = TerminalDetails;
                    clsContactAddWnd.ShowDialog(this);
                    addresult = clsContactAddWnd.Result;
                    details = clsContactAddWnd.ContactDetails;
                    clsContactAddWnd.Close();
                    clsContactAddWnd.Dispose();
                    break;
                case ContactAddWndType.ContactAddHCareWnd:
                    ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                    clsContactAddHCareWnd.Caption = "Please enter customer name for deposit.";
                    clsContactAddHCareWnd.ContactDetails = details;
                    clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                    clsContactAddHCareWnd.ShowDialog(this);
                    addresult = clsContactAddHCareWnd.Result;
                    details = clsContactAddHCareWnd.ContactDetails;
                    clsContactAddHCareWnd.Close();
                    clsContactAddHCareWnd.Dispose();
                    break;
                default:
                    ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                    clsContactAddDetWnd.Caption = "Please enter customer name for deposit.";
                    clsContactAddDetWnd.ContactDetails = details;
                    clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                    clsContactAddDetWnd.ShowDialog(this);
                    addresult = clsContactAddDetWnd.Result;
                    details = clsContactAddDetWnd.ContactDetails;
                    clsContactAddDetWnd.Close();
                    clsContactAddDetWnd.Dispose();
                    break;
            }

            if (addresult == DialogResult.OK)
            {
                txtContact.Text = details.ContactName;
                txtContact.Tag = details.ContactID.ToString();
            }
        }
Exemplo n.º 2
0
        private bool SuspendTransaction(bool ShowNotificationWindow = true)
		{
			bool boRetValue = false;

			if (!mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot suspend an empty transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return boRetValue;
			}
            //if (mboIsRefund)
            //{
            //    MessageBox.Show("Sorry you cannot suspend a REFUND transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return boRetValue;
            //}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.SuspendTransaction);

			if (loginresult == DialogResult.OK)
			{
                if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Closed)
                {
                    this.LoadOptions();
                    boRetValue = true;
                    return boRetValue;
                }
                        
				if (mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
				{
					try
					{
						clsEvent.AddEvent("[" + lblCashier.Text + "] Suspending transaction no. " + lblTransNo.Text);

                        Data.ContactDetails details = new Data.ContactDetails();
                        DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                        switch (mclsSysConfigDetails.ContactAddWndType)
                        {
                            case ContactAddWndType.ContactAddWnd:
                            case ContactAddWndType.ContactAddNoLTOWnd:
                                ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                                clsContactAddWnd.Caption = "Suspend Transaction: Please Enter Customer Name";
                                clsContactAddWnd.ContactDetails = details;
                                clsContactAddWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddWnd.SysConfigDetails = mclsSysConfigDetails;
                                clsContactAddWnd.ShowDialog(this);
                                addresult = clsContactAddWnd.Result;
                                details = clsContactAddWnd.ContactDetails;
                                clsContactAddWnd.Close();
                                clsContactAddWnd.Dispose();
                                break;
                            case ContactAddWndType.ContactAddHCareWnd:
                                ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                                clsContactAddHCareWnd.Caption = "Suspend Transaction: Please Enter Customer Name";
                                clsContactAddHCareWnd.ContactDetails = details;
                                clsContactAddHCareWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddHCareWnd.CashierID = mclsSalesTransactionDetails.CashierID;
                                clsContactAddHCareWnd.ShowDialog(this);
                                addresult = clsContactAddHCareWnd.Result;
                                details = clsContactAddHCareWnd.ContactDetails;
                                clsContactAddHCareWnd.Close();
                                clsContactAddHCareWnd.Dispose();
                                break;
                            default:
                                ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                                clsContactAddDetWnd.Caption = "Suspend Transaction: Please Enter Customer Name";
                                clsContactAddDetWnd.ContactDetails = details;
                                clsContactAddDetWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddDetWnd.ShowDialog(this);
                                addresult = clsContactAddDetWnd.Result;
                                details = clsContactAddDetWnd.ContactDetails;
                                clsContactAddDetWnd.Close();
                                clsContactAddDetWnd.Dispose();
                                break;
                        }
                        
						if (addresult == DialogResult.OK)
						{
                            Cursor.Current = Cursors.WaitCursor;

                            LoadContact(Data.ContactGroupCategory.CUSTOMER, details);

							lblCustomer.Text = details.ContactName;
							lblCustomer.Tag = details.ContactID.ToString();

							Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                            clsSalesTransactions.Suspend(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, details);

                            // Sep 24, 2014 : update back the LastCheckInDate to min date
                            Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                            mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                            clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, mclsSalesTransactionDetails.TransactionDate);

							InsertAuditLog(AccessTypes.SuspendTransaction, "Suspend transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

							if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
								PrintReportFooterSection(true, TransactionStatus.Suspended, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, null, null);

                            clsSalesTransactions.CommitAndDispose();
							clsEvent.AddEventLn("Done!", true);

                            // Added Jun 30, 2013
                            if (mclsTerminalDetails.IsParkingTerminal)
                            {
                                if (MessageBox.Show("Would you like to print the Parking Ticket?", "Print Parking Ticket", MessageBoxButtons.YesNo,  MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                                    PrintParkingTicket();
                            }

                            this.LoadOptions();

							MessageBox.Show("Transaction has been SUSPENDED. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK);

							boRetValue = true;

                            Cursor.Current = Cursors.Default;
						}
						else { clsEvent.AddEventLn("Cancelled!"); }
					}
					catch (Exception ex)
					{ 
                        InsertErrorLogToFile(ex, "ERROR!!! Suspending transaction."); 
                    }
				}
				else
				{
					try
					{
                        
                        clsEvent.AddEvent("[" + lblCashier.Text + "] Suspending transaction no. " + lblTransNo.Text);

                        Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                        mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                        clsSalesTransactions.Suspend(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales);

                        InsertAuditLog(AccessTypes.SuspendTransaction, "Suspend transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

                        if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
                            PrintReportFooterSection(true, TransactionStatus.Suspended, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, null, null);

                        clsSalesTransactions.CommitAndDispose();
                        clsEvent.AddEventLn("Done!", true);

                        // Added Jun 30, 2013
                        if (mclsTerminalDetails.IsParkingTerminal)
                        {
                            if (MessageBox.Show("Would you like to print the Parking Ticket?", "Print Parking Ticket", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                                PrintParkingTicket();
                        }

                        this.LoadOptions();

                        MessageBox.Show("Transaction has been SUSPENDED. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        boRetValue = true;
                        
					}
					catch (Exception ex)
					{ 
                        InsertErrorLogToFile(ex, "ERROR!!! Suspending transaction."); 
                    }
				}
			}
			return boRetValue;
		}
Exemplo n.º 3
0
        private void UpdateContact()
        {
            try {
                
                DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts);
                if (loginresult == DialogResult.OK)
                {
                    loginresult = System.Windows.Forms.DialogResult.Cancel;
                    Data.ContactDetails clsContactDetails = new Data.ContactDetails(); 
                    if (mclsSalesTransactionDetails.CustomerID != 0 && mclsSalesTransactionDetails.CustomerID != Constants.C_RETAILPLUS_CUSTOMERID)
                    {
                        Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                        mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;
                        clsContactDetails = clsContact.Details(mclsSalesTransactionDetails.CustomerID);
                        clsContact.CommitAndDispose();
                        loginresult = System.Windows.Forms.DialogResult.OK;
                    }
                    else
                    {
                        ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                        clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                        clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                        clsContactWnd.TerminalDetails = mclsTerminalDetails;
                        clsContactWnd.ContactGroupCategory = Data.ContactGroupCategory.CUSTOMER;
                        clsContactWnd.ShowDialog(this);
                        clsContactDetails = clsContactWnd.Details;
                        loginresult = clsContactWnd.Result;
                        clsContactWnd.Close();
                        clsContactWnd.Dispose();
                    }

                    if (loginresult == System.Windows.Forms.DialogResult.OK)
                    {
                        DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                        switch (mclsSysConfigDetails.ContactAddWndType)
                        {
                            case ContactAddWndType.ContactAddWnd:
                            case ContactAddWndType.ContactAddNoLTOWnd:
                                ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                                clsContactAddWnd.Caption = "Update Customer [" + mclsContactDetails.ContactName + "]";
                                clsContactAddWnd.ContactDetails = clsContactDetails;
                                clsContactAddWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddWnd.SysConfigDetails = mclsSysConfigDetails;
                                clsContactAddWnd.ShowDialog(this);
                                addresult = clsContactAddWnd.Result;
                                clsContactDetails = clsContactAddWnd.ContactDetails;
                                clsContactAddWnd.Close();
                                clsContactAddWnd.Dispose();
                                break;
                            case ContactAddWndType.ContactAddHCareWnd:
                                ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                                clsContactAddHCareWnd.Caption = "Update Customer [" + mclsContactDetails.ContactName + "]";
                                clsContactAddHCareWnd.ContactDetails = clsContactDetails;
                                clsContactAddHCareWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddHCareWnd.ShowDialog(this);
                                addresult = clsContactAddHCareWnd.Result;
                                clsContactDetails = clsContactAddHCareWnd.ContactDetails;
                                clsContactAddHCareWnd.Close();
                                clsContactAddHCareWnd.Dispose();
                                break;
                            default:
                                ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                                clsContactAddDetWnd.Caption = "Update Customer [" + mclsContactDetails.ContactName + "]";
                                clsContactAddDetWnd.ContactDetails = clsContactDetails;
                                clsContactAddDetWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddDetWnd.ShowDialog(this);
                                addresult = clsContactAddDetWnd.Result;
                                clsContactDetails = clsContactAddDetWnd.ContactDetails;
                                clsContactAddDetWnd.Close();
                                clsContactAddDetWnd.Dispose();
                                break;
                        }
                        if (addresult == DialogResult.OK)
                        {
                            if (mboIsInTransaction)
                            {
                                LoadContact(Data.ContactGroupCategory.CUSTOMER, clsContactDetails);
                            }
                            MessageBox.Show("Customer has been updated and the details has been reloaded for this transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                
            }
            catch { }
        }
Exemplo n.º 4
0
		private void MainWnd_KeyDown(object sender, KeyEventArgs e)
		{
			try
			{
                if (e.KeyData == Keys.F1)
				{
                    ShowHelp(); 
                }
				else if (mboLocked && e.KeyData == Keys.F2)
				{ this.PriceInquiry(); }
				else if (e.KeyData == Keys.Escape)
				{
					if (txtBarCode.Text != string.Empty)
					{ txtBarCode.Text = string.Empty; txtBarCode.Focus(); }
					else
					{ this.Exit(); }
				}
				else if (mboLocked)
				{
					if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.L)
						LoggedOutCashier(true);
					else if (e.KeyData == Keys.Enter)
						this.DoLogin();
				}
				else if (!mboLocked)
				{
                    // 15Jun2015 : Do not allow to do anything in Closed Transaction
                    if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Closed ||
                        mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.ClosedOutOfStock ||
                        mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.ClosedWalkIn)
                    {
                        e.SuppressKeyPress = true;
                        if (e.KeyCode != Keys.F7 && e.KeyCode != Keys.Add && e.KeyCode != Keys.Up && e.KeyCode != Keys.Down && e.KeyCode != Keys.Oemplus) 
                        {   return; }
                    }

                    if (txtBarCode.Text != string.Empty && e.KeyCode != Keys.Enter) return;

					if (Control.ModifierKeys == Keys.Control)
					{
						switch (e.KeyCode)
						{
							case Keys.C:
								grpRLC.Visible = false;
								break;

							case Keys.H:
								DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.PrintTransactionHeader);

                                if (loginresult == DialogResult.OK)
								{
									PrintReportHeaderSection(true, DateTime.MinValue);
									MessageBox.Show("Transaction header has been printed.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
								}
								break;

							case Keys.E:
								ReleaseItems();
								break;

							case Keys.L:
								LoggedOutCashier(true);
								break;

							case Keys.O:
								OpenTransactionDrawer();
								break;

							case Keys.P:
								PrintCheckOutBill();
								break;

							case Keys.R:
								RefundTransaction();
								break;

							case Keys.S:
								PrintOrderSlip(false); 
								break;

                            case Keys.T:
                                UpdateIsConsignment();
                                lblConsignment.Visible = mclsSalesTransactionDetails.isConsignment;
                                break;

							case Keys.U:
								PackTransaction();
								break;

							case Keys.Insert:
								Float();
								break;

                            case Keys.F2:
                                ChangeProductCode();
                                break;

                            case Keys.F3:
                                ChangeItemRemarks();
                                break;

                            case Keys.F4:
                                setItemAsDemo();
                                break;

                            case Keys.F5:
                                UpdateContact();
                                break;

							case Keys.F6:
								SelectContact(AceSoft.RetailPlus.Data.ContactGroupCategory.AGENT);
								break;

							case Keys.Enter:
								if (!mboIsInTransaction)
								{
									if (MessageBox.Show("Are you sure you want to reload the default options?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
									{
                                        Data.SysConfig clsSysConfig = new Data.SysConfig(mConnection, mTransaction);
                                        mConnection = clsSysConfig.Connection; mTransaction = clsSysConfig.Transaction;

                                        try
                                        {
                                            mclsSysConfigDetails = clsSysConfig.get_SysConfigDetails();
                                        }
                                        catch (Exception ex)
                                        {
                                            clsEvent.AddErrorEventLn(ex);
                                        }
                                        clsSysConfig.CommitAndDispose();

										this.LoadOptions();
										MessageBox.Show("Done!", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
									}
								}
								break;

							case Keys.F7:
								IssueCreditCard();
								break;

							case Keys.F8:
								RenewCreditCard();
								break;

							case Keys.F9:
								CreditCardReplacement(CreditCardStatus.Replaced_Lost);
								break;

							case Keys.F10:
								CreditCardReplacement(CreditCardStatus.Replaced_Expired);
								break;

							case Keys.F11:
								CreditCardDeclareAsSuspended();
								break;

							case Keys.F12:
								CreditCardReactivate();
								break;
						}
					}
					else if (Control.ModifierKeys == Keys.Shift)
					{
						switch (e.KeyCode)
						{
                            case Keys.Oemplus:
                                AddItemAttachment();
                                break;
                            case Keys.F1:
                                ShowMallForwarder();
                                break;

							case Keys.F2:
								ChangePrice();
								break;

							case Keys.F4:
								ApplyItemDiscountForAllItem();
								break;

							case Keys.F5:
								ApplyTransDiscount();
								break;

							case Keys.F6:
								SelectWaiter();
								break;

							case Keys.F10:
								PaidOut();
								break;

							case Keys.F11:
								Deposit();
								break;

							case Keys.F12:
								ReprintTransaction();
								break;

							case Keys.Enter:
                                EnterCreditItemizePayment();
								break;

                            case Keys.Delete:
                                InitializeZRead(true);
                                break;
						}
					}
					else if (Control.ModifierKeys == Keys.Alt)
					{
						switch (e.KeyCode)
						{
                            case Keys.F1:
                                string strFileName = Application.ExecutablePath.ToUpper().Replace("RETAILPLUS.EXE","") + "print.prn";
                                RawPrinterHelper.SendFileToPrinter(mclsTerminalDetails.PrinterName, strFileName, "RetailPlus " + "print.prn");
                                CutPrinterPaper(mclsTerminalDetails.PrinterName);
                                MessageBox.Show("Done printing 'print.prn'", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                break;

                            case Keys.Enter:
                                VerifyCredit();
                                break;

							case Keys.S:
								/**********************
								 * December 18, 2008
								 * Added to reprint all items that are already printed
								 * *******************/
								PrintOrderSlip(true);
								break;

							case Keys.U:
								UnPackTransaction();
								break;

							case Keys.F2:
								ChangeAmount();
								break;

                            case Keys.F4:
                                e.SuppressKeyPress = true;
                                return;

							case Keys.F5:
								ApplyTransCharge(); //ChargeTypes.Percentage
								break;

							case Keys.F6:
								ApplyTransCharge(); //ChargeTypes.FixedValue
								break;

							case Keys.F7:
								IssueRewardCard();
								break;

							case Keys.F8:
								RenewRewardCard();
								break;

							case Keys.F9:
								RewardCardReplacement(RewardCardStatus.Replaced_Lost);
								break;

							case Keys.F10:
								RewardCardReplacement(RewardCardStatus.Replaced_Expired);
								break;

							case Keys.F11:
								RewardCardDeclareAsLost();
								break;

							case Keys.F12:
								RewardCardReactivate();
								break;

                            case Keys.Insert:
                                ChangeZeroRated(true);
                                break;

                            case Keys.Delete:
                                ChangeZeroRated(false);
                                break;

							//case Keys.Enter:
							//    mclsTerminalDetails.TrustFund = 0;
							//    MessageBox.Show("Done!", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
							//    break;
							
						}
					}
                    else if (Control.ModifierKeys == (Keys.Control | Keys.Shift))
                    {
                        Security.AccessRights clsAccessRights; Security.AccessRightsDetails clsDetails;
                        switch (e.KeyCode)
                        {
                            case Keys.Enter:
                                clsAccessRights = new Security.AccessRights();
                                clsDetails = new Security.AccessRightsDetails();
                                clsDetails = clsAccessRights.Details(mclsSalesTransactionDetails.CashierID, (Int16)AccessTypes.ReprintZRead);
                                clsAccessRights.CommitAndDispose();

                                if (clsDetails.Read)
                                {
                                    UpdateBranchAndTerminalNo();
                                }
                                break;
                            case Keys.F2:
                                clsAccessRights = new Security.AccessRights();
                                clsDetails = new Security.AccessRightsDetails();
                                clsDetails = clsAccessRights.Details(mclsSalesTransactionDetails.CashierID, (Int16)AccessTypes.Contacts);
                                clsAccessRights.CommitAndDispose();

                                if (clsDetails.Write)
                                {
                                    Data.ContactDetails clsContactDetails;
                                    DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                                    switch (mclsSysConfigDetails.ContactAddWndType)
                                    {
                                        case ContactAddWndType.ContactAddWnd:
                                        case ContactAddWndType.ContactAddNoLTOWnd:
                                            ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                                            clsContactAddWnd.Caption = "Quickly add new customer.";
                                            clsContactAddWnd.ContactDetails = new Data.ContactDetails();
                                            clsContactAddWnd.TerminalDetails = mclsTerminalDetails;
                                            clsContactAddWnd.SysConfigDetails = mclsSysConfigDetails;
                                            clsContactAddWnd.ShowDialog(this);
                                            addresult = clsContactAddWnd.Result;
                                            clsContactDetails = clsContactAddWnd.ContactDetails;
                                            clsContactAddWnd.Close();
                                            clsContactAddWnd.Dispose();
                                            break;
                                        case ContactAddWndType.ContactAddHCareWnd:
                                            ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                                            clsContactAddHCareWnd.Caption = "Quickly add new customer.";
                                            clsContactAddHCareWnd.ContactDetails = new Data.ContactDetails();
                                            clsContactAddHCareWnd.TerminalDetails = mclsTerminalDetails;
                                            clsContactAddHCareWnd.ShowDialog(this);
                                            addresult = clsContactAddHCareWnd.Result;
                                            clsContactDetails = clsContactAddHCareWnd.ContactDetails;
                                            clsContactAddHCareWnd.Close();
                                            clsContactAddHCareWnd.Dispose();
                                            break;
                                        default:
                                            ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                                            clsContactAddDetWnd.Caption = "Quickly add new customer.";
                                            clsContactAddDetWnd.ContactDetails = new Data.ContactDetails();
                                            clsContactAddDetWnd.TerminalDetails = mclsTerminalDetails;
                                            clsContactAddDetWnd.ShowDialog(this);
                                            addresult = clsContactAddDetWnd.Result;
                                            clsContactDetails = clsContactAddDetWnd.ContactDetails;
                                            clsContactAddDetWnd.Close();
                                            clsContactAddDetWnd.Dispose();
                                            break;
                                    }

                                    if (addresult == DialogResult.OK) LoadContact(Data.ContactGroupCategory.CUSTOMER, clsContactDetails);
                                }
                                break;
                            case Keys.F6:
                                UpdateContact();
                                break;
                            case Keys.F9:
                                // needs the counter so that it will only show if CTRL+SHIFT+F9 is hit twice
                                if (miReprintZReadCounter >= 1)
                                {
                                    clsAccessRights = new Security.AccessRights();
                                    clsDetails = new Security.AccessRightsDetails();
                                    clsDetails = clsAccessRights.Details(mclsSalesTransactionDetails.CashierID, (Int16)AccessTypes.ReprintZRead);
                                    clsAccessRights.CommitAndDispose();

                                    if (clsDetails.Read)
                                    {
                                        ReprintZRead();
                                    }
                                    miReprintZReadCounter = 0;
                                }
                                else
                                { miReprintZReadCounter += 1; }

                                break;
                        }
                    }
                    else
                    {
                        switch (e.KeyData)
                        {
                            case Keys.Add:
                            case Keys.Oemplus:
                                AddItemAttachment();
                                break;
                            case Keys.Up:
                                MoveItemUp();
                                break;

                            case Keys.Down:
                                MoveItemDown();
                                break;

                            case Keys.Escape:
                                this.Exit();
                                break;

                            case Keys.F1:
                                ShowHelp();
                                break;

                            case Keys.F2:
                                ChangeQuantity();
                                break;

                            case Keys.F3:
                                ReturnItem();
                                break;

                            case Keys.F4:
                                ApplyItemDiscount();
                                break;

                            case Keys.F5:
                                ApplyTransDiscount();
                                break;

                            case Keys.F6:
                                SelectContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER);
                                break;

                            case Keys.F7:
                                if (!mboIsInTransaction)
                                {
                                    ResumeClosedTransaction();
                                }
                                else
                                {
                                    SuspendTransaction();
                                }
                                break;

                            case Keys.F8:
                                ResumeTransaction();
                                break;

                            case Keys.F9:
                                VoidTransaction();
                                break;

                            case Keys.F10:
                                Disburse();
                                break;

                            case Keys.F11:
                                WithHold();
                                break;

                            case Keys.F12:
                                ShowPrintWindow();
                                break;

                            case Keys.Enter:
                                if (!string.IsNullOrEmpty(txtBarCode.Text.Trim()))
                                    if (txtBarCode.Text.Contains(Constants.SWIPE_REWARD_CARD))
                                    {
                                        clsEvent.AddEventLn("[" + lblCashier.Text + "] Selecting customer.", true);
                                        LoadContact(Data.ContactGroupCategory.CUSTOMER, new Data.ContactDetails());
                                    }
                                    else
                                    {
                                        if (txtBarCode.Text.Contains("*") && txtBarCode.Text.Split('*')[0].Contains("-"))
                                            MessageBox.Show("Sorry you cannot enter a negative quantity when selling an item.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                                        else
                                            ReadBarCode();
                                    }
                                else if (lblCustomer.Text.Trim().ToUpper() == Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER)
                                    CloseTransactionAsOrderSlip();
                                else
                                    CloseTransaction();
                                break;

                            case Keys.Back:
                                if (string.IsNullOrEmpty(txtBarCode.Text.Trim()))
                                    VoidItem();
                                break;

                            case Keys.Insert:
                                {
                                    if (mclsTerminalDetails.CashCountBeforeReport)
                                    {
                                        if (!mboIsCashCountInitialized)
                                            CashCount();
                                        else
                                            MessageBox.Show("Sorry, cash count has been already initialized for the day. You can only initialize cash count once a day.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                                    }
                                    else { CashCount(); }
                                    break;
                                }

                            case Keys.Delete:
                                InitializeZRead(false);
                                break;

                            case Keys.PageDown:
                                SelectProduct(false);
                                break;

                            case Keys.Right:
                                SelectProduct(false); // 13May2013 LEAceron: by right, price should be visible.
                                break;

                            case Keys.PageUp:
                                SelectProduct(true);
                                break;

                            case Keys.Left:
                                PriceInquiry();
                                break;
                        }
                    }
				}
			}
			catch (Exception ex)
			{
                InsertErrorLogToFile(ex, "ERROR!!! Processing event.");
			}
		}
Exemplo n.º 5
0
        private void ContactUpdate()
        {
            try
            {
                if (!EnableContactAddUpdate) return;

                Int64 iContactID = Convert.ToInt64(dgContacts[dgContacts.CurrentRowIndex, 0].ToString());

                if (iContactID != 0 && iContactID != Constants.C_RETAILPLUS_CUSTOMERID)
                {
                    Data.Contacts clsContact = new Data.Contacts();
                    Data.ContactDetails details = clsContact.Details(iContactID);
                    clsContact.CommitAndDispose();

                    DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                    switch (SysConfigDetails.ContactAddWndType)
                    {
                        case ContactAddWndType.ContactAddWnd:
                        case ContactAddWndType.ContactAddNoLTOWnd:
                            ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                            clsContactAddWnd.Caption = "Update Customer [" + details.ContactName + "]";
                            clsContactAddWnd.ContactDetails = details;
                            clsContactAddWnd.TerminalDetails = TerminalDetails;
                            clsContactAddWnd.SysConfigDetails = SysConfigDetails;
                            clsContactAddWnd.ShowDialog(this);
                            addresult = clsContactAddWnd.Result;
                            details = clsContactAddWnd.ContactDetails;
                            clsContactAddWnd.Close();
                            clsContactAddWnd.Dispose();
                            break;
                        case ContactAddWndType.ContactAddHCareWnd:
                            ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                            clsContactAddHCareWnd.Caption = "Update Customer [" + details.ContactName + "]";
                            clsContactAddHCareWnd.ContactDetails = details;
                            clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                            clsContactAddHCareWnd.ShowDialog(this);
                            addresult = clsContactAddHCareWnd.Result;
                            details = clsContactAddHCareWnd.ContactDetails;
                            clsContactAddHCareWnd.Close();
                            clsContactAddHCareWnd.Dispose();
                            break;
                        default:
                            ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                            clsContactAddDetWnd.Caption = "Update Customer [" + details.ContactName + "]";
                            clsContactAddDetWnd.ContactDetails = details;
                            clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                            clsContactAddDetWnd.ShowDialog(this);
                            addresult = clsContactAddDetWnd.Result;
                            details = clsContactAddDetWnd.ContactDetails;
                            clsContactAddDetWnd.Close();
                            clsContactAddDetWnd.Dispose();
                            break;
                    }
                    if (addresult == DialogResult.OK)
                    {
                        txtSearch.Text = details.ContactCode;
                        LoadContactData();
                    }
                }
            }
            catch { }
        }
Exemplo n.º 6
0
		private void ContactAdd()
		{
            if (!EnableContactAddUpdate) return;

            Data.ContactDetails details = new Data.ContactDetails();
            DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

            switch (SysConfigDetails.ContactAddWndType)
            {
                case ContactAddWndType.ContactAddWnd:
                case ContactAddWndType.ContactAddNoLTOWnd:
                    ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                    clsContactAddWnd.Caption = "Quickly add new customer.";
                    clsContactAddWnd.ContactDetails = details;
                    clsContactAddWnd.TerminalDetails = TerminalDetails;
                    clsContactAddWnd.SysConfigDetails = SysConfigDetails;
                    clsContactAddWnd.ShowDialog(this);
                    addresult = clsContactAddWnd.Result;
                    details = clsContactAddWnd.ContactDetails;
                    clsContactAddWnd.Close();
                    clsContactAddWnd.Dispose();
                    break;
                case ContactAddWndType.ContactAddHCareWnd:
                    ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                    clsContactAddHCareWnd.Caption = "Quickly add new customer.";
                    clsContactAddHCareWnd.ContactDetails = details;
                    clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                    clsContactAddHCareWnd.ShowDialog(this);
                    addresult = clsContactAddHCareWnd.Result;
                    details = clsContactAddHCareWnd.ContactDetails;
                    clsContactAddHCareWnd.Close();
                    clsContactAddHCareWnd.Dispose();
                    break;
                default:
                    ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                    clsContactAddDetWnd.Caption = "Quickly add new customer.";
                    clsContactAddDetWnd.ContactDetails = details;
                    clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                    clsContactAddDetWnd.ShowDialog(this);
                    addresult = clsContactAddDetWnd.Result;
                    details = clsContactAddDetWnd.ContactDetails;
                    clsContactAddDetWnd.Close();
                    clsContactAddDetWnd.Dispose();
                    break;
            }

            if (addresult == DialogResult.OK)
            {
                txtSearch.Text = details.ContactCode;
                LoadContactData();
            }
		}