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


PHP Zend_Date::subMonth方法代码示例

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


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

示例1: pdfthongkeAction

    public function pdfthongkeAction()
    {
        $translate = Zend_Registry::get('Zend_Translate');
        $this->view->title = 'Thống kê - ' . $translate->_('TEXT_DEFAULT_TITLE');
        $this->view->headTitle($this->view->title);
        $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
        $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
        Zend_Layout::startMvc($option);
        $date = new Zend_Date();
        $date->subMonth(1);
        $thang = $this->_getParam('thang', $date->toString('M'));
        $nam = $this->_getParam('nam', $date->toString('Y'));
        $auth = Zend_Auth::getInstance();
        $identity = $auth->getIdentity();
        $em_id = $identity->em_id;
        $emModel = new Front_Model_Employees();
        $phongbanModel = new Front_Model_Phongban();
        $my_info = $emModel->fetchRow('em_id=' . $em_id . ' and em_status=1');
        $phong_ban_id = $list_phongban = $phong_ban = array();
        if ($my_info) {
            $phong_ban_id[] = $my_info->em_phong_ban;
            $list_phongban = $phongbanModel->fetchDataStatus($my_info->em_phong_ban, $phong_ban);
        }
        if (sizeof($list_phongban)) {
            foreach ($list_phongban as $phong_ban_info) {
                $phong_ban_id[] = $phong_ban_info->pb_parent;
            }
        }
        $phong_ban_id = implode(',', $phong_ban_id);
        $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
        $holidaysModel = new Front_Model_Holidays();
        $holidays = $holidaysModel->fetchData();
        $listHoliday = array();
        foreach ($holidays as $holiday) {
            $listHoliday[$holiday['hld_id']] = $holiday['hld_code'];
        }
        $k = 0;
        if ($list_nhan_vien) {
            $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
            $pdf->SetCreator(PDF_CREATOR);
            $pdf->SetAuthor(PDF_AUTHOR);
            $pdf->SetTitle(PDF_HEADER_TITLE);
            $pdf->SetSubject(PDF_HEADER_TITLE);
            $pdf->SetKeywords('bang luong');
            $pdf->setPrintHeader(false);
            $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
            $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
            $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
            $pdf->SetMargins(5, PDF_MARGIN_TOP, 5);
            $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
            $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
            $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
            $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
            $pdf->setFontSubsetting(true);
            $pdf->SetFont('dejavusans', '', 14, '', true);
            $pdf->AddPage('L', 'A4');
            $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
            $text_outout = '
                        <style>
                            .ten-co-quan {
                                color: #000;
                                font-size: 10pt;
                                height: 50px;
                                text-align:center;
                            }
                            .ten-bang-luong{
                                height: 30px;
                                text-align:center;
                                font-size: 10pt;
                            }

                            table.first {
                                color: #003300;
                                font-family: helvetica;
                                font-size: 8pt;
                                border-left: 3px solid red;
                                border-right: 3px solid #FF00FF;
                                border-top: 3px solid green;
                                border-bottom: 3px solid blue;
                                background-color: #ccffcc;
                            }
                            .borders {
                                border: 1px solid #000;
                                font-size: 10px;
                            }

                            .tieu-de{
                                height: 20px;
                                font-size: 11px;
                            }
                            .noi-dung{
                                font-size: 10px;
                            }
                            td.second {
                                border: 2px dashed green;
                            }

                            .lowercase {
                                text-transform: lowercase;
                            }
//.........这里部分代码省略.........
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:101,代码来源:ThongkethangController.php

示例2: indexAction

 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Thống kê tháng - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $holidaysModel = new Front_Model_Holidays();
     $list_holidays = $holidaysModel->fetchData(array(), 'hld_order ASC');
     $xinnghiphepModel = new Front_Model_XinNghiPhep();
     $list_nghi_phep = $xinnghiphepModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $chamcongModel = new Front_Model_ChamCong();
     $cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $em_id, 'c_thang' => $thang, 'c_nam' => $nam));
     $khenthuongModel = new Front_Model_KhenThuong();
     $khen_thuong = $khenthuongModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $kyluatModel = new Front_Model_KyLuat();
     $ky_luat = $kyluatModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $this->view->cham_cong = $cham_cong;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->list_holidays = $list_holidays;
     $this->view->list_nghi_phep = $list_nghi_phep;
     $this->view->khen_thuong = $khen_thuong;
     $this->view->ky_luat = $ky_luat;
 }
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:33,代码来源:ThongkethangController.php

示例3: indexAction

 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Duyệt chấm công - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $my_info = $emModel->fetchRow('em_id=' . $em_id . ' and em_status=1');
     $phong_ban_id = $list_phongban = $phong_ban = array();
     if ($my_info) {
         $phong_ban_id[] = $my_info->em_phong_ban;
         $list_phongban = $phongbanModel->fetchDataStatus($my_info->em_phong_ban, $phong_ban);
     }
     if (sizeof($list_phongban)) {
         foreach ($list_phongban as $phong_ban_info) {
             $phong_ban_id[] = $phong_ban_info->pb_parent;
         }
     }
     $phong_ban_id = implode(',', $phong_ban_id);
     $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
     $this->view->list_nhan_vien = $list_nhan_vien;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
 }
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:34,代码来源:DuyetchamcongController.php

示例4: testNetwork

 /**
  * Test the network provided
  * @param $affiliateNetwork
  * @return none
  */
 public static function testNetwork($network)
 {
     //Start date, the first two months ago
     $startDate = new Zend_Date();
     $startDate->setDay(1);
     $startDate->subMonth(2);
     $startDate->setHour(00);
     $startDate->setMinute(00);
     $startDate->setSecond(00);
     //Yesterday, some networks don't give us the data for the same day, then is the safer way to have our data
     $endDate = new Zend_Date();
     $endDate->subDay(1);
     $endDate->setHour(23);
     $endDate->setMinute(59);
     $endDate->setSecond(59);
     //are we connected?
     if ($network->checkConnection()) {
         //Get all the payments for this network.
         $paymentsList = $network->getPaymentHistory();
         echo "Total Number of payments: " . count($paymentsList) . "\n\n";
         //Get all the Merhcants
         $merchantList = $network->getMerchantList(array());
         echo "Number of merchants: " . count($merchantList) . "\n\n";
         // Building the array of merchant Id we want to retrieve data from.
         $merchantIdList = array();
         foreach ($merchantList as $merchant) {
             $merchantIdList[] = $merchant['cid'];
         }
         //If we have joined any merchant
         if (!empty($merchantIdList)) {
             //Split the dates monthly, Most of the network don't allow us to retrieve more than a month data
             $dateArray = Oara_Utilities::monthsOfDifference($startDate, $endDate);
             for ($i = 0; $i < count($dateArray); $i++) {
                 // Calculating the start and end date for the current month
                 $monthStartDate = clone $dateArray[$i];
                 $monthEndDate = null;
                 if ($i != count($dateArray) - 1) {
                     $monthEndDate = clone $dateArray[$i];
                     $monthEndDate->setDay(1);
                     $monthEndDate->addMonth(1);
                     $monthEndDate->subDay(1);
                 } else {
                     $monthEndDate = $endDate;
                 }
                 $monthEndDate->setHour(23);
                 $monthEndDate->setMinute(59);
                 $monthEndDate->setSecond(59);
                 echo "\n importing from " . $monthStartDate->toString("dd-MM-yyyy HH:mm:ss") . " to " . $monthEndDate->toString("dd-MM-yyyy HH:mm:ss") . "\n";
                 $transactionList = $network->getTransactionList($merchantIdList, $monthStartDate, $monthEndDate);
                 echo "Number of transactions: " . count($transactionList) . "\n\n";
                 $overviewList = $network->getOverviewList($transactionList, $merchantIdList, $monthStartDate, $monthEndDate);
                 echo "Number register on the overview: " . count($overviewList) . "\n\n";
             }
         }
         echo "Import finished \n\n";
     } else {
         echo "Error connecting to the network, check credentials\n\n";
     }
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:64,代码来源:Test.php

示例5: getBestsellerProducts

 public function getBestsellerProducts()
 {
     $storeId = (int) Mage::app()->getStore()->getId();
     // Date
     $date = new Zend_Date();
     $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
     $fromDate = $date->subMonth(1)->getDate()->get('Y-MM-dd');
     $collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addStoreFilter()->setPageSize(6);
     $collection->getSelect()->joinLeft(array('aggregation' => $collection->getResource()->getTable('sales/bestsellers_aggregated_monthly')), "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'", array('SUM(aggregation.qty_ordered) AS sold_quantity'))->group('e.entity_id')->order(array('sold_quantity DESC', 'e.created_at'));
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     return $collection;
 }
开发者ID:vlikin,项目名称:test_magento_skin,代码行数:13,代码来源:Bestsold.php

示例6: getLoadedProductCollection

 public function getLoadedProductCollection()
 {
     if ($this->getRequest()->getParam('id') != null) {
         $id = $this->getRequest()->getParam('id');
         // benchmarking
         $memory = memory_get_usage();
         $time = microtime();
         $catId = $id;
         /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
         $collection = Mage::getResourceModel('catalog/product_collection');
         // join sales order items column and count sold products
         $expression = new Zend_Db_Expr("SUM(oi.qty_ordered)");
         $condition = new Zend_Db_Expr("e.entity_id = oi.product_id AND oi.parent_item_id IS NULL");
         $collection->addAttributeToSelect('*')->getSelect()->join(array('oi' => $collection->getTable('sales/order_item')), $condition, array('sales_count' => $expression))->group('e.entity_id')->order('sales_count' . ' ' . 'desc');
         // join category
         $condition = new Zend_Db_Expr("e.entity_id = ccp.product_id");
         $condition2 = new Zend_Db_Expr("c.entity_id = ccp.category_id");
         $collection->getSelect()->join(array('ccp' => $collection->getTable('catalog/category_product')), $condition, array())->join(array('c' => $collection->getTable('catalog/category')), $condition2, array('cat_id' => 'c.entity_id'));
         $condition = new Zend_Db_Expr("c.entity_id = cv.entity_id AND ea.attribute_id = cv.attribute_id");
         // cutting corners here by hardcoding 3 as Category Entiry_type_id
         $condition2 = new Zend_Db_Expr("ea.entity_type_id = 3 AND ea.attribute_code = 'name'");
         $collection->getSelect()->join(array('ea' => $collection->getTable('eav/attribute')), $condition2, array())->join(array('cv' => $collection->getTable('catalog/category') . '_varchar'), $condition, array('cat_name' => 'cv.value'));
         // if Category filter is on
         if ($catId) {
             $collection->getSelect()->where('c.entity_id = ?', $catId)->limit(20);
         }
         // unfortunately I cound not come up with the sql query that could grab only 1 bestseller for each category
         // so all sorting work lays on php
         $result = array();
         foreach ($collection as $product) {
             /** @var $product Mage_Catalog_Model_Product */
             if (isset($result[$product->getCatId()])) {
                 continue;
             }
             $result[$product->getCatId()] = 'Category:' . $product->getCatName() . '; Product:' . $product->getName() . '; Sold Times:' . $product->getSalesCount();
         }
     } else {
         $id = 2;
         $storeId = (int) Mage::app()->getStore()->getId();
         // Date
         $date = new Zend_Date();
         $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
         $fromDate = $date->subMonth(1)->getDate()->get('Y-MM-dd');
         $collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addStoreFilter()->addPriceData()->addTaxPercents()->addUrlRewrite()->setPageSize(6);
         $collection->getSelect()->joinLeft(array('aggregation' => $collection->getResource()->getTable('sales/bestsellers_aggregated_monthly')), "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'", array('SUM(aggregation.qty_ordered) AS sold_quantity'))->group('e.entity_id')->order(array('sold_quantity DESC', 'e.created_at'))->limit(5);
         Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
         Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     }
     return $collection;
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:50,代码来源:Seller.php

示例7: indexAction

 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Duyệt đánh giá phân loại - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $list_phong_ban = $phongbanModel->fetchAll();
     $pb_selected = $this->_getParam('phongban', 0);
     $phong_ban = array();
     $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban);
     $phong_ban_choosed = array();
     $phongbanModel->fetchData($pb_selected, $phong_ban_choosed);
     $pb_ids = array($pb_selected);
     foreach ($phong_ban_choosed as $pb) {
         $pb_ids[] = $pb->pb_id;
     }
     if (!$pb_selected) {
         //$list_employees = $emModel->fetchData(array('em_delete' => 0));
         $list_employees = $emModel->callGetListNhanVien();
     } else {
         //$select = $emModel->select()->where('em_phong_ban in (?)', $pb_ids);
         $list_employees = $emModel->callGetListNhanVien($pb_ids);
     }
     $tieuchiModel = new Front_Model_TieuChiDanhGiaCB();
     $list_tieuchi = $tieuchiModel->fetchData(array('tcdgcb_status' => 1), 'tcdgcb_order ASC');
     $ketquaModel = new Front_Model_DanhGiaKetQuaCV();
     $list_ketqua = $ketquaModel->fetchData(array('dgkqcv_status' => 1), 'dgkqcv_order ASC');
     $this->view->tieu_chi = $list_tieuchi;
     $this->view->ket_qua = $list_ketqua;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->list_nhan_vien = $list_employees;
     $this->view->list_phong_ban = $list_phong_ban;
     $this->view->list_phong_ban_option = $list_phong_ban_option;
     $this->view->pb_id = $pb_selected;
 }
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:47,代码来源:DuyetphanloaiController.php

示例8: indexAction

 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Chấm công - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $holidaysModel = new Front_Model_Holidays();
     $list_holidays = $holidaysModel->fetchData(array(), 'hld_order ASC');
     $xinnghiphepModel = new Front_Model_XinNghiPhep();
     $list_nghi_phep = $xinnghiphepModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $chamcongModel = new Front_Model_ChamCong();
     $cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $em_id, 'c_thang' => $thang, 'c_nam' => $nam));
     $error_message = array();
     $success_message = '';
     if ($this->_request->isPost()) {
         $data_cham_cong = $this->_arrParam['cham_cong'];
         $current_time = new Zend_Db_Expr('NOW()');
         if ($cham_cong && ($cham_cong->c_don_vi_status != '-1' || $cham_cong->c_ptccb_status != '-1')) {
             $error_message[] = 'Chấm công đã được duyệt nên không thể thay đổi.';
         }
         if (!sizeof($error_message)) {
             if ($cham_cong) {
                 $chamcongModel->update(array('c_ngay_1' => isset($data_cham_cong[1]) ? $data_cham_cong[1] : '', 'c_ngay_2' => isset($data_cham_cong[2]) ? $data_cham_cong[2] : '', 'c_ngay_3' => isset($data_cham_cong[3]) ? $data_cham_cong[3] : '', 'c_ngay_4' => isset($data_cham_cong[4]) ? $data_cham_cong[4] : '', 'c_ngay_5' => isset($data_cham_cong[5]) ? $data_cham_cong[5] : '', 'c_ngay_6' => isset($data_cham_cong[6]) ? $data_cham_cong[6] : '', 'c_ngay_7' => isset($data_cham_cong[7]) ? $data_cham_cong[7] : '', 'c_ngay_8' => isset($data_cham_cong[8]) ? $data_cham_cong[8] : '', 'c_ngay_9' => isset($data_cham_cong[9]) ? $data_cham_cong[9] : '', 'c_ngay_10' => isset($data_cham_cong[10]) ? $data_cham_cong[10] : '', 'c_ngay_11' => isset($data_cham_cong[11]) ? $data_cham_cong[11] : '', 'c_ngay_12' => isset($data_cham_cong[12]) ? $data_cham_cong[12] : '', 'c_ngay_13' => isset($data_cham_cong[13]) ? $data_cham_cong[13] : '', 'c_ngay_14' => isset($data_cham_cong[14]) ? $data_cham_cong[14] : '', 'c_ngay_15' => isset($data_cham_cong[15]) ? $data_cham_cong[15] : '', 'c_ngay_16' => isset($data_cham_cong[16]) ? $data_cham_cong[16] : '', 'c_ngay_17' => isset($data_cham_cong[17]) ? $data_cham_cong[17] : '', 'c_ngay_18' => isset($data_cham_cong[18]) ? $data_cham_cong[18] : '', 'c_ngay_19' => isset($data_cham_cong[19]) ? $data_cham_cong[19] : '', 'c_ngay_20' => isset($data_cham_cong[20]) ? $data_cham_cong[20] : '', 'c_ngay_21' => isset($data_cham_cong[21]) ? $data_cham_cong[21] : '', 'c_ngay_22' => isset($data_cham_cong[22]) ? $data_cham_cong[22] : '', 'c_ngay_23' => isset($data_cham_cong[23]) ? $data_cham_cong[23] : '', 'c_ngay_24' => isset($data_cham_cong[24]) ? $data_cham_cong[24] : '', 'c_ngay_25' => isset($data_cham_cong[25]) ? $data_cham_cong[25] : '', 'c_ngay_26' => isset($data_cham_cong[26]) ? $data_cham_cong[26] : '', 'c_ngay_27' => isset($data_cham_cong[27]) ? $data_cham_cong[27] : '', 'c_ngay_28' => isset($data_cham_cong[28]) ? $data_cham_cong[28] : '', 'c_ngay_29' => isset($data_cham_cong[29]) ? $data_cham_cong[29] : '', 'c_ngay_30' => isset($data_cham_cong[30]) ? $data_cham_cong[30] : '', 'c_ngay_31' => isset($data_cham_cong[31]) ? $data_cham_cong[31] : '', 'c_date_modifyed' => $current_time), 'c_id=' . $cham_cong->c_id);
             } else {
                 $chamcongModel->insert(array('c_em_id' => $em_id, 'c_thang' => $thang, 'c_nam' => $nam, 'c_ngay_1' => isset($data_cham_cong[1]) ? $data_cham_cong[1] : '', 'c_ngay_2' => isset($data_cham_cong[2]) ? $data_cham_cong[2] : '', 'c_ngay_3' => isset($data_cham_cong[3]) ? $data_cham_cong[3] : '', 'c_ngay_4' => isset($data_cham_cong[4]) ? $data_cham_cong[4] : '', 'c_ngay_5' => isset($data_cham_cong[5]) ? $data_cham_cong[5] : '', 'c_ngay_6' => isset($data_cham_cong[6]) ? $data_cham_cong[6] : '', 'c_ngay_7' => isset($data_cham_cong[7]) ? $data_cham_cong[7] : '', 'c_ngay_8' => isset($data_cham_cong[8]) ? $data_cham_cong[8] : '', 'c_ngay_9' => isset($data_cham_cong[9]) ? $data_cham_cong[9] : '', 'c_ngay_10' => isset($data_cham_cong[10]) ? $data_cham_cong[10] : '', 'c_ngay_11' => isset($data_cham_cong[11]) ? $data_cham_cong[11] : '', 'c_ngay_12' => isset($data_cham_cong[12]) ? $data_cham_cong[12] : '', 'c_ngay_13' => isset($data_cham_cong[13]) ? $data_cham_cong[13] : '', 'c_ngay_14' => isset($data_cham_cong[14]) ? $data_cham_cong[14] : '', 'c_ngay_15' => isset($data_cham_cong[15]) ? $data_cham_cong[15] : '', 'c_ngay_16' => isset($data_cham_cong[16]) ? $data_cham_cong[16] : '', 'c_ngay_17' => isset($data_cham_cong[17]) ? $data_cham_cong[17] : '', 'c_ngay_18' => isset($data_cham_cong[18]) ? $data_cham_cong[18] : '', 'c_ngay_19' => isset($data_cham_cong[19]) ? $data_cham_cong[19] : '', 'c_ngay_20' => isset($data_cham_cong[20]) ? $data_cham_cong[20] : '', 'c_ngay_21' => isset($data_cham_cong[21]) ? $data_cham_cong[21] : '', 'c_ngay_22' => isset($data_cham_cong[22]) ? $data_cham_cong[22] : '', 'c_ngay_23' => isset($data_cham_cong[23]) ? $data_cham_cong[23] : '', 'c_ngay_24' => isset($data_cham_cong[24]) ? $data_cham_cong[24] : '', 'c_ngay_25' => isset($data_cham_cong[25]) ? $data_cham_cong[25] : '', 'c_ngay_26' => isset($data_cham_cong[26]) ? $data_cham_cong[26] : '', 'c_ngay_27' => isset($data_cham_cong[27]) ? $data_cham_cong[27] : '', 'c_ngay_28' => isset($data_cham_cong[28]) ? $data_cham_cong[28] : '', 'c_ngay_29' => isset($data_cham_cong[29]) ? $data_cham_cong[29] : '', 'c_ngay_30' => isset($data_cham_cong[30]) ? $data_cham_cong[30] : '', 'c_ngay_31' => isset($data_cham_cong[31]) ? $data_cham_cong[31] : '', 'c_date_created' => $current_time, 'c_date_modifyed' => $current_time));
             }
             $success_message = 'Đã cập nhật thành công.';
             $cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $em_id, 'c_thang' => $thang, 'c_nam' => $nam));
         }
     }
     $this->view->success_message = $success_message;
     $this->view->error_message = $error_message;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->cham_cong = $cham_cong;
     $this->view->list_holidays = $list_holidays;
     $this->view->list_nghi_phep = $list_nghi_phep;
 }
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:47,代码来源:ChamcongController.php

示例9: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $transactionNumber = rand(1, 200);
     $twoMonthsAgoDate = new Zend_Date();
     $twoMonthsAgoDate->subMonth(2);
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     for ($i = 0; $i < $transactionNumber; $i++) {
         $dateIndex = rand(0, count($dateArray) - 1);
         $merchantIndex = rand(0, count($merchantList) - 1);
         $transaction = array();
         $transaction['unique_id'] = md5(mt_rand() . $dateArray[$dateIndex]->toString("yyyy-MM-dd HH:mm:ss"));
         $transaction['custom_id'] = "my_custom_id";
         $transaction['merchantId'] = $merchantList[$merchantIndex];
         $transaction['date'] = $dateArray[$dateIndex]->toString("yyyy-MM-dd HH:mm:ss");
         $transactionAmount = rand(1, 1000);
         $transaction['amount'] = $transactionAmount;
         $transaction['commission'] = $transactionAmount / 10;
         //$transaction['link'] = $this->_linkList[rand(0, count($this->_linkList)-1)];
         //$transaction['website'] = $this->_websiteList[rand(0, count($this->_websiteList)-1)];
         //$transaction['page'] = $this->_pageList[rand(0, count($this->_pageList)-1)];
         $transactionStatusChances = rand(1, 100);
         if ($dateArray[$dateIndex]->compare($twoMonthsAgoDate) >= 0) {
             if ($transactionStatusChances < 60) {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 if ($transactionStatusChances < 70) {
                     $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
                 } else {
                     $transaction['status'] = Oara_Utilities::STATUS_PENDING;
                 }
             }
         } else {
             if ($transactionStatusChances < 80) {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
             }
         }
         $totalTransactions[] = $transaction;
     }
     return $totalTransactions;
 }
开发者ID:garygarside,项目名称:php-oara,代码行数:47,代码来源:Demo.php

示例10: indexAction

 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Duyệt đánh giá phân loại - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => 'donvi/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $my_info = $emModel->fetchRow('em_id=' . $em_id . ' and em_status=1');
     $phong_ban_id = $list_phongban = $phong_ban = array();
     if ($my_info) {
         $phong_ban_id[] = $my_info->em_phong_ban;
         $list_phongban = $phongbanModel->fetchDataStatus($my_info->em_phong_ban, $phong_ban);
     }
     if (sizeof($list_phongban)) {
         foreach ($list_phongban as $phong_ban_info) {
             $phong_ban_id[] = $phong_ban_info->pb_parent;
         }
     }
     $phong_ban_id = implode(',', $phong_ban_id);
     $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
     $tieuchiModel = new Front_Model_TieuChiDanhGiaCB();
     $list_tieuchi = $tieuchiModel->fetchData(array('tcdgcb_status' => 1), 'tcdgcb_order ASC');
     $ketquaModel = new Front_Model_DanhGiaKetQuaCV();
     $list_ketqua = $ketquaModel->fetchData(array('dgkqcv_status' => 1), 'dgkqcv_order ASC');
     $this->view->tieu_chi = $list_tieuchi;
     $this->view->ket_qua = $list_ketqua;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->list_nhan_vien = $list_nhan_vien;
 }
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:40,代码来源:DuyetphanloaiController.php

示例11: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
 {
     $totalTransactions = array();
     $transactionNumber = 50000;
     $twoMonthsAgoDate = new Zend_Date();
     $twoMonthsAgoDate->subMonth(2);
     $dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
     for ($i = 0; $i < $transactionNumber; $i++) {
         $dateIndex = rand(0, count($dateArray) - 1);
         $merchantIndex = rand(0, count($merchantList) - 1);
         $transaction = array();
         $transaction['merchantId'] = $merchantList[$merchantIndex];
         $transaction['date'] = $dateArray[$dateIndex]->toString("yyyy-MM-dd HH:mm:ss");
         $transactionAmount = rand(1, 1000);
         $transaction['amount'] = $transactionAmount;
         $transaction['commission'] = $transactionAmount * (rand(1, 20) / 100);
         $transactionStatusChances = rand(1, 100);
         if ($dateArray[$dateIndex]->compare($twoMonthsAgoDate) >= 0) {
             if ($transactionStatusChances < 60) {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 if ($transactionStatusChances < 70) {
                     $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
                 } else {
                     $transaction['status'] = Oara_Utilities::STATUS_PENDING;
                 }
             }
         } else {
             if ($transactionStatusChances < 80) {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
             }
         }
         $totalTransactions[] = $transaction;
     }
     return $totalTransactions;
 }
开发者ID:robryanx,项目名称:php-oara,代码行数:42,代码来源:BigDemo.php

示例12: getListBestSellerProducts

 public function getListBestSellerProducts($fieldorder = 'ordered_qty', $order = 'desc')
 {
     $limit = $this->getConfig('limit_item', 'catalog_source_setting');
     $limit = empty($limit) ? 6 : (int) $limit;
     $storeId = Mage::app()->getStore()->getId();
     $cateids = $this->getConfig('catsid', 'catalog_source_setting');
     $arr_catsid = array();
     if (stristr($cateids, ',') === FALSE) {
         $arr_catsid = array($cateids);
     } else {
         $arr_catsid = explode(",", $cateids);
     }
     $date = new Zend_Date();
     $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
     $fromDate = $date->subMonth(1)->getDate()->get('Y-MM-dd');
     if ($this->getConfig('bestseller_from_date') != '') {
         $fromDate = $this->getConfig('bestseller_from_date');
     }
     if ($this->getConfig('bestseller_to_date') != '') {
         $toDate = $this->getConfig('bestseller_to_date');
     }
     $resource = Mage::getSingleton('core/resource');
     $products = $this->getCollectionPro()->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addStoreFilter()->addPriceData()->addTaxPercents()->addUrlRewrite()->joinTable($resource->getTableName('catalog_category_product'), 'product_id=entity_id', array('category_id' => 'category_id'), null, 'left')->addAttributeToFilter(array(array('attribute' => 'category_id', 'in' => array('finset' => $arr_catsid))));
     $products->getSelect()->joinLeft(array('aggregation' => $products->getResource()->getTable('sales/bestsellers_aggregated_monthly')), "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'", array('SUM(aggregation.qty_ordered) AS sold_quantity'))->group('e.entity_id')->order(array('sold_quantity DESC', 'e.created_at'));
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
     $products->setPageSize($limit)->setCurPage($this->_current_page);
     $this->setProductCollection($products);
     $this->_addProductAttributesAndPrices($products);
     $list = array();
     if (($_products = $this->getProductCollection()) && $_products->getSize()) {
         $list = $products;
     }
     return $list;
 }
开发者ID:booklein,项目名称:bookle,代码行数:35,代码来源:List.php

示例13: applySourceType

 public function applySourceType($collection = null, $is_block_mode = true)
 {
     if ($collection) {
         /*Apply source type*/
         $source_type = $this->getSourceType();
         switch ($source_type) {
             case "best_value":
                 if ($is_block_mode) {
                     $collection->getSelect()->order('t2.position ASC');
                 }
                 break;
             case "new_arrival":
                 $fieldorder = 'created_at';
                 $order = 'desc';
                 $todayStartOfDayDate = Mage::app()->getLocale()->date()->setTime('00:00:00')->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
                 $todayEndOfDayDate = Mage::app()->getLocale()->date()->setTime('23:59:59')->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
                 $collection->addAttributeToFilter(array(array('attribute' => 'news_from_date', array('or' => array(0 => array('date' => true, 'to' => $todayEndOfDayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')))->addAttributeToFilter(array(array('attribute' => 'news_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayStartOfDayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')))->addAttributeToSort('news_from_date', 'desc')->addAttributeToSort($fieldorder, $order);
                 break;
             case "special":
                 $collection->getSelect()->where('price_index.final_price < price_index.price');
                 break;
             case "most_viewed":
                 if ($is_block_mode) {
                     $collection->addViewsCount();
                 }
                 break;
             case "best_seller":
                 if ($is_block_mode) {
                     // Date
                     $date = new Zend_Date();
                     $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
                     $fromDate = $date->subMonth(1)->getDate()->get('Y-MM-dd');
                     $storeId = Mage::app()->getStore()->getId();
                     $collection->getSelect()->joinLeft(array('aggregation' => $collection->getResource()->getTable('sales/bestsellers_aggregated_monthly')), "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'", array('SUM(aggregation.qty_ordered) AS sold_quantity'))->group('e.entity_id')->order(array('sold_quantity DESC', 'e.created_at'));
                 }
                 break;
             case "top_rate":
                 if ($is_block_mode) {
                     $collection->joinField('rating_summary_field', 'review/review_aggregate', 'rating_summary', 'entity_pk_value=entity_id', array('entity_type' => 1, 'store_id' => Mage::app()->getStore()->getId()), 'left');
                     $collection->addAttributeToSort('rating_summary_field', 'desc');
                 }
                 break;
             case "latest":
                 $fieldorder = 'created_at';
                 $order = 'desc';
                 $collection->addAttributeToSort($fieldorder, $order);
                 break;
             case "random":
                 $collection->getSelect()->order(new Zend_Db_Expr('RAND()'));
                 break;
         }
     }
     return $collection;
 }
开发者ID:TusharKDonda,项目名称:maruti,代码行数:54,代码来源:Rule.php

示例14: getListBestSellerProducts

 public function getListBestSellerProducts($config = array())
 {
     $this->_config = $config;
     $fieldorder = 'ordered_qty';
     $order = 'desc';
     $storeId = Mage::app()->getStore()->getId();
     $cateids = $this->getConfig('catsid');
     $list = array();
     $limit_item = $this->getConfig('limit_item', 12);
     $itemspage = $this->getConfig('itemspage', 6);
     $curPage = $this->getConfig('page', 1);
     $date = new Zend_Date();
     $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
     $fromDate = $date->subMonth(1)->getDate()->get('Y-MM-dd');
     $resource = Mage::getSingleton('core/resource');
     if ($curPage * $itemspage > $limit_item + $itemspage) {
         return '';
     }
     if ($cateids && $cateids != "1") {
         $arr_catsid = array();
         if (is_array($cateids)) {
             $arr_catsid = $cateids;
         } else {
             if (stristr($cateids, ',') === FALSE) {
                 $arr_catsid = array($cateids);
             } else {
                 $arr_catsid = explode(",", $cateids);
             }
         }
         $products = $this->getCollectionPro()->addStoreFilter()->addPriceData()->addTaxPercents()->addUrlRewrite()->joinTable($resource->getTableName('catalog_category_product'), 'product_id=entity_id', array('category_id' => 'category_id'), null, 'left')->addAttributeToFilter(array(array('attribute' => 'category_id', 'in' => array('finset' => $arr_catsid))));
         $products->getSelect()->joinLeft(array('aggregation' => $products->getResource()->getTable('sales/bestsellers_aggregated_monthly')), "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'", array('SUM(aggregation.qty_ordered) AS sold_quantity'))->group('e.entity_id')->order(array('sold_quantity DESC', 'e.created_at'));
     } else {
         $products = $this->getCollectionPro()->addStoreFilter()->addPriceData()->addTaxPercents()->addUrlRewrite();
         $products->getSelect()->joinLeft(array('aggregation' => $products->getResource()->getTable('sales/bestsellers_aggregated_monthly')), "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'", array('SUM(aggregation.qty_ordered) AS sold_quantity'))->group('e.entity_id')->order(array('sold_quantity DESC', 'e.created_at'));
     }
     $list = array();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
     $this->_addProductAttributesAndPrices($products);
     $products->setPageSize($itemspage)->setCurPage($curPage);
     $this->setProductCollection($products);
     if (($_products = $this->getProductCollection()) && $_products->getSize()) {
         $list['products'] = $products;
     }
     $size = $products->getSize();
     $list['hasNextData'] = true;
     if ($limit_item < $size) {
         $size = $limit_item;
     }
     if ($size <= $curPage * $itemspage) {
         $list['hasNextData'] = false;
     }
     return $list;
 }
开发者ID:TusharKDonda,项目名称:maruti,代码行数:54,代码来源:Product.php

示例15: testLoose


//.........这里部分代码省略.........
         // success
     }
     try {
         $date->addYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
开发者ID:jsnshrmn,项目名称:Suma,代码行数:67,代码来源:DateTest.php


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