'##############
'Mikroelektronika III.
'##############

'Needs:
'- 'Mikroelektronika I.
'- 'Mikroelektronika II.

'Revision History:
'- Rüdiger Hülsmann	12.01.2011	File created
'- Rüdiger Hülsmann	15.01.2011	Functions added
'- Marty515        	1.08.2012	Upraveno pro CZ kasu



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


{trigger:ticketprinter_button_ticket_0}
	(L.L.elec_busbar_main)
	{if}
		0 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_ticket_0) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_ticket_0)

{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.menu_dolni) 3 =
	{if}
		0 (S.L.navigator_menu_visible) (S.L.kasa_boot_ok) (S.L.menu_dolni)
		1 (S.L.kasa_login) (S.L.kasa_boot2_visible)	
		"" (S.$.IBIS_Complex_Line) 
		"00000" (S.$.kasa_turnus)
		"00" (S.$.kasa_linka)
		"000" (S.$.kasa_cil)
		"" (S.$.Matrix_Terminus)
		"" (S.$.Matrix_Nr)
		(T.L.ev_IBIS_piep)
	{endif}
	
			(L.L.kasa_OtevOdp) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.menu_dolni) 0 =
	(L.L.navigator_menu_visible) 1 = &&
	{if}
		3 (S.L.menu_dolni)
		(M.L.menu_text_frame)
		(T.L.ev_IBIS_piep)
	{endif}
	{endif}

	(L.L.menu_dolni) 0 =
	(L.L.elec_busbar_main) &&
	{if}
		(L.L.elec_busbar_main)
		{if}
			1 (S.L.ticketprinter_ticket_preselection)
		{endif}
		(L.L.ticketprinter_button_ticket_1) !
		{if}
			(T.L.ev_printer_button_on)
		{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.kasa_OtevOdp) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.menu_dolni) 0 =
	(L.L.navigator_menu_visible) 1 = &&
	{if}
		4 (S.L.menu_dolni)
		(M.L.menu_text_frame)
		(T.L.ev_IBIS_piep)
		{endif}
	{endif}
	
	(L.L.menu_dolni) 0 =
	(L.L.navigator_menu_visible) 0 = &&
	(L.L.elec_busbar_main) &&
	{if}
		2 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_ticket_2) !
	{if}
		(T.L.ev_printer_button_on)
	{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.kasa_OtevOdp) 1 =
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
	
	(L.L.menu_dolni) 0 =
	(L.L.navigator_menu_visible) 1 = &&
	{if}
		2 (S.L.menu_dolni)
		(M.L.menu_text_frame)
		(T.L.ev_IBIS_piep)
	{endif}

	(L.L.menu_dolni) 0 =
	(L.L.elec_busbar_main) &&
	{if}
		3 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_ticket_3) !
	{if}
		(T.L.ev_printer_button_on)
	{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)
		{if}
			4 (S.L.ticketprinter_ticket_preselection)
			
		{endif}
		(L.L.ticketprinter_button_ticket_4) !
		{if}
			(T.L.ev_printer_button_on)

		{endif}
		1 (S.L.ticketprinter_button_ticket_4)

{end}

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


{trigger:ticketprinter_button_dummy_0}
	(L.L.elec_busbar_main)
	{if}
		5 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_dummy_0) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_dummy_0)
{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.menu_dolni) 1 =
	(L.L.navigator_menu_visible) 1 = &&
	{if}
	
		1 (S.L.hlasenivisible)
		(T.L.ev_IBIS_piep)
	{endif}

	
			(L.L.menu_dolni) 0 =
			(L.L.navigator_menu_visible) 1 = &&
			{if}
				1 (S.L.menu_dolni)
				(M.L.menu_text_frame)
				(T.L.ev_IBIS_piep)
			{else}
				(L.L.elec_busbar_main)
				{if}
					6 (S.L.ticketprinter_ticket_preselection)
	
			{endif}
			(L.L.ticketprinter_button_dummy_1) !
			{if}
			(T.L.ev_printer_button_on)
		{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)
	{if}
		7 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_dummy_2) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_dummy_2)
{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)
	{if}
		8 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_dummy_3) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_dummy_3)
{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)
	{if}
		9 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_dummy_4) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_dummy_4)
{end}

{trigger:ticketprinter_button_dummy_4_off}
	(T.L.ev_printer_button_off)
	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)
		(T.L.ev_printer_printing)
	{endif}
	(L.L.ticketprinter_button_enter) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_enter)
	

			
{end}

	

{trigger:ticketprinter_button_enter_off}
	(T.L.ev_printer_button_off)
	0 (S.L.ticketprinter_button_enter)
{end}

{trigger:ticketprinter_button_cancel}
(T.L.ev_IBIS_piep)

(L.L.ds_visible) 1 =
{if}
	"" (S.$.IBIS_Complex_Line) 
	"00000" (S.$.kasa_turnus)
	"00" (S.$.kasa_linka)
	"000" (S.$.kasa_cil)
	"" (S.$.Matrix_Terminus)
	"" (S.$.Matrix_Nr)
	0 (S.L.IBIS_route) (S.L.ds_visible) (S.L.IBIS_TerminusCode)
{endif}

(L.L.navigator_menu_visible) 1 =
(L.L.menu_dolni) 0 = &&
{if}
	0 (S.L.navigator_menu) (S.L.IBIS_input) (S.L.IBIS_input_count) (S.L.IBIS_mode)
{endif}

 0 (S.L.hlasenivisible)

(L.L.navigator_menu_visible) 1 =
(L.L.menu_dolni) 0 > &&
{if}
	0 (S.L.menu_dolni)
	(M.L.menu_text_frame)
{endif}

(L.L.navigator_menu_visible) 0 =
{if}
	(L.L.elec_busbar_main)
	{if}
		-1 (S.L.ticketprinter_ticket_preselection)
	{endif}
	(L.L.ticketprinter_button_cancel) !
	{if}
		(T.L.ev_printer_button_on)
	{endif}
	1 (S.L.ticketprinter_button_cancel)
	
	

			
{endif}

{end}

{trigger:ticketprinter_button_cancel_off}
	(T.L.ev_printer_button_off)
	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}

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

{macro:ticketprinter_init}
	-1 (S.L.ticketprinter_ticket_preselection) (S.L.ticketprinter_ticket_selection)
	"" (S.$.ticketprinter_display)
{end}


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

{macro:ticketprinter_frame}

'Anzeige des Fahrscheins aufm Display

(L.L.elec_busbar_main)
{if}
  ""
	(L.L.ticketprinter_druckt)
	{if}
		"" 22 $SetLengthL
		
    (L.L.cp_odpojovac_kasa) 1 =
    {if}
    1 (S.L.okno_Tisk_visible)
    {else}
    0 (S.L.okno_Tisk_visible)
    
    
    {endif}
			
	

         
		
		  
	{else}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 5 <= &&
		{if}	
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s0

'			Mark:
			"  " $+ l0 " 2" $IntToStrEnh $+ 

		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
				"   0"
			{else}
'				Hier hardcodiert die restlichen unverkäuflichen Fahrscheine
					(L.L.ticketprinter_ticket_preselection) 7 =
					{if}
						"  XX"
					{else}
						(L.L.ticketprinter_ticket_preselection) 7 =
						{if}
							"  XX"
						{else}
							(L.L.ticketprinter_ticket_preselection) 8 =
							{if}
								"  XX"
							{else}
								(L.L.ticketprinter_ticket_preselection) 9 =
								{if}
									"  XX"
								{endif}
							{endif}
						{endif}
				{endif}
			{endif}
		{endif}
	{endif}
	22 $SetLengthL

{else}
	"" 22 $SetLengthL

	
{endif}

(S.$.kasa_cena01)



""
(L.L.elec_busbar_main)
{if}
  ""
	(L.L.ticketprinter_druckt)
	{if}
		"" 22 $SetLengthL
	{else}
		(L.L.ticketprinter_ticket_preselection) 0 >=
		(L.L.ticketprinter_ticket_preselection) 5 <= &&
		{if}	
			(L.L.ticketprinter_ticket_preselection) (M.V.GetTicketValue) s0


'			Pfennige:	
			l0 100 * 100 % "02" $IntToStrEnh $+ "Kè         " $+
			
		{else}
			(L.L.ticketprinter_ticket_preselection) 0 <
			{if}
				"00Kè"
			{else}
'				Hier hardcodiert die restlichen unverkäuflichen Fahrscheine
					(L.L.ticketprinter_ticket_preselection) 7 =
					{if}
						"XXKè"
					{else}
						(L.L.ticketprinter_ticket_preselection) 7 =
						{if}
							"XXKè"
						{else}
							(L.L.ticketprinter_ticket_preselection) 8 =
							{if}
								"XXKè"
							{else}
								(L.L.ticketprinter_ticket_preselection) 9 =
								{if}
									"XXKè"
								{endif}
							{endif}
						{endif}
				{endif}
			{endif}
		{endif}
	{endif}
	22 $SetLengthL
{else}
	"" 22 $SetLengthL
{endif}

(S.$.kasa_cena02)


'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)
		
	{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) 
	 0 (S.L.okno_Tisk_visible)
	(T.L.ev_ticketsale_giveticket)
{endif}

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


{macro:cena_listku_frame}

		(L.L.kasa_boot_visible) 1 =
		{if}
		""
		" " (S.$.kasa_cena_text)
		" " (S.$.kasa_cena_text_dolniR)
		" " (S.$.kasa_menu_text_dolniR)
  
  		{else}
			
		    ""
			"  <1:1>          1km " (S.$.kasa_cena_text)
			"Pkp  * 2Pas  * 3Pas  * 4Pas  * 5 Pas * 6 Pas" (S.$.kasa_cena_text_dolniR)
			
				(L.L.kasa_OtevOdp) 1 =
	{if}
		" KoD * èAS+  * èAS-  * VýDEJ * PAPíR * INFO " (S.$.kasa_menu_text_dolniR)
	{else}

			(L.L.menu_dolni) 1 <
			{if}
			" Kè  * KONEC * RùZNÉ * TISKY * PAPíR * INFO " (S.$.kasa_menu_text_dolniR)
			{endif}
	{endif}
	
		{endif}
		

		
		
  
  (L.L.okno_Tisk_visible) 1 =
		{if}
			
			" Tisk ! " (S.$.kasa_tisk_text)
		
		{else}
		      "" (S.$.kasa_tisk_text)
		{endif}




{end}

{macro:menu_text_frame}


		
		(L.L.menu_dolni) 1 = 
	    (L.L.navigator_menu_visible) 1 = &&
		{if}
		"TARIF* MìNA  *  MEM  * RevJi *       * SlHla" (S.$.kasa_menu_text_dolniR)
		{endif}

		(L.L.menu_dolni) 2 = 
	    (L.L.navigator_menu_visible) 1 = &&
		{if}
		"KUMUL* PRUB  * JíZD  *  NUL  *  J ø  *  TUR " (S.$.kasa_menu_text_dolniR)
		{endif}
		
		(L.L.menu_dolni) 3 = 
	    (L.L.navigator_menu_visible) 1 = &&
		{if}		
		" STø * KONEC *       *       *       *      " (S.$.kasa_menu_text_dolniR)
		{endif}
		
		(L.L.menu_dolni) 4 = 
	    (L.L.navigator_menu_visible) 1 = &&
		{if}
		"     * Zpožd *  KAL  *       *       *      " (S.$.kasa_menu_text_dolniR)
		{endif}
		

		
{end}
