/**
  * Testing numbers between 1000 and 9999
  */
 public function testThousands()
 {
     $thousands = array(1000 => 'mil', 1001 => 'mil uno', 1097 => 'mil noventa y siete', 1104 => 'mil ciento cuatro', 1243 => 'mil doscientos cuarenta y tres', 2385 => 'dos mil trescientos ochenta y cinco', 3766 => 'tres mil setecientos sesenta y seis', 4196 => 'cuatro mil ciento noventa y seis', 5846 => 'cinco mil ochocientos cuarenta y seis', 6459 => 'seis mil cuatrocientos cincuenta y nueve', 7232 => 'siete mil doscientos treinta y dos', 8569 => 'ocho mil quinientos sesenta y nueve', 9539 => 'nueve mil quinientos treinta y nueve');
     foreach ($thousands as $number => $word) {
         $this->assertEquals($word, Numbers_Words::toWords($number, 'es'));
     }
 }
Beispiel #2
0
 /**
  * Converts a currency value to word representation (1.02 => one dollar two cents)
  * If the number has not any fraction part, the "cents" number is omitted. 
  *
  * @param  float   $num   A float/integer/string number representing currency value
  *
  * @param  string  $locale Language name abbreviation. Optional. Defaults to en_US.
  *
  * @param  string  $int_curr International currency symbol
  *                 as defined by the ISO 4217 standard (three characters).
  *                 E.g. 'EUR', 'USD', 'PLN'. Optional.
  *                 Defaults to $def_currency defined in the language class.
  *
  * @return string  The corresponding word representation
  *
  * @access public
  * @author Piotr Klaban <*****@*****.**>
  * @since  PHP 4.2.3
  */
 function toCurrency($num, $locale = 'en_US', $int_curr = '')
 {
     $ret = $num;
     @(include_once "Numbers/Words/lang.{$locale}.php");
     $classname = "Numbers_Words_{$locale}";
     if (!class_exists($classname)) {
         return Numbers_Words::raiseError("Unable to include the Numbers/Words/lang.{$locale}.php file");
     }
     $methods = get_class_methods($classname);
     if (!in_array('toCurrencyWords', $methods) && !in_array('tocurrencywords', $methods)) {
         return Numbers_Words::raiseError("Unable to find toCurrencyWords method in '{$classname}' class");
     }
     @($obj = new $classname());
     if (strpos($num, '.') === false) {
         $ret = trim($obj->toCurrencyWords($int_curr, $num));
     } else {
         $currency = explode('.', $num, 2);
         /* add leading zero */
         if (strlen($currency[1]) == 1) {
             $currency[1] .= '0';
         }
         $ret = trim($obj->toCurrencyWords($int_curr, $currency[0], $currency[1]));
     }
     return $ret;
 }
Beispiel #3
0
$YPos -= 3 * $line_height;
$LeftOvers = $pdf->addTextWrap(75, $YPos, 475, $FontSize, $AmountWords, 'left');
$YPos -= 1 * $line_height;
$LeftOvers = $pdf->addTextWrap($Page_Width - 225, $YPos, 100, $FontSize, $_SESSION['PaymentDetail']->DatePaid, 'left');
$LeftOvers = $pdf->addTextWrap($Page_Width - 75, $YPos, 75, $FontSize, number_format(round($_SESSION['PaymentDetail']->Amount, 2), 2), 'left');
$YPos -= 1 * $line_height;
$LeftOvers = $pdf->addTextWrap(75, $YPos, 300, $FontSize, $_SESSION['PaymentDetail']->SuppName, 'left');
$YPos -= 1 * $line_height;
$LeftOvers = $pdf->addTextWrap(75, $YPos, 300, $FontSize, $_SESSION['PaymentDetail']->Address1, 'left');
$YPos -= 1 * $line_height;
$LeftOvers = $pdf->addTextWrap(75, $YPos, 300, $FontSize, $_SESSION['PaymentDetail']->Address2, 'left');
$YPos -= 1 * $line_height;
$Address3 = $_SESSION['PaymentDetail']->Address3 . ' ' . $_SESSION['PaymentDetail']->Address4 . ' ' . $_SESSION['PaymentDetail']->Address5 . ' ' . $_SESSION['PaymentDetail']->Address6;
$LeftOvers = $pdf->addTextWrap(75, $YPos, 300, $FontSize, $Address3, 'left');
$AmountWords = Numbers_Words::toWords(intval($_SESSION['PaymentDetail']->Amount), $Locale);
$AmountWords .= ' ' . _('and') . ' ' . Numbers_Words::toWords(intval(($_SESSION['PaymentDetail']->Amount - intval($_SESSION['PaymentDetail']->Amount)) * 100), $Locale) . ' ' . $HundredsName;
$YPos -= 2 * $line_height;
$LeftOvers = $pdf->addTextWrap(75, $YPos, 300, $FontSize, $AmountWords, 'left');
$LeftOvers = $pdf->addTextWrap(375, $YPos, 100, $FontSize, number_format($_SESSION['PaymentDetail']->Amount, 2), 'right');
// remittance advice 1
$YPos -= 14 * $line_height;
$LeftOvers = $pdf->addTextWrap(0, $YPos, $Page_Width, $FontSize, _('Remittance Advice'), 'center');
$YPos -= 2 * $line_height;
$LeftOvers = $pdf->addTextWrap(25, $YPos, 75, $FontSize, _('DatePaid'), 'left');
$LeftOvers = $pdf->addTextWrap(100, $YPos, 100, $FontSize, _('Vendor No.'), 'left');
$LeftOvers = $pdf->addTextWrap(250, $YPos, 75, $FontSize, _('Cheque No.'), 'left');
$LeftOvers = $pdf->addTextWrap(350, $YPos, 75, $FontSize, _('Amount'), 'left');
$YPos -= 2 * $line_height;
$LeftOvers = $pdf->addTextWrap(25, $YPos, 75, $FontSize, $_SESSION['PaymentDetail']->DatePaid, 'left');
$LeftOvers = $pdf->addTextWrap(100, $YPos, 100, $FontSize, $_SESSION['PaymentDetail']->SupplierID, 'left');
$LeftOvers = $pdf->addTextWrap(250, $YPos, 75, $FontSize, $_GET['ChequeNum'], 'left');
 /**
  * @expectedException Numbers_Words_Exception
  * @expectedExceptionMessage Unable to find method 'doesnotexist' in class 'Numbers_Words_Locale_de'
  */
 function testLoadLocaleMethodMissing()
 {
     Numbers_Words::loadLocale('de', 'doesnotexist');
 }
    $pdf->Cell(25, 4, "", 0, 0, 'C');
    $pdf->Ln(5);
    $contador = $contador + 1;
}
//Calculamos los valores del final de la factura
$importe4 = number_format($importe, 2, ".", ",");
$ivai = $lafila["iva"];
$impo = $importe * ($ivai / 100);
$impo = sprintf("%01.2f", $impo);
$total = $importe + $impo;
$total = sprintf("%01.2f", $total);
$impo = number_format($impo, 2, ".", ",");
$total = sprintf("%01.2f", $total);
$total2 = number_format($total, 2, ".", ",");
//Calculamos de numero a palabras
$nw = new Numbers_Words();
$pdf->SetY(235);
$pdf->Cell(33);
//Modificamos esta parte para que tambi�n muestra la parte fraccionaria y M.N.
$decimales = explode(".", $total);
//$pdf->Cell(35,4,strtoupper($nw->toWords(round($total,0), "es") ." pesos ".$decimales[1]."/100 M.N."),0,0,'L',0);
$pdf->Cell(35, 4, strtoupper($nw->toWords($decimales[0], "es") . " pesos " . $decimales[1] . "/100 M.N."), 0, 0, 'L', 0);
$pdf->Ln(19);
$pdf->Cell(155);
$pdf->Cell(32, 4, $importe4, 0, 0, 'R', 0);
$pdf->Ln(8);
$pdf->Cell(155);
$pdf->Cell(10, 4, $lafila["iva"] . " %", 0, 0, 'R', 0);
$pdf->Cell(22, 4, $impo, 0, 0, 'R', 0);
$pdf->Ln(8);
$pdf->Cell(155);
Beispiel #6
0
 /**
  * Converts a currency value to word representation (1.02 => one dollar two cents)
  * If the number has not any fraction part, the "cents" number is omitted.
  *
  * @param float  $num      A float/integer/string number representing currency value
  *
  * @param string $locale   Language name abbreviation. Optional. Defaults to en_US.
  *
  * @param string $int_curr International currency symbol
  *                 as defined by the ISO 4217 standard (three characters).
  *                 E.g. 'EUR', 'USD', 'PLN'. Optional.
  *                 Defaults to $def_currency defined in the language class.
  *
  * @return string  The corresponding word representation
  *
  * @access public
  * @author Piotr Klaban <*****@*****.**>
  * @since  PHP 4.2.3
  * @return string
  */
 function toCurrency($num, $locale = 'en_US', $int_curr = '')
 {
     $ret = $num;
     @(include_once "Numbers/Words/lang.{$locale}.php");
     $classname = "Numbers_Words_{$locale}";
     if (!class_exists($classname)) {
         return Numbers_Words::raiseError("Unable to include the Numbers/Words/lang.{$locale}.php file");
     }
     $methods = get_class_methods($classname);
     if (!in_array('toCurrencyWords', $methods) && !in_array('tocurrencywords', $methods)) {
         return Numbers_Words::raiseError("Unable to find toCurrencyWords method in '{$classname}' class");
     }
     @($obj = new $classname());
     // round if a float is passed, use Math_BigInteger otherwise
     if (is_float($num)) {
         $num = round($num, 2);
     }
     if (strpos($num, '.') === false) {
         return trim($obj->toCurrencyWords($int_curr, $num));
     }
     $currency = explode('.', $num, 2);
     $len = strlen($currency[1]);
     if ($len == 1) {
         // add leading zero
         $currency[1] .= '0';
     } elseif ($len > 2) {
         // get the 3rd digit after the comma
         $round_digit = substr($currency[1], 2, 1);
         // cut everything after the 2nd digit
         $currency[1] = substr($currency[1], 0, 2);
         if ($round_digit >= 5) {
             // round up without losing precision
             include_once "Math/BigInteger.php";
             $int = new Math_BigInteger(join($currency));
             $int = $int->add(new Math_BigInteger(1));
             $int_str = $int->toString();
             $currency[0] = substr($int_str, 0, -2);
             $currency[1] = substr($int_str, -2);
             // check if the rounded decimal part became zero
             if ($currency[1] == '00') {
                 $currency[1] = false;
             }
         }
     }
     return trim($obj->toCurrencyWords($int_curr, $currency[0], $currency[1]));
 }
 function filterAmountWords($value)
 {
     if (isset($this->amount)) {
         $numbers_words = new Numbers_Words();
         $value = str_pad(ucwords($numbers_words->toWords(floor($this->amount), "en_US")) . ' ', 65, "-", STR_PAD_RIGHT);
     }
     return $value;
 }
Beispiel #8
0
            echo $loc_name;
            ?>
</i></nobr></td>
        <td><b><?php 
            echo $ret;
            ?>
</b></td>
      </tr><?php 
        } else {
            echo sprintf("%30s: '", $loc_name . ' (' . $loc_symbol . ')') . $ret . "'\n";
        }
    }
}
reset($langs);
$num .= '.34';
$handle = new Numbers_Words();
while (list($loc_symbol, $loc_name) = each($langs)) {
    $ret = $handle->toCurrency($num, $loc_symbol);
    if (PEAR::isError($ret)) {
        if ($html_on) {
        }
        echo "Error ({$loc_symbol}): " . $ret->message . "\n";
        if ($html_on) {
        }
    } else {
        if ($html_on) {
            ?>
      <tr>
        <td align="center"><?php 
            echo $loc_symbol;
            ?>
//POSICION DE COLUMNA SUBTOTAL SIN IV
$pdf->Ln(3);
//distancia hacia abajo
$pdf->Cell(90);
//POSICION IZQUIERDA DERECHA
$pdf->Cell(1, 4, $lafila["iva"] . " %", 0, 0, 'R', 1);
//Cell (10,4) POSICION IZQUIERDA DERECHA DE BLOQUE PORCENTAJE
$pdf->Cell(31, 4, $impo, 0, 0, 'R', 0, 1);
//POSICION DE IMPROTE IZ Y DER
$pdf->Ln(3);
//distancia hacia abajo
$pdf->Cell(90);
//POSICION IZQUIERDA DERECHA
$pdf->Cell(32, 4, $total2, 0, 0, 'R', 0);
$pdf->Ln(3);
//distancia hacia abajo
//Calculamos de numero a palabras
$nw = new Numbers_Words();
$pdf->SetY(98);
//distancia arriba abajo de palabras de total
$pdf->Cell(30);
//Posicion de columna de inicio de palabras derecha e izquierda
//Modificamos esta parte para que tambi�n muestra la parte fraccionaria y M.N.
$decimales = explode(".", $total);
//$pdf->Cell(35,4,strtoupper($nw->toWords(round($total,0), "es") ." pesos ".$decimales[1]."/100 M.N."),0,0,'L',0);
$pdf->Cell(40, 4, strtoupper($nw->toWords($decimales[0], "es") . " Y " . $decimales[1] . "/100 Colones"), 0, 0, 'L', 0);
@mysql_free_result($resultado);
@mysql_free_result($query);
@mysql_free_result($resultado2);
@mysql_free_result($query3);
$pdf->Output($name = "Factura.pdf", 'I');
$fm = array('RLTB' => 'Right to left, top to bottom', 'RLBT' => 'Right to left, bottom to top', 'LRTB' => 'Left to right, top to bottom', 'LRBT' => 'Left to right, bottom to top', 'TBLR' => 'Top to bottom, left to right', 'TBRL' => 'Top to bottom, right to left', 'BTLR' => 'Bottom to top, left to right', 'BTRL' => 'Bottom to top, right to left', 'InC' => 'Inwards, clockwise', 'InCC' => 'Inwards, counter-clockwise', 'OutC' => 'Outwards, clockwise', 'OutCC' => 'Outwards, counter-clockwise');
$def['number'] = 5;
$def['cols'] = 5;
$form = new HTML_QuickForm('formMatrixExample');
if ($_POST) {
    $form->setDefaults($_POST);
} else {
    $form->setDefaults($def);
}
$form->addElement('header', '', "HTML_Table_Matrix Example");
$form->addElement('select', 'number', "Number of items", $nSel);
$form->addElement('select', 'cols', "Columns", $sel);
$form->addElement('select', 'rows', "Rows", $sel);
$form->addElement('select', 'startcol', "X Offset", $sel);
$form->addElement('select', 'startrow', "Y Offset", $sel);
$form->addElement('select', 'fillmode', "Fill", $fm);
$form->addElement('submit', "Submit");
$form->display();
if ($_POST) {
    echo "<br><hr>";
    $nw = new Numbers_Words();
    for ($i = 1; $i <= $_POST['number']; $i++) {
        $data[] = $nw->toWords($i);
    }
    $m->setData($data);
    $m->setTableSize($_POST['rows'], $_POST['cols']);
    $m->setFillStart($_POST['startrow'], $_POST['startcol']);
    $f = HTML_Table_Matrix_Filler::factory($_POST['fillmode'], $m);
    $m->accept($f);
    print $m->toHtml();
}
Beispiel #11
0
 /**
  * Solves a simple equation with two given numbers and one operator as defined
  * in $this->_operators.
  * Also converts the numbers to words if required.
  *
  * @param int    $one      First number
  * @param int    $two      Second number
  * @param string $operator Operator used with those two numbers
  *
  * @return array    Array with equation and solution
  */
 private function _solveSimpleEquation($one, $two, $operator)
 {
     $equation = sprintf($operator, $one, $two);
     $function = create_function('', 'return ' . $equation . ';');
     if ($this->_numbersToText) {
         $numberWords = new Numbers_Words();
         $equation = sprintf($operator, $numberWords->toWords($one, $this->_locale), $numberWords->toWords($two, $this->_locale));
     }
     return array($equation, $function());
 }
Beispiel #12
0
 /**
  * Place holder for the real _createCAPTCHA() method
  * used by extended classes to generate CAPTCHA from phrase
  *
  * @return void
  */
 public function createCAPTCHA()
 {
     $res = '';
     $numberWords = new Numbers_Words();
     $phrase = $this->getPhrase();
     if ($this->_mode == 'single') {
         $phraseArr = str_split($phrase);
         for ($i = 0; $i < strlen($phrase); $i++) {
             $res .= ' ' . $numberWords->toWords($phraseArr[$i], $this->_locale);
         }
     } else {
         $res = $numberWords->toWords($phrase, $this->_locale);
     }
     $this->setCaptcha($res);
 }
Beispiel #13
0
<?php

include 'Numbers/Words.php';
$NumberWords = new Numbers_Words();
echo $NumberWords->toWords(2345, 'fr_FR.utf8');
 function exportPayStub($pslf = NULL, $export_type = NULL, $company_obj = NULL)
 {
     if (is_object($company_obj)) {
         $current_company = $company_obj;
     } else {
         global $current_company;
     }
     if (!is_object($pslf) and $this->getId() != '') {
         $pslf = TTnew('PayStubListFactory');
         $pslf->getById($this->getId());
     }
     if (get_class($pslf) !== 'PayStubListFactory') {
         return FALSE;
     }
     if ($export_type == '') {
         return FALSE;
     }
     if ($pslf->getRecordCount() > 0) {
         Debug::Text('aExporting...', __FILE__, __LINE__, __METHOD__, 10);
         switch (strtolower($export_type)) {
             case 'eft_hsbc':
             case 'eft_1464':
             case 'eft_105':
             case 'eft_ach':
             case 'eft_beanstream':
                 //Get file creation number
                 $ugdlf = TTnew('UserGenericDataListFactory');
                 $ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), 'PayStubFactory', TRUE);
                 if ($ugdlf->getRecordCount() > 0) {
                     $ugd_obj = $ugdlf->getCurrent();
                     $setup_data = $ugd_obj->getData();
                 } else {
                     $ugd_obj = TTnew('UserGenericDataFactory');
                 }
                 Debug::Text('bExporting...', __FILE__, __LINE__, __METHOD__, 10);
                 //get User Bank account info
                 $balf = TTnew('BankAccountListFactory');
                 $balf->getCompanyAccountByCompanyId($current_company->getID());
                 if ($balf->getRecordCount() > 0) {
                     $company_bank_obj = $balf->getCurrent();
                     //Debug::Arr($company_bank_obj,'Company Bank Object', __FILE__, __LINE__, __METHOD__,10);
                 }
                 if (isset($setup_data['file_creation_number'])) {
                     $setup_data['file_creation_number']++;
                 } else {
                     //Start at a high number, in attempt to eliminate conflicts.
                     $setup_data['file_creation_number'] = 500;
                 }
                 Debug::Text('bFile Creation Number: ' . $setup_data['file_creation_number'], __FILE__, __LINE__, __METHOD__, 10);
                 //Increment file creation number in DB
                 if ($ugd_obj->getId() == '') {
                     $ugd_obj->setID($ugd_obj->getId());
                 }
                 $ugd_obj->setCompany($current_company->getId());
                 $ugd_obj->setScript('PayStubFactory');
                 $ugd_obj->setName('PayStubFactory');
                 $ugd_obj->setData($setup_data);
                 $ugd_obj->setDefault(TRUE);
                 if ($ugd_obj->isValid()) {
                     $ugd_obj->Save();
                 }
                 $eft = new EFT();
                 $eft->setFileFormat(str_replace('eft_', '', $export_type));
                 $eft->setBusinessNumber($current_company->getBusinessNumber());
                 //ACH
                 $eft->setOriginatorID($current_company->getOriginatorID());
                 $eft->setFileCreationNumber($setup_data['file_creation_number']);
                 $eft->setInitialEntryNumber($current_company->getOtherID5());
                 //ACH
                 $eft->setDataCenter($current_company->getDataCenterID());
                 $eft->setDataCenterName($current_company->getOtherID4());
                 //ACH
                 $eft->setOriginatorShortName($current_company->getShortName());
                 $psealf = TTnew('PayStubEntryAccountListFactory');
                 foreach ($pslf as $key => $pay_stub_obj) {
                     Debug::Text('Looping over Pay Stub... ID: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
                     //Get pay stub entries.
                     $pself = TTnew('PayStubEntryListFactory');
                     $pself->getByPayStubId($pay_stub_obj->getId());
                     $prev_type = NULL;
                     $description_subscript_counter = 1;
                     foreach ($pself as $pay_stub_entry) {
                         $description_subscript = NULL;
                         //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent();
                         $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent();
                         if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) {
                             $type = $pay_stub_entry_name_obj->getType();
                         }
                         //var_dump( $pay_stub_entry->getDescription() );
                         if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) {
                             $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription());
                             $description_subscript = $description_subscript_counter;
                             $description_subscript_counter++;
                         }
                         if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) {
                             $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy());
                         }
                         $prev_type = $pay_stub_entry_name_obj->getType();
                     }
                     if (isset($pay_stub_entries)) {
                         $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 12, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy());
                         unset($pay_stub_entries);
                         //Get User information
                         $ulf = TTnew('UserListFactory');
                         $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent();
                         //Get company information
                         $clf = TTnew('CompanyListFactory');
                         $company_obj = $clf->getById($user_obj->getCompany())->getCurrent();
                         //get User Bank account info
                         $balf = TTnew('BankAccountListFactory');
                         $user_bank_obj = $balf->getUserAccountByCompanyIdAndUserId($user_obj->getCompany(), $user_obj->getId());
                         if ($user_bank_obj->getRecordCount() > 0) {
                             $user_bank_obj = $user_bank_obj->getCurrent();
                         } else {
                             continue;
                         }
                         if (isset($pay_stub['entries'][40][0]['amount'])) {
                             $amount = $pay_stub['entries'][40][0]['amount'];
                         } else {
                             $amount = 0;
                         }
                         if ($amount > 0) {
                             $record = new EFT_Record();
                             $record->setType('C');
                             $record->setCPACode(200);
                             $record->setAmount($amount);
                             $record->setDueDate(TTDate::getBeginDayEpoch($pay_stub_obj->getTransactionDate()));
                             $record->setInstitution($user_bank_obj->getInstitution());
                             $record->setTransit($user_bank_obj->getTransit());
                             $record->setAccount($user_bank_obj->getAccount());
                             $record->setName($user_obj->getFullName());
                             $record->setOriginatorShortName($company_obj->getShortName());
                             $record->setOriginatorLongName(substr($company_obj->getName(), 0, 30));
                             $record->setOriginatorReferenceNumber('TT' . $pay_stub_obj->getId());
                             if (isset($company_bank_obj) and is_object($company_bank_obj)) {
                                 $record->setReturnInstitution($company_bank_obj->getInstitution());
                                 $record->setReturnTransit($company_bank_obj->getTransit());
                                 $record->setReturnAccount($company_bank_obj->getAccount());
                             }
                             $eft->setRecord($record);
                         }
                         unset($amount);
                         $this->getProgressBarObject()->set(NULL, $key);
                     }
                 }
                 $eft->compile();
                 $output = $eft->getCompiledData();
                 break;
             case 'cheque_9085':
             case 'cheque_9209p':
             case 'cheque_dlt103':
             case 'cheque_dlt104':
             case 'cheque_cr_standard_form_1':
             case 'cheque_cr_standard_form_2':
                 $cheque_form_obj = $this->getChequeFormsObject(str_replace('cheque_', '', $export_type));
                 $psealf = TTnew('PayStubEntryAccountListFactory');
                 $numbers_words = new Numbers_Words();
                 $i = 0;
                 foreach ($pslf as $pay_stub_obj) {
                     //Get pay stub entries.
                     $pself = TTnew('PayStubEntryListFactory');
                     $pself->getByPayStubId($pay_stub_obj->getId());
                     $pay_stub_entries = NULL;
                     $prev_type = NULL;
                     $description_subscript_counter = 1;
                     foreach ($pself as $pay_stub_entry) {
                         $description_subscript = NULL;
                         //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent();
                         $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent();
                         //Use this to put the total for each type at the end of the array.
                         if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) {
                             $type = $pay_stub_entry_name_obj->getType();
                         }
                         //Debug::text('Pay Stub Entry Name ID: '. $pay_stub_entry_name_obj->getId() .' Type ID: '. $pay_stub_entry_name_obj->getType() .' Type: '. $type, __FILE__, __LINE__, __METHOD__,10);
                         //var_dump( $pay_stub_entry->getDescription() );
                         if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) {
                             $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription());
                             $description_subscript = $description_subscript_counter;
                             $description_subscript_counter++;
                         }
                         $amount_words = str_pad(ucwords($numbers_words->toWords(floor($pay_stub_entry->getAmount()), "en_US")) . ' ', 65, "-", STR_PAD_RIGHT);
                         //echo "Amount: ". floor($pay_stub_entry->getAmount()) ." - Words: ". $amount_words ."<br>\n";
                         //var_dump($amount_words);
                         if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) {
                             $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'amount_padded' => str_pad(TTi18n::formatNumber($pay_stub_entry->getAmount(), TRUE, $pay_stub_obj->getCurrencyObject()->getRoundDecimalPlaces()), 12, '*', STR_PAD_LEFT), 'amount_words' => $amount_words, 'amount_cents' => Misc::getAfterDecimal($pay_stub_entry->getAmount()), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy());
                         }
                         unset($amount_words);
                         //Only for net pay, make a total YTD of Advance plus Net.
                         /*
                         if ( $type == 40 ) {
                         	$pay_stub_entries[$type][0]['ytd_net_plus_advance'] =
                         }
                         */
                         $prev_type = $pay_stub_entry_name_obj->getType();
                     }
                     //Get User information
                     $ulf = TTnew('UserListFactory');
                     $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent();
                     //Get company information
                     $clf = TTnew('CompanyListFactory');
                     $company_obj = $clf->getById($user_obj->getCompany())->getCurrent();
                     if ($user_obj->getCountry() == 'CA') {
                         $date_format = 'd/m/Y';
                     } else {
                         $date_format = 'm/d/Y';
                     }
                     $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 15, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'transaction_date_display' => date($date_format, $pay_stub_obj->getTransactionDate()), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'tainted' => $pay_stub_obj->getTainted(), 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy());
                     unset($pay_stub_entries);
                     if (isset($pay_stub['entries'][40][0]['amount']) and $pay_stub['entries'][40][0]['amount'] > 0) {
                         //Debug::text($i .'. Pay Stub Transaction Date: '. $pay_stub_obj->getTransactionDate(), __FILE__, __LINE__, __METHOD__,10);
                         //Get Pay Period information
                         $pplf = TTnew('PayPeriodListFactory');
                         $pay_period_obj = $pplf->getById($pay_stub_obj->getPayPeriod())->getCurrent();
                         $pp_start_date = $pay_period_obj->getStartDate();
                         $pp_end_date = $pay_period_obj->getEndDate();
                         $pp_transaction_date = $pay_period_obj->getTransactionDate();
                         //Get pay period numbers
                         $ppslf = TTnew('PayPeriodScheduleListFactory');
                         $pay_period_schedule_obj = $ppslf->getById($pay_period_obj->getPayPeriodSchedule())->getCurrent();
                         $pay_period_data = array('start_date' => TTDate::getDate('DATE', $pp_start_date), 'end_date' => TTDate::getDate('DATE', $pp_end_date), 'transaction_date' => TTDate::getDate('DATE', $pp_transaction_date), 'annual_pay_periods' => $pay_period_schedule_obj->getAnnualPayPeriods());
                         $ps_data = array('date' => $pay_stub_obj->getTransactionDate(), 'amount' => $pay_stub['entries'][40][0]['amount'], 'stub_left_column' => $user_obj->getFullName() . "\n" . TTi18n::gettext("Identification #: ") . $pay_stub['display_id'] . "\n" . TTi18n::gettext("Net Pay: ") . $pay_stub_obj->getCurrencyObject()->getSymbol() . TTi18n::formatNumber($pay_stub['entries'][40][0]['amount'], TRUE, $pay_stub_obj->getCurrencyObject()->getRoundDecimalPlaces()), 'stub_right_column' => TTi18n::gettext('Pay Start Date: ') . TTDate::getDate('DATE', $pay_stub['start_date']) . "\n" . TTi18n::gettext('Pay End Date: ') . TTDate::getDate('DATE', $pay_stub['end_date']) . "\n" . TTi18n::gettext('Payment Date: ') . TTDate::getDate('DATE', $pay_stub['transaction_date']), 'start_date' => $pay_stub['start_date'], 'end_date' => $pay_stub['end_date'], 'full_name' => $user_obj->getFullName(), 'address1' => $user_obj->getAddress1(), 'address2' => $user_obj->getAddress2(), 'city' => $user_obj->getCity(), 'province' => $user_obj->getProvince(), 'postal_code' => $user_obj->getPostalCode(), 'country' => $user_obj->getCountry(), 'company_name' => $company_obj->getName(), 'symbol' => $pay_stub_obj->getCurrencyObject()->getSymbol());
                         $cheque_form_obj->addRecord($ps_data);
                         $this->getFormObject()->addForm($cheque_form_obj);
                     }
                     $this->getProgressBarObject()->set(NULL, $i);
                     $i++;
                 }
                 if (stristr($export_type, 'cheque')) {
                     $output_format = 'PDF';
                 }
                 $output = $this->getFormObject()->output($output_format);
                 break;
         }
     }
     if (isset($output)) {
         return $output;
     }
     return FALSE;
 }
Beispiel #15
0
 function number2text($num)
 {
     if (class_exists('Numbers_Words')) {
         //$lang = JLanguage::load();
         $lang = JFactory::getLanguage();
         $locale = $lang->getLocale();
         //var_dump($locale);
         //$lang = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_onepage'.DS.'assets'.DS.'Words'.DS.);
         $numt = new Numbers_Words();
         $str = @$numt->toWords((int) $num, 'sk');
     }
     if (empty($str)) {
         return "";
     }
     return $str;
 }
 public function actionConvert()
 {
     include "Numbers/Words.php";
     $nw = new Numbers_Words();
     echo ucwords($nw->toCurrency($_POST['Property']['total_price'], 'en_GB'));
 }
        $numRows = $q->numRows();
        if ($numRows == 0) {
            echo "select error";
            exit;
        } else {
            while ($row = $q->fetchRow()) {
                foreach ($row as $key => $val) {
                    ${$key} = $val;
                    $render .= $key . "->" . $val . "<br>";
                }
            }
        }
        if (!$off_conditions) {
            $off_conditions = 'None';
        }
        $nw = new Numbers_Words();
        #$off_price_word = $nw->toWords(numbers_only(format_price($off_price)),'en_GB');
        $off_price_word = $nw->toCurrency($off_price, 'en_GB', 'GBP');
        $offer_text = str_replace("  ", " ", $vendor_name . '
' . $vendor_addr1 . ' ' . $vendor_addr2 . ' ' . $vendor_addr3 . '
' . $vendor_addr5 . '
' . $vendor_postcode . '

' . date('l jS F Y') . '

Dear ' . $vendor_name . ',

Re: ' . $pro_addr . '

Further to our recent conversation, we write to confirm the following offer made on the above property: -
Beispiel #18
0
 /**
  * Return CAPTCHA as a string
  *
  * This method returns the CAPTCHA as string
  *
  * @access  public
  * @return  text        string
  */
 function getCAPTCHA()
 {
     $res = '';
     if ($this->_mode == 'single') {
         for ($i = 0; $i < strlen($this->_phrase); $i++) {
             $res .= ' ' . Numbers_Words::toWords($this->_phrase[$i], $this->_locale);
         }
     } else {
         $res = Numbers_Words::toWords($this->_phrase, $this->_locale);
     }
     return $res;
 }
 function exportPayStub($pslf = NULL, $export_type = NULL)
 {
     global $current_company;
     if (!is_object($pslf) and $this->getId() != '') {
         $pslf = new PayStubListFactory();
         $pslf->getById($this->getId());
     }
     if (get_class($pslf) !== 'PayStubListFactory') {
         return FALSE;
     }
     if ($export_type == '') {
         return FALSE;
     }
     if ($pslf->getRecordCount() > 0) {
         Debug::Text('aExporting...', __FILE__, __LINE__, __METHOD__, 10);
         switch (strtolower($export_type)) {
             case 'hsbc':
             case '1464':
             case '105':
             case 'ach':
                 //Get file creation number
                 $ugdlf = new UserGenericDataListFactory();
                 $ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), 'PayStubFactory', TRUE);
                 if ($ugdlf->getRecordCount() > 0) {
                     Debug::Text('Found Script Setup Data!', __FILE__, __LINE__, __METHOD__, 10);
                     $ugd_obj = $ugdlf->getCurrent();
                     $setup_data = $ugd_obj->getData();
                 } else {
                     $ugd_obj = new UserGenericDataFactory();
                 }
                 Debug::Text('bExporting...', __FILE__, __LINE__, __METHOD__, 10);
                 //get User Bank account info
                 $balf = new BankAccountListFactory();
                 $balf->getCompanyAccountByCompanyId($current_company->getID());
                 if ($balf->getRecordCount() > 0) {
                     $company_bank_obj = $balf->getCurrent();
                     //Debug::Arr($company_bank_obj,'Company Bank Object', __FILE__, __LINE__, __METHOD__,10);
                 }
                 if (isset($setup_data['file_creation_number'])) {
                     $setup_data['file_creation_number']++;
                 } else {
                     //Start at a high number, in attempt to eliminate conflicts.
                     $setup_data['file_creation_number'] = 500;
                 }
                 Debug::Text('bFile Creation Number: ' . $setup_data['file_creation_number'], __FILE__, __LINE__, __METHOD__, 10);
                 //Increment file creation number in DB
                 if ($ugd_obj->getId() == '') {
                     $ugd_obj->setID($ugd_obj->getId());
                 }
                 $ugd_obj->setCompany($current_company->getId());
                 $ugd_obj->setName('PayStubFactory');
                 $ugd_obj->setScript('PayStubFactory');
                 $ugd_obj->setData($setup_data);
                 $ugd_obj->setDefault(TRUE);
                 if ($ugd_obj->isValid()) {
                     $ugd_obj->Save();
                 }
                 $eft = new EFT();
                 $eft->setFileFormat($export_type);
                 $eft->setOriginatorID($current_company->getOriginatorID());
                 $eft->setFileCreationNumber($setup_data['file_creation_number']);
                 $eft->setDataCenter($current_company->getDataCenterID());
                 $eft->setOriginatorShortName($current_company->getShortName());
                 $psealf = new PayStubEntryAccountListFactory();
                 foreach ($pslf as $pay_stub_obj) {
                     Debug::Text('Looping over Pay Stub... ID: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
                     //Get pay stub entries.
                     $pself = new PayStubEntryListFactory();
                     $pself->getByPayStubId($pay_stub_obj->getId());
                     $prev_type = NULL;
                     $description_subscript_counter = 1;
                     foreach ($pself as $pay_stub_entry) {
                         $description_subscript = NULL;
                         //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent();
                         $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent();
                         if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) {
                             $type = $pay_stub_entry_name_obj->getType();
                         }
                         //var_dump( $pay_stub_entry->getDescription() );
                         if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) {
                             $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription());
                             $description_subscript = $description_subscript_counter;
                             $description_subscript_counter++;
                         }
                         if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) {
                             $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy());
                         }
                         $prev_type = $pay_stub_entry_name_obj->getType();
                     }
                     if (isset($pay_stub_entries)) {
                         $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 12, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy());
                         unset($pay_stub_entries);
                         //Get User information
                         $ulf = new UserListFactory();
                         $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent();
                         //Get company information
                         $clf = new CompanyListFactory();
                         $company_obj = $clf->getById($user_obj->getCompany())->getCurrent();
                         //get User Bank account info
                         $balf = new BankAccountListFactory();
                         $user_bank_obj = $balf->getUserAccountByCompanyIdAndUserId($user_obj->getCompany(), $user_obj->getId());
                         if ($user_bank_obj->getRecordCount() > 0) {
                             $user_bank_obj = $user_bank_obj->getCurrent();
                         } else {
                             continue;
                         }
                         $record = new EFT_Record();
                         $record->setType('C');
                         $amount = $pay_stub['entries'][40][0]['amount'];
                         $record->setCPACode(200);
                         $record->setAmount($amount);
                         unset($amount);
                         $record->setDueDate(TTDate::getBeginDayEpoch($pay_stub_obj->getTransactionDate()));
                         //$record->setDueDate( strtotime("24-Sep-99") );
                         $record->setInstitution($user_bank_obj->getInstitution());
                         $record->setTransit($user_bank_obj->getTransit());
                         $record->setAccount($user_bank_obj->getAccount());
                         $record->setName($user_obj->getFullName());
                         $record->setOriginatorShortName($company_obj->getShortName());
                         $record->setOriginatorLongName(substr($company_obj->getName(), 0, 30));
                         $record->setOriginatorReferenceNumber('TT' . $pay_stub_obj->getId());
                         if (isset($company_bank_obj) and is_object($company_bank_obj)) {
                             $record->setReturnInstitution($company_bank_obj->getInstitution());
                             $record->setReturnTransit($company_bank_obj->getTransit());
                             $record->setReturnAccount($company_bank_obj->getAccount());
                         }
                         $eft->setRecord($record);
                     }
                 }
                 $eft->compile();
                 $output = $eft->getCompiledData();
                 break;
             case 'cheque_9085':
             case 'cheque_9209p':
             case 'cheque_dlt103':
             case 'cheque_dlt104':
             case 'cheque_cr_standard_form_1':
             case 'cheque_cr_standard_form_2':
                 $border = 0;
                 $show_background = 0;
                 $pdf = new TTPDF();
                 $pdf->setMargins(0, 0, 0, 0);
                 $pdf->SetAutoPageBreak(FALSE);
                 $pdf->SetFont('freeserif', '', 10);
                 $psealf = new PayStubEntryAccountListFactory();
                 $i = 0;
                 foreach ($pslf as $pay_stub_obj) {
                     //Get pay stub entries.
                     $pself = new PayStubEntryListFactory();
                     $pself->getByPayStubId($pay_stub_obj->getId());
                     $pay_stub_entries = NULL;
                     $prev_type = NULL;
                     $description_subscript_counter = 1;
                     foreach ($pself as $pay_stub_entry) {
                         $description_subscript = NULL;
                         //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent();
                         $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent();
                         //Use this to put the total for each type at the end of the array.
                         if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) {
                             $type = $pay_stub_entry_name_obj->getType();
                         }
                         //Debug::text('Pay Stub Entry Name ID: '. $pay_stub_entry_name_obj->getId() .' Type ID: '. $pay_stub_entry_name_obj->getType() .' Type: '. $type, __FILE__, __LINE__, __METHOD__,10);
                         //var_dump( $pay_stub_entry->getDescription() );
                         if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) {
                             $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription());
                             $description_subscript = $description_subscript_counter;
                             $description_subscript_counter++;
                         }
                         $amount_words = str_pad(ucwords(Numbers_Words::toWords(floor($pay_stub_entry->getAmount()), "en_US")) . ' ', 65, "-", STR_PAD_RIGHT);
                         //echo "Amount: ". floor($pay_stub_entry->getAmount()) ." - Words: ". $amount_words ."<br>\n";
                         //var_dump($amount_words);
                         if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) {
                             $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'amount_padded' => str_pad($pay_stub_entry->getAmount(), 12, '*', STR_PAD_LEFT), 'amount_words' => $amount_words, 'amount_cents' => Misc::getAfterDecimal($pay_stub_entry->getAmount()), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy());
                         }
                         unset($amount_words);
                         //Only for net pay, make a total YTD of Advance plus Net.
                         /*
                         if ( $type == 40 ) {
                         	$pay_stub_entries[$type][0]['ytd_net_plus_advance'] =
                         }
                         */
                         $prev_type = $pay_stub_entry_name_obj->getType();
                     }
                     //Get User information
                     $ulf = new UserListFactory();
                     $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent();
                     //Get company information
                     $clf = new CompanyListFactory();
                     $company_obj = $clf->getById($user_obj->getCompany())->getCurrent();
                     if ($user_obj->getCountry() == 'CA') {
                         $date_format = 'd/m/Y';
                     } else {
                         $date_format = 'm/d/Y';
                     }
                     $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 15, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'transaction_date_display' => date($date_format, $pay_stub_obj->getTransactionDate()), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'tainted' => $pay_stub_obj->getTainted(), 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy());
                     unset($pay_stub_entries);
                     Debug::text($i . '. Pay Stub Transaction Date: ' . $pay_stub_obj->getTransactionDate(), __FILE__, __LINE__, __METHOD__, 10);
                     //Get Pay Period information
                     $pplf = new PayPeriodListFactory();
                     $pay_period_obj = $pplf->getById($pay_stub_obj->getPayPeriod())->getCurrent();
                     $pp_start_date = $pay_period_obj->getStartDate();
                     $pp_end_date = $pay_period_obj->getEndDate();
                     $pp_transaction_date = $pay_period_obj->getTransactionDate();
                     //Get pay period numbers
                     $ppslf = new PayPeriodScheduleListFactory();
                     $pay_period_schedule_obj = $ppslf->getById($pay_period_obj->getPayPeriodSchedule())->getCurrent();
                     $pay_period_data = array('start_date' => TTDate::getDate('DATE', $pp_start_date), 'end_date' => TTDate::getDate('DATE', $pp_end_date), 'transaction_date' => TTDate::getDate('DATE', $pp_transaction_date), 'annual_pay_periods' => $pay_period_schedule_obj->getAnnualPayPeriods());
                     $pdf->AddPage();
                     switch ($export_type) {
                         case 'cheque_9085':
                             $adjust_x = 0;
                             $adjust_y = -5;
                             if ($show_background == 1) {
                                 $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9085.jpg', 0, 0, 210, 300);
                             }
                             $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(42, $adjust_y));
                             $pdf->Cell(100, 5, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L');
                             $pdf->Cell(15, 5, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(130, $adjust_x), Misc::AdjustXY(50, $adjust_y));
                             $pdf->Cell(38, 5, $pay_stub['transaction_date_display'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(175, $adjust_x), Misc::AdjustXY(50, $adjust_y));
                             $pdf->Cell(23, 5, ' ' . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(55, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(60, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getAddress1() . ' ' . $user_obj->getAddress2(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(65, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getCity() . ', ' . $user_obj->getProvince() . ' ' . $user_obj->getPostalCode(), $border, 0, 'L');
                             //Cheque Stub
                             $stub_2_offset = 95;
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             //Earnings
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             break;
                         case 'cheque_9209p':
                             $adjust_x = 0;
                             $adjust_y = -5;
                             if ($show_background == 1) {
                                 $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9209P.jpg', 0, 0, 210, 300);
                             }
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(42, $adjust_y));
                             $pdf->Cell(100, 10, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L');
                             $pdf->Cell(15, 10, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(25, $adjust_y));
                             $pdf->Cell(10, 10, TTi18n::gettext('Date:') . ' ', $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(182, $adjust_x), Misc::AdjustXY(25, $adjust_y));
                             $pdf->Cell(25, 10, $pay_stub['transaction_date_display'], $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(42, $adjust_y));
                             $pdf->Cell(35, 10, $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(57, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(62, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getAddress1() . ' ' . $user_obj->getAddress2(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(67, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getCity() . ', ' . $user_obj->getProvince() . ' ' . $user_obj->getPostalCode(), $border, 0, 'L');
                             //Cheque Stub
                             $stub_2_offset = 100;
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             //Earnings
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             break;
                         case 'cheque_dlt103':
                             $adjust_x = 0;
                             $adjust_y = -5;
                             if ($show_background == 1) {
                                 $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_dlt103.jpg', 0, 0, 210, 300);
                             }
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(54, $adjust_y));
                             $pdf->Cell(100, 10, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L');
                             $pdf->Cell(15, 10, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(33, $adjust_y));
                             $pdf->Cell(10, 10, TTi18n::gettext('Date:') . ' ', $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(182, $adjust_x), Misc::AdjustXY(33, $adjust_y));
                             $pdf->Cell(25, 10, $pay_stub['transaction_date_display'], $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(46, $adjust_y));
                             $pdf->Cell(35, 10, $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(46, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L');
                             //Cheque Stub
                             $stub_2_offset = 100;
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             //Earnings
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             break;
                         case 'cheque_dlt104':
                             $adjust_x = 0;
                             $adjust_y = -5;
                             if ($show_background == 1) {
                                 $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_dlt104.jpg', 0, 0, 210, 300);
                             }
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(52, $adjust_y));
                             $pdf->Cell(100, 10, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L');
                             $pdf->Cell(15, 10, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(33, $adjust_y));
                             $pdf->Cell(10, 10, TTi18n::gettext('Date:') . ' ', $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(182, $adjust_x), Misc::AdjustXY(33, $adjust_y));
                             $pdf->Cell(25, 10, $pay_stub['transaction_date_display'], $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(43, $adjust_y));
                             $pdf->Cell(35, 10, $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(48, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L');
                             //Cheque Stub
                             $stub_2_offset = 100;
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             //Earnings
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             break;
                         case 'cheque_cr_standard_form_1':
                             $adjust_x = 0;
                             $adjust_y = -5;
                             if ($show_background == 1) {
                                 $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9085.jpg', 0, 0, 210, 300);
                             }
                             $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(41, $adjust_y));
                             $pdf->Cell(100, 5, $pay_stub['entries'][40][0]['amount_words'] . TTi18n::gettext(' and ') . $pay_stub['entries'][40][0]['amount_cents'] . '/100 *****', $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(100, $adjust_x), Misc::AdjustXY(23, $adjust_y));
                             $pdf->Cell(38, 5, $pay_stub['transaction_date_display'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(136, $adjust_x), Misc::AdjustXY(32, $adjust_y));
                             $pdf->Cell(24, 5, '  $' . $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(33, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L');
                             //Cheque Stub
                             $stub_2_offset = 95;
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L');
                             //Earnings
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: $') . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: $') . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L');
                             //Signature lines
                             $pdf->setXY(Misc::AdjustXY(7, $adjust_x), Misc::AdjustXY(250, $adjust_y));
                             $border = 0;
                             $pdf->Cell(40, 5, TTi18n::gettext('Employee Signature:'), $border, 0, 'L');
                             $pdf->Cell(60, 5, '_____________________________', $border, 0, 'L');
                             $pdf->Cell(40, 5, TTi18n::gettext('Supervisor Signature:'), $border, 0, 'R');
                             $pdf->Cell(60, 5, '_____________________________', $border, 0, 'L');
                             $pdf->Ln();
                             $pdf->Cell(40, 5, '', $border, 0, 'R');
                             $pdf->Cell(60, 5, $user_obj->getFullName(), $border, 0, 'C');
                             $pdf->Ln();
                             $pdf->Cell(147, 5, '', $border, 0, 'R');
                             $pdf->Cell(60, 5, '_____________________________', $border, 0, 'C');
                             $pdf->Ln();
                             $pdf->Cell(140, 5, '', $border, 0, 'R');
                             $pdf->Cell(60, 5, TTi18n::gettext('(print name)'), $border, 0, 'C');
                             break;
                         case 'cheque_cr_standard_form_2':
                             $pdf_created_date = time();
                             $adjust_x = 0;
                             $adjust_y = -5;
                             if ($show_background == 1) {
                                 $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9085.jpg', 0, 0, 210, 300);
                             }
                             $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(41, $adjust_y));
                             $pdf->Cell(100, 5, $pay_stub['entries'][40][0]['amount_words'] . TTi18n::gettext(' and ') . $pay_stub['entries'][40][0]['amount_cents'] . '/100 *****', $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(100, $adjust_x), Misc::AdjustXY(23, $adjust_y));
                             $pdf->Cell(38, 5, $pay_stub['transaction_date_display'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(136, $adjust_x), Misc::AdjustXY(32, $adjust_y));
                             $pdf->Cell(24, 5, '$  ' . $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'L');
                             $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(33, $adjust_y));
                             $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L');
                             //Cheque Stub
                             $stub_2_offset = 110;
                             $pdf->SetFont('', 'U', 14);
                             $pdf->setXY(Misc::AdjustXY(65, $adjust_x), Misc::AdjustXY(100, $adjust_y));
                             $pdf->Cell(75, 5, TTi18n::gettext('Recipient Copy:'), $border, 0, 'C');
                             $pdf->SetFont('', '', 10);
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(110, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Date of Issue:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(130, 5, TTDate::getDate('DATE+TIME', $pdf_created_date), $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Date of Issue:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(130, 5, TTDate::getDate('DATE+TIME', $pdf_created_date), $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(120, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Recipient:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(110, 5, $user_obj->getFullName(), $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Recipient:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(130, 5, $user_obj->getFullName(), $border, 0, 'J');
                             //Earnings
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(130, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Amount:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(100, 5, ' $' . $pay_stub['entries'][40][0]['amount'], $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(130 + $stub_2_offset, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Amount:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(100, 5, ' $' . $pay_stub['entries'][40][0]['amount'], $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(140, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Regarding:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(100, 5, TTi18n::gettext('Payment from') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']) . ' ' . TTi18n::gettext('to') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'J');
                             $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(140 + $stub_2_offset, $adjust_y));
                             $pdf->SetFont('', 'B', 10);
                             $pdf->Cell(30, 5, TTi18n::gettext('Regarding:'), $border, 0, 'J');
                             $pdf->SetFont('', '', 10);
                             $pdf->Cell(100, 5, TTi18n::gettext('Payment from') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']) . ' ' . TTi18n::gettext('to') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'J');
                             $pdf->SetFont('', 'U', 14);
                             $pdf->setXY(Misc::AdjustXY(65, $adjust_x), Misc::AdjustXY(210, $adjust_y));
                             $pdf->Cell(75, 5, $company_obj->getName() . ' ' . TTi18n::gettext('Copy:'), $border, 0, 'C');
                             $pdf->setXY(Misc::AdjustXY(30, $adjust_x), Misc::AdjustXY(260, $adjust_y));
                             $column_widths = array('generated_by' => 25, 'signed_by' => 25, 'received_by' => 35, 'date' => 35, 'sin_ssn' => 35);
                             $line_h = 4;
                             $cell_h_min = $cell_h_max = $line_h * 4;
                             $pdf->SetFont('', '', 8);
                             $pdf->setFillColor(255, 255, 255);
                             $pdf->MultiCell($column_widths['generated_by'], $line_h, TTi18n::gettext('Generated By') . "\n\n\n ", 1, 'C', 1, 0);
                             $pdf->MultiCell($column_widths['signed_by'], $line_h, TTi18n::gettext('Signed By') . "\n\n\n ", 1, 'C', 1, 0);
                             $pdf->MultiCell($column_widths['received_by'], $line_h, TTi18n::gettext('Received By') . "\n\n\n ", 'T,L,B', 'C', 1, 0);
                             $pdf->MultiCell($column_widths['date'], $line_h, TTi18n::gettext('Date') . "\n\n\n ", 'T,B', 'C', 1, 0);
                             $pdf->MultiCell($column_widths['sin_ssn'], $line_h, TTi18n::gettext('SIN / SSN') . "\n\n\n ", 'T,R,B', 'C', 1, 0);
                             $pdf->Ln();
                             $pdf->SetFont('', '', 10);
                             break;
                     }
                     $i++;
                 }
                 $output = $pdf->Output('', 'S');
                 break;
         }
     }
     if (isset($output)) {
         return $output;
     }
     return FALSE;
 }
Beispiel #20
0
 /**
  * Converts a number to its word representation
  *
  * Private helper function, particularly for 'format2()'.  N.B. The
  * second argument is the 'SP' code which can be specified in the
  * format string for 'format2()' and is interpreted as follows:
  *  'SP' - returns upper-case spelling, e.g. 'FOUR HUNDRED'
  *  'Sp' - returns spelling with first character of each word
  *         capitalized, e.g. 'Four Hundred'
  *  'sp' - returns lower-case spelling, e.g. 'four hundred'
  *
  * @param int    $pn_num            number to be converted to words
  * @param bool   $pb_ordinal        boolean specifying if the number should
  *                                   be ordinal
  * @param string $ps_capitalization string for specifying capitalization
  *                                   options
  * @param string $ps_locale         language name abbreviation used for
  *                                   formatting numbers as spelled-out words
  *
  * @return   string
  * @access   private
  * @since    Method available since Release 1.5.0
  */
 function _spellNumber($pn_num, $pb_ordinal = false, $ps_capitalization = "SP", $ps_locale = "en_GB")
 {
     include_once "Numbers/Words.php";
     $hs_words = Numbers_Words::toWords($pn_num, $ps_locale);
     if (Pear::isError($hs_words)) {
         return $hs_words;
     }
     if ($pb_ordinal && substr($ps_locale, 0, 2) == "en") {
         if (($pn_rem = ($pn_numabs = abs($pn_num)) % 100) == 12) {
             $hs_words = substr($hs_words, 0, -2) . "fth";
         } else {
             if ($pn_rem >= 11 && $pn_rem <= 15) {
                 $hs_words .= "th";
             } else {
                 switch ($pn_numabs % 10) {
                     case 1:
                         $hs_words = substr($hs_words, 0, -3) . "first";
                         break;
                     case 2:
                         $hs_words = substr($hs_words, 0, -3) . "second";
                         break;
                     case 3:
                         $hs_words = substr($hs_words, 0, -3) . "ird";
                         break;
                     case 5:
                         $hs_words = substr($hs_words, 0, -2) . "fth";
                         break;
                     default:
                         switch (substr($hs_words, -1)) {
                             case "e":
                                 $hs_words = substr($hs_words, 0, -1) . "th";
                                 break;
                             case "t":
                                 $hs_words .= "h";
                                 break;
                             case "y":
                                 $hs_words = substr($hs_words, 0, -1) . "ieth";
                                 break;
                             default:
                                 $hs_words .= "th";
                         }
                 }
             }
         }
     }
     if (($hs_char = substr($ps_capitalization, 0, 1)) == strtolower($hs_char)) {
         $hb_upper = false;
         $hs_words = strtolower($hs_words);
     } else {
         if (($hs_char = substr($ps_capitalization, 1, 1)) == strtolower($hs_char)) {
             $hb_upper = false;
             $hs_words = ucwords($hs_words);
         } else {
             $hb_upper = true;
             $hs_words = strtoupper($hs_words);
         }
     }
     return $hs_words;
 }
 /**
  * @expectedException Numbers_Words_Exception
  * @expectedExceptionMessage Unable to include the Numbers/Words/lang.doesnotexist.php file
  */
 function testToCurrencyInvalidLocale()
 {
     $nw = new Numbers_Words();
     $nw->toCurrency(1, 'doesnotexist');
 }
 /**
  * Converts a currency value to its word representation
  * (with monetary units) in Portuguese Brazilian
  *
  * @param integer $int_curr         An international currency symbol
  *                                  as defined by the ISO 4217 standard (three characters)
  * @param integer $decimal          A money total amount without fraction part (e.g. amount of dollars)
  * @param integer $fraction         Fractional part of the money amount (e.g. amount of cents)
  *                                  Optional. Defaults to false.
  * @param integer $convert_fraction Convert fraction to words (left as numeric if set to false).
  *                                  Optional. Defaults to true.
  *
  * @return string  The corresponding word representation for the currency
  *
  * @access public
  * @author Igor Feghali <*****@*****.**>
  * @since  Numbers_Words 0.11.0
  */
 public function toCurrencyWords($int_curr, $decimal, $fraction = false, $convert_fraction = true)
 {
     $neg = 0;
     $ret = array();
     $nodec = false;
     /**
      * Negative ?
      * We can lose the '-' sign if we do the 
      * check after number_format() call (i.e. -0.01)
      */
     if (substr($decimal, 0, 1) == '-') {
         $decimal = -$decimal;
         $neg = 1;
     }
     /**
      * Removes leading zeros, spaces, decimals etc.
      * Adds thousands separator.
      */
     $num = number_format($decimal, 0, '', '');
     /**
      * Checking if given currency exists in driver.
      * If not, use default currency
      */
     $int_curr = strtoupper($int_curr);
     if (!isset($this->_currency_name[$int_curr])) {
         $int_curr = $this->def_currency;
     }
     /**
      * Currency names and plural
      */
     $curr_names = $this->_currency_names[$int_curr];
     if ($num > 0) {
         /**
          * Word representation of decimal
          */
         $ret[] = $this->toWords($num);
         /**
          * Special case.
          */
         if (substr($num, -6) == '000000') {
             $ret[] = trim($this->_curr_sep);
         }
         /**
          * Testing plural. Adding currency name
          */
         if ($num > 1) {
             $ret[] = $curr_names[0][1];
         } else {
             $ret[] = $curr_names[0][0];
         }
     }
     /**
      * Test if fraction was given and != 0
      */
     $fraction = (int) $fraction;
     if ($fraction) {
         /**
          * Removes leading zeros, spaces, decimals etc.
          * Adds thousands separator.
          */
         $num = number_format($fraction, 0, '.', '.');
         /**
          * Testing Range
          */
         if ($num < 0 || $num > 99) {
             return Numbers_Words::raiseError('Fraction out of range.');
         }
         /**
          * Have we got decimal?
          */
         if (count($ret)) {
             $ret[] = trim($this->_sep);
         } else {
             $nodec = true;
         }
         /**
          * Word representation of fraction
          */
         if ($convert_fraction) {
             $ret[] = $this->toWords($num);
         } else {
             $ret[] = $num;
         }
         /**
          * Testing plural
          */
         if ($num > 1) {
             $ret[] = $curr_names[1][1];
         } else {
             $ret[] = $curr_names[1][0];
         }
         /**
          * Have we got decimal?
          * If not, include currency name after cents.
          */
         if ($nodec) {
             $ret[] = trim($this->_curr_sep);
             $ret[] = $curr_names[0][0];
         }
     }
     /**
      * Negative ?
      */
     if ($neg) {
         $ret[] = $this->_minus;
     }
     return implode(' ', $ret);
 }
    $pdf->Cell(25, 4, "", 0, 0, 'C');
    $pdf->Ln(5);
    $contador = $contador + 1;
}
//Calculamos los valores del final de la factura
$importe4 = number_format($importe, 2, ".", ",");
$ivai = $lafila["iva"];
$impo = $importe * ($ivai / 100);
$impo = sprintf("%01.2f", $impo);
$total = $importe + $impo;
$total = sprintf("%01.2f", $total);
$impo = number_format($impo, 2, ".", ",");
$total = sprintf("%01.2f", $total);
$total2 = number_format($total, 2, ".", ",");
//Calculamos de numero a palabras
$nw = new Numbers_Words();
$pdf->SetY(235);
$pdf->Cell(33);
//Modificamos esta parte para que también muestra la parte fraccionaria y Nuevos Soles.
$decimales = explode(".", $total);
//$pdf->Cell(35,4,strtoupper($nw->toWords(round($total,0), "es") ." con ".$decimales[1]."/100 Nuevos Soles."),0,0,'L',0);
$pdf->Cell(35, 4, strtoupper($nw->toWords($decimales[0], "es") . " con " . $decimales[1] . "/100 Nuevos Soles."), 0, 0, 'L', 0);
$pdf->Ln(19);
$pdf->Cell(155);
$pdf->Cell(32, 4, $importe4, 0, 0, 'R', 0);
$pdf->Ln(8);
$pdf->Cell(155);
$pdf->Cell(10, 4, $lafila["iva"] . " %", 0, 0, 'R', 0);
$pdf->Cell(22, 4, $impo, 0, 0, 'R', 0);
$pdf->Ln(8);
$pdf->Cell(155);
if (DB::isError($q)) {
    die("db error: " . $q->getMessage());
}
$numRows = $q->numRows();
if ($numRows) {
    while ($row = $q->fetchRow()) {
        $internal_area = $internal_area + $row["med_dims"];
    }
}
if ($internal_area == 0) {
    $internal_area = '(tbc)';
} else {
    $internal_area .= ' m&sup2; / ' . sqmtr2sqft($internal_area) . ' ft&sup2; - these are approximate figures';
}
// summary screen
$nw = new Numbers_Words();
if ($dea_bedroom == '') {
    $dea_bedroom_word = "(tbc)";
} else {
    $dea_bedroom_word = ucwords($nw->toWords($dea_bedroom));
}
if ($dea_reception == '') {
    $dea_reception_word = "(tbc)";
} else {
    $dea_reception_word = ucwords($nw->toWords($dea_reception));
}
if ($dea_bathroom == '') {
    $dea_bathroom_word = "(tbc)";
} else {
    $dea_bathroom_word = ucwords($nw->toWords($dea_bathroom));
}
Beispiel #25
0
 /**
  * Solves a simple equation with two given numbers
  * and one operator as defined in $this->_operators.
  *
  * Also converts the numbers to words if required.
  *
  * @access protected
  * @return array    Array with equation and solution
  */
 function _solveSimpleEquation($one, $two, $operator)
 {
     $equation = sprintf($operator, $one, $two);
     $code = '$solution=' . $equation . ';';
     eval($code);
     if ($this->_numbersToText) {
         $equation = sprintf($operator, Numbers_Words::toWords($one), Numbers_Words::toWords($two));
     }
     return array($equation, $solution);
 }
Beispiel #26
0
 /**
  * Process the value
  *
  * @param var $value The value to process/format
  * @return string The processed value
  * @access private
  */
 function _process($value)
 {
     return Numbers_Words::toWords($value, $this->_language);
 }
Beispiel #27
0
 function toHtml()
 {
     // The captcha must desappear in frozen state
     if ($this->_flagFrozen) {
         return '';
     }
     switch ($this->_method) {
         case 'Numbers_Words':
             require_once 'Numbers/Words.php';
             isset($this->_value) || ($this->_value = rand(1, 1000));
             $html = ucfirst(Numbers_Words::toWords($this->_value, $this->_locale));
             $html .= '&nbsp;' . parent::toHtml();
             break;
         default:
             $html = '';
     }
     HTTP_Session2::set('_HTML_QuickForm_captcha', $this->_value);
     return $html;
 }