Categorie: reference Bijgewerkt: 2026-04-08 actionfield workflow actionfield1579

ActionField1579

Beschrijving: Set CurrencyFields for the Purchase. Custom: Nee

Propertiesbewerken

Property Type Accessor
Purchase Purchase Root

XMLbewerken

<Workflow Name="ActionField1579" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Set CurrencyFields for the Purchase.</Description>
	<Properties>
		<Property	Name="Purchase"			Type="Purchase"				Accessor="Root"		Direction="In" />

		<Property	Name="PurchaseLines"	Type="List[PurchaseLine]"	Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<Choose Name="Purchase has Vendor">
				<When Name="Purchase has Vendor" Condition="${Purchase.Vendor} != Empty">
					<Assign Name="Set Currency" Property="${Purchase.Currency}" Value="${Purchase.Vendor.Currency}" />

					<Command Name="FindExchangeRate" CommandName="FindExchangeRate">
						<Parameter	Name="CounterCurrency"	Direction="In"		Value="${Purchase.Currency}" />
						<Parameter	Name="Date"				Direction="In"		Value="#{Environment.CurrentDateTime}" />
						<Parameter	Name="ConversionFactor"	Direction="Out"												OutputProperty="${Purchase.CurrencyConversionFactor}" />
						<Parameter	Name="Rate"				Direction="Out"												OutputProperty="${Purchase.CurrencyRate}" />
					</Command>
				</When>

				<Otherwise Name="Purchase has No Vendor">
					<Assign Name="Set Currency to Empty" Property="${Purchase.Currency}" Value="#{Company.Currency}" />
					<Assign Name="Set CurrencyConversionFactor to 1" Property="${Purchase.CurrencyConversionFactor}" Value="1" />
					<Assign Name="Set CurrencyRate to 1" Property="${Purchase.CurrencyRate}" Value="1" />
				</Otherwise>
			</Choose>

			<GetList Name="Get PurchaseLines" Type="PurchaseLine" OutputProperty="${PurchaseLines}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="Id.Purchase"	Operator="="		PropertyValue="${Purchase}" />
				</Filters>
			</GetList>

			<ForEach Name="Foreach PurchaseLine" In="${PurchaseLines}" As="PurchaseLine">
				<When Name="Purchase has CurrencyConversionFactor" Condition="${Purchase.CurrencyConversionFactor} != 0">
					<Assign Name="Set pchl Currency" Property="${PurchaseLine.Currency}" Value="${Purchase.Currency}" />

					<Command Name="CalculateCurrency" CommandName="CalculateCurrency">
						<Parameter	Name="ConversionFactor"	Direction="In"		Value="${Purchase.CurrencyConversionFactor}" />
						<Parameter	Name="Decimals"			Direction="In"		Value="${PurchaseLine.TotalPrice.DecimalDigits}" />
						<Parameter	Name="Rate"				Direction="In"		Value="${Purchase.CurrencyRate}" />
						<Parameter	Name="ToCalculate"		Direction="In"		Value="${PurchaseLine.TotalPrice}" />
						<Parameter	Name="Calculated"		Direction="Out"															OutputProperty="${PurchaseLine.StandardTotalPrice}" />
					</Command>

					<Assign Name="Set StandardVatPrice" Property="${PurchaseLine.StandardVatPrice}" Value="=${PurchaseLine.StandardTotalPrice} * (${PurchaseLine.VatPercentage} / 100)" />
					<Assign Name="Set StandardTotalPriceIncludingVat" Property="${PurchaseLine.StandardTotalPriceIncludingVat}" Value="=${PurchaseLine.StandardTotalPrice} + ${PurchaseLine.StandardVatPrice}" />
				</When>
			</ForEach>
		</Transaction>

		<UserContent Name="Post" />
	</Execution>
</Workflow>