menu compteGF et compteJFG full operationnel
This commit is contained in:
+124
@@ -71,6 +71,68 @@ class Database
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class CompteJFGManager
|
||||
*
|
||||
* Opérations CRUD sur la table `compteJFG`.
|
||||
*/
|
||||
class CompteJFGManager
|
||||
{
|
||||
private PDO $connection;
|
||||
|
||||
public function __construct(Database $database)
|
||||
{
|
||||
$this->connection = $database->getConnection();
|
||||
}
|
||||
|
||||
public function listCompteJFG(): array
|
||||
{
|
||||
$statement = $this->connection->query(
|
||||
'SELECT id, date_operation, debit, credit, libelle, updated_at
|
||||
FROM compteJFG
|
||||
ORDER BY date_operation DESC, id DESC'
|
||||
);
|
||||
|
||||
return $statement->fetchAll();
|
||||
}
|
||||
|
||||
public function createCompteJFG(array $data): bool
|
||||
{
|
||||
$statement = $this->connection->prepare(
|
||||
'INSERT INTO compteJFG (date_operation, debit, credit, libelle, created_at, updated_at)
|
||||
VALUES (:date_operation, :debit, :credit, :libelle, NOW(), NOW())'
|
||||
);
|
||||
|
||||
$statement->bindValue(':date_operation', $data['date_operation'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':debit', $data['debit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':credit', $data['credit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':libelle', $data['libelle'], PDO::PARAM_STR);
|
||||
|
||||
return $statement->execute();
|
||||
}
|
||||
|
||||
public function updateCompteJFG(int $id, array $data): bool
|
||||
{
|
||||
$statement = $this->connection->prepare(
|
||||
'UPDATE compteJFG
|
||||
SET date_operation = :date_operation,
|
||||
debit = :debit,
|
||||
credit = :credit,
|
||||
libelle = :libelle,
|
||||
updated_at = NOW()
|
||||
WHERE id = :id'
|
||||
);
|
||||
|
||||
$statement->bindValue(':date_operation', $data['date_operation'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':debit', $data['debit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':credit', $data['credit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':libelle', $data['libelle'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
|
||||
return $statement->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class LoginManager
|
||||
*
|
||||
@@ -507,3 +569,65 @@ class ActionsManager
|
||||
return $statement->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class CompteGFManager
|
||||
*
|
||||
* Opérations CRUD sur la table `compteGF`.
|
||||
*/
|
||||
class CompteGFManager
|
||||
{
|
||||
private PDO $connection;
|
||||
|
||||
public function __construct(Database $database)
|
||||
{
|
||||
$this->connection = $database->getConnection();
|
||||
}
|
||||
|
||||
public function listCompteGF(): array
|
||||
{
|
||||
$statement = $this->connection->query(
|
||||
'SELECT id, date_operation, debit, credit, libelle, updated_at
|
||||
FROM compteGF
|
||||
ORDER BY date_operation DESC, id DESC'
|
||||
);
|
||||
|
||||
return $statement->fetchAll();
|
||||
}
|
||||
|
||||
public function createCompteGF(array $data): bool
|
||||
{
|
||||
$statement = $this->connection->prepare(
|
||||
'INSERT INTO compteGF (date_operation, debit, credit, libelle, created_at, updated_at)
|
||||
VALUES (:date_operation, :debit, :credit, :libelle, NOW(), NOW())'
|
||||
);
|
||||
|
||||
$statement->bindValue(':date_operation', $data['date_operation'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':debit', $data['debit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':credit', $data['credit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':libelle', $data['libelle'], PDO::PARAM_STR);
|
||||
|
||||
return $statement->execute();
|
||||
}
|
||||
|
||||
public function updateCompteGF(int $id, array $data): bool
|
||||
{
|
||||
$statement = $this->connection->prepare(
|
||||
'UPDATE compteGF
|
||||
SET date_operation = :date_operation,
|
||||
debit = :debit,
|
||||
credit = :credit,
|
||||
libelle = :libelle,
|
||||
updated_at = NOW()
|
||||
WHERE id = :id'
|
||||
);
|
||||
|
||||
$statement->bindValue(':date_operation', $data['date_operation'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':debit', $data['debit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':credit', $data['credit'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':libelle', $data['libelle'], PDO::PARAM_STR);
|
||||
$statement->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
|
||||
return $statement->execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user