Skip to content
Snippets Groups Projects
Commit b2948b2e authored by S.Listl's avatar S.Listl
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1033739][Vertriebsprojekt - Aktion...

[Projekt: Entwicklung - Neon][TicketNr.: 1033739][Vertriebsprojekt - Aktion "Zeit eintragen" in Aktionsmenü]
parent e73af877
No related branches found
No related tags found
No related merge requests found
......@@ -306,6 +306,7 @@
<entityField>
<name>TIMETRACKINGSUM</name>
<title>Time expenses</title>
<description>the total hours of all time trackings related to the salesproject</description>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/timetrackingsum/valueProcess.js</valueProcess>
</entityField>
......@@ -362,6 +363,13 @@
</entityParameter>
</children>
</entityConsumer>
<entityActionField>
<name>newTimetracking</name>
<fieldType>ACTION</fieldType>
<title>New time tracking</title>
<description>Opens the time tracking context in new-mode for the selected salesproject</description>
<onActionProcess>%aditoprj%/entity/Salesproject_entity/entityfields/newtimetracking/onActionProcess.js</onActionProcess>
</entityActionField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("Timetracking_lib");
Timetracking.createNewTimeTracking(vars.getString("$field.SALESPROJECTID"));
\ No newline at end of file
import("system.eMath");
import("system.text");
import("system.translate");
import("system.result");
import("system.vars");
import("Salesproject_lib");
import("Timetracking_lib");
var objectId = ContextUtils.getCurrentContextId();
var rowId = vars.getString("$field.SALESPROJECTID");
var hrs = Salesproject.getTotalTrackingTime(objectId, rowId) / 60;
hrs = eMath.roundDec(hrs, 2, eMath.ROUND_HALF_UP);
var hrs = Timetracking.getTotalTrackingTime(vars.getString("$field.SALESPROJECTID")) / 60;
hrs = text.formatDouble(hrs, "0.00");
result.string(hrs + " " + translate.text("hrs"));
\ No newline at end of file
......@@ -58,6 +58,10 @@
<key>Austria</key>
<value>Österreich</value>
</entry>
<entry>
<key>New time tracking</key>
<value>Neuer Zeiteintrag</value>
</entry>
<entry>
<key>Customercode</key>
<value>Kundennummer</value>
......@@ -1344,6 +1348,7 @@
</entry>
<entry>
<key>New receipt version</key>
<value></value>
</entry>
<entry>
<key>Orderitems</key>
......
import("system.neon");
import("system.vars");
import("system.util");
import("system.translate");
......@@ -82,21 +83,3 @@ Salesproject.getSalesProjectTitleById = function(pSalesProjectId)
.andPrepare("SALESPROJECT.SALESPROJECTID", pSalesProjectId)
.buildSql("select PROJECTTITLE from SALESPROJECT", "1=0"));
}
/**
* calculates the total time of all time trackings of the object
*
* @param {String} pObjectId the objectId
* @param {String} pRowId the rowId
*
* @return {Number} total time in minutes
*/
Salesproject.getTotalTrackingTime = function (pObjectId, pRowId)
{
var totalMinutes = db.cell(SqlCondition.begin()
.andPrepare("TIMETRACKING.OBJECT_ID", pObjectId)
.andPrepare("TIMETRACKING.ROW_ID", pRowId)
.buildSql("select sum(MINUTES) from TIMETRACKING", "1=0"));
return Number(totalMinutes);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.1.7">
<name>Timetracking_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/Timetracking_lib/process.js</process>
<variants>
<element>LIBRARY</element>
</variants>
</process>
import("system.db");
import("system.neon");
import("Context_lib");
/**
* Methods used for time tracking.
* Do not create an instance of this!
*
* @class
*/
function Timetracking() {}
/**
* calculates the total time of all time trackings of the object
*
* @param {String} pRowId the rowId
*
* @return {Number} total time in minutes
*/
Timetracking.getTotalTrackingTime = function (pRowId)
{
var objectId = ContextUtils.getCurrentContextId();
var totalMinutes = db.cell(SqlCondition.begin()
.andPrepare("TIMETRACKING.OBJECT_ID", objectId)
.andPrepare("TIMETRACKING.ROW_ID", pRowId)
.buildSql("select sum(MINUTES) from TIMETRACKING", "1=0"));
return Number(totalMinutes);
}
/**
* Create a new time tracking
*
* @param {String} pRowId the rowId
*
* @return {Number} total time in minutes
*/
Timetracking.createNewTimeTracking = function (pRowId)
{
var objectId = ContextUtils.getCurrentContextId();
var params = {
"ObjectId_param" : objectId,
"RowId_param" : pRowId
};
neon.openContext("Timetracking_context", null, null, neon.OPERATINGSTATE_NEW, params);
}
\ 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