Skip to content
Snippets Groups Projects
Commit 00e8633f authored by Johannes Hörmann's avatar Johannes Hörmann Committed by David Büchler
Browse files

Cost to campaignstep, filter category keyword

parent 3b5d0144
No related branches found
No related tags found
No related merge requests found
Showing with 52 additions and 1 deletion
......@@ -147,6 +147,10 @@
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>ExcludedKeyIdsSubquery_param</name>
<valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityActionGroup>
......
import("system.neon");
import("system.vars");
import("system.db");
import("Sql_lib");
import("system.result");
var cond = SqlCondition.begin()
.andPrepareVars("CAMPAIGNCOST.CAMPAIGN_ID", "$field.CAMPAIGN_ID");
if (vars.get("$field.CAMPAIGNSTEP_ID"))
cond.andPrepareVars("CAMPAIGNCOST.CAMPAIGNSTEP_ID", "$field.CAMPAIGNSTEP_ID");
else
cond.and("CAMPAIGNCOST.CAMPAIGNSTEP_ID is null")
if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW)
cond.andPrepareVars("CAMPAIGNCOST.CAMPAIGNCOSTID", "$field.CAMPAIGNCOSTID", "# <> ?");
result.string(db.translateStatement(cond.buildSql("select CATEGORY from CAMPAIGNCOST", "1=2", "group by CATEGORY")));
\ No newline at end of file
......@@ -5,7 +5,7 @@ import("system.eMath");
var netto = parseFloat(vars.get("$field.NET"));
var countParticipants = parseFloat(vars.get("$field.countParticipants"));
if (countParticipants > 0)
if (netto && countParticipants &&countParticipants > 0)
result.string(eMath.roundDec(netto / countParticipants, 2, eMath.ROUND_HALF_UP));
else
result.string(0);
\ No newline at end of file
......@@ -218,6 +218,12 @@
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>COST</name>
<title>Cost</title>
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00</outputFormat>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -295,6 +301,10 @@
<name>DESCRIPTION.value</name>
<recordfield>CAMPAIGNSTEP.DESCRIPTION</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>COST.value</name>
<expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/cost.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
import("system.result");
result.string("(select sum(NET) from CAMPAIGNCOST where CAMPAIGNCOST.CAMPAIGN_ID = CAMPAIGNSTEP.CAMPAIGN_ID and CAMPAIGNCOST.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID)")
\ No newline at end of file
......@@ -445,6 +445,12 @@
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>ExcludedKeyIdsSubquery_param</name>
<expose v="true" />
<documentation>%aditoprj%/entity/KeywordEntry_entity/entityfields/excludedkeyidssubquery_param/documentation.adoc</documentation>
<description>PARAMETER</description>
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
Can be filled with a subquery-string, which delivers KeyIds to exclude.
The subquery is used insade a "KEYID not in(...)"
\ No newline at end of file
import("system.logging");
import("system.vars");
import("system.db");
import("system.result");
......@@ -10,5 +11,8 @@ if (vars.get("$param.OnlyActives_param") == "true")
cond.andPrepare("AB_KEYWORD_ENTRY.ISACTIVE", "1");
}
if (vars.exists("$param.ExcludedKeyIdsSubquery_param") && vars.get("$param.ExcludedKeyIdsSubquery_param"))
cond.and("AB_KEYWORD_ENTRY.KEYID not in (" + vars.get("$param.ExcludedKeyIdsSubquery_param") + ")");
var condStr = db.translateCondition(cond.build("1 = 1"));
result.string(condStr);
\ No newline at end of file
......@@ -35,6 +35,10 @@
<name>88fbd366-0107-44b7-8d9c-f4fee89c0637</name>
<entityField>CampaignStatus</entityField>
</entityFieldLink>
<entityFieldLink>
<name>27558e2a-a377-4126-a29d-422d2d5a44b4</name>
<entityField>COST</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment