neu
This commit is contained in:
@@ -834,12 +834,15 @@ Public Class usrCntlMDMAuswertungen
|
||||
SQLstr &= " WHEN '210' THEN cast([SERIE-Nr] as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '212' THEN cast(KartenNr as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '213' THEN cast(OBUID as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '214' THEN cast(OBUID as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '215' THEN cast([TELEPASS-Nr] as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '216' THEN cast(OBUID as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '203' THEN cast(KartenNr as VARCHAR(200)) "
|
||||
SQLstr &= " WHEN '209' THEN cast([MSE-Kd-Nr] as VARCHAR(200)) "
|
||||
SQLstr &= " Else '-' "
|
||||
SQLstr &= " END as VARCHAR(200)) AS KarteBoxNr,"
|
||||
SQLstr &= " isnull(sdl.vermerk,'') as Vermerk,isnull(Gesperrt,0) as Gesperrt, isnull(Defekt,0) as Defekt,isnull(Verloren,0) as Verloren,isnull(Gestohlen,0) as Gestohlen,isnull(Ersatzkarte,0) as Ersatzkarte "
|
||||
SQLstr &= " FROM [SDL].[dbo].[SDL] inner join [KundenSDL] on [KundenSDL].SDLnr=sdl.SDLNr and [KundenSDL].KundenNr=sdl.KundenNr"
|
||||
SQLstr &= " FROM [SDL] inner join [KundenSDL] on [KundenSDL].SDLnr=sdl.SDLNr and [KundenSDL].KundenNr=sdl.KundenNr"
|
||||
SQLstr &= " where SDL.SDLNr = '" & MyComboBox2._value & "' And Sperre = 0 And Archiviert = 0 AND isnull([Gesperrt],'')=0 AND isnull([Defekt],'')=0 AND isnull([Verloren],'')=0 AND isnull([Gestohlen],'')=0 AND isnull([Retourniert],'')=0 "
|
||||
SQLstr &= " order by Firma"
|
||||
|
||||
@@ -951,280 +954,12 @@ Public Class usrCntlMDMAuswertungen
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
|
||||
Dim displayFilter = False
|
||||
Dim sqlstr As String = ""
|
||||
|
||||
sqlstr &= " SELECT count(*) Anzahl ,plose_ProduktCode"
|
||||
sqlstr &= ",max(plose_Produktbeschreibung) as plose_Produktbeschreibung"
|
||||
sqlstr &= ",sum(plose_Menge) as plose_Menge"
|
||||
sqlstr &= ",sum(plose_Preis) as plose_Preis"
|
||||
sqlstr &= ",sum(plose_NettobetragTransaktion) as plose_NettobetragTransaktion"
|
||||
sqlstr &= ",sum(plose_MWSTBetrag) as plose_MWSTBetrag"
|
||||
sqlstr &= ",sum(plose_BruttobetragTransaktion) as plose_BruttobetragTransaktion "
|
||||
sqlstr &= " FROM tblPLOSE_Details"
|
||||
sqlstr &= " WHERE 1=1 "
|
||||
|
||||
sqlstr &= " AND plose_DatumTransaktion between '" & datPLOSE_Sum_Von.Value & "' and '" & datPLOSE_Sum_Bis.Value & "' "
|
||||
|
||||
sqlstr &= " group by plose_ProduktCode"
|
||||
sqlstr &= " order by plose_ProduktCode"
|
||||
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL")
|
||||
'DataGridView.DataSource = dt
|
||||
|
||||
|
||||
Dim print As New frmPrintLayout
|
||||
print.Text = "PLOSE"
|
||||
|
||||
Dim rpt As New rptPLOSE_TransaktionenSumary
|
||||
|
||||
rpt.DataSource = dt
|
||||
|
||||
|
||||
'If cbxProdukt.Checked Then
|
||||
' rpt.GroupHeader2.DataField = "prod_descr"
|
||||
'Else
|
||||
' rpt.GroupHeader2.Visible = False
|
||||
' rpt.GroupFooter2.Visible = False
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
Dim sum = 0
|
||||
rpt.lblUeberschrift.Text = "PLOSE Summenbericht " & datPLOSE_Sum_Von.Text & " bis " & datPLOSE_Sum_Bis.Text
|
||||
rpt.lblSachbearbeiter.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME
|
||||
'rpt.lblMandantNiederlassung.Text = PERSONAL.Mandant & " / " & PERSONAL.Niederlassung
|
||||
|
||||
'Dim cnt As Integer = 0
|
||||
rpt.lblDat.Text = Now.ToLongDateString
|
||||
|
||||
|
||||
Dim sumPreis As Double = 0
|
||||
Dim sumNetto As Double = 0
|
||||
Dim sumMWST As Double = 0
|
||||
Dim sumBrutto As Double = 0
|
||||
Dim sumMenge As Double = 0
|
||||
|
||||
AddHandler rpt.Detail.Format, Sub()
|
||||
' rpt.lblProduktBeschreibung.Text = isDbnullEmpty(rpt.Fields.Item("BC_DESCR").Value, "")
|
||||
rpt.lblAnzahl.Text = isDbnullEmpty(rpt.Fields.Item("Anzahl").Value, "")
|
||||
rpt.lblProdukt.Text = isDbnullEmpty(rpt.Fields.Item("plose_ProduktCode").Value, "") & " - " & isDbnullEmpty(rpt.Fields.Item("plose_Produktbeschreibung").Value, "")
|
||||
|
||||
rpt.lblMenge.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_Menge").Value, 0, "")
|
||||
rpt.lblPreis.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_Preis").Value, 2, "")
|
||||
rpt.lblNetto.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_NettobetragTransaktion").Value, 2, "")
|
||||
rpt.lblMWST.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_MWSTBetrag").Value, 2, "")
|
||||
rpt.lblBrutto.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_BruttobetragTransaktion").Value, 2, "")
|
||||
|
||||
|
||||
|
||||
sumMenge += isDbnullEmptyDbl(rpt.Fields.Item("plose_Menge").Value, 4, 0)
|
||||
sumPreis += isDbnullEmptyDbl(rpt.Fields.Item("plose_Preis").Value, 4, 0)
|
||||
sumNetto += isDbnullEmptyDbl(rpt.Fields.Item("plose_NettobetragTransaktion").Value, 4, 0)
|
||||
sumMWST += isDbnullEmptyDbl(rpt.Fields.Item("plose_MWSTBetrag").Value, 4, 0)
|
||||
sumBrutto += isDbnullEmptyDbl(rpt.Fields.Item("plose_BruttobetragTransaktion").Value, 4, 0)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
AddHandler rpt.ReportFooter1.Format, Sub()
|
||||
rpt.lblSumMenge.Text = sumMenge.ToString("N0")
|
||||
rpt.lblSumPreis.Text = sumPreis.ToString("N2")
|
||||
rpt.lblSumNetto.Text = sumNetto.ToString("N2")
|
||||
rpt.lblSumMwst.Text = sumMWST.ToString("N2")
|
||||
rpt.lblSumBrutto.Text = sumBrutto.ToString("N2")
|
||||
|
||||
End Sub
|
||||
|
||||
print.Viewer.LoadDocument(rpt)
|
||||
print.Viewer.ViewType = GrapeCity.Viewer.Common.Model.ViewType.Continuous
|
||||
print.Show()
|
||||
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
|
||||
Dim f As New frmMDMDatenverarbetiung
|
||||
f.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dt_Main As DataTable = SQL.loadDgvBySql_Param("SELECT [plose_POLSEKundennummer] FROM tblPLOSE_Details where plose_FakturiertDatum is null AND plose_DatumTransaktion between '" & datPLOSE_Sum_Von.Value.ToShortDateString & "' and '" & datPLOSE_Sum_Bis.Value.ToShortDateString & "' group by [plose_POLSEKundennummer] ", "FMZOLL")
|
||||
|
||||
If dt_Main Is Nothing OrElse dt_Main.Rows.Count = 0 Then
|
||||
MsgBox("Keine Daten!")
|
||||
Exit Sub
|
||||
End If
|
||||
Dim cnt = 0
|
||||
If vbYes = MsgBox("Es wurden Daten von " & dt_Main.Rows.Count & " Kunden gefunden " & vbNewLine & " Möchten Sie die Anhänge erstellen?",vbYesNoCancel) Then
|
||||
Dim dir = "F:\FMZoll\Maut\PLOSE\" & Now.ToShortDateString
|
||||
|
||||
If IO.Directory.Exists(dir) Then dir &= "_" & Now.ToShortTimeString.Replace(":", "")
|
||||
IO.Directory.CreateDirectory(dir)
|
||||
For Each R_PLOSE In dt_Main.Rows
|
||||
genPLOSEAttachmentByKdNr(R_PLOSE("plose_POLSEKundennummer"), datPLOSE_Sum_Von.Value.ToShortDateString, datPLOSE_Sum_Bis.Value.ToShortDateString, dir)
|
||||
|
||||
|
||||
If True Then 'cnt Mod 10 = 0 Then
|
||||
txtPloseAnh_Einarbeitung.Text = cnt & " / " & dt_Main.Rows.Count
|
||||
Dim proz As Double = (cnt / dt_Main.Rows.Count) * 100
|
||||
pbPloseAnh_Proz.Value = proz
|
||||
lblPloseAnh_Proz.Text = proz.ToString("N2") & " %"
|
||||
GroupBox12.Refresh()
|
||||
My.Application.DoEvents()
|
||||
End If
|
||||
cnt += 1
|
||||
|
||||
|
||||
Next
|
||||
pbPloseAnh_Proz.Value = 100
|
||||
txtPloseAnh_Einarbeitung.Text = dt_Main.Rows.Count & " / " & dt_Main.Rows.Count
|
||||
lblPloseAnh_Proz.Text = "100.00 %"
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Function genPLOSEAttachmentByKdNr(KdNr As String, von As Date, bis As Date, dir As String)
|
||||
Try
|
||||
|
||||
Dim displayFilter = False
|
||||
Dim sqlstr As String = ""
|
||||
|
||||
sqlstr &= " SELECT * "
|
||||
sqlstr &= " FROM tblPLOSE_Details INNER JOIN [tblPLOSE_Produktbeschreibung] on plose_ProduktCode=plp_ProductCode "
|
||||
sqlstr &= " WHERE 1=1 "
|
||||
sqlstr &= " AND plose_FakturiertDatum is null "
|
||||
sqlstr &= " AND plose_POLSEKundennummer = '" & KdNr & "' "
|
||||
sqlstr &= " AND plose_DatumTransaktion between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' "
|
||||
|
||||
' sqlstr &= " group by plose_ProduktCode"
|
||||
sqlstr &= " order by plp_Land, plose_DatumTransaktion"
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL")
|
||||
|
||||
Dim rpt As New rptPLOSE_Anhang
|
||||
|
||||
rpt.DataSource = dt
|
||||
|
||||
rpt.lblRgDatum.Text = datPloseAnhang.Value.ToShortDateString
|
||||
|
||||
rpt.GroupHeaderKz.DataField = "plose_Kennzeichen" 'Gruppierung
|
||||
|
||||
Dim sumNetto As Double = 0
|
||||
Dim sumMWST As Double = 0
|
||||
Dim sumBrutto As Double = 0
|
||||
|
||||
Dim sumNettoKat As Double = 0
|
||||
Dim sumMWSTKat As Double = 0
|
||||
Dim sumBruttoKat As Double = 0
|
||||
|
||||
Dim sumNettoGes As Double = 0
|
||||
Dim sumMWSTGes As Double = 0
|
||||
Dim sumBruttoGes As Double = 0
|
||||
|
||||
Dim cntKat = 0
|
||||
Dim cnt = 0
|
||||
rpt.GroupFooterKat.Visible = False
|
||||
|
||||
AddHandler rpt.Detail.Format, Sub()
|
||||
' If cnt = 0 Then
|
||||
rpt.txtKunde.Text = isDbnullEmpty(rpt.Fields.Item("plose_POLSEKundennummer").Value, "") & " " & isDbnullEmpty(rpt.Fields.Item("plose_Firmenname").Value, "")
|
||||
' End If
|
||||
|
||||
' rpt.txtProduktBeschreibung.Text = isDbnullEmpty(rpt.Fields.Item("BC_DESCR").Value, "")
|
||||
Select Case "DE"
|
||||
Case "DE" : rpt.txtProdukt.Text = isDbnullEmpty(rpt.Fields.Item("plp_Description_DE").Value, "") 'isDbnullEmpty(rpt.Fields.Item("plose_ProduktCode").Value, "") & " - " & isDbnullEmpty(rpt.Fields.Item("plose_Produktbeschreibung").Value, "")
|
||||
Case "IT" : rpt.txtProdukt.Text = isDbnullEmpty(rpt.Fields.Item("plp_Description_IT").Value, "") 'isDbnullEmpty(rpt.Fields.Item("plose_ProduktCode").Value, "") & " - " & isDbnullEmpty(rpt.Fields.Item("plose_Produktbeschreibung").Value, "")
|
||||
Case Else : rpt.txtProdukt.Text = isDbnullEmpty(rpt.Fields.Item("plp_Description_EN").Value, "") 'isDbnullEmpty(rpt.Fields.Item("plose_ProduktCode").Value, "") & " - " & isDbnullEmpty(rpt.Fields.Item("plose_Produktbeschreibung").Value, "")
|
||||
End Select
|
||||
|
||||
rpt.txtKartennummer.Text = isDbnullEmpty(rpt.Fields.Item("plose_NummerKarteGeraet").Value, "")
|
||||
rpt.txtEingang.Text = isDbnullEmpty(rpt.Fields.Item("plose_BeschreibungEinfahrt").Value, "")
|
||||
rpt.txtAusgang.Text = isDbnullEmpty(rpt.Fields.Item("plose_BeschreibungAusfahrt").Value, "")
|
||||
rpt.txtLand.Text = isDbnullEmpty(rpt.Fields.Item("plp_Land").Value, "")
|
||||
rpt.txtDatum.Text = isDbnullEmpty(rpt.Fields.Item("plose_DatumTransaktion").Value, "")
|
||||
|
||||
rpt.txtNetto.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_NettobetragTransaktion").Value, 2, "")
|
||||
rpt.txtMWST.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_MWSTBetrag").Value, 2, "")
|
||||
rpt.txtBrutto.Text = isDbnullEmptyDbl(rpt.Fields.Item("plose_BruttobetragTransaktion").Value, 2, "")
|
||||
|
||||
sumNetto += isDbnullEmptyDbl(rpt.Fields.Item("plose_NettobetragTransaktion").Value, 4, 0)
|
||||
sumMWST += isDbnullEmptyDbl(rpt.Fields.Item("plose_MWSTBetrag").Value, 4, 0)
|
||||
sumBrutto += isDbnullEmptyDbl(rpt.Fields.Item("plose_BruttobetragTransaktion").Value, 4, 0)
|
||||
cnt += 1
|
||||
End Sub
|
||||
|
||||
AddHandler rpt.GroupHeaderKz.Format, Sub()
|
||||
rpt.txtKennzeichen.Text = isDbnullEmpty(rpt.Fields.Item("plose_Kennzeichen").Value, "")
|
||||
If rpt.txtKennzeichen.Text = "" Then rpt.lblKennzeichen.Visible = False
|
||||
End Sub
|
||||
AddHandler rpt.GroupHeaderKat.Format, Sub()
|
||||
rpt.lblKategorie.Text = "MAUT REPORT"
|
||||
End Sub
|
||||
|
||||
AddHandler rpt.GroupFooterKz.Format, Sub()
|
||||
rpt.txtNettoKzSum.Text = sumNetto.ToString("N2")
|
||||
rpt.txtMWSTKzSum.Text = sumMWST.ToString("N2")
|
||||
rpt.txtBruttoKzSum.Text = sumBrutto.ToString("N2")
|
||||
|
||||
rpt.lblSummeKennzeichen.Text = rpt.lblSummeKennzeichen.Text.Replace("Kennzeichen", isDbnullEmpty(rpt.Fields.Item("plose_Kennzeichen").Value, ""))
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
AddHandler rpt.GroupFooterKat.Format, Sub()
|
||||
sumNettoKat += sumNetto
|
||||
sumMWSTKat += sumMWST
|
||||
sumBruttoKat += sumBrutto
|
||||
sumNetto = 0
|
||||
sumMWST = 0
|
||||
sumBrutto = 0
|
||||
|
||||
rpt.txtNettoKatSum.Text = sumNettoKat.ToString("N2")
|
||||
rpt.txtMWSTKatSum.Text = sumMWSTKat.ToString("N2")
|
||||
rpt.txtBruttoKatSum.Text = sumBruttoKat.ToString("N2")
|
||||
cntKat += 1
|
||||
End Sub
|
||||
AddHandler rpt.ReportFooter1.Format, Sub()
|
||||
sumNettoGes += sumNettoKat
|
||||
sumMWSTGes += sumMWSTKat
|
||||
sumBruttoGes += sumBruttoKat
|
||||
sumNettoKat = 0
|
||||
sumMWSTKat = 0
|
||||
sumBruttoKat = 0
|
||||
|
||||
rpt.txtNettoGesSum.Text = sumNettoGes.ToString("N2")
|
||||
rpt.txtMWSTGEsSum.Text = sumMWSTGes.ToString("N2")
|
||||
rpt.txtBruttoGesSum.Text = sumBruttoGes.ToString("N2")
|
||||
|
||||
|
||||
|
||||
'If cntKat <= 1 Then
|
||||
' rpt.GroupFooterKat.Visible = False
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
'print.Viewer.LoadDocument(rpt)
|
||||
'print.Viewer.ViewType = GrapeCity.Viewer.Common.Model.ViewType.Continuous
|
||||
'print.Show()
|
||||
|
||||
|
||||
|
||||
Dim tmpPath = dir & "\" & KdNr & "_PLOSE_Anhang.pdf"
|
||||
Dim p As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
|
||||
rpt.Run(False)
|
||||
p.NeverEmbedFonts = ""
|
||||
p.Export(rpt.Document, tmpPath)
|
||||
|
||||
rpt.Dispose()
|
||||
|
||||
Return tmpPath
|
||||
|
||||
Catch ex As System.Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Class cMDMAuswertung
|
||||
|
||||
Reference in New Issue
Block a user