Bosna i Hercegovina



#16 30.05.2016-08:46
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
greska sve je tarifa 4 ne treba nikakav dodatni uvjet
probao za period 1.5.2016-23.52016 i ok jeali nema sume zadnjeg recordaza dan umjesto
toga je suma ukupna


nevsad ramic
↑  ↓

#17 30.05.2016-09:03
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
Dim rst As DAO.Recordset
IzborPrintera
br = 1
izn = 0
siznos = 0
Suma = 0
Close #1
Set rst = CurrentDb.OpenRecordset("KORISNIK")
'Open rst!Port For Output As #1
Open "C:\Temp\taxa.txt" For Output As #1
Print #1, strParPrint
Print #1, strIzbTrake
Print #1, strObSlova
Print #1, Tab(21 - Len(rst!korisnik)); rst!korisnik
Print #1, Tab(21 - Len(rst!adresa) - Len(rst!grad)); Nz(rst!adresa, ""); ","; Nz(rst!grad)
Print #1, "Izvjestaj o prodatim artiklima za period"
Print #1, Tab(7); "od"; Tab(10); Format(pocetni, "dd.mm.yyyy"); Tab(22); "do"; Tab(25); Format(krajnji, "dd.mm.yyyy")
Print #1, "========================================"
Print #1, " Datum Taxa Iznos"
Print #1, "========================================"
rst.Close
Set rst = CurrentDb.OpenRecordset("select * from Qzaperiod1 WHERE datum BETWEEN DATEVALUE('" & pocetni & "') AND DATEVALUE('" & krajnji & "')")
rst.MoveFirst
Datum = rst!Datum
Do Until rst.EOF
sif = rst!proizvod
im = rst!ime
izn = rst!SumOfiznos
If Datum <> rst!Datum Then

Print #1, "----------------------------------------"
Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
Print #1, "----------------------------------------"
Suma = rst!SumOfiznos
siznos = 0
Datum = rst!Datum
End If
Print #1, Format(rst!Datum, "dd.mm.yyyy"); " "; sif; Tab(16); right(im, 24); Tab(41 - Len(Format(izn, "###0.00"))); Format(izn, "###0.00")
siznos = siznos + rst!SumOfiznos
rst.MoveNext
Loop
Print #1, "----------------------------------------"
rst.MoveFirst
Do Until rst.EOF
Suma = Suma + rst!SumOfiznos
rst.MoveNext
Loop
rst.MoveFirst
Print #1, "SVEUKUPNO : "; Tab(41 - Len(Format(Suma, "####0.00"))); Format(Suma, "####0.00"); " KM"
Print #1, "----------------------------------------"
Print #1, Chr(27) & Chr(100) & Chr(8)
Print #1, Chr(27) & Chr(105)
Close #1
...
...

probao za period 1.5.2016-23.52016
treba biti 273
ja dobijem uvecan za zadnju sumu koju mi nesabere(da se vidi)

pozdrav nevsad
↑  ↓

#18 30.05.2016-10:12
Avko Offline
Administrator
Registrovan/a od: 28.05.2014-09:21
Komentari: 3,320


Subject: Re: Problem Petlja
ja sam mozda krivo razumio , neznam

Citat od zxz:
Mozes i sumu izracunati u petlji pa ti netreba ovaj rst Qzaperiod2
Bit ce jos brze i efikasnije.
U if uslovu sabiras sumu prije
siznos = 0

znaci, onako kako sam ja razumio umjesto ovoga:

DownloadIzvorni kod (Text):
  1. If Datum <> rst!Datum Then
  2.         Print #1, "----------------------------------------"
  3.         Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
  4.         Print #1, "----------------------------------------"
  5.         siznos = 0
  6.         Datum = rst!Datum
  7. End If

staviti ovo:

DownloadIzvorni kod (Text):
  1. If Datum <> rst!Datum Then
  2.         Print #1, "----------------------------------------"
  3.         Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
  4.         Print #1, "----------------------------------------"
  5.         Suma = Suma + rst!SumOfiznos
  6.         siznos = 0
  7.         Datum = rst!Datum
  8. End If

a kod tebe je zbrajanje u do loop petlji

DownloadIzvorni kod (Text):
  1. If Datum <> rst!Datum Then
  2.         Print #1, "----------------------------------------"
  3.         Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
  4.         Print #1, "----------------------------------------"
  5.         Suma = rst!SumOfiznos
  6.         siznos = 0
  7.         Datum = rst!Datum
  8. End If
  9.  
  10. Do Until rst.EOF
  11.         Suma = Suma + rst!SumOfiznos
  12.         rst.MoveNext
  13. Loop

Život je moja domovina.
↑  ↓

#19 30.05.2016-11:35
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
========================================
Datum Taxa Iznos
========================================
16.05.2016 56 RadnaTaksa 7.00
16.05.2016 56e rad.txt e_recept 40.00
----------------------------------------
16.05.2016 47.00
----------------------------------------
17.05.2016 56e rad.txt e_recept 34.00
----------------------------------------
17.05.2016 34.00
----------------------------------------
18.05.2016 56 RadnaTaksa 9.00
18.05.2016 56e rad.txt e_recept 38.00
----------------------------------------
18.05.2016 47.00
----------------------------------------
19.05.2016 56 RadnaTaksa 6.00
19.05.2016 56e rad.txt e_recept 59.00
----------------------------------------
19.05.2016 65.00
----------------------------------------
20.05.2016 56 RadnaTaksa 23.00
20.05.2016 56e rad.txt e_recept 21.00
----------------------------------------
20.05.2016 44.00
----------------------------------------
21.05.2016 55 participacija 1.00
21.05.2016 56e rad.txt e_recept 5.00
----------------------------------------
21.05.2016 6.00
----------------------------------------
23.05.2016 56e rad.txt e_recept 30.00
----------------------------------------
SVEUKUPNO : 273.00 KM

ovo sam rijesio ali generalno ostaje problem sume zadnjeg dana
23.05.2016 ne zbroji
niti rst.MoveLast ne odigra utakmicu
pozdrav nevsad
↑  ↓

#20 30.05.2016-11:57
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
ovo da rezultat
...
...
If Datum <> rst!Datum Then
Print #1, "----------------------------------------"
Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
Print #1, "----------------------------------------"
Suma = 0
siznos = 0
Datum = rst!Datum
End If
Print #1, Format(rst!Datum, "dd.mm.yyyy"); " "; sif; Tab(16); right(im, 24); Tab(41 - Len(Format(izn, "###0.00"))); Format(izn, "###0.00")
siznos = siznos + rst!SumOfiznos
rst.MoveNext
Loop
Print #1, "----------------------------------------"
rst.MoveFirst
Do Until rst.EOF
Suma = Suma + rst!SumOfiznos
rst.MoveNext
Loop
rst.MoveFirst
Print #1, "SVEUKUPNO : "; Tab(41 - Len(Format(Suma, "####0.00"))); Format(Suma, "####0.00"); " KM"
Print #1, "----------------------------------------"
Print #1, Chr(27) & Chr(100) & Chr(8)
Print #1, Chr(27) & Chr(105)
Close #1
...
...

23.05.2016 ne zbroji
nemam ideje
nevsad
↑  ↓

#21 30.05.2016-12:00
Avko Offline
Administrator
Registrovan/a od: 28.05.2014-09:21
Komentari: 3,320


Subject: Re: Problem Petlja
znaci nedostaje ovo:
----------------------------------------
23.05.2016 30.00
----------------------------------------

prije ovoga:

SVEUKUPNO : 273.00 KM

a jesi probao staviti ovo: Suma = Suma + rst!SumOfiznos
Život je moja domovina.
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 30.05.2016-12:12 od strane Avko. ↑  ↓

#22 30.05.2016-12:15
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
jesam
ovo treba sjesti i dobro rastabirit

mi smo mkrenuli putem

probaj probaj probaj

a
možda je bolje

kontaj kontaj pa probaj
↑  ↓

#23 30.05.2016-17:04
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
ovo je rijesenje

Public Function taxaOddo()
Dim rst As DAO.Recordset
IzborPrintera
br = 1
izn = 0
siznos = 0
Suma = 0
kizlaz = 0
Close #1
Set rst = CurrentDb.OpenRecordset("KORISNIK")
'Open rst!Port For Output As #1
Open "C:\Temp\taxa.txt" For Output As #1
Print #1, strParPrint
Print #1, strIzbTrake
Print #1, strObSlova
Print #1, Tab(21 - Len(rst!korisnik)); rst!korisnik
Print #1, Tab(21 - Len(rst!adresa) - Len(rst!grad)); Nz(rst!adresa, ""); ","; Nz(rst!grad)
Print #1, "Izvjestaj o prodatim artiklima za period"
Print #1, Tab(7); "od"; Tab(10); Format(pocetni, "dd.mm.yyyy"); Tab(22); "do"; Tab(25); Format(krajnji, "dd.mm.yyyy")
Print #1, "========================================"
Print #1, " Datum Taxa Iznos"
Print #1, "========================================"
rst.Close
Set rst = CurrentDb.OpenRecordset("select * from Qzaperiod1 WHERE datum BETWEEN DATEVALUE('" & pocetni & "') AND DATEVALUE('" & krajnji & "')")
rst.MoveFirst
Datum = rst!Datum
Do Until rst.EOF
sif = rst!proizvod
im = rst!ime
izn = rst!SumOfiznos
If Datum <> rst!Datum Then
Print #1, "----------------------------------------"
Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
Print #1, "----------------------------------------"
Suma = Suma + rst!SumOfiznos
siznos = 0
Datum = rst!Datum
End If
Print #1, Format(rst!Datum, "dd.mm.yyyy"); " "; sif; Tab(16); right(im, 24); Tab(41 - Len(Format(izn, "###0.00"))); Format(izn, "###0.00")
siznos = siznos + rst!SumOfiznos
rst.MoveNext
Loop
Print #1, "----------------------------------------"
rst.MoveFirst
Suma = Suma + rst!SumOfiznos
If Datum <> rst!Datum Then
Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
Print #1, "----------------------------------------"
End If
'****************
rst.MoveFirst
Suma = 0

Datum = rst!Datum
Do Until rst.EOF

Suma = Suma + rst!SumOfiznos
rst.MoveNext
Loop
rst.MoveFirst
Print #1, "SVEUKUPNO : "; Tab(41 - Len(Format(Suma, "###0.00"))); Format(Suma, "###0.00")
Print #1, "----------------------------------------"

Print #1, Chr(27) & Chr(100) & Chr(8)
Print #1, Chr(27) & Chr(105)
Close #1
End Function

hvala svima za pomoc
nevsad ramic
↑  ↓

#24 30.05.2016-20:47
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,844


Subject: Re: Problem Petlja
DownloadIzvorni kod (Visual Basic):
  1. Public Function taxaOddo()
  2. Dim rst As DAO.Recordset
  3. IzborPrintera
  4. br = 1
  5. izn = 0
  6. siznos = 0
  7. Suma = 0
  8. Close #1
  9. Set rst = CurrentDb.OpenRecordset("KORISNIK")
  10. Open "C:\Temp\taxa.txt" For Output As #1
  11. Print #1, strParPrint
  12. Print #1, strIzbTrake
  13. Print #1, strObSlova
  14. Print #1, Tab(21 - Len(rst!korisnik)); rst!korisnik
  15. Print #1, Tab(21 - Len(rst!adresa) - Len(rst!grad)); Nz(rst!adresa, ""); ","; Nz(rst!grad)
  16. Print #1, "Izvjestaj o prodatim artiklima za period"
  17. Print #1, Tab(7); "od"; Tab(10); Format(Pocetni, "dd.mm.yyyy"); Tab(22); "do"; Tab(25); Format(Krajnji, "dd.mm.yyyy")
  18. Print #1, "========================================"
  19. Print #1, "    Datum                         Taxa                       Iznos"
  20. Print #1, "========================================"
  21. rst.Close
  22. Set rst = CurrentDb.OpenRecordset("select * from Qzaperiod1  WHERE datum BETWEEN DATEVALUE('" & Pocetni & "') AND DATEVALUE('" & Krajnji & "')")
  23. rst.MoveFirst
  24. Datum = rst!Datum
  25. Do Until rst.EOF
  26.    sif = rst!proizvod
  27.    im = rst!ime
  28.    izn = rst!SumOfiznos
  29.    Suma = Suma + izn
  30.         If Datum <> rst!Datum Then
  31.         Print #1, "----------------------------------------"
  32.         Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
  33.         Print #1, "----------------------------------------"
  34.         siznos = 0
  35.         Datum = rst!Datum
  36.         End If
  37. Print #1, Format(rst!Datum, "dd.mm.yyyy"); "  "; sif; Tab(16); right(im, 24); Tab(41 - Len(Format(izn, "###0.00"))); Format(izn, "###0.00")
  38. siznos = siznos + rst!SumOfiznos
  39. rst.MoveNext
  40. Loop
  41.  Print #1, "----------------------------------------"
  42.  Print #1, Datum; Tab(41 - Len(Format(siznos, "###0.00"))); Format(siznos, "###0.00")
  43.  Print #1, "----------------------------------------"
  44.       Print #1, "SVEUKUPNO :            "; Tab(41 - Len(Format(Suma, "####0.00"))); Format(Suma, "####0.00")
  45.       Print #1, "----------------------------------------"
  46. Print #1, Chr(27) & Chr(100) & Chr(8)
  47. Print #1, Chr(27) & Chr(105)
  48. Close #1
  49.  End Function

Pozdrav
↑  ↓

#25 31.05.2016-06:42
nevsad Offline
Clan
Registrovan/a od: 01.09.2010-14:40
Komentari: 187


Subject: Re: Problem Petlja
puno bolje, sa manje koda
fino hvala
nevsad ramic
↑  ↓

Stranice (2): 1, 2


All times are GMT +01:00. Current time: 19.12.2018-16:34.