Esempio n. 1
1
 public function get_id_pdf_handler()
 {
     global $FANNIE_ROOT;
     if (!class_exists('FPDF')) {
         include $FANNIE_ROOT . 'src/fpdf/fpdf.php';
         define('FPDF_FONTPATH', 'font/');
     }
     $this->get_id_handler();
     // load models
     $loan_info = GumLib::loanSchedule($this->loan);
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->SetMargins(6.35, 6.35, 6.35);
     // quarter-inch margins
     $pdf->SetAutoPageBreak(false);
     $pdf->AddPage();
     $pdf->SetXY(0, 0);
     $pdf->Image('img/letterhead.png', null, null, 203);
     // scale to 8"
     $pdf->SetFont('Arial', '', 8);
     $line_height = 3.5;
     $pdf->SetXY(6.35, 43);
     $text = '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.';
     $pdf->Write($line_height, $text);
     $col_width = 40.64;
     $col1 = 6.35 + $col_width;
     $col2 = $col1 + $col_width;
     $col3 = $col2 + $col_width;
     $col4 = $col3 + $col_width;
     $table_y = 60;
     $pdf->SetFont('Arial', 'BU', 8);
     $pdf->SetXY($col1, $table_y);
     $pdf->Cell($col_width, $line_height, 'Ending Period', 0, 0, 'C');
     $pdf->SetXY($col2, $table_y);
     $pdf->Cell($col_width, $line_height, 'Days', 0, 0, 'C');
     $pdf->SetXY($col3, $table_y);
     $pdf->Cell($col_width, $line_height, 'Interest', 0, 0, 'R');
     $pdf->SetXY($col4, $table_y);
     $pdf->Cell($col_width, $line_height, 'Closing Balance', 0, 0, 'R');
     $pdf->SetFont('Arial', '', 8);
     $i = 0;
     for ($i = 0; $i < count($loan_info['schedule']); $i++) {
         $line_y = $table_y + ($i + 1) * $line_height;
         $pdf->SetXY($col1, $line_y);
         $pdf->Cell($col_width, $line_height, $loan_info['schedule'][$i]['end_date'], 0, 0, 'C');
         $pdf->SetXY($col2, $line_y);
         $pdf->Cell($col_width, $line_height, $loan_info['schedule'][$i]['days'], 0, 0, 'C');
         $pdf->SetXY($col3, $line_y);
         $pdf->Cell($col_width, $line_height, number_format($loan_info['schedule'][$i]['interest'], 2), 0, 0, 'R');
         $pdf->SetXY($col4, $line_y);
         $pdf->Cell($col_width, $line_height, number_format($loan_info['schedule'][$i]['balance'], 2), 0, 0, 'R');
     }
     $last_y = $table_y + ($i + 1) * $line_height;
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->SetXY($col1, $last_y);
     $pdf->Cell($col_width, $line_height, 'Total', 0, 0, 'C');
     $pdf->SetXY($col2, $last_y);
     $pdf->Cell($col_width, $line_height, number_format($this->loan->principal(), 2), 0, 0, 'R');
     $pdf->SetXY($col3, $last_y);
     $pdf->Cell($col_width, $line_height, number_format($loan_info['total_interest'], 2), 0, 0, 'R');
     $pdf->SetXY($col4, $last_y);
     $pdf->Cell($col_width, $line_height, number_format($loan_info['balance'], 2), 0, 0, 'R');
     $pdf->SetFont('Arial', '', 8);
     $pdf->SetXY(6.35, $table_y);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell($col_width, $line_height, 'Loan Amount', 0, 1, 'C');
     $pdf->SetFont('Arial', '', 8);
     $pdf->Cell($col_width, $line_height, number_format($this->loan->principal(), 2), 0, 1, 'C');
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell($col_width, $line_height, 'Term', 0, 1, 'C');
     $pdf->SetFont('Arial', '', 8);
     $pdf->Cell($col_width, $line_height, $this->loan->termInMonths() / 12 . ' Years', 0, 1, 'C');
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell($col_width, $line_height, 'Loan Date', 0, 1, 'C');
     $pdf->SetFont('Arial', '', 8);
     $pdf->Cell($col_width, $line_height, date('m/d/Y', strtotime($this->loan->loanDate())), 0, 1, 'C');
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell($col_width, $line_height, 'Interest Rate', 0, 1, 'C');
     $pdf->SetFont('Arial', '', 8);
     $pdf->Cell($col_width, $line_height, 100 * $this->loan->interestRate() . '%', 0, 1, 'C');
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Cell($col_width, $line_height, 'Maturity Date', 0, 1, 'C');
     $pdf->SetFont('Arial', '', 8);
     $ld = strtotime($this->loan->loanDate());
     $ed = mktime(0, 0, 0, date('n', $ld) + $this->loan->termInMonths(), date('j', $ld), date('Y', $ld));
     $pdf->Cell($col_width, $line_height, date('m/d/Y', $ed), 0, 1, 'C');
     $pdf->SetDrawColor(0, 0, 0);
     $pdf->Line(6.35, $table_y, 6.35 + $col_width, $table_y);
     $pdf->Line(6.35, $table_y, 6.35, $table_y + 10 * $line_height);
     $pdf->Line(6.35 + $col_width, $table_y, 6.35 + $col_width, $table_y + 10 * $line_height);
     $pdf->Line(6.35, $table_y + 10 * $line_height, 6.35 + $col_width, $table_y + 10 * $line_height);
     for ($i = 2; $i <= 8; $i += 2) {
         $pdf->Line(6.35, $table_y + $i * $line_height, 6.35 + $col_width, $table_y + $i * $line_height);
     }
     $fields = array(1 => $loan_info['total_interest']);
     $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->renderAsPDF($pdf, 105);
     $check = new GumCheckTemplate($this->custdata, $this->meminfo, $loan_info['balance'], 'Loan Repayment', $this->check_info->checkNumber());
     $check->renderAsPDF($pdf);
     $pdf->Output('LoanPayoff.pdf', 'I');
     if (FormLib::get('issued') == '1') {
         $this->check_info->checkIssued(1);
         $this->check_info->issueDate(date('Y-m-d H:i:s'));
         $this->check_info->save();
     }
     return false;
 }
Esempio n. 2
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();
     }
 }
Esempio n. 3
0
 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;
 }