WIP : sauvegarde avant de continuer ordreGF fctionne mais pas les btn

This commit is contained in:
2026-07-05 13:52:19 +00:00
parent 33a23d0392
commit 26c5f06f98
7 changed files with 369 additions and 5 deletions
+9
View File
@@ -0,0 +1,9 @@
{
"yaml.schemas": {
"file:///home/jfgiraud/.vscode-server/extensions/continue.continue-2.0.0-linux-x64/config-yaml-schema.json": [
".continue/**/*.yaml",
"file:///home/jfgiraud/.continue/config.yaml"
]
},
"json.schemas": []
}
+157
View File
@@ -0,0 +1,157 @@
:root {
--ordregf-bg: #13161f;
--ordregf-card: #1c2030;
--ordregf-border: rgba(255, 255, 255, 0.08);
--ordregf-text: #f0f2fc;
}
/* Force le plein écran */
.ordregf-page {
background-color: var(--ordregf-bg);
margin: 0;
padding: 0;
}
.ordregf-shell {
width: 100%;
max-width: none;
margin: 0;
padding: 20px;
box-sizing: border-box;
}
.ordregf-card {
background: var(--ordregf-card);
border-radius: 12px;
padding: 20px;
width: 100%;
box-sizing: border-box;
}
/* Tables en pleine largeur */
.ordregf-table,
.ordregf-detail-table {
width: 100% !important;
border-collapse: collapse;
table-layout: auto;
}
/* Alignements entêtes */
.ordregf-table th,
.ordregf-detail-table th {
background: rgba(255, 255, 255, 0.05);
padding: 12px;
text-align: left;
color: #fff;
}
.ordregf-detail-table th {
text-align: center !important;
vertical-align: middle;
}
.ordregf-detail-table td {
padding: 8px;
border-bottom: 1px solid var(--ordregf-border);
}
/* Styles boutons */
.ordregf-edit-button {
padding: 4px 12px;
cursor: pointer;
}
/* Boutons principaux (Créer et Retour) */
.ordregf-btn-menu,
.ordregf-btn-creer {
padding: 10px 24px !important;
border-radius: 50px !important;
border: none !important;
cursor: pointer !important;
font-size: 14px !important;
font-weight: 600 !important;
text-decoration: none !important;
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
transition: background 0.3s ease !important;
color: #ffffff !important;
}
/* Bouton Menu (Bleu) */
.ordregf-btn-menu {
background-color: #1a237e !important;
}
.ordregf-btn-menu:hover {
background-color: #283593 !important;
}
/* Bouton Créer (Vert) */
.ordregf-btn-creer {
background-color: #28a745 !important;
}
.ordregf-btn-creer:hover {
background-color: #218838 !important;
}
/* Styles lignes */
.ordregf-header-style {
background: rgba(255, 255, 255, 0.05) !important;
}
.ordregf-header-style td {
color: #fff !important;
font-weight: 600 !important;
padding: 12px !important;
border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
}
.ordregf-detail-row td {
padding: 10px 5px !important;
border-bottom: 1px solid var(--ordregf-border);
color: #e0e0e0;
font-family: monospace;
}
.ordregf-detail-row:hover {
background-color: rgba(255, 255, 255, 0.03);
}
/* Alignement colonnes numériques */
.ordregf-detail-table .text-right {
text-align: right !important;
padding-right: 15px !important;
}
/* Classe commune : force la taille et l'alignement */
.ordregf-btn-petit {
width: 90px; /* Largeur fixe pour tous les petits boutons */
height: 30px; /* Hauteur fixe pour un alignement vertical parfait */
padding: 0 10px; /* Padding horizontal */
font-size: 0.8em;
font-weight: 600;
cursor: pointer;
border: none;
border-radius: 4px;
display: inline-flex; /* Utilise Flexbox pour centrer le texte */
align-items: center; /* Centre verticalement */
justify-content: center; /* Centre horizontalement */
box-sizing: border-box; /* Important : inclut padding/border dans la largeur */
}
/* Couleurs spécifiques */
.ordregf-btn-creer-petit {
background-color: #28a745;
color: white;
}
.ordregf-btn-creer-petit:hover {
background-color: #218838;
}
.ordregf-btn-modifier-petit {
background-color: #1a237e;
color: white;
}
.ordregf-btn-modifier-petit:hover {
background-color: #283593;
}
View File
+3 -1
View File
@@ -1,9 +1,10 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bourse - Page d'Accueil</title>
<title>Bourse</title>
<link rel="stylesheet" href="/css/style.css">
<?php if (!empty($pageStylesheets) && is_array($pageStylesheets)): ?>
<?php foreach ($pageStylesheets as $sheet): ?>
@@ -12,6 +13,7 @@
<?php endif; ?>
<link rel="shortcut icon" href="/assets/images/favicon.png" type="image/x-icon">
</head>
<body class="<?= !empty($bodyClass) ? htmlspecialchars($bodyClass, ENT_QUOTES, 'UTF-8') : '' ?>">
<header class="header">
<div class="container">
+1 -1
View File
@@ -28,7 +28,7 @@ require_once __DIR__ . '/header.php';
</header>
<form name="menu" class="menu-grid" action="#" method="post" autocomplete="off" novalidate>
<button type="button" class="menu-button" data-target="/php/order_gf.php">
<button type="button" class="menu-button" data-target="/php/ordreGF.php">
<div class="menu-button__content">
<span class="menu-button__title">Ordre GF</span>
<span class="menu-button__text">Voir et modifier les ordres GF</span>
+177
View File
@@ -0,0 +1,177 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/session.php';
require_once __DIR__ . '/db.php';
if (empty($_SESSION['user_id'])) {
header('Location: ../index.php');
exit;
}
$pageStylesheets = ['/css/ordreGF.css'];
$bodyClass = 'ordregf-page';
$database = new App\Database\Database();
$connection = $database->getConnection();
// --- Fonctions ---
function fetchOrdreGF(PDO $connection): array
{
return $connection->query('SELECT * FROM `ordreGF` ORDER BY `Id` DESC')->fetchAll(PDO::FETCH_ASSOC) ?: [];
}
function fetchOrdreGFPied(PDO $connection, string $masterId): array
{
$stmt = $connection->prepare('SELECT * FROM `ordreGF_pied` WHERE `Id_entete` = :masterId ORDER BY `Id` ASC');
$stmt->execute([':masterId' => $masterId]);
return $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
}
$ordres = fetchOrdreGF($connection);
require_once __DIR__ . '/header.php';
?>
<section class="ordregf-shell">
<div class="ordregf-card">
<header class="ordregf-card-header" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px;">
<h1 class="ordregf-title">Gestion des ordres GF</h1>
<!-- Conteneur des boutons -->
<div style="display: flex; gap: 10px;">
<button type="button" class="ordregf-btn-creer" onclick="window.location.href='/php/creer_ordre.php';">
Créer un ordre
</button>
<button type="button" class="ordregf-btn-menu" onclick="window.location.href='/php/menu.php';">
Retour au menu
</button>
</div>
</header>
<div class="ordregf-table-wrapper">
<table class="ordregf-table">
<tbody>
<?php foreach ($ordres as $ordre): ?>
<!-- Ligne d'entête (Master) -->
<tr class="ordregf-master-row ordregf-header-style">
<td colspan="8" style="font-weight: bold; font-size: 1.1em; color: #fff;">
<?php
// Affichage explicite des colonnes demandées
echo htmlspecialchars((string)$ordre['isin']) . ' --- ' .
htmlspecialchars((string)$ordre['Nom']) . ' ( ' .
htmlspecialchars((string)$ordre['ticker']) . ' )';
?>
</td>
</tr>
<!-- Lignes de détails -->
<tr class="ordregf-detail-block">
<td colspan="8">
<table class="ordregf-detail-table">
<thead>
<tr>
<th>Date</th>
<th>Qté</th>
<th>Prix Brut</th>
<th>Frais</th>
<th>Prix Net</th>
<th>Engagement Brut</th>
<th>Engagement Net</th>
<th>Ordre</th>
<th>Type</th>
<th>Etat</th>
<!-- Cellule pour le bouton -->
<th style="text-align: right;">
<button type="button" class="ordregf-btn-petit ordregf-btn-creer-petit" onclick="...">
Créer
</button>
</th>
</tr>
</thead>
<tbody>
<?php
$totalQ = 0;
$engaBrut = 0;
$engaNet = 0;
$details = fetchOrdreGFPied($connection, (string)$ordre['ID']);
foreach ($details as $detail):
// Calculs
$qte = (int)($detail['Quantite'] ?? 0);
$prix = (float)($detail['Prix_brut'] ?? 0);
$frais = (float)($detail['Frais_brocker'] ?? 0) + (float)($detail['Frais_etat'] ?? 0) + (float)($detail['Frais_autre'] ?? 0);
$prixNet = $prix + $frais;
$date = !empty($detail['Date_op']) ? date('d/m/Y', strtotime($detail['Date_op'])) : '--/--/----';
// Logique du Total Q
$ordre_type = strtolower($detail['Ordre'] ?? '');
$type_op = strtolower($detail['Type'] ?? '');
$etat = strtolower($detail['Etat'] ?? '');
if ($etat === 'actif') {
if ($type_op === 'long') {
if ($ordre_type === 'achat') {
$totalQ += $qte;
$engaBrut += $qte * $prix;
$engaNet += $qte * $prixNet;
} elseif ($ordre_type === 'vente') {
$totalQ -= $qte;
$engaBrut -= $qte * $prix;
$engaNet -= $qte * $prixNet;
}
} elseif ($type_op === 'short') {
if ($ordre_type === 'achat') {
$totalQ -= $qte;
$engaBrut -= $qte * $prix;
$engaNet -= $qte * $prixNet;
} elseif ($ordre_type === 'vente') {
$totalQ += $qte;
$engaBrut += $qte * $prix;
$engaNet += $qte * $prixNet;
}
}
}
?>
<tr class="ordregf-detail-row">
<td><?= htmlspecialchars($date) ?></td>
<td class="text-right"><?= number_format($qte, 0, ',', ' ') ?></td>
<td class="text-right"><?= number_format($prix, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($frais, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($prixNet, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($qte * $prix, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($qte * $prixNet, 3, ',', ' ') ?></td>
<td><?= htmlspecialchars($detail['Ordre'] ?? '') ?></td>
<td><?= htmlspecialchars($detail['Type'] ?? '') ?></td>
<td><?= htmlspecialchars($detail['Etat'] ?? '') ?></td>
<td style="text-align: right;">
<button type="button" class="ordregf-btn-petit ordregf-btn-modifier-petit" data-detail='<?= json_encode($detail) ?>'>
Modifier
</button>
</td>
</tr>
<?php endforeach; ?>
<!-- Ligne du Footer de calcul -->
<tr style="background-color: rgba(255, 255, 255, 0.08); font-weight: bold;">
<td style="text-align: right;">TOTAL :</td>
<td class="text-right"><?= number_format($totalQ, 0, ',', ' ') ?></td>
<td class="text-right"><?= number_format($engaBrut / $totalQ, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($engaNet / $totalQ - $engaBrut / $totalQ, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($engaNet / $totalQ, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($engaBrut, 3, ',', ' ') ?></td>
<td class="text-right"><?= number_format($engaNet, 3, ',', ' ') ?></td>
<td colspan="4"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</section>
<?php require_once __DIR__ . '/footer.php'; ?>
+22 -3
View File
@@ -1,6 +1,7 @@
.
├── assets
│   ├── csv
│   │   ├── actions.csv
│   │   ├── autre.csv
│   │   ├── ibex35.csv
│   │   ├── nasdaq100.csv
@@ -12,20 +13,38 @@
├── composer.json
├── composer.lock
├── css
│   ├── 404.css
│   ├── actions.css
│   ├── compteGF.css
│   ├── compteJFG.css
│   ├── csv.css
│   ├── menu.css
│   └── style.css
├── index.php
├── js
│   ├── actions.js
│   ├── compteGF.js
│   ├── compteJFG.js
│   ├── csv.js
│   └── menu.js
├── php
│   ├── 404.php
│   ├── actions.php
│   ├── compteGF.php
│   ├── compteJFG.php
│   ├── csv.php
│   ├── db.php
│   ├── download_csv.php
│   ├── footer.php
│   ├── forgot_password.php
│   ├── header.php
│   ├── login_process.php
│   ├── logout.php
│   ├── menu.php
│   ├── register.php
│   ├── reset_password.php
│   ── session.php
│   ── session.php
│   └── update_csv.php
├── structure.txt
└── vendor
├── autoload.php
@@ -118,6 +137,6 @@
│   └── SMTP.php
└── VERSION
13 directories, 106 files
13 directories, 125 files
tree > structure.txt
tree > structure.txt