コード例 #1
0
 public function post_id_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $prep = $dbc->prepare('
         INSERT INTO patronage
         (cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY)
         SELECT cardno,
             purchase,
             discounts,
             rewards,
             net_purch,
             ?,
             ?,
             ?,
             FY
         FROM patronage_workingcopy
         WHERE FY=?
             AND cardno=?');
     $args = array(FormLib::get('cash') + FormLib::get('retain'), FormLib::get('cash'), FormLib::get('retain'), FormLib::get('fy'), $this->id);
     $this->success = $dbc->execute($prep, $args);
     if ($this->success) {
         $pat = new PatronageModel($dbc);
         $pat->cardno($this->id);
         $pat->FY(FormLib::get('fy'));
         $number = GumLib::allocateCheck($patronage, false);
         $dbc = FannieDB::get($FANNIE_OP_DB);
         $pat->check_number($number);
         $pat->save();
     }
     return true;
 }
コード例 #2
0
ファイル: GumEquityPayoffPage.php プロジェクト: phpsmith/IS4C
 public function get_id_handler()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $this->payoff = new GumEquitySharesModel($dbc);
     $this->payoff->gumEquityShareID($this->id);
     if (!$this->payoff->load()) {
         echo _('Error: payoff') . ' #' . $this->id . ' ' . _('does not exist');
         return false;
     }
     $this->all = new GumEquitySharesModel($dbc);
     $this->all->card_no($this->payoff->card_no());
     $bridge = GumLib::getSetting('posLayer');
     $this->custdata = $bridge::getCustdata($this->payoff->card_no());
     $this->meminfo = $bridge::getMeminfo($this->payoff->card_no());
     // bridge may change selected database
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $this->taxid = new GumTaxIdentifiersModel($dbc);
     $this->taxid->card_no($this->payoff->card_no());
     $this->check_info = new GumPayoffsModel($dbc);
     $map = new GumEquityPayoffMapModel($dbc);
     $map->gumEquityShareID($this->id);
     $payoff_id = false;
     foreach ($map->find('gumPayoffID', true) as $obj) {
         // get highest matching ID
         $payoff_id = $obj->gumPayoffID();
         break;
     }
     // none found, allocate new check
     if ($payoff_id === false) {
         $payoff_id = GumLib::allocateCheck($map);
         if ($payoff_id) {
             $this->check_info->gumPayoffID($payoff_id);
             $this->check_info->amount(-1 * $this->payoff->value());
             $this->check_info->issueDate(date('Y-m-d'));
             $this->check_info->save();
             $this->check_info->load();
         }
     } else {
         $this->check_info->gumPayoffID($payoff_id);
         $this->check_info->load();
     }
     $this->settings = new GumSettingsModel($dbc);
     return true;
 }
コード例 #3
0
 public function report_content()
 {
     if (FormLib::get('excel') == '1099') {
         $data = $this->fetch_report_data();
         $pdf = new FPDF('P', 'mm', 'Letter');
         $bridge = GumLib::getSetting('posLayer');
         $year = date('Y', strtotime(FormLib::get('endDate')));
         foreach ($data as $row) {
             $custdata = $bridge::getCustdata($row[0]);
             $meminfo = $bridge::getMeminfo($row[0]);
             $ssn = $row[10] == 'No key' ? $row[9] : $row[10];
             $amount = array(1 => $row[8]);
             $form = new GumTaxFormTemplate($custdata, $meminfo, $ssn, $tax_year, $amount);
             $pdf->addPage();
             $form->renderAsPDF($pdf, 15);
         }
         $pdf->Output('taxform.pdf', 'I');
     } else {
         return parent::report_content();
     }
 }
コード例 #4
0
ファイル: GumLoanPayoffPage.php プロジェクト: phpsmith/IS4C
 public function get_id_view()
 {
     global $FANNIE_URL;
     $ret = '';
     $ret .= '<input onclick="location=\'GumLoanPayoffPage.php?id=' . $this->id . '&pdf=1\'; return false;"
                 type="button" value="Print" />';
     $ret .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
     $ret .= sprintf('<label for="issueCheckbox">Check has been issued</label> 
                     <input type="checkbox" onclick="return issueWarning();"
                     onchange="issueCheck(\'%s\');" id="issueCheckbox" %s />
                     <span id="issueDate">%s</span>', $this->id, $this->check_info->checkIssued() ? 'checked disabled' : '', $this->check_info->checkIssued() ? $this->check_info->issueDate() : '');
     $this->add_script('js/loan_payoff.js');
     if (file_exists('img/letterhead.png')) {
         $ret .= '<img src="img/letterhead.png" style="width: 100%;" />';
     }
     $ret .= '<p>Pursuant to the terms of your Promissory Note with WFC, below please find a check for the principal and, as applicable, compound interest due.   A statement showing the terms of your loan and annual compounding of the interest thereon is provided. If your loan was for more than 0.00% interest, also below is an IRS form 1099-INT to be included with your ' . date('Y') . ' federal tax filing.  If you have questions regarding this payment, please contact Financial Manager Dale Maiers (dmaiers@wholefoods.coop).  Thank you very much for your support.</p>';
     $ret .= '<div>';
     $ret .= '<table style="border: solid 1px black; border-collapse: collapse; width: 20%; float:left;">';
     $ret .= '<tr><td style="text-align:center; border: solid 1px black;"><b>Loan Amount</b><br />';
     $ret .= number_format($this->loan->principal(), 2);
     $ret .= '</td></tr>';
     $ret .= '<tr><td style="text-align:center; border: solid 1px black;"><b>Term</b><br />';
     $ret .= $this->loan->termInMonths() / 12 . ' Years';
     $ret .= '</td></tr>';
     $ret .= '<tr><td style="text-align:center; border: solid 1px black;"><b>Loan Date</b><br />';
     $ret .= date('m/d/Y', strtotime($this->loan->loanDate()));
     $ret .= '</td></tr>';
     $ret .= '<tr><td style="text-align:center; border: solid 1px black;"><b>Interest Rate</b><br />';
     $ret .= $this->loan->interestRate() * 100 . '%';
     $ret .= '</td></tr>';
     $ld = strtotime($this->loan->loanDate());
     $ed = mktime(0, 0, 0, date('n', $ld) + $this->loan->termInMonths(), date('j', $ld), date('Y', $ld));
     $ret .= '<tr><td style="text-align:center; border: solid 1px black;"><b>Maturity Date</b><br />';
     $ret .= date('m/d/Y', $ed);
     $ret .= '</td></tr>';
     $ret .= '</table>';
     $loan_info = GumLib::loanSchedule($this->loan);
     $ret .= '<table style="width: 75%; float: left;">';
     $ret .= '<tr>
             <td style="font-weight: bold; text-decoration: underline; text-align:center;">Ending Period</td>
             <td style="font-weight: bold; text-decoration: underline; text-align:center;">Days</td>
             <td style="font-weight: bold; text-decoration: underline; text-align:right;">Interest</td>
             <td style="font-weight: bold; text-decoration: underline; text-align:right;">Closing Balance</td>
             </tr>';
     foreach ($loan_info['schedule'] as $year) {
         $ret .= sprintf('<tr>
                         <td style="text-align:center;">%s</td>
                         <td style="text-align:center;">%s</td>
                         <td style="text-align:right;">%s</td>
                         <td style="text-align:right;">%s</td>
                         </tr>', $year['end_date'], $year['days'], number_format($year['interest'], 2), number_format($year['balance'], 2));
     }
     $ret .= sprintf('<tr>
                         <td style="text-align:right;">Total</td>
                         <td style="text-align:right;">%s</td>
                         <td style="text-align:right;">%s</td>
                         <td style="text-align:right;">%s</td>
                         </tr>', number_format($this->loan->principal(), 2), number_format($loan_info['total_interest'], 2), number_format($loan_info['balance'], 2));
     $ret .= '</table>';
     $ret .= '</div>';
     $ret .= '<div style="clear: left;"></div>';
     $ret .= '<hr />';
     $fields = array(1 => $loan_info['balance']);
     $this->settings->key('storeStateID');
     if ($this->settings->load()) {
         $fields[12] = $this->settings->value();
     }
     $this->settings->key('storeState');
     if ($this->settings->load()) {
         $fields[11] = $this->settings->value();
     }
     $ssn = 'Unknown';
     if ($this->taxid->load()) {
         $ssn = 'xxx-xx-' . $this->taxid->maskedTaxIdentifier();
     }
     $form = new GumTaxFormTemplate($this->custdata, $this->meminfo, $ssn, date('Y'), $fields, $this->loan->accountNumber());
     $ret .= $form->renderAsHTML();
     $ret .= '<hr />';
     $check = new GumCheckTemplate($this->custdata, $this->meminfo, $loan_info['balance'], 'Loan Repayment', $this->check_info->checkNumber());
     $ret .= $check->renderAsHTML();
     return $ret;
 }
コード例 #5
0
ファイル: GumSendStatements.php プロジェクト: phpsmith/IS4C
<?php

/**
  Script to email end of fiscal year statements
  to all loan account holders
*/
if (basename(__FILE__) != basename($_SERVER['PHP_SELF'])) {
    return;
}
if (php_sapi_name() != 'cli') {
    return;
}
include dirname(__FILE__) . '/../../../../config.php';
if (!class_exists('FannieAPI')) {
    include $FANNIE_ROOT . 'classlib2.0/FannieAPI.php';
}
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
$endFY = mktime(0, 0, 0, GumLib::getSetting('FYendMonth'), GumLib::getSetting('FYendDay'), date('Y'));
echo "Sending statements for " . date('Y-m-d', $endFY) . "\n";
$url = 'http://localhost' . $FANNIE_URL . 'modules/plugins2.0/GiveUsMoneyPlugin/GumEmailPage.php';
$loans = new GumLoanAccountsModel($dbc);
// GumLoanAccounts.loanDate < end of fiscal year
$loans->loanDate(date('Y-m-d 00:00:00', $endFY), '<');
foreach ($loans->find('loanDate') as $loan) {
    echo 'Sending account# ' . $loan->accountNumber() . ' ' . $loan->loanDate() . "\n";
    $qs = '?id=' . $loan->accountNumber() . '&loanstatement=1';
    $ch = curl_init($url . $qs);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);
}
コード例 #6
0
ファイル: GumEmailPage.php プロジェクト: phpsmith/IS4C
 public function get_id_dreceipt_did_handler()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
     $bridge = GumLib::getSetting('posLayer');
     $this->custdata = $bridge::getCustdata($this->id);
     $this->meminfo = $bridge::getMeminfo($this->id);
     $uid = FannieAuth::getUID($this->current_user);
     // bridge may change selected database
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $model = new GumDividendsModel($dbc);
     $model->gumDividendID($this->did);
     $model->load();
     $msg = 'Dear ' . $this->custdata->FirstName() . ' ' . $this->custdata->LastName() . ',' . "\n";
     $msg .= "\n";
     $msg .= 'Attached is a 1099 for the Class C dividend issued ' . date('Y-m-d', strtotime($model->yearEndDate())) . "\n";
     $msg .= wordwrap('Whole Foods Co-op recognizes and thanks you for your support and purchase of Class C Stock. It is important that we maintain your current contact information so that we can deliver any dividends you may earn. Please reply to this email or to finance@wholefoods.coop with any questions or concerns. Or you may also call 218-728-0884, ask for Finance, and we will gladly assist you.') . "\n";
     $msg .= "\n";
     $msg .= 'Dale Maiers' . "\n";
     $msg .= 'Finance Manager' . "\n";
     $subject = 'SAMPLE WFC Owner Financing: Class C Stock Dividend';
     $to = $this->meminfo->email_1();
     $mail = new PHPMailer();
     $mail->From = '*****@*****.**';
     $mail->FromName = 'Whole Foods Co-op';
     $mail->AddAddress('*****@*****.**');
     $mail->AddAddress('*****@*****.**');
     $mail->Subject = $subject;
     $mail->Body = $msg;
     $year = date('Y', strtotime($model->yearEndDate()));
     $taxID = new GumTaxIdentifiersModel($dbc);
     $taxID->card_no($this->id);
     $taxID->load();
     $ssn = 'n/a';
     if ($taxID->maskedTaxIdentifier() != '') {
         $ssn = 'xxx-xx-' . $taxID->maskedTaxIdentifier();
     }
     $amount = array(1 => $model->dividendAmount());
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->AddPage();
     $form = new GumTaxFormTemplate($this->custdata, $this->meminfo, $ssn, $year, $amount);
     $form->renderAsPDF($pdf, 15);
     $raw_pdf = $pdf->Output('wfc.pdf', 'S');
     $mail->AddStringAttachment($raw_pdf, 'wfc.pdf', 'base64', 'application/pdf');
     if ($mail->Send()) {
         header('Location: GumEmailPage.php?id=' . $this->id);
     } else {
         echo $mail->ErrorInfo;
     }
     return false;
 }
コード例 #7
0
ファイル: GumTaxIdPage.php プロジェクト: phpsmith/IS4C
 public function get_id_handler()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $this->ssn_model = new GumTaxIdentifiersModel($dbc);
     $this->ssn_model->card_no($this->id);
     $bridge = GumLib::getSetting('posLayer');
     $this->custdata = $bridge::getCustdata($this->id);
     // bridge may change selected database
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $this->settings = new GumSettingsModel($dbc);
     return true;
 }
コード例 #8
0
ファイル: GumMainPage.php プロジェクト: phpsmith/IS4C
 public function get_id_handler()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
     $bridge = GumLib::getSetting('posLayer');
     $this->custdata = $bridge::getCustdata($this->id);
     if ($this->custdata === false) {
         echo _('Error: member') . ' ' . $this->id . ' ' . _('does not exist');
         return false;
     }
     $this->meminfo = $bridge::getMeminfo($this->id);
     // bridge may change selected database
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     $this->loans = new GumLoanAccountsModel($dbc);
     $this->loans->card_no($this->id);
     $this->equity = new GumEquitySharesModel($dbc);
     $this->equity->card_no($this->id);
     $this->taxid = new GumTaxIdentifiersModel($dbc);
     $this->taxid->card_no($this->id);
     $this->terms = new GumLoanValidTermsModel($dbc);
     $this->settings = new GumSettingsModel($dbc);
     return true;
 }
コード例 #9
0
 function post_printFY_handler()
 {
     global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB, $FANNIE_ROOT;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
     if (!class_exists('FPDF')) {
         include $FANNIE_ROOT . 'src/fpdf/fpdf.php';
         define('FPDF_FONTPATH', 'font/');
     }
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->SetMargins(6.35, 6.35, 6.35);
     // quarter-inch margins
     $pdf->SetAutoPageBreak(false);
     $key = FormLib::get('key');
     $privkey = false;
     if ($key) {
         $privkey = openssl_pkey_get_private($key);
     }
     $map = new GumDividendPayoffMapModel($dbc);
     $bridge = GumLib::getSetting('posLayer');
     $dividends = new GumDividendsModel($dbc);
     $dividends->yearEndDate($this->printFY);
     $acc = array();
     $prevCN = -1;
     $combined = array();
     foreach ($dividends->find('card_no') as $dividend) {
         if (!isset($combined[$dividend->card_no()])) {
             $combined[$dividend->card_no()] = array();
         }
         $combined[$dividend->card_no()][] = $dividend;
     }
     foreach ($combined as $card_no => $acc) {
         if (!empty($acc)) {
             $ttl = 0.0;
             // roll up totals to a single amount
             foreach ($acc as $a) {
                 $ttl += $a->dividendAmount();
             }
             // lookup check
             $map->reset();
             $map->gumDividendID($acc[0]->gumDividendID());
             $checkID = false;
             foreach ($map->find('gumPayoffID', true) as $obj) {
                 $checkID = $obj->gumPayoffID();
                 break;
             }
             if ($checkID) {
                 $check = new GumPayoffsModel($dbc);
                 $check->gumPayoffID($checkID);
                 $check->load();
             } else {
                 // allocate a new check if needed
                 $checkID = GumLib::allocateCheck($map);
                 $check = new GumPayoffsModel($dbc);
                 $check->gumPayoffID($checkID);
                 $check->load();
                 $check->amount($ttl);
                 $check->save();
                 // map rolled up dividends to same check
                 foreach ($acc as $a) {
                     $map->gumDividendID($a->gumDividendID());
                     $map->gumPayoffID($checkID);
                     $map->save();
                 }
             }
             $pdf->AddPage();
             $custdata = $bridge::getCustdata($card_no);
             $meminfo = $bridge::getMeminfo($card_no);
             // bridge may change selected database
             $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
             $this->taxid = new GumTaxIdentifiersModel($dbc);
             $this->taxid->card_no($custdata->CardNo());
             $ssn = 'Unknown';
             if ($this->taxid->load()) {
                 $ssn = 'xxx-xx-' . $this->taxid->maskedTaxIdentifier();
                 if ($privkey) {
                     $try = openssl_private_decrypt($this->taxid->encryptedTaxIdentifier(), $decrypted, $privkey);
                     if ($try) {
                         $ssn = $decrypted;
                     }
                 }
             }
             $form = new GumTaxDividendFormTemplate($custdata, $meminfo, $ssn, date('Y'), array(1 => sprintf('%.2f', $ttl)));
             $ret .= $form->renderAsPDF($pdf, 105);
             $template = new GumCheckTemplate($custdata, $meminfo, $ttl, 'Dividend Payment', $check->checkNumber());
             $template->renderAsPDF($pdf);
             $check->checkIssued(1);
             $check->issueDate(date('Y-m-d H:i:s'));
             $check->save();
             $pdf->Image('img/new_letterhead.png', 10, 10, 35);
             if (!isset($pdf->fonts['gillsansmtpro-book'])) {
                 $pdf->AddFont('GillSansMTPro-Book', '', 'GillSansMTPro-Book.php');
             }
             $pdf->SetFont('GillSansMTPro-Book', '', 11);
             $l = 55;
             $pdf->SetXY($l, 20);
             $pdf->Cell(0, 5, date('j F Y'), 0, 1);
             $pdf->Ln(5);
             $pdf->SetX($l);
             $pdf->Cell(0, 5, 'Dear Owner:', 0, 1);
             $pdf->Ln(2);
             $pdf->SetX($l);
             $pdf->MultiCell(135, 5, 'Based on the Co-op\'s profitability in Fiscal Year 2015 (July 1, 2014-June 30, 2015), the Board of Directors approved a four percent (4%) dividend on your Class C equity investment. Your dividend is pro-rated based on when you made your investment during that fiscal year. As this check represents an annual return on your investment, the amount cannot be compounded.');
             $pdf->Ln(2);
             $pdf->SetX($l);
             $pdf->MultiCell(135, 5, 'You are welcome to cash your check toward a purchase at the Co-op. Thank you for investing in Whole Foods Co-op');
             $pdf->Ln(4);
             $pdf->SetX($l);
             $pdf->Cell(0, 5, 'Thank you,', 0, 1);
             $pdf->Ln(4);
             $pdf->SetX($l);
             $pdf->Cell(0, 5, 'Sharon Murphy', 0, 1);
             $pdf->Ln(2);
             $pdf->SetX($l);
             $pdf->Cell(0, 5, 'General Manager', 0, 1);
         }
     }
     $pdf->Output('Dividends.pdf', 'I');
     return false;
 }
コード例 #10
0
ファイル: GumSchedulePage.php プロジェクト: phpsmith/IS4C
 public function get_id_view()
 {
     global $FANNIE_URL;
     $ret = '';
     $ret .= '<table id="infoTable" cellspacing="0" cellpadding="4">';
     $ret .= '<tr>';
     $ret .= '<td class="right">First Name</td><td class="left">' . $this->custdata->FirstName() . '</td>';
     $ssn = 'Unknown';
     if ($this->taxid->load()) {
         $ssn = 'xxx-xx-' . $this->taxid->maskedTaxIdentifier();
     }
     $ret .= '<td class="right">Social Security Number</td><td class="left">' . $ssn . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td>Last Name</td><td>' . $this->custdata->LastName() . '</td>';
     $ret .= '<td>Loan Amount</td><td>' . number_format($this->loan->principal(), 2) . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td>Address</td><td>' . $this->meminfo->street() . '</td>';
     $ldate = strtotime($this->loan->loanDate());
     $ret .= '<td>Loan Date</td><td>' . date('m/d/Y', $ldate) . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td>City</td><td>' . $this->meminfo->city() . '</td>';
     $ret .= '<td>Term</td><td>' . $this->loan->termInMonths() / 12 . ' Years</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td>State</td><td>' . $this->meminfo->state() . '</td>';
     $ret .= '<td>Interest Rate</td><td>' . number_format($this->loan->interestRate() * 100, 2) . '%</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td>Zip Code</td><td>' . $this->meminfo->zip() . '</td>';
     $enddate = mktime(0, 0, 0, date('n', $ldate) + $this->loan->termInMonths(), date('j', $ldate), date('Y', $ldate));
     $ret .= '<td>Maturity Date</td><td>' . date('m/d/Y', $enddate) . '</td>';
     $ret .= '</tr>';
     $ret .= '</table>';
     $ret .= '<hr />';
     $ret .= '<table id="scheduleTable" cellspacing="0" cellpadding="4">';
     $ret .= '<tr><td class="header"colspan="4">Schedule</td></tr>';
     $ret .= '<tr class="subheader">';
     $ret .= '<td>Year Ending</td><td>Days</td><td>Interest</td><td>Balance</td>';
     $ret .= '</tr>';
     $loan_info = GumLib::loanSchedule($this->loan);
     foreach ($loan_info['schedule'] as $period) {
         $ret .= $this->printRow($period);
     }
     $ret .= '<tr class="subheader">';
     $ret .= '<td>Balance</td>';
     $ret .= '<td>' . number_format($this->loan->principal(), 2) . '</td>';
     $ret .= '<td class="moneyfield">' . number_format($loan_info['total_interest'], 2) . '</td>';
     $ret .= '<td class="moneyfield">' . number_format($loan_info['balance'], 2) . '</td>';
     $ret .= '</tr>';
     $ret .= '</table>';
     return $ret;
 }
コード例 #11
0
ファイル: GumPromissoryPage.php プロジェクト: phpsmith/IS4C
 public function get_id_view()
 {
     global $FANNIE_URL;
     $ret = '';
     $ret .= '<input onclick="location=\'GumPromissoryPage.php?id=' . $this->id . '&pdf=1\'; return false;"
                 type="button" value="Print" /><br />';
     if (file_exists('img/letterhead.png')) {
         $ret .= '<img src="img/letterhead.png" style="width: 100%;" />';
     }
     $ret .= '<table id="infoTable" cellspacing="0" cellpadding="4">';
     $ret .= '<tr>';
     $ret .= '<td class="header top left right">Lender</td>';
     $ret .= '<td class="header top right">Borrower</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left right">' . $this->custdata->FirstName() . ' ' . $this->custdata->LastName() . '</td>';
     $ret .= '<td class="right">' . $this->my_address[0] . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left right">' . $this->meminfo->street() . '</td>';
     $ret .= '<td class="right">' . $this->my_address[1] . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left right">' . $this->meminfo->city() . ', ' . $this->meminfo->state() . ' ' . $this->meminfo->zip() . '</td>';
     $ret .= '<td class="right">' . $this->my_address[2] . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ssn = 'Unknown';
     if ($this->taxid->load()) {
         $ssn = 'xxx-xx-' . $this->taxid->maskedTaxIdentifier();
     }
     $ret .= '<td class="left right bottom">' . $ssn . '</td>';
     $tax_id = GumLib::getSetting('storeFederalID', 'xx-xxxxxxx');
     $ret .= '<td class="right bottom">' . $tax_id . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr><td class="noborder" colspan="2">&nbsp;</td></tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left top">Owner #: ' . $this->loan->card_no() . '</td>';
     $ret .= '<td class="right top">Account #: ' . $this->loan->accountNumber() . '</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left">Loan Date: ' . date('m/d/Y', strtotime($this->loan->loanDate())) . '</td>';
     $ret .= '<td class="right">Interest Rate: ' . number_format($this->loan->interestRate() * 100, 2) . '%</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left bottom">Principal Sum: $' . number_format($this->loan->principal(), 2) . '</td>';
     $ld = strtotime($this->loan->loanDate());
     $ret .= '<td class="right bottom">Maturity Date: ' . date('m/d/Y', mktime(0, 0, 0, date('n', $ld) + $this->loan->termInMonths(), date('j', $ld), date('Y', $ld))) . '</td>';
     $ret .= '</tr>';
     foreach ($this->paragraphs as $p) {
         $ret .= '<tr><td class="paragraph" colspan="2">' . $p . '</td></tr>';
     }
     $ret .= '<tr>';
     $ret .= '<td class="top left right header">Lender Signature</td>';
     $ret .= '<td class="top right header">Borrower Signature</td>';
     $ret .= '</tr>';
     $ret .= '<tr>';
     $ret .= '<td class="left right bottom">&nbsp;<br />&nbsp;</td>';
     $ret .= '<td class="right bottom">&nbsp;<br />&nbsp;</td>';
     $ret .= '</tr>';
     $ret .= '</table>';
     return $ret;
 }
コード例 #12
-1
ファイル: PatronageChecks.php プロジェクト: phpsmith/IS4C
 public function post_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $fy = FormLib::get('fy');
     $per_page = FormLib::get('per_page');
     $custdata = new CustdataModel($dbc);
     $meminfo = new MeminfoModel($dbc);
     $query = $dbc->prepare('
         SELECT p.cardno,
             p.cash_pat,
             m.zip,
             p.check_number
         FROM patronage AS p
             INNER JOIN meminfo AS m ON p.cardno=m.card_no
             INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
         WHERE p.FY=?
         ORDER BY m.zip,
             c.LastName,
             c.FirstName');
     $result = $dbc->execute($query, array($fy));
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->SetMargins(6.35, 6.35, 6.35);
     // quarter-inch margins
     $pdf->SetAutoPageBreak(false);
     $filename = '';
     $this->files = array();
     $filenumber = 1;
     set_time_limit(0);
     while ($w = $dbc->fetch_row($result)) {
         if (empty($filename)) {
             $filename = $filenumber . '-' . substr($w['zip'], 0, 5);
         }
         $dbc = FannieDB::get($FANNIE_OP_DB);
         $custdata->CardNo($w['cardno']);
         $custdata->personNum(1);
         $custdata->load();
         $meminfo->card_no($w['cardno']);
         $meminfo->load();
         if ($w['check_number'] == '') {
             $patronage = new PatronageModel($dbc);
             $patronage->cardno($w['cardno']);
             $patronage->FY($fy);
             $number = GumLib::allocateCheck($patronage, false);
             $dbc = FannieDB::get($FANNIE_OP_DB);
             $patronage->check_number($number);
             $patronage->save();
             $w['check_number'] = $number;
         }
         $pdf->AddPage();
         $pdf->Image('rebate_body.png', 10, 0, 190);
         $check = new GumCheckTemplate($custdata, $meminfo, $w['cash_pat'], 'Rebate ' . $fy, $w['check_number']);
         $check->renderAsPDF($pdf);
         if ($pdf->PageNo() == $per_page) {
             $filename .= '-' . substr($w['zip'], 0, 5) . '.pdf';
             $filenumber++;
             $pdf->Output('/tmp/' . $filename, 'F');
             $this->files[] = $filename;
             $filename = '';
             $pdf = new FPDF('P', 'mm', 'Letter');
             $pdf->SetMargins(6.35, 6.35, 6.35);
             // quarter-inch margins
             $pdf->SetAutoPageBreak(false);
         }
     }
     $filename .= '-End.pdf';
     $pdf->Output('/tmp/' . $filename, 'F');
     $this->files[] = $filename;
     return true;
 }