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


PHP ExcelWriter类代码示例

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


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

示例1: ImportData

 function ImportData($sql, $fileName = "har_excel.xls", $download = false)
 {
     $excel = new ExcelWriter($fileName);
     if ($excel == false) {
         $this->error = $excel->error;
         return false;
     }
     $this->db->query($sql);
     if ($this->db->numRows() == 0) {
         $this->error = "No data found in the table";
         return false;
     }
     if ($row = $this->db->fetchAssoc()) {
         for ($i = 0; $i < count($row); $i++) {
             $fields[] = $this->db->fieldName($i);
         }
         $excel->writeLine($fields);
         do {
             $excel->writeLine($row);
         } while ($row = $this->db->fetchAssoc());
     }
     $excel->close();
     $this->db->close();
     if ($download) {
         if (!headers_sent()) {
             $this->download_file($fileName, true);
         } else {
             $this->error = "Error :Headers already Sent.Can't Download file.";
         }
     }
     return;
 }
开发者ID:arkosoft,项目名称:S-Admin,代码行数:32,代码来源:mysql_excel.inc.php

示例2: appuserexport

 public function appuserexport()
 {
     if ($this->Session->check('id')) {
         $this->autoRender = false;
         App::import('Vendor', 'ExcelWriter');
         $date = date("Y-m-d");
         $this->loadModel('Appuser');
         $request = $this->request->data;
         // pr($request);
         $conditions = array();
         if ($request['Appusers']['type'] == 1) {
             $reportname = "FULL";
             if ($request['Appusers']['status'] == 1) {
                 $conditions = "Appuser.is_active=1";
             } elseif ($request['Appusers']['status'] == 2) {
                 $conditions = "Appuser.is_active=0";
             } else {
                 $conditions = "1=1";
             }
             if ($request['Appusers']['sort'] == 1) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`email` ASC";
                 } else {
                     $order = "`Appuser`.`email` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 2) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`zip` ASC";
                 } else {
                     $order = "`Appuser`.`zip` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 3) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`city` ASC";
                 } else {
                     $order = "`Appuser`.`city` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 4) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`country` ASC";
                 } else {
                     $order = "`Appuser`.`country` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 5) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`created` ASC";
                 } else {
                     $order = "`Appuser`.`created` DESC";
                 }
             } else {
                 $order = "`Appuser`.`email` ASC";
             }
             $cond = "Device.user_id=Appuser.id";
             $cond2 = "Stickeruse.user_id=Appuser.id";
             $cond3 = "Purchasedsticker.user_id=Appuser.id";
             $result = $this->Appuser->query("SELECT  `Appuser`.`id`, `Appuser`.`zip`, `Appuser`.`city`, `Appuser`.`email`, `Appuser`.`country`, `Appuser`.`created`, `Appuser`.`is_active`,( SELECT  SUM(`count`) FROM  digistic_stickerapp.stickeruses WHERE  user_id = `Appuser`.`id` ) AS totalused,( SELECT  COUNT(*) FROM  digistic_stickerapp.devices WHERE  user_id = `Appuser`.`id` ) AS tdevice,( SELECT COUNT(`id`) FROM digistic_stickerapp.purchasedstickers WHERE user_id=`Appuser`.`id` ) AS pstickers FROM  digistic_stickerapp.`appusers` AS Appuser WHERE {$conditions} GROUP BY  `Appuser`.`id` ORDER BY {$order}");
             // $log = $this->Appuser->getDataSource()->getLog(false, false);
             // debug($log);
             // pr($result);die;
         } elseif ($request['Appusers']['type'] == 2) {
             $from = $this->request->data['Appusers']['from'];
             $to = $this->request->data['Appusers']['to'];
             $reportname = "Date Range From " . date('jS F, Y', strtotime($from . ' 00:00:00')) . " To " . date("jS F, Y", strtotime($to . ' 23:59:59'));
             $conditions = "WHERE Appuser.created >= '" . date($from . ' 00:00:00') . "' AND Appuser.created <='" . date($to . ' 23:59:59') . "' ";
             if ($request['Appusers']['status'] == 1) {
                 $conditions = " AND Appuser.is_active=1 ";
             } elseif ($request['Appusers']['status'] == 2) {
                 $conditions = " AND Appuser.is_active=0 ";
             }
             if ($request['Appusers']['sort'] == 1) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`email` ASC";
                 } else {
                     $order = "`Appuser`.`email` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 2) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`zip` ASC";
                 } else {
                     $order = "`Appuser`.`zip` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 3) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`city` ASC";
                 } else {
                     $order = "`Appuser`.`city` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 4) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`country` ASC";
                 } else {
                     $order = "`Appuser`.`country` DESC";
                 }
             } elseif ($request['Appusers']['sort'] == 5) {
                 if ($request['Appusers']['sorttype'] == 1) {
                     $order = "`Appuser`.`created` ASC";
                 } else {
                     $order = "`Appuser`.`created` DESC";
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:89itworld,项目名称:digisticker,代码行数:101,代码来源:AppusersController.php

示例3: array

    $outputFileName = 'data/excel/' . $datename . '.xls';
    $content = array();
    $archive = array("接收人", "发送人", "发送时间", "内容");
    $content[] = $archive;
    $wheresql = '';
    $vuidtype = getGP('vuidtype', 'P');
    if (!is_superadmin() && $vuidtype == '') {
        $wheresql .= " AND uid ='" . $_USER->id . "'";
    }
    if ($vuidtype != '') {
        if ($vuidtype == '-1') {
            $wheresql .= get_subordinate($_USER->id, 'uid');
        } else {
            $wheresql .= " and uid='" . $vuidtype . "'";
        }
    }
    $sql = "SELECT * FROM " . DB_TABLEPRE . "sms_send WHERE 1 {$wheresql} ORDER BY id desc";
    $result = $db->query($sql);
    while ($row = $db->fetch_array($result)) {
        $archive = array("" . $row['receiveperson'] . "", "" . get_realname($row['uid']) . "", "" . str_replace("-", ".", $row[date]) . "", "" . $row['content'] . "");
        $content[] = $archive;
    }
    $excel = new ExcelWriter($outputFileName);
    if ($excel == false) {
        echo $excel->error;
    }
    foreach ($content as $v) {
        $excel->writeLine($v);
    }
    $excel->sendfile($outputFileName);
}
开发者ID:haogm123,项目名称:ydoa,代码行数:31,代码来源:mod_index.php

示例4: PedidoDAO

<?php

$pedidoDAO = new PedidoDAO();
$empresaDAO = new EmpresaDAO();
$relatorioDAO = new RelatorioDAO();
echo '<pre>';
$empresas = $empresaDAO->listarTodas();
foreach ($empresas as $emp) {
    $id_empresa = $emp->id_empresa;
    echo "\n > " . $emp->fantasia . " ";
    $nomeArquivo = 'conciliacao_franquia' . date("Ymd") . "_" . $id_empresa . ".xls";
    $arquivoDiretorio = "../relatorios/conciliacao_franquia/" . $nomeArquivo;
    $excel = new ExcelWriter($arquivoDiretorio);
    if ($excel == false) {
        echo $excel->error;
        exit;
    }
    //Unidade
    $myArr = array('Relação de pedidos em conciliação franquia:' . $emp->fantasia);
    $excel->writeLine($myArr);
    //periodo
    $myArr = array('Até: ' . date('d') . '/' . date('m') . '/' . date('Y'));
    $excel->writeLine($myArr);
    //espaço
    $myArr = array(' ');
    $excel->writeLine($myArr);
    //Escreve o nome dos campos de uma tabela
    $excel->writeLine(array('PEDIDO', 'ABERTO HÁ (dias) ', 'ATENDENTE'));
    $total_comissao = 0;
    $total = 0;
    $cont = 0;
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:31,代码来源:cron_conciliacao_franquia.php

示例5: adminActivityDataExport

 /**
  * Function exports the admin activity report from the database into various file format
  * Excel/CSV/TSV/XML Formats
  * 
  * @return file
  */
 function adminActivityDataExport()
 {
     if ($_POST['export'] == 'excel') {
         include "classes/Lib/excelwriter.inc.php";
         $excel = new ExcelWriter("adminactivity_Detail.xls");
         if ($excel == false) {
             echo $excel->error;
         }
         $myArr = array("SlNo", "UserId", "Url", "VisitedOn");
         $excel->writeLine($myArr);
         $j = 1;
         $sql = 'select user_id,url,visited_on from admin_activity_table';
         $obj = new Bin_Query();
         $obj->executeQuery($sql);
         if ($obj->executeQuery($sql)) {
             $cnt = count($obj->records);
             for ($i = 0; $i < $cnt; $i++) {
                 $user_id = $obj->records[$i]['user_id'];
                 $url = $obj->records[$i]['url'];
                 $visited_on = $obj->records[$i]['visited_on'];
                 $excel->writeRow();
                 $excel->writeCol($j);
                 $excel->writeCol($user_id);
                 $excel->writeCol($url);
                 $excel->writeCol($visited_on);
                 $j++;
             }
             $excel->close();
         }
         if (strpos($_SERVER['USER'], 'MSIE')) {
             // IE cannot download from sessions without a cache
             header('Cache-Control: public');
         } else {
             //header("Cache-Control: no-cache, must-revalidate");
             header("Cache-Control: no-cache");
         }
         $file = "adminactivity_Detail.xls";
         //chmod ($file, 0755);
         header("Pragma: no-cache");
         header("Content-Type: php/doc/xml/html/htm/asp/jpg/JPG/sql/txt/jpeg/gif/bmp/png/xls/csv/x-ms-asf\n");
         header("Connection: close");
         header("Content-Disposition: attachment; filename=" . $file . "\n");
         header("Content-Transfer-Encoding: binary\n");
         header("Content-length: " . (string) filesize("{$file}"));
         $fd = fopen($file, "rb");
         fpassthru($fd);
         /*function xlsBOF() 
         			{
         				echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);  
         				return;
         			}
         	
         			function xlsEOF() 
         			{
         				echo pack("ss", 0x0A, 0x00);
         				return;
         			}
         	
         			function xlsWriteNumber($Row, $Col, $Value) 
         			{
         				echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
         				echo pack("d", $Value);
         				return;
         			}
         	
         			function xlsWriteLabel($Row, $Col, $Value ) 
         			{
         				$L = strlen($Value);
         				echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
         				echo $Value;
         				return;
         			}
         			//Send header
         			header("Pragma: public");
         			header("Expires: 0");
         			header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         			header("Content-Type: application/force-download");
         			header("Content-Type: application/octet-stream");
         			header("Content-Type: application/download");
         			header("Content-Disposition: attachment;filename=user_report.xls"); 
         			header("Content-Transfer-Encoding: binary ");
         			xlsBOF();
         					xlsWriteLabel(1,0,"No");
         					xlsWriteLabel(1,1,"First Name");
         					xlsWriteLabel(1,2,"Last Name");
         					xlsWriteLabel(1,3,"Display Name");
         					xlsWriteLabel(1,4,"Email");
         					xlsWriteLabel(1,5,"Date of Joining");
         								
         				   $xlsRow = 2;
         				   $j=1;
         					
         					//Query
         					
//.........这里部分代码省略.........
开发者ID:kingsj,项目名称:zeuscart,代码行数:101,代码来源:CAdminActivityDataExport.php

示例6: date

    $campo_total[] = '';
}
if ($c->c_final_contrato == 'on') {
    $campos_header[] = 'FINAL DE CONTRATO';
    $campo_total[] = '';
}
if ($c->c_royalties == 'on') {
    $campos_header[] = "ROYALTIES";
    $campos_header[] = "MES/ANO";
}
if ($c->c_observacoes == 'on') {
    $campos_header[] = "OBSERVACOES";
}
$nomeArquivo = 'franquia_' . date("Ym") . "_" . $controle_id_empresa . ".xls";
$arquivoDiretorio = "../relatorios/cadastrados/" . $nomeArquivo;
$excel = new ExcelWriter($arquivoDiretorio);
$excel->writeLine($campos_header);
$financeiroDAO = new FinanceiroDAO();
$lista = $financeiroDAO->relRoyaltiesEmAberto($c);
$id_empresa = 0;
foreach ($lista as $res) {
    $campos = array();
    if ($id_empresa != $res->id_empresa && $id_empresa > 0) {
        $campo_total[] = number_format((double) $valor_total, 2, '.', '');
        $excel->writeLine($campo_total);
        $excel->writeRow();
        $excel->writeRow();
        $valor_total = 0;
    }
    $campo_total = array();
    if ($c->c_royalties == 'on') {
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:31,代码来源:gera_rel_royalties_aberto+-+Cópia.php

示例7: googleProduct

 /**
  * Function generates a excel product report for google base
  * 
  * 
  * @return file
  */
 function googleProduct()
 {
     include "classes/Lib/excelwriter.inc.php";
     $excel = new ExcelWriter("GoogleBase_Product_Feed.xls");
     if ($excel == false) {
         echo $excel->error;
     }
     $myArr = array("Product Id", "Product Title", "Description", "Product Price", "Link", "Brand", "Image Link", "Weight");
     $excel->writeLine($myArr);
     $sql = 'select product_id,title,description,price,brand,thumb_image,weight from products_table';
     $obj = new Bin_Query();
     if ($obj->executeQuery($sql)) {
         $cnt = count($obj->records);
         for ($i = 0; $i < $cnt; $i++) {
             $product_id = $obj->records[$i]['product_id'];
             $title = $obj->records[$i]['title'];
             $description = strip_tags($obj->records[$i]['description']);
             $price = $obj->records[$i]['price'];
             $brand = $obj->records[$i]['brand'];
             $thumb_image = $obj->records[$i]['thumb_image'];
             $image_link = $_SERVER['SERVER_NAME'] . '/' . $thumb_image;
             $weight = $obj->records[$i]['weight'];
             $link = $_SERVER['SERVER_NAME'] . '/?do=prodetail&action=showprod&id=' . $product_id;
             $excel->writeRow();
             $excel->writeCol($product_id);
             $excel->writeCol($title);
             $excel->writeCol($description);
             $excel->writeCol($price);
             $excel->writeCol($link);
             $excel->writeCol($brand);
             $excel->writeCol($image_link);
             $excel->writeCol($weight);
         }
         $excel->close();
     }
     if (strpos($_SERVER['USER'], 'MSIE')) {
         // IE cannot download from sessions without a cache
         header('Cache-Control: public');
     } else {
         //header("Cache-Control: no-cache, must-revalidate");
         header("Cache-Control: no-cache");
     }
     $file = "GoogleBase_Product_Feed.xls";
     //chmod ($file, 0755);
     header("Pragma: no-cache");
     header("Content-Type: php/doc/xml/html/htm/asp/jpg/JPG/sql/txt/jpeg/gif/bmp/png/xls/csv/x-ms-asf\n");
     header("Connection: close");
     header("Content-Disposition: attachment; filename=" . $file . "\n");
     header("Content-Transfer-Encoding: binary\n");
     header("Content-length: " . (string) filesize("{$file}"));
     $fd = fopen($file, "rb");
     fpassthru($fd);
 }
开发者ID:kingsj,项目名称:zeuscart,代码行数:59,代码来源:CGoogleBase.php

示例8: EmpresaDAO

$empresaDAO = new EmpresaDAO();
$relatorioDAO = new RelatorioDAO();
$retorna = 14;
while ($retorna > 0) {
    $ano_mes = date('Y-m', strtotime("-" . $retorna . " month"));
    $ano_mes_exp = explode('-', $ano_mes);
    $mes_referencia = date('m/Y', strtotime("-" . $retorna . " month"));
    $empresas = $empresaDAO->listarTodas();
    $mes = $ano_mes_exp[1];
    $ano = $ano_mes_exp[0];
    foreach ($empresas as $emp) {
        $id_empresa = $emp->id_empresa;
        //Você pode colocar aqui o nome do arquivo que você deseja salvar.
        $nomeArquivo = 'geral_' . date("sshYmdhms") . "_" . $id_empresa . ".xls";
        $arquivoDiretorio = "../relatorios/geral/" . $nomeArquivo;
        $excel = new ExcelWriter($arquivoDiretorio);
        if ($excel == false) {
            echo $excel->error;
            exit;
        }
        //Unidade
        $myArr = array('Relatório de Faturamento:' . $emp->fantasia);
        $excel->writeLine($myArr);
        //periodo
        $myArr = array('Relatório Gerado em: ' . date('d/m/Y'));
        $excel->writeLine($myArr);
        //periodo
        $myArr = array('Período : ' . $mes_referencia);
        $excel->writeLine($myArr);
        $myArr = array('');
        $excel->writeLine($myArr);
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:31,代码来源:cron_geral2.php

示例9: categoryexport

 public function categoryexport()
 {
     if ($this->Session->check('id')) {
         // pr($this->request->data);
         $this->autoRender = false;
         App::import('Vendor', 'ExcelWriter');
         $date = date("Y-m-d");
         $this->loadModel('Categorie');
         $request = $this->request->data;
         // pr($request);
         $conditions = array();
         if ($request['Categories']['type'] == 1) {
             $reportname = "FULL";
             if ($request['Categories']['status'] == 1) {
                 $conditions = "Categorie.is_active=1";
             } elseif ($request['Categories']['status'] == 2) {
                 $conditions = "Categorie.is_active=0";
             } else {
                 $conditions = array();
             }
         } elseif ($request['Categories']['type'] == 2) {
             $from = $this->request->data['Categories']['from'];
             $to = $this->request->data['Categories']['to'];
             $reportname = "Created From " . date('jS F, Y', strtotime($from . ' 00:00:00')) . " To " . date("jS F, Y", strtotime($to . ' 23:59:59'));
             $conditions = "WHERE Categorie.created >= '" . date($from . ' 00:00:00') . "' AND Categorie.created <='" . date($to . ' 23:59:59') . "' ";
             if ($request['Categories']['status'] == 1) {
                 $conditions .= "AND Categorie.is_active=1";
             } elseif ($request['Categories']['status'] == 2) {
                 $conditions .= "AND Categorie.is_active=0";
             } else {
                 $conditions .= "";
             }
         } elseif ($request['Categories']['type'] == 3) {
             $from = $this->request->data['Categories']['from'];
             $to = $this->request->data['Categories']['to'];
             $reportname = "Modified From " . date('jS F, Y', strtotime($from . ' 00:00:00')) . " To " . date("jS F, Y", strtotime($to . ' 23:59:59'));
             $conditions = "WHERE Categorie.updated >= '" . date($from . ' 00:00:00') . "' AND Categorie.updated <='" . date($to . ' 23:59:59') . "' ";
             if ($request['Categories']['status'] == 1) {
                 $conditions .= "AND Categorie.is_active=1";
             } elseif ($request['Categories']['status'] == 2) {
                 $conditions .= "AND Categorie.is_active=0";
             } else {
                 $conditions .= "";
             }
             // pr($conditions);die;
         }
         if ($request['Categories']['sort'] == 1) {
             if ($request['Categories']['sorttype'] == 1) {
                 $order = "Categorie.name ASC";
             } else {
                 $order = "Categorie.name DESC";
             }
         } elseif ($request['Categories']['sort'] == 4) {
             if ($request['Categories']['sorttype'] == 1) {
                 $order = "Categorie.is_active ASC";
             } else {
                 $order = "Categorie.is_active DESC";
             }
         } elseif ($request['Categories']['sort'] == 5) {
             if ($request['Categories']['sorttype'] == 1) {
                 $order = "total ASC";
             } else {
                 $order = "total DESC";
             }
         } elseif ($request['Categories']['sort'] == 6) {
             if ($request['Categories']['sorttype'] == 1) {
                 $order = "Categorie.created ASC";
             } else {
                 $order = "Categorie.created DESC";
             }
         } elseif ($request['Categories']['sort'] == 7) {
             if ($request['Categories']['sorttype'] == 1) {
                 $order = "Categorie.updated ASC";
             } else {
                 $order = "Categorie.updated DESC";
             }
         } else {
             $order = "Categorie.name ASC";
         }
         $cond = "`Sticker.category_id`=`Categorie`.`id`";
         $result = $this->Categorie->find('all', array('fields' => array('Categorie.id', 'Categorie.name', 'Categorie.is_active', 'Categorie.is_deleted', 'Categorie.created', 'Categorie.updated', 'COUNT(`Sticker`.`id`) AS total'), 'joins' => array(array('table' => 'stickers', 'alias' => 'Sticker', 'type' => 'inner', 'conditions' => $cond)), 'conditions' => $conditions, 'order' => $order, 'group' => 'Categorie.id'));
         if (empty($result)) {
             $this->Session->setFlash("No Data Found", "flash_custom");
             $this->redirect(array('controller' => 'Reports'));
         }
         // pr($result);die;
         $fileName = WWW_ROOT . "files" . DS . "Excel" . DS . "Category_Report" . "_" . $reportname . "_" . $date . ".xls";
         $excel = new ExcelWriter($fileName);
         $excel->writeCol("S. No.", array('font-weight' => 'bold'));
         $excel->writeCol("Name", array('font-weight' => 'bold'));
         $excel->writeCol("Activation Status", array('font-weight' => 'bold'));
         $excel->writeCol("Deletion Status", array('font-weight' => 'bold'));
         $excel->writeCol("Total Stickers", array('font-weight' => 'bold'));
         $excel->writeCol("Created", array('font-weight' => 'bold'));
         $excel->writeCol("Modified", array('font-weight' => 'bold'));
         foreach ($result as $key => $data) {
             if ($key == 0) {
                 $excel->writeLine(array(), array());
             }
             $excel->writeCol($key + 1, array());
//.........这里部分代码省略.........
开发者ID:89itworld,项目名称:digisticker,代码行数:101,代码来源:CategoriesController.php

示例10: PedidoDAO

$pedidoDAO = new PedidoDAO();
$afiliadoDAO = new AfiliadoDAO();
$relatorioDAO = new RelatorioDAO();
$afiliados = $afiliadoDAO->listarTodos();
$ano = date("Y", strtotime("-1 month"));
$mes = date("m", strtotime("-1 month"));
$data_i = $ano . '-' . '01' . '-01 00:00:00';
$data_f = $ano . '-' . $mes . '-' . date("d", strtotime("-1 day", strtotime(date("Y-m-01")))) . ' 00:00:00';
echo '<pre>';
echo 'de ' . $data_i . ' até ' . $data_f . "\n";
foreach ($afiliados as $a) {
    $nomeArquivo = 'afiliado_' . $a->id_afiliado . '_' . date("Ymd") . ".xls";
    $arquivoDiretorio = "../relatorios/afiliado/" . $nomeArquivo;
    $pedidos = $pedidoDAO->listaComissaoAfiliado($a->id_afiliado, $data_i, $data_f);
    $excel = new ExcelWriter($arquivoDiretorio);
    if (!$excel) {
        echo $excel->error;
    }
    $excel->writeLine(array('Relação de comissionamento do afiliado ' . $a->nome));
    $excel->writeLine(array('Referente ' . invert($data_i, '/', 'PHP') . ' até ' . invert($data_f, '/', 'PHP')));
    $excel->writeLine(array(''));
    $excel->writeLine(array("ORDEM", "VALOR", "COMISSÃO", "VALOR À PAGAR"));
    $comissao_total = 0;
    $valor_total = 0;
    foreach ($pedidos as $p) {
        $comissao = $p->valor / 100 * $a->comissao;
        $comissao_total = $comissao_total + $comissao;
        $valor_total = $valor_total + $p->valor;
        $excel->writeLine(array($p->id_pedido . '/' . $p->ordem, $p->valor, $a->comissao . '%', $comissao));
    }
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:30,代码来源:cron_rel_afiliado.php

示例11: builtXLS

 public function builtXLS()
 {
     $this->load->model('report/product');
     $url = '';
     if (isset($this->request->get['filter_date_start'])) {
         $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
     }
     if (isset($this->request->get['filter_date_end'])) {
         $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
     }
     if (isset($this->request->get['filter_payment_method'])) {
         $url .= '&filter_payment_method=' . $this->request->get['filter_payment_method'];
     }
     if (isset($this->request->get['filter_shipping_method'])) {
         $url .= '&filter_shipping_method=' . $this->request->get['filter_shipping_method'];
     }
     if (isset($this->request->get['filter_payment_code'])) {
         $url .= '&filter_payment_code=' . $this->request->get['filter_payment_code'];
     }
     if (isset($this->request->get['filter_type_date'])) {
         $url .= '&filter_type_date=' . $this->request->get['filter_type_date'];
     }
     if (isset($this->request->get['filter_order_status_id'])) {
         $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
     }
     require_once DIR_SYSTEM . "library/excel/excelwriter.inc.php";
     if (is_file(DIR_APPLICATION . 'controller/report/reports/product_purchased.xls')) {
         unlink(DIR_APPLICATION . 'controller/report/reports/product_purchased.xls');
     }
     $name_file = DIR_APPLICATION . 'controller/report/reports/product_purchased.xls';
     if (isset($this->request->get['filter_date_start'])) {
         $filter_date_start = $this->request->get['filter_date_start'];
     } else {
         $filter_date_start = '';
     }
     if (isset($this->request->get['filter_date_end'])) {
         $filter_date_end = $this->request->get['filter_date_end'];
     } else {
         $filter_date_end = '';
     }
     if (isset($this->request->get['filter_payment_code'])) {
         $filter_payment_code = $this->request->get['filter_payment_code'];
     } else {
         $filter_payment_code = '';
     }
     if (isset($this->request->get['filter_shipping_method'])) {
         $filter_shipping_method = $this->request->get['filter_shipping_method'];
     } else {
         $filter_shipping_method = '';
     }
     if (isset($this->request->get['filter_payment_method'])) {
         $filter_payment_method = $this->request->get['filter_payment_method'];
     } else {
         $filter_payment_method = '';
     }
     if (isset($this->request->get['filter_type_date'])) {
         $filter_type_date = $this->request->get['filter_type_date'];
     } else {
         $filter_type_date = '';
     }
     if (isset($this->request->get['filter_order_status_id'])) {
         $filter_order_status_id = $this->request->get['filter_order_status_id'];
     } else {
         $filter_order_status_id = 0;
     }
     $filter_data = array('filter_date_start' => $filter_date_start, 'filter_date_end' => $filter_date_end, 'filter_payment_code' => $filter_payment_code, 'filter_payment_method' => $filter_payment_method, 'filter_shipping_method' => $filter_shipping_method, 'filter_order_status_id' => $filter_order_status_id, 'filter_type_date' => $filter_type_date);
     $results = $this->model_report_product->getPurchased($filter_data);
     $excel = new ExcelWriter($name_file);
     if (count($results) > 0) {
         $myArr = array('Nome do produto', 'Modelo', 'Quantidade', 'Preço de Custo', 'Total');
         $excel->writeLine($myArr, 'title');
         foreach ($results as $result) {
             $myArr = array($result['name'], $result['model'], $result['quantity'], $this->currency->format($result['cost_price'], $this->config->get('config_currency')), $this->currency->format($result['total'], $this->config->get('config_currency')));
             $excel->writeLine($myArr, 'rows');
         }
         $excel->close();
         $this->response->redirect(HTTPS_SERVER . 'controller/report/reports/product_purchased.xls');
     } else {
         $this->response->redirect($this->url->link('report/product_purchased', 'warning=Nenhum registro foi encontrado&token=' . $this->session->data['token'] . $url, 'SSL'));
     }
 }
开发者ID:luanmpereira,项目名称:default-store,代码行数:81,代码来源:product_purchased.php

示例12: export

 public function export()
 {
     if ($this->Session->check('id')) {
         App::import('Vendor', 'ExcelWriter');
         $date = date("Y-m-d");
         $this->loadModel('Sticker');
         $this->loadModel('Categorie');
         $cond = "Sticker.id=Favsticker.sticker_id";
         $conditions = "GROUP BY Favsticker.sticker_id HAVING count(Favsticker.sticker_id) >= 2";
         $data = $this->Sticker->find('all', array('fields' => array('Sticker.id', 'Sticker.name', 'Sticker.image', 'Sticker.type_id', 'Sticker.category_id', 'Sticker.created', 'Sticker.modified'), 'joins' => array(array('table' => 'favstickers', 'alias' => 'Favsticker', 'type' => 'inner', 'conditions' => $cond)), 'conditions' => $conditions));
         foreach ($data as $key => $value) {
             $f = $this->Categorie->find('first', array('fields' => 'name', 'conditions' => array('id' => $value['Sticker']['category_id'])));
             $data[$key]['Sticker']['category_name'] = $f['Categorie']['name'];
         }
         $fileName = WWW_ROOT . "files" . DS . "Excel" . DS . "PopularSticker_Report" . "_" . $date . ".xls";
         $this->autoRender = false;
         $excel = new ExcelWriter($fileName);
         $excel->writeCol("S. No.");
         $excel->writeCol("Name");
         $excel->writeCol("Category");
         $excel->writeCol("Type");
         $excel->writeCol("Created");
         $excel->writeCol("Modified");
         foreach ($data as $key => $value) {
             if ($key == 0) {
                 $excel->writeLine(array(), array());
             }
             $excel->writeCol($key + 1, array());
             $excel->writeCol(ucfirst($value['Sticker']['name']));
             $excel->writeCol(ucfirst($value['Sticker']['category_name']));
             if ($value['Sticker']['type_id'] == 1) {
                 $excel->writeCol("Free");
             } else {
                 $excel->writeCol("Paid");
             }
             $excel->writeCol(date("F j, Y, g:i A", strtotime($value['Sticker']['created'])));
             $excel->writeCol(date("F j, Y, g:i A", strtotime($value['Sticker']['modified'])));
             $excel->writeLine(array(), array());
         }
         $this->redirect(DS . "files" . DS . "Excel" . DS . "PopularSticker_Report" . "_" . $date . ".xls");
     } else {
         $this->redirect(array('controller' => 'Users', 'action' => 'index'));
     }
 }
开发者ID:89itworld,项目名称:digisticker,代码行数:44,代码来源:DashboardController.php

示例13: write_xls

function write_xls($sql)
{
    $sql = str_replace('\\', '', $sql);
    $excel = new ExcelWriter('excel_report/' . date('m_d_Y_s') . '_feedback_report.xls');
    $file_name = date('m_d_Y_s') . '_feedback_report.xls';
    if ($excel == false) {
        echo $excel->error;
    }
    $result1 = mysql_query($sql) or die(mysql_error());
    $arr1 = mysql_fetch_array($result1);
    if (mysql_num_rows($result1) != 0) {
        $myArr = array("Branch", branch_name($arr1['b_id']), "", "Semester", sem_name($arr1['sem_id']));
        $excel->writeLine($myArr);
        $myArr = array("", "", "", "", "", "");
        $excel->writeLine($myArr);
        $myArr = array("Batch", batch_name($arr1['batch_id']), "", "Division", division_name($arr1['division_id']), "", "Feedback No", $arr1['feedback_no']);
        $excel->writeLine($myArr);
        $myArr = array("", "", "", "", "", "");
        $excel->writeLine($myArr);
        $myArr = array("Faculty Name:", faculty_name($arr1['f_id']), "", "Subject:", subject_name($arr1['sub_id']));
        $excel->writeLine($myArr);
        $myArr = array("", "", "", "", "", "");
        $excel->writeLine($myArr);
        $myArr = array("", "", "", "", "", "");
        $excel->writeLine($myArr);
        /*$myArr=array("Remark(s)");//"Ans1","Ans2","Ans3","Ans4","Ans5","Ans6","Ans7","Ans8","Ans9"
        		$excel->writeLine($myArr);
        		$myArr=array("","","","","","");
        		$excel->writeLine($myArr);*/
        $myArr = array("Ans1", "Ans2", "Ans3", "Ans4", "Ans5", "Ans6", "Ans7", "Ans8", "Ans9", "Remark");
        $excel->writeLine($myArr);
        $result = mysql_query($sql) or die(mysql_error());
        $total_ids = "0";
        $r_id = 1;
        while ($arr = mysql_fetch_array($result)) {
            /*if($arr['remark']!=NULL)
            		{	
            			$myArr=array(strtolower($arr['remark']));				
            			$excel->writeLine($myArr);
            			$r_id++;			
            		}*/
            $myArr = array($arr['ans1'], $arr['ans2'], $arr['ans3'], $arr['ans4'], $arr['ans5'], $arr['ans6'], $arr['ans7'], $arr['ans8'], $arr['ans9'], $arr['remark']);
            $excel->writeLine($myArr);
            $r_id++;
        }
        $myArr = array("", "", "", "", "", "");
        $excel->writeLine($myArr);
        $excel->close();
        return $file_name;
    } else {
        echo '<p align=center>No Record Found!.</p>';
    }
}
开发者ID:bangkay,项目名称:Capstone,代码行数:53,代码来源:feedback.php

示例14: verifica_permissao

require "../includes/funcoes.php";
require "../includes/global.inc.php";
require '../includes/dias_uteis.php';
require "../includes/geraexcel/excelwriter.inc.php";
$permissao = verifica_permissao('Franquia', $controle_id_departamento_p, $controle_id_departamento_s);
if ($permissao == 'FALSE' or $controle_id_empresa != '1') {
    echo '<br><br><strong>Você não tem permissão para acessar essa página</strong>';
    exit;
}
pt_register('POST', 'id_empresa');
pt_register('POST', 'crescimento');
$empresaDAO = new EmpresaDAO();
$emp = $empresaDAO->selectPorId($id_empresa);
$arquivoDiretorio = "./exporta/" . $controle_id_usuario . ".xls";
$nomeArquivo = $controle_id_usuario . ".xls";
$excel = new ExcelWriter($arquivoDiretorio);
if ($excel == false) {
    echo $excel->error;
    exit;
}
//Escreve o nome dos campos de uma tabela
$linha_arq = 'Relatorio de Planejamento Econômico Financeiro - Franquia ' . $emp->fantasia . ' - Taxa de Crescimento de ' . $crescimento . '%;';
$myArr = explode(';', $linha_arq);
$excel->writeLine($myArr);
$linha_arq = 'ANO I;Operacionais;';
$myArr = explode(';', $linha_arq);
$excel->writeLine($myArr);
#inicio do ano I
$linha_arq = ';1;2;3;4;5;6;7;8;9;10;11;12';
$myArr = explode(';', $linha_arq);
$excel->writeLine($myArr);
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:31,代码来源:gera_viabilidade.php

示例15: builtXLS

 public function builtXLS()
 {
     $this->load->language('sale/customer');
     $this->load->model('sale/customer');
     $url = '';
     if (isset($this->request->get['filter_name'])) {
         $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
     }
     if (isset($this->request->get['filter_email'])) {
         $url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
     }
     if (isset($this->request->get['filter_customer_group_id'])) {
         $url .= '&filter_customer_group_id=' . $this->request->get['filter_customer_group_id'];
     }
     if (isset($this->request->get['filter_status'])) {
         $url .= '&filter_status=' . $this->request->get['filter_status'];
     }
     if (isset($this->request->get['filter_birthday'])) {
         $url .= '&filter_birthday=' . $this->request->get['filter_birthday'];
     }
     if (isset($this->request->get['filter_ip'])) {
         $url .= '&filter_ip=' . $this->request->get['filter_ip'];
     }
     if (isset($this->request->get['filter_date_added'])) {
         $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
     }
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (isset($this->request->get['pdv'])) {
         $url .= '&pdv=' . $this->request->get['pdv'];
     }
     require_once DIR_SYSTEM . "library/excel/excelwriter.inc.php";
     $name_file = DIR_APPLICATION . 'controller/sale/customer_report/customer_report.xls';
     if (isset($this->request->get['filter_name'])) {
         $filter_name = $this->request->get['filter_name'];
     } else {
         $filter_name = null;
     }
     if (isset($this->request->get['filter_email'])) {
         $filter_email = $this->request->get['filter_email'];
     } else {
         $filter_email = null;
     }
     if (isset($this->request->get['filter_customer_group_id'])) {
         $filter_customer_group_id = $this->request->get['filter_customer_group_id'];
     } else {
         $filter_customer_group_id = null;
     }
     if (isset($this->request->get['filter_status'])) {
         $filter_status = $this->request->get['filter_status'];
     } else {
         $filter_status = null;
     }
     if (isset($this->request->get['filter_birthday'])) {
         $filter_birthday = $this->request->get['filter_birthday'];
     } else {
         $filter_birthday = null;
     }
     if (isset($this->request->get['filter_ip'])) {
         $filter_ip = $this->request->get['filter_ip'];
     } else {
         $filter_ip = null;
     }
     if (isset($this->request->get['filter_date_added'])) {
         $filter_date_added = $this->request->get['filter_date_added'];
     } else {
         $filter_date_added = null;
     }
     if (isset($this->request->get['sort'])) {
         $sort = $this->request->get['sort'];
     } else {
         $sort = 'name';
     }
     if (isset($this->request->get['order'])) {
         $order = $this->request->get['order'];
     } else {
         $order = 'ASC';
     }
     $filter_data = array('filter_name' => $filter_name, 'filter_email' => $filter_email, 'filter_customer_group_id' => $filter_customer_group_id, 'filter_status' => $filter_status, 'filter_birthday' => $filter_birthday, 'filter_date_added' => $filter_date_added, 'filter_ip' => $filter_ip, 'sort' => $sort, 'order' => $order);
     $results = $this->model_sale_customer->getCustomers($filter_data);
     $excel = new ExcelWriter($name_file);
     if (count($results) > 0) {
         $myArr = array('Nome', 'Email', 'Sexo', 'Data de Aniversário', 'Data de Cadastro');
         $excel->writeLine($myArr, 'title');
         foreach ($results as $result) {
             if ($result['sex'] == 'F') {
                 $sex = 'Mulher';
             } else {
                 $sex = 'Homem';
             }
             $myArr = array($result['firstname'] . ' ' . $result['lastname'], $result['email'], $sex, date('d/m/Y', strtotime($result['birthday'])), date('d/m/Y H:i:s', strtotime($result['date_added'])));
             $excel->writeLine($myArr, 'rows');
         }
//.........这里部分代码省略.........
开发者ID:luanmpereira,项目名称:default-store,代码行数:101,代码来源:customer.php


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