<?php require_once '../general.php'; $stocks = Stock::all()->as_array(); print_r($stocks); echo time() . "\n"; echo Time::unixToDate(time()) . "\n"; echo date(DATE_RFC822, strtotime('thursday next week 10:30am', 1352710199)) . "\n"; echo date(DATE_RFC822, strtotime('next month', 1352710199)) . "\n";
<?php require_once "../general.php"; $t = Time::dateToUnix('12/07/1986'); echo $t . "\n"; echo Time::unixToDate(1350988194976 / 1000);
public function getBirthday() { return Time::unixToDate($this->_orm->birthday); }
public static function user_order_receipt() { return function ($request, $response) { $user_id = $request->session('id'); if ($user_id) { $response->header('Content-Type', 'application/pdf'); $id = $request->id; $order = Order::findById($id); $report = Zend_Pdf::load('../pdf/trustrec.pdf'); $page = $report->pages[0]; $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES); $page->setFont($font, 11); $page->drawText(Time::unixToDate(time()), 460, 900); $page->drawText(Time::unixToDate(time()), 460, 455); $page->drawText('Order#: ' . $order->id, 400, 910); $page->drawText('Order#: ' . $order->id, 400, 465); $page->drawText($order->user->profile->fullname, 100, 900); $page->drawText($order->user->profile->fullname, 100, 455); $page->drawText($order->user->profile->address, 440, 530); $page->drawText($order->user->profile->address, 440, 85); $page->drawText($order->user->profile->fullname, 445, 555); $page->drawText($order->user->profile->fullname, 445, 109); $row = 850; foreach ($order->items as $item) { # code... $page->drawText($item->product->name, 80, $row); $page->drawText($item->product->name, 80, $row - 446); $page->drawText($item->quantity, 45, $row); $page->drawText($item->quantity, 45, $row - 446); $page->drawText(money_format('%5.2n', $item->product->price), 315, $row); $page->drawText(money_format('Php %5.2n', $item->subtotal), 370, $row); $page->drawText(money_format('%5.2n', $item->product->price), 315, $row - 446); $page->drawText(money_format('Php %5.2n', $item->subtotal), 370, $row - 446); $row -= 17; } $page->drawText(money_format('Php %5.2n', $order->total), 370, 562); $page->drawText(money_format('Php %5.2n', $order->total), 370, 118); #$page->drawText( money_format('Php %5.2n', $order->total * 0.30),450,485); echo $report->render(); } else { $response->code(403); } }; }
<?php require_once "../db/general.php"; $path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'lib'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); require_once "Zend/Pdf.php"; //$response->header('Content-Type','application/pdf'); $stocks_report = Zend_Pdf::load('../pdf/inv.pdf'); $page = $stocks_report->pages[0]; $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES); $page->setFont($font, 11); //echo "Height = {$page->getHeight()} \n"; //echo "Width = {$page->getWidth()} \n"; $page->drawText("as of " . Time::unixToDate(time()), 100, 100); echo $stocks_report->save('test.pdf'); ?>