0); ?>

Entry Summary by Category


0'; $pay_res=mysqli_query($db, $query); while (!$PartialPay && $pay_row=mysqli_fetch_row($pay_res)) { $PartialPay=(cntEntry($pay_row[0]) != cntPaid($pay_row[0])); } if ($PartialPay) { echo 'Note: Paid Count may be overstated due to partial payments

'."\n"; } } echo ''."\n"; switch ($Order) { case 'ca': $orderby='s.type_seq, s.cat'; break; case 'cd': $orderby='s.type_seq, s.cat desc'; break; case 'eca': $orderby='ecnt, s.type_seq, s.cat'; break; case 'ecd': $orderby='ecnt desc, s.type_seq, s.cat'; break; default: $orderby='cat'; } $HRef='entry_summ.php?k='.$Key.'&o='; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if ($ShowPaid) { echo ''."\n"; } echo ''."\n"; $query='select s.type_seq, s.cat, s.cat_desc, count(e.entry) as ecnt '; $query.='from style s left join entry e on (s.type_seq = e.type_seq and s.cat = e.cat and e.removed != "Y") '; $query.='where s.sg="'.$Comp_SG.'" group by s.type_seq, s.cat, s.cat_desc order by '.$orderby; $summ_res=mysqli_query($db, $query); while ($summ_row=mysqli_fetch_assoc($summ_res)) { $query='select count(*) from style_sub where sg="'.$Comp_SG.'" and type_seq='.$summ_row['type_seq'].' and cat='.$summ_row['cat'].' and sub_cat != ""'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); $sub_cnt=$cnt_row[0]; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if ($ShowPaid) { $query='select count(distinct entry) from entry e, payments p where e.type_seq="'.$summ_row['type_seq'].'"'; $query.=' and e.cat="'.$summ_row['cat'].'" and e.removed != "Y" and e.brewer=p.brewer and p.pay_stat in ("A", "P")'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); echo ''."\n"; } echo ''."\n"; if ($sub_cnt > 0) { $cnt_sub=0; $query='select s.sub_cat, s.cat_desc, count(e.entry) as ecnt '; $query.='from style_sub s left join entry e on (s.type_seq = e.type_seq and s.cat = e.cat and s.sub_cat = e.sub_cat and e.removed != "Y") '; $query.='where s.sg="'.$Comp_SG.'" and s.type_seq="'.$summ_row['type_seq'].'" and s.cat="'.$summ_row['cat'].'" group by s.sub_cat, s.cat_desc order by s.sub_cat'; $sub_summ_res=mysqli_query($db, $query); while ($sub_summ_row=mysqli_fetch_assoc($sub_summ_res)) { ++$cnt_sub; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if ($ShowPaid) { $query='select count(distinct entry) from entry e, payments p where e.type_seq="'.$summ_row['type_seq'].'"'; $query.=' and e.cat="'.$summ_row['cat'].'" and sub_cat="'.$sub_summ_row['sub_cat'].'" and e.removed != "Y" and'; $query.=' e.brewer=p.brewer and p.pay_stat in ("A", "P")'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); echo ''."\n"; } echo ''."\n"; } } } echo '
'."\n"; echo 'Category'."\n"; echo ''."\n"; echo 'Description'."\n"; echo ''."\n"; echo 'Entry
Count
'."\n"; echo '
'."\n"; echo 'Paid
Count'."\n"; echo '
'."\n"; echo ($summ_row['ecnt'] > 0 ? '' : '').disp_cat($summ_row['type_seq'], $summ_row['cat']).($summ_row['ecnt'] > 0 ? '' : '')."\n"; echo ' 0 ? ' id="cell_'.$summ_row['type_seq'].':'.$summ_row['cat'].'" title="Click to Expand" onclick="toggleSubCat('.SQ($summ_row['type_seq'].':'.$summ_row['cat']).')"' : '').'>'."\n"; echo ($sub_cnt > 0 ? '+' : ' ')."\n"; echo ''."\n"; echo $summ_row['cat_desc']."\n"; echo ''."\n"; echo $summ_row['ecnt']."\n"; echo ''."\n"; echo $cnt_row[0]."\n"; echo '
'."\n"; ?>