Beispiel #1
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;
		}
Beispiel #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.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
				{
					try
					{
						clsEvent.AddEvent("[" + lblCashier.Text + "] Suspending transaction no. " + lblTransNo.Text);

                        DialogResult addresult; Data.ContactDetails details;
						TableSelectWnd clsTableSelectWnd = new TableSelectWnd();
						clsTableSelectWnd.TerminalDetails = mclsTerminalDetails;
						clsTableSelectWnd.ShowAvailableTableOnly = mboIsInTransaction;
                        clsTableSelectWnd.ContactGroupCategory = ContactGroupCategory.TABLES;
						clsTableSelectWnd.ShowDialog(this);
						details = clsTableSelectWnd.Details;
						addresult = clsTableSelectWnd.Result;
						clsTableSelectWnd.Close();
						clsTableSelectWnd.Dispose();

                        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, Constants.C_DATE_MIN_VALUE);
                            clsContact.UpdateLastCheckInDate(details.ContactID, 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);

                            if (mclsTerminalDetails.WithRestaurantFeatures)
                            {
                                // show only the message if success printing.
                                // error message is already shown during error printing.
                                if (PrintOrderSlip(false, true))
                                    MessageBox.Show("Transaction has been SUSPENDED & Order's has been re-send to Kitchen/Bar printer's. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK);
                            }
                            else
                                MessageBox.Show("Transaction has been SUSPENDED. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK);

                            this.LoadOptions();

                            boRetValue = true;

                            Cursor.Current = Cursors.Default;
                        }
                        else { clsEvent.AddEventLn("Cancelled!"); }
					}
					catch (Exception ex)
					{ clsEvent.AddErrorEventLn(ex); }
				}
				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);

                        if (mclsTerminalDetails.WithRestaurantFeatures)
                        {
                            // show only the message if success printing.
                            // error message is already shown during error printing.
                            if (PrintOrderSlip(false, true))
                                MessageBox.Show("Transaction has been SUSPENDED & Order's has been re-send to Kitchen/Bar printer's. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK);
                            
                        }
                        else
                            MessageBox.Show("Transaction has been SUSPENDED. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK);

                        this.LoadOptions();

                        boRetValue = true;
                    }
                    catch (Exception ex)
                    { clsEvent.AddErrorEventLn(ex); }
				}
			}
			return boRetValue;
		}