Exemplo n.º 1
0
 function ExportData()
 {
     $utf8 = strtolower(EW_CHARSET) == "utf-8";
     $bSelectLimit = FALSE;
     // Load recordset
     if ($bSelectLimit) {
         $this->TotalRecs = $this->SelectRecordCount();
     } else {
         if ($rs = $this->LoadRecordset()) {
             $this->TotalRecs = $rs->RecordCount();
         }
     }
     $this->StartRec = 1;
     $this->SetUpStartRec();
     // Set up start record position
     // Set the last record to display
     if ($this->DisplayRecs <= 0) {
         $this->StopRec = $this->TotalRecs;
     } else {
         $this->StopRec = $this->StartRec + $this->DisplayRecs - 1;
     }
     if (!$rs) {
         header("Content-Type:");
         // Remove header
         header("Content-Disposition:");
         $this->ShowMessage();
         return;
     }
     $this->ExportDoc = ew_ExportDocument($this, "v");
     $Doc =& $this->ExportDoc;
     if ($bSelectLimit) {
         $this->StartRec = 1;
         $this->StopRec = $this->DisplayRecs <= 0 ? $this->TotalRecs : $this->DisplayRecs;
     } else {
         //$this->StartRec = $this->StartRec;
         //$this->StopRec = $this->StopRec;
     }
     // Call Page Exporting server event
     $this->ExportDoc->ExportCustom = !$this->Page_Exporting();
     $ParentTable = "";
     $sHeader = $this->PageHeader;
     $this->Page_DataRendering($sHeader);
     $Doc->Text .= $sHeader;
     $this->ExportDocument($Doc, $rs, $this->StartRec, $this->StopRec, "view");
     // Export detail records (socios_detalles)
     if (EW_EXPORT_DETAIL_RECORDS && in_array("socios_detalles", explode(",", $this->getCurrentDetailTable()))) {
         global $socios_detalles;
         if (!isset($socios_detalles)) {
             $socios_detalles = new csocios_detalles();
         }
         $rsdetail = $socios_detalles->LoadRs($socios_detalles->GetDetailFilter());
         // Load detail records
         if ($rsdetail && !$rsdetail->EOF) {
             $ExportStyle = $Doc->Style;
             $Doc->SetStyle("h");
             // Change to horizontal
             if ($this->Export != "csv" || EW_EXPORT_DETAIL_RECORDS_FOR_CSV) {
                 $Doc->ExportEmptyRow();
                 $detailcnt = $rsdetail->RecordCount();
                 $socios_detalles->ExportDocument($Doc, $rsdetail, 1, $detailcnt);
             }
             $Doc->SetStyle($ExportStyle);
             // Restore
             $rsdetail->Close();
         }
     }
     // Export detail records (socios_cuotas)
     if (EW_EXPORT_DETAIL_RECORDS && in_array("socios_cuotas", explode(",", $this->getCurrentDetailTable()))) {
         global $socios_cuotas;
         if (!isset($socios_cuotas)) {
             $socios_cuotas = new csocios_cuotas();
         }
         $rsdetail = $socios_cuotas->LoadRs($socios_cuotas->GetDetailFilter());
         // Load detail records
         if ($rsdetail && !$rsdetail->EOF) {
             $ExportStyle = $Doc->Style;
             $Doc->SetStyle("h");
             // Change to horizontal
             if ($this->Export != "csv" || EW_EXPORT_DETAIL_RECORDS_FOR_CSV) {
                 $Doc->ExportEmptyRow();
                 $detailcnt = $rsdetail->RecordCount();
                 $socios_cuotas->ExportDocument($Doc, $rsdetail, 1, $detailcnt);
             }
             $Doc->SetStyle($ExportStyle);
             // Restore
             $rsdetail->Close();
         }
     }
     // Export detail records (deudas)
     if (EW_EXPORT_DETAIL_RECORDS && in_array("deudas", explode(",", $this->getCurrentDetailTable()))) {
         global $deudas;
         if (!isset($deudas)) {
             $deudas = new cdeudas();
         }
         $rsdetail = $deudas->LoadRs($deudas->GetDetailFilter());
         // Load detail records
         if ($rsdetail && !$rsdetail->EOF) {
             $ExportStyle = $Doc->Style;
             $Doc->SetStyle("h");
             // Change to horizontal
             if ($this->Export != "csv" || EW_EXPORT_DETAIL_RECORDS_FOR_CSV) {
                 $Doc->ExportEmptyRow();
                 $detailcnt = $rsdetail->RecordCount();
                 $deudas->ExportDocument($Doc, $rsdetail, 1, $detailcnt);
             }
             $Doc->SetStyle($ExportStyle);
             // Restore
             $rsdetail->Close();
         }
     }
     $sFooter = $this->PageFooter;
     $this->Page_DataRendered($sFooter);
     $Doc->Text .= $sFooter;
     // Close recordset
     $rs->Close();
     // Export header and footer
     $Doc->ExportHeaderAndFooter();
     // Call Page Exported server event
     $this->Page_Exported();
     // Clean output buffer
     if (!EW_DEBUG_ENABLED && ob_get_length()) {
         ob_end_clean();
     }
     // Write debug message if enabled
     if (EW_DEBUG_ENABLED) {
         echo ew_DebugMsg();
     }
     // Output data
     if ($this->Export == "email") {
         echo $this->ExportEmail($Doc->Text);
     } else {
         $Doc->Export();
     }
 }
Exemplo n.º 2
0
 function ExportData()
 {
     $utf8 = strtolower(EW_CHARSET) == "utf-8";
     $bSelectLimit = EW_SELECT_LIMIT;
     // Load recordset
     if ($bSelectLimit) {
         $this->TotalRecs = $this->SelectRecordCount();
     } else {
         if ($rs = $this->LoadRecordset()) {
             $this->TotalRecs = $rs->RecordCount();
         }
     }
     $this->StartRec = 1;
     // Export all
     if ($this->ExportAll) {
         set_time_limit(EW_EXPORT_ALL_TIME_LIMIT);
         $this->DisplayRecs = $this->TotalRecs;
         $this->StopRec = $this->TotalRecs;
     } else {
         // Export one page only
         $this->SetUpStartRec();
         // Set up start record position
         // Set the last record to display
         if ($this->DisplayRecs <= 0) {
             $this->StopRec = $this->TotalRecs;
         } else {
             $this->StopRec = $this->StartRec + $this->DisplayRecs - 1;
         }
     }
     if ($bSelectLimit) {
         $rs = $this->LoadRecordset($this->StartRec - 1, $this->DisplayRecs <= 0 ? $this->TotalRecs : $this->DisplayRecs);
     }
     if (!$rs) {
         header("Content-Type:");
         // Remove header
         header("Content-Disposition:");
         $this->ShowMessage();
         return;
     }
     $this->ExportDoc = ew_ExportDocument($this, "h");
     $Doc =& $this->ExportDoc;
     if ($bSelectLimit) {
         $this->StartRec = 1;
         $this->StopRec = $this->DisplayRecs <= 0 ? $this->TotalRecs : $this->DisplayRecs;
     } else {
         //$this->StartRec = $this->StartRec;
         //$this->StopRec = $this->StopRec;
     }
     // Call Page Exporting server event
     $this->ExportDoc->ExportCustom = !$this->Page_Exporting();
     $ParentTable = "";
     // Export master record
     if (EW_EXPORT_MASTER_RECORD && $this->GetMasterFilter() != "" && $this->getCurrentMasterTable() == "deudas") {
         global $deudas;
         if (!isset($deudas)) {
             $deudas = new cdeudas();
         }
         $rsmaster = $deudas->LoadRs($this->DbMasterFilter);
         // Load master record
         if ($rsmaster && !$rsmaster->EOF) {
             $ExportStyle = $Doc->Style;
             $Doc->SetStyle("v");
             // Change to vertical
             if ($this->Export != "csv" || EW_EXPORT_MASTER_RECORD_FOR_CSV) {
                 $deudas->ExportDocument($Doc, $rsmaster, 1, 1);
                 $Doc->ExportEmptyRow();
             }
             $Doc->SetStyle($ExportStyle);
             // Restore
             $rsmaster->Close();
         }
     }
     $sHeader = $this->PageHeader;
     $this->Page_DataRendering($sHeader);
     $Doc->Text .= $sHeader;
     $this->ExportDocument($Doc, $rs, $this->StartRec, $this->StopRec, "");
     $sFooter = $this->PageFooter;
     $this->Page_DataRendered($sFooter);
     $Doc->Text .= $sFooter;
     // Close recordset
     $rs->Close();
     // Export header and footer
     $Doc->ExportHeaderAndFooter();
     // Call Page Exported server event
     $this->Page_Exported();
     // Clean output buffer
     if (!EW_DEBUG_ENABLED && ob_get_length()) {
         ob_end_clean();
     }
     // Write debug message if enabled
     if (EW_DEBUG_ENABLED) {
         echo ew_DebugMsg();
     }
     // Output data
     if ($this->Export == "email") {
         echo $this->ExportEmail($Doc->Text);
     } else {
         $Doc->Export();
     }
 }