<?php

session_start();
//~ echo "[Debug]: avvio esportazione personalizzata <br />";
require_once "connection.php";
$d->CheckSession("progsla", "", "../pubblica/index.php");
//~ echo "ExportArray:<pre>";
//~ print_r($_SESSION['ExportArray']);
//~ echo "</pre>";
$root = substr($_SERVER["DOCUMENT_ROOT"], 0, -1);
require_once "{$root}/prog_sla/classi/XlsExport.php";
// locale
//~ require_once("$root/classi/XlsExport.php");	// remoto
$d->SessionLog("Avviata esportazione personalizzata.");
$FileName = "tmp/esportazione_personalizzata_" . date('d-m-Y') . ".xls";
$x = new XlsExport($FileName);
// preparazione primo gruppo di intestazioni ( generalità ):
//~ $Generalita = $d->GetRows("*", "view_generalita", "", "", "", 1);
$x->xlsWriteLabel(0, 0, "Data:");
// contatore base 1
$x->xlsWriteLabel(0, 1, "N. Cartella:");
$x->xlsWriteLabel(0, 2, "Cognome:");
$x->xlsWriteLabel(0, 3, "Nome:");
$x->xlsWriteLabel(0, 4, "Sesso:");
$x->xlsWriteLabel(0, 5, "Luogo di nascita:");
$x->xlsWriteLabel(0, 6, "Età:");
$x->xlsWriteLabel(0, 7, "Altezza:");
$x->xlsWriteLabel(0, 8, "Prov:");
$x->xlsWriteLabel(0, 9, "Città:");
$x->xlsWriteLabel(0, 10, "Cap:");
$x->xlsWriteLabel(0, 11, "Indirizzo:");
<?php

session_start();
$root = substr($_SERVER["DOCUMENT_ROOT"], 0, -1);
require_once "{$root}/Class/XlsExport.php";
require_once "{$root}/Class/Net.php";
$FileName = "tmp/RollOut_WIN7_RITIRI_FIL_" . $_SESSION['rollout']['cod_fil'] . ".xls";
$x = new XlsExport($FileName, "mail");
$x->xlsWriteLabel(0, 0, "Branch Code:");
$x->xlsWriteLabel(0, 1, $_SESSION['rollout']['cod_fil']);
$x->xlsWriteLabel(1, 0, "N:");
$x->xlsWriteLabel(1, 1, "Tipologia Apparato:");
$x->xlsWriteLabel(1, 2, "Marca:");
$x->xlsWriteLabel(1, 3, "Modello:");
$x->xlsWriteLabel(1, 4, "Serial Number:");
$x->xlsWriteLabel(1, 5, "Asset:");
$xlsRow = 2;
foreach ($_SESSION['rollout']['dettaglio'] as $key => $field) {
    if ($field['provenienza'] == "DA FILIALE" && $field['tipo_mch'] != "Server") {
        $x->xlsWriteLabel($xlsRow, 0, $xlsRow - 1 . ")");
        $x->xlsWriteLabel($xlsRow, 1, $field['tipo_mch']);
        $x->xlsWriteLabel($xlsRow, 2, $field['marca']);
        $x->xlsWriteLabel($xlsRow, 3, $field['modello']);
        $x->xlsWriteLabel($xlsRow, 4, $field['serial']);
        $x->xlsWriteLabel($xlsRow, 5, $field['asset']);
        $xlsRow++;
    }
}
$x->WriteFile();
//'to' => 'UGIS - IT - ROLLOUT EUROPC - UniCredit Group - UniCredit Group <*****@*****.**>',
//'cc' => 'Leonardi Giorgio (UGIS) <*****@*****.**>, Vesentini Doriana (UGIS) <*****@*****.**>',
                $x->xlsWriteLabel($xlsRow, 23, $field['stato_mch']);
                $x->xlsWriteLabel($xlsRow, 24, "");
                $xlsRow++;
            }
            $x->WriteFile();
            $d->SessionLog("Terminata esportazione giacenza vecchio (hwold)");
            exit;
            ?>
				<script type="text/javascript">
					window.close();
				</script><?php 
            break;
        case "hwfull":
            $d->SessionLog("Avviata esportazione giacenza completa (hwfull)");
            $FileName = "tmp/Giacenza_Palermo_al_" . date('d-m-Y') . ".xls";
            $x = new XlsExport($FileName);
            $hwfull = $d->GetRows("*", "view_macchine", "", "id_macchina", 1);
            $x->xlsWriteLabel(0, 0, "ID Prodotto");
            // contatore base 1
            $x->xlsWriteLabel(0, 1, "TIPO /  PROVENIENZA");
            $x->xlsWriteLabel(0, 2, "DDT Arrivo e/o REQUEST NUMBER (x resi e dismesse)");
            // ddt_in
            $x->xlsWriteLabel(0, 3, "Nome Filiale Citta ( solo x dismessi)");
            // den
            $x->xlsWriteLabel(0, 4, "Codice Filiale");
            // cod_fil filiale
            $x->xlsWriteLabel(0, 5, "DATA IN");
            // data_in
            $x->xlsWriteLabel(0, 6, "ORDINE OUT (Utilizzato x l- uscita della merce)");
            // ddt_out
            $x->xlsWriteLabel(0, 7, "DATA OUT");