Compare commits
2 Commits
dd037b8f73
...
e6cfad0446
| Author | SHA1 | Date | |
|---|---|---|---|
| e6cfad0446 | |||
| 755cd972e1 |
11212
cobertura.xml
11212
cobertura.xml
File diff suppressed because it is too large
Load Diff
@ -65,6 +65,14 @@ class Calc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($option instanceof Select || $option instanceof Checkbox || $option instanceof Radio) {
|
if ($option instanceof Select || $option instanceof Checkbox || $option instanceof Radio) {
|
||||||
|
if ($option instanceof PaperDbSelect) {
|
||||||
|
if ($option->getStaffelCalc() !== null) {
|
||||||
|
$formel = $this->formelCalc->parse($option->getStaffelCalc());
|
||||||
|
eval('$staffelCalcResult = ' . $formel . ';');
|
||||||
|
$option->setStaffelCalcResult($staffelCalcResult);
|
||||||
|
$this->engine->setVariables($option->parseAdditionalValues($this->engine->getVariables()));
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($option->getSelectedOptions() as $opt) {
|
foreach ($option->getSelectedOptions() as $opt) {
|
||||||
if ($opt->isValid()) {
|
if ($opt->isValid()) {
|
||||||
$gesamt = $this->parseEdgeCollection(
|
$gesamt = $this->parseEdgeCollection(
|
||||||
@ -167,16 +175,20 @@ class Calc
|
|||||||
$edge->getCalcValue(),
|
$edge->getCalcValue(),
|
||||||
$orgCv . ' = ' . $cv,
|
$orgCv . ' = ' . $cv,
|
||||||
);
|
);
|
||||||
$this->engine->getCalcGraph()->addPart(new Part(
|
$this->engine
|
||||||
type: PartType::CalcValue,
|
->getCalcGraph()
|
||||||
name: $option->getId() . '_' . $collection->getName(),
|
->addPart(new Part(
|
||||||
unParsed: $edge->getCalcValue(),
|
type: PartType::CalcValue,
|
||||||
));
|
name: $option->getId() . '_' . $collection->getName(),
|
||||||
$this->engine->getCalcGraph()->addPart(new Part(
|
unParsed: $edge->getCalcValue(),
|
||||||
type: PartType::CalcValue,
|
));
|
||||||
name: $calcValueId,
|
$this->engine
|
||||||
unParsed: $edge->getCalcValue(),
|
->getCalcGraph()
|
||||||
));
|
->addPart(new Part(
|
||||||
|
type: PartType::CalcValue,
|
||||||
|
name: $calcValueId,
|
||||||
|
unParsed: $edge->getCalcValue(),
|
||||||
|
));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$cv = 0;
|
$cv = 0;
|
||||||
}
|
}
|
||||||
@ -187,11 +199,11 @@ class Calc
|
|||||||
if ($edge->getFormel() != '') {
|
if ($edge->getFormel() != '') {
|
||||||
$formel = $this->formelCalc->parse($edge->getFormel());
|
$formel = $this->formelCalc->parse($edge->getFormel());
|
||||||
if (
|
if (
|
||||||
$formel != '' &&
|
$formel != ''
|
||||||
!in_array($option->getId(), ['weight', 'weight_single']) &&
|
&& !in_array($option->getId(), ['weight', 'weight_single'])
|
||||||
!$option->isAjaxExport() &&
|
&& !$option->isAjaxExport()
|
||||||
!$option->isDisplayOnly() &&
|
&& !$option->isDisplayOnly()
|
||||||
$option->isAmount()
|
&& $option->isAmount()
|
||||||
) {
|
) {
|
||||||
$p = 0;
|
$p = 0;
|
||||||
$formel = str_replace('tonumber', '$this->toNumber', $formel);
|
$formel = str_replace('tonumber', '$this->toNumber', $formel);
|
||||||
@ -199,11 +211,13 @@ class Calc
|
|||||||
try {
|
try {
|
||||||
eval('@$p = ' . $this->eval_func($gesamt, $formel) . ';');
|
eval('@$p = ' . $this->eval_func($gesamt, $formel) . ';');
|
||||||
$this->engine->addDebugCalcFormel($edge->getFormel(), $formel . ' = ' . $p);
|
$this->engine->addDebugCalcFormel($edge->getFormel(), $formel . ' = ' . $p);
|
||||||
$this->engine->getCalcGraph()->addCalcFormel(new Part(
|
$this->engine
|
||||||
type: PartType::Formel,
|
->getCalcGraph()
|
||||||
name: sprintf('%s-%s', $option->getId(), $collection->getName()),
|
->addCalcFormel(new Part(
|
||||||
unParsed: $edge->getFormel(),
|
type: PartType::Formel,
|
||||||
));
|
name: sprintf('%s-%s', $option->getId(), $collection->getName()),
|
||||||
|
unParsed: $edge->getFormel(),
|
||||||
|
));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->engine->addDebugCalcFormel($edge->getFormel(), $formel . ' = error');
|
$this->engine->addDebugCalcFormel($edge->getFormel(), $formel . ' = error');
|
||||||
$p = 0;
|
$p = 0;
|
||||||
@ -215,11 +229,11 @@ class Calc
|
|||||||
$this->engine->setVariable('price', $gesamt);
|
$this->engine->setVariable('price', $gesamt);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
$formel != '' &&
|
$formel != ''
|
||||||
!in_array($option->getId(), ['weight', 'weight_single']) &&
|
&& !in_array($option->getId(), ['weight', 'weight_single'])
|
||||||
$option->isAjaxExport() &&
|
&& $option->isAjaxExport()
|
||||||
!$option->isDisplayOnly() &&
|
&& !$option->isDisplayOnly()
|
||||||
$option->isAmount()
|
&& $option->isAmount()
|
||||||
) {
|
) {
|
||||||
$p = 0;
|
$p = 0;
|
||||||
$formel = str_replace('tonumber', '$this->toNumber', $formel);
|
$formel = str_replace('tonumber', '$this->toNumber', $formel);
|
||||||
@ -233,11 +247,11 @@ class Calc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
$formel != '' &&
|
$formel != ''
|
||||||
!in_array($option->getId(), ['weight', 'weight_single']) &&
|
&& !in_array($option->getId(), ['weight', 'weight_single'])
|
||||||
!$option->isAjaxExport() &&
|
&& !$option->isAjaxExport()
|
||||||
$option->isDisplayOnly() &&
|
&& $option->isDisplayOnly()
|
||||||
$option->isAmount()
|
&& $option->isAmount()
|
||||||
) {
|
) {
|
||||||
$p = 0;
|
$p = 0;
|
||||||
$formel = str_replace('tonumber', '$this->toNumber', $formel);
|
$formel = str_replace('tonumber', '$this->toNumber', $formel);
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Select extends Base
|
|||||||
/** @var ObjectRepository */
|
/** @var ObjectRepository */
|
||||||
protected $paperRepository;
|
protected $paperRepository;
|
||||||
|
|
||||||
public function __construct(null|string $mode = null)
|
public function __construct(?string $mode = null)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@ -49,18 +49,18 @@ class Select extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($this->json['mode']) &&
|
isset($this->json['mode'])
|
||||||
((string) $this->json['mode']) == \PSC\Library\Calc\Option\Type\Select::$modePaperDb
|
&& (string) $this->json['mode'] == \PSC\Library\Calc\Option\Type\Select::$modePaperDb
|
||||||
) {
|
) {
|
||||||
$this->parseModePapierDbJson();
|
$this->parseModePapierDbJson();
|
||||||
} elseif (
|
} elseif (
|
||||||
isset($this->json['mode']) &&
|
isset($this->json['mode'])
|
||||||
((string) $this->json['mode']) == \PSC\Library\Calc\Option\Type\Select::$modeDelivery
|
&& (string) $this->json['mode'] == \PSC\Library\Calc\Option\Type\Select::$modeDelivery
|
||||||
) {
|
) {
|
||||||
$this->parseModeDeliveryJson();
|
$this->parseModeDeliveryJson();
|
||||||
} elseif (
|
} elseif (
|
||||||
isset($this->json['mode']) &&
|
isset($this->json['mode'])
|
||||||
((string) $this->json['mode']) == \PSC\Library\Calc\Option\Type\Select::$modeColorDb
|
&& (string) $this->json['mode'] == \PSC\Library\Calc\Option\Type\Select::$modeColorDb
|
||||||
) {
|
) {
|
||||||
$this->parseModeColorDbJson();
|
$this->parseModeColorDbJson();
|
||||||
} else {
|
} else {
|
||||||
@ -81,18 +81,18 @@ class Select extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($this->node['mode']) &&
|
isset($this->node['mode'])
|
||||||
((string) $this->node['mode']) == \PSC\Library\Calc\Option\Type\Select::$modePaperDb
|
&& (string) $this->node['mode'] == \PSC\Library\Calc\Option\Type\Select::$modePaperDb
|
||||||
) {
|
) {
|
||||||
$this->parseModePapierDbXML();
|
$this->parseModePapierDbXML();
|
||||||
} elseif (
|
} elseif (
|
||||||
isset($this->node['mode']) &&
|
isset($this->node['mode'])
|
||||||
((string) $this->node['mode']) == \PSC\Library\Calc\Option\Type\Select::$modeDelivery
|
&& (string) $this->node['mode'] == \PSC\Library\Calc\Option\Type\Select::$modeDelivery
|
||||||
) {
|
) {
|
||||||
$this->parseModeDeliveryXML();
|
$this->parseModeDeliveryXML();
|
||||||
} elseif (
|
} elseif (
|
||||||
isset($this->node['mode']) &&
|
isset($this->node['mode'])
|
||||||
((string) $this->node['mode']) == \PSC\Library\Calc\Option\Type\Select::$modeColorDb
|
&& (string) $this->node['mode'] == \PSC\Library\Calc\Option\Type\Select::$modeColorDb
|
||||||
) {
|
) {
|
||||||
$this->parseModeColorDbXML();
|
$this->parseModeColorDbXML();
|
||||||
} else {
|
} else {
|
||||||
@ -123,6 +123,9 @@ class Select extends Base
|
|||||||
private function parseModePapierDbXML()
|
private function parseModePapierDbXML()
|
||||||
{
|
{
|
||||||
$this->element->setContainer((string) $this->node['container']);
|
$this->element->setContainer((string) $this->node['container']);
|
||||||
|
if (isset($this->node['staffelCalc'])) {
|
||||||
|
$this->element->setStaffelCalc((string) $this->node['staffelCalc']);
|
||||||
|
}
|
||||||
if ($this->getPaperRepository()) {
|
if ($this->getPaperRepository()) {
|
||||||
$this->element->setNewPaperObject($this->getPaperRepository()->getNewObject());
|
$this->element->setNewPaperObject($this->getPaperRepository()->getNewObject());
|
||||||
/** @var PaperContainer\Container $container */
|
/** @var PaperContainer\Container $container */
|
||||||
@ -154,6 +157,9 @@ class Select extends Base
|
|||||||
private function parseModePapierDbJson()
|
private function parseModePapierDbJson()
|
||||||
{
|
{
|
||||||
$this->element->setContainer((string) $this->json['container']);
|
$this->element->setContainer((string) $this->json['container']);
|
||||||
|
if (isset($this->json['staffelCalc'])) {
|
||||||
|
$this->element->setStaffelCalc((string) $this->json['staffelCalc']);
|
||||||
|
}
|
||||||
if ($this->getPaperRepository()) {
|
if ($this->getPaperRepository()) {
|
||||||
$this->element->setNewPaperObject($this->getPaperRepository()->getNewObject());
|
$this->element->setNewPaperObject($this->getPaperRepository()->getNewObject());
|
||||||
/** @var PaperContainer\Container $container */
|
/** @var PaperContainer\Container $container */
|
||||||
|
|||||||
@ -10,15 +10,18 @@ class PaperDbSelect extends Select
|
|||||||
{
|
{
|
||||||
protected $newPaperObject = null;
|
protected $newPaperObject = null;
|
||||||
|
|
||||||
public function getSelectedOption(): null|Opt
|
private ?string $staffelCalc = null;
|
||||||
|
private ?float $staffelCalcResult = null;
|
||||||
|
|
||||||
|
public function getSelectedOption(): ?Opt
|
||||||
{
|
{
|
||||||
if (count($this->selectedOptions) > 0) {
|
if (count($this->selectedOptions) > 0) {
|
||||||
return $this->selectedOptions[0];
|
return $this->selectedOptions[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($this->savedCalcValues[$this->getId()]) &&
|
isset($this->savedCalcValues[$this->getId()])
|
||||||
$this->savedCalcValues[$this->getId()]['art_nr'] == $this->getRawValue()
|
&& $this->savedCalcValues[$this->getId()]['art_nr'] == $this->getRawValue()
|
||||||
) {
|
) {
|
||||||
$opt = new PaperOpt();
|
$opt = new PaperOpt();
|
||||||
$opt->setId($this->savedCalcValues[$this->getId()]['art_nr']);
|
$opt->setId($this->savedCalcValues[$this->getId()]['art_nr']);
|
||||||
@ -104,6 +107,7 @@ class PaperDbSelect extends Select
|
|||||||
$variables[$this->getId() . '_glam'] = 0;
|
$variables[$this->getId() . '_glam'] = 0;
|
||||||
$variables[$this->getId() . '_post'] = 0;
|
$variables[$this->getId() . '_post'] = 0;
|
||||||
$variables[$this->getId() . '_sammelform'] = 0;
|
$variables[$this->getId() . '_sammelform'] = 0;
|
||||||
|
$variables[$this->getId() . '_staffel_value'] = 0;
|
||||||
} else {
|
} else {
|
||||||
/** @var Paper $paper */
|
/** @var Paper $paper */
|
||||||
$paper = $option->getPaper();
|
$paper = $option->getPaper();
|
||||||
@ -160,6 +164,7 @@ class PaperDbSelect extends Select
|
|||||||
$variables[$this->getId() . '_glam'] = $paper->getGlam();
|
$variables[$this->getId() . '_glam'] = $paper->getGlam();
|
||||||
$variables[$this->getId() . '_post'] = $paper->getPost();
|
$variables[$this->getId() . '_post'] = $paper->getPost();
|
||||||
$variables[$this->getId() . '_sammelform'] = $paper->getSammelform();
|
$variables[$this->getId() . '_sammelform'] = $paper->getSammelform();
|
||||||
|
$variables[$this->getId() . '_staffel_value'] = $this->getStaffelValue($paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $variables;
|
return $variables;
|
||||||
@ -177,6 +182,7 @@ class PaperDbSelect extends Select
|
|||||||
{
|
{
|
||||||
return array_merge_recursive(parent::generateXML(), ['_attributes' => [
|
return array_merge_recursive(parent::generateXML(), ['_attributes' => [
|
||||||
'mode' => 'papierdb',
|
'mode' => 'papierdb',
|
||||||
|
'staffelCalc' => $this->staffelCalc,
|
||||||
'container' => $this->container,
|
'container' => $this->container,
|
||||||
]]);
|
]]);
|
||||||
}
|
}
|
||||||
@ -186,8 +192,49 @@ class PaperDbSelect extends Select
|
|||||||
$obj = parent::generateJson();
|
$obj = parent::generateJson();
|
||||||
$obj->mode = 'papierdb';
|
$obj->mode = 'papierdb';
|
||||||
$obj->container = $this->container;
|
$obj->container = $this->container;
|
||||||
|
$obj->staffelCalc = $this->staffelCalc;
|
||||||
$obj->options = [];
|
$obj->options = [];
|
||||||
$obj->options[] = $this->getSelectedOption()->generateJson();
|
$obj->options[] = $this->getSelectedOption()->generateJson();
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setStaffelCalc(?string $staffelCalc): void
|
||||||
|
{
|
||||||
|
$this->staffelCalc = $staffelCalc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStaffelCalc(): ?string
|
||||||
|
{
|
||||||
|
return $this->staffelCalc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStaffelCalcResult(?float $staffelCalcResult): void
|
||||||
|
{
|
||||||
|
$this->staffelCalcResult = $staffelCalcResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStaffelCalcResult(): ?float
|
||||||
|
{
|
||||||
|
return $this->staffelCalcResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getStaffelValue($paper): ?float
|
||||||
|
{
|
||||||
|
if ($this->getStaffelCalcResult() >= $paper->getStaffelMenge5()) {
|
||||||
|
return (float) $paper->getStaffelPreis5();
|
||||||
|
}
|
||||||
|
if ($this->getStaffelCalcResult() >= $paper->getStaffelMenge4()) {
|
||||||
|
return (float) $paper->getStaffelPreis4();
|
||||||
|
}
|
||||||
|
if ($this->getStaffelCalcResult() >= $paper->getStaffelMenge3()) {
|
||||||
|
return (float) $paper->getStaffelPreis3();
|
||||||
|
}
|
||||||
|
if ($this->getStaffelCalcResult() >= $paper->getStaffelMenge2()) {
|
||||||
|
return (float) $paper->getStaffelPreis2();
|
||||||
|
}
|
||||||
|
if ($this->getStaffelCalcResult() >= $paper->getStaffelMenge1()) {
|
||||||
|
return (float) $paper->getStaffelPreis1();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PSC\Library\Calc\Tests\Article;
|
namespace PSC\Library\Calc\Tests\Article;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
@ -10,7 +11,7 @@ class SimpleXmlTest extends TestCase
|
|||||||
public function testIfArticleCountInXmlCorrect()
|
public function testIfArticleCountInXmlCorrect()
|
||||||
{
|
{
|
||||||
$parser = new Engine(new Container());
|
$parser = new Engine(new Container());
|
||||||
$this->assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple.xml')));
|
$this->assertTrue($parser->loadString(file_get_contents(__DIR__ . '/../TestFiles/General/simple.xml')));
|
||||||
|
|
||||||
$this->assertEquals(1, $parser->getArticles()->Count());
|
$this->assertEquals(1, $parser->getArticles()->Count());
|
||||||
}
|
}
|
||||||
@ -18,7 +19,8 @@ class SimpleXmlTest extends TestCase
|
|||||||
public function testIfArticleCountInXmlCorrectWith2Article()
|
public function testIfArticleCountInXmlCorrectWith2Article()
|
||||||
{
|
{
|
||||||
$parser = new Engine(new Container());
|
$parser = new Engine(new Container());
|
||||||
$this->assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple2articles.xml')));
|
$this->assertTrue($parser->loadString(file_get_contents(__DIR__
|
||||||
|
. '/../TestFiles/General/simple2articles.xml')));
|
||||||
|
|
||||||
$this->assertEquals(2, $parser->getArticles()->Count());
|
$this->assertEquals(2, $parser->getArticles()->Count());
|
||||||
}
|
}
|
||||||
@ -26,12 +28,11 @@ class SimpleXmlTest extends TestCase
|
|||||||
public function testGetArticleByName()
|
public function testGetArticleByName()
|
||||||
{
|
{
|
||||||
$parser = new Engine(new Container());
|
$parser = new Engine(new Container());
|
||||||
$parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple2articles.xml'));
|
$parser->loadString(file_get_contents(__DIR__ . '/../TestFiles/General/simple2articles.xml'));
|
||||||
|
|
||||||
$parser->setActiveArticle("Blocks A5 25blatt geleimt");
|
$parser->setActiveArticle('Blocks A5 25blatt geleimt');
|
||||||
$article = $parser->getArticle();
|
$article = $parser->getArticle();
|
||||||
$this->assertInstanceOf('PSC\Library\Calc\Article', $article);
|
$this->assertInstanceOf('PSC\Library\Calc\Article', $article);
|
||||||
$this->assertEquals('Blocks A5 25blatt geleimt', $article->getName());
|
$this->assertEquals('Blocks A5 25blatt geleimt', $article->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
61
tests/Customer/PP/CalcTest.php
Normal file
61
tests/Customer/PP/CalcTest.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Library\Calc\Tests\Customer\PP;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use PSC\Library\Calc\Article;
|
||||||
|
use PSC\Library\Calc\Engine;
|
||||||
|
use PSC\Library\Calc\Option\Type\Select;
|
||||||
|
use PSC\Library\Calc\PaperContainer;
|
||||||
|
use PSC\Library\Calc\Tests\Mock\PaperRepostory;
|
||||||
|
|
||||||
|
class CalcTest extends TestCase
|
||||||
|
{
|
||||||
|
protected ?Engine $engine = null;
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
$repository = new PaperRepostory();
|
||||||
|
|
||||||
|
$paperContainer = new PaperContainer();
|
||||||
|
$paperContainer->parse(simplexml_load_string(file_get_contents(__DIR__ . '/papierContainer.xml')));
|
||||||
|
|
||||||
|
$this->engine = new Engine();
|
||||||
|
$this->engine->setPaperContainer($paperContainer);
|
||||||
|
$this->engine->setPaperRepository($repository);
|
||||||
|
$this->engine->setFormulas(file_get_contents(__DIR__ . '/formels.txt'));
|
||||||
|
$this->engine->setParameters(file_get_contents(__DIR__ . '/parameters.txt'));
|
||||||
|
$this->engine->setTemplates(file_get_contents(__DIR__ . '/calcTemplates.xml'));
|
||||||
|
|
||||||
|
$this->engine->loadString(file_get_contents(__DIR__ . '/calc.txt'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown(): void
|
||||||
|
{
|
||||||
|
$this->engine = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNormalPrice(): void
|
||||||
|
{
|
||||||
|
$this->engine->calc();
|
||||||
|
$this->assertSame(25.00, $this->engine->getPrice());
|
||||||
|
$this->engine->getCalcGraph()->generateJsonGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStaffel2Price(): void
|
||||||
|
{
|
||||||
|
$this->engine->setVariable('papier', 'staffel2');
|
||||||
|
$this->engine->calc();
|
||||||
|
$this->assertSame(207.00, $this->engine->getPrice());
|
||||||
|
$this->engine->getCalcGraph()->generateJsonGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStaffel2_1Price(): void
|
||||||
|
{
|
||||||
|
$this->engine->setVariable('papier', 'staffel2');
|
||||||
|
$this->engine->setVariable('auflage', '45');
|
||||||
|
$this->engine->calc();
|
||||||
|
$this->assertSame(407.00, $this->engine->getPrice());
|
||||||
|
$this->engine->getCalcGraph()->generateJsonGraph();
|
||||||
|
}
|
||||||
|
}
|
||||||
39
tests/Customer/PP/calc.txt
Normal file
39
tests/Customer/PP/calc.txt
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!-- Prototyp für wmw, Übergabe prüfen!
|
||||||
|
ToDo:
|
||||||
|
-Online-Rabatt wird per exportAjax nur ausgewiesen, wenn Default="ja" ausgewählt ist!
|
||||||
|
-Buchrücken > 4,5 cm für HDCOVER, HDLEINEN
|
||||||
|
-Buchrücken > 0,5 cm für PUR
|
||||||
|
-->
|
||||||
|
|
||||||
|
<kalkulation>
|
||||||
|
<artikel>
|
||||||
|
<name>Broschüren Offsetdruck</name>
|
||||||
|
<kommentar></kommentar>
|
||||||
|
|
||||||
|
<!-- Grundlagen -->
|
||||||
|
|
||||||
|
<name>BRO Prototyp</name>
|
||||||
|
<kommentar></kommentar>
|
||||||
|
|
||||||
|
<option id="auflage" name="Auflage" type="Input" default="21" min="50" max="5000000"/>
|
||||||
|
|
||||||
|
|
||||||
|
<option id="papier" name="PapierDB" type="Select" mode="papierdb" staffelCalc="$Vauflage$V" container="staffel" default="staffel1">
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<option id="calc" type="Hidden">
|
||||||
|
<auflage>
|
||||||
|
<grenze formel="$Vpapier_value$V">1-</grenze>
|
||||||
|
</auflage>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<option id="calc_staffel" type="Hidden">
|
||||||
|
<auflage>
|
||||||
|
<grenze formel="$Vpapier_staffel_value$V">1-</grenze>
|
||||||
|
</auflage>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
</artikel>
|
||||||
|
</kalkulation>
|
||||||
2
tests/Customer/PP/calcTemplates.xml
Normal file
2
tests/Customer/PP/calcTemplates.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<root>
|
||||||
|
</root>
|
||||||
1
tests/Customer/PP/formels.txt
Normal file
1
tests/Customer/PP/formels.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
9
tests/Customer/PP/papierContainer.xml
Normal file
9
tests/Customer/PP/papierContainer.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<container>
|
||||||
|
|
||||||
|
<papiercontainer id="staffel">
|
||||||
|
<papier id="staffel1"/>
|
||||||
|
<papier id="staffel2"/>
|
||||||
|
</papiercontainer>
|
||||||
|
|
||||||
|
</container>
|
||||||
1
tests/Customer/PP/parameters.txt
Normal file
1
tests/Customer/PP/parameters.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
@ -447,6 +447,40 @@ class PaperRepostory implements ObjectRepository
|
|||||||
$papier['ct200']->setUmschlagen(true);
|
$papier['ct200']->setUmschlagen(true);
|
||||||
$papier['ct200']->setStaerke(0.191);
|
$papier['ct200']->setStaerke(0.191);
|
||||||
|
|
||||||
|
$papier['staffel1'] = new Paper();
|
||||||
|
$papier['staffel1']->setArtNr('staffel1');
|
||||||
|
$papier['staffel1']->setGrammatur('1');
|
||||||
|
$papier['staffel1']->setPreis(5);
|
||||||
|
$papier['staffel1']->setUmschlagen(true);
|
||||||
|
$papier['staffel1']->setStaerke(0.191);
|
||||||
|
$papier['staffel1']->setStaffelmenge1(10);
|
||||||
|
$papier['staffel1']->setStaffelmenge2(20);
|
||||||
|
$papier['staffel1']->setStaffelmenge3(30);
|
||||||
|
$papier['staffel1']->setStaffelmenge4(40);
|
||||||
|
$papier['staffel1']->setStaffelmenge5(50);
|
||||||
|
$papier['staffel1']->setStaffelpreis1(10);
|
||||||
|
$papier['staffel1']->setStaffelpreis2(20);
|
||||||
|
$papier['staffel1']->setStaffelpreis3(30);
|
||||||
|
$papier['staffel1']->setStaffelpreis4(40);
|
||||||
|
$papier['staffel1']->setStaffelpreis5(50);
|
||||||
|
|
||||||
|
$papier['staffel2'] = new Paper();
|
||||||
|
$papier['staffel2']->setArtNr('staffel2');
|
||||||
|
$papier['staffel2']->setGrammatur('1');
|
||||||
|
$papier['staffel2']->setPreis(6);
|
||||||
|
$papier['staffel2']->setUmschlagen(true);
|
||||||
|
$papier['staffel2']->setStaerke(0.191);
|
||||||
|
$papier['staffel2']->setStaffelmenge1(10);
|
||||||
|
$papier['staffel2']->setStaffelmenge2(20);
|
||||||
|
$papier['staffel2']->setStaffelmenge3(30);
|
||||||
|
$papier['staffel2']->setStaffelmenge4(40);
|
||||||
|
$papier['staffel2']->setStaffelmenge5(50);
|
||||||
|
$papier['staffel2']->setStaffelpreis1(101);
|
||||||
|
$papier['staffel2']->setStaffelpreis2(201);
|
||||||
|
$papier['staffel2']->setStaffelpreis3(301);
|
||||||
|
$papier['staffel2']->setStaffelpreis4(401);
|
||||||
|
$papier['staffel2']->setStaffelpreis5(501);
|
||||||
|
|
||||||
return $papier[$criteria['artNr']];
|
return $papier[$criteria['artNr']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user