-- Group: projects
-- Name: detail
--- Notes:
+-- Notes:
-- Copyright (c) 1999-2013 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
---
+--
-- xTuple version 4.2.0 - Modified to significantly amend the display of this screen and its filters.
-- xTuple version 4.3.0 - Add Incidents to hierarchy display
-SELECT *,
+SELECT *,
formatQty(qty) AS f_qty,
formatMoney(value) AS f_value,
'curr' AS qty_xtnumericrole,
prj_id AS project,
NULL AS section_qtdisplayrole,
prj_number AS name,
- CASE
+ CASE
WHEN prj_status = 'C' THEN <? value('complete') ?>
WHEN prj_status = 'O' THEN <? value('inprocess') ?>
WHEN prj_status = 'P' THEN <? value('planning') ?>
prj_owner_username,
prj_name AS item,
firstline(prj_descrip) AS descrip,
- crmacct_name AS customer,
+ crmacct_name AS customer,
cntct_name AS contact,
addr_city AS city,
addr_state AS state,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
- CASE WHEN (prj_status = 'O' AND prj_due_date < current_date) THEN 'red'
- WHEN (prj_status = 'O' AND prj_due_date BETWEEN current_date AND current_date + (fetchmetricvalue('ProjectDueDateWarning')||' days')::interval) THEN 'orange'
+ CASE WHEN (prj_status = 'O' AND prj_due_date < current_date) THEN 'red'
+ WHEN (prj_status = 'O' AND prj_due_date BETWEEN current_date AND current_date + (fetchmetricvalue('ProjectDueDateWarning')||' days')::interval) THEN 'orange'
END AS due_qtforegroundrole,
0 AS xtindentrole
FROM prj()
LEFT OUTER JOIN addr ON (cntct_addr_id=addr_id)
WHERE (1=1 )
-
+
UNION ALL
----- TASKS -----
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
3 AS type,
'0' AS subtype,
1 AS section,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM prjtask
prjtask_prj_id AS project,
NULL AS section_qtdisplayrole,
prjtask_number AS name,
- CASE
+ CASE
WHEN prjtask_status = 'C' THEN <? value('complete') ?>
WHEN prjtask_status = 'O' THEN <? value('inprocess') ?>
WHEN prjtask_status = 'P' THEN <? value('planning') ?>
prjtask_exp_budget AS exp_budget,
prjtask_exp_actual AS exp_actual,
(prjtask_exp_budget-prjtask_exp_actual) AS exp_balance,
- CASE WHEN (prjtask_status = 'O' AND prjtask_due_date < current_date) THEN 'red'
- WHEN (prjtask_status = 'O' AND prjtask_due_date BETWEEN current_date AND current_date + (fetchmetricvalue('ProjectDueDateWarning')||' days')::interval) THEN 'orange'
+ CASE WHEN (prjtask_status = 'O' AND prjtask_due_date < current_date) THEN 'red'
+ WHEN (prjtask_status = 'O' AND prjtask_due_date BETWEEN current_date AND current_date + (fetchmetricvalue('ProjectDueDateWarning')||' days')::interval) THEN 'orange'
END AS due_qtforegroundrole,
2 AS xtindentrole
FROM prjtask
UNION ALL
----- INCIDENTS -----
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
100 AS type,
'0' AS subtype,
1 AS section,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM incdt
incdt_prj_id AS project,
NULL AS section_qtdisplayrole,
incdt_number::text AS name,
- CASE
+ CASE
WHEN incdt_status = 'L' THEN <? value('closed') ?>
WHEN incdt_status = 'N' THEN <? value('new') ?>
WHEN incdt_status = 'F' THEN <? value('feedback') ?>
- WHEN incdt_status = 'A' THEN <? value('assigned') ?>
+ WHEN incdt_status = 'A' THEN <? value('assigned') ?>
WHEN incdt_status = 'R' THEN <? value('resolved') ?>
WHEN incdt_status = 'C' THEN <? value('confirmed') ?>
END AS status,
WHERE (1=1 )
GROUP BY incdt_id, incdt_prj_id, incdt_number, crmacct_number, crmacct_name, addr.addr_city, addr.addr_state, cntct_name, incdt_number, incdt_status, incdt_assigned_username, incdt_owner_username, incdt_number, incdt_summary
<? endif ?>
-
+
<? if exists("showSo") ?>
UNION ALL
----- QUOTES -----
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
10 AS type,
'0' AS subtype,
1 AS section,
NULL::text AS state,
NULL::numeric AS qty,
NULL::text AS uom,
- NULL::numeric AS value,
+ NULL::numeric AS value,
NULL::date AS due,
NULL::date AS assigned,
NULL::date AS started,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM quhead
WHERE (1=1)
UNION ALL
-SELECT quhead_id AS id,
+SELECT quhead_id AS id,
15 AS type,
quhead_number AS subtype,
1 AS section,
prj_id AS project,
<? value("quotes") ?> AS section_qtdisplayrole,
quhead_number AS name,
- CASE WHEN (quhead_status = 'C') THEN
+ CASE WHEN (quhead_status = 'C') THEN
<? value("converted") ?>
WHEN (quhead_status = 'X') THEN
<? value("canceled") ?>
cust_name AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
NULL AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM quhead
UNION ALL
-SELECT quitem_id AS id,
+SELECT quitem_id AS id,
17 AS type,
quhead_number AS subtype,
1 AS section,
prj_id AS project,
<? value("quotes") ?> AS section_qtdisplayrole,
- quitem_linenumber::text AS name,
- CASE WHEN (quhead_status = 'C') THEN
+ quitem_linenumber::text AS name,
+ CASE WHEN (quhead_status = 'C') THEN
<? value("converted") ?>
WHEN (quhead_status = 'X') THEN
<? value("canceled") ?>
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
quitem_qtyord,
uom_name AS uom,
(quitem_qtyord * quitem_qty_invuomratio) * (quitem_price / quitem_price_invuomratio) AS value,
NULL::numeric AS hrs_balance,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
- NULL::numeric AS exp_balance,
+ NULL::numeric AS exp_balance,
NULL::text AS due_qtforegroundrole,
3 AS xtindentrole
FROM quhead
UNION ALL
-SELECT quhead_id AS id,
+SELECT quhead_id AS id,
18 AS type,
quhead_number AS subtype,
1 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM((quitem_qtyord * quitem_qty_invuomratio) * (quitem_price / quitem_price_invuomratio)) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM quhead
UNION ALL
-SELECT -1 AS id,
+SELECT -1 AS id,
19 AS type,
MAX(quhead_number) AS subtype,
1 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM((quitem_qtyord * quitem_qty_invuomratio) * (quitem_price / quitem_price_invuomratio)) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM quhead
UNION ALL
------ SALES ORDERS ------
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
20 AS type,
'0' AS subtype,
2 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL::numeric AS qty,
NULL::text AS uom,
NULL::numeric AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM cohead
UNION ALL
-SELECT cohead_id AS id,
+SELECT cohead_id AS id,
25 AS type,
cohead_number::text AS subtype,
2 AS section,
prj_id AS project,
<? value("sos") ?> AS section_qtdisplayrole,
cohead_number::text AS name,
- COALESCE((SELECT
+ COALESCE((SELECT
CASE WHEN (coitem_status = 'O') THEN
<? value("open") ?>
WHEN (coitem_status = 'C') THEN
ELSE
<? value("canceled") ?>
END
- FROM
+ FROM
(SELECT coitem_status,
- CASE
+ CASE
WHEN (coitem_status = 'O') THEN 1
WHEN (coitem_status = 'C') then 2
ELSE 3
cust_name AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
NULL AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM cohead
UNION ALL
-SELECT coitem_id AS id,
+SELECT coitem_id AS id,
27 AS type,
cohead_number::text AS subtype,
2 AS section,
prj_id AS project,
<? value("sos") ?> AS section_qtdisplayrole,
- coitem_linenumber::text AS name,
+ coitem_linenumber::text AS name,
CASE WHEN (coitem_status = 'O') THEN
<? value("open") ?>
WHEN (coitem_status = 'C') THEN
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
coitem_qtyord,
uom_name AS uom,
(coitem_qtyord * coitem_qty_invuomratio) * (coitem_price / coitem_price_invuomratio) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
3 AS xtindentrole
FROM cohead
UNION ALL
-SELECT cohead_id AS id,
+SELECT cohead_id AS id,
28 AS type,
cohead_number::text AS subtype,
2 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM((coitem_qtyord * coitem_qty_invuomratio) * (coitem_price / coitem_price_invuomratio)) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM cohead
UNION ALL
-SELECT -1 AS id,
+SELECT -1 AS id,
29 AS type,
MAX(cohead_number::text) AS subtype,
2 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM((coitem_qtyord * coitem_qty_invuomratio) * (coitem_price / coitem_price_invuomratio)) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM cohead
JOIN coitem ON (coitem_cohead_id = cohead_id)
WHERE (1=1)
GROUP BY prj_id
-
+
UNION ALL
------ INVOICES -------
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
30 AS type,
'0' AS subtype,
3 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL::numeric AS qty,
NULL::text AS uom,
NULL::numeric AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM invchead
cust_name AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
NULL AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM invchead
UNION ALL
-SELECT invcitem_id AS id,
+SELECT invcitem_id AS id,
37 AS type,
invchead_invcnumber::text AS subtype,
3 AS section,
prj_id AS project,
<? value("invoices") ?> AS section_qtdisplayrole,
- invcitem_linenumber::text AS name,
+ invcitem_linenumber::text AS name,
CASE WHEN (invchead_posted) THEN
<? value("posted") ?>
ELSE <? value("unposted") ?>
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
invcitem_billed AS qty,
uom_name AS uom,
(invcitem_billed * invcitem_qty_invuomratio) * (invcitem_price / invcitem_price_invuomratio) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
3 AS xtindentrole
FROM invchead
UNION ALL
-SELECT invchead_id AS id,
+SELECT invchead_id AS id,
38 AS type,
invchead_invcnumber::text AS subtype,
3 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM((invcitem_billed * invcitem_qty_invuomratio) * (invcitem_price / invcitem_price_invuomratio)) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM invchead
UNION ALL
-SELECT -1 AS id,
+SELECT -1 AS id,
39 AS type,
MAX(invchead_invcnumber::text) AS subtype,
3 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM((invcitem_billed * invcitem_qty_invuomratio) * (invcitem_price / invcitem_price_invuomratio)) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM invchead
JOIN invcitem ON (invcitem_invchead_id = invchead_id)
WHERE (1=1)
GROUP BY prj_id
-
-<? endif ?>
+
+<? endif ?>
<? if exists("showWo") ?>
UNION ALL
------ WORK ORDERS -------
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
40 AS type,
'0' AS subtype,
4 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL::numeric AS qty,
NULL::text AS uom,
NULL::numeric AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
- FROM wo
+ FROM wo
JOIN prj() ON (wo_prj_id=prj_id)
WHERE (1=1)
UNION ALL
-SELECT wo_id AS id,
+SELECT wo_id AS id,
45 AS type,
formatWoNumber(wo_id) AS subtype,
4 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
wo_qtyord AS qty,
uom_name AS uom,
wo_postedvalue AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM wo
UNION ALL
-SELECT -1 AS id,
+SELECT -1 AS id,
49 AS type,
MAX(formatWoNumber(wo_id)) AS subtype,
4 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM(wo_postedvalue) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM wo
<? if exists("showPo") ?>
UNION ALL
------ PURCHASE REQUESTS ------
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
50 AS type,
'0' AS subtype,
5 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL::numeric AS qty,
NULL::text AS uom,
NULL::numeric AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM pr
UNION ALL
-SELECT pr_id AS id,
+SELECT pr_id AS id,
55 AS type,
pr_number::text || '-' || pr_subnumber::text AS subtype,
5 AS section,
prj_id AS project,
<? value("prs") ?> AS section_qtdisplayrole,
pr_number::text || '-' || pr_subnumber::text AS name,
- <? value("open") ?> AS status,
+ <? value("open") ?> AS status,
NULL::text AS project_type,
NULL::text AS prj_username,
NULL::text AS prj_owner_username,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
pr_qtyreq AS qty,
uom_name AS uom,
stdcost(item_id) * pr_qtyreq AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM pr
UNION ALL
-SELECT -1 AS id,
+SELECT -1 AS id,
59 AS type,
MAX(pr_number::text || '-' || pr_subnumber::text) AS subtype,
5 AS section,
NULL::text AS prj_owner_username,
NULL::text AS item,
NULL::text AS descrip,
- NULL::text AS customer,
+ NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM(stdcost(item_id) * pr_qtyreq) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM pr
JOIN item ON (itemsite_item_id = item_id)
WHERE (1=1)
GROUP BY prj_id
-
+
UNION ALL
------ PURCHASE ORDERS ------
-SELECT DISTINCT -1 AS id,
+SELECT DISTINCT -1 AS id,
60 AS type,
'0' AS subtype,
6 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL::numeric AS qty,
NULL::text AS uom,
NULL::numeric AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
1 AS xtindentrole
FROM poitem
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL AS uom,
NULL AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM pohead
UNION ALL
-SELECT poitem_id AS id,
+SELECT poitem_id AS id,
67 AS type,
pohead_number::text AS subtype,
6 AS section,
prj_id AS project,
<? value("pos") ?> AS section_qtdisplayrole,
- poitem_linenumber::text AS name,
+ poitem_linenumber::text AS name,
CASE WHEN (poitem_status = 'U') THEN
<? value("unreleased") ?>
WHEN (poitem_status = 'O') THEN
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
poitem_qty_ordered,
poitem_vend_uom AS uom,
(poitem_qty_ordered * poitem_unitprice) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
3 AS xtindentrole
FROM pohead
UNION ALL
-SELECT pohead_id AS id,
+SELECT pohead_id AS id,
68 AS type,
pohead_number::text AS subtype,
6 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM(poitem_qty_ordered * poitem_unitprice) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM pohead
UNION ALL
-SELECT -1 AS id,
+SELECT -1 AS id,
69 AS type,
MAX(pohead_number::text) AS subtype,
6 AS section,
NULL::text AS customer,
NULL::text AS contact,
NULL::text AS city,
- NULL::text AS state,
+ NULL::text AS state,
NULL AS qty,
NULL::text AS uom,
SUM(poitem_qty_ordered * poitem_unitprice) AS value,
NULL::numeric AS exp_budget,
NULL::numeric AS exp_actual,
NULL::numeric AS exp_balance,
-
+
NULL::text AS due_qtforegroundrole,
2 AS xtindentrole
FROM pohead
JOIN poitem ON (poitem_pohead_id = pohead_id)
JOIN prj() ON (poitem_prj_id=prj_id)
WHERE (1=1)
- GROUP BY prj_id
+ GROUP BY prj_id
<? endif ?>
<? if exists("username") ?>
AND (prj_username=<? value("username") ?> OR prj_owner_username=<? value("username") ?>)
<? endif ?>
-<? if exists("assigned_username") ?>
- AND (prj_username=<? value("assigned_username") ?>)
+<? if exists("assigned_username") ?>
+ AND (prj_username=<? value("assigned_username") ?>)
<? elseif exists("assigned_usr_pattern") ?>
- AND (prj_username ~ <? value("assigned_usr_pattern") ?>)
+ AND (prj_username ~ <? value("assigned_usr_pattern") ?>)
<? endif ?>
-<? if exists("owner_username") ?>
+<? if exists("owner_username") ?>
AND (prj_owner_username=<? value("owner_username") ?>)
<? elseif exists("owner_usr_pattern") ?>
- AND (prj_owner_username ~ <? value("owner_usr_pattern") ?>)
+ AND (prj_owner_username ~ <? value("owner_usr_pattern") ?>)
<? endif ?>
<? if exists("crmacct_id") ?>
AND project IN (SELECT prj_id FROM prj WHERE (prj_crmacct_id=<? value("crmacct_id") ?>))
AND project IN (SELECT wo_prj_id FROM wo WHERE wo_id=<? value("wo_id") ?>)
<? endif ?>
<? if exists("pohead_id") ?>
- AND project IN (SELECT poitem_prj_id FROM pohead JOIN poitem ON (pohead_id=poitem_pohead_id)
+ AND project IN (SELECT poitem_prj_id FROM pohead JOIN poitem ON (pohead_id=poitem_pohead_id)
WHERE pohead_id=<? value("pohead_id") ?>)
<? endif ?>
-<? if exists("prjtype_id") ?>
- AND project IN (SELECT prj_id FROM prj WHERE prj_prjtype_id = <? value("prjtype_id") ?>)
-<? endif ?>
-
ORDER BY project, section, subtype, type, id;