Skip to content
Snippets Groups Projects
Commit 00113367 authored by Maximilian Schröger's avatar Maximilian Schröger
Browse files

Angebot/Angebotsposten Preislogik

parent 9149406d
No related branches found
No related tags found
No related merge requests found
Showing
with 173 additions and 10 deletions
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<name>Contract_entity</name> <name>Contract_entity</name>
<title>Contract</title> <title>Contract</title>
<majorModelMode>DISTRIBUTED</majorModelMode> <majorModelMode>DISTRIBUTED</majorModelMode>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Contract_entity/conditionProcess.js</conditionProcess>
<recordContainerType>DB</recordContainerType> <recordContainerType>DB</recordContainerType>
<caption>Contract</caption> <caption>Contract</caption>
<iconId>VAADIN:FORM</iconId> <iconId>VAADIN:FORM</iconId>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Contract_entity/conditionProcess.js</conditionProcess>
<entityFields> <entityFields>
<entityField> <entityField>
<name>CONTRACTCODE</name> <name>CONTRACTCODE</name>
......
...@@ -41,12 +41,6 @@ ...@@ -41,12 +41,6 @@
<mandatory v="true" /> <mandatory v="true" />
<possibleItemsProcess>%aditoprj%/entity/Offer_entity/entityfields/language/possibleItemsProcess.js</possibleItemsProcess> <possibleItemsProcess>%aditoprj%/entity/Offer_entity/entityfields/language/possibleItemsProcess.js</possibleItemsProcess>
</entityField> </entityField>
<entityField>
<name>NET</name>
<tableName>OFFER</tableName>
<columnName>NET</columnName>
<caption>Total net</caption>
</entityField>
<entityField> <entityField>
<name>OFFERCODE</name> <name>OFFERCODE</name>
<tableName>OFFER</tableName> <tableName>OFFER</tableName>
...@@ -116,6 +110,7 @@ ...@@ -116,6 +110,7 @@
<tableName>OFFER</tableName> <tableName>OFFER</tableName>
<columnName>VAT</columnName> <columnName>VAT</columnName>
<caption>Total VAT</caption> <caption>Total VAT</caption>
<state>READONLY</state>
</entityField> </entityField>
<entityField> <entityField>
<name>IMAGE</name> <name>IMAGE</name>
...@@ -127,6 +122,7 @@ ...@@ -127,6 +122,7 @@
<tableName>OFFER</tableName> <tableName>OFFER</tableName>
<columnName>HEADER</columnName> <columnName>HEADER</columnName>
<caption>Header text</caption> <caption>Header text</caption>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/header/valueProcess.js</valueProcess>
</entityField> </entityField>
<entityField> <entityField>
<name>FOOTER</name> <name>FOOTER</name>
...@@ -153,6 +149,19 @@ ...@@ -153,6 +149,19 @@
<triggerRecalculation v="true" /> <triggerRecalculation v="true" />
<mandatory v="true" /> <mandatory v="true" />
</entityParameter> </entityParameter>
<entityParameter>
<name>Currency_param</name>
<code>%aditoprj%/entity/Offer_entity/entityfields/offerofferitem_dfo/children/currency_param/code.js</code>
<expose v="true" />
<triggerRecalculation v="true" />
</entityParameter>
<entityParameter>
<name>RelationId_param</name>
<code>%aditoprj%/entity/Offer_entity/entityfields/offerofferitem_dfo/children/relationid_param/code.js</code>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="true" />
</entityParameter>
</children> </children>
</entityOutgoingField> </entityOutgoingField>
<entityActionField> <entityActionField>
...@@ -161,6 +170,25 @@ ...@@ -161,6 +170,25 @@
<onActionProcess>%aditoprj%/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js</onActionProcess> <onActionProcess>%aditoprj%/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js</onActionProcess>
<caption>New offer verison</caption> <caption>New offer verison</caption>
</entityActionField> </entityActionField>
<entityField>
<name>PreviewTitle</name>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/previewtitle/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>NET</name>
<tableName>OFFER</tableName>
<columnName>NET</columnName>
<caption>Total net</caption>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/net/valueProcess.js</valueProcess>
<fieldIdProcess>%aditoprj%/entity/Offer_entity/entityfields/net/fieldIdProcess.js</fieldIdProcess>
</entityField>
<entityField>
<name>TotalGross</name>
<caption>Total gross</caption>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/totalgross/valueProcess.js</valueProcess>
</entityField>
</entityFields> </entityFields>
<linkInformation> <linkInformation>
<linkInformation> <linkInformation>
......
import("system.vars");
import("system.result");
result.string(vars.get("$field.CURRENCY"));
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.RELATION_ID"));
\ No newline at end of file
import("system.translate");
import("system.result");
import("system.vars");
result.string(translate.text("Offer") + " " + vars.get("$field.OFFERCODE"));
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.eMath");
var netValue = vars.get("$field.NET");
var vatValue = vars.get("$field.VAT");
result.string( eMath.addDec(netValue, vatValue) );
\ No newline at end of file
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
<majorModelMode>DISTRIBUTED</majorModelMode> <majorModelMode>DISTRIBUTED</majorModelMode>
<alias>Data_alias</alias> <alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Offeritem_entity/conditionProcess.js</conditionProcess> <conditionProcess>%aditoprj%/entity/Offeritem_entity/conditionProcess.js</conditionProcess>
<onDBInsert>%aditoprj%/entity/Offeritem_entity/onDBInsert.js</onDBInsert>
<onDBUpdate>%aditoprj%/entity/Offeritem_entity/onDBUpdate.js</onDBUpdate>
<onDBDelete>%aditoprj%/entity/Offeritem_entity/onDBDelete.js</onDBDelete>
<recordContainerType>DB</recordContainerType> <recordContainerType>DB</recordContainerType>
<caption>Offeritem</caption> <caption>Offeritem</caption>
<entityFields> <entityFields>
...@@ -44,6 +47,7 @@ ...@@ -44,6 +47,7 @@
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>DESCRIPTION</columnName> <columnName>DESCRIPTION</columnName>
<caption>Description</caption> <caption>Description</caption>
<contentType>LONG_TEXT</contentType>
</entityField> </entityField>
<entityField> <entityField>
<name>DISCOUNT</name> <name>DISCOUNT</name>
...@@ -56,6 +60,8 @@ ...@@ -56,6 +60,8 @@
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>GROUPCODEID</columnName> <columnName>GROUPCODEID</columnName>
<caption>Commodity group</caption> <caption>Commodity group</caption>
<possibleItemsProcess>%aditoprj%/entity/Offeritem_entity/entityfields/groupcodeid/possibleItemsProcess.js</possibleItemsProcess>
<state>READONLY</state>
</entityField> </entityField>
<entityField> <entityField>
<name>ITEMNAME</name> <name>ITEMNAME</name>
...@@ -68,6 +74,7 @@ ...@@ -68,6 +74,7 @@
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>ITEMPOSITION</columnName> <columnName>ITEMPOSITION</columnName>
<caption>Position</caption> <caption>Position</caption>
<state>READONLY</state>
</entityField> </entityField>
<entityField> <entityField>
<name>ITEMSORT</name> <name>ITEMSORT</name>
...@@ -78,6 +85,7 @@ ...@@ -78,6 +85,7 @@
<name>OFFERITEMID</name> <name>OFFERITEMID</name>
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>OFFERITEMID</columnName> <columnName>OFFERITEMID</columnName>
<valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/offeritemid/valueProcess.js</valueProcess>
</entityField> </entityField>
<entityField> <entityField>
<name>OFFER_ID</name> <name>OFFER_ID</name>
...@@ -90,6 +98,9 @@ ...@@ -90,6 +98,9 @@
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>OPTIONAL</columnName> <columnName>OPTIONAL</columnName>
<caption>Optional</caption> <caption>Optional</caption>
<contentType>BOOLEAN</contentType>
<possibleItemsProcess>%aditoprj%/entity/Offeritem_entity/entityfields/optional/possibleItemsProcess.js</possibleItemsProcess>
<valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/optional/valueProcess.js</valueProcess>
</entityField> </entityField>
<entityField> <entityField>
<name>PRICE</name> <name>PRICE</name>
...@@ -102,18 +113,25 @@ ...@@ -102,18 +113,25 @@
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>PRODUCT_ID</columnName> <columnName>PRODUCT_ID</columnName>
<caption>Article</caption> <caption>Article</caption>
<possibleItemsProcess>%aditoprj%/entity/Offeritem_entity/entityfields/product_id/possibleItemsProcess.js</possibleItemsProcess>
<onValidation>%aditoprj%/entity/Offeritem_entity/entityfields/product_id/onValidation.js</onValidation>
<onValueChange>%aditoprj%/entity/Offeritem_entity/entityfields/product_id/onValueChange.js</onValueChange>
</entityField> </entityField>
<entityField> <entityField>
<name>QUANTITY</name> <name>QUANTITY</name>
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>QUANTITY</columnName> <columnName>QUANTITY</columnName>
<caption>Quantity</caption> <caption>Quantity</caption>
<valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/quantity/valueProcess.js</valueProcess>
<onValidation>%aditoprj%/entity/Offeritem_entity/entityfields/quantity/onValidation.js</onValidation>
<onValueChange>%aditoprj%/entity/Offeritem_entity/entityfields/quantity/onValueChange.js</onValueChange>
</entityField> </entityField>
<entityField> <entityField>
<name>UNIT</name> <name>UNIT</name>
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>UNIT</columnName> <columnName>UNIT</columnName>
<caption>Unit</caption> <caption>Unit</caption>
<possibleItemsProcess>%aditoprj%/entity/Offeritem_entity/entityfields/unit/possibleItemsProcess.js</possibleItemsProcess>
</entityField> </entityField>
<entityField> <entityField>
<name>USER_EDIT</name> <name>USER_EDIT</name>
...@@ -132,6 +150,7 @@ ...@@ -132,6 +150,7 @@
<tableName>OFFERITEM</tableName> <tableName>OFFERITEM</tableName>
<columnName>VAT</columnName> <columnName>VAT</columnName>
<caption>VAT</caption> <caption>VAT</caption>
<state>READONLY</state>
</entityField> </entityField>
<entityParameter> <entityParameter>
<name>OfferId_param</name> <name>OfferId_param</name>
...@@ -140,6 +159,31 @@ ...@@ -140,6 +159,31 @@
<mandatory v="true" /> <mandatory v="true" />
<description>PARAMETER</description> <description>PARAMETER</description>
</entityParameter> </entityParameter>
<entityParameter>
<name>RelationId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
<name>Currency_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>TotalPrice</name>
<caption>Sum</caption>
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00</outputFormat>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/totalprice/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>IMAGE</name>
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/Offeritem_entity/entityfields/image/valueProcess.js</valueProcess>
</entityField>
</entityFields> </entityFields>
<linkInformation> <linkInformation>
<linkInformation> <linkInformation>
......
...@@ -5,4 +5,4 @@ import("system.vars"); ...@@ -5,4 +5,4 @@ import("system.vars");
if(vars.exists("$param.OfferId_param") && vars.get("$param.OfferId_param") != "") if(vars.exists("$param.OfferId_param") && vars.get("$param.OfferId_param") != "")
result.string("OFFERITEM.OFFER_ID = ('" + vars.get("$param.OfferId_param") + "')"); result.string("OFFERITEM.OFFER_ID = ('" + vars.get("$param.OfferId_param") + "')");
else else
result.string("1 = 2"); result.string("");
\ No newline at end of file \ No newline at end of file
...@@ -4,5 +4,5 @@ import("Keyword_lib"); ...@@ -4,5 +4,5 @@ import("Keyword_lib");
var kwdUtils, items; var kwdUtils, items;
kwdUtils = new KeywordUtils(); kwdUtils = new KeywordUtils();
items = kwdUtils.getStandardArray("PRICELIST"); items = kwdUtils.getStandardArray("GROUPCODE");
result.object(items); result.object(items);
\ No newline at end of file
import("system.result");
result.string("TEXT:IM");
\ No newline at end of file
import("system.util");
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
result.string(util.getNewUUID());
\ No newline at end of file
import("system.translate");
import("system.result");
result.object([
["0", translate.text("Yes")]
,["1", translate.text("No")]
]);
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
result.string("1");
\ No newline at end of file
import("system.logging");
import("system.vars");
import("system.neon");
import("Product_lib");
var pid = vars.get("$local.value");
if(pid != "")
{
var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : "";
var relid = vars.exists("$param.RelationId_param") ? vars.get("$param.RelationId_param") : "";
var pUtils = new ProductUtils();
var PriceListFilter = { currency: curr, quantity: vars.get("$field.QUANTITY"), relationId: relid };
var ProductDetails = pUtils.getProductDetails(pid, PriceListFilter);
if(ProductDetails[pid] != undefined)
{
vars.set("$field.GROUPCODEID", ProductDetails[pid].groupCode);
vars.set("$field.UNIT", ProductDetails[pid].unit);
vars.set("$field.ITEMNAME", ProductDetails[pid].productName);
if(ProductDetails[pid].PriceListToUse != null)
{
vars.set("$field.PRICE", ProductDetails[pid].PriceListToUse.price);
vars.set("$field.VAT", ProductDetails[pid].PriceListToUse.vat);
}
}
}
\ No newline at end of file
import("system.logging");
import("system.result");
import("system.db");
import("Sql_lib");
//TODO: change field to lookup field
var sqlUtils = new LegacySqlUtils();
var prodsSql = "select PRODUCTID, " + sqlUtils.concat(["PRODUCTCODE", "'/'", "PRODUCTNAME"])
+ " from PRODUCT";
var prods = db.table(prodsSql);
var retArray = [];
for(var i = 0; i < prods.length; i++)
retArray.push(prods[i]);
result.object(retArray);
\ No newline at end of file
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