ustva, kundeblatt

This commit is contained in:
2025-08-28 10:07:43 +02:00
parent 4e000b0bdd
commit 98fd7c20e8
5 changed files with 168 additions and 124 deletions

View File

@@ -2175,15 +2175,16 @@ Public Class frmMDM_USTVAntrag
Private Function excelAuswertung(ByRef Optional filepath As String = "", Optional feedback As Boolean = False, Optional openExcel As Boolean = True) As Boolean
Dim sqlStr = "Select [UStVPo_ReDat] As InvoiceDate , [UStVPo_ReNr] As InvoiceNumber, antr.UStVAn_Name As Company, 'FR' as CountryOfRefund ,'EUR' as Currency ,replace([UStVPo_Leistender],'FR','') as SupplierName, leist.[UstV_Leistender_Strasse] AS SupplierStreet, leist.[UstV_Leistender_StrasseNr] as SupplierStreetNumber, leist.[UstV_Leistender_PLZ] as SupplierPostalCode, leist.[UstV_Leistender_Stadt] as SupplierCity, leist.[UstV_Leistender_Land] as SupplierCountry, leist.[UstV_Leistender_UstNr] as SupplierVAT_TaxNumber, [UStVPo_Leistungsbezeichnung] as ExpenseCategory ,Round((1119/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseGrossAmount, [UStVPo_USteuerbetragEUR] as ExpenseVATAmount,Round((100/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseNetAmount
Dim sqlStr = "Select [UStVPo_ReDat] As InvoiceDate , [UStVPo_ReNr] As InvoiceNumber, antr.UStVAn_Name As Company, LandKz as CountryOfRefund ,'EUR' as Currency ,replace([UStVPo_Leistender],'FR','') as SupplierName, leist.[UstV_Leistender_Strasse] AS SupplierStreet, leist.[UstV_Leistender_StrasseNr] as SupplierStreetNumber, leist.[UstV_Leistender_PLZ] as SupplierPostalCode, leist.[UstV_Leistender_Stadt] as SupplierCity, leist.[UstV_Leistender_Land] as SupplierCountry, leist.[UstV_Leistender_UstNr] as SupplierVAT_TaxNumber, [UStVPo_Leistungsbezeichnung] as ExpenseCategory ,Round((1119/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseGrossAmount, [UStVPo_USteuerbetragEUR] as ExpenseVATAmount,Round((100/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseNetAmount
From [tblUStVPositionen]
inner Join [tblUStVLeistender] as leist on leist.UStV_Leistender = [tblUStVPositionen].[UStVPo_Leistender]
inner Join [tblUStVAntrag] as antr on antr.UStVAn_ID = [tblUStVPositionen].UStVAn_ID
inner join [Länderverzeichnis für die Außenhandelsstatistik] on UStVAn_LandNr=Landnr
Where [tblUStVPositionen].UStVAn_ID ='" & UStVAn_ID & "' ORDER BY UStVPo_ID"
Dim dt = SQL.loadDgvBySql(sqlStr, "FMZOLL")
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
filepath = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt, {"N1:N" & (dt.Rows.Count + 1), "O1:O" & (dt.Rows.Count + 1), "P1:P" & (dt.Rows.Count + 1)},,,, openExcel)
filepath = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt, {"N1:N" & (dt.Rows.Count + 1), "O1:O" & (dt.Rows.Count + 1), "P1:P" & (dt.Rows.Count + 1)},,,, openExcel,,, True)
Return True
Else
If feedback Then MsgBox("keine Daten vorhanden!")
@@ -2209,7 +2210,7 @@ Public Class frmMDM_USTVAntrag
Dim subject As String = ""
subject &= IIf(USTV_ANTRAG.UStVAn_Name <> "", USTV_ANTRAG.UStVAn_Name & "_", "")
subject &= IIf(USTV_ANTRAG.UStVAn_LandKz <> "", USTV_ANTRAG.UStVAn_LandKz & "_", "")
subject &= IIf(Antrag_LandKz <> "", Antrag_LandKz & "_", "")
subject &= IIf(USTV_ANTRAG.UStVAn_ReDatVon IsNot Nothing AndAlso USTV_ANTRAG.UStVAn_ReDatBis IsNot Nothing, CDate(USTV_ANTRAG.UStVAn_ReDatVon).ToShortDateString & "-" & CDate(USTV_ANTRAG.UStVAn_ReDatBis).ToShortDateString, "")
Mail.Subject = subject
@@ -3628,7 +3629,9 @@ Public Class frmMDM_USTVAntrag
'If spedBuch.VermittlerOffertenNr <> spedBuch.Abfertigungsart Then
If spedBuch.VermittlerOffertenNr <> (CInt(spedBuch.Abfertigungsart) - 100) Then
'31 und 14 ist in Ordnung (weil Sonderfall).
Dim AbfArt As Integer = (CInt(spedBuch.Abfertigungsart) - 100)
If spedBuch.VermittlerOffertenNr <> AbfArt AndAlso Not (spedBuch.VermittlerOffertenNr = 31 AndAlso AbfArt = 14) Then
Fehlertext = "Speditionsbucheintrag prüfen!" & vbNewLine & "OffertenNr stimmen nicht überein!"
Return False
End If

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 DataGridViewCellStyle2 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)
@@ -71,6 +71,7 @@ Partial Class usrCntlUSTV
Me.btnUSTVAloeschen = New System.Windows.Forms.Button()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.btnVorschau = New System.Windows.Forms.Button()
Me.btnMail = New System.Windows.Forms.Button()
@@ -80,7 +81,7 @@ Partial Class usrCntlUSTV
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuStrip3 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.Button3 = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
CType(Me.dgvUSTV, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
Me.Panel2.SuspendLayout()
@@ -102,8 +103,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
DataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
Me.dgvUSTV.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle2
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)
@@ -769,6 +770,7 @@ Partial Class usrCntlUSTV
'Panel3
'
Me.Panel3.AutoSize = True
Me.Panel3.Controls.Add(Me.Button4)
Me.Panel3.Controls.Add(Me.Button3)
Me.Panel3.Controls.Add(Me.Button2)
Me.Panel3.Controls.Add(Me.btnVorschau)
@@ -785,6 +787,19 @@ Partial Class usrCntlUSTV
Me.Panel3.Size = New System.Drawing.Size(1627, 77)
Me.Panel3.TabIndex = 0
'
'Button3
'
Me.Button3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button3.ForeColor = System.Drawing.Color.Black
Me.Button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button3.Location = New System.Drawing.Point(982, 5)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(104, 39)
Me.Button3.TabIndex = 28
Me.Button3.Text = "Vorauszahlungen"
Me.Button3.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -831,7 +846,7 @@ Partial Class usrCntlUSTV
Me.btnPLOSEAlle.ForeColor = System.Drawing.Color.Black
Me.btnPLOSEAlle.Image = CType(resources.GetObject("btnPLOSEAlle.Image"), System.Drawing.Image)
Me.btnPLOSEAlle.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnPLOSEAlle.Location = New System.Drawing.Point(367, 8)
Me.btnPLOSEAlle.Location = New System.Drawing.Point(516, 7)
Me.btnPLOSEAlle.Name = "btnPLOSEAlle"
Me.btnPLOSEAlle.Size = New System.Drawing.Size(132, 40)
Me.btnPLOSEAlle.TabIndex = 24
@@ -882,18 +897,20 @@ Partial Class usrCntlUSTV
Me.ContextMenuStrip3.Name = "ContextMenuStrip1"
Me.ContextMenuStrip3.Size = New System.Drawing.Size(61, 4)
'
'Button3
'Button4
'
Me.Button3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button3.ForeColor = System.Drawing.Color.Black
Me.Button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button3.Location = New System.Drawing.Point(982, 5)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(104, 39)
Me.Button3.TabIndex = 28
Me.Button3.Text = "Vorauszahlungen"
Me.Button3.UseVisualStyleBackColor = True
Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button4.Image = Global.SDL.My.Resources.Resources.statistik_small
Me.Button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button4.Location = New System.Drawing.Point(367, 7)
Me.Button4.Margin = New System.Windows.Forms.Padding(0)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(128, 41)
Me.Button4.TabIndex = 29
Me.Button4.Text = "Nicht Eingereichte Anträge"
Me.Button4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button4.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
Me.Button4.UseVisualStyleBackColor = True
'
'usrCntlUSTV
'
@@ -969,4 +986,5 @@ Partial Class usrCntlUSTV
Friend WithEvents Label12 As Label
Friend WithEvents lblID As Label
Friend WithEvents Button3 As Button
Friend WithEvents Button4 As Button
End Class

View File

@@ -769,7 +769,7 @@
XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS
fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+
tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/
6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALEAAACxABrSO9dQAAB4JJREFUSEu9lntM1FcW
6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDwAACw8BkvkDpQAAB4JJREFUSEu9lntM1FcW
x0+yNWpdBURGEJ0ZXtVqZX0hFJAB5gVILVbQTRCQ1wwDw7wYGMSCgiI+IoivtbpBwOLqqnUXq30YlVrX
bXAFu6Ua2ShG0jVoq1ZFwQffzb3zhG22/+0vOZnf3Nz8Pjn3nPs9X1qx10yqpnWU27iOEuo0pG6qpMKP
qyljXxkpt6hozdF6qvxkN2XuW0OymiwqO1I33tBUPTNhsypTUpVuydhTOi5jTynNL08mQUEkiQwyEhql

View File

@@ -382,7 +382,7 @@ Public Class usrCntlUSTV
If Not col.ColumnName.Contains(colName) Then col.ColumnName = col.ColumnName.Replace("UStVAn_", "")
Next
cProgramFunctions.genExcelFromDT_NEW(dtNew, {"J1:N" & (dtNew.Rows.Count + 1)},,,,, True)
cProgramFunctions.genExcelFromDT_NEW(dtNew, {"K1:K" & (dtNew.Rows.Count + 1), "O1:T" & (dtNew.Rows.Count + 1)},,,,, True)
End If
@@ -407,7 +407,7 @@ Public Class usrCntlUSTV
Dim dt = SQL.loadDgvBySql(sqlStr, "FMZOLL")
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
cProgramFunctions.genExcelFromDT_NEW(dt, {"J1:N" & (dt.Rows.Count + 1)},,,,, True)
cProgramFunctions.genExcelFromDT_NEW(dt, {"J1:M" & (dt.Rows.Count + 1)},,,,, True)
Else
MsgBox("Keine Daten!")
End If
@@ -696,17 +696,18 @@ Public Class usrCntlUSTV
Private Function excelAuswertung(Optional ByRef filepath As String = "", Optional feedback As Boolean = False, Optional openExcel As Boolean = True) As Boolean
Dim sqlStr = "SELECT [UStVPo_ReDat] as InvoiceDate , [UStVPo_ReNr] As InvoiceNumber, antr.UStVAn_Name as Company, 'FR' as CountryOfRefund ,'EUR' as Currency ,[UStVPo_Leistender] as SupplierName, leist.[UstV_Leistender_Strasse] AS SupplierStreet, leist.[UstV_Leistender_StrasseNr] as SupplierStreetNumber, leist.[UstV_Leistender_PLZ] as SupplierPostalCode, leist.[UstV_Leistender_Stadt] as SupplierCity, leist.[UstV_Leistender_Land] as SupplierCountry, leist.[UstV_Leistender_UstNr] as SupplierVAT_TaxNumber, [UStVPo_Leistungsbezeichnung] as ExpenseCategory ,Round((1119/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseGrossAmount, [UStVPo_USteuerbetragEUR] as ExpenseVATAmount,Round((100/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseNetAmount
Dim sqlStr = "SELECT [UStVPo_ReDat] as InvoiceDate , [UStVPo_ReNr] As InvoiceNumber, antr.UStVAn_Name as Company, LandKz as CountryOfRefund ,'EUR' as Currency ,[UStVPo_Leistender] as SupplierName, leist.[UstV_Leistender_Strasse] AS SupplierStreet, leist.[UstV_Leistender_StrasseNr] as SupplierStreetNumber, leist.[UstV_Leistender_PLZ] as SupplierPostalCode, leist.[UstV_Leistender_Stadt] as SupplierCity, leist.[UstV_Leistender_Land] as SupplierCountry, leist.[UstV_Leistender_UstNr] as SupplierVAT_TaxNumber, [UStVPo_Leistungsbezeichnung] as ExpenseCategory ,Round((1119/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseGrossAmount, [UStVPo_USteuerbetragEUR] as ExpenseVATAmount,Round((100/19*[UStVPo_USteuerbetragEUR]),2) as ExpenseNetAmount
FROM [tblUStVPositionen]
inner Join [tblUStVLeistender] as leist on leist.UStV_Leistender = [tblUStVPositionen].[UStVPo_Leistender]
inner join [tblUStVAntrag] as antr on antr.UStVAn_ID = [tblUStVPositionen].UStVAn_ID
inner join [Länderverzeichnis für die Außenhandelsstatistik] on UStVAn_LandNr=Landnr
where [tblUStVPositionen].UStVAn_ID ='" & dgvUSTV.SelectedRows(0).Cells("UStVAn_ID").Value & "' ORDER BY UStVPo_ID"
Dim dt = SQL.loadDgvBySql(sqlStr, "FMZOLL")
'filepath = ""
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
filepath = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt, {"N1:N" & (dt.Rows.Count + 1), "O1:O" & (dt.Rows.Count + 1), "P1:P" & (dt.Rows.Count + 1)},,,, openExcel)
filepath = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt, {"N1:N" & (dt.Rows.Count + 1), "O1:O" & (dt.Rows.Count + 1), "P1:P" & (dt.Rows.Count + 1)},,,, openExcel,,, True)
Return True
Else
MsgBox("Keine Daten!")
@@ -724,7 +725,7 @@ Public Class usrCntlUSTV
Dim subject As String = ""
subject &= IIf(dgvUSTV.CurrentRow.Cells("UStVAn_Name").Value <> "", dgvUSTV.CurrentRow.Cells("UStVAn_Name").Value & "_", "")
'subject &= If(dgvUSTV.CurrentRow.Cells("UStVAn_LandKz").Value <> "", dgvUSTV.CurrentRow.Cells("UStVAn_LandKz").Value & "_")
subject &= IIf(dgvUSTV.CurrentRow.Cells("Land_Antrag").Value <> "", dgvUSTV.CurrentRow.Cells("Land_Antrag").Value & "_", "")
If (dgvUSTV.CurrentRow.Cells("UStVAn_ReDatVon").Value IsNot Nothing AndAlso dgvUSTV.CurrentRow.Cells("UStVAn_ReDatBis").Value IsNot Nothing) Then
subject &= CDate(dgvUSTV.CurrentRow.Cells("UStVAn_ReDatVon").Value).ToShortDateString & "-" & CDate(dgvUSTV.CurrentRow.Cells("UStVAn_ReDatBis").Value).ToShortDateString
End If
@@ -1472,4 +1473,26 @@ Public Class usrCntlUSTV
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim sqlStr = "SELECT [UStVAn_ID] as ID,[UStVAn_KuNr] as KundenNr,[UStVAn_Name] as Kundename,Adressen.LandKz as Land_Kunde, case when UstIdKz is not null and UstIdNr is not null THEN UstIdKz +'' + UstIdNr ELSE isnull(Steuernummer,'') END as SteuerUIDNr, LfdA .LandKz Land_Antrag,cast([UStVAn_ReDatVon] as Date) as ReDatVon,cast([UStVAn_ReDatBis] as Date) as ReDatBis , cast(UStVAn_AntragEingereichtAm as Date) as EingereichtAm,[UStVAn_3470] as An3470 ,[UStVAn_Währungscode] as Währung,[UStVAn_USteuerbetrag] as Steuerbetrag,[UStVAn_Erstattungsbetrag] as Erstattungsbetrag,[UStVAn_USteuerbetragEUR] as SteuerbetragEUR,[UStVAn_ErstattungsbetragEUR] as ErstattungsbetragEUR,(cast([UStVAn_USteuerbetragEUR] as decimal(17,2)) - cast( [UStVAn_ErstattungsbetragEUR] as decimal(17,2))) as DifferenzbetragEUR, UStVAn_VZBetrag as Vorauszahlungsbetrag, [UStVAn_Sachbearbeiter] as Sachbearbeiter, UStVAn_AntragArt as Art, stnr.[StNrFürRückerstattungUSt] as SteuerNr
FROM [tblUStVAntrag]
inner join [Länderverzeichnis für die Außenhandelsstatistik] as LfdA on UStVAn_LandNr=Landnr
inner join Adressen on AdressenNr=UStVAn_KuNr
left join [tblSteuernummern] as stnr on stnr.AdressenNr = UStVAn_KuNr and stnr.LandNr=UStVAn_LandNr
where 1=1 AND UStVAn_AntragEingereichtAm is null
order by UStVAn_KuNr,UStVAn_Name,datepart(year,[UStVAn_ReDatVon] ) desc,LfdA .LandKz,[UStVAn_ReDatVon] desc"
Dim dt = SQL.loadDgvBySql(sqlStr, "FMZOLL")
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
cProgramFunctions.genExcelFromDT_NEW(dt, {"J1:M" & (dt.Rows.Count + 1)},,,,, True)
Else
MsgBox("Keine Daten!")
End If
End Sub
End Class