Fix Checkbox
This commit is contained in:
parent
5cfcfdbf4b
commit
c13767b01b
@ -285,4 +285,13 @@ class Base
|
||||
{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
public function toArray() : array {
|
||||
return [
|
||||
'id' => $this->getId(),
|
||||
'name' => $this->getName(),
|
||||
'type' => $this->getType(),
|
||||
'valid' => $this->isValid()
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,21 @@ class Checkbox extends Base
|
||||
*/
|
||||
public function processValue()
|
||||
{
|
||||
|
||||
if(is_array($this->rawValue)) {
|
||||
/** @var \PSC\Library\Calc\Option\Type\Checkbox\Opt $item */
|
||||
foreach($this->options as $item) {
|
||||
if(in_array($item->getId(), $this->rawValue)) {
|
||||
$item->setIsSelected(true);
|
||||
}
|
||||
}
|
||||
}elseif($this->rawValue != "") {
|
||||
/** @var \PSC\Library\Calc\Option\Type\Checkbox\Opt $item */
|
||||
foreach($this->options as $item) {
|
||||
if($item->getId() == $this->rawValue) {
|
||||
$item->setIsSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,10 +54,24 @@ class Checkbox extends Base
|
||||
|
||||
public function getSelectedOptions()
|
||||
{
|
||||
$tmp = [];
|
||||
|
||||
/** @var Opt $opt */
|
||||
foreach($this->getOptions() as $opt) {
|
||||
if($opt->isSelected()) return $opt;
|
||||
if($opt->isSelected()) $tmp[] = $opt;
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
$tmp = array();
|
||||
foreach($this->getSelectedOptions() as $option) {
|
||||
$tmp[] = $option->getLabel();
|
||||
}
|
||||
|
||||
return implode(", ", $tmp);
|
||||
}
|
||||
|
||||
}
|
||||
46
tests/Customer/K/CalcTest.php
Normal file
46
tests/Customer/K/CalcTest.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace PSC\Library\Calc\Tests\Customer\K;
|
||||
|
||||
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 \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Engine */
|
||||
protected $engine = null;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$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()
|
||||
{
|
||||
$this->engine = null;
|
||||
}
|
||||
|
||||
public function testCalcPlan()
|
||||
{
|
||||
$this->engine->setVariable('anz_ausfuhren', 2500);
|
||||
/** @var Select $option */
|
||||
$option = $this->engine->getArticle()->getOptionById('tarif');
|
||||
var_dump($option->getSelectedOption());
|
||||
}
|
||||
}
|
||||
529
tests/Customer/K/calc.xml
Normal file
529
tests/Customer/K/calc.xml
Normal file
@ -0,0 +1,529 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<kalkulation>
|
||||
<artikel>
|
||||
<name>Import Filing CHIEF</name>
|
||||
<kommentar>Testkalkulation</kommentar>
|
||||
|
||||
<uploads>
|
||||
<upload id="neutral" name="Druckdaten" description="Bitte laden sie eine PDF für den Druck hoch"/>
|
||||
</uploads>
|
||||
|
||||
|
||||
<!-- ab hier beginnt die Eingabemaske -->
|
||||
<option id="de" name="ATLAS" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="100" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="fr" name="DELTA" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="nl" name="AGS" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="pl" name="PUESC" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="uk" name="CHIEF-CDS" type="Hidden" default="1" >
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="at" name="e-zoll" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="ch" name="e-dec" type="Hidden" default="0">
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="bg" name="PLDA" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="dk" name="SKAT" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
<option id="sw" name="TDS" type="Hidden" default="0" >
|
||||
<opt id="0" name="nein"></opt>
|
||||
<opt id="1" name="JA"></opt>
|
||||
</option>
|
||||
|
||||
//Neue Lizenz CSP Badge 28.22.2020
|
||||
<option id="csp" name="Request badge from AEB" type="Select" default="1">
|
||||
<opt id="0" name="No"></opt>
|
||||
<opt id="1" name="Yes"></opt>
|
||||
</option>
|
||||
|
||||
<option id="anz_ausfuhren" name="Annual number of import declarations" type="Input" default="100"/>
|
||||
|
||||
<option id="anz_user" name="Anzahl Anwender" type="Hidden" default="1">
|
||||
<opt id="1" name="1 Anwender"></opt>
|
||||
<opt id="2" name="2 Anwender"></opt>
|
||||
<opt id="3" name="3 Anwender"></opt>
|
||||
<opt id="4" name="4 Anwender"></opt>
|
||||
<opt id="5" name="5 Anwender"></opt>
|
||||
<opt id="6" name="6 Anwender"></opt>
|
||||
<opt id="7" name="7 Anwender"></opt>
|
||||
<opt id="8" name="8 Anwender"></opt>
|
||||
<opt id="9" name="9 Anwender"></opt>
|
||||
<opt id="10" name="10 Anwender"></opt>
|
||||
<opt id="11" name="11 Anwender"></opt>
|
||||
<opt id="12" name="12 Anwender"></opt>
|
||||
<opt id="13" name="13 Anwender"></opt>
|
||||
<opt id="14" name="14 Anwender"></opt>
|
||||
<opt id="15" name="15 Anwender"></opt>
|
||||
<opt id="16" name="16 Anwender"></opt>
|
||||
<opt id="17" name="17 Anwender"></opt>
|
||||
<opt id="18" name="18 Anwender"></opt>
|
||||
<opt id="19" name="19 Anwender"></opt>
|
||||
<opt id="20" name="20 Anwender"></opt>
|
||||
<opt id="21" name="21 Anwender"></opt>
|
||||
<opt id="22" name="22 Anwender"></opt>
|
||||
<opt id="23" name="23 Anwender"></opt>
|
||||
<opt id="24" name="24 Anwender"></opt>
|
||||
<opt id="25" name="25 Anwender"></opt>
|
||||
</option>
|
||||
|
||||
<option id="zusatzopt_txt" name="----------------------- Additional options -----------------------" type="Text" default=""/>
|
||||
|
||||
|
||||
<!-- Würde auch für Reporting benötigt, funktioniert aber leider nicht -->
|
||||
|
||||
|
||||
//Diese Option gibt es für Deutschland noch nicht!!
|
||||
//Zum Start noch nicht verfügbar
|
||||
<option id="reporting" name="Reporting und Analytics 1 System" type="Hidden" default="0">
|
||||
<opt id="0" name="No"></opt>
|
||||
<opt id="1" name="Yes"></opt>
|
||||
</option>
|
||||
|
||||
|
||||
//Diese Option gibt es nur für die Schweiz
|
||||
<option id="evv" name="eVV und bordereau" type="Select" default="0">
|
||||
<grenzen>
|
||||
<ch>
|
||||
<grenze>1</grenze>
|
||||
</ch>
|
||||
</grenzen>
|
||||
<opt id="0" name="Nein"></opt>
|
||||
<opt id="1" name="Ja"></opt>
|
||||
</option>
|
||||
|
||||
//Diese Option gibt es nur für Belgien
|
||||
<option id="port_notification" name="Port Notification (C-Port)" type="Select" default="0">
|
||||
<grenzen>
|
||||
<bg>
|
||||
<grenze>1</grenze>
|
||||
</bg>
|
||||
</grenzen>
|
||||
<opt id="0" name="Nein"></opt>
|
||||
<opt id="1" name="Ja"></opt>
|
||||
</option>
|
||||
|
||||
//Diese Option gibt es nur für Deutschland
|
||||
<option id="transitverfahren" name="Transitverfahren (NCTS Zugelassener Empfänger (ZE))" type="Select" default="0">
|
||||
<grenzen>
|
||||
<de>
|
||||
<grenze>100</grenze>
|
||||
</de>
|
||||
</grenzen>
|
||||
<opt id="0" name="Nein"></opt>
|
||||
<opt id="1" name="Ja"></opt>
|
||||
</option>
|
||||
|
||||
//Diese Option gibt es nur für Deutschland -> Tarifwechsel, nicht in Starter möglich
|
||||
<option id="archivierung" name="Archivierung" type="Select" default="0">
|
||||
<grenzen>
|
||||
<de>
|
||||
<grenze>100</grenze>
|
||||
</de>
|
||||
</grenzen>
|
||||
<opt id="0" name="Nein"></opt>
|
||||
<opt id="1" name="Ja"></opt>
|
||||
</option>
|
||||
|
||||
|
||||
//Diese Option gibt es nur für Niederlande
|
||||
<option id="transitverfahren_ncts_ta" name="Transitverfahren (NCTS Toegelaten Afzender (TA))" type="Select" default="0">
|
||||
<grenzen>
|
||||
<nl>
|
||||
<grenze>1</grenze>
|
||||
</nl>
|
||||
</grenzen>
|
||||
<opt id="0" name="Nein"></opt>
|
||||
<opt id="1" name="Ja"></opt>
|
||||
</option>
|
||||
|
||||
//Diese Option gibt es nur für UK
|
||||
<option id="transitverfahren_ncts_ce" name="Transit procedure (NCTS Authorized Consignee (CE))" type="Select" default="0">
|
||||
<grenzen>
|
||||
<uk>
|
||||
<grenze>1</grenze>
|
||||
</uk>
|
||||
</grenzen>
|
||||
<opt id="0" name="No"></opt>
|
||||
<opt id="1" name="Yes"></opt>
|
||||
</option>
|
||||
|
||||
|
||||
<option id="integrationen_txt" name="----------------------- Integrations -----------------------" type="Text" default=""/>
|
||||
|
||||
//Diese Option gibt es OHNE Aufpreis; Projektarbeit, deshalb keine Bestellung möglich
|
||||
<option id="erp_plugin" name="ERP plug-ins (request quote from sales)" type="Select" default="0">
|
||||
<opt id="0" name="No"></opt>
|
||||
<opt id="1" name="Yes"></opt>
|
||||
</option>
|
||||
|
||||
|
||||
<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
|
||||
<!-- Beginn Kalkulation - Beginn Kalkulation - Beginn Kalkulation - Beginn Kalkulation -->
|
||||
<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
|
||||
|
||||
<!-- ANFANG Ermittlung Anzahl Länder für den Tarifwechsel -->
|
||||
<option id="anzahl_laender" name="anzahl_laender" type="Hidden" default="1">
|
||||
<ch>
|
||||
<grenze calc_value="$Vch$V+$Vbg$V+$Vde$V+$Vnl$V+$Vuk$V">0,1</grenze>
|
||||
</ch>
|
||||
</option>
|
||||
<!-- ENDE Ermittlung Anzahl Länder für den Tarifwechsel -->
|
||||
|
||||
|
||||
<!-- Berechnung des Tarifmodells auf Basis Länder, Anz. User und Anz. Ausfuhren -->
|
||||
<option id="monatspreis" name="monatspreis" type="Hidden" default="1">
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze value="1,100"> //Länder
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="$Ptarif_basic_import$P">1-1299</grenze> //Ausfuhren
|
||||
</anz_ausfuhren>
|
||||
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="$Ptarif_business_import$P">1300-6249</grenze> //Ausfuhren
|
||||
</anz_ausfuhren>
|
||||
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="$Ptarif_enterprise_import$P">6250-</grenze> //Ausfuhren
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="2,3,101,102"> //Länder
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="$Ptarif_business_import$P">1-6249</grenze> //Ausfuhren
|
||||
</anz_ausfuhren>
|
||||
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="$Ptarif_enterprise_import$P">6250-</grenze> //Ausfuhren
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="4,5,6,7,8,9,10,101-"> //Länder
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="$Ptarif_enterprise_import$P">1-</grenze> //Ausfuhren
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
</anzahl_laender>
|
||||
</option>
|
||||
|
||||
|
||||
|
||||
//Berechnung des Tarifmodells - Nach der Berechnung des Monatspreises
|
||||
<option id="tarif" name="Calculated price plan" type="Select" default="2" >
|
||||
<opt id="1" name="Starter">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
<grenze>1-33</grenze> // Anzeige Starter
|
||||
</monatspreis>
|
||||
</opt>
|
||||
<opt id="2" name="Basic">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
<grenze>34-92</grenze> // Anzeige Basic
|
||||
</monatspreis>
|
||||
</opt>
|
||||
<opt id="2" name="Business">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
<grenze>93-626</grenze> // Anzeige Business
|
||||
</monatspreis>
|
||||
</opt>
|
||||
<opt id="2" name="Enterprise">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
<grenze>627-</grenze> // Anzeige Enterprise
|
||||
</monatspreis>
|
||||
</opt>
|
||||
</option>
|
||||
|
||||
|
||||
<!-- Berechnung des Aufpreises der Ausfuhren -->
|
||||
|
||||
<option id="transaktionen" name="transaktionen" type="Hidden" default="1" exportAjax="1">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
|
||||
<grenze value="92"> //Basic bis 100 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="0">1-100</grenze>
|
||||
<grenze formel="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_basic_import$P)*$Pkosten_ausfuhren_basic_import$P/12">101-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="626"> //Business bis 2500 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="0">1-2500</grenze>
|
||||
<grenze formel="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_business_import$P)*$Pkosten_ausfuhren_business_import$P/12">2501-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1843"> //Enterprise bis 10000 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="0">1-10000</grenze>
|
||||
<grenze formel="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_enterprise_import$P)*$Pkosten_ausfuhren_enterprise_import$P/12">10001-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
</monatspreis>
|
||||
</option>
|
||||
|
||||
<option id="transaktionen_calc_value" name="transaktionen_calc_value" type="Hidden" default="1">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
|
||||
<grenze value="92"> //Basic bis 100 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="0">1-100</grenze>
|
||||
<grenze calc_value="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_basic_import$P)*$Pkosten_ausfuhren_basic_import$P/12">101-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="626"> //Business bis 2500 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="0">1-2500</grenze>
|
||||
<grenze calc_value="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_business_import$P)*$Pkosten_ausfuhren_business_import$P/12">2501-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1843"> //Enterprise bis 10000 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="0">1-10000</grenze>
|
||||
<grenze calc_value="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_enterprise_import$P)*$Pkosten_ausfuhren_enterprise_import$P/12">10001-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
</monatspreis>
|
||||
</option>
|
||||
|
||||
|
||||
<option id="transaktionen_anzeige" name="transaktionen_anzeige" type="Hidden" default="1">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
|
||||
<grenze value="92"> //Basic bis 100 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="0">1-100</grenze>
|
||||
<grenze formel="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_basic_import$P)*$Pkosten_ausfuhren_basic_import$P/12">101-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="626"> //Business bis 2500 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="0">1-2500</grenze>
|
||||
<grenze formel="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_business_import$P)*$Pkosten_ausfuhren_business_import$P/12">2501-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1843"> //Enterprise bis 10000 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="0">1-10000</grenze>
|
||||
<grenze formel="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_enterprise_import$P)*$Pkosten_ausfuhren_enterprise_import$P/12">10001-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
</monatspreis>
|
||||
</option>
|
||||
|
||||
|
||||
// 1. Nur für Jahressumme
|
||||
<option id="transaktionen_jahressumme" name="transaktionen_jahressumme" type="Hidden" default="1">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
|
||||
<grenze value="92"> //Basic bis 100 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="0">1-100</grenze>
|
||||
<grenze calc_value="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_basic_import$P)*$Pkosten_ausfuhren_basic_import$P">101-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="626"> //Business bis 2500 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="0">1-2500</grenze>
|
||||
<grenze calc_value="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_business_import$P)*$Pkosten_ausfuhren_business_import$P/12">2501-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1843"> //Enterprise bis 10000 Ausfuhren enthalten
|
||||
<anz_ausfuhren>
|
||||
<grenze calc_value="0">1-10000</grenze>
|
||||
<grenze calc_value="($Vanz_ausfuhren$V-$Penthaltene_ausfuhren_enterprise_import$P)*$Pkosten_ausfuhren_enterprise_import$P/12">10001-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</grenze>
|
||||
|
||||
</monatspreis>
|
||||
</option>
|
||||
|
||||
|
||||
|
||||
<!-- Berechnung Reporting und Analytics (nicht für DE, sobald ein 2. Land dazu kommt, dann ja) -->
|
||||
<option id="kosten_reporting" name="kosten_reporting" type="Hidden" default="1">
|
||||
<monatspreis formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">
|
||||
<grenze value="33"> //Bei Starter
|
||||
<reporting>
|
||||
<grenze formel="0">0,1</grenze>
|
||||
</reporting>
|
||||
</grenze>
|
||||
|
||||
<grenze value="102"> //Bei Basic
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze value="100">
|
||||
<de> // Prüfung bei einem Land, ob DE
|
||||
<grenze value="100">
|
||||
<reporting>
|
||||
<grenze formel="0">0,1</grenze> // Wenn DE, dann 0
|
||||
</reporting>
|
||||
</grenze>
|
||||
</de>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1-10,101-120"> // Wenn mehr als ein Land, dann berechnen
|
||||
<reporting>
|
||||
<grenze formel="0">0</grenze>
|
||||
<grenze formel="30">1</grenze>
|
||||
</reporting>
|
||||
</grenze>
|
||||
</anzahl_laender>
|
||||
</grenze>
|
||||
|
||||
<grenze value="395"> //Bei Business
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze value="100">
|
||||
<de>
|
||||
<grenze value="100">
|
||||
<reporting>
|
||||
<grenze formel="0">0,1</grenze>
|
||||
</reporting>
|
||||
</grenze>
|
||||
</de>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1-10,101-120">
|
||||
<reporting>
|
||||
<grenze formel="0">0</grenze>
|
||||
<grenze formel="60">1</grenze>
|
||||
</reporting>
|
||||
</grenze>
|
||||
</anzahl_laender>
|
||||
</grenze>
|
||||
|
||||
<grenze value="2048"> //Bei Enterprise
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze value="100">
|
||||
<de>
|
||||
<grenze value="1">
|
||||
<reporting>
|
||||
<grenze formel="0">0,1</grenze>
|
||||
</reporting>
|
||||
</grenze>
|
||||
</de>
|
||||
</grenze>
|
||||
|
||||
<grenze value="1-10,101-120">
|
||||
<reporting>
|
||||
<grenze formel="0">0</grenze>
|
||||
<grenze formel="315">1</grenze>
|
||||
</reporting>
|
||||
</grenze>
|
||||
</anzahl_laender>
|
||||
</grenze>
|
||||
|
||||
</monatspreis>
|
||||
</option>
|
||||
|
||||
// CSP Badge pro Monat (28.11.2020)
|
||||
<!-- Berechnung CSP Badge pro Monat-->
|
||||
<option id="csp_licence" name="csp_licence" type="Hidden" default="1" exportAjax="1">
|
||||
<csp>
|
||||
<grenze formel="0">0</grenze>
|
||||
<grenze formel="$Pcsp_badge_licence$P">1</grenze>
|
||||
</csp>
|
||||
</option>
|
||||
|
||||
<option id="csp_licence_anzeige" name="csp_licence_anzeige" type="Hidden" default="1">
|
||||
<csp>
|
||||
<grenze formel="0">0</grenze>
|
||||
<grenze formel="$Pcsp_badge_licence$P">1</grenze>
|
||||
</csp>
|
||||
</option>
|
||||
|
||||
// CSP Badge pro Transaktion = 1$ (28.11.2020)
|
||||
|
||||
<option id="csp_declaration" name="csp_declaration" type="Hidden" default="1" exportAjax="1">
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="$Pcsp_per_declaration$P*$Vanz_ausfuhren$V/12">1-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</option>
|
||||
|
||||
<option id="csp_declaration_anzeige" name="csp_declaration_anzeige" type="Hidden" default="1">
|
||||
<anz_ausfuhren>
|
||||
<grenze formel="$Pcsp_per_declaration$P*$Vanz_ausfuhren$V/12">1-</grenze>
|
||||
</anz_ausfuhren>
|
||||
</option>
|
||||
|
||||
|
||||
<!-- Berechnung SAP Schnittstelle -->
|
||||
<option id="sap" name="sap" type="Hidden" default="1">
|
||||
<sap_plugin>
|
||||
<grenze formel="0">0</grenze>
|
||||
<grenze formel="(250+250)">1</grenze>
|
||||
<grenze formel="(250+1000)">2</grenze>
|
||||
</sap_plugin>
|
||||
</option>
|
||||
|
||||
<option id="summe_aeb" name="summe_aeb" type="Hidden" default="1" exportAjax="1">
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">1-</grenze>
|
||||
</anzahl_laender>
|
||||
</option>
|
||||
|
||||
|
||||
<option id="summe_aeb_anzeige" name="summe_aeb_anzeige" type="Hidden" default="1">
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze formel="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV">1-</grenze>
|
||||
</anzahl_laender>
|
||||
</option>
|
||||
|
||||
|
||||
// 2. Nur für Jahressumme
|
||||
<option id="summe_aeb_aufs_jahr" name="summe_aeb_aufs_jahr" type="Hidden" default="1">
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze calc_value="$CVmonatspreis_anzahl_laender_anz_ausfuhren$CV*12">1-</grenze>
|
||||
</anzahl_laender>
|
||||
</option>
|
||||
|
||||
// Jahressumme nur für Angebotsausgabe
|
||||
<option id="jahressumme_der_monatlichen_kosten" name="jahressumme_der_monatlichen_kosten" type="Hidden" default="1" exportAjax="1">
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze formel="($CVtransaktionen_jahressumme_monatspreis$CV)+($CVsumme_aeb_aufs_jahr_anzahl_laender$CV)">1-</grenze>
|
||||
</anzahl_laender>
|
||||
</option>
|
||||
|
||||
<option id="calc_voucher" name="calc_voucher" type="Hidden" default="1" exportAjax="1">
|
||||
<anzahl_laender formel="$CVanzahl_laender_ch$CV">
|
||||
<grenze formel="($CVmonatspreis_anzahl_laender_anz_ausfuhren$CV+$CVtransaktionen_calc_value_monatspreis_anz_ausfuhren$CV)*1.20">1-</grenze>
|
||||
</anzahl_laender>
|
||||
</option>
|
||||
|
||||
</artikel>
|
||||
</kalkulation>
|
||||
2
tests/Customer/K/calcTemplates.xml
Normal file
2
tests/Customer/K/calcTemplates.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<root>
|
||||
</root>
|
||||
0
tests/Customer/K/formels.txt
Normal file
0
tests/Customer/K/formels.txt
Normal file
4
tests/Customer/K/papierContainer.xml
Normal file
4
tests/Customer/K/papierContainer.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<container>
|
||||
|
||||
</container>
|
||||
80
tests/Customer/K/parameters.txt
Normal file
80
tests/Customer/K/parameters.txt
Normal file
@ -0,0 +1,80 @@
|
||||
// AEB Exportfilling
|
||||
|
||||
//Tairfe pro Monat Export
|
||||
$tarif_starter=33;
|
||||
$tarif_basic=92;
|
||||
$tarif_business=356;
|
||||
$tarif_enterprise=1843;
|
||||
|
||||
//Tairfe pro Monat Export Brexit
|
||||
$tarif_starter_brexit=33;
|
||||
$tarif_basic_brexit=92;
|
||||
$tarif_business_brexit=356;
|
||||
$tarif_enterprise_brexit=1843;
|
||||
|
||||
//Schwellwerte für Tarifwechsel Export
|
||||
//bis jetzt nich verwendbar in Grenzen
|
||||
$schwellwert_starter=158;
|
||||
$schwellwert_basic=1374;
|
||||
$schwellwert_business=13749;
|
||||
$schwellwert_enterprise_ab=13750;
|
||||
|
||||
//enthaltene Ausfuhren Export
|
||||
$enthaltene_ausfuhren_starter=25;
|
||||
$enthaltene_ausfuhren_basic=250;
|
||||
$enthaltene_ausfuhren_business=2500;
|
||||
$enthaltene_ausfuhren_enterprise=25000;
|
||||
|
||||
//enthaltene Ausfuhren Export Brexit
|
||||
$enthaltene_ausfuhren_starter_brexit=50;
|
||||
$enthaltene_ausfuhren_basic_brexit=250;
|
||||
$enthaltene_ausfuhren_business_brexit=2500;
|
||||
$enthaltene_ausfuhren_enterprise_brexit=25000;
|
||||
|
||||
// Setup-Kosten
|
||||
$setup_exportfilling=600;
|
||||
|
||||
//SAP Setup einmalig Export filing Chief
|
||||
$sap_export_filing_chief_ecc=5700;
|
||||
$sap_export_filing_chief_hana=7600;
|
||||
|
||||
//SAP monatlich Export filing Chief
|
||||
$sap_export_filing_chief_monatlich=225;
|
||||
|
||||
// Setup-Kosten Export Brexit
|
||||
$setup_export_starter_brexit=0;
|
||||
$setup_export_basic_brexit=0;
|
||||
$setup_export_business_brexit=0;
|
||||
$setup_export_enterprise_brexit=600;
|
||||
|
||||
//Kosten zusätzliche Ausfuhren Export
|
||||
$kosten_ausfuhren_starter=3.60;
|
||||
$kosten_ausfuhren_basic=2.82;
|
||||
$kosten_ausfuhren_business=1.59;
|
||||
$kosten_ausfuhren_enterprise=0.88;
|
||||
|
||||
//Kosten zusätzliche Ausfuhren Export Brexit
|
||||
$kosten_ausfuhren_starter_brexit=3.60;
|
||||
$kosten_ausfuhren_basic_brexit=2.82;
|
||||
$kosten_ausfuhren_business_brexit=1.59;
|
||||
$kosten_ausfuhren_enterprise_brexit=0.88;
|
||||
|
||||
//AEB Importfilling
|
||||
//Tarife pro Monat Import
|
||||
$tarif_basic_import=92;
|
||||
$tarif_business_import=626;
|
||||
$tarif_enterprise_import=1843;
|
||||
|
||||
//enthaltene Ausfuhren Import
|
||||
$enthaltene_ausfuhren_basic_import=100;
|
||||
$enthaltene_ausfuhren_business_import=2500;
|
||||
$enthaltene_ausfuhren_enterprise_import=10000;
|
||||
|
||||
//Kosten zusätzliche Ausfuhren Import
|
||||
$kosten_ausfuhren_basic_import=5.34;
|
||||
$kosten_ausfuhren_business_import=3.89;
|
||||
$kosten_ausfuhren_enterprise_import=2.21;
|
||||
|
||||
// Lizenzkosten CSP Badge Licence
|
||||
$csp_badge_licence=127.5;
|
||||
$csp_per_declaration=1;
|
||||
53
tests/Customer/L/CalcTest.php
Normal file
53
tests/Customer/L/CalcTest.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace PSC\Library\Calc\Tests\Customer\L;
|
||||
|
||||
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 \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/** @var Engine */
|
||||
protected $engine = null;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$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()
|
||||
{
|
||||
$this->engine = null;
|
||||
}
|
||||
|
||||
public function testCalcPlan()
|
||||
{
|
||||
$article = $this->engine->getArticle();
|
||||
$option = $article->getOptionById('kalender_typ2');
|
||||
$this->assertEquals("BASIC, PERFORMANCE", $option->getValue());
|
||||
}
|
||||
|
||||
public function testCalcVarPlan()
|
||||
{
|
||||
$this->engine->setVariable('kalender_typ2', ["1", "4"]);
|
||||
$article = $this->engine->getArticle();
|
||||
$option = $article->getOptionById('kalender_typ2');
|
||||
$this->assertEquals("BASIC, PRIMARY", $option->getValue());
|
||||
}
|
||||
}
|
||||
33
tests/Customer/L/calc.xml
Normal file
33
tests/Customer/L/calc.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<kalkulation>
|
||||
<artikel>
|
||||
<name>Kalkulation EduPlaner</name>
|
||||
<kommentar>Gratis Schulplaner</kommentar>
|
||||
<uploads>
|
||||
<upload id="neutral" name="Druckdaten" description="Bitte laden sie eine PDF für den Druck hoch"/>
|
||||
</uploads>
|
||||
|
||||
// EINGABE *******************************************************************************
|
||||
|
||||
<option id="kalender_typ2" name="Bitte senden Sie mir folgende Muster-Kalender:" type="Checkbox" default="1,2">
|
||||
<opt id="1" name="BASIC"></opt>
|
||||
<opt id="2" name="PERFORMANCE"></opt>
|
||||
<opt id="3" name="PURE"></opt>
|
||||
<opt id="4" name="PRIMARY"></opt>
|
||||
</option>
|
||||
|
||||
<option id="hinweis" name="Hinweis:" type="Text" default="Papiermuster, Mustercover und Musterseiten liegen jeder Sendung bei."></option>
|
||||
|
||||
|
||||
|
||||
// KALKULATION ***************************************************************************
|
||||
|
||||
<option id="gesamtsumme_mit_produktionszeitzuschlag" name="gesamtsumme_mit_produktionszeitzuschlag" type="Hidden" default="1">
|
||||
<auflage>
|
||||
<grenze formel="(0)">0-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
|
||||
</artikel>
|
||||
</kalkulation>
|
||||
2
tests/Customer/L/calcTemplates.xml
Normal file
2
tests/Customer/L/calcTemplates.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<root>
|
||||
</root>
|
||||
0
tests/Customer/L/formels.txt
Normal file
0
tests/Customer/L/formels.txt
Normal file
4
tests/Customer/L/papierContainer.xml
Normal file
4
tests/Customer/L/papierContainer.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<container>
|
||||
|
||||
</container>
|
||||
0
tests/Customer/L/parameters.txt
Normal file
0
tests/Customer/L/parameters.txt
Normal file
Loading…
Reference in New Issue
Block a user