public void PreSale(IPreTriggerResult preTriggerResult, ISaleLineItem saleLineItem, IPosTransaction posTransaction) { Debug.WriteLine("PreSale"); // NOTE: This is the ideal place to update the fiscal printer for a new sales line item // except for the fact that key data in saleLineItem such as price and tax are not yet // set when this API is invoked. }
public void PrePriceOverride(IPreTriggerResult preTriggerResult, ISaleLineItem saleLineItem, IPosTransaction posTransaction, int lineId) { if (preTriggerResult == null) { throw new ArgumentNullException("preTriggerResult"); } // Do not allow price overrides. preTriggerResult.ContinueOperation = false; preTriggerResult.MessageId = 3033; // "This operation is invalid for this type of transaction. }
public void PreLineDiscountPercent(IPreTriggerResult preTriggerResult, IPosTransaction transaction, int LineId) { RetailTransaction retailTrans = transaction as RetailTransaction; //if (retailTrans.PartnerData.IsSpecialDisc == false)//IsDisableLineDiscount() && //{ // MessageBox.Show("Discoutn not allowed for this item."); // preTriggerResult.ContinueOperation = false; //} LSRetailPosis.ApplicationLog.Log("IDiscountTriggersV1.PreLineDiscountPercent", "Triggered before adding line discount percentange.", LSRetailPosis.LogTraceLevel.Trace); }
public void PreReturnItem(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction) { if (preTriggerResult == null) { throw new ArgumentNullException("preTriggerResult"); } // Don't allow returns preTriggerResult.ContinueOperation = false; // Optional - Specify resource ID and to display message box to user preTriggerResult.MessageId = 1827; }
public void PreReturnTransaction(IPreTriggerResult preTriggerResult, IRetailTransaction originalTransaction, IPosTransaction posTransaction) { if (preTriggerResult == null) { throw new ArgumentNullException("preTriggerResult"); } // Don't allow returns preTriggerResult.ContinueOperation = false; // Optional - Specify resource ID and to display message box to user preTriggerResult.MessageId = 3033; // "This operation is invalid for this type of transaction. Debug.WriteLine("PreReturnTransaction"); }
public void PreSuspendTransaction(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction) { System.Collections.Generic.LinkedList <LSRetailPosis.Transaction.Line.SaleItem.SaleLineItem> saleline = new System.Collections.Generic.LinkedList <LSRetailPosis.Transaction.Line.SaleItem.SaleLineItem>(((LSRetailPosis.Transaction.RetailTransaction)(posTransaction)).SaleItems); bool isServiceItem = false; foreach (var sale in saleline) { if (sale.ItemType == LSRetailPosis.Transaction.Line.SaleItem.BaseSaleItem.ItemTypes.Service && !sale.Voided) { isServiceItem = true; break; } } if (isServiceItem) { preTriggerResult.MessageId = 62999; preTriggerResult.ContinueOperation = false; return; } LSRetailPosis.ApplicationLog.Log("SuspendTriggers.PreSuspendTransaction", "Prior to the suspension of a transaction...", LSRetailPosis.LogTraceLevel.Trace); }
/// <summary> /// Triggered before voiding of a payment. /// </summary> /// <param name="preTriggerResult"></param> /// <param name="posTransaction"></param> /// <param name="lineId"> </param> public void PreVoidPayment(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, int lineId) { LSRetailPosis.ApplicationLog.Log("PaymentTriggers.PreVoidPayment", "Before the void payment operation...", LSRetailPosis.LogTraceLevel.Trace); }
public void PrePayment(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, object posOperation, string tenderId) { RetailTransaction retailTransaction = posTransaction as RetailTransaction; LSRetailPosis.Transaction.CustomerPaymentTransaction custTrans = posTransaction as LSRetailPosis.Transaction.CustomerPaymentTransaction; if (custTrans != null) { InputConfirmation inputconfirm = new InputConfirmation(); inputconfirm.PromptText = "Remarks "; inputconfirm.InputType = InputType.Normal; Interaction.frmInput Oinput = new Interaction.frmInput(inputconfirm); Oinput.ShowDialog(); if (!string.IsNullOrEmpty(Oinput.InputText)) { custTrans.PartnerData.Remarks = Oinput.InputText; } else { custTrans.PartnerData.Remarks = ""; } if ((PosisOperations)posOperation == PosisOperations.PayCreditMemo) { preTriggerResult.ContinueOperation = false; return; } SqlConnection connection = new SqlConnection(); if (application != null) { connection = application.Settings.Database.Connection; } else { connection = ApplicationSettings.Database.LocalConnection; } Enums.EnumClass oEnum = new Enums.EnumClass(); string sMaxAmount = string.Empty; string sTerminalID = ApplicationSettings.Terminal.TerminalId; string sMinAmt = Convert.ToString(oEnum.ValidateMinDeposit(connection, out sMaxAmount, sTerminalID, Convert.ToDecimal((((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount))); if (Convert.ToDecimal(sMinAmt) != 0 && Convert.ToDecimal(sMaxAmount) != 0) { if (Convert.ToDecimal(sMinAmt) > Convert.ToDecimal((((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount) || Convert.ToDecimal(sMaxAmount) < Convert.ToDecimal((((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount)) { preTriggerResult.ContinueOperation = false; preTriggerResult.MessageId = 50448; return; } } } //start : RH on 05/11/2014 if (retailTransaction != null) { /* InputConfirmation inC = new InputConfirmation(); * inC.PromptText = "Remarks"; * inC.InputType = InputType.Normal; * * Interaction.frmInput Oinput = new Interaction.frmInput(inC); * Oinput.ShowDialog(); * if(!string.IsNullOrEmpty(Oinput.InputText)) * retailTransaction.PartnerData.Remarks = Oinput.InputText; * else * retailTransaction.PartnerData.Remarks = "";*/ int iPM = 100; int iCF = 100; int isSale = 0; foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems) { if (!saleLineItem.Voided) { isSale = 1; iPM = getMetalType(saleLineItem.ItemId); if (iPM == (int)MetalType.PackingMaterial) { break; } } } if (isSale == 1 && string.IsNullOrEmpty(retailTransaction.PartnerData.Remarks)) { InputConfirmation inC = new InputConfirmation(); inC.PromptText = "Remarks"; inC.InputType = InputType.Normal; Interaction.frmInput Oinput = new Interaction.frmInput(inC); Oinput.ShowDialog(); if (!string.IsNullOrEmpty(Oinput.InputText)) { retailTransaction.PartnerData.Remarks = Oinput.InputText; } else { retailTransaction.PartnerData.Remarks = ""; } } if ((isSale == 1 || retailTransaction.SaleIsReturnSale) && string.IsNullOrEmpty(retailTransaction.PartnerData.TouristNumber)) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Tourist VAT Applicable.", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); //command.Parameters.Add("@GOLDFIXING", SqlDbType.Bit).Value = Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "YES" ? "True" : "False"; if (Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "YES") { InputConfirmation inC = new InputConfirmation(); inC.PromptText = "Tourist VAT Applicable"; inC.InputType = InputType.Normal; inC.MaxLength = 20; Interaction.frmInput Oinput = new Interaction.frmInput(inC); Oinput.ShowDialog(); if (!string.IsNullOrEmpty(Oinput.InputText)) { retailTransaction.PartnerData.TouristNumber = Oinput.InputText; } else { retailTransaction.PartnerData.TouristNumber = ""; } } } } string sAdjustmentId = AdjustmentItemID(); foreach (SaleLineItem SLineItem in retailTransaction.SaleItems) { //if(SLineItem.ItemId == sAdjustmentId && retailTransaction.SaleItems.Count == 1) //{ // retailTransaction.RefundReceiptId = "1"; // //break; //} if (SLineItem.ItemId == sAdjustmentId && retailTransaction.SaleItems.Count > 0) { retailTransaction.RefundReceiptId = "1"; } if (SLineItem.ItemId != sAdjustmentId) { retailTransaction.RefundReceiptId = ""; break; } } foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems) { if (!saleLineItem.Voided) { iCF = getMetalType(saleLineItem.ItemId); if (iCF == (int)MetalType.Certificate) { break; } } } foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems) { if (saleLineItem.ReturnLineId == 0) { if (retailTransaction.PartnerData.PackingMaterial != "Y") { if (IsRetailItem(saleLineItem.ItemId)) { if (iPM != (int)MetalType.PackingMaterial) { #region Commented //using(LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Have you issued packing material?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) //{ // LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); // if(Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "NO") // { // preTriggerResult.ContinueOperation = false; // return; // } // else // { // retailTransaction.PartnerData.PackingMaterial = "Y"; // if(IsCertificateItem(saleLineItem.ItemId)) // { // if(iCF != (int)MetalType.Certificate) // { // using(LSRetailPosis.POSProcesses.frmMessage dialog1 = new LSRetailPosis.POSProcesses.frmMessage("Have you issued the certificate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) // { // LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog1); // if(Convert.ToString(dialog1.DialogResult).ToUpper().Trim() == "NO") // { // preTriggerResult.ContinueOperation = false; // return; // } // else // retailTransaction.PartnerData.CertificateIssue = "Y"; // } // } // else // retailTransaction.PartnerData.CertificateIssue = "Y"; // } // } //} #endregion using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Proceed without packing material?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); if (Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "NO") { preTriggerResult.ContinueOperation = false; return; } } } else { retailTransaction.PartnerData.PackingMaterial = "Y"; #region Commented //if(IsCertificateItem(saleLineItem.ItemId)) //{ // if(iCF != (int)MetalType.Certificate) // { // using(LSRetailPosis.POSProcesses.frmMessage dialog1 = new LSRetailPosis.POSProcesses.frmMessage("Have you issued the certificate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) // { // LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog1); // if(Convert.ToString(dialog1.DialogResult).ToUpper().Trim() == "NO") // { // preTriggerResult.ContinueOperation = false; // return; // } // else // retailTransaction.PartnerData.CertificateIssue = "Y"; // } // } // else // retailTransaction.PartnerData.CertificateIssue = "Y"; //} #endregion } } } #region Commented // else if(retailTransaction.PartnerData.CertificateIssue != "Y") // { // if(IsCertificateItem(saleLineItem.ItemId)) // { // if(iCF != (int)MetalType.Certificate) // { // using(LSRetailPosis.POSProcesses.frmMessage dialog1 = new LSRetailPosis.POSProcesses.frmMessage("Have you issued the certificate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) // { // LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog1); // if(Convert.ToString(dialog1.DialogResult).ToUpper().Trim() == "NO") // { // preTriggerResult.ContinueOperation = false; // return; // } // else // retailTransaction.PartnerData.CertificateIssue = "Y"; // } // } // else // retailTransaction.PartnerData.CertificateIssue = "Y"; // } // } #endregion } } } // end: RH on 05/11/2014 LSRetailPosis.ApplicationLog.Log("PaymentTriggers.PrePayment", "On the start of a payment operation...", LSRetailPosis.LogTraceLevel.Trace); switch ((PosisOperations)posOperation) { case PosisOperations.PayCash: // Insert code here... break; case PosisOperations.PayCard: // Insert code here... break; case PosisOperations.PayCheque: // Insert code here... break; case PosisOperations.PayCorporateCard: // Insert code here... break; case PosisOperations.PayCreditMemo: // Insert code here... break; case PosisOperations.PayCurrency: // Insert code here... break; case PosisOperations.PayCustomerAccount: // Insert code here... break; case PosisOperations.PayGiftCertificate: // Insert code here... break; case PosisOperations.PayLoyalty: // Insert code here... break; // etc..... } }
public void PreRecallTransaction(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction) { LSRetailPosis.ApplicationLog.Log("SuspendTriggers.PreRecallTransaction", "Prior to the recall of a transaction from suspension...", LSRetailPosis.LogTraceLevel.Trace); }
public void PreLineDiscountAmount(IPreTriggerResult preTriggerResult, IPosTransaction transaction, int LineId) { LSRetailPosis.ApplicationLog.Log("IDiscountTriggersV1.PreLineDiscountAmount", "Triggered before adding line discount amount.", LSRetailPosis.LogTraceLevel.Trace); }
public void PreTotalDiscountPercent(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction) { LSRetailPosis.ApplicationLog.Log("IDiscountTriggersV2.PreTotalDiscountPercent", "Triggered before total discount percent.", LSRetailPosis.LogTraceLevel.Trace); }
public void PreTenderDeclaration(IPreTriggerResult preTriggerResult, IPosTransaction transaction) { LSRetailPosis.ApplicationLog.Log("CashManagementTriggers.PreTenderDeclaration", "Before running the Tender Declaration operation...", LSRetailPosis.LogTraceLevel.Trace); }
public void PreEndTransaction(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction) { if (preTriggerResult == null) { throw new ArgumentNullException("preTriggerResult"); } if (posTransaction == null) { throw new ArgumentNullException("posTransaction"); } Debug.WriteLine("PreEndTransaction"); bool abortTransaction = false; FiscalPrinterSingleton fiscalCore = FiscalPrinterSingleton.Instance; IFiscalOperations fiscalPrinter = fiscalCore.FiscalPrinter; PersistentPrinterData printerData = fiscalCore.PrinterData; RetailTransaction retailTransaction = posTransaction as RetailTransaction; LinkedList <TenderLineItem> tenderLines = null; LinkedList <SaleLineItem> salesLines = null; ComputePosExeMD5Text(); // Note: Other transaction types (CustomerPaymentTransaction) may also apply. if (retailTransaction != null) { // We are a retail transaction // Add all payments to the fiscal printer // Alternative option is to do this as ar result of IPaymentTriggers tenderLines = retailTransaction.TenderLines; salesLines = retailTransaction.SaleItems; if (fiscalPrinter.OperatingState == FiscalPrinterState.FiscalReceipt) { Decimal totalDiscountAmount = 0m; Decimal totalDiscountPercent = 0m; // Post any quantity changes to the printer fiscalCore.UpdateFiscalCouponSalesItemsQty(retailTransaction); UpdateFiscalPrinterTransactionData(fiscalCore, fiscalPrinter, salesLines, ref totalDiscountAmount, ref totalDiscountPercent); // Start payment, apply total/transaction discount or surcharge // Note: we are not implementing a surcharge if (totalDiscountPercent != 0) { // Transaction level % discount fiscalPrinter.StartTotalPaymentWithDiscount((int)(totalDiscountPercent * 100)); } else if (totalDiscountAmount != 0) { // Transaction level amount discount fiscalPrinter.StartTotalPaymentWithDiscount(totalDiscountAmount); } else { // No transaction level discounts or surcharge fiscalPrinter.StartTotalPayment(); } // Process Payments... Decimal posPaymentTotal = 0m; foreach (TenderLineItem tenderLine in tenderLines) { if (!tenderLine.Voided) { string paymentMethod = fiscalCore.MapTenderTypeIdToPaymentMethod(tenderLine.TenderTypeId); decimal paymentAmount = tenderLine.Amount; if (paymentAmount > 0m) { // only process positive payments with the fiscal printer // Cash-back should is ignored fiscalPrinter.MakePayment(paymentMethod, paymentAmount); posPaymentTotal += paymentAmount; } } } string couponNumber = fiscalPrinter.GetCouponNumber(); posTransaction.FiscalDocumentId = couponNumber; string serialNumber = fiscalPrinter.GetSerialNumber(); posTransaction.FiscalSerialId = serialNumber; Debug.WriteLine("Balance due: " + fiscalPrinter.GetBalanceDue()); Debug.WriteLine("Subtotal " + fiscalPrinter.GetSubtotal()); Debug.WriteLine("Pos Payment total " + posPaymentTotal); Debug.Assert(fiscalPrinter.GetBalanceDue() == 0m, "Not enough payment was made as expected by the fiscal printer"); if (fiscalPrinter.GetBalanceDue() > 0m) { // user will need to void transaction or fix the shortage to proceed. preTriggerResult.ContinueOperation = false; preTriggerResult.MessageId = 4042; // The action is not valid for this type of transaction. } else { // End and finalize the Fiscal Coupon fiscalPrinter.EndReceipt(string.Format(CultureInfo.CurrentCulture, "Thank you! MD5:{0}", _posExeMd5Text)); printerData.SetGrandTotal(fiscalPrinter.GetGrandTotal()); PrintTenderManagementReports(tenderLines); } } else { // Check to see if there are sales items on this transaction if (ContainsItemsRequiringFiscalPrinter(retailTransaction)) { // A Fiscal Coupon has not been created - Abort this operation. preTriggerResult.ContinueOperation = false; preTriggerResult.MessageId = 4042; // The action is not valid for this type of transaction. } } if (abortTransaction) { // Abort the transaction fiscalPrinter.CancelReceipt(); preTriggerResult.ContinueOperation = false; preTriggerResult.MessageId = 4042; // The action is not valid for this type of transaction. } } }
/// <summary> /// Before the operation is processed this trigger is called. /// </summary> /// <param name="preTriggerResult"></param> /// <param name="posTransaction"></param> /// <param name="posisOperation"></param> public void PreProcessOperation(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, PosisOperations posisOperation) { LSRetailPosis.ApplicationLog.Log("ICustomerTriggersV1.PreProcessOperation", "Before the operation is processed this trigger is called.", LSRetailPosis.LogTraceLevel.Trace); }
/// <summary> /// Before the infocode is processed this trigger is called. If the infocode should not be processed /// after the trigger has finished running then PreTriggerResults needs to be filled out accordingly. /// </summary> /// <param name="preTriggerResult"></param> /// <param name="posTransaction"></param> /// <param name="tableRefId">What table does the infocode apply to</param> public void PreProcessInfocode(IPreTriggerResult preTriggerResult, IPosTransaction transaction, InfoCodeTableRefType tableRefId) { }
public void PrePayCustomerAccount(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, decimal amount) { LSRetailPosis.ApplicationLog.Log("PaymentTriggers.PrePayCustomerAccount", "Before charging to a customer account", LSRetailPosis.LogTraceLevel.Trace); }
public void PreClearQty(IPreTriggerResult preTriggerResult, ISaleLineItem saleLineItem, IPosTransaction posTransaction, int lineId) { }
public void PreVoidItem(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, int lineId) { }
public void PreSetQty(IPreTriggerResult preTriggerResult, ISaleLineItem saleLineItem, IPosTransaction posTransaction, int lineId) { // NOTE properties such as saleLineItem.Quantity are not yet set when this trigger is invoked }
public void PrePayCardAuthorization(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, ICardInfo cardInfo, decimal amount) { LSRetailPosis.ApplicationLog.Log("PaymentTriggers.PrePayCardAuthorization", "Before the EFT authorization", LSRetailPosis.LogTraceLevel.Trace); }
public void PreVoidTransaction(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction) { Debug.WriteLine("PreVoidTransaction"); }
public void PreLogon(IPreTriggerResult preTriggerResult, string operatorId, string name) { MessageBox.Show("Pre Logon"); }
public void PreLogon(IPreTriggerResult preTriggerResult, string operatorId, string name) { LSRetailPosis.ApplicationLog.Log("IApplicationTriggers.PreLogon", "Before the user has been logged on...", LSRetailPosis.LogTraceLevel.Trace); }