This commit is contained in:
2024-08-23 13:07:18 +02:00
7 changed files with 298 additions and 74 deletions

View File

@@ -1,17 +1,11 @@
Imports itextsharp.text.pdf
Imports System.IO
Imports System.Drawing.Printing
Imports System.Runtime.InteropSerausices
Imports System.Runtime.Serialization
Imports Microsoft.Office.Interop
Imports System.Text
Imports System.Net
Imports GrapeCity.ActiveReports
Imports Microsoft.VisualBasic.ApplicationServices
Imports System.Net.Mail
Imports System.Reflection
Imports System.Text.RegularExpressions
Imports DAKOSY_Worker.NichtAbschliessendeFestsetzung
Imports System.Windows.Documents
Imports VERAG_PROG_ALLGEMEIN
@@ -1711,7 +1705,13 @@ Public Class FormularManagerNEU
Select Case fieldName
Case "name" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtFirma.Text
Case "address" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtAdresse1.Text & " " & usrCntl.txtAdresse2.Text & " " & usrCntl.txtAdresse3.Text
Case "name_1" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtFirma.Text
Case "name_2" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtFirma.Text
Case "address" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtAdresse1.Text & " " & usrCntl.cbxLandKz.Text & "-" & usrCntl.txtAdresse2.Text & " " & usrCntl.txtAdresse3.Text
Case "zipcode" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtAdresse2.Text
Case "country" : odoc.FormFields(fieldName).Range.Text = usrCntl.cbxLandKz.Text
Case "place" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtAdresse3.Text
Case "street" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtAdresse1.Text
Case "surname_firstname" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtHerrFrau.Text
Case "vatno" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtUid.Text
Case "taxno" : odoc.FormFields(fieldName).Range.Text = usrCntl.txtSteuerNr.Text
@@ -1720,6 +1720,9 @@ Public Class FormularManagerNEU
Case "c_name2" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Bez
Case "c_name3" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Bez
Case "c_name4" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Bez
Case "c_name5" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Bez
Case "c_name6" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Bez
Case "c_name7" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Bez
Case "c_address" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Straße & " " & FIRMA.Firma_Ort
Case "c_zipcode" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_Ort
Case "c_vatno" : odoc.FormFields(fieldName).Range.Text = FIRMA.Firma_UID

View File

@@ -295,6 +295,12 @@ Public Class frmBU_Mahnlauf
initRgFirma(rpt, FIRMA, AD.LandKz)
rpt.lblFirmaFax.Visible = True
rpt.Label1.Visible = True
rpt.lblFaxNr.Visible = True
Select Case FIRMA.Firma_ID
Case 1 ' rpt.picVERAG.Image= My.Resources.Verag_AG_Logo : rpt.Picture1.Image = My.Resources.aeo_AT_imex is eh standard
Case 7 : rpt.picVERAG.Image = My.Resources.Atilla_big_med : rpt.Picture1.Image = Nothing
@@ -305,7 +311,7 @@ Public Class frmBU_Mahnlauf
Case 26 : rpt.picVERAG.Image = My.Resources.VERAG_UNISPED_Logo : rpt.Picture1.Image = Nothing
Case 23 : rpt.picVERAG.Image = My.Resources.Unisped_ZS_logo : rpt.Picture1.Image = My.Resources.unisped_aeo_ZS_AT
Case 17 : rpt.picVERAG.Image = My.Resources.FrontOfficeSUB_Horizontal : rpt.Picture1.Image = Nothing
Case 19 : rpt.picVERAG.Image = My.Resources.VERAG_360 : rpt.Picture1.Image = Nothing
Case 19 : rpt.picVERAG.Image = My.Resources.VERAG_360 : rpt.Picture1.Image = Nothing : rpt.lblFirmaFax.Visible = False : rpt.Label1.Visible = False : rpt.lblFaxNr.Visible = False
End Select
Dim ZZTage = 10
@@ -324,7 +330,24 @@ Public Class frmBU_Mahnlauf
rpt.lblSachbearbeiter.Text = cFakturierung.getSBRgName(FIRMA.Firma_ID, VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME) 'If(RECHNUNG.Sachbearbeiter, "")
rpt.lblEmail.Text = IIf(FIRMA.Firma_E_Mail_Mahnungen <> "", FIRMA.Firma_E_Mail_Mahnungen, "buchhaltung@verag.ag")
Select Case FIRMA.Firma_ID
Case 19
If VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_email <> "" Then
rpt.lblEmail.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_email
Else
rpt.lblEmail.Text = IIf(FIRMA.Firma_E_Mail_Mahnungen <> "", FIRMA.Firma_E_Mail_Mahnungen, "buchhaltung@verag.ag")
End If
If VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_telefonnr <> "" AndAlso VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_durchwahl <> "" Then
rpt.lblTelefon.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_telefonnr + "-" + VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_durchwahl
End If
Case Else
rpt.lblEmail.Text = IIf(FIRMA.Firma_E_Mail_Mahnungen <> "", FIRMA.Firma_E_Mail_Mahnungen, "buchhaltung@verag.ag")
End Select
Dim waehrungCode As String = KD.Währungscode
@@ -645,6 +668,7 @@ Public Class frmBU_Mahnlauf
rpt.txtBank1.Text = If(FIRMA.Firma_Bankverbindung1, "") & vbNewLine & If(FIRMA.Firma_IBAN1, "") & vbNewLine & If(FIRMA.Firma_BIC1, "").ToString.Trim
rpt.txtBank2.Text = If(FIRMA.Firma_Bankverbindung2, "") & vbNewLine & If(FIRMA.Firma_IBAN2, "") & vbNewLine & If(FIRMA.Firma_BIC2, "").ToString.Trim
rpt.picVERAG.Size = New SizeF(2.712, 0.61)
rpt.lblFirmaEmail.Text = IIf(FIRMA.Firma_E_Mail_Mahnungen <> "", FIRMA.Firma_E_Mail_Mahnungen, "fibu360@verag.ag")
Case 21 '"UNISPED"
rpt.txtBank1.Text = If(FIRMA.Firma_Bankverbindung1, "") & vbNewLine & If(FIRMA.Firma_IBAN1, "") & vbNewLine & If(FIRMA.Firma_BIC1, "").ToString.Trim

View File

@@ -1400,7 +1400,7 @@ Partial Public Class rptMahnung
Public WithEvents lblTelefon As GrapeCity.ActiveReports.SectionReportModel.Label
Private WithEvents Label5 As GrapeCity.ActiveReports.SectionReportModel.Label
Public WithEvents lblEmail As GrapeCity.ActiveReports.SectionReportModel.Label
Private WithEvents Label1 As GrapeCity.ActiveReports.SectionReportModel.Label
Public WithEvents Label1 As GrapeCity.ActiveReports.SectionReportModel.Label
Public WithEvents lblFaxNr As GrapeCity.ActiveReports.SectionReportModel.Label
Public WithEvents TextBox2 As GrapeCity.ActiveReports.SectionReportModel.TextBox
Public WithEvents Label2 As GrapeCity.ActiveReports.SectionReportModel.Label

View File

@@ -450,9 +450,9 @@ Public Class frmMDMDatenverarbetiung
sqlstr &= " SELECT Adressen.AdressenNr as KundenNr, Adressen.[Name 1] as Name, trans.transaction_country AS Country,trans.device_product_type AS CardType, trans.device_product_number AS CardNr,Sum(trans.transaction_gross_amount) AS [Transaction Amount], Sum(trans.total_gross_amount) AS [Total Amount]
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1
GROUP BY Adressen.AdressenNr, Adressen.[Name 1], trans.transaction_country, trans.device_product_type, trans.device_product_number "
@@ -706,11 +706,11 @@ Public Class frmMDMDatenverarbetiung
.SET_SQL(" SELECT Adressen.AdressenNr as KundenNr, Adressen.[Name 1] as Name, trans.transaction_country AS Country,trans.device_product_type AS CardType, Sum(trans.transaction_gross_amount) As [Transaktionsbetrag],Sum(trans.USteuer_EUR) As [USt Betrag], Sum(trans.total_gross_amount) As [Gesamtbetrag_Brutto]
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
Left Join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1
GROUP BY Adressen.AdressenNr, Adressen.[Name 1], trans.transaction_country, trans.device_product_type", "FMZOLL")
@@ -1071,11 +1071,11 @@ Public Class frmMDMDatenverarbetiung
'top = " TOP 20 "
Dim SQLStr = " SELECT distinct cust.customer_id as [Customer ID], Adressen.AdressenNr AS [Customer Nr], Adressen.MSEExportCSV, Adressen.Rechnungsdruck
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0)
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0)
order by cust.customer_id"
Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200)
@@ -3397,46 +3397,43 @@ Public Class frmMDMDatenverarbetiung
pruefData_MSE = True
Try
Dim dtMSEKundennummern As DataTable = SQL.loadDgvBySql(" SELECT cust.customer_id, cust.customer_name, Adressen.AdressenNr, (SELECT Offerten.OffertenNr FROM Offerten WHERE (((Offerten.KundenNr)=isnull(Adressen.[AdressenNr],0)) AND ((Offerten.OffertenNr)=23))) AS Offerte_23
Dim fehlendeKundenr As Integer = CInt((New SQL).getValueTxtBySql("select count(*) from (SELECT cust.customer_id, cust.customer_name, Adressen.AdressenNr, (SELECT Offerten.OffertenNr FROM Offerten WHERE (((Offerten.KundenNr)=isnull(Adressen.[AdressenNr],0)) AND ((Offerten.OffertenNr)=23))) AS Offerte_23
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
WHERE bills.[invoice_date] = '" & DateTimePicker2.Text & "'
GROUP BY cust.customer_id, cust.customer_name, Adressen.AdressenNr
HAVING (((cust.customer_id) Is Not Null) AND ((Adressen.AdressenNr) Is Null)) OR (((cust.customer_id) Is Not Null) AND ((Adressen.AdressenNr) Is Not Null) AND (((SELECT Offerten.OffertenNr FROM Offerten WHERE (((Offerten.KundenNr)=isnull(Adressen.[AdressenNr],0)) AND ((Offerten.OffertenNr)=23)))) Is Null));
", "FMZOLL")
If dtMSEKundennummern.Rows.Count > 0 Then
HAVING (((cust.customer_id) Is Not Null) AND ((Adressen.AdressenNr) Is Null)) OR (((cust.customer_id) Is Not Null) AND ((Adressen.AdressenNr) Is Not Null) AND (((SELECT Offerten.OffertenNr FROM Offerten WHERE (((Offerten.KundenNr)=isnull(Adressen.[AdressenNr],0)) AND ((Offerten.OffertenNr)=23)))) Is Null)))as a", "FMZOLL"))
If fehlendeKundenr > 0 Then
pruefData_MSE = False
'If dtMSEKundennummern.Rows.Count = 1 AndAlso dtMSEKundennummern.Rows(0).Item("Kundennummer").Value = "868070" Then pruefData_MSE = True 'ist VERAG -> OK
MsgBox("Es sind " & fehlendeKundenr & " Kunden nicht der MSE-KundenNr bzw. fehlt die Offerte verknüpft!" & vbNewLine & "Diese Kunden (von Rechnung " & DateTimePicker2.Text & ") müssen aktualisiert werden. (bitte an Administrator wenden).")
Return False
End If
Dim dtLeistungsnummern As DataTable = SQL.loadDgvBySql(" SELECT trans.device_product_type, trans.transaction_country,trans.transaction_product_name, trans.transaction_product_id, cust.[customer_id], trans.partner_haulier_id, cust.customer_name,
Sum(trans.transaction_gross_amount) AS [Summe Transaction Amount ( EUR )],
Sum(trans.msts_fee_amount) AS [Summe Admin Fee Amount ( EUR )],
Sum(trans.msts_fee_amount) AS [Summe Fees and Costs Amount ( EUR )],
Sum(trans.msts_vat_amount) AS [Summe VAT Amount ( EUR )],
Sum(trans.transaction_gross_amount) AS [Summe Total Amount ( EUR )]
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
LEFT JOIN tblMSELeistungen ON trans.device_product_type = tblMSELeistungen.[Card Type] AND trans.transaction_country = tblMSELeistungen.[Transaction Country]
WHERE ((trans.transaction_gross_amount <> 0) AND tblMSELeistungen.LeistungsNr Is Null)
GROUP BY trans.device_product_type, trans.transaction_country,trans.transaction_product_name, trans.transaction_product_id, cust.[customer_id], trans.partner_haulier_id, cust.customer_name;", "FMZOLL")
Dim falscheLeistungsnummern As Integer = CInt((New SQL).getValueTxtBySql("select count (*) from (Select trans.device_product_type, trans.transaction_country,trans.transaction_product_name, trans.transaction_product_id, cust.[customer_id], trans.partner_haulier_id, cust.customer_name,
sum(trans.transaction_gross_amount) As [Summe Transaction Amount ( EUR )],
sum(trans.msts_fee_amount) As [Summe Admin Fee Amount ( EUR )],
sum(trans.msts_fee_amount) As [Summe Fees And Costs Amount ( EUR )],
sum(trans.msts_vat_amount) As [Summe VAT Amount ( EUR )],
sum(trans.transaction_gross_amount) As [Summe Total Amount ( EUR )]
From [VERAG].[dbo].[tblMSESettlements] as bills
Left Join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
Left Join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
Left Join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] And inv.customer_number = cust.[customer_id] And trans.transaction_country = inv.country
Left Join tblMSELeistungen ON trans.device_product_type = tblMSELeistungen.[Card Type] And trans.transaction_country = tblMSELeistungen.[Transaction Country]
WHERE((trans.transaction_gross_amount <> 0) And tblMSELeistungen.LeistungsNr Is Null) And bills.[invoice_date] = '" & DateTimePicker2.Text & "'
GROUP by trans.device_product_type, trans.transaction_country, trans.transaction_product_name, trans.transaction_product_id, cust.[customer_id], trans.partner_haulier_id, cust.customer_name) as a", "FMZOLL"))
If dtLeistungsnummern.Rows.Count > 0 Then
If falscheLeistungsnummern > 0 Then
pruefData_MSE = False
MsgBox("Es fehlen " & falscheLeistungsnummern & " Leistungsnummern!" & vbNewLine & "Diese Leistungssnummern (von Rechnung " & DateTimePicker2.Text & ") müssen nachgetragen werden. (bitte an Administrator wenden, tblMSELeistungen).")
Return False
End If
@@ -3445,10 +3442,30 @@ Public Class frmMDMDatenverarbetiung
fehlendeTransactionen = CInt((New SQL).getValueTxtBySql("select count(*) FROM [VERAG].[dbo].[tblMSESettlements] where [invoice_date] = '" & DateTimePicker2.Text & "' AND [transaction_id] not in (select [transaction_id] from [VERAG].[dbo].[tblMSETransactions]) ", "FMZOLL"))
If fehlendeTransactionen > 0 Then
pruefData_MSE = False
MsgBox("Es fehlen " & fehlendeTransactionen & " Transaktionen in der Datenbank!" & vbNewLine & "Diese Transaktionen (von Rechnung " & DateTimePicker2.Text & ") müssen nachgeladen werden (bitte an Administrator wenden).")
Dim hint As String = ""
If fehlendeTransactionen > 500 Then
hint = "Batch-Nr: "
hint &= SQL.getValueTxtBySql("select distinct(trans.batch_seq_nr) FROM [VERAG].[dbo].[tblMSESettlements] where [invoice_date] = '" & DateTimePicker2.Text & "' AND [transaction_id] not in (select [transaction_id] from [VERAG].[dbo].[tblMSETransactions]) ", "FMZOLL")
End If
MsgBox("Es fehlen " & fehlendeTransactionen & " Transaktionen in der Datenbank!" & vbNewLine & "Diese Transaktionen (von Rechnung " & DateTimePicker2.Text & ") müssen nachgeladen werden (bitte an Administrator wenden)." & IIf(hint <> "", vbNewLine & hint, ""))
End If
Dim nichtAufAbgerechnetGesetzteTransactionen As Integer = 0
nichtAufAbgerechnetGesetzteTransactionen = CInt((New SQL).getValueTxtBySql("select count (*) FROM [VERAG].[dbo].[tblMSESettlements] as bills inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] where trans.[transaction_status] <> 'Billed' and [invoice_date] = '" & DateTimePicker2.Text & "'", "FMZOLL"))
If nichtAufAbgerechnetGesetzteTransactionen > 0 Then
Dim hint As String = ""
pruefData_MSE = False
If nichtAufAbgerechnetGesetzteTransactionen > 500 Then
hint = "Batch-Nr: "
hint &= SQL.getValueTxtBySql("select distinct(trans.batch_seq_nr) FROM [VERAG].[dbo].[tblMSESettlements] as bills inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] where trans.[transaction_status] <> 'Billed' and [invoice_date] = '" & DateTimePicker2.Text & "'", "FMZOLL")
End If
MsgBox("Es sind " & nichtAufAbgerechnetGesetzteTransactionen & " Transaktionen in der Datenbank, die noch nicht auf VERRECHNET gesetzt sind!" & vbNewLine & "Diese Transaktionen (von Rechnung " & DateTimePicker2.Text & ") müssen aktualisiert werden. (bitte an Administrator wenden)." & IIf(hint <> "", vbNewLine & hint, ""))
End If
Catch ex As Exception

View File

@@ -27,6 +27,7 @@ Partial Class usrCntlMDMDatenverarbeitungAuswertungen_divers
Me.cbxNurEULander = New System.Windows.Forms.CheckBox()
Me.Button2 = New System.Windows.Forms.Button()
Me.cbxConsFakt = New System.Windows.Forms.CheckBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button6
@@ -94,11 +95,27 @@ Partial Class usrCntlMDMDatenverarbeitungAuswertungen_divers
Me.cbxConsFakt.UseVisualStyleBackColor = True
Me.cbxConsFakt.Visible = False
'
'Button3
'
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button3.Image = Global.SDL.My.Resources.Resources.statistik_small
Me.Button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button3.Location = New System.Drawing.Point(168, 64)
Me.Button3.Name = "Button3"
Me.Button3.Padding = New System.Windows.Forms.Padding(0, 0, 2, 0)
Me.Button3.Size = New System.Drawing.Size(130, 41)
Me.Button3.TabIndex = 53
Me.Button3.Text = "fehlende Transakt."
Me.Button3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button3.UseVisualStyleBackColor = True
Me.Button3.Visible = False
'
'usrCntlMDMDatenverarbeitungAuswertungen_divers
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.White
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.cbxConsFakt)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.cbxNurEULander)
@@ -116,4 +133,5 @@ Partial Class usrCntlMDMDatenverarbeitungAuswertungen_divers
Friend WithEvents cbxNurEULander As CheckBox
Friend WithEvents Button2 As Button
Friend WithEvents cbxConsFakt As CheckBox
Friend WithEvents Button3 As Button
End Class

View File

@@ -1,8 +1,11 @@
Public Class usrCntlMDMDatenverarbeitungAuswertungen_divers
Imports VERAG_PROG_ALLGEMEIN
Public Class usrCntlMDMDatenverarbeitungAuswertungen_divers
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim MAIN As frmMDMDatenverarbetiung
Dim Lieferant As String
Dim abrechnugsdatum As String
Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
@@ -40,6 +43,15 @@
Button2.Text = "Fakturierwarenart"
Button1.Text = "Offertenpositionen"
Case "MSE"
Button6.Text = "Nach Spezifikation"
Button2.Text = "Leistungsnummern"
Button1.Text = "Kunden"
Button3.Text = "fehlende Transakt."
Button3.Visible = True
Case Else
End Select
@@ -74,6 +86,10 @@
Case "UTA"
genUTABericht("KDNR")
Case "MSE"
genMSEBericht("SPEZ")
Case Else
MsgBox("nicht definiert!")
@@ -95,6 +111,10 @@
Case "UTA"
genUTABericht("OP")
Case "MSE"
genMSEBericht("KDNR")
End Select
@@ -112,6 +132,9 @@
Case "UTA"
genUTABericht("FKWA")
Case "MSE"
genMSEBericht("LENR")
End Select
@@ -360,22 +383,140 @@
End Sub
Sub genMSEBericht(art As String)
Dim sqlstr = ""
Select Case art
Case "SPEZ"
sqlstr = " SELECT inv.invoice_id as Rechnung,bills.specification_page_id AS Spezifikation_Id ,bills.specification_page_name AS Spezifikation,count(*) as AnzahlTransactionen,
Sum(trans.msts_fee_amount) as Gebühren_MSE,
Sum(trans.transaction_net_amount) as Transaktionsbetrag_Netto,
Sum(trans.USteuer_EUR) As Steuerbetrag,
Sum(trans.transaction_gross_amount) As Transaktionsbetrag_Brutto
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and trans.transaction_country = inv.country
where bills.invoice_date = '" & MAIN.DateTimePicker2.Text & "' --and trans.charged <> 1
GROUP BY inv.invoice_id,bills.specification_page_id, bills.specification_page_name"
Case "LENR"
sqlstr = "Select trans.device_product_type, trans.transaction_country,trans.transaction_product_name, trans.transaction_product_id, cust.[customer_id], trans.partner_haulier_id, cust.customer_name,
sum(trans.transaction_gross_amount) As [Summe Transaction Amount ( EUR )],
sum(trans.msts_fee_amount) As [Summe Admin Fee Amount ( EUR )],
sum(trans.msts_fee_amount) As [Summe Fees And Costs Amount ( EUR )],
sum(trans.msts_vat_amount) As [Summe VAT Amount ( EUR )],
sum(trans.transaction_gross_amount) As [Summe Total Amount ( EUR )]
From [VERAG].[dbo].[tblMSESettlements] as bills
Left Join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
Left Join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
Left Join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] And inv.customer_number = cust.[customer_id] And trans.transaction_country = inv.country
Left Join tblMSELeistungen ON trans.device_product_type = tblMSELeistungen.[Card Type] And trans.transaction_country = tblMSELeistungen.[Transaction Country]
WHERE((trans.transaction_gross_amount <> 0) And tblMSELeistungen.LeistungsNr Is Null) And bills.[invoice_date] = '" & MAIN.DateTimePicker2.Text & "'
GROUP by trans.device_product_type, trans.transaction_country, trans.transaction_product_name, trans.transaction_product_id, cust.[customer_id], trans.partner_haulier_id, cust.customer_name"
Case "KDNR"
sqlstr = " Select cust.customer_id, cust.customer_name, Adressen.AdressenNr, (SELECT Offerten.OffertenNr FROM Offerten WHERE (((Offerten.KundenNr)=isnull(Adressen.[AdressenNr],0)) AND ((Offerten.OffertenNr)=23))) AS Offerte_23
FROM [VERAG].[dbo].[tblMSESettlements] as bills
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
WHERE bills.[invoice_date] = '" & MAIN.DateTimePicker2.Text & "'
GROUP BY cust.customer_id, cust.customer_name, Adressen.AdressenNr
HAVING (((cust.customer_id) Is Not Null) AND ((Adressen.AdressenNr) Is Null)) OR (((cust.customer_id) Is Not Null) AND ((Adressen.AdressenNr) Is Not Null) AND (((SELECT Offerten.OffertenNr FROM Offerten WHERE (((Offerten.KundenNr)=isnull(Adressen.[AdressenNr],0)) AND ((Offerten.OffertenNr)=23)))) Is Null))"
Case "TRANS"
sqlstr = " select * FROM [VERAG].[dbo].[tblMSESettlements] where [invoice_date] = '" & MAIN.DateTimePicker2.Text & "' AND [transaction_id] not in (select [transaction_id] from [VERAG].[dbo].[tblMSETransactions])"
Case Else
MsgBox("Auswertungsart nicht definiert!")
Exit Sub
End Select
Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL")
Dim print As New frmPrintLayout
print.Text = "MSE"
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
MsgBox("Keine Daten!")
Exit Sub
End If
cProgramFunctions.genExcelCSVFromDT(dt, True)
'DEAKVIERT weil zu aufwendig, aktuell per Excel-Export
'Dim rpt As New rptPLOSE_LaenderGesamt
'rpt.DataSource = dt
'Dim sum = 0
'' rpt.lblUeberschrift.Text = "PLOSE Summenbericht " & dat_Sum_Von.Text & " bis " & dat_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 sumBruttoAlleLeistungen As Double = 0
'Dim sumMenge As Double = 0
'AddHandler rpt.Detail.Format, Sub()
' rpt.lblLand.Text = SQL.isDbnullEmpty(rpt.Fields.Item("Rechnung").Value, "") & " - " & SQL.isDbnullEmpty(rpt.Fields.Item("Spezifikation_Id").Value, "")
' rpt.lblEU.Text = SQL.isDbnullEmpty(rpt.Fields.Item("Spezifikation").Value, "")
' rpt.lblNetto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Transaktionsbetrag_Netto").Value, 2, "")
' rpt.lblMWST.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Steuerbetrag").Value, 2, "")
' rpt.lblBrutto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Transaktionsbetrag_Brutto").Value, 2, "")
' sumNetto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Transaktionsbetrag_Netto").Value, 4, 0)
' sumMWST += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Steuerbetrag").Value, 4, 0)
' sumBrutto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Transaktionsbetrag_Brutto").Value, 4, 0)
' End Sub
'AddHandler rpt.ReportFooter1.Format, Sub()
' 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()
End Sub
Sub genKundenbericht_PLOSE()
Dim displayFilter = False
Dim sqlstr As String = ""
Dim frmMDM As frmMDMDatenverarbetiung = Me.ParentForm
sqlstr &= " SELECT count(*) Anzahl,AdressenNr,Ordnungsbegriff "
sqlstr &= " ,sum(plose_Menge) as plose_Menge "
sqlstr &= " ,sum(plose_Preis) as plose_Preis "
sqlstr &= " ,sum(plose_NettobetragWaehrungAbbuchung) as plose_NettobetragWaehrungAbbuchung "
sqlstr &= " ,sum(plose_MWSTBetragWaehrungAbbuchung) as plose_MWSTBetragWaehrungAbbuchung "
sqlstr &= " ,sum(plose_BruttobetragWaehrungAbbuchung) as plose_BruttobetragWaehrungAbbuchung "
sqlstr &= " Select count(*) Anzahl,AdressenNr,Ordnungsbegriff "
sqlstr &= " ,sum(plose_Menge) As plose_Menge "
sqlstr &= " ,sum(plose_Preis) As plose_Preis "
sqlstr &= " ,sum(plose_NettobetragWaehrungAbbuchung) As plose_NettobetragWaehrungAbbuchung "
sqlstr &= " ,sum(plose_MWSTBetragWaehrungAbbuchung) As plose_MWSTBetragWaehrungAbbuchung "
sqlstr &= " ,sum(plose_BruttobetragWaehrungAbbuchung) As plose_BruttobetragWaehrungAbbuchung "
sqlstr &= " FROM tblPLOSE_Details "
sqlstr &= " INNER JOIN Adressen ON PLOSEKundenNr=plose_POLSEKundennummer "
sqlstr &= " INNER JOIN Adressen On PLOSEKundenNr=plose_POLSEKundennummer "
sqlstr &= " WHERE 1=1 "
sqlstr &= " AND plose_RechnungsDatum between '" & frmMDM.dat_Sum_Von.Value & "' and '" & frmMDM.dat_Sum_Bis.Value & "' "
sqlstr &= " And plose_RechnungsDatum between '" & frmMDM.dat_Sum_Von.Value & "' and '" & frmMDM.dat_Sum_Bis.Value & "' "
If cbxConsFakt.CheckState = CheckState.Checked Then
sqlstr &= " AND plose_Fakturiert =1 "
@@ -461,4 +602,15 @@
print.Viewer.ViewType = GrapeCity.Viewer.Common.Model.ViewType.Continuous
print.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Select Case Lieferant
Case "MSE"
genMSEBericht("TRANS")
End Select
End Sub
End Class