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

[Projekt: Entwicklung - Neon][TicketNr.: 1029579][Preise überarbeiten] fix...

[Projekt: Entwicklung - Neon][TicketNr.: 1029579][Preise überarbeiten] fix current EK, VK. Moved to other context
parent fc43725a
No related branches found
No related tags found
No related merge requests found
Showing
with 96 additions and 126 deletions
......@@ -118,11 +118,6 @@
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Pers_entity/entityfields/pers_user_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>PREVIEWTITLE</name>
<title></title>
<valueProcess>%aditoprj%/entity/Pers_entity/entityfields/previewtitle/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>OrgId_param</name>
<expose v="true" />
......@@ -186,7 +181,6 @@
</entityField>
<entityField>
<name>ORG_ID</name>
<title></title>
<tableName>RELATION</tableName>
<columnName>ORG_ID</columnName>
<valueProcess>%aditoprj%/entity/Pers_entity/entityfields/org_id/valueProcess.js</valueProcess>
......@@ -469,6 +463,20 @@
<mandatory v="false" />
<description>PARAMETER</description>
</entityParameter>
<entityFieldGroup>
<name>FULL_NAME_fieldGroup</name>
<valueProcess>%aditoprj%/entity/Pers_entity/entityfields/full_name_fieldgroup/valueProcess.js</valueProcess>
<title>Name</title>
<description>FIELDGROUP</description>
<fields>
<element>SALUTATION</element>
<element>TITLE</element>
<element>FIRSTNAME</element>
<element>MIDDLENAME</element>
<element>LASTNAME</element>
<element>TITLESUFFIX</element>
</fields>
</entityFieldGroup>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.result");
var salutation = vars.get("$field.SALUTATION");
var title = vars.get("$field.TITLE");
var firstname = vars.get("$field.FIRSTNAME");
var middlename = vars.get("$field.MIDDLENAME");
var lastname = vars.get("$field.LASTNAME");
var titlesuffix = vars.get("$field.TITLESUFFIX");
var resultString = [salutation, title, firstname, middlename, lastname, titlesuffix].filter(Boolean).join(" ");
if(resultString)
result.string(resultString);
else
result.string("Neuer Kontakt");
import("system.vars");
import("system.result");
result.string(vars.get("$field.PREVIEWTITLE"));
\ No newline at end of file
result.string(vars.get("$field.FULL_NAME_fieldGroup"));
\ No newline at end of file
......@@ -124,6 +124,20 @@
<columnName>USER_NEW</columnName>
<valueProcess>%aditoprj%/entity/Product_entity/entityfields/user_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>currentPurchasePriceId</name>
<title>Curr. purchase price</title>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Product_entity/entityfields/currentpurchasepriceid/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>currentSalesPriceId</name>
<title>Curr. sales price</title>
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00 €</outputFormat>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Product_entity/entityfields/currentsalespriceid/valueProcess.js</valueProcess>
</entityField>
<entityOutgoingField>
<name>ProductOrg_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
......
import("system.result");
import("system.vars");
import("Product_lib");
result.string(ProductUtils.getCurrentProductPrice(vars.get("$field.PRODUCTID"), "PP"));
\ No newline at end of file
import("system.result");
import("system.vars");
import("Product_lib");
result.string(ProductUtils.getCurrentProductPrice(vars.get("$field.PRODUCTID"), "SP"));
\ No newline at end of file
......@@ -240,20 +240,6 @@
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/Productprice_entity/entityfields/image/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>currentPurchasePrice</name>
<title>Curr. purchase price</title>
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00 €</outputFormat>
<valueProcess>%aditoprj%/entity/Productprice_entity/entityfields/currentpurchaseprice/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>currentSalesPrice</name>
<title>Curr. sales price</title>
<contentType>NUMBER</contentType>
<outputFormat>#,##0.00 €</outputFormat>
<valueProcess>%aditoprj%/entity/Productprice_entity/entityfields/currentsalesprice/valueProcess.js</valueProcess>
</entityField>
<entityIncomingField>
<name>#INCOMING</name>
</entityIncomingField>
......
import("system.result");
import("Keyword_lib");
var KeywordUtils, items;
items = KeywordUtils.getStandardArray("CURRENCY");
var items = KeywordUtils.getStandardArray("CURRENCY");
result.object(items);
\ No newline at end of file
import("system.result");
import("system.vars");
import("Product_lib");
if(vars.exists("$param.ProductId_param") && vars.get("$param.ProductId_param") != "")
{
result.string( ProductUtils.getCurrentProductPrice(vars.get("$param.ProductId_param"), "PP") );
}
\ No newline at end of file
import("system.result");
import("system.vars");
import("Product_lib");
if(vars.exists("$param.ProductId_param") && vars.get("$param.ProductId_param") != "")
{
result.string( ProductUtils.getCurrentProductPrice(vars.get("$param.ProductId_param"), "SP") );
}
\ No newline at end of file
......@@ -926,6 +926,10 @@
<entry>
<key>Euro zone</key>
</entry>
<entry>
<key>Prices</key>
<value>Preise</value>
</entry>
<entry>
<key>NAME</key>
</entry>
......
......@@ -287,6 +287,9 @@
<entry>
<key>Ein Gruppentermin kann nur durch den Organisator bearbeitet werden.</key>
</entry>
<entry>
<key>Prices</key>
</entry>
<entry>
<key>Communication Other</key>
</entry>
......
......@@ -18,9 +18,5 @@
<name>d1c8b084-a20b-49ae-88fe-7a578396d4a5</name>
<view>ProductpriceRelation_view</view>
</neonViewReference>
<neonViewReference>
<name>d6d23301-5660-4938-b6a3-683dc096baac</name>
<view>ProductpriceCurrent_view</view>
</neonViewReference>
</references>
</neonContext>
......@@ -14,20 +14,8 @@
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>cb520389-fbb4-4ae3-a172-c3dc428de20c</name>
<entityField>TITLE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>b2557e5d-729e-4aab-a695-8952d4427d88</name>
<entityField>FIRSTNAME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>1ea425a7-8203-4592-996f-e3dcd5c880b6</name>
<entityField>MIDDLENAME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>c0e18d4a-04e3-4c81-83da-39b1870cc540</name>
<entityField>LASTNAME</entityField>
<name>c08b6952-9825-42fa-9b42-7a20a376fec7</name>
<entityField>FULL_NAME_fieldGroup</entityField>
</entityFieldLink>
<entityFieldLink>
<name>bfd5e2d2-d89d-4c90-a8e2-f85fb2cc48f3</name>
......
......@@ -51,10 +51,21 @@
<entityField>ProductStockCount_dfo</entityField>
<view>StockCount_view</view>
</neonViewReference>
<neonViewReference>
<name>297942d3-d87d-4813-96b0-7fa1bb58a9cf</name>
<entityField>ProductProductpriceCurr_dfo</entityField>
<view>ProductpriceCurrent_view</view>
</neonViewReference>
<genericViewTemplate>
<name>ProductPriceCurrent_template</name>
<showDrawer v="true" />
<drawerCaption>Prices</drawerCaption>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>b93cd0c5-7028-496b-9709-ed57ba53ab47</name>
<entityField>currentPurchasePriceId</entityField>
</entityFieldLink>
<entityFieldLink>
<name>6e4db325-6546-47f8-8dfa-ae60e8c37a13</name>
<entityField>currentSalesPriceId</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.0">
<name>ProductpriceCurrent_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<noneLayout>
<name>layout</name>
</noneLayout>
</layout>
<children>
<genericViewTemplate>
<name>Generic</name>
<showDrawer v="true" />
<drawerCaption>Current purchase/sales price</drawerCaption>
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>8775da33-ac67-474f-b3cc-43f848d805aa</name>
<entityField>currentPurchasePrice</entityField>
</entityFieldLink>
<entityFieldLink>
<name>7ea07988-e3f6-4540-bdb2-4e34cf3211be</name>
<entityField>currentSalesPrice</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
......@@ -35,6 +35,10 @@
<name>56902ebb-b48b-42f9-b867-fb2b07527461</name>
<entityField>PRICE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>8879e46d-fa53-4769-8bcf-15b65fdf9967</name>
<entityField>CURRENCY</entityField>
</neonTableColumn>
<neonTableColumn>
<name>15a669d9-b089-4134-89a0-129de6e1e68c</name>
<entityField>BUYSELL</entityField>
......@@ -47,10 +51,6 @@
<name>981f29b1-b4c5-4591-8064-21a72f339179</name>
<entityField>VAT</entityField>
</neonTableColumn>
<neonTableColumn>
<name>8879e46d-fa53-4769-8bcf-15b65fdf9967</name>
<entityField>CURRENCY</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
......
......@@ -15,7 +15,9 @@
<constraints nullable="false" foreignKeyName="FK_PRODUCTPRICE_PRODUCT_ID" references="PRODUCT(PRODUCTID)"/>
</column>
<column name="FROMQUANTITY" type="NUMERIC(14,2)"/>
<column name="CURRENCY" type="INTEGER"/>
<column name="CURRENCY" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="PRICELIST" type="INTEGER"/>
<column name="BUYSELL" type="VARCHAR(5)"/>
<column name="DATE_EDIT" type="TIMESTAMP"/>
......
......@@ -2,7 +2,10 @@ import("system.SQLTYPES");
import("system.datetime");
import("system.db");
import("system.vars");
import("system.translate");
import("Util_lib");
import("Sql_lib");
import("Keyword_lib");
/**
......@@ -26,19 +29,22 @@ function ProductUtils() {}
ProductUtils.getCurrentProductPrice = function(pid, buySell) {
if (pid != undefined && pid != "" && buySell != undefined && buySell != "")
{
var actualpriceSelect = "select PRICE from PRODUCTPRICE \n\
where BUYSELL = '" + buySell + "' and PRODUCT_ID = '" + pid + "' and CURRENCY = 1 \n\
and VALID_FROM <= ? and (VALID_TO >= ? or VALID_TO is null) \n\
order by VALID_FROM desc";
var today = datetime.today();
var sqltypes = [ [today.toString(), SQLTYPES.TIMESTAMP], [today.toString(), SQLTYPES.TIMESTAMP] ];
var actualprice = db.cell([actualpriceSelect, sqltypes]);
if (actualprice != "")
return actualprice;
var today = datetime.clearTime(vars.get("sys.date"), "utc");
var actualPriceCondition = SqlCondition.begin()
.andPrepare("PRODUCTPRICE.BUYSELL", buySell)
.andPrepare("PRODUCTPRICE.PRODUCT_ID", pid)
.andPrepare("PRODUCTPRICE.CURRENCY", 1) // TODO: warum ist Currency hardgecoded auf 1??
.andPrepare("PRODUCTPRICE.VALID_FROM", today, "# <= ?")
.andSqlCondition(SqlCondition.begin()
.orPrepare("PRODUCTPRICE.VALID_TO", today, "# >= ?")
.or("PRODUCTPRICE.VALID_TO is null"), "1 = 2");
var productPriceData = db.array(db.ROW, actualPriceCondition.buildSelect("select PRICE, CURRENCY from PRODUCTPRICE", "1 = 2", "order by VALID_FROM desc"));
if (productPriceData[0] != "")
return productPriceData[0] + " " + KeywordUtils.get("CURRENCY", productPriceData[1])[1];
else
return "0.00";
return "";
} else {
throw new Error(); // TODO: add message
}
......@@ -56,7 +62,10 @@ ProductUtils.getCurrentProductPrice = function(pid, buySell) {
ProductUtils.getStockCount = function(pid) {
if (pid != undefined && pid != "")
{
var sum = db.cell("select sum(QUANTITY * IN_OUT) from STOCK where PRODUCT_ID = '" + pid + "'");
var sum = db.cell(SqlCondition.begin()
.andPrepare("STOCK.PRODUCT_ID", pid)
.buildSelect("select sum(QUANTITY * IN_OUT) from STOCK"));
if (sum == "")
sum = "0";
......@@ -74,7 +83,7 @@ ProductUtils.getStockCount = function(pid) {
* current price list to use for offer/order are delivered.
*
* @param {String} pid req ProductID
* @param {Object} pPriceListFilter opt { currency: "currencyValue", quantity: "quantityValue", relationId: "relationIdValue (for custom price lists)" }
* @param {Object} priceListFilter opt { currency: "currencyValue", quantity: "quantityValue", relationId: "relationIdValue (for custom price lists)" }
*
* @example //Product_entity, Field: PRODUCT_ID, Process: onValueChange
* var pid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCT_ID"));
......@@ -286,7 +295,7 @@ ProductUtils.getProductDetails = function(pid, priceListFilter)
* @return {Object | null} null if no identical price list was found, otherwise the found price list
*/
ProductUtils.checkForIndenticalPriceLists = function(pid, priceList) {
var PriceLists = that.getProductDetails(pid).PriceLists;
var PriceLists = this.getProductDetails(pid).PriceLists;
for (var pricelist in PriceLists) {
//equal price list
......
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