📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv9.demodesign.com.tr
/
includes
/
modules
/
PHPExcel
📝
excel2.php
← Geri Dön
<?php $ilktarih = $_GET["ilktarih"] . " 00:00:00"; $sontarih = $_GET["sontarih"] . " 00:00:00"; // Filtreler require_once("../../../init.php"); require_once("PHPExcel.php"); // Veritabanı Bağlantısı try { $conn = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8;", DB_USERNAME, DB_PASSWORD); } catch (PDOException $e) { die($e->getMessage()); } // Fonksiyon function countRow($data) { global $conn; $where = ""; if ($data["where"]): $where = "WHERE "; foreach ($data["where"] as $key => $value) { $where .= " $key=:$key && "; $execute[$key] = $value; } $where = substr($where, 0, -3); else: $execute[] = ""; endif; $row = $conn->prepare("SELECT * FROM {$data['table']} $where "); $row->execute($execute); $validate = $row->rowCount(); return $validate; } // Siparişler Tablosu $siparisler = $conn->prepare("SELECT * FROM orders WHERE date BETWEEN '" . $ilktarih . "' and '" . $sontarih . "'"); $siparisler->execute(array()); $siparisler = $siparisler->fetchAll(PDO::FETCH_ASSOC); // Nesne $Excel = new PHPExcel(); // Başlık $Excel->getActiveSheet()->setTitle("Ciro Tablosu"); // Tablo Stilleri $Excel->getActiveSheet()->getColumnDimension("A")->setAutoSize(true); $Excel->getActiveSheet()->getColumnDimension("B")->setAutoSize(true); $Excel->getActiveSheet()->getColumnDimension("D")->setAutoSize(true); $Excel->getActiveSheet()->getRowDimension("1")->setRowHeight(27); // Arka Plan Rengi $Excel->getActiveSheet()->getStyle("A1:D1")->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB("DC123C"); // Çerçeve $borderstyle = array( "borders" => array( "allborders" => array( "style" => PHPExcel_Style_Border::BORDER_THIN ) ) ); $Excel->getActiveSheet()->getStyle("A1:B1")->applyFromArray($borderstyle); // Kalın Yazı $Excel->getActiveSheet()->getStyle("A1:B1")->getFont()->setBold(true); // Başlık Sütunları $Excel->getActiveSheet()->setCellValue("A1", "Tarih"); $Excel->getActiveSheet()->setCellValue("B1", "Gelen Ödeme"); $Excel->getActiveSheet()->setCellValue("D1", "Toplam Ciro"); // Başlangıç Satırı $i = 2; // Veri Dökümü $total = 0; foreach ($siparisler as $row) { $Excel->getActiveSheet()->getStyle("A$i:B$i")->applyFromArray($borderstyle); $Excel->getActiveSheet()->setCellValue("A" . $i, $row["date"]); $Excel->getActiveSheet()->setCellValue("B" . $i, $row["total"]." TL"); // Sonraki Satır $i++; $total+=$row["total"]; } $Excel->getActiveSheet()->setCellValue("D3", $total." TL"); // Kaydetme İşlemi $Kaydet = PHPExcel_IOFactory::createWriter($Excel, 'Excel2007'); $Kaydet->save("Ciro.xlsx"); echo "<center><h2>Ciro tablosunu <a href='https://sihirlihali.com/includes/modules/PHPExcel/Ciro.xlsx'>indir</a></h2></center>";
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula