[% USE HTML %][% USE L %][% USE LxERP %]

[% FORM.title %] — [% LxERP.t8("Step #1/#2", 1, 2) %] — [% LxERP.t8("Basic Data") %]

[%- INCLUDE 'common/flash.html' %]
[% L.hidden_tag("id", SELF.query.id) %]
[%- LxERP.t8("Name") %] [% L.input_tag("query.name", SELF.query.name, style="width: 800px", "data-validate"="required") %]
[%- LxERP.t8("Required access right") %] [% L.select_tag("query.access_right", SELF.access_rights, default=SELF.query.access_right, style="width: 800px") %]
[%- LxERP.t8("Description") %] [% L.textarea_tag("query.description", SELF.query.description, rows=5, style="width: 800px") %]
[%- LxERP.t8("SQL query") %] [% L.textarea_tag("query.sql_query", SELF.query.sql_query, rows=20, style="width: 800px", "data-validate"="required") %]

[% LxERP.t8("The SQL query can be parameterized with variables named as follows: <%name%>.") %] [% LxERP.t8("On the next page the type of all variables can be set.") %] [% LxERP.t8("Note that parameter names must not be quoted.") %] [% LxERP.t8("Example") %]:

SELECT extract(YEAR FROM oe.transdate) AS "Jahr", SUM(oe.amount) AS "Angebotssumme"
FROM oe
LEFT JOIN employee ON (oe.employee_id = employee.id)
WHERE (oe.customer_id IS NOT NULL)
  AND COALESCE(oe.quotation, FALSE)
  AND (employee.login = <%Benutzer-Login%>)
GROUP BY "Jahr"
ORDER BY "Jahr"