Query panel in the Number generator window
Query panel in the Number generator window

The Query panel is used to enter and edit the SQL query that generates the object number.

Figure 11.101. Query panel


The panel displays a multiline text box for editing the query. The context menu of this box contains the Test query command, which is used to test the query. After the test is over, the Query result window opens.

The following parameters can be used in the query:

Stock-in records (tp_InputDocuments)
  %stor_ID - Store
  %part_ID - Partner
  %usr_ID - Employee
  %Date - Date
Stock-out records (tp_OutputDocuments)
  %stor_ID - Store 
  %part_ID - Partner 
  %usr_ID - Employee 
  %Date - Date
Sales records (tp_SaleDocuments)
  %arch_ID - Business day
  %stor_ID - Store 
  %usr_ID - Employee 
  %Date - Date
Stocktaking records (tp_StoreInventories)
  %stor_ID - Store 
  %usr_ID - Employee 
  %Date - Date
Production records (tp_CompoundDocuments)
  %stor_ID - Store 
  %usr_ID - Employee 
  %Date - Date 
Butchering records (tp_DecomposeDocuments)
  %stor_ID - Store 
  %usr_ID - Employee 
  %Date - Date 
Stock movement records (tp_MoveDocuments)
  %stor_ID - Store 
  %stor_ID_In - Sending store
  %stor_ID_Out - Sending store
  %usr_ID - Employee 
  %Date - Date 
Stock adjustment records (tp_WriteOffDocuments)
  %stor_ID - Store 
  %wdtp_ID - Stock adjustment record type
  %usr_ID - Employee 
  %Date - Date 
Development records (tp_StoreExperiments)
  %stor_ID - Store 
  %usr_ID - Employee 
  %Date - Date 
Receipts (tp_Checks)
  %dvsn_ID - Division 
  %arch_ID - Business day 
  %dev_ID - POS terminal 
  %usr_ID - Employee 
  %Date - Date 
Bills (tp_PreChecks)
  %arch_ID - Business day 
  %dev_ID - POS terminal 
  %usr_ID - Employee 
  %Date - Date 
Orders (tp_Orders)
  %dvsn_ID - Division 
  %arch_ID - Business day 
  %plac_ID - Table 
  %dev_ID - POS terminal 
  %usr_ID - Employee 
  %Date - Date 
Guest tabs (tp_Guests)
  %dvsn_ID - Division 
  %arch_ID - Business day 
  %plac_ID - Table 
  %dev_ID - POS terminal 
  %usr_ID - Employee 
  %Date - Date 
IDs (tp_Identifiers)
  %idnt_Name - ID name
Regular customer account operations(tp_ClientPurseOperations)
  %clnt_ID - Regular customer
  %cptp_ID - Regular customer account type
  %usr_ID - Employee
  %atop_ID - Authorisation operation
  %Date - Date
Regular customer points operations (tp_ClientDiscountPointOperations)
  %clnt_ID - Regular customer
  %dspt_ID - Point type
  %usr_ID - Employee
  %Date - Date
Business days (tp_Archives)
  %dvsn_ID - Division 
  %dev_ID - POS terminal 
  %usr_ID - Employee 
  %Date - Date 
Store period closure (tp_StoreArchives)
  %stgr_ID - Store group
  %Date - Date 
Planned cost records (tp_StoreGroupPlanPrices)
  %stgr_ID - Store group
  %Date - Date 
  %usr_ID - Employee