function GetLastMonthFilter($FldExpression) { $today = getdate(); $lastmonth = mktime(0, 0, 0, $today['mon'] - 1, 1, $today['year']); $sVal = date("Y|m", $lastmonth); $sWrk = $FldExpression . " BETWEEN " . ewr_QuotedValue(ewr_DateVal("month", $sVal, 1), EWR_DATATYPE_DATE) . " AND " . ewr_QuotedValue(ewr_DateVal("month", $sVal, 2), EWR_DATATYPE_DATE); return $sWrk; }
function ewr_DateFilterString($FldExpr, $FldOpr, $FldVal, $FldType) { if ($FldOpr == "Year" && $FldVal != "") { // Year filter return str_replace("%s", $FldExpr, "YEAR(%s)") . " = " . $FldVal; } else { $wrkVal1 = ewr_DateVal($FldOpr, $FldVal, 1); $wrkVal2 = ewr_DateVal($FldOpr, $FldVal, 2); if ($wrkVal1 != "" && $wrkVal2 != "") { return $FldExpr . " BETWEEN " . ewr_QuotedValue($wrkVal1, $FldType) . " AND " . ewr_QuotedValue($wrkVal2, $FldType); } else { return ""; } } }