commit de 28072025_02
This commit is contained in:
parent
d043f6f20b
commit
f41fc922a6
@ -3163,26 +3163,32 @@ Future<double> getValeurTotaleStock() async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> getHistoriqueSortiesPersonnelles({
|
||||
Future<List<Map<String, dynamic>>> getHistoriqueSortiesPersonnelles({
|
||||
int? adminId,
|
||||
String? statut,
|
||||
int? pointDeVenteId,
|
||||
int limit = 50,
|
||||
}) async {
|
||||
}) async {
|
||||
final db = await database;
|
||||
|
||||
try {
|
||||
String whereClause = '';
|
||||
List<dynamic> params = [];
|
||||
|
||||
// Filtre par point de vente seulement si pointDeVenteId n'est pas null
|
||||
// (null signifie que l'utilisateur a pointDeVenteId = 0 et peut tout voir)
|
||||
if (pointDeVenteId != null) {
|
||||
whereClause = 'WHERE sp.point_de_vente_id = ?';
|
||||
params.add(pointDeVenteId);
|
||||
}
|
||||
|
||||
if (adminId != null) {
|
||||
whereClause = 'WHERE sp.admin_id = ?';
|
||||
whereClause += (whereClause.isEmpty ? 'WHERE' : ' AND') + ' sp.admin_id = ?';
|
||||
params.add(adminId);
|
||||
}
|
||||
|
||||
if (statut != null) {
|
||||
whereClause +=
|
||||
(whereClause.isEmpty ? 'WHERE' : ' AND') + ' sp.statut = ?';
|
||||
whereClause += (whereClause.isEmpty ? 'WHERE' : ' AND') + ' sp.statut = ?';
|
||||
params.add(statut);
|
||||
}
|
||||
|
||||
@ -3210,7 +3216,7 @@ Future<double> getValeurTotaleStock() async {
|
||||
print('Erreur récupération historique sorties: $e');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getStatistiquesSortiesPersonnelles() async {
|
||||
final db = await database;
|
||||
|
||||
@ -1507,7 +1507,13 @@ Future<void> _showDemandeTransfertDialog(Product product) async {
|
||||
|
||||
// Valeurs par défaut
|
||||
normalizedData['description'] = ''; // Description toujours vide
|
||||
normalizedData['stock'] = 1; // Stock toujours à 1
|
||||
if (mapping.containsKey('stock')) {
|
||||
final stockValue = _cleanValue(_getColumnValue(row, mapping, 'stock'));
|
||||
final stock = int.tryParse(stockValue ?? '0') ?? 1;
|
||||
normalizedData['stock'] = stock > 0 ? stock : 1;
|
||||
} else {
|
||||
normalizedData['stock'] = 1; // Valeur par défaut
|
||||
}
|
||||
|
||||
// Validation des données obligatoires
|
||||
if (normalizedData['name'] == null || normalizedData['price'] == null) {
|
||||
@ -1567,6 +1573,9 @@ Future<void> _showDemandeTransfertDialog(Product product) async {
|
||||
} else if (header == 'PRIX' || header == 'PRICE') {
|
||||
columnMapping['price'] = i;
|
||||
print('→ Mappé vers price');
|
||||
} else if (header == 'STOCK' || header == 'QUANTITY' || header == 'QTE') {
|
||||
columnMapping['stock'] = i;
|
||||
print('→ Mappé vers stock');
|
||||
} else if (header == 'BOUTIQUE' ||
|
||||
header.contains('POINT DE VENTE') ||
|
||||
header == 'MAGASIN') {
|
||||
@ -2175,6 +2184,7 @@ Future<void> _showDemandeTransfertDialog(Product product) async {
|
||||
'RAM', // ram
|
||||
'INTERNE', // memoire_interne
|
||||
'IMEI', // imei
|
||||
'STOCK'
|
||||
'PRIX', // price
|
||||
'BOUTIQUE', // point_de_vente
|
||||
];
|
||||
|
||||
@ -636,7 +636,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
if (detail.estCadeau) ...[
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 8,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
@ -655,7 +655,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
),
|
||||
] else if (detail.aRemise) ...[
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 8,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
@ -664,7 +664,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
)
|
||||
),
|
||||
pw.Text(
|
||||
'${(detail.prixFinal / detail.quantite).toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal / detail.quantite)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 10,
|
||||
color: PdfColors.orange700,
|
||||
@ -709,7 +709,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
),
|
||||
] else if (detail.aRemise) ...[
|
||||
pw.Text(
|
||||
'${detail.sousTotal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.sousTotal)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 8,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
@ -718,7 +718,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
)
|
||||
),
|
||||
pw.Text(
|
||||
'${detail.prixFinal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: pw.FontWeight.bold,
|
||||
@ -727,7 +727,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
),
|
||||
] else
|
||||
pw.Text(
|
||||
'${detail.prixFinal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal)}',
|
||||
style: smallTextStyle
|
||||
),
|
||||
],
|
||||
@ -759,7 +759,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
pw.Text('SOUS-TOTAL:', style: smallTextStyle),
|
||||
pw.SizedBox(width: 10),
|
||||
pw.Text('${sousTotal.toStringAsFixed(0)}', style: smallTextStyle),
|
||||
pw.Text('${NumberFormat('#,##0', 'fr_FR').format(sousTotal)}', style: smallTextStyle),
|
||||
],
|
||||
),
|
||||
pw.SizedBox(height: 2),
|
||||
@ -771,7 +771,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
pw.Text('REMISES:', style: pw.TextStyle(color: PdfColors.orange, fontSize: 10, font: regularFont)),
|
||||
pw.SizedBox(width: 10),
|
||||
pw.Text('-${totalRemises.toStringAsFixed(0)}', style: pw.TextStyle(color: PdfColors.orange, fontSize: 10, font: regularFont)),
|
||||
pw.Text('-${NumberFormat('#,##0', 'fr_FR').format(totalRemises)}', style: pw.TextStyle(color: PdfColors.orange, fontSize: 10, font: regularFont)),
|
||||
],
|
||||
),
|
||||
pw.SizedBox(height: 2),
|
||||
@ -783,7 +783,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
pw.Text('CADEAUX ($nombreCadeaux):', style: pw.TextStyle(color: PdfColors.green700, fontSize: 10, font: regularFont)),
|
||||
pw.SizedBox(width: 10),
|
||||
pw.Text('-${totalCadeaux.toStringAsFixed(0)}', style: pw.TextStyle(color: PdfColors.green700, fontSize: 10, font: regularFont)),
|
||||
pw.Text('-${NumberFormat('#,##0', 'fr_FR').format(totalCadeaux)}', style: pw.TextStyle(color: PdfColors.green700, fontSize: 10, font: regularFont)),
|
||||
],
|
||||
),
|
||||
pw.SizedBox(height: 2),
|
||||
@ -1197,7 +1197,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
pw.Container(
|
||||
width: 180, height: 1, color: PdfColors.black),
|
||||
pw.SizedBox(height: 4),
|
||||
pw.Text('${client?.nom} \n ${client?.prenom}',
|
||||
pw.Text('${client?.nom} ${client?.prenom}',
|
||||
style: boldTextStyle),
|
||||
pw.SizedBox(height: 4),
|
||||
pw.Text(client?.telephone ?? 'Non spécifié',
|
||||
@ -1357,7 +1357,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
if (detail.estCadeau) ...[
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 7,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
@ -1373,19 +1373,19 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
detail.prixUnitaire !=
|
||||
detail.sousTotal / detail.quantite) ...[
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 7,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
color: PdfColors.grey600,
|
||||
)),
|
||||
pw.Text(
|
||||
'${(detail.prixFinal / detail.quantite).toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal / detail.quantite)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 9, color: PdfColors.orange)),
|
||||
] else
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: normalTextStyle),
|
||||
],
|
||||
),
|
||||
@ -1419,7 +1419,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
if (detail.estCadeau) ...[
|
||||
pw.Text(
|
||||
'${detail.sousTotal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.sousTotal)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 7,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
@ -1434,20 +1434,20 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
] else if (detail.aRemise &&
|
||||
detail.sousTotal != detail.prixFinal) ...[
|
||||
pw.Text(
|
||||
'${detail.sousTotal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.sousTotal)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 7,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
color: PdfColors.grey600,
|
||||
)),
|
||||
pw.Text(
|
||||
'${detail.prixFinal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 9,
|
||||
fontWeight: pw.FontWeight.bold)),
|
||||
] else
|
||||
pw.Text(
|
||||
'${detail.prixFinal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal)}',
|
||||
style: normalTextStyle),
|
||||
],
|
||||
),
|
||||
@ -1475,7 +1475,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
pw.SizedBox(width: 20),
|
||||
pw.Container(
|
||||
width: 80,
|
||||
child: pw.Text('${sousTotal.toStringAsFixed(0)}',
|
||||
child: pw.Text('${NumberFormat('#,##0', 'fr_FR').format(sousTotal)}',
|
||||
style: normalTextStyle,
|
||||
textAlign: pw.TextAlign.right),
|
||||
),
|
||||
@ -1494,7 +1494,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
pw.Container(
|
||||
width: 80,
|
||||
child: pw.Text(
|
||||
'-${totalRemises.toStringAsFixed(0)}',
|
||||
'-${NumberFormat('#,##0', 'fr_FR').format(totalRemises)}',
|
||||
style: pw.TextStyle(
|
||||
color: PdfColors.orange,
|
||||
fontWeight: pw.FontWeight.bold,
|
||||
@ -1516,7 +1516,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
pw.Container(
|
||||
width: 80,
|
||||
child: pw.Text(
|
||||
'-${totalCadeaux.toStringAsFixed(0)}',
|
||||
'-${NumberFormat('#,##0', 'fr_FR').format(totalCadeaux)}',
|
||||
style: pw.TextStyle(
|
||||
color: PdfColors.green700,
|
||||
fontWeight: pw.FontWeight.bold,
|
||||
@ -1543,7 +1543,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
pw.Container(
|
||||
width: 80,
|
||||
child: pw.Text(
|
||||
'${commande.montantTotal.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(commande.montantTotal)}',
|
||||
style: boldTextStyle,
|
||||
textAlign: pw.TextAlign.right),
|
||||
),
|
||||
@ -2103,7 +2103,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
children: [
|
||||
if (detail.estCadeau) ...[
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 6,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
@ -2119,18 +2119,18 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
detail.prixUnitaire !=
|
||||
detail.prixFinal / detail.quantite) ...[
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 6,
|
||||
decoration: pw.TextDecoration.lineThrough,
|
||||
color: PdfColors.grey600,
|
||||
)),
|
||||
pw.Text(
|
||||
'${(detail.prixFinal / detail.quantite).toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal / detail.quantite)}',
|
||||
style: const pw.TextStyle(fontSize: 7)),
|
||||
] else
|
||||
pw.Text(
|
||||
'${detail.prixUnitaire.toStringAsFixed(0)}',
|
||||
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)}',
|
||||
style: const pw.TextStyle(fontSize: 7)),
|
||||
],
|
||||
),
|
||||
@ -2857,7 +2857,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
'-${totalRemises.toStringAsFixed(0)}',
|
||||
'-${NumberFormat('#,##0', 'fr_FR').format(totalRemises)}',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@ -556,7 +556,7 @@ class _HistoriquePageState extends State<HistoriquePage> {
|
||||
.format(commande.dateCommande),
|
||||
Icons.calendar_today),
|
||||
_buildDetailRow(
|
||||
'PV', '${_selectedPointDeVente} ', Icons.person),
|
||||
'PV', '${commande.pointDeVenteDesign} ', Icons.person),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.assignment,
|
||||
|
||||
@ -34,6 +34,7 @@ class _HistoriqueSortiesPersonnellesPageState extends State<HistoriqueSortiesPer
|
||||
final historique = await _database.getHistoriqueSortiesPersonnelles(
|
||||
adminId: _afficherSeulementMesDemandes ? _userController.userId : null,
|
||||
statut: _filtreStatut,
|
||||
pointDeVenteId: _userController.pointDeVenteId == 0 ? null : _userController.pointDeVenteId, // Si pointDeVenteId = 0, ne pas filtrer
|
||||
limit: 100,
|
||||
);
|
||||
setState(() {
|
||||
@ -150,8 +151,9 @@ class _HistoriqueSortiesPersonnellesPageState extends State<HistoriqueSortiesPer
|
||||
Icon(Icons.history, size: 64, color: Colors.grey),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'Aucun historique trouvé',
|
||||
'Aucun historique trouvé pour ce point de vente',
|
||||
style: TextStyle(fontSize: 18, color: Colors.grey),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -5,13 +5,13 @@ import 'dart:async';
|
||||
|
||||
class DatabaseConfig {
|
||||
// Local MySQL settings
|
||||
static const String localHost = '102.17.52.31';
|
||||
static const String localHost = '192.168.88.73';
|
||||
static const String localUsername = 'guycom';
|
||||
static const String? localPassword = '3iV59wjRdbuXAPR';
|
||||
static const String localDatabase = 'guycom';
|
||||
|
||||
// Production (public) MySQL settings
|
||||
static const String prodHost = '102.17.52.31';
|
||||
static const String prodHost = '185.70.105.157';
|
||||
static const String prodUsername = 'guycom';
|
||||
static const String prodPassword = '3iV59wjRdbuXAPR';
|
||||
static const String prodDatabase = 'guycom';
|
||||
|
||||
48
pubspec.lock
48
pubspec.lock
@ -57,6 +57,46 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
camera:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: camera
|
||||
sha256: dfa8fc5a1adaeb95e7a54d86a5bd56f4bb0e035515354c8ac6d262e35cec2ec8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.10.6"
|
||||
camera_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_android
|
||||
sha256: "4f40d053a67e99029b5be7f00ef8047b63edb65ccc4e2546b84d47e302c6bf62"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.10.10+4"
|
||||
camera_avfoundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_avfoundation
|
||||
sha256: cabc6cbdeadca9cbcac178110c9d5e87bde5c646c3b8c9c4c2747fc500a12432
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.20+5"
|
||||
camera_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_platform_interface
|
||||
sha256: "2f757024a48696ff4814a789b0bd90f5660c0fb25f393ab4564fb483327930e2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.10.0"
|
||||
camera_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_web
|
||||
sha256: "595f28c89d1fb62d77c73c633193755b781c6d2e0ebcd8dc25b763b514e6ba8f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.5"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1053,6 +1093,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -68,6 +68,7 @@ dependencies:
|
||||
numbers_to_letters: ^1.0.0
|
||||
qr_code_scanner_plus: ^2.0.10+1
|
||||
window_manager: ^0.3.7
|
||||
camera: ^0.10.5+9
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user