<?php
class Compta {

    public static function getByVente($vente = 1) {
        $query = "SELECT * FROM compta WHERE Vente=:vente ORDER BY GM";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":vente", $vente);
        $statement->execute();
        return $statement->fetch();
    }  

    
    public static function getByVenteAndGM($vente, $gm) {
        $query = "SELECT * FROM compta WHERE Vente=:vente AND GM=:gm";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":vente", $vente);
        $statement->bindParam(":gm", $gm);
        $statement->execute();
        return $statement->fetch();
    }    
}