Something went wrong on our end
-
dsg03695 authored
Ticket #1066024: all responsible persons will be shown in the filter view with all corresponding values. Each supervisor can be selected only once per district via the excludedContactid_param.
dsg03695 authoredTicket #1066024: all responsible persons will be shown in the filter view with all corresponding values. Each supervisor can be selected only once per district via the excludedContactid_param.
valueProcess.js 1.17 KiB
import("system.text");
import("Sql_lib");
import("system.SQLTYPES");
import("Date_lib");
import("system.vars");
import("system.result");
import("system.entities");
import("system.neon");
import("system.db");
var districtTurnover;
var appliedFilter = vars.get("$field.DISTRICT_FILTER");
if (appliedFilter)
{
appliedFilter = JSON.parse(appliedFilter).filter;
appliedFilter = JSON.stringify(appliedFilter);
districtTurnover = newSelect("sum(NET)")
.from("SALESORDER")
.join("CONTACT", "CONTACT.CONTACTID = SALESORDER.CONTACT_ID")
.join("ORGANISATION", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID")
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID")
.leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID")
.where(db.toFilterCondition(appliedFilter, "Organisation_entity"))
//.and("SALESORDER.SALESORDERDATE", DateUtils.getCurrentYear(), SqlBuilder.YEAR_EQUALS(), SQLTYPES.INTEGER)
.cell();
}
if (districtTurnover)
districtTurnover = text.formatDouble(districtTurnover, "#,##0.00", true);
else
districtTurnover = "0";
result.string(districtTurnover);