Fiskal, Formualre, etc,

This commit is contained in:
2026-03-02 08:39:12 +01:00
parent 6434bcf08e
commit d452db8e16
9 changed files with 613 additions and 200 deletions

View File

@@ -1,4 +1,5 @@
Imports System.IO
Imports System.Data.SqlClient
Imports System.IO
Imports System.Web.UI.WebControls.Expressions
Imports VERAG_PROG_ALLGEMEIN
@@ -12,10 +13,11 @@ Public Class usrCntlFaktAbrechnung
Dim FIRMA As VERAG_PROG_ALLGEMEIN.cFirmen = Nothing
Shared SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim refactored As Boolean = False
Public SAVED = True ' Eigenschaft, ob das Formular gespeichert ist oder verändert wurde
Dim loaded As Boolean = False
Dim allowGetValues As Boolean = True
Dim allowGetValues As Boolean = False
Public Event EVENT_SAVED()
Public Event EVENT_DELETED()
Public Event SOMETHING_CHANGED(RK_ID)
@@ -1319,7 +1321,16 @@ Public Class usrCntlFaktAbrechnung
If FIRMA IsNot Nothing AndAlso FIRMA.Firma_ID = 19 AndAlso RECHNUNG.DruckDatumZeit Is Nothing Then
Dim isRC As Boolean = If(r.Cells("ReverseCharge").Value IsNot DBNull.Value, r.Cells("ReverseCharge").Value, False)
If Not preistaffelIsSet Then setMWSTABRfromSPEDinPOS(r, landNr, landBez, summeRMC, summeFremd, False, False, preistaffelIsSet, antrag, isVZ)
If Not preistaffelIsSet Then
If refactored Then
SetMWSTFromSpedRefactored(r, landBez, summeRMC, summeFremd, False, False, preistaffelIsSet, antrag, isVZ)
Else
setMWSTABRfromSPEDinPOS(r, landNr, landBez, summeRMC, summeFremd, False, False, preistaffelIsSet, antrag, isVZ)
End If
End If
End If
Catch ex As Exception : End Try
@@ -1496,8 +1507,14 @@ Public Class usrCntlFaktAbrechnung
If r IsNot Nothing AndAlso r.Cells("Anzahl").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) AndAlso r.Cells("Preis").Value <> 0 AndAlso isMWSTBearb Then 'r.Cells("LeistungsNr").Value <> bearbNrRMC AndAlso
If Not preistaffelIsSet Then
If refactored Then
SetMWSTFromSpedRefactored(r, landBez, summeRMC, summeFremd, (containRMC AndAlso containFremd), posSet, preistaffelIsSet, antrag, isVZ, True, sumOffertRMC, sumOffertFremd)
Else
setMWSTABRfromSPEDinPOS(r, landNr, landBez, summeRMC, summeFremd, (containRMC AndAlso containFremd), posSet, preistaffelIsSet, antrag, isVZ, True, sumOffertRMC, minBetragRMC, sumOffertFremd, minBetragFremd)
End If
End If
'If posSet Then Exit For
End If
@@ -5210,4 +5227,196 @@ mwst:
End Function
Private Structure AntragSummen
Public RMC As Double
Public Fremd As Double
Public VZ As Double
End Structure
Private Structure MWSTEntscheidung
Public IsMWST As Boolean
Public SetPreisstaffel As Boolean
End Structure
Private Sub SetMWSTFromSpedRefactored(r As DataGridViewRow, LandBez As String, ByRef summeRMC As Double, ByRef summeFremd As Double, ByRef fremdUndRMC As Boolean, ByRef posChanged As Boolean, ByRef setPreisstaffel As Boolean, antrag As cUSTVAntrag, isVZ As Boolean, Optional changed As Boolean = False, Optional sumOffertRMC As Double = 0, Optional sumOffertFremd As Double = 0)
If Not IsSpedArtRelevant() Then Exit Sub
If Not IsRowValid(r) Then Exit Sub
If Not IsAntragValid(antrag) Then Exit Sub
If Not IsLandAndTextMatching(r, LandBez, antrag) Then Exit Sub
Dim summen As AntragSummen = CalculateSummen(antrag, isVZ)
Dim isRMCKunde = isRMCKunde_ref(antrag)
Dim isMWST As Boolean = DecideMWST(r, summen, isRMCKunde, isVZ, setPreisstaffel)
If Not isMWST Then Exit Sub
ApplyPreis(r, summen, isRMCKunde)
ApplyBearbeitungsGebuehr(r, summen, summeRMC, summeFremd, fremdUndRMC, posChanged, changed, sumOffertRMC, sumOffertFremd)
End Sub
Private Function IsAntragValid(antrag As cUSTVAntrag) As Boolean
Return antrag IsNot Nothing AndAlso antrag.UStVAn_ID > 0
End Function
Private Function IsRowValid(r As DataGridViewRow) As Boolean
If r Is Nothing Then Return False
If IsDBNull(r.Cells("LeistungsBez").Value) Then Return False
If IsDBNull(r.Cells("Land").Value) Then Return False
Return True
End Function
Private Function IsLandAndTextMatching(r As DataGridViewRow, landBez As String, antrag As cUSTVAntrag) As Boolean
Dim iso2 = ConvertToISO2(landBez)
If r.Cells("Land").Value.ToString <> iso2 Then Return False
Dim leistungsText = r.Cells("LeistungsBez").Value.ToString.ToLower
Dim begriffe = GetUebersetzungen(antrag.UStVAn_AntragArt)
Return begriffe.Any(Function(x) leistungsText.StartsWith(x))
End Function
Private Function ConvertToISO2(landBez As String) As String
Select Case landBez.Length
Case 2 : Return landBez
Case 3 : Return VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO3Land(landBez)
Case 1 : Return VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO1Land(landBez)
Case Else : Return ""
End Select
End Function
Private Function GetUebersetzungen(antragArt As String) As List(Of String)
Dim baseText = antragArt.ToLower
Return New List(Of String) From {
baseText,
baseText.Replace("mwst", "vat"),
baseText.Replace("moest", "excise"),
baseText.Replace("oe", "ö"),
baseText.Replace("mwst", "rambursare tva"),
baseText.Replace("moest", "rambursare acciza")
}
End Function
Private Function CalculateSummen(antrag As cUSTVAntrag, isVZ As Boolean) As AntragSummen
Dim result As New AntragSummen
For Each pos In antrag.POSITIONEN
Dim offenVZ = pos.UStVPo_VZ AndAlso pos.UStVPo_VZ_RKID Is Nothing
Dim offenNormal = Not pos.UStVPo_VZ AndAlso pos.UStVPo_VZ_RKID Is Nothing
If offenVZ Then result.VZ += pos.UStVPo_USteuerbetragEUR
Dim relevant = If(isVZ, offenVZ, offenNormal)
If Not relevant Then Continue For
If pos.UStVPo_Leistender.ToUpper.StartsWith("RMC") Then
result.RMC += pos.UStVPo_USteuerbetragEUR
Else
result.Fremd += pos.UStVPo_USteuerbetragEUR
End If
Next
Return result
End Function
Private Function DecideMWST(r As DataGridViewRow, summen As AntragSummen, isRMCKunde As Boolean, isVZ As Boolean, ByRef setPreisstaffel As Boolean) As Boolean
Dim isMWST As Boolean = False
Dim staffel As Double = If(IsDBNull(r.Cells("Staffelpreis").Value), -1, r.Cells("Staffelpreis").Value)
Dim offRMC As Boolean = If(IsDBNull(r.Cells("RMC").Value), False, r.Cells("RMC").Value)
Dim offFremd As Boolean = If(IsDBNull(r.Cells("Fremd").Value), False, r.Cells("Fremd").Value)
Dim offVZ As Boolean = If(IsDBNull(r.Cells("VZ").Value), False, r.Cells("VZ").Value)
If isRMCKunde Then
If (offRMC Or offFremd) AndAlso (summen.RMC > 0 Or summen.Fremd > 0) Then
isMWST = True
End If
Else
If offVZ = isVZ Then
If isVZ AndAlso summen.VZ > 0 Then
If staffel > -1 AndAlso staffel <= summen.VZ Then
setPreisstaffel = True
End If
isMWST = True
ElseIf Not isVZ AndAlso summen.VZ > 0 Then
If staffel > -1 AndAlso staffel <= summen.VZ Then
setPreisstaffel = True
End If
isMWST = True
End If
End If
End If
Return isMWST
End Function
Private Sub ApplyPreis(
r As DataGridViewRow,
summen As AntragSummen,
isRMCKunde As Boolean)
r.Cells("Anzahl").Value = 1
If Not IsDBNull(r.Cells("Preis").Value) _
AndAlso CDbl(r.Cells("Preis").Value) <> 0 Then Exit Sub
If isRMCKunde Then
r.Cells("Preis").Value = If(summen.RMC > 0, summen.RMC, summen.Fremd)
Else
r.Cells("Preis").Value = summen.VZ
End If
End Sub
Private Sub ApplyBearbeitungsGebuehr(
r As DataGridViewRow,
summen As AntragSummen,
ByRef summeRMC As Double,
ByRef summeFremd As Double,
ByRef fremdUndRMC As Boolean,
ByRef posChanged As Boolean,
changed As Boolean,
sumOffertRMC As Double,
sumOffertFremd As Double)
If IsDBNull(r.Cells("BGebLeistungsNr").Value) Then Exit Sub
If IsDBNull(r.Cells("BGebProzent").Value) Then Exit Sub
If IsDBNull(r.Cells("Preis").Value) Then Exit Sub
' hier nur noch Gebühr-Logik
' KEINE MWST-Logik mehr
' KEINE Antrag-Logik mehr
posChanged = True
End Sub
Private Function isRMCKunde_ref(antrag As cUSTVAntrag) As Boolean
If antrag Is Nothing Then Return False
Dim kdNr = If(RECHNUNG.RechnungsKundenNr > 0, RECHNUNG.RechnungsKundenNr, kdFirmaRechnungAn.KdNr)
Return kdNr = 150000 AndAlso (antrag.UStVAn_AntragArt = "MWST" OrElse antrag.UStVAn_AntragArt = "MOEST")
End Function
Private Function IsSpedArtRelevant() As Boolean
If SPEDBUCH Is Nothing Then Return False
Return SPEDBUCH.Abfertigungsart = 114 _
OrElse SPEDBUCH.Abfertigungsart = 115 _
OrElse SPEDBUCH.Abfertigungsart = 10
End Function
End Class

View File

@@ -1862,10 +1862,10 @@ Public Class FormularManagerNEU
Hinweismeldung = "CBAM Checklist für Neukunden nicht in " & usrCntl.cboSprache.SelectedItem.text & " verfügbar!"
End If
If Hinweismeldung <> "" Then MsgBox(Hinweismeldung)
Select Case usrCntl.cboSprache._value
Case "EN", "TR"
If Hinweismeldung <> "" Then MsgBox(Hinweismeldung)
Return fm.fillPDF("DOKUMENTE", "VORLAGEN", "SONSTIGE", usrCntl.cboFirma._value, "", Name & "_" & usrCntl.cboSprache._value, listTowrite)
Case Else
Return fm.fillPDF("DOKUMENTE", "VORLAGEN", "SONSTIGE", usrCntl.cboFirma._value, "", Name, listTowrite)

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.3.4")>
<Assembly: AssemblyFileVersion("1.5.3.4")>
<Assembly: AssemblyVersion("1.5.3.5")>
<Assembly: AssemblyFileVersion("1.5.3.5")>

View File

@@ -23,7 +23,7 @@ Partial Class usrCntlUSTV
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(usrCntlUSTV))
Me.pnlFilter = New System.Windows.Forms.Panel()
Me.dgvUSTV = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
@@ -84,6 +84,7 @@ Partial Class usrCntlUSTV
Me.ContextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuStrip3 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuStrip4 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.btnoffeneAntraege = New System.Windows.Forms.Button()
CType(Me.dgvUSTV, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
Me.Panel2.SuspendLayout()
@@ -97,7 +98,7 @@ Partial Class usrCntlUSTV
Me.pnlFilter.Dock = System.Windows.Forms.DockStyle.Bottom
Me.pnlFilter.Location = New System.Drawing.Point(0, 81)
Me.pnlFilter.Name = "pnlFilter"
Me.pnlFilter.Size = New System.Drawing.Size(1627, 27)
Me.pnlFilter.Size = New System.Drawing.Size(1737, 27)
Me.pnlFilter.TabIndex = 6
'
'dgvUSTV
@@ -105,8 +106,8 @@ Partial Class usrCntlUSTV
Me.dgvUSTV.AKTUALISIERUNGS_INTERVALL = -1
Me.dgvUSTV.AllowUserToAddRows = False
Me.dgvUSTV.AllowUserToDeleteRows = False
DataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
Me.dgvUSTV.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1
DataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
Me.dgvUSTV.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle3
Me.dgvUSTV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvUSTV.Dock = System.Windows.Forms.DockStyle.Fill
Me.dgvUSTV.Location = New System.Drawing.Point(0, 108)
@@ -114,7 +115,7 @@ Partial Class usrCntlUSTV
Me.dgvUSTV.Name = "dgvUSTV"
Me.dgvUSTV.ReadOnly = True
Me.dgvUSTV.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.dgvUSTV.Size = New System.Drawing.Size(1627, 431)
Me.dgvUSTV.Size = New System.Drawing.Size(1737, 431)
Me.dgvUSTV.TabIndex = 1
'
'Label1
@@ -131,6 +132,7 @@ Partial Class usrCntlUSTV
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
Me.Panel1.Controls.Add(Me.btnoffeneAntraege)
Me.Panel1.Controls.Add(Me.txtSucheID)
Me.Panel1.Controls.Add(Me.MyComboBox1)
Me.Panel1.Controls.Add(Me.Label12)
@@ -173,7 +175,7 @@ Partial Class usrCntlUSTV
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(1627, 108)
Me.Panel1.Size = New System.Drawing.Size(1737, 108)
Me.Panel1.TabIndex = 0
'
'txtSucheID
@@ -295,7 +297,7 @@ Partial Class usrCntlUSTV
Me.txtRisiko.BackColor = System.Drawing.Color.IndianRed
Me.txtRisiko.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtRisiko.ForeColor = System.Drawing.Color.Black
Me.txtRisiko.Location = New System.Drawing.Point(1015, 29)
Me.txtRisiko.Location = New System.Drawing.Point(1125, 29)
Me.txtRisiko.MaxLineLength = -1
Me.txtRisiko.MaxLines_Warning = ""
Me.txtRisiko.MaxLines_Warning_Label = Nothing
@@ -308,7 +310,7 @@ Partial Class usrCntlUSTV
'
Me.Label10.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label10.AutoSize = True
Me.Label10.Location = New System.Drawing.Point(957, 32)
Me.Label10.Location = New System.Drawing.Point(1067, 32)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(36, 13)
Me.Label10.TabIndex = 55
@@ -332,7 +334,7 @@ Partial Class usrCntlUSTV
Me.txtOPSaldo.BackColor = System.Drawing.Color.IndianRed
Me.txtOPSaldo.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtOPSaldo.ForeColor = System.Drawing.Color.Black
Me.txtOPSaldo.Location = New System.Drawing.Point(1015, 6)
Me.txtOPSaldo.Location = New System.Drawing.Point(1125, 6)
Me.txtOPSaldo.MaxLineLength = -1
Me.txtOPSaldo.MaxLines_Warning = ""
Me.txtOPSaldo.MaxLines_Warning_Label = Nothing
@@ -345,7 +347,7 @@ Partial Class usrCntlUSTV
'
Me.Label11.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label11.AutoSize = True
Me.Label11.Location = New System.Drawing.Point(957, 12)
Me.Label11.Location = New System.Drawing.Point(1067, 12)
Me.Label11.Name = "Label11"
Me.Label11.Size = New System.Drawing.Size(52, 13)
Me.Label11.TabIndex = 53
@@ -355,7 +357,7 @@ Partial Class usrCntlUSTV
'
Me.Label9.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label9.AutoSize = True
Me.Label9.Location = New System.Drawing.Point(1512, 52)
Me.Label9.Location = New System.Drawing.Point(1622, 52)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(102, 13)
Me.Label9.TabIndex = 52
@@ -377,7 +379,7 @@ Partial Class usrCntlUSTV
Me.txtSumDiff._WaehrungZeichen = True
Me.txtSumDiff.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtSumDiff.ForeColor = System.Drawing.Color.Black
Me.txtSumDiff.Location = New System.Drawing.Point(1396, 49)
Me.txtSumDiff.Location = New System.Drawing.Point(1506, 49)
Me.txtSumDiff.MaxLineLength = -1
Me.txtSumDiff.MaxLines_Warning = ""
Me.txtSumDiff.MaxLines_Warning_Label = Nothing
@@ -393,7 +395,7 @@ Partial Class usrCntlUSTV
Me.btnKundendatenaktualisieren.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnKundendatenaktualisieren.ForeColor = System.Drawing.Color.Black
Me.btnKundendatenaktualisieren.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnKundendatenaktualisieren.Location = New System.Drawing.Point(1497, 6)
Me.btnKundendatenaktualisieren.Location = New System.Drawing.Point(1607, 6)
Me.btnKundendatenaktualisieren.Name = "btnKundendatenaktualisieren"
Me.btnKundendatenaktualisieren.Size = New System.Drawing.Size(127, 39)
Me.btnKundendatenaktualisieren.TabIndex = 33
@@ -416,7 +418,7 @@ Partial Class usrCntlUSTV
Me.txtSumErst._WaehrungZeichen = True
Me.txtSumErst.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtSumErst.ForeColor = System.Drawing.Color.Black
Me.txtSumErst.Location = New System.Drawing.Point(1396, 25)
Me.txtSumErst.Location = New System.Drawing.Point(1506, 25)
Me.txtSumErst.MaxLineLength = -1
Me.txtSumErst.MaxLines_Warning = ""
Me.txtSumErst.MaxLines_Warning_Label = Nothing
@@ -441,7 +443,7 @@ Partial Class usrCntlUSTV
Me.txtSumUst._WaehrungZeichen = True
Me.txtSumUst.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtSumUst.ForeColor = System.Drawing.Color.Black
Me.txtSumUst.Location = New System.Drawing.Point(1396, 5)
Me.txtSumUst.Location = New System.Drawing.Point(1506, 5)
Me.txtSumUst.MaxLineLength = -1
Me.txtSumUst.MaxLines_Warning = ""
Me.txtSumUst.MaxLines_Warning_Label = Nothing
@@ -466,7 +468,7 @@ Partial Class usrCntlUSTV
Me.txtVZBetrag._WaehrungZeichen = True
Me.txtVZBetrag.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtVZBetrag.ForeColor = System.Drawing.Color.Black
Me.txtVZBetrag.Location = New System.Drawing.Point(1204, 5)
Me.txtVZBetrag.Location = New System.Drawing.Point(1314, 5)
Me.txtVZBetrag.MaxLineLength = -1
Me.txtVZBetrag.MaxLines_Warning = ""
Me.txtVZBetrag.MaxLines_Warning_Label = Nothing
@@ -479,7 +481,7 @@ Partial Class usrCntlUSTV
'
Me.Label5.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(1302, 51)
Me.Label5.Location = New System.Drawing.Point(1412, 51)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(79, 13)
Me.Label5.TabIndex = 29
@@ -489,7 +491,7 @@ Partial Class usrCntlUSTV
'
Me.Label8.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(1117, 13)
Me.Label8.Location = New System.Drawing.Point(1227, 13)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(55, 13)
Me.Label8.TabIndex = 50
@@ -499,7 +501,7 @@ Partial Class usrCntlUSTV
'
Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(1302, 27)
Me.Label4.Location = New System.Drawing.Point(1412, 27)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(90, 13)
Me.Label4.TabIndex = 28
@@ -523,7 +525,7 @@ Partial Class usrCntlUSTV
Me.txt3470Betrag.BackColor = System.Drawing.Color.LightGreen
Me.txt3470Betrag.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txt3470Betrag.ForeColor = System.Drawing.Color.Black
Me.txt3470Betrag.Location = New System.Drawing.Point(848, 8)
Me.txt3470Betrag.Location = New System.Drawing.Point(958, 8)
Me.txt3470Betrag.MaxLineLength = -1
Me.txt3470Betrag.MaxLines_Warning = ""
Me.txt3470Betrag.MaxLines_Warning_Label = Nothing
@@ -536,7 +538,7 @@ Partial Class usrCntlUSTV
'
Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(1302, 6)
Me.Label3.Location = New System.Drawing.Point(1412, 6)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(59, 13)
Me.Label3.TabIndex = 27
@@ -546,7 +548,7 @@ Partial Class usrCntlUSTV
'
Me.Label7.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label7.AutoSize = True
Me.Label7.Location = New System.Drawing.Point(811, 12)
Me.Label7.Location = New System.Drawing.Point(921, 12)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(31, 13)
Me.Label7.TabIndex = 48
@@ -568,7 +570,7 @@ Partial Class usrCntlUSTV
Me.txtVorschaubetrGes._WaehrungZeichen = True
Me.txtVorschaubetrGes.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtVorschaubetrGes.ForeColor = System.Drawing.Color.Black
Me.txtVorschaubetrGes.Location = New System.Drawing.Point(1205, 28)
Me.txtVorschaubetrGes.Location = New System.Drawing.Point(1315, 28)
Me.txtVorschaubetrGes.MaxLineLength = -1
Me.txtVorschaubetrGes.MaxLines_Warning = ""
Me.txtVorschaubetrGes.MaxLines_Warning_Label = Nothing
@@ -581,7 +583,7 @@ Partial Class usrCntlUSTV
'
Me.Label6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(1117, 35)
Me.Label6.Location = New System.Drawing.Point(1227, 35)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(82, 13)
Me.Label6.TabIndex = 33
@@ -726,7 +728,7 @@ Partial Class usrCntlUSTV
Me.Button1.ForeColor = System.Drawing.Color.Black
Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Image)
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.Location = New System.Drawing.Point(1510, 6)
Me.Button1.Location = New System.Drawing.Point(1620, 6)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(114, 39)
Me.Button1.TabIndex = 5
@@ -772,7 +774,7 @@ Partial Class usrCntlUSTV
Me.Panel2.Location = New System.Drawing.Point(0, 539)
Me.Panel2.MinimumSize = New System.Drawing.Size(0, 50)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(1627, 77)
Me.Panel2.Size = New System.Drawing.Size(1737, 77)
Me.Panel2.TabIndex = 2
'
'Panel3
@@ -793,7 +795,7 @@ Partial Class usrCntlUSTV
Me.Panel3.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel3.Location = New System.Drawing.Point(0, 0)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(1627, 77)
Me.Panel3.Size = New System.Drawing.Size(1737, 77)
Me.Panel3.TabIndex = 0
'
'btn3470
@@ -801,7 +803,7 @@ Partial Class usrCntlUSTV
Me.btn3470.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btn3470.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btn3470.ForeColor = System.Drawing.Color.Black
Me.btn3470.Location = New System.Drawing.Point(862, 5)
Me.btn3470.Location = New System.Drawing.Point(972, 5)
Me.btn3470.Name = "btn3470"
Me.btn3470.Size = New System.Drawing.Size(114, 39)
Me.btn3470.TabIndex = 30
@@ -829,7 +831,7 @@ Partial Class usrCntlUSTV
Me.btnVZ.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnVZ.ForeColor = System.Drawing.Color.Black
Me.btnVZ.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnVZ.Location = New System.Drawing.Point(982, 5)
Me.btnVZ.Location = New System.Drawing.Point(1092, 5)
Me.btnVZ.Name = "btnVZ"
Me.btnVZ.Size = New System.Drawing.Size(104, 39)
Me.btnVZ.TabIndex = 28
@@ -842,7 +844,7 @@ Partial Class usrCntlUSTV
Me.btnFAPruefung.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnFAPruefung.ForeColor = System.Drawing.Color.Black
Me.btnFAPruefung.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnFAPruefung.Location = New System.Drawing.Point(1092, 6)
Me.btnFAPruefung.Location = New System.Drawing.Point(1202, 6)
Me.btnFAPruefung.Name = "btnFAPruefung"
Me.btnFAPruefung.Size = New System.Drawing.Size(92, 39)
Me.btnFAPruefung.TabIndex = 27
@@ -855,7 +857,7 @@ Partial Class usrCntlUSTV
Me.btnVorschau.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnVorschau.ForeColor = System.Drawing.Color.Black
Me.btnVorschau.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnVorschau.Location = New System.Drawing.Point(1190, 6)
Me.btnVorschau.Location = New System.Drawing.Point(1300, 6)
Me.btnVorschau.Name = "btnVorschau"
Me.btnVorschau.Size = New System.Drawing.Size(92, 39)
Me.btnVorschau.TabIndex = 26
@@ -868,7 +870,7 @@ Partial Class usrCntlUSTV
Me.btnMail.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnMail.ForeColor = System.Drawing.Color.Black
Me.btnMail.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnMail.Location = New System.Drawing.Point(1288, 5)
Me.btnMail.Location = New System.Drawing.Point(1398, 5)
Me.btnMail.Name = "btnMail"
Me.btnMail.Size = New System.Drawing.Size(92, 39)
Me.btnMail.TabIndex = 25
@@ -896,7 +898,7 @@ Partial Class usrCntlUSTV
Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button5.Image = CType(resources.GetObject("Button5.Image"), System.Drawing.Image)
Me.Button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button5.Location = New System.Drawing.Point(1386, 5)
Me.Button5.Location = New System.Drawing.Point(1496, 5)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(118, 40)
Me.Button5.TabIndex = 23
@@ -938,6 +940,18 @@ Partial Class usrCntlUSTV
Me.ContextMenuStrip4.Name = "ContextMenuStrip1"
Me.ContextMenuStrip4.Size = New System.Drawing.Size(61, 4)
'
'btnoffeneAntraege
'
Me.btnoffeneAntraege.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnoffeneAntraege.ForeColor = System.Drawing.Color.Black
Me.btnoffeneAntraege.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnoffeneAntraege.Location = New System.Drawing.Point(806, 24)
Me.btnoffeneAntraege.Name = "btnoffeneAntraege"
Me.btnoffeneAntraege.Size = New System.Drawing.Size(83, 40)
Me.btnoffeneAntraege.TabIndex = 79
Me.btnoffeneAntraege.Text = "offene Anträge"
Me.btnoffeneAntraege.UseVisualStyleBackColor = True
'
'usrCntlUSTV
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -946,7 +960,7 @@ Partial Class usrCntlUSTV
Me.Controls.Add(Me.Panel2)
Me.Controls.Add(Me.Panel1)
Me.Name = "usrCntlUSTV"
Me.Size = New System.Drawing.Size(1627, 616)
Me.Size = New System.Drawing.Size(1737, 616)
CType(Me.dgvUSTV, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel1.ResumeLayout(False)
Me.Panel1.PerformLayout()
@@ -1015,4 +1029,5 @@ Partial Class usrCntlUSTV
Friend WithEvents Button4 As Button
Friend WithEvents btn3470 As Button
Friend WithEvents ContextMenuStrip4 As ContextMenuStrip
Friend WithEvents btnoffeneAntraege As Button
End Class

View File

@@ -12,7 +12,7 @@ Public Class usrCntlUSTV
Public kdNr As Integer = -1
Dim loaded As Boolean = False
Sub init(Optional kdNr As Integer = -1, Optional ID As Integer = -1, Optional AntragsLand As String = "")
Sub init(Optional kdNr As Integer = -1, Optional ID As Integer = -1, Optional AntragsLand As String = "", Optional ignoreDate As Boolean = False)
pnlFilter.AutoScroll = False
btnKundendatenaktualisieren.Enabled = False
' MsgBox(kdNr)
@@ -51,7 +51,7 @@ Public Class usrCntlUSTV
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)'), 1, 2, '') AS 'GutschriftsNr' ,[UStVAn_Währungscode],[UStVAn_USteuerbetrag],[UStVAn_Erstattungsbetrag],([UStVAn_USteuerbetrag] - [UStVAn_Erstattungsbetrag]) as UStVAn_Differenzbetrag,[UStVAn_USteuerbetragEUR],[UStVAn_ErstattungsbetragEUR],([UStVAn_USteuerbetragEUR] - [UStVAn_ErstattungsbetragEUR]) as UStVAn_DifferenzbetragEUR,UStVAn_VZoffen ,[UStVAn_Sachbearbeiter]
FROM [tblUStVAntrag] inner join [Länderverzeichnis für die Außenhandelsstatistik] on UStVAn_LandNr=Landnr
where 1=1 " & getWhere(, ID, AntragsLand) & "
where 1=1 " & getWhere(Not ignoreDate, ID, AntragsLand) & "
order by UStVAn_KuNr,UStVAn_Name,datepart(year,[UStVAn_ReDatVon] ) desc,LandKz,[UStVAn_ReDatVon] desc"
.SET_SQL(sql_query, "FMZOLL")
@@ -325,24 +325,16 @@ Public Class usrCntlUSTV
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then
'FlatButton1.Enabled = False#
btnUSTVAloeschen.Enabled = False
btnNeuerUSTVA.Enabled = False
btnPLOSEAlle.Enabled = False
Else
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
btnUSTVAloeschen.Enabled = True
btnNeuerUSTVA.Enabled = True
Else
btnUSTVAloeschen.Enabled = True
btnNeuerUSTVA.Enabled = True
End If
End If
frmMain.EnableDoubleBuffered(dgvUSTV)
' Panel3.Height = Me.Height / 2 + 300
End Sub
@@ -1747,5 +1739,9 @@ Public Class usrCntlUSTV
End Sub
Private Sub btnoffeneAntraege_Click(sender As Object, e As EventArgs) Handles btnoffeneAntraege.Click
If loaded = False Then Exit Sub
cbxDifferenzbetrag.CheckState = CheckState.Checked
init(,,, True)
End Sub
End Class

View File

@@ -29,10 +29,12 @@ Public Class usrcntlFiskaluebersicht
.Columns("FK_Datum").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
.Columns("FK_Datum").HeaderText = "Datum"
.Columns("FK_Art").HeaderText = "Art"
.Columns("FK_Art").Width = 50
.Columns("FK_locked").Visible = False
.Columns("FK_Id").Visible = False
.Columns("FK_Kdnr").Visible = False
.Columns("FK_Land").Visible = False
.Columns("FK_Land").HeaderText = "Land"
.Columns("FK_Land").Width = 50
End With
@@ -678,6 +680,7 @@ Public Class usrcntlFiskaluebersicht
End Sub
Private Sub getFields()
fk.FK_Land = cbxLand._value
fk.FK_Art = cbxLand._value
If BA IsNot Nothing Then fk.FK_Bonitaet = BA.ba_id

View File

@@ -55,7 +55,7 @@ Public Class frmMDMDatenverarbetiung
Case "PLOSE"
Dim plose As cPLOSE_Inv_Data
pruef = plose.checkImport()
If pruef Then pruef = pruefData_PLOSE()
If pruef Then pruef = pruefData_PLOSE_NEW()
Case "ASFINAG" : pruef = pruefData_ASFINAG()
Case "UTA" : pruef = pruefData_UTA()
Case "IDS" : pruef = pruefData_IDS()
@@ -916,7 +916,6 @@ Public Class frmMDMDatenverarbetiung
group by plose_POLSEKundennummer,plose_ProduktCode
order by plose_POLSEKundennummer,plose_ProduktCode", "FMZOLL")
.LOAD()
'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
If .Columns.Count > 0 Then
.Columns("plose_POLSEKundennummer").HeaderText = "PLOSE KdNr"
@@ -929,18 +928,6 @@ Public Class frmMDMDatenverarbetiung
.Columns("plose_MWSTBetragWaehrungAbbuchung").HeaderText = "MWST"
.Columns("plose_BruttobetragWaehrungAbbuchung").HeaderText = "Brutto"
'.Columns("VERAGLeistungsNr").ReadOnly = False
'.Columns("VERAGKdNr").ReadOnly = False
'For Each r As DataGridViewColumn In .Columns
' If r.Name = "VERAGLeistungsNr" Or r.Name = "VERAGKdNr" Then
' r.ReadOnly = False
' Else
' r.ReadOnly = True
' End If
'Next
Dim c As New DataGridViewTextBoxColumn
c.Name = "VERAGKdNr"
c.HeaderText = "VERAG KdNr"
@@ -2076,14 +2063,14 @@ Public Class frmMDMDatenverarbetiung
End If
End If
Dim connectionString = ""
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD_Test.accd"
Else
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD.accdb"
End If
'Dim connectionString = ""
'If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
' connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD_Test.accd"
'Else
' connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL.verag.ost.dmn\f\FMZoll\MautD.accdb"
'End If
Dim con As New OleDbConnection(connectionString)
'Dim con As New OleDbConnection(connectionString)
Dim cmd As New OleDbCommand
Dim var1 As String
@@ -2094,7 +2081,7 @@ Public Class frmMDMDatenverarbetiung
If dt IsNot Nothing Then
con.Open()
'con.Open()
For Each r In dt.Rows
Try
@@ -2102,26 +2089,26 @@ Public Class frmMDMDatenverarbetiung
r(0) & "'," & r(1) & ",'" & r(2) & "','" & r(3) & "','" & r(4) & "','" & r(5).ToString.Replace("'", " ") & "','" & r(6) & "','" & r(7).ToString.Replace("'", " ") & "','" & r(8).ToString.Replace("'", " ") & "'," & CDbl(r(9)).ToString.Replace(",", ".") & "," & CDbl(r(10)).ToString.Replace(",", ".") & "," & CDbl(r(11)).ToString.Replace(",", ".") & ",'" & datPloseAnhang.Text & "')", "FMZOLL")
'Zeitstempel
Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Entry Terminal],[Exit Terminal],[Nett Amount],[VAT Amount],[Total Amount]) VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P12) "
' "SELECT * FROM DBParent WHERE P_ID = " & UniqeID & ";"
Using Command As New OleDbCommand(SQLQuery, con)
'Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Entry Terminal],[Exit Terminal],[Nett Amount],[VAT Amount],[Total Amount]) VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P12) "
'' "SELECT * FROM DBParent WHERE P_ID = " & UniqeID & ";"
'Using Command As New OleDbCommand(SQLQuery, con)
Command.Parameters.AddWithValue("@P1", r(0))
Command.Parameters.AddWithValue("@P2", r(1))
Command.Parameters.AddWithValue("@P3", r(2))
Command.Parameters.AddWithValue("@P4", r(3))
Command.Parameters.AddWithValue("@P5", r(4))
Command.Parameters.AddWithValue("@P6", r(5))
Command.Parameters.AddWithValue("@P7", r(6))
Command.Parameters.AddWithValue("@P8", r(7))
Command.Parameters.AddWithValue("@P9", r(8))
Command.Parameters.AddWithValue("@P10", CDbl(r(9)))
Command.Parameters.AddWithValue("@P11", CDbl(r(10)))
Command.Parameters.AddWithValue("@P12", CDbl(r(11)))
' Command.Parameters.AddWithValue("@P1", r(0))
' Command.Parameters.AddWithValue("@P2", r(1))
' Command.Parameters.AddWithValue("@P3", r(2))
' Command.Parameters.AddWithValue("@P4", r(3))
' Command.Parameters.AddWithValue("@P5", r(4))
' Command.Parameters.AddWithValue("@P6", r(5))
' Command.Parameters.AddWithValue("@P7", r(6))
' Command.Parameters.AddWithValue("@P8", r(7))
' Command.Parameters.AddWithValue("@P9", r(8))
' Command.Parameters.AddWithValue("@P10", CDbl(r(9)))
' Command.Parameters.AddWithValue("@P11", CDbl(r(10)))
' Command.Parameters.AddWithValue("@P12", CDbl(r(11)))
If Not VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then Command.ExecuteNonQuery()
Command.Dispose()
End Using
' If Not VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then Command.ExecuteNonQuery()
' Command.Dispose()
'End Using
Catch ex2 As System.Exception
@@ -2133,7 +2120,7 @@ Public Class frmMDMDatenverarbetiung
Next
con.Close()
'con.Close()
End If
pic.Visible = True
Return True
@@ -4139,6 +4126,178 @@ Public Class frmMDMDatenverarbetiung
End Try
End Function
Function pruefData_PLOSE_NEW() As Boolean
Try
Dim VERAGKdNr_DT As DataTable = SQL.loadDgvBySql("SELECT AdressenNr,PLOSEKundenNr FROM Adressen WHERE PLOSEKundenNr is not null order by PLOSEKundenNr", "FMZOLL")
pruefData_PLOSE_NEW = True
checkFixeTaxeImOffert("PLOSE", VERAGKdNr_DT)
Dim PLOSE_doppelteProductCodes As DataTable = SQL.loadDgvBySql("select count(*), plp_ProductCode from tblPLOSE_Produktbeschreibung p where plp_LeistungsNr is not null AND p.plp_Firma IN ('PSS','PU') group by plp_ProductCode having count(*) > 1", "FMZOLL")
If PLOSE_doppelteProductCodes.Rows.Count > 0 Then
pruefData_PLOSE_NEW = False
MsgBox(PLOSE_doppelteProductCodes.Rows.Count & " doppelte Productcodes hinterlegt!")
cProgramFunctions.genExcelCSVFromDT(PLOSE_doppelteProductCodes, True)
End If
checkFixeTaxeImOffert("PLOSE", VERAGKdNr_DT)
Dim cnt = 0
Dim cntTotal = MyDatagridview1.Rows.Count()
Dim PLoseSQL As String = "SELECT
d.plose_POLSEKundennummer,
a.AdressenNr AS VERAGKdNr,
p.plp_LeistungsNr AS VERAGLeistungsNr,
o.OffertenNr AS KundeOffertenNr,
op.LeistungsNr AS KundeLeistungsNr,
COUNT(*) AS Anzahl,
d.plose_ProduktCode,
MAX(d.plose_Produktbeschreibung) AS plose_Produktbeschreibung,
SUM(d.plose_Menge) AS plose_Menge,
SUM(d.plose_Preis) AS plose_Preis,
SUM(d.plose_NettobetragWaehrungAbbuchung) AS plose_NettobetragWaehrungAbbuchung,
SUM(d.plose_MWSTBetragWaehrungAbbuchung) AS plose_MWSTBetragWaehrungAbbuchung,
SUM(d.plose_BruttobetragWaehrungAbbuchung) AS plose_BruttobetragWaehrungAbbuchung,
CASE WHEN a.AdressenNr IS NULL THEN 0 ELSE 1 END AS KundeOK,
CASE WHEN p.plp_LeistungsNr IS NULL THEN 0 ELSE 1 END AS ProduktOK,
CASE WHEN o.OffertenNr IS NULL THEN 0 ELSE 1 END AS OfferteOK,
CASE WHEN op.LeistungsNr IS NULL THEN 0 ELSE 1 END AS LeistungOK
FROM tblPLOSE_Details d
LEFT JOIN Adressen a
ON a.PLOSEKundenNr = d.plose_POLSEKundennummer
LEFT JOIN tblPLOSE_Produktbeschreibung p
ON p.plp_ProductCode = d.plose_ProduktCode AND p.plp_LeistungsNr is not null
AND p.plp_Firma IN ('PSS','PU')
LEFT JOIN Offerten o
ON o.KundenNr = a.AdressenNr
AND o.OffertenNr = 80
LEFT JOIN Offertenpositionen op
ON op.KundenNr = a.AdressenNr
AND op.OffertenNr = 80
AND op.LeistungsNr = p.plp_LeistungsNr
WHERE
d.plose_DatumTransaktion between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "'
AND d.plose_Fakturiert = 0
AND d.plose_ProduktCode NOT IN (" & ProduktCode_NOT_IN & ")
GROUP BY
d.plose_POLSEKundennummer,
d.plose_ProduktCode,
a.AdressenNr,
p.plp_LeistungsNr,
o.OffertenNr,
op.LeistungsNr
ORDER BY
d.plose_POLSEKundennummer,
d.plose_ProduktCode"
With MyDatagridview1
.Columns.Clear()
.SET_SQL(PLoseSQL, "FMZOLL")
.LOAD()
If .Columns.Count > 0 Then
.Columns("plose_POLSEKundennummer").HeaderText = "PLOSE KdNr"
.Columns("plose_ProduktCode").HeaderText = "ProduktCode"
.Columns("plose_Produktbeschreibung").HeaderText = "Beschreibung"
.Columns("plose_Produktbeschreibung").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
.Columns("plose_Menge").HeaderText = "Menge"
.Columns("plose_Preis").HeaderText = "Preis"
.Columns("plose_NettobetragWaehrungAbbuchung").HeaderText = "Netto"
.Columns("plose_MWSTBetragWaehrungAbbuchung").HeaderText = "MWST"
.Columns("plose_BruttobetragWaehrungAbbuchung").HeaderText = "Brutto"
.Columns("KundeOK").Visible = False
.Columns("ProduktOK").Visible = False
.Columns("OfferteOK").Visible = False
.Columns("LeistungOK").Visible = False
.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
End If
Dim sumBto As Double = 0
Dim sumNto As Double = 0
For Each r As DataGridViewRow In .Rows
sumBto += If(IsNumeric(r.Cells("plose_BruttobetragWaehrungAbbuchung").Value), CDbl(r.Cells("plose_BruttobetragWaehrungAbbuchung").Value), 0)
sumNto += If(IsNumeric(r.Cells("plose_NettobetragWaehrungAbbuchung").Value), CDbl(r.Cells("plose_NettobetragWaehrungAbbuchung").Value), 0)
If r.Cells("KundeOK").Value Then
r.Cells("VERAGKdNr").Style.BackColor = Color.MintCream
Else
r.Cells("VERAGKdNr").Style.BackColor = Color.PapayaWhip
pruefData_PLOSE_NEW = False
End If
If r.Cells("ProduktOK").Value Then
r.Cells("VERAGLeistungsNr").Style.BackColor = Color.MintCream
Else
r.Cells("VERAGLeistungsNr").Style.BackColor = Color.PapayaWhip
pruefData_PLOSE_NEW = False
End If
If r.Cells("OfferteOK").Value Then
r.Cells("KundeOffertenNr").Style.BackColor = Color.MintCream
Else
r.Cells("KundeOffertenNr").Style.BackColor = Color.PapayaWhip
pruefData_PLOSE_NEW = False
End If
If r.Cells("LeistungOK").Value Then
r.Cells("KundeLeistungsNr").Style.BackColor = Color.MintCream
Else
r.Cells("KundeLeistungsNr").Style.BackColor = Color.PapayaWhip
pruefData_PLOSE_NEW = False
End If
If cnt Mod 100 = 0 Then
lblProzPruef.Text = CInt(cnt / cntTotal * 100) & " %"
lblProzPruef.Refresh()
End If
cnt += 1
Next
lblProzPruef.Text = CInt(cnt / MyDatagridview1.Rows.Count() * 100) & " %" '100
lblProzPruef.Refresh()
Me.Refresh()
txtAnzahl.Text = .Rows.Count
txtPruefsummeNetto.Text = CDbl(sumNto).ToString("C2")
txtPruefsummeBrutto.Text = CDbl(sumBto).ToString("C2")
.ClearSelection()
End With
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
pruefData_PLOSE_NEW = False
End Try
End Function
Public Sub SuspendPainting(ByVal parent As Control)
SendMessage(parent.Handle, WM_SETREDRAW, False, 0)
End Sub
@@ -4225,7 +4384,36 @@ Public Class frmMDMDatenverarbetiung
End If
Dim dtUTAOffertenPositionen As DataTable = SQL.loadDgvBySql("SELECT * FROM vwUTA_PrüfungInkonsistenzVERAGOffertenpositionen2_new", "FMZOLL")
Dim dtUTAOffertenPositionen As DataTable = SQL.loadDgvBySql("WITH Basis AS
(
SELECT DISTINCT
a.AdressenNr AS VERAG_KundenNr,
l.VERAG_OffertenNr,
l.VERAG_LeistungsNr
FROM dbo.tblUTAImportNew i
INNER JOIN dbo.tblUTALeistungen l
ON i.Fakturierwarenart = l.Fakturierwarenart
AND i.Lieferland = l.Lieferland
INNER JOIN dbo.Adressen a
ON i.Kundennummer = a.UTAKundenNr
)
SELECT
b.VERAG_KundenNr,
b.VERAG_OffertenNr,
b.VERAG_LeistungsNr
FROM Basis b
WHERE NOT EXISTS
(
SELECT 1
FROM dbo.Offertenpositionen o
WHERE o.KundenNr = b.VERAG_KundenNr
AND o.OffertenNr = b.VERAG_OffertenNr
AND o.LeistungsNr = b.VERAG_LeistungsNr
)
ORDER BY
b.VERAG_KundenNr,
b.VERAG_OffertenNr,
b.VERAG_LeistungsNr;", "FMZOLL")
If dtUTAOffertenPositionen.Rows.Count > 0 Then
pruefData_UTA = False
@@ -4424,7 +4612,7 @@ Public Class frmMDMDatenverarbetiung
If IDSRechnungungenVorhanden < 1 Then
pruefData_IDS = False
Dim hint As String = ""
MsgBox("Es sind keine Rechnungen in der Datenbank, vermutlich noch nicht (vollständig) geladen!" & vbNewLine & "Diese Rechnungen vom" & DateTimePicker2.Text & ") müssen nachgeladen werden (bitte an Administrator wenden)." & IIf(hint <> "", vbNewLine & hint, ""))
MsgBox("Es sind keine Rechnungen in der Datenbank, vermutlich noch nicht (vollständig) geladen!" & vbNewLine & "Diese Rechnungen vom (" & DateTimePicker2.Text & ") müssen nachgeladen werden (bitte an Administrator wenden)." & IIf(hint <> "", vbNewLine & hint, ""))
End If
@@ -4621,7 +4809,7 @@ Public Class frmMDMDatenverarbetiung
If Not vbYes = MsgBox("Aktuell ist der Testlauf aktiviert, wirklich fortfahren?", vbYesNoCancel) Then Exit Sub
End If
If vbYes = MsgBox("Möchten Sie den Vorgang wirklich manuell ausgeführen (wird bei Rechnungserstellung automatisch ausgeführt)", vbYesNoCancel) Then
If vbYes = MsgBox("Möchten Sie den Vorgang wirklich manuell ausführen (wird bei Rechnungserstellung automatisch ausgeführt)", vbYesNoCancel) Then
Select Case LIEFERANT
Case "PLOSE" : setFakturiert(LIEFERANT)
Case "UTA" : setFakturiert(LIEFERANT)
@@ -5203,13 +5391,16 @@ RabattBerechnen:
End If
Dim sqlStringOffertMehrfach = "select COUNT(*) as Anzahl ,OffertenNr, KundenNr LeistungsNr from Offertenpositionen where LeistungsNr = 441 and OffertenNr = " & OffertenNr & " and KundenNr in (" & AdressenNr & ") group by KundenNr, LeistungsNr, OffertenNr having COUNT(*) > 1"
If AdressenNr <> "" Then
Dim dtOfferten As DataTable = SQL.loadDgvBySql(sqlStringOffertMehrfach, "FMZOLL")
If dtOfferten.Rows.Count > 0 Then
MsgBox("Es sind bei " & dtOfferten.Rows.Count & " Kunden das Offert 441 mehrfach hinterlegt, das muss korrigiert werden, ansonten kann die Fixe Taxe nicht berechnet werden!")
MsgBox("Es sind bei " & dtOfferten.Rows.Count & " Kunden das Offert 441 mehrfach hinterlegt, das muss korrigiert werden, ansonsten kann die Fixe Taxe nicht berechnet werden!")
cProgramFunctions.genExcelCSVFromDT(dtOfferten, True)
Return False
End If
Dim sqlStringFehlendeOffertenNr = "select KundenNr, OffertenNr from Offertenpositionen where OffertenNr = " & OffertenNr & " and KundenNr in (" & AdressenNr & ")
GROUP by KundenNr, OffertenNr
EXCEPT
@@ -5218,11 +5409,11 @@ RabattBerechnen:
Dim dtfehlendeOfferten As DataTable = SQL.loadDgvBySql(sqlStringFehlendeOffertenNr, "FMZOLL")
If dtfehlendeOfferten.Rows.Count > 0 Then
MsgBox("Es fehlen bei " & dtfehlendeOfferten.Rows.Count & " Kunden das Offert 441, bitte hinterlegen ansonten wird die Fixe Taxe nicht gesetzt!")
MsgBox("Es fehlen bei " & dtfehlendeOfferten.Rows.Count & " Kunden das Offert 441, bitte hinterlegen ansonsten wird die Fixe Taxe nicht gesetzt!")
cProgramFunctions.genExcelCSVFromDT(dtfehlendeOfferten, True)
Return True
End If
End If
End Function

View File

@@ -663,7 +663,7 @@ Public Class cMSEAPI
batchNr = json.StringOf("batch_seq_nr")
totalPages = json.IntOf("total_pages")
currentPage = json.IntOf("page_nr")
Dim apiPage = json.IntOf("page_nr")
Dim transactions As New Chilkat.JsonArray
@@ -674,12 +674,11 @@ Public Class cMSEAPI
Dim num As Integer = transactions.Size
If num < 1 Then
Return "FEHLER Array Transaktions ist leer"
If num > 0 Then
If json.StringOf("receiver") = "10738" Then
saveTransactions(num, dt, transactions, json.StringOf("receiver"), savedTrans)
End If
End If
If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver"), savedTrans)
Catch ex As WebException
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)

View File

@@ -663,9 +663,9 @@ BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, [Control], New Object(
Catch ex As Exception
Try
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("MAIL ERROR - VOR SENDEN" & ex.Message, "TO: " & eMailTo & vbNewLine & "SUBJ: " & betreff & vbNewLine & "TXT: " & text, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL,,,,, furtherMailAdress)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("MAIL ERROR - VOR SENDEN" & ex.Message, "FROM: " & eMailfrom & vbNewLine & "TO: " & eMailTo & vbNewLine & "SUBJ: " & betreff & vbNewLine & "TXT: " & text, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL,,,,, furtherMailAdress)
Catch ex2 As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("MAIL ERROR - VOR SENDEN LOG! " & ex2.Message, "TO: " & eMailTo & vbNewLine & "SUBJ: " & betreff & vbNewLine & "TXT: " & text, ex2.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.LOG)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("MAIL ERROR - VOR SENDEN LOG! " & ex2.Message, "FROM: " & eMailfrom & vbNewLine & "TO: " & eMailTo & vbNewLine & "SUBJ: " & betreff & vbNewLine & "TXT: " & text, ex2.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.LOG)
End Try
End Try