private void ResumeClosedTransaction() { if (!SuspendTransactionAndContinue()) return; DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ResumeClosedTransaction); if (loginresult == DialogResult.OK) { try { ResumeTransactionWnd ResumeWnd = new ResumeTransactionWnd(); ResumeWnd.TerminalDetails = mclsTerminalDetails; ResumeWnd.CashierID = mclsSalesTransactionDetails.CashierID; ResumeWnd.TransactionStatusToList = AceSoft.RetailPlus.TransactionStatus.Closed; ResumeWnd.ShowDialog(this); DialogResult result = ResumeWnd.Result; Data.SalesTransactionDetails details = ResumeWnd.Details; ResumeWnd.Close(); ResumeWnd.Dispose(); if (result == DialogResult.OK) { if (details.TransactionStatus != TransactionStatus.Closed) { MessageBox.Show("This transaction is not yet Closed, please select another transaction. {Current Status: " + details.TransactionStatus.ToString("G") + "}", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } clsEvent.AddEvent("[" + lblCashier.Text + "] Resuming closed transaction no. " + details.TransactionNo); mclsSalesTransactionDetails = details; if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Refund || mclsSalesTransactionDetails.TransactionType == TransactionTypes.POSRefund) { mboIsRefund = true; lblSubtotalName.Text = "SUBTOTAL: REFUND"; lblOrderType.Visible = false; } lblOrderType.Text = mclsSalesTransactionDetails.OrderType.ToString("G").ToUpper(); lblTransNo.Text = mclsSalesTransactionDetails.TransactionNo; lblTransNo.Tag = mclsSalesTransactionDetails.TransactionID.ToString(); lblCustomer.Text = mclsSalesTransactionDetails.CustomerName; lblCustomer.Tag = mclsSalesTransactionDetails.CustomerID.ToString(); lblAgent.Text = mclsSalesTransactionDetails.AgentName; lblAgent.Tag = mclsSalesTransactionDetails.AgentID.ToString(); lblAgentPositionDepartment.Text = mclsSalesTransactionDetails.AgentPositionName; lblAgentPositionDepartment.Tag = mclsSalesTransactionDetails.AgentDepartmentName; grpItems.Text = "Served by: " + details.WaiterName; grpItems.Tag = mclsSalesTransactionDetails.WaiterID.ToString(); lblTransDate.Text = mclsSalesTransactionDetails.TransactionDate.ToString("MMM. dd, yyyy hh:mm:ss tt"); mdteOverRidingPrintDate = mclsSalesTransactionDetails.TransactionDate; lblTransDiscount.Tag = mclsSalesTransactionDetails.TransDiscountType.ToString("d"); lblConsignment.Visible = mclsSalesTransactionDetails.isConsignment; if (mclsSalesTransactionDetails.ChargeAmount == 0) lblTransCharge.Tag = ChargeTypes.NotApplicable.ToString("d"); else { Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction); bool bolInPercent = clsChargeType.Details(mclsSalesTransactionDetails.ChargeCode).InPercent; clsChargeType.CommitAndDispose(); if (bolInPercent) lblTransCharge.Tag = ChargeTypes.Percentage.ToString("d"); else lblTransCharge.Tag = ChargeTypes.FixedValue.ToString("d"); } // Aug 6, 2011 : Lemu // Put here from CloseTransaction try { mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); } catch { } mclsSalesTransactionDetails.CashierName = lblCashier.Text; LoadResumedItems(details.TransactionItems, false); // 06Mar2015 : reload this, to use for price level Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; mclsContactDetails = clsContacts.Details(mclsSalesTransactionDetails.CustomerID); clsContacts.CommitAndDispose(); mboIsInTransaction = true; InsertAuditLog(AccessTypes.ResumeClosedTransaction, "Resume closed transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); clsEvent.AddEventLn("[" + lblCashier.Text + "] Resuming closed transaction no. " + details.TransactionNo + " Done.", true); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Resuming closed transaction."); } } }
private void ResumeTransaction() { if (!SuspendTransactionAndContinue()) return; // ShowOneTerminalSuspendedTransactions // Only same cashier in same terminal can be resume. // if terminalno and cashier is not the same to not allow if (mclsTerminalDetails.ShowOneTerminalSuspendedTransactions) { Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; int count = clsSalesTransactions.CountSuspended(mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, mclsTerminalDetails.BranchID); clsSalesTransactions.CommitAndDispose(); if (count == 0) { MessageBox.Show("No suspended transaction found for this day.", "RetailPlus", MessageBoxButtons.OK); return; } } DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ResumeTransaction); if (loginresult == DialogResult.OK) { try { ResumeTransactionWnd ResumeWnd = new ResumeTransactionWnd(); ResumeWnd.TerminalDetails = mclsTerminalDetails; ResumeWnd.CashierID = mclsSalesTransactionDetails.CashierID; ResumeWnd.TransactionStatusToList = AceSoft.RetailPlus.TransactionStatus.Suspended; ResumeWnd.ShowDialog(this); DialogResult result = ResumeWnd.Result; Data.SalesTransactionDetails details = ResumeWnd.Details; ResumeWnd.Close(); ResumeWnd.Dispose(); if (result == DialogResult.OK) { if (details.TransactionStatus == TransactionStatus.SuspendedOpen) { if (MessageBox.Show("This transaction is already open in another terminal. Please suspend in the other terminal first before opening." + Environment.NewLine + "Would you like to force open this transaction?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } else { DialogResult resResumeSuspendedOpenTransaction = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ResumeSuspendedOpenTransaction); if (resResumeSuspendedOpenTransaction != System.Windows.Forms.DialogResult.OK) { clsEvent.AddEvent("[" + lblCashier.Text + "] Resuming transaction no. " + details.TransactionNo + " cancelled. SuspendedOpen"); return; } } } clsEvent.AddEvent("[" + lblCashier.Text + "] Resuming transaction no. " + details.TransactionNo); mclsSalesTransactionDetails = details; if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Refund || mclsSalesTransactionDetails.TransactionType == TransactionTypes.POSRefund) { mboIsRefund = true; lblSubtotalName.Text = "SUBTOTAL: REFUND"; lblOrderType.Visible = false; } lblOrderType.Text = mclsSalesTransactionDetails.OrderType.ToString("G").ToUpper(); lblTransNo.Text = mclsSalesTransactionDetails.TransactionNo; lblTransNo.Tag = mclsSalesTransactionDetails.TransactionID.ToString(); lblCustomer.Text = mclsSalesTransactionDetails.CustomerName; lblCustomer.Tag = mclsSalesTransactionDetails.CustomerID.ToString(); lblAgent.Text = mclsSalesTransactionDetails.AgentName; lblAgent.Tag = mclsSalesTransactionDetails.AgentID.ToString(); lblAgentPositionDepartment.Text = mclsSalesTransactionDetails.AgentPositionName; lblAgentPositionDepartment.Tag = mclsSalesTransactionDetails.AgentDepartmentName; grpItems.Text = "Served by: " + details.WaiterName; grpItems.Tag = mclsSalesTransactionDetails.WaiterID.ToString(); lblTransDate.Text = mclsSalesTransactionDetails.TransactionDate.ToString("MMM. dd, yyyy hh:mm:ss tt"); mdteOverRidingPrintDate = mclsSalesTransactionDetails.TransactionDate; lblTransDiscount.Tag = mclsSalesTransactionDetails.TransDiscountType.ToString("d"); lblConsignment.Visible = mclsSalesTransactionDetails.isConsignment; if (mclsSalesTransactionDetails.ChargeAmount == 0) lblTransCharge.Tag = ChargeTypes.NotApplicable.ToString("d"); else { Data.ChargeType clsChargeType = new Data.ChargeType(mConnection, mTransaction); bool bolInPercent = clsChargeType.Details(mclsSalesTransactionDetails.ChargeCode).InPercent; clsChargeType.CommitAndDispose(); if (bolInPercent) lblTransCharge.Tag = ChargeTypes.Percentage.ToString("d"); else lblTransCharge.Tag = ChargeTypes.FixedValue.ToString("d"); } // Aug 6, 2011 : Lemu // Put here from CloseTransaction try { mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); } catch { } mclsSalesTransactionDetails.CashierName = lblCashier.Text; LoadResumedItems(details.TransactionItems, false); // Jan 31, 2015 : Lemu // put back to SuspendedOpen so that it won't be open somewhere else if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Suspended) { Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; clsEvent.AddEvent("Putting transaction SuspendedOpen: " + mclsSalesTransactionDetails.TransactionNo, true); clsSalesTransactions.UpdateTransactionToSuspendedOpen(mclsSalesTransactionDetails.TransactionID); clsSalesTransactions.CommitAndDispose(); } // 06Mar2015 : reload this, to use for price level Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction); mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction; mclsContactDetails = clsContacts.Details(mclsSalesTransactionDetails.CustomerID); clsContacts.CommitAndDispose(); mboIsInTransaction = true; InsertAuditLog(AccessTypes.ResumeTransaction, "Resume transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); clsEvent.AddEventLn("[" + lblCashier.Text + "] Resuming transaction no. " + details.TransactionNo + " Done.", true); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Resuming transaction."); } } }