Esempio n. 1
1
    $sql .= "where tgl_update>= '" . balikTgl($_POST["frm"]["tgl_awal"]) . " 00:00:00' and tgl_update<='" . balikTgl($_POST["frm"]["tgl_akhir"]) . " 23:59:59'";
    $dataArray = $db_function->selectAllRows($sql);
    $row++;
    xlsWriteLabel($row, 0, "[debitur_trail]");
    $row++;
    foreach ($judulArrayTrail as $col => $data) {
        xlsWriteLabel($row, $col, $data);
    }
    $row++;
    foreach ($dataArray as $data) {
        foreach ($judulArrayTrail as $col => $judul) {
            $kata = $data[$col];
            if (strlen($kata) > 1000) {
                $kata = substr($kata, 0, 1000);
            }
            xlsWriteLabel($row, $col, $kata);
        }
        $row++;
    }
    xlsEOF();
    exit;
}
function xlsBOF()
{
    echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
    return;
}
function xlsEOF()
{
    echo pack("ss", 0xa, 0x0);
    return;
Esempio n. 2
0
$tablehead = 1;
//baris berapa data mulai di tulis
$tablebody = 2;
//penulisan 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=" . $namaFile . "");
header("Content-Transfer-Encoding: binary ");
xlsBOF();
//xlsWriteLabel(0,0,$judul);
$kolomhead = 0;
xlsWriteLabel($tablehead, $kolomhead++, "ID");
xlsWriteLabel($tablehead, $kolomhead++, "NAK");
xlsWriteLabel($tablehead, $kolomhead++, "NAMA");
xlsWriteLabel($tablehead, $kolomhead++, "NIK");
while ($data = mysql_fetch_array($result)) {
    $kolombody = 0;
    //gunakan xlsWriteNumber untuk penulisan nomor dan xlsWriteLabel untuk penulisan string
    xlsWriteNumber($tablebody, $kolombody++, $data['id']);
    xlsWriteLabel($tablebody, $kolombody++, $data['nak']);
    xlsWriteLabel($tablebody, $kolombody++, $data['nama']);
    xlsWriteLabel($tablebody, $kolombody++, $data['nik']);
    $tablebody++;
    //$nourut++;
}
xlsEOF();
exit;
Esempio n. 3
0
xlsBOF();

/*
Make a top line on your excel sheet at line 1 (starting at 0).
The first number is the row number and the second number is the column, both are start at '0'
*/

xlsWriteLabel(0,0,"Title"); //Top Title

// Make column labels. (at line 3)
xlsWriteLabel(2,0,"Row Name"); // Row Name




$xlsRow = 3;

// Put data records from mysql by while loop.
while($row=mysql_fetch_array($result)){


    xlsWriteLabel($xlsRow,0,$row['']); //Each DB Row




    $xlsRow++;
}
xlsEOF();
exit();
?>
Esempio n. 4
0
function print_expenselist_excel($array, $groupid)
{
    // http://www.appservnetwork.com/modules.php?name=News&file=article&sid=8
    $members = get_groupmembers($groupid);
    $mcount = count($members);
    // construct array to hold all expense id's per member
    for ($j = 0; $j < $mcount; $j++) {
        $expids[$members[$j]['user_id']] = get_user_expenses_idonly($members[$j]['user_id']);
    }
    // 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=test.xls ");
    header("Content-Transfer-Encoding: binary ");
    // XLS Data Cell
    $result = mysql_db_query($dbname, "select id,prename,name,sname,grade from appdata where course='{$courseid}' and sec='{$section}'");
    xlsBOF();
    xlsWriteLabel(0, 0, "ID");
    xlsWriteLabel(0, 1, "Date");
    xlsWriteLabel(0, 2, "Type");
    xlsWriteLabel(0, 3, "Description");
    xlsWriteLabel(0, 4, "Amount");
    xlsWriteLabel(0, 5, "Paid by");
    for ($j = 0; $j < $mcount; $j++) {
        if (!empty($members[$j]['username'])) {
            $uname = " (" . $members[$j]['username'] . ")";
        } else {
            $uname = "";
        }
        xlsWriteLabel(0, 6 + $j, $members[$j]['realname'] . $uname);
    }
    $xlsRow = 1;
    $count = count($array);
    for ($i = 0; $i < $count; $i++) {
        if (!empty($array[$i]['username'])) {
            $uname = " (" . $array[$i]['username'] . ")";
        } else {
            $uname = "";
        }
        xlsWriteNumber($xlsRow, 0, $array[$i]['expense_id']);
        xlsWriteLabel($xlsRow, 1, $array[$i]['date']);
        xlsWriteLabel($xlsRow, 2, $array[$i]['type_name']);
        xlsWriteLabel($xlsRow, 3, $array[$i]['description']);
        xlsWriteNumber($xlsRow, 4, $array[$i]['amount']);
        xlsWriteLabel($xlsRow, 5, $array[$i]['realname'] . $uname);
        $x = 0;
        for ($j = 0; $j < $mcount; $j++) {
            // check number of participants for the expense
            if (in_array($array[$i]['expense_id'], $expids[$members[$j]['user_id']])) {
                $x += 1;
            }
        }
        for ($j = 0; $j < $mcount; $j++) {
            // write expense/person for each member
            if (in_array($array[$i]['expense_id'], $expids[$members[$j]['user_id']])) {
                xlsWriteNumber($xlsRow, 6 + $j, number_format($array[$i]['amount'] / $x, DECIMALS, DSEP, TSEP));
            } else {
                xlsWriteLabel($xlsRow, 6 + $j, "");
            }
        }
        $xlsRow++;
    }
    xlsEOF();
    exit;
}
mysql_connect("localhost", "root", "");
mysql_select_db("sms");
$keyword = $_GET['keyword'];
// query menampilkan semua data
$query = "\nSELECT playsms_featureSurvey.keyword, \n        playsms_tblSMSIncoming.in_sender, \n        playsms_tblSMSIncoming.in_message, \n        playsms_tblSMSIncoming.in_datetime\nFROM playsms_featureSurvey, playsms_tblSMSIncoming\nWHERE playsms_featureSurvey.keyword = playsms_tblSMSIncoming.in_keyword AND \n         playsms_featureSurvey.keyword = '{$keyword}'\nORDER BY playsms_tblSMSIncoming.in_datetime DESC\n\n";
$hasil = mysql_query($query);
// nilai awal untuk baris cell
$noBarisCell = 1;
// nilai awal untuk nomor urut data
$noData = 1;
while ($data = mysql_fetch_array($hasil)) {
    // menampilkan no. urut data
    xlsWriteNumber($noBarisCell, 0, $noData);
    // menampilkan data nim
    xlsWriteLabel($noBarisCell, 1, $data['keyword']);
    // menampilkan data nama mahasiswa
    xlsWriteLabel($noBarisCell, 2, $data['in_sender']);
    // menampilkan data nilai
    xlsWriteLabel($noBarisCell, 3, $data['in_message']);
    // menampilkan status kelulusan
    xlsWriteLabel($noBarisCell, 4, $data['in_datetime']);
    // increment untuk no. baris cell dan no. urut data
    $noBarisCell++;
    $noData++;
}
// memanggil function penanda akhir file excel
xlsEOF();
exit;
?>

Esempio n. 6
0
    xlsWriteLabel(0, 10, mb_convert_encoding("聯絡人", "Big5", "UTF-8"));
    xlsWriteLabel(0, 11, mb_convert_encoding("電話", "Big5", "UTF-8"));
    while ($ly = @mysql_fetch_array($q_mid)) {
        $a++;
        xlsWriteNumber($a, 0, $a);
        xlsWriteLabel($a, 1, $ly[mid]);
        xlsWriteLabel($a, 2, $ly[tid]);
        xlsWriteLabel($a, 3, $ly[midf]);
        xlsWriteLabel($a, 4, $ly[tidf]);
        xlsWriteLabel($a, 5, $ly[mcc]);
        xlsWriteLabel($a, 6, mb_convert_encoding($ly[sob], "Big5", "UTF-8"));
        xlsWriteLabel($a, 7, mb_convert_encoding($ly[webname], "Big5", "UTF-8"));
        xlsWriteLabel($a, 8, mb_convert_encoding($ly[weburl], "Big5", "UTF-8"));
        xlsWriteLabel($a, 9, $ly[comid]);
        xlsWriteLabel($a, 10, mb_convert_encoding($ly[username], "Big5", "UTF-8"));
        xlsWriteLabel($a, 11, mb_convert_encoding($ly[phone], "Big5", "UTF-8"));
    }
    xlsEOF();
    exit;
} else {
    if ($btm == '匯出csv') {
        $Csv_fileName = "taishin_mid_{$hohsn}.csv";
        $fpw = mb_convert_encoding("序,mid,tid,分期mid,分期tid,行業別,營業項目,帳單名稱,網址,統編/身份證,聯絡人,電話", "Big5", "UTF-8") . "\r\n";
        while ($ly = @mysql_fetch_array($q_mid)) {
            $a++;
            $body = sprintf("%03d", $a) . ',' . $ly[mid] . ',' . $ly[tid] . ',' . $ly[midf] . ',' . $ly[tidf] . ',' . $ly[mcc] . ',' . $ly[sob] . ',' . $ly[webname] . ',' . $ly[weburl] . ',' . $ly[comid] . ',' . $ly[username] . ',' . $ly[phone];
            $fpw .= mb_convert_encoding($body, "Big5", "UTF-8") . "\r\n";
        }
        header("Content-disposition: attachment; filename={$Csv_fileName}");
        header("Content-Type: application/save-as");
        echo $fpw;
Esempio n. 7
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "users.xls";
     $judul = "users";
     $tablehead = 2;
     $tablebody = 3;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     xlsWriteLabel(0, 0, $judul);
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "no");
     xlsWriteLabel($tablehead, $kolomhead++, "ip_address");
     xlsWriteLabel($tablehead, $kolomhead++, "username");
     xlsWriteLabel($tablehead, $kolomhead++, "password");
     xlsWriteLabel($tablehead, $kolomhead++, "salt");
     xlsWriteLabel($tablehead, $kolomhead++, "email");
     xlsWriteLabel($tablehead, $kolomhead++, "activation_code");
     xlsWriteLabel($tablehead, $kolomhead++, "forgotten_password_code");
     xlsWriteLabel($tablehead, $kolomhead++, "forgotten_password_time");
     xlsWriteLabel($tablehead, $kolomhead++, "remember_code");
     xlsWriteLabel($tablehead, $kolomhead++, "created_on");
     xlsWriteLabel($tablehead, $kolomhead++, "last_login");
     xlsWriteLabel($tablehead, $kolomhead++, "active");
     xlsWriteLabel($tablehead, $kolomhead++, "sex");
     xlsWriteLabel($tablehead, $kolomhead++, "birth_date");
     xlsWriteLabel($tablehead, $kolomhead++, "yxdm");
     xlsWriteLabel($tablehead, $kolomhead++, "jszw");
     xlsWriteLabel($tablehead, $kolomhead++, "jszc");
     xlsWriteLabel($tablehead, $kolomhead++, "jsxl");
     xlsWriteLabel($tablehead, $kolomhead++, "phone");
     xlsWriteLabel($tablehead, $kolomhead++, "jsinfo");
     foreach ($this->users_model->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->ip_address);
         xlsWriteLabel($tablebody, $kolombody++, $data->username);
         xlsWriteLabel($tablebody, $kolombody++, $data->password);
         xlsWriteLabel($tablebody, $kolombody++, $data->salt);
         xlsWriteLabel($tablebody, $kolombody++, $data->email);
         xlsWriteLabel($tablebody, $kolombody++, $data->activation_code);
         xlsWriteLabel($tablebody, $kolombody++, $data->forgotten_password_code);
         xlsWriteNumber($tablebody, $kolombody++, $data->forgotten_password_time);
         xlsWriteLabel($tablebody, $kolombody++, $data->remember_code);
         xlsWriteNumber($tablebody, $kolombody++, $data->created_on);
         xlsWriteNumber($tablebody, $kolombody++, $data->last_login);
         xlsWriteLabel($tablebody, $kolombody++, $data->active);
         xlsWriteLabel($tablebody, $kolombody++, $data->sex);
         xlsWriteLabel($tablebody, $kolombody++, $data->birth_date);
         xlsWriteLabel($tablebody, $kolombody++, $data->yxdm);
         xlsWriteLabel($tablebody, $kolombody++, $data->jszw);
         xlsWriteLabel($tablebody, $kolombody++, $data->jszc);
         xlsWriteLabel($tablebody, $kolombody++, $data->jsxl);
         xlsWriteNumber($tablebody, $kolombody++, $data->phone);
         xlsWriteLabel($tablebody, $kolombody++, $data->jsinfo);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
{
    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;
}
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=Mailing-List.xls");
header("Content-Transfer-Encoding: binary");
xlsBOF();
xlsWriteLabel(0, 0, "#");
xlsWriteLabel(0, 1, "Email");
$query = mysql_query("SELECT * FROM bow_mailinglist_tbl ORDER BY email_ad ASC");
$i = 0;
while ($rows = mysql_fetch_assoc($query)) {
    $i++;
    xlsWriteLabel($i, 0, $i);
    xlsWriteLabel($i, 1, $rows['email_ad']);
}
xlsEOF();
Esempio n. 9
0
xlsWriteLabel(0, 6, "Note");
xlsWriteLabel(0, 7, "Economico");
$xlsRow = 1;
$tot_economico = 0;
foreach ($r as $key => $field) {
    if ($field['n_pdl'] > "1") {
        $economico = floatval($field['econ']) * floatval($field['n_pdl']);
        $compenso = floatval($field['prz']) * floatval($field['n_pdl']);
    } else {
        $economico = floatval($field['econ']);
        $compenso = floatval($field['prz']);
    }
    xlsWriteLabel($xlsRow, 0, $field['n_call']);
    xlsWriteLabel($xlsRow, 1, Inverti_Data($field['data_att']));
    xlsWriteLabel($xlsRow, 2, $field['cliente']);
    xlsWriteLabel($xlsRow, 3, $field['Comune'] . " (" . $field['Targa'] . ")");
    xlsWriteLabel($xlsRow, 4, $field['tecnico']);
    xlsWriteLabel($xlsRow, 5, $field['tipo']);
    xlsWriteLabel($xlsRow, 6, $field['note_call']);
    xlsWriteNumber($xlsRow, 7, sprintf("%.2f", $economico));
    $tot_economico += $economico;
    $xlsRow++;
}
xlsWriteLabel($xlsRow, 0, "Totale: ");
xlsWriteNumber($xlsRow, 1, sprintf("%.2f", $tot_economico));
xlsWriteLabel($xlsRow + 1, 0, "Aaaaaa: ");
xlsWriteNumber($xlsRow + 1, 1, "579,33");
xlsWriteLabel($xlsRow + 2, 0, "float con virgola: ");
xlsWriteNumber($xlsRow + 2, 1, sprintf("%,2f", $tot_economico));
xlsEOF();
exit;
Esempio n. 10
0
function do_invoice_download()
{
    global $smarty;
    global $rpcpbx;
    global $friconf;
    $rpcres = sendrequest($rpcpbx->base_dbquery("select src,dst,calldate,billsec,cost from billinginvoice where calldate >= '" . $_REQUEST['year'] . "-" . $_REQUEST['month'] . "-01 00:00:00' and calldate <= '" . $_REQUEST['year'] . "-" . $_REQUEST['month'] . "-31 23:59:59' order by calldate desc"), 0);
    #CSV FORMAT
    if ($_REQUEST['format'] == 'csv') {
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        Header("Content-Type: application/vnd.ms-excel");
        Header("Content-Disposition: attachment; filename=billing_invoice.csv");
        header("Content-Transfer-Encoding: binary ");
        echo "caller,called,calldate,billsec,cost\n";
        foreach ($rpcres['result_array'] as $each) {
            echo $each['src'] . ',' . $each['dst'] . ',' . $each['calldate'] . ',' . $each['billsec'] . ',' . $each['cost'] . ',' . "\n";
        }
        exit;
    } else {
        include "../include/exportxls.php";
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        Header("Content-Type: application/vnd.ms-excel");
        Header("Content-Disposition: attachment; filename=billing_invoice.xls");
        header("Content-Transfer-Encoding: binary ");
        xlsBOF();
        xlsWriteLabel(0, 0, "src");
        xlsWriteLabel(0, 1, "dst");
        xlsWriteLabel(0, 2, "calldate");
        xlsWriteLabel(0, 3, "billsec");
        xlsWriteLabel(0, 4, "cost");
        $xlsRow = 1;
        foreach ($rpcres['result_array'] as $each) {
            xlsWriteLabel($xlsRow, 0, $each['src']);
            xlsWriteLabel($xlsRow, 1, $each['dst']);
            xlsWriteLabel($xlsRow, 2, $each['calldate']);
            xlsWriteLabel($xlsRow, 3, $each['billsec']);
            xlsWriteLabel($xlsRow, 4, $each['cost']);
            $xlsRow++;
        }
        xlsEOF();
        exit;
    }
    exit;
}
Esempio n. 11
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "alumnos.xls";
     $judul = "alumnos";
     $tablehead = 2;
     $tablebody = 3;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     xlsWriteLabel(0, 0, $judul);
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "no");
     xlsWriteLabel($tablehead, $kolomhead++, "NOMBRE_ALUMNO");
     xlsWriteLabel($tablehead, $kolomhead++, "APELLIDO_PATERNO");
     xlsWriteLabel($tablehead, $kolomhead++, "APELLIDO_MATERNO");
     xlsWriteLabel($tablehead, $kolomhead++, "EMAIL");
     xlsWriteLabel($tablehead, $kolomhead++, "TELEFONO");
     xlsWriteLabel($tablehead, $kolomhead++, "DIRECCION");
     xlsWriteLabel($tablehead, $kolomhead++, "SEXO");
     xlsWriteLabel($tablehead, $kolomhead++, "FECHA_NACIMIENTO");
     xlsWriteLabel($tablehead, $kolomhead++, "DNI");
     xlsWriteLabel($tablehead, $kolomhead++, "AÑO_INGRESO");
     xlsWriteLabel($tablehead, $kolomhead++, "SEMESTRE_INGRESO");
     xlsWriteLabel($tablehead, $kolomhead++, "CARRERA_PROFESIONAL");
     xlsWriteLabel($tablehead, $kolomhead++, "TURNO");
     foreach ($this->model_alumnos->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->NOMBRE_ALUMNO);
         xlsWriteLabel($tablebody, $kolombody++, $data->APELLIDO_PATERNO);
         xlsWriteLabel($tablebody, $kolombody++, $data->APELLIDO_MATERNO);
         xlsWriteLabel($tablebody, $kolombody++, $data->EMAIL);
         xlsWriteLabel($tablebody, $kolombody++, $data->TELEFONO);
         xlsWriteLabel($tablebody, $kolombody++, $data->DIRECCION);
         xlsWriteLabel($tablebody, $kolombody++, $data->SEXO);
         xlsWriteNumber($tablebody, $kolombody++, $data->FECHA_NACIMIENTO);
         xlsWriteNumber($tablebody, $kolombody++, $data->DNI);
         xlsWriteNumber($tablebody, $kolombody++, $data->AÑO_INGRESO);
         xlsWriteLabel($tablebody, $kolombody++, $data->SEMESTRE_INGRESO);
         xlsWriteLabel($tablebody, $kolombody++, $data->CARRERA_PROFESIONAL);
         xlsWriteLabel($tablebody, $kolombody++, $data->TURNO);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
Esempio n. 12
0
    xlsWriteLabel(0, 12, mb_convert_encoding("次特店網址", "Big5", "UTF-8"));
    while ($ly = @mysql_fetch_array($q_mid)) {
        $a++;
        xlsWriteNumber($a, 0, $a);
        xlsWriteLabel($a, 1, $ly[mid]);
        xlsWriteLabel($a, 2, $ly[tid]);
        xlsWriteLabel($a, 3, mb_convert_encoding($ly[day_3d], "Big5", "UTF-8"));
        xlsWriteLabel($a, 4, mb_convert_encoding($ly[zip], "Big5", "UTF-8"));
        xlsWriteLabel($a, 5, $ly[mcc]);
        xlsWriteLabel($a, 6, mb_convert_encoding($ly[webname], "Big5", "UTF-8"));
        xlsWriteLabel($a, 7, $ly[ints]);
        xlsWriteLabel($a, 8, $ly[red]);
        xlsWriteLabel($a, 9, $ly[yes_3d]);
        xlsWriteLabel($a, 10, $ly[comid]);
        xlsWriteLabel($a, 11, $ly[bossid]);
        xlsWriteLabel($a, 12, $ly[weburl]);
    }
    xlsEOF();
    exit;
} else {
    if ($btm == '匯出csv') {
        $Csv_fileName = "taishin_mid_{$hohsn}.csv";
        $fpw = mb_convert_encoding("特店數,次特店代號,端末機代號,3D生效日,區域別,MCC CODE,招牌/對外名稱,分期,紅利,3D,次特店統編,負責人ID,次特店網址", "Big5", "UTF-8") . "\r\n";
        while ($ly = @mysql_fetch_array($q_mid)) {
            $a++;
            $body = $a . ',' . $ly[mid] . ',' . $ly[tid] . ',' . $ly[day_3d] . ',' . $ly[zip] . ',' . $ly[mcc] . ',' . $ly[webname] . ',' . $ly[ints] . ',' . $ly[red] . ',' . $ly[yes_3d] . ',' . $ly[comid] . ',' . $ly[bossid] . ',' . $ly[weburl];
            $fpw .= mb_convert_encoding($body, "Big5", "UTF-8") . "\r\n";
        }
        header("Content-disposition: attachment; filename={$Csv_fileName}");
        header("Content-Type: application/save-as");
        echo $fpw;
Esempio n. 13
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "guru.xls";
     $judul = "guru";
     $tablehead = 0;
     $tablebody = 1;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "No");
     xlsWriteLabel($tablehead, $kolomhead++, "Nuptk");
     xlsWriteLabel($tablehead, $kolomhead++, "Nama Guru");
     xlsWriteLabel($tablehead, $kolomhead++, "Tmp Lahir");
     xlsWriteLabel($tablehead, $kolomhead++, "Tgl Lahir");
     xlsWriteLabel($tablehead, $kolomhead++, "Golongan");
     xlsWriteLabel($tablehead, $kolomhead++, "Pend Guru");
     xlsWriteLabel($tablehead, $kolomhead++, "Id Matpel");
     foreach ($this->Guru_model->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->nuptk);
         xlsWriteLabel($tablebody, $kolombody++, $data->nama_guru);
         xlsWriteLabel($tablebody, $kolombody++, $data->tmp_lahir);
         xlsWriteLabel($tablebody, $kolombody++, $data->tgl_lahir);
         xlsWriteLabel($tablebody, $kolombody++, $data->golongan);
         xlsWriteLabel($tablebody, $kolombody++, $data->pend_guru);
         xlsWriteNumber($tablebody, $kolombody++, $data->id_matpel);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
Esempio n. 14
0
    $row = 0;
    // This tells us that we are on the first row
    $first = true;
    // Ok we are on the first row
    // lets make some headers of sorts
    if ($first) {
        $qcol = $q[$row];
        foreach ($qcol as $k => $v) {
            // take the key and make label
            // make it uppper case and replace _ with ' '
            xlsWriteLabel($row, $col, strtoupper(ereg_replace("_", " ", $v)));
            $col++;
        }
        // prepare for the first real data row
        $col = 0;
        $first = false;
    }
    for ($i = 1; $i < count($q); $i++) {
        $qcol = $q[$i];
        // go through the data
        foreach ($qcol as $k => $v) {
            // write it out
            xlsWriteLabel($i, $col, $v);
            $col++;
        }
        // reset col and goto next row
        $col = 0;
    }
    xlsEOF();
    exit;
}
Esempio n. 15
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "jadwal.xls";
     $judul = "jadwal";
     $tablehead = 0;
     $tablebody = 1;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "No");
     xlsWriteLabel($tablehead, $kolomhead++, "Id Tes");
     xlsWriteLabel($tablehead, $kolomhead++, "Id Kelas");
     xlsWriteLabel($tablehead, $kolomhead++, "Tgl Tes");
     foreach ($this->Jadwal_model->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteNumber($tablebody, $kolombody++, $data->id_tes);
         xlsWriteNumber($tablebody, $kolombody++, $data->id_kelas);
         xlsWriteLabel($tablebody, $kolombody++, $data->tgl_tes);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
Esempio n. 16
0
header("Content-Transfer-Encoding: binary ");
xlsBOF();
xlsWriteHeader(0, 0, "System Name");
xlsWriteHeader(0, 1, "Usage");
xlsWriteHeader(0, 2, "Model");
xlsWriteHeader(0, 3, "Location");
xlsWriteHeader(0, 4, "Serial Number");
xlsWriteHeader(0, 5, "RFID Tag");
xlsWriteHeader(0, 6, "Asset Number");
xlsWriteHeader(0, 7, "Comments");
//    xlsWriteHeader(1,0,"");
//    xlsWriteHeader(1,1,"");
//    xlsWriteHeader(1,2,"");
//    xlsWriteHeader(1,3,"");
//    xlsWriteHeader(1,4,"");
//    xlsWriteHeader(1,5,"");
//    xlsWriteHeader(1,6,"");
//    xlsWriteHeader(1,7,"");
$xlsRow = 2;
while ($row = mysql_fetch_array($result)) {
    xlsWriteLabel($xlsRow, 0, $row['system_name']);
    xlsWriteLabel($xlsRow, 1, $row['system_usage']);
    xlsWriteLabel($xlsRow, 2, $row['system_model']);
    xlsWriteLabel($xlsRow, 3, $row['data_location_id']);
    xlsWriteLabel($xlsRow, 4, $row['system_serial_number']);
    xlsWriteLabel($xlsRow, 5, $row['system_rfid_tag']);
    xlsWriteLabel($xlsRow, 6, $row['system_asset_number']);
    xlsWriteLabel($xlsRow, 7, $row['comments']);
    $xlsRow++;
}
xlsEOF();
Esempio n. 17
0
    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=Name_wise.xls");
    header("Content-Transfer-Encoding: binary ");
    xlsBOF();
    xlsWriteLabel(0, 0, "Name");
    xlsWriteLabel(0, 1, "PSRN");
    xlsWriteLabel(0, 2, "Book Title");
    xlsWriteLabel(0, 3, "Author");
    xlsWriteLabel(0, 4, "Edition");
    xlsWriteLabel(0, 5, "Barcode");
    xlsWriteLabel(0, 6, "Date");
    xlsWriteLabel(0, 7, "Due Date");
    $xlsRow = 1;
    while ($row = mysql_fetch_array($result)) {
        xlsWriteLabel($xlsRow, 0, $row['name']);
        xlsWriteLabel($xlsRow, 1, $row['bitsid']);
        xlsWriteLabel($xlsRow, 2, $row['book_title']);
        xlsWriteLabel($xlsRow, 3, $row['author']);
        xlsWriteLabel($xlsRow, 4, $row['edition']);
        xlsWriteLabel($xlsRow, 5, $row['accession_number']);
        xlsWriteLabel($xlsRow, 6, $row['date']);
        xlsWriteLabel($xlsRow, 7, $row['due_date']);
        $xlsRow++;
    }
    xlsEOF();
}
Esempio n. 18
0
 function search_excel($VAR, $construct, $type)
 {
     global $C_translate;
     # set the field list for this method:
     $arr = $construct->method["{$type}"];
     $filename = 'Export.xls';
     # determine what action to take:
     # inline display, download, email, web save
     if ($VAR["type"] == "display") {
         header('Content-type: application/x-msexcel');
         header("Content-Disposition: inline; filename={$filename}");
         header("Content-Description: PHP/INTERBASE Generated Data");
     } else {
         if ($VAR["type"] == "download") {
             header("Content-Disposition: attachment; filename={$filename}");
         } else {
             if ($VAR["type"] == "email") {
                 echo "Email exports not supported yet!";
                 exit;
             } else {
                 if ($VAR["type"] == "email") {
                     echo "Saving exports not supported yet!";
                     exit;
                 }
             }
         }
     }
     # Start the Excel Stream
     xlsBOF();
     /************** BEGIN STANDARD EXPORT SEARCH CODE *********************/
     # set the field list for this method:
     $arr = $construct->method["{$type}"];
     # loop through the field list to create the sql queries
     $arr = $construct->method[$type];
     $field_list = '';
     $i = 0;
     while (list($key, $value) = each($arr)) {
         if ($i == 0) {
             $field_var = $construct->table . '_' . $value;
             $field_list .= AGILE_DB_PREFIX . $construct->table . '.' . $value;
             // determine if this record is linked to another table/field
             if ($construct->field[$value]["asso_table"] != "") {
                 $this->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]);
             }
         } else {
             $field_var = $construct->table . '_' . $value;
             $field_list .= "," . AGILE_DB_PREFIX . $construct->table . "." . $value;
             // determine if this record is linked to another table/field
             if ($construct->field[$value]["asso_table"] != "") {
                 $this->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]);
             }
         }
         $i++;
     }
     # get the search details:
     if (isset($VAR['search_id'])) {
         include_once PATH_CORE . 'search.inc.php';
         $search = new CORE_search();
         $search->get($VAR['search_id']);
     } else {
         echo '<BR> The search terms submitted were invalid!';
     }
     # get the sort order details:
     if (isset($VAR['order_by']) && $VAR['order_by'] != "") {
         $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . $construct->table . '.' . $VAR['order_by'];
         $smarty_order = $VAR['order_by'];
     } else {
         $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . $construct->table . '.' . $construct->order_by;
         $smarty_order = $search->order_by;
     }
     # determine the offset & limit
     if (isset($VAR['page'])) {
         $current_page = $VAR['page'];
     } else {
         $current_page = '0';
     }
     # determine the offset & limit
     if ($current_page == 0) {
         $offset = '0,10000000';
     } else {
         $offset = $current_page * $search->limit - $search->limit . ',' . $search->limit;
     }
     # format saved search string
     $sql = explode(" WHERE ", $search->sql);
     # generate the full query
     $q = preg_replace("/%%fieldList%%/i", $field_list, $search->sql);
     $q = preg_replace("/%%tableList%%/i", AGILE_DB_PREFIX . $construct->table, $q);
     $q = preg_replace("/%%whereList%%/i", "", $q);
     $q .= " " . AGILE_DB_PREFIX . $construct->table . ".site_id = '" . DEFAULT_SITE . "'";
     $q .= $order_by;
     $db =& DB();
     # determine the offset & limit
     $result = $db->Execute($q);
     # error reporting
     if ($result === false) {
         global $C_debug;
         $C_debug->error('core:export.inc.php', 'search_xml', $db->ErrorMsg() . '<br><br>' . $q);
         echo "An SQL error has occured!";
         return;
     }
     # put the results into an array
     $i = 0;
     $class_name = TRUE;
     $results = '';
     while (!$result->EOF) {
         $results[$i] = $result->fields;
         $result->MoveNext();
         $i++;
     }
     # get any linked fields
     if ($i > 0) {
         $this->result = $results;
         $db_join = new CORE_database();
         $this->result = $db_join->join_fields($results, $this->linked);
     } else {
         $this->result = $results;
     }
     /************** END STANDARD EXPORT SEARCH CODE *********************/
     # WRITE THE FIRST COLUMN
     reset($arr);
     $column = 0;
     while (list($key, $value) = each($arr)) {
         // get the translated field name
         $field = $C_translate->translate('field_' . $value, $construct->module, '');
         if (gettype($this->result["{$ii}"]["{$key}"]) != "string") {
             xlsWriteLabel($row, $column, $field);
         }
         $column++;
     }
     # LOOP THROUGH THE RESULTS & DISPLAY AS EXCEL
     $row = 1;
     for ($ii = 0; $ii < count($this->result); $ii++) {
         # get the data for each cell:
         reset($arr);
         $column = 0;
         while (list($key, $value) = each($arr)) {
             if ($construct->field["{$value}"][convert] == 'date' || $construct->field["{$value}"][convert] == 'time' || $construct->field["{$value}"][convert] == 'date-now' || $construct->field["{$value}"][convert] == 'date-time') {
                 $data = date(UNIX_DATE_FORMAT, $this->result["{$ii}"]["{$value}"]);
             } else {
                 $data = $this->result["{$ii}"]["{$value}"];
             }
             if (is_numeric($data)) {
                 xlsWriteNumber($row, $column, $data);
             } else {
                 xlsWriteLabel($row, $column, $data);
             }
             $column++;
         }
         $row++;
     }
     # Dispay the output
     xlsEOF();
     exit;
 }
Esempio n. 19
0
// nilai awal untuk nomor urut data
$noData = 1;

while ($data = mysql_fetch_array($hasil))
{
   // menampilkan no. urut data
   xlsWriteNumber($noBarisCell,0,$noData);

   // menampilkan data nim
   xlsWriteLabel($noBarisCell,1,$data['kd_barang']);

   // menampilkan data nama mahasiswa
   xlsWriteLabel($noBarisCell,2,$data['nama']);

   // menampilkan data nilai
   xlsWriteLabel($noBarisCell,3,$data['expire_date']);

   // menentukan status kelulusan
   //if ($data['nilai'] >= 60) $status = "LULUS";
   //else $status = "TIDAK LULUS";

   // menampilkan status kelulusan
   xlsWriteNumber($noBarisCell,4,$data['harga_dosp']);
   xlsWriteNumber($noBarisCell,5,$data['stok_ms']);
   xlsWriteNumber($noBarisCell,6,$data['stok_apt']);
   xlsWriteNumber($noBarisCell,7,$data['stok_rj']);
   xlsWriteNumber($noBarisCell,8,$data['stok_ri']);
   xlsWriteNumber($noBarisCell,9,$data['stok_igd']);
   xlsWriteNumber($noBarisCell,10,$data['stok_oca']);
    xlsWriteNumber($noBarisCell,11,$data['stok_lab']);
	 xlsWriteNumber($noBarisCell,12,$data['stok_rad']);
Esempio n. 20
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "facultad.xls";
     $judul = "facultad";
     $tablehead = 2;
     $tablebody = 3;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     xlsWriteLabel(0, 0, $judul);
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "no");
     xlsWriteLabel($tablehead, $kolomhead++, "NOMBRE_FACULTAD");
     foreach ($this->model_facultad->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->NOMBRE_FACULTAD);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
Esempio n. 21
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "mahasiswa.xls";
     $judul = "mahasiswa";
     $tablehead = 2;
     $tablebody = 3;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     xlsWriteLabel(0, 0, $judul);
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "no");
     xlsWriteLabel($tablehead, $kolomhead++, "th_akademik");
     xlsWriteLabel($tablehead, $kolomhead++, "kd_prodi");
     xlsWriteLabel($tablehead, $kolomhead++, "nama_mhs");
     xlsWriteLabel($tablehead, $kolomhead++, "sex");
     xlsWriteLabel($tablehead, $kolomhead++, "tempat_lahir");
     xlsWriteLabel($tablehead, $kolomhead++, "tanggal_lahir");
     xlsWriteLabel($tablehead, $kolomhead++, "alamat");
     xlsWriteLabel($tablehead, $kolomhead++, "kota");
     xlsWriteLabel($tablehead, $kolomhead++, "hp");
     xlsWriteLabel($tablehead, $kolomhead++, "email");
     xlsWriteLabel($tablehead, $kolomhead++, "nama_ayah");
     xlsWriteLabel($tablehead, $kolomhead++, "nama_ibu");
     xlsWriteLabel($tablehead, $kolomhead++, "alamat_ortu");
     xlsWriteLabel($tablehead, $kolomhead++, "hp_ortu");
     xlsWriteLabel($tablehead, $kolomhead++, "password");
     xlsWriteLabel($tablehead, $kolomhead++, "file_foto");
     xlsWriteLabel($tablehead, $kolomhead++, "status");
     xlsWriteLabel($tablehead, $kolomhead++, "tgl_insert");
     xlsWriteLabel($tablehead, $kolomhead++, "tgl_update");
     foreach ($this->mahasiswa_model->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->th_akademik);
         xlsWriteLabel($tablebody, $kolombody++, $data->kd_prodi);
         xlsWriteLabel($tablebody, $kolombody++, $data->nama_mhs);
         xlsWriteLabel($tablebody, $kolombody++, $data->sex);
         xlsWriteLabel($tablebody, $kolombody++, $data->tempat_lahir);
         xlsWriteLabel($tablebody, $kolombody++, $data->tanggal_lahir);
         xlsWriteLabel($tablebody, $kolombody++, $data->alamat);
         xlsWriteLabel($tablebody, $kolombody++, $data->kota);
         xlsWriteLabel($tablebody, $kolombody++, $data->hp);
         xlsWriteLabel($tablebody, $kolombody++, $data->email);
         xlsWriteLabel($tablebody, $kolombody++, $data->nama_ayah);
         xlsWriteLabel($tablebody, $kolombody++, $data->nama_ibu);
         xlsWriteLabel($tablebody, $kolombody++, $data->alamat_ortu);
         xlsWriteLabel($tablebody, $kolombody++, $data->hp_ortu);
         xlsWriteLabel($tablebody, $kolombody++, $data->password);
         xlsWriteLabel($tablebody, $kolombody++, $data->file_foto);
         xlsWriteLabel($tablebody, $kolombody++, $data->status);
         xlsWriteLabel($tablebody, $kolombody++, $data->tgl_insert);
         xlsWriteLabel($tablebody, $kolombody++, $data->tgl_update);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
Esempio n. 22
0
                xlsWriteLabel(1, 2, "Description");
                xlsWriteLabel(1, 3, "Jumlah");
                xlsWriteLabel(1, 4, "Alasan Return");
                xlsWriteLabel(1, 5, "Tanggal Return");
                xlsWriteLabel(1, 6, "Operator");
                xlsWriteLabel(1, 7, "Keterangan");
                $xlsRow = 2;
                while ($row = mysqli_fetch_array($result)) {
                    xlsWriteLabel($xlsRow, 0, $row['no_form_r']);
                    xlsWriteLabel($xlsRow, 1, $row['part_number']);
                    xlsWriteLabel($xlsRow, 2, $row['description']);
                    xlsWriteLabel($xlsRow, 3, $row['jumlah']);
                    xlsWriteLabel($xlsRow, 4, $row['alasan']);
                    xlsWriteLabel($xlsRow, 5, $row['tgl_return']);
                    xlsWriteLabel($xlsRow, 6, $row['username']);
                    xlsWriteLabel($xlsRow, 7, $row['keterangan']);
                    $xlsRow++;
                }
                xlsEOF();
                exit;
            }
        } else {
            if (isset($_POST['lihat'])) {
                $menu = $_POST['menu'];
                if ($menu == "brgkel") {
                    $startdate = $_POST['startdate'];
                    $enddate = $_POST['enddate'];
                    ?>
<html>
<head>
    <link href="css/test.css" type="text/css" rel="stylesheet"><link href="../images/icon.jpg" rel="shortcut icon" />
Esempio n. 23
0
        xlsWriteLabel($a, 1, $ly[mid]);
        xlsWriteLabel($a, 2, $ly[tid]);
        xlsWriteLabel($a, 3, $ly[CHname]);
        xlsWriteLabel($a, 4, $ly[ENname]);
        xlsWriteLabel($a, 5, $ly[webname]);
        xlsWriteLabel($a, 6, $ly[ENwebname]);
        xlsWriteLabel($a, 7, mb_convert_encoding($iso2o, "Big5", "UTF-8"));
        xlsWriteLabel($a, 8, mb_convert_encoding($ly[weburl], "Big5", "UTF-8"));
        xlsWriteLabel($a, 9, mb_convert_encoding($ly[comid], "Big5", "UTF-8"));
        xlsWriteLabel($a, 10, mb_convert_encoding($ly[username], "Big5", "UTF-8"));
        xlsWriteLabel($a, 11, mb_convert_encoding($ly[phone], "Big5", "UTF-8"));
        xlsWriteLabel($a, 12, mb_convert_encoding($ly[email], "Big5", "UTF-8"));
        xlsWriteLabel($a, 13, $ly[mcc]);
        xlsWriteLabel($a, 14, mb_convert_encoding($ArrFubon_City[$ly[city]], "Big5", "UTF-8"));
        xlsWriteLabel($a, 15, mb_convert_encoding($ly[zipcode], "Big5", "UTF-8"));
        xlsWriteLabel($a, 16, mb_convert_encoding($ly[country], "Big5", "UTF-8"));
    }
    xlsEOF();
    exit;
} else {
    if ($btm == '匯出csv') {
        $Csv_fileName = "fubon_mid_{$hohsn}.csv";
        $fpw = mb_convert_encoding("序,mid,tid,特店名稱,特店名稱(英),對外名稱,對外名稱(英),線下交易,網址,統一編號,聯絡人,電話,Email,mcc行業別,城市別,郵遞區號,國家別", "Big5", "UTF-8") . "\r\n";
        while ($ly = @mysql_fetch_array($q_mid)) {
            $a++;
            $iso2o = $ly[iso2o] == 1 ? "是" : "否";
            $body = sprintf("%03d", $a) . ',' . $ly[mid] . ',' . $ly[tid] . ',' . $ly[CHname] . ',' . $ly[ENname] . ',' . $ly[webname] . ',' . $ly[ENwebname] . ',' . $iso2o . ',' . $ly[weburl] . ',' . $ly[comid] . ',' . $ly[username] . ',' . $ly[phone] . ',' . $ly[email] . ',' . $ly[MCC] . ',' . $ArrFubon_City[$ly[city]] . ',' . $ly[zipcode] . ',' . $ly[country];
            $fpw .= mb_convert_encoding($body, "Big5", "UTF-8") . "\r\n";
        }
        header("Content-disposition: attachment; filename={$Csv_fileName}");
        header("Content-Type: application/save-as");
Esempio n. 24
0
function Create_Excel_File($ExcelFile, $Data)
{
    header('Content-type: application/x-msexcel');
    header("Content-Disposition: attachment; filename={$ExcelFile}");
    function xlsBOF()
    {
        echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
        return;
    }
    function xlsEOF()
    {
        echo pack("ss", 0xa, 0x0);
        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;
    }
    xlsBOF();
    for ($i = 0; $i < count($Data[0]); $i++) {
        for ($j = 0; $j < count($Data); $j++) {
            $v = $Data[$j][$i];
            xlsWriteLabel($j, $i, $v);
        }
    }
    xlsEOF();
}
Esempio n. 25
0
    $xlsRow = 1;
    while ($array = $db->fetch_array($query)) {
        ++$index;
        xlsWriteNumber($xlsRow, 0, "{$index}");
        xlsWriteLabel($xlsRow, 1, "{$array['0']}");
        xlsWriteLabel($xlsRow, 2, "{$array['1']}");
        xlsWriteLabel($xlsRow, 3, "{$array['2']}");
        xlsWriteLabel($xlsRow, 4, "{$array['3']}");
        xlsWriteLabel($xlsRow, 5, "{$array['4']}");
        xlsWriteLabel($xlsRow, 6, "{$array['5']}");
        xlsWriteLabel($xlsRow, 7, "{$array['6']}");
        xlsWriteLabel($xlsRow, 8, "{$array['7']}");
        xlsWriteLabel($xlsRow, 9, "{$array['8']}");
        xlsWriteLabel($xlsRow, 10, "{$array['9']}");
        xlsWriteLabel($xlsRow, 11, "{$array['10']}");
        xlsWriteLabel($xlsRow, 12, "{$array['11']}");
        $xlsRow++;
    }
    xlsEOF();
    $date = date('Ymh');
    $db->query("update boya_reg_user set class_no='{$date}' where id in(" . $in . ")");
    exit;
} else {
    echo "<script>window.history.back();</script>";
}
function xlsBOF()
{
    echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
    return;
}
function xlsEOF()
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "tbl_kelompok.xls";
     $judul = "tbl_kelompok";
     $tablehead = 0;
     $tablebody = 1;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "No");
     xlsWriteLabel($tablehead, $kolomhead++, "Nidn");
     xlsWriteLabel($tablehead, $kolomhead++, "Dpl");
     xlsWriteLabel($tablehead, $kolomhead++, "Lokasi");
     xlsWriteLabel($tablehead, $kolomhead++, "Jumlah");
     foreach ($this->Daftar_kelompok->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->nidn);
         xlsWriteLabel($tablebody, $kolombody++, $data->dpl);
         xlsWriteLabel($tablebody, $kolombody++, $data->lokasi);
         xlsWriteNumber($tablebody, $kolombody++, $data->jumlah);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }
Esempio n. 27
0
	if ($r_spb)
	{
		$stock_on_order = $r_spb['req_stock'];
	}
	else
	{
	//default safety
		$stock_on_order = 0;
	}*/
   xlsWriteNumber($noBarisCell,0,$noData);

   // menampilkan data nim
   xlsWriteLabel($noBarisCell,1,$data['kd_barang']);

   // menampilkan data nama mahasiswa
   xlsWriteLabel($noBarisCell,2,$data['nama']);

   // menampilkan data nilai
   xlsWriteNumber($noBarisCell,3,$data['max_qty']);
   xlsWriteNumber($noBarisCell,4,$data['stok']);
   //xlsWriteNumber($noBarisCell,5,$stock_on_order);
   xlsWriteNumber($noBarisCell,5,$data['order_qty']);
   // menentukan status kelulusan
   //if ($data['nilai'] >= 60) $status = "LULUS";
   //else $status = "TIDAK LULUS";

  
   // increment untuk no. baris cell dan no. urut data
   $noBarisCell++;
   $noData++;
}
Esempio n. 28
0
    xlsWriteLabel(0, 10, mb_convert_encoding("電話", "Big5", "UTF-8"));
    xlsWriteLabel(0, 11, mb_convert_encoding("取用日", "Big5", "UTF-8"));
    while ($ly = @mysql_fetch_array($q_mid)) {
        $a++;
        xlsWriteNumber($a, 0, $a);
        xlsWriteLabel($a, 1, $ly[mid]);
        xlsWriteLabel($a, 2, $ly[tid]);
        xlsWriteLabel($a, 3, $ly[checksum]);
        xlsWriteLabel($a, 4, $ly[mcc]);
        xlsWriteLabel($a, 5, mb_convert_encoding($ly[sob], "Big5", "UTF-8"));
        xlsWriteLabel($a, 6, mb_convert_encoding($ly[webname], "Big5", "UTF-8"));
        xlsWriteLabel($a, 7, mb_convert_encoding($ly[weburl], "Big5", "UTF-8"));
        xlsWriteLabel($a, 8, $ly[comid]);
        xlsWriteLabel($a, 9, mb_convert_encoding($ly[username], "Big5", "UTF-8"));
        xlsWriteLabel($a, 10, mb_convert_encoding($ly[phone], "Big5", "UTF-8"));
        xlsWriteLabel($a, 11, $ly[dtymd]);
    }
    xlsEOF();
    exit;
} else {
    if ($btm == '匯出csv') {
        $Csv_fileName = "ctcb_mid_{$hohsn}.csv";
        $fpw = "序,mid,tid,檢核碼,行業別,營業項目,帳單名稱,網址,統編/身份證,聯絡人,電話\r\n";
        while ($ly = @mysql_fetch_array($q_mid)) {
            $a++;
            $body = sprintf("%03d", $a) . ",'" . $ly[mid] . ",'" . $ly[tid] . "," . $ly[checksum] . ",'" . $ly[mcc] . "," . $ly[sob] . "," . $ly[webname] . "," . $ly[weburl] . ",'" . $ly[comid] . "," . $ly[username] . ",'" . $ly[phone];
            $fpw .= $body . "\r\n";
            //$fpw .= mb_convert_encoding($body, "Big5", "UTF-8") . "\r\n";
        }
        //$fpw = mb_convert_encoding($body, "Big5", "UTF-8");
        header("Content-disposition: attachment; filename={$Csv_fileName}");
Esempio n. 29
0
}
$jm = sizeof($data['id_siswa']);
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=file_siswa.xls ");
header("Content-Transfer-Encoding: binary ");
xlsBOF();
xlsWriteLabel(0, 3, "Data Siswa");
xlsWriteLabel(2, 0, "Nomor");
xlsWriteLabel(2, 1, "Nama Siswa");
xlsWriteLabel(2, 2, "NIS");
xlsWriteLabel(2, 3, "Kelamin");
xlsWriteLabel(2, 4, "Alamat");
xlsWriteLabel(2, 5, "Telpon");
$xlsRow = 3;
for ($y = 0; $y < $jm; $y++) {
    ++$i;
    xlsWriteNumber($xlsRow, 0, "{$i}");
    xlsWriteLabel($xlsRow, 1, $data['nama_siswa'][$y]);
    xlsWriteLabel($xlsRow, 2, $data['nis'][$y]);
    xlsWriteLabel($xlsRow, 3, $data['kelamin'][$y]);
    xlsWriteLabel($xlsRow, 4, $data['alamat'][$y]);
    xlsWriteLabel($xlsRow, 5, $data['telpon'][$y]);
    $xlsRow++;
}
xlsEOF();
exit;
Esempio n. 30
0
 public function excel()
 {
     $this->load->helper('exportexcel');
     $namaFile = "m_admin.xls";
     $judul = "m_admin";
     $tablehead = 0;
     $tablebody = 1;
     $nourut = 1;
     //penulisan 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=" . $namaFile . "");
     header("Content-Transfer-Encoding: binary ");
     xlsBOF();
     $kolomhead = 0;
     xlsWriteLabel($tablehead, $kolomhead++, "No");
     xlsWriteLabel($tablehead, $kolomhead++, "Username");
     xlsWriteLabel($tablehead, $kolomhead++, "Password");
     xlsWriteLabel($tablehead, $kolomhead++, "Level");
     xlsWriteLabel($tablehead, $kolomhead++, "Kon Id");
     foreach ($this->Admin_model->get_all() as $data) {
         $kolombody = 0;
         //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
         xlsWriteNumber($tablebody, $kolombody++, $nourut);
         xlsWriteLabel($tablebody, $kolombody++, $data->username);
         xlsWriteLabel($tablebody, $kolombody++, $data->password);
         xlsWriteLabel($tablebody, $kolombody++, $data->level);
         xlsWriteNumber($tablebody, $kolombody++, $data->kon_id);
         $tablebody++;
         $nourut++;
     }
     xlsEOF();
     exit;
 }