Beispiel #1
0
        public void PostVoidItem(IPosTransaction posTransaction, int lineId)
        {
            IFiscalOperations fiscalPrinter = FiscalPrinterSingleton.Instance.FiscalPrinter;

            if (fiscalPrinter != null && FiscalPrinterSingleton.Instance.SalesLineItemData.ContainsKey(lineId))
            {
                LineItemTagalong tagalong = FiscalPrinterSingleton.Instance.SalesLineItemData[lineId];

                if (!tagalong.Voided)
                {
                    fiscalPrinter.RemoveItem(tagalong.PrinterItemNumber);
                    tagalong.Voided = true;
                }
            }
        }
Beispiel #2
0
        private static void UpdateFiscalPrinterTransactionData(FiscalPrinterSingleton fiscalCore, IFiscalOperations fiscalPrinter, LinkedList <SaleLineItem> salesLines, ref Decimal totalDiscountAmount, ref Decimal totalDiscountPercent)
        {
            foreach (SaleLineItem lineItem in salesLines)
            {     // Check for changes from what was last sent to fiscal printer...
                if (fiscalCore.SalesLineItemData.ContainsKey(lineItem.LineId))
                { // We have a tag along
                    LineItemTagalong tagalong = fiscalCore.SalesLineItemData[lineItem.LineId];

                    if (!tagalong.Voided)
                    {
                        // Process line discounts/additional charges...

                        // Consdier if check lineItem.NoDiscountAllowed should be done first
                        foreach (DiscountItem discount in lineItem.DiscountLines)
                        {   // Future enhancment - determine if discounts must be applied in a specific order and
                            // if % discounts are applied to the running total or to the base price
                            // and if multiple % discounts are allowed?

                            if (discount is LineDiscountItem)
                            {
                                if (discount.Amount != 0)
                                {   // Apply amount discount
                                    fiscalPrinter.ApplyDiscount(tagalong.PrinterItemNumber, discount.Amount);
                                }

                                if (discount.Percentage != 0)
                                {   // Apply % discount
                                    fiscalPrinter.ApplyDiscount(tagalong.PrinterItemNumber, (int)(discount.Percentage * 100));
                                }
                            }
                            else if (discount is TotalDiscountItem)
                            {
                                Debug.Assert((totalDiscountAmount == 0) || (totalDiscountAmount == discount.Amount), "TotalDiscountAmount has multiple value");
                                totalDiscountAmount = discount.Amount;

                                Debug.Assert((totalDiscountPercent == 0) || (totalDiscountPercent == discount.Percentage), "totalDiscountPercent has multiple value");
                                totalDiscountPercent = discount.Percentage;
                            }
                        }
                    }
                }
            }
        }