'##############
'Ticketprinter-Script
'##############

'Simulates ticket printer - EMKE

'(c) 12.01..2010 Rüdiger Hülsmann

'Script Version: 1.0
'Omsi release: 1.0

'Needs:
'- elec


'Revision History:
'-	Rüdiger Hülsmann	12.01.2011	File created
'-	Rüdiger Hülsmann	15.01.2011	Functions added
'-	nemeza				


'----------------------
'	Trigger
'----------------------
{trigger:IBIS_1}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	1 (M.L.IBIS_Zahlentasten)
	{endif}
{end}


{trigger:IBIS_2}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	2 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_3}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	60 (S.L.emke_tp_led_counter)
	3 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_4}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	60 (S.L.emke_tp_led_counter)
	4 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_5}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	5 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_6}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	6 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_7}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	7 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_8}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	8 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_9}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	9 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:IBIS_0}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	0 (M.L.IBIS_Zahlentasten)
	{endif}
{end}

{trigger:emke-tp_route_memcard-insert}
	1 (S.L.emke_tp_route_memcard_pos)
{end}

{trigger:emke-tp_route_memcard-remove}
	0 (S.L.emke_tp_route_memcard_pos)
{end}

{trigger:emke-tp_driver_memcard-insert}
	1 (S.L.emke_tp_driver_memcard_pos)
{end}

{trigger:emke-tp_driver_memcard-remove}
	0 (S.L.emke_tp_driver_memcard_pos)
{end}

{trigger:IBIS_setmode_linie_kurs}
{trigger:emke-tp_button-on}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		(L.L.emke_tp_active) 0 =
		{if}
			 0.1 (S.L.emke_tp_active)
		{else}
			60 (S.L.emke_tp_led_counter)
			(L.L.emke_tp_mode) 8 =
			(L.L.emke_tp_mode) 5 = ||
			{if}
				(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
			{endif}
		{endif}
	{endif}
	1 (S.L.emke_tp_g_on)
	(T.L.ev_printer_button_on)
{end}
{end}

{trigger:IBIS_setmode_linie_kurs_off}
{trigger:emke-tp_button-on_off}
	(T.L.ev_printer_button_off)
	0 (S.L.emke_tp_g_on)
{end}
{end}

{trigger:emke-tp_button-off}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		0 (S.L.emke_tp_g_off_counter)
		1 (S.L.emke_tp_g_off)
		(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:emke-tp_button-off_off}
	(T.L.ev_printer_button_off)
	0 (S.L.emke_tp_g_off)
{end}

{trigger:emke-tp_button-shift}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	(T.L.ev_printer_button_on)
	60 (S.L.emke_tp_led_counter)
	0 (S.L.emke_tp_g_off_counter)
	1 (S.L.emke_tp_g_shift)
	(L.L.emke_tp_mode) 2 >
	(L.L.emke_tp_mode) 6 < &&
	{if}
		(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
		{if}
			(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
		{endif}
		8 (S.L.emke_tp_mode)
	{else}
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	{endif}
	{endif}
{end}

{trigger:emke-tp_button-shift_off}
	(T.L.ev_printer_button_off)
'	0 (S.L.emke_tp_g_shift)
{end}

{trigger:emke-tp_button-percent}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(T.L.ev_printer_button_on)	
	1 (S.L.emke_tp_g_percent)
	(L.L.emke_tp_mode) 2 >
	(L.L.emke_tp_mode) 6 < &&
	{if}
		2 (S.L.emke_tp_mode)
		0 (S.L.emke_tp_jarat)
	{endif}
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	{endif}
{end}

{trigger:emke-tp_button-percent_off}
	(T.L.ev_printer_button_off)
	0 (S.L.emke_tp_g_percent)
{end}

{trigger:emke-tp_button-def}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:emke-tp_button-def_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-dollar}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:emke-tp_button-dollar_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-space}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(T.L.ev_printer_button_on)
	(L.L.emke_tp_mode) 3 =
	(L.L.emke_tp_mode) 4 = ||
	{if}
		(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
		{if}
			(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
		{endif}
		5 (S.L.emke_tp_mode)
	{else}
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	{endif}
	
	{endif}
{end}

{trigger:emke-tp_button-space_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-nyille}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)	
'' Lelszálló megálló változtatás számgombokkal
'' Felszálló a nyilakkal (3)
	(L.L.emke_tp_mode) 3 =
	{if}
	(L.L.emke_tp_depart_busstop_index) 1 >
	{if}
		(L.L.emke_tp_depart_busstop_index) 1 - (S.L.emke_tp_depart_busstop_index)
	{else}
		 (L.L.emke_tp_arrive_busstop_index) 1 - (S.L.emke_tp_depart_busstop_index)
	{endif}
	{else}
'' Felszálló megálló változtatás számgombokkal
'' Leszálló a nyilakkal (4)
	(L.L.emke_tp_mode) 4 =
	{if}
	(L.L.emke_tp_arrive_busstop_index) (L.L.emke_tp_depart_busstop_index) 1 + >
	{if}
		(L.L.emke_tp_arrive_busstop_index) 1 - (S.L.emke_tp_arrive_busstop_index)
	{else}
		 (L.L.emke_tp_busstop_count) (S.L.emke_tp_arrive_busstop_index)
	{endif}
	{else}
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	{endif}
	{endif}
	(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:emke-tp_button-nyille_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-nyilfel}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)	
'' Lelszálló megálló változtatás számgombokkal
'' Felszálló a nyilakkal (3)
	(L.L.emke_tp_mode) 3 =
	{if}
	(L.L.emke_tp_depart_busstop_index) (L.L.emke_tp_arrive_busstop_index) 1 - <
	{if}
		(L.L.emke_tp_depart_busstop_index) 1 + (S.L.emke_tp_depart_busstop_index)
	{else}
		 1 (S.L.emke_tp_depart_busstop_index)
	{endif}
	{else}
'' Felszálló megálló változtatás számgombokkal
'' Leszálló a nyilakkal (4)
	(L.L.emke_tp_mode) 4 =
	{if}
	(L.L.emke_tp_arrive_busstop_index) (L.L.emke_tp_busstop_count) < 
	{if}
		(L.L.emke_tp_arrive_busstop_index) 1 + (S.L.emke_tp_arrive_busstop_index)
	{else}
		 (L.L.emke_tp_depart_busstop_index) 1 + (S.L.emke_tp_arrive_busstop_index)
	{endif}
	{else}
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	{endif}
	{endif}
	(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:emke-tp_button-nyilfel_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-nyiljobb}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(T.L.ev_printer_button_on)
'
'		(L.L.emke_tp_mode) 3 =
'		{if}
'			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
'			{if}
'				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
'			{endif}
'			4 (S.L.emke_tp_mode)
'		{else}
'		(L.L.emke_tp_mode) 4 =
		(L.L.emke_tp_mode) 5 =
'		||
		(L.L.emke_tp_mode) 8 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			3 (S.L.emke_tp_mode)
		{endif}
'		{endif}
'
	{endif}
{end}

{trigger:emke-tp_button-nyiljobb_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-nyilbal}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(T.L.ev_printer_button_on)
		(L.L.emke_tp_mode) 4 =		
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			3 (S.L.emke_tp_mode)
		{else}
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 5 = ||
		(L.L.emke_tp_mode) 8 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			4 (S.L.emke_tp_mode)
		{endif}
		{endif}
	{endif}
{end}

{trigger:emke-tp_button-nyilbal_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:emke-tp_button-felk}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
	60 (S.L.emke_tp_led_counter)
	(L.L.emke_tp_mode) 8 =
	(L.L.emke_tp_mode) 5 = ||
	{if}
		(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
	{endif}
	(L.L.emke_tp_ticket_type) 5 <
	{if}
		(L.L.emke_tp_ticket_type) 1 + (S.L.emke_tp_ticket_type)
	{else}
		0 (S.L.emke_tp_ticket_type)
	{endif}
	(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:emke-tp_button-felk_off}
	(T.L.ev_printer_button_off)
{end}
' ----------------------------------------------------------

{trigger:ticketprinter_button_ticket_bianko}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = || &&
		{if}
			(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			7 (S.L.emke_tp_mode)
		{else}
		(L.L.emke_tp_mode) 7 =
		(L.L.emke_tp_mode) 8 = ||
		{if}
			(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
		{else}
		{endif}
		{endif}
		(T.L.ev_printer_button_on)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_bianko_off}
	(T.L.ev_printer_button_off)
{end}

{trigger:ticketprinter_button_ticket_0}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		0 (S.L.ticketprinter_ticket_preselection)
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	
	(L.L.ticketprinter_button_ticket_0) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_ticket_0)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_0_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_ticket_0)
{end}		
			
{trigger:ticketprinter_button_ticket_1}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		1 (S.L.ticketprinter_ticket_preselection)
	
		
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_ticket_1) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_ticket_1)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_1_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_ticket_1)
{end}
	

{trigger:ticketprinter_button_ticket_2}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		2 (S.L.ticketprinter_ticket_preselection)
	
		
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_ticket_2) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_ticket_2)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_2_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_ticket_2)
{end}	


{trigger:ticketprinter_button_ticket_3}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		3 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_ticket_3) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_ticket_3)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_3_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_ticket_3)
{end}


{trigger:ticketprinter_button_ticket_4}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		4 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_ticket_4) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_ticket_4)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_4_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_ticket_4)
{end}

{trigger:ticketprinter_button_dummy_0}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		5 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_dummy_0) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_dummy_0)
	{endif}
{end}

{trigger:ticketprinter_button_dummy_0_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_dummy_0)
{end}


{trigger:ticketprinter_button_dummy_1}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		6 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_dummy_1) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_dummy_1)
	{endif}
{end}

{trigger:ticketprinter_button_dummy_1_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_dummy_1)
{end}


{trigger:ticketprinter_button_dummy_2}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		7 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_dummy_2) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_dummy_2)
	{endif}
{end}

{trigger:ticketprinter_button_dummy_2_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_dummy_2)
{end}


{trigger:ticketprinter_button_dummy_3}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		8 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_dummy_3) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_dummy_3)
	{endif}
{end}

{trigger:ticketprinter_button_dummy_3_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_dummy_3)
{end}


{trigger:ticketprinter_button_dummy_4}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		9 (S.L.ticketprinter_ticket_preselection)
	
		(L.L.emke_tp_mode) 3 =
		(L.L.emke_tp_mode) 4 = ||
		{if}
			(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			7 (S.L.emke_tp_mode)
		{endif}
	(L.L.ticketprinter_button_dummy_4) !
	{if}
		(T.L.ev_printer_button_on)
'		(M.L.ticketprinter_button_enter)
	{endif}
	1 (S.L.ticketprinter_button_dummy_4)
	{endif}
{end}

{trigger:ticketprinter_button_dummy_4_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_dummy_4)
{end}




{trigger:IBIS_loeschen}
{trigger:ticketprinter_button_cancel}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		60 (S.L.emke_tp_led_counter)
		-1 (S.L.ticketprinter_ticket_preselection)
	
	(L.L.ticketprinter_button_cancel) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_cancel)
	60 (S.L.emke_tp_led_counter)
	0 (S.L.emke_tp_g_shift)
	(L.L.emke_tp_mode) 6 = (L.L.emke_tp_errcode) 3 = &&
	(L.L.emke_tp_mode) 1 = ||
	{if}
		1 (S.L.emke_tp_mode)
		0 (S.L.emke_tp_errcode) (S.L.emke_tp_vonal) (S.L.emke_tp_jarat)
		-1 (M.L.IBIS_Zahlentasten)
	{endif}
	(L.L.emke_tp_mode) 6 = (L.L.emke_tp_errcode) 4 = &&
	(L.L.emke_tp_mode) 2 = ||
	{if}
		2 (S.L.emke_tp_mode)
		0 (S.L.emke_tp_errcode) (S.L.emke_tp_jarat)
		-1 (M.L.IBIS_Zahlentasten)
	{endif}
	{endif}
{end}
{end}

{trigger:IBIS_loeschen_off}
{trigger:ticketprinter_button_cancel_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_cancel)
{end}
{end}

{trigger:ticketprinter_getticket}
	0 (S.L.ticketprinter_ticket_pos)
	-1 (S.L.ticketprinter_ticket_selection) (S.L.GivenTicket)
	(T.L.ev_ticketsale_giveticket)
{end}

'----------------------
'	Init
'----------------------

{macro:ticketprinter_init}
	-1 (S.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
	0 (S.L.emke_tp_route_memcard_pos) (S.L.emke_tp_driver_memcard_pos) (S.L.emke_tp_ticket_type)
	0 (S.L.emke_tp_led) (S.L.emke_tp_lcdbacklight) (S.L.emke_tp_g_on) (S.L.emke_tp_g_off)
	0 (S.L.emke_tp_led_counter) (S.L.emke_tp_g_off_counter)
	"" (S.$.emke_tp_display) (S.$.emke_tp_sum) (S.$.emke_tp_input_kar) (S.$.emke_tp_input) (S.$.act_busstop)
	-1 (S.L.IBIS_RouteIndex) (S.L.emke_tp_mode)
{end}


'----------------------
'	Frame
'----------------------

{macro:ticketprinter_frame}
(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
{if}

	(L.L.emke_tp_active) 0.9 < (L.L.emke_tp_active) 0.1 >= &&
	{if}
		(L.L.emke_tp_active) (L.S.Timegap) 5 / + (S.L.emke_tp_active)
		0 (S.L.emke_tp_mode)
	{else}
		(L.L.emke_tp_active) 1 < (L.L.emke_tp_active) 0.9 >= &&
		{if}
			1 (S.L.emke_tp_active) (S.L.emke_tp_mode)
		{endif}
	 {endif}
(L.L.emke_tp_active) 1 =
{if}
	(M.L.emke-tp_led_frame)
	(M.L.emke-tp_button-off_frame)
	(M.L.emke-tp_memcard_check)

	(L.L.emke_tp_mode) 1 =
	{if}
'	(S.$.emke_tp_display)
'	1 (S.L.Refresh_Strings)		
		(L.L.emke_tp_vonal) !
		{if}
			-1 (S.L.emke_tp_route_index)
'			(L.L.IBIS_input)
			(L.L.IBIS_input_count) 1 <
			{if}
				 ""
			{else}
				(L.$.emke_tp_input)
			{endif}
			(L.L.IBIS_input_count) 4 <
			{if}
				"_" $+
			{endif}
			(S.$.emke_tp_input_kar)
			
			"VONALSZÁM: " (L.$.emke_tp_input_kar) $+  30 $SetLengthL (S.$.emke_tp_display)
			1 (S.L.Refresh_Strings)
			(L.L.IBIS_input_count) 4 =
			{if}
'	Vonalszám ellenőrzés
				(L.L.IBIS_input) (S.L.emke_tp_vonal)
				0 (S.L.IBIS_input_count) (S.L.IBIS_input) (S.L.emke_tp_jarat)
				"" (S.$.emke_tp_input) (S.$.act_busstop)
				(L.L.emke_tp_vonal) !
				{if}
					3 (S.L.emke_tp_errcode)
				{else}
					(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
					{if}
						(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
					{endif}
					"" (S.$.emke_tp_input_kar)
					2 (S.L.emke_tp_mode)
					1 (S.L.Refresh_Strings)
				{endif}
			{endif}
		{else}
			"VONALSZÁM: " (L.L.emke_tp_vonal) $IntToStr $+  30 $SetLengthL (S.$.emke_tp_display)
			1 (S.L.Refresh_Strings)
		{endif}
	{else}
	(L.L.emke_tp_mode) 6 =
	{if}
		(L.L.emke_tp_errcode) 0 =
		{if}
			""
		{else}
		(L.L.emke_tp_errcode) 1 =
		{if}
			"ÚJ KEZELŐT KÉREK MEGADNI"
		{else}
		(L.L.emke_tp_errcode) 2 =
		{if}
			"KÁRTYA NEM TALÁLHATÓ"
		{else}
		(L.L.emke_tp_errcode) 3 =
		{if}
			"HIBÁS VONALSZÁM"
		{else}
		(L.L.emke_tp_errcode) 4 =
		{if}
			"HIBÁS JÁRATSZÁM"
		{else}
'		(L.L.emke_tp_errcode) 1 =
'		{if}
'		{else}
'		{endif}
		{endif}
		{endif}
		{endif}
		{endif}
		{endif}
		30 $SetLengthL (S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
	{else}
	(L.L.emke_tp_mode) 2 =
	{if}
'		(L.L.IBIS_input)
'		{if}
'			(L.L.IBIS_input) $IntToStr
'		{else}
'			 ""
'		{endif}
		(L.L.IBIS_input_count) 1 <
		{if}
			 ""
		{else}
			(L.$.emke_tp_input)
		{endif}
		(L.L.IBIS_input_count) 3 <
		{if}
			"_" $+
		{endif}
		(S.$.emke_tp_input_kar)
		"JÁRATSZÁM: " (L.$.emke_tp_input_kar) $+ 30 $SetLengthL (S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
		(L.L.IBIS_input_count) 3 =
		(L.L.emke_tp_jarat) ! &&
		{if}
'	Járatszám ellenőrzés			
			(L.L.IBIS_input) (S.L.emke_tp_jarat)
			0 (S.L.IBIS_input_count) (S.L.IBIS_input) "" (S.$.emke_tp_input)  (S.$.act_busstop)
			(L.L.emke_tp_vonal) 1000 * (L.L.emke_tp_jarat) + (M.V.GetRouteIndex) (S.L.emke_tp_route_index) 0 < s3
			(L.L.emke_tp_jarat) 10 < &&
			{if}
				(L.L.emke_tp_vonal) 10 * (L.L.emke_tp_jarat) + (M.V.GetRouteIndex) (S.L.emke_tp_route_index) 0 < s3
			{endif}
			l3 (L.L.emke_tp_jarat) 0 <= ||
			{if}
				4 (S.L.emke_tp_errcode)
			{else}
				(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
				{if}
					(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
				{endif}
				"" (S.$.emke_tp_input_kar)
				3 (S.L.emke_tp_mode)
				1 (S.L.emke_tp_depart_busstop_index)
				(L.L.emke_tp_route_index) (M.V.GetBusstopCount) (S.L.emke_tp_busstop_count) (S.L.emke_tp_arrive_busstop_index)
				1 (S.L.Refresh_Strings)
			{endif}						
		{endif}
	{else}
''	felszálló megálló
	(L.L.emke_tp_mode) 3 =
	{if}
		(L.L.emke_tp_busstop_count) 1 >
		{if}
'' Lelszálló megálló változtatás számgombokkal
'' Felszálló a nyilakkal
		(L.L.IBIS_input_count) 2 =
		{if}
			(L.L.IBIS_input) (L.L.emke_tp_busstop_count) <=
			(L.L.IBIS_input) (L.L.emke_tp_depart_busstop_index) > &&
			{if}
				(L.L.IBIS_input) (S.L.emke_tp_arrive_busstop_index)
			{endif}
			0 (S.L.IBIS_input) (S.L.IBIS_input_count)
			"" (S.$.emke_tp_input)
		{endif}
		
'' Kijelző / Display:		
		"     "
		(L.L.emke_tp_depart_busstop_index) "02" $IntToStrEnh $+
		" " $+
'		"Hévíz, aut. áll."		
		(L.L.emke_tp_route_index) (L.L.emke_tp_depart_busstop_index) 1 - (M.V.GetRouteBusstopIdent) (S.$.act_busstop) (M.V.GetBusstopIndex) 0 (M.V.GetBusstopString)
		14 $SetLengthL $+
		"-" $+
		(L.L.IBIS_input_count) 1 =
		{if}
			(L.L.IBIS_input) $IntToStr "_" $+ $+
		{else}
			(L.L.emke_tp_arrive_busstop_index) "02" $IntToStrEnh $+
		{endif}
'		(L.L.emke_tp_arrive_busstop_index) "02" $IntToStrEnh $+
		"+" $+
'		370
		(L.L.emke_tp_ticket_type) (M.V.GetTicketValue) s7
'			Mark:
			l7 "  3" $IntToStrEnh "." $+

'			Pfennige:	
			l7 100 * 100 % "02" $IntToStrEnh $+
		30 $SetLengthL $+
		{else}
		"     "
		(L.L.emke_tp_ticket_type)  "02" $IntToStrEnh $+
		(L.L.emke_tp_ticket_type) (M.V.GetTicketName) $+
		(L.L.emke_tp_ticket_type) (M.V.GetTicketValue) s7
'			Mark:
			l7 "  3" $IntToStrEnh "." $+

'			Pfennige:	
			l7 100 * 100 % "02" $IntToStrEnh $+
		30 $SetLengthL $+
		{endif}
		 (S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
	{else}
''	leszálló megálló
	(L.L.emke_tp_mode) 4 =
	{if}
''		Felszálló megálló változtatása gombokkal
		
		(L.L.IBIS_input_count) 2 =
		{if}
			(L.L.IBIS_input) 0 >
			(L.L.IBIS_input) (L.L.emke_tp_arrive_busstop_index) < &&
			{if}
				(L.L.IBIS_input) (S.L.emke_tp_depart_busstop_index)			
			{endif}
			0 (S.L.IBIS_input) (S.L.IBIS_input_count)
			"" (S.$.emke_tp_input)
		{endif}

		"     "
		(L.L.IBIS_input_count) 1 =
		{if}
			(L.L.IBIS_input) $IntToStr "_" $+ $+
		{else}
			(L.L.emke_tp_depart_busstop_index) "02" $IntToStrEnh $+
		{endif}
'		(L.L.emke_tp_depart_busstop_index) "02" $IntToStrEnh $+
		"-" $+
'		"Balatongyörök aut. ford."
		(L.L.emke_tp_route_index) (L.L.emke_tp_arrive_busstop_index) 1 - (M.V.GetRouteBusstopIdent) (M.V.GetBusstopIndex) 0 (M.V.GetBusstopString)
'		(L.L.emke_tp_arrive_busstop_index) 1 - 0 (M.V.GetBusstopString)
		14 $SetLengthL $+
		" " $+
		(L.L.emke_tp_arrive_busstop_index) "02" $IntToStrEnh $+
		"+" $+
'		370
		(L.L.emke_tp_ticket_type) (M.V.GetTicketValue) s7
'			Mark:
			l7 "  3" $IntToStrEnh "." $+

'			Pfennige:	
			l7 100 * 100 % "02" $IntToStrEnh $+
		30 $SetLengthL (S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
	{else}
''	Dátum a kijelzőre
	(L.L.emke_tp_mode) 5 =
	{if}
'''			"13.11.84   01:21"
'		Tag:
'			(L.S.Day) "02" $IntToStrEnh "." $+
'		Monat:
'			(L.S.Month) "02" $IntToStrEnh $+ "." $+
'		Jahr:
'			(L.S.Year) $IntToStr 2 $SetLengthR $+ "       " $+
'		Stunden:
'			(L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh $+ ":" $+
'		Minuten:
'			l0 l1 - 60 * trunc "02" $IntToStrEnh $+

'''			"2014.05.31. 21:12"

'		Jahr:
			(L.S.Year) $IntToStr 4 $SetLengthR "." $+
'		Monat:
			(L.S.Month) "02" $IntToStrEnh $+ "." $+
'		Tag:
			(L.S.Day) "02" $IntToStrEnh $+ "." $+

			"  " $+
'		Stunden:
			(L.S.Time) 3600 / s4 trunc s5 "02" $IntToStrEnh $+ ":" $+
'		Minuten:
			l4 l5 - 60 * trunc "02" $IntToStrEnh $+
		
'		30 $SetLengthL
		(S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
	{else}
''	Jegynyomtatás
	(L.L.emke_tp_mode) 7 =
	{if}

'Anzeige des Fahrscheins aufm Display
	(L.L.ticketprinter_druckt)
	{if}
		"ÖSSZESEN: " (L.$.emke_tp_sum) $+ " FT" $+
		30 $SetLengthL (S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
	{else}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 4 <= &&
		{if}	
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s7
'			Mark:
			l7 "  3" $IntToStrEnh "." $+

'			Pfennige:	
			l7 100 * 100 % "02" $IntToStrEnh $+  (S.$.emke_tp_sum)

'			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketName) " :" $+
'			(L.$.emke_tp_sum) $+
			(M.L.ticketprinter_button_enter)
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
				""
			{else}
'				Hier hardcodiert die restlichen unverkäuflichen Fahrscheine
				(L.L.ticketprinter_ticket_preselection) 5 =
				{if}
					"1.00"
				{else}
					(L.L.ticketprinter_ticket_preselection) 6 =
					{if}
						"5.00"
					{else}
						(L.L.ticketprinter_ticket_preselection) 7 =
						{if}
							"15.00"
						{else}
							(L.L.ticketprinter_ticket_preselection) 8 =
							{if}
								"10.00"
							{else}
								(L.L.ticketprinter_ticket_preselection) 9 =
								{if}
									"7.00"
								{endif}
							{endif}
						{endif}
					{endif}
				{endif}
			{endif}
			 (S.$.emke_tp_sum)
			(M.L.ticketprinter_button_enter)
		{endif}
		
	{endif}	
	{else}
		(L.L.emke_tp_mode) 8 =
		{if}
		"JÁRATSZÁM: " (L.L.emke_tp_jarat) " 3" $IntToStrEnh $+ 30 $SetLengthL (S.$.emke_tp_display)
		1 (S.L.Refresh_Strings)
		{else}
		(L.L.emke_tp_mode) 9 =
		{if}
'			"ÖSSZESEN: " (L.$.emke_tp_sum) $+ " FT" $+
'			30 $SetLengthL (S.$.emke_tp_display)
'			1 (S.L.Refresh_Strings)
		{else}
'		(L.L.emke_tp_mode) 1 =
'		{if}
'		{else}

'		{endif}
		{endif}
		{endif}
' / mode 7
	{endif}
' / mode 5
	{endif}
' / mode 4
	{endif}
' / mode 3
	{endif}
' / mode 2
	{endif}
' / mode 6
	{endif}
' / mode 1
	{endif}
	
	
{else}
'	-1 (S.L.emke_tp_mode)
{endif}
' "@Mode: " (L.L.emke_tp_mode) trunc $IntToStr $+ (S.$.emke_tp_display)
'	1 (S.L.Refresh_Strings)	





{else}
	-1 (S.L.emke_tp_mode) (S.L.emke_tp_mode_last)
{endif}

(L.L.emke_tp_mode) 1 <
{if}
	0 (S.L.emke_tp_led) (S.L.emke_tp_vonal) (S.L.emke_tp_jarat)
	0 (S.L.emke_tp_g_off_counter) (S.L.emke_tp_sum_display_counter)  (S.L.emke_tp_lcd_display_sum_counter)
	-1 (S.L.emke_tp_route_index)
	"" (S.$.emke_tp_display) (S.$.emke_tp_sum) (S.$.emke_tp_input_kar) (S.$.act_busstop)
	1 (S.L.Refresh_Strings)
	(L.L.emke_tp_mode) -1 =
	{if}
		0 (S.L.emke_tp_lcdbacklight) (S.L.emke_tp_active) (S.L.emke_tp_led_counter)
	{else}
		1 (S.L.emke_tp_lcdbacklight)
		60  (S.L.emke_tp_led_counter)
	{endif}
{endif}
'Ausgeben des Fahrscheins

(L.L.ticketprinter_druckt)
{if}
	(L.L.ticketprinter_ticket_pos) (L.S.Timegap) 1 * + (S.L.ticketprinter_ticket_pos)
	1 >
	{if}
		1 (S.L.ticketprinter_ticket_pos)
		0 (S.L.ticketprinter_druckt)
		(L.L.ticketprinter_ticket_selection) (S.L.GivenTicket)
		5 (S.L.emke_tp_sum_display_counter)
		1 (S.L.emke_tp_lcd_display_sum_counter)
		9 (S.L.emke_tp_mode)
	{endif}
{endif}

(L.L.ticketprinter_ticket_visible)
(L.L.ticketprinter_druckt) ! &&
(L.L.GivenTicket) 0 < &&
{if}
	0 (S.L.ticketprinter_ticket_pos)
	-1 (S.L.ticketprinter_ticket_selection) 
	(T.L.ev_ticketsale_giveticket)
{endif}

(L.L.ticketprinter_druckt) (L.L.GivenTicket) 0 >= || (S.L.ticketprinter_ticket_visible)


{end}

{macro:emke-tp_led_frame}
' A led amikor be van kapcsolva a gép, de nincs "elaludva". --> A led akkor világít, ha a gép alszik, de be van kapcsolva
' 1 perc után ha nem nyomogatod akkor a kijelző besötétül és a led is kialszik. --> a led ekkor kezd világítani.
	(L.L.emke_tp_led_counter) 0 >
	{if}
		0 (S.L.emke_tp_led)
		1 (S.L.emke_tp_lcdbacklight)
		(L.L.emke_tp_led_counter) (L.S.timegap) - (S.L.emke_tp_led_counter)
	{else}
		1 (S.L.emke_tp_led)
		0 (S.L.emke_tp_led_counter) (S.L.emke_tp_lcdbacklight)
	{endif}
	(L.L.emke_tp_sum_display_counter)
	(L.L.emke_tp_mode) 2 > &&
	{if}
		(L.L.emke_tp_sum_display_counter) 1 >
		{if}
			(L.L.emke_tp_sum_display_counter) (L.S.timegap) - (S.L.emke_tp_sum_display_counter)
		{else}
			"" (S.$.emke_tp_sum)
			0 (S.L.emke_tp_sum_display_counter)
		{endif}
	{endif}
	(L.L.emke_tp_lcd_display_sum_counter)
	(L.L.emke_tp_mode) 9 = &&
	{if}	
		(L.L.emke_tp_lcd_display_sum_counter) 0 >
		{if}
			(L.L.emke_tp_lcd_display_sum_counter) (L.S.timegap) - (S.L.emke_tp_lcd_display_sum_counter)
		{else}
			0 (S.L.emke_tp_lcd_display_sum_counter)
			(L.L.emke_tp_mode_last) (S.L.emke_tp_mode)
		{endif}
	{endif}
{end}


{macro:emke-tp_button-off_frame}
	(L.L.emke_tp_g_off)
	(L.L.emke_tp_g_off_counter) 3 <= &&
	{if}
		(L.L.emke_tp_g_off_counter) (L.S.timegap) 2 * + (S.L.emke_tp_g_off_counter)		
	{else}
		(L.L.emke_tp_g_off_counter) 3 >
		{if}
			0 (S.L.emke_tp_errcode)
			0  (S.L.emke_tp_active)
			0 (S.L.emke_tp_mode_last)
			-1 (S.L.emke_tp_mode)
'			(S.L.emke_tp_g_off)
		{else}
' rövid off
			(L.L.emke_tp_g_shift)
			(L.L.emke_tp_g_off_counter) 0 > &&
			{if}
				(L.L.emke_tp_mode) (L.L.emke_tp_mode_last) = !
				{if}
					(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
				{endif}
				0 (S.L.emke_tp_errcode)
				1 (S.L.emke_tp_mode)
				0 (S.L.emke_tp_g_shift) (S.L.emke_tp_vonal) (S.L.emke_tp_jarat)  (S.L.emke_tp_g_off_counter)
			{endif}
		{endif}
	{endif}
{end}

{macro:emke-tp_memcard_check}
	(L.L.emke_tp_driver_memcard_pos) 1 <
	(L.L.emke_tp_route_memcard_pos) 1 < ||
	{if}
		(L.L.emke_tp_driver_memcard_pos) 1 <
		{if}
			(L.L.emke_tp_mode) 6 = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			1 (S.L.emke_tp_errcode)
			6 (S.L.emke_tp_mode)
		{endif}
		(L.L.emke_tp_route_memcard_pos) 1 <
		{if}
			(L.L.emke_tp_mode) 6 = !
			{if}
				(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
			{endif}
			2 (S.L.emke_tp_errcode)
			6 (S.L.emke_tp_mode)
		{endif}
	{else}			
			(L.L.emke_tp_errcode) 1 =
			(L.L.emke_tp_errcode) 2 = ||
			{if}
				0 (S.L.emke_tp_errcode)
				1 (S.L.emke_tp_mode)
			{else}
				(L.L.emke_tp_errcode) 0 >
				(L.L.emke_tp_mode) 6 = ! &&
				{if}
					(L.L.emke_tp_mode) (S.L.emke_tp_mode_last)
					6 (S.L.emke_tp_mode)
				{endif}
			{endif}
	{endif}
{end}

{macro:IBIS_Zahlentasten}
	s0
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) > l0 0 >= &&
	{if}
		
		(L.L.emke_tp_mode) 1 = (L.L.IBIS_input_count) 4 < &&
		(L.L.emke_tp_mode) 2 = (L.L.IBIS_input_count) 3 < && ||
		(L.L.emke_tp_mode) 3 = (L.L.IBIS_input_count) 2 < && ||
		(L.L.emke_tp_mode) 4 = (L.L.IBIS_input_count) 2 < && ||
		{if}
			(L.L.IBIS_input) 10 * l0 + (S.L.IBIS_input)
			(L.L.IBIS_input_count) 1 + (S.L.IBIS_input_count)
			(L.$.emke_tp_input) l0 $IntToStr $+ (S.$.emke_tp_input)
			(T.L.ev_IBIS_piep)
			1 (S.L.Refresh_Strings)
		{else}
			l0 0 =
			{if}
'				9 (S.L.emke_tp_mode)
				(T.L.ev_IBIS_piep)
			{endif}
		{endif}
	{else}
		0 (S.L.IBIS_input_count) (S.L.IBIS_input)
		"" (S.$.emke_tp_input)
		1 (S.L.Refresh_Strings)
	{endif}
{end}

{macro:ticketprinter_button_enter}
	(L.L.ticketprinter_ticket_preselection) -1 > &&
	(L.L.ticketprinter_druckt) ! &&
	(L.L.ticketprinter_ticket_pos) 0 = &&
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	(L.L.emke_tp_active) &&
	{if}
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		-1 (S.L.ticketprinter_ticket_preselection)
		(T.L.ev_printer_printing)
		60 (S.L.emke_tp_led_counter)
	{endif}
{end}
