Skip to content
Code-Schnipsel Gruppen Projekte
Commit c9d09718 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'dev'

Übergeordnete d40fe5b7 ff727054
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -111,8 +111,12 @@
<en><![CDATA[Subtotal:]]></en>
</locale>
<locale name="article.list.articles.sumtotal">
<de><![CDATA[Summe:]]></de>
<en><![CDATA[Sum total:]]></en>
<de><![CDATA[Gesamtsumme]]></de>
<en><![CDATA[Grand total]]></en>
</locale>
<locale name="article.list.articles.grandSubSum">
<de><![CDATA[Summe]]></de>
<en><![CDATA[Total]]></en>
</locale>
<locale name="erp.panel.extras.text">
......@@ -660,7 +664,7 @@
<de><![CDATA[Bitte wähle zuerst einen Kunden aus]]></de>
<en><![CDATA[Please select a customer first]]></en>
</locale>
<locale name="article.summary.tpl.labelPosInfo">
<de><![CDATA[Pos.-Info]]></de>
<en><![CDATA[Pos. info]]></en>
......
......@@ -73,12 +73,6 @@
</tr>
{/foreach}
{if count($priceFactors)}
<tr>
<td colspan="2"><br/></td>
</tr>
{/if}
{foreach $vatArray as $vat}
<tr>
<td>
......@@ -94,6 +88,35 @@
</tr>
{/foreach}
{if count($grandTotal)}
<tr class="articles-sum-row-grandSubSum">
<td class="articles-sum-row-firstCell">
<span class="articles-sum-row-grandSubSum-text">
{locale group="quiqqer/erp" var="article.list.articles.grandSubSum" Locale=$Locale}
</span>
</td>
<td style="width: 140px" class="articles-sum-row-sndCell">
<span class="articles-sum-row-grandSubSum-value">
{$calculations.grandSubSum}
</span>
</td>
</tr>
{foreach $grandTotal as $priceFactor}
<tr>
<td class="articles-sum-row-firstCell">
<span class="articles-sum-row-firstCell-text">
{$priceFactor.title} {if !empty($priceFactor.valueText) && $priceFactor.valueText !== '-'}({$priceFactor.valueText}){/if}
</span>
</td>
<td class="articles-sum-row-sndCell">
<span class="articles-sum-row-firstCell-value">
{$priceFactor.sumFormatted}
</span>
</td>
</tr>
{/foreach}
{/if}
<tr class="articles-sum-row-sum">
<td class="articles-sum-row-firstCell">
<span class="articles-sum-row-sum-text">
......
......@@ -106,10 +106,12 @@ table.articles-article {
text-align: right;
}
.articles-sum-row-grandSubSum-text,
.articles-sum-row-subsum-text {
border-bottom: 1px solid #999999;
}
.articles-sum-row-grandSubSum-value,
.articles-sum-row-subsum-value {
border-bottom: 1px solid #999999;
}
......
......@@ -71,12 +71,6 @@
</tr>
{/foreach}
{if count($priceFactors)}
<tr>
<td colspan="2"><br/></td>
</tr>
{/if}
{foreach $vatArray as $vat}
<tr>
<td>
......@@ -92,6 +86,35 @@
</tr>
{/foreach}
{if count($grandTotal)}
<tr class="articles-sum-row-grandSubSum">
<td class="articles-sum-row-firstCell">
<span class="articles-sum-row-grandSubSum-text">
{locale group="quiqqer/erp" var="article.list.articles.grandSubSum" Locale=$Locale}
</span>
</td>
<td style="width: 140px" class="articles-sum-row-sndCell">
<span class="articles-sum-row-grandSubSum-value">
{$calculations.grandSubSum}
</span>
</td>
</tr>
{foreach $grandTotal as $priceFactor}
<tr>
<td class="articles-sum-row-firstCell">
<span class="articles-sum-row-firstCell-text">
{$priceFactor.title} {if !empty($priceFactor.valueText) && $priceFactor.valueText !== '-'}({$priceFactor.valueText}){/if}
</span>
</td>
<td class="articles-sum-row-sndCell">
<span class="articles-sum-row-firstCell-value">
{$priceFactor.sumFormatted}
</span>
</td>
</tr>
{/foreach}
{/if}
<tr class="articles-sum-row-sum">
<td class="articles-sum-row-firstCell">
<span class="articles-sum-row-sum-text">
......
......@@ -26,6 +26,11 @@ class ArticleList extends ArticleListUnique implements \IteratorAggregate
*/
protected $sum;
/**
* @var int|float
*/
protected $grandSubSum;
/**
* @var QUI\Interfaces\Users\User
*/
......@@ -254,7 +259,13 @@ public function toArray(): array
continue;
}
$result['attributes'][] = [
$key = 'attributes';
if ($Factor->getCalculationBasis() === QUI\ERP\Accounting\Calc::CALCULATION_GRAND_TOTAL) {
$key = 'grandTotalFactors';
}
$data[$key][] = [
'title' => $Factor->getTitle(),
'value' => $Factor->getSumFormatted(),
'valueText' => ''
......@@ -323,6 +334,7 @@ public function calc($Calc = null)
$Calc->calcArticleList($this, function ($data) use ($self) {
$self->sum = $data['sum'];
$self->grandSubSum = $data['grandSubSum'];
$self->subSum = $data['subSum'];
$self->nettoSum = $data['nettoSum'];
$self->nettoSubSum = $data['nettoSubSum'];
......@@ -334,6 +346,7 @@ public function calc($Calc = null)
$this->calculations = [
'sum' => $self->sum,
'grandSubSum' => $self->grandSubSum,
'subSum' => $self->subSum,
'nettoSum' => $self->nettoSum,
'nettoSubSum' => $self->nettoSubSum,
......
......@@ -340,6 +340,7 @@ public function toHTML($template = false): string
$this->calculations['sum'] = $Currency->format($this->calculations['sum']);
$this->calculations['subSum'] = $Currency->format($this->calculations['subSum']);
$this->calculations['grandSubSum'] = $Currency->format($this->calculations['grandSubSum']);
$this->calculations['nettoSum'] = $Currency->format($this->calculations['nettoSum']);
$this->calculations['nettoSubSum'] = $Currency->format($this->calculations['nettoSubSum']);
......@@ -376,9 +377,22 @@ public function toHTML($template = false): string
]);
}
$priceFactors = [];
$grandTotal = [];
foreach ($this->PriceFactors as $Factor) {
if ($Factor->getCalculationBasis() === QUI\ERP\Accounting\Calc::CALCULATION_GRAND_TOTAL) {
$grandTotal[] = $Factor->toArray();
continue;
}
$priceFactors[] = $Factor->toArray();
}
// output
$Engine->assign([
'priceFactors' => $this->PriceFactors->toArray(),
'priceFactors' => $priceFactors,
'grandTotal' => $grandTotal,
'showHeader' => $this->showHeader,
'this' => $this,
'articles' => $articles,
......
......@@ -62,10 +62,14 @@ class Calc
/**
* Berechnet auf Basis des Preises inklusive Steuern
* Zum Beispiel MwSt
*
*/
const CALCULATION_BASIS_VAT_BRUTTO = 4;
/**
* Berechnet von Gesamtpreis
*/
const CALCULATION_GRAND_TOTAL = 5;
/**
* @var UserInterface
*/
......@@ -235,6 +239,12 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
/* @var $PriceFactor QUI\ERP\Accounting\PriceFactors\Factor */
foreach ($priceFactors as $PriceFactor) {
if ($PriceFactor->getCalculationBasis() === self::CALCULATION_GRAND_TOTAL) {
$PriceFactor->setNettoSum($PriceFactor->getValue());
$PriceFactor->setValueText('');
continue;
}
// percent - Prozent Angabe
if ($PriceFactor->getCalculation() === self::CALCULATION_PERCENTAGE) {
$calcBasis = $PriceFactor->getCalculationBasis();
......@@ -264,6 +274,10 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
$percentage = $priceFactorValue / 100 * $subSum;
}
break;
case self::CALCULATION_GRAND_TOTAL:
// starts later
continue 2;
}
$percentage = \round($percentage, $precision);
......@@ -274,7 +288,7 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
if ($isNetto) {
$PriceFactor->setSum($PriceFactor->getNettoSum());
} elseif ($PriceFactor->getCalculationBasis() === ErpCalc::CALCULATION_BASIS_VAT_BRUTTO) {
} elseif ($PriceFactor->getCalculationBasis() === self::CALCULATION_BASIS_VAT_BRUTTO) {
$PriceFactor->setNettoSum($PriceFactor->getNettoSum() - $vatSum);
$PriceFactor->setSum($vatSum + $PriceFactor->getNettoSum());
} else {
......@@ -351,8 +365,10 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
$priceFactorBruttoSums = 0;
foreach ($priceFactors as $Factor) {
/* @var $Factor QUI\ERP\Products\Utils\PriceFactor */
$priceFactorBruttoSums = $priceFactorBruttoSums + \round($Factor->getSum(), $precision);
if ($Factor->getCalculationBasis() !== self::CALCULATION_GRAND_TOTAL) {
/* @var $Factor QUI\ERP\Products\Utils\PriceFactor */
$priceFactorBruttoSums = $priceFactorBruttoSums + \round($Factor->getSum(), $precision);
}
}
$priceFactorBruttoSum = $subSum + $priceFactorBruttoSums;
......@@ -365,6 +381,10 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
$added = false;
foreach ($priceFactors as $Factor) {
if ($Factor->getCalculationBasis() === self::CALCULATION_GRAND_TOTAL) {
continue;
}
if ($Factor instanceof QUI\ERP\Products\Interfaces\PriceFactorWithVatInterface) {
$Factor->setSum(\round($Factor->getSum() - $diff, $precision));
$bruttoSum = \round($bruttoSum, $precision);
......@@ -404,9 +424,24 @@ public function calcArticleList(ArticleList $List, $callback = false): ArticleLi
}
}
// look if CALCULATION_GRAND_TOTAL
$grandSubSum = $bruttoSum;
foreach ($priceFactors as $Factor) {
if ($Factor->getCalculationBasis() === self::CALCULATION_GRAND_TOTAL) {
$value = $Factor->getValue();
$bruttoSum = $bruttoSum + $value;
if ($bruttoSum < 0) {
$bruttoSum = 0;
}
}
}
$callback([
'sum' => $bruttoSum,
'subSum' => $subSum,
'grandSubSum' => $grandSubSum,
'nettoSum' => $nettoSum,
'nettoSubSum' => $nettoSubSum,
'vatArray' => $vatArray,
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren