diff --git a/src/bricklink/order.cpp b/src/bricklink/order.cpp
index ac36e22a..e7c686b8 100755
--- a/src/bricklink/order.cpp
+++ b/src/bricklink/order.cpp
@@ -263,7 +263,9 @@ double Order::usSalesTax() const
double Order::grandTotal() const
{
- return d->m_grandTotal;
+ // return d->m_grandTotal; // this is sometimes off by 1 cent
+ return orderTotal() + shipping() + insurance() + additionalCharges1() + additionalCharges2()
+ - credit() - creditCoupon() + usSalesTax();
}
double Order::vatChargeSeller() const
diff --git a/src/desktop/orderinformationdialog.cpp b/src/desktop/orderinformationdialog.cpp
index 317431d2..c5b2bc2b 100755
--- a/src/desktop/orderinformationdialog.cpp
+++ b/src/desktop/orderinformationdialog.cpp
@@ -87,35 +87,51 @@ OrderInformationDialog::OrderInformationDialog(const BrickLink::Order *order, QW
% order->paymentCurrencyCode());
}
- static auto setVatLabel = [](QLabel *l, const BrickLink::Order *order, double vatCharge) {
- double gt = order->grandTotal() + order->credit() + order->creditCoupon();
- double gtNet = gt - vatCharge;
+ bool vatFromSeller = !qFuzzyIsNull(order->vatChargeSeller());
+ double vatCharge = vatFromSeller ? order->vatChargeSeller() : order->vatChargeBrickLink();
+ bool hasVat = !qFuzzyIsNull(vatCharge);
+ double coupon = order->creditCoupon();
+ double gtGross = order->grandTotal() + coupon; // see below for why creditCoupon is needed here
+ double gtNet = gtGross - vatCharge;
+ double vatPercent = Utility::roundTo(100 * (gtGross / (qFuzzyIsNull(gtNet) ? gtGross : gtNet) - 1.0), 0);
- double p = Utility::roundTo(100 * (gt / (qFuzzyIsNull(gtNet) ? gt : gtNet) - 1.0), 1);
- l->setText(l->text().arg(QLocale().toString(p, 'f', QLocale::FloatingPointShortest) % u'%'));
- };
+ if (!qFuzzyIsNull(coupon)) {
+ // the vatCharge values are wrong when a orderCoupon is active
+ // we can however re-calculate this value
+ double netFix = coupon * 100 / (100 + vatPercent);
+ gtNet -= netFix;
+ gtGross -= coupon;
+ vatCharge = gtGross - gtNet;
+ vatPercent = Utility::roundTo(100 * (gtGross / (qFuzzyIsNull(gtNet) ? gtGross : gtNet) - 1.0), 0);
+ }
- setVatLabel(w_vatSellerLabel, order, order->vatChargeSeller());
- setVatLabel(w_vatBLLabel, order, order->vatChargeBrickLink());
+ w_vatInfoLabel->setVisible(hasVat);
+ w_vatSeparator->setVisible(hasVat);
+ w_vatLabel->setText(w_vatLabel->text()
+ .arg(QLocale().toString(vatPercent, 'f', QLocale::FloatingPointShortest) % u'%')
+ .arg(vatFromSeller ? tr("Seller", "x% VAT (Seller)")
+ : tr("BrickLink", "x% VAT (BrickLink)")));
- setup(w_shipping, w_shippingCopy, Currency::toDisplayString(order->shipping(), { }, 2),
- !qFuzzyIsNull(order->shipping()), w_shippingLabel);
- setup(w_insurance, w_insuranceCopy, Currency::toDisplayString(order->insurance(), { }, 2),
- !qFuzzyIsNull(order->insurance()), w_insuranceLabel);
- setup(w_addCharges1, w_addCharges1Copy, Currency::toDisplayString(order->additionalCharges1(), { }, 2),
+ setup(w_shipping, w_shippingCopy, Currency::toDisplayString(order->shipping(), { }, 2),
+ !qFuzzyIsNull(order->shipping()), w_shippingLabel);
+ setup(w_insurance, w_insuranceCopy, Currency::toDisplayString(order->insurance(), { }, 2),
+ !qFuzzyIsNull(order->insurance()), w_insuranceLabel);
+ setup(w_addCharges1, w_addCharges1Copy, Currency::toDisplayString(order->additionalCharges1(), { }, 2),
!qFuzzyIsNull(order->additionalCharges1()), w_addCharges1Label);
- setup(w_addCharges2, w_addCharges2Copy, Currency::toDisplayString(order->additionalCharges2(), { }, 2),
+ setup(w_addCharges2, w_addCharges2Copy, Currency::toDisplayString(order->additionalCharges2(), { }, 2),
!qFuzzyIsNull(order->additionalCharges2()), w_addCharges2Label);
- setup(w_credit, w_creditCopy, Currency::toDisplayString(order->credit(), { }, 2),
- !qFuzzyIsNull(order->credit()), w_creditLabel);
- setup(w_creditCoupon, w_creditCouponCopy, Currency::toDisplayString(order->creditCoupon(), { }, 2),
- !qFuzzyIsNull(order->creditCoupon()), w_creditCouponLabel);
- setup(w_total, w_totalCopy, Currency::toDisplayString(order->orderTotal(), { }, 2));
- setup(w_salesTax, w_salesTaxCopy, Currency::toDisplayString(order->usSalesTax(), { }, 2),
- !qFuzzyIsNull(order->usSalesTax()), w_salesTaxLabel);
- setup(w_grandTotal, w_grandTotalCopy, Currency::toDisplayString(order->grandTotal(), { }, 2));
- setup(w_vatSeller, w_vatSellerCopy, Currency::toDisplayString(order->vatChargeSeller(), { }, 2),
- !qFuzzyIsNull(order->vatChargeSeller()), w_vatSellerLabel);
- setup(w_vatBL, w_vatBLCopy, Currency::toDisplayString(order->vatChargeBrickLink(), { }, 2),
- !qFuzzyIsNull(order->vatChargeBrickLink()), w_vatBLLabel);
+ setup(w_credit, w_creditCopy, Currency::toDisplayString(order->credit(), { }, 2),
+ !qFuzzyIsNull(order->credit()), w_creditLabel);
+ setup(w_creditCoupon, w_creditCouponCopy, Currency::toDisplayString(order->creditCoupon(), { }, 2),
+ !qFuzzyIsNull(order->creditCoupon()), w_creditCouponLabel);
+ setup(w_total, w_totalCopy, Currency::toDisplayString(order->orderTotal(), { }, 2));
+ setup(w_salesTax, w_salesTaxCopy, Currency::toDisplayString(order->usSalesTax(), { }, 2),
+ !qFuzzyIsNull(order->usSalesTax()), w_salesTaxLabel);
+ setup(w_grandTotal, w_grandTotalCopy, Currency::toDisplayString(order->grandTotal(), { }, 2));
+ setup(w_grossGrandTotal, w_grossGrandTotalCopy, Currency::toDisplayString(gtGross, { }, 2),
+ hasVat, w_grossGrandTotalLabel);
+ setup(w_netGrandTotal, w_netGrandTotalCopy, Currency::toDisplayString(gtNet, { }, 2),
+ hasVat, w_netGrandTotalLabel);
+ setup(w_vat, w_vatCopy, Currency::toDisplayString(vatCharge, { }, 2),
+ hasVat, w_vatLabel);
}
diff --git a/src/desktop/orderinformationdialog.ui b/src/desktop/orderinformationdialog.ui
index eb9e0799..01689245 100755
--- a/src/desktop/orderinformationdialog.ui
+++ b/src/desktop/orderinformationdialog.ui
@@ -6,8 +6,8 @@
0
0
- 603
- 449
+ 626
+ 493
@@ -89,6 +89,7 @@
+ 75
true
@@ -155,6 +156,37 @@
+ -
+
+
+ 24
+
+
+ QLayout::SetDefaultConstraint
+
+
-
+
+
+ Address
+
+
+
+ -
+
+
+ C
+
+
+
+ ..
+
+
+ true
+
+
+
+
+
-
@@ -383,23 +415,27 @@
- -
-
-
- 24
-
-
- QLayout::SetDefaultConstraint
+
-
+
+
+ Phone
+
+
+ -
+
-
-
+
- Address
+ xxx
+
+
+ true
- -
-
+
-
+
C
@@ -427,41 +463,6 @@
- -
-
-
-
-
-
- xxx
-
-
- true
-
-
-
- -
-
-
- C
-
-
-
- ..
-
-
- true
-
-
-
-
-
- -
-
-
- Phone
-
-
-
@@ -511,13 +512,54 @@
-
+
+
+ Order Total
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ xxx
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ true
+
+
+
+ -
+
+
+ C
+
+
+
+ ..
+
+
+ true
+
+
+
+
+
+ -
Shipping
- -
+
-
0
@@ -551,14 +593,14 @@
- -
+
-
Insurance
- -
+
-
0
@@ -592,14 +634,14 @@
- -
+
-
Additional Charges 1
- -
+
-
0
@@ -633,14 +675,14 @@
- -
+
-
Additional Charges 2
- -
+
-
0
@@ -674,14 +716,14 @@
- -
+
-
Credit
- -
+
-
0
@@ -715,14 +757,14 @@
- -
+
-
Credit Coupon
- -
+
-
0
@@ -756,20 +798,20 @@
- -
-
+
-
+
- Order Total
+ Sales Tax
- -
-
+
-
+
0
-
-
+
xxx
@@ -782,7 +824,7 @@
-
-
+
C
@@ -797,20 +839,36 @@
- -
-
+
-
+
+
+
+ 10
+ 0
+
+
+
+ QFrame::Plain
+
+
+ Qt::Horizontal
+
+
+
+ -
+
- Sales Tax
+ Grand Total
- -
-
+
-
+
0
-
-
+
xxx
@@ -823,7 +881,7 @@
-
-
+
C
@@ -838,20 +896,36 @@
- -
-
+
-
+
+
+
+ 75
+ true
+
+
+
+ QFrame::NoFrame
+
- Grand Total
+ VAT Information:
- -
-
+
-
+
+
+ Net Grand Total
+
+
+
+ -
+
0
-
-
+
xxx
@@ -864,7 +938,7 @@
-
-
+
C
@@ -879,20 +953,20 @@
- -
-
+
-
+
- %1 VAT Charge (Seller)
+ %1 VAT (%2)
- -
+
-
0
-
-
+
xxx
@@ -905,7 +979,7 @@
-
-
+
C
@@ -920,20 +994,20 @@
- -
-
+
-
+
- %1 VAT Charge (BrickLink)
+ Gross Grand Total
- -
-
+
-
+
0
-
-
+
xxx
@@ -946,7 +1020,7 @@
-
-
+
C
@@ -961,6 +1035,16 @@
+ -
+
+
+ QFrame::HLine
+
+
+
+
+
+
diff --git a/translations/brickstore_de.ts b/translations/brickstore_de.ts
index e981d7e7..24ee4b63 100644
--- a/translations/brickstore_de.ts
+++ b/translations/brickstore_de.ts
@@ -1347,83 +1347,83 @@
BrickLink::Orders
-
+
Adresse ist nicht verfügbar
-
+
Konnte Adresse zur Bestellung nicht in den Cache schreiben
-
+
Konnte Bestellung nicht in eine Datei speichern
-
+
Konnte die XML Daten der Bestellung nicht in den Cache schreiben
-
-
+
+
Konnte XML Daten nicht verarbeiten
-
+
Konnte die XML Daten der Bestellung nicht laden
-
+
Erhalten
-
+
Getätigt
-
+
Datum
-
+
Typ
-
+
Status
-
+
Bestellnr.
-
+
Käufer/Verkäufer
-
+
Teile
-
+
Posten
-
+
Gesamt
@@ -3582,7 +3582,7 @@ Bitte wählen Sie auch aus, welche Eigenschaften (z.B. Anmerkungen, Staffelpreis
Download...<br>Zu <b>%p%</b> fertig<br>(%v von %m)
-
+
Werkzeugleiste anpassen...
@@ -3636,84 +3636,103 @@ Bitte wählen Sie auch aus, welche Eigenschaften (z.B. Anmerkungen, Staffelpreis
Status
-
+
Letzte Aktualisierung
-
+
Tracking Nummer
-
+
Adresse
-
+
Telefon
-
+
Währung
-
+
Versand
-
+
Versicherung
-
+
Zusätzliche Kosten 1
-
+
Zusätzliche Kosten 2
-
+
Gutschrift
-
+
Gutschrift Coupon
-
+
+
+ Mehrwertsteuer:
+
+
+
+
+ Netto Gesamtbetrag
+
+
+
+
+ x% VAT (Seller or BrickLink)
+ %1 MwSt. (%2)
+
+
+
+
+ Brutto Gesamtbetrag
+
+
+
Bestellwert
-
+
US "Sales Tax"
-
+
Gesamtbetrag
-
- %1 MwSt. (Verkäufer)
+ %1 MwSt. (Verkäufer)
-
- %1 MwSt. (BrickLink)
+ %1 MwSt. (BrickLink)
@@ -3739,6 +3758,18 @@ Bitte wählen Sie auch aus, welche Eigenschaften (z.B. Anmerkungen, Staffelpreis
Bezahlung in
+
+
+
+ x% VAT (Seller)
+ Verkäufer
+
+
+
+
+ x% VAT (BrickLink)
+ BrickLink
+
OrderModel
@@ -3750,82 +3781,82 @@ Bitte wählen Sie auch aus, welche Eigenschaften (z.B. Anmerkungen, Staffelpreis
Orders
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Erhalten
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/translations/brickstore_en.ts b/translations/brickstore_en.ts
index f6673b58..89913e29 100644
--- a/translations/brickstore_en.ts
+++ b/translations/brickstore_en.ts
@@ -1291,83 +1291,83 @@
BrickLink::Orders
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -3100,7 +3100,7 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
-
+
@@ -3154,83 +3154,94 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
+ x% VAT (Seller or BrickLink)
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3253,86 +3264,98 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
+
+
+
+ x% VAT (Seller)
+
+
+
+
+
+ x% VAT (BrickLink)
+
+
Orders
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/translations/brickstore_es.ts b/translations/brickstore_es.ts
index 0994c868..ccaf80e0 100755
--- a/translations/brickstore_es.ts
+++ b/translations/brickstore_es.ts
@@ -1295,83 +1295,83 @@
BrickLink::Orders
-
+
Dirección no disponible
-
+
No se puede escribir la dirección del pedido en la caché
-
+
No se puede guardar el pedido en un archivo
-
+
No se puede escribir el pedido XML en la caché
-
-
+
+
No se ha podido convertir los datos XML del pedido recibido
-
+
No se puede abir el XML del pedido
-
+
Recibidos
-
+
Realizados
-
+
Fecha
-
+
Tipo
-
+
Estado
-
+
ID Pedido
-
+
Comprador/Vendedor
-
+
Artículos
-
+
Lotes
-
+
Total
@@ -3116,7 +3116,7 @@ Por favor seleciona también que atributos (p.ej. notas, precios encadenados, ..
Descargando...<br><b>%p%</b> finalizado<br>(%v de %m)
-
+
Personalizar Barra de heramientas...
@@ -3170,84 +3170,103 @@ Por favor seleciona también que atributos (p.ej. notas, precios encadenados, ..
Estado
-
+
Última Actualización
-
+
Número de Seguimiento
-
+
Dirección
-
+
Teléfono
-
+
Código de Moneda
-
+
Envío
-
+
Seguro
-
+
Cargos Adicionales 1
-
+
Cargos Adicionales 2
-
+
Crédito
-
+
Crédito de Cupón
-
+
+
+
+
+
+
+
+
+
+
+
+
+ x% VAT (Seller or BrickLink)
+ %1 VAT (%2)
+
+
+
+
+
+
+
+
Total Pedido
-
+
Impuestos de Ventas
-
+
Gran Total
-
- Cargo %1 IVA (Vendedor)
+ Cargo %1 IVA (Vendedor)
-
- Cargo %1 IVA (BrickLink)
+ Cargo %1 IVA (BrickLink)
@@ -3273,86 +3292,98 @@ Por favor seleciona también que atributos (p.ej. notas, precios encadenados, ..
Pago en
+
+
+
+ x% VAT (Seller)
+ Vendedor
+
+
+
+
+ x% VAT (BrickLink)
+ BrickLink
+
Orders
-
+
Desconocido
-
+
Pendiente
-
+
Actualizado
-
+
Precesando
-
+
Listo
-
+
Pagado
-
+
Empaquetado
-
+
Enviado
-
+
Recibido
-
+
Completado
-
+
OCR
-
+
NPB
-
+
NPX
-
+
NRS
-
+
NSS
-
+
Cancelado
diff --git a/translations/brickstore_fr.ts b/translations/brickstore_fr.ts
index 448e7f49..536f6793 100644
--- a/translations/brickstore_fr.ts
+++ b/translations/brickstore_fr.ts
@@ -1322,83 +1322,83 @@
BrickLink::Orders
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
Reçue
-
+
Passée
-
+
Date
-
+
Type
-
+
Statut
-
+
Numéro
-
+
-
+
Items
-
+
Lots
-
+
Total
@@ -4050,7 +4050,7 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
Téléchargement...<br><b>%p%</b> terminé<br>(%v of %m)
-
+
@@ -4116,83 +4116,94 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
Statut
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
+ x% VAT (Seller or BrickLink)
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4215,6 +4226,18 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
+
+
+
+ x% VAT (Seller)
+
+
+
+
+
+ x% VAT (BrickLink)
+
+
OrderModel
@@ -4226,82 +4249,82 @@ Please also select which item's attributes (e.g. remarks, tiered prices, ..
Orders
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Reçue
-
+
-
+
-
+
-
+
-
+
-
+
-
+