Bosna i Hercegovina



#1 02.07.2014-22:47
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,509


Subject: Data Report
Pozdrav do site.
Imam 4 reporti izrabotrni vo DataReport e sega me interesira dali moze ovie 4 reporti istovremeno da se printaat na 3 posebni printeri istovremeno , bez razlika koj od ovie printeri e default.
↑  ↓

#2 03.07.2014-07:06
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,737


Subject: Re: Data Report
Hehehe pa ti si to vec napravio u temi Presmetka DPH (DDV) , (PDV) vo cod so popust
Imas file setup ini gdje upisujes na koji printer da stampa.
Isto mozes primijeniti i ovdje.
Iz tvofga setup.ini
[Printeri]
Kujna=Microsoft Office Document Image Writer
Sank=Neki drugi printer
Smetka=neki treci printer
Pozdrav
↑  ↓

#3 03.07.2014-11:35
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,509


Subject: Re: Data Report
Da toa sega taka funkcionira no imam problem so spoolerot od printerite (se isklucuva) i sakam da probam
na nekoj drug nacin da vidam sto ke se sluci dali isto ke se isklucuva
↑  ↓

#4 03.07.2014-16:19
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,737


Subject: Re: Data Report
Probaj sa ovim.
Ovaj kod ti postavlja odredjeni printer na default printer..
Mozda onda ostampa.
Ako ne onda postavi cio kod.

DownloadIzvorni kod (Visual Basic):
  1. Declare Function aht_apiWriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal strAppName As String, ByVal strKeyName As String, ByVal strValue As String) As Integer
  2.  
  3.  
  4. Function SetDefPrinter(Drajver As String) As Boolean
  5.  
  6.    SetDefPrinter = (aht_apiWriteProfileString("Windows", "Device", Drajver) <> 0)
  7. End Function
  8.  
  9.  
  10. Function Pozivdefprinter()
  11. Dim Drajver As String
  12. Dim Vrijednost As Boolean
  13.    Drajver = "Microsoft Office Document Image Writer,Winspool"
  14.    Vrijednost = SetDefPrinter(Drajver)
  15. End Function

Pozdrav
↑  ↓

#5 03.07.2014-21:01
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,509


Subject: Re: Data Report
imam jas vakva funkcija no ne mi treba da go menuvam difolt stampacot bidejki vo isti moment se slucuva da stampam i dve ili tri naracki.
Da pojasnam: Mi treba da mozam sekoj DataReport da go isprintam bez da go menuvam defaul stampacot eve go i codot:

DownloadIzvorni kod (Visual Basic):
  1. Baza = App.Path & "\" & "BazaRL.mdb"
  2.  cn.ConnectionString = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & Baza & ";"
  3.  cn.Open


DownloadIzvorni kod (Visual Basic):
  1. Global PrintSankOK As Boolean
  2. Global PrintKujnaOK As Boolean
  3. Global PrintKujna2OK As Boolean
  4. Global PrintNarackaOK As Boolean
  5. Global PrintSmetkaOK As Boolean
  6. Global LevMargin As Integer
  7. Function PrintSank(SmetkaBroj As Long) 'ne se koristi
  8. On Error GoTo PosError
  9.    
  10.    PrintSankOK = False
  11.    Dim rs As ADODB.Recordset
  12.    Dim txt As String
  13.    Dim Naziv As String
  14.    Dim Danok As String
  15.    Dim Cena As String
  16.    Dim DDV As String
  17.    Dim Kolicina As String
  18.    Dim Rb As Integer
  19.    Dim SQLSmetkaStavki As String
  20.        SQLSmetkaStavki = "SELECT tblArtikli_Prodazba.Naziv, tblSmetki_Markirajne.Kolicina" _
  21.                        & " FROM tblArtikli_Prodazba INNER JOIN tblSmetki_Markirajne ON tblArtikli_Prodazba.ID_ArtikalP = tblSmetki_Markirajne.Stavka" _
  22.                        & " WHERE (((tblArtikli_Prodazba.Kujna_Sank)=1) AND ((tblSmetki_Markirajne.Smetka_Br)=" & SmetkaBroj & "));"
  23. Set rs = New ADODB.Recordset
  24.        rs.Open SQLSmetkaStavki, cn, adOpenStatic, adLockOptimistic
  25.  
  26.    If rs.RecordCount <= 0 Then
  27.       ' MsgBox "Бројот на ставките во нарачката за шанк е помал или енаков на 0! Вадењето на нарачка не е дозволено "
  28.       PrintSankOK = True
  29.        Exit Function
  30.    End If
  31.  
  32.   '**************************************************************************
  33.    ' If SelectPrinter(ReadIniValue(App.Path & "\Setup.ini", "Printeri", "Sank")) = True Then
  34.    '    Call MsgBox("PRINTER NOT FOUND  ", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "")
  35.    '    Exit Function
  36.    '  End If
  37.  '**************************************************************************
  38.  
  39.  '   With Printer.Font
  40. '       .Name = "Times New Roman"
  41. '       .Size = ReadIniValue(App.Path & "\Setup.ini", "SmetkaSetup", "SizeFont")
  42. '   End With
  43.  
  44.    Set rptNaracka_Sank.DataSource = rs
  45.        rptNaracka_Sank.LeftMargin = 10
  46.        rptNaracka_Sank.TopMargin = 10
  47.        rptNaracka_Sank.Sections("section4").Controls.Item("txtData").Caption = Format(Date, "dd.mm.yyyy")
  48.        rptNaracka_Sank.Sections("section4").Controls.Item("txtCas").Caption = Format(Time, "hh:mm:ss")
  49.        rptNaracka_Sank.Sections("section4").Controls.Item("txtKelner").Caption = DLookup("Vraboten_Ime", "tblVraboteni", "ID_Vraboten=" & DLookup("Vraboten", "tblSmetki", "ID_Smetka=" & SmetkaBroj))
  50.        rptNaracka_Sank.Sections("section4").Controls.Item("txtMasa").Caption = DLookup("Masa", "tblMasi", "ID_Masa=" & DLookup("Masa", "tblSmetki", "ID_Smetka=" & SmetkaBroj))
  51.        rptNaracka_Sank.Sections("section4").Controls.Item("txtSmetkaBroj").Caption = Format(DLookup("Smetka_Broj", "tblSmetki", "ID_Smetka=" & SmetkaBroj), "0000000")
  52.       'rptNaracka_Sank.WindowState = 2
  53.      'rptNaracka_Sank.Show vbModal
  54.       rptNaracka_Sank.PrintReport
  55.  
  56.  
  57.  
  58. ' Rb = 0
  59.  PrintSankOK = True
  60. PosError:
  61.     If Error <> "" Then
  62.       ' If Err = 482 Then Call PrinterGreska
  63.       On Error Resume Next
  64.        PrintSankOK = False
  65.        Exit Function
  66.     End If
  67.  
  68.  
  69.  End Function
  70. Function PrintKujna(SmetkaBroj As Long)
  71. On Error GoTo PosError
  72. PrintKujnaOK = False
  73.  
  74.    Dim rs As ADODB.Recordset
  75.    Dim txt As String
  76.    Dim Naziv As String
  77.    Dim Danok As String
  78.    Dim Cena As String
  79.    Dim DDV As String
  80.    Dim Kolicina As String
  81.    Dim Rb As Integer
  82.    Dim Prio As Boolean
  83.    Dim PrioPrint As Boolean
  84.       Prio = True
  85.       PrioPrint = False
  86.    Dim SQLSmetkaStavki As String
  87.        SQLSmetkaStavki = "SELECT tblArtikli_Prodazba.Naziv, tblSmetki_Markirajne.Kolicina" _
  88.                        & " FROM tblArtikli_Prodazba INNER JOIN tblSmetki_Markirajne ON tblArtikli_Prodazba.ID_ArtikalP = tblSmetki_Markirajne.Stavka" _
  89.                        & " WHERE (((tblArtikli_Prodazba.Kujna_Sank)=2) AND ((tblSmetki_Markirajne.Smetka_Br)=" & SmetkaBroj & "));"
  90.    Set rs = New ADODB.Recordset
  91.        rs.Open SQLSmetkaStavki, cn, adOpenStatic, adLockOptimistic
  92.    
  93.  
  94.    If rs.RecordCount <= 0 Then
  95.      '  MsgBox "Бројот на ставките во нарачката за шанк е помал или енаков на 0! Вадењето на нарачка не е дозволено "
  96.       PrintKujnaOK = True
  97.        Exit Function
  98.    End If
  99.  
  100.    
  101.  
  102.   '**************************************************************************
  103.  '   If SelectPrinter(ReadIniValue(App.Path & "\Setup.ini", "Printeri", "Kujna")) = True Then
  104.  '      Call MsgBox("PRINTER NOT FOUND  ", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "")
  105.  '      Exit Function
  106.  '    End If
  107.  '**************************************************************************
  108.  
  109.   '  With Printer.Font
  110.  '      .Name = "Times New Roman"
  111.  '      .Size = ReadIniValue(App.Path & "\Setup.ini", "SmetkaSetup", "SizeFont") + 1
  112.  '  End With
  113.  
  114.    Set rptNaracka_Kujna.DataSource = rs
  115.        rptNaracka_Kujna.LeftMargin = 10
  116.        rptNaracka_Kujna.TopMargin = 10
  117.        rptNaracka_Kujna.Sections("section4").Controls.Item("txtData").Caption = Format(Date, "dd.mm.yyyy")
  118.        rptNaracka_Kujna.Sections("section4").Controls.Item("txtCas").Caption = Format(Time, "hh:mm:ss")
  119.        rptNaracka_Kujna.Sections("section4").Controls.Item("txtKelner").Caption = DLookup("Vraboten_Ime", "tblVraboteni", "ID_Vraboten=" & DLookup("Vraboten", "tblSmetki", "ID_Smetka=" & SmetkaBroj))
  120.        rptNaracka_Kujna.Sections("section4").Controls.Item("txtMasa").Caption = DLookup("Masa", "tblMasi", "ID_Masa=" & DLookup("Masa", "tblSmetki", "ID_Smetka=" & SmetkaBroj))
  121.        rptNaracka_Kujna.Sections("section4").Controls.Item("txtSmetkaBroj").Caption = Format(DLookup("Smetka_Broj", "tblSmetki", "ID_Smetka=" & SmetkaBroj), "0000000")
  122.       'rptNaracka_Kujna.WindowState = 2
  123.      'rptNaracka_Kujna.Show vbModal
  124.       rptNaracka_Kujna.PrintReport
  125.   If Vnimanie = True Then rptNaracka_Kujna.Sections("section5").Controls.Item("labVnimanie").Caption = "POZOR PIZZA"
  126.  
  127.  
  128.   PrintKujnaOK = True
  129. PosError:
  130.     If Error <> "" Then
  131.       ' If Err = 482 Then Call PrinterGreska
  132.       On Error Resume Next
  133.        PrintKujnaOK = False
  134.        Exit Function
  135.     End If
  136.  
  137.  
  138.  End Function
DownloadIzvorni kod (Visual Basic):
  1. Call PrintSank(6769)
  2.     Call PrintKujna(6769)
eve i data raportite i bazata

Prilozi:
Informacije o fajlu: rar  New Folder.rar
Preuzimanja: 60
Veličina: 362.58 KB

↑  ↓

#6 05.07.2014-09:28
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,737


Subject: Re: Data Report
Ovo stavi u novi modul DEfPrinter:
Option Explicit

Declare Function aht_apiWriteProfileString Lib "kernel32" Alias "WriteProfileStringA" (ByVal strAppName As String, ByVal strKeyName As String, ByVal strValue As String) As Integer


DownloadIzvorni kod (Visual Basic):
  1. Function SetDefPrinter(Drajver As String) As Boolean
  2.  
  3.    SetDefPrinter = (aht_apiWriteProfileString("Windows", "Device", Drajver) <> 0)
  4. End Function
  5.  
  6.  
  7. Function Pozivdefprinter(ImeReporta As String)
  8. Dim Drajver As String
  9. Dim Vrijednost As Boolean
  10.  
  11.    
  12.    Drajver = ReadIniValue(App.Path & "\Setup.ini", "Printeri", ImeReporta)
  13.    Vrijednost = SetDefPrinter(Drajver)
  14. End Function

Tvoje procedure za stampu Prepravi ovako:
Function PrintSank(SmetkaBroj As Long)
tvojkod
...

Moj kod
'*********************************************
*
Pozivdefprinter ("Sank")
'***************************************
' tvoj kod
rptNaracka_Sank.PrintReport

----------------------------------------

Function PrintKujna(SmetkaBroj As Long)
Tvoj kod
...

Moj kod
'*************************************
Pozivdefprinter ("Kujna")
'*************************************
'Tvoj kod
rptNaracka_Kujna.PrintReport

Poziv za stampu sa nekog komandnog tastera:
Call PrintSank(61)
Call PrintKujna(61)

Setup.ini:
[Printeri]
Kujna=Microsoft Office Document Image Writer
Sank=CutePDF Writer
Smetka=Microsoft Office Document Image Writer

Ovo bi trebalo da ti radi
Pozdrav
↑  ↓

#7 06.07.2014-16:16
Gjoreski Offline
Super Moderator
Registrovan/a od: 02.02.2009-22:24
Komentari: 1,509


Subject: Re: Data Report
Ova nema da pravi problem ako na sekoe printajne se menuva default stampacot?
↑  ↓

#8 06.07.2014-17:18
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,737


Subject: Re: Data Report
Jedino sta bi jos trebalo napraviti a to je:
-da se ucita koji je stampac po defaultu prije stampe te isti vratiti nakon stampe tako da ne zbunjuje korisnike racunara.
Pozdrav
↑  ↓

Stranice (1): 1


All times are GMT +01:00. Current time: 21.08.2018-15:15.