CalculReduction.xml 16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<?xml version="1.0" encoding="utf-8"?>
<Simulator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../doc/Simulator.xsd" name="CalculReduction" label="Calculer un prix après réduction" defaultView="particuliers" referer="" dynamic="0" memo="0">
	<Description><![CDATA[
<blockquote>Ce simulateur permet de calculer le prix après l'application d'un taux de réduction (soldes, promotion, remise, rabais, ristourne...).</blockquote>
	]]></Description>
	<DataSet dateFormat="d/m/Y" decimalPoint="," moneySymbol="€" symbolPosition="after">
		<Data id="1" name="PrixOrigine" label="Prix avant réduction" type="money" min="0.01" />
		<Data id="2" name="TauxReduction" label="Taux de réduction" type="percent" min="0.01" max="100" />
		<Data id="3" name="ValeurReduction" label="Montant de la réduction" type="money" />
		<Data id="4" name="PrixReduit" label="Prix après réduction" type="money" />
		<Data id="5" name="prixapresreduction2" label="Prix aprés réduction 2" type="money" />
		<Data id="6" name="TauxReduction2" label="2e taux de réduction" type="percent" min="0.01" max="100" />
		<DataGroup id="1" name="Cumul" label="">
			<Data id="7" name="ValeurReduction2" label="Montant de la 2e réduction" type="money" />
			<Data id="8" name="ValeurReductionTotale" label="Montant total des réductions" type="money" />
			<Data id="9" name="PrixFinal" label="Prix final" type="money" />
		</DataGroup>
		<Data id="10" name="Question_2e_Taux" label="2e taux de réduction ?" type="choice">
			<Choices>
				<Choice id="1" value="Oui" label="Oui" />
				<Choice id="2" value="Non" label="Non" />
			</Choices>
		</Data>
	</DataSet>
	<Steps>
		<Step id="1" name="CalculPrixReduit" label="Calcul du prix réduit" template="pages:article.html.twig" output="normal" dynamic="1">
			<Panels>
				<Panel id="1" name="Calcul" label="Calcul de réduction">
					<FieldSet id="1">
						<Field position="1" data="1" usage="input" newline="0" label="Indiquez ici votre prix d'origine" required="1" visibleRequired="0" colon="0" help="0">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
						<Field position="2" data="2" usage="input" newline="0" label="Indiquez le taux de réduction à appliquer" required="1" visibleRequired="0" colon="0" help="0">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
					</FieldSet>
					<FieldSet id="2">
						<Field position="1" data="3" usage="output" newline="0" label="Montant de la réduction obtenue" required="0" visibleRequired="0" colon="0" help="0" emphasize="1">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
						<Field position="2" data="4" usage="output" newline="0" label="Prix après réduction" required="0" visibleRequired="0" colon="0" help="0" emphasize="1">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
						<Field position="3" data="5" usage="output" newline="0" label="Prix après réduction" required="0" visibleRequired="0" colon="0" help="0" emphasize="1">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
					</FieldSet>
					<FieldSet id="3">
						<Field position="1" data="10" usage="input" newline="0" label="Bénéficiez-vous d'une seconde réduction ?" required="0" visibleRequired="0" colon="0" help="0" expanded="1">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
					</FieldSet>
					<FieldSet id="4">
						<Field position="1" data="6" usage="input" newline="0" label="Indiquez le 2e taux de réduction" required="0" visibleRequired="0" colon="0" help="0">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
					</FieldSet>
					<FieldSet id="5">
						<Field position="1" data="7" usage="output" newline="0" label="Montant de la 2e réduction" required="0" visibleRequired="0" colon="0" help="0">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
						<Field position="2" data="8" usage="output" newline="0" label="Montant total des réductions" required="0" visibleRequired="0" colon="0" help="0" emphasize="1">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
						<Field position="3" data="9" usage="output" newline="0" label="Prix final" required="0" visibleRequired="0" colon="0" help="0" emphasize="1">
							<PreNote><![CDATA[

							]]></PreNote>
						</Field>
					</FieldSet>
					<BlockInfo id="6" name="Merci" label="">
						<Chapter id="1" name="Merci" label="">
							<Section id="1" name="Merci" label="">
								<Content><![CDATA[
<blockquote><b>Merci d'avoir utilisé ce simulateur.</b>
</blockquote>
								]]></Content>
							</Section>
						</Chapter>
					</BlockInfo>
				</Panel>
			</Panels>
			<ActionList>
				<Action name="Nouvelle_simulation" label="Nouvelle simulation" what="reset" for="newSimulation" />
			</ActionList>
		</Step>
	</Steps>
	<BusinessRules>
		<BusinessRule id="1" name="R1" label="warning +">
			<Conditions value="#2 > 100">
				<Condition operand="TauxReduction" operator=">" expression="100" />
			</Conditions>
			<IfActions>
				<Action id="1" name="notifyWarning" target="data" data="2" value="Attention, le taux ne doit pas être supérieur à 100%" />
				<Action id="2" name="hideObject" target="fieldset" step="1" panel="1" fieldset="2" />
			</IfActions>
			<ElseActions>
				<Action id="1" name="showObject" target="fieldset" step="1" panel="1" fieldset="2" />
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="2" name="R2" label="warning -">
			<Conditions value="#2 &lt; 0">
				<Condition operand="TauxReduction" operator="&lt;" expression="0" />
			</Conditions>
			<IfActions>
				<Action id="1" name="notifyError" target="data" data="2" value="Attention, le taux ne peut pas être négatif" />
				<Action id="2" name="hideObject" target="fieldset" step="1" panel="1" fieldset="2" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="3" name="R3" label="Calcul Remise">
			<Conditions value="defined(#1) &amp;&amp; defined(#2) &amp;&amp; #2 > 0 &amp;&amp; #2 &lt;= 100">
				<Connector type="all">
					<Condition operand="PrixOrigine" operator="present" />
					<Condition operand="TauxReduction" operator="present" />
					<Condition operand="TauxReduction" operator=">" expression="0" />
					<Condition operand="TauxReduction" operator="&lt;=" expression="100" />
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="setAttribute" target="content" data="3" value="#1 * (#2 / 100)" />
				<Action id="2" name="showObject" target="fieldset" step="1" panel="1" fieldset="2" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="4" name="R4" label="Prix Réduit">
			<Conditions value="defined(#3)">
				<Condition operand="ValeurReduction" operator="present" />
			</Conditions>
			<IfActions>
				<Action id="1" name="setAttribute" target="content" data="4" value="#1 - #3" />
				<Action id="2" name="showObject" target="fieldset" step="1" panel="1" fieldset="3" />
				<Action id="3" name="hideObject" target="action" step="1" action="Nouvelle_simulation" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="5" name="R5" label="Prix Réduit 2">
			<Conditions value="defined(#3)">
				<Condition operand="ValeurReduction" operator="present" />
			</Conditions>
			<IfActions>
				<Action id="1" name="setAttribute" target="content" data="5" value="#1 - #3" />
				<Action id="2" name="showObject" target="fieldset" step="1" panel="1" fieldset="3" />
				<Action id="3" name="hideObject" target="action" step="1" action="Nouvelle_simulation" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="6" name="R6" label="warning_0">
			<Conditions value="#2 = 0">
				<Condition operand="TauxReduction" operator="=" expression="0" />
			</Conditions>
			<IfActions>
				<Action id="1" name="notifyError" target="dataset" value="Le taux ne doit pas être nul" />
				<Action id="2" name="hideObject" target="fieldset" step="1" panel="1" fieldset="2" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="7" name="R7" label="2e Réduction">
			<Conditions value="#10 = 'Non'">
				<Condition operand="Question_2e_Taux" operator="=" expression="Non" />
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="action" step="1" action="Nouvelle_simulation" />
			</IfActions>
			<ElseActions>
				<Action id="1" name="showObject" target="fieldset" step="1" panel="1" fieldset="4" />
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="8" name="R8" label="warning 2+">
			<Conditions value="#6 > 100">
				<Condition operand="TauxReduction2" operator=">" expression="100" />
			</Conditions>
			<IfActions>
				<Action id="1" name="notifyWarning" target="data" data="6" value="Attention, le taux ne doit pas être supérieur à 100%" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="9" name="R9" label="warning 2-">
			<Conditions value="#6 &lt; 0">
				<Condition operand="TauxReduction2" operator="&lt;" expression="0" />
			</Conditions>
			<IfActions>
				<Action id="1" name="notifyError" target="data" data="6" value="Attention, le taux ne peut pas être négatif" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="10" name="R10" label="Calcul Reduc 2 bis">
			<Conditions value="defined(#7)">
				<Connector type="all">
					<Condition operand="ValeurReduction2" operator="present" />
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="setAttribute" target="content" data="8" value="#3 + #7" />
				<Action id="2" name="setAttribute" target="content" data="9" value="#4 - #7" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="11" name="R11" label="Reduc 2">
			<Conditions value="defined(#6)">
				<Connector type="all">
					<Condition operand="TauxReduction2" operator="present" />
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="setAttribute" target="content" data="7" value="#4 * (#6 / 100)" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="12" name="R12" label="Affichage départ">
			<Conditions value="defined(#1) &amp;&amp; defined(#2) &amp;&amp; #2 > 0 &amp;&amp; #2 &lt;= 100">
				<Connector type="all">
					<Condition operand="PrixOrigine" operator="present" />
					<Condition operand="TauxReduction" operator="present" />
					<Condition operand="TauxReduction" operator=">" expression="0" />
					<Condition operand="TauxReduction" operator="&lt;=" expression="100" />
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="fieldset" step="1" panel="1" fieldset="2" />
				<Action id="2" name="showObject" target="fieldset" step="1" panel="1" fieldset="3" />
			</IfActions>
			<ElseActions>
				<Action id="1" name="hideObject" target="fieldset" step="1" panel="1" fieldset="2" />
				<Action id="2" name="hideObject" target="fieldset" step="1" panel="1" fieldset="3" />
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="13" name="R13" label="affiche 2e partie">
			<Conditions value="defined(#1) &amp;&amp; defined(#2) &amp;&amp; defined(#10) &amp;&amp; #10 = 'Oui'">
				<Connector type="all">
					<Condition operand="PrixOrigine" operator="present" />
					<Condition operand="TauxReduction" operator="present" />
					<Condition operand="Question_2e_Taux" operator="present" />
					<Condition operand="Question_2e_Taux" operator="=" expression="Oui" />
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="field" step="1" panel="1" fieldset="4" field="1" />
			</IfActions>
			<ElseActions>
				<Action id="1" name="hideObject" target="field" step="1" panel="1" fieldset="4" field="1" />
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="14" name="R14" label="afficher 3eme partie">
			<Conditions value="defined(#1) &amp;&amp; defined(#2) &amp;&amp; defined(#10) &amp;&amp; #10 = 'Oui' &amp;&amp; defined(#6) &amp;&amp; #6 >= 0 &amp;&amp; #6 &lt; 100">
				<Connector type="all">
					<Condition operand="PrixOrigine" operator="present" />
					<Condition operand="TauxReduction" operator="present" />
					<Condition operand="Question_2e_Taux" operator="present" />
					<Condition operand="Question_2e_Taux" operator="=" expression="Oui" />
					<Condition operand="TauxReduction2" operator="present" />
					<Condition operand="TauxReduction2" operator=">=" expression="0" />
					<Condition operand="TauxReduction2" operator="&lt;" expression="100" />
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="fieldset" step="1" panel="1" fieldset="5" />
			</IfActions>
			<ElseActions>
				<Action id="1" name="hideObject" target="fieldset" step="1" panel="1" fieldset="5" />
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="15" name="R15" label="Affiche bouton">
			<Conditions value="(defined(#1) &amp;&amp; defined(#2) &amp;&amp; defined(#10) &amp;&amp; #10 = 'Non') || (defined(#1) &amp;&amp; defined(#2) &amp;&amp; defined(#6) &amp;&amp; #10 = 'Oui' &amp;&amp; defined(#6) &amp;&amp; #6 >= 0 &amp;&amp; #6 &lt;= 100)">
				<Connector type="any">
					<Connector type="all">
						<Condition operand="PrixOrigine" operator="present" />
						<Condition operand="TauxReduction" operator="present" />
						<Condition operand="Question_2e_Taux" operator="present" />
						<Condition operand="Question_2e_Taux" operator="=" expression="Non" />
					</Connector>
					<Connector type="all">
						<Condition operand="PrixOrigine" operator="present" />
						<Condition operand="TauxReduction" operator="present" />
						<Condition operand="TauxReduction2" operator="present" />
						<Condition operand="Question_2e_Taux" operator="=" expression="Oui" />
						<Condition operand="TauxReduction2" operator="present" />
						<Condition operand="TauxReduction2" operator=">=" expression="0" />
						<Condition operand="TauxReduction2" operator="&lt;=" expression="100" />
					</Connector>
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="blockinfo" step="1" panel="1" blockinfo="6" />
				<Action id="2" name="showObject" target="action" step="1" action="Nouvelle_simulation" />
			</IfActions>
			<ElseActions>
				<Action id="1" name="hideObject" target="blockinfo" step="1" panel="1" blockinfo="6" />
				<Action id="2" name="hideObject" target="action" step="1" action="Nouvelle_simulation" />
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="16" name="R16" label="afficher prixreductionBig et cacher small">
			<Conditions value="defined(#1) &amp;&amp; defined(#2) &amp;&amp; (!defined(#10) || #10 = 'Non')">
				<Connector type="all">
					<Condition operand="PrixOrigine" operator="present" />
					<Condition operand="TauxReduction" operator="present" />
					<Connector type="any">
						<Condition operand="Question_2e_Taux" operator="blank" />
						<Condition operand="Question_2e_Taux" operator="=" expression="Non" />
					</Connector>
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="field" step="1" panel="1" fieldset="2" field="2" />
				<Action id="2" name="hideObject" target="field" step="1" panel="1" fieldset="2" field="3" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
		<BusinessRule id="17" name="R17" label="afficher prix recduction small et cacher big">
			<Conditions value="defined(#1) &amp;&amp; defined(#2) &amp;&amp; (defined(#10) &amp;&amp; #10 = 'Oui')">
				<Connector type="all">
					<Condition operand="PrixOrigine" operator="present" />
					<Condition operand="TauxReduction" operator="present" />
					<Connector type="all">
						<Condition operand="Question_2e_Taux" operator="present" />
						<Condition operand="Question_2e_Taux" operator="=" expression="Oui" />
					</Connector>
				</Connector>
			</Conditions>
			<IfActions>
				<Action id="1" name="showObject" target="field" step="1" panel="1" fieldset="2" field="3" />
				<Action id="2" name="hideObject" target="field" step="1" panel="1" fieldset="2" field="2" />
			</IfActions>
			<ElseActions>
			</ElseActions>
		</BusinessRule>
	</BusinessRules>
</Simulator>