private void ReprintTransaction(string TransactionNo = "", string TerminalNo = "") { if (!SuspendTransactionAndContinue()) return; DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ReprintTransaction); if (loginresult == DialogResult.OK) { DialogResult result = System.Windows.Forms.DialogResult.OK; string strTransactionNo = TransactionNo; string strTerminalNo = TerminalNo; if (string.IsNullOrEmpty(TransactionNo)) { TransactionNoWnd clsTransactionNoWnd = new TransactionNoWnd(); clsTransactionNoWnd.TransactionNoLength = mclsTerminalDetails.TransactionNoLength; clsTransactionNoWnd.TerminalNo = mclsTerminalDetails.TerminalNo; clsTransactionNoWnd.TerminalDetails = mclsTerminalDetails; clsTransactionNoWnd.ShowDialog(this); result = clsTransactionNoWnd.Result; strTransactionNo = clsTransactionNoWnd.TransactionNo; strTerminalNo = clsTransactionNoWnd.TerminalNo; clsTransactionNoWnd.Close(); clsTransactionNoWnd.Dispose(); } if (result == DialogResult.OK) { LoadOptions(); clsEvent.AddEventLn("Reprinting transaction #: " + strTransactionNo, true); mclsTerminalDetails.AutoPrint = PrintingPreference.Normal; string OldTerminalNo = mclsTerminalDetails.TerminalNo; //put to print the correct terminal no mclsTerminalDetails.TerminalNo = strTerminalNo; //open salestransaction data Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; LoadTransaction(strTransactionNo, strTerminalNo); AddToReprintedTransaction(strTransactionNo, strTerminalNo); clsSalesTransactions.CommitAndDispose(); ArrayList arrChequePaymentDetails = null; if (mclsSalesTransactionDetails.PaymentDetails.arrChequePaymentDetails != null) { arrChequePaymentDetails = new ArrayList(); foreach (Data.ChequePaymentDetails det in mclsSalesTransactionDetails.PaymentDetails.arrChequePaymentDetails) { arrChequePaymentDetails.Add(det); } } ArrayList arrCreditCardPaymentDetails = null; { arrCreditCardPaymentDetails = new ArrayList(); if (mclsSalesTransactionDetails.PaymentDetails.arrCreditCardPaymentDetails != null) foreach (Data.CreditCardPaymentDetails det in mclsSalesTransactionDetails.PaymentDetails.arrCreditCardPaymentDetails) { arrCreditCardPaymentDetails.Add(det); } } ArrayList arrCreditPaymentDetails = null; if (mclsSalesTransactionDetails.PaymentDetails.arrCreditPaymentDetails != null) { arrCreditPaymentDetails = new ArrayList(); foreach (Data.CreditPaymentDetails det in mclsSalesTransactionDetails.PaymentDetails.arrCreditPaymentDetails) { arrCreditPaymentDetails.Add(det); } } ArrayList arrDebitPaymentDetails = null; if (mclsSalesTransactionDetails.PaymentDetails.arrDebitPaymentDetails != null) { arrDebitPaymentDetails = new ArrayList(); foreach (Data.DebitPaymentDetails det in mclsSalesTransactionDetails.PaymentDetails.arrDebitPaymentDetails) { arrDebitPaymentDetails.Add(det); } } //print transactionfooter //items are already printed during the loading of items. //if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default) // PrintReportFooterSection(true, TransactionStatus.Reprinted, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.AmountPaid, mclsSalesTransactionDetails.CashPayment, mclsSalesTransactionDetails.ChequePayment, mclsSalesTransactionDetails.CreditCardPayment, mclsSalesTransactionDetails.CreditPayment, mclsSalesTransactionDetails.DebitPayment, mclsSalesTransactionDetails.RewardPointsPayment, mclsSalesTransactionDetails.RewardConvertedPayment, mclsSalesTransactionDetails.ChangeAmount, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails); if (mclsSalesTransactionDetails.isConsignment) { // 18Feb2015 : Print DR only if the transaction is consignment clsEvent.AddEventLn(" re-printing delivery receipt as consginment...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintDeliveryReceipt(); } else if (mclsSalesTransactionDetails.CustomerDetails.ContactCode == mclsSysConfigDetails.WalkInCustomerCode && (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoice || mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt || mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR)) { clsEvent.AddEventLn(" re-printing walk-in customer quote form...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintWalkInReceipt(); } else if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.CreditPayment && 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) { clsEvent.AddEventLn(" re-printing sales invoice...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintSalesInvoice(); } else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.DeliveryReceipt) { clsEvent.AddEventLn(" re-printing delivery receipt...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintDeliveryReceipt(); } else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceAndDR) { clsEvent.AddEventLn(" re-printing sales invoice & delivery receipt...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintSalesInvoice(); PrintDeliveryReceipt(); } //Added February 10, 2010 else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceForLX300Printer) { clsEvent.AddEventLn(" re-printing sales invoice for LX300...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintSalesInvoiceToLX(TerminalReceiptType.SalesInvoiceForLX300Printer); } //Added May 11, 2010 else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceOrDR) { clsEvent.AddEventLn(" re-printing sales invoice or OR...", true, mclsSysConfigDetails.WillWriteSystemLog); if (mclsSalesTransactionDetails.CashPayment != 0 || mclsSalesTransactionDetails.CreditCardPayment != 0) PrintSalesInvoice(); if (mclsSalesTransactionDetails.ChequePayment != 0 || mclsSalesTransactionDetails.CreditPayment != 0) PrintDeliveryReceipt(); } //Added January 17, 2011 else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceForLX300PlusPrinter) { clsEvent.AddEventLn(" re-printing sales invoice for LX300 Plus...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintSalesInvoiceToLX(TerminalReceiptType.SalesInvoiceForLX300PlusPrinter); } //Added February 22, 2011 else if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.SalesInvoiceForLX300PlusAmazon) { clsEvent.AddEventLn(" re-printing sales invoice for LX300 Plus Amazon...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintSalesInvoiceToLX(TerminalReceiptType.SalesInvoiceForLX300PlusAmazon); } else if (!mboIsRefund) // do not print if refund coz its already printed above { // Sep 14, 2014 Control printing in mclsFilePrinter.Write //if (mclsTerminalDetails.AutoPrint == PrintingPreference.Normal) //print items if not yet printed //{ clsEvent.AddEventLn(" printing items to POS printer...", true, mclsSysConfigDetails.WillWriteSystemLog); // do this here in case void items are to be printed if (!mboIsItemHeaderPrinted) { PrintReportHeadersSection(true); mboIsItemHeaderPrinted = true; } foreach (System.Data.DataRow dr in ItemDataTable.Rows) { string stItemNo = "" + dr["ItemNo"].ToString(); string stProductUnitCode = "" + dr["ProductUnitCode"].ToString(); 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 stProductCode = "" + dr["ProductCode"].ToString(); if (dr["MatrixDescription"].ToString() != string.Empty && dr["MatrixDescription"].ToString() != null) stProductCode += "-" + dr["MatrixDescription"].ToString(); decimal decQuantity = 0; string stDiscountCode = "" + dr["DiscountCode"].ToString(); DiscountTypes ItemDiscountType = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), dr["ItemDiscountType"].ToString()); if (dr["Quantity"].ToString().IndexOf("RETURN") != -1) { stProductCode = "" + dr["ProductCode"].ToString() + "-RET"; decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - RETURN", "").Trim()); decAmount = -decAmount; } else if (dr["Quantity"].ToString().IndexOf("DEMO") != -1) { stProductCode = "" + dr["ProductCode"].ToString() + "-DEMO"; decQuantity = Convert.ToDecimal(dr["Quantity"].ToString().Replace(" - DEMO", "").Trim()); decAmount = 0; } else if (dr["Quantity"].ToString() != "VOID") { decQuantity = Convert.ToDecimal(dr["Quantity"]); } if (dr["Quantity"].ToString().IndexOf("VOID") != -1) { if (mclsTerminalDetails.WillPrintVoidItem) if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default) PrintItem(stItemNo, stProductCode, stProductUnitCode, decQuantity, decPrice, decDiscount, decPromoApplied, decAmount, decVAT, decEVAT, stDiscountCode, ItemDiscountType); } else { if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default) PrintItem(stItemNo, stProductCode, stProductUnitCode, decQuantity, decPrice, decDiscount, decPromoApplied, decAmount, decVAT, decEVAT, stDiscountCode, ItemDiscountType); } } if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default) { PrintReportFooterSection(true, TransactionStatus.Reprinted, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.AmountPaid, mclsSalesTransactionDetails.CashPayment, mclsSalesTransactionDetails.ChequePayment, mclsSalesTransactionDetails.CreditCardPayment, mclsSalesTransactionDetails.CreditPayment, mclsSalesTransactionDetails.DebitPayment, mclsSalesTransactionDetails.RewardPointsPayment, mclsSalesTransactionDetails.RewardConvertedPayment, mclsSalesTransactionDetails.ChangeAmount, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails); // print the charge slip if not refund and will print if (mclsTerminalDetails.WillPrintChargeSlip && !mboIsRefund) { clsEvent.AddEventLn(" printing charge slip...", true, mclsSysConfigDetails.WillWriteSystemLog); // Nov 05, 2011 : Print Charge Slip PrintChargeSlip(ChargeSlipType.Customer); PrintChargeSlip(ChargeSlipType.Original); if (mclsTerminalDetails.IncludeCreditChargeAgreement && mclsSalesTransactionDetails.CustomerDetails.CreditDetails.CardTypeDetails.WithGuarantor) //do not print the guarantor if there is no agreement printed { PrintChargeSlip(ChargeSlipType.Guarantor); } } } //} // Sep 14, 2014 Control printing in mclsFilePrinter.Write } clsEvent.AddEventLn("Done reprinting transaction #".PadRight(15) + ":" + strTransactionNo, true); if (mclsSalesTransactionDetails.RewardPointsPayment != 0) { clsEvent.AddEventLn(" printing rewards slip...", true, mclsSysConfigDetails.WillWriteSystemLog); PrintRewardsRedemptionSlip(); } mclsTerminalDetails.TerminalNo = OldTerminalNo; //put back after printing the correct terminal no this.LoadOptions(); } } }
private void ReprintDeliveryReceipt() { if (!SuspendTransactionAndContinue()) return; DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ReprintTransaction); if (loginresult == DialogResult.OK) { TransactionNoWnd clsTransactionNoWnd = new TransactionNoWnd(); clsTransactionNoWnd.TransactionNoLength = mclsTerminalDetails.TransactionNoLength; clsTransactionNoWnd.TerminalNo = mclsTerminalDetails.TerminalNo; clsTransactionNoWnd.TerminalDetails = mclsTerminalDetails; clsTransactionNoWnd.ShowDialog(this); DialogResult result = clsTransactionNoWnd.Result; string strTransactionNo = ""; string strTerminalNo = mclsTerminalDetails.TerminalNo; if (result == DialogResult.OK) { strTransactionNo = clsTransactionNoWnd.TransactionNo; strTerminalNo = clsTransactionNoWnd.TerminalNo; } clsTransactionNoWnd.Close(); clsTransactionNoWnd.Dispose(); if (result == DialogResult.OK) { clsEvent.AddEventLn("Reprinting transaction #: " + strTransactionNo, true); mclsTerminalDetails.AutoPrint = PrintingPreference.Normal; //open salestransaction data LoadTransaction(strTransactionNo, strTerminalNo); //insert to logfile ArrayList arrChequePaymentDetails = null; ArrayList arrCreditCardPaymentDetails = null; ArrayList arrCreditPaymentDetails = null; ArrayList arrDebitPaymentDetails = null; //print transactionfooter if (mclsTerminalDetails.ReceiptType == TerminalReceiptType.Default) PrintReportFooterSection(true, TransactionStatus.Reprinted, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, mclsSalesTransactionDetails.AmountPaid, mclsSalesTransactionDetails.CashPayment, mclsSalesTransactionDetails.ChequePayment, mclsSalesTransactionDetails.CreditCardPayment, mclsSalesTransactionDetails.CreditPayment, mclsSalesTransactionDetails.DebitPayment, mclsSalesTransactionDetails.RewardPointsPayment, mclsSalesTransactionDetails.RewardConvertedPayment, mclsSalesTransactionDetails.ChangeAmount, arrChequePaymentDetails, arrCreditCardPaymentDetails, arrCreditPaymentDetails, arrDebitPaymentDetails); PrintDeliveryReceipt(); clsEvent.AddEventLn("Done reprinting delivery receipt transaction #".PadRight(15) + ":" + strTransactionNo, true); this.LoadOptions(); } } }
private void ReturnItem() { if (mboIsRefund || mclsTerminalDetails.IsParkingTerminal) return; DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.ReturnItem); if (loginresult == DialogResult.OK) { TransactionNoWnd clsTransactionNoWnd = new TransactionNoWnd(); clsTransactionNoWnd.TransactionNoLength = mclsTerminalDetails.TransactionNoLength; clsTransactionNoWnd.TerminalNo = mclsTerminalDetails.TerminalNo; clsTransactionNoWnd.TerminalDetails = mclsTerminalDetails; clsTransactionNoWnd.ShowDialog(this); DialogResult result = clsTransactionNoWnd.Result; string strTransactionNo = clsTransactionNoWnd.TransactionNo; string strTerminalNo = clsTransactionNoWnd.TerminalNo; clsTransactionNoWnd.Close(); clsTransactionNoWnd.Dispose(); if (result == DialogResult.OK) { TransactionReturnItemSelectWnd ItemWnd = new TransactionReturnItemSelectWnd(); ItemWnd.SysConfigDetails = mclsSysConfigDetails; ItemWnd.TransactionNo = strTransactionNo; ItemWnd.TerminalDetails = mclsTerminalDetails; ItemWnd.TransactionTerminalNo = strTerminalNo; ItemWnd.ShowDialog(this); if (ItemWnd.Result == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; if (!mboIsInTransaction) { lblTransDate.Text = DateTime.Now.ToString("MMM. dd, yyyy hh:mm:ss tt"); if (!this.CreateTransaction()) return; } Data.SalesTransactionItemDetails clsItemDetails = ItemWnd.Details; clsItemDetails = ComputeItemTotal(clsItemDetails); // set the grossales, vat, discounts, etc. clsItemDetails.TransactionItemStatus = TransactionItemStatus.Return; System.Data.DataRow dr = ItemDataTable.NewRow(); clsItemDetails.TransactionItemStatus = TransactionItemStatus.Return; clsItemDetails.ItemNo = Convert.ToString(ItemDataTable.Rows.Count + 1); dr = setCurrentRowItemDetails(dr, clsItemDetails); Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction); mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction; clsItemDetails.TransactionItemsID = AddItemToDB(clsItemDetails); dr["TransactionItemsID"] = clsItemDetails.TransactionItemsID.ToString(); // Sep 14, 2013: Removed if return. Return should have no effect in Reserved and Commit // Added May 7, 2011 to Cater Reserved and Commit functionality // ReservedAndCommitItem(clsItemDetails, clsItemDetails.TransactionItemStatus); ItemDataTable.Rows.Add(dr); mclsSalesTransactionDetails.TransactionItemsList.Add(clsItemDetails); dgItems.CurrentRowIndex = ItemDataTable.Rows.Count; dgItems.Select(dgItems.CurrentRowIndex); SetItemDetails(); ComputeSubTotal(); setTotalDetails(); 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.RefundTransaction, "Return Item " + clsItemDetails.ProductCode + "." + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); try { DisplayItemToTurretDelegate DisplayItemToTurretDel = new DisplayItemToTurretDelegate(DisplayItemToTurret); DisplayItemToTurretDel.BeginInvoke("RET-" + clsItemDetails.ProductCode, clsItemDetails.ProductUnitCode, clsItemDetails.Quantity, clsItemDetails.Price, clsItemDetails.Discount, clsItemDetails.PromoApplied, clsItemDetails.Amount, clsItemDetails.VAT, clsItemDetails.EVAT, null, null); } catch { } if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto) { PrintItemDelegate PrintItemDel = new PrintItemDelegate(PrintItem); string strProductCode = clsItemDetails.ProductCode; if (!string.IsNullOrEmpty(clsItemDetails.MatrixDescription)) strProductCode += "-" + clsItemDetails.MatrixDescription; PrintItemDel.BeginInvoke(clsItemDetails.ItemNo, strProductCode + " - RET ", clsItemDetails.ProductUnitCode, clsItemDetails.Quantity, clsItemDetails.Price, clsItemDetails.Discount, clsItemDetails.PromoApplied, clsItemDetails.Amount, clsItemDetails.VAT, clsItemDetails.EVAT, clsItemDetails.DiscountCode, clsItemDetails.ItemDiscountType, null, null); } Cursor.Current = Cursors.Default; } ItemWnd.Close(); ItemWnd.Dispose(); } } }