コード例 #1
0
 function testCustomPatterns()
 {
     $dateFormatter = new DateFormat();
     $time = mktime(9, 9, 9, 9, 1, 2004);
     $pattern = "'Hello' EEEE, 'it should be' MMM yyyy HH:mm:ss!!!";
     $wants = 'Hello Wednesday, it should be Sep 2004 09:09:09!!!';
     $this->assertEqual($wants, $dateFormatter->format($time, $pattern));
 }
コード例 #2
0
function load_ten_day_schedule()
{
    require_once 'com/tcshl/game/Schedule.php';
    require_once 'com/tcshl/game/Game.php';
    require_once 'com/tcshl/util/DateFormat.php';
    global $SEASON;
    global $smarty;
    // Build schedule
    $Schedule = new Schedule();
    $Schedule->loadUpcomingGames($SEASON, 0, 10);
    $GameArray = $Schedule->get_GameArray();
    $MobileDateFormat = new DateFormat();
    $MobileTimeFormat = new DateFormat();
    $smarty->assign('current_gamedate', -1);
    if (count($GameArray) > 0) {
        $smarty->assign('gameID', array());
        $smarty->assign('gameType', array());
        $smarty->assign('gameDate', array());
        $smarty->assign('gameTime', array());
        $smarty->assign('gameGuestTeam', array());
        $smarty->assign('gameGuestScore', array());
        $smarty->assign('gameHomeTeam', array());
        $smarty->assign('gameHomeScore', array());
        $smarty->assign('gameReferee1', array());
        $smarty->assign('gameReferee2', array());
        $smarty->assign('gameReferee3', array());
        $smarty->assign('postponed', array());
        $smarty->assign('announcementID', array());
        foreach ($GameArray as $Game) {
            $smarty->append('gameID', $Game->get_gameID());
            $smarty->append('gameType', $Game->get_gameType());
            $smarty->append('gameDate', $MobileDateFormat->formatTimestamp($Game->get_gameTime(), 'MOBILE_DATE_FORMAT'));
            $smarty->append('gameTime', $MobileTimeFormat->formatTimestamp($Game->get_gameTime(), 'MOBILE_TIME_FORMAT'));
            $smarty->append('gameGuestTeam', $Game->get_gameGuestTeamHumanReadable());
            $smarty->append('gameGuestScore', $Game->get_gameGuestScore());
            $smarty->append('gameHomeTeam', $Game->get_gameHomeTeamHumanReadable());
            $smarty->append('gameHomeScore', $Game->get_gameHomeScore());
            $smarty->append('gameReferee1', $Game->get_gameReferee1HumanReadable());
            $smarty->append('gameReferee2', $Game->get_gameReferee2HumanReadable());
            $smarty->append('gameReferee3', $Game->get_gameReferee3HumanReadable());
            $smarty->append('postponed', $Game->get_postponed());
            $smarty->append('announcementID', $Game->get_announcementID());
        }
    }
}
コード例 #3
0
 /**
  * Constructor
  *
  * @param   string f default NULL format string
  */
 public function __construct($f = NULL)
 {
     // Add some default formatters
     $this->setFormatter('printf', PrintfFormat::getInstance());
     $this->setFormatter('date', DateFormat::getInstance());
     $this->setFormatter('choice', ChoiceFormat::getInstance());
     $this->setFormatter('number', NumberFormat::getInstance());
     $this->setFormatter('array', ArrayFormat::getInstance());
     $this->setFormatter('hash', HashFormat::getInstance());
     parent::__construct($f);
 }
コード例 #4
0
ファイル: Users.php プロジェクト: Wicloz/UniversityWebsite
 public static function forceLogin($user = null, $remember = false)
 {
     if ($user->exists()) {
         DB::instance()->delete("user_sessions", array("", "hash", "=", Cookie::get(Config::get('remember/cookie_name'))));
         Session::put(Config::get('session/loggedId'), $user->id());
         if ($remember) {
             $hash = Hash::hashUnique();
             DB::instance()->insert("user_sessions", array('user_id' => $user->id(), 'hash' => $hash, 'expiry' => DateFormat::sql(time() + Config::get('remember/cookie_expiry'))));
             Cookie::put(Config::get('remember/cookie_name'), $hash, Config::get('remember/cookie_expiry'));
         }
         self::$_currentUser = new User();
     }
 }
コード例 #5
0
ファイル: ConstantsSeeder.php プロジェクト: aleguisf/fvdev1
 public function run()
 {
     Language::create(array('name' => 'Español', 'locale' => 'es'));
     BranchType::create(array('name' => 'Productos'));
     BranchType::create(array('name' => 'Servicios'));
     PaymentType::create(array('name' => 'Efectivo'));
     PaymentType::create(array('name' => 'Aplicar Crédito'));
     PaymentType::create(array('name' => 'Transferencia Bancaria'));
     PaymentType::create(array('name' => 'cheque'));
     InvoiceStatus::create(array('name' => 'Emitido'));
     InvoiceStatus::create(array('name' => 'Enviado'));
     InvoiceStatus::create(array('name' => 'Visto'));
     InvoiceStatus::create(array('name' => 'Parcial'));
     InvoiceStatus::create(array('name' => 'Pagado'));
     InvoiceStatus::create(array('name' => 'Anulado'));
     Frequency::create(array('name' => 'Mensual'));
     Frequency::create(array('name' => 'Trimestral'));
     Frequency::create(array('name' => 'Semestral'));
     Frequency::create(array('name' => 'Anual'));
     Currency::create(array('name' => 'Bolivianos', 'code' => 'BS', 'symbol' => 'Bs', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
     DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
     DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
     DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
     DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
     DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
     DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
     DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
     DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
     DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
     DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
     DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
     /*	
     d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
     D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
     m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
     M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
     yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
     */
     $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US & Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US & Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US & Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US & Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
     foreach ($timezones as $name => $location) {
         Timezone::create(array('name' => $name, 'location' => $location));
     }
 }
コード例 #6
0
ファイル: login.php プロジェクト: Wicloz/UniversityWebsite
function createPage($smarty)
{
    if (Users::loggedIn()) {
        Redirect::to('?page=profile');
    }
    if (Input::exists()) {
        if (Input::get('action') === 'register') {
            $validation = new Validate();
            $validation->check($_POST, array_merge(Config::get('validation/register_info'), Config::get('validation/set_password')));
            if ($validation->passed()) {
                try {
                    Users::create(array('student_id' => Input::get('sid'), 'password' => Hash::hashPassword(Input::get('password')), 'permission_group' => 1, 'name' => Input::get('name'), 'email' => Input::get('email'), 'umail' => Input::get('sid') . '@umail.leidenuniv.nl', 'phone' => Phone::formatNumber(Input::get('phone')), 'joined' => DateFormat::sql()));
                    Users::login(Input::get('sid'), Input::get('password'));
                    Notifications::addSuccess('You have been succesfully registered!');
                    Redirect::to('?page=profile');
                } catch (Exception $e) {
                    Notifications::addError($e->getMessage());
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'login') {
            $validation = new Validate();
            $validation->check($_POST, Config::get('validation/login'));
            if ($validation->passed()) {
                $login = Users::login(Input::get('sid'), Input::get('password'), Input::getAsBool('remember'));
                if ($login) {
                    Notifications::addSuccess('You have been logged in!');
                    Redirect::to('?page=profile');
                } else {
                    Notifications::addValidationFail('Invalid student number or password.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
    }
    $smarty->assign('remember', Input::getAsBool('remember'));
    $smarty->assign('name', Input::get('name'));
    $smarty->assign('sid', Input::get('sid'));
    $smarty->assign('email', Input::get('email'));
    $smarty->assign('phone', Input::get('phone'));
    return $smarty;
}
コード例 #7
0
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'taxRates' => TaxRate::orderBy('name')->get()];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_NOTIFICATIONS) {
             $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
             return View::make('accounts.notifications', $data);
         } else {
             if ($section == ACCOUNT_IMPORT_EXPORT) {
                 return View::make('accounts.import_export');
             } else {
                 if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                     $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                     return View::make("accounts.{$subSection}", $data);
                 } else {
                     if ($section == ACCOUNT_PRODUCTS) {
                         $data = ['account' => Auth::user()->account];
                         return View::make('accounts.products', $data);
                     } else {
                         if ($section == ACCOUNT_BRANCHES) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.branches', $data);
                         } else {
                             if ($section == ACCOUNT_GROUPS) {
                                 $data = ['account' => Auth::user()->account];
                                 return View::make('accounts.groups', $data);
                             } else {
                                 if ($section == ACCOUNT_USERS) {
                                     $data = ['account' => Auth::user()->account];
                                     return View::make('accounts.user_management', $data);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #8
0
 /**
  * Inserts or updates an event to the specific calendar.
  * If we try to edit a task without due date, it deletes it
  *
  * @param PcTask $task
  * @param string $calendarUrl
  * @param bool $updateEmailAddress (=false)
  * @return int|bool the id of the event - false if the event we try to add/edit hasn't got due date
  */
 public function createOrUpdateEvent(PcTask $task, $updateEmailAddress = false)
 {
     $event = null;
     $googleCalendarEventId = $task->getGoogleCalendarEventId();
     $mode = self::EVENT_CREATE_MODE;
     if (strlen($googleCalendarEventId)) {
         $event = $this->getEvent($googleCalendarEventId);
         if (is_object($event)) {
             $mode = self::EVENT_UPDATE_MODE;
         }
         if ($this->hasEventBeenDeleted($event)) {
             return;
         }
     }
     if (SfConfig::get('app_gcal_debug')) {
         if ($mode == self::EVENT_CREATE_MODE) {
             error_log('Creating task on GCal for the Plancake task ' . $task->getId() . ' ' . $task->getDescription());
         } else {
             error_log('Editing task on GCal for the Plancake task ' . $task->getId() . ' ' . $task->getDescription());
         }
     }
     if ($mode == self::EVENT_CREATE_MODE) {
         $event = $this->service->newEventEntry();
     }
     if (!$task->getDueDate() || $task->isCompleted()) {
         // A task without due date or completed shouldn't be on Google Calendar
         $this->deleteEventById($googleCalendarEventId);
         $task->removeGoogleCalendarEventId();
         return false;
     }
     // {{{ Adding extended property to patch a problem we have this the integration:
     // search 'EVENT_EXTENDED_PROPERTY_TASK_ID' in this file
     $this->setExtendedProperty($event, self::EVENT_EXTENDED_PROPERTY_TASK_ID, $task->getId());
     // }}}
     $event->title = $this->service->newTitle($task->getDescription());
     $event->where = array($this->service->newWhere(""));
     $event->content = $this->service->newContent($task->getNote());
     // Setting the date using RFC 3339 format
     list($startDate, $startTime) = DateFormat::fromLocalDateAndTime2GMTDateAndTime($task->getDueDate("Y-m-d"), $task->getDueTime());
     $timeObject = new PcTime();
     if ($startTime > 0) {
         $startTime = $timeObject->createFromIntegerValue($startTime)->get5CharsRepresentation();
     } else {
         $startTime = null;
     }
     //$endDate = "2011-01-20";
     //$endTime = "16:00";
     //$userTimezone = $this->user->getPcTimezone();
     //$tzOffset = ($userTimezone->getOffset()/60);
     // right now, $tzOffset can be -8, but we need -08
     //$tzOffset = "-08";
     if ($task->getRepetitionId() > 0) {
         //            $recurrence = "DTSTART;VALUE=DATE:20110501\r\n" .
         //                    "DTEND;VALUE=DATE:20110502\r\n" .
         //                    "RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20110904\r\n";
         $dtStart = $task->getDueDate("Ymd");
         if ($startTime !== null) {
             $dtStart = $dtStart . 'T' . str_replace(':', '', $startTime) . '00Z';
         }
         $recurrence = "DTSTART:{$dtStart}\r\n" . "RRULE:{$task->getRepetitionICalRrule()}\r\n";
         $event->recurrence = $this->service->newRecurrence($recurrence);
     } else {
         $when = $this->service->newWhen();
         if ($startTime !== null) {
             $when->startTime = "{$startDate}T{$startTime}:00.000Z";
         } else {
             $when->startTime = $startDate;
         }
         // $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
         $event->when = array($when);
     }
     if ($mode == self::EVENT_CREATE_MODE) {
         $newEvent = null;
         try {
             $newEvent = $this->service->insertEvent($event, $this->getCalendarUrl());
         } catch (Exception $e) {
             $newEvent = $this->service->insertEvent($event, $this->getCalendarUrl());
         }
     } else {
         // {{{ rather then running just $event->save() ,
         // we try many times, as sometimes the updating is a bit
         //quirky on Google Calendar end
         try {
             $event->save();
         } catch (Exception $e) {
             try {
                 $event->save();
             } catch (Exception $e) {
                 $event->save();
             }
         }
         // }}}
         $newEvent = $event;
     }
     if ($updateEmailAddress) {
         $dbEntry = PcGoogleCalendarPeer::retrieveByUser($this->user);
         $dbEntry->setEmailAddress($newEvent->author[0]->email->text)->save();
     }
     $eventId = $this->getEventId($newEvent);
     if ($mode == self::EVENT_CREATE_MODE) {
         $task->setGoogleCalendarEventId($eventId);
     }
     return $eventId;
 }
コード例 #9
0
 /**
  * Renders the localized version of the date-time value.
  * If the culture is not specified, the default application
  * culture will be used.
  * This method overrides parent's implementation.
  */
 protected function renderBody()
 {
     $app = $this->Application->getGlobalization();
     //initialized the default class wide formatter
     if (is_null(self::$formatter)) {
         self::$formatter = new DateFormat($app->Culture);
     }
     $culture = $this->getCulture();
     $value = $this->getValue();
     //return the specific cultural formatted date time
     if (strlen($culture) && $app->Culture !== $culture) {
         $formatter = new DateFormat($culture);
         return $formatter->format($value, $this->getPattern());
     }
     $charset = $this->getCharset();
     if (empty($charset)) {
         $charset = 'UTF-8';
     }
     //return the application wide culture formatted date time.
     return self::$formatter->format($value, $this->getPattern(), $charset);
 }
コード例 #10
0
 /**
  * Renders the localized version of the date-time value.
  * If the culture is not specified, the default application
  * culture will be used.
  * This method overrides parent's implementation.
  */
 protected function getFormattedDate()
 {
     $value = $this->getValue();
     $defaultText = $this->getDefaultText();
     if (empty($value) && !empty($defaultText)) {
         return $this->getDefaultText();
     }
     $app = $this->getApplication()->getGlobalization();
     //initialized the default class wide formatter
     if (self::$formatter === null) {
         self::$formatter = new DateFormat($app->getCulture());
     }
     $culture = $this->getCulture();
     //return the specific cultural formatted date time
     if (strlen($culture) && $app->getCulture() !== $culture) {
         $formatter = new DateFormat($culture);
         return $formatter->format($value, $this->getPattern(), $this->getCharset());
     }
     //return the application wide culture formatted date time.
     $result = self::$formatter->format($value, $this->getPattern(), $this->getCharset());
     return $result;
 }
コード例 #11
0
ファイル: PcTask.php プロジェクト: ntemple/intelli-plancake
 /**
  * The same method is in the JS code: see PLANCAKE.localAPi__isTaskOnThisDay
  * 
  * @param int $day - in the format YYYY-MM-DD (e.g.: 2011-12-25)
  * @return bool
  */
 public function isOnThisDay($day)
 {
     if ($day === null || !strlen($day)) {
         return false;
     }
     $dayTimestamp = strtotime($day);
     $dayDowIndex = date('w', $dayTimestamp);
     // 0 -> Sun ...... 6-> Sat
     $taskDueDate = $this->getDueDate('Y-m-d');
     $taskDueDateTimestamp = strtotime($taskDueDate);
     $taskDueDateDowIndex = date('w', $taskDueDateTimestamp);
     // 0 -> Sun ...... 6-> Sat
     $taskRepetitionId = $this->getRepetitionId();
     $taskRepetitionParam = $this->getRepetitionParam();
     $daysBetweenDayAndDueDate = ($dayTimestamp - $taskDueDateTimestamp) / 86400;
     $weeksBetweenDayAndDueDate = $daysBetweenDayAndDueDate / 7;
     $monthsBetweenDayAndDueDate = ((int) date('Y', $dayTimestamp) - (int) date('Y', $taskDueDateTimestamp)) * 12 + ((int) date('n', $dayTimestamp) - (int) date('n', $taskDueDateTimestamp));
     if (!$taskDueDate) {
         return false;
     }
     // this is a repetiting task starting in the future, not on the current day
     if ($taskRepetitionId && $taskDueDateTimestamp > $dayTimestamp) {
         return false;
     }
     if ($taskDueDate == $day) {
         return true;
     }
     if ($taskRepetitionId < 7) {
         // every Sun, every Mon, ... or every Sat
         if ($taskRepetitionId - 1 === $dayDowIndex) {
             return true;
         }
     }
     if ($taskRepetitionId == 8) {
         // every day
         return true;
     }
     if ($taskRepetitionId == 9) {
         // every weekday
         if ($dayDowIndex > 0 && $dayDowIndex < 6) {
             return true;
         }
     }
     if ($taskRepetitionId == 10 && $taskRepetitionParam) {
         // every X days
         if (!($daysBetweenDayAndDueDate % $taskRepetitionParam)) {
             return true;
         }
     }
     if ($taskRepetitionId == 11) {
         // every week
         if ($dayDowIndex === $taskDueDateDowIndex) {
             return true;
         }
     }
     if ($taskRepetitionId == 12) {
         // every X weeks
         if ($dayDowIndex === $taskDueDateDowIndex && !($weeksBetweenDayAndDueDate % $taskRepetitionParam)) {
             return true;
         }
     }
     if ($taskRepetitionId == 13) {
         // every month on the due date day
         if (date('d', $taskDueDateTimestamp) === date('d', $dayTimestamp)) {
             return true;
         }
     }
     if ($taskRepetitionId == 14) {
         // every X months on the due date day
         if (date('d', $taskDueDateTimestamp) === date('d', $dayTimestamp) && !($monthsBetweenDayAndDueDate % $taskRepetitionParam)) {
             return true;
         }
     }
     if ($taskRepetitionId == 15) {
         // every year
         if (date('d', $taskDueDateTimestamp) === date('d', $dayTimestamp) && date('n', $taskDueDateTimestamp) === date('n', $dayTimestamp)) {
             return true;
         }
     }
     if ($taskRepetitionId == 16) {
         // every X years
         if (date('d', $taskDueDateTimestamp) === date('d', $dayTimestamp) && date('n', $taskDueDateTimestamp) === date('n', $dayTimestamp) && !((date('Y', $dayTimestamp) - date('Y', $taskDueDateTimestamp)) % $taskRepetitionParam)) {
             return true;
         }
     }
     if ($taskRepetitionId == 18) {
         // every [select later] month(s) on the last day
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && date('t', $dayTimestamp) == date('d', $dayTimestamp)) {
             return true;
         }
     }
     if ($taskRepetitionId == 19) {
         // every [select later] month(s) on the second last day
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && date('t', $dayTimestamp) - 1 == date('d', $dayTimestamp)) {
             return true;
         }
     }
     if ($taskRepetitionId >= 20 && $taskRepetitionId <= 26) {
         // every X month(s) on the first Sun/Mon..../Sat
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && $dayDowIndex == $taskRepetitionId - 20 && date('j', $dayTimestamp) <= 7) {
             return true;
         }
     }
     if ($taskRepetitionId >= 27 && $taskRepetitionId <= 33) {
         // every X month(s) on the last Sun/Mon..../Sat
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && $dayDowIndex == $taskRepetitionId - 27 && date('j', $dayTimestamp) > date('t', $dayTimestamp) - 7) {
             return true;
         }
     }
     if ($taskRepetitionId == 34) {
         // repeat weekly on some weekdays
         $weekdaysSet = DateFormat::fromIntegerToWeekdaysSetForRepetition($taskRepetitionParam);
         $key = strtolower(date('D', $dayTimestamp));
         if ($weekdaysSet[$key]) {
             return true;
         }
     }
     if ($taskRepetitionId >= 40 && $taskRepetitionId <= 46) {
         // every X month(s) on the second Sun/Mon..../Sat
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && $dayDowIndex == $taskRepetitionId - 40 && (date('j', $dayTimestamp) > 7 && date('j', $dayTimestamp) <= 14)) {
             return true;
         }
     }
     if ($taskRepetitionId >= 50 && $taskRepetitionId <= 56) {
         // every X month(s) on the third Sun/Mon..../Sat
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && $dayDowIndex == $taskRepetitionId - 50 && (date('j', $dayTimestamp) > 14 && date('j', $dayTimestamp) <= 21)) {
             return true;
         }
     }
     if ($taskRepetitionId >= 60 && $taskRepetitionId <= 66) {
         // every X month(s) on the fourth Sun/Mon..../Sat
         if (!($monthsBetweenDayAndDueDate % $taskRepetitionParam) && $dayDowIndex == $taskRepetitionId - 60 && (date('j', $dayTimestamp) > 21 && date('j', $dayTimestamp) <= 28)) {
             return true;
         }
     }
     return false;
 }
コード例 #12
0
ファイル: year.php プロジェクト: BackupTheBerlios/horux-svn
 public function getData()
 {
     if (isset($this->Request['f1'])) {
         $year = $this->Request['f3'];
         $this->employee = new employee($this->Request['f2']);
     } else {
         $year = $this->FilterYear->getSelectedValue();
     }
     $config = $this->employee->getConfig();
     $months = array();
     $app = $this->getApplication()->getGlobalization();
     $nHolidays = 0;
     $totalYearHoursX = 0;
     $nWeekH = 0;
     for ($i = 1; $i <= 12; $i++) {
         $wt = $this->employee->getWorkingTime(1, $i, $year);
         $monthTemp = 0;
         if ($wt) {
             $nHolidays = bcadd($nHolidays, bcdiv($wt['holidaysByYear'], 12, 4), 4);
             $nbreOfDay = date("t", mktime(0, 0, 0, $i, 1, $year));
             for ($day = 1; $day <= $nbreOfDay; $day++) {
                 $todo = $this->employee->getDayTodo($day, $i, $year);
                 if ($todo) {
                     $totalYearHoursX = bcadd($totalYearHoursX, $todo, 4);
                 }
             }
             $dayPerWeek = 0;
             if ($wt['mondayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['mondayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['tuesdayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['tuesdayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['wednesdayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['wednesdayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['thursdayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['thursdayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['fridayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['fridayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['saturdayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['saturdayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['sundayTime_m'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($wt['sundayTime_a'] > 0) {
                 $dayPerWeek += 0.5;
             }
             if ($dayPerWeek > 0) {
                 $nWeekH = bcadd($nWeekH, bcdiv(bcdiv($wt['holidaysByYear'], 12, 4), $dayPerWeek, 4), 4);
             }
         }
     }
     $this->daysVacation->Text = sprintf("%.02f %s / %.02f " . Prado::localize('weeks'), $nHolidays, Prado::localize('days'), $nWeekH);
     $this->daysVacationLastYear->Text = sprintf("%.02f", $this->employee->geHolidaystMonth($year - 1, 12));
     $this->totalVacation->Text = sprintf("%.02f", bcadd($nHolidays, $this->daysVacationLastYear->Text, 4));
     $this->hoursBalance->Text = sprintf("%.02f", $this->employee->getOvertimeLastYear($year - 1));
     $totalYearHours100 = 0;
     $totalYearHoursX2 = 0;
     $hoursWorked = 0;
     $nbreHolidaysDay = 0;
     $nbreHolidaysHour = 0;
     $nbreAbsenceDay2 = 0;
     $nbreAbsenceHour2 = 0;
     $totalHours = 0;
     for ($month = 1; $month <= 12; $month++) {
         $absentHoursComp = 0;
         $_month = new DateFormat($app->getCulture());
         $months[$month]['month'] = $_month->format("1.{$month}.{$year}", "MMMM");
         $months[$month]['occupancy'] = $this->employee->getPercentage(1, $month, $year);
         $nbreOfDay = date("t", mktime(0, 0, 0, $month, 1, $year));
         $HoursMonth = 0;
         $HoursMonthAtX = 0;
         $HoursDone = 0;
         $nWorkingDay = 0;
         $months[$month]['hours100'] = 0;
         $wt = $this->employee->getWorkingTime(1, $month, $year);
         for ($day = 1; $day <= $nbreOfDay; $day++) {
             $dayTodo = $this->employee->getDayTodo($day, $month, $year);
             $HoursMonth = bcadd($HoursMonth, $dayTodo, 4);
             $tmp = $this->employee->getDayDone($day, $month, $year);
             if ($tmp['compensation'] > 0) {
                 $absentHoursComp = bcadd($absentHoursComp, $tmp['compensation'], 4);
             }
             $HoursDone = bcadd($HoursDone, $tmp['done'], 4);
             if ($dayTodo) {
                 $nWorkingDay++;
             }
             if ($this->employee->isAWorkingDay($year, $month, $day) > 0 && !$this->employee->isNonWorkingDay($day, $month, $year)) {
                 $months[$month]['hours100'] = bcadd($months[$month]['hours100'], bcdiv($wt['hoursByWeek'], $config['daysByWeek'], 4), 4);
             }
         }
         $totalHourWorked = $HoursDone;
         if ($HoursMonth > 0) {
             if ($months[$month]['occupancy'] > 0) {
                 $months[$month]['hours100'] = sprintf("%.02f", $months[$month]['hours100']);
             } else {
                 $months[$month]['hours100'] = sprintf("%.02f", 0);
             }
             $totalYearHours100 = bcadd($months[$month]['hours100'], $totalYearHours100, 2);
         }
         $months[$month]['hoursX'] = sprintf("%.02f", $HoursMonth);
         $totalYearHoursX2 = bcadd($months[$month]['hoursX'], $totalYearHoursX2, 2);
         $defaultHolidayTimeCode = $this->employee->getDefaultHolidaysCounter();
         $holidays = $this->employee->getRequest($year, $month, $defaultHolidayTimeCode);
         $months[$month]['nbreHolidaysDay'] = sprintf("%.02f", $holidays['nbre']);
         $nbreHolidaysDay = bcadd($nbreHolidaysDay, $months[$month]['nbreHolidaysDay'], 2);
         if ($nWorkingDay > 0) {
             $holidaysHour = bcmul($holidays['nbre'], bcdiv($wt['hoursByWeek'], $config['daysByWeek'], 4), 4);
             //  bcmul(bcdiv($HoursMonth,$nWorkingDay,4),$holidays['nbre'],4);
             $nbreHolidaysHour = bcadd($nbreHolidaysHour, $holidaysHour, 2);
         }
         $months[$month]['nbreHolidaysHour'] = sprintf("%.02f", $holidaysHour);
         $totalHourWorked = bcsub($totalHourWorked, $holidaysHour, 4);
         if ($month == 1) {
             $months[$month]['holidayBalance'] = sprintf("%.02f", $this->totalVacation->Text - $months[$month]['nbreHolidaysDay']);
         } else {
             $months[$month]['holidayBalance'] = sprintf("%.02f", $months[$month - 1]['holidayBalance'] - $months[$month]['nbreHolidaysDay']);
         }
         $nbreLeaveHour = $this->employee->getMonthLeaveRequest($month, $year);
         $months[$month]['nbreLeaveHour'] = sprintf("%.02f", $nbreLeaveHour);
         $totalHourWorked = bcsub($totalHourWorked, $nbreLeaveHour, 4);
         $nbreLeaveDay = 0;
         if ($nbreLeaveHour > 0) {
             $wt = $this->employee->getWorkingTime(1, $month, $year);
             $config = $this->employee->getConfig();
             $hoursByDay = bcdiv($wt['hoursByWeek'], $config['daysByWeek'], 4);
             if ($wt['calendarType'] == 1) {
                 $hoursByDay = bcdiv(bcmul($wt['workingPercent'], $hoursByDay, 4), 100, 4);
             }
             $nbreLeaveDay = bcdiv($nbreLeaveHour, $hoursByDay, 4);
         }
         $months[$month]['nbreLeaveDay'] = sprintf("%.02f", $nbreLeaveDay);
         $nbreAbsenceDay = $this->employee->getMonthAbsentRequest($month, $year);
         if ($this->employee->getHoursByDay($month, $year) > 0) {
             $nbreAbsenceDay = bcadd($nbreAbsenceDay, bcdiv($absentHoursComp, $this->employee->getHoursByDay($month, $year), 4), 4);
         }
         $months[$month]['nbreAbsenceDay'] = sprintf("%.02f", $nbreAbsenceDay);
         $nbreAbsenceDay2 = bcadd($nbreAbsenceDay2, $nbreAbsenceDay, 2);
         if ($nWorkingDay > 0) {
             $wt = $this->employee->getWorkingTime(1, $month, $year);
             if ($wt['calendarType'] == 1) {
                 $nbreAbsenceHour = bcmul(bcdiv($HoursMonth, $nWorkingDay, 4), $nbreAbsenceDay, 4);
             } else {
                 $nbreAbsenceHour = bcmul(bcdiv($months[$month]['hours100'], $nWorkingDay, 4), $nbreAbsenceDay, 4);
             }
             $nbreAbsenceHour2 = bcadd($nbreAbsenceHour, $nbreAbsenceHour2, 2);
         }
         $months[$month]['nbreAbsenceHour'] = sprintf("%.02f", $nbreAbsenceHour);
         $totalHourWorked = bcsub($totalHourWorked, $nbreAbsenceHour, 4);
         $months[$month]['hoursWorked'] = sprintf("%.02f", $totalHourWorked);
         $hoursWorked = bcadd($hoursWorked, $months[$month]['hoursWorked'], 2);
         $months[$month]['totalHours'] = sprintf("%.02f", $HoursDone);
         $totalHours = bcadd($totalHours, $HoursDone, 2);
         $months[$month]['monthBalance'] = bcsub($months[$month]['totalHours'], $months[$month]['hoursX'], 2);
         $totalYearHoursX = bcsub($totalYearHoursX, $months[$month]['totalHours'], 2);
         $months[$month]['hoursDueYear'] = sprintf("%.02f", $totalYearHoursX);
         $hoursDueYearSubHolidays = 0;
         if ($nWorkingDay > 0) {
             $hoursDueYearSubHolidays = bcmul(bcdiv($HoursMonth, $nWorkingDay, 4), $months[$month]['holidayBalance'], 4);
         }
         $hoursDueYearSubHolidays = bcsub($totalYearHoursX, $hoursDueYearSubHolidays, 2);
         $months[$month]['hoursDueYearSubHolidays'] = sprintf("%.02f", $hoursDueYearSubHolidays);
         if (12 - $month > 0) {
             $months[$month]['average'] = bcdiv($months[$month]['hoursDueYearSubHolidays'], 12 - $month, 2);
         } else {
             $months[$month]['average'] = "";
         }
     }
     $months[13] = array();
     $months[14]['month'] = Prado::localize('Totals');
     $months[14]['hours100'] = sprintf("%.02f", $totalYearHours100);
     $months[14]['hoursX'] = sprintf("%.02f", $totalYearHoursX2);
     $months[14]['hoursWorked'] = sprintf("%.02f", $hoursWorked);
     $months[14]['nbreHolidaysDay'] = sprintf("%.02f", $nbreHolidaysDay);
     $months[14]['nbreHolidaysHour'] = sprintf("%.02f", $nbreHolidaysHour);
     $months[14]['nbreAbsenceDay'] = sprintf("%.02f", $nbreAbsenceDay2);
     $months[14]['nbreAbsenceHour'] = sprintf("%.02f", $nbreAbsenceHour2);
     $months[14]['totalHours'] = sprintf("%.02f", $totalHours);
     $months[15] = array();
     $months[16]['month'] = Prado::localize('Total do be done');
     $months[16]['hoursX'] = sprintf("%.02f", $totalYearHoursX2 - $this->hoursBalance->Text);
     return $months;
 }
コード例 #13
0
ファイル: Tables.php プロジェクト: Wicloz/UniversityWebsite
 public static function events($history, $subject = null)
 {
     $results = Queries::events($history, $subject);
     $now_pos = 0;
     foreach ($results as $index => $entry) {
         if ($entry->type === 'assignment' && strtotime($entry->date) < strtotime('now')) {
             $now_pos = $index + 1;
         } elseif (strtotime($entry->date) < strtotime('today')) {
             $now_pos = $index + 1;
         }
         if ($entry->type === 'assignment') {
             $entry->date = DateFormat::dateTimeTable($entry->date);
         } elseif ($entry->type === 'exam') {
             $entry->date = DateFormat::dateTable($entry->date);
         } elseif ($entry->type === 'planning') {
             $entry->date = DateFormat::dateTable($entry->date);
         }
     }
     $today = new stdClass();
     $today->todayRow = true;
     $today->id = 'today';
     $today->completion = false;
     $today->date = '<b>' . DateFormat::dateTimeTable() . '</b>';
     $today->type = '<b>-</b>';
     $today->subject_name = '</a><b>Today is a gift</b><a href="">';
     $today->task = '<b>Thats why it\'s called the present</b>';
     $today->state = '<b>-</b>';
     array_splice($results, $now_pos, 0, array($today));
     return $results;
 }
コード例 #14
0
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_PAYMENTS) {
             $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
             $accountGateway = null;
             $config = null;
             $configFields = null;
             $selectedCards = 0;
             if (count($account->account_gateways) > 0) {
                 $accountGateway = $account->account_gateways[0];
                 $config = $accountGateway->config;
                 $selectedCards = $accountGateway->accepted_credit_cards;
                 $configFields = json_decode($config);
                 foreach ($configFields as $configField => $value) {
                     $configFields->{$configField} = str_repeat('*', strlen($value));
                 }
             } else {
                 $accountGateway = AccountGateway::createNew();
                 $accountGateway->gateway_id = GATEWAY_MOOLAH;
             }
             $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
             $recommendedGatewayArray = array();
             foreach ($recommendedGateways as $recommendedGateway) {
                 $arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
                 $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
             }
             $creditCardsArray = unserialize(CREDIT_CARDS);
             $creditCards = [];
             foreach ($creditCardsArray as $card => $name) {
                 if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
                 } else {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
                 }
             }
             $otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
             $recommendedGatewayArray['Other Options'] = $otherItem;
             $gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
             foreach ($gateways as $gateway) {
                 $paymentLibrary = $gateway->paymentlibrary;
                 $gateway->fields = $gateway->getFields();
                 if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
                     $accountGateway->fields = $gateway->fields;
                 }
             }
             $data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => $gateways, 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
             return View::make('accounts.payments', $data);
         } else {
             if ($section == ACCOUNT_NOTIFICATIONS) {
                 $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
                 return View::make('accounts.notifications', $data);
             } else {
                 if ($section == ACCOUNT_IMPORT_EXPORT) {
                     return View::make('accounts.import_export');
                 } else {
                     if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                         $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                         if ($subSection == ACCOUNT_INVOICE_DESIGN) {
                             $invoice = new stdClass();
                             $client = new stdClass();
                             $invoiceItem = new stdClass();
                             $client->name = 'Sample Client';
                             $client->address1 = '';
                             $client->city = '';
                             $client->state = '';
                             $client->postal_code = '';
                             $client->work_phone = '';
                             $client->work_email = '';
                             $invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber();
                             $invoice->invoice_date = date_create()->format('Y-m-d');
                             $invoice->account = json_decode(Auth::user()->account->toJson());
                             $invoice->amount = $invoice->balance = 100;
                             $invoiceItem->cost = 100;
                             $invoiceItem->qty = 1;
                             $invoiceItem->notes = 'Notes';
                             $invoiceItem->product_key = 'Item';
                             $invoice->client = $client;
                             $invoice->invoice_items = [$invoiceItem];
                             $data['invoice'] = $invoice;
                             $data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get();
                         }
                         return View::make("accounts.{$subSection}", $data);
                     } else {
                         if ($section == ACCOUNT_PRODUCTS) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.products', $data);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #15
0
ファイル: Update.php プロジェクト: Wicloz/UniversityWebsite
 private static function getFormattedInput($fields)
 {
     $data = array();
     foreach ($fields as $field => $type) {
         if (Input::has($field)) {
             if ($type === 'datetime') {
                 $data[$field] = DateFormat::sql(Input::get($field));
             } elseif ($type === 'date') {
                 $data[$field] = DateFormat::sqlDate(Input::get($field));
             } elseif ($type === 'time') {
                 $data[$field] = DateFormat::sqlTime(Input::get($field));
             } else {
                 $data[$field] = Input::get($field);
             }
         }
     }
     return $data;
 }
コード例 #16
0
 public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
 {
     if ($section == ACCOUNT_DETAILS) {
         $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get()];
         return View::make('accounts.details', $data);
     } else {
         if ($section == ACCOUNT_PAYMENTS) {
             $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
             $accountGateway = null;
             $config = null;
             $configFields = null;
             $selectedCards = 0;
             if (count($account->account_gateways) > 0) {
                 $accountGateway = $account->account_gateways[0];
                 $config = $accountGateway->config;
                 $selectedCards = $accountGateway->accepted_credit_cards;
                 $configFields = json_decode($config);
                 foreach ($configFields as $configField => $value) {
                     $configFields->{$configField} = str_repeat('*', strlen($value));
                 }
             }
             $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
             $recommendedGatewayArray = array();
             foreach ($recommendedGateways as $recommendedGateway) {
                 $arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
                 $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
             }
             $creditCardsArray = unserialize(CREDIT_CARDS);
             $creditCards = [];
             foreach ($creditCardsArray as $card => $name) {
                 if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
                 } else {
                     $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
                 }
             }
             $otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
             $recommendedGatewayArray['Other Options'] = $otherItem;
             $data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
             foreach ($data['gateways'] as $gateway) {
                 $paymentLibrary = $gateway->paymentlibrary;
                 $gateway->fields = $gateway->getFields();
                 if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
                     $accountGateway->fields = $gateway->fields;
                 }
             }
             return View::make('accounts.payments', $data);
         } else {
             if ($section == ACCOUNT_NOTIFICATIONS) {
                 $data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
                 return View::make('accounts.notifications', $data);
             } else {
                 if ($section == ACCOUNT_IMPORT_EXPORT) {
                     return View::make('accounts.import_export');
                 } else {
                     if ($section == ACCOUNT_ADVANCED_SETTINGS) {
                         $data = ['account' => Auth::user()->account, 'feature' => $subSection];
                         return View::make("accounts.{$subSection}", $data);
                     } else {
                         if ($section == ACCOUNT_PRODUCTS) {
                             $data = ['account' => Auth::user()->account];
                             return View::make('accounts.products', $data);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #17
0
ファイル: functions.php プロジェクト: carobiscuit/PFA
function fixDates()
{
    global $conn;
    global $MASTER_TABLE;
    $fixDates = mysqli_query($conn, "SELECT id, CheckDate from {$MASTER_TABLE} where importDate = CURDATE()");
    while ($row = $fixDates->fetch_array()) {
        $id = $row["id"];
        $CheckDate = $row["CheckDate"];
        if ($CheckDate != null) {
            $dateFormat = new DateFormat();
            $dateFormat->formatDate($CheckDate);
            $updateDates = mysqli_query($conn, "UPDATE {$MASTER_TABLE} SET CheckDate = '{$CheckDate}' where id = '{$id}'");
        }
    }
}
コード例 #18
0
ファイル: ConstantsSeeder.php プロジェクト: Vrian7ipx/repocas
    public function run()
    {
        $master = new MasterDocument();
        $master->name = 'Factura Normal';
        $master->javascript_web = 'class MYPDF extends TCPDF {
	public function Footer() {
        $this->SetY(-15);
        $this->SetFont(\'helvetica\', \'\', 8, false);
		$imgdata = base64_decode(\'/9j/4QmpRXhpZgAATU0AKgAAAAgADAEAAAMAAAABAk8AAAEBAAMAAAABAKUAAAECAAMAAAADAAAA
ngEGAAMAAAABAAIAAAESAAMAAAABAAEAAAEVAAMAAAABAAMAAAEaAAUAAAABAAAApAEbAAUAAAAB
AAAArAEoAAMAAAABAAIAAAExAAIAAAAeAAAAtAEyAAIAAAAUAAAA0odpAAQAAAABAAAA6AAAASAA
CAAIAAgALcbAAAAnEAAtxsAAACcQQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykAMjAxNjow
MTowNSAxMjoyNDozNQAAAAAEkAAABwAAAAQwMjIxoAEAAwAAAAH//wAAoAIABAAAAAEAAAAqoAMA
BAAAAAEAAACWAAAAAAAAAAY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AAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAAAHg4QklNBBkAAAAAAAQAAAAeOEJJ
TQPzAAAAAAAJAAAAAAAAAAABADhCSU0nEAAAAAAACgABAAAAAAAAAAI4QklNA/UAAAAAAEgAL2Zm
AAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEAMgAAAAEAWgAAAAYAAAAAAAEANQAAAAEA
LQAAAAYAAAAAAAE4QklNA/gAAAAAAHAAAP////////////////////////////8D6AAAAAD/////
////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP//////
//////////////////////8D6AAAOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAA
AAAABAAAAAA4QklNBBoAAAAAA2UAAAAGAAAAAAAAAAAAAACWAAAAKgAAABgAbABvAGcAaQBuAC0A
ZgBhAGMAdAB1AHIAYQAtAHYAaQByAHQAdQBhAGwALQBCAE4AAAABAAAAAAAAAAAAAAAAAAAAAAAA
AAEAAAAAAAAAAAAAACoAAACWAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAA
AAEAAAAAAABudWxsAAAAAgAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBs
b25nAAAAAAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAACWAAAAAFJnaHRsb25nAAAAKgAA
AAZzbGljZXNWbExzAAAAAU9iamMAAAABAAAAAAAFc2xpY2UAAAASAAAAB3NsaWNlSURsb25nAAAA
AAAAAAdncm91cElEbG9uZwAAAAAAAAAGb3JpZ2luZW51bQAAAAxFU2xpY2VPcmlnaW4AAAANYXV0
b0dlbmVyYXRlZAAAAABUeXBlZW51bQAAAApFU2xpY2VUeXBlAAAAAEltZyAAAAAGYm91bmRzT2Jq
YwAAAAEAAAAAAABSY3QxAAAABAAAAABUb3AgbG9uZwAAAAAAAAAATGVmdGxvbmcAAAAAAAAAAEJ0
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gICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIDw/eHBhY2tldCBlbmQ9InciPz7/7gAOQWRvYmUAZEAAAAAB/9sAhAABAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAgICAgICAgICAgIDAwMDAwMDAwMDAQEBAQEB
AQEBAQECAgECAgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD
AwP/wAARCACWACoDAREAAhEBAxEB/90ABAAG/8QBogAAAAY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DKSpUgggkEEG4II+hHv3Xurlf5pn8wofJb
LdHbG63yePm271Z1tgMpn95Y2CjmyeU7Q33tPb9VvOhw+denbI47G7XSFMdJ9pLEKivSpLmRI6dl
917qm6aaaokknqJJZ55pHllnldpZpZJGLSSSyOxeSR2NySSTe5Pv3Xurfv5GGPrqz+YLsmopKaeo
gxPX3Z+Qyc0UZeOhopdtS4qOqqSP81A+SydNCGNh5JlX6ke/de63hPfuvdf/0dxz56r8J36U0fOq
TaEPVz5ymXCy58bhO4Yt0NFKIJNijZKS79OcSiMpm/hKtIaMSecGn8g9+691Rr/BP+E34A/3+G4j
x9ftvmTc/wCvba4F/fuvde/gn/Cb7/nr9xf+c3zK/wDsX9+6917+Cf8ACb7/AJ6/cX/nN8yv/sX9
+691bH/Lfg/loU+P31D8BKza9flEai/v/V1C9gJ2LNQlgccaxe2aWi3kNqLOQI/tIlxX3QP1n1E+
691aH7917r//2Q==\');

		  $html = \'<hr><table border="0">
			<tr>
			<td align="center">Servicio de Facturación <b>www.emizor.com</b></td>
			</tr>
			<tr>
			<td width="578" align="center">Pág \'.$this->getAliasNumPage().\'/\'.$this->getAliasNbPages().\'</td>
			</tr>
			</table>\';
        $this->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
		$this->Image(\'@\'.$imgdata, \'7\', \'158\', 4, 12, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);

	}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);

$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Factura\');
$pdf->SetSubject(\'Primera Factura\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');

// set margins
$pdf->SetMargins(15, 20, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// borra la linea de arriba en el area del header
$pdf->setPrintHeader(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf->SetFont(\'helvetica\', \'B\' , 12);
$nit = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;
$sfc = $invoice->sfc;

// add a page
$pdf->AddPage(\'P\', \'LETTER\');
//contenido del recuadro
$html = \'
	<table border="0" width="180">
	<tr>
		<td width="75" style="font-size:8px">NIT:</td>
		<td align="left" style="font-size:10px">:&nbsp;\'.$nit.\'</td>
	</tr>
	<tr>
		<td style="font-size:8px">AUTORIZACI&Oacute;N N&ordm;</td>
		<td align="left" style="font-size:10px">:&nbsp;\'.$nauto.\'</td>
	</tr>
	<tr>
		<td style="font-size:8px">FACTURA N&ordm;</td>
		<td align="left" style="font-size:10px">:&nbsp;\'.$nfac.\'</td>
	</tr>
	<tr><td></td></tr>

	</table>
\';
//imprime el contenido de la variable html
$pdf->writeHTMLCell($w=0, $h=0, $x=\'140\', $y=\'13\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//dibuja un rectangulo
$pdf->SetLineStyle(array(\'width\' => 0.5, \'cap\' => \'butt\', \'join\' => \'miter\', \'dash\' => 0, \'color\' => array(0, 0, 0)));
$pdf->RoundedRect(138, 11, 63, 18, 2, \'1111\', null);
$imgdata = base64_decode($invoice->logo);
$pdf->Image(\'@\'.$imgdata, \'14\', \'10\', \'35\', \'35\', \'\', \'\', \'T\', false, 500, \'\', false, false, 0, false, false, false);

//marca de agua
$imgdata = base64_decode($invoice->logo);
$pdf->SetAlpha(0.3);
$pdf->Image(\'@\'.$imgdata, \'65\', \'90\', \'90\', \'90\', \'\', \'\', \'T\', false, 500, \'\', false, false, 0, false, false, false);
$pdf->SetAlpha(1);
///title
$anchoDivFac = 480;
if($invoice->type_third==0)
{
    $factura = "FACTURA";
    $tercero ="";
}
else{
    $factura = "FACTURA POR TERCEROS";
    $tercero = $matriz->name;
	$anchoDivFac = 520;
}
if($invoice->invoice_status_id == 6)
{
	$factura = "FACTURA ANULADA";
}

$titleFactura=\'<table border="0">
<tr>
<td width="480" align="center"><font color="#333333">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'.$factura.\'</font></td>
</tr>
</table>\';
$pdf->SetFont(\'helvetica\', \'B\' , 22);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'42\', $titleFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'B\' , 9);

// $sinCreditoFiscal = "SIN DERECHO A CR&Eacute;DITO FISCAL";
// $sinCreditoFiscalHtml=\'<table border="0">
// <tr>
// <td width="500" align="center"><font color="#333333">&nbsp;&nbsp;&nbsp;&nbsp;\'.$sinCreditoFiscal.\'</font></td>
// </tr>
// </table>\';
$pdf->SetFont(\'helvetica\', \'B\' , 13);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'38\', $sinCreditoFiscalHtml, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'B\' , 11);








//nombre de la empresa
$business = $invoice->account_name;
$unipersonal = $invoice->account_uniper;
$pdf->SetFont(\'helvetica\', \'B\', 10, false);
// $NombreEmpresa = \'
//     <p style="line-height: 150%">
//         <font color="#333333">
//             \'.$business.\'
//         </font>
//     </p>\';
//$NombreEmpresa = \' <table border="0">
//  <tr>
 //   <td width="250" align="center"><font color="#333333">\'.$business.\'</font></td>
//  </tr>
//</table>
//\';
//$pdf->writeHTMLCell($w=0, $h=0, $x=\'45\', $y=\'10\', $NombreEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf->SetFont(\'helvetica\', \'B\', 8, false);
if($unipersonal!="")
    $pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'36\', \'De: \'.$unipersonal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'1\', $tercero, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
if($copia==1)
    $original = "COPIA";
else
$original = "ORIGINAL";


$pdf->SetFont(\'helvetica\', \'B\', 12);
    $original = \'
        <p style="line-height: 150% ">
            \'.$original.\'
        </p>\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'155\', $y=\'29\', $original, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//datos de la empresa
// $casa = $matriz->name;
$casa = "CASA MATRIZ";
$dir_casa = $matriz->address2."  ".$matriz->address1;
$tel_casa = $matriz->work_phone;
$city_casa = $matriz->city." - Bolivia";
if($matriz->city == $invoice->city && $invoice->branch_id != $matriz->id)
    $city_casa ="";
else
$city_casa = \'<tr>
        <td width="150" align="left">\'.$city_casa.\'</td>
        </tr>\';
$pdf->SetFont(\'helvetica\', \'\', 8);

if($invoice->branch_id == $matriz->id || $branch->number_branch == 0)
{
	$datoEmpresa = \'
    <table border = "0">
        <tr style="line-height:1">
        <td width="150" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr style="line-height:1">
        <td width="150" align="left">\'.$dir_casa.\' </td>
        </tr>
        <tr style="line-height:1">
        <td width="150" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa.\'
    </table>
    \';
}
else{
	$sucursal = $invoice->branch_name;
	$direccion = $invoice->address1." - ".$invoice->address2;
	$ciudad = $invoice->city." - Bolivia";
	$telefonos =$invoice->phone;
	$datoEmpresa = \'
    <table border = "0">
        <tr style="line-height:0.9">
        <td width="270" align="left"><b><font size="7">\'.$casa.\'</font></b></td>
        </tr>
        <tr style="line-height:0.9">
        <td width="270" align="left"><font size="7">\'.$dir_casa.\'</font></td>
        </tr>
        <tr style="line-height:0.9">
        <td width="270" align="left"><font size="7">Telfs: \'.$tel_casa.\'</font></td>
        </tr>
        <font size="7">\'.$city_casa.\'</font>
        <tr style="line-height:0.9">
        <td width="270" align="left"><b><font size="7">\'.$sucursal.\'</font></b></td>
        </tr>
        <tr style="line-height:0.9">
        <td width="270" align="left"><font size="7">\'.$direccion.\'</font></td>
        </tr>
        <tr style="line-height:0.9">
        <td width="270" align="left"><font size="7">Telfs: \'.$telefonos.\'</font></td>
        </tr>
        <tr style="line-height:0.9">
        <td width="270" align="left"><font size="7">\'.$ciudad.\'</font></td>
        </tr>
    </table>
    \';
}

$pdf->writeHTMLCell($w=0, $h=0, $x=\'46\', $y=\'15\', $datoEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//actividad económica
$actividad=$invoice->economic_activity;
$pdf->SetFont(\'helvetica\', \'\', 10);
$actividadEmpresa = \'
    <table>
        <tr>
            <td align="center">\'.$actividad.\'</td>
        </tr>
    </table>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'135\', $y=\'36\', $actividadEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//TABLA datos del cliente

$pdf->SetFont(\'helvetica\', \'\', 11);

$meses = array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");

$lenguage = \'es_ES.UTF-8\';
putenv("LANG=$lenguage");
setlocale(LC_ALL, $lenguage);

//$date =date("d/m/Y", strtotime($invoice->invoice_date));
//$date = DateTime::createFromFormat("d/m/Y", $date);
//$fecha=strftime("%d de %B de %Y",$date->getTimestamp());

$date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
if($date== null){
    $date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());
}
else
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());



$fecha= $invoice->state.", ".$fecha;
$senor = $invoice->client_name;
$nit = $invoice->client_nit;

$datosCliente = \'
<table cellpadding="2" border="0">
    <tr>
        <td width="300"><b>&nbsp;Lugar y fecha :</b>\'.$fecha.\'</td>
        <td width="220" align="right"><b>NIT/CI :</b>\'.$nit.\'</td>
    </tr>
    <tr>
        <td colspan="2"><b>&nbsp;Se&ntilde;or(es):</b> \'.$senor .\'</td>
    </tr>

</table>
\';
//$datosCliente="asdf";

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'58\', $datosCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//dibuja rectangulo datos del cliente
$pdf->SetLineStyle(array(\'width\' => 0.3, \'cap\' => \'butt\', \'join\' => \'miter\', \'dash\' => 0, \'color\' => array(0, 0, 0)));
$pdf->RoundedRect(16, 58, 184, 14, 1, \'1111\', null);
$textTitulos = "";
$textTitulos .= \'<p></p>
<table border="0.2" cellpadding="3" cellspacing="0">
    <thead>
        <tr>
          <td width="70" align="center" bgcolor="#E6DFDF"><font size="10"><b>CANTIDAD</b></font></td>
         <td width="240" align="center" bgcolor="#E6DFDF"><font size="10"><b>CONCEPTO</b></font></td>
         <td width="115" align="center" bgcolor="#E6DFDF"><font size="10"><b>PRECIO UNITARIO</b></font></td>
         <td width="97" align="center" bgcolor="#E6DFDF"><font size="10"><b>TOTAL</b></font></td>
        </tr>
    </thead>
</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'66\', $textTitulos, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//
$ini = 0;
$final = "";
$resto = $ini;
//number_format((float)($product->cost*6), 2, \'.\', \',\')
foreach ($products as $key => $product){
		$textContenido =\'
        <table border="0.2" cellpadding="3" cellspacing="0">
		<tr>
		<td width="70" align="center"><font size="10">\'.intval($product->packs).\'</font></td>
		<td width="240"><font size="10">\'.$product->notes.\'</font></td>
		<td width="115" align="right"><font size="10">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</font></td>
		<td width="97" align="right"><font size="10"> \'.number_format((float)$product->units2->units*$product->packs*$product->cost, 2, \'.\', \'\').\'</font></td>
		</tr>
         </table>
		\';
        $ini = $pdf->GetY(); //punto inicial antes de dibujar la siguiente fila

        if(($ini+$resto)>= 250.46944444444){

			$pdf->AddPage(\'P\', \'LETTER\');
            $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        }
        else{
        $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        $final = $pdf->GetY();  //punto hasta donde se dibujo la fila
        }
        $resto = $final-$ini; //diferencia entre $ini y $final para sacar el tamaño siguiente a dibujar
//}
}
$texPie = "";
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$fiscal=number_format((float)$invoice->debito_fiscal, 2, \'.\', \'\');
$ice=number_format((float)$invoice->importe_ice, 2, \'.\', \'\');


require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$importe = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$num = explode(".", $importe);
if(!isset($num[1]))
    $num[1]="00";

$literal= $nts->to_word($num[0]).substr($num[1],0,2);





$pdf->SetFont(\'helvetica\', \'\', 11);
		$texPie .=\'
		<table border="0.2" cellpadding="3" cellspacing="0">
            <tr>
                <td width="425" align="right"><b>SUBTOTAL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td  width="97" align="right"><b>\'.$subtotal.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>Descuentos &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$descuento.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>TOTAL A PAGAR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$total.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>ICE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$invoice->importe_ice.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>Importe Cr&eacute;dito Fiscal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$invoice->debito_fiscal.\'</b></td>
            </tr>

            <tr>
                <td colspan="2" style="font-size:9px"><b>Son: </b>\'.$literal.\'/100 BOLIVIANOS.</td>
            </tr>
		</table>
		\';
        if ($pdf->GetY() >= \'210.6375\' ){

            $pdf->AddPage(\'P\', \'LETTER\');
        }

$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $texPie, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//nota al cliente
$restoQr = 11;
$line=60;
if (!empty($invoice->public_notes)){
$nota = $invoice->public_notes;
$notaCliente = \'

		<table style="padding:0px 0px 0px 5px" border="0">
		<tr>
			<td style="line-height: \'.$line.\'%"> </td>
		</tr>
		<tr>
			<td width="88" align="right" style="font-size:9px;"><b>Nota al Cliente:</b></td>
			<td width="352" align="left" bgcolor="#F2F2F2" style="font-size:9px; border-left: 1px solid #000;">\'.$nota.\'</td>
		</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $notaCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$restoQr=$restoQr+10;
$line=100;
}
if (!empty($invoice->terms)){
$nota = $invoice->public_notes;
$terminos = $invoice->terms;
$termCliente = \'
		<table style="padding:0px 0px 0px 5px">
		<tr><td style="line-height: \'.$line.\'%"> </td></tr>
		<tr>
			<td width="88" align="right" style="font-size:9px"><b>Términos de Facturación: </b></td>
			<td width="352" align="left" bgcolor="#F2F2F2" style="font-size:9px; border-left: 1px solid #000; ">\'.$terminos.\'</td>
		</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $termCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$restoQr=$restoQr+11;
$line=50;
}

$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');

$law_gen="ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAÍS, EL USO ILÍCITO DE ÉSTA SERÁ SANCIONADO DE ACUERDO A LEY";

$law=$invoice->law;
$datosFactura = \'
<table border="0" style="line-height: 160%">
	<tr><td style="line-height: \'.$line.\'%"> </td></tr>
    <tr>
        <td width="230" align="left"><b>C&Oacute;DIGO DE CONTROL :&nbsp;&nbsp;\'.$control_code.\'</b></td>
        <td width="210" align="left"><b>Fecha L&iacute;mite de Emisi&oacute;n : &nbsp;\'.$fecha_limite.\' </b></td>
    </tr>
    <tr>
        <td width="450" align="center" style="font-size:7px"><b>"\'.$law_gen.\'"</b></td>
    </tr>
    <tr>
        <td width="450" align="center" style="font-size:7px">"\'.$law.\'"</td>
    </tr>
</table>
\';
if ($pdf->GetY() >= \'226.6375\' ){
		$pdf->AddPage(\'P\', \'LETTER\');
		if(!empty($nota) && !empty($terminos)){
			$restoQr = $restoQr - 18;
		}
    }

$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $datosFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$date_qr = date("d/m/Y", strtotime($invoice->invoice_date));
$date_qr = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->invoice_date);
if($date_qr== null)
    $date_qr = $invoice->invoice_date;
else
    $date_qr = $date_qr->format(\'d/m/Y\');

if($descuento == \'0.00\')
    $descuento = 0;
$datosqr = $invoice->account_nit.\'|\'.$invoice->invoice_number.\'|\'.$invoice->number_autho.\'|\'.$date_qr.\'|\'.$total.\'|\'.$fiscal.\'|\'.$invoice->control_code.\'|\'.$invoice->client_nit.\'|\'.$ice.\'|0|0|\'.$descuento;
$pdf->write2DBarcode($datosqr, \'QRCODE,M\', \'175\',
$pdf->GetY()-$restoQr, 25, 25, \'\', \'N\');

//Close and output PDF document
$pdf->Output(\'factura.pdf\', \'I\');

die;';
        //factura fiscal
        $master->javascript_pos = ' $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Factura\');
$pdf->SetSubject(\'Primera Factura\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');
$pdf->SetMargins(0.5, 0.5, 0.5);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetFont(\'helvetica\', \'\' , 7);
$page_format = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => 1000),
    \'Dur\' => 3,
);
$business = $invoice->account_name;
if($invoice->account_uniper !=\'\')
    $unipersonal = \'<tr><td align="center">De: \'.$invoice->account_uniper.\'</td></tr>\';
else
    $unipersonal="";
// Check the example n. 29 for viewer preferences
$pdf->AddPage(\'P\', $page_format, false, false);
$sucursal = $invoice->branch_name;
$direccion = $invoice->address1." - ".$invoice->address2;
$ciudad = $invoice->city." - Bolivia";
$telefonos =$invoice->phone;

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
if($copia==1)
    $original = "COPIA";
else
$original = "ORIGINAL";
$pdf->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)$lin .= \'-\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf->SetFont(\'helvetica\', \' \' , 8);
$nitEmpresa = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;

$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf->SetFont(\'times\', \'B\' , 9);
$actividad=$invoice->economic_activity;
$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'\' , 8);
$date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
if($date==null)
    $date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
$fecha = $date->format(\'d/m/Y\');
$senor = $invoice->client_name;
$nit = $invoice->client_nit;
$hora = $date->format(\'H:i:s\');

$datosCli = \'<br>
	<table border="1">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//tabla
$htmlTabla = \'
	<table border="1">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Importe</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}
//total
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//TOTALES
$ice = number_format((float)($invoice->importe_ice), 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$importeCreditoFiscal = number_format((float)($invoice->debito_fiscal), 2, \'.\', \',\');
$fiscal =$importeCreditoFiscal;
$montoPagar = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);



$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACION: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//CODIGO DE CONTROL

$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');
$law_gen=\'"\'."ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAÍS, EL USO ILÍCITO DE ÉSTA SERÁ SANCIONADO DE ACUERDO A LEY".\'"\';
$law=$invoice->law;

 $htmlControl = \'
 	<table>
 		<tr>
 			<td>CODIGO DE CONTROL : \'.$control_code.\'</td>
 		</tr>
 		<tr>
 			<td>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</td>
 		</tr>

 	</table>
 	<br>

 \';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//qr
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$date_qr = date("d/m/Y", strtotime($invoice->invoice_date));
$date_qr = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->invoice_date);
if($date_qr== null)
    $date_qr = $invoice->invoice_date;
else
    $date_qr = $date_qr->format(\'d/m/Y\');
if($descuento=="0.00")
    $descuento=0;
if($fiscal==0) $fiscal="0";
if($ice==0) $ice ="0";
if($descuento==0)$descuento="0";
$datosqr = $invoice->account_nit.\'|\'.$invoice->invoice_number.\'|\'.$invoice->number_autho.\'|\'.$date_qr.\'|\'.$total.\'|\'.$fiscal.\'|\'.$invoice->control_code.\'|\'.$invoice->client_nit.\'|\'.$ice.\'|0|0|\'.$descuento;
$pdf->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$y = $pdf->GetY();
$y2 = intval($y) + 8;
//////pdf adaptado a nuevo tamaño//////////////////////////////////////////////////////////////////
$page_format2 = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => $y2),
    \'Dur\' => 3,
);
// add first page ---
$pdf2 = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
//Close and output PDF document
$pdf2->SetCreator(PDF_CREATOR);
$pdf2->SetAuthor(\'ipxserver\');
$pdf2->SetTitle(\'Factura\');
$pdf2->SetSubject(\'Primera Factura\');
$pdf2->SetKeywords(\'TCPDF, PDF, example, test, guide\');
// set margins
$pdf2->SetMargins(0.5, 0.5, 0.5);
// set auto page breaks
$pdf2->SetAutoPageBreak(TRUE, 0.5);
// borra la linea de arriba en el area del header
$pdf2->setPrintHeader(false);
$pdf2->setPrintFooter(false);
// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf2->SetFont(\'helvetica\', \'\' , 7);
// add second page ---
$pdf2->AddPage(\'P\', $page_format2, false, false);

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf2->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)
{
	$lin .= \'-\';

}
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf2->SetFont(\'helvetica\', \' \' , 8);


$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf2->SetFont(\'times\', \'B\' , 9);

$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//datos cliente
$pdf2->SetFont(\'helvetica\', \'\' , 8);


$datosCli = \'<br>
	<table border="0">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td colspan="3" align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td colspan="3" align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//tabla
$htmlTabla = \'
	<table border="0">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Subtotal</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}

//total
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);




$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACIÓN: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


//CODIGO DE CONTROL

 $htmlControl = \'
 	<table>
 		<tr>
 			<td><b>CÓDIGO DE CONTROL : \'.$control_code.\'</b></td>
 		</tr>
 		<tr>
 			<td><b>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</b></td>
 		</tr>
 	</table>
 	<br>

 \';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//qr
$pdf2->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf2->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->Output(\'factura.pdf\', \'I\');
die();';
        $master->save();
        $master = new MasterDocument();
        $master->name = 'Nota de Entrega';
        $master->javascript_web = 'class MYPDF extends TCPDF {
	public function Footer() {
        $this->SetY(-15);
        $this->SetFont(\'helvetica\', \'I\', 8, false);
		$logoEmizor = base64_decode(\'/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUE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C9mZgABAKGZmgAGAAAAAAABADIAAAABAFoAAAAGAAAAAAABADUAAAABAC0AAAAGAAAAAAABOEJJTQP4AAAAAABwAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAADhCSU0ECAAAAAAAEAAAAAEAAAJAAAACQAAAAAA4QklNBB4AAAAAAAQAAAAAOEJJTQQaAAAAAANpAAAABgAAAAAAAAAAAAAALwAAAC8AAAAaAGwAbwBnAG8ALQBlAG0AaQB6AG8AcgAtAGEAaQByAHAAYQBwAGUAcgBfADAAOABfADAAOAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAALwAAAC8AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAABAAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9uZwAAAC8AAAAAUmdodGxvbmcAAAAvAAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGljZQAAABIAAAAHc2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVtAAAADEVTbGljZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5cGUAAAAASW1nIAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAAAAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAAvAAAAAFJnaHRsb25nAAAALwAAAAN1cmxURVhUAAAAAQAAAAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RFWFQAAAABAAAAAAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQA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DphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOkEzNkU1OTU0OEY5NEU1MTFBQTNGQjkwMzM5NDY2NkM4IiBzdEV2dDp3aGVuPSIyMDE1LTExLTI2VDE5OjU1OjQ0LTA0OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD94cGFja2V0IGVuZD0idyI/Pv/uAA5BZG9iZQBkQAAAAAH/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQECAgICAgICAgICAgMDAwMDAwMDAwMBAQEBAQEBAQEBAQICAQICAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA//AABEIAC8ALwMBEQACEQEDEQH/3QAEAAb/xAGiAAAABgIDAQAAAAAAAAAAAAAHCAYFBAkDCgIBAAsBAAAGAwEBAQAAAAAAAAAAAAYFBAMHAggBCQAKCxAAAgEDBAEDAwIDAwMCBgl1AQIDBBEFEgYhBxMiAAgxFEEyIxUJUUIWYSQzF1JxgRhikSVDobHwJjRyChnB0TUn4VM2gvGSokRUc0VGN0djKFVWVxqywtLi8mSDdJOEZaOzw9PjKThm83UqOTpISUpYWVpnaGlqdnd4eXqFhoeIiYqUlZaXmJmapKWmp6ipqrS1tre4ubrExcbHyMnK1NXW19jZ2uTl5ufo6er09fb3+Pn6EQACAQMCBAQDBQQEBAYGBW0BAgMRBCESBTEGACITQVEHMmEUcQhCgSORFVKhYhYzCbEkwdFDcvAX4YI0JZJTGGNE8aKyJjUZVDZFZCcKc4OTRnTC0uLyVWV1VjeEhaOzw9Pj8ykal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zZtlry+sd/dbpEltPMI18aRUdpXqQiliPFdqMQFq5AJ0kKW6gr2u5rvuc5G5dtOW5m3K1tXmIs4JJII7WHSpkdIw5to4w6Rl3/RDFBrRpI4uhp2ptfPb23JhdpbZx82Vz+fr4Mbi6CAAvPUztYFmNlighQGSWRiEiiVnYhVJAO3PcrLZ9vvN03G4EVjAhd2PkB/hJ4ADJJAGT1MGx7LufMW77fsOy2jTbndSiONB5sfU+SgVZmOFUFiQAetk344dDYH4/dd0O08f4q3P1viye8NwBLS5rOvEFkEbMqypisapMNHEbaYruw8skjNz59wOd77nnfpdznBSxSqQRVxHHXFfIu/xSHzOB2qoHXP2n9tNs9ruVLfY7TTJuUlJLqemZpiM08xHH8ES+SjUe9nJMB7BHUndf//T3+PfuvdFV+YvxhxPyz6Zqerq/KRbdysO5Nu7m2zuqalqcj/drKYyrNHk65MZT12OGUer2lk8lRJBLKsReqVyVZFdZK9p/ca69r+bY+ZIbVri1NvLDNCGVPFRhqRdZV9GmdInLKCaKVyGIMC/eO9j7L3/APbaXkebcUsdyS+trm2umSSVbeSJ9ErmFJYPH1WktzEscjhPEkSXDxoyq748/Gzqv4x7FpNi9X4FKGLRBLn9xVniqNz7vykUZR8tuLKLFG9TO7MxjhQR0tKrlIIo09Psr579wOZvcXe5N65kvS7VPhRLUQwIT8ESVNABQFjV3wXZjnoTe0Xs1yJ7J8rQcr8j7SsSFVNxcPRrm7lUU8W4lABdiSxVAFiiDFYY0Tt6e9u9CdS7S7BynaG2tk4fC7xy9A9BV1tBCYKVBUSmWtraPFowx2PyWR4WpqII45JlBDE65C6O/wCduaN02G35b3Dd5ZtpjkDhWNWwKKrOe5kTiiMSFNKDtUKc7V7Z8j7HzRe85bRy7Bb7/cRFGdBpXuJLssY/TSSThI6KrOK6j3MWGH2Feh31737r3X//1N/j37r3Xvfuvde9+691737r3Xvfuvde9+691//Z\');
		  $html = \'<hr><table border="0">
			<tr>
			<td align="center">Sistema de facturaci&oacute;n brindado por <a href="www.emizor.com">www.emizor.com</a></td>
			</tr>
			<tr>
			<td width="578" align="center">Pág \'.$this->getAliasNumPage().\'/\'.$this->getAliasNbPages().\'</td>
			</tr>
			</table>\';
        $this->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
		$this->Image(\'@\'.$logoEmizor, \'7\', \'128\', 4, 12, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
		$this->Image(\'@\'.$emizorAvion, \'145\', \'265\', 5, 8, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
	}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Nota de Entrega\');
$pdf->SetSubject(\'Primera Nota\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');
// set margins
$pdf->SetMargins(15, 20, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// borra la linea de arriba en el area del header
$pdf->setPrintHeader(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf->SetFont(\'helvetica\', \'B\' , 11);
$nit = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;
$sfc = $invoice->sfc;

// add a page
$pdf->AddPage(\'P\', \'LETTER\');

$logoEmpresa = base64_decode($invoice->logo);
$pdf->Image(\'@\'.$logoEmpresa, \'14\', \'10\', 50, 20, \'\', \'\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
///title

$titleFactura=\'<table>
<tr>
<td align="rigth"><font color="#333333">NOTA DE ENTREGA</font></td>
</tr>
</table>\';
$pdf->SetFont(\'helvetica\', \'B\' , 27);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'10\', $titleFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'B\' , 11);
//nombre de la empresa
$business = $invoice->account_name;
$unipersonal = $invoice->account_uniper;
$pdf->SetFont(\'helvetica\', \'B\', 12, false);
$NombreEmpresa = \'
    <p style="line-height: 150%">
        <font color="#333333">
            \'.$business.\'
        </font>
    </p>\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'31\', $NombreEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);




$pdf->SetFont(\'helvetica\', \'B\', 8, false);


//datos de la empresa
$casa = $matriz->name;
$dir_casa = $matriz->address1." - ".$matriz->address2;
$tel_casa = $matriz->work_phone;
$city_casa = $matriz->city." - Bolivia";
if($matriz->city == $invoice->city && $invoice->branch_id != $matriz->id)
    $city_casa ="";
else
$city_casa = \'<tr>
        <td width="220" align="left">\'.$city_casa.\'</td>
        </tr>\';
        $pdf->SetFont(\'helvetica\', \'\', 7);

if($invoice->branch_id == $matriz->id)
{
	$datoEmpresa = \'
    <table border = "0">
        <tr>
        <td width="250" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$dir_casa.\' </td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa.\'
    </table>				\';
}
else{
	$sucursal = $invoice->branch_name;
	$direccion = $invoice->address1." - ".$invoice->address2;
	$ciudad = $invoice->city." - Bolivia";
	$telefonos =$invoice->phone;
	$datoEmpresa = \'
    <table border = "0">
        <tr>
        <td width="250" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$dir_casa.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa.\'
        <tr>
        <td width="250" align="left"><b>\'.$sucursal.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$direccion.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$telefonos.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$ciudad.\'</td>
        </tr>
    </table>				\';
}

$pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'40\', $datoEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//TABLA datos del cliente

$pdf->SetFont(\'helvetica\', \'\', 10);

$meses = array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");

$lenguage = \'es_ES.UTF-8\';
putenv("LANG=$lenguage");
setlocale(LC_ALL, $lenguage);


$date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
if($date== null){
    $date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());
}
else
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());



//$fecha= $invoice->state.", ".$fecha;
$senor = $invoice->client_name;
$nit = $invoice->client_nit;
$numeroNota = $invoice->document_number;

$datosCliente = \'
<table cellpadding="2" border="0">
    <tr>
        <td  width="80" align="right"><b>&nbsp;Fecha :</b></td>
        <td width="135">\'.$fecha.\'</td>
    </tr>

    <tr>
        <td width="80" align="right"><b>Nº de Nota:</b></td>
        <td width="135">\'.$numeroNota.\'</td>
    </tr>
</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'121\', $y=\'32\', $datosCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$nameClient = \'
	<table border = "0">
	<tr>
        <td width="60" align="right"><b>Para:</b></td>
        <td width="90">&nbsp;\'.$senor .\'</td>
    </tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'67\', $y=\'32\', $nameClient, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//preparado por

$pdf->SetFont(\'helvetica\', \'\', 9);
$nombreUsuario = $user->last_name." ".$user->first_name;
$rol = "Soporte Técnico";
$telefono = $user->phone;
$correo = $user->email;

$preparadoPor = \'
    <table border = "0">
        <tr>
        <td width="75" align="left"><b>Preparado por: </b></td>
        <td width="110" align="left">\'.$nombreUsuario.\'</td>
        </tr>
        <!--tr>
        <td width="75" align="left"> </td>
        <td width="110" align="left">\'.$rol.\'</td>
        </tr-->
        <tr>
        <td width="75" align="left"> </td>
        <td width="110" align="left">Telfs: \'.$telefono.\'</td>
        </tr>
        <tr>
        <td width="75" align="left"> </td>
        <td width="110" align="left">\'.$correo.\'</td>
        </tr>
    </table>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'125\', $y=\'50\', $preparadoPor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);





$textTitulos = "";
$textTitulos .= \'<p></p>
<table border="0.2" cellpadding="3" cellspacing="0">
    <thead>
        <tr>
         <td width="70" align="center" bgcolor="#E6DFDF"><font size="10"><b>CANTIDAD</b></font></td>
         <td width="240" align="center" bgcolor="#E6DFDF"><font size="10"><b>CONCEPTO</b></font></td>
         <td width="115" align="center" bgcolor="#E6DFDF"><font size="10"><b>PRECIO UNITARIO</b></font></td>
         <td width="97" align="center" bgcolor="#E6DFDF"><font size="10"><b>TOTAL</b></font></td>
        </tr>
    </thead>
</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'60\', $textTitulos, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//
$ini = 0;
$final = "";
$resto = $ini;
//for ($i=0;$i<=10;$i++)
//{
foreach ($products as $key => $product){
		$textContenido =\'
        <table border="0.2" cellpadding="3" cellspacing="0">
		<tr>
		<td width="70" align="center"><font size="10">\'.intval($product->qty).\'</font></td>
		<td width="240"><font size="10">\'.$product->notes.\'</font></td>
		<td width="115" align="right"><font size="10">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</font></td>
		<td width="97" align="right"><font size="10"> \'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</font></td>
		</tr>
         </table>
		\';
        $ini = $pdf->GetY(); //punto inicial antes de dibujar la siguiente fila

        if(($ini+$resto)>= 250.46944444444){

			$pdf->AddPage(\'P\', \'LETTER\');
            $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        }
        else{
        $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        $final = $pdf->GetY();  //punto hasta donde se dibujo la fila
        }
        $resto = $final-$ini; //diferencia entre $ini y $final para sacar el tamaño siguiente a dibujar
//}
}
$texPie = "";
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$fiscal="0";
$ice="0";


require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);


$pdf->SetFont(\'helvetica\', \'\', 11);
		$texPie .=\'
		<table border="0.2" cellpadding="3" cellspacing="0">
            <tr>
                <td width="425" align="right"><b>SUBTOTAL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td  width="97" align="right"><b>\'.$subtotal.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>Descuentos &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$descuento.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>TOTAL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$total.\'</b></td>
            </tr>

            <tr>
                <td colspan="2" style="font-size:9px"><b>Son: </b>\'.$literal.\'/100 BOLIVIANOS.</td>
            </tr>
		</table>
		\';
        if ($pdf->GetY() >= \'210.6375\' ){

            $pdf->AddPage(\'P\', \'LETTER\');
        }

$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $texPie, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//nota al cliente
$restoQr = 11;
$line=60;
if (!empty($invoice->public_notes)){
$nota = $invoice->public_notes;
$notaCliente = \'

		<table style="padding:0px 0px 0px 5px" border="0">
		<tr>
			<td style="line-height: \'.$line.\'%"> </td>
		</tr>
		<tr>
			<td width="88" align="right" style="font-size:9px;"><b>Nota al Cliente:</b></td>
			<td width="352" align="left" bgcolor="#F2F2F2" style="font-size:9px; border-left: 1px solid #000;">\'.$nota.\'</td>
		</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $notaCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$restoQr=$restoQr+10;
$line=100;
}

$restoQr=$restoQr+11;
$line=50;


$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');

$law_gen="ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAIS, EL USO ILICITO DE ESTA SERA SANCIONADO DE ACUERDO A LEY";

$law=$invoice->law;
//$usuario = "usuario";
$datosFactura = \'
<table border="0" style="line-height: 160%">
	<tr><td style="line-height: \'.$line.\'%"> </td></tr>
    <tr><td> </td></tr>
    <tr><td> </td></tr>
    <tr>
        <td width="262" align="center" style="font-size:9px"><b>Recibi Conforme</b></td>
        <td width="262" align="center" style="font-size:9px"><b>Entregue Conforme</b></td>
    </tr>
    <tr>
        <td width="262" align="center" style="font-size:9px"><b> </b></td>
        <td width="262" align="center" style="font-size:9px">\'.$nombreUsuario.\'</td>
    </tr>

</table>
\';
if ($pdf->GetY() >= \'226.6375\' ){
		$pdf->AddPage(\'P\', \'LETTER\');
		if(!empty($nota) && !empty($terminos)){
			$restoQr = $restoQr - 18;
		}
    }

$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $datosFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//Close and output PDF document
$pdf->Output(\'factura.pdf\', \'I\');

die;';
        //factura fiscal
        $master->javascript_pos = ' $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Factura\');
$pdf->SetSubject(\'Primera Factura\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');
$pdf->SetMargins(0.5, 0.5, 0.5);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetFont(\'helvetica\', \'\' , 7);
$page_format = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => 1000),
    \'Dur\' => 3,
);
$business = $invoice->account_name;
if($invoice->account_uniper !=\'\')
    $unipersonal = \'<tr><td align="center">De: \'.$invoice->account_uniper.\'</td></tr>\';
else
    $unipersonal="";
// Check the example n. 29 for viewer preferences
$pdf->AddPage(\'P\', $page_format, false, false);
$sucursal = $invoice->branch_name;
$direccion = $invoice->address1." - ".$invoice->address2;
$ciudad = $invoice->city." - Bolivia";
$telefonos =$invoice->phone;

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
if($copia==1)
    $original = "COPIA";
else
$original = "ORIGINAL";
$pdf->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)$lin .= \'-\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf->SetFont(\'helvetica\', \' \' , 8);
$nitEmpresa = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;

$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf->SetFont(\'times\', \'B\' , 9);
$actividad=$invoice->economic_activity;
$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'\' , 8);
$date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
if($date==null)
    $date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
$fecha = $date->format(\'d/m/Y\');
$senor = $invoice->client_name;
$nit = $invoice->client_nit;
$hora = $date->format(\'H:i:s\');

$datosCli = \'<br>
	<table border="1">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//tabla
$htmlTabla = \'
	<table border="1">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Importe</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}
//total
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//TOTALES
$ice = number_format((float)($invoice->importe_ice), 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$importeCreditoFiscal = number_format((float)($invoice->debito_fiscal), 2, \'.\', \',\');
$fiscal =$importeCreditoFiscal;
$montoPagar = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);



$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACION: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//CODIGO DE CONTROL

$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');
$law_gen=\'"\'."ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAÍS, EL USO ILÍCITO DE ÉSTA SERÁ SANCIONADO DE ACUERDO A LEY".\'"\';
$law=$invoice->law;

 $htmlControl = \'
 	<table>
 		<tr>
 			<td>CODIGO DE CONTROL : \'.$control_code.\'</td>
 		</tr>
 		<tr>
 			<td>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</td>
 		</tr>

 	</table>
 	<br>

 \';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//qr
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$date_qr = date("d/m/Y", strtotime($invoice->invoice_date));
$date_qr = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->invoice_date);
if($date_qr== null)
    $date_qr = $invoice->invoice_date;
else
    $date_qr = $date_qr->format(\'d/m/Y\');
if($descuento=="0.00")
    $descuento=0;
if($fiscal==0) $fiscal="0";
if($ice==0) $ice ="0";
if($descuento==0)$descuento="0";
$datosqr = $invoice->account_nit.\'|\'.$invoice->invoice_number.\'|\'.$invoice->number_autho.\'|\'.$date_qr.\'|\'.$total.\'|\'.$fiscal.\'|\'.$invoice->control_code.\'|\'.$invoice->client_nit.\'|\'.$ice.\'|0|0|\'.$descuento;
$pdf->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$y = $pdf->GetY();
$y2 = intval($y) + 8;
//////pdf adaptado a nuevo tamaño//////////////////////////////////////////////////////////////////
$page_format2 = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => $y2),
    \'Dur\' => 3,
);
// add first page ---
$pdf2 = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
//Close and output PDF document
$pdf2->SetCreator(PDF_CREATOR);
$pdf2->SetAuthor(\'ipxserver\');
$pdf2->SetTitle(\'Factura\');
$pdf2->SetSubject(\'Primera Factura\');
$pdf2->SetKeywords(\'TCPDF, PDF, example, test, guide\');
// set margins
$pdf2->SetMargins(0.5, 0.5, 0.5);
// set auto page breaks
$pdf2->SetAutoPageBreak(TRUE, 0.5);
// borra la linea de arriba en el area del header
$pdf2->setPrintHeader(false);
$pdf2->setPrintFooter(false);
// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf2->SetFont(\'helvetica\', \'\' , 7);
// add second page ---
$pdf2->AddPage(\'P\', $page_format2, false, false);

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf2->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)
{
	$lin .= \'-\';

}
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf2->SetFont(\'helvetica\', \' \' , 8);


$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf2->SetFont(\'times\', \'B\' , 9);

$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//datos cliente
$pdf2->SetFont(\'helvetica\', \'\' , 8);


$datosCli = \'<br>
	<table border="0">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td colspan="3" align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td colspan="3" align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//tabla
$htmlTabla = \'
	<table border="0">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Subtotal</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}

//total
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);




$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACIÓN: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


//CODIGO DE CONTROL

 $htmlControl = \'
 	<table>
 		<tr>
 			<td><b>CÓDIGO DE CONTROL : \'.$control_code.\'</b></td>
 		</tr>
 		<tr>
 			<td><b>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</b></td>
 		</tr>
 	</table>
 	<br>

 \';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//qr
$pdf2->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf2->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->Output(\'factura.pdf\', \'I\');
die();';
        $master->save();
        PaymentType::create(array('name' => 'Efectivo'));
        PaymentType::create(array('name' => 'Crédito'));
        PaymentType::create(array('name' => 'Transferencia Bancaria'));
        PaymentType::create(array('name' => 'Cheque'));
        //Unidad::create(array('name' => 'unidad','is_int'=>true,));
        //Unidad::create(array('nombre' => 'decimal','is_int'=>false));
        InvoiceStatus::create(array('name' => 'Emitido'));
        InvoiceStatus::create(array('name' => 'Enviado'));
        InvoiceStatus::create(array('name' => 'Visto'));
        InvoiceStatus::create(array('name' => 'Parcial'));
        InvoiceStatus::create(array('name' => 'Pagado'));
        InvoiceStatus::create(array('name' => 'Anulado'));
        Frequency::create(array('name' => 'Mensual'));
        Frequency::create(array('name' => 'Trimestral'));
        Frequency::create(array('name' => 'Semestral'));
        Frequency::create(array('name' => 'Anual'));
        Currency::create(array('name' => 'Bolivianos', 'code' => 'BS', 'symbol' => 'Bs', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
        DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
        DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
        DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
        DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
        DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
        DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
        DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
        DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
        DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
        DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
        DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
        DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
        DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
        DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
        TaxRate::create(array('account_id' => '1', 'name' => 'ICE', 'rate' => '0.42'));
        //
        Category::create(array('name' => 'General'));
        /*
        d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
        D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
        m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
        M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
        yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
        */
        $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
        foreach ($timezones as $name => $location) {
            Timezone::create(array('name' => $name, 'location' => $location));
        }
    }
コード例 #19
0
    public function run()
    {
        $master = new MasterDocument();
        $master->name = 'Factura Normal';
        $master->javascript_web = 'class MYPDF extends TCPDF {
	public function Footer() {
        $this->SetY(-15);
        $this->SetFont(\'helvetica\', \'I\', 8, false);
		$imgdata = base64_decode(\'/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wgARCABkABsDAREAAhEBAxEB/8QAGgAAAgMBAQAAAAAAAAAAAAAABgcAAQUIBP/EABsBAAICAwEAAAAAAAAAAAAAAAUGAQIABAcD/9oADAMBAAIQAxAAAAHqiIwdsdu6pGZkrCMbEJjBGYuGmatVFNXPzUaeYAVjq1Uw0opaNOHYVhr0omGhHKBxdgB2KshFtiAxwjQXaBmojmp45c3FxzOhLDMojW3njHAtpXoFqnFIyJh2GYd/VIqFiTcj30RkoJ6QRumphpSTsMwKVmS38mdEWx1bwfcdib+h0Uk9M9nh7y0zJmU//8QAIxAAAgEEAgICAwAAAAAAAAAABAUDAAECBhAREhMUNSAxQf/aAAgBAQABBQLulbmJtj3XfDuwIrLXIvAHgMuLX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AAQmxkIFVudEYjUmx0AAAAAAAAAAAAAAAAUnNsdFVudEYjUHhsQFIAAAAAAAAAAAAKdmVjdG9yRGF0YWJvb2wBAAAAAFBnUHNlbnVtAAAAAFBnUHMAAAAAUGdQQwAAAABMZWZ0VW50RiNSbHQAAAAAAAAAAAAAAABUb3AgVW50RiNSbHQAAAAAAAAAAAAAAABTY2wgVW50RiNQcmNAWQAAAAAAAAAAABBjcm9wV2hlblByaW50aW5nYm9vbAAAAAAOY3JvcFJlY3RCb3R0b21sb25nAAAAAAAAAAxjcm9wUmVjdExlZnRsb25nAAAAAAAAAA1jcm9wUmVjdFJpZ2h0bG9uZwAAAAAAAAALY3JvcFJlY3RUb3Bsb25nAAAAAAA4QklNA+0AAAAAABAASAAAAAEAAgBIAAAAAQACOEJJTQQmAAAAAAAOAAAAAAAAAAAAAD+AAAA4QklNBA0AAAAAAAQAAAAeOEJJTQQZAAAAAAAEAAAAHjhCSU0D8wAAAAAACQAAAAAAAAAAAQA4QklNJxAAAAAAAAoAAQAAAAAAAAACOEJJTQP1AAAAAABIAC9mZgABAGxmZgAGAAAAAAABAC9mZgABAKGZmgAGAAAAAAABADIAAAABAFoAAAAGAAAAAAABADUAAAABAC0AAAAGAAAAAAABOEJJTQP4AAAAAABwAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAADhCSU0ECAAAAAAAEAAAAAEAAAJAAAACQAAAAAA4QklNBB4AAAAAAAQAAAAAOEJJTQQaAAAAAANpAAAABgAAAAAAAAAAAAAALwAAAC8AAAAaAGwAbwBnAG8ALQBlAG0AaQB6AG8AcgAtAGEAaQByAHAAYQBwAGUAcgBfADAAOABfADAAOAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAALwAAAC8AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAA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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD94cGFja2V0IGVuZD0idyI/Pv/uAA5BZG9iZQBkQAAAAAH/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQECAgICA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2lk8lRJBLKsReqVyVZFdZK9p/ca69r+bY+ZIbVri1NvLDNCGVPFRhqRdZV9GmdInLKCaKVyGIMC/eO9j7L3/APbaXkebcUsdyS+trm2umSSVbeSJ9ErmFJYPH1WktzEscjhPEkSXDxoyq748/Gzqv4x7FpNi9X4FKGLRBLn9xVniqNz7vykUZR8tuLKLFG9TO7MxjhQR0tKrlIIo09Psr579wOZvcXe5N65kvS7VPhRLUQwIT8ESVNABQFjV3wXZjnoTe0Xs1yJ7J8rQcr8j7SsSFVNxcPRrm7lUU8W4lABdiSxVAFiiDFYY0Tt6e9u9CdS7S7BynaG2tk4fC7xy9A9BV1tBCYKVBUSmWtraPFowx2PyWR4WpqII45JlBDE65C6O/wCduaN02G35b3Dd5ZtpjkDhWNWwKKrOe5kTiiMSFNKDtUKc7V7Z8j7HzRe85bRy7Bb7/cRFGdBpXuJLssY/TSSThI6KrOK6j3MWGH2Feh31737r3X//1N/j37r3Xvfuvde9+691737r3Xvfuvde9+691//Z\');
		  $html = \'<hr><table border="0">
			<tr>
			<td align="center">Sistema de facturaci&oacute;n brindado por <a href="www.emizor.com">www.emizor.com</a></td>
			</tr>
			<tr>
			<td width="578" align="center">Pág \'.$this->getAliasNumPage().\'/\'.$this->getAliasNbPages().\'</td>
			</tr>
			</table>\';
        $this->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
		$this->Image(\'@\'.$imgdata, \'7\', \'158\', 4, 12, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
		$this->Image(\'@\'.$imgdata2, \'145\', \'265\', 5, 8, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
	}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);

$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Factura\');
$pdf->SetSubject(\'Primera Factura\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');

// set margins
$pdf->SetMargins(15, 20, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// borra la linea de arriba en el area del header
$pdf->setPrintHeader(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf->SetFont(\'helvetica\', \'B\' , 11);
$nit = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;
$sfc = $invoice->sfc;

// add a page
$pdf->AddPage(\'P\', \'LETTER\');
//contenido del recuadro
$html = \'
	<table border="0" width="160">
	<tr>
		<td style="font-size:8px">NIT:</td>
		<td align="left" style="font-size:10px">: \'.$nit.\'</td>
	</tr>
	<tr>
		<td style="font-size:8px">AUTORIZACI&Oacute;N N&ordm;</td>
		<td align="left" style="font-size:10px">: \'.$nauto.\'</td>
	</tr>
	<tr>
		<td style="font-size:8px">FACTURA N&ordm;</td>
		<td align="left" style="font-size:10px">: \'.$nfac.\'</td>
	</tr>
	<tr><td></td></tr>
	<tr>
		<td align = "center" colspan="2">\'.$sfc.\'</td>
	</tr>
	</table>
\';
//imprime el contenido de la variable html
$pdf->writeHTMLCell($w=0, $h=0, $x=\'140\', $y=\'17\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//dibuja un rectangulo
$pdf->SetLineStyle(array(\'width\' => 0.5, \'cap\' => \'butt\', \'join\' => \'miter\', \'dash\' => 0, \'color\' => array(0, 0, 0)));
$pdf->RoundedRect(138, 15, 61, 18, 2, \'1111\', null);
$imgdata = base64_decode($invoice->logo);
$pdf->Image(\'@\'.$imgdata, \'14\', \'10\', 50, 20, \'\', \'\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
///title
$anchoDivFac = 480;
if($invoice->type_third==0)
{
    $factura = "FACTURA";
    $tercero ="";
}
else{
    $factura = "FACTURA POR TERCEROS";
    $tercero = $matriz->name;
	$anchoDivFac = 520;
}

$titleFactura=\'<table>
<tr>
<td align="rigth" width="\'.$anchoDivFac.\'"><font color="#333333">\'.$factura.\'</font></td>
</tr>
</table>\';
$pdf->SetFont(\'helvetica\', \'B\' , 20);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'53\', $titleFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'B\' , 11);
//nombre de la empresa
$business = $invoice->account_name;
$unipersonal = $invoice->account_uniper;
$pdf->SetFont(\'helvetica\', \'B\', 12, false);
$NombreEmpresa = \'
    <p style="line-height: 150%">
        <font color="#333333">
            \'.$business.\'
        </font>
    </p>\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'31\', $NombreEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'B\', 8, false);
if($unipersonal!="")
    $pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'36\', \'De: \'.$unipersonal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'1\', $tercero, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
if($copia==1)
    $original = "COPIA";
else
$original = "ORIGINAL";


$pdf->SetFont(\'helvetica\', \'B\', 12);
    $original = \'
        <p style="line-height: 150% ">
            \'.$original.\'
        </p>\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'155\', $y=\'40\', $original, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//datos de la empresa
$casa = $matriz->name;
$dir_casa = $matriz->address1." - ".$matriz->address2;
$tel_casa = $matriz->work_phone;
$city_casa = $matriz->city." - Bolivia";
$city_casa0 = $matriz->city." - Bolivia";
if($matriz->city == $invoice->city && $invoice->branch_id != $matriz->id)
    $city_casa ="";
else
$city_casa = \'<tr>
        <td width="220" align="left">\'.$city_casa.\'</td>
        </tr>\';
        $pdf->SetFont(\'helvetica\', \'\', 7);

if($invoice->branch_id == $matriz->id || $branch_matriz == 0)
{
	$datoEmpresa = \'
    <table border = "0">
        <tr>
        <td width="250" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$dir_casa.\' </td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa0.\'
    </table>				\';
}
else{
	$sucursal = $invoice->branch_name;
	$direccion = $invoice->address1." - ".$invoice->address2;
	$ciudad = $invoice->city." - Bolivia";
	$telefonos =$invoice->phone;
	$datoEmpresa = \'
    <table border = "0">
        <tr>
        <td width="250" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$dir_casa.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa.\'
        <tr>
        <td width="250" align="left"><b>\'.$sucursal.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$direccion.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$telefonos.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$ciudad.\'</td>
        </tr>
    </table>				\';
}

$pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'40\', $datoEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//actividad económica
$actividad=$invoice->economic_activity;
$pdf->SetFont(\'helvetica\', \'\', 10);
$actividadEmpresa = \'
    <table>
        <tr>
            <td align="center">\'.$actividad.\'</td>
        </tr>
    </table>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'130\', $y=\'45\', $actividadEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//TABLA datos del cliente

$pdf->SetFont(\'helvetica\', \'\', 11);

$meses = array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");

$lenguage = \'es_ES.UTF-8\';
putenv("LANG=$lenguage");
setlocale(LC_ALL, $lenguage);

//$date =date("d/m/Y", strtotime($invoice->invoice_date));
//$date = DateTime::createFromFormat("d/m/Y", $date);
//$fecha=strftime("%d de %B de %Y",$date->getTimestamp());

$date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
if($date== null){
    $date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());
}
else
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());



$fecha= $invoice->state.", ".$fecha;
$senor = $invoice->client_name;
$nit = $invoice->client_nit;

$datosCliente = \'
<table cellpadding="2" border="0">
    <tr>
        <td width="300"><b>&nbsp;Lugar y fecha :</b>\'.$fecha.\'</td>
        <td width="220" align="right"><b>NIT/CI :</b>\'.$nit.\'</td>
    </tr>
    <tr>
        <td colspan="2"><b>&nbsp;Se&ntilde;or(es):</b> \'.$senor .\'</td>
    </tr>

</table>
\';
//$datosCliente="asdf";

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'62\', $datosCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//dibuja rectangulo datos del cliente
$pdf->SetLineStyle(array(\'width\' => 0.3, \'cap\' => \'butt\', \'join\' => \'miter\', \'dash\' => 0, \'color\' => array(0, 0, 0)));
$pdf->RoundedRect(16, 62, 184, 14, 1, \'1111\', null);
$textTitulos = "";
$textTitulos .= \'<p></p>
<table border="0.2" cellpadding="3" cellspacing="0">
    <thead>
        <tr>
         <td width="70" align="center" bgcolor="#E6DFDF"><font size="10"><b>CANTIDAD</b></font></td>
         <td width="240" align="center" bgcolor="#E6DFDF"><font size="10"><b>CONCEPTO</b></font></td>
         <td width="115" align="center" bgcolor="#E6DFDF"><font size="10"><b>PRECIO UNITARIO</b></font></td>
         <td width="97" align="center" bgcolor="#E6DFDF"><font size="10"><b>TOTAL</b></font></td>
        </tr>
    </thead>
</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'70\', $textTitulos, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//
$ini = 0;
$final = "";
$resto = $ini;
//for ($i=0;$i<=10;$i++)
//{
foreach ($products as $key => $product){
		$textContenido =\'
        <table border="0.2" cellpadding="3" cellspacing="0">
		<tr>
		<td width="70" align="center"><font size="10">\'.intval($product->qty).\'</font></td>
		<td width="240"><font size="10">\'.$product->notes.\'</font></td>
		<td width="115" align="right"><font size="10">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</font></td>
		<td width="97" align="right"><font size="10"> \'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</font></td>
		</tr>
         </table>
		\';
        $ini = $pdf->GetY(); //punto inicial antes de dibujar la siguiente fila

        if(($ini+$resto)>= 250.46944444444){

			$pdf->AddPage(\'P\', \'LETTER\');
            $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        }
        else{
        $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        $final = $pdf->GetY();  //punto hasta donde se dibujo la fila
        }
        $resto = $final-$ini; //diferencia entre $ini y $final para sacar el tamaño siguiente a dibujar
//}
}
$texPie = "";
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$fiscal="0";
$ice="0";


require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);


$pdf->SetFont(\'helvetica\', \'\', 11);
		$texPie .=\'
		<table border="0.2" cellpadding="3" cellspacing="0">
            <tr>
                <td width="425" align="right"><b>SUBTOTAL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td  width="97" align="right"><b>\'.$subtotal.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>Descuentos &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$descuento.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>TOTAL A PAGAR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$total.\'</b></td>
            </tr>

            <tr>
                <td colspan="2" style="font-size:9px"><b>Son: </b>\'.$literal.\'/100 BOLIVIANOS.</td>
            </tr>
		</table>
		\';
        if ($pdf->GetY() >= \'210.6375\' ){

            $pdf->AddPage(\'P\', \'LETTER\');
        }

$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $texPie, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//nota al cliente
$restoQr = 11;
$line=60;
if (!empty($invoice->public_notes)){
$nota = $invoice->public_notes;
$notaCliente = \'

		<table style="padding:0px 0px 0px 5px" border="0">
		<tr>
			<td style="line-height: \'.$line.\'%"> </td>
		</tr>
		<tr>
			<td width="88" align="right" style="font-size:9px;"><b>Nota al Cliente:</b></td>
			<td width="352" align="left" bgcolor="#F2F2F2" style="font-size:9px; border-left: 1px solid #000;">\'.$nota.\'</td>
		</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $notaCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$restoQr=$restoQr+10;
$line=100;
}
if (!empty($invoice->terms)){
$nota = $invoice->public_notes;
$terminos = $invoice->terms;
$termCliente = \'
		<table style="padding:0px 0px 0px 5px">
		<tr><td style="line-height: \'.$line.\'%"> </td></tr>
		<tr>
			<td width="88" align="right" style="font-size:9px"><b>Términos de Facturación: </b></td>
			<td width="352" align="left" bgcolor="#F2F2F2" style="font-size:9px; border-left: 1px solid #000; ">\'.$terminos.\'</td>
		</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $termCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$restoQr=$restoQr+11;
$line=50;
}

$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');

$law_gen="ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAIS, EL USO ILICITO DE ESTA SERA SANCIONADO DE ACUERDO A LEY";

$law=$invoice->law;
$datosFactura = \'
<table border="0" style="line-height: 160%">
	<tr><td style="line-height: \'.$line.\'%"> </td></tr>
    <tr>
        <td width="240" align="left"><b>C&Oacute;DIGO DE CONTROL :&nbsp;&nbsp;\'.$control_code.\'</b></td>
        <td width="210" align="left"><b>Fecha L&iacute;mite de Emisi&oacute;n : &nbsp;\'.$fecha_limite.\' </b></td>
    </tr>
    <tr>
        <td width="450" align="center" style="font-size:7px"><b>"\'.$law_gen.\'"</b></td>
    </tr>
    <tr>
        <td width="440" align="center" style="font-size:7px">"\'.$law.\'"</td>
    </tr>
</table>
\';
if ($pdf->GetY() >= \'226.6375\' ){
		$pdf->AddPage(\'P\', \'LETTER\');
		if(!empty($nota) && !empty($terminos)){
			$restoQr = $restoQr - 18;
		}
    }

$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $datosFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$date_qr = date("d/m/Y", strtotime($invoice->invoice_date));
$date_qr = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->invoice_date);
if($date_qr== null)
    $date_qr = $invoice->invoice_date;
else
    $date_qr = $date_qr->format(\'d/m/Y\');

if($descuento == \'0.00\')
    $descuento = 0;
$datosqr = $invoice->account_nit.\'|\'.$invoice->invoice_number.\'|\'.$invoice->number_autho.\'|\'.$date_qr.\'|\'.$total.\'|\'.$fiscal.\'|\'.$invoice->control_code.\'|\'.$invoice->client_nit.\'|\'.$ice.\'|0|0|\'.$descuento;
$pdf->write2DBarcode($datosqr, \'QRCODE,M\', \'175\',
$pdf->GetY()-$restoQr, 25, 25, \'\', \'N\');

//Close and output PDF document
$pdf->Output(\'factura.pdf\', \'I\');

die;';
        //factura fiscal
        $master->javascript_pos = ' $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Factura\');
$pdf->SetSubject(\'Primera Factura\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');
$pdf->SetMargins(0.5, 0.5, 0.5);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetFont(\'helvetica\', \'\' , 7);
$page_format = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => 1000),
    \'Dur\' => 3,
);
$business = $invoice->account_name;
if($invoice->account_uniper !=\'\')
    $unipersonal = \'<tr><td align="center">De: \'.$invoice->account_uniper.\'</td></tr>\';
else
    $unipersonal="";
// Check the example n. 29 for viewer preferences
$pdf->AddPage(\'P\', $page_format, false, false);
$sucursal = $invoice->branch_name;
$direccion = $invoice->address1." - ".$invoice->address2;
$ciudad = $invoice->city." - Bolivia";
$telefonos =$invoice->phone;

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
if($copia==1)
    $original = "COPIA";
else
$original = "ORIGINAL";
$pdf->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)$lin .= \'-\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf->SetFont(\'helvetica\', \' \' , 8);
$nitEmpresa = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;

$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf->SetFont(\'times\', \'B\' , 9);
$actividad=$invoice->economic_activity;
$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'\' , 8);
$date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
if($date==null)
    $date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
$fecha = $date->format(\'d/m/Y\');
$senor = $invoice->client_name;
$nit = $invoice->client_nit;
$hora = $date->format(\'H:i:s\');

$datosCli = \'<br>
	<table border="1">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//tabla
$htmlTabla = \'
	<table border="1">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Importe</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}
//total
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//TOTALES
$ice = number_format((float)($invoice->importe_ice), 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$importeCreditoFiscal = number_format((float)($invoice->debito_fiscal), 2, \'.\', \',\');
$fiscal =$importeCreditoFiscal;
$montoPagar = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);



$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACION: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//CODIGO DE CONTROL

$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');
$law_gen=\'"\'."ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAÍS, EL USO ILÍCITO DE ÉSTA SERÁ SANCIONADO DE ACUERDO A LEY".\'"\';
$law=$invoice->law;

 $htmlControl = \'
 	<table>
 		<tr>
 			<td>CODIGO DE CONTROL : \'.$control_code.\'</td>
 		</tr>
 		<tr>
 			<td>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</td>
 		</tr>

 	</table>
 	<br>

 \';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//qr
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$date_qr = date("d/m/Y", strtotime($invoice->invoice_date));
$date_qr = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->invoice_date);
if($date_qr== null)
    $date_qr = $invoice->invoice_date;
else
    $date_qr = $date_qr->format(\'d/m/Y\');
if($descuento=="0.00")
    $descuento=0;
if($fiscal==0) $fiscal="0";
if($ice==0) $ice ="0";
if($descuento==0)$descuento="0";
$datosqr = $invoice->account_nit.\'|\'.$invoice->invoice_number.\'|\'.$invoice->number_autho.\'|\'.$date_qr.\'|\'.$total.\'|\'.$fiscal.\'|\'.$invoice->control_code.\'|\'.$invoice->client_nit.\'|\'.$ice.\'|0|0|\'.$descuento;
$pdf->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$y = $pdf->GetY();
$y2 = intval($y) + 8;
//////pdf adaptado a nuevo tamaño//////////////////////////////////////////////////////////////////
$page_format2 = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => $y2),
    \'Dur\' => 3,
);
// add first page ---
$pdf2 = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
//Close and output PDF document
$pdf2->SetCreator(PDF_CREATOR);
$pdf2->SetAuthor(\'ipxserver\');
$pdf2->SetTitle(\'Factura\');
$pdf2->SetSubject(\'Primera Factura\');
$pdf2->SetKeywords(\'TCPDF, PDF, example, test, guide\');
// set margins
$pdf2->SetMargins(0.5, 0.5, 0.5);
// set auto page breaks
$pdf2->SetAutoPageBreak(TRUE, 0.5);
// borra la linea de arriba en el area del header
$pdf2->setPrintHeader(false);
$pdf2->setPrintFooter(false);
// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf2->SetFont(\'helvetica\', \'\' , 7);
// add second page ---
$pdf2->AddPage(\'P\', $page_format2, false, false);

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf2->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)
{
	$lin .= \'-\';

}
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf2->SetFont(\'helvetica\', \' \' , 8);


$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf2->SetFont(\'times\', \'B\' , 9);

$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//datos cliente
$pdf2->SetFont(\'helvetica\', \'\' , 8);


$datosCli = \'<br>
	<table border="0">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td colspan="3" align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td colspan="3" align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//tabla
$htmlTabla = \'
	<table border="0">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Subtotal</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}

//total
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);




$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACIÓN: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


//CODIGO DE CONTROL

 $htmlControl = \'
 	<table>
 		<tr>
 			<td><b>CÓDIGO DE CONTROL : \'.$control_code.\'</b></td>
 		</tr>
 		<tr>
 			<td><b>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</b></td>
 		</tr>
 	</table>
 	<br>

 \';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//qr
$pdf2->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf2->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->Output(\'factura.pdf\', \'I\');
die();';
        $master->save();
        $master = new MasterDocument();
        $master->name = 'Nota de Entrega';
        $master->javascript_web = 'class MYPDF extends TCPDF {
	public function Footer() {
        $this->SetY(-15);
        $this->SetFont(\'helvetica\', \'I\', 8, false);
		$logoEmizor = base64_decode(\'/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQU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AAABAFoAAAAGAAAAAAABADUAAAABAC0AAAAGAAAAAAABOEJJTQP4AAAAAABwAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAADhCSU0ECAAAAAAAEAAAAAEAAAJAAAACQAAAAAA4QklNBB4AAAAAAAQAAAAAOEJJTQQaAAAAAANpAAAABgAAAAAAAAAAAAAALwAAAC8AAAAaAGwAbwBnAG8ALQBlAG0AaQB6AG8AcgAtAGEAaQByAHAAYQBwAGUAcgBfADAAOABfADAAOAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAALwAAAC8AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAABAAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9uZwAAAC8AAAAAUmdodGxvbmcAAAAvAAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGljZQAAABIAAAAHc2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVtAAAADEVTbGljZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5cGUAAAAASW1nIAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAAAAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAAvAAAAAFJnaHRsb25nAAAALwAAAAN1cmxURVhUAAAAAQAAAAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RFWFQAAAABAAAAAAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJaG9yekFsaWduZW51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dDppbnN0YW5jZUlEPSJ4bXAuaWlkOkEzNkU1OTU0OEY5NEU1MTFBQTNGQjkwMzM5NDY2NkM4IiBzdEV2dDp3aGVuPSIyMDE1LTExLTI2VDE5OjU1OjQ0LTA0OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD94cGFja2V0IGVuZD0idyI/Pv/uAA5BZG9iZQBkQAAAAAH/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQECAgICAgICAgICAgMDAwMDAwMDAwMBAQEBAQEBAQEBAQICAQICAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA//AABEIAC8ALwMBEQACEQEDEQH/3QAEAAb/xAGiAAAABgIDAQAAAAAAAAAAAAAHCAYFBAkDCgIBAAsBAAAGAwEBAQAAAAAAAAAAAAYFBAMHAggBCQAKCxAAAgEDBAEDAwIDAwMCBgl1AQIDBBEFEgYhBxMiAAgxFEEyIxUJUUIWYSQzF1JxgRhikSVDobHwJjRyChnB0TUn4VM2gvGSokRUc0VGN0djKFVWVxqywtLi8mSDdJOEZaOzw9PjKThm83UqOTpISUpYWVpnaGlqdnd4eXqFhoeIiYqUlZaXmJmapKWmp6ipqrS1tre4ubrExcbHyMnK1NXW19jZ2uTl5ufo6er09fb3+Pn6EQACAQMCBAQDBQQEBAYGBW0BAgMRBCESBTEGACITQVEHMmEUcQhCgSORFVKhYhYzCbEkwdFDcvAX4YI0JZJTGGNE8aKyJjUZVDZFZCcKc4OTRnTC0uLyVWV1VjeEhaOzw9Pj8ykalKS0xNTk9JWltcXV5fUoR1dmOH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qQiliPFdqMQFq5AJ0kKW6gr2u5rvuc5G5dtOW5m3K1tXmIs4JJII7WHSpkdIw5to4w6Rl3/RDFBrRpI4uhp2ptfPb23JhdpbZx82Vz+fr4Mbi6CAAvPUztYFmNlighQGSWRiEiiVnYhVJAO3PcrLZ9vvN03G4EVjAhd2PkB/hJ4ADJJAGT1MGx7LufMW77fsOy2jTbndSiONB5sfU+SgVZmOFUFiQAetk344dDYH4/dd0O08f4q3P1viye8NwBLS5rOvEFkEbMqypisapMNHEbaYruw8skjNz59wOd77nnfpdznBSxSqQRVxHHXFfIu/xSHzOB2qoHXP2n9tNs9ruVLfY7TTJuUlJLqemZpiM08xHH8ES+SjUe9nJMB7BHUndf//T3+PfuvdFV+YvxhxPyz6Zqerq/KRbdysO5Nu7m2zuqalqcj/drKYyrNHk65MZT12OGUer2lk8lRJBLKsReqVyVZFdZK9p/ca69r+bY+ZIbVri1NvLDNCGVPFRhqRdZV9GmdInLKCaKVyGIMC/eO9j7L3/APbaXkebcUsdyS+trm2umSSVbeSJ9ErmFJYPH1WktzEscjhPEkSXDxoyq748/Gzqv4x7FpNi9X4FKGLRBLn9xVniqNz7vykUZR8tuLKLFG9TO7MxjhQR0tKrlIIo09Psr579wOZvcXe5N65kvS7VPhRLUQwIT8ESVNABQFjV3wXZjnoTe0Xs1yJ7J8rQcr8j7SsSFVNxcPRrm7lUU8W4lABdiSxVAFiiDFYY0Tt6e9u9CdS7S7BynaG2tk4fC7xy9A9BV1tBCYKVBUSmWtraPFowx2PyWR4WpqII45JlBDE65C6O/wCduaN02G35b3Dd5ZtpjkDhWNWwKKrOe5kTiiMSFNKDtUKc7V7Z8j7HzRe85bRy7Bb7/cRFGdBpXuJLssY/TSSThI6KrOK6j3MWGH2Feh31737r3X//1N/j37r3Xvfuvde9+691737r3Xvfuvde9+691//Z\');
		  $html = \'<hr><table border="0">
			<tr>
			<td align="center">Sistema de facturaci&oacute;n brindado por <a href="www.emizor.com">www.emizor.com</a></td>
			</tr>
			<tr>
			<td width="578" align="center">Pág \'.$this->getAliasNumPage().\'/\'.$this->getAliasNbPages().\'</td>
			</tr>
			</table>\';
        $this->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
		$this->Image(\'@\'.$logoEmizor, \'7\', \'128\', 4, 12, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
		$this->Image(\'@\'.$emizorAvion, \'145\', \'265\', 5, 8, \'\', \'www.emizor.com\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
	}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Nota de Entrega\');
$pdf->SetSubject(\'Primera Nota\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');
// set margins
$pdf->SetMargins(15, 20, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// borra la linea de arriba en el area del header
$pdf->setPrintHeader(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf->SetFont(\'helvetica\', \'B\' , 11);
$nit = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;
$sfc = $invoice->sfc;

// add a page
$pdf->AddPage(\'P\', \'LETTER\');

$logoEmpresa = base64_decode($invoice->logo);
$pdf->Image(\'@\'.$logoEmpresa, \'14\', \'10\', 50, 20, \'\', \'\', \'T\', false, 300, \'\', false, false, 0, false, false, false);
///title

$titleFactura=\'<table>
<tr>
<td align="rigth"><font color="#333333">NOTA DE ENTREGA</font></td>
</tr>
</table>\';
$pdf->SetFont(\'helvetica\', \'B\' , 27);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'10\', $titleFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'B\' , 11);
//nombre de la empresa
$business = $invoice->account_name;
$unipersonal = $invoice->account_uniper;
$pdf->SetFont(\'helvetica\', \'B\', 12, false);
$NombreEmpresa = \'
    <p style="line-height: 150%">
        <font color="#333333">
            \'.$business.\'
        </font>
    </p>\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'31\', $NombreEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);




$pdf->SetFont(\'helvetica\', \'B\', 8, false);


//datos de la empresa
$casa = $matriz->name;
$dir_casa = $matriz->address1." - ".$matriz->address2;
$tel_casa = $matriz->work_phone;
$city_casa = $matriz->city." - Bolivia";
if($matriz->city == $invoice->city && $invoice->branch_id != $matriz->id)
    $city_casa ="";
else
$city_casa = \'<tr>
        <td width="220" align="left">\'.$city_casa.\'</td>
        </tr>\';
        $pdf->SetFont(\'helvetica\', \'\', 7);

if($invoice->branch_id == $matriz->id)
{
	$datoEmpresa = \'
    <table border = "0">
        <tr>
        <td width="250" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$dir_casa.\' </td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa.\'
    </table>				\';
}
else{
	$sucursal = $invoice->branch_name;
	$direccion = $invoice->address1." - ".$invoice->address2;
	$ciudad = $invoice->city." - Bolivia";
	$telefonos =$invoice->phone;
	$datoEmpresa = \'
    <table border = "0">
        <tr>
        <td width="250" align="left"><b>\'.$casa.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$dir_casa.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$tel_casa.\'</td>
        </tr>
        \'.$city_casa.\'
        <tr>
        <td width="250" align="left"><b>\'.$sucursal.\'</b></td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$direccion.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">Telfs: \'.$telefonos.\'</td>
        </tr>
        <tr>
        <td width="250" align="left">\'.$ciudad.\'</td>
        </tr>
    </table>				\';
}

$pdf->writeHTMLCell($w=0, $h=0, $x=\'15\', $y=\'40\', $datoEmpresa, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//TABLA datos del cliente

$pdf->SetFont(\'helvetica\', \'\', 10);

$meses = array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");

$lenguage = \'es_ES.UTF-8\';
putenv("LANG=$lenguage");
setlocale(LC_ALL, $lenguage);


$date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
if($date== null){
    $date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());
}
else
    $fecha = strftime("%d de %B de %Y",$date->getTimestamp());



//$fecha= $invoice->state.", ".$fecha;
$senor = $invoice->client_name;
$nit = $invoice->client_nit;
$numeroNota = $invoice->document_number;

$datosCliente = \'
<table cellpadding="2" border="0">
    <tr>
        <td  width="80" align="right"><b>&nbsp;Fecha :</b></td>
        <td width="135">\'.$fecha.\'</td>
    </tr>

    <tr>
        <td width="80" align="right"><b>Nº de Nota:</b></td>
        <td width="135">\'.$numeroNota.\'</td>
    </tr>
</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'121\', $y=\'32\', $datosCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$nameClient = \'
	<table border = "0">
	<tr>
        <td width="60" align="right"><b>Para:</b></td>
        <td width="90">&nbsp;\'.$senor .\'</td>
    </tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'67\', $y=\'32\', $nameClient, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//preparado por

$pdf->SetFont(\'helvetica\', \'\', 9);
$nombreUsuario = $user->last_name." ".$user->first_name;
$rol = "Soporte Técnico";
$telefono = $user->phone;
$correo = $user->email;

$preparadoPor = \'
    <table border = "0">
        <tr>
        <td width="75" align="left"><b>Preparado por: </b></td>
        <td width="110" align="left">\'.$nombreUsuario.\'</td>
        </tr>
        <!--tr>
        <td width="75" align="left"> </td>
        <td width="110" align="left">\'.$rol.\'</td>
        </tr-->
        <tr>
        <td width="75" align="left"> </td>
        <td width="110" align="left">Telfs: \'.$telefono.\'</td>
        </tr>
        <tr>
        <td width="75" align="left"> </td>
        <td width="110" align="left">\'.$correo.\'</td>
        </tr>
    </table>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'125\', $y=\'50\', $preparadoPor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);





$textTitulos = "";
$textTitulos .= \'<p></p>
<table border="0.2" cellpadding="3" cellspacing="0">
    <thead>
        <tr>
         <td width="70" align="center" bgcolor="#E6DFDF"><font size="10"><b>CANTIDAD</b></font></td>
         <td width="240" align="center" bgcolor="#E6DFDF"><font size="10"><b>CONCEPTO</b></font></td>
         <td width="115" align="center" bgcolor="#E6DFDF"><font size="10"><b>PRECIO UNITARIO</b></font></td>
         <td width="97" align="center" bgcolor="#E6DFDF"><font size="10"><b>TOTAL</b></font></td>
        </tr>
    </thead>
</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'60\', $textTitulos, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//
$ini = 0;
$final = "";
$resto = $ini;
//for ($i=0;$i<=10;$i++)
//{
foreach ($products as $key => $product){
		$textContenido =\'
        <table border="0.2" cellpadding="3" cellspacing="0">
		<tr>
		<td width="70" align="center"><font size="10">\'.intval($product->qty).\'</font></td>
		<td width="240"><font size="10">\'.$product->notes.\'</font></td>
		<td width="115" align="right"><font size="10">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</font></td>
		<td width="97" align="right"><font size="10"> \'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</font></td>
		</tr>
         </table>
		\';
        $ini = $pdf->GetY(); //punto inicial antes de dibujar la siguiente fila

        if(($ini+$resto)>= 250.46944444444){

			$pdf->AddPage(\'P\', \'LETTER\');
            $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        }
        else{
        $pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $textContenido, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
        $final = $pdf->GetY();  //punto hasta donde se dibujo la fila
        }
        $resto = $final-$ini; //diferencia entre $ini y $final para sacar el tamaño siguiente a dibujar
//}
}
$texPie = "";
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$fiscal="0";
$ice="0";


require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);


$pdf->SetFont(\'helvetica\', \'\', 11);
		$texPie .=\'
		<table border="0.2" cellpadding="3" cellspacing="0">
            <tr>
                <td width="425" align="right"><b>SUBTOTAL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td  width="97" align="right"><b>\'.$subtotal.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>Descuentos &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$descuento.\'</b></td>
            </tr>
            <tr>
                <td width="425"  align="right"><b>TOTAL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
                <td width="97" align="right"><b>\'.$total.\'</b></td>
            </tr>

            <tr>
                <td colspan="2" style="font-size:9px"><b>Son: </b>\'.$literal.\'/100 BOLIVIANOS.</td>
            </tr>
		</table>
		\';
        if ($pdf->GetY() >= \'210.6375\' ){

            $pdf->AddPage(\'P\', \'LETTER\');
        }

$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $texPie, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//nota al cliente
$restoQr = 11;
$line=60;
if (!empty($invoice->public_notes)){
$nota = $invoice->public_notes;
$notaCliente = \'

		<table style="padding:0px 0px 0px 5px" border="0">
		<tr>
			<td style="line-height: \'.$line.\'%"> </td>
		</tr>
		<tr>
			<td width="88" align="right" style="font-size:9px;"><b>Nota al Cliente:</b></td>
			<td width="352" align="left" bgcolor="#F2F2F2" style="font-size:9px; border-left: 1px solid #000;">\'.$nota.\'</td>
		</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $notaCliente, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$restoQr=$restoQr+10;
$line=100;
}

$restoQr=$restoQr+11;
$line=50;


$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');

$law_gen="ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAIS, EL USO ILICITO DE ESTA SERA SANCIONADO DE ACUERDO A LEY";

$law=$invoice->law;
//$usuario = "usuario";
$datosFactura = \'
<table border="0" style="line-height: 160%">
	<tr><td style="line-height: \'.$line.\'%"> </td></tr>
    <tr><td> </td></tr>
    <tr><td> </td></tr>
    <tr>
        <td width="262" align="center" style="font-size:9px"><b>Recibi Conforme</b></td>
        <td width="262" align="center" style="font-size:9px"><b>Entregue Conforme</b></td>
    </tr>
    <tr>
        <td width="262" align="center" style="font-size:9px"><b> </b></td>
        <td width="262" align="center" style="font-size:9px">\'.$nombreUsuario.\'</td>
    </tr>

</table>
\';
if ($pdf->GetY() >= \'226.6375\' ){
		$pdf->AddPage(\'P\', \'LETTER\');
		if(!empty($nota) && !empty($terminos)){
			$restoQr = $restoQr - 18;
		}
    }

$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$pdf->writeHTMLCell($w=0, $h=0, \'\', \'\', $datosFactura, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//Close and output PDF document
$pdf->Output(\'factura.pdf\', \'I\');

die;';
        //factura fiscal
        $master->javascript_pos = ' $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(\'ipxserver\');
$pdf->SetTitle(\'Factura\');
$pdf->SetSubject(\'Primera Factura\');
$pdf->SetKeywords(\'TCPDF, PDF, example, test, guide\');
$pdf->SetMargins(0.5, 0.5, 0.5);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetFont(\'helvetica\', \'\' , 7);
$page_format = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => 1000),
    \'Dur\' => 3,
);
$business = $invoice->account_name;
if($invoice->account_uniper !=\'\')
    $unipersonal = \'<tr><td align="center">De: \'.$invoice->account_uniper.\'</td></tr>\';
else
    $unipersonal="";
// Check the example n. 29 for viewer preferences
$pdf->AddPage(\'P\', $page_format, false, false);
$sucursal = $invoice->branch_name;
$direccion = $invoice->address1." - ".$invoice->address2;
$ciudad = $invoice->city." - Bolivia";
$telefonos =$invoice->phone;

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
if($copia==1)
    $original = "COPIA";
else
$original = "ORIGINAL";
$pdf->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)$lin .= \'-\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf->SetFont(\'helvetica\', \' \' , 8);
$nitEmpresa = $invoice->account_nit;
$nfac = $invoice->invoice_number;
$nauto = $invoice->number_autho;

$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf->SetFont(\'times\', \'B\' , 9);
$actividad=$invoice->economic_activity;
$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'helvetica\', \'\' , 8);
$date = DateTime::createFromFormat("Y-m-d", $invoice->invoice_date);
if($date==null)
    $date = DateTime::createFromFormat("d/m/Y", $invoice->invoice_date);
$fecha = $date->format(\'d/m/Y\');
$senor = $invoice->client_name;
$nit = $invoice->client_nit;
$hora = $date->format(\'H:i:s\');

$datosCli = \'<br>
	<table border="1">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//tabla
$htmlTabla = \'
	<table border="1">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Importe</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}
//total
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//TOTALES
$ice = number_format((float)($invoice->importe_ice), 2, \'.\', \',\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \',\');
$importeCreditoFiscal = number_format((float)($invoice->debito_fiscal), 2, \'.\', \',\');
$fiscal =$importeCreditoFiscal;
$montoPagar = number_format((float)$invoice->importe_neto, 2, \'.\', \',\');
require_once(app_path().\'/includes/numberToString.php\');
$nts = new numberToString();
$num = explode(".", $invoice->importe_neto);
if(!isset($num[1]))
    $num[1]="00";
$literal= $nts->to_word($num[0]).substr($num[1],0,2);



$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACION: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf->SetFont(\'helvetica\', \' \' , 8);
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//CODIGO DE CONTROL

$control_code = $invoice->control_code;
$fecha_limite = date("d/m/Y", strtotime($invoice->deadline));
$fecha_limite = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->deadline);
if($fecha_limite== null)
    $fecha_limite = $invoice->deadline;
else
    $fecha_limite = $fecha_limite->format(\'d/m/Y\');
$law_gen=\'"\'."ESTA FACTURA CONTRIBUYE AL DESARROLLO DEL PAÍS, EL USO ILÍCITO DE ÉSTA SERÁ SANCIONADO DE ACUERDO A LEY".\'"\';
$law=$invoice->law;

 $htmlControl = \'
 	<table>
 		<tr>
 			<td>CODIGO DE CONTROL : \'.$control_code.\'</td>
 		</tr>
 		<tr>
 			<td>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</td>
 		</tr>

 	</table>
 	<br>

 \';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//qr
$subtotal = number_format((float)$invoice->importe_total, 2, \'.\', \'\');
$descuento= number_format((float)($invoice->importe_total-$invoice->importe_neto), 2, \'.\', \'\');
$total = number_format((float)$invoice->importe_neto, 2, \'.\', \'\');
$date_qr = date("d/m/Y", strtotime($invoice->invoice_date));
$date_qr = \\DateTime::createFromFormat(\'Y-m-d\',$invoice->invoice_date);
if($date_qr== null)
    $date_qr = $invoice->invoice_date;
else
    $date_qr = $date_qr->format(\'d/m/Y\');
if($descuento=="0.00")
    $descuento=0;
if($fiscal==0) $fiscal="0";
if($ice==0) $ice ="0";
if($descuento==0)$descuento="0";
$datosqr = $invoice->account_nit.\'|\'.$invoice->invoice_number.\'|\'.$invoice->number_autho.\'|\'.$date_qr.\'|\'.$total.\'|\'.$fiscal.\'|\'.$invoice->control_code.\'|\'.$invoice->client_nit.\'|\'.$ice.\'|0|0|\'.$descuento;
$pdf->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$y = $pdf->GetY();
$y2 = intval($y) + 8;
//////pdf adaptado a nuevo tamaño//////////////////////////////////////////////////////////////////
$page_format2 = array(
    \'MediaBox\' => array (\'llx\' => 0, \'lly\' => 0, \'urx\' => 72, \'ury\' => $y2),
    \'Dur\' => 3,
);
// add first page ---
$pdf2 = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, \'UTF-8\', false);
//Close and output PDF document
$pdf2->SetCreator(PDF_CREATOR);
$pdf2->SetAuthor(\'ipxserver\');
$pdf2->SetTitle(\'Factura\');
$pdf2->SetSubject(\'Primera Factura\');
$pdf2->SetKeywords(\'TCPDF, PDF, example, test, guide\');
// set margins
$pdf2->SetMargins(0.5, 0.5, 0.5);
// set auto page breaks
$pdf2->SetAutoPageBreak(TRUE, 0.5);
// borra la linea de arriba en el area del header
$pdf2->setPrintHeader(false);
$pdf2->setPrintFooter(false);
// set some language-dependent strings (optional)
if (@file_exists(\'/includes/tcpdf/examples/lang/spa.php\')) {
	require_once(\'/includes/tcpdf/examples/lang/spa.php\');
	$pdf->setLanguageArray($l);
}
$pdf2->SetFont(\'helvetica\', \'\' , 7);
// add second page ---
$pdf2->AddPage(\'P\', $page_format2, false, false);

$html = \'
<table>
	<tr>
		<td align="center" style="font-size:10px; "><b>\'.$business.\'</b></td>
	</tr>
        \'.$unipersonal.\'
        <tr>
		<td align="center">\'.$sucursal.\'</td>
	</tr><tr>
		<td align="center">\'.$direccion.\'</td>
	</tr><tr>
		<td align="center">Telefono: \'.$telefonos.\'</td>
	</tr><tr>
		<td align="center">\'.$ciudad.\'</td>
	</tr>
</table>
\';
//imprime el contenido de la variable html
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->SetFont(\'times\', \'B\' , 10);
$fact = \'<br><br><table>
<tr>
	<td align="center">
		FACTURA
	</td>
</tr>
<tr>
	<td align="center">
		\'.$original.\'
	</td>
</tr>
</table>
\'
;
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $fact, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$lin = " ";

$pdf2->SetFont(\'helvetica\', \' \' , 8);
for ($i=0;$i<72;$i++)
{
	$lin .= \'-\';

}
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//DATOS FACTURA
$pdf2->SetFont(\'helvetica\', \' \' , 8);


$datosfac = \'
	<table border="0">
		<tr>
			<td align="left">NIT : </td>
			<td align="left">\'.$nitEmpresa.\'</td>
		</tr>
		<tr>
			<td align="left">FACTURA No : </td>
			<td align="left">\'.$nfac.\'</td>
		</tr>
		<tr>
			<td align="left">AUTORIZACION No :   </td>
			<td align="left">\'.$nauto.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'10\', $y=\'\', $datosfac, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//actividad economica
$pdf2->SetFont(\'times\', \'B\' , 9);

$acti = \'
	<table align="center">
		<tr>
			<td>ACTIVIDAD ECON&Oacute;MICA</td>
		</tr>
		<tr>
			<td>\'.$actividad.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $acti, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
//datos cliente
$pdf2->SetFont(\'helvetica\', \'\' , 8);


$datosCli = \'<br>
	<table border="0">
		<tr>
			<td align="left" width="40">Fecha : </td>
			<td align="left">\'.$fecha.\'</td>
			<td align="right" width="30">Hora : </td>
			<td align="left">\'.$hora.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">NIT/CI : </td>
			<td colspan="3" align="left">\'.$nit.\'</td>
		</tr>
		<tr>
			<td align="left" width="40">Nombre :   </td>
			<td colspan="3" align="left">\'.$senor.\'</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'9\', $y=\'\', $datosCli, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//tabla
$htmlTabla = \'
	<table border="0">
		<tr>
			<td align="center">Cantidad</td>
			<td align="center">Precio</td>
			<td align="center">Subtotal</td>
		</tr>
	</table>
<p style="line-height: 30%">
    </p>\';

$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

foreach ($products as $key => $product){
	$htmlTabla2 = \'
		<table border="0">
			<tr>
				<td colspan="3">\'.$product->notes.\'</td>
			</tr>
			<tr>
				<td align="center">\'.intval($product->qty).\'</td>
				<td align="center">\'.number_format((float)$product->cost, 2, \'.\', \',\').\'</td>
				<td align="center">\'.number_format((float)($product->cost*$product->qty), 2, \'.\', \',\').\'</td>
			</tr>
		</table>
	\';
	$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTabla2, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
}

//total
$htmlTotal = \'<hr>
	<table>
		<tr>
			<td align="right" width="173"><b>TOTAL: Bs \'.$total.\'</b></td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlTotal, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);




$htmlDatosExtra = \'
	<table>
		<tr>
			<td>ICE: \'.$ice.\'</td>
		</tr>
		<tr>
			<td>DESCUENTOS/BONIFICACIÓN: \'.$descuento.\'</td>
		</tr>
		<tr>
			<td>IMPORTE BASE CREDITO FISCAL: \'.$importeCreditoFiscal.\'</td>
		</tr>
		<tr>
			<td>MONTO A PAGAR: Bs \'.$montoPagar.\'</td>
		</tr>
		<tr>
			<td>SON: \'.$literal.\'/100 BOLIVIANOS</td>
		</tr>
	</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlDatosExtra, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//linea
$pdf2->SetFont(\'helvetica\', \' \' , 8);
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $lin, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);


//CODIGO DE CONTROL

 $htmlControl = \'
 	<table>
 		<tr>
 			<td><b>CÓDIGO DE CONTROL : \'.$control_code.\'</b></td>
 		</tr>
 		<tr>
 			<td><b>FECHA LÍMITE EMISIÓN : \'.$fecha_limite.\'</b></td>
 		</tr>
 	</table>
 	<br>

 \';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlControl, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

//qr
$pdf2->write2DBarcode($datosqr, \'QRCODE,M\', \'24\', \'\' , 25, 25, \'\', \'N\');

$htmlLeyenda = \'<br><br>
		<table>
			<tr>
				<td align="center"><b>\'.$law_gen.\'</b></td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $htmlLeyenda, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);
$pdf2->SetFont(\'times\', \' \' , 9);
$emizor = \'<br><br>
		<table>
			<tr>
				<td align="center">www.emizor.com</td>
			</tr>
		</table>
\';
$pdf2->writeHTMLCell($w=0, $h=0, $x=\'\', $y=\'\', $emizor, $border=0, $ln=1, $fill=0, $reseth=true, $align=\'left\', $autopadding=true);

$pdf2->Output(\'factura.pdf\', \'I\');
die();';
        $master->save();
        PaymentType::create(array('name' => 'Efectivo'));
        PaymentType::create(array('name' => 'Crédito'));
        PaymentType::create(array('name' => 'Transferencia Bancaria'));
        PaymentType::create(array('name' => 'Cheque'));
        //Unidad::create(array('name' => 'unidad','is_int'=>true,));
        //Unidad::create(array('nombre' => 'decimal','is_int'=>false));
        InvoiceStatus::create(array('name' => 'Emitido'));
        InvoiceStatus::create(array('name' => 'Enviado'));
        InvoiceStatus::create(array('name' => 'Visto'));
        InvoiceStatus::create(array('name' => 'Parcial'));
        InvoiceStatus::create(array('name' => 'Pagado'));
        InvoiceStatus::create(array('name' => 'Anulado'));
        Frequency::create(array('name' => 'Mensual'));
        Frequency::create(array('name' => 'Trimestral'));
        Frequency::create(array('name' => 'Semestral'));
        Frequency::create(array('name' => 'Anual'));
        Currency::create(array('name' => 'Bolivianos', 'code' => 'BS', 'symbol' => 'Bs', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
        DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
        DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
        DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
        DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
        DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
        DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
        DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
        DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
        DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
        DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
        DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
        DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
        DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
        DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
        /*
        d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
        D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
        m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
        M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
        yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
        */
        $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
        foreach ($timezones as $name => $location) {
            Timezone::create(array('name' => $name, 'location' => $location));
        }
    }
コード例 #20
0
function smarty_modifier_dateformat($input)
{
    return DateFormat::format($input);
}
コード例 #21
0
 public function executeGetRepetitionParamSelectTag(sfWebRequest $request)
 {
     $id = $request->getParameter('id');
     $value = $request->getParameter('value');
     if (!$id) {
         return $this->renderText('');
     }
     $summary = '';
     $tag = '';
     if ($repetition = PcRepetitionPeer::retrieveByPk($id)) {
         if ($repetition->needsParam()) {
             if ($repetition->getSpecial() == 'selected_wkdays') {
                 $weekdaysSelected = DateFormat::fromIntegerToWeekdaysSetForRepetition($value);
                 $selectedSun = $weekdaysSelected['sun'] ? "checked='checked'" : '';
                 $selectedMon = $weekdaysSelected['mon'] ? "checked='checked'" : '';
                 $selectedTue = $weekdaysSelected['tue'] ? "checked='checked'" : '';
                 $selectedWed = $weekdaysSelected['wed'] ? "checked='checked'" : '';
                 $selectedThu = $weekdaysSelected['thu'] ? "checked='checked'" : '';
                 $selectedFri = $weekdaysSelected['fri'] ? "checked='checked'" : '';
                 $selectedSat = $weekdaysSelected['sat'] ? "checked='checked'" : '';
                 $tag = "";
                 if (PcUserPeer::getLoggedInUser()->getWeekStart() == 0) {
                     $tag .= "<input type='checkbox' id='wdfr_sun' name='weekdaysForRepetition' value='sun' {$selectedSun} ><label for='wdfr_sun'>" . __('ACCOUNT_DOW_SUN') . "</label>";
                 }
                 $tag .= "<input type='checkbox' id='wdfr_mon' name='weekdaysForRepetition' value='mon' {$selectedMon} /><label for='wdfr_mon'>" . __('ACCOUNT_DOW_MON') . "</label>";
                 $tag .= "<input type='checkbox' id='wdfr_tue' name='weekdaysForRepetition' value='tue' {$selectedTue} /><label for='wdfr_tue'>" . __('ACCOUNT_DOW_TUE') . "</label>";
                 $tag .= "<input type='checkbox' id='wdfr_wed' name='weekdaysForRepetition' value='wed' {$selectedWed} /><label for='wdfr_wed'>" . __('ACCOUNT_DOW_WED') . "</label>";
                 $tag .= "<input type='checkbox' id='wdfr_thu' name='weekdaysForRepetition' value='thu' {$selectedThu} /><label for='wdfr_thu'>" . __('ACCOUNT_DOW_THU') . "</label>";
                 $tag .= "<input type='checkbox' id='wdfr_fri' name='weekdaysForRepetition' value='fri' {$selectedFri} /><label for='wdfr_fri'>" . __('ACCOUNT_DOW_FRI') . "</label>";
                 $tag .= "<input type='checkbox' id='wdfr_sat' name='weekdaysForRepetition' value='sat' {$selectedSat} /><label for='wdfr_sat'>" . __('ACCOUNT_DOW_SAT') . "</label>";
                 if (PcUserPeer::getLoggedInUser()->getWeekStart() == 1) {
                     $tag .= "<input type='checkbox' id='wdfr_sun' name='weekdaysForRepetition' value='sun' {$selectedSun} ><label for='wdfr_sun'>" . __('ACCOUNT_DOW_SUN') . "</label>";
                 }
                 $summary = $tag;
             } else {
                 $min = $repetition->getMinParam();
                 $max = $repetition->getMaxParam();
                 $tag = "<select name=\"repetitionParam\">";
                 for ($i = $min; $i <= $max; $i++) {
                     $selected = $value == $i ? 'selected="selected"' : '';
                     $label = $repetition->isParamCardinal() ? $i : PcUtils::getOrdinalFromCardinal($i);
                     $tag .= "<option value=\"{$i}\" {$selected}>{$label}</option>";
                 }
                 $tag .= "</select>";
                 $summary = str_replace(__('ACCOUNT_TASK_REPETITION_SELECT_LATER'), $tag, $repetition->getLocalizedHumanExpression());
             }
         }
     }
     return $this->renderText($summary);
 }
コード例 #22
0
ファイル: news.php プロジェクト: Torredo/cms
<!--                                        <table class="table table-striped b-t b-light" ui-jq="dataTable" ui-options="{bPaginate: false, bFilter: false, bInfo: false, order: [[ 0, 'desc' ]], aoColumns: [null,{bSortable:false},{bSortable:false},{bSortable:false,sWidth: '50px'}]}" style="width: 100%; margin: 0px;">-->
                                        <table class="table table-striped b-t b-light">
                                            <thead>
                                                <tr>
                                                    <th width="20">Дата</th>
                                                    <th>Заголовок</th>
                                                    <th>Текст</th>
                                                    <th style="width:84px;"></th>
                                                </tr>
                                            </thead>
                                            <?php 
    foreach ($records as $record) {
        ?>
                                                <tr>
                                                    <td><?php 
        echo DateFormat::dateDMY($record["date"]);
        ?>
</td>
                                                    <td><?php 
        echo $record["title"];
        ?>
</td>
                                                    <td><?php 
        echo $record["text"];
        ?>
</td>
                                                    <td>
                                                        <button class="btn btn-xs btn-info edit"
                                                                data-id="<?php 
        echo $record["id"];
        ?>
コード例 #23
0
ファイル: provider.php プロジェクト: Torredo/cms
        ?>
</td>
                                                    <td><?php 
        echo $record["delivery"];
        ?>
</td>
                                                    <td><?php 
        echo $record["comments"];
        ?>
</td>
                                                    <td>
                                                        <?php 
        if ($record["update"] == "0000-00-00 00:00:00") {
            echo "не обновлялся";
        } else {
            echo DateFormat::dateDMY($record["update"]) . " в " . DateFormat::time($record["update"]);
        }
        ?>
                                                    </td>
                                                    <td>
                                                        <button class="btn btn-xs btn-info edit"
                                                                data-id="<?php 
        echo $record["id"];
        ?>
"
                                                                data-title="<?php 
        echo $table;
        ?>
" data-toggle="modal"
                                                                data-target=".<?php 
        echo $table;
コード例 #24
0
ファイル: index.php プロジェクト: high/cgeek
			
			<p><i>
				This is my page about me. Now, you may have noticed that there is no color or graphics on this page. 
				The theme is inspired by the clean theme from <a href="http://mnmlist.com/">mnmlist.com</a> written by Leo Babauta.
				The purpose is that I want people to read what I'm writing, not looking at the pretty colors or the fancy pictures.  
			</i></p>
			
			<h2>News</h2>
		
			<?php 
foreach ($newsItems as $newsItem) {
    ?>
 
			<h3><?php 
    echo $newsItem->getTitle();
    ?>
 - <?php 
    echo DateFormat::toNewsDate($newsItem->getCreatedTimestamp());
    ?>
</h3>
			<p>
				<?php 
    echo $newsItem->getContent();
    ?>
			</p>
			<?php 
}
?>
		</div>
	</body>
</html>
コード例 #25
0
 public function run()
 {
     // TEST DATA
     /*
     $contact = new Contact;
     $contact->first_name = 'Hillel';
     $contact->last_name = 'Hillel';
     $contact->email = '*****@*****.**';
     $contact->last_name = '2125551234';
     $client->contacts()->save($contact);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0001';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0002';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0003';
     $client->invoices()->save($invoice);
     
     $invoice = new Invoice;
     $invoice->invoice_number = '0004';
     $client->invoices()->save($invoice);
     */
     PaymentType::create(array('name' => 'Apply Credit'));
     PaymentType::create(array('name' => 'Bank Transfer'));
     PaymentType::create(array('name' => 'Cash'));
     PaymentType::create(array('name' => 'Debit'));
     PaymentType::create(array('name' => 'ACH'));
     PaymentType::create(array('name' => 'Visa Card'));
     PaymentType::create(array('name' => 'MasterCard'));
     PaymentType::create(array('name' => 'American Express'));
     PaymentType::create(array('name' => 'Discover Card'));
     PaymentType::create(array('name' => 'Diners Card'));
     PaymentType::create(array('name' => 'EuroCard'));
     PaymentType::create(array('name' => 'Nova'));
     PaymentType::create(array('name' => 'Credit Card Other'));
     PaymentType::create(array('name' => 'PayPal'));
     PaymentType::create(array('name' => 'Google Wallet'));
     PaymentType::create(array('name' => 'Check'));
     Theme::create(array('name' => 'amelia'));
     Theme::create(array('name' => 'cerulean'));
     Theme::create(array('name' => 'cosmo'));
     Theme::create(array('name' => 'cyborg'));
     Theme::create(array('name' => 'flatly'));
     Theme::create(array('name' => 'journal'));
     Theme::create(array('name' => 'readable'));
     Theme::create(array('name' => 'simplex'));
     Theme::create(array('name' => 'slate'));
     Theme::create(array('name' => 'spacelab'));
     Theme::create(array('name' => 'united'));
     Theme::create(array('name' => 'yeti'));
     InvoiceStatus::create(array('name' => 'Draft'));
     InvoiceStatus::create(array('name' => 'Sent'));
     InvoiceStatus::create(array('name' => 'Viewed'));
     InvoiceStatus::create(array('name' => 'Partial'));
     InvoiceStatus::create(array('name' => 'Paid'));
     Frequency::create(array('name' => 'Weekly'));
     Frequency::create(array('name' => 'Two weeks'));
     Frequency::create(array('name' => 'Four weeks'));
     Frequency::create(array('name' => 'Monthly'));
     Frequency::create(array('name' => 'Three months'));
     Frequency::create(array('name' => 'Six months'));
     Frequency::create(array('name' => 'Annually'));
     Industry::create(array('name' => 'Accounting & Legal'));
     Industry::create(array('name' => 'Advertising'));
     Industry::create(array('name' => 'Aerospace'));
     Industry::create(array('name' => 'Agriculture'));
     Industry::create(array('name' => 'Automotive'));
     Industry::create(array('name' => 'Banking & Finance'));
     Industry::create(array('name' => 'Biotechnology'));
     Industry::create(array('name' => 'Broadcasting'));
     Industry::create(array('name' => 'Business Services'));
     Industry::create(array('name' => 'Commodities & Chemicals'));
     Industry::create(array('name' => 'Communications'));
     Industry::create(array('name' => 'Computers & Hightech'));
     Industry::create(array('name' => 'Defense'));
     Industry::create(array('name' => 'Energy'));
     Industry::create(array('name' => 'Entertainment'));
     Industry::create(array('name' => 'Government'));
     Industry::create(array('name' => 'Healthcare & Life Sciences'));
     Industry::create(array('name' => 'Insurance'));
     Industry::create(array('name' => 'Manufacturing'));
     Industry::create(array('name' => 'Marketing'));
     Industry::create(array('name' => 'Media'));
     Industry::create(array('name' => 'Nonprofit & Higher Ed'));
     Industry::create(array('name' => 'Pharmaceuticals'));
     Industry::create(array('name' => 'Professional Services & Consulting'));
     Industry::create(array('name' => 'Real Estate'));
     Industry::create(array('name' => 'Retail & Wholesale'));
     Industry::create(array('name' => 'Sports'));
     Industry::create(array('name' => 'Transportation'));
     Industry::create(array('name' => 'Travel & Luxury'));
     Industry::create(array('name' => 'Other'));
     Industry::create(array('name' => 'Photography'));
     Size::create(array('name' => '1 - 3'));
     Size::create(array('name' => '4 - 10'));
     Size::create(array('name' => '11 - 50'));
     Size::create(array('name' => '51 - 100'));
     Size::create(array('name' => '101 - 500'));
     Size::create(array('name' => '500+'));
     PaymentTerm::create(array('num_days' => 7, 'name' => 'Net 7'));
     PaymentTerm::create(array('num_days' => 10, 'name' => 'Net 10'));
     PaymentTerm::create(array('num_days' => 14, 'name' => 'Net 14'));
     PaymentTerm::create(array('num_days' => 15, 'name' => 'Net 15'));
     PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30'));
     PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
     PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
     Currency::create(array('name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
     DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
     DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
     DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
     DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
     DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
     DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
     DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
     DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
     DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
     DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
     DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
     PaymentLibrary::create(['name' => 'Omnipay']);
     PaymentLibrary::create(['name' => 'PHP-Payments']);
     /*	
     d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
     D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
     m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
     M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
     yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
     */
     $gateways = [array('name' => 'Authorize.Net AIM', 'provider' => 'AuthorizeNet_AIM'), array('name' => 'Authorize.Net SIM', 'provider' => 'AuthorizeNet_SIM'), array('name' => 'CardSave', 'provider' => 'CardSave'), array('name' => 'Eway Rapid', 'provider' => 'Eway_Rapid'), array('name' => 'FirstData Connect', 'provider' => 'FirstData_Connect'), array('name' => 'GoCardless', 'provider' => 'GoCardless'), array('name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'), array('name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'), array('name' => 'Mollie', 'provider' => 'Mollie'), array('name' => 'MultiSafepay', 'provider' => 'MultiSafepay'), array('name' => 'Netaxept', 'provider' => 'Netaxept'), array('name' => 'NetBanx', 'provider' => 'NetBanx'), array('name' => 'PayFast', 'provider' => 'PayFast'), array('name' => 'Payflow Pro', 'provider' => 'Payflow_Pro'), array('name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay'), array('name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost'), array('name' => 'PayPal Express', 'provider' => 'PayPal_Express'), array('name' => 'PayPal Pro', 'provider' => 'PayPal_Pro'), array('name' => 'Pin', 'provider' => 'Pin'), array('name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'), array('name' => 'SagePay Server', 'provider' => 'SagePay_Server'), array('name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost'), array('name' => 'Stripe', 'provider' => 'Stripe'), array('name' => 'TargetPay Direct eBanking', 'provider' => 'TargetPay_Directebanking'), array('name' => 'TargetPay Ideal', 'provider' => 'TargetPay_Ideal'), array('name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash'), array('name' => 'TwoCheckout', 'provider' => 'TwoCheckout'), array('name' => 'WorldPay', 'provider' => 'WorldPay')];
     foreach ($gateways as $gateway) {
         Gateway::create($gateway);
     }
     $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
     foreach ($timezones as $name => $location) {
         Timezone::create(array('name' => $name, 'location' => $location));
     }
 }
コード例 #26
0
ファイル: Queries.php プロジェクト: Wicloz/UniversityWebsite
 public static function day($date)
 {
     $data = DB::instance()->query("\r\n            SELECT A.id, concat(A.end_date, ' ', A.end_time) as 'date', A.desc_short as 'task', A.completion as 'completion', 'assignment' as 'type', S.name as 'parent_name', concat('page=subjects&subject=', S.abbreviation) as 'parent_page', S.name as 'subject_name', S.abbreviation as 'subject'\r\n                FROM `" . Users::showSid() . "_assignments` A\r\n                INNER JOIN `subjects` S\r\n                ON A.subject = S.abbreviation\r\n                WHERE A.end_date = ? OR (A.completion = 0 AND A.end_date < ?)\r\n            UNION\r\n            SELECT E.id, E.date, concat(E.weight, ' ', S.name) as 'task', E.mark as 'completion', 'exam' as 'type', S.name as 'parent_name', concat('page=subjects&subject=', S.abbreviation) as 'parent_page', S.name as 'subject_name', S.abbreviation as 'subject'\r\n                FROM `" . Users::showSid() . "_exams` E\r\n                INNER JOIN `subjects` S\r\n                ON E.subject = S.abbreviation\r\n                WHERE E.date = ?\r\n            UNION\r\n            SELECT P.id, P.date_end as 'date', P.goal as 'task', P.completion, 'planning' as 'type', S.name as 'parent_name', concat('page=subjects&subject=', S.abbreviation) as 'parent_page', S.name as 'subject_name', S.abbreviation as 'subject'\r\n                FROM `" . Users::showSid() . "_planning` P\r\n                INNER JOIN `subjects` S\r\n                ON P.parent_table = 'subjects' AND P.parent_id = S.id\r\n                WHERE (P.date_start <= ? AND P.date_end >= ?) OR (P.completion = 0 AND P.date_end < ?)\r\n            UNION\r\n            SELECT P.id, P.date_end as 'date', P.goal as 'task', P.completion, 'planning' as 'type', A.desc_short as 'parent_name', concat('page=assignments_item&id=', A.id) as 'parent_page', S.name as 'subject_name', S.abbreviation as 'subject'\r\n                FROM `" . Users::showSid() . "_planning` P\r\n                INNER JOIN `" . Users::showSid() . "_assignments` A\r\n                ON P.parent_table = 'assignments' AND P.parent_id = A.id\r\n                INNER JOIN `subjects` S\r\n                ON A.subject = S.abbreviation\r\n                WHERE (P.date_start <= ? AND P.date_end >= ?) OR (P.completion = 0 AND P.date_end < ?)\r\n            UNION\r\n            SELECT P.id, P.date_end as 'date', P.goal as 'task', P.completion, 'planning' as 'type', concat(E.weight, ' ', S.name) as 'parent_name', concat('page=exams_item&id=', E.id) as 'parent_page', S.name as 'subject_name', S.abbreviation as 'subject'\r\n                FROM `" . Users::showSid() . "_planning` P\r\n                INNER JOIN `" . Users::showSid() . "_exams` E\r\n                ON P.parent_table = 'exams' AND P.parent_id = E.id\r\n                INNER JOIN `subjects` S\r\n                ON E.subject = S.abbreviation\r\n                WHERE (P.date_start <= ? AND P.date_end >= ?) OR (P.completion = 0 AND P.date_end < ?)\r\n            ORDER BY completion DESC, date ASC\r\n        ", array(DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date), DateFormat::sqlDate($date)));
     $results = $data->results();
     foreach ($results as $entry) {
         self::parseEvent($entry);
     }
     return $results;
 }
コード例 #27
0
 public function run()
 {
     PriceType::create(array('name' => 'CIUDAD'));
     PriceType::create(array('name' => 'VIAJERO'));
     PriceType::create(array('name' => 'OTRO'));
     BusinessType::create(array('cod' => 'A', 'name' => 'AGENCIA'));
     BusinessType::create(array('cod' => 'B', 'name' => 'BANCO'));
     BusinessType::create(array('cod' => 'C', 'name' => 'COLEGIO'));
     BusinessType::create(array('cod' => 'CD', 'name' => 'CAMPO DEPORTIVO'));
     BusinessType::create(array('cod' => 'D', 'name' => 'DISCOTECA'));
     BusinessType::create(array('cod' => 'EE', 'name' => 'EMPRESA ESTATAL'));
     BusinessType::create(array('cod' => 'EP', 'name' => 'EMPRESA PRIVADA'));
     BusinessType::create(array('cod' => 'FA', 'name' => 'FARMACIA'));
     BusinessType::create(array('cod' => 'I', 'name' => 'INSTITUTO'));
     BusinessType::create(array('cod' => 'K', 'name' => 'KIOSCO'));
     BusinessType::create(array('cod' => 'L', 'name' => 'LICORERIA'));
     BusinessType::create(array('cod' => 'MM', 'name' => 'MICRO MARKET'));
     BusinessType::create(array('cod' => 'S', 'name' => 'SNACK'));
     BusinessType::create(array('cod' => 'P', 'name' => 'PENSION'));
     BusinessType::create(array('cod' => 'SM', 'name' => 'SUPER MERCADO'));
     BusinessType::create(array('cod' => 'PV', 'name' => 'PUESTO DE VENTA'));
     BusinessType::create(array('cod' => 'HO', 'name' => 'HOSPITAL'));
     BusinessType::create(array('cod' => 'H', 'name' => 'HOTEL'));
     BusinessType::create(array('cod' => 'CL', 'name' => 'CLINICA'));
     BusinessType::create(array('cod' => 'U', 'name' => 'UNIVERSIDAD'));
     BusinessType::create(array('cod' => 'T', 'name' => 'TERMINAL'));
     BusinessType::create(array('cod' => 'F', 'name' => 'FRIAL'));
     BusinessType::create(array('cod' => 'R', 'name' => 'RESTAURANT'));
     BusinessType::create(array('cod' => 'DP', 'name' => 'DOMICILIO PARTICULAR'));
     BusinessType::create(array('cod' => 'TI', 'name' => 'TIENDA'));
     BusinessType::create(array('cod' => 'IN', 'name' => 'INTERNET'));
     BusinessType::create(array('cod' => 'PS', 'name' => 'PELUQUERIA/SALON DE BELLEZA'));
     BusinessType::create(array('cod' => 'O', 'name' => 'OTROS'));
     InvoiceStatus::create(array('name' => 'Emitido'));
     InvoiceStatus::create(array('name' => 'Anulado'));
     Frequency::create(array('name' => 'Semanal'));
     Frequency::create(array('name' => 'Cada 2 Semanas'));
     Frequency::create(array('name' => 'Cada 4 Semanas'));
     Frequency::create(array('name' => 'Mensual'));
     Frequency::create(array('name' => 'Trimestral'));
     Frequency::create(array('name' => 'Semestral'));
     Frequency::create(array('name' => 'Anual'));
     Currency::create(array('name' => 'Bolivianos', 'code' => 'BS', 'symbol' => 'Bs', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     Currency::create(array('name' => 'Aux', 'code' => ' ', 'symbol' => ' ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
     DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
     DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
     DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
     DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
     DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
     DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
     DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
     DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
     DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
     DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
     DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
     DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
     DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
     /*	
     d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
     D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
     m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
     M, MM: Abbreviated and full month names, respectively. Eg, Jan, January
     yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
     */
     $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
     foreach ($timezones as $name => $location) {
         Timezone::create(array('name' => $name, 'location' => $location));
     }
 }