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 .= ' '; $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; }
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(); } }
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; }