wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/Ticket/CTktFlds

Version 12 (modified by Don Wilson, 13 years ago) ( diff )

--

CTktFlds

CTktFlds is a C++ class that is a wrapper around struct tktfld_struct to simplify ticket programming.

Constructor

CTktFlds(void);

Parameters

Constructor does not accept any parameters

Examples

CTktFlds flds;

This contructs the object.

Member Functions

Clear

Clears all references or a specified item.

void Clear(void);

void Clear(int nFld);

Parameters

  • nFld - Ticket item to clear

Version with no parameters clears all fields

Return Value

Function does not return a result.

Remarks

Examples

CTktFlds flds;
flds.Set(TKT_FLD_TIME, strTime);
flds.Set(TKT_FLD_GROSS, strGross);
PrintTkt(TKT_STD, flds);
CTktFlds flds;
flds.Set(TKT_FLD_TIME, strTime);
flds.Set(TKT_FLD_GROSS, strGross);
flds.PrintTkt(TKT_STD);

// Clear the entire flds object to start over
flds.Clear();
flds.Set(TKT_FLD_TIME, strTime);
flds.Set(TKT_FLD_NET, strNet);
flds.PrintTkt(TKT_ALT);
CTktFlds flds;
flds.Set(TKT_FLD_TIME, strTime);
flds.Set(TKT_FLD_GROSS, strGross);
flds.PrintTkt(TKT_STD);

// Clear the gross weight reference so it will not print on the alternate ticket, time will still print
flds.Clear(TKT_FLD_GROSS);
flds.Set(TKT_FLD_NET, strNet);
flds.PrintTkt(TKT_ALT);

Set

Sets a reference

void Set(int nFld, string& str);
void Set(int nFld, char* psz);
void Set(int nFld, const char* psz);

Parameters

  • nFld - Field to set
  • str - String variable
  • psz - pointer to character array

Retrun Value

Function does not return any result.

Remarks

The TKT_FLD_xxx definitions relate to the ticket field position information provided in the "Configuration" program. Refer to the chart below.

IDTypical useCode Character
TKT_FLD_GROSSGross weight1
TKT_FLD_TARETare weight2
TKT_FLD_NETNet weight3
TKT_FLD_TIMETime4
TKT_FLD_DATEDate5
TKT_FLD_IDID6
TKT_FLD_CNConsecutive number7
TKT_FLD_UNITSWeight units8
TKT_FLD_DSP_WTDisplay weight9
TKT_FLD_PC_CNTPiece countA
TKT_FLD_TOT_CNTTotal countB
TKT_FLD_ID1ID1C
TKT_FLD_ID2ID2D
TKT_FLD_ID3ID3E
TKT_FLD_G_ACCUMGross weight accumulatorF
TKT_FLD_N_ACCUMNet weight accumulatorG
TKT_FLD_PRMPT1Prompt 1H
TKT_FLD_PRMPT2Prompt 2I
TKT_FLD_PRMPT3Prompt 3J
TKT_FLD_REF1Reference 1K
TKT_FLD_REF2Reference 2L
TKT_FLD_REF3Reference 3M
TKT_FLD_CNV_NETConverted net weightZ

The following are not standard nControl fields:

IDTypical useCode Character
TKT_FLD_CNV_UNITSConverted weight units0 (Zero)
TKT_FLD_CNV_DSP_WTConverted display weightU
TKT_FLD_CNV_G_ACCUMConverted gross accumulatorV
TKT_FLD_CNV_N_ACCUMConverted net accumulatorW
TKT_FLD_CNV_GROSSConverted gross weightX
TKT_FLD_CNV_TAREConverted tare weightY
TKT_FLD_IN_TIMETime In - First pass timeN
TKT_FLD_IN_DATEDate In - First pass dateO
TKT_FLD_ID4ID4P
TKT_FLD_PRMPT4Prompt 4Q
TKT_FLD_CUSTOMCustom fieldR

Example

string strTime = GetTimeStr(1); // Include seconds
string strGross = FormatGrossWt(1);

CTktFlds flds;
flds.Set(TKT_FLD_TIME, strTime);
flds.Set(TKT_FLD_GROSS, strGross);
flds.PrintTkt(TKT_STD);
Note: See TracWiki for help on using the wiki.