petiflamand
Messages postés675Date d'inscriptionsamedi 31 mai 2003StatutMembreDernière intervention26 mai 2013
-
11 mars 2009 à 22:28
petiflamand
Messages postés675Date d'inscriptionsamedi 31 mai 2003StatutMembreDernière intervention26 mai 2013
-
12 mars 2009 à 18:52
voici mon codeSet db = OpenDatabase(App.Path & "\manager.mdb")Set rs = db.OpenRecordset("ticket")If rs.RecordCount > 0 Thenrs.MoveFirst'cont = rs!nticketDo Until rs.EOF = TrueIf rs!Date = principale.Text4 Thentoc = rs!nticketIf cont rs!nticket Thennb_ticket = nb_ticket + 1'----------------------------------------------
MSFlexGrid1.AddItem ("1") MSFlexGrid1.Row = MSFlexGrid1.Rows - 1 MSFlexGrid1.col = 1 MSFlexGrid1.Text = toc MSFlexGrid1.col = 2 MSFlexGrid1.Text = rs!Date MSFlexGrid1.col = 3 MSFlexGrid1.Text = rs!heure MSFlexGrid1.col = 4 Set rd = db.OpenRecordset("select SUM(ticket.TOTAL) As TOTALPlus ,nticket from ticket WHERE ticket.nticket=" & toc & " and ticket.opa='+' group by nticket") On Error GoTo erreur4 totalplus = rd!totalplus Set rr = db.OpenRecordset("select SUM(ticket.TOTAL) As TOTALMoin ,nticket FROM ticket WHERE ticket.nticket=" & toc & " and ticket.opa='-' group by nticket") On Error GoTo erreur5 totalmoin = rr!totalmoin On Error GoTo erreur3
If totalmoin > 0 ThenMSFlexGrid1.Text = Format(totalplus, "###0.00") - Format(totalmoin, "###0.00")ElseMSFlexGrid1.Text = Format(rd!totalplus, "###0.00")End IfMSFlexGrid1.col = 5MSFlexGrid1.Text = rs!mode_pay
End Ifcont = rs!nticketEnd Ifrs.MoveNext
'cont = rs!nticketLoopEnd IfVOICI MA TABLE
shift
nticket
ncaisse
date
heure
cod_prod
design
departement
numero_dep
tva
mode_pay
opa
prix_achat
prix_vente
quantité
pvente
mois
année
TOTAL
NF
total_achat
180823
thierry
11/03/2009
07:06:58
5410133810035
rizla grise
CIGARETTES 21
2
21
cash
+
0,00 €
0,80 €
1
0,8
0,80 €
Non
0,00 €
180823
thierry
11/03/2009
07:07:00
5010891011868
RIZLA LONGUE
CIGARETTES 21
2
21
cash
+
0,00 €
0,90 €
1
0,9
0,90 €
Non
0,00 €
180824
thierry
11/03/2009
07:11:01
54027060
MARLBORO
CIGARETTES
1
0
bancontact
+
0,00 €
4,40 €
1
4,4
4,40 €
Non
0,00 €
180824
thierry
11/03/2009
07:11:01
54027060
MARLBORO
CIGARETTES
1
0
bancontact
+
0,00 €
4,40 €
1
4,4
4,40 €
Non
0,00 €
180824
thierry
11/03/2009
07:11:06
40099293
FREEDENT CHLORO
SHOP 6
4
6
bancontact
+
0,00 €
1,00 €
1
1
1,00 €
Non
0,00 €
180824
thierry
11/03/2009
07:11:07
40099293
FREEDENT CHLORO
SHOP 6
4
6
bancontact
+
0,00 €
1,00 €
1
1
1,00 €
Non
0,00 €
180824
thierry
11/03/2009
07:11:07
40099293
FREEDENT CHLORO
SHOP 6
4
6
bancontact
+
0,00 €
1,00 €
1
1
1,00 €
Non
0,00 €
180824
thierry
11/03/2009
07:11:07
40099293
FREEDENT CHLORO
SHOP 6
4
6
bancontact
+
0,00 €
1,00 €
1
1
1,00 €
Non
0,00 €
180825
thierry
11/03/2009
07:12:14
2
EURO SUPER 95
CARBURANT EURO
91
21
bancontact
+
0,00 €
1,23 €
12
15,17823
15,18 €
Non
0,00 €
180826
thierry
11/03/2009
07:13:42
87196931
KENT
CIGARETTES
1
0
cash
+
0,00 €
4,40 €
1
4,4
4,40 €
Non
0,00 €
180826
thierry
11/03/2009
07:13:43
87196931
KENT
CIGARETTES
1
0
cash
+
0,00 €
4,40 €
1
4,4
4,40 €
Non
0,00 €
180827
thierry
11/03/2009
07:16:44
5413635023347
LA MEUSE
LIBRAIRIE B
21
0
cash
+
0,00 €
1,00 €
1
1
1,00 €
Non
0,00 €
180828
thierry
11/03/2009
07:17:05
90162909
RED BULL
SHOP 6
4
6
cash
+
0,00 €
1,80 €
1
1,8
1,80 €
Non
0,00 €
180828
thierry
11/03/2009
07:17:07
90162909
RED BULL
SHOP 6
4
6
cash
+
0,00 €
1,80 €
1
1,8
1,80 €
Non
0,00 €
180828
thierry
11/03/2009
07:17:08
90162909
RED BULL
SHOP 6
4
6
cash
+
0,00 €
1,80 €
1
1,8
1,80 €
Non
0,00 €
180828
thierry
11/03/2009
07:17:10
600
pain
PAIN
34
6
cash
+
0,00 €
1,75 €
1
1,75
1,75 €
Non
0,00 €
180828
thierry
11/03/2009
07:17:15
3258171933109
GAULOISES BL 29
CIGARETTES
1
0
cash
+
0,00 €
5,80 €
1
5,8
5,80 €
Non
0,00 €
180829
thierry
11/03/2009
07:17:45
80310839
TIC TAC LIM ORA
SHOP 6
4
6
cash
+
0,00 €
0,80 €
1
0,8
0,80 €
Non
0,00 €
180831
thierry
11/03/2009
07:23:27
5449000052926
FANTA 1,5 L
SHOP 6
4
6
cash
+
0,00 €
1,85 €
1
1,85
1,85 €
Non
0,00 €
180831
thierry
11/03/2009
07:23:29
54027381
NEXT 20 CIG
CIGARETTES
1
0
cash
+
0,00 €
3,70 €
1
3,7
3,70 €
Non
0,00 €
180832
thierry
11/03/2009
07:25:01
87248869
L&M
CIGARETTES
1
0
bancontact
+
0,00 €
5,00 €
1
5
5,00 €
Non
0,00 €
180832
thierry
11/03/2009
07:25:01
87248869
L&M
CIGARETTES
1
0
bancontact
+
0,00 €
5,00 €
1
5
5,00 €
Non
0,00 €
180833
thierry
11/03/2009
07:28:47
5420018057202
GALETTE PUR BEU
SHOP 6
4
6
cash
+
0,00 €
0,75 €
1
0,75
0,75 €
Non
0,00 €
180833
thierry
11/03/2009
07:28:50
54491472
COCA LIGHTCIT 5
SHOP 6
4
6
cash
+
0,00 €
1,35 €
1
1,35
1,35 €
Non
0,00 €
180835
thierry
11/03/2009
07:32:23
90162909
RED BULL
SHOP 6
4
6
cash
+
0,00 €
1,80 €
1
1,8
1,80 €
Non
0,00 €
180835
thierry
11/03/2009
07:32:24
90162909
RED BULL
SHOP 6
4
6
cash
+
0,00 €
1,80 €
1
1,8
1,80 €
Non
0,00 €
180835
thierry
11/03/2009
07:32:26
5449000052926
FANTA 1,5 L
SHOP 6
4
6
cash
+
0,00 €
1,85 €
1
1,85
1,85 €
Non
0,00 €
180835
thierry
11/03/2009
07:32:28
54137417
LM BIG PACK
CIGARETTES
1
0
cash
+
0,00 €
6,00 €
1
6
6,00 €
Non
0,00 €
180836
thierry
11/03/2009
07:32:58
54137493
MARLBORO INTENS
CIGARETTES
1
0
cash
+
0,00 €
4,20 €
1
4,2
4,20 €
Non
0,00 €
180836
thierry
11/03/2009
07:32:58
90162909
RED BULL
SHOP 6
4
6
cash
+
0,00 €
1,80 €
1
1,8
1,80 €
Non
0,00 €
Quand je fait mon code il me trouve 2 X le 180824bonjour si vous avez plus simple pour moi je suis preneurMon code me sert a aditionner tout les ticket de même numéroMerci
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 202174 12 mars 2009 à 10:08
toute ta maladroite mécanique peut être faite grace a une requete SQL bien tournée :
SELECT nticket,date,mode_pay,
SUM(SELECT SUM( TOTAL) FROM Table1 T2 WHERE T1.nticket=T2.nticket AND opa='+') As Plus,
SUM(SELECT SUM( TOTAL) FROM Table1 T2 WHERE T1.nticket=T2.nticket AND opa='-') AS Moins,
Plus-Moins As TOTAL
FROM Table1 T1
GROUP BY nticket, date, mode_pay
NB. je n'ai pas demandé ici l'heure, puisque le groupement de données ne fonctionnerait pas.
petiflamand
Messages postés675Date d'inscriptionsamedi 31 mai 2003StatutMembreDernière intervention26 mai 20131 12 mars 2009 à 18:52
Bonjour ,
Je vais tester , je suis nopvice donc je fait par rapport a ce que je connait , pour le ticket c'est normale puisque l'heure est intégré au moment ou on scan l'article