13 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 14 # include <QTextCodec> 21 QTextCodec::setCodecForTr(QTextCodec::codecForName(
"utf-8"));
22 QTextCodec::setCodecForCStrings(QTextCodec::codecForName(
"utf-8"));
23 QTextCodec::setCodecForLocale(QTextCodec::codecForName(
"utf-8"));
28 class Exception :
public std::exception {
30 Exception(
const QString &msg)
35 virtual ~Exception() throw()
39 virtual const char* what()
const throw()
41 static QByteArray rawMessage = m_message.toUtf8();
42 return rawMessage.data();
52 throw Exception(
"Invalid interface");
58 QString resultDescription, badParamDescription;
59 QVector<wchar_t> v(256);
62 throw Exception(
"get_ResultDescription error");
69 resultDescription = QString::fromWCharArray(&v[0]);
71 QVector<wchar_t> v(256);
74 throw Exception(
"get_BadParamDescription error");
81 badParamDescription = QString::fromWCharArray(&v[0]);
84 if(badParamDescription.isEmpty())
85 throw Exception(QObject::trUtf8(
"[%1] %2")
87 .arg(resultDescription));
89 throw Exception(QObject::trUtf8(
"[%1] %2 (%3)")
91 .arg(resultDescription)
92 .arg(badParamDescription));
100 throw Exception(
"Invalid interface");
132 void registration(
TED::Fptr::IFptr *ifptr,
const wchar_t *name,
double price,
double quantity)
146 void registrationFZ54(
TED::Fptr::IFptr *ifptr,
const wchar_t *name,
double price,
147 double quantity,
double positionSum,
int taxNumber)
173 double remainder, change;
176 qDebug() << qPrintable(QObject::trUtf8(
"Remainder: %1, Change: %2")
204 const wchar_t *barcode,
double scale = 100)
270 const bool UseShowProperties =
false;
271 const bool PrintFiscalCheck =
true;
272 const bool PrintNonfiscalCheck =
true;
273 const bool UseFZ54 =
true;
277 #if defined(Q_OS_LINUX) 278 QLibrary lib(
"../bins/linux-x64/libfptr.so");
281 lib.setFileName(
"../bins/linux-x86/libfptr.so");
284 #elif defined(Q_OS_WIN32) 285 QLibrary lib(
"../bins/nt-x86-mingw/fptr.dll");
293 qDebug() << qPrintable(QObject::trUtf8(
"Не удалось загрузить библиотеку fptr - [%1]")
294 .arg(lib.errorString()));
304 qDebug() << qPrintable(
"Cannot create Fptr object");
311 QFileInfo finfo(lib.fileName());
318 if(UseShowProperties)
360 QVector<wchar_t> v(256);
363 throw Exception(
"get_DeviceSettings error");
370 QString settings = QString::fromWCharArray(&v[0], v.size());
372 qDebug() << qPrintable(settings);
390 catch(
const Exception&)
405 catch(
const Exception&)
423 for(
int i = -2; i < 5; ++i)
427 double price = 1 * pow(10, i), quantity = 1;
428 registrationFZ54(ifptr, QObject::trUtf8(
"Позиция %1").arg(i + 3).toStdWString().c_str(),
430 sum += price * quantity;
434 double price = 1 * pow(10, i), quantity = 1;
435 registration(ifptr, QObject::trUtf8(
"Позиция %1").arg(i + 3).toStdWString().c_str(),
437 sum += price * quantity;
456 payment(ifptr, sum / 4, 1);
457 payment(ifptr, sum / 4, 2);
458 payment(ifptr, sum / 4, 3);
459 payment(ifptr, sum, 0);
461 closeCheck(ifptr, 0);
467 if(PrintNonfiscalCheck)
470 L
"Я сразу смазал карту будня, плеснувши краску из стакана;\n" 471 L
"Я показал на блюде студня косые скулы океана.\n" 472 L
"На чешуе жестяной рыбы прочел я зовы новых губ.",
475 printText(ifptr, L
"А вы",
478 printText(ifptr, L
"ноктюрн сыграть",
481 printText(ifptr, L
"могли бы",
484 printText(ifptr, L
"на флейте водосточных труб?",
490 printText(ifptr, L
"");
493 printText(ifptr, L
"");
496 printText(ifptr, L
"");
499 printText(ifptr, L
"");
502 printText(ifptr, L
"");
505 printText(ifptr, L
"");
508 printText(ifptr, L
"");
511 printText(ifptr, L
"");
515 catch(
const std::exception &ex)
517 qDebug() << qPrintable(ex.what());
virtual int DTOSHARED_CCA put_Scale(double value)=0
Устанавливает масштаб.
virtual int DTOSHARED_CCA put_BarcodeColumns(int value)=0
Устанавливает количество колонок ШК.
virtual int DTOSHARED_CCA ShowProperties()=0
Выводит диалог настройки драйвера
virtual int DTOSHARED_CCA put_BarcodeCorrection(int value)=0
Устанавливает уровень коррекции ШК.
#define EC_INVALID_MODE
Не поддерживается в данном режиме устройства
virtual int DTOSHARED_CCA put_Price(double value)=0
Устанавливает цену.
virtual int DTOSHARED_CCA put_BarcodeRows(int value)=0
Устанавливает количество строк ШК.
virtual int DTOSHARED_CCA get_Remainder(double *value)=0
Возвращает значение остатка.
virtual int DTOSHARED_CCA Charge()=0
Регистрирует надбавку.
virtual int DTOSHARED_CCA Discount()=0
Регистрирует скидку.
virtual int DTOSHARED_CCA put_Mode(int value)=0
Устанаваливает значение режима работы.
virtual int DTOSHARED_CCA put_BarcodeControlCode(int value)=0
Устанавливает флаг наличия контрольных символов ШК.
virtual int DTOSHARED_CCA get_ResultCode(int *value)=0
Возвращает результат последней операции
#define EC_3801
Чек закрыт - операция невозможна
virtual int DTOSHARED_CCA Report()=0
Печатает указанный отчет.
virtual int DTOSHARED_CCA put_PositionSum(double value)=0
Устанавливает сумму позиции.
Базовый интерфейс для работы с драйверами
virtual int DTOSHARED_CCA Registration()=0
Производит регистрацию продажи / прихода.
virtual int DTOSHARED_CCA put_DeviceSingleSetting(const wchar_t *name, const wchar_t *value)=0
Устанавливает значение настроки
virtual int DTOSHARED_CCA put_PrintBarcodeText(int value)=0
Устанавливает флаг печати данных штрихкода.
TED::Fptr::IFptr *(* CreateFptrInterfacePtr)(int ver)
Тип функции CreateFptrInterface().
virtual int DTOSHARED_CCA get_DeviceSettings(wchar_t *bfr, int bfrSize)=0
Возвращает строку с текущими настройками драйвера
virtual int DTOSHARED_CCA put_BarcodeType(int value)=0
Устанавливает тип штрихкода.
virtual int DTOSHARED_CCA put_Barcode(const wchar_t *value)=0
Устанавливает данные штрихкода.
virtual int DTOSHARED_CCA get_ResultDescription(wchar_t *bfr, int bfrSize)=0
Возвращает текстовое описание результата последней операции
virtual int DTOSHARED_CCA put_BarcodePixelProportions(int value)=0
Устанавливает пропорции пикселя ШК.
#define EC_3822
Смена превысила 24 часа
virtual int DTOSHARED_CCA put_BarcodeProportions(int value)=0
Устанавливает пропорции ШК.
virtual int DTOSHARED_CCA put_TaxNumber(int value)=0
Устанавливает номер налога.
virtual int DTOSHARED_CCA put_Quantity(double value)=0
Устанавливает количество.
virtual int DTOSHARED_CCA put_BarcodePrintType(int value)=0
Устанавливает способ печати ШК.
virtual int DTOSHARED_CCA put_BarcodeVersion(int value)=0
Устанавливает версию ШК.
virtual int DTOSHARED_CCA PrintString()=0
Печатает строку.
virtual int DTOSHARED_CCA put_DiscountType(int value)=0
Устанавливает тип скидки.
virtual int DTOSHARED_CCA put_DeviceEnabled(int value)=0
Устанавливает логическое состояние драйвера
virtual int DTOSHARED_CCA put_TextWrap(int value)=0
Устанавливает перенос.
virtual int DTOSHARED_CCA CancelCheck()=0
Аннулирует чек.
virtual int DTOSHARED_CCA put_Height(int value)=0
Устанавливает высоту.
virtual int DTOSHARED_CCA ApplySingleSettings()=0
Применяет установленные настройки
virtual int DTOSHARED_CCA put_Destination(int value)=0
Устанавливает область действия налога / скидки.
virtual int DTOSHARED_CCA CloseCheck()=0
Закрывает чек в ККТ.
virtual int DTOSHARED_CCA put_Name(const wchar_t *value)=0
Устанавливает название.
virtual int DTOSHARED_CCA get_Change(double *value)=0
Возвращает значение сдачи.
virtual int DTOSHARED_CCA OpenCheck()=0
Открывает чек в ККТ.
virtual int DTOSHARED_CCA get_BadParamDescription(wchar_t *bfr, int bfrSize)=0
Возвращает текстовое описание неверного параметра
virtual int DTOSHARED_CCA put_Alignment(int value)=0
Устанавливает выравнивание.
virtual int DTOSHARED_CCA PrintBarcode()=0
Печатает штрихкод.
virtual int DTOSHARED_CCA put_BarcodeUseProportions(int value)=0
Устанавливает флаг использования пропорций ШК.
virtual int DTOSHARED_CCA put_BarcodePackingMode(int value)=0
Устанавливает режим упаковки ШК.
virtual int DTOSHARED_CCA Payment()=0
Производит регистрацию оплаты.
ChequeType
Типы / состояния чека
virtual int DTOSHARED_CCA put_CheckType(int value)=0
Устанавливает тип чека.
virtual int DTOSHARED_CCA GetStatus()=0
Заполняет свойства драйвера текущим состоянием ККТ.
virtual int DTOSHARED_CCA SetMode()=0
Устанавливает режим ККТ.
virtual int DTOSHARED_CCA put_Summ(double value)=0
Устанавливает сумму.
DestinationType
Цель налога / скидки
virtual int DTOSHARED_CCA PrintFooter()=0
Печатает блок атрибутов чека.
Интерфейс драйвера контрольно кассовых машин (дККТ)
virtual int DTOSHARED_CCA put_Caption(const wchar_t *value)=0
Устанавливает строку.
#define EC_INVALID_PARAM
Недопустимое значение
virtual int DTOSHARED_CCA put_TypeClose(int value)=0
Устанавливает тип платежа.
void(* ReleaseFptrInterfacePtr)(TED::Fptr::IFptr **iface)
Тип функции ReleaseFptrInterface().
virtual int DTOSHARED_CCA put_ReportType(int value)=0
Устанавливает тип отчета.