<srs>
<def>
<!--Get data from command `view` -->
<itm model="command" type="v_srs_map" name="Map" label="Mapa" link="self" >
<![CDATA[
SELECT
latitude
,longitude
,'test' as text
,true as permament
FROM
view where latitude is not null limit 300
]]>
</itm>
<itm model="command" name="view" label="SPRAWY/ZGŁOSZENIA" opts="clipboard" >
<![CDATA[
SELECT
ie.ieventID,
ie.ieventnr,
ie.ieventlocation,
ie.ieventsummary,
f.firmNameShort,
cs.commisionFullNR,
ie.ieventdate,
ie.ieventtime,
ie.ieventtags,
ie.status,
ie.addDate,
ie.addUsername,
ie.modDate,
ie.latitude,
ie.longitude,
f.firmID
FROM [event].[ievent] ie
LEFT JOIN (SELECT ff.firmID, ff.firmNameShort, cr.objectSource, cr.objectID, cr.remoteID FROM firm.firm ff
LEFT JOIN common.relation cr on ff.firmID = cr.objectID AND cr.objectSource = 'firm'
) f ON f.objectSource = 'firm' AND f.remoteID = ie.iEventID
LEFT JOIN (SELECT wc.commisionID, wc.commisionFullNR, cr.objectSource, cr.objectID, cr.remoteID FROM wms.commision wc
LEFT JOIN common.relation cr on wc.commisionID = cr.objectID AND cr.objectSource = 'commisionservice'
) cs ON cs.objectSource = 'commisionservice' AND cs.remoteID = ie.iEventID
INNER join [app].[user_teams] ut on ie.groupid = ut.team_id and ut.user_id = @userid
INNER join [app].[teams] ts on ut.team_id = ts.team_id
ORDER BY ie.addDate DESC
]]>
</itm>
</def>
</srs>