Merge fix

print
Josef Rokos 8 years ago
parent e733901286
commit f9d7df9ab5

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

@ -100,3 +100,9 @@ void ReceiptSaveForm::on_radioAdd_toggled(bool checked)
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!ui->name->text().isEmpty());
}
}
void ReceiptSaveForm::accept()
{
m_binder.bindToData();
QDialog::accept();
}

@ -106,6 +106,8 @@ void ShopForm::on_saveButton_clicked()
connect(form, &QDialog::accepted, [this]() {
ShopService srv;
m_voucher->setStatus(Voucher::NOT_PAID);
srv.saveVoucher(m_voucher);
m_voucher = srv.createVoucher();
m_itemsModel->setData(m_voucher->items());
ui->total->setText("0");

Loading…
Cancel
Save