| 83 | Пресметка на цена |
| 84 | {{{#!sql |
| 85 | select |
| 86 | case |
| 87 | when p.type_of_technology = '3D' and to_char( p.date_time_start , 'dy' ) ilike 'sat' |
| 88 | and to_char( p.date_time_start , 'dy' ) ilike 'fri' |
| 89 | and to_char( p.date_time_start , 'dy' ) ilike 'sun' |
| 90 | then 360 |
| 91 | when p.type_of_technology = '3D' and to_char( p.date_time_start , 'dy' ) ilike 'mon' |
| 92 | and to_char( p.date_time_start , 'dy' ) ilike 'tue' |
| 93 | and to_char( p.date_time_start , 'dy' ) ilike 'wen' |
| 94 | and to_char( p.date_time_start , 'dy' ) ilike 'thu' |
| 95 | then 330 |
| 96 | when p.type_of_technology = '3D' and p.date_time_start=f.start_date then 370 |
| 97 | when p.type_of_technology = '2D' and to_char( p.date_time_start , 'dy' ) ilike 'sat' |
| 98 | and to_char( p.date_time_start , 'dy' ) ilike 'fri' |
| 99 | and to_char( p.date_time_start , 'dy' ) ilike 'sun' |
| 100 | then 290 |
| 101 | when p.type_of_technology = '2D' and to_char( p.date_time_start , 'dy' ) ilike 'mon' |
| 102 | and to_char( p.date_time_start , 'dy' ) ilike 'tue' |
| 103 | and to_char( p.date_time_start , 'dy' ) ilike 'wen' |
| 104 | and to_char( p.date_time_start , 'dy' ) ilike 'thu' |
| 105 | then 270 |
| 106 | when p.type_of_technology = '2D' and p.date_time_start=f.start_date then 300 |
| 107 | else 250 |
| 108 | end |
| 109 | + |
| 110 | case |
| 111 | when f.duration between 120 and 140 then 30 |
| 112 | when f.duration<120 then 0 |
| 113 | when f.duration between 140 and 180 then 60 |
| 114 | when f.duration>180 then 80 |
| 115 | end |
| 116 | from tickets t |
| 117 | left join projections p on p.id_projection=t.id_projection |
| 118 | left join films f on f.id_film = p.id_film |
| 119 | left join discounts d on d.id_discount = t.id_discount |
| 120 | where t.id_ticket = 1 |
| 121 | }}} |