Skip to content
Snippets Groups Projects
Commit 888a1589 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Cost to campaignstep, filter category keyword

parent 4a67649e
No related branches found
No related tags found
No related merge requests found
Showing with 52 additions and 1 deletion
...@@ -147,6 +147,10 @@ ...@@ -147,6 +147,10 @@
<name>ContainerName_param</name> <name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js</valueProcess> <valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/containername_param/valueProcess.js</valueProcess>
</entityParameter> </entityParameter>
<entityParameter>
<name>ExcludedKeyIdsSubquery_param</name>
<valueProcess>%aditoprj%/entity/CampaignCost_entitiy/entityfields/keywordcampaignmanagementcostcategory/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess>
</entityParameter>
</children> </children>
</entityConsumer> </entityConsumer>
<entityActionGroup> <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"); ...@@ -5,7 +5,7 @@ import("system.eMath");
var netto = parseFloat(vars.get("$field.NET")); var netto = parseFloat(vars.get("$field.NET"));
var countParticipants = parseFloat(vars.get("$field.countParticipants")); 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)); result.string(eMath.roundDec(netto / countParticipants, 2, eMath.ROUND_HALF_UP));
else else
result.string(0); result.string(0);
\ No newline at end of file
...@@ -218,6 +218,12 @@ ...@@ -218,6 +218,12 @@
</entityParameter> </entityParameter>
</children> </children>
</entityConsumer> </entityConsumer>
<entityField>
<name>COST</name>
<title>Cost</title>
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00</outputFormat>
</entityField>
</entityFields> </entityFields>
<recordContainers> <recordContainers>
<dbRecordContainer> <dbRecordContainer>
...@@ -295,6 +301,10 @@ ...@@ -295,6 +301,10 @@
<name>DESCRIPTION.value</name> <name>DESCRIPTION.value</name>
<recordfield>CAMPAIGNSTEP.DESCRIPTION</recordfield> <recordfield>CAMPAIGNSTEP.DESCRIPTION</recordfield>
</dbRecordFieldMapping> </dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>COST.value</name>
<expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/cost.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings> </recordFieldMappings>
</dbRecordContainer> </dbRecordContainer>
</recordContainers> </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 @@ ...@@ -445,6 +445,12 @@
</entityParameter> </entityParameter>
</children> </children>
</entityConsumer> </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> </entityFields>
<recordContainers> <recordContainers>
<dbRecordContainer> <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.vars");
import("system.db"); import("system.db");
import("system.result"); import("system.result");
...@@ -10,5 +11,8 @@ if (vars.get("$param.OnlyActives_param") == "true") ...@@ -10,5 +11,8 @@ if (vars.get("$param.OnlyActives_param") == "true")
cond.andPrepare("AB_KEYWORD_ENTRY.ISACTIVE", "1"); 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")); var condStr = db.translateCondition(cond.build("1 = 1"));
result.string(condStr); result.string(condStr);
\ No newline at end of file
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
<name>88fbd366-0107-44b7-8d9c-f4fee89c0637</name> <name>88fbd366-0107-44b7-8d9c-f4fee89c0637</name>
<entityField>CampaignStatus</entityField> <entityField>CampaignStatus</entityField>
</entityFieldLink> </entityFieldLink>
<entityFieldLink>
<name>27558e2a-a377-4126-a29d-422d2d5a44b4</name>
<entityField>COST</entityField>
</entityFieldLink>
</fields> </fields>
</genericViewTemplate> </genericViewTemplate>
</children> </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