Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT RES.* FROM (
- SELECT SR.sr_id, TSIV.sr_item_id, TSIV.rank, TSIV.entry, U.description AS unit_desc, CT.description AS ct_desc, SR.appt_start, CA.site_city, CA.site_state,
- dbo.conditional_flat_rate_description(TSIV.entry, TSIV.cost_under_max_rate, TSIV.cost_over_max_rate, TSIV.cost_min_units, TSIV.cost_max_units, TSIV.cost_description, TSIV.cost_show_math, NULL) AS 'statement_description',
- round(dbo.conditional_flat_rate1(TSIV.entry, TSIV.cost_under_max_rate, TSIV.cost_over_max_rate, TSIV.cost_min_units, TSIV.cost_max_units, TSIV.statement_description, TSIV.statement_amount), 2) AS 'statement_amount' FROM sr SR
- INNER JOIN ctn CTN ON SR.ctn_id = CTN.ctn_id
- INNER JOIN ctn_address CA ON CTN.ctn_id = CA.ctn_id
- INNER JOIN ctn_type CT ON CTN.ctn_type_id = CT.ctn_type_id
- LEFT JOIN total_sr_items_vw TSIV ON SR.sr_id = TSIV.sr_id
- LEFT JOIN units U ON TSIV.unit_id = U.unit_id
- LEFT JOIN cost_rates CR ON TSIV.cost_rate_id = CR.cost_rate_id
- WHERE SR.sr_id IN($srIds)
- )RES
- WHERE RES.statement_amount != 0
Add Comment
Please, Sign In to add comment