예제 #1
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;
 }