| | 263 | ==== Filtr okresu urlopu ==== |
| | 264 | |
| | 265 | {{{ |
| | 266 | pocz_urlop in (select s FROM generate_series('2008-03-01 00:00'::timestamp,'2050-03-04 00:00', '1 day') as S where s {value}) |
| | 267 | or |
| | 268 | kon_urlop in (select s FROM generate_series('2008-03-01 00:00'::timestamp,'2050-03-04 00:00', '1 day') as S where s {value}) |
| | 269 | or |
| | 270 | (pocz_urlop < (select min(s) FROM generate_series('2008-03-01 00:00'::timestamp,'2050-03-04 00:00', '1 day') as S where s {value}) |
| | 271 | and |
| | 272 | kon_urlop > (select max(s) FROM generate_series('2008-03-01 00:00'::timestamp,'2050-03-04 00:00', '1 day') as S where s {value})) |
| | 273 | |
| | 274 | select coalesce( |
| | 275 | (select min(CAST(f1.data__ AS date) -interval '1 day') ::date |
| | 276 | FROM documents doc |
| | 277 | LEFT JOIN features_text_view f1 ON doc.doc_id = f1.tbl_id AND f1.featid = 4 /*data od*/ |
| | 278 | where dctpid = 24 AND gostof IS NULL and copyof is null AND doc.is_del IS FALSE and f1.data__ is not null), current_date::date-interval '1 day') |
| | 279 | union |
| | 280 | select coalesce( |
| | 281 | (select max(CAST(f1.data__ AS date))::date |
| | 282 | FROM documents doc |
| | 283 | LEFT JOIN features_text_view f1 ON doc.doc_id = f1.tbl_id AND f1.featid = 4 /*data od*/ |
| | 284 | where dctpid = 24 AND gostof IS NULL and copyof is null AND doc.is_del IS FALSE and f1.data__ is not null),current_date::date) |
| | 285 | }}} |
| | 286 | |
| | 287 | |
| | 288 | |