>>** If no Station is selected and the Show Paid only checkbox is off, then >>** create a default WHERE clause >>IF EMPTY(.cboStations.DisplayValue) AND .chkUnpaid.Value = 0 >> cWhere = ".T." >>ENDIF >> >>** If a Station is selected, add it to the WHERE clause >>IF NOT EMPTY(.cboStations.DisplayValue) >> cWhere = cWhere + " StatName = '" + PADR(.cboStations.DisplayValue, 10, " ") + "' AND " >>ENDIF >> >>** If the Show Paid only checkbox is on, then add it to the WHERE clause >>IF .chkUnpaid.Value = 1 >> cWhere = cWhere + " NOT Scanned AND " >>ENDIF >> >>** Remove trailing 'AND' >>cWhere = ALLTRIM(cWhere) >>cWhere = SUBSTR(cWhere, 1, LEN(cWhere) - 3) >> >>** Of no sort column was passed in, use the default columns. >>IF EMPTY(cSortOrder) >> cSortOrder = "StatName, InvoiceId" >>ENDIF >> >>** Run the query >>SELECT StatName, InvoiceId, DoneDate, UserId, Scanned ; >> FROM Commits ; >> WHERE &cWhere ; >> GROUP BY StatName, InvoiceId; >> ORDER BY &cSortOrder ; >> INTO CURSOR ReconData >> >> >>.BindControls = TRUE >>.Refresh() >>>>