Exemple #1
0
        public void Register(byte paymentType = 0, string comment = "")
        {
            if (cart.GetCount() <= 0)
            {
                driver.OpenDocument(DOC_TYPE_BUY);
            }
            int    i       = 1;
            double cartSum = cart.GetTotal();
            double sum     = 0;

            //if (cart.GetDiscount() >= 1) driver.RegisterDiscount(1, "Sale", cart.GetDiscount());
            foreach (entities.Product element in cart.GetElements())
            {
                driver.setTax_id(element.Tax_id);
                driver.RegisterProduct(element.GetName(), element.GetSku(), element.GetCartCount(), element.GetPrice(), i);
                driver.RegisterDiscount(1, "sale", element.Discount);
                sum += (element.GetCartCount() * element.GetPrice());
                i++;
            }
            double paymentSum;

            if (cartSum < sum)
            {
                int discount = Convert.ToInt32(sum - cartSum);
                if (discount <= 1)
                {
                    discount = 1;
                }

                paymentSum = sum - discount;
            }
            else
            {
                paymentSum = sum;
            }
            //driver.SetTaxNumber(tax_id);
            //driver.SetCashierName(Properties.Settings.Default.cashierName);
            driver.PrintTotal();
            driver.RegisterPayment(cartSum, paymentType);
            if (comment != "")
            {
                driver.PrintString(comment);
            }
            if (Properties.Settings.Default.cashierSign)
            {
                driver.cashierSign();
            }
            if (Properties.Settings.Default.buyerSign)
            {
                driver.buyerSign();
            }
            for (i = 0; i < Properties.Settings.Default.indentSize / 5; i++)
            {
                driver.ScrollPaper();
            }
            driver.CloseDocument();
        }
Exemple #2
0
        public void Register(byte paymentType = 0)
        {
            if (cart.GetCount() <= 0)
            {
                driver.OpenDocument(DOC_TYPE_BUY);
            }
            int    i       = 1;
            double cartSum = cart.GetTotal();
            double sum     = 0;

            if (cart.GetDiscount() >= 1)
            {
                driver.RegisterDiscount(cart.GetDiscType(), "-", cart.GetDiscount());
            }
            ;
            foreach (entities.Product element in cart.GetElements())
            {
                driver.RegisterProduct(element.GetName(), element.GetSku(), element.GetCartCount(), element.GetPrice(), i);
                sum += (element.GetCartCount() * element.GetPrice());
                i++;
            }
            double paymentSum;

            if (cartSum < sum)
            {
                int discount = Convert.ToInt32(sum - cartSum);
                if (discount <= 1)
                {
                    discount = 1;
                }

                paymentSum = sum - discount;
            }
            else
            {
                paymentSum = sum;
            }
            driver.SetTaxNumber(tax_id);
            driver.PrintTotal();
            driver.RegisterPayment(cartSum, paymentType);
            driver.BotIndent();
            driver.CloseDocument();
        }
Exemple #3
0
        public void Register(byte paymentType = 0)
        {
            if (cart.GetCount() <= 0)
            {
                return;
            }

            driver.OpenDocument(DOC_TYPE_REGISTER);
            int    i       = 1;
            double cartSum = cart.GetTotal();
            double sum     = 0;

            foreach (entities.Product element in cart.GetElements())
            {
                driver.RegisterProduct(element.GetName(), element.GetSku(), element.GetCartCount(), element.GetPrice(), i);
                sum += (element.GetCartCount() * element.GetPrice());
                i++;
            }

            double paymentSum;

            if (cartSum < sum)
            {
                int discount = Convert.ToInt32(sum - cartSum);
                if (discount <= 1)
                {
                    discount = 1;
                }

                driver.RegisterDiscount(1, "-", discount);
                paymentSum = sum - discount;
            }
            else
            {
                paymentSum = sum;
            }

            driver.PrintTotal();
            driver.RegisterPayment(cartSum, paymentType);
            driver.CloseDocument();
        }