0 || strlen($f_cmp_comp) > 2 || strlen($f_cmp_comp2) > 2 || strlen($f_cmp_match) > 2 || strlen($f_cs_eid) > 2 || strlen($f_csc_name) > 0 || strlen($f_street) > 2 || strlen($f_hsno) > 0 || strlen($f_zipcode) > 2 || strlen($f_city) > 2 || strlen($f_remark) > 2 || strlen($f_person) > 2) : // ******************************************* // * Selection of the customers for the list * // ******************************************* if ($f_searchmode == "1") : $prefix = "%"; else : $prefix = ""; endif; $whereClause = ""; if ($f_jb_id != "") : $whereClause .= "jb.jb_id = '" . $f_jb_id . "'"; endif; if ($whereClause != "" && $f_cmp_comp != "") : $whereClause .= " AND "; endif; if ($f_cmp_comp != "") : $whereClause .= "tr.tr_comp LIKE '" . $prefix . $f_cmp_comp . "%'"; endif; if ($whereClause != "" && $f_cmp_comp2 != "") : $whereClause .= " AND "; endif; if ($f_cmp_comp2 != "") : $whereClause .= "tr.tr_comp2 LIKE '" . $prefix . $f_cmp_comp2 . "%'"; endif; if ($whereClause != "" && $f_cmp_match != "") : $whereClause .= " AND "; endif; if ($f_cmp_match != "") : $whereClause .= "cmp.cmp_match LIKE '" . $prefix . $f_cmp_match . "%'"; endif; if ($whereClause != "" && $f_cs_eid != "") : $whereClause .= " AND "; endif; if ($f_cs_eid != "") : $whereClause .= "cs.cs_eid LIKE '" . $prefix . $f_cs_eid . "%'"; endif; if ($whereClause != "" && $f_csc_name != "") : $whereClause .= " AND "; endif; if ($f_csc_name != "") : $whereClause .= "csc.csc_name LIKE '" . $prefix . $f_csc_name . "%'"; endif; // if ($whereClause != "" && $f_usr_name != "") : $whereClause .= " AND "; endif; // if ($f_usr_name != "") : $whereClause .= "usr.usr_name LIKE '" . $prefix . $f_usr_name . "%'"; endif; // if ($whereClause != "" && $f_usr_phone != "") : $whereClause .= " AND "; endif; // if ($f_usr_phone != "") : $whereClause .= "usr.usr_phone LIKE '" . $prefix . $f_usr_phone . "%'"; endif; // if ($whereClause != "" && $f_usr_email != "") : $whereClause .= " AND "; endif; // if ($f_usr_email != "") : $whereClause .= "usr.usr_email LIKE '" . $prefix . $f_usr_email . "%'"; endif; if ($whereClause != "" && $f_cmp_iln != "") : $whereClause .= " AND "; endif; if ($f_cmp_iln != "") : $whereClause .= "cmp.cmp_iln LIKE '" . $prefix . $f_cmp_iln . "%'"; endif; if ($whereClause != "" && $f_cmp_tax_idno != "") : $whereClause .= " AND "; endif; if ($f_cmp_tax_idno != "") : $whereClause .= "cmp.cmp_tax_idno LIKE '" . $prefix . $f_cmp_tax_idno . "%'"; endif; if ($whereClause != "" && $f_cmp_bank != "") : $whereClause .= " AND "; endif; if ($f_cmp_bank != "") : $whereClause .= "cmp.cmp_bank LIKE '" . $prefix . $f_cmp_bank . "%'"; endif; if ($whereClause != "" && $f_cmp_bankno != "") : $whereClause .= " AND "; endif; if ($f_cmp_bankno != "") : $whereClause .= "cmp.cmp_bankno LIKE '" . $prefix . $f_cmp_bankno . "%'"; endif; if ($whereClause != "" && $f_cmp_bankacc != "") : $whereClause .= " AND "; endif; if ($f_cmp_bankacc != "") : $whereClause .= "cmp.cmp_bankacc LIKE '" . $prefix . $f_cmp_bankacc . "%'"; endif; if ($whereClause != "" && $f_street != "") : $whereClause .= " AND "; endif; if ($f_street != "") : $whereClause .= "ad.ad_street LIKE '" . $f_street . "%'"; endif; if ($whereClause != "" && $f_hsno != "") : $whereClause .= " AND "; endif; if ($f_hsno != "") : $whereClause .= "tr.tr_hsno LIKE '" . $f_hsno . "%'"; endif; if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif; if ($f_zipcode != "") : $whereClause .= "ad.ad_zipcode LIKE '" . $f_zipcode . "%'"; endif; if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif; if ($f_city != "") : $whereClause .= "ad.ad_city LIKE '" . $f_city . "%'"; endif; if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif; if ($f_country != "") : $whereClause .= "ad.ad_country LIKE '" . $f_country . "%'"; endif; if ($whereClause != "" && $f_remark != "") : $whereClause .= " AND "; endif; if ($f_remark != "") : $whereClause .= "tr.tr_remark LIKE '" . $f_remark . "%'"; endif; if ($whereClause != "" && $f_person != "") : $whereClause .= " AND "; endif; if ($f_person != "") : $whereClause .= "tr.tr_person LIKE '" . $f_person . "%'"; endif; // Past days to search in... // if ($f_days > 0) : // Set the current timestamp to store the data $fromDateRange = date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d") - $f_days ,date("Y"))); if ($whereClause != "") : $whereClause .= " AND "; endif; $whereClause .= "jb.jb_ordertime >= '$fromDateRange' "; // endif; // Check authentication if ($whereClause != "" && $f_cmp_authenticated == "1") : $whereClause .= " AND "; endif; if ($f_cmp_authenticated == "1") : $whereClause .= "cmp.cmp_authenticated LIKE '" . $f_cmp_authenticated . "%'"; endif; if ($whereClause != "") : $whereClause .= " AND "; endif; if ($orderClause == "") : $orderClause = "jb.jb_ordertime"; endif; $sqlquery = "SELECT jb.jb_id, jb.jb_ordertime," . " tr.tr_comp, tr.tr_comp2, tr.tr_hsno, tr.tr_remark, tr.tr_person," . " csc.csc_id, csc.csc_name, cs.cs_id, cs.cs_eid," . " cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_authenticated, cmp.cmp_match," . " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country" . " FROM job AS jb, tour AS tr, address AS ad," . " customer AS cs, costcenter AS csc, company AS cmp" . " WHERE " . $whereClause . " (ISNULL(jb.jb_export_time) OR (jb.jb_export_time = '0000-00-00 00:00:00')) AND" . " jb.jb_id = tr.jb_id AND" . " jb.hq_id = '$hq_id' AND" . " tr.tr_sort = '1' AND" . " tr.ad_id = ad.ad_id AND" . " jb.csc_id_payer = csc.csc_id AND" . " csc.cs_id = cs.cs_id AND" . " cs.hq_id = '$hq_id' AND" . " cmp.cmp_id = cs.cmp_id" . " ORDER BY " . $orderClause; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: '$sqlquery'" . $result->getMessage()); // Table with header while ($row = $result->fetch_assoc()): $numOfRows++; $tableOfRows .= "