Пример #1
0
        /// <summary>
        /// Prints the bill.
        /// </summary>
        /// <param name="bill">The xml representation of bill.</param>
        ///
        ///
        public void PrintBill(XmlDocument bill)
        {
            ProcessBill(bill);

            StringBuilder errorMessage = null;

            lock (MakoPrintFiscal.SerialPortSyncRoot)
            {
                //inicjalizacja portu
                if ((errorMessage = ElzabLibWrapper.LibCommunicationInit(portName, 9600, 5)) != null)
                {
                    HandleError(errorMessage.ToString());
                }

                // ustawienie numeru kasy i kasjera
                SetCashierCode();


                //rozpoczecie paragonu
                if ((errorMessage = ElzabLibWrapper.LibReceiptBegin()) != null)
                {
                    HandleError(errorMessage.ToString());
                }

                //linie paragonu
                for (int i = 0; i < receitLines.Count; i++)
                {
                    ReceiptLine rLine = (ReceiptLine)receitLines[i];
                    if ((errorMessage = ElzabLibWrapper.LibReceiptItem(rLine.name, rLine.vatRate, rLine.quantity, rLine.coma, rLine.measure, rLine.price, rLine.value)) != null)
                    {
                        HandleError(errorMessage.ToString());
                    }
                }


                // wydrukowanie numeru systemowego
                if ((errorMessage = ElzabLibWrapper.LibAdditionalLine(12, billNr)) != null)
                {
                    HandleError(errorMessage.ToString());
                }

                //zakonczenie paragonu
                if ((errorMessage = ElzabLibWrapper.LibReceiptEnd(0)) != null)
                {
                    HandleError(errorMessage.ToString());
                }


                //zamkniecie portu
                if ((errorMessage = ElzabLibWrapper.LibCommunicationEnd()) != null)
                {
                    HandleError(errorMessage.ToString());
                }
            }
        }
Пример #2
0
        public void SetCashierCode()
        {
            StringBuilder errorMessage = null;

            byte[] output = new byte[4];
            byte[] input  = new byte[255];

            for (int i = 0; i < 2; i++)
            {
                output[i]     = (byte)this.cash[i];
                output[i + 2] = (byte)this.cashier[i];
            }

            if ((errorMessage = ElzabLibWrapper.LibRSSequence(0x43, 1, 4, input, output)) != null)
            {
                HandleError(errorMessage.ToString());
            }
        }
Пример #3
0
        /// <summary>
        /// Prints the daily report.
        /// </summary>
        /// <param name="reportData"></param>
        public void PrintDailyReport(XmlDocument reportData)
        {
            StringBuilder errorMessage = null;

            lock (MakoPrintFiscal.SerialPortSyncRoot)
            {
                //inicjalizacja portu
                if ((errorMessage = ElzabLibWrapper.LibCommunicationInit(portName, 9600, 5)) != null)
                {
                    HandleError(errorMessage.ToString());
                }

                if ((errorMessage = ElzabLibWrapper.LibDailyReport(1)) != null)
                {
                    HandleError(errorMessage.ToString());
                }

                //zamkniecie portu
                if ((errorMessage = ElzabLibWrapper.LibCommunicationEnd()) != null)
                {
                    HandleError(errorMessage.ToString());
                }
            }
        }