Exemplo n.º 1
0
        protected override void OnPayment(uint amount, FiscalPaymentType paymentType)
        {
            ExecuteDriverCommand(delegate()
            {
                _errorCode = (short)GeneralError.Success;

                POSCommand cmd = new POSCommand(214);
                cmd.AddChar(OPERATOR_PASSWD, 4);

                switch (paymentType)
                {
                case FiscalPaymentType.Cash:
                    cmd.AddNumeric(0, 2);
                    break;

                case FiscalPaymentType.Card:
                    cmd.AddNumeric(2, 2);
                    break;

                default:
                    cmd.AddNumeric(3, 2);
                    break;
                }
                cmd.AddNumeric((int)amount, 10);

                byte[] nRsp = new byte[11];
                _errorCode  = cmd.Execute(Port, nRsp);
                if (_errorCode != (short)GeneralError.Success)
                {
                    CancelDocument();
                }
            });
        }
Exemplo n.º 2
0
        protected override void OnPayment(uint amount, FiscalPaymentType paymentType)
        {
            _deviceProtocol.WriteDebugLine(string.Format("OnPayment({0}, {1})", amount, paymentType));

            bool nonFiscalDoc = _currDocType == DocumentType.Other || !HasNonzeroRegistrations;

            if (!nonFiscalDoc)
            {
                ExecuteDriverCommand(delegate()
                {
                    // подытог
                    FiscalDocState cuurDocState = _deviceProtocol.GetDeviceInfo().DocState;
                    if (cuurDocState == FiscalDocState.Position)
                    {
                        _deviceProtocol.ExecuteCommand("12");
                    }

                    decimal fAmount = (decimal)(amount / 100.0);
                    _deviceProtocol.CreateCommand("13");
                    switch (paymentType)
                    {
                    case FiscalPaymentType.Cash:
                        _deviceProtocol.AddString("00");
                        break;

                    case FiscalPaymentType.Card:
                        _deviceProtocol.AddString("02");
                        break;

                    case FiscalPaymentType.Other1:
                        _deviceProtocol.AddString("03");
                        break;

                    case FiscalPaymentType.Other2:
                        _deviceProtocol.AddString("04");
                        break;

                    case FiscalPaymentType.Other3:
                        _deviceProtocol.AddString("05");
                        break;
                    }

                    _deviceProtocol.AddString(fAmount.ToString("f2", _currNfi));
                    _deviceProtocol.AddString("");  // название платежной карты

                    _deviceProtocol.Execute();
                });
            }
        }
Exemplo n.º 3
0
        protected override void OnPayment(uint amount, FiscalPaymentType paymentType)
        {
            string printLine = "";

            switch (paymentType)
            {
            case FiscalPaymentType.Card:
                printLine = "Безнал. оплата:";
                break;

            case FiscalPaymentType.Cash:
                printLine = "Наличные:";
                break;

            default:
                printLine = "Оплата:";
                break;
            }
            paymentAmount += (int)amount;
            OnPrintString(printLine + string.Format("{0:f2}", amount / 100.0).PadLeft(PrinterInfo.TapeWidth.MainPrinter - printLine.Length), FontStyle.Regular);
            ErrorCode = new ServerErrorCode(this, GeneralError.Success);
        }
Exemplo n.º 4
0
        protected override void OnPayment(uint amount, FiscalPaymentType paymentType)
        {
            if (_currDocType == DocumentType.Sale ||
                _currDocType == DocumentType.Refund)
            {
                ExecuteDriverCommand(true, protocol =>
                {
                    // проверка состояния документа
                    protocol.ExecuteCommand("A0");
                    byte docStatus = (byte)protocol.GetFieldAsInt(3);
                    // если подытог еще не подводился
                    if ((docStatus & 0xF0) == 0x10)
                    {
                        // выполняем команду "Подытог"
                        protocol.ExecuteCommand("34");
                    }

                    // выполняем команду "Платеж"
                    protocol.ExecuteCommand("35", Convert.ToString((int)paymentType),
                                            (amount / 100m).ToString("F2", SPProtocol.Nfi));
                });
            }
        }
Exemplo n.º 5
0
 protected override void OnPayment(uint amount, FiscalPaymentType paymentType)
 {
 }
Exemplo n.º 6
0
 protected override void OnPayment(uint amount, FiscalPaymentType paymentType)
 {
     ExecuteDriverCommand(delegate(){ });
 }