function getInfo()
{
    $id = $_GET['id'];
    $type = $_GET['type'];
    $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
    switch ($type) {
        case "repas":
            $output[0] = "<b>Encaissement au comptant (Ticket Repas)</b><br/>";
            $output[1] = strtoupper($type);
            break;
        case "cantine":
            $query = "SELECT `datefacture`,`communeid`,`montantfcp`,`montanteuro`,`restearegler` FROM `" . DB . "`.`factures_cantine` WHERE `idfacture` = {$id}";
            $result = $mysqli->query($query);
            $row = $result->fetch_array(MYSQLI_ASSOC);
            $output[0] = "<b>Facture {$type} " . $row['communeid'] . " du " . standarddateformat($row['datefacture']) . " montant " . trispace($row['montantfcp']) . "FCP (" . $row['montanteuro'] . "&euro;)</b><br/>" . "Reste &agrave; r&eacute;gler " . trispace($row['restearegler']) . " FCP<input type='hidden' id='montantmax' value='" . $row['restearegler'] . "'/><input type='hidden' id='montanttotal' value='" . $row['montantfcp'] . "'/>";
            $output[1] = strtoupper($type);
            break;
        case "etal":
            $query = "SELECT `datefacture`,`communeid`,`montantfcp`,`montanteuro`,`restearegler` FROM `" . DB . "`.`factures_etal` WHERE `idfacture` = {$id}";
            $result = $mysqli->query($query);
            $row = $result->fetch_array(MYSQLI_ASSOC);
            $output[0] = "<b>Facture Place et Etal " . $row['communeid'] . " du " . standarddateformat($row['datefacture']) . " montant " . trispace($row['montantfcp']) . "FCP (" . $row['montanteuro'] . "&euro;)</b><br/>" . "Reste &agrave; r&eacute;gler " . trispace($row['restearegler']) . " FCP<input type='hidden' id='montantmax' value='" . $row['restearegler'] . "'/><input type='hidden' id='montanttotal' value='" . $row['montantfcp'] . "'/>";
            $output[1] = "PLACE ET ETAL";
            break;
        case "amarrage":
            $query = "SELECT `datefacture`,`communeid`,`montantfcp`,`montanteuro`,`restearegler` FROM `" . DB . "`.`factures_amarrage` WHERE `idfacture` = {$id}";
            $result = $mysqli->query($query);
            $row = $result->fetch_array(MYSQLI_ASSOC);
            $output[0] = "<b>Facture Amarrage " . $row['communeid'] . " du " . standarddateformat($row['datefacture']) . " montant " . trispace($row['montantfcp']) . "FCP (" . $row['montanteuro'] . "&euro;)</b><br/>" . "Reste &agrave; r&eacute;gler " . trispace($row['restearegler']) . " FCP<input type='hidden' id='montantmax' value='" . $row['restearegler'] . "'/><input type='hidden' id='montanttotal' value='" . $row['montantfcp'] . "'/>";
            $output[1] = "AMARRAGE";
            break;
    }
    $mysqli->close();
    return $output;
}
function genpdf($idfacture, $idpaiement, $date, $payeur, $type, $mode, $montant, $initiales, $no_cheque, $organisme, $obs)
{
    $xreg = 1.5;
    $yreg = 3.5;
    $pdf = new FPDF('P', 'mm', 'A4');
    $pdf->AddPage();
    //logo
    $pdf->Image('img/logo.jpg', 10 + $xreg, 14 + $yreg, 12, 10, 'jpg');
    $pdf->SetLineWidth(0.4);
    $pdf->Rect(4 + $xreg, 7 + $yreg, 196, 30);
    //rectangle global
    $pdf->Line(4 + $xreg, 13 + $yreg, 200 + $xreg, 13 + $yreg);
    //1ere barre horizontale
    $pdf->Line(27 + $xreg, 7 + $yreg, 27 + $xreg, 37 + $yreg);
    //1ere barre verticale
    $pdf->Line(77 + $xreg, 7 + $yreg, 77 + $xreg, 37 + $yreg);
    //2nd barre verticale
    $pdf->Line(127 + $xreg, 7 + $yreg, 127 + $xreg, 37 + $yreg);
    //3eme barre verticale
    $pdf->Line(152 + $xreg, 7 + $yreg, 152 + $xreg, 37 + $yreg);
    //4eme barre verticale
    $pdf->Line(177 + $xreg, 7 + $yreg, 177 + $xreg, 37 + $yreg);
    //5eme barre verticale
    $pdf->SetLineWidth(0.2);
    $pdf->Line(27 + $xreg, 21 + $yreg, 200 + $xreg, 21 + $yreg);
    //1ere barre fine horizontale
    $pdf->Line(4 + $xreg, 31 + $yreg, 200 + $xreg, 31 + $yreg);
    //2nd barre fine horizontale
    $pdf->SetFont('Arial', '', 8);
    $pdf->SetXY(4 + $xreg, 7 + $yreg);
    $pdf->Cell(23, 7, utf8_decode('DATE'), 0, 1, 'C');
    $pdf->SetXY(27 + $xreg, 7 + $yreg);
    $pdf->Cell(50, 7, utf8_decode('NOM de la partie versante'), 0, 1, 'C');
    $pdf->SetXY(27 + $xreg, 13 + $yreg);
    $pdf->Cell(50, 7, utf8_decode('Reçu de M.'), 0, 1, '');
    $pdf->SetXY(77 + $xreg, 7 + $yreg);
    $pdf->Cell(50, 7, utf8_decode('DESIGNATION DES PRODUITS'), 0, 1, 'C');
    $pdf->SetXY(127 + $xreg, 7 + $yreg);
    $pdf->Cell(25, 3.5, utf8_decode('VERSEMENT'), 0, 1, 'C');
    $pdf->SetXY(127 + $xreg, 9.5 + $yreg);
    $pdf->Cell(25, 3.5, utf8_decode('en numéraire'), 0, 1, 'C');
    $pdf->SetXY(152 + $xreg, 7 + $yreg);
    $pdf->Cell(25, 7, utf8_decode('CHEQUES'), 0, 1, 'C');
    $pdf->SetXY(177 + $xreg, 7 + $yreg);
    $pdf->Cell(25, 7, utf8_decode('DIVERS'), 0, 1, 'C');
    //data
    $pdf->SetXY(4 + $xreg, 25 + $yreg);
    $pdf->Cell(23, 7, "No. " . $idpaiement, 0, 1, 'C');
    $pdf->SetXY(4 + $xreg, 31 + $yreg);
    $pdf->Cell(23, 7, standarddateformat($date), 0, 1, 'C');
    $pdf->SetXY(27 + $xreg, 31 + $yreg);
    $pdf->Cell(50, 7, utf8_decode($obs), 0, 1, '');
    $pdf->SetXY(27 + $xreg, 21 + $yreg);
    $pdf->Cell(50, 10, strtoupper(utf8_decode($payeur)), 0, 1, 'C');
    switch ($mode) {
        case 'num':
            $pdf->SetXY(125 + $xreg + $xreg, 21 + $yreg);
            break;
        case 'chq':
            $pdf->SetXY(150 + $xreg + $xreg, 19 + $yreg);
            break;
        default:
            $pdf->SetXY(175 + $xreg + $xreg, 21 + $yreg);
            break;
    }
    $pdf->Cell(25, 10, utf8_decode(trispace($montant) . ' FCP'), 0, 1, 'C');
    $pdf->SetXY(150 + $xreg + $xreg, 23 + $yreg);
    $pdf->Cell(25, 10, utf8_decode($organisme . ' ' . $no_cheque), 0, 1, 'C');
    $pdf->SetXY(77 + $xreg + $xreg, 13 + $yreg);
    $pdf->Cell(50, 10, utf8_decode('Facture n° ' . $idfacture), 0, 1, 'C');
    $pdf->SetXY(77 + $xreg + $xreg, 21 + $yreg);
    $pdf->Cell(50, 10, utf8_decode($type), 0, 1, 'C');
    $pdf->SetXY(77 + $xreg + $xreg, 29 + $yreg);
    $pdf->Cell(50, 10, utf8_decode('Receveur ' . $initiales), 0, 1, 'C');
    $pdf->Output();
}