diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 2d6e327..0bf31cb 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -1003,6 +1003,9 @@ void ATBDeviceControllerPlugin::prepareDynTemplateData() break; case nsDeviceControllerInterface::TICKET_VARIANT::PARKING_TICKET: break; + case nsDeviceControllerInterface::TICKET_VARIANT::FREE_TICKET: + private_setupDynTemplatData_FREE_TICKET(dynTicketData, this->currentTicket); + break; case nsDeviceControllerInterface::TICKET_VARIANT::FOOD_STAMP: private_setupDynTemplatData_FOOD_STAMP(dynTicketData, this->currentTicket); break; @@ -1128,6 +1131,41 @@ void ATBDeviceControllerPlugin::private_setupDynTemplatData_FINE_PAYMENT(struct } + +void ATBDeviceControllerPlugin::private_setupDynTemplatData_FREE_TICKET(struct T_dynDat *dynTicketData, Ticket *ticket) +{ + QDateTime currentDateTime = QDateTime::fromString(ticket->getPrintingData()["currentDateTime"].toString(), Qt::ISODate); + + QString currentDateString = this->printerLocale.toString(currentDateTime.date(), QLocale::ShortFormat); + + + // set dynamic printer data: + QByteArray ba_licenseplate = codec->fromUnicode(ticket->getPrintingData()["licenseplate"].toString()); + memcpy((char*)dynTicketData->licensePlate, ba_licenseplate.data(), std::min(ba_licenseplate.size(),8)); + + QByteArray ba_amount = codec->fromUnicode(ticket->getPrintingData()["amount"].toString()); + memcpy((char*)dynTicketData->vendingPrice, ba_amount.data(), std::min(ba_amount.size(),8)); // Szeged + memcpy((char*)dynTicketData->dynDat6, ba_amount.data(), std::min(ba_amount.size(),8)); // Schoenau + + QByteArray ba_currentDate = codec->fromUnicode(currentDateString); + memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8)); + + + // FREE_TICKET needs parking endtime: + + QDateTime parkingEndDateTime = QDateTime::fromString(ticket->getPrintingData()["parkingEnd"].toString(), Qt::ISODate); + + QByteArray ba_parkingEndTime = codec->fromUnicode(parkingEndDateTime.toString("hh:mm")); + memcpy((char*)dynTicketData->parkingEnd, ba_parkingEndTime.data(), std::min(ba_parkingEndTime.size(),8)); + + QString parkingEndDateString = this->printerLocale.toString(parkingEndDateTime.date(), QLocale::ShortFormat); + + QByteArray ba_parkingEndDate = codec->fromUnicode(parkingEndDateString); + memcpy((char*)dynTicketData->currentTime, ba_parkingEndDate.data(), std::min(ba_parkingEndDate.size(),8)); + // ! and yes... 'ParkingEndDate' is 'currentTime' +} + + /************************************************************************************************ * cash payment */ diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.h b/src/ATBAPP/ATBDeviceControllerPlugin.h index 02e317b..6a1ce44 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.h +++ b/src/ATBAPP/ATBDeviceControllerPlugin.h @@ -145,6 +145,7 @@ private: void private_setupDynTemplatData_STOP_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket); void private_setupDynTemplatData_FOOD_STAMP(struct T_dynDat *dynTicketData, Ticket *ticket); void private_setupDynTemplatData_FINE_PAYMENT(struct T_dynDat *dynTicketData, Ticket *ticket); + void private_setupDynTemplatData_FREE_TICKET(struct T_dynDat *dynTicketData, Ticket *ticket); // --------------------------------------------------------------------------------------------- private slots: