当前位置: 首页>>代码示例>>PHP>>正文


PHP Messages::getbyOrderId方法代码示例

本文整理汇总了PHP中Messages::getbyOrderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::getbyOrderId方法的具体用法?PHP Messages::getbyOrderId怎么用?PHP Messages::getbyOrderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Messages的用法示例。


在下文中一共展示了Messages::getbyOrderId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editAction

 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/orders/process');
     $id = $this->getRequest()->getParam('id');
     $NS = new Zend_Session_Namespace('Default');
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     try {
         if (!empty($id) && is_numeric($id)) {
             $fields = "o.order_id, \n\t\t\t\t\t\t\to.order_number as order_number,\n\t\t\t\t\t\t\tDATE_FORMAT(o.order_date, '%d/%m/%Y') as Starting, \n\t\t\t\t\t\t\tDATE_FORMAT(o.expiring_date, '%d/%m/%Y') as Valid_Up, \n\t\t\t\t\t\t\tin.invoice_id as invoice_id, \n\t\t\t\t\t\t\tin.formatted_number as invoice_number, \n\t\t\t\t\t\t\tCONCAT(d.domain, '.', w.tld) as Domain, \n\t\t\t\t\t\t\tc.company as company, \n\t\t\t\t\t\t\to.status_id, \n\t\t\t\t\t\t\ts.status as Status, \n\t\t\t\t\t\t\to.vat as VAT, \n\t\t\t\t\t\t\to.total as Total, \n\t\t\t\t\t\t\to.grandtotal as Grandtotal";
             $rs = Orders::getAllInfo($id, $fields, true, $NS->customer['customer_id']);
             if (!empty($rs)) {
                 // Check the status of the order.
                 // If the order has to be paid we have update it to the last prices and taxes
                 if ($rs[0]['status_id'] == Statuses::id('tobepaid', 'orders')) {
                     // Update the total order
                     Orders::updateTotalsOrder($id);
                     // Reload the data
                     $rs = Orders::getAllInfo($id, $fields, true, $NS->customer['customer_id']);
                     $rs[0]['Total'] = $currency->toCurrency($rs[0]['Total'], array('currency' => Settings::findbyParam('currency')));
                     $rs[0]['VAT'] = $currency->toCurrency($rs[0]['VAT'], array('currency' => Settings::findbyParam('currency')));
                     $rs[0]['Grandtotal'] = $currency->toCurrency($rs[0]['Grandtotal'], array('currency' => Settings::findbyParam('currency')));
                     $this->view->tobepaid = true;
                     // To be Paid status
                 }
                 $records = OrdersItems::getAllDetails($id, "oi.detail_id, \n                                        \t\t\t\t\t        oi.description as description, \n                                        \t\t\t\t\t        DATE_FORMAT(oi.date_end, '%d/%m/%Y') as expiration_date, \n                                        \t\t\t\t\t        oi.quantity as quantity, \n                                        \t\t\t\t\t        oi.price as price, \n                                        \t\t\t\t\t        CONCAT(oi.discount, '%') as discount, \n                                        \t\t\t\t\t        oi.subtotal as subtotal, \n                                        \t\t\t\t\t        bc.name as billingcycle, \n                                        \t\t\t\t\t        oi.setupfee as setupfee", true);
                 for ($i = 0; $i < count($records); $i++) {
                     $records[$i]['price'] = $currency->toCurrency($records[$i]['price'], array('currency' => Settings::findbyParam('currency')));
                     $records[$i]['subtotal'] = $currency->toCurrency($records[$i]['subtotal'], array('currency' => Settings::findbyParam('currency')));
                     $records[$i]['setupfee'] = $currency->toCurrency($records[$i]['setupfee'], array('currency' => Settings::findbyParam('currency')));
                 }
                 $columns = array();
                 $columns[] = $this->translator->translate('Description');
                 $columns[] = $this->translator->translate('Expiry Date');
                 $columns[] = $this->translator->translate('Qty');
                 $columns[] = $this->translator->translate('Price');
                 $columns[] = $this->translator->translate('Discount');
                 $columns[] = $this->translator->translate('Subtotal');
                 $columns[] = $this->translator->translate('Billing Cycle');
                 $columns[] = $this->translator->translate('Setup Fee');
                 $this->view->customer_id = $NS->customer['customer_id'];
                 $this->view->invoiced = $rs[0]['status_id'] == Statuses::id("complete", "orders") && $rs[0]['invoice_number'] > 0 ? true : false;
                 $this->view->invoice_id = $rs[0]['invoice_id'];
                 $this->view->order = array('records' => $rs);
                 $this->view->details = array('records' => $records, 'columns' => $columns);
                 // Get Order status history
                 $this->view->statushistory = StatusHistory::getStatusList($id);
                 // Show the list of the messages attached to this domain
                 $this->view->messages = Messages::getbyOrderId($id);
                 $this->view->headTitle()->prepend($this->translator->_('Order %s', $rs[0]['order_number']));
                 $rsfiles = Files::findbyExternalId($id, "orders", "file, Date_Format(date, '%d/%m/%Y') as date, fc.name as categoryname, publickey, download");
                 if (isset($rsfiles[0])) {
                     $this->view->files = $rsfiles;
                 }
                 // Send the data to the form
                 $form->populate($rs[0]);
                 $this->view->title = $this->translator->_('Order %s', $rs[0]['order_number']);
                 $this->view->orderid = $id;
             } else {
                 $this->_helper->redirector('index', 'orders', 'default', array('mex' => 'Order not found', 'status' => 'information'));
                 die;
             }
         }
         #$this->view->title = $this->translator->_('Order %s', $formattedID);
         $this->view->description = "Here you can see all the order information.";
         $this->view->dnsdatagrid = $this->dnsGrid();
         $this->view->form = $form;
         $this->_helper->viewRenderer('customform');
     } catch (Exception $e) {
         echo $e->getMessage();
         die;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:77,代码来源:OrdersController.php

示例2: editAction

 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/orders/process');
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $customer = null;
     $createInvoiceConfirmText = $this->translator->translate('Are you sure you want to create or overwrite the invoice for this order?');
     $id = intval($this->getRequest()->getParam('id'));
     $this->view->description = $this->translator->translate("Here you can edit the selected order.");
     if (!empty($id) && is_numeric($id)) {
         $rs = $this->orders->find($id);
         if (!empty($rs)) {
             $rs = $rs->toArray();
             $rs['setupfee'] = Orders::getSetupfee($id);
             $rs['order_date'] = Shineisp_Commons_Utilities::formatDateOut($rs['order_date']);
             $rs['expiring_date'] = Shineisp_Commons_Utilities::formatDateOut($rs['expiring_date']);
             $rs['received_income'] = 0;
             $rs['missing_income'] = $rs['grandtotal'];
             $rs['order_number'] = !empty($rs['order_number']) ? $rs['order_number'] : Orders::formatOrderId($rs['order_id']);
             $payments = Payments::findbyorderid($id, 'income', true);
             if (isset($payments)) {
                 foreach ($payments as $payment) {
                     $rs['received_income'] += isset($payment['income']) ? $payment['income'] : 0;
                     $rs['missing_income'] -= isset($payment['income']) ? $payment['income'] : 0;
                 }
             }
             $rs['profit'] = $rs['total'] - $rs['cost'];
             $rs['profit'] = $currency->toCurrency($rs['profit'], array('currency' => Settings::findbyParam('currency')));
             // set the default income to prepare the payment task
             $rs['income'] = $rs['missing_income'];
             $rs['missing_income'] = sprintf('%.2f', $rs['missing_income']);
             unset($payments);
             $parent = Customers::find($rs['customer_id']);
             //if customer comes from reseller
             if ($parent['parent_id']) {
                 $rs['customer_parent_id'] = $parent['parent_id'];
             } else {
                 $rs['customer_parent_id'] = $rs['customer_id'];
             }
             $link = Fastlinks::findlinks($id, $rs['customer_id'], 'Orders');
             if (isset($link[0])) {
                 $rs['fastlink'] = $link[0]['code'];
                 $rs['visits'] = $link[0]['visits'];
             }
             $form->populate($rs);
             $this->view->id = $id;
             $this->view->customerid = $rs['customer_id'];
             if (!empty($rs['fastlink'])) {
                 $this->view->titlelink = "/index/link/id/" . $rs['fastlink'];
             }
             if (!empty($rs['order_number'])) {
                 $this->view->title = $this->translator->_("Order nr. %s", $rs['order_number']);
             }
             $this->view->messages = Messages::getbyOrderId($id);
             $createInvoiceConfirmText = $rs['missing_income'] > 0 ? $this->translator->translate('Are you sure you want to create or overwrite the invoice for this order? The order status is: not paid.') : $createInvoiceConfirmText;
             $customer = Customers::get_by_customerid($rs['customer_id'], 'company, firstname, lastname, email');
         } else {
             $this->_helper->redirector('list', 'orders', 'admin');
         }
     }
     $this->view->mex = urldecode($this->getRequest()->getParam('mex'));
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('id' => 'submit', 'css' => array('btn btn-success'))), array("url" => "/admin/orders/print/id/{$id}", "label" => $this->translator->translate('Print'), "params" => array('css' => null)), array("url" => "/admin/orders/dropboxit/id/{$id}", "label" => $this->translator->translate('Dropbox It'), "params" => array('css' => null)), array("url" => "/admin/orders/clone/id/{$id}", "label" => $this->translator->translate('Clone'), "params" => array('css' => null)), array("url" => "/admin/orders/sendorder/id/{$id}", "label" => $this->translator->translate('Email'), "params" => array('css' => array('btn btn-danger'))), array("url" => "/admin/orders/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => array('btn btn-danger'))), array("url" => "/admin/orders/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if the order has been invoiced
     $invoice_id = Orders::isInvoiced($id);
     if ($invoice_id) {
         $this->view->buttons[] = array("url" => "/admin/orders/sendinvoice/id/{$invoice_id}", "label" => $this->translator->translate('Email invoice'), "params" => array('css' => array('btn btn-danger')));
         $this->view->buttons[] = array("url" => "/admin/invoices/print/id/{$invoice_id}", "label" => $this->translator->translate('Print invoice'), "params" => array('css' => null));
     } else {
         // Order not invoiced, show button to create a new invoice
         $this->view->buttons[] = array("url" => "/admin/orders/createinvoice/id/{$id}", "label" => $this->translator->translate('Invoice'), "params" => array('css' => array('btn btn-danger')), 'onclick' => "return confirm('" . $createInvoiceConfirmText . "')");
     }
     $this->view->customer = array('records' => $customer, 'editpage' => 'customers');
     $this->view->ordersdatagrid = $this->orderdetailGrid();
     $this->view->paymentsdatagrid = $this->paymentsGrid();
     $this->view->statushistory = StatusHistory::getStatusList($id);
     // Get Order status history
     $this->view->filesgrid = $this->filesGrid();
     $this->view->statushistorygrid = $this->statusHistoryGrid();
     $this->view->form = $form;
     $this->render('applicantform');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:87,代码来源:OrdersController.php


注:本文中的Messages::getbyOrderId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。