Skip to content

Lane Transaction Database

Andy Theuninck edited this page May 29, 2015 · 1 revision

CapturedSignature

Name Type Info
capturedSignatureID INT PK Increment
tdate DATETIME Indexed
emp_no INT
register_no INT Indexed
trans_no INT
trans_id INT
filetype CHAR(3)
filecontents BLOB

Use: This table contains digital images of customer signatures. The standard dtransactions columns indicate what transaction line the signature goes with. Filetype is a three letter extension indicating what kind of image it is, and filecontents is the raw image data. This data is in the database because it's the only existing pathway to transfer information from the lane to the server.

CcReceiptView

View

Name Type Info
tranType VARCHAR(255)
amount MONEY
PAN VARCHAR(255)
entryMethod VARCHAR(255)
issuer VARCHAR(255)
name VARCHAR(255)
xResultMessage VARCHAR(255)
xApprovalNumber VARCHAR(255)
xTransactionID VARCHAR(255)
date INT
cashierNo INT
laneNo INT
transNo INT
transID INT
datetime DATETIME
sortorder INT

Use: View of transaction timing to generate cashier performance reports

PaycardTransactions

Name Type Info
paycardTransactionID INT PK Increment
dateID INT Indexed
empNo INT
registerNo INT Indexed
transNo INT Indexed
transID INT
previousPaycardTransactionID INT
processor VARCHAR(25)
refNum VARCHAR(50)
live TINYINT
cardType VARCHAR(15)
transType VARCHAR(15)
amount MONEY
PAN VARCHAR(19)
issuer VARCHAR(20)
name VARCHAR(50)
manual TINYINT
requestDatetime DATETIME
responseDatetime DATETIME
seconds FLOAT
commErr SMALLINT
httpCode SMALLINT
validResponse SMALLINT
xResultCode VARCHAR(8)
xApprovalNumber VARCHAR(20)
xResponseCode VARCHAR(8)
xResultMessage VARCHAR(100)
xTransactionID VARCHAR(12)
xBalance VARCHAR(8)
xToken VARCHAR(64)
xProcessorRef VARCHAR(24)
xAcquirerRef VARCHAR(100)

Use: This table records information about integrated card transactions.

The first set of columns simply identifies the transaction.

  • paycardTransactionID is an identity column. It should be unique at the lane level and unique in conjunction with registerNo at the server level.
  • dateID, empNo, registerNo, transNo, and transID refer to the corresponding tender record in dtransaction. The camelCase names instead of underscores are for compliance with newer project style guidlines.
  • previousPaycardTransactionID refers to a previous record in this table. A void transaction should refer to the previous approved transaction.

The next set of column has information about what was sent to the server.

  • processor is the name of the PHP class that's making the request
  • refNum is a reference number sent to the processor. This is usually just a memo field that will come back unchanged on the response.
  • live indicates whether it's a live or testing transaction
  • cardType is Credit, Debit, etc
  • transType is Sale, Return, etc
  • amount is the Sale, Return, etc amount. This value is always positive.
  • PAN is the last four digits of the card. Do not record full card numbers for credit or debit cards. May be permissible with some gift card providers to keep the whole number.
  • issuer is Visa, MasterCard, etc
  • name is the cardholder's name. This is not always available and depends on what's on the magnetic stripe.
  • manual indicates how the card was entered. 1 means keyed in, 0 means swiped.
  • requestDatetime is a timestamp when the request was sent

The last set of fields deal with the response. Fields that start with "x" are data returned by the processor.

  • responseDatetime is a timestamp when the response was received
  • seconds indicates how long the request took
  • commErr is cURL error code, if any
  • httpCode is the HTTP response code
  • validResponse is a normalized indicator of what happened. Not all processors use the same codes for approve, decline, etc 0 => no response at all 1 => approved 2 => declined 3 => processor reported error 4 => response was malformed
  • xResultCode indicates what happened - typically approved, declined, or an error
  • xApprovalNumber is the actual authorization number
  • xResponseCode is further data about the result such as a specific error code or decline code
  • xResultMessage is a descriptive text response of the the result or response code
  • xTransactionID is an additional processor reference like a sequence number
  • xBalance is remaining balance on the card
  • xToken is a reference value for making future modifications to the transaction
  • xProcessorRef is another reference number field
  • xAcquirerRef is another reference number field

Not all processors will provide data for all fields. At minimum, there should be a value for validResponse to show whether the transaction was approved. On approved transactions, there needs to be an xApprovalNumber and some kind of sequence or reference number in xTransactionID. There should be some value indicating approval in xResultMessage. All the other response fields are optional.

couponApplied

Name Type Info
emp_no INT PK
trans_no INT PK
quantity FLOAT
trans_id INT PK

Use: Track which items have had coupons applied to them. This is primarily to deal with "free" coupons that can apply to multiple, differently-priced items ina single transaction.

dtransactions

Name Type Info
datetime DATETIME Indexed
store_id SMALLINT
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT
pos_row_id BIGINT UNSIGNED PK Increment

Use: This is IT CORE's transaction log. A rather important table.

A transaction can be uniquely identified by: date + register_no + emp_no + trans_no A record in a transaction can be uniquely identified by: date + register_no + emp_no + trans_no + trans_id Note that "date" is not necessary datetime. All records in a transaction don't always have the exact same time to the second.

upc is generally a product. The column is always a varchar here, regardless of dbms, because sometimes non-numeric data goes here such as 'DISCOUNT', 'TAX', or 'amountDPdept' (transaction discounts, applicable tax, and open rings, respectively).

description is what's displayed on screen and on receipts.

trans_type indicates the record's type Values include (but may not be limited to at all co-ops): I => normally a product identified by upc, but can also be a discount line (upc='DISCOUNT') or a YOU SAVED line (upc='0'). A => tax total line C => a commentary line. These generally exist only for generating the on-screen display at the register (subtotal lines, etc). D => open ring to a department. In this case, upc will be the amount, 'DP', and the department number T => tender record. UPC is generally, but not always, '0' (e.g., manufacturer coupons have their own UPCs) 0 => another commentary line

trans_subtype refines the record's type. Values include (but may not be limited to at all co-ops): CM => record is a cashier-written comment. Used to make notes on a transaction (tender code) => goes with trans_type 'T', exact values depends what's in core_op.tenders blank => no refinement available for this trans_type

trans_status is a fairly all-purpose indicator. Values include (but may not be limited to at all co-ops): X => the transaction is canceled D => this can be omitted with back-end reporting R => this line is a refund V => this line is a void M => this line is a member special discount C => this line is a coupon Z => this item was damaged, not sold (WFC) blank => no particular meaning

department is set for a UPC item, an open-department ring, a member special discount, or a manufacturer coupon. All other lines have zero here.

quantity and ItemQtty are the number of items sold on that line. These can be fractional for by-weight items. These values are normally the same, except for: 1. member special lines, where ItemQtty is always zero. This is useful for tracking actual movement by UPC 2. refund lines, where quantity is negative and ItemQtty is not. No idea what the reasoning was here.

scale indicates an item sold by-weight. Meaningless on non-item records.

cost indicates an item's cost. Meaningless on non-item records.

unitPrice is the price a customer will be charged per item. total is quantity times unitPrice. This is what the customer actually pays. If an item is on sale, regPrice indicates the regular price per item. On non-item records, total is usually the only relevant column. Sales are positive, voids/refunds/tenders are negative.

tax indicates whether to tax an item and at what rate

foodstamp indicates whether an item can be paid for using foodstamps

discount is any per-item discount that was applied. In the simplest case, this is the regularPrice minus the unitPrice (times quantity). Discounts are listed as positive values.

memDiscount is the same as discount, but these discounts are only applied if the customer is a member (custdata.Type = 'PC')

discountable indicates whether an item is eligible for transaction-wide percent discounts.

discounttype indicates what type of sale an item is on. 0 => not on sale 1 => on sale for everyone 2 => on sale for members Values over 2 may be used, but aren't used consistently across co-ops at this time.

voided indicates whether a line has been voided 0 => no 1 => yes voided is also used as a status flag in some cases You'd have to dig into IT CORE code a bit to get a handle on that.

percentDiscount is a percentage discount applied to the whole transaction. This is an integer, so 5 = 5% = 0.05

volDiscType is a volume discount type. Usage varies a lot here, but in general: volDiscType => core_op.products.pricemethod volume => core_op.products.quantity VolSpecial => core_op.products.groupprice If an item is on sale, those become specialpricemethod, specialquantity, and specialgroupprice (respectively). Exact calculations depend a lot of volDiscType. 0 means there is no volume discount, and either 1 or 2 (depending on IT CORE version) will probably do a simple 3 for $2 style sale (quantity=3, groupprice=2.00). Higher type values vary.

mixMatch relates to volume pricing. In general, items with the same mixMatch setting are interchangeable. This is so you can do sales across a set of products (e.g., Clif Bars) and the customer can buy various flavors but still get the discount.

matched notes item quantites that have already been used for a volume pricing group. This is so the same item doesn't get counted more than once.

memType and staff match values in core_op.custdata. Including them here helps determine membership status at the time of purchase as opposed to current status.

numflag and charflag are generic status indicators. As far as I know, there's no uniform usage across implementations. Also used by the shrink/DDD module to indicate the reason the product has been marked as unsellable, for which trans_status = 'Z'.

card_no is the customer number from core_op.custdata.

efsnetRequest

Name Type Info
date INT
cashierNo INT
laneNo INT
transNo INT
transID INT
datetime DATETIME
refNum VARCHAR(50)
live TINYINT
mode VARCHAR(32)
amount MONEY
PAN VARCHAR(19)
issuer VARCHAR(16)
name VARCHAR(50)
manual TINYINT
sentPAN TINYINT
sentExp TINYINT
sentTr1 TINYINT
sentTr2 TINYINT
efsnetRequestID INT PK Increment

Use: This table logs information that is sent to a credit-card payment gateway. All current paycard modules use this table structure. Future ones don't necessarily have to, but doing so may enable more code re-use.

Some column usage may vary depending on a given gateway's requirements and/or formatting, but in general:

cashierNo, laneNo, transNo, and transID are equivalent to emp_no, register_no, trans_no, and trans_id in dtransactions (respectively).

mode indicates the type of transaction, such as refund or sale. Exact value can vary from gateway to gateway.

PAN is the cardnumber - for the love of $deity only save the last 4 digits here - issuer is Visa, MC, etc, and name is the cardholder's name (if available).

The sent* columns indicate which information was sent. Most gateways will accept PAN + expiration date, or either track. Sending both tracks is usually fine; I've never seen a system where you send all 4 pieces of card info.

efsnetRequestID is an incrementing ID columns. This is unique at a lane level but not an overall system level since different lanes will increment through the same ID values. The combination of laneNo and efsnetRequestID should be unique though.

efsnetRequestMod

Name Type Info
date INT
cashierNo INT
laneNo INT
transNo INT
transID INT
datetime DATETIME
origRefNum VARCHAR(50)
origAmount MONEY
origTransactionID VARCHAR(12)
mode VARCHAR(32)
altRoute TINYINT
seconds FLOAT
commErr INT
httpCode INT
validResponse SMALLINT
xResponseCode VARCHAR(4)
xResultCode VARCHAR(4)
xResultMessage VARCHAR(100)

Use: This table logs information that is returned from a credit-card payment gateway when modifying an earlier transaction. Generally, this means some kind of void. All current paycard modules use this table structure. Future ones don't necessarily have to, but doing so may enable more code re-use.

Some column usage may vary depending on a given gateway's requirements and/or formatting, but in general:

cashierNo, laneNo, transNo, and transID are equivalent to emp_no, register_no, trans_no, and trans_id in dtransactions (respectively).

mode is the operation type. Exact syntax varies by gateway. Some gateways provide multiple addresses. Using a different one can be noted in altRoute.

seconds, commErr, and httpCode are curl-related entries noting how long the network request took and errors that occurred, if any.

the x* columns vary a lot. What to store here depends what the gateway returns.

efsnetResponse

Name Type Info
date INT
cashierNo INT
laneNo INT
transNo INT
transID INT
datetime DATETIME
refNum VARCHAR(50)
seconds FLOAT
commErr INT
httpCode INT
validResponse SMALLINT
xResponseCode VARCHAR(4)
xResultCode VARCHAR(8)
xResultMessage VARCHAR(100)
xTransactionID VARCHAR(12)
xApprovalNumber VARCHAR(20)
efsnetRequestID INT Indexed

Use: This table logs information that is returned from a credit-card payment gateway after sending a [non-void] request. All current paycard modules use this table structure. Future ones don't necessarily have to, but doing so may enable more code re-use.

Some column usage may vary depending on a given gateway's requirements and/or formatting, but in general:

cashierNo, laneNo, transNo, and transID are equivalent to emp_no, register_no, trans_no, and trans_id in dtransactions (respectively).

seconds, commErr, and httpCode are curl-related entries noting how long the network request took and errors that occurred, if any.

the x* columns vary a lot. What to store here depends what the gateway returns.

efsnetTokens

Name Type Info
expireDay DATETIME
refNum VARCHAR(50) PK
token VARCHAR(100) PK
processData VARCHAR(255)
acqRefData VARCHAR(255)

Use: This table logs tokens used for modifying later transactions.

expireDay is when(ish) the token is no longer valid

refNum maps to efsnetRequest & efsnetResponse records

token is the actual token

processData and acqRefData are additional values needed in addition to the token for certain kinds of modifying transactions

localtemptrans

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT Indexed Increment

Use: Stores current transaction data. See dtransactions for detailed information on the columns. The only notable difference is this table has an automatically incremented trans_id column.

localtrans

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT

Use: Lane-side record of historical transactions. See dtransactions for details on what the columns are used for.

localtransarchive

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT

Use: Lane side storage of transactions older than what's in localtrans. This could probably go away entirely. By the data is removed from localtrans it should be safely archived on the server side anyway.

localtranstoday

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT Indexed
emp_no SMALLINT Indexed
trans_no INT Indexed
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT

Use: Contains today's transactions. Truncating this table daily will yield better performance on some actions that reference the current day's info - for example, reprinting receipts.

memdiscountadd

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed

Use: This view calculates member discounts on items in the transaction that have not yet been applied. These records are then inserted into localtemptrans to apply the relevant discount(s).

memdiscountremove

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed

Use: This view is the opposite of memdiscountadd. It calculates the reverse of all currently applied member discounts on items. These records are inserted into localtemptrans to remove member discounts if needed.

screendisplay

View

Name Type Info
description VARCHAR(255)
comment VARCHAR(255)
total MONEY
status VARCHAR(255)
lineColor VARCHAR(255)
discounttype INT
trans_type VARCHAR(2)
trans_status VARCHAR(2)
voided INT
trans_id INT

Use: Formats current transaction info for onscreen display.

The first four columns are display text and on rendered left to right. Description goes on the far left, comment goes in the middle, total is the lineitem's price, and status is a character or two on the far right.

trans_id is used to select appropriate lines if the entire transaction does not fit on the screen

The remaining columns are used for display formatting mostly in terms of background & text color.

staffdiscountadd

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed

Use: This view calculates staff discounts on items in the transaction that have not yet been applied. These records are then inserted into localtemptrans to apply the relevant discount(s).

staffdiscountremove

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed

Use: This view is the opposite of staffdiscountadd. It calculates the reverse of all currently applied staff discounts on items. These records are inserted into localtemptrans to remove staff discounts if needed.

suspended

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT

Use: Local table for suspending transactions if server connection is temporarily unavailable

suspendedtoday

Name Type Info
datetime DATETIME Indexed
register_no SMALLINT
emp_no SMALLINT
trans_no INT
upc VARCHAR(13) Indexed
description VARCHAR(30)
trans_type VARCHAR(1) Indexed
trans_subtype VARCHAR(2)
trans_status VARCHAR(1)
department SMALLINT Indexed
quantity DOUBLE
scale TINYINT Default=0
cost MONEY
unitPrice MONEY
total MONEY
regPrice MONEY
tax SMALLINT
foodstamp TINYINT
discount MONEY
memDiscount MONEY
discountable TINYINT
discounttype TINYINT
voided TINYINT
percentDiscount TINYINT
ItemQtty DOUBLE
volDiscType TINYINT
volume TINYINT
VolSpecial MONEY
mixMatch VARCHAR(13)
matched SMALLINT
memType TINYINT
staff TINYINT
numflag INT Default=0
charflag VARCHAR(2) Default=''
card_no INT Indexed
trans_id TINYINT

Use: This view omits all entries in suspended that aren't from the current day. Resuming a transaction from a previous day wouldn't necessarily cause problems, but "stale" suspended transactions that never get resumed could eventually make the list of available transactions unwieldy.

taxView

View

Name Type Info
id INT
description VARCHAR(255)
taxTotal MONEY
fsTaxable MONEY
fsTaxTotal MONEY
foodstampTender MONEY
taxrate FLOAT

Use: This view is a revised, BETA way of dealing with taxes. Rather than generate the tax total (including foodstamp exemptions) with a series of cascading views, this single view provides a record for each available tax rate. Exemption calculations then occur on the code side in a far-easier-to-read imperative style.

id is the tax rate's identifier and description is its description.

taxTotal is the total tax due for this particular rate. SUM(taxTotal) over the view would be the total tax due with all rates.

fsTaxable is the retail cost of goods taxed at this rate. fsTaxTotal is tax due on those items at this rate.

foodstampTender is the total amount tendered in foodstamps for the transaction. This will be the same for all records in this view and is provided as a convenience to avoid a second look-up query.

rate is this tax rate as a decimal - i.e., 1% is 0.01.


In calculating exemptions, foodstampTender and fsTaxable are important. If foodstampTender is >= fsTaxable then all foodstampable, taxable items were purchased with foodstamps and you can subtract fsTaxTotal from taxTotal. On the other hand if foodstampTender is < fsTaxable then you should reduce taxTotal by a proportional pro-rated amount.

When dealing with multiple tax rates, it is important to reduce foodstampTender each time it is used. The value in the view is the same for all records and POS has to decide where to apply that tender more than once.

taxrates

Name Type Info
id INT PK
rate FLOAT
description VARCHAR(50)

Use: Local tax rates

Clone this wiki locally