SELECT {FIELDS} FROM CRMActivities A
{JOIN}
WHERE
(
/* Sekce pro Verejne aktivity, zobrazi se vsem*/
(A.IsPrivate = 'N')
or
(
/* Sekce pro neverejne aktivity */
(A.IsPrivate = 'A')
and
(
/* Test na supervizora a privilegium "Videt neverejne aktivity" */
({$HasActivityPrivilege} = 'A')
or
(
/* Test na Zadavatele, Resitele, prip jeho nadrizene, nebo vyresitele*/
(A.CreatedBy_ID = {$ActualUser})
or
(A.ResolvedBy_ID = {$ActualUser})
or
(A.SolverRole_ID in
(select L.Role_ID from SecurityUserRoleLinks L where L.User_ID = {$ActualUser}))
or
(A.SolverUser_ID = {$ActualUser})
or
(A.SolverRole_ID in
(select SSR2.ID from SYS$SecurityRoles2 SSR2
join SecurityUserRoleLinks L on L.Role_ID = SSR2.Superior_ID and L.User_ID = {$ActualUser}))
or
(A.SolverUser_ID in
(select L.User_ID from SecurityUserRoleLinks L
join SYS$SecurityRoles2 SSR2 on SSR2.ID = L.Role_ID
join SecurityUserRoleLinks L2 on L2.Role_ID = SSR2.Superior_ID and L2.User_ID = {$ActualUser}))
)
or
/* Test na ucastniky */
(A.ID in ( select Y.parent_id from crmactivityparticipants Y where
(Y.parent_id=A.ID)
and
(
(Y.participantrole_id is not null and Y.participantrole_id in
(select L.role_id from securityuserrolelinks L where L.user_id = {$ActualUser})
)
or
(Y.participantuser_id is not null and Y.participantuser_id = {$ActualUser})
)
)
)
)
)
)
{ANDWHERE}
{ORDERBY}
| Alias | CLSID objektu | Prefix | Popis |
|---|---|---|---|
| A | AVV1JYV5AVNOZHQCK0D4CJFUCS | ||
| AA | N53352D4AKB43AMHHSYG1UKFVW | ActArea | Oblast aktivit |
| AQ | V4ZWII12WD3O3IRJZW04M00DMK | ActQueue | Řada aktivit |
| BO | K2WTYL304VD13ACL03KIU0CLP4 | BusOrder | Zakázka |
| BP | QOKMKIQUJF34L3DUICTBWEDQJC | BusProject | Projekt |
| BT | KAWTYL304VD13ACL03KIU0CLP4 | BusTransaction | Obchodní případ |
| DIV | O1X54EUXPZCL35CH000ILPWJF4 | Division | Středisko |
| F | 4K3EXM5PQBCL35CH000ILPWJF4 | Firm | Firma |
| FO | AT011EZZ5DFO115YJ1HCZJDXJ4 | FirmOffice | Provozovna |
| P | CAQPAYUOXVCL3ACL03KIU0CLP4 | Period | Období |
| PE | WEC02QYERNCL35CH000ILPWJF4 | Person | Osoba |
| PLS | 0XVIXAV11TY4NIKAG0INVQKJ2C | PipeLineStatus | Pravděpodobnost úspěchu |
| PRG | BI2G1QCE021OXBQUM3UYAM0OWS | Progress | Krok v procesu |
| SR | QRDGQ1DV2CU4D3TOUMORZ0LWIW | SolverRole | Role řešitele |
| ST | SKWQTWWJXVY4X50WACKKGG0YDO | ActivityProcess | Proces aktivity |
| SU1 | 22AHIVDVAVE13C5S00CA141B44 | CreatedBy | Vytvořil uživatel |
| SU2 | 22AHIVDVAVE13C5S00CA141B44 | SolverUser | Řešitel |
| SU3 | 22AHIVDVAVE13C5S00CA141B44 | ResolvedBy | Vyřešil |
| TT | SMOEDRFJASV4P4XCFPYBZ1UYYO | ActivityType | Typ aktivity |
SELECT {FIELDS} FROM
CRMActivityPictures Pic
{JOIN}
WHERE
Pic.Parent_ID=:ID
ORDER BY
Pic.PosIndex
| Alias | CLSID objektu | Prefix | Popis |
|---|---|---|---|
| P | S1AUUMOM3REL3C5V00CA141B44 | Picture | Obrázek |
| Pic | CCLLH0VEKPCOFJA3NUGMMPYRDW | Pic | CRM aktivity - obrázky |
SELECT {FIELDS} FROM
CRMActivityParticipants CAP
WHERE
CAP.Parent_ID=:ID
| Alias | CLSID objektu | Prefix | Popis |
|---|---|---|---|
| CAP | 1FIXUH0DFVH4P40OT1X52GRLSK |
SELECT {FIELDS} FROM
CRMActivityTimeRecords CARM
WHERE
CARM.Parent_ID=:ID
| Alias | CLSID objektu | Prefix | Popis |
|---|---|---|---|
| CARM | 35YOTP3OM404LBN2C0BXGQI1E4 |
##CASEOR {:VALUE} #
##0#
(A.SolverRole_ID is not null and A.SolverRole_ID in
(select L.Role_ID from SecurityUserRoleLinks L where L.User_ID = {$ActualUser}))
or
(A.SolverUser_ID is not null and A.SolverUser_ID = {$ActualUser})
##1#
(A.SolverRole_ID is not null and A.SolverRole_ID in
(select SSR2.ID from SYS$SecurityRoles2 SSR2
join SecurityUserRoleLinks L on L.Role_ID = SSR2.Superior_ID and L.User_ID = {$ActualUser}))
or
(A.SolverUser_ID is not null and A.SolverUser_ID in
(select L.User_ID from SecurityUserRoleLinks L
join SYS$SecurityRoles2 SSR2 on SSR2.ID = L.Role_ID
join SecurityUserRoleLinks L2 on L2.Role_ID = SSR2.Superior_ID and L2.User_ID = {$ActualUser}))
##2#
(A.SolverRole_ID is not null and A.SolverRole_ID in
(select L.Role_ID from SecurityUserRoleLinks L where L.User_ID = {$ActualUser}))
or
(A.SolverUser_ID is not null and A.SolverUser_ID = {$ActualUser})
or
(A.SolverRole_ID is not null and A.SolverRole_ID in
(select SSR2.ID from SYS$SecurityRoles2 SSR2
join SecurityUserRoleLinks L on L.Role_ID = SSR2.Superior_ID and L.User_ID = {$ActualUser}))
or
(A.SolverUser_ID is not null and A.SolverUser_ID in
(select L.User_ID from SecurityUserRoleLinks L
join SYS$SecurityRoles2 SSR2 on SSR2.ID = L.Role_ID
join SecurityUserRoleLinks L2 on L2.Role_ID = SSR2.Superior_ID and L2.User_ID = {$ActualUser}))
##END#
(A.ActivityProcess_ID is null)
##CASEOR {:VALUE} #
##1#A.Status = 0
##2#A.Status = 1
##3#A.Status = 2
##4#A.Status = 3
##END#
A.IsPrivate = {:VALUE}
/* Omezeni za role s moznosti vsech podrizenych */
(
/* timhle omezime vsechny prime nadrizene */
(A.SolverRole_ID = (select Bx.ID from SecurityRoles Bx where Bx.ID = {:VALUE}))
or
/* a jestli mame omezeit za podrizene tak to udelame takhle */
({WithChildren} = 1 AND
(A.SolverRole_ID in
(select Bx.ID from SecurityRoles Bx where
Bx.ID in (select B2x.ID from Sys$SecurityRoles2 B2x where B2x.Superior_ID = {:VALUE})
)
)
)
)
/* Omezeni za role s moznosti vsech podrizenych */
(
/* timhle omezime vsechny prime nadrizene */
(A.SolverRole_ID in (select Bx.ID from SecurityRoles Bx where Bx.ID in ({:LIST})))
or
/* a jestli mame omezeit za podrizene tak to udelame takhle */
({WithChildren} = 1 AND
(A.SolverRole_ID in
(select Bx.ID from SecurityRoles Bx where
Bx.ID in (select B2x.ID from Sys$SecurityRoles2 B2x where B2x.Superior_ID in ({:LIST}))
)
)
)
)
A.SolverUser_ID = {:VALUE}
A.SolverUser_ID IN ({:LIST})
((A.SolverUser_ID = {:VALUE} or
(A.ID in ( select Y.parent_id from crmactivityparticipants Y where
(Y.parent_id=A.ID)
and
(Y.participantuser_id is not null and Y.participantuser_id = {:VALUE})
)
)
))
(A.SolverUser_ID IN ({:LIST}) or
(A.ID in ( select Y.parent_id from crmactivityparticipants Y where
(Y.parent_id=A.ID)
and
(Y.participantuser_id is not null and Y.ParticipantUser_ID IN ({:LIST}))
)
)
)
A.ResolvedBy_ID = {:VALUE}
A.ResolvedBy_ID IN ({:LIST})
A.SheduledStart$DATE >= {:LOW} and
A.SheduledStart$DATE < {:HIGH} and
TT.issheduled='A'
A.SheduledEnd$DATE >= {:LOW} and
A.SheduledEnd$DATE < {:HIGH} and
TT.issheduled='A'
(A.SheduledEnd$DATE - A.SheduledStart$DATE) >= {:LOW} and
(A.SheduledEnd$DATE - A.SheduledStart$DATE) <= {:HIGH} and
TT.issheduled='A'
A.RealStart$DATE >= {:LOW} and
A.RealStart$DATE < {:HIGH}
A.RealEnd$DATE >= {:LOW} and
A.RealEnd$DATE < {:HIGH}
(A.RealEnd$DATE - A.RealStart$DATE) >= {:LOW} and
(A.RealEnd$DATE - A.RealStart$DATE) <= {:HIGH}
A.Firm_ID IS NULL
(A.Firm_ID IN (SELECT ID FROM Firms WHERE (ID IN ({:LIST})) OR (Firm_ID IN ({:LIST}))))
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
Y.Firm_ID IN (SELECT ID FROM Firms WHERE (ID IN ({:LIST})) OR (Firm_ID IN ({:LIST})))
)
)
)
(A.Firm_ID IN (SELECT ID FROM Firms WHERE ID={:VALUE} OR Firm_ID={:VALUE}))
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
Y.Firm_ID IN (SELECT ID FROM Firms WHERE ID={:VALUE} OR Firm_ID={:VALUE})
)
)
)
(A.FirmOffice_ID={:VALUE})
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
Y.FirmOffice_ID={:VALUE})
)
)
A.FirmOffice_ID IN ({:LIST})
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
Y.FirmOffice_ID IN ({:LIST}))
)
)
A.Person_ID IN ({:LIST})
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
Y.Person_ID IN ({:LIST}))
)
)
A.Person_ID is Null
(A.Person_ID = {:VALUE})
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
Y.Person_ID={:VALUE})
)
)
(A.ContactNote LIKE {:VALUE} ESCAPE '~')
OR
(
(A.ID IN
(SELECT
Y.Parent_ID
FROM
CRMActivityContacts Y
WHERE
Y.Parent_ID=A.ID AND
(Y.Note LIKE {:VALUE} ESCAPE '~'))
)
)
A.ID IN (SELECT Y.LEFTSIDE_ID FROM Relations Y {:WHERE})
Y.RIGHTSIDE_ID = {:VALUE}
Y.REL_DEF = {:VALUE}
A.CreatedAt$DATE >= {:LOW} and
A.CreatedAt$DATE < {:HIGH}
A.CorrectedAt$DATE >= {:LOW} and
A.CorrectedAt$DATE < {:HIGH}
TT.BusinessRelationship = {:VALUE}
{:ANDWHERE}
TableName=CRMActivityParticipants
Alias=Y
CheckBoxCaption=Rozšířit o doklady bez účastníků
Y.ParticipantUser_ID = {:VALUE}
Y.ParticipantUser_ID IN ({:LIST})
/* Omezeni za role s moznosti vsech podrizenych */
(
/* timhle omezime vsechny prime nadrizene */
(Y.ParticipantRole_ID in (select Bx.ID from SecurityRoles Bx where Bx.ID = ({:LIST})))
or
/* a jestli mame omezeit za podrizene tak to udelame takhle */
({WithChildren} = 1 AND
(Y.ParticipantRole_ID in
(select Bx.ID from SecurityRoles Bx where
Bx.ID in (select B2x.ID from Sys$SecurityRoles2 B2x where B2x.Superior_ID = ({:LIST}))
)
)
)
)
/* Omezeni za role s moznosti vsech podrizenych */
(
/* timhle omezime vsechny prime nadrizene */
(Y.ParticipantRole_ID in (select Bx.ID from SecurityRoles Bx where Bx.ID in ({:LIST})))
or
/* a jestli mame omezeit za podrizene tak to udelame takhle */
({WithChildren} = 1 AND
(Y.ParticipantRole_ID in
(select Bx.ID from SecurityRoles Bx where
Bx.ID in (select B2x.ID from Sys$SecurityRoles2 B2x where B2x.Superior_ID in ({:LIST}))
)
)
)
)
{:ANDWHERE}
TableName=CRMActivityTimeRecords
Alias=Y
CheckBoxCaption=Rozšířit o doklady bez evidence času
(exists (select ID from CRMActivityTimeRecords CTR where (A.ID = CTR.Parent_ID) and (CTR.Worker_ID = {:VALUE})))
(exists (select ID from CRMActivityTimeRecords CTR where (A.ID = CTR.Parent_ID) and (CTR.Worker_ID IN ({:LIST}))))
Y.TimeOfWork BETWEEN {:LOW} and {:HIGH}
(Y.DateOfRecord$DATE >= {:LOW}) and
(Y.DateOfRecord$DATE < {:HIGH})
AQ.Code Collate PXW_CSY {DIR},
P.Code Collate PXW_CSY {DIR},
A.OrdNumberAQ.Code Collate PXW_CSY {DIR},A.ActQueue_IDP.Code Collate PXW_CSY {DIR},A.Period_IDA.OrdNumber
TT.Code Collate PXW_CSY {DIR},A.ActivityType_IDST.Code Collate PXW_CSY {DIR},A.ActivityProcess_IDA.Status
A.Priority
A.IsPrivate
SU1.Name Collate PXW_CSY {DIR}, A.CreatedBy_IDSR.Name Collate PXW_CSY {DIR}, A.SolverRole_IDSU2.Name Collate PXW_CSY {DIR}, A.SolverUser_IDA.SheduledStart$DATE
A.SheduledEnd$DATE
A.RealStart$DATE
A.RealEnd$DATE
A.Subject
F.Name Collate PXW_CSY {DIR},A.Firm_IDA.RealStart$DATE
A.RealEnd$DATE
FO.Name Collate PXW_CSY {DIR},A.FirmOffice_IDBO.Code Collate PXW_CSY {DIR}, A.BusOrder_IDBT.Code Collate PXW_CSY {DIR}, A.BusTransaction_IDA.NextContact$Date
PRG.Name Collate PXW_CSY {DIR}, A.Progress_IDPLS.Name Collate PXW_CSY {DIR}, A.PipeLineStatus_IDA.FinancialVolume
A.TradeDate$DATE
BP.Code Collate PXW_CSY {DIR}, A.BusProject_IDDIV.Code Collate PXW_CSY {DIR}, A.Division_IDPE.LastName Collate PXW_CSY {DIR},
PE.FirstName Collate PXW_CSY {DIR},
A.Person_ID%NextContactState%
Generated by ABRA Software a.s. 27.10.2021 16:36