private void CheckInTable() { // Added Sep 24, 2014 as required by Bellevue to check how long the customer is already in if (!SuspendTransactionAndContinue()) return; try { clsEvent.AddEvent("[" + lblCashier.Text + "] Checkin table."); DialogResult result; Data.ContactDetails details; TableSelectWnd clsTableSelectWnd = new TableSelectWnd(); clsTableSelectWnd.TerminalDetails = mclsTerminalDetails; clsTableSelectWnd.ContactGroupCategory = ContactGroupCategory.TABLES; clsTableSelectWnd.ShowAvailableTableOnly = true; //mboIsInTransaction clsTableSelectWnd.ShowDialog(this); details = clsTableSelectWnd.Details; result = clsTableSelectWnd.Result; clsTableSelectWnd.Close(); clsTableSelectWnd.Dispose(); if (result == DialogResult.OK) { DateTime dteCheckIn = DateTime.Now; Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(details.ContactID, dteCheckIn); clsContacts.CommitAndDispose(); clsEvent.AddEventLn("Done!", true); MessageBox.Show(details.ContactName + " has been successfully checkin @ " + dteCheckIn.ToString("yyyy-MM-dd hh:mm"), "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { clsEvent.AddErrorEventLn(ex); } }
private void SelectContact(AceSoft.RetailPlus.Data.ContactGroupCategory enumContactGroupCategory) { // Sep 24, 2011 Lemuel E. Aceron // Added order slip wherein all punch items will not change sales and inventory // a customer named ORDER SLIP should be defined in contacts if (lblCustomer.Text.Trim().ToUpper() == Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER && mboIsInTransaction && enumContactGroupCategory == AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER) { MessageBox.Show("Sorry you cannot select ORDER SLIP customer when an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto && mboIsInTransaction) { switch (enumContactGroupCategory) { case AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER: MessageBox.Show("Sorry you cannot select a customer when an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; case AceSoft.RetailPlus.Data.ContactGroupCategory.AGENT: MessageBox.Show("Sorry you cannot select an agent when an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } return; } try { switch (enumContactGroupCategory) { case AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER: clsEvent.AddEvent("[" + lblCashier.Text + "] Selecting customer."); if (mclsTerminalDetails.ShowCustomerSelection == false) { clsEvent.AddEventLn("Cancelled! ShowCustomerSelection is OFF, reward is ON."); txtBarCode.Text = Constants.SWIPE_REWARD_CARD; txtBarCode.Focus(); txtBarCode.SelectionStart = txtBarCode.Text.Length + 1; return; } break; case AceSoft.RetailPlus.Data.ContactGroupCategory.AGENT: clsEvent.AddEvent("[" + lblCashier.Text + "] Selecting agent."); break; } DialogResult result; Data.ContactDetails details; TableSelectWnd clsTableSelectWnd = new TableSelectWnd(); clsTableSelectWnd.TerminalDetails = mclsTerminalDetails; clsTableSelectWnd.ContactGroupCategory = enumContactGroupCategory; clsTableSelectWnd.ShowAvailableTableOnly = mboIsInTransaction; clsTableSelectWnd.ShowDialog(this); details = clsTableSelectWnd.Details; result = clsTableSelectWnd.Result; clsTableSelectWnd.Close(); clsTableSelectWnd.Dispose(); if (result == DialogResult.OK) { // Nov 18, 2011 : Lemu - auto suspend if already doing a transaction if (mboIsInTransaction) { if (mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID && mclsSalesTransactionDetails.CustomerID != details.ContactID) { Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE); clsContacts.UpdateLastCheckInDate(details.ContactID, mclsSalesTransactionDetails.TransactionDate); clsContacts.CommitAndDispose(); LoadContact(ContactGroupCategory.CUSTOMER, details); return; } else if (mclsSalesTransactionDetails.CustomerID == details.ContactID) { return; } else if (mclsSalesTransactionDetails.CustomerID != details.ContactID) { if (MessageBox.Show("Would you like to move from table: " + mclsSalesTransactionDetails.CustomerDetails.ContactCode + " to table: " + details.ContactCode + "." + Environment.NewLine + "Please click [Yes] to move, [Cancel] to create new transaction in the selected table.", "RetailPlus", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK) { Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE); clsContacts.UpdateLastCheckInDate(details.ContactID, mclsSalesTransactionDetails.TransactionDate); clsContacts.CommitAndDispose(); LoadContact(ContactGroupCategory.CUSTOMER, details); return; } else { this.SuspendTransaction(false); } } } else { Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE); clsContacts.UpdateLastCheckInDate(details.ContactID, mclsSalesTransactionDetails.TransactionDate); clsContacts.CommitAndDispose(); } Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; string stTransactionNo = clsSalesTransactions.getSuspendedTransactionNo(details.ContactID, mclsTerminalDetails.TerminalNo, mclsTerminalDetails.BranchID); if (stTransactionNo != string.Empty) { LoadTransaction(stTransactionNo, mclsTerminalDetails.TerminalNo); } else { this.LoadOptions(); LoadContact(ContactGroupCategory.CUSTOMER, details); // 13Mar2015 : MPC, override the price using the PriceLevel // For PriceLevel1...5 if (mclsSysConfigDetails.EnablePriceLevel) { Cursor.Current = Cursors.WaitCursor; Int32 iOldRow = dgItems.CurrentRowIndex; Data.SalesTransactionItemDetails Details = new Data.SalesTransactionItemDetails(); Data.ProductPackage clsProductPackage = new Data.ProductPackage(mConnection, mTransaction); mConnection = clsProductPackage.Connection; mTransaction = clsProductPackage.Transaction; Data.ProductPackageDetails clsProductPackageDetails = new Data.ProductPackageDetails(); System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource; for (int x = 0; x < dt.Rows.Count; x++) { dgItems.CurrentRowIndex = x; Details = getCurrentRowItemDetails(); dgItems.UnSelect(x); if (Details.TransactionItemStatus == TransactionItemStatus.Valid) { clsProductPackageDetails = clsProductPackage.Details(Details.ProductPackageID); switch (mclsContactDetails.PriceLevel) { case PriceLevel.SRP: Details.Price = clsProductPackageDetails.Price; break; case PriceLevel.One: Details.Price = clsProductPackageDetails.Price1 == 0 ? clsProductPackageDetails.Price : clsProductPackageDetails.Price1; break; case PriceLevel.Two: Details.Price = clsProductPackageDetails.Price2 == 0 ? clsProductPackageDetails.Price : clsProductPackageDetails.Price2; break; case PriceLevel.Three: Details.Price = clsProductPackageDetails.Price3 == 0 ? clsProductPackageDetails.Price : clsProductPackageDetails.Price3; break; case PriceLevel.Four: Details.Price = clsProductPackageDetails.Price4 == 0 ? clsProductPackageDetails.Price : clsProductPackageDetails.Price4; break; case PriceLevel.Five: Details.Price = clsProductPackageDetails.Price5 == 0 ? clsProductPackageDetails.Price : clsProductPackageDetails.Price5; break; case PriceLevel.WSPrice: Details.Price = clsProductPackageDetails.WSPrice == 0 ? clsProductPackageDetails.Price : clsProductPackageDetails.WSPrice; break; default: Details.Price = clsProductPackageDetails.Price; break; } Details = ApplyPromo(Details); ApplyChangeQuantityPriceAmountDetails(x, Details, "Change Price: Change Contact"); } } clsProductPackage.CommitAndDispose(); if (iOldRow >= 0) { dgItems.CurrentRowIndex = iOldRow; dgItems.Select(iOldRow); Details = getCurrentRowItemDetails(); DisplayItemToTurretDelegate DisplayItemToTurretDel = new DisplayItemToTurretDelegate(DisplayItemToTurret); DisplayItemToTurretDel.BeginInvoke(Details.Description, Details.ProductUnitCode, Details.Quantity, Details.Price, Details.Discount, Details.PromoApplied, Details.Amount, Details.VAT, Details.EVAT, null, null); InsertAuditLog(AccessTypes.ChangePrice, "Change price: change contact : for item " + Details.ProductCode + " to " + Details.Price.ToString("#,##0.#0") + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); mbodgItemRowClick = false; } Cursor.Current = Cursors.Default; } } clsSalesTransactions.CommitAndDispose(); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { clsEvent.AddErrorEventLn(ex); } }
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; }
private void SelectTable() { // Sep 24, 2011 Lemuel E. Aceron // Added order slip wherein all punch items will not change sales and inventory // a customer named ORDER SLIP should be defined in contacts if (lblCustomer.Text.Trim().ToUpper() == Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER && mboIsInTransaction) { MessageBox.Show("Sorry you cannot select ORDER SLIP customer when an item is already purchased.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { clsEvent.AddEvent("[" + lblCashier.Text + "] Selecting customer."); DialogResult result; Data.ContactDetails details; bool isMergeTable = false; TableSelectWnd clsTableSelectWnd = new TableSelectWnd(); clsTableSelectWnd.TerminalDetails = mclsTerminalDetails; clsTableSelectWnd.ContactGroupCategory = ContactGroupCategory.TABLES; clsTableSelectWnd.ShowAvailableTableOnly = mboIsInTransaction; clsTableSelectWnd.ShowDialog(this); details = clsTableSelectWnd.Details; result = clsTableSelectWnd.Result; isMergeTable = clsTableSelectWnd.isMergeTable; clsTableSelectWnd.Close(); clsTableSelectWnd.Dispose(); if (result == DialogResult.OK) { if (isMergeTable) { List<Data.ContactDetails> lstDetails; TableMergeWnd clsTableMergeWnd = new TableMergeWnd(); clsTableMergeWnd.TerminalDetails = mclsTerminalDetails; clsTableMergeWnd.ContactGroupCategory = ContactGroupCategory.TABLES; clsTableMergeWnd.ShowAvailableTableOnly = true; // inde pwede imerge and table na may laman na clsTableMergeWnd.MainTableToMerge = details; clsTableMergeWnd.ShowDialog(this); //details = clsTableMergeWnd.Details; result = clsTableMergeWnd.Result; lstDetails = clsTableMergeWnd.MergeTables; clsTableMergeWnd.Close(); clsTableMergeWnd.Dispose(); if (result == DialogResult.OK) { // 22Nov2014 : remove the merge tables when closed or void or create a new list RemoveFromMergeTable(details.ContactCode); if (lstDetails.Count > 0) { Data.MergeTable clsMergeTable = new Data.MergeTable(); Data.MergeTableDetails clsMergeTableDetails; // insert the main table clsMergeTableDetails = new Data.MergeTableDetails() { MainTableCode = details.ContactCode, ChildTableCode = details.ContactCode }; clsMergeTable.Insert(clsMergeTableDetails); // insert the child tables for (int x = 0; x < lstDetails.Count; x++) { clsMergeTableDetails = new Data.MergeTableDetails() { MainTableCode = details.ContactCode, ChildTableCode = lstDetails[x].ContactCode }; clsMergeTable.Insert(clsMergeTableDetails); } clsMergeTable.CommitAndDispose(); } } return; } // Nov 18, 2011 : Lemu - auto suspend if already doing a transaction if (mboIsInTransaction) { if (mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID && mclsSalesTransactionDetails.CustomerID != details.ContactID) { Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE); clsContacts.UpdateLastCheckInDate(details.ContactID, mclsSalesTransactionDetails.TransactionDate); // Jan 31, 2015 : Lemu // put back to SuspendedOpen so that it won't be open somewhere else Data.SalesTransactions clsSalesTransactions1 = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions1.Connection; mTransaction = clsSalesTransactions1.Transaction; clsEvent.AddEventLn("Putting transaction SuspendedOpen: " + mclsSalesTransactionDetails.TransactionNo, true); clsSalesTransactions1.UpdateTransactionToSuspendedOpen(mclsSalesTransactionDetails.TransactionID); clsContacts.CommitAndDispose(); LoadContact(ContactGroupCategory.CUSTOMER, details); return; } else if (mclsSalesTransactionDetails.CustomerID == details.ContactID) { return; } else if (mclsSalesTransactionDetails.CustomerID != details.ContactID) { if (MessageBox.Show("Would you like to move from table: " + mclsSalesTransactionDetails.CustomerDetails.ContactCode + " to table: " + details.ContactCode + "." + Environment.NewLine + "Please click [Yes] to move, [Cancel] to create new transaction in the selected table.", "RetailPlus", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK) { Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE); clsContacts.UpdateLastCheckInDate(details.ContactID, mclsSalesTransactionDetails.TransactionDate); // Jan 31, 2015 : Lemu // put back to SuspendedOpen so that it won't be open somewhere else Data.SalesTransactions clsSalesTransactions1 = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions1.Connection; mTransaction = clsSalesTransactions1.Transaction; clsEvent.AddEventLn("Putting transaction SuspendedOpen: " + mclsSalesTransactionDetails.TransactionNo, true); clsSalesTransactions1.UpdateTransactionToSuspendedOpen(mclsSalesTransactionDetails.TransactionID); clsContacts.CommitAndDispose(); LoadContact(ContactGroupCategory.CUSTOMER, details); return; } else { this.SuspendTransaction(false); } } } else { Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; clsContacts.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, Constants.C_DATE_MIN_VALUE); clsContacts.UpdateLastCheckInDate(details.ContactID, mclsSalesTransactionDetails.TransactionDate); clsContacts.CommitAndDispose(); } Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; string stTransactionNo = clsSalesTransactions.getSuspendedTransactionNo(details.ContactID, mclsTerminalDetails.TerminalNo, mclsTerminalDetails.BranchID); if (stTransactionNo != string.Empty) { LoadTransaction(stTransactionNo, mclsTerminalDetails.TerminalNo); } else { this.LoadOptions(); LoadContact(ContactGroupCategory.CUSTOMER, details); } clsSalesTransactions.CommitAndDispose(); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { clsEvent.AddErrorEventLn(ex); } }