Documentation is available at Invoices.inc
- <?php
- // Team Template code runs within a Team_Display member function environement
- if (!isset($teamCompUnix)) $teamCompUnix="";
- if (isset($_POST["selectedCompUnix"])) $teamCompUnix=$_POST["selectedCompUnix"];
- if ($teamCompUnix=="" && isset($extras["CompUnix"]))
- $teamCompUnix=$extras["CompUnix"];
- if (!preg_match('|^[A-Za-z][-_A-Za-z0-9]*$|',$teamCompUnix))
- $teamCompUnix="";
- if ($teamCompUnix!="")
- {
- $_SESSION["teamCompUnix"]=$teamCompUnix;
- $compDB = new CompDB($teamCompUnix, $this->db->getDBUser(),
- $this->db->getDBPass());
- $details = $this->db->getTeamDetails($teamID);
- $orgID = $compDB->checkForCentralAffiliation($details["Name"],
- $details["Short"]);
- $compStatus=$compDB->getStatus();
- }
- if ($teamCompUnix!="" && isset($_POST["submit"]))
- {
- foreach($_POST as $label=>$value)
- {
- if ($label=="affil") continue;
- if ($label=="submit") continue;
- $id = substr($label,strrpos($label,'-')+1,strlen($label));
- $update=(substr($value,0,3)!="not"?"TRUE":"FALSE");
- if ($update=="TRUE")
- $orgString=", orgid=$orgID ";
- else
- $orgString="";
- $query = "UPDATE people_paying SET org_pays=$update{$orgString} WHERE peopleid=$id;";
- $compDB->query($query);
- touch("{$GLOBALS["CIB_VAR_PATH"]}/$teamCompUnix.updated");
- }
- }
- if ($teamCompUnix!="")
- {
- $invoice=$compDB->produceRegistrantArray($orgID);
- $formattedInvoice=$this->formatInvoice($invoice,$details,$compStatus,
- $teamCompUnix,$compDB);
- $table=$formattedInvoice;
- }
- if ($teamCompUnix=="")
- {
- $comps = $this->db->getUpcomingComps($teamID,'2 weeks');
- $needTable=FALSE;
- foreach($comps as $aComp)
- {
- if (!isset($aComp["OrgID"])) continue;
- if ($aComp["NumAttending"]>0)
- $needTable=TRUE;
- if ($needTable) break;
- }
- if ($needTable)
- {
- $table =<<<END_TABLE
- <p>Your team has members attending the following competitions. The current
- registration total is shown next to the competition name. You can click
- on the competition name to see the current invoice. From the details page for a given
- competition you can remove people from the team invoice or "adopt" non-team
- members who are partering with your members, if needed.</p>
- <table>
- <tr><th>Date</th><th>Competition</th><th>Outstanding</th><th>Paid</th><th>Waived</th><th>Reg. Total</th></tr>
- END_TABLE; foreach($comps as $aCompUnix=>$aComp)
- {
- $compDB = new CompDB($aCompUnix, $this->db->getDBUser(),
- $this->db->getDBPass());
- if (!isset($aComp["OrgID"])) continue;
- $compOrgID=$aComp["OrgID"];
- $totalDue = $compDB->getTotalOwed($compOrgID);
- if (abs($totalDue)<0.5) continue;
- $totalWaived = $compDB->getTotalWaived($compOrgID);
- $totalPaid = $compDB->getTotalPaid($compOrgID);
- $outstanding=$totalDue-$totalWaived-$totalPaid;
- $total_s = number_format($totalDue,2);
- $paid_s = number_format($totalPaid,2);
- $waived_s = number_format($totalWaived,2);
- $outstanding_s = number_format($outstanding,2);
- $link="{$GLOBALS["CIB_BASE_URL"]}team/admin/$teamID/Invoices/$aCompUnix";
- $table .= <<<END_ROW
- <tr><td>{$aComp["Date"]}</td><td><a href="$link">{$aComp["Name"]}</a></td><td>\$$outstanding_s</td><td>\$$paid_s</td><td>\$$waived_s</td><td>\$$total_s</td></tr>
- END_ROW; }
- $table .= "</table>";
- }
- else
- {
- $table="<p>You have no members competing at upcoming competitions.</p>";
- }
- }
- $body.=<<<END_BODY
- <div class="team-tab">
- $table
- </div>
- END_BODY?>
Documentation generated on Tue, 25 Apr 2006 13:03:55 -0400 by phpDocumentor 1.3.0RC3