public function lNumClientsViaLetter($strLetter, $bIncludeInactive, $strWhereExtra = '') { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $strLetter = strtoupper($strLetter); $sqlWhere = $this->strWhereByLetter($strLetter, $bIncludeInactive); $strInner = ''; if (!$bIncludeInactive) { sqlQualClientViaStatus($strWhereEx, $strInner, true, true, false, null); $sqlWhere .= $strWhereEx; } $sqlStr = "SELECT COUNT(*) AS lNumClients\n FROM client_records\n {$strInner}\n {$this->strInnerExtra}\n WHERE NOT cr_bRetired\n {$sqlWhere} {$strWhereExtra} ;"; $query = $this->db->query($sqlStr); $row = $query->row(); return (int) $row->lNumClients; }
public function lNumClientsViaLocation($lLocID) { sqlQualClientViaStatus($strWhere, $strInner, true, true, false, null); $sqlStr = "SELECT COUNT(*) AS lNumClients\n FROM client_records\n {$strInner}\n\n WHERE cr_lLocationID={$lLocID}\n AND NOT cr_bRetired\n {$strWhere};"; $query = $this->db->query($sqlStr); $row = $query->row(); return (int) $row->lNumClients; }
public function lNumClientsViaClientStatID($lStatID, $bTestActive, $bActive) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- sqlQualClientViaStatus($sqlWhereSubquery, $strInner, $bTestActive, $bActive, false, null); $sqlStr = "SELECT COUNT(cr_lKeyID) AS lNumRecs\n FROM client_records\n {$strInner}\n WHERE 1\n AND NOT cr_bRetired\n {$sqlWhereSubquery}\n AND csh_lStatusID={$lStatID};"; $query = $this->db->query($sqlStr); $row = $query->row(); return $row->lNumRecs; }
function strCViaStatCatIDExport(&$sRpt, $lStatCatID) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $strLocWhere = " AND (cst_lClientStatusCatID = {$lStatCatID}) "; sqlQualClientViaStatus($sqlWhereSubquery, $strInner, true, true, false, false); $sqlStr = 'SELECT ' . strExportFields_Client() . "\n FROM client_records\n INNER JOIN client_location ON cr_lLocationID = cl_lKeyID\n INNER JOIN client_status_cats ON cr_lStatusCatID = csc_lKeyID\n INNER JOIN lists_client_vocab ON cr_lVocID = cv_lKeyID\n \n {$strInner}\n \n LEFT JOIN lists_generic ON cr_lAttributedTo = lgen_lKeyID\n WHERE 1\n AND NOT cr_bRetired\n\n {$sqlWhereSubquery}\n {$strLocWhere} ;"; /* $zzzlPos = strrpos(__FILE__, '\\'); $zzzlLen=strlen(__FILE__); $zzzstrFile=substr(__FILE__, strrpos(__FILE__, '\\',-(($zzzlLen-$zzzlPos)+1))); echoT('<font class="debug">'.$zzzstrFile.' Line: <b>'.__LINE__.":</b><br><b>\$sqlStr=</b><br>".nl2br(htmlspecialchars($sqlStr))."<br><br></font>\n"); //die; */ $query = $this->db->query($sqlStr); return $this->dbutil->csv_from_result($query); }