Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VIEW OPEN CHECKS M3700 3

Status
Not open for further replies.

Jackba

Technical User
Jan 24, 2016
192
KE
Hi Guys I have a question on micros 3700.

How can one view all open check that are on different RVCs in one SLU, this is so that the Cashier doesn't have to change the to a different RVC to access the checks to cash out.

Any ideas or ISl for this?
 
When you add your Open Check SLU key to your touchscreen leave the Revenue Center field blank.
 
Actually, you will probably have to program a MACRO with a Change Revenue Center no sign out.
 
@Mr5443

Thanx for the reply , I had previously tried a combination of Macro and smart keys but the most I can get out of this is two RVC , but most of our sites have even upto 10 RVCs
 
You cant do this with core.

You would need to write a SIM which accesses the database and finds all the open checks and displays them. The when you try and open them the system would prompt you to change RVC.

Do you want some custom SIM scripts developed. Contact me via my website
 
I have tried to modify one of the isl script but the best I can do is to get it display all the checks but cant pick them up, the just display as buttons.

 
How about something like this.
The only thing i cant figure out is how to put more than a single digit into the key expression section.

Maybe someone else can figure that out.


Code:
event inq : 1

        var keypress : key
	var checknumber: A20

	
	clearislts
	setisltskey 1, 1, 4, 4, 1, key(2,51) , "3"
        setisltskey 6, 2, 4, 4, 1, @KEY_ENTER , "Pickup Check"

        displayislts

        inputkey keypress, checknumber, "Choose a check"    // Assuming you pressed the key labeled 3 it will place the value 3 into the checknumber variable. 

        loadkybdmacro makekeys(checknumber), key(1, 327684)    // Activate the pickup check method which will attempt to pickup the check number 3

endevent

Do you want some custom SIM scripts developed. Contact me via my website
 
@CathalMF


Are you talking about something like this?

ReferenceNum = ""
While Len(ReferenceNum) = 0

touchscreen 312
input orderRef, "Enter Guest Check Number"

If Len(orderRef) > 0 Then
ReferenceNum = orderRef
checknum = ReferenceNum
Else
ErrorMessage "Invalid Entry. Check # must be 1 to 4 digits."
EndIf

EndWhile
 
It's possible to do via ISL but a few questions. Can cashiers change RVC, and does the script need to leave them in their current RVC when done?
 
Yeah, that's gonna get messy crossing revenue centers.
 
@Moregele


Yes the Cashiers can change RVC but if possible they remain in the current RVC when done
 
or have a pop up that allows them to change the rvc when they pick up a check from a different RVC while still maintaining the current SLU or screen so as not to mess up the reports for different RVCs
 
Do your cashiers already change revenue centers in order to close the checks? To be honest it doesn't really sound like you're using revenue centers they way they're really meant to be. I still say it's technically possible to do, and wrote something up just now that I'll post for you that gets you most of the way there, but it's an odd way of using revenue centers.
 
You will probably have to play around with it a bit to get it to work just right on your system, but this should at least give you a good starting point

Code:
RETAINGLOBALVAR

VAR NEXT_PAGE_KEY : KEY = KEY(1,2)
VAR PREV_PAGE_KEY : KEY = KEY(1,1)
VAR SQL_H       : N12 = 0
VAR SQL_CMD     : A2000

VAR CURRENT_RVC : N3


EVENT INQ : 1
	IF @INSTANDALONEMODE OR @INBACKUPMODE
		EXITWITHERROR "Not available while in stand-alone or backup mode"
	ENDIF
	
	CALL LOADSQL
	
		FORMAT SQL_CMD AS "SELECT ob_tpriv11_pickup_others_chk FROM micros.emp_class_def WHERE emp_class_seq = (SELECT emp_class_seq FROM micros.emp_def WHERE obj_num = ", @TREMP, ")"
		CALL SQL_QUERY(SQL_CMD)
		VAR WHERE : A2000
		IF SQL_CMD = "T;" //the sql_cmd always adds the separator even if just one record, don't feel like throwing in a SPLITQ here
			FORMAT WHERE AS "chk_open = 'T'"
		ELSE
			FORMAT WHERE AS "chk_open = 'T' AND emp_seq = (SELECT emp_seq FROM micros.emp_def WHERE obj_num = ", @TREMP, ")"
		ENDIF
		FORMAT SQL_CMD AS "SELECT COUNT(chk_seq) FROM micros.chk_dtl WHERE ", WHERE
		CALL SQL_QUERY(SQL_CMD)
		VAR COUNT : N5 = SQL_CMD
		VAR CHK_NUMS[ COUNT ] : N9
		VAR CHK_SEQS[ COUNT ] : N9
		
		FORMAT SQL_CMD AS "SELECT chk_num, chk_seq FROM micros.chk_dtl WHERE ", WHERE, " ORDER BY chk_open_date_time"
		CALL SQL_RECORDSET(SQL_CMD)
		VAR I : N9
		FOR I = 1 TO COUNT
			CALL SQL_NEXTRECORD(SQL_CMD)
			SPLITQ SQL_CMD, ";", CHK_NUMS[I], CHK_SEQS[I]
		ENDFOR
		
		VAR INP_RESULT : A200
		VAR KEY_RESULT : KEY
		VAR CURRENT_PAGE : N9 = 1
		VAR CHK_SEQ : N9
		VAR CHK_NUM : N9
		VAR CHK_RVC : N9
		VAR LOOPING : N1 = 1
		WHILE LOOPING
			CALL ShowPaginationKeys(10, COUNT, CURRENT_PAGE, CHK_NUMS[], CHK_SEQS[])
			INPUTKEY KEY_RESULT, INP_RESULT, "SELECT CHECK NUMBER"
			
			//navigation keys accounted for first
			IF KEY_RESULT = @KEY_CLEAR
				EXITCONTINUE
			ENDIF
			IF KEY_RESULT = NEXT_PAGE_KEY
				CURRENT_PAGE = CURRENT_PAGE + 1
			ENDIF
			IF KEY_RESULT = PREV_PAGE_KEY
				CURRENT_PAGE = CURRENT_PAGE - 1
			ENDIF
			
			IF KEY_RESULT <> @KEY_CLEAR AND KEY_RESULT <> NEXT_PAGE_KEY AND KEY_RESULT <> PREV_PAGE_KEY
				//not a navigation key? okie dokie
				CHK_SEQ = KEYNUMBER(KEY_RESULT)
				FORMAT SQL_CMD AS "SELECT chk_num, rvc_seq FROM micros.chk_dtl WHERE chk_seq = ", CHK_SEQ
				CALL SQL_QUERY(SQL_CMD)
				SPLITQ SQL_CMD, ";", CHK_NUM, CHK_RVC
				//store the current RVC
				CURRENT_RVC = @RVC
				IF CURRENT_RVC <> CHK_RVC
					LOADKYBDMACRO KEY(42, CHK_RVC),KEY(1,327684),MAKEKEYS(CHK_NUM),@KEY_ENTER
				ELSE
					LOADKYBDMACRO KEY(1,327684),MAKEKEYS(CHK_NUM),@KEY_ENTER
				ENDIF
				LOOPING = 0
			ENDIF
		ENDWHILE
		
	CALL CLOSESQL
ENDEVENT

EVENT FINAL_TENDER
	IF CURRENT_RVC <> 0
		//attempt to put us back into our old rvc
		IF CURRENT_RVC <> @RVC
			LOADKYBDMACRO KEY(42, CURRENT_RVC)
		ENDIF
		CURRENT_RVC = 0
	ENDIF
ENDEVENT

EVENT SRVC_TOTAL:*
	IF CURRENT_RVC <> 0
		//attempt to put us back into our old rvc
		IF CURRENT_RVC <> @RVC
			LOADKYBDMACRO KEY(42, CURRENT_RVC)
		ENDIF
		CURRENT_RVC = 0
	ENDIF
ENDEVENT

//////////////////////////////////////////////////
///////////    FORMATTING FUNCTIONS   ////////////
//////////////////////////////////////////////////

SUB PAD_LINE( REF OUT, VAR LINE : A40)
	VAR PADDING : A40 = "                                        "
	FORMAT OUT AS MID(PADDING,1,(32-LEN(LINE))/2.0), LINE 	
ENDSUB


//////////////////////////////////////////////////
///////////       INPUT FUNCTIONS     ////////////
//////////////////////////////////////////////////
SUB GET_YES_NO( REF ANSWER, VAR MESSAGE : A78 )
	CLEARISLTS
		SETISLTSKEYX 2, 10, 4, 4, 2, @KEY_ENTER, 10059, "LEFT", 10, "YES"
		SETISLTSKEYX 2, 16, 4, 4, 2, @KEY_CLEAR, 10058, "LEFT", 10, "NO"
		SETISLTSKEYX 11, 12, 2, 6, 2, @KEY_CANCEL, 10392, "LEFT", 10, "CANCEL"
	DISPLAYISLTS
	
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEY_PRESS : KEY
	VAR DATA : A20
	INPUTKEY KEY_PRESS, DATA, MESSAGE
	
	IF KEY_PRESS = @KEY_ENTER
		ANSWER = 1
	ELSEIF KEY_PRESS = @KEY_CANCEL
		EXITCONTINUE
	ELSE
		ANSWER = 0
	ENDIF
	WINDOWCLOSE
ENDSUB

SUB GET_INPUT( REF ANSWER, VAR MESSAGE : A78, VAR TS_SCRN : N9 )
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEYPRESS : KEY
	IF TS_SCRN > 0
		TOUCHSCREEN TS_SCRN
	ENDIF
	INPUTKEY KEYPRESS, TIPAMT, MESSAGE
	WINDOWCLOSE
ENDSUB

SUB ShowPaginationKeys( var ResultsPerPage : N4, var ResultSize : N4, var CurrentPage : N4, ref Names[], ref ObjNums[] )

	Clearislts
	
	while (CurrentPage-1) * ResultsPerPage + 1 > ResultSize AND CurrentPage > 1
		CurrentPage = CurrentPage - 1
	endwhile

	var NumPages : N5 = 1
	while NumPages*ResultsPerPage < ResultSize
		NumPages = NumPages + 1
	endwhile

	var KeyHeight : N1 = 6
	var KeyWidth : N1 = 30 / (ResultsPerPage / 2)
	
	var FirstItem : N5 = (CurrentPage-1) * ResultsPerPage + 1
	
	//draw first row of results
	var i : N5

	for i = FirstItem to FirstItem + ResultsPerPage / 2 - 1
		if i > ResultSize
			break
		endif
		SetIslTsKeyx 1,(i - FirstItem) * KeyWidth + 1,3,KeyWidth,1,key(1, ObjNums[ i ]), 0, "C", 1, Names[ i ]
	endfor

	//draw second row of results
	for i = i to FirstItem + ResultsPerPage
		if i > ResultSize
			break
		endif
		SetIslTsKeyx 4,(i - FirstItem - ResultsPerPage / 2) * KeyWidth + 1,3,KeyWidth,1,key(1, ObjNums[ i ]), 0, "C", 1, Names[ i ]
	endfor

	//draw some page keys
	if CurrentPage > 1
		setisltskeyx 11, 1, 2, 2, 1, key(1,1), 10388, "C", 10, ""
	endif
	if CurrentPage < NumPages
		setisltskeyx 11, 3, 2, 2, 1, key(1,2), 10389, "C", 10, ""
	endif
	
	//Provide an escape route
	SetIslTsKeyx 9,27,4, 4, 1, @Key_Clear, 10058, "L", 10, "Done/Exit"
	
	displayislts

endsub

SUB ShowISLKeyboard( var Keyboard_Width : N2, var Keyboard_Height : N2)

	//ASCII keys 65 - 90

	//calculate the starting X position for the top row of keys
	var X : N2 = (30 - (10 * Keyboard_Width)) / 2
	//calculate the starting Y position for the top row of keys
	var Y : N2 = 12 - (Keyboard_Height * 3) + 1

	//draw keys Q(81),W(87),E(69),R(82),T(84),Y(89),U(85),I(73),O(79),P(80)
	SetIslTsKeyx Y,X + (Keyboard_Width * 0),Keyboard_Height,Keyboard_Width,1,key(1,81),0,"C",10,"Q"
	SetIslTsKeyx Y,X + (Keyboard_Width * 1),Keyboard_Height,Keyboard_width,1,key(1,87),0,"C",10,"W"
	SetIslTsKeyx Y,X + (Keyboard_Width * 2),Keyboard_Height,Keyboard_width,1,key(1,69),0,"C",10,"E"
	SetIslTsKeyx Y,X + (Keyboard_Width * 3),Keyboard_Height,Keyboard_width,1,key(1,82),0,"C",10,"R"
	SetIslTsKeyx Y,X + (Keyboard_Width * 4),Keyboard_Height,Keyboard_width,1,key(1,84),0,"C",10,"T"
	SetIslTsKeyx Y,X + (Keyboard_Width * 5),Keyboard_Height,Keyboard_width,1,key(1,89),0,"C",10,"Y"
	SetIslTsKeyx Y,X + (Keyboard_Width * 6),Keyboard_Height,Keyboard_width,1,key(1,85),0,"C",10,"U"
	SetIslTsKeyx Y,X + (Keyboard_Width * 7),Keyboard_Height,Keyboard_width,1,key(1,73),0,"C",10,"I"
	SetIslTsKeyx Y,X + (Keyboard_Width * 8),Keyboard_Height,Keyboard_width,1,key(1,79),0,"C",10,"O"
	SetIslTsKeyx Y,X + (Keyboard_Width * 9),Keyboard_Height,Keyboard_width,1,key(1,80),0,"C",10,"P"


	//calculate the starting X position for the second row of keys
	X = (30 - (10 * Keyboard_Width)) / 2 + 1
	//calculate the starting Y position for the second row of keys
	Y = 12 - (Keyboard_Height * 2) + 1


	//draw keys A(65),S(83),D(68),F(70),G(71),H(72),J(74),K(75),L(76)
	SetIslTsKeyx Y,X + (Keyboard_Width * 0),Keyboard_Height,Keyboard_Width,1,key(1,65),0,"C",10,"A"
	SetIslTsKeyx Y,X + (Keyboard_Width * 1),Keyboard_Height,Keyboard_width,1,key(1,83),0,"C",10,"S"
	SetIslTsKeyx Y,X + (Keyboard_Width * 2),Keyboard_Height,Keyboard_width,1,key(1,68),0,"C",10,"D"
	SetIslTsKeyx Y,X + (Keyboard_Width * 3),Keyboard_Height,Keyboard_width,1,key(1,70),0,"C",10,"F"
	SetIslTsKeyx Y,X + (Keyboard_Width * 4),Keyboard_Height,Keyboard_width,1,key(1,71),0,"C",10,"G"
	SetIslTsKeyx Y,X + (Keyboard_Width * 5),Keyboard_Height,Keyboard_width,1,key(1,72),0,"C",10,"H"
	SetIslTsKeyx Y,X + (Keyboard_Width * 6),Keyboard_Height,Keyboard_width,1,key(1,74),0,"C",10,"J"
	SetIslTsKeyx Y,X + (Keyboard_Width * 7),Keyboard_Height,Keyboard_width,1,key(1,75),0,"C",10,"K"
	SetIslTsKeyx Y,X + (Keyboard_Width * 8),Keyboard_Height,Keyboard_width,1,key(1,76),0,"C",10,"L"

	
	//calculate the starting X position for the third row of keys
	X = (30 - (10 * Keyboard_Width)) / 2 + 2
	//calculate the starting Y position for the second row of keys
	Y = 12 - (Keyboard_Height * 1) + 1

	//draw keys Z(90),X(88),C(67),V(86),B(66),N(78),M(77)
	SetIslTsKeyx Y,X + (Keyboard_Width * 0),Keyboard_Height,Keyboard_Width,1,key(1,90),0,"C",10,"Z"
	SetIslTsKeyx Y,X + (Keyboard_Width * 1),Keyboard_Height,Keyboard_width,1,key(1,88),0,"C",10,"X"
	SetIslTsKeyx Y,X + (Keyboard_Width * 2),Keyboard_Height,Keyboard_width,1,key(1,67),0,"C",10,"C"
	SetIslTsKeyx Y,X + (Keyboard_Width * 3),Keyboard_Height,Keyboard_width,1,key(1,86),0,"C",10,"V"
	SetIslTsKeyx Y,X + (Keyboard_Width * 4),Keyboard_Height,Keyboard_width,1,key(1,66),0,"C",10,"B"
	SetIslTsKeyx Y,X + (Keyboard_Width * 5),Keyboard_Height,Keyboard_width,1,key(1,78),0,"C",10,"N"
	SetIslTsKeyx Y,X + (Keyboard_Width * 6),Keyboard_Height,Keyboard_width,1,key(1,77),0,"C",10,"M"

	//backspace key
	SetIslTsKeyx Y,X + (Keyboard_Width * 8),Keyboard_Height,Keyboard_width,1,key(1,91),10072,"C",10,""

	//spacebar
	SetIslTsKeyx Y,X + (Keyboard_Width * 7),Keyboard_Height,Keyboard_width,1,key(1,92),0,"C",39,"|__|"
	
	
	//Provide an escape route
	SetIslTsKeyx 9,27,4, 4, 1, @Key_Clear, 10058, "L", 10, "Done/Exit"

ENDSUB


/////////////////////////////////////////////////
///////////        SQL FUNCTIONS      ///////////
/////////////////////////////////////////////////


SUB LOADSQL
	CALL LOADDLL
	CALL OPENSQL
ENDSUB

SUB LOADDLL
	IF SQL_H = 0
		DLLLOAD SQL_H, "MDSSysUtilsProxy.dll"
	ENDIF
ENDSUB

SUB OPENSQL
	IF SQL_H = 0
		RETURN
	ENDIF
	VAR CON_STATUS : N9
	DLLCALL_CDECL SQL_H, sqlIsConnectionOpen( REF CON_STATUS )
	IF CON_STATUS = 0
		DLLCALL_CDECL SQL_H, sqlInitConnection("micros", "ODBC;UID=custom;PWD=custom", "")
	ENDIF
ENDSUB

SUB SQL_QUERY( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlGetRecordSet( SQL_CMD )
	
	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		ERRORMESSAGE "SQL ERROR: ", SQL_CMD
	ENDIF
	
	DLLCALL_CDECL SQL_H, sqlGetNext( REF SQL_CMD )
ENDSUB

SUB SQL_EXEC( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlExecuteQuery( SQL_CMD )
	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		ERRORMESSAGE "SQL ERROR: ", SQL_CMD
	ENDIF
ENDSUB

SUB SQL_RECORDSET( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlGetRecordSet( sql_cmd )

	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		EXITWITHERROR "SQL Error: ", SQL_CMD
	ENDIF
ENDSUB

SUB SQL_NEXTRECORD( REF SQL_CMD )
		DLLCALL_CDECL SQL_H, sqlGetNext( REF SQL_CMD )
ENDSUB

SUB CLOSESQL
   IF SQL_H <> 0
         DLLCALL_CDECL SQL_H, sqlCloseConnection()
	 DLLFREE SQL_H
   ENDIF
   SQL_H = 0
ENDSUB
 
@Moregelen

Thanx man it works just fine, however is it possible to define which screen it defaults to once the check is picked for ease of navigation
 
Very cool sim Moregelen. Ill be keeping a copy of that.
I never would have thought to store the check sequence number in a KEY variable like that and to use KEYNUMBER to extract it again. Genius.

Do you want some custom SIM scripts developed. Contact me via my website
 
There isn't really an easy way to show specific screens reliably from SIM. If you make the change below to the SIM, it will no longer break the Next Screen definition on the button, so I would recommend setting the screen you want it to land on using Touchscreen Designer and this modification. Still keep the key set to inquiry 1. Theory is that when you hit the button, it will run the script (which is just to queue up a macro) and then change screen, and then execute the macro. Which means that part that breaks the next screen will happen after it has already changed screens.

@CathalMF - Yup yup. Useful way of getting the input back when you're dealing with complicated information you don't actually want to display. Just remember that because of my Next, Previous, and Exit keys there are certain off-limit numbers. Everything you see below inquiry 2 is actually part of a function library I just import into my scripts rather than coding it all over again, which is why a lot of it is generic. I normally just use the import function instead of putting it directly into the script, but obviously y'all need the actual code for it to work!

Code:
RETAINGLOBALVAR

VAR NEXT_PAGE_KEY : KEY = KEY(1,2)
VAR PREV_PAGE_KEY : KEY = KEY(1,1)
VAR SQL_H       : N12 = 0
VAR SQL_CMD     : A2000
VAR SHOW_CHECKS : KEY = KEY(24, 16384*2+@PMSSEQNUM)

VAR CURRENT_RVC : N3


EVENT INQ : 1
	LOADKYBDMACRO SHOW_CHECKS
ENDEVENT

EVENT INQ : 2
	IF @INSTANDALONEMODE OR @INBACKUPMODE
		EXITWITHERROR "Not available while in stand-alone or backup mode"
	ENDIF
	
	CALL LOADSQL
	
		FORMAT SQL_CMD AS "SELECT ob_tpriv11_pickup_others_chk FROM micros.emp_class_def WHERE emp_class_seq = (SELECT emp_class_seq FROM micros.emp_def WHERE obj_num = ", @TREMP, ")"
		CALL SQL_QUERY(SQL_CMD)
		VAR WHERE : A2000
		IF SQL_CMD = "T;" //the sql_cmd always adds the separator even if just one record, don't feel like throwing in a SPLITQ here
			FORMAT WHERE AS "chk_open = 'T'"
		ELSE
			FORMAT WHERE AS "chk_open = 'T' AND emp_seq = (SELECT emp_seq FROM micros.emp_def WHERE obj_num = ", @TREMP, ")"
		ENDIF
		FORMAT SQL_CMD AS "SELECT COUNT(chk_seq) FROM micros.chk_dtl WHERE ", WHERE
		CALL SQL_QUERY(SQL_CMD)
		VAR COUNT : N5 = SQL_CMD
		VAR CHK_NUMS[ COUNT ] : N9
		VAR CHK_SEQS[ COUNT ] : N9
		
		FORMAT SQL_CMD AS "SELECT chk_num, chk_seq FROM micros.chk_dtl WHERE ", WHERE, " ORDER BY chk_open_date_time"
		CALL SQL_RECORDSET(SQL_CMD)
		VAR I : N9
		FOR I = 1 TO COUNT
			CALL SQL_NEXTRECORD(SQL_CMD)
			SPLITQ SQL_CMD, ";", CHK_NUMS[I], CHK_SEQS[I]
		ENDFOR
		
		VAR INP_RESULT : A200
		VAR KEY_RESULT : KEY
		VAR CURRENT_PAGE : N9 = 1
		VAR CHK_SEQ : N9
		VAR CHK_NUM : N9
		VAR CHK_RVC : N9
		VAR LOOPING : N1 = 1
		WHILE LOOPING
			CALL ShowPaginationKeys(10, COUNT, CURRENT_PAGE, CHK_NUMS[], CHK_SEQS[])
			INPUTKEY KEY_RESULT, INP_RESULT, "SELECT CHECK NUMBER"
			
			//navigation keys accounted for first
			IF KEY_RESULT = @KEY_CLEAR
				EXITCONTINUE
			ENDIF
			IF KEY_RESULT = NEXT_PAGE_KEY
				CURRENT_PAGE = CURRENT_PAGE + 1
			ENDIF
			IF KEY_RESULT = PREV_PAGE_KEY
				CURRENT_PAGE = CURRENT_PAGE - 1
			ENDIF
			
			IF KEY_RESULT <> @KEY_CLEAR AND KEY_RESULT <> NEXT_PAGE_KEY AND KEY_RESULT <> PREV_PAGE_KEY
				//not a navigation key? okie dokie
				CHK_SEQ = KEYNUMBER(KEY_RESULT)
				FORMAT SQL_CMD AS "SELECT chk_num, rvc_seq FROM micros.chk_dtl WHERE chk_seq = ", CHK_SEQ
				CALL SQL_QUERY(SQL_CMD)
				SPLITQ SQL_CMD, ";", CHK_NUM, CHK_RVC
				//store the current RVC
				CURRENT_RVC = @RVC
				IF CURRENT_RVC <> CHK_RVC
					LOADKYBDMACRO KEY(42, CHK_RVC),KEY(1,327684),MAKEKEYS(CHK_NUM),@KEY_ENTER
				ELSE
					LOADKYBDMACRO KEY(1,327684),MAKEKEYS(CHK_NUM),@KEY_ENTER
				ENDIF
				LOOPING = 0
			ENDIF
		ENDWHILE
		
	CALL CLOSESQL
ENDEVENT

EVENT FINAL_TENDER
	IF CURRENT_RVC <> 0
		//attempt to put us back into our old rvc
		IF CURRENT_RVC <> @RVC
			LOADKYBDMACRO KEY(42, CURRENT_RVC)
		ENDIF
		CURRENT_RVC = 0
	ENDIF
ENDEVENT

EVENT SRVC_TOTAL:*
	IF CURRENT_RVC <> 0
		//attempt to put us back into our old rvc
		IF CURRENT_RVC <> @RVC
			LOADKYBDMACRO KEY(42, CURRENT_RVC)
		ENDIF
		CURRENT_RVC = 0
	ENDIF
ENDEVENT

//////////////////////////////////////////////////
///////////    FORMATTING FUNCTIONS   ////////////
//////////////////////////////////////////////////

SUB PAD_LINE( REF OUT, VAR LINE : A40)
	VAR PADDING : A40 = "                                        "
	FORMAT OUT AS MID(PADDING,1,(32-LEN(LINE))/2.0), LINE 	
ENDSUB


//////////////////////////////////////////////////
///////////       INPUT FUNCTIONS     ////////////
//////////////////////////////////////////////////
SUB GET_YES_NO( REF ANSWER, VAR MESSAGE : A78 )
	CLEARISLTS
		SETISLTSKEYX 2, 10, 4, 4, 2, @KEY_ENTER, 10059, "LEFT", 10, "YES"
		SETISLTSKEYX 2, 16, 4, 4, 2, @KEY_CLEAR, 10058, "LEFT", 10, "NO"
		SETISLTSKEYX 11, 12, 2, 6, 2, @KEY_CANCEL, 10392, "LEFT", 10, "CANCEL"
	DISPLAYISLTS
	
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEY_PRESS : KEY
	VAR DATA : A20
	INPUTKEY KEY_PRESS, DATA, MESSAGE
	
	IF KEY_PRESS = @KEY_ENTER
		ANSWER = 1
	ELSEIF KEY_PRESS = @KEY_CANCEL
		EXITCONTINUE
	ELSE
		ANSWER = 0
	ENDIF
	WINDOWCLOSE
ENDSUB

SUB GET_INPUT( REF ANSWER, VAR MESSAGE : A78, VAR TS_SCRN : N9 )
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEYPRESS : KEY
	IF TS_SCRN > 0
		TOUCHSCREEN TS_SCRN
	ENDIF
	INPUTKEY KEYPRESS, TIPAMT, MESSAGE
	WINDOWCLOSE
ENDSUB

SUB ShowPaginationKeys( var ResultsPerPage : N4, var ResultSize : N4, var CurrentPage : N4, ref Names[], ref ObjNums[] )

	Clearislts
	
	while (CurrentPage-1) * ResultsPerPage + 1 > ResultSize AND CurrentPage > 1
		CurrentPage = CurrentPage - 1
	endwhile

	var NumPages : N5 = 1
	while NumPages*ResultsPerPage < ResultSize
		NumPages = NumPages + 1
	endwhile

	var KeyHeight : N1 = 6
	var KeyWidth : N1 = 30 / (ResultsPerPage / 2)
	
	var FirstItem : N5 = (CurrentPage-1) * ResultsPerPage + 1
	
	//draw first row of results
	var i : N5

	for i = FirstItem to FirstItem + ResultsPerPage / 2 - 1
		if i > ResultSize
			break
		endif
		SetIslTsKeyx 1,(i - FirstItem) * KeyWidth + 1,3,KeyWidth,1,key(1, ObjNums[ i ]), 0, "C", 1, Names[ i ]
	endfor

	//draw second row of results
	for i = i to FirstItem + ResultsPerPage
		if i > ResultSize
			break
		endif
		SetIslTsKeyx 4,(i - FirstItem - ResultsPerPage / 2) * KeyWidth + 1,3,KeyWidth,1,key(1, ObjNums[ i ]), 0, "C", 1, Names[ i ]
	endfor

	//draw some page keys
	if CurrentPage > 1
		setisltskeyx 11, 1, 2, 2, 1, key(1,1), 10388, "C", 10, ""
	endif
	if CurrentPage < NumPages
		setisltskeyx 11, 3, 2, 2, 1, key(1,2), 10389, "C", 10, ""
	endif
	
	//Provide an escape route
	SetIslTsKeyx 9,27,4, 4, 1, @Key_Clear, 10058, "L", 10, "Done/Exit"
	
	displayislts

endsub

SUB ShowISLKeyboard( var Keyboard_Width : N2, var Keyboard_Height : N2)

	//ASCII keys 65 - 90

	//calculate the starting X position for the top row of keys
	var X : N2 = (30 - (10 * Keyboard_Width)) / 2
	//calculate the starting Y position for the top row of keys
	var Y : N2 = 12 - (Keyboard_Height * 3) + 1

	//draw keys Q(81),W(87),E(69),R(82),T(84),Y(89),U(85),I(73),O(79),P(80)
	SetIslTsKeyx Y,X + (Keyboard_Width * 0),Keyboard_Height,Keyboard_Width,1,key(1,81),0,"C",10,"Q"
	SetIslTsKeyx Y,X + (Keyboard_Width * 1),Keyboard_Height,Keyboard_width,1,key(1,87),0,"C",10,"W"
	SetIslTsKeyx Y,X + (Keyboard_Width * 2),Keyboard_Height,Keyboard_width,1,key(1,69),0,"C",10,"E"
	SetIslTsKeyx Y,X + (Keyboard_Width * 3),Keyboard_Height,Keyboard_width,1,key(1,82),0,"C",10,"R"
	SetIslTsKeyx Y,X + (Keyboard_Width * 4),Keyboard_Height,Keyboard_width,1,key(1,84),0,"C",10,"T"
	SetIslTsKeyx Y,X + (Keyboard_Width * 5),Keyboard_Height,Keyboard_width,1,key(1,89),0,"C",10,"Y"
	SetIslTsKeyx Y,X + (Keyboard_Width * 6),Keyboard_Height,Keyboard_width,1,key(1,85),0,"C",10,"U"
	SetIslTsKeyx Y,X + (Keyboard_Width * 7),Keyboard_Height,Keyboard_width,1,key(1,73),0,"C",10,"I"
	SetIslTsKeyx Y,X + (Keyboard_Width * 8),Keyboard_Height,Keyboard_width,1,key(1,79),0,"C",10,"O"
	SetIslTsKeyx Y,X + (Keyboard_Width * 9),Keyboard_Height,Keyboard_width,1,key(1,80),0,"C",10,"P"


	//calculate the starting X position for the second row of keys
	X = (30 - (10 * Keyboard_Width)) / 2 + 1
	//calculate the starting Y position for the second row of keys
	Y = 12 - (Keyboard_Height * 2) + 1


	//draw keys A(65),S(83),D(68),F(70),G(71),H(72),J(74),K(75),L(76)
	SetIslTsKeyx Y,X + (Keyboard_Width * 0),Keyboard_Height,Keyboard_Width,1,key(1,65),0,"C",10,"A"
	SetIslTsKeyx Y,X + (Keyboard_Width * 1),Keyboard_Height,Keyboard_width,1,key(1,83),0,"C",10,"S"
	SetIslTsKeyx Y,X + (Keyboard_Width * 2),Keyboard_Height,Keyboard_width,1,key(1,68),0,"C",10,"D"
	SetIslTsKeyx Y,X + (Keyboard_Width * 3),Keyboard_Height,Keyboard_width,1,key(1,70),0,"C",10,"F"
	SetIslTsKeyx Y,X + (Keyboard_Width * 4),Keyboard_Height,Keyboard_width,1,key(1,71),0,"C",10,"G"
	SetIslTsKeyx Y,X + (Keyboard_Width * 5),Keyboard_Height,Keyboard_width,1,key(1,72),0,"C",10,"H"
	SetIslTsKeyx Y,X + (Keyboard_Width * 6),Keyboard_Height,Keyboard_width,1,key(1,74),0,"C",10,"J"
	SetIslTsKeyx Y,X + (Keyboard_Width * 7),Keyboard_Height,Keyboard_width,1,key(1,75),0,"C",10,"K"
	SetIslTsKeyx Y,X + (Keyboard_Width * 8),Keyboard_Height,Keyboard_width,1,key(1,76),0,"C",10,"L"

	
	//calculate the starting X position for the third row of keys
	X = (30 - (10 * Keyboard_Width)) / 2 + 2
	//calculate the starting Y position for the second row of keys
	Y = 12 - (Keyboard_Height * 1) + 1

	//draw keys Z(90),X(88),C(67),V(86),B(66),N(78),M(77)
	SetIslTsKeyx Y,X + (Keyboard_Width * 0),Keyboard_Height,Keyboard_Width,1,key(1,90),0,"C",10,"Z"
	SetIslTsKeyx Y,X + (Keyboard_Width * 1),Keyboard_Height,Keyboard_width,1,key(1,88),0,"C",10,"X"
	SetIslTsKeyx Y,X + (Keyboard_Width * 2),Keyboard_Height,Keyboard_width,1,key(1,67),0,"C",10,"C"
	SetIslTsKeyx Y,X + (Keyboard_Width * 3),Keyboard_Height,Keyboard_width,1,key(1,86),0,"C",10,"V"
	SetIslTsKeyx Y,X + (Keyboard_Width * 4),Keyboard_Height,Keyboard_width,1,key(1,66),0,"C",10,"B"
	SetIslTsKeyx Y,X + (Keyboard_Width * 5),Keyboard_Height,Keyboard_width,1,key(1,78),0,"C",10,"N"
	SetIslTsKeyx Y,X + (Keyboard_Width * 6),Keyboard_Height,Keyboard_width,1,key(1,77),0,"C",10,"M"

	//backspace key
	SetIslTsKeyx Y,X + (Keyboard_Width * 8),Keyboard_Height,Keyboard_width,1,key(1,91),10072,"C",10,""

	//spacebar
	SetIslTsKeyx Y,X + (Keyboard_Width * 7),Keyboard_Height,Keyboard_width,1,key(1,92),0,"C",39,"|__|"
	
	
	//Provide an escape route
	SetIslTsKeyx 9,27,4, 4, 1, @Key_Clear, 10058, "L", 10, "Done/Exit"

ENDSUB


/////////////////////////////////////////////////
///////////        SQL FUNCTIONS      ///////////
/////////////////////////////////////////////////


SUB LOADSQL
	CALL LOADDLL
	CALL OPENSQL
ENDSUB

SUB LOADDLL
	IF SQL_H = 0
		DLLLOAD SQL_H, "MDSSysUtilsProxy.dll"
	ENDIF
ENDSUB

SUB OPENSQL
	IF SQL_H = 0
		RETURN
	ENDIF
	VAR CON_STATUS : N9
	DLLCALL_CDECL SQL_H, sqlIsConnectionOpen( REF CON_STATUS )
	IF CON_STATUS = 0
		DLLCALL_CDECL SQL_H, sqlInitConnection("micros", "ODBC;UID=custom;PWD=custom", "")
	ENDIF
ENDSUB

SUB SQL_QUERY( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlGetRecordSet( SQL_CMD )
	
	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		ERRORMESSAGE "SQL ERROR: ", SQL_CMD
	ENDIF
	
	DLLCALL_CDECL SQL_H, sqlGetNext( REF SQL_CMD )
ENDSUB

SUB SQL_EXEC( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlExecuteQuery( SQL_CMD )
	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		ERRORMESSAGE "SQL ERROR: ", SQL_CMD
	ENDIF
ENDSUB

SUB SQL_RECORDSET( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlGetRecordSet( sql_cmd )

	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		EXITWITHERROR "SQL Error: ", SQL_CMD
	ENDIF
ENDSUB

SUB SQL_NEXTRECORD( REF SQL_CMD )
		DLLCALL_CDECL SQL_H, sqlGetNext( REF SQL_CMD )
ENDSUB

SUB CLOSESQL
   IF SQL_H <> 0
         DLLCALL_CDECL SQL_H, sqlCloseConnection()
	 DLLFREE SQL_H
   ENDIF
   SQL_H = 0
ENDSUB
 
@CathalMF

It seems nothing is ever impossible wish I had this much knowledge on SIM

@Moregelen

Thanx again for the script just makes me learn even more on sims am kinder new to them though
 
Depends on what you mean by alpha value. You can see I have a keyboard function that I use when I want them to type in information (I use that instead of a straight input because then I can respond each time they hit a button). If you mean storing something like letters in the key itself, I've done this before with small sets by converting them into two digit numbers, but there is a limit (I don't know what it is) to how much you can shove inside of a button. What are you trying to get back exactly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top