Fixes
This commit is contained in:
parent
6cb94dbce2
commit
e2c41ecaa9
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ composer.phar
|
||||
vendor/
|
||||
.php-cs-fixer.cache
|
||||
.phpunit.result.cache
|
||||
cobertura.xml
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
.phpunit.cache/
|
||||
|
||||
3790
cobertura.xml
3790
cobertura.xml
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ use PSC\Library\Calc\Model\Part;
|
||||
use PSC\Library\Calc\Model\PartType;
|
||||
use PSC\Library\Calc\Option\Type\Base;
|
||||
use PSC\Library\Calc\Option\Type\Checkbox;
|
||||
use PSC\Library\Calc\Option\Type\Input;
|
||||
use PSC\Library\Calc\Option\Type\PaperDbSelect;
|
||||
use PSC\Library\Calc\Option\Type\Radio;
|
||||
use PSC\Library\Calc\Option\Type\Row;
|
||||
@ -76,6 +77,18 @@ class Calc
|
||||
}
|
||||
}
|
||||
|
||||
if ($option instanceof Input) {
|
||||
if ($option->getMaxCalc() != null) {
|
||||
$formel = $this->formelCalc->parse($option->getMaxCalc());
|
||||
eval('$maxValue = ' . $formel . ';');
|
||||
$option->setMaxValue($maxValue);
|
||||
}
|
||||
if ($option->getMinCalc() != null) {
|
||||
$formel = $this->formelCalc->parse($option->getMinCalc());
|
||||
eval('$minValue = ' . $formel . ';');
|
||||
$option->setMinValue($minValue);
|
||||
}
|
||||
}
|
||||
$gesamt = $this->parseEdgeCollection(
|
||||
$gesamt,
|
||||
$option,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace PSC\Library\Calc\Option\Parser;
|
||||
|
||||
use PSC\Library\Calc\General\Parser\EdgeCollectionContainer;
|
||||
@ -6,7 +7,6 @@ use PSC\Library\Calc\Option\Type\Input as PSCInput;
|
||||
|
||||
class Input extends Base
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->element = new \PSC\Library\Calc\Option\Type\Input();
|
||||
@ -16,18 +16,26 @@ class Input extends Base
|
||||
{
|
||||
parent::parseJson();
|
||||
|
||||
if(isset($this->json['placeHolder'])) {
|
||||
$this->element->setPlaceHolder((string)$this->json['placeHolder']);
|
||||
if (isset($this->json['placeHolder'])) {
|
||||
$this->element->setPlaceHolder((string) $this->json['placeHolder']);
|
||||
}
|
||||
if(isset($this->json['minValue'])) {
|
||||
$this->element->setMinValue((int)$this->json['minValue']);
|
||||
if (isset($this->json['minValue'])) {
|
||||
$this->element->setMinValue((int) $this->json['minValue']);
|
||||
}
|
||||
|
||||
if(isset($this->json['maxValue'])) {
|
||||
$this->element->setMaxValue((int)$this->json['maxValue']);
|
||||
if (isset($this->json['minCalc'])) {
|
||||
$this->element->setMinCalc((string) $this->json['minCalc']);
|
||||
}
|
||||
|
||||
if(isset($this->json['dependencys']) && count($this->json['dependencys']) > 0) {
|
||||
if (isset($this->json['maxValue'])) {
|
||||
$this->element->setMaxValue((int) $this->json['maxValue']);
|
||||
}
|
||||
|
||||
if (isset($this->json['maxCalc'])) {
|
||||
$this->element->setMaxCalc((string) $this->json['maxCalc']);
|
||||
}
|
||||
|
||||
if (isset($this->json['dependencys']) && count($this->json['dependencys']) > 0) {
|
||||
$edgeCollectionContainerParser = new EdgeCollectionContainer();
|
||||
$edgeCollectionContainerParser->fromJson($this->json['dependencys']);
|
||||
$this->element->setEdgesCollectionContainer($edgeCollectionContainerParser->parseJson());
|
||||
@ -40,22 +48,30 @@ class Input extends Base
|
||||
{
|
||||
parent::parseXML();
|
||||
|
||||
if(isset($this->node['min'])) {
|
||||
$this->element->setMinValue((int)$this->node['min']);
|
||||
if (isset($this->node['min'])) {
|
||||
$this->element->setMinValue((int) $this->node['min']);
|
||||
}
|
||||
|
||||
if(isset($this->node['max'])) {
|
||||
$this->element->setMaxValue((int)$this->node['max']);
|
||||
if (isset($this->node['min_calc'])) {
|
||||
$this->element->setMinCalc((string) $this->node['min_calc']);
|
||||
}
|
||||
|
||||
if(isset($this->node['pattern'])) {
|
||||
$this->element->setPattern((string)$this->node['pattern']);
|
||||
}
|
||||
if(isset($this->node['placeholder'])) {
|
||||
$this->element->setPlaceHolder((string)$this->node['placeholder']);
|
||||
if (isset($this->node['max'])) {
|
||||
$this->element->setMaxValue((int) $this->node['max']);
|
||||
}
|
||||
|
||||
if($this->node->children()) {
|
||||
if (isset($this->node['max_calc'])) {
|
||||
$this->element->setMaxCalc((string) $this->node['max_calc']);
|
||||
}
|
||||
|
||||
if (isset($this->node['pattern'])) {
|
||||
$this->element->setPattern((string) $this->node['pattern']);
|
||||
}
|
||||
if (isset($this->node['placeholder'])) {
|
||||
$this->element->setPlaceHolder((string) $this->node['placeholder']);
|
||||
}
|
||||
|
||||
if ($this->node->children()) {
|
||||
$edgeCollectionContainerParser = new EdgeCollectionContainer();
|
||||
$edgeCollectionContainerParser->fromXML($this->node);
|
||||
$this->element->setEdgesCollectionContainer($edgeCollectionContainerParser->parseXML());
|
||||
@ -63,5 +79,4 @@ class Input extends Base
|
||||
|
||||
return $this->element;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -133,7 +133,6 @@ class Select extends Base
|
||||
foreach ($container->getItems() as $papier) {
|
||||
/** @var Paper $paper */
|
||||
$paper = $this->getPaperRepository()->findOneBy(['artNr' => $papier->getId()]);
|
||||
|
||||
if ($paper) {
|
||||
$optPapier = new \PSC\Library\Calc\Option\Type\Select\PaperOpt();
|
||||
$optPapier->setId($paper->getArtNr());
|
||||
|
||||
@ -1,34 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace PSC\Library\Calc\Option\Type;
|
||||
|
||||
class Input extends Base
|
||||
{
|
||||
private ?int $minValue = null;
|
||||
|
||||
private ?int $maxValue = null;
|
||||
private null|int $minValue = null;
|
||||
|
||||
private string $pattern = "";
|
||||
private null|int $maxValue = null;
|
||||
|
||||
private string $placeHolder = "";
|
||||
private null|string $maxCalc = null;
|
||||
|
||||
private null|string $minCalc = null;
|
||||
|
||||
private string $pattern = '';
|
||||
|
||||
private string $placeHolder = '';
|
||||
|
||||
public $type = 'input';
|
||||
|
||||
public function setMinValue(?int $min): void
|
||||
public function setMinValue(null|int $min): void
|
||||
{
|
||||
$this->minValue = $min;
|
||||
}
|
||||
|
||||
public function getMinValue(): ?int
|
||||
public function getMinValue(): null|int
|
||||
{
|
||||
return $this->minValue;
|
||||
}
|
||||
|
||||
public function setMaxValue(?int $max): void
|
||||
public function setMaxCalc(null|string $max): void
|
||||
{
|
||||
$this->maxCalc = $max;
|
||||
}
|
||||
|
||||
public function getMaxCalc(): null|string
|
||||
{
|
||||
return $this->maxCalc;
|
||||
}
|
||||
|
||||
public function setMinCalc(null|string $min): void
|
||||
{
|
||||
$this->minCalc = $min;
|
||||
}
|
||||
|
||||
public function getMinCalc(): null|string
|
||||
{
|
||||
return $this->minCalc;
|
||||
}
|
||||
|
||||
public function setMaxValue(null|int $max): void
|
||||
{
|
||||
$this->maxValue = $max;
|
||||
}
|
||||
|
||||
public function getMaxValue(): ?int
|
||||
|
||||
public function getMaxValue(): null|int
|
||||
{
|
||||
return $this->maxValue;
|
||||
}
|
||||
@ -57,28 +82,39 @@ class Input extends Base
|
||||
{
|
||||
$tmp = [];
|
||||
|
||||
if($this->getPlaceHolder() != "") {
|
||||
if ($this->getPlaceHolder() != '') {
|
||||
$tmp['_attributes'] = [
|
||||
'placeholder' => $this->getPlaceHolder()
|
||||
'placeholder' => $this->getPlaceHolder(),
|
||||
];
|
||||
}
|
||||
if($this->getMinValue() !== null) {
|
||||
if ($this->getMinValue() !== null) {
|
||||
$tmp = array_merge_recursive($tmp, ['_attributes' => [
|
||||
'min' => $this->getMinValue()
|
||||
'min' => $this->getMinValue(),
|
||||
]]);
|
||||
}
|
||||
if($this->getMaxValue() !== null) {
|
||||
if ($this->getMaxValue() !== null) {
|
||||
$tmp = array_merge_recursive($tmp, ['_attributes' => [
|
||||
'max' => $this->getMaxValue()
|
||||
'max' => $this->getMaxValue(),
|
||||
]]);
|
||||
}
|
||||
|
||||
if ($this->getMinCalc() !== null) {
|
||||
$tmp = array_merge_recursive($tmp, ['_attributes' => [
|
||||
'min_calc' => $this->getMinCalc(),
|
||||
]]);
|
||||
}
|
||||
if ($this->getMaxCalc() !== null) {
|
||||
$tmp = array_merge_recursive($tmp, ['_attributes' => [
|
||||
'max_calc' => $this->getMaxCalc(),
|
||||
]]);
|
||||
}
|
||||
|
||||
$tmp = array_merge_recursive($tmp, ['_attributes' => [
|
||||
'default' => $this->getDefault()
|
||||
'default' => $this->getDefault(),
|
||||
]]);
|
||||
if($this->isRequire()) {
|
||||
if ($this->isRequire()) {
|
||||
$tmp = array_merge_recursive($tmp, ['_attributes' => [
|
||||
'require' => 'true'
|
||||
'require' => 'true',
|
||||
]]);
|
||||
}
|
||||
return array_merge_recursive($tmp, parent::generateXML());
|
||||
@ -89,12 +125,18 @@ class Input extends Base
|
||||
$obj = parent::generateJson();
|
||||
$obj->placeHolder = $this->placeHolder;
|
||||
$obj->required = $this->isRequire();
|
||||
if($this->getMinValue() !== NULL) {
|
||||
if ($this->getMinValue() !== null) {
|
||||
$obj->minValue = $this->getMinValue();
|
||||
}
|
||||
if($this->getMaxValue() !== null) {
|
||||
if ($this->getMaxValue() !== null) {
|
||||
$obj->maxValue = $this->getMaxValue();
|
||||
}
|
||||
if ($this->getMinCalc() !== null) {
|
||||
$obj->minCalc = $this->getMinCalc();
|
||||
}
|
||||
if ($this->getMaxCalc() !== null) {
|
||||
$obj->maxCalc = $this->getMaxCalc();
|
||||
}
|
||||
$obj->type = 2;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
79
tests/Customer/MM/CalcTest.php
Normal file
79
tests/Customer/MM/CalcTest.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace PSC\Library\Calc\Tests\Customer\MM;
|
||||
|
||||
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
|
||||
{
|
||||
/** @var Engine */
|
||||
protected $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.xml'));
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
$this->engine = null;
|
||||
}
|
||||
|
||||
public function testPrice(): void
|
||||
{
|
||||
$this->engine->calc();
|
||||
$this->assertSame(1272.34, $this->engine->getPrice());
|
||||
self::assertCount(
|
||||
3,
|
||||
$this->engine
|
||||
->getArticle()
|
||||
->getOptionById('papier_umschlag')
|
||||
->getValidOptions(),
|
||||
);
|
||||
self::assertSame(
|
||||
60,
|
||||
$this->engine
|
||||
->getArticle()
|
||||
->getOptionById('seiten_inhalt')
|
||||
->getMaxValue(),
|
||||
);
|
||||
}
|
||||
|
||||
public function testPapierDbPrice(): void
|
||||
{
|
||||
$this->engine->setVariable('papier_inhalt', 'ct90');
|
||||
$this->engine->calc();
|
||||
$this->assertSame(1185.42, $this->engine->getPrice());
|
||||
self::assertCount(
|
||||
5,
|
||||
$this->engine
|
||||
->getArticle()
|
||||
->getOptionById('papier_umschlag')
|
||||
->getValidOptions(),
|
||||
);
|
||||
self::assertSame(
|
||||
80,
|
||||
$this->engine
|
||||
->getArticle()
|
||||
->getOptionById('seiten_inhalt')
|
||||
->getMaxValue(),
|
||||
);
|
||||
}
|
||||
}
|
||||
261
tests/Customer/MM/calc.xml
Normal file
261
tests/Customer/MM/calc.xml
Normal file
@ -0,0 +1,261 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<kalkulation>
|
||||
<artikel>
|
||||
<name>SD-Satz</name>
|
||||
<kommentar></kommentar>
|
||||
|
||||
<option id="auflage" name="Auflage" type="Input" default="1000"></option>
|
||||
|
||||
<option id="endformat_breite" type="Hidden" default="210" />
|
||||
<option id="endformat_hoehe" type="Hidden" default="297" />
|
||||
<option id="endformat_offene_hoehe" type="Hidden" default="420" />
|
||||
<option id="endformat_offene_breite" type="Hidden" default="297" />
|
||||
|
||||
<option id="seiten_inhalt" type="Input" name="seiten_inhalt" default="4"
|
||||
max_calc="1800/$Vpapier_inhalt_grammatur$V*$Vseiten_pro_bogen$V" min="1" />
|
||||
<option id="seiten_umschlag" type="Input" name="seiten_umschlag" default="4" />
|
||||
|
||||
<option id="seiten_pro_bogen" type="Hidden" default="4" />
|
||||
|
||||
<option id="papier_inhalt" type="Select" name="Papier Inhalt" mode="papierdb"
|
||||
default="ct120" container="inhalt" />
|
||||
|
||||
<option id="papier_umschlag" type="Select" name="Papier Umschlag" mode="papierdb"
|
||||
default="ct200" container="umschlag" />
|
||||
|
||||
|
||||
<!-- CALC -->
|
||||
|
||||
<!-- CALC INHALT -->
|
||||
<option id="druckbogen_inhalt_expl" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$Vseiten_inhalt$V/$Vseiten_pro_bogen$V">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckbogen_inhalt_netto" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$Vauflage$V/$CVdruckbogen_inhalt_expl$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckbogen_inhalt_zuschuss" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="ceil($Pdm_zuschuss_je_auftrag$P+($CVdruckbogen_inhalt_netto$CV*$Pdm_zuschuss_fortdruck$P))">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckbogen_inhalt_brutto" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckbogen_inhalt_netto$CV+$CVdruckbogen_inhalt_zuschuss$CV">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="drucke_inhalt_klicks" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="2*$CVdruckbogen_inhalt_brutto$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckzeit_inhalt" type="Hidden">
|
||||
<papier_inhalt_grammatur>
|
||||
<grenze calc_value="$CVdrucke_inhalt_klicks$CV/$Pdm_drucke_pro_minute_100$P">1-100</grenze>
|
||||
<grenze calc_value="$CVdrucke_inhalt_klicks$CV/$Pdm_drucke_pro_minute_150$P">101-150</grenze>
|
||||
<grenze calc_value="$CVdrucke_inhalt_klicks$CV/$Pdm_drucke_pro_minute_300$P">151-300</grenze>
|
||||
</papier_inhalt_grammatur>
|
||||
</option>
|
||||
|
||||
<!-- CALC Umschlag -->
|
||||
<option id="druckbogen_umschlag_expl" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$Vseiten_umschlag$V/$Vseiten_pro_bogen$V">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckbogen_umschlag_netto" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$Vauflage$V/$CVdruckbogen_umschlag_expl$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckbogen_umschlag_zuschuss" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="ceil($Pdm_zuschuss_je_papiersorte$P+($CVdruckbogen_umschlag_netto$CV*$Pdm_zuschuss_fortdruck$P))">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckbogen_umschlag_brutto" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckbogen_inhalt_netto$CV+$CVdruckbogen_inhalt_zuschuss$CV">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="drucke_umschlag_klicks" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="2*$CVdruckbogen_umschlag_brutto$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="druckzeit_umschlag" type="Hidden">
|
||||
<papier_umschlag_grammatur>
|
||||
<grenze calc_value="$CVdrucke_umschlag_klicks$CV/$Pdm_drucke_pro_minute_100$P">1-100</grenze>
|
||||
<grenze calc_value="$CVdrucke_umschlag_klicks$CV/$Pdm_drucke_pro_minute_150$P">
|
||||
101-150</grenze>
|
||||
<grenze calc_value="$CVdrucke_umschlag_klicks$CV/$Pdm_drucke_pro_minute_300$P">
|
||||
151-300</grenze>
|
||||
</papier_umschlag_grammatur>
|
||||
</option>
|
||||
|
||||
<!-- Calc Druckzeit -->
|
||||
<option id="druckzeit_gesamt_netto" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckzeit_umschlag$CV+$CVdruckzeit_inhalt$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="druckzeit_zuschlag_finisher" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckzeit_gesamt_netto$CV*$Pdm_druckzeit_zuschlag_finisher$P">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="druckzeit" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckzeit_gesamt_netto$CV+$CVdruckzeit_zuschlag_finisher$CV">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<!-- CALC KARTON -->
|
||||
<option id="hoehe_endprodukt_einzeln" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="0.25+(2*($CVdruckbogen_inhalt_expl$CV*$Vpapier_inhalt_staerke$V))+(2*$CVdruckbogen_umschlag_expl$CV*$Vpapier_umschlag_staerke$V)">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="hoehe_endprodukt_gesamt" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVhoehe_endprodukt_einzeln$CV*$Vauflage$V">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="gewicht_endprodukt_einzeln" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="($CVdruckbogen_inhalt_expl$CV*(($Vendformat_offene_breite$V/1000)*($Vendformat_offene_hoehe$V/1000)*$Vpapier_inhalt_grammatur$V))+($CVdruckbogen_umschlag_expl$CV*(($Vendformat_offene_breite$V/1000)*($Vendformat_offene_hoehe$V/1000)*$Vpapier_umschlag_grammatur$V))">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="gewicht_endprodukt_gesamt" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVgewicht_endprodukt_einzeln$CV*$Vauflage$V">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<!-- CALC Kartons -->
|
||||
<option id="kartons" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="ceil($CVhoehe_endprodukt_gesamt$CV/150)">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<!-- CALC Kosten -->
|
||||
<option id="produktions_kosten" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckzeit$CV*$Pdm_minutensatz$P">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="materialkosten_papier_inhalt" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckbogen_inhalt_brutto$CV/1000*$Vpapier_inhalt_value$V">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="materialkosten_papier_umschlag" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdruckbogen_umschlag_brutto$CV/1000*$Vpapier_umschlag_value$V">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="materialkosten_papier_zuschlag" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="($CVmaterialkosten_papier_inhalt$CV+$CVmaterialkosten_papier_umschlag$CV)*$Pzuschlag_papier$P">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="klickkosten_druck_inhalt" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdrucke_inhalt_klicks$CV*$Pdm_klick_farbe$P">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="klickkosten_druck_umschlag" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVdrucke_umschlag_klicks$CV*$Pdm_klick_farbe$P">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="klickkosten_material_zuschlag" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="($CVklickkosten_druck_inhalt$CV+$CVklickkosten_druck_umschlag$CV)*$Pzuschlag_material$P">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="kosten_verpacken" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVkartons$CV*2.2">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
<option id="kosten_versand" type="Hidden">
|
||||
<auflage formel="$CVgewicht_endprodukt_gesamt$CV">
|
||||
<grenze calc_value="4">1-800</grenze>
|
||||
<grenze calc_value="6.5">801-4600</grenze>
|
||||
<grenze calc_value="8">4601-9300</grenze>
|
||||
<grenze calc_value="9.5">9300-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="summe_prod" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="$CVproduktions_kosten$CV+$CVmaterialkosten_papier_inhalt$CV+$CVmaterialkosten_papier_umschlag$CV+$CVmaterialkosten_papier_zuschlag$CV+$CVklickkosten_druck_inhalt$CV+$CVklickkosten_druck_umschlag$CV+$CVklickkosten_material_zuschlag$CV+$CVkosten_versand$CV+$CVkosten_verpacken$CV">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="zzgl_vwgk" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVsumme_prod$CV*$Pzuschlag_verwaltung$P">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="selbstkosten" type="Hidden">
|
||||
<auflage>
|
||||
<grenze calc_value="$CVsumme_prod$CV+$CVzzgl_vwgk$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="gewinn" type="Hidden">
|
||||
<auflage>
|
||||
<grenze
|
||||
calc_value="(($CVselbstkosten$CV/(100-($Pzuschlag_gewinn$P*100)))*($Pzuschlag_gewinn$P*100))">
|
||||
1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
<option id="calc" type="Hidden">
|
||||
<auflage>
|
||||
<grenze formel="$CVselbstkosten$CV+$CVgewinn$CV">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
</artikel>
|
||||
</kalkulation>
|
||||
2
tests/Customer/MM/calcTemplates.xml
Normal file
2
tests/Customer/MM/calcTemplates.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<root>
|
||||
</root>
|
||||
0
tests/Customer/MM/formels.txt
Normal file
0
tests/Customer/MM/formels.txt
Normal file
45
tests/Customer/MM/papierContainer.xml
Normal file
45
tests/Customer/MM/papierContainer.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<papiercontainer id="inhalt">
|
||||
<papier id="ct90" />
|
||||
<papier id="ct100" />
|
||||
<papier id="ct120" />
|
||||
</papiercontainer>
|
||||
<papiercontainer id="umschlag">
|
||||
<papier id="ct90">
|
||||
<grenzen>
|
||||
<papier_inhalt>
|
||||
<grenze>ct90</grenze>
|
||||
</papier_inhalt>
|
||||
</grenzen>
|
||||
</papier>
|
||||
<papier id="ct100">
|
||||
<grenzen>
|
||||
<papier_inhalt>
|
||||
<grenze>ct90</grenze>
|
||||
<grenze>ct100</grenze>
|
||||
</papier_inhalt>
|
||||
</grenzen>
|
||||
</papier>
|
||||
<papier id="ct120">
|
||||
<grenzen>
|
||||
<papier_inhalt>
|
||||
<grenze>ct90</grenze>
|
||||
<grenze>ct100</grenze>
|
||||
<grenze>ct120</grenze>
|
||||
</papier_inhalt>
|
||||
</grenzen>
|
||||
</papier>
|
||||
<papier id="ct160">
|
||||
<grenzen>
|
||||
<papier_inhalt>
|
||||
<grenze>ct90</grenze>
|
||||
<grenze>ct100</grenze>
|
||||
<grenze>ct120</grenze>
|
||||
<grenze>ct160</grenze>
|
||||
</papier_inhalt>
|
||||
</grenzen>
|
||||
</papier>
|
||||
<papier id="ct200" />
|
||||
</papiercontainer>
|
||||
</root>
|
||||
27
tests/Customer/MM/parameters.txt
Normal file
27
tests/Customer/MM/parameters.txt
Normal file
@ -0,0 +1,27 @@
|
||||
$dm_zuschuss_je_auftrag = 3;
|
||||
$dm_zuschuss_je_papiersorte = 2;
|
||||
$dm_zuschuss_fortdruck = 0.02;
|
||||
|
||||
$dm_drucke_pro_minute_100 = 30;
|
||||
$dm_minuten_pro_1000_100 = 34;
|
||||
|
||||
$dm_drucke_pro_minute_150 = 19;
|
||||
$dm_minuten_pro_1000_150 = 53;
|
||||
|
||||
$dm_drucke_pro_minute_300 = 12;
|
||||
$dm_minuten_pro_1000_300 = 84;
|
||||
|
||||
|
||||
$dm_druckzeit_zuschlag_finisher = 0.20;
|
||||
|
||||
$dm_stundensatz = 78;
|
||||
$dm_minutensatz = 1.3;
|
||||
|
||||
$dm_klick_farbe = 0.07;
|
||||
$dm_klick_sw = 0.01;
|
||||
|
||||
$zuschlag_papier = 0.16;
|
||||
$zuschlag_material = 0.08;
|
||||
$zuschlag_fremd = 0.08;
|
||||
$zuschlag_verwaltung = 0.27;
|
||||
$zuschlag_gewinn = 0.10;
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
@ -15,8 +16,7 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
class PaperRepostory implements ObjectRepository
|
||||
{
|
||||
|
||||
public function find(mixed $id): ?object
|
||||
public function find(mixed $id): null|object
|
||||
{
|
||||
// TODO: Implement find() method.
|
||||
}
|
||||
@ -26,14 +26,18 @@ class PaperRepostory implements ObjectRepository
|
||||
// TODO: Implement findAll() method.
|
||||
}
|
||||
|
||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||
{
|
||||
public function findBy(
|
||||
array $criteria,
|
||||
null|array $orderBy = null,
|
||||
null|int $limit = null,
|
||||
null|int $offset = null,
|
||||
): array {
|
||||
// TODO: Implement findBy() method.
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?object
|
||||
public function findOneBy(array $criteria): null|object
|
||||
{
|
||||
$papier = array();
|
||||
$papier = [];
|
||||
$papier['bdm135'] = new Paper();
|
||||
$papier['bdm135']->setArtNr('bdm135');
|
||||
$papier['bdm135']->setVolume(0);
|
||||
@ -63,7 +67,6 @@ class PaperRepostory implements ObjectRepository
|
||||
$papier['bdg250']->setGrammatur(250);
|
||||
$papier['bdg250']->setPapierTyp1(1);
|
||||
|
||||
|
||||
$papier['bdm300'] = new Paper();
|
||||
$papier['bdm300']->setArtNr('bdm300');
|
||||
$papier['bdm300']->setDescription1('Bilderdruck matt 300 gr');
|
||||
@ -72,7 +75,6 @@ class PaperRepostory implements ObjectRepository
|
||||
$papier['bdg300']->setArtNr('bdg300');
|
||||
$papier['bdg300']->setDescription1('Bilderdruck glänzend 300 gr');
|
||||
|
||||
|
||||
$papier['INM115'] = new Paper();
|
||||
$papier['INM115']->setArtNr('INM115');
|
||||
$papier['INM115']->setGrammatur('115');
|
||||
@ -391,10 +393,42 @@ class PaperRepostory implements ObjectRepository
|
||||
$papier['621995']->setDescription1('80 g/m², Preprint, weiss');
|
||||
$papier['621995']->setDescription2('80 g/m², Preprint, weiss');
|
||||
|
||||
$papier['ct90'] = new Paper();
|
||||
$papier['ct90']->setArtNr('ct90');
|
||||
$papier['ct90']->setGrammatur('90');
|
||||
$papier['ct90']->setPreis('42.9');
|
||||
$papier['ct90']->setUmschlagen(true);
|
||||
$papier['ct90']->setStaerke(0.125);
|
||||
|
||||
$papier['ct100'] = new Paper();
|
||||
$papier['ct100']->setArtNr('ct100');
|
||||
$papier['ct100']->setGrammatur('100');
|
||||
$papier['ct100']->setPreis('42.9');
|
||||
$papier['ct100']->setUmschlagen(true);
|
||||
$papier['ct100']->setStaerke(0.125);
|
||||
|
||||
$papier['ct120'] = new Paper();
|
||||
$papier['ct120']->setArtNr('ct120');
|
||||
$papier['ct120']->setGrammatur('120');
|
||||
$papier['ct120']->setPreis('42.9');
|
||||
$papier['ct120']->setUmschlagen(true);
|
||||
$papier['ct120']->setStaerke(0.125);
|
||||
|
||||
$papier['ct160'] = new Paper();
|
||||
$papier['ct160']->setArtNr('ct160');
|
||||
$papier['ct160']->setGrammatur('160');
|
||||
$papier['ct160']->setPreis('42.9');
|
||||
$papier['ct160']->setUmschlagen(true);
|
||||
$papier['ct160']->setStaerke(0.125);
|
||||
|
||||
$papier['ct200'] = new Paper();
|
||||
$papier['ct200']->setArtNr('ct200');
|
||||
$papier['ct200']->setGrammatur('200');
|
||||
$papier['ct200']->setPreis('71.4');
|
||||
$papier['ct200']->setUmschlagen(true);
|
||||
$papier['ct200']->setStaerke(0.191);
|
||||
|
||||
return $papier[$criteria['artNr']];
|
||||
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
|
||||
Loading…
Reference in New Issue
Block a user