14 $monLibrary= dirname(__FILE__) .
"/../library";
15 require_once(
"$monLibrary/cu_top.i");
16 require_once(
"$monLibrary/ck_hticket.i");
17 require_once(
"$monLibrary/cu_pass.i");
19 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
22 header(
"Location: /hcuadm/hcu_noperm.prg");
26 $dms_ok=array(
'act'=>
'string',
'csv'=>
'string');
31 $self = $_SERVER[
'PHP_SELF'];
37 cu_header(
"CU Products Report");
39 $act = intval($_REQUEST[
'act']);
40 $showProduct = isset( $_REQUEST[
"show_product"] ) && intval($_REQUEST[
'show_product']) == 1 ? 1 : 0;
41 $singleLine = isset( $_REQUEST[
"single_line"] ) && intval($_REQUEST[
'single_line']) == 1 ? 1 : 0;
42 $showDecider = isset( $_REQUEST[
"show_decider"] ) && intval($_REQUEST[
'show_decider']) == 1 ? 1 : 0;
43 $skipBlankEmails = isset( $_REQUEST[
"skip_blank_emails"] ) && intval($_REQUEST[
'skip_blank_emails']) == 1 ? 1 : 0;
44 $showExpDate = isset( $_REQUEST[
"show_exp_date"] ) && intval($_REQUEST[
'show_exp_date']) == 1 ? 1 : 0;
45 $pDescending = isset( $_REQUEST[
"d"] ) && intval($_REQUEST[
'd']) == 1 ? 1 : 0;
48 if ( $singleLine ) $showDecider = 0;
51 if ( !$showDecider ) $skipBlankEmails = 0;
54 $sql =
"SELECT * FROM cuprodlist ORDER BY home_cu_desc";
56 $product_rs = db_query($sql, $link);
57 $productList = array();
59 while ($product_row = db_fetch_array($product_rs, $row_cnt++)) {
60 $code = trim( $product_row[
"home_cu_code"] );
61 $descr = trim( $product_row[
"home_cu_desc"] );
62 $include = isset( $_REQUEST[
"value$code"] ) ? intval( $_REQUEST[
"value$code"] ) : 0;
63 $productList[] = array(
"code" => $code,
"desc" => $descr,
"include" => $include );
66 usort($productList,
"productSort");
69 $systemOptions = array();
70 $systemOptions[] = array(
"code" =>
"WEBONLY",
"desc" =>
"Web Only",
"mask" => $SYS_TYPE_WEBONLY );
71 $systemOptions[] = array(
"code" =>
"BATCH",
"desc" =>
"Batch",
"mask" => $SYS_TYPE_BATCH );
72 $systemOptions[] = array(
"code" =>
"LIVE",
"desc" =>
"Live",
"mask" => $SYS_TYPE_LIVE );
73 $systemOptions[] = array(
"code" =>
"IVR",
"desc" =>
"IVR",
"mask" => $SYS_TYPE_IVR );
74 $systemOptions[] = array(
"code" =>
"VOIP",
"desc" =>
"VOIP",
"mask" => $SYS_TYPE_VOIP );
75 $systemOptions[] = array(
"code" =>
"ASP",
"desc" =>
"ASP",
"mask" => $SYS_TYPE_ASP );
76 $systemOptions[] = array(
"code" =>
"UPGRADE",
"desc" =>
"Upgrade/Conversion",
"mask" => $SYS_TYPE_UPGRADE );
77 $optionList = array();
78 for ( $o = 0; $o < count( $systemOptions ); $o++ ) {
79 $code = $systemOptions[$o][
"code"];
80 $desc = $systemOptions[$o][
"desc"];
81 $mask = $systemOptions[$o][
"mask"];
82 $includeOption = isset( $_REQUEST[
"option$code"] ) ? intval( $_REQUEST[
"option$code"] ) : 0;
83 $optionList[] = array(
"code" => $code,
"desc" => $desc,
"include" => $includeOption,
"mask" => $mask );
87 $prodLogic = isset( $_REQUEST[
"prod_logic"] ) ? intval( $_REQUEST[
"prod_logic"] ) : 0;
94 $ob_desc = array(0, 0, 0, 0, 0, 0, 0, 0);
100 $requiredNotOptions = 0;
101 for ( $i = 0; $i < count( $optionList ); $i++ ) {
102 if ( $optionList[$i][
"include"] == 1 )
103 $requiredOptions |= $optionList[$i][
"mask"];
104 else if ( $optionList[$i][
"include"] == 2 )
105 $requiredNotOptions |= $optionList[$i][
"mask"];
111 $sql =
"SELECT cuinfo.user_name, cuinfo.name, cuinfo.vendor, cuinfo.contract_expires, cuinfo.renewal_term, cuinfo.system_options, home_page_url, www_server, dec_31_assets, dec_31_mem";
114 $rows_sql =
"SELECT count(cuinfo.user_name) as row_count 120 if ( $showProduct && !$singleLine ) {
121 $sql .=
", cuprodlist.home_cu_desc";
123 }
else if ( $showProduct && $singleLine ) {
125 $vis_col += count($productList);
128 if ( $showDecider ) {
132 if ( $showExpDate ) {
136 $sql .=
" FROM cuinfo ";
138 if ( $showProduct && !$singleLine ) {
139 $tempSql =
"JOIN cuproducts on cuproducts.user_name = cuinfo.user_name 140 JOIN cuprodlist on cuprodlist.home_cu_code = cuproducts.home_cu_code ";
142 $rows_sql .= $tempSql;
145 $tempSql =
" WHERE (cuinfo.system_options & $SYS_TYPE_CLOSED) = 0 ";
147 $rows_sql .= $tempSql;
150 if ( $requiredOptions > 0 ) {
151 $tempSql =
" AND (cuinfo.system_options & $requiredOptions) = $requiredOptions ";
153 $rows_sql .= $tempSql;
157 if ( $requiredNotOptions > 0 ) {
158 $tempSql =
" AND (cuinfo.system_options & $requiredNotOptions) = 0 ";
160 $rows_sql .= $tempSql;
164 $ob_fldid = (intval($_GET[
'ob']) < 1) ? 1 : intval($_GET[
'ob']);
165 $order_sql =
" ORDER BY " . get_field(intval($ob_fldid));
167 if ($pDescending == 1)
168 $order_sql .=
" desc ";
170 $ob_desc[$_GET[
"ob"]] = 1;
174 $cu_rs = db_query($sql, $link);
176 $rows_rs = db_query($rows_sql, $link);
177 list($num_rows) = db_fetch_array($rows_rs, 0);
178 db_free_result($rows_rs);
181 if (($csv) && ($num_rows > 1)) {
185 # First record has the field names 187 $fieldNames =
"\"CU Code\",\"CU Name\",\"Asset\",\"Mem\",\"Vendor\"";
188 if ( $showProduct && !$singleLine )
189 $fieldNames .=
",\"Product\"";
191 $fieldNames .=
",\"First\",\"Last\",\"E-mail\",\"Phone\"";
193 $fieldNames .=
",\"Exp Date\",\"Renewal\"";
194 if ( $showProduct && $singleLine ) {
197 for ( $p = 0; $p < count( $productList ); $p++ ) {
198 $fieldNames .=
",\"{$productList[$p]["code
"]}\"";
202 $outputString =
"$fieldNames\r\n";
210 while ($cu_row = db_fetch_array($cu_rs, $row_cnt++)) {
211 $userName = trim($cu_row[
"user_name"]);
214 $cuProducts = GetCUProductList( $userName );
216 $passedFilter = TestProductFilter2($cuProducts, $productList, $prodLogic);
218 if ( !$passedFilter ) {
222 $row_class = ($row_class ==
"odd" ?
"even" :
"odd");
226 $cuName = $cu_row[
'name'];
227 $cuAssets = $cu_row[
'dec_31_assets'];
228 $cuMembers = $cu_row[
'dec_31_mem'];
229 $cuVendor = $cu_row[
'vendor'];
230 $cuExpires = $cu_row[
'contract_expires'];
231 $cuRenewal = $cu_row[
'renewal_term'];
232 $cuHomepage = trim($cu_row[
"home_page_url"]);
234 $vend_show = (trim($cu_row[
"vendor"]) ==
'' ?
"" :
"&vc=". trim($cu_row[
"vendor"]));
235 $www_show = (trim($cu_row[
"www_server"]) ==
'' ?
"" :
"&wc=". trim($cu_row[
"www_server"]));
237 $outputFields =
"\"$cuCode\",\"$cuName\",\"$cuAssets\",\"$cuMembers\",\"$cuVendor\"";
240 $outputFields .=
",\"$cuExpires\",\"$cuRenewal\"";
242 if ( $showProduct ) {
244 for( $p = 0; $p < count( $productList ); $p++ ) {
245 $cuHasProduct =
false;
246 for ( $c = 0; $c < count( $cuProducts ); $c++ ) {
247 if ( $cuProducts[$c] == $productList[$p][
"code"] ) {
248 $cuHasProduct =
true;
253 $outputFields .= sprintf(
",\"%s\"", ($cuHasProduct ?
"X" :
"") );
257 $outputString .=
"$outputFields\r\n";
263 $deciderList = array();
265 while ($cu_row = db_fetch_array($cu_rs, $row_cnt++)) {
266 $userName = trim($cu_row[
"user_name"]);
267 if ( $userName == $skippingCU )
continue;
269 if ( $userName != $currCU ) {
271 if ( $showDecider ) {
272 while ( $deciderOffset < count( $deciderList ) ) {
274 $cuDecideFirst = trim($deciderList[$deciderOffset][
'fname']);
275 $cuDecideLast = trim($deciderList[$deciderOffset][
'lname']);
276 $cuDecideEmail = $deciderList[$deciderOffset][
'email'];
277 $cuDecidePhone = $deciderList[$deciderOffset][
'phone'];
279 $outputFields =
"\"\",\"\"";
282 $outputFields .=
",\"\"";
284 $outputFields .=
",\"$cuDecideFirst\",\"$cuDecideLast\",\"$cuDecideEmail\",\"$cuDecidePhone\"";
287 $outputFields .=
",\"\"";
289 $outputString .=
"$outputFields\r\n";
295 $passedFilter = TestProductFilter($userName, $productList, $prodLogic);
297 if ( !$passedFilter ) {
298 $skippingCU = $userName;
303 if ( $showDecider ) {
304 $deciderSQL =
"SELECT monitor_contact.fname, monitor_contact.lname, monitor_contact.email, monitor_contact.phone 306 WHERE user_name = '$userName' 307 AND monitor_contact.decider = 'Y' ";
309 if ( $skipBlankEmails )
310 $deciderSQL .=
" AND length( monitor_contact.email ) > 0 ";
312 $deciderRS = db_query($deciderSQL, $link);
315 $deciderList = array();
317 while ($deciderRow = db_fetch_array($deciderRS, $deciderRowCnt++)) {
318 $deciderList[] = $deciderRow;
327 $deciderOffset < count( $deciderList ) ) {
328 $cuDecideFirst = trim($deciderList[$deciderOffset][
'fname']);
329 $cuDecideLast = trim($deciderList[$deciderOffset][
'lname']);
330 $cuDecideEmail = $deciderList[$deciderOffset][
'email'];
331 $cuDecidePhone = $deciderList[$deciderOffset][
'phone'];
339 if ( !($showDecider && $skipBlankEmails && !count( $deciderList )) ) {
341 $cuCode = ($userName != $currCU ? $userName :
"");
342 $cuName = ($userName != $currCU ? $cu_row[
'name'] :
"");
343 $cuAssets = ($userName != $currCU ? $cu_row[
'dec_31_assets'] :
"");
344 $cuMembers = ($userName != $currCU ? $cu_row[
'dec_31_mem'] :
"");
345 $cuVendor = ($userName != $currCU ? $cu_row[
'vendor'] :
"");
346 $cuExpires = ($userName != $currCU ? $cu_row[
'contract_expires'] :
"");
347 $cuRenewal = ($userName != $currCU ? $cu_row[
'renewal_term'] :
"");
349 $outputFields =
"\"$cuCode\",\"$cuName\",\"$cuAssets\",\"$cuMembers\",\"$cuVendor\"";
352 $outputFields .= sprintf(
",\"%s\"", $cu_row[
'home_cu_desc'] );
354 if ( $showDecider ) {
355 $outputFields .=
",\"$cuDecideFirst\",\"$cuDecideLast\",\"$cuDecideEmail\",\"$cuDecidePhone\"";
360 $outputFields .=
",\"$cuExpires\",\"$cuRenewal\"";
362 $outputString .=
"$outputFields\r\n";
369 if ( $showDecider ) {
370 while ( $deciderOffset < count( $deciderList ) ) {
372 $cuDecideFirst = trim($deciderList[$deciderOffset][
'fname']);
373 $cuDecideLast = trim($deciderList[$deciderOffset][
'lname']);
374 $cuDecideEmail = $deciderList[$deciderOffset][
'email'];
375 $cuDecidePhone = $deciderList[$deciderOffset][
'phone'];
377 $outputFields =
"\"\",\"\"";
380 $outputFields .=
",\"\"";
382 $outputFields .=
",\"$cuDecideFirst\",\"$cuDecideLast\",\"$cuDecideEmail\",\"$cuDecidePhone\"";
385 $outputFields .=
",\"\"";
387 $outputString .=
"$outputFields\r\n";
394 header(
"Content-length: " . strlen( $outputString ) );
395 header(
"Content-type: application/octetstream");
396 header(
"Content-disposition: inline; filename=\"ProductReport.csv\"");
397 print ( $outputString );
404 <table cellpadding=
"3" cellspacing=
"0" border=
"0" width=
"99%" class=
"dmsbg">
407 <table cellpadding=
"0" cellspacing=
"0" border=
"0" width=
"100%" bgcolor=white>
409 <td
class=
"ahd" align=
"center" colspan=
"<?php echo $vis_col; ?>">
416 if ( $showProduct ) {
417 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
418 $csvFilter .=
"show_product=1";
421 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
422 $csvFilter .=
"single_line=1";
424 if ( $showDecider ) {
425 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
426 $csvFilter .=
"show_decider=1";
428 if ( $skipBlankEmails ) {
429 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
430 $csvFilter .=
"skip_blank_emails=1";
432 if ( $showExpDate ) {
433 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
434 $csvFilter .=
"show_exp_date=1";
439 <form action=
"<?php echo $self; ?>" method=
"get">
440 <input type=
"hidden" name=
"act" value=
"<?php echo $act; ?>">
441 <table cellpadding=
"0" cellspacing=
"0" style=
'border-width: 1px;' width=
"100%" bgcolor=white>
443 <td style=
'font-weight:bold;'>Select what to view: </td>
444 <td><input type=
"checkbox" name=
"show_product" value=
"1" <?php echo ($showProduct == 1 ?
"checked='CHECKED'" :
"") ?>>
447 <td><input type=
"checkbox" name=
"single_line" value=
"1" <?php echo ($singleLine == 1 ?
"checked='CHECKED'" :
"") ?>>
450 <td><input type=
"checkbox" name=
"show_decider" value=
"1" <?php echo ($showDecider == 1 ?
"checked='CHECKED'" :
"") ?>>
453 <td><input type=
"checkbox" name=
"skip_blank_emails" value=
"1" <?php echo ($skipBlankEmails == 1 ?
"checked='CHECKED'" :
"") ?>>
456 <td><input type=
"checkbox" name=
"show_exp_date" value=
"1" <?php echo ($showExpDate == 1 ?
"checked='CHECKED'" :
"") ?>>
459 <td><button type=
"submit">Refresh</button>
463 <td style=
'font-weight:bold;'>Product Filter: <span
id=
'productExpand' style=
'cursor:pointer;' onClick=
"javascript:toggleFilter();">[ + ]</span></td>
465 <tr
id=
'productFilter' style=
'display:none;'>
466 <td colspan=
'8'><table>
468 <td colspan=
'8'><table>
471 for ( $i = 0; $i < count( $productList ); $i++ ) {
473 printf(
"<td>%s</td>", $productList[$i][
"desc"] );
474 printf(
"<td><input type='radio' name='value%s' value='1' %s> Has</td>", $productList[$i][
"code"], $productList[$i][
"include"] == 1 ?
"checked='CHECKED'" :
"" );
475 printf(
"<td><input type='radio' name='value%s' value='2' %s> Doesn't Have</td>", $productList[$i][
"code"], $productList[$i][
"include"] == 2 ?
"checked='CHECKED'" :
"" );
476 printf(
"<td><input type='radio' name='value%s' value='0' %s> Don't Care</td>", $productList[$i][
"code"], $productList[$i][
"include"] == 0 ?
"checked='CHECKED'" :
"" );
480 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
481 $csvFilter .= sprintf(
"value%s=%s", $productList[$i][
"code"], $productList[$i][
"include"] );
487 <td colspan=
'8'><table>
491 printf(
"<td style='font-weight:bold;'>Filter Logic:</td>" );
494 printf(
"<td> </td>" );
495 printf(
"<td><input type='radio' name='prod_logic' value='0' %s> Show Credit Unions respecting the \"Has\" and \"Doesn't Have\"</td>", $prodLogic == 0 ?
"checked='CHECKED'" :
"" );
498 printf(
"<td> </td>" );
499 printf(
"<td><input type='radio' name='prod_logic' value='1' %s> Show Credit Unions with any \"Has\"</td>", $prodLogic == 1 ?
"checked='CHECKED'" :
"" );
502 printf(
"<td> </td>" );
503 printf(
"<td><input type='radio' name='prod_logic' value='2' %s> Show Credit Unions with all \"Has\"</td>", $prodLogic == 2 ?
"checked='CHECKED'" :
"" );
507 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
508 $csvFilter .= sprintf(
"prod_logic=%s", $prodLogic );
515 <td style=
'font-weight:bold;'>Option Filter: <span
id=
'optionExpand' style=
'cursor:pointer;' onClick=
"javascript:toggleOptionFilter();">[ + ]</span></td>
517 <tr
id=
'optionFilter' style=
'display:none;'>
518 <td colspan=
'8'><table style=
"border-width: 1;">
521 for ( $i = 0; $i < count( $optionList ); $i++ ) {
523 printf(
"<td>%s</td>", $optionList[$i][
"desc"] );
524 printf(
"<td><input type='radio' name='option%s' value='1' %s> Has</td>", $optionList[$i][
"code"], $optionList[$i][
"include"] == 1 ?
"checked='CHECKED'" :
"" );
525 printf(
"<td><input type='radio' name='option%s' value='2' %s> Does NOT Have</td>", $optionList[$i][
"code"], $optionList[$i][
"include"] == 2 ?
"checked='CHECKED'" :
"" );
526 printf(
"<td><input type='radio' name='option%s' value='0' %s> Don't Care</td>", $optionList[$i][
"code"], $optionList[$i][
"include"] == 0 ?
"checked='CHECKED'" :
"" );
530 if ( strlen( $csvFilter ) ) $csvFilter .=
"&";
531 $csvFilter .= sprintf(
"option%s=%s", $optionList[$i][
"code"], $optionList[$i][
"include"] );
540 <script language=
"javascript">
542 function toggleFilter() {
543 var elemExpand = document.getElementById(
'productExpand');
544 var elemFilter = document.getElementById(
'productFilter');
546 if ( elemFilter.style.display ==
"none" ) {
547 elemFilter.style.display =
"block";
548 elemExpand.innerHTML =
"[ - ]";
550 elemFilter.style.display =
"none";
551 elemExpand.innerHTML =
"[ + ]";
554 function toggleOptionFilter() {
555 var elemExpand = document.getElementById(
'optionExpand');
556 var elemFilter = document.getElementById(
'optionFilter');
558 if ( elemFilter.style.display ==
"none" ) {
559 elemFilter.style.display =
"block";
560 elemExpand.innerHTML =
"[ - ]";
562 elemFilter.style.display =
"none";
563 elemExpand.innerHTML =
"[ + ]";
572 <tr><td> </td></tr>
574 <td colspan=
"<?php echo $vis_col; ?>" >
575 <a href=
"/monitor/mindex.html" target=
"_top">Return to Monitor</a>
577 <a href=
"cuproduct_report.prg?csv=csv&<?php echo $csvFilter; ?>&ob=<?php echo $ob_fldid ?>&d=<?php echo $pDescending?>">Download CSV</a>
581 <td
class=
"hdr"><a href=
"<?php echo $self; ?>?act=<?php echo $act; ?>&ob=1&d=<?php echo $ob_desc[1]; ?>&<?php echo $csvFilter; ?>">CU Code</a></td>
582 <td
class=
"hdr"><a href=
"<?php echo $self; ?>?act=<?php echo $act; ?>&ob=2&d=<?php echo $ob_desc[2]; ?>&<?php echo $csvFilter; ?>">CU Name</a></td>
583 <td
class=
"hdr"><a href=
"<?php echo $self; ?>?act=<?php echo $act; ?>&ob=3&d=<?php echo $ob_desc[3]; ?>&<?php echo $csvFilter; ?>">Asset</a></td>
584 <td
class=
"hdr"><a href=
"<?php echo $self; ?>?act=<?php echo $act; ?>&ob=4&d=<?php echo $ob_desc[4]; ?>&<?php echo $csvFilter; ?>">Mem</a></td>
585 <td
class=
"hdr"><a href=
"<?php echo $self; ?>?act=<?php echo $act; ?>&ob=5&d=<?php echo $ob_desc[5]; ?>&<?php echo $csvFilter; ?>">Vendor</a></td>
587 if ( $showProduct && !$singleLine ) {
588 printf(
"<td class=\"hdr\"><a href=\"$self?act=$act&ob=6&d=%s&$csvFilter\">Product</a></td>\n", $ob_desc[6] );
590 if ( $showDecider ) {
592 printf(
"<td class=\"hdr\"><a href=\"javascript:void();\">First</a></td>\n" );
593 printf(
"<td class=\"hdr\"><a href=\"javascript:void();\">Last</a></td>\n" );
594 printf(
"<td class=\"hdr\"><a href=\"javascript:void();\">E-mail</a></td>\n" );
595 printf(
"<td class=\"hdr\"><a href=\"javascript:void();\">Phone</a></td>\n" );
597 if ( $showExpDate ) {
598 printf(
"<td class=\"hdr\"><a href=\"$self?act=$act&ob=7&d=%s&$csvFilter\">Exp Date</a></td>\n", $ob_desc[7] );
599 printf(
"<td class=\"hdr\"><a href=\"javascript:void();\">Renewal</a></td>\n" );
602 if ( $showProduct && $singleLine ) {
604 for ( $p = 0; $p < count( $productList ); $p++ ) {
605 printf(
"<td class=\"hdr\">%s</td>\n", $productList[$p][
"code"] );
612 <?php
if ($num_rows == 0): ?>
614 <td
class=
"ahd" align=
"center" colspan=
"<?php echo $vis_col; ?>">
624 while ($cu_row = db_fetch_array($cu_rs, $row_cnt++)) {
625 $userName = trim($cu_row[
"user_name"]);
628 $cuProducts = GetCUProductList( $userName );
630 $passedFilter = TestProductFilter2($cuProducts, $productList, $prodLogic);
632 if ( !$passedFilter ) {
636 $row_class = ($row_class ==
"odd" ?
"even" :
"odd");
638 print
"<tr class=\"$row_class\">";
642 $cuName = $cu_row[
'name'];
643 $cuAssets = $cu_row[
'dec_31_assets'];
644 $cuMembers = $cu_row[
'dec_31_mem'];
645 $cuVendor = $cu_row[
'vendor'];
646 $cuExpires = $cu_row[
'contract_expires'];
647 $cuRenewal = $cu_row[
'renewal_term'];
648 $cuHomepage = trim($cu_row[
"home_page_url"]);
650 $vend_show = (trim($cu_row[
"vendor"]) ==
'' ?
"" :
"&vc=". trim($cu_row[
"vendor"]));
651 $www_show = (trim($cu_row[
"www_server"]) ==
'' ?
"" :
"&wc=". trim($cu_row[
"www_server"]));
653 printf(
"<td class=\"usul\"><a href=\"%s/hcuadm/cuindex.prg?action=fetch&rowid=%s%s%s\">$cuCode</a></td>",
654 $info_url, $cuCode, $vend_show, $www_show );
656 if ( strlen( $cuName ) > 0 && strlen( $cuHomepage ) > 0 )
657 print
"<td class=\"usul\"><a href='http://$cuHomepage' target='_blank'>$cuName</a></td>";
658 else if ( strlen( $cuName ) > 0 )
659 print
"<td class=\"usul\">$cuName</td>";
661 print
"<td class=\"usul\"> </td>";
664 print
"<td class=\"usul\">$cuAssets</td>";
666 print
"<td class=\"usul\"> </td>";
668 if ( $cuMembers > 0 )
669 print
"<td class=\"usul\">$cuMembers</td>";
671 print
"<td class=\"usul\"> </td>";
673 if ( strlen( $cuVendor ) > 0 )
674 print
"<td class=\"usul\">$cuVendor</td>";
676 print
"<td class=\"usul\"> </td>";
678 if ( $showExpDate ) {
679 if ( strlen( $cuExpires ) )
680 print
"<td class=\"usul\">$cuExpires</a></td>\n";
682 print
"<td class=\"usul\"> </a></td>\n";
683 if ( strlen( $cuRenewal ) )
684 print
"<td class=\"usul\">$cuRenewal</a></td>\n";
686 print
"<td class=\"usul\"> </a></td>\n";
689 if ( $showProduct ) {
691 for( $p = 0; $p < count( $productList ); $p++ ) {
692 $cuHasProduct =
false;
693 for ( $c = 0; $c < count( $cuProducts ); $c++ ) {
694 if ( $cuProducts[$c] == $productList[$p][
"code"] ) {
695 $cuHasProduct =
true;
700 printf(
"<td class=\"usul\" style='border-left:1px dotted grey;'>%s</td>\n", ($cuHasProduct ?
"X" :
" ") );
710 $deciderList = array();
712 while ($cu_row = db_fetch_array($cu_rs, $row_cnt++)) {
713 $userName = trim($cu_row[
"user_name"]);
715 if ( $userName == $skippingCU )
continue;
717 if ( $userName != $currCU ) {
719 if ( $showDecider ) {
720 while ( $deciderOffset < count( $deciderList ) ) {
721 $row_class = ($row_class ==
"odd" ?
"even" :
"odd");
724 print
"<tr class=\"$row_class\">";
725 print
"<td class=\"usul\"> </td>";
726 print
"<td class=\"usul\"> </td>";
727 print
"<td class=\"usul\"> </td>";
728 print
"<td class=\"usul\"> </td>";
729 print
"<td class=\"usul\"> </td>";
730 if ( $showProduct && !$singleLine )
731 print
"<td class=\"usul\"> </td>";
733 $cuDecideFirst = dms_disphtml($deciderList[$deciderOffset][
'fname']);
734 $cuDecideLast = dms_disphtml($deciderList[$deciderOffset][
'lname']);
735 $cuDecideEmail = $deciderList[$deciderOffset][
'email'];
736 $cuDecidePhone = $deciderList[$deciderOffset][
'phone'];
738 print
"<td class=\"usul\">$cuDecideFirst</a></td>\n";
739 print
"<td class=\"usul\">$cuDecideLast</a></td>\n";
740 print
"<td class=\"usul\">$cuDecideEmail</a></td>\n";
741 print
"<td class=\"usul\">$cuDecidePhone</a></td>\n";
743 if ( $showExpDate ) {
744 print
"<td class=\"usul\"> </td>";
745 print
"<td class=\"usul\"> </td>";
748 if ( $showProduct && $singleLine )
749 print
"<td class=\"usul\"> </td>";
757 $passedFilter = TestProductFilter($userName, $productList, $prodLogic);
759 if ( !$passedFilter ) {
760 $skippingCU = $userName;
765 if ( $showDecider ) {
766 $deciderSQL =
"SELECT monitor_contact.fname, monitor_contact.lname, monitor_contact.email, monitor_contact.phone 768 WHERE user_name = '$userName' 769 AND monitor_contact.decider = 'Y' ";
771 if ( $skipBlankEmails )
772 $deciderSQL .=
" AND length( monitor_contact.email ) > 0 ";
774 $deciderRS = db_query($deciderSQL, $link);
777 $deciderList = array();
779 while ($deciderRow = db_fetch_array($deciderRS, $deciderRowCnt++)) {
780 $deciderList[] = $deciderRow;
789 $deciderOffset < count( $deciderList ) ) {
790 $cuDecideFirst = dms_disphtml($deciderList[$deciderOffset][
'fname']);
791 $cuDecideLast = dms_disphtml($deciderList[$deciderOffset][
'lname']);
792 $cuDecideEmail = $deciderList[$deciderOffset][
'email'];
793 $cuDecidePhone = $deciderList[$deciderOffset][
'phone'];
801 if ( !($showDecider && $skipBlankEmails && !count( $deciderList )) ) {
802 $row_class = ($row_class ==
"odd" ?
"even" :
"odd");
804 print
"<tr class=\"$row_class\">";
807 $cuCode = ($userName != $currCU ? $userName :
"");
808 $cuName = ($userName != $currCU ? $cu_row[
'name'] :
"");
809 $cuAssets = ($userName != $currCU ? $cu_row[
'dec_31_assets'] :
"");
810 $cuMembers = ($userName != $currCU ? $cu_row[
'dec_31_mem'] :
"");
811 $cuVendor = ($userName != $currCU ? $cu_row[
'vendor'] :
"");
812 $cuExpires = ($userName != $currCU ? $cu_row[
'contract_expires'] :
"");
813 $cuRenewal = ($userName != $currCU ? $cu_row[
'renewal_term'] :
"");
814 $cuHomepage = trim($cu_row[
"home_page_url"]);
816 $vend_show = (trim($cu_row[
"vendor"]) ==
'' ?
"" :
"&vc=". trim($cu_row[
"vendor"]));
817 $www_show = (trim($cu_row[
"www_server"]) ==
'' ?
"" :
"&wc=". trim($cu_row[
"www_server"]));
819 if ( $userName != $currCU )
820 printf(
"<td class=\"usul\"><a href=\"%s/hcuadm/cuindex.prg?action=fetch&rowid=%s%s%s\">$cuCode</a></td>",
821 $info_url, $cuCode, $vend_show, $www_show );
823 print
"<td class=\"usul\"> </td>";
825 if ( strlen( $cuName ) > 0 && strlen( $cuHomepage ) > 0 )
826 print
"<td class=\"usul\"><a href='http://$cuHomepage' target='_blank'>$cuName</a></td>";
827 else if ( strlen( $cuName ) > 0 )
828 print
"<td class=\"usul\">$cuName</td>";
830 print
"<td class=\"usul\"> </td>";
833 print
"<td class=\"usul\">$cuAssets</td>";
835 print
"<td class=\"usul\"> </td>";
837 if ( $cuMembers > 0 )
838 print
"<td class=\"usul\">$cuMembers</td>";
840 print
"<td class=\"usul\"> </td>";
842 if ( strlen( $cuVendor ) > 0 )
843 print
"<td class=\"usul\">$cuVendor</td>";
845 print
"<td class=\"usul\"> </td>";
847 if ( $showProduct && !$singleLine )
848 printf(
"<td class=\"usul\">%s</td>\n", dms_disphtml($cu_row[
'home_cu_desc']) );
850 if ( $showDecider ) {
851 print
"<td class=\"usul\">$cuDecideFirst</a></td>\n";
852 print
"<td class=\"usul\">$cuDecideLast</a></td>\n";
853 print
"<td class=\"usul\">$cuDecideEmail</a></td>\n";
854 print
"<td class=\"usul\">$cuDecidePhone</a></td>\n";
858 if ( $showExpDate ) {
859 if ( strlen( $cuExpires ) )
860 print
"<td class=\"usul\">$cuExpires</a></td>\n";
862 print
"<td class=\"usul\"> </a></td>\n";
863 if ( strlen( $cuRenewal ) )
864 print
"<td class=\"usul\">$cuRenewal</a></td>\n";
866 print
"<td class=\"usul\"> </a></td>\n";
869 if ( $showProduct && $singleLine )
870 printf(
"<td class=\"usul\">%s</td>\n", dms_disphtml($cu_row[
'home_cu_desc']) );
879 if ( $showDecider ) {
880 while ( $deciderOffset < count( $deciderList ) ) {
881 $row_class = ($row_class ==
"odd" ?
"even" :
"odd");
884 print
"<tr class=\"$row_class\">";
885 print
"<td class=\"usul\"> </td>";
886 print
"<td class=\"usul\"> </td>";
887 print
"<td class=\"usul\"> </td>";
888 print
"<td class=\"usul\"> </td>";
889 print
"<td class=\"usul\"> </td>";
890 if ( $showProduct && !$singleLine )
891 print
"<td class=\"usul\"> </td>";
893 $cuDecideFirst = dms_disphtml($deciderList[$deciderOffset][
'fname']);
894 $cuDecideLast = dms_disphtml($deciderList[$deciderOffset][
'lname']);
895 $cuDecideEmail = $deciderList[$deciderOffset][
'email'];
896 $cuDecidePhone = $deciderList[$deciderOffset][
'phone'];
898 print
"<td class=\"usul\">$cuDecideFirst</a></td>\n";
899 print
"<td class=\"usul\">$cuDecideLast</a></td>\n";
900 print
"<td class=\"usul\">$cuDecideEmail</a></td>\n";
901 print
"<td class=\"usul\">$cuDecidePhone</a></td>\n";
903 if ( $showExpDate ) {
904 print
"<td class=\"usul\"> </td>";
905 print
"<td class=\"usul\"> </td>";
908 if ( $showProduct && $singleLine )
909 print
"<td class=\"usul\"> </td>";
936 function TestProductFilter( $cuName, $productList, $prodLogic ) {
940 $productSql =
"SELECT cuproducts.home_cu_code FROM cuproducts 941 JOIN cuprodlist on cuprodlist.home_cu_code = cuproducts.home_cu_code 942 WHERE cuproducts.user_name = '$cuName' order by cuproducts.home_cu_code";
943 $product_rs = db_query($productSql, $link);
945 $cuProductList = array();
947 while ( $product_row = db_fetch_array($product_rs, $prodRowCnt++) ) {
948 $cuProductList[] = trim($product_row[
"home_cu_code"]);
952 db_free_result($product_rs);
955 $passedFilter =
false;
957 for ( $i = 0; $i < count( $productList ); $i++ ) {
959 if ( $productList[$i][
"include"] == 1 ) {
963 for ( $p = 0; $p < count( $cuProductList ); $p++ ) {
965 if ( $cuProductList[$p] == $productList[$i][
"code"] ) {
971 if ( $prodLogic == 1 && $found ) {
973 $passedFilter =
true;
975 }
else if ( $prodLogic == 2 && !$found ) {
977 $passedFilter =
false;
979 }
else if ( $prodLogic == 0 && !$found ) {
981 $passedFilter =
false;
987 }
else if ( ($productList[$i][
"include"] == 2) && ($prodLogic == 0) ) {
991 for ( $p = 0; $p < count( $cuProductList ); $p++ ) {
993 if ( $cuProductList[$p] == $productList[$i][
"code"] ) {
1002 $passedFilter =
false;
1013 if ( !$passedFilter && $prodLogic == 0 ) {
1015 for ( $i = 0; $i < count( $productList ); $i++ ) {
1016 if ( $productList[$i][
"include"] == 1 || $productList[$i][
"include"] == 2 ) {
1020 if ( $expectedCount == $matchCount ) $passedFilter =
true;
1025 if ( !$passedFilter && $prodLogic == 2 ) {
1027 for ( $i = 0; $i < count( $productList ); $i++ ) {
1028 if ( $productList[$i][
"include"] == 1 ) {
1032 if ( $expectedCount == $matchCount ) $passedFilter =
true;
1035 return $passedFilter;
1038 function productSort($a, $b)
1040 $indexArray= array_flip(array(
"",
"Silver",
"Gold",
"Platinum"));
1041 $aIndex= intval($indexArray[$a[
"code"]]);
1042 $bIndex= intval($indexArray[$b[
"code"]]);
1044 $indexChange= $aIndex - $bIndex;
1045 if ($indexChange != 0)
1046 return $indexChange;
1047 return strcmp($a[
"desc"], $b[
"desc"]);
1051 function GetCUProductList( $cuName ) {
1055 $productSql =
"SELECT cuproducts.home_cu_code FROM cuproducts 1056 WHERE cuproducts.user_name = '$cuName' order by cuproducts.home_cu_code";
1057 $product_rs = db_query($productSql, $link);
1059 $cuProductList = array();
1061 while ( $product_row = db_fetch_array($product_rs, $prodRowCnt++) ) {
1062 $cuProductList[] = trim($product_row[
"home_cu_code"]);
1066 db_free_result($product_rs);
1068 return $cuProductList;
1072 function TestProductFilter2( $cuProductList, $productList, $prodLogic ) {
1075 $passedFilter =
false;
1077 for ( $i = 0; $i < count( $productList ); $i++ ) {
1079 if ( $productList[$i][
"include"] == 1 ) {
1083 for ( $p = 0; $p < count( $cuProductList ); $p++ ) {
1085 if ( $cuProductList[$p] == $productList[$i][
"code"] ) {
1091 if ( $prodLogic == 1 && $found ) {
1093 $passedFilter =
true;
1095 }
else if ( $prodLogic == 2 && !$found ) {
1097 $passedFilter =
false;
1099 }
else if ( $prodLogic == 0 && !$found ) {
1101 $passedFilter =
false;
1107 }
else if ( ($productList[$i][
"include"] == 2) && ($prodLogic == 0) ) {
1111 for ( $p = 0; $p < count( $cuProductList ); $p++ ) {
1113 if ( $cuProductList[$p] == $productList[$i][
"code"] ) {
1122 $passedFilter =
false;
1133 if ( !$passedFilter && $prodLogic == 0 ) {
1135 for ( $i = 0; $i < count( $productList ); $i++ ) {
1136 if ( $productList[$i][
"include"] == 1 || $productList[$i][
"include"] == 2 ) {
1140 if ( $expectedCount == $matchCount ) $passedFilter =
true;
1145 if ( !$passedFilter && $prodLogic == 2 ) {
1147 for ( $i = 0; $i < count( $productList ); $i++ ) {
1148 if ( $productList[$i][
"include"] == 1 ) {
1152 if ( $expectedCount == $matchCount ) $passedFilter =
true;
1155 return $passedFilter;
1158 function get_field($value) {
1159 switch (intval($value)) {
1161 $ret_field =
" cuinfo.name ";
1164 $ret_field =
" cuinfo.dec_31_assets ";
1167 $ret_field =
" cuinfo.dec_31_mem ";
1170 $ret_field =
" cuinfo.vendor ";
1173 $ret_field =
" cuprodlist.home_cu_desc ";
1176 $ret_field =
" cuinfo.contract_expires ";
1180 $ret_field =
" cuinfo.user_name ";
1188 function get_desc($value) {