Skip to content
GitLab
Erkunden
Anmelden
Registrieren
Primärnavigation
Suchen oder aufrufen …
Projekt
products
Verwalten
Aktivität
Mitglieder
Labels
Planen
Tickets
54
Ticketübersichten
Meilensteine
Wiki
Code
Merge Requests
0
Repository
Branch
Commits
Tags
Repository-Diagramm
Revisionen vergleichen
Build
Pipelines
Aufgaben
Pipeline-Zeitpläne
Artefakte
Bereitstellung
Releases
Betreiben
Umgebungen
Überwachen
Vorfälle
Service-Desk
Analysieren
Wertschöpfungskettenanalyse
Mitwirkenden-Analyse
CI/CD-Analyse
Repository-Analysen
Hilfe
Hilfe
Support
GitLab-Dokumentation
GitLab-Pläne vergleichen
Community-Forum
Zu GitLab beitragen
Feedback geben
Tastenkürzel
?
Code-Schnipsel
Gruppen
Projekte
Show more breadcrumbs
QUIQQER
products
Commits
be521441
Commit
be521441
erstellt
vor 4 Jahren
von
Henning Leutz
Dateien durchsuchen
Optionen
Downloads
Patches
Einfaches Diff
fix:
discount#10
Übergeordneter
8df00614
No related branches found
Branches enthält Commit
No related tags found
Tags enthält Commit
Keine zugehörigen Merge Requests gefunden
Änderungen
1
Leerzeichenänderungen ausblenden
Inline
Nebeneinander
1 geänderte Datei
src/QUI/ERP/Products/Utils/Calc.php
+58
-37
58 Ergänzungen, 37 Löschungen
src/QUI/ERP/Products/Utils/Calc.php
wird angezeigt
mit
58 Ergänzungen
und
37 Löschungen
src/QUI/ERP/Products/Utils/Calc.php
+
58
−
37
Zeige Datei @
be521441
...
...
@@ -300,8 +300,8 @@ public function calcProductList(ProductList $List, $callback = false): ProductLi
$vatArray
[
$vat
][
'sum'
]
=
$vatArray
[
$vat
][
'sum'
]
+
$productVatArray
[
'sum'
];
}
$subSum
=
\round
(
$subSum
,
$Currency
->
getPrecision
());
$nettoSum
=
\round
(
$nettoSum
,
$Currency
->
getPrecision
());
//
$subSum = \round($subSum, $Currency->getPrecision());
//
$nettoSum = \round($nettoSum, $Currency->getPrecision());
QUI\ERP\Debug
::
getInstance
()
->
log
(
'Berechnetet Produktliste MwSt'
,
'quiqqer/product'
);
QUI\ERP\Debug
::
getInstance
()
->
log
(
$vatArray
,
'quiqqer/product'
);
...
...
@@ -375,6 +375,14 @@ public function calcProductList(ProductList $List, $callback = false): ProductLi
$priceFactorValue
=
\round
(
$priceFactorValue
,
$Currency
->
getPrecision
());
$PriceFactor
->
setNettoSum
(
$priceFactorValue
);
if
(
!
$isNetto
)
{
$vCalc
=
$vat
/
100
+
1
;
$bruttoDisplay
=
\round
(
$priceFactorValue
*
$vCalc
,
$Currency
->
getPrecision
());
$bruttoDisplay
=
$Currency
->
format
(
$bruttoDisplay
);
$PriceFactor
->
setValueText
(
$bruttoDisplay
);
}
break
;
// Prozent Angabe
...
...
@@ -422,17 +430,19 @@ public function calcProductList(ProductList $List, $callback = false): ProductLi
continue
2
;
}
$vatSum
=
\round
(
$PriceFactor
->
getNettoSum
()
*
(
$vatValue
/
100
),
$Currency
->
getPrecision
()
);
$vatSum
=
$PriceFactor
->
getNettoSum
()
*
(
$vatValue
/
100
);
$vatSumRounded
=
\round
(
$vatSum
,
$Currency
->
getPrecision
());
$PriceFactor
->
setVat
(
$vatValue
);
if
(
$isNetto
)
{
$PriceFactor
->
setSum
(
$PriceFactor
->
getNettoSum
());
$PriceFactor
->
setSum
(
\round
(
$PriceFactor
->
getNettoSum
(),
$Currency
->
getPrecision
())
);
}
else
{
$PriceFactor
->
setSum
(
$vatSum
+
$PriceFactor
->
getNettoSum
());
$vatBruttoSum
=
$vatSumRounded
+
$PriceFactor
->
getNettoSum
();
$PriceFactor
->
setSum
(
$vatBruttoSum
);
}
if
(
$Vat
&&
!
$Vat
->
isVisible
())
{
...
...
@@ -464,9 +474,11 @@ public function calcProductList(ProductList $List, $callback = false): ProductLi
foreach
(
$vatArray
as
$vatEntry
)
{
$vatLists
[
$vatEntry
[
'vat'
]]
=
true
;
// liste für MWST texte
$bruttoSum
=
$bruttoSum
+
\round
(
$vatEntry
[
'sum'
]
,
$precision
)
;
$bruttoSum
=
$bruttoSum
+
$vatEntry
[
'sum'
];
}
$bruttoSum
=
\round
(
$bruttoSum
,
$Currency
->
getPrecision
());
foreach
(
$vatLists
as
$vat
=>
$bool
)
{
$vatText
[
$vat
]
=
ErpCalc
::
getVatText
(
$vat
,
$this
->
getUser
(),
$Locale
);
}
...
...
@@ -491,31 +503,33 @@ public function calcProductList(ProductList $List, $callback = false): ProductLi
foreach
(
$priceFactors
as
$Factor
)
{
/* @var $Factor QUI\ERP\Products\Utils\PriceFactor */
$priceFactorBruttoSums
=
$priceFactorBruttoSums
+
\round
(
$Factor
->
getSum
()
,
$precision
)
;
$priceFactorBruttoSums
=
$priceFactorBruttoSums
+
$Factor
->
getSum
();
}
$priceFactorBruttoSum
=
$subSum
+
$priceFactorBruttoSums
;
if
(
$priceFactorBruttoSum
!==
\round
(
$bruttoSum
,
$precision
))
{
$diff
=
$priceFactorBruttoSum
-
\round
(
$bruttoSum
,
$precision
);
$diff
=
\round
(
$diff
,
$precision
);
// if we have a diff, we change the first vat price factor
$added
=
false
;
foreach
(
$priceFactors
as
$Factor
)
{
if
(
$Factor
instanceof
QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface
)
{
$Factor
->
setSum
(
\round
(
$Factor
->
getSum
()
-
$diff
,
$precision
));
$bruttoSum
=
\round
(
$bruttoSum
,
$precision
);
$added
=
true
;
break
;
}
}
if
(
$added
===
false
)
{
$bruttoSum
=
$bruttoSum
+
$diff
;
}
}
$bruttoSum
=
$priceFactorBruttoSum
;
// $bruttoSumRounded = \round($bruttoSum, $precision);
//
// if ($priceFactorBruttoSum !== $bruttoSumRounded) {
// $diff = $priceFactorBruttoSum - \round($bruttoSum, $precision);
// $diff = \round($diff, $precision);
//
// // if we have a diff, we change the first vat price factor
// $added = false;
//
// foreach ($priceFactors as $Factor) {
// if ($Factor instanceof QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface) {
// $Factor->setSum(\round($Factor->getSum() - $diff, $precision));
// $bruttoSum = \round($bruttoSum, $precision);
// $added = true;
// break;
// }
// }
//
// if ($added === false) {
// $bruttoSum = $bruttoSum + $diff;
// }
// }
}
if
(
$bruttoSum
<=
0
||
$nettoSum
<=
0
)
{
...
...
@@ -730,8 +744,10 @@ public function getProductPrice(
$bruttoPrice
=
$this
->
round
(
$nettoPrice
+
$vatSum
);
// sum
$nettoSum
=
$this
->
round
(
$nettoPrice
*
$Product
->
getQuantity
());
$vatSum
=
\round
(
$nettoSum
*
(
$Vat
->
getValue
()
/
100
),
$Currency
->
getPrecision
());
$nettoSum
=
$this
->
round
(
$nettoPrice
*
$Product
->
getQuantity
());
$nettoSumNotRounded
=
$nettoPriceNotRounded
*
$Product
->
getQuantity
();
$vatSum
=
\round
(
$nettoSumNotRounded
*
(
$Vat
->
getValue
()
/
100
),
$Currency
->
getPrecision
());
// korrektur rechnung / 1 cent problem
if
(
$checkVatBrutto
!==
$bruttoPrice
)
{
...
...
@@ -746,12 +762,14 @@ public function getProductPrice(
$bruttoSum
=
$bruttoPrice
*
$Product
->
getQuantity
();
}
else
{
// sum
$nettoSum
=
$this
->
round
(
$nettoPrice
*
$Product
->
getQuantity
());
$vatSum
=
\round
(
$nettoSum
*
(
$Vat
->
getValue
()
/
100
),
$Currency
->
getPrecision
());
$nettoSum
=
$this
->
round
(
$nettoPrice
*
$Product
->
getQuantity
());
$vatSum
=
\round
(
$nettoSum
*
(
$Vat
->
getValue
()
/
100
),
$Currency
->
getPrecision
());
$bruttoSum
=
$this
->
round
(
$nettoSum
+
$vatSum
);
$nettoSumNotRounded
=
$nettoPriceNotRounded
*
$Product
->
getQuantity
();
}
$price
=
$isNetto
?
$nettoPrice
:
$bruttoPrice
;
$sum
=
$isNetto
?
$nettoSum
:
$bruttoSum
;
...
...
@@ -779,13 +797,15 @@ public function getProductPrice(
);
QUI\ERP\Debug
::
getInstance
()
->
log
([
'
basis
PriceNotRounded'
=>
$nettoPriceNotRounded
,
'
netto
PriceNotRounded'
=>
$nettoPriceNotRounded
,
'basisPrice'
=>
$basisPrice
,
'price'
=>
$price
,
'sum'
=>
$sum
,
'nettoSum'
=>
$nettoSum
,
'nettoSumNotRounded'
=>
$nettoSumNotRounded
,
'nettoPrice'
=>
$nettoPrice
,
'vatArray'
=>
$vatArray
,
'vatText'
=>
!
empty
(
$vatArray
)
?
$vatArray
[
'text'
]
:
''
,
'isEuVat'
=>
$isEuVatUser
,
'isNetto'
=>
$isNetto
,
'currencyData'
=>
$this
->
getCurrency
()
->
toArray
(),
...
...
@@ -799,6 +819,7 @@ public function getProductPrice(
'price'
=>
$price
,
'sum'
=>
$sum
,
'nettoSum'
=>
$nettoSum
,
'nettoSumNotRounded'
=>
$nettoSumNotRounded
,
'nettoPrice'
=>
$nettoPrice
,
'vatArray'
=>
$vatArray
,
'vatText'
=>
!
empty
(
$vatArray
)
?
$vatArray
[
'text'
]
:
''
,
...
...
This diff is collapsed.
Zum Erweitern klicken.
Vorschau
0%
Wiederholen
oder
Neue Datei anhängen
.
Abbrechen
You are about to add
0
people
to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Kommentar speichern
Abbrechen
Bitte
registrieren
oder
Anmelden
zum Kommentieren