From 6d704e79c69dcc957779b2419f9e7f7ea3135390 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Mon, 30 Dec 2024 15:22:26 +0100 Subject: [PATCH] ustva --- SDL/USTV/frmUSTVoffeneAntraege.Designer.vb | 135 ++++++++++++--------- SDL/USTV/frmUSTVoffeneAntraege.vb | 103 +++++++++++----- 2 files changed, 153 insertions(+), 85 deletions(-) diff --git a/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb b/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb index e43be93b..d80b6602 100644 --- a/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb +++ b/SDL/USTV/frmUSTVoffeneAntraege.Designer.vb @@ -23,9 +23,9 @@ Partial Class frmUSTVoffeneAntraege _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + 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 DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Me.FlowLayoutPanel = New System.Windows.Forms.FlowLayoutPanel() Me.btn = New System.Windows.Forms.Button() Me.Button7 = New System.Windows.Forms.Button() @@ -46,11 +46,13 @@ Partial Class frmUSTVoffeneAntraege Me.lblKunde = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.pnlLand = New System.Windows.Forms.Panel() + Me.Label5 = New System.Windows.Forms.Label() + Me.cbxKundeLand = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.cbxNichtEroeffneteAntraege = New System.Windows.Forms.CheckBox() - Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.AntragEröffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.cbxSteuerNr = New System.Windows.Forms.CheckBox() Me.MyComboBox1 = New VERAG_PROG_ALLGEMEIN.MyComboBox() + Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.AntragEröffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.txtmaxAnz = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtMWST = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtAnzahl = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -226,7 +228,7 @@ Partial Class frmUSTVoffeneAntraege ' 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(1295, 71) + Me.Label3.Location = New System.Drawing.Point(1295, 80) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(50, 13) Me.Label3.TabIndex = 43 @@ -236,7 +238,7 @@ Partial Class frmUSTVoffeneAntraege ' Me.cbxAlleoffenen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.cbxAlleoffenen.AutoSize = True - Me.cbxAlleoffenen.Location = New System.Drawing.Point(1137, 69) + Me.cbxAlleoffenen.Location = New System.Drawing.Point(1293, 60) Me.cbxAlleoffenen.Name = "cbxAlleoffenen" Me.cbxAlleoffenen.Size = New System.Drawing.Size(128, 17) Me.cbxAlleoffenen.TabIndex = 44 @@ -256,57 +258,64 @@ Partial Class frmUSTVoffeneAntraege ' 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(3, 10) + Me.Label4.Location = New System.Drawing.Point(170, 9) Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(34, 13) + Me.Label4.Size = New System.Drawing.Size(68, 13) Me.Label4.TabIndex = 47 - Me.Label4.Text = "Land:" + Me.Label4.Text = "Land-Antrag:" ' 'pnlLand ' Me.pnlLand.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.pnlLand.Controls.Add(Me.Label5) + Me.pnlLand.Controls.Add(Me.cbxKundeLand) Me.pnlLand.Controls.Add(Me.cbxNichtEroeffneteAntraege) Me.pnlLand.Controls.Add(Me.cbxSteuerNr) Me.pnlLand.Controls.Add(Me.Label4) Me.pnlLand.Controls.Add(Me.MyComboBox1) - Me.pnlLand.Location = New System.Drawing.Point(863, 62) + Me.pnlLand.Location = New System.Drawing.Point(807, 62) Me.pnlLand.Name = "pnlLand" - Me.pnlLand.Size = New System.Drawing.Size(268, 33) + Me.pnlLand.Size = New System.Drawing.Size(480, 35) Me.pnlLand.TabIndex = 42 Me.pnlLand.Visible = False ' + 'Label5 + ' + 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(18, 9) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(68, 13) + Me.Label5.TabIndex = 49 + Me.Label5.Text = "Land-Kunde:" + ' + 'cbxKundeLand + ' + Me.cbxKundeLand._allowedValuesFreiText = Nothing + Me.cbxKundeLand._allowFreiText = False + Me.cbxKundeLand._value = "" + Me.cbxKundeLand.FormattingEnabled = True + Me.cbxKundeLand.Location = New System.Drawing.Point(92, 6) + Me.cbxKundeLand.Name = "cbxKundeLand" + Me.cbxKundeLand.Size = New System.Drawing.Size(72, 21) + Me.cbxKundeLand.TabIndex = 48 + ' 'cbxNichtEroeffneteAntraege ' Me.cbxNichtEroeffneteAntraege.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.cbxNichtEroeffneteAntraege.AutoSize = True - Me.cbxNichtEroeffneteAntraege.Checked = True - Me.cbxNichtEroeffneteAntraege.CheckState = System.Windows.Forms.CheckState.Checked - Me.cbxNichtEroeffneteAntraege.Location = New System.Drawing.Point(126, 0) + Me.cbxNichtEroeffneteAntraege.Location = New System.Drawing.Point(338, 0) Me.cbxNichtEroeffneteAntraege.Name = "cbxNichtEroeffneteAntraege" Me.cbxNichtEroeffneteAntraege.Size = New System.Drawing.Size(134, 17) Me.cbxNichtEroeffneteAntraege.TabIndex = 46 Me.cbxNichtEroeffneteAntraege.Text = "nicht eröffnete Anträge" Me.cbxNichtEroeffneteAntraege.UseVisualStyleBackColor = True ' - 'ContextMenuStrip1 - ' - Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AntragEröffnenToolStripMenuItem}) - Me.ContextMenuStrip1.Name = "ContextMenuStrip1" - Me.ContextMenuStrip1.Size = New System.Drawing.Size(159, 26) - ' - 'AntragEröffnenToolStripMenuItem - ' - Me.AntragEröffnenToolStripMenuItem.Name = "AntragEröffnenToolStripMenuItem" - Me.AntragEröffnenToolStripMenuItem.Size = New System.Drawing.Size(158, 22) - Me.AntragEröffnenToolStripMenuItem.Text = "Antrag eröffnen" - ' 'cbxSteuerNr ' Me.cbxSteuerNr.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.cbxSteuerNr.AutoSize = True - Me.cbxSteuerNr.Checked = True - Me.cbxSteuerNr.CheckState = System.Windows.Forms.CheckState.Checked - Me.cbxSteuerNr.Location = New System.Drawing.Point(126, 15) + Me.cbxSteuerNr.Location = New System.Drawing.Point(338, 17) Me.cbxSteuerNr.Name = "cbxSteuerNr" Me.cbxSteuerNr.Size = New System.Drawing.Size(105, 17) Me.cbxSteuerNr.TabIndex = 46 @@ -319,11 +328,23 @@ Partial Class frmUSTVoffeneAntraege Me.MyComboBox1._allowFreiText = False Me.MyComboBox1._value = "" Me.MyComboBox1.FormattingEnabled = True - Me.MyComboBox1.Location = New System.Drawing.Point(48, 7) + Me.MyComboBox1.Location = New System.Drawing.Point(244, 5) Me.MyComboBox1.Name = "MyComboBox1" Me.MyComboBox1.Size = New System.Drawing.Size(72, 21) Me.MyComboBox1.TabIndex = 46 ' + 'ContextMenuStrip1 + ' + Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AntragEröffnenToolStripMenuItem}) + Me.ContextMenuStrip1.Name = "ContextMenuStrip1" + Me.ContextMenuStrip1.Size = New System.Drawing.Size(159, 26) + ' + 'AntragEröffnenToolStripMenuItem + ' + Me.AntragEröffnenToolStripMenuItem.Name = "AntragEröffnenToolStripMenuItem" + Me.AntragEröffnenToolStripMenuItem.Size = New System.Drawing.Size(158, 22) + Me.AntragEröffnenToolStripMenuItem.Text = "Antrag eröffnen" + ' 'txtmaxAnz ' Me.txtmaxAnz._DateTimeOnly = False @@ -340,7 +361,7 @@ Partial Class frmUSTVoffeneAntraege Me.txtmaxAnz._WaehrungZeichen = True Me.txtmaxAnz.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.txtmaxAnz.ForeColor = System.Drawing.Color.Black - Me.txtmaxAnz.Location = New System.Drawing.Point(1362, 68) + Me.txtmaxAnz.Location = New System.Drawing.Point(1362, 77) Me.txtmaxAnz.MaxLineLength = -1 Me.txtmaxAnz.MaxLines_Warning = "" Me.txtmaxAnz.MaxLines_Warning_Label = Nothing @@ -410,34 +431,34 @@ Partial Class frmUSTVoffeneAntraege Me.MyDatagridview1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.MyDatagridview1.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle4 + DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.MyDatagridview1.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1 Me.MyDatagridview1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.MyDatagridview1.DefaultCellStyle = DataGridViewCellStyle5 + DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.MyDatagridview1.DefaultCellStyle = DataGridViewCellStyle2 Me.MyDatagridview1.Location = New System.Drawing.Point(12, 98) Me.MyDatagridview1.Name = "MyDatagridview1" Me.MyDatagridview1.ReadOnly = True - DataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle6.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.MyDatagridview1.RowHeadersDefaultCellStyle = DataGridViewCellStyle6 + DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.MyDatagridview1.RowHeadersDefaultCellStyle = DataGridViewCellStyle3 Me.MyDatagridview1.RowHeadersWidth = 62 Me.MyDatagridview1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect Me.MyDatagridview1.Size = New System.Drawing.Size(1409, 528) @@ -504,4 +525,6 @@ Partial Class frmUSTVoffeneAntraege Friend WithEvents ContextMenuStrip1 As ContextMenuStrip Friend WithEvents AntragEröffnenToolStripMenuItem As ToolStripMenuItem Friend WithEvents cbxSteuerNr As CheckBox + Friend WithEvents Label5 As Label + Friend WithEvents cbxKundeLand As VERAG_PROG_ALLGEMEIN.MyComboBox End Class diff --git a/SDL/USTV/frmUSTVoffeneAntraege.vb b/SDL/USTV/frmUSTVoffeneAntraege.vb index 5e971318..7cb60768 100644 --- a/SDL/USTV/frmUSTVoffeneAntraege.vb +++ b/SDL/USTV/frmUSTVoffeneAntraege.vb @@ -1,8 +1,4 @@ Imports System.Windows.Documents -Imports com.sun.org.apache.bcel.internal.generic -Imports GrapeCity.ActiveReports.FormattedText.Layout.Utils -Imports jdk.nashorn.internal.objects.annotations -Imports VERAG_PROG_ALLGEMEIN Public Class frmUSTVoffeneAntraege @@ -430,7 +426,11 @@ Public Class frmUSTVoffeneAntraege End If If MyComboBox1._value <> "" Then - sqlwhereLand &= " and land = '" & MyComboBox1._value & "'" + sqlwhereLand &= " and Einreichland = '" & MyComboBox1._value & "'" + End If + + If cbxKundeLand._value <> "" Then + sqlwhereLand &= " and Kundenland = '" & cbxKundeLand._value & "'" End If If cbxSteuerNr.Checked Then @@ -446,11 +446,12 @@ Public Class frmUSTVoffeneAntraege .Columns.Clear() 'Exit Sub 'MsgBox(.sql) - Dim sqlstring = "select isnull(UStVAn_ID,0) as antragExisitiert,tblSteuernummern.UStV as SteuerNr,Lieferant , KdNr, Kundenname, Land from ( select " & top & " + Dim sqlstring = "select isnull(UStVAn_ID,0) as antragExisitiert,tblSteuernummern.UStV as SteuerNr,Lieferant , KdNr, Kundenname, Kundenland, Einreichland from ( select " & top & " 'PLOSE' as Lieferant, plose_POLSEKundennummer as KdNr, - Adressen.[Name 1] as Kundenname, - plp_Land as Land, + Adressen.[Name 1] as Kundenname, + Adressen.LandKz as Kundenland, + plp_Land as Einreichland, [plose_RechnungsDatum] AS Rechnungsdatum, sum([plose_MWSTBetrag]) as MWST FROM [tblPLOSE_Details] @@ -458,7 +459,7 @@ Public Class frmUSTVoffeneAntraege INNER JOIN [tblPLOSE_Produktbeschreibung] ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_Archiv <> 1 AND plose_LieferantCode IN (0,1,7) AND cast(plose_RechnungsDatum as date) between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and plose_RechnungsNr is not null " & sqlwherePLOSE & " - group by plose_POLSEKundennummer, Adressen.[Name 1] ,[plose_RechnungsDatum],plp_Land + group by plose_POLSEKundennummer, Adressen.[Name 1],Adressen.LandKz ,[plose_RechnungsDatum],plp_Land having sum(plose_MWSTBetrag)<>0 UNION ALL @@ -466,14 +467,16 @@ Public Class frmUSTVoffeneAntraege Select " & top & " 'RMC' as Lieferant, [rmc_kdNr] as KdNr, - [rmc_kdName] as Kundenname, - [rmc_landKZ] as Land, + Adressen.[Name 1] as Kundenname, + Adressen.LandKz as Kundenland, + [rmc_landKZ] as Einreichland, [rmc_reDatum] AS Rechnungsdatum, [rmc_betragMWST] as MWST - FROM [tblRMCImport] + FROM [tblRMCImport] + INNER JOIN Adressen on WölflKundenNr= [rmc_kdNr] where cast(rmc_reDatum As Date) between '" & dat_Sum_Von.Value & "' And '" & dat_Sum_Bis.Value & "' And UStVAn_ID is null " & sqlwhereRMC & " - group by rmc_reDatum, rmc_kdNr,[rmc_kdName], [rmc_landKZ],[rmc_reNr], [rmc_betragMWST] + group by rmc_reDatum, rmc_kdNr,Adressen.[Name 1],Adressen.LandKz, [rmc_landKZ],[rmc_reNr], [rmc_betragMWST] having [rmc_betragMWST] <> 0 UNION ALL @@ -482,13 +485,14 @@ Public Class frmUSTVoffeneAntraege 'UTA' as Lieferant, Adressen.AdressenNr as KdNr, Adressen.[Name 1] as Kundenname, - [Lieferland_ISO2] as Land, + Adressen.LandKz as Kundenland, + [Lieferland_ISO2] as Einreichland, [Rechnungsdatum] AS Rechnungsdatum, sum([Gesamtbetrag_Umsatzsteuer_in_Darstellwährung]) as MWSt FROM [tblUTAImportNew] INNER JOIN Adressen on Adressen.UTAKundenNr = tblUTAImportNew.Kundennummer where cast([Rechnungsdatum] As Date) between '" & dat_Sum_Von.Value & "' And '" & dat_Sum_Bis.Value & "' And [tblUTAImportNew].UStVAn_ID is null - " & sqlwhereUTA & "group by Adressen.AdressenNr, Kundennummer,Adressen.[Name 1],[Rechnungsdatum], [Lieferland_ISO2] having sum([Gesamtbetrag_Umsatzsteuer_in_Darstellwährung]) <> 0 + " & sqlwhereUTA & "group by Adressen.AdressenNr, Kundennummer,Adressen.[Name 1],Adressen.LandKz ,[Rechnungsdatum], [Lieferland_ISO2] having sum([Gesamtbetrag_Umsatzsteuer_in_Darstellwährung]) <> 0 UNION ALL @@ -496,17 +500,18 @@ Public Class frmUSTVoffeneAntraege Select " & top & " 'MSE' as Lieferant, partner_customer_number as KdNr, - customer_name as Kundenname, - country as Land, + customer_name as Kundenname, + Adressen.LandKz as Kundenland, + country as Einreichland, invoice_date AS Rechnungsdatum, sum(total_vat_amount_euro) as MWST - FROM [VERAG].[dbo].[tblMSEInvoices] inner join [tblMSECustomers] on [customer_number] = [customer_id] + FROM [VERAG].[dbo].[tblMSEInvoices] inner join [tblMSECustomers] on [customer_number] = [customer_id] INNER JOIN Adressen on Adressen.MSEKundenNr = [customer_number] where cast(invoice_date As Date) between '" & dat_Sum_Von.Value & "' And '" & dat_Sum_Bis.Value & "' And [UStVAn_ID] is null " & sqlwhereMSE & " - group by invoice_date, partner_customer_number,customer_name, country having sum(total_vat_amount_euro) <> 0 + group by invoice_date, partner_customer_number,customer_name,Adressen.LandKz, country having sum(total_vat_amount_euro) <> 0 UNION ALL @@ -515,7 +520,8 @@ Public Class frmUSTVoffeneAntraege 'IDS' as Lieferant, tblIDSTransactionsNew.KdNrVERAG as KdNr, Adressen.[Name 1] as Kundenname, - tbl_IDS_Länder.Lieferland_ISO2 as Land, + Adressen.LandKz as Kundenland, + tbl_IDS_Länder.Lieferland_ISO2 as Einreichland, cast(tblIDSTransactionsNew.[YearMonthDay] as date) AS Rechnungsdatum, SUM(tblIDSTransactionsNew.[VATAmount]) AS MWST FROM @@ -534,13 +540,15 @@ Public Class frmUSTVoffeneAntraege GROUP BY tblIDSTransactionsNew.KdNrVERAG, Adressen.[Name 1], + Adressen.LandKz, tbl_IDS_Länder.Lieferland_ISO2, tblIDSTransactionsNew.[YearMonthDay] ) as temp inner join tblKundenErweitert on temp.kdnr = kde_KundenNr - left join tblUStVAntrag on UStVAn_KuNr = temp.kdnr and UStVAn_ReDatVon <= temp.Rechnungsdatum and UStVAn_ReDatBis >= temp.Rechnungsdatum - left JOIN tblSteuernummern On temp.Land = tblSteuernummern.LandKz and KdNr = tblSteuernummern.AdressenNr + inner join [Länderverzeichnis für die Außenhandelsstatistik] on temp.Einreichland=LandKz + left join tblUStVAntrag on UStVAn_KuNr = temp.kdnr and UStVAn_ReDatVon <= temp.Rechnungsdatum and UStVAn_ReDatBis >= temp.Rechnungsdatum and [Länderverzeichnis für die Außenhandelsstatistik].LandNr = UStVAn_LandNr + left JOIN tblSteuernummern On temp.Einreichland = tblSteuernummern.LandKz and KdNr = tblSteuernummern.AdressenNr where 1 = 1 and isnull(kde_keineMWSt,0) = 0 " & sqlwhereLand & sqlwhereSteuerNr & - " group by isnull(UStVAn_ID,0) , Lieferant, KdNr, Kundenname, Land, tblSteuernummern.UStV" + " group by isnull(UStVAn_ID,0) , Lieferant, KdNr, Kundenname,Kundenland, Einreichland, tblSteuernummern.UStV" .SET_SQL(sqlstring, "FMZOLL") .LOAD() @@ -549,7 +557,8 @@ Public Class frmUSTVoffeneAntraege .Columns("KdNr").HeaderText = "KdNr" .Columns("SteuerNr").HeaderText = "SteuerNr" .Columns("Kundenname").HeaderText = "Kunde" - .Columns("Land").HeaderText = "Land" + .Columns("Kundenland").HeaderText = "Kundenland" + .Columns("Einreichland").HeaderText = "Einreichland" .Columns("Kundenname").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells @@ -571,10 +580,10 @@ Public Class frmUSTVoffeneAntraege Dim list As New List(Of String) For Each r As DataGridViewRow In .Rows - If r.Cells("Land").Value IsNot Nothing And r.Cells("Land").Value <> "" Then + If r.Cells("Einreichland").Value IsNot Nothing And r.Cells("Einreichland").Value <> "" Then - If Not list.Any(Function(c) c = r.Cells("Land").Value) Then - list.Add(r.Cells("Land").Value) + If Not list.Any(Function(c) c = r.Cells("Einreichland").Value) Then + list.Add(r.Cells("Einreichland").Value) End If End If @@ -586,6 +595,27 @@ Public Class frmUSTVoffeneAntraege Next End If + If Not cbxKundeLand._value <> "" Then + cbxKundeLand.Items.Clear() + cbxKundeLand.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", "")) + Dim list As New List(Of String) + For Each r As DataGridViewRow In .Rows + + If r.Cells("Kundenland").Value IsNot Nothing And r.Cells("Kundenland").Value <> "" Then + + If Not list.Any(Function(c) c = r.Cells("Kundenland").Value) Then + list.Add(r.Cells("Kundenland").Value) + + End If + End If + Next + + For Each l In list + Dim listItem As New VERAG_PROG_ALLGEMEIN.MyListItem(l, l) + cbxKundeLand.Items.Add(listItem) + Next + End If + txtAnzahl.Text = .Rows.Count txtMWST.Text = sumMwSt @@ -680,8 +710,20 @@ Public Class frmUSTVoffeneAntraege Dim index As Integer = -1 If (MyDatagridview1.SelectedRows.Count > 0) Then index = MyDatagridview1.SelectedRows(0).Index - Dim frm = New frmMDM_USTVAntrag(MyDatagridview1.SelectedRows(0).Cells("KdNr").Value, MyDatagridview1.SelectedRows(0).Cells("Land").Value, dat_Sum_Von.Value, dat_Sum_Bis.Value) - frm.ShowDialog() + If MyDatagridview1.SelectedRows(0).Cells("antragExisitiert").Value > 0 Then + + Dim frm = New frmMDM_USTVAntrag(MyDatagridview1.SelectedRows(0).Cells("antragExisitiert").Value) + frm.ShowDialog() + + Else + + Dim frm = New frmMDM_USTVAntrag(MyDatagridview1.SelectedRows(0).Cells("KdNr").Value, MyDatagridview1.SelectedRows(0).Cells("Land").Value, dat_Sum_Von.Value, dat_Sum_Bis.Value) + frm.ShowDialog() + + End If + + + MyDatagridview1.GetOrder() initDgv_gesamt(txtmaxAnz.Text, cbxNichtEroeffneteAntraege.Checked, IIf(cbxAlleoffenen.Checked, -1, kdNr)) @@ -707,4 +749,7 @@ Public Class frmUSTVoffeneAntraege End Sub + Private Sub cbxKundeLand_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxKundeLand.SelectedIndexChanged + initDgv_gesamt(txtmaxAnz.Text, cbxNichtEroeffneteAntraege.Checked, IIf(cbxAlleoffenen.Checked, -1, kdNr)) + End Sub End Class \ No newline at end of file