Merge fix
This commit is contained in:
@@ -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");
|
||||||
|
|||||||
@@ -100,3 +100,9 @@ void ReceiptSaveForm::on_radioAdd_toggled(bool checked)
|
|||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!ui->name->text().isEmpty());
|
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]() {
|
connect(form, &QDialog::accepted, [this]() {
|
||||||
ShopService srv;
|
ShopService srv;
|
||||||
|
m_voucher->setStatus(Voucher::NOT_PAID);
|
||||||
|
srv.saveVoucher(m_voucher);
|
||||||
m_voucher = srv.createVoucher();
|
m_voucher = srv.createVoucher();
|
||||||
m_itemsModel->setData(m_voucher->items());
|
m_itemsModel->setData(m_voucher->items());
|
||||||
ui->total->setText("0");
|
ui->total->setText("0");
|
||||||
|
|||||||
Reference in New Issue
Block a user