Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

use realtime

SELECT id, short_name, b.name_location,


case
when term_mode = 0 then 'ATM_Offline'
when term_mode = 1 then 'ATM_INService'
when term_mode = 2 then 'ATM_INService'
when term_mode = 3 then 'ATM_Closed'
when term_mode = 4 then 'ATM_Supervisor_Mode'
else convert(char(1),term_mode)
end term_mode
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)
ORDER BY term_mode, short_name
--**************************************************************************
select a.id, --------CASH JAM------------------a.short_name,b.name_location, 'CashHandlerFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,09,02) = '02'
--**********************************************************************
select a.id, --------TRANSPORT WAY NOT FREE------------------a.short_name,b.name_location, 'CashHandlerSuspect' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,09,02) = '01'
--**********************************************************************
select a.id, ------RECEIPT PRINTER FAULTY-----------------short_name,b.name_location,'ReceiptPrinterFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,13,2) = '02'
--*******************************************************************
select a.id,----------RECEIPT PAPER LOW-----------------------short_name, b.name_location,'ReceiptPaperLow' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,13,2) = '01'
--***************************************************************
select a.id,-----------------JOURNAL PRINTER FAULTY-------------------a.short_name,b.name_location, 'JournalPrinterFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,15,2) = '02'
--****************************************************************************
select a.id,------------JOURNAL PAPER LOW-------------------a.short_name,b.name_location,'JournalPaperLow' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,15,2) = '01'
--*********************************************************************
select a.id,------------ENCRYPTOR FAULTY-------------------a.short_name,b.name_location,'EncryptorFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,19,2) = '02'
--*********************************************************************
select a.id,------------CARD READER SUSPECT-------------------a.short_name,b.name_location,'CardReaderSuspect' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,7,2) = '01'
--*********************************************************************
select a.id,------------CARD READER FAULTY-------------------a.short_name,b.name_location,'CardReaderFaulty' as Fault
FROM term a,tm_card_acceptor b

where a.id=substring (b.card_acceptor,1,8)and substring(a.status,7,2) = '02'


--*********************************************************************
select a.term_id AS Terminal,--------------CASH LEVEL---------b.short_name AS Shortname,d.name_location AS Location,
sum(a.item_value / 100) AS Amount
FROM
dbo.ssf_media_cassette a, dbo.term b, dbo.ssf_media_type c, tm_card_acceptor d
WHERE
b.id = substring (d.card_acceptor,1,8)
and a.term_id=b.id
and a.type_id = c.type_id
and (c.media_class = 'Cash')
AND (c.media_value <> 0)
group by a.term_id, b.short_name,d.name_location

==============================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
==============================================================================
create view terminal_status_vw
as
SELECT id, short_name, b.name_location,term_mode
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)
create view terminal_fault_vw
as
--**************************************************************************
select a.id, --------CASH JAM------------------a.short_name,b.name_location, 'CashHandlerFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,09,02) = '02'
--**********************************************************************
union
select a.id, --------TRANSPORT WAY NOT FREE------------------a.short_name,b.name_location, 'CashHandlerSuspect' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,09,02) = '01'
--**********************************************************************
union
select a.id, ------RECEIPT PRINTER FAULTY-----------------short_name,b.name_location,'ReceiptPrinterFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,13,2) = '02'
--*******************************************************************
union
select a.id,----------RECEIPT PAPER LOW-----------------------short_name, b.name_location,'ReceiptPaperLow' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,13,2) = '01'
--***************************************************************
union
select a.id,-----------------JOURNAL PRINTER FAULTY-------------------a.short_name,b.name_location, 'JournalPrinterFaulty' as Fault

FROM term a,tm_card_acceptor b


where a.id=substring (b.card_acceptor,1,8)and substring(a.status,15,2) = '02'
--****************************************************************************
union
select a.id,------------JOURNAL PAPER LOW-------------------a.short_name,b.name_location,'JournalPaperLow' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,15,2) = '01'
--*********************************************************************
union
select a.id,------------ENCRYPTOR FAULTY-------------------a.short_name,b.name_location,'EncryptorFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,19,2) = '02'
--*********************************************************************
union
select a.id,------------CARD READER SUSPECT-------------------a.short_name,b.name_location,'CardReaderSuspect' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,7,2) = '01'
--*********************************************************************
union
select a.id,------------CARD READER FAULTY-------------------a.short_name,b.name_location,'CardReaderFaulty' as Fault
FROM term a,tm_card_acceptor b
where a.id=substring (b.card_acceptor,1,8)and substring(a.status,7,2) = '02'
--*********************************************************************
create view atm_cash_level_vw as
select a.term_id,--------------CASH LEVEL---------b.short_name,d.name_location,
sum(a.item_value / 100) AS Amount
FROM
dbo.ssf_media_cassette a, dbo.term b, dbo.ssf_media_type c, tm_card_acceptor d
WHERE
b.id = substring (d.card_acceptor,1,8)
and a.term_id=b.id
and a.type_id = c.type_id
and (c.media_class = 'Cash')
AND (c.media_value <> 0)
group by a.term_id, b.short_name,d.name_location

You might also like