Fieldpine Logo Documentation Home  

Event Handler Reference


The following table shows all available events in the system. There are different types of events

These types of events can be generated and handled in different ways.

There are a large number of events covering both business level and highly technical aspects of the system. The "Use" column in the table attempts to show where the event is primarily consumed.

Event#NameUsePosScript"C"TTFLoggedTypeDescription
16000PriceAllSaleRareNoP1918ActiveCalled near the end of POS pricing to allow you to override the pricing on the whole sale
16001SalelinePreAddCommonNoP1918ActiveAn item is about to be added to the sale and you can stop this. This event cannot be handled by PosScript, there is an alternative event for PosScript users 2010, SalelineAddPre
16002PastSalesDisplayRareNoP1921ActiveA sale is about to be drawn on the PastSales screen. This event can block the sale from being displayed
16003PosVersionChangeRareNoP1923PassiveCalled if the Pos detects the underlying code version has changed
16100ServerLoadedSaleRareNoP1918PassiveCalled when a server system is about to store a sale from a trading lane
16300HttpSocketAcceptTechNoP1918ActiveCalled after a TCP connection has been accepted. You can abort the connection.
16400DatabaseOpenQueryInternalNoP1918PassiveCalled immediately before an SQL query is sent to the underlying database engine.
10003ActiveSaleChangeNormal P623P1918 PassiveSent when the active sale the user is seeing on screen changes
100SaleCreatedNormal Yes Not yet fully documented. PS_SALE_NEW
1000PS_BARCODE_UNKNOWN_DEFINENormal Yes Not yet fully documented
1001PS_BARCODE_UNKNOWN_NODEFINENormal Yes Not yet fully documented
1002PS_BARCODE_UNKNOWN_CUSTNormal Yes Not yet fully documented
1007PS_SALE_PARK_REQUESTNormal Yes Not yet fully documented
1008Writeoff requestNormal Yes Not yet fully documented
1009Quit RequestNormal Yes Not yet fully documented
1010Trash RequestNormal Yes Not yet fully documented
1011Saledone PreNormal Yes Not yet fully documented
1012Return RequestNormal Yes Not yet fully documented
1013Purge PreNormal Yes Not yet fully documented
1014Purge PostNormal Yes Not yet fully documented
1015CancelCommon Yes Not yet fully documented
1016Reverse RequestNormal Yes Not yet fully documented
1017Reverse DoneNormal Yes Not yet fully documented
1018Sale CompletedNormal Yes Not yet fully documented
1019Cancel RequestNormal Yes Not yet fully documented
1020Sale TestModeNormal Yes Not yet fully documented
1022Trash DoneNormal Yes Not yet fully documented
1023Sale Pre CompleteNormal Yes Not yet fully documented
1024Pre Sale Pre CompleteNormal Yes Not yet fully documented
1025Sale payments allowedNormal Yes Not yet fully documented
1100Reward reachedNormal Yes Not yet fully documented
1400Split StartNormal Yes Not yet fully documented
2000Http new requestNormal Yes Not yet fully documented
10001Product dispatchNormal Yes Not yet fully documented
2001SalelineAddCommon YesNo ActiuveItem has been added to the sale. The event handler is able to capture and update any additional fields.
2002Saleline add cashNormal Yes Not yet fully documented
2003Saleline discount addNormal Yes Not yet fully documented
2004Saleline discount deletedNormal Yes Not yet fully documented
2005Saleline price changeNormal Yes Not yet fully documented
2006Saleline quantity changeNormal Yes Not yet fully documented
2009Saleline deletedNormal Yes Not yet fully documented
2010SalelineAddPreCommon YesNo ActiveThis event cannot be handled by PosScript, there is an alternative event for PosScript users 16001, SalelinePreAdd
2011saleline alter totalNormal Yes Not yet fully documented
2014saleline price promptNormal Yes Not yet fully documented
2015Return adjustmentNormal Yes Not yet fully documented
2016Return CompleteNormal Yes Not yet fully documented
2017Hire ReturnNormal Yes Not yet fully documented
2018Hire unreturnNormal Yes Not yet fully documented
2019Auto WriteoffNormal Yes Not yet fully documented
2104Saleline request delete discountNormal Yes Not yet fully documented
3000Payment addNormal Yes Not yet fully documented
3001Payment deletedNormal Yes Not yet fully documented
3002Payment filterNormal Yes Not yet fully documented
3003Ext PromptNormal Yes Not yet fully documented
3500Float logNormal Yes Not yet fully documented
4000Teller changeNormal Yes Not yet fully documented
4002Teller password failureNormal Yes Not yet fully documented
4003Teller change requestNormal Yes Not yet fully documented
4004Teller max failureNormal Yes Not yet fully documented
4005Teller timeoutNormal Yes Not yet fully documented
4006Teller Meta changeNormal Yes Not yet fully documented
4500Cash inNormal Yes Not yet fully documented
4600Cash outNormal Yes Not yet fully documented
4700Language changeNormal Yes Not yet fully documented
4800Rightclick menu requestNormal Yes Not yet fully documented
5000Customer setNormal Yes Not yet fully documented
5001Customer sale historyNormal Yes Not yet fully documented
5002Account detailNormal Yes Not yet fully documented
5003Account BillNormal Yes Not yet fully documented
5004Customer set requestNormal Yes Not yet fully documented
5005Customer set failureNormal Yes Not yet fully documented
5006Floor limit exceededNormal Yes Not yet fully documented
5100Reward adviseNormal Yes Not yet fully documented
5200Purchase new headerNormal Yes Not yet fully documented
5201Purchase new lineNormal Yes Not yet fully documented
5202Purchase order approvedNormal Yes Not yet fully documented
5203Get new Order#Normal Yes Not yet fully documented
10001Location ChangeNormal Yes Not yet fully documented
10002Screen RequestNormal Yes ActiveThe User Interface is about to display a new screen.
10004User InputNormal Yes Not yet fully documented
10005Send EmailNormal Yes Not yet fully documented
10006Popup RegnoNormal Yes Not yet fully documented
10007Serial item scannedNormal Yes Not yet fully documented
12000Cash drawer openingNormal Yes Not yet fully documented
12001Cash drawer abnormal openNormal Yes Not yet fully documented
12010Eftpos failureNormal Yes Not yet fully documented
13000Settle CloseNormal Yes Not yet fully documented
13002Settle Close ParkedNormal Yes Not yet fully documented
13003Settle PrintingNormal Yes Not yet fully documented
13004Settle Close BlindNormal Yes Not yet fully documented
13005Settle Close DoneNormal Yes Not yet fully documented
13006Shift CloseNormal Yes Not yet fully documented
13007Shift OpenNormal Yes Not yet fully documented
14000Debug RequestNormal Yes Not yet fully documented
14001Config RequestNormal Yes Not yet fully documented
14002Designer publishNormal Yes Not yet fully documented
18997Maint commandNormal Yes Not yet fully documented
18998Drawer MotionNormal Yes Not yet fully documented
18999Printer Status ChangeNormal Yes Not yet fully documented
19000Stock LevelNormal No Not yet fully documented
19001Hard totalNormal No Not yet fully documented
19002SysErrorNormal No Not yet fully documented
19003Pole DisplayNormal No Not yet fully documented
19004MessageBoxNormal No Not yet fully documented
19005Store ChatNormal No Not yet fully documented
19006FIS ChangeNormal No Not yet fully documented
19007Makeline ChangeNormal No Not yet fully documented
19008Eftpos doneNormal No Not yet fully documented
19009Runtime ErrorNormal No Not yet fully documented
19010Sale loadedNormal No Not yet fully documented
19011TimeCheckNormal No Not yet fully documented
19012Screen CloseNormal No Not yet fully documented
19013Saleline Post EventNormal No Not yet fully documented
19600Spy StatusTech No Not yet fully documented
19601KeypressTech No Not yet fully documented
19602barcode scanTech No Not yet fully documented
19603printer actionTech No Not yet fully documented
19604cash drawerTech No Not yet fully documented
19605Fuel transactionTech No Not yet fully documented
19606WindowsTech No Not yet fully documented
19607MouseTech No Not yet fully documented
19608TraceTech No Not yet fully documented
201System Startup No YesPassive
202Version Change No YesPassive
203Quickcode Executed No YesPassive
204Runtime Error No YesPassive
205TimeChanged No YesPassive
208BIS End No YesPassive
216MsgBox No YesPassive
217Sale Complete No YesPassive
218Crash Detected No YesPassive
219Lots of Files No YesPassive
220Major System Issue No YesPassive
221Hardware Change No YesPassive
222Auto Recovery No YesPassive
241Screen Open No YesPassive
242Barcode Scanned No YesPassive
243Screenshot No YesPassive
244Large Change No YesPassive
245Manual Discount No YesPassive
246Account Balance Change No YesPassive
247Online Sale Arrived No YesPassive
248Eftpos Failure No YesPassive
249Lookup Products No YesPassive
250Device Performance No YesPassive
251Database Performance No YesPassive
252Cash Drawer Open All No YesPassive
253Cash Drawer Open Abnormal No YesPassive
254System Screen Opening No YesPassive
255Bad barcode scan No YesPassive
256Login Fail No YesPassive
257Database slow No YesPassive
258Speedtest No YesPassive
259Environment Change No YesPassive
260Pos State No YesPassive
281Purchase Order Change No YesPassive
282Sale Change No YesPassive
283Product Change No YesPassive
284Supplier Change No YesPassive
285Customer Change No YesPassive
286Sale Delete Item No YesPassive
287Settle Completed No YesPassiveFired after the end of day settlement screen is completed.
288Startup Performance No YesPassive

#2010, SalelineAddPre

Called just before an item is about to be added to a sale. This event allows you to stop this item being added to the sale. Use "exit 0" to stop the item being added.

Input Arguments:

Symbol NameContents
%CTX.product.*%The product record being added. Any of the product attributes can be fetched. Common values fetched are CTX.product.piditem, CTX.product.plucode
%sale.*%Details of the current sale
%salecustomer.*%Details of the current customer. These symbols may return 0/empty if no customer is currently selected
*All other general symbols are also available

Example PosScript Handler

:event(number(2010) index(0))
	set customer = %salecustomer.cid%
	set plu = %CTX.product.plucode%

	if customer = 17
	then
		if plu = "BEER"
		then
			message(99,1,This customer is not allowed to purchase %CTX.product.description%)
			exit 0
		endif
	endif

	exit

#2001, SalelineAdd

Called after an item has been added to a sale. The saleline is ready for you to capture and store any additional information.

The symbol CTX.product. is not valid during this event. you can access the same information using the PosScript variable "saleline(-1,nnnn)"

Input Arguments:

Symbol NameContents

Example PosScript Handler

:event(number(2001) index(0))
	set prodcode = saleline(-1,plucode)
	
	
	//  ************** Part 1 - Save the PLU code ************
	// Would not normally do this, it is for this example only

	sale(line,set,field,u_Saved_Plu,%prodcode%)

	
	//  ************** Part 2 - Update site specific saleline fields ************
	
	// If this product is taxable we have to add VAT to the custom field u_Unit_Avg_Cost
	// We need to check the setting u_FlatTax1_? to determine if the item is taxable
	// as products are stored in groups
	set lncatid = posc(storage(query(field(u_Account_Category) psql(?products,plucode,=,%prodcode%))))
	set a = string((u_FlatTax1_%lncatid%))
	set b = string(settings) + a
	set taxable = symbol(%b%)
	if taxable = Yes
	then
		// Get the line average cost from the products table
		set lnavgcst = posc(storage(query(field(CostPriceAverage) psql(?products,plucode,=,%prodcode%))))
		// Calculate tax
		set vat = tax(2,lnavgcst)
		// Add the tax to the average cost
		set lnavgcst = lnavgcst + vat
		// Round the total
		set lnavgcst = function(lnavgcst,financialround)
		// Store the new value including the VAT
		sale(line,set,field,u_Unit_Avg_Cost,%lnavgcst%)
	endif



	//  ************** Part 3 - Prompt user for product specific information ************

	// Do we have specific prompt screen
	set prodpidcode = saleline(-1,pid)
	if prodpidcode = 0:13427
	then
		screen(4xml(6050_ScriptXml.scr,EnterPricePid13427))
	endif

#16300, HttpSocketAccept

When a network request connects, this event is fired immediately after the accept() call. You may drop the connection by returning a Deny Response. The POS continues to perform normal restriction checking after this call; so even if you ALLOW a connection it may still be dropped.

Input Arguments:

Field#NameContents
450FIELDPINE_EVNT_SOCKADDRThe SOCKADDR structure that was filled in by the accept() call

Calling Pseudo Code

  SOCKET s = accept(..., SockAddr);
  if (s != INVALID_SOCKET) {
	... Call event handlers, passing SockAddr ...
	... If any handler returns DENY, close socket and exit ...
  }

Example Mini "C" Handler

:event(number(16300) index(0) lang(C))
	// Deny connections from 192.201.*.*

	SOCKADDR_IN sock;
	memset(&sock, 0, sizeof(sock));

	PosContext_GetFieldToBuffer(pContext, FIELDPINE_EVNT_SOCKADDR, &sock, sizeof(sock));
	if (sock.sin_addr.S_un.S_un_b.s_b1 == 192) {
		if (sock.sin_addr.S_un.S_un_b.s_b2 == 201) {
			return FIELDPINE_REEV_DENY;
		}
	}
	return FIELDPINE_REEV_NO_RESPONSE;
:end


#16400, DatabaseOpenQuery

The system is about to send a new SQL query to the database engine. Primarily this is used for support purposes.

Input Arguments:

Field#NameContents
480FIELDPINE_EVNT_SQLThe SQL about to be sent to the database engine. This SQL might still be altered to conform to underlying engine syntax and performance requirements

Example Mini "C" Handler

:event(number(16400) index(0) lang(C))
	#include <stdio.h>
	#include <share.h>

	FILE* pf = _fsopen("SqlLog.out", "a", _SH_DENYNO);
	if (pf) {
		char* pValue = NULL;
		int ValueLen = 0;
		PosContext_GetFieldPtr(pContext, FIELDPINE_EVNT_SQL, &pValue, &ValueLen);
		if ((pValue != NULL) && (ValueLen > 0)) {
			fprintf(pf, "Sql=%*s\n", ValueLen, pValue);
		}
		fclose(pf);
	}
	return FIELDPINE_REEV_NO_RESPONSE;
:end


#10002, Screen Request

The User interface is about to display a new screen. This event fires to allow you to block or override this operation. You can allow the operation (default action), block the screen or set a replacement screen to be used.

Input Arguments:

Field#NameContents
300FIELDPINE_EVNT_CONTEXT1The name of the screen being requested

Example Mini "C" Handler

:event(number(10002) index(0) lang(C))
	#include <stdio.h>
	#include <share.h>
	#include <string.h>

	// Get the name of the screen being invoked
	int ValueLen = 0;
	char* pValue = PosContext_GetFieldPtr(pContext, FIELDPINE_EVNT_CONTEXT1, &ValueLen);

	// Log this to an audit file
	FILE* pf = _fsopen("ScreensLog.out", "a", _SH_DENYNO);
	if (pf) {
		if ((pValue != NULL) && (ValueLen > 0)) {
			time_t ltime;
			time( &ltime );

			char buff[70];
			strftime(buff, sizeof(buff), "%d-%b-%Y %H:%M:%S", localtime(&ltime));
			fprintf(pf, "%s Screen=%*s\n", buff, ValueLen, pValue);
		}
		fclose(pf);
	}

	// Or, Block the Menu screen completely
	if ((ValueLen == 4) && (strnicmp(pValue, "menu", 4) == 0)) {
		return FIELDPINE_REEV_DENY;
	}


	// Or, If they are requesting the screen "hidden", change to "secret"
	if ((ValueLen == 6) && (strnicmp(pValue, "hidden", 6) == 0)) {
		PosContext_SetData(pContext, "workingcommand.newscreen", "secret");
		return FIELDPINE_REEV_ALLOW;
	}

	return FIELDPINE_REEV_NO_RESPONSE;
:end

#10003, Active Sale Change

The active sale on screen has changed and the user is working with a different sale. This can be as simple as the user is clicking on tabs to select multiple sales or is starting a new sale.

Input Arguments:

Field#NameContents
421FIELDPINE_EVNT_ORIGINAL_SIDThe SaleId (specific to this machine) now being displayed

Example Mini "C" Handler

:event(number(10003) index(0) lang(C))
	long DisplaySid = PosContext(pContext, FIELDPINE_EVNT_ORIGINAL_SID);
	// The current SID on screen is now  DisplaySid.
	// If DisplaySid is zero, no sale is currently displaying
	// ....  Do whatever ....

	return FIELDPINE_REEV_NO_RESPONSE;
:end


#16002, PastSales Display Request

The Past sales screen has selected a sale to be displayed. This event fires to allow you to block or override this operation.

Input Arguments:

Field#NameContents
421FIELDPINE_EVNT_ORIGINAL_SIDThe local sale number for the sale
310FIELDPINE_EVNT_COUNTER_1The number of sales that have alreay been added to the display
311FIELDPINE_EVNT_CALLER_IDunique number that is the same for every call from this run, but will differ the next time the screen is displayed

Example Mini "C" Handler

:event(number(16002) index(0) lang(C))

	// Get the Sid 
	long Sid = PosContext_GetField(pContext, FIELDPINE_EVNT_ORIGINAL_SID);

	// If it is just this sale#, do not allow it
	if (Sid == 8382200) return FIELDPINE_REEV_DENY;

	return FIELDPINE_REEV_NO_RESPONSE;
:end

Example of Blocking a Customer

:event(number(16002) index(0) lang(C))

	// Get the Sid 
	long Sid = PosContext_GetField(pContext, FIELDPINE_EVNT_ORIGINAL_SID);

	// Ask for the Cid number from this sale
	// Note, this API is not available at time of writing, but will be shortly
	long Cid = PosDatabase_GetLong_clc(pContext, "Sale[#1]", Sid, ".cid");

	// If it is just this Cid#, do not allow it
	if (Cid == 83) return FIELDPINE_REEV_DENY;

	return FIELDPINE_REEV_NO_RESPONSE;
:end