示例#1
0
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     global $CORE_LOCAL;
     $this->conn = CoopCredLib::ccDataConnect();
     if ($this->conn === False) {
         return "Error: ccDataConnect() failed.";
     }
     $programOK = CoopCredLib::programOK($this->tender_code, $this->conn);
     if ($programOK !== True) {
         return DisplayLib::boxMsg("{$programOK}");
     }
     $subtotals = CoopCredLib::getCCredSubtotals($this->tender_code, $this->conn);
     if ($subtotals !== True) {
         return DisplayLib::boxMsg("{$subtotals}");
     }
     $pc = $CORE_LOCAL->get("CCredProgramCode");
     //$pc = $CORE_LOCAL->get("programCode");
     /* For Refunding the total without entering the exact amount
      *  i.e. with QA alone.
      */
     if ($this->amount == '' && $this->DefaultTotal() < 0) {
         $this->amount = $this->DefaultTotal();
     }
     /* No Available Balance.
      */
     if ($CORE_LOCAL->get("{$pc}availBal") < 0) {
         return DisplayLib::boxMsg(_("Member") . " #" . $CORE_LOCAL->get("memberID") . ' ' . _("does not have enough Coop Cred in ") . '<b>' . $CORE_LOCAL->get("{$pc}programName") . '</b>' . _(" to cover this purchase."));
     }
     /* Tender more than Available Balance
      * the amount remaining less the amount of this type already tendered
      * in the current transaction.
      * I think availBal already includes memChargeTotal.
      */
     if (abs($CORE_LOCAL->get("{$pc}memChargeTotal")) + $this->amount >= $CORE_LOCAL->get("{$pc}availBal") + 0.005) {
         $memChargeCommitted = $CORE_LOCAL->get("{$pc}availBal") + $CORE_LOCAL->get("{$pc}memChargeTotal");
         return DisplayLib::xboxMsg(_("The amount of Coop Cred you have in ") . '<b>' . $CORE_LOCAL->get("{$pc}programName") . '</b>' . _(" is only \$") . number_format($memChargeCommitted, 2) . '.');
     }
     /* Tender more than Amount Due.
      */
     if (MiscLib::truncate2($CORE_LOCAL->get("amtdue")) < MiscLib::truncate2($this->amount)) {
         return DisplayLib::xboxMsg(_("The amount of Coop Cred tendered may not exceed the Amount Due."));
     }
     /* Add the tender to those used in this transaction.
      */
     if ($CORE_LOCAL->get('CCredTendersUsed') == '') {
         $CORE_LOCAL->set('CCredTendersUsed', array("{$this->tender_code}" => $CORE_LOCAL->get("CCredProgramID")));
     } else {
         $tu = $CORE_LOCAL->get('CCredTendersUsed');
         if (!array_key_exists("{$this->tender_code}", $tu)) {
             $tu["{$this->tender_code}"] = $CORE_LOCAL->get("CCredProgramID");
             $CORE_LOCAL->set('CCredTendersUsed', $tu);
         }
     }
     return true;
     // errorCheck()
 }
示例#2
0
 /**
   Return a message containing Available Balance
   after the just-completed transaction
   for each Program the member belongs to.
   @param $str [string] from the custReceiptMessage table record.
     format: "AAA BBB \d" where AAA will sort to the right sequence
             and \d is the CCredPrograms.programID
     I don't remember why three fields. AAA \d may be enough.
   @return [string] message about Available Balance for each Program
   the member belongs to.
 */
 public function message($str)
 {
     global $CORE_LOCAL;
     $lineStart = "";
     $lineEnd = "\n";
     $msg = explode(' ', $str);
     // 9Oct2014 Why [2]? Wouldn't [1] be enough?
     if (!isset($msg[2]) || !preg_match('/^\\d+$/', $msg[2])) {
         return "Error: No program id in {$str}{$lineEnd}";
     }
     $programID = $msg[2];
     if (!in_array('CoopCred', $CORE_LOCAL->get('PluginList'))) {
         $ret = "{$lineStart}" . _("Coop Cred is not currently in use at this co-op.") . "{$lineEnd}";
         return $ret;
     }
     $conn = CoopCredLib::ccDataConnect();
     if ($conn === False) {
         return "Error: ccDataConnect() failed." . $lineEnd;
     }
     $ccQ = "SELECT p.programID, p.programName, p.tenderType,\n            p.active, p.startDate, p.endDate,\n            p.bankID, p.creditOK, p.inputOK, p.transferOK,\n            m.creditBalance, m.creditLimit, m.creditOK, m.inputOK,\n                m.transferOK, m.isBank\n                ,(m.creditLimit - m.creditBalance) as availCreditBalance\n                ,c.FirstNAme, c.LastName\n            FROM CCredMemberships m\n            JOIN CCredPrograms p ON p.programID = m.programID\n            JOIN {$CORE_LOCAL->get('pDatabase')}.custdata c\n                ON m.cardNo = c.CardNo\n                WHERE m.cardNo =" . $CORE_LOCAL->get("memberID") . " AND m.programID={$programID}\n                 AND c.personNum=1";
     $ccS = $conn->prepare_statement("{$ccQ}");
     if ($ccS === False) {
         return "Statement prep for Program {$programID} failed.{$lineEnd}";
     }
     $args = array();
     $ccR = $conn->exec_statement($ccS, $args);
     if ($ccR === False) {
         return "Query for Program {$programID} failed.{$lineEnd}";
     }
     if ($conn->num_rows($ccR) == 0) {
         $ret = "Member " . $CORE_LOCAL->get("memberID") . _(" is not registered for Coop Cred Program {$programID}.") . "{$lineEnd}";
         return $ret;
     }
     /* For each Coop Cred Program the member is in.
      */
     while ($row = $conn->fetch_array($ccR)) {
         $programOK = CoopCredLib::programOK($row['tenderType'], $conn);
         if ($programOK === True) {
             $subs = CoopCredLib::getCCredSubtotals($row['tenderType'], $conn);
             if ($subs !== True) {
                 return "Error: Coop Cred Program " . $programID . " subtotals.";
             }
             $projectName = 'Coop Cred';
             $pcode = 'CCred' . $programID;
             $pname = $CORE_LOCAL->get("{$pcode}ProgramName");
             $acb = $CORE_LOCAL->get("{$pcode}availBal") != '' ? $CORE_LOCAL->get("{$pcode}availBal") : _("Balance not available.");
             $ret = sprintf("%s: %s %s: \$ %s%s", $projectName, $pname, _("Available"), $acb, $lineEnd);
         } else {
             $ret = $programOK . $lineEnd;
         }
     }
     return $ret;
 }
示例#3
0
 /**
   Generate the message
   @param $val the value returned by the object's select_condition()
   @param $ref a transaction reference (emp-lane-trans)
   @param $reprint boolean
   @return [string] message to print on receipt
 */
 public function message($val, $ref, $reprint = False)
 {
     global $CORE_LOCAL;
     if ($val == 0) {
         return '';
     }
     $lineStart = "";
     $lineEnd = "\n";
     $conn = CoopCredLib::ccDataConnect();
     if ($conn === False) {
         return "Error: ccDataConnect() failed." . $lineEnd;
     }
     $chgName = ReceiptLib::getChgName();
     $dateTimeStamp = time();
     $date = ReceiptLib::build_time($dateTimeStamp);
     $itemSeparator = '';
     for ($i = 1; $i <= 7; $i++) {
         $itemSeparator .= $lineEnd;
     }
     $cutPaper = chr(27) . chr(105) . chr(27) . chr(33) . chr(5);
     $projectName = _('Coop Cred');
     $projectUC = _('COOP CRED');
     $slip = '';
     $tu = $CORE_LOCAL->get('CCredTendersUsed');
     foreach ($tu as $tTender => $tProgramID) {
         $programCode = "CCred{$tProgramID}";
         $programName = $CORE_LOCAL->get("{$programCode}programName");
         $subs = CoopCredLib::getCCredSubtotals($tTender, $conn, $programCode, 'localtranstoday', $ref);
         if ($subs !== True) {
             return "Error: Coop Cred Program " . $tProgramID . " subtotals.";
         }
         $labels["{$programCode}"] = array("{$projectUC} '{$programName}' ACCOUNT\n", "Tender:{$tTender} Debit Amount:", "I ACKNOWLEDGE THE ABOVE DEBIT\n", "TO MY {$projectUC} '{$programName}' ACCOUNT\n");
         $slip .= $itemSeparator . $cutPaper . "\n" . ReceiptLib::centerString("S T O R E   C O P Y") . "\n" . ReceiptLib::centerString("................................................") . "\n\n" . $labels["{$programCode}"][0] . "Name: " . trim($chgName) . "\n" . "Member Number: " . trim($CORE_LOCAL->get("memberID")) . "\n" . "Date: " . $date . "\n" . "REFERENCE #: " . $ref . "\n" . $labels["{$programCode}"][1] . " \$" . number_format(-1 * $CORE_LOCAL->get("{$programCode}chargeTotal"), 2) . "\n" . $labels["{$programCode}"][2] . $labels["{$programCode}"][3] . "Member Sign Below\n\n\n" . "X____________________________________________\n" . $CORE_LOCAL->get("fname") . " " . $CORE_LOCAL->get("lname") . "\n\n" . ReceiptLib::centerString(".................................................") . "\n\n";
         // each tender
     }
     return $slip;
 }
示例#4
0
 function parse($str)
 {
     global $CORE_LOCAL;
     $ret = $this->default_json();
     $pStyle = "<p style='font-weight:bold; text-align:center; margin: 0em 0em 0em -1.0em;'>";
     if (!in_array('CoopCred', $CORE_LOCAL->get('PluginList'))) {
         $message = "{$pStyle}" . _("Coop Cred is not currently in use at this co-op.") . "</p>";
         $ret['output'] = DisplayLib::boxMsg("{$message}", "", True);
         return $ret;
     }
     $conn = CoopCredLib::ccDataConnect();
     if ($conn === False) {
         return "Error: ccDataConnect() failed.";
     }
     $ccQ = "SELECT p.programID AS ppID, p.programName, p.tenderType,\n            p.active, p.startDate, p.endDate,\n            p.bankID, p.creditOK, p.inputOK, p.transferOK,\n            m.creditBalance, m.creditLimit, m.creditOK, m.inputOK,\n                m.transferOK, m.isBank\n                ,(m.creditLimit - m.creditBalance) as availCreditBalance\n                ,c.FirstNAme, c.LastName\n            FROM CCredMemberships m\n            JOIN CCredPrograms p\n                ON p.programID = m.programID\n            JOIN {$CORE_LOCAL->get('pDatabase')}.custdata c\n                ON m.cardNo = c.CardNo\n            WHERE m.cardNo =" . $CORE_LOCAL->get("memberID") . " AND c.personNum=1 " . "ORDER BY ppID";
     $ccS = $conn->prepare_statement("{$ccQ}");
     if ($ccS === False) {
         $ret['output'] = DisplayLib::boxMsg("<p>Prep Failed: {$ccQ}</p>", "", True);
         return $ret;
     }
     $args = array();
     $ccR = $conn->exec_statement($ccS, $args);
     if ($ccR === False) {
         $ret['output'] = DisplayLib::boxMsg("<p>Query Failed: {$ccQ}</p>", "", True);
         return $ret;
     }
     if ($conn->num_rows($ccR) == 0) {
         $message = "{$pStyle}Member " . $CORE_LOCAL->get("memberID") . _(" is not registered for any Coop Cred Programs.") . "</p>";
         $ret['output'] = DisplayLib::boxMsg("{$message}", "", True);
         return $ret;
     }
     $pStyle2 = "style='" . "font-weight:bold; " . "text-align:center; " . "margin: 0em 0em 0em -1.0em; " . "'";
     $message = "<p {$pStyle2}>";
     $message .= _("Member") . " #" . $CORE_LOCAL->get("memberID");
     $message .= "<br />" . _("Can spend these amounts of Coop Cred:");
     $message .= "</p>";
     $bStyle3 = "style='" . "margin: 0.25em 0em 0em -3.0em; " . "'";
     $message .= "<div {$bStyle3}>";
     $tableStyle1 = "style='" . "width: 16em; " . "'";
     $rowStyle = "style='vertical-align:top;' ";
     $keyStyle = "style='font-size:0.8em;' ";
     $nameStyle = "style='font-size:0.8em;' ";
     $narrowAmountStyle = "style='text-align:right; font-size:1.2em;' ";
     $wideAmountStyle = "style='text-align:right; font-size:1.1em;' ";
     $notOkStyle = "style='font-size:0.8em;' ";
     $noteStyle = "style='font-size:0.7em;' ";
     $message .= "<table {$tableStyle1} cellpadding=2 cellspacing=0 border=0>";
     while ($row = $conn->fetch_array($ccR)) {
         $programOK = CoopCredLib::programOK($row['tenderType'], $conn);
         if ($programOK === True) {
             $programCode = 'CCred' . $CORE_LOCAL->get("CCredProgramID");
             $subtotals = CoopCredLib::getCCredSubtotals($row['tenderType'], $conn);
             $tenderKeyCap = $CORE_LOCAL->get("{$programCode}tenderKeyCap") != "" ? $CORE_LOCAL->get("{$programCode}tenderKeyCap") : 'CCr' . $CORE_LOCAL->get("CCredProgramID");
             $programBalance = $CORE_LOCAL->get("{$programCode}availBal") ? $CORE_LOCAL->get("{$programCode}availBal") : $CORE_LOCAL->get("{$programCode}availCreditBalance");
             $programBalanceString = sprintf("\$%s", number_format($programBalance, 2));
             $amountStyle = strlen($programBalanceString) <= 9 ? $narrowAmountStyle : $wideAmountStyle;
             $message .= sprintf("%s%s%s%s%s%s%s", "<tr {$rowStyle}><td {$keyStyle}>", "[{$tenderKeyCap}]", "</td><td {$nameStyle}>", $CORE_LOCAL->get("{$programCode}programName"), "</td><td {$amountStyle}>", $programBalanceString, "</td></tr>");
         } else {
             $message .= "<tr><td colspan=99 {$notOkStyle}>" . $programOK . "</td></tr>";
         }
     }
     $note = _("The amounts reflect any tenders of, or inputs to, " . "Coop Cred in the current transaction.");
     $message .= "<tr><td colspan=99 {$noteStyle}>" . $note . "</td></tr>";
     /* Want: self, mode=Print
      */
     $printButton = "<button type='submit' value='" . $CORE_LOCAL->get('memberID') . "' onClick='' " . " title='Not implemented yet' " . ">" . "Print" . "</button>";
     $message .= "<tr><td colspan=99 >" . $printButton . "</td></tr>";
     $message .= "</table>";
     $message .= "</div>";
     $ret['output'] = DisplayLib::boxMsg("{$message}", "", True);
     return $ret;
 }
示例#5
0
文件: PrehLib.php 项目: phpsmith/IS4C
 /**
   Assign store-specific alternate member message line
   @param $store code for the coop
   @param $member CardNo from custdata
   @param $personNumber personNum from custdata
   @param $row a record from custdata
   @param $chargeOk whether member can store-charge purchases
 */
 public static function setAltMemMsg($store, $member, $personNumber, $row, $chargeOk)
 {
     if ($store == 'WEFC_Toronto') {
         /* Doesn't quite allow for StoreCharge/PrePay for regular members
          * either instead of or in addition to CoopCred
          */
         if (isset($row['blueLine'])) {
             $memMsg = $row['blueLine'];
         } else {
             $memMsg = '#' . $member;
         }
         if ($member == CoreLocal::get('defaultNonMem')) {
             CoreLocal::set("memMsg", $memMsg);
             return;
         }
         if ($member < 99000) {
             if (in_array('CoopCred', CoreLocal::get('PluginList'))) {
                 $conn = CoopCredLib::ccDataConnect();
                 if ($conn !== False) {
                     $ccQ = "SELECT p.programID AS ppID, p.programName, p.tenderType,\n                        p.active, p.startDate, p.endDate,\n                        p.bankID, p.creditOK, p.inputOK, p.transferOK,\n                        m.creditBalance, m.creditLimit, m.creditOK, m.inputOK,\n                            m.transferOK, m.isBank\n                            ,(m.creditLimit - m.creditBalance) as availCreditBalance\n                        FROM CCredMemberships m\n                        JOIN CCredPrograms p\n                            ON p.programID = m.programID\n                            WHERE m.cardNo =?" . " ORDER BY ppID";
                     $ccS = $conn->prepare_statement("{$ccQ}");
                     if ($ccS === False) {
                         CoreLocal::set("memMsg", $memMsg . "Prep failed");
                         return;
                     }
                     $args = array();
                     $args[] = $member;
                     $ccR = $conn->exec_statement($ccS, $args);
                     if ($ccR === False) {
                         CoreLocal::set("memMsg", $memMsg . "Query failed");
                         return;
                     }
                     if ($conn->num_rows($ccR) == 0) {
                         CoreLocal::set("memMsg", $memMsg);
                         return;
                     }
                     $message = "";
                     while ($row = $conn->fetch_array($ccR)) {
                         $programOK = CoopCredLib::programOK($row['tenderType'], $conn);
                         if ($programOK === True) {
                             $programCode = 'CCred' . CoreLocal::get("CCredProgramID");
                             $tenderKeyCap = CoreLocal::get("{$programCode}tenderKeyCap") != "" ? CoreLocal::get("{$programCode}tenderKeyCap") : 'CCr' . CoreLocal::get("CCredProgramID");
                             $programBalance = CoreLocal::get("{$programCode}availBal") ? CoreLocal::get("{$programCode}availBal") : CoreLocal::get("{$programCode}availCreditBalance");
                             $message .= " {$tenderKeyCap}: " . number_format($programBalance, 2);
                         } else {
                             $message .= $row['tenderType'] . " not OK";
                         }
                     }
                     if ($message != "") {
                         CoreLocal::set("memMsg", $memMsg . "{$message}");
                         return;
                     }
                 }
             }
             if ($chargeOk == 1) {
                 $conn = Database::pDataConnect();
                 $query = "SELECT ChargeLimit AS CLimit\n                    FROM custdata\n                    WHERE personNum=1 AND CardNo = {$member}";
                 $table_def = $conn->table_definition('custdata');
                 // 3Jan14 schema may not have been updated
                 if (!isset($table_def['ChargeLimit'])) {
                     $query = str_replace('ChargeLimit', 'MemDiscountLimit', $query);
                 }
                 $result = $conn->query($query);
                 $num_rows = $conn->num_rows($result);
                 if ($num_rows > 0) {
                     $row2 = $conn->fetch_array($result);
                 } else {
                     $row2 = array();
                 }
                 if (isset($row2['CLimit'])) {
                     $limit = 1.0 * $row2['CLimit'];
                 } else {
                     $limit = 0.0;
                 }
                 // Prepay
                 if ($limit == 0.0) {
                     CoreLocal::set("memMsg", $memMsg . _(' : Pre Pay: $') . number_format((double) CoreLocal::get("availBal") * 1, 2));
                     // Store Charge
                 } else {
                     CoreLocal::set("memMsg", $memMsg . _(' : Store Charge: $') . number_format((double) CoreLocal::get("availBal") * 1, 2));
                 }
             }
             // Intra-coop transfer
         } else {
             CoreLocal::set("memMsg", $memMsg);
             CoreLocal::set("memMsg", $memMsg . _(' : Intra Coop spent: $') . number_format((double) CoreLocal::get("balance") * 1, 2));
         }
         // WEFC_Toronto
     }
     //return $ret;
 }
示例#6
0
 public function plugin_transaction_reset()
 {
     global $CORE_LOCAL;
     $dbc = CoopCredLib::ccDataConnect();
     if ($dbc === False) {
         return False;
     }
     if (!$dbc->table_exists("CCredPrograms")) {
         $dbc->logger("Table CCredPrograms does not exist.");
         return False;
     }
     $q = "SELECT MAX(programID) maxpid FROM CCredPrograms";
     $s = $dbc->prepare("{$q}");
     $r = $dbc->execute($s, array());
     $maxPID = 0;
     foreach ($r as $row) {
         $maxPID = $row['maxpid'];
         break;
     }
     if ($maxPID > 0) {
         $ccNames = array('programID', 'programName', 'paymentDepartment', 'paymentName', 'paymentKeyCap', 'tenderType', 'tenderName', 'tenderKeyCap', 'memChargeTotal', 'availBal', 'availCreditBalance', 'chargeTotal', 'paymentTotal', 'balance', 'creditBalance');
         if ($CORE_LOCAL->get('CCredProgramCode') != '') {
             $CORE_LOCAL->set('CCredProgramCode', '');
         }
         if ($CORE_LOCAL->get('CCredProgramID') != '') {
             $CORE_LOCAL->set('CCredProgramID', 0);
         }
         if ($CORE_LOCAL->get('CCredTendersUsed') != '') {
             $CORE_LOCAL->set('CCredTendersUsed', '');
         }
         if ($CORE_LOCAL->get('CCredDepartmentsUsed') != '') {
             $CORE_LOCAL->set('CCredDepartmentsUsed', '');
         }
         /* E.g. "CCred3programName"
          */
         for ($pid = 1; $pid <= $maxPID; $pid++) {
             foreach ($ccNames as $name) {
                 $var = "CCred{$pid}{$name}";
                 if (is_numeric($CORE_LOCAL->get("{$var}"))) {
                     //$varVal = $CORE_LOCAL->get("$var");
                     //$dbc->logger("Set $var of >{$varVal}< to 0.");
                     $CORE_LOCAL->set("{$var}", 0);
                 } elseif ($CORE_LOCAL->get("{$var}") != '') {
                     //$varVal = $CORE_LOCAL->get("$var");
                     //$dbc->logger("Set $var of >{$varVal}< to ''.");
                     $CORE_LOCAL->set("{$var}", '');
                 } else {
                     //$dbc->logger("For $var do nothing.");
                     1;
                 }
             }
         }
         /* Check that no CCred session vars are other than 0/"".
          */
         $sss = 0;
         foreach (array_keys($_SESSION) as $key) {
             if (preg_match("/^CCred/", $key)) {
                 // If it's not '' and not 0
                 if ($CORE_LOCAL->get("{$key}")) {
                     $sss++;
                     $dbc->logger("Still {$key} >" . $CORE_LOCAL->get("{$key}") . '<');
                 }
             }
         }
         //$dbc->logger("sss: $sss");
     }
     return True;
     // plugin_transaction_reset()
 }
示例#7
0
 /**
   Generate the message
   @param $val the value returned by the object's select_condition()
   @param $ref a transaction reference (emp-lane-trans)
   @param $reprint boolean
   @return [string] message to print on receipt
 */
 public function message($val, $ref, $reprint = False)
 {
     global $CORE_LOCAL;
     if ($val == 0) {
         return '';
     }
     $lineStart = "";
     $lineEnd = "\n";
     $conn = CoopCredLib::ccDataConnect();
     if ($conn === False) {
         return "Error: ccDataConnect() failed." . $lineEnd;
     }
     $dateTimeStamp = time();
     $date = ReceiptLib::build_time($dateTimeStamp);
     $projectName = _('Coop Cred');
     $itemSeparator = '';
     for ($i = 1; $i <= 2; $i++) {
         $itemSeparator .= $lineEnd;
     }
     $slip = $itemSeparator;
     $programsReported = array();
     $tu = $CORE_LOCAL->get('CCredTendersUsed');
     if (is_array($tu)) {
         foreach ($tu as $tTender => $tProgramID) {
             if (in_array($tProgramID, $programsReported)) {
                 continue;
             } else {
                 $programsReported[] = $tProgramID;
             }
             $programCode = "CCred{$tProgramID}";
             $programName = $CORE_LOCAL->get("{$programCode}programName");
             $subs = CoopCredLib::getCCredSubtotals($tTender, $conn, $programCode, 'localtranstoday', $ref);
             if ($subs !== True) {
                 return "Error: Coop Cred Program " . $tProgramID . " subtotals.";
             }
             $acb = $CORE_LOCAL->get("{$programCode}availBal") != '' ? $CORE_LOCAL->get("{$programCode}availBal") : _("Balance not available.");
             $slip .= sprintf("%s: %s %s: \$ %s%s", $projectName, $programName, _("Remaining"), $acb, $lineEnd . $lineEnd);
             // each tender
         }
     }
     $du = $CORE_LOCAL->get('CCredDepartmentsUsed');
     if (is_array($du)) {
         foreach ($du as $dDepartment => $dProgramID) {
             if (in_array($dProgramID, $programsReported)) {
                 continue;
             } else {
                 $programsReported[] = $dProgramID;
             }
             $programCode = "CCred{$dProgramID}";
             $programName = $CORE_LOCAL->get("{$programCode}programName");
             $pcTenderType = $CORE_LOCAL->get("{$programCode}tenderType");
             $subs = CoopCredLib::getCCredSubtotals($pcTenderType, $conn, $programCode, 'localtranstoday', $ref);
             if ($subs !== True) {
                 return "Error: Coop Cred Program " . $dProgramID . " subtotals.";
             }
             $acb = $CORE_LOCAL->get("{$programCode}availBal") != '' ? $CORE_LOCAL->get("{$programCode}availBal") : _("Balance not available.");
             $slip .= sprintf("%s: %s %s: \$ %s%s", $projectName, $programName, _("Remaining"), $acb, $lineEnd . $lineEnd);
             // each department
         }
     }
     return $slip;
 }