BU_Mahnlauf, ustva

This commit is contained in:
2025-04-04 11:49:54 +02:00
parent 30ac9b018b
commit 3d39da0357
5 changed files with 171 additions and 76 deletions

View File

@@ -27,6 +27,7 @@ Partial Class frmMDM_USTVAntrag
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMDM_USTVAntrag))
Me.pnlBottom = New System.Windows.Forms.Panel()
Me.picExcel = New System.Windows.Forms.PictureBox()
Me.Button4 = New System.Windows.Forms.Button()
Me.picPDF = New System.Windows.Forms.PictureBox()
Me.btnMail = New System.Windows.Forms.Button()
@@ -113,8 +114,10 @@ Partial Class frmMDM_USTVAntrag
Me.Button3 = New System.Windows.Forms.Button()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.picExcel = New System.Windows.Forms.PictureBox()
Me.txtSumme = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Label27 = New System.Windows.Forms.Label()
Me.pnlBottom.SuspendLayout()
CType(Me.picExcel, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.picPDF, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnlHeader.SuspendLayout()
Me.Panel9.SuspendLayout()
@@ -134,13 +137,14 @@ Partial Class frmMDM_USTVAntrag
CType(Me.dgvErstattungspositionen, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnlErstattungsdetails.SuspendLayout()
Me.Panel1.SuspendLayout()
CType(Me.picExcel, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'pnlBottom
'
Me.pnlBottom.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.pnlBottom.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnlBottom.Controls.Add(Me.txtSumme)
Me.pnlBottom.Controls.Add(Me.Label27)
Me.pnlBottom.Controls.Add(Me.picExcel)
Me.pnlBottom.Controls.Add(Me.Button4)
Me.pnlBottom.Controls.Add(Me.picPDF)
@@ -155,6 +159,16 @@ Partial Class frmMDM_USTVAntrag
Me.pnlBottom.Size = New System.Drawing.Size(1454, 100)
Me.pnlBottom.TabIndex = 3
'
'picExcel
'
Me.picExcel.Image = Global.SDL.My.Resources.Resources.Excel_logo
Me.picExcel.Location = New System.Drawing.Point(1026, 13)
Me.picExcel.Name = "picExcel"
Me.picExcel.Size = New System.Drawing.Size(35, 35)
Me.picExcel.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.picExcel.TabIndex = 29
Me.picExcel.TabStop = False
'
'Button4
'
Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat
@@ -170,7 +184,7 @@ Partial Class frmMDM_USTVAntrag
'picPDF
'
Me.picPDF.Image = Global.SDL.My.Resources.Resources.pdf
Me.picPDF.Location = New System.Drawing.Point(1067, 39)
Me.picPDF.Location = New System.Drawing.Point(1079, 13)
Me.picPDF.Name = "picPDF"
Me.picPDF.Size = New System.Drawing.Size(35, 35)
Me.picPDF.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
@@ -1416,15 +1430,40 @@ Partial Class frmMDM_USTVAntrag
Me.ContextMenuStrip2.Name = "ContextMenuStrip1"
Me.ContextMenuStrip2.Size = New System.Drawing.Size(61, 4)
'
'picExcel
'txtSumme
'
Me.picExcel.Image = Global.SDL.My.Resources.Resources.Excel_logo
Me.picExcel.Location = New System.Drawing.Point(1014, 39)
Me.picExcel.Name = "picExcel"
Me.picExcel.Size = New System.Drawing.Size(35, 35)
Me.picExcel.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.picExcel.TabIndex = 29
Me.picExcel.TabStop = False
Me.txtSumme._DateTimeOnly = False
Me.txtSumme._numbersOnly = False
Me.txtSumme._numbersOnlyKommastellen = ""
Me.txtSumme._numbersOnlyTrennzeichen = False
Me.txtSumme._Prozent = False
Me.txtSumme._ShortDateNew = False
Me.txtSumme._ShortDateOnly = False
Me.txtSumme._TimeOnly = False
Me.txtSumme._TimeOnly_Seconds = False
Me.txtSumme._value = ""
Me.txtSumme._Waehrung = True
Me.txtSumme._WaehrungZeichen = True
Me.txtSumme.ForeColor = System.Drawing.Color.Black
Me.txtSumme.Location = New System.Drawing.Point(1026, 63)
Me.txtSumme.MaxLineLength = -1
Me.txtSumme.MaxLines_Warning = ""
Me.txtSumme.MaxLines_Warning_Label = Nothing
Me.txtSumme.Name = "txtSumme"
Me.txtSumme.ReadOnly = True
Me.txtSumme.Size = New System.Drawing.Size(88, 20)
Me.txtSumme.TabIndex = 49
Me.txtSumme.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'Label27
'
Me.Label27.AutoSize = True
Me.Label27.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label27.Location = New System.Drawing.Point(975, 66)
Me.Label27.Name = "Label27"
Me.Label27.Size = New System.Drawing.Size(45, 13)
Me.Label27.TabIndex = 48
Me.Label27.Text = "Summe:"
'
'frmMDM_USTVAntrag
'
@@ -1441,6 +1480,7 @@ Partial Class frmMDM_USTVAntrag
Me.Text = "USTV Antrag"
Me.pnlBottom.ResumeLayout(False)
Me.pnlBottom.PerformLayout()
CType(Me.picExcel, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.picPDF, System.ComponentModel.ISupportInitialize).EndInit()
Me.pnlHeader.ResumeLayout(False)
Me.pnlHeader.PerformLayout()
@@ -1465,7 +1505,6 @@ Partial Class frmMDM_USTVAntrag
CType(Me.dgvErstattungspositionen, System.ComponentModel.ISupportInitialize).EndInit()
Me.pnlErstattungsdetails.ResumeLayout(False)
Me.Panel1.ResumeLayout(False)
CType(Me.picExcel, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
@@ -1558,4 +1597,6 @@ Partial Class frmMDM_USTVAntrag
Friend WithEvents Label14 As Label
Friend WithEvents txtEingereichtAm As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents picExcel As PictureBox
Friend WithEvents txtSumme As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents Label27 As Label
End Class

View File

@@ -1283,8 +1283,11 @@ Public Class frmMDM_USTVAntrag
If dgvUSTVPositionen.SelectedRows.Count > 0 Then
initPosition(dgvUSTVPositionen.SelectedRows(0).Cells("UStVPo_ID").Value)
calcSumme()
End If
End Sub
Private Sub dgvErstattungspositionen_SelectionChanged(sender As Object, e As EventArgs) Handles dgvErstattungspositionen.SelectionChanged
@@ -2141,6 +2144,7 @@ Public Class frmMDM_USTVAntrag
ElseIf TabControl1.SelectedTab Is TabPage2 Then
initdgvErstattungen()
posTabisSelected = False
txtSumme._value = 0
End If
@@ -2311,7 +2315,7 @@ Public Class frmMDM_USTVAntrag
Next
cProgramFunctions.genExcelFromDT_NEW(dtNew, {"K1:K" & (dtNew.Rows.Count + 1)},, "Statement itemising VAT amounts relating to the period covered by this application", "VAT NO.: " & USTV_ANTRAG.UStVAn_Steuernummer & " " & "Name/Company: " & USTV_ANTRAG.UStVAn_Name & " " & "VAT in " & Antrag_LandKz & ": " & txtStNr.Text, IIf(USTV_ANTRAG.UStVAn_Währungscode = "EUR", "", ""), True, "E")
cProgramFunctions.genExcelFromDT_NEW(dtNew, {"K1:K" & (dtNew.Rows.Count + 1)},, "Statement itemising VAT amounts relating to the period covered by this application", "VAT NO.: " & USTV_ANTRAG.UStVAn_Steuernummer & " " & "Name/Company: " & USTV_ANTRAG.UStVAn_Name & " " & "VAT in " & Antrag_LandKz & ": " & txtStNr.Text, IIf(USTV_ANTRAG.UStVAn_Währungscode = "EUR", "", ""), True, "E", True, True)
End If
@@ -2388,6 +2392,23 @@ Public Class frmMDM_USTVAntrag
End Sub
Private Sub calcSumme()
Dim countSumme As Double = 0
If posTabisSelected Then
For i As Integer = 0 To dgvUSTVPositionen.SelectedRows.Count - 1
countSumme += CDbl(dgvUSTVPositionen.SelectedRows(i).Cells("UStVPo_USteuerbetragEUR").Value)
Next
End If
txtSumme._value = countSumme.ToString
End Sub
End Class

View File

@@ -25,6 +25,7 @@ Partial Class frmBU_Mahnlauf
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmBU_Mahnlauf))
Me.Panel1 = New System.Windows.Forms.Panel()
Me.cbxZahlungseingaenge = New System.Windows.Forms.CheckBox()
Me.cbxNurFaellig = New System.Windows.Forms.CheckBox()
Me.MyComboBox1 = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label7 = New System.Windows.Forms.Label()
@@ -55,7 +56,6 @@ Partial Class frmBU_Mahnlauf
Me.Button2 = New System.Windows.Forms.Button()
Me.Button1 = New System.Windows.Forms.Button()
Me.MyTextBox2 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.cbxZahlungseingaenge = New System.Windows.Forms.CheckBox()
Me.Panel1.SuspendLayout()
Me.pnlTop.SuspendLayout()
Me.Panel2.SuspendLayout()
@@ -83,6 +83,17 @@ Partial Class frmBU_Mahnlauf
Me.Panel1.Size = New System.Drawing.Size(1287, 127)
Me.Panel1.TabIndex = 0
'
'cbxZahlungseingaenge
'
Me.cbxZahlungseingaenge.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.cbxZahlungseingaenge.AutoSize = True
Me.cbxZahlungseingaenge.Location = New System.Drawing.Point(568, 87)
Me.cbxZahlungseingaenge.Name = "cbxZahlungseingaenge"
Me.cbxZahlungseingaenge.Size = New System.Drawing.Size(114, 17)
Me.cbxZahlungseingaenge.TabIndex = 39
Me.cbxZahlungseingaenge.Text = "Zahlungseingänge"
Me.cbxZahlungseingaenge.UseVisualStyleBackColor = True
'
'cbxNurFaellig
'
Me.cbxNurFaellig.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -490,17 +501,6 @@ Partial Class frmBU_Mahnlauf
Me.MyTextBox2.TabIndex = 39
Me.MyTextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'cbxZahlungseingaenge
'
Me.cbxZahlungseingaenge.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.cbxZahlungseingaenge.AutoSize = True
Me.cbxZahlungseingaenge.Location = New System.Drawing.Point(568, 87)
Me.cbxZahlungseingaenge.Name = "cbxZahlungseingaenge"
Me.cbxZahlungseingaenge.Size = New System.Drawing.Size(114, 17)
Me.cbxZahlungseingaenge.TabIndex = 39
Me.cbxZahlungseingaenge.Text = "Zahlungseingänge"
Me.cbxZahlungseingaenge.UseVisualStyleBackColor = True
'
'frmBU_Mahnlauf
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

View File

@@ -71,29 +71,13 @@ Public Class frmBU_Mahnlauf
Dim sqlStringVerag360Zahlungseingaenge = "SELECT i_personenkonto Konto,KTO.c_name, KTO.c_landid Land,/*KTO.c_plz + ' ' + KTO.c_ort Ort,isnull(KTO.c_email,'') Email, */ " &
"isnull(( SELECT TOP 1 [Zahlungsinformationen] FROM [FMZOLL\SQLFMZOLL].[VERAG].[dbo].Kunden where KundenNr=i_personenkonto ) ,'') Zahlungsinfo, cast(min (OWNFIELD_Belegdatum)as date) as 'ältesteRg'," &
"count(*) Anzahl, sum(eur_bruttobetrag+eur_zahlung) Ausstand ,min(op.d_netto) Faelligkeit,max(si_mahnstufe) Mahnstufe, cast(MAX(d_mahnung)as date) Mahndatum, max(replace(KTO.c_zahlziel,'0/0/','')) ZZ,
case
when max(si_mahnstufe) = 1 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 20 Then 'telefonisch'
when max(si_mahnstufe) = 1 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 30 Then 'ZZ 30 Tage'
when max(si_mahnstufe) = 1 and cast(MAX(d_mahnung)as date) < (GETDATE()- 60) Then 'Sperre Donnerstag'
when max(si_mahnstufe) = 2 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 20 Then 'Sperre Freitag'
when max(si_mahnstufe) = 2 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 30 Then 'ZZ 30 Tage'
when max(si_mahnstufe) >= 3 Then 'Sperre Donnerstag'
else '-'
End as sperre" & If(cbxNurFaellig.Checked, "", ",SUM(CASE WHEN op.d_netto<getDATE() THEN (eur_bruttobetrag+eur_zahlung) ELSE 0 END) Summe_Faellig") & "
FROM op_debitor OP
RIGHT join fibu_konto KTO on i_personenkonto=i_konto AND KTO.i_firm_refid=OP.i_firm_refid
WHERE (OP.i_firm_refid = '" & Firma_ID & "') AND (dt_geloescht IS NULL)
" & If(cbxNurFaellig.Checked, " and op.d_netto<=getdate() and isnull(si_mahnflags,0) <>(1) ", "") & "
" & If(KdNr > 0, " AND i_personenkonto ='" & KdNr & "'", "") & "
" & If(KdTxt <> "", " AND KTO.c_name LIKE '" & KdTxt.Replace("*", "%") & "'", "") & "
group by i_personenkonto ,KTO.c_name,KTO.c_landid,KTO.c_ort,KTO.c_plz,KTO.c_email
HAVING sum(eur_bruttobetrag+eur_zahlung)>'" & MyTextBox1._value & "'
" & If(MyComboBox1._value > 0, " and max(si_mahnstufe)>='" & MyComboBox1._value & "'", "") & "
ORDER BY KTO.c_name"
Dim sqlStringVerag360Zahlungseingaenge = " SELECT cast(d_beleg as Date) as d_beleg ,c_urbelegid, c_buchtext, case when c_sollhabenkz = 'H' then eur_betrag else eur_betrag * -1 end as eur_betrag , BU.i_konto,KTO.c_landid
FROM [FIBU2].[dbo].[fibu_belegzeile] as BU
RIGHT join fibu_konto KTO on KTO.i_konto=BU.i_konto AND BU.i_firm_refid=KTO.i_firm_refid
where cast(d_beleg as date) = '03.04.2025' and BU.i_firm_refid=" & Firma_ID & " and (c_kennung = 'KE' or BU.i_konto in (5827, 5829) or LEFT(BU.i_konto,1) = 0 or c_kennung = 'DE')
and (BU.i_konto in (2800, 2801, 2802, 2803, 2811, 2812, 2813, 2814, 2817, 2818, 2822 ,2826, 2827, 2828, 2831, 2832, 2833, 2837, 2845) or i_gegenkonto in (2800, 2801, 2802, 2803, 2811, 2812, 2813, 2814, 2817, 2818, 2822 ,2826, 2827, 2828, 2831, 2832, 2833, 2837, 2845))
order by i_beleg_refid, i_zeilen_refid"
'MsgBox(sqlStr)
@@ -102,40 +86,67 @@ Public Class frmBU_Mahnlauf
.DataSource = dt_OP
If .Columns.Count = 0 Then Exit Sub
.Columns("c_name").HeaderText = "Firma"
.Columns("c_name").AutoSizeMode = DataGridViewAutoSizeColumnsMode.Fill
If zahlungseingaenge And Firma_ID = 19 Then
.Columns("c_buchtext").HeaderText = "Buchungstext"
.Columns("c_buchtext").AutoSizeMode = DataGridViewAutoSizeColumnsMode.Fill
.Columns("d_beleg").Width = 75
.Columns("d_beleg").HeaderText = "Belegdatum"
.Columns("c_urbelegid").Width = 90
.Columns("c_urbelegid").HeaderText = "BelegNr."
.Columns("i_konto").Width = 75
.Columns("i_konto").HeaderText = "KdNr/Konto"
.Columns("eur_betrag").Width = 75
.Columns("eur_betrag").HeaderText = "Betrag"
.Columns("c_landid").Width = 75
.Columns("c_landid").HeaderText = "Land"
.Columns("Land").Width = 40
.Columns("Anzahl").Width = 40
If Firma_ID = 19 Then
.Columns("Zahlungsinfo").Width = 300
.Columns("ältesteRg").Width = 75
Else
.Columns("Email").Width = 150
.Columns("Ort").Width = 150
.Columns("c_name").HeaderText = "Firma"
.Columns("c_name").AutoSizeMode = DataGridViewAutoSizeColumnsMode.Fill
.Columns("Land").Width = 40
.Columns("Anzahl").Width = 40
If Firma_ID = 19 Then
.Columns("Zahlungsinfo").Width = 300
.Columns("ältesteRg").Width = 75
Else
.Columns("Email").Width = 150
.Columns("Ort").Width = 150
End If
.Columns("Faelligkeit").Width = 75
.Columns("Faelligkeit").HeaderText = "Fälligkeit"
.Columns("Mahndatum").Width = 75
.Columns("Konto").Width = 75
.Columns("Konto").HeaderText = "KdNr/Konto"
.Columns("Ausstand").Width = 75
.Columns("Ausstand").HeaderText = "Betrag"
If Not cbxNurFaellig.Checked Then
.Columns("Summe_Faellig").Width = 75
.Columns("Summe_Faellig").HeaderText = "Summe fällig"
End If
.Columns("Mahnstufe").Width = 50
End If
.Columns("Faelligkeit").Width = 75
.Columns("Faelligkeit").HeaderText = "Fälligkeit"
.Columns("Mahndatum").Width = 75
.Columns("Konto").Width = 75
.Columns("Konto").HeaderText = "KdNr/Konto"
.Columns("Ausstand").Width = 75
.Columns("Ausstand").HeaderText = "Betrag"
If Not cbxNurFaellig.Checked Then
.Columns("Summe_Faellig").Width = 75
.Columns("Summe_Faellig").HeaderText = "Summe fällig"
End If
.Columns("Mahnstufe").Width = 50
End With
End Sub
@@ -1278,4 +1289,13 @@ Public Class frmBU_Mahnlauf
Private Sub cbxZahlungseingaenge_CheckedChanged(sender As Object, e As EventArgs) Handles cbxZahlungseingaenge.CheckedChanged
'initDGV(cbxZahlungseingaenge.Checked)
End Sub
Private Sub cboFirma_SelectedValueChanged(sender As Object, e As EventArgs) Handles cboFirma.SelectedValueChanged
If cboFirma._value <> "" AndAlso cboFirma._value = 19 Then
cbxZahlungseingaenge.Visible = True
Else
cbxZahlungseingaenge.Visible = False
cbxZahlungseingaenge.Checked = False
End If
End Sub
End Class

View File

@@ -1124,7 +1124,7 @@ Public Class cProgramFunctions
Return ""
End Function
Public Shared Function genExcelFromDT_NEW(dt As DataTable, Optional rangeAsWaehrung() As String = Nothing, Optional ShowAutoFilter As Boolean = True, Optional HeaderTxt As String = "", Optional HeaderTxt2 As String = "", Optional waehrungsZeichen As String = "", Optional fitCellsToContent As Boolean = False, Optional mergeHeadersToCell As Char = "") As String
Public Shared Function genExcelFromDT_NEW(dt As DataTable, Optional rangeAsWaehrung() As String = Nothing, Optional ShowAutoFilter As Boolean = True, Optional HeaderTxt As String = "", Optional HeaderTxt2 As String = "", Optional waehrungsZeichen As String = "", Optional fitCellsToContent As Boolean = False, Optional mergeHeadersToCell As Char = "", Optional Landscape As Boolean = False, Optional fitToOnePage As Boolean = False) As String
Try
Dim sPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\VERAG\SDL\tmp\" ' My.Computer.FileSystem.GetTempFileName
@@ -1181,6 +1181,19 @@ Public Class cProgramFunctions
wb.Worksheets(0).Rows().AdjustToContents()
End If
If Landscape Then
wb.Worksheets(0).PageSetup.PageOrientation = XLPageOrientation.Landscape
Else
wb.Worksheets(0).PageSetup.PageOrientation = XLPageOrientation.Default
End If
If fitToOnePage Then
wb.Worksheets(0).PageSetup.PagesWide = 1 ' In die Breite auf eine Seite anpassen
wb.Worksheets(0).PageSetup.PagesTall = 1 ' In die Höhe auf eine Seite anpassen
End If
Dim filename As String = sPath & "tmp_" & Now.ToString("ddMMyyyyHHmmss") & ".xlsx"