Esempio n. 1
0
 function printpdfinvoiceAction()
 {
     $orderId = $this->_getParam('orderId');
     $this->_helper->layout->disableLayout();
     $items = App_Model_Show_Order::show()->getOrderDetail($orderId);
     // create new PDF document
     $pdf = new Pandamp_Lib_Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     define("PDF_HEADER_TITLE", "PT. Justika Siar Publika");
     define("PDF_HEADER_STRING", "Puri Imperium Office Plaza, Jl. Kuningan Madya Kav 5-6 Kuningan Jakarta 12980,\nTelepon: (62-21) 83701827 / Faksimili: (62-21) 83701826\nE-mail: layanan@hukumonline.com");
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nihki Prihadi');
     $pdf->SetTitle('TCPDF Example');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, tutorial');
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //$pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set default font subsetting mode
     $pdf->setFontSubsetting(true);
     // Set font
     // dejavusans is a UTF-8 Unicode font, if you only need to
     // print standard ASCII chars, you can use core fonts like
     // helvetica or times to reduce file size.
     $pdf->SetFont('dejavusans', '', 10, '', true);
     // add a page
     $pdf->AddPage();
     // create address box
     $pdf->CreateTextBox('Kepada Yth,', 0, 25, 80, 10, 10, 'B');
     $pdf->CreateTextBox($items[0]['taxCompany'], 0, 30, 80, 10, 10);
     if ($items[0]['orderStatus'] == 3) {
         $status = "LUNAS";
     } else {
         $status = "BELUM LUNAS";
     }
     $html = '
         <table>
         <tr>
             <td style="color:red;font-size:3em;">' . $status . '</td>
         </tr>
         </table>
         ';
     $pdf->writeHTMLCell($w = 0, $h = 0, 90, 30, $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     $pdf->CreateTextBox('ATTN: ' . $this->_user->fullName, 0, 35, 80, 10, 10);
     $pdf->CreateTextBox($items[0]['taxAddress'], 0, 40, 80, 10, 10);
     $pdf->CreateTextBox($items[0]['taxCity'] . '-' . $items[0]['taxZip'], 0, 45, 80, 10, 10);
     $modelProvince = new App_Model_Db_Table_Province();
     $rowProvince = $modelProvince->find($items[0]['taxProvince'])->current();
     if ($rowProvince) {
         $pdf->CreateTextBox($rowProvince->pname, 0, 50, 80, 10, 10);
     }
     // invoice title / number
     $pdf->CreateTextBox('Invoice #' . $items[0]['invoiceNumber'], 0, 65, 120, 20, 16);
     // date, order ref
     $pdf->CreateTextBox('Date: ' . Pandamp_Lib_Formater::get_date($items[0]['datePurchased']), 0, 75, 0, 10, 10, '', 'R');
     $pdf->CreateTextBox('Order ref.: #' . $items[0]['orderId'], 0, 80, 0, 10, 10, '', 'R');
     // list headers
     $pdf->CreateTextBox('Quantity', 0, 95, 20, 10, 10, 'B', 'C');
     $pdf->CreateTextBox('Product or service', 20, 95, 90, 10, 10, 'B');
     $pdf->CreateTextBox('Price', 110, 95, 30, 10, 10, 'B', 'R');
     $pdf->CreateTextBox('Amount', 140, 95, 30, 10, 10, 'B', 'R');
     $pdf->Line(20, 105, 195, 105);
     $currY = 108;
     $total = 0;
     for ($iCart = 0; $iCart < count($items); $iCart++) {
         $pdf->CreateTextBox($items[$iCart]['qty'], 0, $currY, 20, 10, 10, '', 'C');
         $html2 = '
         <table>
         <tr>
             <td>' . $items[$iCart]['documentName'] . '</td>
         </tr>
         </table>
         ';
         $pdf->writeHTMLCell(90, 10, 40, $currY, $html2, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
         //	$pdf->CreateTextBox($items[$iCart]['documentName'], 20, $currY, 90, 10, 10, '');
         $pdf->CreateTextBox('Rp ' . number_format($items[$iCart]['price'], 0, ',', '.'), 110, $currY, 30, 10, 10, '', 'R');
         $amount = $items[$iCart]['price'] * $items[$iCart]['qty'];
         $pdf->CreateTextBox('Rp ' . number_format($items[$iCart]['finalPrice'], 0, ',', '.'), 140, $currY, 30, 10, 10, '', 'R');
         $currY = $currY + 15;
         $total = $total + $amount;
     }
     $pdf->Line(195, $currY + 8, 130, $currY + 8);
     // output the total row
     $pdf->CreateTextBox('Sub Total ', 5, $currY + 7, 135, 10, 10, 'B', 'R');
     $pdf->CreateTextBox('Rp ' . number_format($total, 2, ',', '.'), 140, $currY + 7, 30, 10, 10, 'B', 'R');
     if ($items[0]['discount'] > 0) {
         $pdf->CreateTextBox('Disc ', 5, $currY + 12, 135, 10, 10, 'B', 'R');
         $pdf->CreateTextBox($items[0]['discount'] . '%', 140, $currY + 12, 30, 10, 10, 'B', 'R');
         $pdf->CreateTextBox('Grand Total ', 5, $currY + 22, 135, 10, 10, 'B', 'R');
         $grandTotal = $result['subTotal'] - $result['disc'] / 100 * $result['subTotal'];
         $total = $total - $items[0]['discount'] / 100 * $total;
         $pdf->CreateTextBox('Rp ' . number_format($total, 2, ',', '.'), 140, $currY + 22, 30, 10, 10, 'B', 'R');
     } else {
         $pdf->CreateTextBox('Grand Total ', 5, $currY + 12, 135, 10, 10, 'B', 'R');
         $pdf->CreateTextBox('Rp ' . number_format($total, 2, ',', '.'), 140, $currY + 12, 30, 10, 10, 'B', 'R');
     }
     // some payment instructions or information
     $pdf->setXY(20, $currY + 50);
     $pdf->SetFont(PDF_FONT_NAME_MAIN, '', 10);
     $ft = '
         <b>Pembayaran lewat transfer bank</b><br/>
         1. Bank BNI 46, Cabang Dukuh Bawah, No. 0073957339, a/n PT Justika Siar Publika<br/>
         2. Bank BCA, Cabang Pembantu Menara Imperium, No. 221-3028-707, a/n PT Justika Siar Publika<br><br><br>
         Jika anda sudah melakukan pembayaran, mohon konfirmasikan pembayaran anda lewat situs kami di ' . ROOT_URL . '/payment/confirm atau email ke layanan@hukumonline.com<br>
         atau fax ke (021) 8370-1826<br><br>
         Terima kasih atas kepercayaan anda atas hukumonline.com.<br><br>
         Salam,<br>
         hukumonline.com
         ';
     $pdf->MultiCell(175, 10, $ft, 0, 'L', 0, 1, '', '', true, null, true);
     //Close and output PDF document
     $pdf->Output('Hukumonline_EStore_Report.pdf', 'I');
 }
Esempio n. 2
0
 function processAction()
 {
     $formater = new Pandamp_Core_Hol_User();
     $orderId = $this->_request->getParam('orderId');
     $packageId = $this->_request->getParam('packageId');
     $paymentSubscription = $this->_request->getParam('paymentSubscription');
     $this->_orderIdNumber = $orderId;
     if (empty($orderId)) {
         echo "kosong";
         die;
     }
     include_once ROOT_DIR . '/app/models/Store.php';
     $modelAppStore = new App_Model_Store();
     if ($modelAppStore->isOrderPaid($orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'hol-site', array('view' => 'orderalreadypaid'));
         die;
     }
     //$tblOrder = new App_Model_Db_Table_Order();
     $items = App_Model_Show_Order::show()->getOrderDetail($orderId);
     $tmpMethod = $this->_request->getParam('method');
     if (!empty($tmpMethod)) {
         $items[0]['paymentMethod'] = $tmpMethod;
     }
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->find($items[0]['userId'])->current();
     $total = $formater->checkPromoValidation('Total', $packageId, $rowUser->promotionId, $paymentSubscription);
     switch ($items[0]['paymentMethod']) {
         case 'nsiapay':
             require_once 'PaymentGateway/Nsiapay.php';
             // include the class file
             $paymentObject = new Nsiapay();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->enableTestMode();
             }
             $paymentObject->addField('TYPE', "IMMEDIATE");
             $subTotal = 0;
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $basket[] = $items[$iCart]['documentName'] . "," . $items[$iCart]['price'] . ".00" . "," . $items[$iCart]['qty'] . "," . $items[$iCart]['finalPrice'] . ".00";
                 $subTotal += $items[$iCart]['price'] * $items[$iCart]['qty'];
             }
             $ca = implode(";", $basket);
             $merchantId = "000100090000028";
             $paymentObject->addField("BASKET", $ca);
             $paymentObject->addField("MERCHANTID", $merchantId);
             $paymentObject->addField("CHAINNUM", "NA");
             $paymentObject->addField("TRANSIDMERCHANT", $items[0]['invoiceNumber']);
             $paymentObject->addField("AMOUNT", $subTotal);
             $paymentObject->addField("CURRENCY", "360");
             $paymentObject->addField("PurchaseCurrency", "360");
             $paymentObject->addField("acquirerBIN", "360");
             $paymentObject->addField("password", "123456");
             $paymentObject->addField("URL", "http://hukumonline.pl");
             $paymentObject->addField("MALLID", "199");
             $paymentObject->addField("SESSIONID", Zend_Session::getId());
             $sha1 = sha1($subTotal . ".00" . $merchantId . "08iIWbWvO16w" . $items[0]['invoiceNumber']);
             //                echo $subTotal.".00".$merchantId."08iIWbWvO16w".$items[0]['invoiceNumber']."<br>";
             //                echo $sha1;die;
             $paymentObject->addField("WORDS", $sha1);
             //$paymentObject->dumpFields();
             $this->_helper->layout->disableLayout();
             $paymentObject->submitPayment();
             break;
         case 'manual':
         case 'bank':
             /*
              1. update order status
              2. redirect to instruction page 
             */
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             $this->updateInvoiceMethod($orderId, 'bank', 1, 0, 'paid with manual method');
             // HAP: i think we should send this notification when user were on page "Complete Order" and after confirmation made by user is approved;
             //$this->Mailer($orderId, 'admin-order', 'admin');
             //$this->Mailer($orderId, 'user-order', 'user');
             $this->_helper->redirector('instruction', 'payment', 'membership', array('orderId' => $orderId));
             break;
     }
 }
Esempio n. 3
0
 public function documentAction()
 {
     $this->_checkAuth();
     $userId = $this->_userFinanceInfo->userId;
     $rowset = App_Model_Show_Order::show()->getDocumentSummary($userId);
     $rowsetTotal = App_Model_Show_Order::show()->countDocument($userId);
     $this->view->numCount = $rowsetTotal;
     $this->view->rowset = $rowset;
 }
Esempio n. 4
0
 public function nsiapaypaymentAction()
 {
     $r = $this->getRequest();
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 10;
     $this->view->limit = $limit;
     $itemsPerPage = $limit;
     $this->view->itemsPerPage = $itemsPerPage;
     $offset = $r->getParam('offset') ? $r->getParam('offset') : 0;
     $this->view->offset = $offset;
     $Query = $r->getParam('Query') ? $r->getParam('Query') : '';
     $where = "KO.orderStatus = 3 AND KO.paymentMethod ='nsiapay'";
     $status = App_Model_Show_OrderStatus::show()->getStatus();
     for ($i = 0; $i < count($status); $i++) {
         $statusId[$i] = $status[$i]['orderStatusId'];
         $orderStatus[$i] = $status[$i]['ordersStatus'];
     }
     $rowset = App_Model_Show_Order::show()->getOrderSummaryAdmin($where, $limit, $offset);
     $numi = App_Model_Show_Order::show()->countOrdersAdmin('(' . $where . ')');
     $this->view->statusId = $statusId;
     $this->view->orderStatus = $orderStatus;
     $this->view->totalItems = $numi;
     $this->view->rows = $rowset;
     $this->view->where = $where;
 }
Esempio n. 5
0
 function viewinvoiceAction()
 {
     $this->_checkAuth();
     $orderId = $this->_request->getParam('orderId');
     $items = App_Model_Show_Order::show()->getOrderDetail($orderId);
     $this->view->orderId = $orderId;
     $this->view->invoiceNumber = $items[0]['invoiceNumber'];
     $this->view->datePurchased = Pandamp_Lib_Formater::get_date($items[0]['datePurchased']);
     $tblPaymentSetting = new App_Model_Db_Table_PaymentSetting();
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     if ($this->_user->kopel != $items[0]['userId']) {
         $this->_redirect(ROOT_URL . '/shop/payment/cartempty');
     }
     $result = array();
     $result['subTotal'] = 0;
     for ($iCart = 0; $iCart < count($items); $iCart++) {
         $itemId = $items[$iCart]['itemId'];
         $qty = 1;
         $itemPrice = $items[$iCart]['price'];
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = $items[$iCart]['documentName'];
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $result['grandTotal'] = $result['subTotal'] + $result['taxAmount'];
     $this->view->cart = $result;
     $data = array();
     $data['taxNumber'] = $items[0]['taxNumber'];
     $data['taxCompany'] = $items[0]['taxCompany'];
     $data['taxAddress'] = $items[0]['taxAddress'];
     $data['taxCity'] = $items[0]['taxCity'];
     $data['taxZip'] = $items[0]['taxZip'];
     $data['taxProvince'] = $items[0]['taxProvince'];
     $data['taxCountry'] = $items[0]['taxCountryId'];
     $data['paymentMethod'] = $items[0]['paymentMethod'];
     $data['currencyValue'] = $items[0]['currencyValue'];
     $this->view->data = $data;
     $this->view->identity = "Lihat Faktur-" . $orderId;
 }