public function fetchEmailsInFolderAction()
 {
     $tblQueue = new Pandamp_Modules_Misc_Email_Model_Queue();
     $rowset = $tblQueue->fetchAll();
     $a = array();
     $a['totalCount'] = count($rowset);
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['email'][$i]['qid'] = $row->newsletterQID;
             $a['email'][$i]['sender'] = $row->sender;
             $a['email'][$i]['recepientMail'] = $row->recepientMail;
             $a['email'][$i]['recepientName'] = $row->recepientName;
             $a['email'][$i]['subject'] = $row->subject;
             $a['email'][$i]['SendDate'] = Pandamp_Lib_Formater::get_date($row->SendDate);
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['email'][0]['qid'] = '';
         $a['email'][0]['sender'] = '';
         $a['email'][0]['recepientMail'] = '';
         $a['email'][0]['recepientName'] = '';
         $a['email'][0]['subject'] = '';
         $a['email'][0]['SendDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
 public function fetchCommentAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment();
     $decorator = new Pandamp_BeanContext_Decorator($modelComment);
     $rowset = $decorator->fetchCommentAsEntity($start, $end);
     $num_rows = $modelComment->getNumOfComment();
     $gShort = new Pandamp_Controller_Action_Helper_GetCatalogShortTitle();
     $a = array();
     $a['totalCount'] = $num_rows;
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['comment'][$ii]['guid'] = $row->getId();
             $a['comment'][$ii]['title'] = $row->getTitle();
             $a['comment'][$ii]['description'] = $row->getComment();
             $a['comment'][$ii]['user_email'] = $row->getEmail();
             $a['comment'][$ii]['guid_article'] = $row->getobjectId();
             $a['comment'][$ii]['shortarticle'] = $gShort->getCatalogShortTitle($row->getobjectId());
             $a['comment'][$ii]['createdby'] = $row->getName();
             $a['comment'][$ii]['ip'] = $row->getIp() != 0 ? $row->getIp() : '-';
             $a['comment'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->getDate());
             $a['comment'][$ii]['status'] = $row->getPublished();
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['comment'][0]['guid'] = 'XXX';
         $a['comment'][0]['title'] = "No Data";
         $a['comment'][0]['description'] = "-";
         $a['comment'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
 function fetchBannerAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $tblPBanner = new Pandamp_Modules_Misc_Banner_Model_Powerban();
     $rowset = $tblPBanner->fetchAll(null, 'createdDate DESC', $end, $start);
     $a = array();
     $a['totalCount'] = $tblPBanner->countPowerban();
     $now = date('Y-m-d H:i:s');
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['banner'][$ii]['guid'] = $row->guid;
             $a['banner'][$ii]['title'] = $row->name;
             $a['banner'][$ii]['source'] = $row->src;
             $a['banner'][$ii]['type'] = $row->type;
             $a['banner'][$ii]['alt'] = $row->alt;
             $a['banner'][$ii]['url'] = $row->url;
             $a['banner'][$ii]['createdby'] = $row->createdBy;
             $a['banner'][$ii]['modifiedby'] = $row->modifiedBy;
             $a['banner'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
             if ($now <= $row->publishedDate && $row->status == 99) {
                 $status = "publish_y";
             } else {
                 if (($now <= $row->expiredDate || $row->expiredDate == '0000-00-00 00:00:00') && $row->status == 99) {
                     $status = "publish_g";
                 } else {
                     if ($now > $row->expiredDate && $row->status == 99) {
                         $status = "publish_r";
                     } else {
                         if ($row->status == 0) {
                             $status = "publish_x";
                         } else {
                             if ($row->status == -1) {
                                 $status = "disabled";
                             }
                         }
                     }
                 }
             }
             $a['banner'][$ii]['status'] = $status;
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['banner'][0]['guid'] = 'XXX';
         $a['banner'][0]['title'] = "No Data";
         $a['banner'][0]['source'] = "-";
         $a['banner'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
 function klideAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
     $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
     $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid);
     if ($rowset) {
         $modelAsset = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
         $decorator = new Pandamp_BeanContext_Decorator($modelAsset);
         $rowAsset = $decorator->getAssetNumOfClickAsEntity($catalogGuid);
         $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_CLINIC', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'klinik');
         $asset = $modelAsset->addCounterAsset($rowset->getId(), $data);
         $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedCommentTitle');
         $question = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedCommentQuestion');
         $category = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedKategoriKlinik');
         $answer = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedAnswer');
         $author = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSelectNama');
         $source = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSelectMitra');
         $this->view->title = isset($title) ? $title : '';
         $this->view->question = isset($question) ? $question : '';
         $this->view->category = isset($category) ? $category : '';
         $this->view->answer = isset($answer) ? $answer : '';
         $this->view->author = isset($author) ? $author : '';
         $this->view->source = isset($source) ? $source : '';
         $this->view->createdBy = $rowset->getCreatedBy();
         $this->view->publishedDate = Pandamp_Lib_Formater::get_date($rowset->getPublishedDate());
         $this->view->numofclick = isset($rowAsset) ? $rowAsset->getValueInt() : 0;
         // get votes
         $modelVote = new Pandamp_Modules_Extension_Vote_Model_Vote();
         $decorator = new Pandamp_BeanContext_Decorator($modelVote);
         $rowRate = $decorator->getRatingAsEntity($catalogGuid, $ip);
         $val = $rowRate ? $rowRate->getValue() : 0;
         $counter = $rowRate ? $rowRate->getCounter() : 0;
         if ($counter < 1) {
             $count = 0;
         } else {
             $count = $counter;
             //how many votes total
         }
         $current_rating = $val;
         $tense = $count == 1 ? "vote" : "votes";
         //plural form votes/vote
         $rating = @number_format($current_rating / $count, 1);
         $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
         $this->view->drawrating = $drawrating;
         $this->view->catalogGuid = $catalogGuid;
     }
 }
Exemple #5
0
 function sendInvoiceToUser($orderId)
 {
     $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail');
     $siteOwner = "Hukumonline";
     $siteName = $config->mail->sender->support->name;
     $contactEmail = $config->mail->sender->support->email;
     $tblOrder = new App_Model_Db_Table_Order();
     $rowOrder = $tblOrder->find($orderId)->current();
     $userId = $rowOrder->userId;
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->find($userId)->current();
     $userEmail = $rowUser->email;
     $userFullname = $rowUser->fullName;
     $datePurchased = Pandamp_Lib_Formater::get_date($rowOrder->datePurchased);
     if ($rowOrder->paymentMethodNote == "membership") {
         $duedate = date("d/m/y", strtotime($rowOrder->invoiceExpirationDate));
     } else {
         $duedate = "-";
     }
     $message = "Kepada Yth, \r\n{$userFullname}\r\n\r\nBerikut kami beritahukan bahwa Invoice untuk anda sudah dibuat pada tanggal {$datePurchased}.\r\n\r\nDengan metode pembayaran: {$rowOrder->paymentMethod}\r\n\r\nInvoice # {$rowOrder->invoiceNumber}\r\nJumlah tagihan: Rp. {$rowOrder->orderTotal}\r\nJatuh tempo: {$duedate}\r\n\r\nAnda bisa login di Ruang Konsumen untuk melihat status invoice ini atau melakukan pembayaran secara online di " . ROOT_URL . "/store/viewinvoice/orderId/{$orderId}.\r\n\r\nTerima kasih,\r\n\r\nHukumonline\r\n\r\n==============================";
     $this->send($config->mail->sender->support->email, $config->mail->sender->support->name, $userEmail, '', "Hukumonline Invoice: " . $rowOrder->invoiceNumber, $message);
 }
Exemple #6
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');
 }
Exemple #7
0
 public function reIndexCatalog()
 {
     gc_enable();
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $formater = new Pandamp_Lib_Formater();
     $title = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     //		$tbl = new Pandamp_Core_Orm_Table_Catalog();
     //		$rowset = $tbl->fetchAll(); //("profileGuid='Pandamp_peraturan'");
     $query = "SELECT * FROM KutuCatalog";
     $results = $this->_conn->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         //			if($iCount == 100)
         //				break;
         //			echo 'urutan: '.$iCount .'<br>';
         $nextRow = $rowset[$iCount + 1];
         //			echo 'current guid: '.$row->guid.'  '.'next guid: '.$nextRow->guid.'<br>';
         if ($row->modifiedBy !== $row->createdBy) {
             $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font>&nbsp;';
         } else {
             $modified = '';
         }
         echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . ']&nbsp;indexing:<font color=green>' . $title->getCatalogTitle($row->guid) . '</font>[current guid: ' . $row->guid . '  ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>]&nbsp;' . $modified . '[createdDate:<i>' . $formater->get_date($row->createdDate) . '</i>]</span></li>';
         $documents[] = $this->_createSolrDocument($row);
         if ($iCount % 500 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //					$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 //					echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid;
                 $log->err($e->getMessage());
                 throw new Zend_Exception($e->getMessage());
                 //					echo $e->getMessage().'<br>';
             }
         }
         flush();
     }
     echo '</ul></div></td></tr></table>';
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         //			$solr->optimize();
     } catch (Exception $e) {
         $log->err($e->getMessage());
         throw new Zend_Exception($e->getMessage());
         //			echo $e->getMessage().'<br>';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     //		echo'<br>WAKTU EKSEKUSI: '. $time;
     //		$log->info("WAKTU EKSEKUSI: ". $time." indexing catalog ".$iCount." dari ".$rowCount ." ".$username);
     echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>';
     // log to assetSetting
     $tblAssetSetting = new App_Model_Db_Table_AssetSetting();
     $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
     if ($rowAsset) {
         $rowAsset->valueText = "Update {$rowCount} indexing-catalog at " . date("Y-m-d H:i:s") . $username;
         $rowAsset->valueInt = $rowAsset->valueInt + 1;
     } else {
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = $gman->generateGuid();
         $rowAsset = $tblAssetSetting->fetchNew();
         $rowAsset->guid = $catalogGuid;
         $rowAsset->application = "INDEX CATALOG";
         $rowAsset->part = "KUTU";
         $rowAsset->valueType = "INDEX";
         $rowAsset->valueInt = 0;
         $rowAsset->valueText = $rowCount . " Indexing catalog at " . date("Y-m-d H:i:s") . $username;
     }
     $rowAsset->save();
 }
 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;
 }
 function userAction()
 {
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $req = $this->getRequest();
     $sortDir = $req->getParam('dir') ? $req->getParam('dir') : 'DESC';
     $sortBy = $req->getParam('sort') ? $req->getParam('sort') : 'username';
     $start = $req->getParam('start') ? $req->getParam('start') : 0;
     $end = $req->getParam('limit') ? $req->getParam('limit') : 10;
     $fields = $req->getParam('fields') ? $req->getParam('fields') : '';
     $query = $req->getParam('query') ? $req->getParam('query') : '';
     $startdt = $req->getParam('startdt') ? $req->getParam('startdt') : '';
     $enddt = $req->getParam('enddt') ? $req->getParam('enddt') : '';
     $group = $req->getParam('group') ? $req->getParam('group') : '';
     $selectedRows = Zend_Json::decode($fields);
     $rowval = $query;
     $a = array();
     $i = 0;
     switch ($group) {
         case 'member_gratis':
             $rowset = $tblUser->fetchUserGroupFree("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows, 'member_gratis', $startdt, $enddt);
             $a['totalCount'] = $tblUser->countUserGroup('member_gratis', $startdt, $enddt);
             if ($a['totalCount'] != 0) {
                 foreach ($rowset as $row) {
                     //$a['user'][$i]['guid'] 				= $row->guid;
                     $a['user'][$i]['kopel'] = $row->kopel;
                     $a['user'][$i]['fullName'] = $row->fullName;
                     $a['user'][$i]['username'] = $row->username;
                     $a['user'][$i]['email'] = !empty($row->email) ? $row->email : '-';
                     $a['user'][$i]['company'] = !empty($row->company) ? $row->company : '-';
                     $a['user'][$i]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
                     $a['user'][$i]['value'] = $row->packageId;
                     $a['user'][$i]['packageId'] = $row->value;
                     $a['user'][$i]['periodeId'] = $row->status ? $row->status : "unknown";
                     $a['user'][$i]['isEmailSent'] = $row->isEmailSent;
                     $a['user'][$i]['isEmailSentOver'] = $row->isEmailSentOver;
                     $a['user'][$i]['isActive'] = $row->isActive;
                     $a['user'][$i]['isContact'] = $row->isContact;
                     $i++;
                 }
             }
             if ($a['totalCount'] == 0) {
                 $a['user'][0]['guid'] = 'No Data';
             }
             break;
         case 'member_corporate':
             if ($startdt && $enddt) {
                 $rowset = $tblUser->fetchUser("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows, 'member_corporate', $startdt, $enddt);
                 $a['totalCount'] = $tblUser->countUserGroup('member_corporate', $startdt, $enddt);
             } else {
                 $rowset = $tblUser->fetchUser("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows, 'member_corporate', $startdt, $enddt);
                 $a['totalCount'] = $tblUser->countUserGroup('member_corporate', $startdt, $enddt);
             }
             if ($a['totalCount'] != 0) {
                 foreach ($rowset as $row) {
                     // sent email confirm -7 days
                     // $formater->_writeConfirmAkunHabis($row->guid, 'panel');
                     // check if days > 0
                     /*
                     if ($row->DaysLeft > 0)
                     {
                     	$formater->downgrade($row->guid);
                     }
                     */
                     //$a['user'][$i]['guid'] 				= $row->guid;
                     $a['user'][$i]['kopel'] = $row->kopel;
                     $a['user'][$i]['fullName'] = $row->fullName;
                     $a['user'][$i]['username'] = $row->username;
                     $a['user'][$i]['email'] = !empty($row->email) ? $row->email : '-';
                     $a['user'][$i]['company'] = !empty($row->company) ? $row->company : '-';
                     $a['user'][$i]['createdDate'] = Pandamp_Lib_Formater::get_date_english($row->createdDate);
                     $a['user'][$i]['expirationDate'] = $row->expirationDate ? Pandamp_Lib_Formater::get_date_english($row->expirationDate) : '-';
                     $a['user'][$i]['paymentId'] = $row->paymentId;
                     $a['user'][$i]['DaysLeft'] = $row->isPaid == "Y" ? "-" : $row->DaysLeft;
                     $a['user'][$i]['value'] = $row->packageId;
                     $a['user'][$i]['packageId'] = $row->value;
                     $a['user'][$i]['periodeId'] = $row->status ? $row->status : "unknown";
                     $a['user'][$i]['isEmailSent'] = $row->isEmailSent;
                     $a['user'][$i]['isEmailSentOver'] = $row->isEmailSentOver;
                     $a['user'][$i]['isActive'] = $row->isActive;
                     $a['user'][$i]['isContact'] = $row->isContact;
                     $i++;
                 }
             }
             if ($a['totalCount'] == 0) {
                 $a['user'][0]['guid'] = 'No Data';
             }
             break;
         case 'member_individual':
             $rowset = $tblUser->fetchUser("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows, 'member_individual', $startdt, $enddt);
             $a['totalCount'] = $tblUser->countUserGroup('member_individual', $startdt, $enddt);
             if ($a['totalCount'] != 0) {
                 foreach ($rowset as $row) {
                     // sent email confirm -7 days
                     // $formater->_writeConfirmAkunHabis($row->guid, 'panel');
                     // check if days > 0
                     /*
                     if ($row->DaysLeft > 0)
                     {
                     	$formater->downgrade($row->guid);
                     }
                     */
                     //$a['user'][$i]['guid'] 				= $row->guid;
                     $a['user'][$i]['kopel'] = $row->kopel;
                     $a['user'][$i]['fullName'] = $row->fullName;
                     $a['user'][$i]['username'] = $row->username;
                     $a['user'][$i]['email'] = !empty($row->email) ? $row->email : '-';
                     $a['user'][$i]['company'] = !empty($row->company) ? $row->company : '-';
                     $a['user'][$i]['createdDate'] = Pandamp_Lib_Formater::get_date_english($row->createdDate);
                     $a['user'][$i]['expirationDate'] = $row->expirationDate ? Pandamp_Lib_Formater::get_date_english($row->expirationDate) : '-';
                     $a['user'][$i]['paymentId'] = $row->paymentId;
                     $a['user'][$i]['DaysLeft'] = $row->isPaid == "Y" ? "-" : $row->DaysLeft;
                     $a['user'][$i]['value'] = $row->packageId;
                     $a['user'][$i]['packageId'] = $row->value;
                     $a['user'][$i]['periodeId'] = $row->status ? $row->status : "unknown";
                     $a['user'][$i]['isEmailSent'] = $row->isEmailSent;
                     $a['user'][$i]['isEmailSentOver'] = $row->isEmailSentOver;
                     $a['user'][$i]['isActive'] = $row->isActive;
                     $a['user'][$i]['isContact'] = $row->isContact;
                     $i++;
                 }
             }
             if ($a['totalCount'] == 0) {
                 $a['user'][0]['guid'] = 'No Data';
                 $a['user'][0]['DaysLeft'] = '-';
                 $a['user'][0]['isEmailSent'] = '';
                 $a['user'][0]['isEmailSentOver'] = '';
                 $a['user'][0]['isActive'] = '';
                 $a['user'][0]['isContact'] = 'N';
             }
             break;
         case 'member_bonus':
             if ($startdt && $enddt) {
                 $rowset = $tblUser->fetchUser("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows, 'member_bonus', $startdt, $enddt);
                 $a['totalCount'] = $tblUser->countUserGroup('member_bonus', $startdt, $enddt);
             } else {
                 $rowset = $tblUser->fetchUser("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows, 'member_bonus', $startdt, $enddt);
                 $a['totalCount'] = $tblUser->countUserGroup('member_bonus', $startdt, $enddt);
             }
             if ($a['totalCount'] != 0) {
                 foreach ($rowset as $row) {
                     // sent email confirm -7 days
                     // $formater->_writeConfirmAkunHabis($row->guid, 'panel');
                     // check if days > 0
                     /*
                     if ($row->DaysLeft > 0)
                     {
                     	$formater->downgrade($row->guid);
                     }
                     */
                     //$a['user'][$i]['guid'] 				= $row->guid;
                     $a['user'][$i]['kopel'] = $row->kopel;
                     $a['user'][$i]['fullName'] = $row->fullName;
                     $a['user'][$i]['username'] = $row->username;
                     $a['user'][$i]['email'] = !empty($row->email) ? $row->email : '-';
                     $a['user'][$i]['company'] = !empty($row->company) ? $row->company : '-';
                     $a['user'][$i]['createdDate'] = Pandamp_Lib_Formater::get_date_english($row->createdDate);
                     $a['user'][$i]['expirationDate'] = $row->expirationDate ? Pandamp_Lib_Formater::get_date_english($row->expirationDate) : '-';
                     $a['user'][$i]['paymentId'] = $row->paymentId;
                     $a['user'][$i]['DaysLeft'] = $row->isPaid == "Y" ? "-" : $row->DaysLeft;
                     $a['user'][$i]['value'] = $row->packageId;
                     $a['user'][$i]['packageId'] = $row->value;
                     $a['user'][$i]['periodeId'] = $row->status ? $row->status : "unknown";
                     $a['user'][$i]['isEmailSent'] = $row->isEmailSent;
                     $a['user'][$i]['isEmailSentOver'] = $row->isEmailSentOver;
                     $a['user'][$i]['isActive'] = $row->isActive;
                     $a['user'][$i]['isContact'] = $row->isContact;
                     $i++;
                 }
             }
             if ($a['totalCount'] == 0) {
                 $a['user'][0]['guid'] = 'No Data';
             }
             break;
         case 'others':
             $rowset = $tblUser->fetchUserGroupOther("{$sortBy} {$sortDir}", $start, $end, $rowval, $selectedRows);
             $a['totalCount'] = $tblUser->countUserGroupOther();
             if ($a['totalCount'] != 0) {
                 foreach ($rowset as $row) {
                     //$a['user'][$i]['guid'] 				= $row->guid;
                     $a['user'][$i]['kopel'] = $row->kopel;
                     $a['user'][$i]['fullName'] = $row->fullName;
                     $a['user'][$i]['email'] = !empty($row->email) ? $row->email : '-';
                     $a['user'][$i]['username'] = $row->username;
                     $a['user'][$i]['company'] = !empty($row->company) ? $row->company : '-';
                     $a['user'][$i]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
                     $a['user'][$i]['value'] = $row->packageId;
                     $a['user'][$i]['packageId'] = $row->value;
                     $a['user'][$i]['periodeId'] = $row->status ? $row->status : "unknown";
                     $a['user'][$i]['isEmailSent'] = $row->isEmailSent;
                     $a['user'][$i]['isEmailSentOver'] = $row->isEmailSentOver;
                     $a['user'][$i]['isActive'] = $row->isActive;
                     $a['user'][$i]['isContact'] = $row->isContact;
                     $i++;
                 }
             }
             if ($a['totalCount'] == 0) {
                 $a['user'][0]['guid'] = 'No Data';
             }
             break;
     }
     echo Zend_Json::encode($a);
 }
 public function fetchClinicAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $status = $this->_getParam('status') ? $this->_getParam('status') : 0;
     //$folderGuid	= 'lt4a0a533e31979'; // Klinik
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->fetchFromFolderAdminClinic($status, $start, $end);
     $a = array();
     $a['totalCount'] = $tblCatalog->countCatalogsInFolderClinic($status);
     $now = date('Y-m-d H:i:s');
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
             $a['clinic'][$ii]['guid'] = $row->guid;
             $a['clinic'][$ii]['title'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedCommentTitle');
             $a['clinic'][$ii]['question'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedCommentQuestion');
             $a['clinic'][$ii]['content'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedContent');
             $findPartner = $tblCatalog->getCatalogByGuid($modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedSelect'));
             if ($findPartner) {
                 $a['clinic'][$ii]['partner'] = $modelCatalogAttribute->getCatalogAttributeValue($findPartner->guid, 'fixedTitle');
             }
             $a['clinic'][$ii]['createdby'] = $row->createdBy;
             $a['clinic'][$ii]['modifiedby'] = $row->modifiedBy;
             $a['clinic'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
             if ($now <= $row->publishedDate && $row->status == 99) {
                 $status = "publish_y";
             } else {
                 if (($now <= $row->expiredDate || $row->expiredDate == '0000-00-00 00:00:00') && $row->status == 99) {
                     $status = "publish_g";
                 } else {
                     if ($now > $row->expiredDate && $row->status == 99) {
                         $status = "publish_r";
                     } else {
                         if ($row->status == 0) {
                             $status = "publish_x";
                         } else {
                             if ($row->status == 1) {
                                 $status = "ruby";
                             } else {
                                 if ($row->status == 2) {
                                     $status = "pill";
                                 } else {
                                     if ($row->status == -1) {
                                         $status = "disabled";
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $a['clinic'][$ii]['status'] = $status;
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['clinic'][0]['guid'] = 'XXX';
         $a['clinic'][0]['title'] = "No Data";
         $a['clinic'][0]['question'] = "-";
         $a['clinic'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
 public function reportCatalogAction()
 {
     $startdt = $this->_getParam('startdt') ? $this->_getParam('startdt') : '';
     $enddt = $this->_getParam('enddt') ? $this->_getParam('enddt') : '';
     $queryAttr = Zend_Db_Table::getDefaultAdapter()->query("SELECT kcf.folderGuid\r\n\t\t\t\t\tFROM KutuCatalog kc INNER JOIN KutuCatalogAttribute kca ON kc.guid = kca.catalogGuid\r\n\t\t\t\t\tINNER JOIN KutuCatalogFolder kcf ON kc.guid = kcf.catalogGuid\r\n\t\t\t\t\tWHERE kc.createdDate BETWEEN '{$startdt}' AND '{$enddt}'");
     $rowset = $queryAttr->fetchAll(Zend_Db::FETCH_OBJ);
     $a = array();
     $a['totalCount'] = count($rowset);
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
             $rowCatalogSubTitle = $rowsetCatalogAttribute->findByAttributeGuid('fixedSubTitle');
             //				$rowCatalogisHeadline = $rowsetCatalogAttribute->findByAttributeGuid('fixedMainNews');
             $a['catalogs'][$ii]['guid'] = $row->guid;
             $a['catalogs'][$ii]['title'] = is_object($rowCatalogAttribute) ? $rowCatalogAttribute->value : '-';
             $a['catalogs'][$ii]['subtitle'] = is_object($rowCatalogSubTitle) ? $rowCatalogSubTitle->value : '';
             //				$a['catalogs'][$ii]['headline']= ((is_object($rowCatalogisHeadline))? $rowCatalogisHeadline->value : "");
             $modelProfile = new Pandamp_Modules_Dms_Profile_Model_Profile();
             $p = $modelProfile->getProfileByPG($row->profileGuid);
             $a['catalogs'][$ii]['profile_column'] = $p->title;
             $a['catalogs'][$ii]['createdby'] = $row->createdBy;
             $a['catalogs'][$ii]['modifiedby'] = $row->modifiedBy;
             $a['catalogs'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
             $a['catalogs'][$ii]['status'] = $row->status == 0 ? "" : "Y";
             $ii++;
         }
     }
     echo Zend_Json::encode($a);
 }