CBAM bugfix, Fakt Summierung.

This commit is contained in:
2025-03-28 13:13:12 +01:00
parent 19dc242ce6
commit 6923d0dff7
3 changed files with 145 additions and 99 deletions

View File

@@ -428,9 +428,9 @@
,max([Rechnungsbetrag])Rechnungspreis
,max([Rechnungswährung]) Rechnungswaehrung
,isnull(max(Empfänger_CN_EORI),'') as EmpfängerEORI
,isnull(max(CZ_Name), '') as Empfänger
,isnull(max(CN_Name), '') as Empfänger
,isnull(max(Versender_CZ_EORI),'') as AbsenderEORI
,isnull(max(CN_Name), '') as Absender
,isnull(max(CZ_Name), '') as Absender
FROM [tbl_DY_Zollmeldungen_Import]
where

View File

@@ -33,15 +33,12 @@ Partial Class usrcntlFakturierung
Me.Label61 = New System.Windows.Forms.Label()
Me.GBMautberichte = New System.Windows.Forms.GroupBox()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.Label5 = New System.Windows.Forms.Label()
Me.lblAnzahlMautberichte = New System.Windows.Forms.Label()
Me.pbMautAnh_Proz = New System.Windows.Forms.ProgressBar()
Me.lblMautAnh_Proz = New System.Windows.Forms.Label()
Me.cbxDateMautbericht = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label69 = New System.Windows.Forms.Label()
Me.Label68 = New System.Windows.Forms.Label()
Me.cbxMautbericht = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label62 = New System.Windows.Forms.Label()
Me.Button18 = New System.Windows.Forms.Button()
Me.Label44 = New System.Windows.Forms.Label()
@@ -68,7 +65,6 @@ Partial Class usrcntlFakturierung
Me.cbxRechnungsjournaldrucken = New System.Windows.Forms.CheckBox()
Me.Button20 = New System.Windows.Forms.Button()
Me.Label72 = New System.Windows.Forms.Label()
Me.KdSearchBox3 = New VERAG_PROG_ALLGEMEIN.KdSearchBox()
Me.rbkunde = New System.Windows.Forms.RadioButton()
Me.rbAlleKunden = New System.Windows.Forms.RadioButton()
Me.txtPloseAnh_Einarbeitung = New System.Windows.Forms.TextBox()
@@ -77,7 +73,6 @@ Partial Class usrcntlFakturierung
Me.lblPloseAnh_Proz = New System.Windows.Forms.Label()
Me.Button19 = New System.Windows.Forms.Button()
Me.Label70 = New System.Windows.Forms.Label()
Me.cboSachbearbeiter = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Label67 = New System.Windows.Forms.Label()
Me.dtRechnungsdatum = New System.Windows.Forms.DateTimePicker()
Me.Label66 = New System.Windows.Forms.Label()
@@ -86,9 +81,13 @@ Partial Class usrcntlFakturierung
Me.Label63 = New System.Windows.Forms.Label()
Me.Label45 = New System.Windows.Forms.Label()
Me.Button14 = New System.Windows.Forms.Button()
Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.cbxDateMautbericht = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.cbxMautbericht = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.KdSearchBox3 = New VERAG_PROG_ALLGEMEIN.KdSearchBox()
Me.cboSachbearbeiter = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.GroupBox1.SuspendLayout()
Me.GBMautberichte.SuspendLayout()
CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GBSammelrechnung.SuspendLayout()
CType(Me.PictureBox8, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -98,6 +97,7 @@ Partial Class usrcntlFakturierung
CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
@@ -199,7 +199,7 @@ Partial Class usrcntlFakturierung
Me.GBMautberichte.Enabled = False
Me.GBMautberichte.Location = New System.Drawing.Point(10, 131)
Me.GBMautberichte.Name = "GBMautberichte"
Me.GBMautberichte.Size = New System.Drawing.Size(697, 195)
Me.GBMautberichte.Size = New System.Drawing.Size(697, 211)
Me.GBMautberichte.TabIndex = 16
Me.GBMautberichte.TabStop = False
'
@@ -212,16 +212,6 @@ Partial Class usrcntlFakturierung
Me.TextBox1.Size = New System.Drawing.Size(106, 13)
Me.TextBox1.TabIndex = 105
'
'MyDatagridview1
'
Me.MyDatagridview1.AKTUALISIERUNGS_INTERVALL = -1
Me.MyDatagridview1.BackgroundColor = System.Drawing.SystemColors.Window
Me.MyDatagridview1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.MyDatagridview1.Location = New System.Drawing.Point(4, 71)
Me.MyDatagridview1.Name = "MyDatagridview1"
Me.MyDatagridview1.Size = New System.Drawing.Size(471, 124)
Me.MyDatagridview1.TabIndex = 34
'
'Label5
'
Me.Label5.AutoSize = True
@@ -255,17 +245,6 @@ Partial Class usrcntlFakturierung
Me.lblMautAnh_Proz.Text = "0%"
Me.lblMautAnh_Proz.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'cbxDateMautbericht
'
Me.cbxDateMautbericht._allowedValuesFreiText = Nothing
Me.cbxDateMautbericht._allowFreiText = False
Me.cbxDateMautbericht._value = ""
Me.cbxDateMautbericht.FormattingEnabled = True
Me.cbxDateMautbericht.Location = New System.Drawing.Point(265, 12)
Me.cbxDateMautbericht.Name = "cbxDateMautbericht"
Me.cbxDateMautbericht.Size = New System.Drawing.Size(87, 21)
Me.cbxDateMautbericht.TabIndex = 32
'
'Label69
'
Me.Label69.AutoSize = True
@@ -283,18 +262,6 @@ Partial Class usrcntlFakturierung
Me.Label68.TabIndex = 30
Me.Label68.Text = "Generiert Mautberichte"
'
'cbxMautbericht
'
Me.cbxMautbericht._allowedValuesFreiText = Nothing
Me.cbxMautbericht._allowFreiText = False
Me.cbxMautbericht._value = ""
Me.cbxMautbericht.DropDownWidth = 200
Me.cbxMautbericht.FormattingEnabled = True
Me.cbxMautbericht.Location = New System.Drawing.Point(265, 33)
Me.cbxMautbericht.Name = "cbxMautbericht"
Me.cbxMautbericht.Size = New System.Drawing.Size(152, 21)
Me.cbxMautbericht.TabIndex = 30
'
'Label62
'
Me.Label62.AutoSize = True
@@ -320,7 +287,7 @@ Partial Class usrcntlFakturierung
Me.Label44.AutoSize = True
Me.Label44.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label44.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
Me.Label44.Location = New System.Drawing.Point(11, 340)
Me.Label44.Location = New System.Drawing.Point(11, 345)
Me.Label44.Name = "Label44"
Me.Label44.Size = New System.Drawing.Size(436, 17)
Me.Label44.TabIndex = 15
@@ -369,7 +336,7 @@ Partial Class usrcntlFakturierung
Me.GBSammelrechnung.Controls.Add(Me.Label45)
Me.GBSammelrechnung.Controls.Add(Me.Button14)
Me.GBSammelrechnung.Enabled = False
Me.GBSammelrechnung.Location = New System.Drawing.Point(10, 351)
Me.GBSammelrechnung.Location = New System.Drawing.Point(10, 356)
Me.GBSammelrechnung.Name = "GBSammelrechnung"
Me.GBSammelrechnung.Size = New System.Drawing.Size(697, 393)
Me.GBSammelrechnung.TabIndex = 14
@@ -611,34 +578,6 @@ Partial Class usrcntlFakturierung
Me.Label72.TabIndex = 42
Me.Label72.Text = "* hier wird eine RE-Nr erzeugt, die Rechnungen gelten dann als ""gedruckt"" und kön" &
"nen somit nicht mehr geändert werden."
'
'KdSearchBox3
'
Me.KdSearchBox3._AlleFirmenCLUSTER = False
Me.KdSearchBox3._AllowSetValue = True
Me.KdSearchBox3._autoSizeGross = False
Me.KdSearchBox3._display_Name1 = False
Me.KdSearchBox3._displayAVISO_Email = False
Me.KdSearchBox3._displayFullName = False
Me.KdSearchBox3._displayWoelflKd = False
Me.KdSearchBox3._hideIfListEmpty = True
Me.KdSearchBox3._loadKdData = False
Me.KdSearchBox3._searchName1 = True
Me.KdSearchBox3._UseFIRMA = ""
Me.KdSearchBox3._ValueKdAndName = True
Me.KdSearchBox3.dgvpos = "LEFT"
Me.KdSearchBox3.KdName = ""
Me.KdSearchBox3.KdNr = "-1"
Me.KdSearchBox3.kdNrField = Nothing
Me.KdSearchBox3.KdNrNullInt = Nothing
Me.KdSearchBox3.Location = New System.Drawing.Point(87, 308)
Me.KdSearchBox3.Name = "KdSearchBox3"
Me.KdSearchBox3.nurAktive = True
Me.KdSearchBox3.searchActive = True
Me.KdSearchBox3.Size = New System.Drawing.Size(350, 20)
Me.KdSearchBox3.TabIndex = 41
Me.KdSearchBox3.TIMER_SEARCH = True
Me.KdSearchBox3.usrcntl = Nothing
'
'rbkunde
'
@@ -715,17 +654,6 @@ Partial Class usrcntlFakturierung
Me.Label70.TabIndex = 30
Me.Label70.Text = "6. Hängt Mautgesamtbericht an Sammenrechnungen an."
'
'cboSachbearbeiter
'
Me.cboSachbearbeiter._allowedValuesFreiText = Nothing
Me.cboSachbearbeiter._allowFreiText = False
Me.cboSachbearbeiter._value = ""
Me.cboSachbearbeiter.FormattingEnabled = True
Me.cboSachbearbeiter.Location = New System.Drawing.Point(529, 38)
Me.cboSachbearbeiter.Name = "cboSachbearbeiter"
Me.cboSachbearbeiter.Size = New System.Drawing.Size(152, 21)
Me.cboSachbearbeiter.TabIndex = 29
'
'Label67
'
Me.Label67.AutoSize = True
@@ -796,6 +724,78 @@ Partial Class usrcntlFakturierung
Me.Button14.Text = "Rechnungspos. berechnen"
Me.Button14.UseVisualStyleBackColor = True
'
'MyDatagridview1
'
Me.MyDatagridview1.AKTUALISIERUNGS_INTERVALL = -1
Me.MyDatagridview1.BackgroundColor = System.Drawing.SystemColors.Window
Me.MyDatagridview1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.MyDatagridview1.Location = New System.Drawing.Point(4, 71)
Me.MyDatagridview1.Name = "MyDatagridview1"
Me.MyDatagridview1.Size = New System.Drawing.Size(471, 135)
Me.MyDatagridview1.TabIndex = 34
'
'cbxDateMautbericht
'
Me.cbxDateMautbericht._allowedValuesFreiText = Nothing
Me.cbxDateMautbericht._allowFreiText = False
Me.cbxDateMautbericht._value = ""
Me.cbxDateMautbericht.FormattingEnabled = True
Me.cbxDateMautbericht.Location = New System.Drawing.Point(265, 12)
Me.cbxDateMautbericht.Name = "cbxDateMautbericht"
Me.cbxDateMautbericht.Size = New System.Drawing.Size(87, 21)
Me.cbxDateMautbericht.TabIndex = 32
'
'cbxMautbericht
'
Me.cbxMautbericht._allowedValuesFreiText = Nothing
Me.cbxMautbericht._allowFreiText = False
Me.cbxMautbericht._value = ""
Me.cbxMautbericht.DropDownWidth = 200
Me.cbxMautbericht.FormattingEnabled = True
Me.cbxMautbericht.Location = New System.Drawing.Point(265, 33)
Me.cbxMautbericht.Name = "cbxMautbericht"
Me.cbxMautbericht.Size = New System.Drawing.Size(152, 21)
Me.cbxMautbericht.TabIndex = 30
'
'KdSearchBox3
'
Me.KdSearchBox3._AlleFirmenCLUSTER = False
Me.KdSearchBox3._AllowSetValue = True
Me.KdSearchBox3._autoSizeGross = False
Me.KdSearchBox3._display_Name1 = False
Me.KdSearchBox3._displayAVISO_Email = False
Me.KdSearchBox3._displayFullName = False
Me.KdSearchBox3._displayWoelflKd = False
Me.KdSearchBox3._hideIfListEmpty = True
Me.KdSearchBox3._loadKdData = False
Me.KdSearchBox3._searchName1 = True
Me.KdSearchBox3._UseFIRMA = ""
Me.KdSearchBox3._ValueKdAndName = True
Me.KdSearchBox3.dgvpos = "LEFT"
Me.KdSearchBox3.KdName = ""
Me.KdSearchBox3.KdNr = "-1"
Me.KdSearchBox3.kdNrField = Nothing
Me.KdSearchBox3.KdNrNullInt = Nothing
Me.KdSearchBox3.Location = New System.Drawing.Point(87, 308)
Me.KdSearchBox3.Name = "KdSearchBox3"
Me.KdSearchBox3.nurAktive = True
Me.KdSearchBox3.searchActive = True
Me.KdSearchBox3.Size = New System.Drawing.Size(350, 20)
Me.KdSearchBox3.TabIndex = 41
Me.KdSearchBox3.TIMER_SEARCH = True
Me.KdSearchBox3.usrcntl = Nothing
'
'cboSachbearbeiter
'
Me.cboSachbearbeiter._allowedValuesFreiText = Nothing
Me.cboSachbearbeiter._allowFreiText = False
Me.cboSachbearbeiter._value = ""
Me.cboSachbearbeiter.FormattingEnabled = True
Me.cboSachbearbeiter.Location = New System.Drawing.Point(529, 38)
Me.cboSachbearbeiter.Name = "cboSachbearbeiter"
Me.cboSachbearbeiter.Size = New System.Drawing.Size(152, 21)
Me.cboSachbearbeiter.TabIndex = 29
'
'usrcntlFakturierung
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -812,7 +812,6 @@ Partial Class usrcntlFakturierung
Me.GroupBox1.ResumeLayout(False)
Me.GBMautberichte.ResumeLayout(False)
Me.GBMautberichte.PerformLayout()
CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).EndInit()
Me.GBSammelrechnung.ResumeLayout(False)
Me.GBSammelrechnung.PerformLayout()
CType(Me.PictureBox8, System.ComponentModel.ISupportInitialize).EndInit()
@@ -823,6 +822,7 @@ Partial Class usrcntlFakturierung
CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.MyDatagridview1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()

View File

@@ -1,4 +1,6 @@
Imports System.IO
Imports System.Globalization
Imports System.IO
Imports System.Web.UI.WebControls.Expressions
Imports VERAG_PROG_ALLGEMEIN
Public Class usrcntlFakturierung
@@ -806,7 +808,7 @@ Public Class usrcntlFakturierung
End If
End If
End If
ElseIf f.Contains("_Maut.pdf") Then
@@ -822,7 +824,7 @@ Public Class usrcntlFakturierung
End If
End If
End If
End If
End If
Next
@@ -1051,9 +1053,9 @@ Public Class usrcntlFakturierung
Next
If listPDFs.Count > 0 Then
If listPDFs.Count > 0 Then
Dim pathPDF = listPDFs(0).ToString
Dim pathPDF = listPDFs(0).ToString
If listPDFs.Count > 1 Then
Dim pathPDFMerge = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("MDM_Sammelrechnung.pdf", ".pdf", False, False)
@@ -1072,19 +1074,19 @@ Public Class usrcntlFakturierung
End If
pbPloseAnh_Proz.Value = 100
txtPloseAnh_Einarbeitung.Text = dtSelectedSammelrechnungen.Rows.Count & " / " & dtSelectedSammelrechnungen.Rows.Count
lblPloseAnh_Proz.Text = "100.00 %"
pbPloseAnh_Proz.Value = 100
txtPloseAnh_Einarbeitung.Text = dtSelectedSammelrechnungen.Rows.Count & " / " & dtSelectedSammelrechnungen.Rows.Count
lblPloseAnh_Proz.Text = "100.00 %"
Else
MsgBox("Datei von " & rechnungsdatum.ToShortDateString & " konnte nicht erstellt werden!")
End If
MsgBox("Datei von " & rechnungsdatum.ToShortDateString & " konnte nicht erstellt werden!")
End If
End If
If cbxRechnungsjournaldrucken.Checked Then
REJournalExcel(Sachbearbeiter, rechnungsdatum, -1)
@@ -1511,15 +1513,59 @@ Public Class usrcntlFakturierung
End Function
Private Sub cbxDateMautbericht_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbxDateMautbericht.SelectedValueChanged
With MyDatagridview1
.Columns.Clear()
.SET_SQL("SELECT [Datenquelle] as Lieferant,sum([Net Amount]) as Netto,sum([VAT Amount]) as VAT,sum([Total Amount]) as Brutto
Dim dtSummen As DataTable = (New SQL).loadDgvBySql("SELECT [Datenquelle] as Lieferant,sum([Net Amount]) as Netto,sum([VAT Amount]) as VAT,sum([Total Amount]) as Brutto
FROM [VERAG].[dbo].[tblMautbericht]
where cast([Billingdate] as date) = '" & cbxDateMautbericht._value & "'
group by [Datenquelle]", "FMZOLL")
.LOAD()
Dim sumNetto As Double = 0
Dim sumVAT As Double = 0
Dim sumBrutto As Double = 0
For Each row As DataRow In dtSummen.Rows
If Not IsDBNull(row("Netto")) AndAlso IsNumeric(row("Netto")) Then sumNetto += CDbl(row("Netto"))
If Not IsDBNull(row("VAT")) AndAlso IsNumeric(row("VAT")) Then sumVAT += CDbl(row("VAT"))
If Not IsDBNull(row("Brutto")) AndAlso IsNumeric(row("Brutto")) Then sumBrutto += CDbl(row("Brutto"))
Next
Dim drLast = dtSummen.NewRow
If dtSummen.Columns.Contains("Lieferant") Then drLast.Item("Lieferant") = "SUMME"
If dtSummen.Columns.Contains("Netto") Then drLast.Item("Netto") = sumNetto
If dtSummen.Columns.Contains("VAT") Then drLast.Item("VAT") = sumVAT
If dtSummen.Columns.Contains("Brutto") Then drLast.Item("Brutto") = sumBrutto
dtSummen.Rows.InsertAt(drLast, dtSummen.Rows.Count)
With MyDatagridview1
.Columns.Clear()
.DataSource = dtSummen
If dtSummen.Columns.Contains("Netto") Then
.Columns(1).DefaultCellStyle.Format = "c2"
.Columns(1).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
End If
If .Columns.Contains("VAT") Then
.Columns(2).DefaultCellStyle.Format = "c2"
.Columns(2).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
End If
If .Columns.Contains("Brutto") Then
.Columns(3).DefaultCellStyle.Format = "c2"
.Columns(3).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
End If
.AllowUserToAddRows = False
.Columns("Lieferant").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
End With