|
|
@ -60,6 +60,8 @@ QByteArray ReceiptGenerator::generate()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QByteArray out;
|
|
|
|
QByteArray out;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char printMode = 8 | 16 ;
|
|
|
|
|
|
|
|
|
|
|
|
SettingsService srvGsSettings("CORE");
|
|
|
|
SettingsService srvGsSettings("CORE");
|
|
|
|
SettingsService srvShopSettings("SHOP");
|
|
|
|
SettingsService srvShopSettings("SHOP");
|
|
|
|
|
|
|
|
|
|
|
@ -73,14 +75,17 @@ QByteArray ReceiptGenerator::generate()
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append(prepareString(gs->zipCode() + " " + gs->city()));
|
|
|
|
out.append(prepareString(gs->zipCode() + " " + gs->city()));
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append(prepareString("IC: " + gs->ic()));
|
|
|
|
out.append(prepareString("IC: " + QString::number(gs->ic())));
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x1b\x61\0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
|
|
|
|
out.append(printMode);
|
|
|
|
for (int i = 0; i < shopSettings->lettersPerLine(); i++ )
|
|
|
|
for (int i = 0; i < shopSettings->lettersPerLine(); i++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
out.append("_");
|
|
|
|
out.append("-");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
|
|
|
|
out.append((char)0);
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
|
|
|
|
|
|
|
|
foreach (QSharedPointer<VoucherItem> item, m_voucher->items()) {
|
|
|
|
foreach (QSharedPointer<VoucherItem> item, m_voucher->items()) {
|
|
|
@ -108,26 +113,32 @@ QByteArray ReceiptGenerator::generate()
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
|
|
|
|
out.append(printMode);
|
|
|
|
for (int i = 0; i < shopSettings->lettersPerLine(); i++ )
|
|
|
|
for (int i = 0; i < shopSettings->lettersPerLine(); i++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
out.append("_");
|
|
|
|
out.append("-");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
|
|
|
|
out.append((char)0);
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
|
|
|
|
|
|
|
|
char printMode = 8 | 16 ;
|
|
|
|
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
out.append(printMode);
|
|
|
|
out.append(printMode);
|
|
|
|
out.append("Celekem:");
|
|
|
|
out.append("Celekem:");
|
|
|
|
|
|
|
|
|
|
|
|
QString totalPrice = QString::number(m_voucher->totalPrice().toDouble(), 'f', 2);
|
|
|
|
QString totalPrice = QString::number(m_voucher->totalPrice().toDouble(), 'f', 2);
|
|
|
|
int numSpaces = shopSettings->lettersPerLine() - (8 * 2 + totalPrice.length() * 2);
|
|
|
|
int numSpaces = shopSettings->lettersPerLine() - (8 + totalPrice.length());
|
|
|
|
for (int i = 0; i < numSpaces; i++)
|
|
|
|
for (int i = 0; i < numSpaces; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
out.append(" ");
|
|
|
|
out.append(" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
out.append(prepareString(totalPrice));
|
|
|
|
out.append(prepareString(totalPrice));
|
|
|
|
out.append("\x1b\x21\0");
|
|
|
|
out.append("\x1b\x21");
|
|
|
|
|
|
|
|
out.append((char)0);
|
|
|
|
|
|
|
|
out.append("\x0a");
|
|
|
|
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|
out.append("\x0a");
|
|
|
|