private void CreditCardReplacement(CreditCardStatus pvtCreditCardStatus) { if (mboIsInTransaction) { MessageBox.Show("Sorry you cannot replace a Credit Card while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.CreditCardChange); if (loginresult == DialogResult.OK) { try { DialogResult result; Data.ContactDetails clsContactDetails; ContactSelectWnd clsContactWnd = new ContactSelectWnd(); clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK; clsContactWnd.SysConfigDetails = mclsSysConfigDetails; clsContactWnd.TerminalDetails = mclsTerminalDetails; clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER; clsContactWnd.Header = "Please select customer for credit card replacement."; clsContactWnd.ShowDialog(this); clsContactDetails = clsContactWnd.Details; result = clsContactWnd.Result; clsContactWnd.Close(); clsContactWnd.Dispose(); if (result != DialogResult.OK) { return; } if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID) { return; } clsEvent.AddEvent("[" + lblCashier.Text + "] Replacing credit card..."); Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction); mConnection = clsContact.Connection; mTransaction = clsContact.Transaction; clsContactDetails = clsContact.Details(clsContactDetails.ContactID); Data.ContactDetails clsGuarantor = clsContact.Details(clsContactDetails.CreditDetails.GuarantorID); clsContact.CommitAndDispose(); if (clsContactDetails.CreditDetails.CreditCardNo == string.Empty || clsContactDetails.CreditDetails.CreditCardNo == null) { clsEvent.AddEventLn("Cancelled!"); clsEvent.AddEventLn(clsContactDetails.ContactName + " has no valid Credit Card yet. "); MessageBox.Show(clsContactDetails.ContactName + " has no valid Credit Card yet. Please select another customer.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } clsEvent.AddEvent("[" + lblCashier.Text + "] Replacing credit card #: " + clsContactDetails.CreditDetails.CreditCardNo + " of " + clsContactDetails.ContactName + " as " + pvtCreditCardStatus.ToString("G")); string strOldCreditCardNo = clsContactDetails.CreditDetails.CreditCardNo; ContactCreditWnd clsContactCreditWnd = new ContactCreditWnd(); if (pvtCreditCardStatus == CreditCardStatus.Replaced_Lost) clsContactCreditWnd.Header = "Credit Card Replacement of LOST CARD "; else if (pvtCreditCardStatus == CreditCardStatus.Replaced_Expired) clsContactCreditWnd.Header = "Credit Card Replacement of EXPIRED CARD "; clsContactCreditWnd.CardTypeDetails = clsContactDetails.CreditDetails.CardTypeDetails; clsContactCreditWnd.Guarantor = clsGuarantor; clsContactCreditWnd.ContactDetails = clsContactDetails; clsContactCreditWnd.CreditCardStatus = pvtCreditCardStatus; clsContactCreditWnd.TerminalDetails = mclsTerminalDetails; clsContactCreditWnd.ShowDialog(this); result = clsContactCreditWnd.Result; clsContactDetails = clsContactCreditWnd.ContactDetails; clsContactCreditWnd.Close(); clsContactCreditWnd.Dispose(); if (result == DialogResult.OK) { Data.Products clsProducts = new Data.Products(mConnection, mTransaction); mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction; string strProductBarcode = Data.Products.DEFAULT_CREDIT_CARD_REPLACEMENT_FEE_BARCODE; //override if with Guarantor if (clsContactDetails.CreditDetails.CardTypeDetails.WithGuarantor) strProductBarcode = Data.Products.DEFAULT_SUPER_CARD_REPLACEMENT_FEE_BARCODE; if (clsProducts.Details(strProductBarcode).ProductID == 0) { if (!clsContactDetails.CreditDetails.CardTypeDetails.WithGuarantor) clsProducts.CREATE_CREDIT_CARD_REPLACEMENT_FEE_BARCODE_PRODUCT(); else clsProducts.CREATE_SUPER_CARD_REPLACEMENT_FEE_BARCODE_PRODUCT(); Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.CreditCardChange, strProductBarcode + " product has been created coz it's not configured"); } clsProducts.CommitAndDispose(); MessageBox.Show("Credit Card No: " + strOldCreditCardNo + " has been replaced with new card #: " + clsContactDetails.CreditDetails.CreditCardNo + ".", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); clsEvent.AddEventLn("Done!", true); clsEvent.AddEventLn("Credit Card No: " + strOldCreditCardNo + " has been replaced with new card #: " + clsContactDetails.CreditDetails.CreditCardNo + ".", true); LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + strProductBarcode + "transaction for customer: "); LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails); if (!this.CreateTransaction()) return; txtBarCode.Text = strProductBarcode; ReadBarCode(); int iRow = dgItems.CurrentRowIndex; txtBarCode.Text = ""; CloseTransaction(); clsLocalDB.CommitAndDispose(); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Replacing internal credit card."); } Cursor.Current = Cursors.Default; } }
private void IssueCreditCard() { if (mboIsInTransaction) { MessageBox.Show("Sorry you cannot issue a Credit Card while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.CreditCardIssuance); if (loginresult == DialogResult.OK) { try { DialogResult result; Data.CardTypeDetails clsCardTypeDetails = new Data.CardTypeDetails(); Data.ContactDetails clsGuarantorDetails = new AceSoft.RetailPlus.Data.ContactDetails(); ContactCreditTypeSelectWnd clsContactCreditTypeSelectWnd = new ContactCreditTypeSelectWnd(); clsContactCreditTypeSelectWnd.TerminalDetails = mclsTerminalDetails; clsContactCreditTypeSelectWnd.ShowDialog(this); clsCardTypeDetails = clsContactCreditTypeSelectWnd.CardTypeDetails; result = clsContactCreditTypeSelectWnd.Result; clsContactCreditTypeSelectWnd.Close(); clsContactCreditTypeSelectWnd.Dispose(); if (result != DialogResult.OK) { return; } Data.ContactDetails clsContactDetails; ContactSelectWnd clsContactWnd = new ContactSelectWnd(); clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK; clsContactWnd.SysConfigDetails = mclsSysConfigDetails; clsContactWnd.TerminalDetails = mclsTerminalDetails; if (clsCardTypeDetails.WithGuarantor) { MessageBox.Show("Please select a GUARANTOR to issue Credit Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER; clsContactWnd.Header = "Select GUARANTOR to issue Credit Card."; clsContactWnd.ShowDialog(this); clsGuarantorDetails = clsContactWnd.Details; result = clsContactWnd.Result; clsContactWnd.Close(); clsContactWnd.Dispose(); if (result != DialogResult.OK) { return; } MessageBox.Show(clsGuarantorDetails.ContactName + " has been selected as guarantor." + Environment.NewLine + "Please select the CUSTOMER to issue Credit Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); } clsContactWnd = new ContactSelectWnd(); clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK; clsContactWnd.SysConfigDetails = mclsSysConfigDetails; clsContactWnd.TerminalDetails = mclsTerminalDetails; clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER; clsContactWnd.Header = "Select CUSTOMER to issue Credit Card."; clsContactWnd.ShowDialog(this); clsContactDetails = clsContactWnd.Details; result = clsContactWnd.Result; clsContactWnd.Close(); clsContactWnd.Dispose(); if (result != DialogResult.OK) { return; } if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID) { return; } // if no guarantor if (!clsCardTypeDetails.WithGuarantor) clsGuarantorDetails = new Data.ContactDetails(); clsEvent.AddEvent("[" + lblCashier.Text + "] Issuing credit card no to " + clsContactDetails.ContactName); Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction); mConnection = clsContact.Connection; mTransaction = clsContact.Transaction; clsContactDetails = clsContact.Details(clsContactDetails.ContactID); clsContact.CommitAndDispose(); if (clsContactDetails.CreditDetails.CreditCardNo != string.Empty && clsContactDetails.CreditDetails.CreditCardNo != null) { clsEvent.AddEventLn("Cancelled!"); clsEvent.AddEventLn("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was already issued to " + clsContactDetails.ContactName + " on " + clsContactDetails.CreditDetails.CreditAwardDate.ToString("MMM dd, yyyy hh:mm tt")); MessageBox.Show("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was already issued to " + clsContactDetails.ContactName + " on " + clsContactDetails.CreditDetails.CreditAwardDate.ToString("MMM dd, yyyy hh:mm tt") + "." + Environment.NewLine + " Please select another customer to issue Credit Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } clsEvent.AddEvent("[" + lblCashier.Text + "] Issuing credit card no to " + clsContactDetails.ContactName); ContactCreditWnd clsContactCreditWnd = new ContactCreditWnd(); clsContactCreditWnd.Header = "Credit Card Issuance"; clsContactCreditWnd.CardTypeDetails = clsCardTypeDetails; clsContactCreditWnd.Guarantor = clsGuarantorDetails; clsContactCreditWnd.ContactDetails = clsContactDetails; clsContactCreditWnd.CreditCardStatus = CreditCardStatus.New; clsContactCreditWnd.TerminalDetails = mclsTerminalDetails; clsContactCreditWnd.ShowDialog(this); result = clsContactCreditWnd.Result; clsContactDetails = clsContactCreditWnd.ContactDetails; clsContactCreditWnd.Close(); clsContactCreditWnd.Dispose(); if (result == DialogResult.OK) { Data.Products clsProducts = new Data.Products(mConnection, mTransaction); mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction; string strProductBarcode = Data.Products.DEFAULT_CREDIT_CARD_MEMBERSHIP_FEE_BARCODE; //override if with Guarantor if (clsCardTypeDetails.WithGuarantor) strProductBarcode = Data.Products.DEFAULT_SUPER_CARD_MEMBERSHIP_FEE_BARCODE; if (clsProducts.Details(strProductBarcode).ProductID == 0) { if (!clsCardTypeDetails.WithGuarantor) clsProducts.CREATE_CREDIT_CARD_MEMBERSHIP_FEE_BARCODE_PRODUCT(); else clsProducts.CREATE_SUPER_CARD_MEMBERSHIP_FEE_BARCODE_PRODUCT(); Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.RewardCardChange, strProductBarcode + " product has been created coz it's not configured"); } clsProducts.CommitAndDispose(); MessageBox.Show("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was issued to " + clsContactDetails.ContactName + "." + Environment.NewLine + "Please collect the payment then close the transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); clsEvent.AddEventLn("Done!", true); clsEvent.AddEventLn("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was issued to " + clsContactDetails.ContactName + ".", true); LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + strProductBarcode + "transaction for customer: "); LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails); if (!this.CreateTransaction()) return; txtBarCode.Text = strProductBarcode; ReadBarCode(); int iRow = dgItems.CurrentRowIndex; txtBarCode.Text = ""; CloseTransaction(); clsLocalDB.CommitAndDispose(); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Issuing internal credit-card."); } Cursor.Current = Cursors.Default; } }
private void RenewRewardCard() { if (mboIsInTransaction) { MessageBox.Show("Sorry you cannot renew a Reward Card while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.RewardCardChange); if (loginresult == DialogResult.OK) { try { DialogResult result; Data.ContactDetails clsContactDetails; ContactSelectWnd clsContactWnd = new ContactSelectWnd(); clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK; clsContactWnd.SysConfigDetails = mclsSysConfigDetails; clsContactWnd.TerminalDetails = mclsTerminalDetails; clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER; clsContactWnd.Header = "Please select customer for reward card renewal."; clsContactWnd.ShowDialog(this); clsContactDetails = clsContactWnd.Details; result = clsContactWnd.Result; clsContactWnd.Close(); clsContactWnd.Dispose(); if (result != DialogResult.OK) { return; } if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID) { return; } clsEvent.AddEvent("[" + lblCashier.Text + "] Renewing reward card."); Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction); mConnection = clsContact.Connection; mTransaction = clsContact.Transaction; clsContactDetails = clsContact.Details(clsContactDetails.ContactID); clsContact.CommitAndDispose(); if (clsContactDetails.RewardDetails.RewardCardNo == string.Empty || clsContactDetails.RewardDetails.RewardCardNo == null) { clsEvent.AddEventLn("Cancelled!"); clsEvent.AddEventLn(clsContactDetails.ContactName + " has no valid Reward Card yet. "); MessageBox.Show(clsContactDetails.ContactName + " has no valid Reward Card yet. Please select another customer.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } clsEvent.AddEvent("[" + lblCashier.Text + "] Renewing reward card #: " + clsContactDetails.RewardDetails.RewardCardNo + " of " + clsContactDetails.ContactName + "."); ContactRewardWnd clsContactRewardWnd = new ContactRewardWnd(); clsContactRewardWnd.TerminalDetails = mclsTerminalDetails; clsContactRewardWnd.Caption = "Reward Card Renewal"; clsContactRewardWnd.ContactDetails = clsContactDetails; clsContactRewardWnd.RewardCardStatus = RewardCardStatus.ReNew; clsContactRewardWnd.ShowDialog(this); result = clsContactRewardWnd.Result; clsContactDetails = clsContactRewardWnd.ContactDetails; clsContactRewardWnd.Close(); clsContactRewardWnd.Dispose(); if (result == DialogResult.OK) { Data.Products clsProducts = new Data.Products(mConnection, mTransaction); mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction; if (clsProducts.Details(Data.Products.DEFAULT_ADVANTAGE_CARD_RENEWAL_FEE_BARCODE).ProductID == 0) { clsProducts.CREATE_ADVANTAGE_CARD_RENEWAL_FEE_BARCODE_PRODUCT(); Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.RewardCardChange, "ADVANTAGE_CARD_RENEWAL_FEE_BARCODE product has been created coz it's not configured"); } clsProducts.CommitAndDispose(); MessageBox.Show("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " has been renewed with new expiry date " + clsContactDetails.RewardDetails.ExpiryDate.ToString("yyyy-MM-dd") + ".", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); clsEvent.AddEventLn("Done!", true); clsEvent.AddEventLn("Reward Card No: " + clsContactDetails.RewardDetails.RewardCardNo + " has been renewed with new expiry date " + clsContactDetails.RewardDetails.ExpiryDate.ToString("yyyy-MM-dd") + ".", true); LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + Data.Products.DEFAULT_ADVANTAGE_CARD_RENEWAL_FEE_BARCODE + "transaction for customer: "); LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails); if (!this.CreateTransaction()) return; txtBarCode.Text = Data.Products.DEFAULT_ADVANTAGE_CARD_RENEWAL_FEE_BARCODE; ReadBarCode(); int iRow = dgItems.CurrentRowIndex; txtBarCode.Text = ""; CloseTransaction(); clsLocalDB.CommitAndDispose(); } else { clsEvent.AddEventLn("Cancelled!"); } } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Renewing reward card."); } Cursor.Current = Cursors.Default; } }
private void EnterCreditItemizePayment() { if (!SuspendTransactionAndContinue()) return; DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.EnterCreditPayment); if (loginresult == DialogResult.OK) { LoadOptions(); if (!CheckIfOKToSell(true)) return; ContactSelectWnd clsContactWnd = new ContactSelectWnd(); clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK; clsContactWnd.SysConfigDetails = mclsSysConfigDetails; clsContactWnd.TerminalDetails = mclsTerminalDetails; clsContactWnd.HasCreditOnly = true; clsContactWnd.ShowDialog(this); DialogResult result = clsContactWnd.Result; mclsContactDetails = clsContactWnd.Details; clsContactWnd.Close(); clsContactWnd.Dispose(); if (result == DialogResult.OK) { CreditsItemizeWnd creditWnd = new CreditsItemizeWnd(); creditWnd.TerminalDetails = mclsTerminalDetails; creditWnd.SysConfigDetails = mclsSysConfigDetails; creditWnd.CashierID = mclsSalesTransactionDetails.CashierID; creditWnd.CashierName = mclsSalesTransactionDetails.CashierName; creditWnd.CustomerDetails = mclsContactDetails; creditWnd.ShowDialog(this); Keys keyData = creditWnd.KeyData; string strTransactionNoToReprint = creditWnd.TransactionNoToReprint; string strTerminalNoToReprint = creditWnd.TerminalNoToReprint; decimal AmountPaid = creditWnd.AmountPayment; decimal CashPayment = creditWnd.CashPayment; decimal ChequePayment = creditWnd.ChequePayment; decimal CreditCardPayment = creditWnd.CreditCardPayment; decimal DebitPayment = creditWnd.DebitPayment; decimal BalanceAmount = creditWnd.BalanceAmount; decimal ChangeAmount = creditWnd.ChangeAmount; DataGridViewSelectedRowCollection dgvItemsSelectedRows = creditWnd.dgvItemsSelectedRows; PaymentTypes PaymentType = creditWnd.PaymentType; ArrayList arrCashPaymentDetails = creditWnd.CashPaymentDetails; ArrayList arrChequePaymentDetails = creditWnd.ChequePaymentDetails; ArrayList arrCreditCardPaymentDetails = creditWnd.CreditCardPaymentDetails; ArrayList arrDebitPaymentDetails = creditWnd.DebitPaymentDetails; result = creditWnd.Result; // do not dispose here coz the dgvItemsSelectedRows is also disposed //creditWnd.Close(); //creditWnd.Dispose(); if (result == DialogResult.OK) { if (keyData == Keys.F12) { ReprintTransaction(strTransactionNoToReprint, strTerminalNoToReprint); return; } bool boActivateSuspendedAccount = true; if (!mclsContactDetails.CreditDetails.CreditActive) { if (MessageBox.Show("Account is InActive, would you like to re-activate? Remarks: " + Environment.NewLine + mclsContactDetails.Remarks + Environment.NewLine + Environment.NewLine + "Press [yes] to automatically activate or [no] to disregard activation.", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) boActivateSuspendedAccount = false; } Int64 iCollectionReceiptNo = 0; if (mclsSysConfigDetails.CreditPaymentType == CreditPaymentType.MPC) { decimal decRetValue = 0; if (ShowNoControl(this, out decRetValue, decimal.Parse(iCollectionReceiptNo.ToString()), "Enter Collection Receipt (CR) No.") != System.Windows.Forms.DialogResult.OK) { MessageBox.Show("Sorry you cannot issue a Credit Payment without the collection receipt no. Please enter CR No first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { iCollectionReceiptNo = Int64.Parse(decRetValue.ToString()); } } Cursor.Current = Cursors.WaitCursor; try { LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; mclsSalesTransactionDetails = new Data.SalesTransactionDetails(); mclsSalesTransactionDetails.TransactionItemsList = new System.Collections.Generic.List<Data.SalesTransactionItemDetails>(); mclsSalesTransactionDetails.CustomerDetails = mclsContactDetails; mclsSalesTransactionDetails.TransactionStatus = TransactionStatus.CreditPayment; mclsSalesTransactionDetails.CRNo = iCollectionReceiptNo; Data.Products clsProducts = new Data.Products(mConnection, mTransaction); mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction; if (clsProducts.Details(Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE).ProductID == 0) { clsProducts.CREATE_CREDITPAYMENT_PRODUCT(); Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.EnterCreditPayment, "CREDIT PAYMENT product has been created coz it's not configured"); } /************** April 21, 2006: added transaction no. ***************/ lblCustomer.Tag = mclsContactDetails.ContactID; lblCustomer.Text = mclsContactDetails.ContactName; clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE + " transaction for customer: "); LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, mclsContactDetails); if (!this.CreateTransaction()) return; txtBarCode.Text = Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE; ReadBarCode(); int iRow = dgItems.CurrentRowIndex; Data.SalesTransactionItemDetails clsItemDetails = getCurrentRowItemDetails(); clsItemDetails.Price = AmountPaid; clsItemDetails.Amount = AmountPaid; clsItemDetails = ComputeItemTotal(clsItemDetails); // set the grossales, vat, discounts, etc.(Details); Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; ApplyChangeQuantityPriceAmountDetails(iRow, clsItemDetails, "Change Quantity, Price, Amount for Credit Payment"); // re-instantiate the status mclsSalesTransactionDetails.TransactionStatus = TransactionStatus.CreditPayment; mclsSalesTransactionDetails.AmountDue = AmountPaid; mclsSalesTransactionDetails.AmountPaid = AmountPaid; mclsSalesTransactionDetails.ChangeAmount = ChangeAmount; mclsSalesTransactionDetails.CashPayment = CashPayment; mclsSalesTransactionDetails.ChequePayment = ChequePayment; mclsSalesTransactionDetails.PaymentType = PaymentType; mclsSalesTransactionDetails.CRNo = iCollectionReceiptNo; // for assignment of payments mclsSalesTransactionDetails.PaymentDetails = AssignArrayListPayments(arrCashPaymentDetails, arrChequePaymentDetails, arrCreditCardPaymentDetails, null, arrDebitPaymentDetails); SavePayments(arrCashPaymentDetails, arrChequePaymentDetails, arrCreditCardPaymentDetails, null, arrDebitPaymentDetails); // save the details of credit payments SaveCreditPayments(dgvItemsSelectedRows, arrCashPaymentDetails, arrChequePaymentDetails, arrCreditCardPaymentDetails, null, arrDebitPaymentDetails, boActivateSuspendedAccount); //OpenDrawerDelegate opendrawerDel = new OpenDrawerDelegate(OpenDrawer); //Invoke(opendrawerDel); OpenDrawer(); //update the transaction table Int64 iTransactionID = Convert.ToInt64(lblTransNo.Tag); string strORNo = ""; // no need to put an OR no for credit payment coz it's already declared before clsSalesTransactions.Close(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TerminalNo, strORNo, 0, 0, AmountPaid, AmountPaid, AmountPaid, 0, 0, 0, 0, 0, 0, 0, 0, 0, DiscountTypes.NotApplicable, 0, 0, 0, 0, 0, 0, 0, 0, 0, AmountPaid, CashPayment, ChequePayment, CreditCardPayment, 0, DebitPayment, 0, 0, 0, 0, PaymentType, null, null, 0, 0, null, null, mclsSalesTransactionDetails.CashierID, lblCashier.Text, TransactionStatus.CreditPayment); // 05Mar2015 : MPC - Update the CRNo as per Ms. Norma clsSalesTransactions.UpdateCRNo(mclsSalesTransactionDetails.BranchID, mclsSalesTransactionDetails.TerminalNo, mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.CRNo); //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport); UpdateTerminalReport(TransactionStatus.CreditPayment, 0, 0, AmountPaid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CashPayment, ChequePayment, CreditCardPayment, 0, DebitPayment, 0, 0, PaymentType); //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport); UpdateCashierReport(TransactionStatus.CreditPayment, 0, 0, AmountPaid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CashPayment, ChequePayment, CreditCardPayment, 0, DebitPayment, 0, 0, PaymentType); // 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); //enable IsCreditAllowed //already done when paying creditpayment //// 3Nov2014 : automatically deposit the change if credit payment //#region Auto deposit for creditpayment //if (mclsSysConfigDetails.WillDepositChangeOfCreditPayment) //{ // InsertAuditLog(AccessTypes.Deposit, "Auto depositing change of trx #: " + mclsSalesTransactionDetails.TransactionNo + "."); // clsEvent.AddEventLn("Auto depositing change of trx #: " + mclsSalesTransactionDetails.TransactionNo + "."); // Data.Deposits clsDeposit = new Data.Deposits(mConnection, mTransaction); // mConnection = clsDeposit.Connection; mTransaction = clsDeposit.Transaction; // Data.DepositDetails clsDepositDetails = new Data.DepositDetails() // { // BranchDetails = mclsTerminalDetails.BranchDetails, // TerminalNo = mclsTerminalDetails.TerminalNo, // Amount = mclsSalesTransactionDetails.ChangeAmount, // PaymentType = mclsSalesTransactionDetails.PaymentType, // DateCreated = DateTime.Now, // CashierID = mclsSalesTransactionDetails.CashierID, // CashierName = mclsSalesTransactionDetails.CashierName, // ContactID = mclsSalesTransactionDetails.CustomerDetails.ContactID, // ContactName = mclsSalesTransactionDetails.CustomerDetails.ContactName, // Remarks = "Auto deposit from trx #: " + mclsSalesTransactionDetails.TransactionNo + ".", // CreatedOn = DateTime.Now, // LastModified = DateTime.Now // }; // clsDeposit.Insert(clsDepositDetails); // Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction); // mConnection = clsContact.Connection; mTransaction = clsContact.Transaction; // clsContact.AddDebit(clsDepositDetails.ContactID, clsDepositDetails.Amount); // clsDeposit.CommitAndDispose(); // InsertAuditLog(AccessTypes.Deposit, "Deposit: type='" + clsDepositDetails.PaymentType.ToString("G") + "' amount='" + clsDepositDetails.Amount.ToString(",##0.#0") + "'" + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); // clsEvent.AddEventLn("Done! type=" + clsDepositDetails.PaymentType.ToString("G") + " amount=" + clsDepositDetails.Amount.ToString("#,###.#0")); //} //#endregion clsSalesTransactions.CommitAndDispose(); clsLocalDB.CommitAndDispose(); InsertAuditLog(AccessTypes.CreditPayment, "Pay credit for " + mclsContactDetails.ContactName + "." + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); if (mclsTerminalDetails.AutoPrint == PrintingPreference.AskFirst) if (MessageBox.Show("Would you like to print this transaction?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, (mclsSysConfigDetails.isDefaultButtonYesInPrintTransaction ? MessageBoxDefaultButton.Button1 : MessageBoxDefaultButton.Button2)) == DialogResult.Yes) mclsTerminalDetails.AutoPrint = PrintingPreference.Normal; // print credit payment as normal transaction if not HP if (mclsSalesTransactionDetails.isConsignment) { // 18Feb2015 : Print DR only if the transaction is consignment clsEvent.AddEventLn(" printing delivery receipt as consginment...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintDeliveryReceipt(); } else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.OutOfStockCustomerCode && (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice || mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt || mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR)) { clsEvent.AddEventLn(" printing out of stock orders...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintOSReceipt(); } else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode && (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice || mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt || mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR)) { clsEvent.AddEventLn(" printing walk-in customer quote form...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintWalkInReceipt(); } else if (mclsSysConfigDetails.CreditPaymentType == CreditPaymentType.Houseware) { // do another report for credit payment if HP PrintCreditPayment(); // do this twice as per request of CN trader's and CS PrintCreditPayment(); } else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice || mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt || mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR) { clsEvent.AddEventLn(" printing sales invoice...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintCollectionReceipt(); } else { // Sep 14, 2014 Control printing in mclsFilePrinter.Write //if (mclsTerminalDetails.AutoPrint == PrintingPreference.Normal) //print items if not yet printed //{ foreach (System.Data.DataRow dr in ItemDataTable.Rows) { if (dr["Quantity"].ToString() != "VOID") { string stItemNo = "" + dr["ItemNo"].ToString(); string stProductCode = "" + dr["ProductCode"].ToString(); if (dr["MatrixDescription"].ToString() != string.Empty && dr["MatrixDescription"].ToString() != null) stProductCode += "-" + dr["MatrixDescription"].ToString(); string stProductUnitCode = "" + dr["ProductUnitCode"].ToString(); decimal decQuantity = Convert.ToDecimal(dr["Quantity"]); decimal decPrice = Convert.ToDecimal(dr["Price"]); decimal decDiscount = Convert.ToDecimal(dr["Discount"]); decimal decAmount = Convert.ToDecimal(dr["Amount"]); decimal decVAT = Convert.ToDecimal(dr["VAT"]); decimal decEVAT = Convert.ToDecimal(dr["EVAT"]); decimal decPromoApplied = Convert.ToDecimal(dr["PromoApplied"]); string stDiscountCode = "" + dr["DiscountCode"].ToString(); DiscountTypes ItemDiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["ItemDiscountType"].ToString()); PrintItem(stItemNo, stProductCode, stProductUnitCode, decQuantity, decPrice, decDiscount, decPromoApplied, decAmount, decVAT, decEVAT, stDiscountCode, ItemDiscountType); } } //} // Sep 14, 2014 Control printing in mclsFilePrinter.Write PrintReportFooterSection(true, TransactionStatus.CreditPayment, 0, 0, AmountPaid, 0, 0, AmountPaid, CashPayment, ChequePayment, CreditCardPayment, 0, DebitPayment, 0, 0, ChangeAmount, arrChequePaymentDetails, arrCreditCardPaymentDetails, null, arrDebitPaymentDetails); } this.LoadOptions(); } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Credit payment procedure. Err Description: "); } Cursor.Current = Cursors.Default; } creditWnd.Close(); creditWnd.Dispose(); } } }
private void VerifyCredit() { if (!SuspendTransactionAndContinue()) return; DialogResult loginresult = DialogResult.Cancel; // 08Jul2015 : Remove the access for CreditVerification if it's normal switch (mclsSysConfigDetails.CreditPaymentType ) { case CreditPaymentType.Houseware: loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.EnterCreditPayment); break; case CreditPaymentType.Normal: case CreditPaymentType.MPC: default: loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.FE_VerifyCredit); break; } if (loginresult == DialogResult.OK) { CreditVerificationWnd clsCreditVerificationWnd = new CreditVerificationWnd(); clsCreditVerificationWnd.TerminalDetails = mclsTerminalDetails; clsCreditVerificationWnd.SysConfigDetails = mclsSysConfigDetails; clsCreditVerificationWnd.CashierID = mclsSalesTransactionDetails.CashierID; clsCreditVerificationWnd.CashierName = mclsSalesTransactionDetails.CashierName; clsCreditVerificationWnd.ShowDialog(this); DialogResult result = clsCreditVerificationWnd.Result; Data.ContactDetails details = clsCreditVerificationWnd.CreditorDetails; Data.ContactDetails guarantordetails = clsCreditVerificationWnd.GuarantorDetails; Keys keyCommand = clsCreditVerificationWnd.keyCommand; clsCreditVerificationWnd.Close(); clsCreditVerificationWnd.Dispose(); if (result == DialogResult.OK) { if (keyCommand == Keys.F12) { Cursor.Current = Cursors.WaitCursor; LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; try { //print the verification slip PrintCreditVerificationSlip(details, guarantordetails); } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Credit verification procedure. Err Description: "); } clsLocalDB.CommitAndDispose(); } } } }
private void SplitTransaction() { if (!mboIsInTransaction) { MessageBox.Show("No active transaction found.", "RetailPlus", MessageBoxButtons.OK); return; } if (mboIsInTransaction) { SplitPaymentSelectWnd payment = new SplitPaymentSelectWnd(); payment.MainWndTop = cmd1.Location.Y; payment.MainWndLeft = cmd10.Location.X + 1; payment.ShowDialog(this); DialogResult result = payment.Result; SplitPaymentTypes SplitPaymentType = payment.SplitPaymentType; payment.Close(); payment.Dispose(); if (result == DialogResult.OK) { decimal decRetValue = 0; Int32 iNoOfDiners = mclsSalesTransactionDetails.PaxNo; if (SplitPaymentType == SplitPaymentTypes.Equally || SplitPaymentType == SplitPaymentTypes.ByAmount) { if (ShowNoControl(this, out decRetValue, decimal.Parse(iNoOfDiners.ToString()), "Enter no. of diners to pay.") == DialogResult.Cancel) return; else { iNoOfDiners = Int32.Parse(decRetValue.ToString()); // just close the transaction if it's just 1 dinner if (iNoOfDiners == 1) { CloseTransaction(); return; } } } DialogResult paymentResult = DialogResult.Cancel; Data.SplitPaymentDetails[] clsSplitPaymentDetails; // get the item details Data.SalesTransactionItems clsItems = new Data.SalesTransactionItems(); mConnection = clsItems.Connection; mTransaction = clsItems.Transaction; Data.SalesTransactionItemDetails[] TransactionItems = clsItems.Details(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.TransactionDate); mclsSalesTransactionDetails.TransactionItems = TransactionItems; clsItems.CommitAndDispose(); switch (SplitPaymentType) { case SplitPaymentTypes.Equally: #region Equal payments //insert payment details SplitPaymentEqualWnd clsSplitPaymentEqualWnd = new SplitPaymentEqualWnd(); clsSplitPaymentEqualWnd.TerminalDetails = mclsTerminalDetails; clsSplitPaymentEqualWnd.SysConfigDetails = mclsSysConfigDetails; clsSplitPaymentEqualWnd.CustomerDetails = mclsContactDetails; clsSplitPaymentEqualWnd.SalesTransactionDetails = mclsSalesTransactionDetails; clsSplitPaymentEqualWnd.CreditCardSwiped = mboCreditCardSwiped; clsSplitPaymentEqualWnd.IsRefund = mboIsRefund; clsSplitPaymentEqualWnd.IsCreditChargeExcluded = false; //mTopItemDetails.IsCreditChargeExcluded; clsSplitPaymentEqualWnd.NoOfDiners = iNoOfDiners; clsSplitPaymentEqualWnd.ShowDialog(this); paymentResult = clsSplitPaymentEqualWnd.Result; clsSplitPaymentDetails = clsSplitPaymentEqualWnd.arrSplitPaymentDetails; clsSplitPaymentEqualWnd.Close(); clsSplitPaymentEqualWnd.Dispose(); if (paymentResult == DialogResult.OK) { //save the old in a temp Details Data.SalesTransactionDetails tmpSalesTransactionDetails = mclsSalesTransactionDetails; LocalDB clsLocalDB = new LocalDB(); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; // save all the payments made foreach (Data.SplitPaymentDetails det in clsSplitPaymentDetails) { mclsSalesTransactionDetails = tmpSalesTransactionDetails; mclsSalesTransactionDetails.TransactionItems = TransactionItems; decimal decSplitPercentage = mclsSalesTransactionDetails.SubTotal - mclsSalesTransactionDetails.Discount + mclsSalesTransactionDetails.Charge; decSplitPercentage = det.AmountDue / decSplitPercentage; SetGridItems(); SetGridItemsWidth(); #region create the transaction CreateTransaction(); #endregion #region punch all the items divided by the NoOfDiner foreach (Data.SalesTransactionItemDetails item in tmpSalesTransactionDetails.TransactionItems) { Data.SalesTransactionItemDetails clsDetails = item; //clsDetails.Amount = item.Amount / iNoOfDiners; //clsDetails.Price = item.Price / iNoOfDiners; //clsDetails.PurchasePrice = item.PurchasePrice / iNoOfDiners; //clsDetails.Discount = item.Discount / iNoOfDiners; //clsDetails.Quantity = item.Quantity / iNoOfDiners; //clsDetails.Amount = item.Amount * decSplitPercentage; //clsDetails.Price = item.Price * decSplitPercentage; //clsDetails.PurchasePrice = item.PurchasePrice * decSplitPercentage; //clsDetails.Discount = item.Discount * decSplitPercentage; clsDetails.Quantity = item.Quantity * decSplitPercentage; AddItem(clsDetails); } #endregion #region Apply existing discount if required if (tmpSalesTransactionDetails.Discount != 0) { if (tmpSalesTransactionDetails.TransDiscountType == DiscountTypes.NotApplicable) { lblTransDiscount.Text = "Less 0% / 0.00"; } lblTransDiscount.Tag = tmpSalesTransactionDetails.TransDiscountType.ToString("d"); mclsSalesTransactionDetails.TransDiscountType = tmpSalesTransactionDetails.TransDiscountType; mclsSalesTransactionDetails.TransDiscount = tmpSalesTransactionDetails.TransDiscount; mclsSalesTransactionDetails.Discount = tmpSalesTransactionDetails.Discount / iNoOfDiners; mclsSalesTransactionDetails.DiscountableAmount = tmpSalesTransactionDetails.DiscountableAmount / iNoOfDiners; mclsSalesTransactionDetails.DiscountCode = tmpSalesTransactionDetails.DiscountCode; mclsSalesTransactionDetails.DiscountRemarks = tmpSalesTransactionDetails.DiscountRemarks; ComputeSubTotal(); setTotalDetails(); if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount) { Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType); clsSalesTransactions.CommitAndDispose(); InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); } } #endregion Data.SalesTransactionItemDetails mTopItemDetails = getCurrentRowItemDetails(); #region close the transaction // override the customerinformation if it's paid with in-house creditcard if (det.clsCreditorDetails.ContactID != 0 && det.clsCreditorDetails.ContactID != mclsSalesTransactionDetails.CustomerID) { LoadContact(Data.ContactGroupCategory.CUSTOMER, det.clsCreditorDetails); } //close then print 1 by 1 CloseTransaction(mTopItemDetails, det.AmountPaid, det.ChangeAmount, det.BalanceAmount, det.CashPayment, det.ChequePayment, det.CreditCardPayment, det.CreditPayment, det.CreditChargeAmount, det.DebitPayment, det.RewardConvertedPayment, det.RewardPointsPayment, det.PaymentType, det.arrCashPaymentDetails, det.arrChequePaymentDetails, det.arrCreditCardPaymentDetails, det.arrCreditPaymentDetails, det.arrDebitPaymentDetails); #endregion clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog); this.LoadOptions(); } #region void the old transaction mclsSalesTransactionDetails = tmpSalesTransactionDetails; // load the transaction LoadTransaction(tmpSalesTransactionDetails.TransactionNo, tmpSalesTransactionDetails.TerminalNo); clsEvent.AddEventLn("[" + lblCashier.Text + "] Voiding transaction no. " + lblTransNo.Text, true); System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource; for (int x = 0; x < dt.Rows.Count; x++) { dgItems.CurrentRowIndex = x; Data.SalesTransactionItemDetails Details = getCurrentRowItemDetails(); if (Details.TransactionItemStatus != TransactionItemStatus.Void) { Details.TransactionItemStatus = TransactionItemStatus.Void; ReservedAndCommitItem(Details, Details.TransactionItemStatus); } } //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport); UpdateTerminalReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned); //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport); UpdateCashierReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned); new Data.SalesTransactions(mConnection, mTransaction).Void(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName); new Data.SalesTransactions(mConnection, mTransaction).UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, lblTerminalNo.Text); // 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); InsertAuditLog(AccessTypes.VoidTransaction, "VOID transaction #:" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); clsEvent.AddEventLn("Done transaction no. " + lblTransNo.Text + " has been void.", true); #endregion clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog); this.LoadOptions(); // commit all in the database clsLocalDB.CommitAndDispose(); } #endregion break; case SplitPaymentTypes.ByItem: #region Item Payment //insert payment details SplitPaymentItemWnd clsSplitPaymentItemWnd = new SplitPaymentItemWnd(); clsSplitPaymentItemWnd.TerminalDetails = mclsTerminalDetails; clsSplitPaymentItemWnd.SysConfigDetails = mclsSysConfigDetails; clsSplitPaymentItemWnd.CustomerDetails = mclsContactDetails; clsSplitPaymentItemWnd.SalesTransactionDetails = mclsSalesTransactionDetails; clsSplitPaymentItemWnd.CreditCardSwiped = mboCreditCardSwiped; clsSplitPaymentItemWnd.IsRefund = mboIsRefund; clsSplitPaymentItemWnd.IsCreditChargeExcluded = false; //mTopItemDetails.IsCreditChargeExcluded; clsSplitPaymentItemWnd.NoOfDiners = iNoOfDiners; clsSplitPaymentItemWnd.SalesTransactionItemDetails = mclsSalesTransactionDetails.TransactionItems; clsSplitPaymentItemWnd.ShowDialog(this); paymentResult = clsSplitPaymentItemWnd.Result; clsSplitPaymentDetails = clsSplitPaymentItemWnd.arrSplitPaymentDetails; clsSplitPaymentItemWnd.Close(); clsSplitPaymentItemWnd.Dispose(); if (paymentResult == DialogResult.OK) { //save the old in a temp Details Data.SalesTransactionDetails tmpSalesTransactionDetails = mclsSalesTransactionDetails; LocalDB clsLocalDB = new LocalDB(); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; // save all the payments made foreach (Data.SplitPaymentDetails det in clsSplitPaymentDetails) { mclsSalesTransactionDetails = tmpSalesTransactionDetails; mclsSalesTransactionDetails.TransactionItems = TransactionItems; SetGridItems(); SetGridItemsWidth(); #region create the transaction CreateTransaction(); #endregion #region punch all the items for the selected payee foreach (Data.SalesTransactionItemDetails item in tmpSalesTransactionDetails.TransactionItems) { if (item.PaxNo == det.PaxNo) { Data.SalesTransactionItemDetails clsDetails = item; //clsDetails.Amount = item.Amount * decSplitPercentage; //clsDetails.Price = item.Price * decSplitPercentage; //clsDetails.PurchasePrice = item.PurchasePrice * decSplitPercentage; //clsDetails.Discount = item.Discount * decSplitPercentage; //clsDetails.Quantity = item.Quantity * decSplitPercentage; AddItem(clsDetails); } } #endregion #region Apply existing discount if required if (tmpSalesTransactionDetails.Discount != 0) { if (tmpSalesTransactionDetails.TransDiscountType == DiscountTypes.NotApplicable) { lblTransDiscount.Text = "Less 0% / 0.00"; } lblTransDiscount.Tag = tmpSalesTransactionDetails.TransDiscountType.ToString("d"); mclsSalesTransactionDetails.TransDiscountType = tmpSalesTransactionDetails.TransDiscountType; mclsSalesTransactionDetails.TransDiscount = tmpSalesTransactionDetails.TransDiscount; mclsSalesTransactionDetails.Discount = tmpSalesTransactionDetails.Discount / iNoOfDiners; mclsSalesTransactionDetails.DiscountableAmount = tmpSalesTransactionDetails.DiscountableAmount / iNoOfDiners; mclsSalesTransactionDetails.DiscountCode = tmpSalesTransactionDetails.DiscountCode; mclsSalesTransactionDetails.DiscountRemarks = tmpSalesTransactionDetails.DiscountRemarks; ComputeSubTotal(); setTotalDetails(); if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount) { Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType); clsSalesTransactions.CommitAndDispose(); InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); } } #endregion Data.SalesTransactionItemDetails mTopItemDetails = getCurrentRowItemDetails(); #region close the transaction // override the customerinformation if it's paid with in-house creditcard if (det.clsCreditorDetails.ContactID != 0 && det.clsCreditorDetails.ContactID != mclsSalesTransactionDetails.CustomerID) { LoadContact(Data.ContactGroupCategory.CUSTOMER, det.clsCreditorDetails); } //close then print 1 by 1 CloseTransaction(mTopItemDetails, det.AmountPaid, det.ChangeAmount, det.BalanceAmount, det.CashPayment, det.ChequePayment, det.CreditCardPayment, det.CreditPayment, det.CreditChargeAmount, det.DebitPayment, det.RewardConvertedPayment, det.RewardPointsPayment, det.PaymentType, det.arrCashPaymentDetails, det.arrChequePaymentDetails, det.arrCreditCardPaymentDetails, det.arrCreditPaymentDetails, det.arrDebitPaymentDetails); #endregion clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog); this.LoadOptions(); } #region void the old transaction mclsSalesTransactionDetails = tmpSalesTransactionDetails; // load the transaction LoadTransaction(tmpSalesTransactionDetails.TransactionNo, tmpSalesTransactionDetails.TerminalNo); clsEvent.AddEventLn("[" + lblCashier.Text + "] Voiding transaction no. " + lblTransNo.Text, true); System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource; for (int x = 0; x < dt.Rows.Count; x++) { dgItems.CurrentRowIndex = x; Data.SalesTransactionItemDetails Details = getCurrentRowItemDetails(); if (Details.TransactionItemStatus != TransactionItemStatus.Void) { Details.TransactionItemStatus = TransactionItemStatus.Void; ReservedAndCommitItem(Details, Details.TransactionItemStatus); } } //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport); UpdateTerminalReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned); //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport); UpdateCashierReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned); new Data.SalesTransactions(mConnection, mTransaction).Void(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName); new Data.SalesTransactions(mConnection, mTransaction).UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, lblTerminalNo.Text); // 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); InsertAuditLog(AccessTypes.VoidTransaction, "VOID transaction #:" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); clsEvent.AddEventLn("Done transaction no. " + lblTransNo.Text + " has been void.", true); #endregion clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog); this.LoadOptions(); // commit all in the database clsLocalDB.CommitAndDispose(); } #endregion break; case SplitPaymentTypes.ByAmount: #region Amount Payments //insert payment details SplitPaymentAmountWnd clsSplitPaymentAmountWnd = new SplitPaymentAmountWnd(); clsSplitPaymentAmountWnd.TerminalDetails = mclsTerminalDetails; clsSplitPaymentAmountWnd.SysConfigDetails = mclsSysConfigDetails; clsSplitPaymentAmountWnd.CustomerDetails = mclsContactDetails; clsSplitPaymentAmountWnd.SalesTransactionDetails = mclsSalesTransactionDetails; clsSplitPaymentAmountWnd.CreditCardSwiped = mboCreditCardSwiped; clsSplitPaymentAmountWnd.IsRefund = mboIsRefund; clsSplitPaymentAmountWnd.IsCreditChargeExcluded = false; //mTopItemDetails.IsCreditChargeExcluded; clsSplitPaymentAmountWnd.NoOfDiners = iNoOfDiners; clsSplitPaymentAmountWnd.ShowDialog(this); paymentResult = clsSplitPaymentAmountWnd.Result; clsSplitPaymentDetails = clsSplitPaymentAmountWnd.arrSplitPaymentDetails; clsSplitPaymentAmountWnd.Close(); clsSplitPaymentAmountWnd.Dispose(); if (paymentResult == DialogResult.OK) { //save the old in a temp Details Data.SalesTransactionDetails tmpSalesTransactionDetails = mclsSalesTransactionDetails; LocalDB clsLocalDB = new LocalDB(); mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction; // save all the payments made foreach (Data.SplitPaymentDetails det in clsSplitPaymentDetails) { mclsSalesTransactionDetails = tmpSalesTransactionDetails; mclsSalesTransactionDetails.TransactionItems = TransactionItems; decimal decSplitPercentage = mclsSalesTransactionDetails.SubTotal - mclsSalesTransactionDetails.Discount + mclsSalesTransactionDetails.Charge; decSplitPercentage = det.AmountDue / decSplitPercentage; SetGridItems(); SetGridItemsWidth(); #region create the transaction CreateTransaction(); #endregion #region punch all the items divided by the NoOfDiner foreach (Data.SalesTransactionItemDetails item in tmpSalesTransactionDetails.TransactionItems) { Data.SalesTransactionItemDetails clsDetails = item; //clsDetails.Amount = item.Amount * decSplitPercentage; //clsDetails.Price = item.Price * decSplitPercentage; //clsDetails.PurchasePrice = item.PurchasePrice * decSplitPercentage; //clsDetails.Discount = item.Discount * decSplitPercentage; clsDetails.Quantity = item.Quantity * decSplitPercentage; AddItem(clsDetails); } #endregion #region Apply existing discount if required if (tmpSalesTransactionDetails.Discount != 0) { if (tmpSalesTransactionDetails.TransDiscountType == DiscountTypes.NotApplicable) { lblTransDiscount.Text = "Less 0% / 0.00"; } lblTransDiscount.Tag = tmpSalesTransactionDetails.TransDiscountType.ToString("d"); mclsSalesTransactionDetails.TransDiscountType = tmpSalesTransactionDetails.TransDiscountType; mclsSalesTransactionDetails.TransDiscount = tmpSalesTransactionDetails.TransDiscount; mclsSalesTransactionDetails.Discount = tmpSalesTransactionDetails.Discount / iNoOfDiners; mclsSalesTransactionDetails.DiscountableAmount = tmpSalesTransactionDetails.DiscountableAmount / iNoOfDiners; mclsSalesTransactionDetails.DiscountCode = tmpSalesTransactionDetails.DiscountCode; mclsSalesTransactionDetails.DiscountRemarks = tmpSalesTransactionDetails.DiscountRemarks; ComputeSubTotal(); setTotalDetails(); if (mclsSalesTransactionDetails.Discount <= mclsSalesTransactionDetails.DiscountableAmount) { Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; clsSalesTransactions.UpdateSubTotal(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.DiscountCode, mclsSalesTransactionDetails.DiscountRemarks, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.ChargeAmount, mclsSalesTransactionDetails.ChargeCode, mclsSalesTransactionDetails.ChargeRemarks, mclsSalesTransactionDetails.ChargeType); clsSalesTransactions.CommitAndDispose(); InsertAuditLog(AccessTypes.Discounts, "Apply transaction discount for " + mclsSalesTransactionDetails.Discount.ToString("#,###.#0") + ". Tran. #".PadRight(15) + ":" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); } } #endregion Data.SalesTransactionItemDetails mTopItemDetails = getCurrentRowItemDetails(); #region close the transaction // override the customerinformation if it's paid with in-house creditcard if (det.clsCreditorDetails.ContactID != 0 && det.clsCreditorDetails.ContactID != mclsSalesTransactionDetails.CustomerID) { LoadContact(Data.ContactGroupCategory.CUSTOMER, det.clsCreditorDetails); } //close then print 1 by 1 CloseTransaction(mTopItemDetails, det.AmountPaid, det.ChangeAmount, det.BalanceAmount, det.CashPayment, det.ChequePayment, det.CreditCardPayment, det.CreditPayment, det.CreditChargeAmount, det.DebitPayment, det.RewardConvertedPayment, det.RewardPointsPayment, det.PaymentType, det.arrCashPaymentDetails, det.arrChequePaymentDetails, det.arrCreditCardPaymentDetails, det.arrCreditPaymentDetails, det.arrDebitPaymentDetails); #endregion clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog); this.LoadOptions(); } #region void the old transaction mclsSalesTransactionDetails = tmpSalesTransactionDetails; // load the transaction LoadTransaction(tmpSalesTransactionDetails.TransactionNo, tmpSalesTransactionDetails.TerminalNo); clsEvent.AddEventLn("[" + lblCashier.Text + "] Voiding transaction no. " + lblTransNo.Text, true); System.Data.DataTable dt = (System.Data.DataTable)dgItems.DataSource; for (int x = 0; x < dt.Rows.Count; x++) { dgItems.CurrentRowIndex = x; Data.SalesTransactionItemDetails Details = getCurrentRowItemDetails(); if (Details.TransactionItemStatus != TransactionItemStatus.Void) { Details.TransactionItemStatus = TransactionItemStatus.Void; ReservedAndCommitItem(Details, Details.TransactionItemStatus); } } //UpdateTerminalReportDelegate updateterminalDel = new UpdateTerminalReportDelegate(UpdateTerminalReport); UpdateTerminalReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned); //UpdateCashierReportDelegate updatecashierDel = new UpdateCashierReportDelegate(UpdateCashierReport); UpdateCashierReport(TransactionStatus.Void, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, 0, 0, 0, 0, 0, 0, 0, PaymentTypes.NotYetAssigned); new Data.SalesTransactions(mConnection, mTransaction).Void(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, mclsSalesTransactionDetails.ItemsDiscount, mclsSalesTransactionDetails.SNRItemsDiscount, mclsSalesTransactionDetails.PWDItemsDiscount, mclsSalesTransactionDetails.OtherItemsDiscount, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.SNRDiscount, mclsSalesTransactionDetails.PWDDiscount, mclsSalesTransactionDetails.OtherDiscount, mclsSalesTransactionDetails.TransDiscount, mclsSalesTransactionDetails.TransDiscountType, mclsSalesTransactionDetails.VAT, mclsSalesTransactionDetails.VATableAmount, mclsSalesTransactionDetails.ZeroRatedSales, mclsSalesTransactionDetails.NonVATableAmount, mclsSalesTransactionDetails.VATExempt, mclsSalesTransactionDetails.EVAT, mclsSalesTransactionDetails.EVATableAmount, mclsSalesTransactionDetails.NonEVATableAmount, mclsSalesTransactionDetails.LocalTax, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.CashierID, mclsSalesTransactionDetails.CashierName); new Data.SalesTransactions(mConnection, mTransaction).UpdateTerminalNo(mclsSalesTransactionDetails.TransactionID, lblTerminalNo.Text); // 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); InsertAuditLog(AccessTypes.VoidTransaction, "VOID transaction #:" + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); clsEvent.AddEventLn("Done transaction no. " + lblTransNo.Text + " has been void.", true); #endregion clsEvent.AddEventLn(" Loading Options...", true, mclsSysConfigDetails.WillWriteSystemLog); this.LoadOptions(); // commit all in the database clsLocalDB.CommitAndDispose(); } #endregion break; default: break; } } } }