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

'Simulates ticket printer

'(c) 12.01.2010 Rüdiger Hülsmann
'(c) 22.06.2011 Markus Rabe

'Script Version: 1.0
'Omsi release: 1.0

'Needs:
'- none


'Revision History:
'- Rüdiger Hülsmann	12.01.2011	File created
'- Rüdiger Hülsmann	15.01.2011	Functions added
'- Markus Rabe		22.06.2011	Anzeige von Uhrzeit und Haltestelle
'- ?			?		Korrektur 19 pf => 20 pf



'----------------------
'	Trigger
'----------------------

{trigger:ticketprinter_button_ticket_0}
	(L.L.Ticket)
	{if}
		0 (S.L.ticketprinter_ticket_preselection)
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		(M.L.ev_printer_button)
	{else}
		(L.L.elec_busbar_main)
		{if}
			0 (S.L.ticketprinter_ticket_preselection)

			(L.L.Ticketprinter) 1 =
			{if}
				0 (S.L.IBIS_Mode)
			{endif}
			4 (S.L.PFE_Mode)
		{endif}
		(L.L.ticketprinter_button_ticket_0) !
		{if}
			(M.L.ev_printer_button)
		{endif}
		1 (S.L.ticketprinter_button_ticket_0)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_0_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_ticket_0)
{end}


{trigger:ticketprinter_button_ticket_1}
	(L.L.Ticket)
	{if}
		1 (S.L.ticketprinter_ticket_preselection)
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		(M.L.ev_printer_button)
	{else}
		(L.L.elec_busbar_main)
		{if}
			1 (S.L.ticketprinter_ticket_preselection)

			(L.L.Ticketprinter) 1 =
			{if}
				0 (S.L.IBIS_Mode)
			{endif}
			4 (S.L.PFE_Mode)
		{endif}
		(L.L.ticketprinter_button_ticket_1) !
		{if}
			(M.L.ev_printer_button)
		{endif}
		1 (S.L.ticketprinter_button_ticket_1)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_1_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_ticket_1)
{end}


{trigger:ticketprinter_button_ticket_2}
	(L.L.Ticket)
	{if}
		2 (S.L.ticketprinter_ticket_preselection)
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		(M.L.ev_printer_button)
	{else}
		(L.L.elec_busbar_main)
		{if}
			2 (S.L.ticketprinter_ticket_preselection)

			(L.L.Ticketprinter) 1 =
			{if}
				0 (S.L.IBIS_Mode)
			{endif}
			4 (S.L.PFE_Mode)
		{endif}
		(L.L.ticketprinter_button_ticket_2) !
		{if}
			(M.L.ev_printer_button)
		{endif}
		1 (S.L.ticketprinter_button_ticket_2)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_2_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_ticket_2)
{end}


{trigger:ticketprinter_button_ticket_3}
	(L.L.Ticket)
	{if}
		3 (S.L.ticketprinter_ticket_preselection)
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		(M.L.ev_printer_button)
	{else}
		(L.L.elec_busbar_main)
		{if}
			3 (S.L.ticketprinter_ticket_preselection)

			(L.L.Ticketprinter) 1 =
			{if}
				0 (S.L.IBIS_Mode)
			{endif}
			4 (S.L.PFE_Mode)
		{endif}
		(L.L.ticketprinter_button_ticket_3) !
		{if}
			(M.L.ev_printer_button)
		{endif}
		1 (S.L.ticketprinter_button_ticket_3)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_3_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_ticket_3)
{end}


{trigger:ticketprinter_button_ticket_4}
	(L.L.Ticket)
	{if}
		4 (S.L.ticketprinter_ticket_preselection)
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		(M.L.ev_printer_button)
	{else}
		(L.L.elec_busbar_main)
		{if}
			4 (S.L.ticketprinter_ticket_preselection)

			(L.L.Ticketprinter) 1 =
			{if}
				0 (S.L.IBIS_Mode)
			{endif}
			4 (S.L.PFE_Mode)
		{endif}
		(L.L.ticketprinter_button_ticket_4) !
		{if}
			(M.L.ev_printer_button)
		{endif}
		1 (S.L.ticketprinter_button_ticket_4)
	{endif}
{end}

{trigger:ticketprinter_button_ticket_4_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_ticket_4)
{end}


{trigger:ticketprinter_button_dummy_0}
	(L.L.elec_busbar_main)
	{if}
		5 (S.L.ticketprinter_ticket_preselection)
		(L.L.Ticketprinter) 1 =
		{if}
			0 (S.L.IBIS_Mode)
		{endif}
		4 (S.L.PFE_Mode)
	{endif}
	(L.L.ticketprinter_button_dummy_0) !
	{if}
		(M.L.ev_printer_button)
	{endif}
	1 (S.L.ticketprinter_button_dummy_0)
{end}

{trigger:ticketprinter_button_dummy_0_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_dummy_0)
{end}


{trigger:ticketprinter_button_dummy_1}
	(L.L.elec_busbar_main)
	{if}
		6 (S.L.ticketprinter_ticket_preselection)
		(L.L.Ticketprinter) 1 =
		{if}
			0 (S.L.IBIS_Mode)
		{endif}
		4 (S.L.PFE_Mode)
	{endif}
	(L.L.ticketprinter_button_dummy_1) !
	{if}
		(M.L.ev_printer_button)
	{endif}
	1 (S.L.ticketprinter_button_dummy_1)
{end}

{trigger:ticketprinter_button_dummy_1_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_dummy_1)
{end}


{trigger:ticketprinter_button_dummy_2}
	(L.L.elec_busbar_main)
	{if}
		7 (S.L.ticketprinter_ticket_preselection)
		(L.L.Ticketprinter) 1 =
		{if}
			0 (S.L.IBIS_Mode)
		{endif}
		4 (S.L.PFE_Mode)
	{endif}
	(L.L.ticketprinter_button_dummy_2) !
	{if}
		(M.L.ev_printer_button)
	{endif}
	1 (S.L.ticketprinter_button_dummy_2)
{end}

{trigger:ticketprinter_button_dummy_2_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_dummy_2)
{end}


{trigger:ticketprinter_button_dummy_3}
	(L.L.elec_busbar_main)
	{if}
		8 (S.L.ticketprinter_ticket_preselection)
		(L.L.Ticketprinter) 1 =
		{if}
			0 (S.L.IBIS_Mode)
		{endif}
		4 (S.L.PFE_Mode)
	{endif}
	(L.L.ticketprinter_button_dummy_3) !
	{if}
		(M.L.ev_printer_button)
	{endif}
	1 (S.L.ticketprinter_button_dummy_3)
{end}

{trigger:ticketprinter_button_dummy_3_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_dummy_3)
{end}


{trigger:ticketprinter_button_dummy_4}
	(L.L.elec_busbar_main)
	{if}
		9 (S.L.ticketprinter_ticket_preselection)
		(L.L.Ticketprinter) 1 =
		{if}
			0 (S.L.IBIS_Mode)
		{endif}
		4 (S.L.PFE_Mode)
	{endif}
	(L.L.ticketprinter_button_dummy_4) !
	{if}
		(M.L.ev_printer_button)
	{endif}
	1 (S.L.ticketprinter_button_dummy_4)
{end}

{trigger:ticketprinter_button_dummy_4_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_dummy_4)
{end}


{trigger:ticketprinter_button_enter}
	(L.L.elec_busbar_main) 
	(L.L.ticketprinter_ticket_preselection) -1 > &&
	(L.L.ticketprinter_druckt) ! &&
	(L.L.ticketprinter_ticket_pos) 0 = &&
	{if}
		(L.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
		1 (S.L.ticketprinter_druckt)
		-1 (S.L.ticketprinter_ticket_preselection)
		(L.L.Ticketprinter) 0 =
		{if}
			(T.L.ev_prodata_printing)
		{else}
			(T.L.ev_printer_printing)
		{endif}
	{endif}
	(L.L.ticketprinter_button_enter) !
	{if}
		(M.L.ev_printer_button)
	{endif}
	1 (S.L.ticketprinter_button_enter)
{end}

{trigger:ticketprinter_button_enter_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_enter)
{end}


{trigger:ticketprinter_button_cancel}
	(L.L.Ticket)
	{if}
		-1 (S.L.ticketprinter_ticket_preselection)
	{else}
		(L.L.elec_busbar_main)
		{if}
			-1 (S.L.ticketprinter_ticket_preselection)
			3 (S.L.PFE_Mode)
		{endif}
		(L.L.ticketprinter_button_cancel) !
		(L.L.Ticket) ! &&
		{if}
			(M.L.ev_printer_button)
		{endif}
		1 (S.L.ticketprinter_button_cancel)
	{endif}
{end}

{trigger:ticketprinter_button_cancel_off}
	(M.L.ev_printer_button)
	0 (S.L.ticketprinter_button_cancel)
{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}

'##########################
'	PFE
'##########################

{trigger:AutoPilot}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		1 (S.L.PFE_Mode)
		0 (S.L.IBIS_Mode)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Maintenance}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		2 (S.L.PFE_Mode)
		0 (S.L.IBIS_Mode)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Ticketing}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		3 (S.L.PFE_Mode)
		0 (S.L.IBIS_Mode)
		-1 (S.L.ticketprinter_ticket_preselection)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Ziel}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		5 (S.L.PFE_Mode)
		0 (S.L.IBIS_input) (S.L.IBIS_input_count)
		3 (S.L.IBIS_Mode)
		0 (S.L.IBIS_Modetimer)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Reset}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		1 (S.L.AutoAnnoucement)
		0 (S.L.PFE_Mode) (S.L.PFE_Startup_timer) (S.L.AutoPilot) (S.L.Maintenance) (S.L.Ticketing) (S.L.Ticketing1) (S.L.Ticketing2) (S.L.Ziel) (S.L.AutoPilot_Tab) (S.L.Maintenance_Tab) (S.L.Ticketing_Tab) (S.L.Ziel_Tab) (S.L.PFELight_overlay_alphascale) (S.L.Screen_LightMode) (S.L.DayNight_Mode)
		0 (S.L.IBIS_Route) (S.L.IBIS_TerminusCode) (S.L.IBIS_TerminusIndex) (S.L.IBIS_Linie_Complex) (S.L.IBIS_busstop_index) (S.L.IBIS_busstop) (S.L.IBIS_busstop_entwerter_soll) (S.L.IBIS_busstop_entwerter_ist) (S.L.IBIS_Mode)
		-1 (S.L.IBIS_RouteIndex)
		"" (S.$.IBIS_terminus_name) (S.$.IBIS_cabindisplay) (S.$.Haltestelle) (S.$.act_busstop) (S.$.IBIS) (S.$.IBIS_busstop_name)
		"     " (S.$.IBIS_Complex_Line)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:AutoAnnoucement}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		(L.L.AutoAnnoucement) ! (S.L.AutoAnnoucement)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Screen_LightDN}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		(L.L.Screen_LightMode) 2 <
		{if}
			(L.L.Screen_LightMode) 1 + 1 max (S.L.Screen_LightMode)
			(L.L.Screen_LightMode) 2 >
			{if}
				0 (S.L.Screen_LightMode)
			{endif}
		{else}
			(L.L.Screen_LightMode) 3 =
			{if}
				0 (S.L.Screen_LightMode)
			{endif}
		{endif}
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Screen_LightUP}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		(L.L.Screen_LightMode) 1 - (S.L.Screen_LightMode)
		(L.L.Screen_LightMode) 2 >
		{if}
			0 (S.L.Screen_LightMode)
		{endif}
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:Screen_AutoLight}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		3 (S.L.Screen_LightMode)
		(M.L.ev_printer_button)
	{endif}
{end}

{trigger:DayNight_Mode}
	(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
	{if}
		(L.L.DayNight_Mode) ! (S.L.DayNight_Mode)
		(M.L.ev_printer_button)
	{endif}
{end}


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

{macro:ticketprinter_init}
	-1 (S.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
	1 (S.L.Ticketing) (S.L.AutoAnnoucement)
	"" (S.$.PRO_ticketprinter_display)
	"" (S.$.PFE_ticketprinter_display)
	0 (S.L.PFELight_overlay_alphascale)

	(C.L.EMI) !
	{if}
		1 (S.L.Ticket)
	{else}
		0 (S.L.Ticket)
	{endif}
{end}


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

{macro:ticketprinter_frame}

(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
(L.L.Ticketprinter) 1 = &&
{if}

'Mode 0 : Startup
'Mode 1 : AutoPilot
'Mode 2 : Maintenance
'Mode 3 : Ticketing
'Mode 4 : Ticketing 2
'Mode 5 : Ziel

	(L.L.PFE_Startup_timer) (L.S.Timegap) + 18 min (S.L.PFE_Startup_timer)

	(L.L.PFE_Startup_timer) 1 >
	(L.L.PFE_Startup_timer) 2 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-1.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 2 >
	(L.L.PFE_Startup_timer) 4 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-2.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 4 >
	(L.L.PFE_Startup_timer) 10 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-3.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 10 >
	(L.L.PFE_Startup_timer) 13 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-4.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 13 >
	(L.L.PFE_Startup_timer) 15 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-5.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 15 >
	(L.L.PFE_Startup_timer) 17 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-6.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 17 >
	(L.L.PFE_Startup_timer) 18 < &&
	(L.L.PFE_Mode) 0 = &&
	{if}
		"PFE_Startup-7.bmp" (S.$.PFE_screen)
	{endif}

	(L.L.PFE_Startup_timer) 18 =
	(L.L.PFE_Mode) 0 = &&
	{if}
		3 (S.L.PFE_Mode)
	{endif}
		(L.L.PFE_Mode) 1 =
		{if}
			1 (S.L.AutoPilot) (S.L.Maintenance_Tab) (S.L.Ticketing_Tab) (S.L.Ziel_Tab)
			0 (S.L.Maintenance) (S.L.Ticketing) (S.L.Ticketing1) (S.L.Ticketing2) (S.L.Ziel) (S.L.AutoPilot_Tab)
			(L.L.DayNight_Mode) 0 =
			{if}
				"PFE_AutoPi.bmp" (S.$.PFE_screen)
				(L.L.AutoAnnoucement) 0 =
				{if}
					"PFE_AutoPi-1.bmp" (S.$.PFE_screen)
				{endif}
			{else}
				"PFE_AutoPi_N.bmp" (S.$.PFE_screen)
				(L.L.AutoAnnoucement) 0 =
				{if}
					"PFE_AutoPi-1_N.bmp" (S.$.PFE_screen)
				{endif}
			{endif}
		{endif}

		(L.L.PFE_Mode) 2 =
		{if}
			1 (S.L.Maintenance) (S.L.AutoPilot_Tab) (S.L.Ticketing_Tab) (S.L.Ziel_Tab)
			0 (S.L.AutoPilot) (S.L.Ticketing) (S.L.Ticketing1) (S.L.Ticketing2) (S.L.Ziel) (S.L.Maintenance_Tab)
			(L.L.DayNight_Mode) 0 =
			{if}
				"PFE_Maint.bmp" (S.$.PFE_screen)
			{else}
				"PFE_Maint_N.bmp" (S.$.PFE_screen)
			{endif}
		{endif}

		(L.L.PFE_Mode) 3 =
		{if}
			1 (S.L.Ticketing) (S.L.Ticketing1) (S.L.AutoPilot_Tab) (S.L.Maintenance_Tab) (S.L.Ziel_Tab)
			0 (S.L.AutoPilot) (S.L.Maintenance) (S.L.Ticketing2) (S.L.Ziel) (S.L.Ticketing_Tab)
			(L.L.DayNight_Mode) 0 =
			{if}
				"PFE_Ticket.bmp" (S.$.PFE_screen)
			{else}
				"PFE_Ticket_N.bmp" (S.$.PFE_screen)
			{endif}
		{endif}

		(L.L.PFE_Mode) 4 =
		{if}
			1 (S.L.Ticketing) (S.L.Ticketing2) (S.L.AutoPilot_Tab) (S.L.Maintenance_Tab) (S.L.Ziel_Tab)
			0 (S.L.AutoPilot) (S.L.Maintenance) (S.L.Ticketing1) (S.L.Ziel) (S.L.Ticketing_Tab)
			(L.L.DayNight_Mode) 0 =
			{if}
				"PFE_Ticket2.bmp" (S.$.PFE_screen)
			{else}
				"PFE_Ticket2_N.bmp" (S.$.PFE_screen)
			{endif}
		{endif}

		(L.L.PFE_Mode) 5 =
		{if}
			1 (S.L.Ziel) (S.L.AutoPilot_Tab) (S.L.Maintenance_Tab) (S.L.Ticketing_Tab)
			0 (S.L.AutoPilot) (S.L.Maintenance) (S.L.Ticketing) (S.L.Ticketing1) (S.L.Ticketing2) (S.L.Ziel_Tab)
			(L.L.DayNight_Mode) 0 =
			{if}
				"PFE_Ziel.bmp" (S.$.PFE_screen)
			{else}
				"PFE_Ziel_N.bmp" (S.$.PFE_screen)
			{endif}
		{endif}
	{else}
		0 (S.L.PFE_Mode) (S.L.PFE_Startup_timer) (S.L.AutoPilot) (S.L.Maintenance) (S.L.Ticketing) (S.L.Ticketing1) (S.L.Ticketing2) (S.L.Ziel) (S.L.AutoPilot_Tab) (S.L.Maintenance_Tab) (S.L.Ticketing_Tab) (S.L.Ziel_Tab)
		"PFE_OFF.bmp" (S.$.PFE_screen)
	{endif}


(L.L.elec_busbar_main) (C.L.elec_busbar_minV) >
(L.L.Ticketprinter) 1 = &&
{if}
	(L.L.PFE_Mode) 1 >=
	{if}
		(L.L.Screen_LightMode) 0 =
		{if}
			0.0 (S.L.PFELight_overlay_alphascale)
		{else}
			(L.L.Screen_LightMode) 1 =
			{if}
				0.25 (S.L.PFELight_overlay_alphascale)
			{else}
				(L.L.Screen_LightMode) 2 =
				{if}
					0.5 (S.L.PFELight_overlay_alphascale)
				{else}
					(L.L.Screen_LightMode) 3 =
					{if}
						(L.L.Envir_Brightness) (F.L.Invert) (S.L.PFELight_overlay_alphascale)
					{endif}
				{endif}
			{endif}
		{endif}
	{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}
		3 (S.L.PFE_Mode)
		1 (S.L.ticketprinter_ticket_pos)
		0 (S.L.ticketprinter_druckt)
		(L.L.ticketprinter_ticket_selection) (S.L.GivenTicket)
	{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) 
	(L.L.Ticket)
	{if}
		-1 (S.L.ticketprinter_ticket_preselection)
	{else}
		(T.L.ev_ticketsale_giveticket)
	{endif}
{endif}

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

'###########################
'Prodata Displays
'###########################

'Anzeige des Fahrscheins aufm Display
(L.L.elec_busbar_main)
{if}
	(L.L.ticketprinter_druckt)
	{if}
		"Druckt..." 20 $SetLengthL
	{else}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 4 <= &&
		{if}	
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketName) ":" $+
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
				"LINIE RT  DAT. ZEIT "
			{else}
'				Hier hardcodiert die restlichen unverkäuflichen Fahrscheine
				(L.L.ticketprinter_ticket_preselection) 5 =
				{if}
					"KuDamm-Ticket  :"
				{else}
					(L.L.ticketprinter_ticket_preselection) 6 =
					{if}
						"Tageskarte Erm :"
					{else}
						(L.L.ticketprinter_ticket_preselection) 7 =
						{if}
							"Komb-Tageskarte:"
						{else}
							(L.L.ticketprinter_ticket_preselection) 8 =
							{if}
								"Tageskarte Fam :"
							{else}
								(L.L.ticketprinter_ticket_preselection) 9 =
								{if}
									"Komb-Tagesk Erm:"
								{endif}
							{endif}
						{endif}
					{endif}
				{endif}
			{endif}
		{endif}
	{endif}
	20 $SetLengthL

	"@" $+

	(L.L.ticketprinter_druckt)
	{if}
		"" 20 $SetLengthL
	{else}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 4 <= &&
		{if}
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s0
'			Mark:
			l0 $IntToStr "." $+
'			Pfennige:	
			l0 100 * 100 % 0.1 + "02" $IntToStrEnh $+
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
'			Linie/Kurs:
				(L.$.IBIS_Complex_Line) " " $+
'			Route:
				(L.L.IBIS_Route) "02" $IntToStrEnh $+ "  " $+
'			Tag:
				(L.S.Day) "02" $IntToStrEnh $+
'			Monat:
				(L.S.Month) "02" $IntToStrEnh $+ " " $+
'			Stunden:
				(L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh $+ ":" $+
'			Minuten:
				l0 l1 - 60 * trunc "02" $IntToStrEnh $+
			{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}
		{endif}
	{endif}
	20 $SetLengthL $+
{else}
	"" (S.$.PRO_ticketprinter_display)
{endif}
(S.$.PRO_ticketprinter_display)

'Side Display
	(L.L.elec_busbar_main)
	{if}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 4 <= &&
		{if}
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s0
'			Mark:
			l0 $IntToStr "." $+

'			Pfennige:
			l0 100 * 100 % 0.1 + "02" $IntToStrEnh $+
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
'			Tag:
				(L.S.Day) "02" $IntToStrEnh "." $+
'			Monat:
				(L.S.Month) "02" $IntToStrEnh $+ " " $+
'			Stunden:
				(L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh $+ "." $+
'			Minuten:
				l0 l1 - 60 * trunc "02" $IntToStrEnh $+
			{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}
		{endif}
		20 $SetLengthL
	{else}
		"" 20 $SetLengthL
	{endif}
	(S.$.PRO_ticketprinter_Sidedisplay)

'###########################
'PFE Displays
'###########################
	(L.L.elec_busbar_main)
	{if}
		(L.L.PFE_Mode) 1 >=
		{if}
'		Tag:
			(L.S.Day) "02" $IntToStrEnh "." $+
'		Monat:
			(L.S.Month) "02" $IntToStrEnh $+ "." $+
'		Jahr:
			(L.S.Year) $IntToStr 4 $SetLengthR $+ "      " $+
'		Stunden:
			(L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh $+ ":" $+
'		Minuten:
			l0 l1 - 60 * trunc "02" $IntToStrEnh $+ ":" $+
'		Sekunden:
			(L.S.Time) 60 / s0 trunc s1 l0 l1 - 60 * trunc "02" $IntToStrEnh $+
		{else}
			"" (S.$.PFE_ticketprinter_display)
		{endif}
	{endif}
	(S.$.PFE_ticketprinter_display)


'Side display
	(L.L.elec_busbar_main)
	(L.L.PFE_Mode) 1 >= &&
	{if}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 4 <= &&
		{if}	
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketName) ":" $+
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
				"Gute Reise !"
			{else}
'				Hier hardcodiert die restlichen unverkäuflichen Fahrscheine
				(L.L.ticketprinter_ticket_preselection) 5 =
				{if}
					"KuDamm-Ticket  :"
				{else}
					(L.L.ticketprinter_ticket_preselection) 6 =
					{if}
						"Tageskarte Erm :"
					{else}
						(L.L.ticketprinter_ticket_preselection) 7 =
						{if}
							"Komb-Tageskarte:"
						{else}
							(L.L.ticketprinter_ticket_preselection) 8 =
							{if}
								"Tageskarte Fam :"
							{else}
								(L.L.ticketprinter_ticket_preselection) 9 =
								{if}
									"Komb-Tagesk Erm:"
								{endif}
							{endif}
						{endif}
					{endif}
				{endif}
			{endif}
		{endif}
		20 $SetLengthL

	"@" $+

		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 4 <= &&
		{if}
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s0
'			Mark:
			l0 $IntToStr "." $+

'			Pfennige:	
			l0 100 * 100 % 0.1 + "02" $IntToStrEnh $+
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
'			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 $+
			{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}
		{endif}
		20 $SetLengthL $+
	{else}
		"" (S.$.PFE_ticketprinter_Sidedisplay)
	{endif}
	(S.$.PFE_ticketprinter_Sidedisplay)


'Display Ticketing 1
	(L.L.elec_busbar_main)
	{if}
		"Linie     Route     Ziel      Zone      Ri   "
	"@" $+
'	Linie/Kurs:
		(L.$.IBIS_Complex_Line) $+ "  " $+
	"@" $+
'	Route:
		(L.L.IBIS_Route) "02" $IntToStrEnh $+ " " $+
	"@" $+
'	Terminus:
		(L.L.IBIS_TerminusCode) "03" $IntToStrEnh $+ " " $+
	"@" $+
'	Zone / Entwerter:
		(L.L.IBIS_busstop_entwerter_ist) " 4" $IntToStrEnh $+ " " $+
	"@" $+
		(L.L.IBIS_Route) 2 % 0.5 >
		{if}
			"A" $+
		{else}
			"B" $+
		{endif}
		" " $+
	{else}
		"" (S.$.PFE_Ticketing1_display)
	{endif}
	(S.$.PFE_Ticketing1_display)


'Display Ticketing 2
	(L.L.elec_busbar_main)
	{if}
		(L.$.Matrix_Nr) " - " $+
		(L.L.IBIS_TerminusIndex) 5 (M.V.GetTerminusString) $+
	{else}
		"" (S.$.PFE_Ticketing2_display)
	{endif}
	(S.$.PFE_Ticketing2_display)


'Display Ticketing 3
	(L.L.elec_busbar_main)
	{if}
		(L.L.PFE_Mode) 1 >=
		{if}
			(L.L.ticketprinter_druckt)
			{if}
				"Druckt..."
			{else}
				(L.L.ticketprinter_ticket_preselection) 0 >=
				(L.L.ticketprinter_ticket_preselection) 4 <= &&
				{if}	
					(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketName) " :" $+
					(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s0

'					Mark:
					l0 " 2" $IntToStrEnh $+ "." $+
'					Pfennige:	
					l0 100 * 100 % 0.1 + "02" $IntToStrEnh $+
				{else}
					(L.L.ticketprinter_ticket_preselection) 0 <
					{if}
						(L.L.IBIS_mode) 1 =
						{if}
							"Linie-Kurs : "
							(L.L.IBIS_input_count) 0 =
							{if}
								(L.$.IBIS_Complex_Line) $+
							{else}
								" " 5 (L.L.IBIS_input_count) - $* $+ (L.L.IBIS_input) "0" (L.L.IBIS_input_count) $IntToStr $+ $IntToStrEnh $+ 
							{endif}
						{else}
							(L.L.IBIS_mode) 2 =
							{if}
								"Route : " " " 2 (L.L.IBIS_input_count) - $* $+ (L.L.IBIS_input) "0" (L.L.IBIS_input_count) $IntToStr $+ $IntToStrEnh $+ 
							{else}
								(L.L.IBIS_Mode) 4 =
								{if}
									4 (S.L.PFE_mode)
									(L.L.IBIS_modetimer) (L.S.Timegap) + (S.L.IBIS_modetimer)
									(L.L.IBIS_modetimer) 3 >=
									{if}
										2 (S.L.IBIS_mode)
'										4 (S.L.PFE_mode)
									{endif}
									"Falsches Route"
								{endif}
							{endif}
						{endif}
					{else}
'						Hier hardcodiert die restlichen unverkäuflichen Fahrscheine
						(L.L.ticketprinter_ticket_preselection) 5 =
						{if}
							"KuDamm-Ticket  : 1.00"
						{else}
							(L.L.ticketprinter_ticket_preselection) 6 =
							{if}
								"Tageskarte Erm : 5.00"
							{else}
								(L.L.ticketprinter_ticket_preselection) 7 =
								{if}
									"Komb-Tageskarte:15.00"
								{else}
									(L.L.ticketprinter_ticket_preselection) 8 =
									{if}
										"Tageskarte Fam :10.00"
									{else}
										(L.L.ticketprinter_ticket_preselection) 9 =
										{if}
											"Komb-Tagesk Erm: 7.00"
										{endif}
									{endif}
								{endif}
							{endif}
						{endif}
					{endif}
				{endif}
			{endif}
		{endif}
	{else}
		"" (S.$.PFE_Ticketing3_display)
	{endif}
	(S.$.PFE_Ticketing3_display)

'-----------------------------------------------

'Display Ziel 1
	(L.L.elec_busbar_main)
	{if}
		(L.L.IBIS_Mode) 6 =
		{if}
			(L.L.IBIS_modetimer) (L.S.Timegap) + (S.L.IBIS_modetimer)
			(L.L.IBIS_modetimer) 3 >=
			{if}
				3 (S.L.IBIS_mode)
			{endif}
			"Falsches Ziel"
		{else}
			(L.L.IBIS_TerminusIndex) 5 (M.V.GetTerminusString)
		{endif}
	{else}
		"" (S.$.PFE_Ziel1_display)
	{endif}
	(S.$.PFE_Ziel1_display)


'Display Ziel 2
	(L.L.elec_busbar_main)
	{if}
		"" " " 3 (L.L.IBIS_input_count) - $* $+ (L.L.IBIS_input) "0" (L.L.IBIS_input_count) $IntToStr $+ $IntToStrEnh $+
	{else}
		"" (S.$.PFE_Ziel2_display)
	{endif}
	(S.$.PFE_Ziel2_display)

'-----------------------------------------------

'Display Autopilot 1
	(L.L.elec_busbar_main)
	{if}
		(M.V.GetTTLineString) $length 0 >
		{if}
			"01" $+ (S.$.PFE_Autopilot1_display)
		{else}
			"" (S.$.PFE_Autopilot1_display)
		{endif}
	{endif}


'Display Autopilot 2
	(L.L.elec_busbar_main)
	{if}
		(L.L.schedule_active)
		{if}
			" GEFUNDEN"
		{else}
			" NICHT GEFUNDEN"
		{endif}
	{else}
		"" (S.$.PFE_Autopilot2_display)
	{endif}
	(S.$.PFE_Autopilot2_display)


'Display Autopilot 3
	(L.L.elec_busbar_main)
	{if}
		""
		(M.V.GetTTDelay) s1 60 / s0
		l1 abs 6 >=
		{if}
			l0 0 >
			{if}
				"+"
			{else}
				"-"
			{endif}
		{else}
			" "
		{endif}
		l0 abs trunc " 2" $IntToStrEnh $+ "." $+
		l0 abs l0 abs trunc - 10 * " 1"  $IntToStrEnh $+
	{else}
		"" (S.$.PFE_Autopilot3_display)
	{endif}
	(S.$.PFE_Autopilot3_display)


'Display Autopilot 4
	(L.L.elec_busbar_main)
	{if}
		(L.L.IBIS_TerminusCode) "03" $IntToStrEnh " - " $+
		(L.$.Matrix_Nr) $+ " " $+
		(L.L.IBIS_TerminusIndex) 5 (M.V.GetTerminusString) $+
	{else}
		"" (S.$.PFE_Autopilot4_display)
	{endif}
	(S.$.PFE_Autopilot4_display)


'Display Autopilot 5
	(L.L.elec_busbar_main)
	{if}
		(L.L.schedule_active)
		{if}
			(M.V.GetTTBusstopCount) 1 - s3
			(M.V.GetTTBusstopIndex) 0 + l3 <=
			{if}
'				Stunden:
				(M.V.GetTTBusstopIndex) 0 + (M.V.GetTTBusstopDep) 3600 / s0 trunc s1 "02" $IntToStrEnh ":" $+
'				Minuten:
				l0 l1 - 60 * trunc s2 "02" $IntToStrEnh $+
				(S.$.PFE_Autopilot5_display)
			{endif}
		{else}
			"" (S.$.PFE_Autopilot5_display)
		{endif}
	{endif}


'Display Autopilot 6
	(L.L.elec_busbar_main)
	{if}
		(M.V.GetTTBusstopIndex) s2 (M.V.GetTTBusstopName)
	{else}
		"" (S.$.PFE_Autopilot6_display)
	{endif}
	(S.$.PFE_Autopilot6_display)


'Display Autopilot 7
	(L.L.elec_busbar_main)
	{if}
		(L.L.IBIS_Route) 0 = !
		{if}
			(L.$.Haltestelle)
		{endif}
'		(L.L.IBIS_busstop_index) 0 (M.V.GetBusstopString) (S.$.Haltestelle)
	{else}
		"" (S.$.PFE_Autopilot7_display)
	{endif}
	(S.$.PFE_Autopilot7_display)
{end}


{macro:ev_printer_button}
	(L.L.Ticketprinter) 0 =
	(L.L.Ticket) ! &&
	{if}
		l1
		{if}
			(T.L.ev_prodata_button_on)
		{else}
			(T.L.ev_prodata_button_off)
		{endif}
	{else}
		(L.L.Ticketprinter) 1 =
		(L.L.Ticket) ! &&
		{if}
		l1
			{if}
				(T.L.ev_printer_button_on)
'			{else}
'				(T.L.ev_printer_button_off)
			{endif}
		{endif}
	{endif}

	(L.L.Ticket)
	{if}
	l1
		{if}
			(T.L.ev_ticket_on)
'		{else}
'			(T.L.ev_ticket_off)
		{endif}
	{endif}
{end}