Example #1
0
 private void TestCheckBt_Click(object sender, EventArgs e)
 {
     if (cashRegister != null)
     {
         cashRegister.StartCheck();
         cashRegister.AddCheckPosition(1, 1, 1, "Тесттовар1");
         cashRegister.AddPayment(10);
         cashRegister.EndCheck();
     }
 }
Example #2
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            //виводимо квитанцію на фіскальний принтер
            List <WareDocumentDetail> details = (from a in document.WareDocumentDetails
                                                 select a).ToList();

            if (cashRegister != null)
            {
                cashRegister.StartCheck();
                foreach (var detail in details)
                {
                    cashRegister.AddCheckPosition(detail.WareID, Convert.ToDecimal(detail.PriceForUnit), detail.UnitQuantity, detail.Ware.Name);
                }

                cashRegister.AddPayment(Convert.ToDecimal(PaySumaL.Text));
                cashRegister.EndCheck();
            }
            else
            {
                MessageBox.Show("Фіскальний принтер не підключено");
            }

            //зберігаємо дані про оплату в БД
            int?cardId = null;

            if (CardTB.Text.Length > 0)
            {
                CardsLogic cardsLogic = new CardsLogic(manager);
                WareCard   card       = cardsLogic.GetByCode(CardTB.Text);
                if (card != null)
                {
                    cardId = card.ID;
                }
            }

            DocumentPaymentsLogic paymentsLogic = new DocumentPaymentsLogic(manager);

            paymentsLogic.Create(DateTime.Now,
                                 Convert.ToDecimal(PaySumaL.Text),
                                 true, documentId,
                                 Convert.ToInt32(document.CurrencyID),
                                 Convert.ToInt32(StructureObjectsLUE.EditValue),
                                 Convert.ToInt32(PaymentTypesLUE.EditValue),
                                 cardId,
                                 CheckNumberTB.Text);
            manager.Save();
            this.Close();
        }