CORE-POS/IS4C

View on GitHub
documentation/Reference Code/Wedge/installation/mysql/translog/views/receipt.viw

Summary

Maintainability
Test Coverage
use translog;
DROP VIEW IF EXISTS `receipt`;

CREATE view receipt as

select

case 
    when trans_type = 'T'
        then     concat(right( concat(space(44), upper(rtrim(Description)) ), 44) 
            , right(concat( space(8), (-1 * Total)), 8) 
            , right(concat(space(4), status), 4))
    when voided = 3 
        then     concat(left(concat(Description, space(30)), 30) 
            , space(9) 
            , 'TOTAL' 
            , right(concat(space(8), UnitPrice), 8))
    when voided = 2
        then     description
    when voided = 4
        then     description
    when voided = 6
        then     description
    when voided = 7 or voided = 17
        then     concat(left(concat(Description, space(30)), 30) 
            , space(14) 
            , right(concat(space(8), UnitPrice), 8) 
            , right(concat(space(4), status), 4))

    else
        concat(left(concat(Description, space(30)), 30)
        , ' ' 
        , left(concat(Comment, space(13)), 13) 
        , right(concat(space(8), Total), 8) 
        , right(concat(space(4), status), 4))

end
as linetoprint

from ltt_receipt
order by trans_id