ustva, Fremdrechnungen, ids
This commit is contained in:
@@ -158,7 +158,7 @@ Public Class frmMDM_USTVAntrag
|
|||||||
|
|
||||||
For Each r As DataGridViewRow In .Rows
|
For Each r As DataGridViewRow In .Rows
|
||||||
|
|
||||||
Dim da_id As Integer
|
Dim da_id As Integer = -1
|
||||||
|
|
||||||
If Not IsDBNull(r.Cells("UStVPo_daId").Value) Then
|
If Not IsDBNull(r.Cells("UStVPo_daId").Value) Then
|
||||||
da_id = r.Cells("UStVPo_daId").Value
|
da_id = r.Cells("UStVPo_daId").Value
|
||||||
|
|||||||
@@ -64,20 +64,33 @@ Public Class ustCntlUSTV_AntragPosition
|
|||||||
loadChangedDSToPanel(UStV_Leitender, True)
|
loadChangedDSToPanel(UStV_Leitender, True)
|
||||||
|
|
||||||
Dim da_id = -1
|
Dim da_id = -1
|
||||||
|
|
||||||
|
If Not IsDBNull(UStV_POS.UStVPo_daId) AndAlso UStV_POS.UStVPo_daId > 0 Then
|
||||||
|
|
||||||
|
da_id = UStV_POS.UStVPo_daId
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
Select Case If(UStV_POS.UStVPo_SchnittstellenNr, -1)
|
Select Case If(UStV_POS.UStVPo_SchnittstellenNr, -1)
|
||||||
Case 6, 0 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [plInv_daId] FROM [tblPLOSE_Inv_Data] where plInv_SupplierRechnungsDatum='" & UStV_POS.UStVPo_ReDat & "' and plInv_SupplierRechnungsNr='" & UStV_POS.UStVPo_ReNr & "' and plInv_SupplierCountry='" & Antrag_LandKz & "' AND [plInv_daId] is not null", "FMZOLL",,, -1)
|
Case 6, 0 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [plInv_daId] FROM [tblPLOSE_Inv_Data] where plInv_SupplierRechnungsDatum='" & UStV_POS.UStVPo_ReDat & "' and plInv_SupplierRechnungsNr='" & UStV_POS.UStVPo_ReNr & "' and plInv_SupplierCountry='" & Antrag_LandKz & "' AND [plInv_daId] is not null", "FMZOLL",,, -1)
|
||||||
Case 7 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [rmc_daId] FROM [tblRMCImport] where rmc_reDatum='" & UStV_POS.UStVPo_ReDat & "' and rmc_reNr='" & UStV_POS.UStVPo_ReNr & "' and rmc_landKZ='" & Antrag_LandKz & "' AND [rmc_daId] is not null", "FMZOLL",,, -1)
|
Case 7 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [rmc_daId] FROM [tblRMCImport] where rmc_reDatum='" & UStV_POS.UStVPo_ReDat & "' and rmc_reNr='" & UStV_POS.UStVPo_ReNr & "' and rmc_landKZ='" & Antrag_LandKz & "' AND [rmc_daId] is not null", "FMZOLL",,, -1)
|
||||||
Case 4, 9 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [daId] FROM [tblMSEInvoices] as inv inner join tblMSECustomers on inv.customer_number = customer_id where invoice_date='" & UStV_POS.UStVPo_ReDat & "' and country='" & Antrag_LandKz & "' AND partner_customer_number = " & kdnr & " AND daId is not null", "FMZOLL",,, -1)
|
Case 4, 9 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [daId] FROM [tblMSEInvoices] as inv inner join tblMSECustomers on inv.customer_number = customer_id where invoice_date='" & UStV_POS.UStVPo_ReDat & "' and country='" & Antrag_LandKz & "' AND partner_customer_number = " & kdnr & " AND daId is not null", "FMZOLL",,, -1)
|
||||||
Case 10 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [daId] FROM [tblUTAImportNew] where Rechnungsdatum='" & UStV_POS.UStVPo_ReDat & "' and Abrechnungsnummer='" & UStV_POS.UStVPo_ReNr & "' and Lieferland_ISO2='" & Antrag_LandKz & "' AND daId is not null", "FMZOLL",,, -1)
|
Case 10 : da_id = sql.getValueTxtBySql("SELECT TOP(1) [daId] FROM [tblUTAImportNew] where Rechnungsdatum='" & UStV_POS.UStVPo_ReDat & "' and Abrechnungsnummer='" & UStV_POS.UStVPo_ReNr & "' and Lieferland_ISO2='" & Antrag_LandKz & "' AND daId is not null", "FMZOLL",,, -1)
|
||||||
Case 8 : da_id = sql.getValueTxtBySql("SELECT TOP(1) tblIDSInvoicesNew.daId FROM [tblIDSTransactionsNew] INNER JOIN tbl_IDS_Länder ON tblIDSTransactionsNew.[OutletCountryCode] = tbl_IDS_Länder.OutletCountryCode LEFT JOIN tblIDSInvoicesNew on tblIDSInvoicesNew.CustomerCode = tblIDSTransactionsNew.CustomerCode and tblIDSInvoicesNew.Invoicenumber = Paymentsummarynumber where tblIDSTransactionsNew.[YearMonthDay] ='" & UStV_POS.UStVPo_ReDat & "' and ISNULL(tblIDSTransactionsNew.[OBONumber], ISNULL(tblIDSTransactionsNew.[VRNumber], tblIDSTransactionsNew.[Paymentsummarynumber])) ='" & UStV_POS.UStVPo_ReNr & "' and tbl_IDS_Länder.Lieferland_ISO2='" & Antrag_LandKz & "' AND tblIDSInvoicesNew.daId is not null", "FMZOLL",,, -1) : scanSonstiges.Enabled = False
|
Case 8 : da_id = sql.getValueTxtBySql("SELECT TOP(1) tblIDSInvoicesNew.daId FROM [tblIDSTransactionsNew] INNER JOIN tbl_IDS_Länder ON tblIDSTransactionsNew.[OutletCountryCode] = tbl_IDS_Länder.OutletCountryCode LEFT JOIN tblIDSInvoicesNew on tblIDSInvoicesNew.CustomerCode = tblIDSTransactionsNew.CustomerCode and tblIDSInvoicesNew.Invoicenumber = Paymentsummarynumber where tblIDSTransactionsNew.[YearMonthDay] ='" & UStV_POS.UStVPo_ReDat & "' and ISNULL(tblIDSTransactionsNew.[OBONumber], ISNULL(tblIDSTransactionsNew.[VRNumber], tblIDSTransactionsNew.[Paymentsummarynumber])) ='" & UStV_POS.UStVPo_ReNr & "' and tbl_IDS_Länder.Lieferland_ISO2='" & Antrag_LandKz & "' AND tblIDSInvoicesNew.daId is not null", "FMZOLL",,, -1) : scanSonstiges.Enabled = False
|
||||||
Case 1 : da_id = 1 'VERAG-RECHNUGNEN werden immer direkt OHNE daid geöffnet!
|
Case 1 : da_id = 1 : scanSonstiges.Enabled = False 'VERAG-RECHNUGNEN werden immer direkt OHNE daid geöffnet!
|
||||||
Case -1 : IIf(UStV_POS.UStVPo_daId > 0, UStV_POS.UStVPo_daId, -1) : scanSonstiges.Enabled = True
|
Case -1 : da_id = IIf(UStV_POS.UStVPo_daId > 0, UStV_POS.UStVPo_daId, -1)
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
If da_id > -1 Then
|
If da_id > -1 Then
|
||||||
scanSonstiges.INIT_daId(da_id)
|
scanSonstiges.INIT_daId(da_id)
|
||||||
|
scanSonstiges.Enabled = Not UStV_POS.UStVPo_SchnittstellenNr > 0
|
||||||
Else
|
Else
|
||||||
scanSonstiges.INIT(kdnr, "MDM", "MDM_DATEN", "DIVERSE")
|
scanSonstiges.INIT(kdnr, "MDM", "MDM_DATEN", "USTVA_" & UStV_POS.UStVAn_ID & "_" & UStV_POS.UStVPo_ID)
|
||||||
|
'scanSonstiges.INIT_daId(da_id)
|
||||||
|
scanSonstiges.Enabled = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
scanUSTVFABest.INIT(kdnr, "KUNDENDATEN", "FA_Bestaetigungen")
|
scanUSTVFABest.INIT(kdnr, "KUNDENDATEN", "FA_Bestaetigungen")
|
||||||
@@ -437,12 +450,13 @@ Public Class ustCntlUSTV_AntragPosition
|
|||||||
Private Sub scanSonstiges_FileAdded(id As String, path As String, name As String) Handles scanSonstiges.FileAdded
|
Private Sub scanSonstiges_FileAdded(id As String, path As String, name As String) Handles scanSonstiges.FileAdded
|
||||||
getValues(UStV_POS, True)
|
getValues(UStV_POS, True)
|
||||||
UStV_POS.UStVPo_daId = id
|
UStV_POS.UStVPo_daId = id
|
||||||
UStV_POS.SAVE()
|
If UStV_POS.SAVE() Then scanSonstiges.INIT_daId(UStV_POS.UStVPo_daId)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub scanSonstiges_FileDeleted() Handles scanSonstiges.FileDeleted
|
Private Sub scanSonstiges_FileDeleted() Handles scanSonstiges.FileDeleted
|
||||||
getValues(UStV_POS, True)
|
getValues(UStV_POS, True)
|
||||||
UStV_POS.UStVPo_daId = -1
|
UStV_POS.UStVPo_daId = Nothing
|
||||||
UStV_POS.SAVE()
|
UStV_POS.SAVE()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
29
SDL/mdm/usrcntlFremdrechnungen.Designer.vb
generated
29
SDL/mdm/usrcntlFremdrechnungen.Designer.vb
generated
@@ -24,6 +24,7 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
Me.components = New System.ComponentModel.Container()
|
Me.components = New System.ComponentModel.Container()
|
||||||
Dim DataGridViewCellStyle1 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()
|
||||||
Me.DetailsAnzeigenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
Me.DetailsAnzeigenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||||
Me.FlowLayoutPanel = New System.Windows.Forms.FlowLayoutPanel()
|
Me.FlowLayoutPanel = New System.Windows.Forms.FlowLayoutPanel()
|
||||||
Me.btnSDL_Alle = New System.Windows.Forms.Button()
|
Me.btnSDL_Alle = New System.Windows.Forms.Button()
|
||||||
@@ -54,6 +55,7 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Me.Panel3 = New System.Windows.Forms.Panel()
|
Me.Panel3 = New System.Windows.Forms.Panel()
|
||||||
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
|
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
|
||||||
Me.dgvLFRechnung = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
Me.dgvLFRechnung = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||||
|
Me.dgvDetails = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||||
Me.Panel4 = New System.Windows.Forms.Panel()
|
Me.Panel4 = New System.Windows.Forms.Panel()
|
||||||
Me.cntxtExcel = New System.Windows.Forms.ContextMenuStrip(Me.components)
|
Me.cntxtExcel = New System.Windows.Forms.ContextMenuStrip(Me.components)
|
||||||
Me.ToolStripMenuItem3 = New System.Windows.Forms.ToolStripMenuItem()
|
Me.ToolStripMenuItem3 = New System.Windows.Forms.ToolStripMenuItem()
|
||||||
@@ -64,8 +66,10 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Me.Panel3.SuspendLayout()
|
Me.Panel3.SuspendLayout()
|
||||||
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.SplitContainer1.Panel1.SuspendLayout()
|
Me.SplitContainer1.Panel1.SuspendLayout()
|
||||||
|
Me.SplitContainer1.Panel2.SuspendLayout()
|
||||||
Me.SplitContainer1.SuspendLayout()
|
Me.SplitContainer1.SuspendLayout()
|
||||||
CType(Me.dgvLFRechnung, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.dgvLFRechnung, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.dgvDetails, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.Panel4.SuspendLayout()
|
Me.Panel4.SuspendLayout()
|
||||||
Me.cntxtExcel.SuspendLayout()
|
Me.cntxtExcel.SuspendLayout()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
@@ -388,7 +392,6 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Me.Button4.Text = "Details" & Global.Microsoft.VisualBasic.ChrW(10) & "anzeigen"
|
Me.Button4.Text = "Details" & Global.Microsoft.VisualBasic.ChrW(10) & "anzeigen"
|
||||||
Me.Button4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
Me.Button4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||||
Me.Button4.UseVisualStyleBackColor = True
|
Me.Button4.UseVisualStyleBackColor = True
|
||||||
Me.Button4.Visible = False
|
|
||||||
'
|
'
|
||||||
'Button5
|
'Button5
|
||||||
'
|
'
|
||||||
@@ -449,6 +452,10 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
'
|
'
|
||||||
Me.SplitContainer1.Panel1.AutoScroll = True
|
Me.SplitContainer1.Panel1.AutoScroll = True
|
||||||
Me.SplitContainer1.Panel1.Controls.Add(Me.dgvLFRechnung)
|
Me.SplitContainer1.Panel1.Controls.Add(Me.dgvLFRechnung)
|
||||||
|
'
|
||||||
|
'SplitContainer1.Panel2
|
||||||
|
'
|
||||||
|
Me.SplitContainer1.Panel2.Controls.Add(Me.dgvDetails)
|
||||||
Me.SplitContainer1.Panel2MinSize = 0
|
Me.SplitContainer1.Panel2MinSize = 0
|
||||||
Me.SplitContainer1.Size = New System.Drawing.Size(1356, 799)
|
Me.SplitContainer1.Size = New System.Drawing.Size(1356, 799)
|
||||||
Me.SplitContainer1.SplitterDistance = 559
|
Me.SplitContainer1.SplitterDistance = 559
|
||||||
@@ -471,6 +478,23 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Me.dgvLFRechnung.Size = New System.Drawing.Size(1354, 770)
|
Me.dgvLFRechnung.Size = New System.Drawing.Size(1354, 770)
|
||||||
Me.dgvLFRechnung.TabIndex = 29
|
Me.dgvLFRechnung.TabIndex = 29
|
||||||
'
|
'
|
||||||
|
'dgvDetails
|
||||||
|
'
|
||||||
|
Me.dgvDetails.AKTUALISIERUNGS_INTERVALL = 1000
|
||||||
|
Me.dgvDetails.AllowUserToAddRows = False
|
||||||
|
Me.dgvDetails.AllowUserToDeleteRows = False
|
||||||
|
Me.dgvDetails.AllowUserToResizeColumns = False
|
||||||
|
Me.dgvDetails.AllowUserToResizeRows = False
|
||||||
|
DataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
|
||||||
|
Me.dgvDetails.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle2
|
||||||
|
Me.dgvDetails.BackgroundColor = System.Drawing.Color.White
|
||||||
|
Me.dgvDetails.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
|
||||||
|
Me.dgvDetails.Location = New System.Drawing.Point(-1, 3)
|
||||||
|
Me.dgvDetails.Name = "dgvDetails"
|
||||||
|
Me.dgvDetails.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
|
||||||
|
Me.dgvDetails.Size = New System.Drawing.Size(1352, 228)
|
||||||
|
Me.dgvDetails.TabIndex = 30
|
||||||
|
'
|
||||||
'Panel4
|
'Panel4
|
||||||
'
|
'
|
||||||
Me.Panel4.BackColor = System.Drawing.Color.White
|
Me.Panel4.BackColor = System.Drawing.Color.White
|
||||||
@@ -515,9 +539,11 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Me.Panel1.PerformLayout()
|
Me.Panel1.PerformLayout()
|
||||||
Me.Panel3.ResumeLayout(False)
|
Me.Panel3.ResumeLayout(False)
|
||||||
Me.SplitContainer1.Panel1.ResumeLayout(False)
|
Me.SplitContainer1.Panel1.ResumeLayout(False)
|
||||||
|
Me.SplitContainer1.Panel2.ResumeLayout(False)
|
||||||
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.SplitContainer1.ResumeLayout(False)
|
Me.SplitContainer1.ResumeLayout(False)
|
||||||
CType(Me.dgvLFRechnung, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.dgvLFRechnung, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.dgvDetails, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.Panel4.ResumeLayout(False)
|
Me.Panel4.ResumeLayout(False)
|
||||||
Me.cntxtExcel.ResumeLayout(False)
|
Me.cntxtExcel.ResumeLayout(False)
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
@@ -557,4 +583,5 @@ Partial Class usrcntlFremdrechnungen
|
|||||||
Friend WithEvents cbx As CheckBox
|
Friend WithEvents cbx As CheckBox
|
||||||
Friend WithEvents dat_Sum_Bis As DateTimePicker
|
Friend WithEvents dat_Sum_Bis As DateTimePicker
|
||||||
Friend WithEvents dat_Sum_Von As DateTimePicker
|
Friend WithEvents dat_Sum_Von As DateTimePicker
|
||||||
|
Friend WithEvents dgvDetails As VERAG_PROG_ALLGEMEIN.MyDatagridview
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
|
Imports javax.xml.bind
|
||||||
Imports Microsoft.Office.Interop
|
Imports Microsoft.Office.Interop
|
||||||
|
Imports VERAG_PROG_ALLGEMEIN
|
||||||
|
|
||||||
Public Class usrcntlFremdrechnungen
|
Public Class usrcntlFremdrechnungen
|
||||||
Dim KUNDE As New cKunden
|
Dim KUNDE As New cKunden
|
||||||
@@ -10,7 +12,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
Dim FUNC As New cProgramFunctions
|
Dim FUNC As New cProgramFunctions
|
||||||
Dim aktbtn As String = ""
|
Dim aktbtn As String = ""
|
||||||
Dim dgvInitWait As Boolean = False
|
Dim dgvInitWait As Boolean = False
|
||||||
Dim aktSDLNr As Integer = -1
|
Dim aktLieferant As String = "ALLE"
|
||||||
Dim fullyPainted = False
|
Dim fullyPainted = False
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
|
|
||||||
KUNDE = kundenSQL.getKundeByKdNr(kdNr)
|
KUNDE = kundenSQL.getKundeByKdNr(kdNr)
|
||||||
|
|
||||||
SET_SDL(-1)
|
SET_SDL("")
|
||||||
|
|
||||||
dgvInitWait = False
|
dgvInitWait = False
|
||||||
Panel3.Visible = True
|
Panel3.Visible = True
|
||||||
@@ -195,7 +197,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
|
|
||||||
|
|
||||||
Sub SET_SDL(SDLNrTmp)
|
Sub SET_SDL(SDLNrTmp)
|
||||||
aktSDLNr = SDLNrTmp
|
aktLieferant = SDLNrTmp
|
||||||
|
|
||||||
|
|
||||||
Dim anzahlTop = 1000
|
Dim anzahlTop = 1000
|
||||||
@@ -204,61 +206,61 @@ Public Class usrcntlFremdrechnungen
|
|||||||
Select Case SDLNrTmp
|
Select Case SDLNrTmp
|
||||||
|
|
||||||
'IDS
|
'IDS
|
||||||
Case 100 : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
Case "IDS" : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
||||||
" [YearMonthDay] as Rechnungsdatum,[Invoicenumber] as Rechnungsnummer, CustomerCode as Kundennummer,[daId],[TransactionVolume] as Transaktionsmenge,[AmminclVAT] as Bruttobetrag,[TotalNetAmount] as Nettobetrag,[VATAmount] as MWSt, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblIDSInvoicesNew WHERE [CustomerCode] in (SELECT distinct([CustomerCode]) FROM [VERAG].[dbo].[tbl_IDS_Kunden] WHERE 1 = 1 " & IIf(kdNr > 0, " AND [KdNrVERAG]=" & kdNr, "") & ") and [YearMonthDay] " & setSQLWhere(SDLNrTmp, "") & " order by [YearMonthDay] desc, [Invoicenumber]"
|
" invoice_id, [YearMonthDay] as Rechnungsdatum,[Invoicenumber] as Rechnungsnummer, CustomerCode as Kundennummer,[daId],[TransactionVolume] as Transaktionsmenge,[AmminclVAT] as Bruttobetrag,[TotalNetAmount] as Nettobetrag,[VATAmount] as MWSt, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblIDSInvoicesNew WHERE [CustomerCode] in (SELECT distinct([CustomerCode]) FROM [VERAG].[dbo].[tbl_IDS_Kunden] WHERE 1 = 1 " & IIf(kdNr > 0, " AND [KdNrVERAG]=" & kdNr, "") & ") and [YearMonthDay] " & setSQLWhere(SDLNrTmp, "") & " order by [YearMonthDay] desc, [Invoicenumber]"
|
||||||
|
|
||||||
'UTA
|
'UTA
|
||||||
Case 212 : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
Case "UTA" : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
||||||
" [Rechnungsdatum],[Rechnungsnummer_pro_Lieferland] as Rechnungsnummer,Kundennummer,SUM(Gesamtbetrag_Brutto_in_Darstellwährung) as Bruttobetrag,SUM(Gesamtbetrag_Netto_in_Darstellwährung) as Nettobetrag, SUM(Gesamtbetrag_Umsatzsteuer_in_Darstellwährung) as MWSt,[daId],[Lieferland_ISO2] as Land, 'RE' as Art, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTAImportNew] inner join adressen on Kundennummer = UTAKundenNr where 1 = 1 " & IIf(kdNr > 0, " AND [AdressenNr]=" & kdNr, "") & " AND [Rechnungsdatum] " & setSQLWhere(SDLNrTmp, "Land") & " group by [Rechnungsnummer_pro_Lieferland],[Rechnungsdatum],Kundennummer,[daId],[Lieferland_ISO2]"
|
" [Rechnungsdatum],[Rechnungsnummer_pro_Lieferland] as Rechnungsnummer,Kundennummer,SUM(Gesamtbetrag_Brutto_in_Darstellwährung) as Bruttobetrag,SUM(Gesamtbetrag_Netto_in_Darstellwährung) as Nettobetrag, SUM(Gesamtbetrag_Umsatzsteuer_in_Darstellwährung) as MWSt,[daId],[Lieferland_ISO2] as Land, 'RE' as Art, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTAImportNew] inner join adressen on Kundennummer = UTAKundenNr where 1 = 1 " & IIf(kdNr > 0, " AND [AdressenNr]=" & kdNr, "") & " AND [Rechnungsdatum] " & setSQLWhere(SDLNrTmp, "Land") & " group by [Rechnungsnummer_pro_Lieferland],[Rechnungsdatum],Kundennummer,[daId],[Lieferland_ISO2]"
|
||||||
|
|
||||||
SQL_STR &= " UNION ALL SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") & " [Datum], [RechnungsNr],[KundenNr],0,0,0,[daId],'',[DocumentTyp], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTADocuments] inner join adressen on KundenNr = UTAKundenNr where 1 = 1 " & IIf(kdNr > 0, " AND [AdressenNr]=" & kdNr, "") & " and [Datum] " & setSQLWhere(SDLNrTmp, "") & " order by Rechnungsdatum desc"
|
SQL_STR &= " UNION ALL SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") & " [Datum], [RechnungsNr],[KundenNr],0,0,0,[daId],'',[DocumentTyp], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTADocuments] inner join adressen on KundenNr = UTAKundenNr where 1 = 1 " & IIf(kdNr > 0, " AND [AdressenNr]=" & kdNr, "") & " and [Datum] " & setSQLWhere(SDLNrTmp, "") & " order by Rechnungsdatum desc"
|
||||||
|
|
||||||
'PLOSE
|
'PLOSE
|
||||||
Case 214 : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
Case "PLOSE" : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
||||||
" [plInv_SupplierRechnungsDatum] as Rechnungsdatum, [plInv_SupplierRechnungsNr] as Rechnungsnummer,[plInv_PLOSEKundennummer] as Kundennummer,[plInv_Nettobetrag] as Nettobetrag,[plInv_MWSTBetrag] as MWST,[plInv_Bruttobetrag] as Bruttobetrag,[plInv_daId] as daId, [plInv_SupplierCountry] as Land, cast(case when [plInv_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblPLOSE_Inv_Data inner join Adressen on Adressen.PLOSEKundenNr = plInv_PLOSEKundennummer where 1 = 1 " & IIf(kdNr > 0, " AND Adressen.AdressenNr=" & kdNr, "") & " and [plInv_SupplierRechnungsDatum] " & setSQLWhere(SDLNrTmp, "plInv_SupplierCountry") & " Order by plInv_SupplierRechnungsDatum desc, [plInv_SupplierRechnungsNr]"
|
" [plInv_SupplierRechnungsDatum] as Rechnungsdatum, [plInv_SupplierRechnungsNr] as Rechnungsnummer,[plInv_PLOSEKundennummer] as Kundennummer,[plInv_Nettobetrag] as Nettobetrag,[plInv_MWSTBetrag] as MWST,[plInv_Bruttobetrag] as Bruttobetrag,[plInv_daId] as daId, [plInv_SupplierCountry] as Land, cast(case when [plInv_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblPLOSE_Inv_Data inner join Adressen on Adressen.PLOSEKundenNr = plInv_PLOSEKundennummer where 1 = 1 " & IIf(kdNr > 0, " AND Adressen.AdressenNr=" & kdNr, "") & " and [plInv_SupplierRechnungsDatum] " & setSQLWhere(SDLNrTmp, "plInv_SupplierCountry") & " Order by plInv_SupplierRechnungsDatum desc, [plInv_SupplierRechnungsNr]"
|
||||||
|
|
||||||
'MSE
|
'MSE
|
||||||
Case 208 : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
Case "MSE" : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
||||||
" [invoice_date] as Rechnungsdatum, [invoice_id] as Rechnungsnummer/*,[invoice_nr]*/,[customer_number] as Kundennummer, daId, [total_amount_euro] as Brutto_EUR ,[total_vat_amount_euro] as MWST,[country] as Land, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblMSEInvoices where customer_number in (select customer_id from tblMSECustomers where 1 = 1 " & IIf(kdNr > 0, " AND [partner_customer_number]=" & kdNr, "") & " and [invoice_date] " & setSQLWhere(SDLNrTmp, "country") & " ) order by invoice_date desc, invoice_id"
|
" [invoice_date] as Rechnungsdatum, [invoice_id] as Rechnungsnummer/*,[invoice_nr]*/,[customer_number] as Kundennummer, daId, [total_amount_euro] as Brutto_EUR ,[total_vat_amount_euro] as MWST,[country] as Land, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblMSEInvoices where customer_number in (select customer_id from tblMSECustomers where 1 = 1 " & IIf(kdNr > 0, " AND [partner_customer_number]=" & kdNr, "") & " and [invoice_date] " & setSQLWhere(SDLNrTmp, "country") & " ) order by invoice_date desc, invoice_id"
|
||||||
|
|
||||||
'VERAG
|
'VERAG
|
||||||
Case 502 : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
Case "VERAG" : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
||||||
" tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer , tblTrdinInvoice.SteuerbetragLokal, 1 as daId, cast(1 as bit) as PDFvorhanden FROM tblTrdinInvoice WHERE 1 = 1 " & IIf(kdNr > 0, " AND tblTrdinInvoice.RechnungsKundenNr=" & kdNr, "") & " AND tblTrdinInvoice.FilialenNr = 4814 and tblTrdinInvoice.Rechnungsdatum " & setSQLWhere(SDLNrTmp, "'AT'") & " ORDER BY tblTrdinInvoice.Rechnungsdatum desc, tblTrdinInvoice.Rechnungsnummer"
|
" tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer , tblTrdinInvoice.SteuerbetragLokal, 1 as daId, cast(1 as bit) as PDFvorhanden FROM tblTrdinInvoice WHERE 1 = 1 " & IIf(kdNr > 0, " AND tblTrdinInvoice.RechnungsKundenNr=" & kdNr, "") & " AND tblTrdinInvoice.FilialenNr = 4814 and tblTrdinInvoice.Rechnungsdatum " & setSQLWhere(SDLNrTmp, "'AT'") & " ORDER BY tblTrdinInvoice.Rechnungsdatum desc, tblTrdinInvoice.Rechnungsnummer"
|
||||||
'RMC
|
'RMC
|
||||||
Case 999 : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
Case "RMC" : SQL_STR = "SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahlTop, "") &
|
||||||
"[rmc_reDatum] as Rechnungsdatum,[rmc_reNr] as Rechnungsnummer,rmc_kdNr as Kundennummer,[rmc_betragNetto] as Nettobetrag,[rmc_betragBrutto] as Bruttobetrag,[rmc_waehrung] as Währung ,[rmc_euroBrutto] as Brutto_EUR,[rmc_daId] as daId,[rmc_betragMWST] as MWST,rmc_landKZ as Land, cast(case when [rmc_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblRMCImport] inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr where 1 = 1 " & IIf(kdNr > 0, " AND AdressenNr=" & kdNr, "") & " and [rmc_reDatum] " & setSQLWhere(SDLNrTmp, "rmc_landKZ") & " order by rmc_reDatum desc, rmc_reNr"
|
"[rmc_reDatum] as Rechnungsdatum,[rmc_reNr] as Rechnungsnummer,rmc_kdNr as Kundennummer,[rmc_betragNetto] as Nettobetrag,[rmc_betragBrutto] as Bruttobetrag,[rmc_waehrung] as Währung ,[rmc_euroBrutto] as Brutto_EUR,[rmc_daId] as daId,[rmc_betragMWST] as MWST,rmc_landKZ as Land, cast(case when [rmc_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblRMCImport] inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr where 1 = 1 " & IIf(kdNr > 0, " AND AdressenNr=" & kdNr, "") & " and [rmc_reDatum] " & setSQLWhere(SDLNrTmp, "rmc_landKZ") & " order by rmc_reDatum desc, rmc_reNr"
|
||||||
|
|
||||||
Case -1 : Dim anzahl As Integer = anzahlTop / 6 : SQL_STR = " select * from (SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") &
|
Case "ALLE" : Dim anzahl As Integer = anzahlTop / 6 : SQL_STR = " select * from (SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") &
|
||||||
"
|
"
|
||||||
--IDS
|
--IDS
|
||||||
'IDS' as Lieferant, [YearMonthDay] as Rechnungsdatum,[Invoicenumber] as Rechnungsnummer,CustomerCode as Kundennummer,[AmminclVAT] as Bruttobetrag,[TotalNetAmount] as Nettobetrag,[VATAmount] as MWSt,'' as Land, 'RE' as Art,[daId], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblIDSInvoicesNew WHERE [CustomerCode] = (SELECT TOP 1 [CustomerCode] FROM [VERAG].[dbo].[tbl_IDS_Kunden] WHERE 1 = 1 " & IIf(kdNr > 0, " AND [KdNrVERAG]=" & kdNr, "") & " ORDER BY Zeitstempel DESC) and [YearMonthDay] " & setSQLWhere(SDLNrTmp, "") & " order by [YearMonthDay], [Invoicenumber]
|
'IDS' as Lieferant,invoice_id, [YearMonthDay] as Rechnungsdatum,[Invoicenumber] as Rechnungsnummer,CustomerCode as Kundennummer,[AmminclVAT] as Bruttobetrag,[TotalNetAmount] as Nettobetrag,[VATAmount] as MWSt,'' as Land, 'RE' as Art,[daId], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblIDSInvoicesNew WHERE [CustomerCode] = (SELECT TOP 1 [CustomerCode] FROM [VERAG].[dbo].[tbl_IDS_Kunden] WHERE 1 = 1 " & IIf(kdNr > 0, " AND [KdNrVERAG]=" & kdNr, "") & " ORDER BY Zeitstempel DESC) and [YearMonthDay] " & setSQLWhere(SDLNrTmp, "") & " order by [YearMonthDay], [Invoicenumber]
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
|
|
||||||
--MSE
|
--MSE
|
||||||
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'MSE' as Lieferant, [invoice_date] as Rechnungsdatum, cast([invoice_id] as nvarchar) as Rechnungsnummer,[customer_number] as Kundennummer, [total_amount_euro] as Bruttobetrag ,(total_amount_euro - [total_vat_amount_euro]) as Nettobetrag ,[total_vat_amount_euro] as MWST,[country] as Land,'RE' as Art,daId, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblMSEInvoices where customer_number = (select top 1 customer_id from tblMSECustomers where 1 = 1 " & IIf(kdNr > 0, " AND [partner_customer_number]=" & kdNr, "") & " and [invoice_date] " & setSQLWhere(SDLNrTmp, "country") & " ) order by invoice_date, invoice_id
|
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'MSE' as Lieferant,-1 as invoice_id, [invoice_date] as Rechnungsdatum, cast([invoice_id] as nvarchar) as Rechnungsnummer,[customer_number] as Kundennummer, [total_amount_euro] as Bruttobetrag ,(total_amount_euro - [total_vat_amount_euro]) as Nettobetrag ,[total_vat_amount_euro] as MWST,[country] as Land,'RE' as Art,daId, cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblMSEInvoices where customer_number = (select top 1 customer_id from tblMSECustomers where 1 = 1 " & IIf(kdNr > 0, " AND [partner_customer_number]=" & kdNr, "") & " and [invoice_date] " & setSQLWhere(SDLNrTmp, "country") & " ) order by invoice_date, invoice_id
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
--UTA
|
--UTA
|
||||||
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'UTA' as Lieferant, [Rechnungsdatum],STR([Rechnungsnummer_pro_Lieferland]) as Rechnungsnummer,Kundennummer,SUM(Gesamtbetrag_Brutto_in_Darstellwährung) as Bruttobetrag,SUM(Gesamtbetrag_Netto_in_Darstellwährung) as Nettobetrag, SUM(Gesamtbetrag_Umsatzsteuer_in_Darstellwährung) as MWSt,[Lieferland_ISO2] as Land, 'RE' as Art,[daId], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTAImportNew] inner join adressen on Kundennummer = UTAKundenNr where 1 = 1 " & IIf(kdNr > 0, " AND [AdressenNr]=" & kdNr, "") & " and [Rechnungsdatum] " & setSQLWhere(SDLNrTmp, "Lieferland_ISO2") & " group by [Rechnungsnummer_pro_Lieferland],[Rechnungsdatum],Kundennummer,[daId],[Lieferland_ISO2] UNION ALL SELECT 'UTA', [Datum], cast([RechnungsNr] as nvarchar) ,[KundenNr],0,0,0,'',[DocumentTyp],[daId], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTADocuments] inner join adressen on KundenNr = UTAKundenNr where AdressenNr = " & kdNr & " AND Datum " & setSQLWhere(SDLNrTmp, "") & " --order by Rechnungsnummer desc
|
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'UTA' as Lieferant,-1 as invoice_id, [Rechnungsdatum],STR([Rechnungsnummer_pro_Lieferland]) as Rechnungsnummer,Kundennummer,SUM(Gesamtbetrag_Brutto_in_Darstellwährung) as Bruttobetrag,SUM(Gesamtbetrag_Netto_in_Darstellwährung) as Nettobetrag, SUM(Gesamtbetrag_Umsatzsteuer_in_Darstellwährung) as MWSt,[Lieferland_ISO2] as Land, 'RE' as Art,[daId], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTAImportNew] inner join adressen on Kundennummer = UTAKundenNr where 1 = 1 " & IIf(kdNr > 0, " AND [AdressenNr]=" & kdNr, "") & " and [Rechnungsdatum] " & setSQLWhere(SDLNrTmp, "Lieferland_ISO2") & " group by [Rechnungsnummer_pro_Lieferland],[Rechnungsdatum],Kundennummer,[daId],[Lieferland_ISO2] UNION ALL SELECT 'UTA',-1, [Datum], cast([RechnungsNr] as nvarchar) ,[KundenNr],0,0,0,'',[DocumentTyp],[daId], cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblUTADocuments] inner join adressen on KundenNr = UTAKundenNr where AdressenNr = " & kdNr & " AND Datum " & setSQLWhere(SDLNrTmp, "") & " --order by Rechnungsnummer desc
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
--VERAG
|
--VERAG
|
||||||
|
|
||||||
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'VERAG' as Lieferant, tblTrdinInvoice.Rechnungsdatum, cast(tblTrdinInvoice.Rechnungsnummer as nvarchar) as Rechnungsnummer ,tblTrdinInvoice.KundenNrZentrale as Kundennummer, tblTrdinInvoice.SteuerpflichtigerBetragLokal + tblTrdinInvoice.SteuerfreierBetragLokal as Bruttobetrag ,tblTrdinInvoice.SteuerpflichtigerBetragLokal + tblTrdinInvoice.SteuerfreierBetragLokal - tblTrdinInvoice.SteuerbetragLokal as Nettobetrag ,tblTrdinInvoice.SteuerbetragLokal as MWST, 'AT' as Land, 'RE' as Art, 1 as daId, cast(1 as bit) PDFvorhanden FROM tblTrdinInvoice WHERE 1 = 1 " & IIf(kdNr > 0, " AND tblTrdinInvoice.RechnungsKundenNr=" & kdNr, "") & " and tblTrdinInvoice.Rechnungsdatum " & setSQLWhere(SDLNrTmp, "'AT'") & " AND tblTrdinInvoice.FilialenNr = 4814 ORDER BY tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer
|
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'VERAG' as Lieferant,-1 as invoice_id, tblTrdinInvoice.Rechnungsdatum, cast(tblTrdinInvoice.Rechnungsnummer as nvarchar) as Rechnungsnummer ,tblTrdinInvoice.KundenNrZentrale as Kundennummer, tblTrdinInvoice.SteuerpflichtigerBetragLokal + tblTrdinInvoice.SteuerfreierBetragLokal as Bruttobetrag ,tblTrdinInvoice.SteuerpflichtigerBetragLokal + tblTrdinInvoice.SteuerfreierBetragLokal - tblTrdinInvoice.SteuerbetragLokal as Nettobetrag ,tblTrdinInvoice.SteuerbetragLokal as MWST, 'AT' as Land, 'RE' as Art, 1 as daId, cast(1 as bit) PDFvorhanden FROM tblTrdinInvoice WHERE 1 = 1 " & IIf(kdNr > 0, " AND tblTrdinInvoice.RechnungsKundenNr=" & kdNr, "") & " and tblTrdinInvoice.Rechnungsdatum " & setSQLWhere(SDLNrTmp, "'AT'") & " AND tblTrdinInvoice.FilialenNr = 4814 ORDER BY tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer
|
||||||
|
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
--PLOSE
|
--PLOSE
|
||||||
|
|
||||||
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'PLOSE' as Lieferant, [plInv_SupplierRechnungsDatum] as Rechnungsdatum, cast([plInv_SupplierRechnungsNr] as nvarchar) as Rechnungsnummer,[plInv_PLOSEKundennummer] as Kundennummer,[plInv_Bruttobetrag] as Bruttobetrag,[plInv_Nettobetrag] as Nettobetrag,[plInv_MWSTBetrag] as MWST, [plInv_SupplierCountry] as Land, 'RE' as Art,[plInv_daId] as daId, cast(case when [plInv_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblPLOSE_Inv_Data inner join Adressen on Adressen.PLOSEKundenNr = plInv_PLOSEKundennummer where 1 = 1 " & IIf(kdNr > 0, " AND Adressen.AdressenNr=" & kdNr, "") & " and [plInv_SupplierRechnungsDatum] " & setSQLWhere(SDLNrTmp, "plInv_SupplierCountry") & " Order by plInv_SupplierRechnungsDatum desc, [plInv_SupplierRechnungsNr]
|
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'PLOSE' as Lieferant,-1 as invoice_id, [plInv_SupplierRechnungsDatum] as Rechnungsdatum, cast([plInv_SupplierRechnungsNr] as nvarchar) as Rechnungsnummer,[plInv_PLOSEKundennummer] as Kundennummer,[plInv_Bruttobetrag] as Bruttobetrag,[plInv_Nettobetrag] as Nettobetrag,[plInv_MWSTBetrag] as MWST, [plInv_SupplierCountry] as Land, 'RE' as Art,[plInv_daId] as daId, cast(case when [plInv_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM tblPLOSE_Inv_Data inner join Adressen on Adressen.PLOSEKundenNr = plInv_PLOSEKundennummer where 1 = 1 " & IIf(kdNr > 0, " AND Adressen.AdressenNr=" & kdNr, "") & " and [plInv_SupplierRechnungsDatum] " & setSQLWhere(SDLNrTmp, "plInv_SupplierCountry") & " Order by plInv_SupplierRechnungsDatum desc, [plInv_SupplierRechnungsNr]
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
--RMC
|
--RMC
|
||||||
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'RMC' as Lieferant, [rmc_reDatum] as Rechnungsdatum,cast([rmc_reNr] as nvarchar) as Rechnungsnummer,rmc_kdNr as Kundennummer ,[rmc_betragBrutto] as Bruttobetrag,[rmc_betragNetto] as Nettobetrag,[rmc_betragMWST] as MWST, rmc_landKZ as Land, 'RE' as Art, [rmc_daId] as daId, cast(case when [rmc_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblRMCImport] inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr where 1 = 1 " & IIf(kdNr > 0, " AND AdressenNr=" & kdNr, "") & " and [rmc_reDatum] " & setSQLWhere(SDLNrTmp, "rmc_landKZ") & " order by rmc_reDatum, rmc_reNr
|
SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") & " 'RMC' as Lieferant,-1 as invoice_id, [rmc_reDatum] as Rechnungsdatum,cast([rmc_reNr] as nvarchar) as Rechnungsnummer,rmc_kdNr as Kundennummer ,[rmc_betragBrutto] as Bruttobetrag,[rmc_betragNetto] as Nettobetrag,[rmc_betragMWST] as MWST, rmc_landKZ as Land, 'RE' as Art, [rmc_daId] as daId, cast(case when [rmc_daId] is not null then 1 else 0 end as bit) as PDFvorhanden FROM [VERAG].[dbo].[tblRMCImport] inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr where 1 = 1 " & IIf(kdNr > 0, " AND AdressenNr=" & kdNr, "") & " and [rmc_reDatum] " & setSQLWhere(SDLNrTmp, "rmc_landKZ") & " order by rmc_reDatum, rmc_reNr
|
||||||
|
|
||||||
) as temp where 1=1 and temp.Rechnungsdatum" & setSQLWhere(SDLNrTmp, "temp.Land", True) & " order by Rechnungsdatum desc"
|
) as temp where 1=1 and temp.Rechnungsdatum" & setSQLWhere(SDLNrTmp, "temp.Land", True) & " order by Rechnungsdatum desc"
|
||||||
|
|
||||||
@@ -296,7 +298,12 @@ Public Class usrcntlFremdrechnungen
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If .Columns.Contains("invoice_id") Then
|
||||||
|
.Columns("invoice_id").Visible = False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
End With
|
End With
|
||||||
|
|
||||||
@@ -305,32 +312,47 @@ Public Class usrcntlFremdrechnungen
|
|||||||
dgvLFRechnung.Width = 100
|
dgvLFRechnung.Width = 100
|
||||||
dgvLFRechnung.Height = 100
|
dgvLFRechnung.Height = 100
|
||||||
dgvLFRechnung.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
|
dgvLFRechnung.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
|
||||||
|
dgvLFRechnung.Rows(0).Frozen = True
|
||||||
|
|
||||||
|
|
||||||
initDGVWidth() 'vor Filter, damit richtige Größe
|
initDGVWidth() 'vor Filter, damit richtige Größe
|
||||||
|
|
||||||
setPDFImages()
|
setPDFImages()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function setSQLWhere(SDLNrTmp As Integer, land As String, Optional alle As Boolean = False) As String
|
Private Function setSQLWhere(aktLieferant As String, land As String, Optional alle As Boolean = False) As String
|
||||||
|
|
||||||
|
|
||||||
Dim SQLWhere = " between '" & dat_Sum_Von.Value.ToShortDateString & "' and '" & dat_Sum_Bis.Value.ToShortDateString & "'"
|
Dim SQLWhere = " between '" & dat_Sum_Von.Value.ToShortDateString & "' and '" & dat_Sum_Bis.Value.ToShortDateString & "'"
|
||||||
|
|
||||||
If cbx.Checked AndAlso SDLNrTmp <> 100 AndAlso KUNDE IsNot Nothing Then
|
If cbx.Checked AndAlso aktLieferant <> "IDS" AndAlso KUNDE IsNot Nothing Then
|
||||||
|
|
||||||
'ORIGINAL-RECHNUNG senden wenn:
|
'ORIGINAL-RECHNUNG senden wenn:
|
||||||
'1. wenn die Rechnung in dem Land in dem er ansässig ist ausgestellt wurde (rumän. Kunde – Rechnung ausgestellt in Rumänien = z.B. IDS in RO getankt…)
|
'1. wenn die Rechnung in dem Land in dem er ansässig ist ausgestellt wurde (rumän. Kunde – Rechnung ausgestellt in Rumänien = z.B. IDS in RO getankt…)
|
||||||
If land <> "" Then SQLWhere &= " AND " & land & " not in ('" & KUNDE.LandKz & "')"
|
If land <> "" Then
|
||||||
|
|
||||||
|
If KUNDE.LandKz <> "" Then
|
||||||
|
Dim landKZiso2 = ""
|
||||||
|
If KUNDE.LandKz.Length = 2 Then
|
||||||
|
landKZiso2 = KUNDE.LandKz
|
||||||
|
ElseIf KUNDE.LandKz.Length = 3 Then
|
||||||
|
landKZiso2 = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO3Land(KUNDE.LandKz)
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
SQLWhere &= " AND " & land & " not in ('" & landKZiso2 & "')"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'2. wenn die Rechnung die Summe NULL aufweist
|
'2. wenn die Rechnung die Summe NULL aufweist
|
||||||
|
|
||||||
Select Case SDLNrTmp
|
Select Case aktLieferant
|
||||||
Case 212 And Not alle : SQLWhere &= " AND Gesamtbetrag_Brutto_in_Darstellwährung <> 0" 'UTA
|
Case "UTA" : If Not alle Then SQLWhere &= " AND Gesamtbetrag_Brutto_in_Darstellwährung <> 0" 'UTA
|
||||||
Case 214 And Not alle : SQLWhere &= " AND plInv_Bruttobetrag <> 0" 'PLOSE
|
Case "PLOSE" : If Not alle Then SQLWhere &= " AND plInv_Bruttobetrag <> 0" 'PLOSE
|
||||||
Case 502 And Not alle : SQLWhere &= " AND (tblTrdinInvoice.SteuerpflichtigerBetragLokal + tblTrdinInvoice.SteuerfreierBetragLokal) <> 0" 'VERAG
|
Case "VERAG" : If Not alle Then SQLWhere &= " AND (tblTrdinInvoice.SteuerpflichtigerBetragLokal + tblTrdinInvoice.SteuerfreierBetragLokal) <> 0" 'VERAG
|
||||||
Case 208 And Not alle : SQLWhere &= " AND total_amount_euro <> 0" 'MSE
|
Case "MSE" : If Not alle Then SQLWhere &= " AND total_amount_euro <> 0" 'MSE
|
||||||
Case 999 And Not alle : SQLWhere &= " AND rmc_betragBrutto <> 0" 'RMC
|
Case "RMC" : If Not alle Then SQLWhere &= " AND rmc_betragBrutto <> 0" 'RMC
|
||||||
Case -1 And alle : SQLWhere &= " AND temp.Nettobetrag <> 0" 'ALLE
|
Case "ALLE" : If alle Then SQLWhere &= " AND temp.Nettobetrag <> 0" 'ALLE
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
'3. Rechnungen der Länder in denen der Kunde keine MWST erstattet bekommt
|
'3. Rechnungen der Länder in denen der Kunde keine MWST erstattet bekommt
|
||||||
@@ -353,68 +375,109 @@ Public Class usrcntlFremdrechnungen
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function setSQLDetailWhere(aktLieferant As String, land As String, Optional alle As Boolean = False) As String
|
||||||
|
|
||||||
|
|
||||||
|
Dim SQLWhere = ""
|
||||||
|
|
||||||
|
If cbx.Checked AndAlso KUNDE IsNot Nothing Then
|
||||||
|
|
||||||
|
'ORIGINAL-RECHNUNG senden wenn:
|
||||||
|
'1. wenn die Rechnung in dem Land in dem er ansässig ist ausgestellt wurde (rumän. Kunde – Rechnung ausgestellt in Rumänien = z.B. IDS in RO getankt…)
|
||||||
|
If land <> "" Then
|
||||||
|
If KUNDE.LandKz <> "" Then
|
||||||
|
Dim landKZiso2 = ""
|
||||||
|
If KUNDE.LandKz.Length = 2 Then
|
||||||
|
landKZiso2 = KUNDE.LandKz
|
||||||
|
ElseIf KUNDE.LandKz.Length = 3 Then
|
||||||
|
landKZiso2 = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO3Land(KUNDE.LandKz)
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
SQLWhere &= " AND " & land & " not in ('" & landKZiso2 & "')"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'2. wenn die Rechnung die Summe NULL aufweist
|
||||||
|
|
||||||
|
Select Case aktLieferant
|
||||||
|
Case "IDS" : If Not alle Then SQLWhere &= " AND [AmminclVAT] <> 0" 'IDS
|
||||||
|
End Select
|
||||||
|
|
||||||
|
'3. Rechnungen der Länder in denen der Kunde keine MWST erstattet bekommt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'4. Rechnungen der Länder, in denen der Kunde selber MWST beantragt
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return SQLWhere
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Function getSDLNrButton(SDLNrTmp) As Object
|
Function getSDLNrButton(SDLNrTmp) As Object
|
||||||
Select Case SDLNrTmp
|
Select Case SDLNrTmp
|
||||||
Case 100 : Return btnSDL_IDS
|
Case "IDS" : Return btnSDL_IDS
|
||||||
Case 212 : Return btnSDL_UTA
|
Case "UTA" : Return btnSDL_UTA
|
||||||
Case 213 : Return btnSDL_Hugo
|
Case "HUGO" : Return btnSDL_Hugo
|
||||||
Case 214 : Return btnSDL_PLOSE
|
Case "PLOSE" : Return btnSDL_PLOSE
|
||||||
Case 208 : Return btnSDL_MautMSE
|
Case "MSE" : Return btnSDL_MautMSE
|
||||||
Case 207 : Return btnSDL_FREJUS
|
Case "FREJUS" : Return btnSDL_FREJUS
|
||||||
Case 502 : Return btnVERAGCardNew
|
Case "VERAG" : Return btnVERAGCardNew
|
||||||
Case 999 : Return btnSDL_RMC
|
Case "RMC" : Return btnSDL_RMC
|
||||||
Case Else : Return btnSDL_Alle
|
Case Else : Return btnSDL_Alle
|
||||||
End Select
|
End Select
|
||||||
End Function
|
End Function
|
||||||
Private Sub btnSDL_Alle_Click(sender As Object, e As EventArgs) Handles btnSDL_Alle.Click
|
Private Sub btnSDL_Alle_Click(sender As Object, e As EventArgs) Handles btnSDL_Alle.Click
|
||||||
SET_SDL(-1)
|
SET_SDL("ALLE")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_IDS_Click(sender As Object, e As EventArgs) Handles btnSDL_IDS.Click
|
Private Sub btnSDL_IDS_Click(sender As Object, e As EventArgs) Handles btnSDL_IDS.Click
|
||||||
SET_SDL(100)
|
SET_SDL("IDS")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_UTA_Click(sender As Object, e As EventArgs) Handles btnSDL_UTA.Click
|
Private Sub btnSDL_UTA_Click(sender As Object, e As EventArgs) Handles btnSDL_UTA.Click
|
||||||
SET_SDL(212)
|
SET_SDL("UTA")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_Hugo_Click(sender As Object, e As EventArgs) Handles btnSDL_Hugo.Click
|
Private Sub btnSDL_Hugo_Click(sender As Object, e As EventArgs) Handles btnSDL_Hugo.Click
|
||||||
SET_SDL(213)
|
SET_SDL("HUGO")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_PLOSE_Click(sender As Object, e As EventArgs) Handles btnSDL_PLOSE.Click
|
Private Sub btnSDL_PLOSE_Click(sender As Object, e As EventArgs) Handles btnSDL_PLOSE.Click
|
||||||
SET_SDL(214)
|
SET_SDL("PLOSE")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Private Sub btnSDL_MautMSE_Click(sender As Object, e As EventArgs) Handles btnSDL_MautMSE.Click
|
Private Sub btnSDL_MautMSE_Click(sender As Object, e As EventArgs) Handles btnSDL_MautMSE.Click
|
||||||
SET_SDL(208)
|
SET_SDL("MSE")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_MotorWay_Click(sender As Object, e As EventArgs)
|
Private Sub btnSDL_MotorWay_Click(sender As Object, e As EventArgs)
|
||||||
SET_SDL(205)
|
SET_SDL("MW")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_FREJUS_Click(sender As Object, e As EventArgs) Handles btnSDL_FREJUS.Click
|
Private Sub btnSDL_FREJUS_Click(sender As Object, e As EventArgs) Handles btnSDL_FREJUS.Click
|
||||||
SET_SDL(207)
|
SET_SDL("FREJUS")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnVERAGCardNew_Click(sender As Object, e As EventArgs) Handles btnVERAGCardNew.Click
|
Private Sub btnVERAGCardNew_Click(sender As Object, e As EventArgs) Handles btnVERAGCardNew.Click
|
||||||
SET_SDL(502)
|
SET_SDL("VERAG")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSDL_RMC_Click(sender As Object, e As EventArgs) Handles btnSDL_RMC.Click
|
Private Sub btnSDL_RMC_Click(sender As Object, e As EventArgs) Handles btnSDL_RMC.Click
|
||||||
SET_SDL(999)
|
SET_SDL("RMC")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Sub newBinding(sdlNr As Integer, ByVal sql As String)
|
Sub newBinding(aktLieferant As String, ByVal sql As String)
|
||||||
dgvInitWait = True
|
dgvInitWait = True
|
||||||
' bindingSDL = Nothing
|
' bindingSDL = Nothing
|
||||||
dgvLFRechnung.Columns.Clear()
|
dgvLFRechnung.Columns.Clear()
|
||||||
@@ -429,7 +492,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
dgvLFRechnung.LOAD()
|
dgvLFRechnung.LOAD()
|
||||||
|
|
||||||
lblEinträge.Text = dgvLFRechnung.RowCount & " Einträge"
|
lblEinträge.Text = dgvLFRechnung.RowCount & " Einträge"
|
||||||
If dgvLFRechnung.RowCount >= 200 Then lblEinträge.Text = dgvLFRechnung.RowCount & " Einträge " & IIf(cbxMax1000Eintrage.Checked, "(Anzeige auf 200 beschränkt)", "")
|
If dgvLFRechnung.RowCount >= 200 Then lblEinträge.Text = dgvLFRechnung.RowCount & " Einträge " & IIf(cbxMax1000Eintrage.Checked, "(Anzeige auf 1000 beschränkt)", "")
|
||||||
|
|
||||||
dgvInitWait = False
|
dgvInitWait = False
|
||||||
|
|
||||||
@@ -460,11 +523,11 @@ Public Class usrcntlFremdrechnungen
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub reClick()
|
Sub reClick()
|
||||||
getSDLNrButton(aktSDLNr).PerformClick()
|
getSDLNrButton(aktLieferant).PerformClick()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub refreshDgv(kdNr, SDLNr, Optional Kfz = "", Optional History = "")
|
Sub refreshDgv(kdNr, SDLNr, Optional Kfz = "", Optional History = "")
|
||||||
SET_SDL(aktSDLNr)
|
SET_SDL(aktLieferant)
|
||||||
|
|
||||||
dgvLFRechnung.ClearSelection()
|
dgvLFRechnung.ClearSelection()
|
||||||
If Kfz <> "" And History <> "" Then
|
If Kfz <> "" And History <> "" Then
|
||||||
@@ -505,7 +568,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub dgvSDL_SelectionChanged(sender As Object, e As EventArgs) Handles dgvLFRechnung.Click
|
Private Sub dgvSDL_SelectionChanged(sender As Object, e As EventArgs) Handles dgvLFRechnung.Click
|
||||||
'ReloadLeistung()
|
ReloadRechnungsdetails()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
@@ -517,7 +580,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
Dim TextHTMLtable = ""
|
Dim TextHTMLtable = ""
|
||||||
|
|
||||||
TextHTMLtable &= "<table border=1>"
|
TextHTMLtable &= "<table border=1>"
|
||||||
TextHTMLtable &= "<tr><td>Lieferant</td><td>Land</td><td>Datum</td></tr>"
|
TextHTMLtable &= "<tr><td>Supplier</td><td>Country</td><td>Date</td></tr>"
|
||||||
|
|
||||||
Dim pdflist As New List(Of String)
|
Dim pdflist As New List(Of String)
|
||||||
For Each row In dgvLFRechnung.SelectedRows
|
For Each row In dgvLFRechnung.SelectedRows
|
||||||
@@ -528,15 +591,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
If dgvLFRechnung.Columns.Contains("Lieferant") Then
|
If dgvLFRechnung.Columns.Contains("Lieferant") Then
|
||||||
Lieferant = row.Cells("Lieferant").Value
|
Lieferant = row.Cells("Lieferant").Value
|
||||||
Else
|
Else
|
||||||
Select Case aktSDLNr
|
Lieferant = aktLieferant
|
||||||
Case 100 : Lieferant = "IDS"
|
|
||||||
Case 212 : Lieferant = "UTA"
|
|
||||||
Case 214 : Lieferant = "PLOSE"
|
|
||||||
Case 208 : Lieferant = "MSE"
|
|
||||||
Case 502 : Lieferant = "VERAG"
|
|
||||||
Case 999 : Lieferant = "RMC"
|
|
||||||
End Select
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Lieferant = "VERAG" Then
|
If Lieferant = "VERAG" Then
|
||||||
@@ -550,16 +605,43 @@ Public Class usrcntlFremdrechnungen
|
|||||||
' cFakturierung.doRechnungsDruck_SRorER(da_id,, False, 3)
|
' cFakturierung.doRechnungsDruck_SRorER(da_id,, False, 3)
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
If Lieferant = "IDS" Then
|
||||||
|
|
||||||
|
Dim dt As New DataTable
|
||||||
|
dt = initDGVRechnungsdetails(row.Cells("invoice_id").value, True)
|
||||||
|
|
||||||
|
For Each r As DataRow In dt.Rows
|
||||||
|
|
||||||
TextHTMLtable &= "<tr>"
|
TextHTMLtable &= "<tr>"
|
||||||
TextHTMLtable &= "<td><b>" & IIf(dgvLFRechnung.Columns.Contains("Lieferant"), row.Cells("Lieferant").Value, Lieferant) & "</b></td>"
|
TextHTMLtable &= "<td><b>" & Lieferant & "</b></td>"
|
||||||
|
TextHTMLtable &= "<td><b>" & r.Item("Land") & "</b></td>"
|
||||||
|
TextHTMLtable &= "<td><b>" & r.Item("Rechnungsdatum") & "</b></td>"
|
||||||
|
TextHTMLtable &= "</tr>"
|
||||||
|
|
||||||
|
Dim daId = r.Item("daId")
|
||||||
|
If daId > 0 Then
|
||||||
|
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId)
|
||||||
|
pdflist.Add(DS.GET_TOP1_PATH())
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Else
|
||||||
|
TextHTMLtable &= "<tr>"
|
||||||
|
TextHTMLtable &= "<td><b>" & Lieferant & "</b></td>"
|
||||||
TextHTMLtable &= "<td><b>" & row.Cells("Land").Value & "</b></td>"
|
TextHTMLtable &= "<td><b>" & row.Cells("Land").Value & "</b></td>"
|
||||||
TextHTMLtable &= "<td><b>" & row.Cells("Rechnungsdatum").Value & "</b></td>"
|
TextHTMLtable &= "<td><b>" & row.Cells("Rechnungsdatum").Value & "</b></td>"
|
||||||
TextHTMLtable &= "</tr>"
|
TextHTMLtable &= "</tr>"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim daId = row.Cells("daId").Value
|
Dim daId = row.Cells("daId").Value
|
||||||
If daId > 0 Then
|
If daId > 0 Then
|
||||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId)
|
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId)
|
||||||
@@ -568,6 +650,10 @@ Public Class usrcntlFremdrechnungen
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
@@ -689,7 +775,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
|
|
||||||
Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click
|
Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click
|
||||||
|
|
||||||
SET_SDL(aktSDLNr)
|
SET_SDL(aktLieferant)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
@@ -717,8 +803,8 @@ Public Class usrcntlFremdrechnungen
|
|||||||
Try
|
Try
|
||||||
If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then
|
If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then
|
||||||
|
|
||||||
Select Case aktSDLNr
|
Select Case aktLieferant
|
||||||
Case 502 'VERAG
|
Case "VERAG"
|
||||||
Dim ReDat = dgvLFRechnung.Rows(e.RowIndex).Cells("Rechnungsdatum").Value
|
Dim ReDat = dgvLFRechnung.Rows(e.RowIndex).Cells("Rechnungsdatum").Value
|
||||||
Dim ReNr = dgvLFRechnung.Rows(e.RowIndex).Cells("Rechnungsnummer").Value
|
Dim ReNr = dgvLFRechnung.Rows(e.RowIndex).Cells("Rechnungsnummer").Value
|
||||||
|
|
||||||
@@ -728,7 +814,7 @@ Public Class usrcntlFremdrechnungen
|
|||||||
cFakturierung.doRechnungsDruck_SRorER(da_id,, False, 3)
|
cFakturierung.doRechnungsDruck_SRorER(da_id,, False, 3)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Case -1 'ALLE
|
Case "ALLE"
|
||||||
Dim Lieferant = dgvLFRechnung.Rows(e.RowIndex).Cells("Lieferant").Value
|
Dim Lieferant = dgvLFRechnung.Rows(e.RowIndex).Cells("Lieferant").Value
|
||||||
|
|
||||||
If Lieferant = "VERAG" Then
|
If Lieferant = "VERAG" Then
|
||||||
@@ -780,11 +866,11 @@ Public Class usrcntlFremdrechnungen
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub dat_Sum_Von_Leave(sender As Object, e As EventArgs) Handles dat_Sum_Von.Leave, dat_Sum_Bis.Leave
|
Private Sub dat_Sum_Von_Leave(sender As Object, e As EventArgs) Handles dat_Sum_Von.Leave, dat_Sum_Bis.Leave
|
||||||
SET_SDL(aktSDLNr)
|
SET_SDL(aktLieferant)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub cbx_CheckedChanged(sender As Object, e As EventArgs) Handles cbx.CheckedChanged
|
Private Sub cbx_CheckedChanged(sender As Object, e As EventArgs) Handles cbx.CheckedChanged
|
||||||
SET_SDL(aktSDLNr)
|
SET_SDL(aktLieferant)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Button2_Click(sender As Object, e As EventArgs)
|
Private Sub Button2_Click(sender As Object, e As EventArgs)
|
||||||
@@ -857,4 +943,117 @@ Public Class usrcntlFremdrechnungen
|
|||||||
End With
|
End With
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Sub ReloadRechnungsdetails()
|
||||||
|
|
||||||
|
|
||||||
|
' MsgBox(dgvInitWait)
|
||||||
|
If Not dgvInitWait Then
|
||||||
|
Try
|
||||||
|
If dgvLFRechnung.SelectedRows.Count > 0 AndAlso (aktLieferant = "IDS" Or aktLieferant = "ALLE") Then
|
||||||
|
dgvDetails.Visible = True
|
||||||
|
If Not SplitContainer1.Panel2Collapsed Then
|
||||||
|
|
||||||
|
Select Case aktLieferant
|
||||||
|
Case "IDS" : initDGVRechnungsdetails(dgvLFRechnung.SelectedRows(0).Cells("invoice_id").Value)
|
||||||
|
Case "ALLE" : If dgvLFRechnung.Columns.Contains("Lieferant") AndAlso dgvLFRechnung.SelectedRows(0).Cells("Lieferant").Value = "IDS" Then initDGVRechnungsdetails(dgvLFRechnung.SelectedRows(0).Cells("invoice_id").Value)
|
||||||
|
End Select
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
dgvDetails.Visible = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
'Neuer eintrag
|
||||||
|
MsgBox(ex.Message & ex.StackTrace)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Function initDGVRechnungsdetails(rechnugnsID As Integer, Optional setDatatable As Boolean = False) As DataTable
|
||||||
|
|
||||||
|
Dim sql = " select [YearMonthDay] as Rechnungsdatum,[Invoicenumber] as Rechnungsnummer, CustomerCode as Kundennummer,[daId],[TransactionVolume] as Transaktionsmenge,[AmminclVAT] as Bruttobetrag,[TotalNetAmount] as Nettobetrag,[VATAmount] as MWSt,
|
||||||
|
cast(case when [daId] is not null then 1 else 0 end as bit) as PDFvorhanden,[Country] as Land
|
||||||
|
FROM [VERAG].[dbo].[tblIDSInvoicesNewSplittedByCountry] WHERE [TotalInvoiceId] = " & rechnugnsID & setSQLDetailWhere(aktLieferant, "Country")
|
||||||
|
|
||||||
|
If setDatatable Then
|
||||||
|
|
||||||
|
Dim dtRechnugnsdet As DataTable = (New SQL).loadDgvBySql(sql, "FMZOLL")
|
||||||
|
Return dtRechnugnsdet
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
With dgvDetails
|
||||||
|
|
||||||
|
.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
|
||||||
|
.SET_SQL(sql, "FMZOLL")
|
||||||
|
.LOAD()
|
||||||
|
.ClearSelection()
|
||||||
|
|
||||||
|
Dim c As New DataGridViewImageColumn
|
||||||
|
c.Name = "PDF" : c.HeaderText = "PDF"
|
||||||
|
c.DefaultCellStyle.NullValue = Nothing
|
||||||
|
c.ImageLayout = DataGridViewImageCellLayout.Zoom
|
||||||
|
c.Width = 40
|
||||||
|
c.DefaultCellStyle.Padding = New Padding(2)
|
||||||
|
c.DefaultCellStyle.BackColor = Color.White
|
||||||
|
c.Image = My.Resources.pdf_gray
|
||||||
|
|
||||||
|
|
||||||
|
If Not .Columns.Contains("PDF") Then .Columns.Add(c)
|
||||||
|
|
||||||
|
If .Columns.Count > 0 Then
|
||||||
|
|
||||||
|
For Each r As DataGridViewRow In .Rows
|
||||||
|
|
||||||
|
If IsDBNull(r.Cells("daId").Value) OrElse r.Cells("daId").Value = 0 Then
|
||||||
|
DirectCast(r.Cells("PDF"), DataGridViewImageCell).Value = My.Resources.pdf_gray
|
||||||
|
End If
|
||||||
|
|
||||||
|
If .Columns.Contains("daId") Then
|
||||||
|
If .Columns("daId") IsNot Nothing Then .Columns("daId").Visible = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End With
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub dgvDetails_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDetails.CellContentDoubleClick
|
||||||
|
|
||||||
|
|
||||||
|
Try
|
||||||
|
If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then
|
||||||
|
|
||||||
|
|
||||||
|
Dim daId = dgvDetails.Rows(e.RowIndex).Cells("daId").Value
|
||||||
|
If daId > 0 Then
|
||||||
|
Me.Cursor = Cursors.WaitCursor
|
||||||
|
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId)
|
||||||
|
DS.OPEN_SINGLE()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
Me.Cursor = Cursors.Default
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Me.Cursor = Cursors.Default
|
||||||
|
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -376,7 +376,6 @@ Public Class usrcntlPDFScanList
|
|||||||
ElseIf files.Count > 0 Then
|
ElseIf files.Count > 0 Then
|
||||||
If files(0) <> "" Then
|
If files(0) <> "" Then
|
||||||
Dim fio As New System.IO.FileInfo(files(0))
|
Dim fio As New System.IO.FileInfo(files(0))
|
||||||
|
|
||||||
If DS.uploadDataToDATENSERVER(files(0), fio.Name, ".pdf") Then
|
If DS.uploadDataToDATENSERVER(files(0), fio.Name, ".pdf") Then
|
||||||
RaiseEvent FileAdded(DS.da_id, DS.GET_TOP1_PATH, DS.da_name)
|
RaiseEvent FileAdded(DS.da_id, DS.GET_TOP1_PATH, DS.da_name)
|
||||||
MsgBox("Dokument wurde hochgeladen.")
|
MsgBox("Dokument wurde hochgeladen.")
|
||||||
|
|||||||
@@ -664,6 +664,173 @@ End Class
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public Class cIDSInvoiceSplittedByCountry
|
||||||
|
|
||||||
|
Property invoice_id As Integer
|
||||||
|
Property YearMonthDay As Object = Nothing
|
||||||
|
Property CustomerCode As Object = Nothing
|
||||||
|
Property TotalInvoiceId As Object = Nothing
|
||||||
|
Property Country As Object = Nothing
|
||||||
|
Property Invoicenumber As Object = Nothing
|
||||||
|
Property DocumentName As Object = Nothing
|
||||||
|
Property Zeitstempel As Object = Nothing
|
||||||
|
Property daid As Object = Nothing
|
||||||
|
Property archiv As Boolean
|
||||||
|
Property archiviertDatum As Object = Nothing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public hasEntry = False
|
||||||
|
|
||||||
|
Dim SQL As New SQL
|
||||||
|
|
||||||
|
Sub New()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub New(invoice_id)
|
||||||
|
Me.invoice_id = invoice_id
|
||||||
|
LOADID()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub New(YearMonthDay, CustomerCode, Invoicenumber, Country)
|
||||||
|
Me.YearMonthDay = YearMonthDay
|
||||||
|
Me.Invoicenumber = Invoicenumber
|
||||||
|
Me.CustomerCode = CustomerCode
|
||||||
|
Me.Country = Country
|
||||||
|
LOAD()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
|
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("invoice_id", invoice_id,, True))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("YearMonthDay", YearMonthDay))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("TotalInvoiceId", TotalInvoiceId))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CustomerCode", CustomerCode))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Invoicenumber", Invoicenumber))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("DocumentName", DocumentName))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Country", Country))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Zeitstempel", Zeitstempel))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("daid", daid))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("archiv", archiv))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("archiviertDatum", archiviertDatum))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return list
|
||||||
|
End Function
|
||||||
|
Public Function SAVE() As Boolean
|
||||||
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
|
||||||
|
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country) " &
|
||||||
|
" BEGIN " & getUpdateCmd() & " END " &
|
||||||
|
" Else " &
|
||||||
|
" BEGIN " & getInsertCmd() & " END " &
|
||||||
|
" commit tran "
|
||||||
|
|
||||||
|
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
|
||||||
|
End Function
|
||||||
|
Public Sub LOADID()
|
||||||
|
Try
|
||||||
|
hasEntry = False
|
||||||
|
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||||
|
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE invoice_id=@invoice_id ", conn)
|
||||||
|
cmd.Parameters.AddWithValue("@invoice_id", invoice_id)
|
||||||
|
Dim dr = cmd.ExecuteReader()
|
||||||
|
If dr.Read Then
|
||||||
|
For Each li In getParameterList()
|
||||||
|
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||||
|
|
||||||
|
If dr.Item(li.Text) Is DBNull.Value Then
|
||||||
|
propInfo.SetValue(Me, Nothing)
|
||||||
|
Else
|
||||||
|
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
hasEntry = True
|
||||||
|
End If
|
||||||
|
dr.Close()
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Sub LOAD()
|
||||||
|
Try
|
||||||
|
hasEntry = False
|
||||||
|
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||||
|
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country", conn)
|
||||||
|
cmd.Parameters.AddWithValue("@YearMonthDay", YearMonthDay)
|
||||||
|
cmd.Parameters.AddWithValue("@Invoicenumber", Invoicenumber)
|
||||||
|
cmd.Parameters.AddWithValue("@CustomerCode", CustomerCode)
|
||||||
|
cmd.Parameters.AddWithValue("@Country", Country)
|
||||||
|
|
||||||
|
Dim dr = cmd.ExecuteReader()
|
||||||
|
If dr.Read Then
|
||||||
|
For Each li In getParameterList()
|
||||||
|
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||||
|
|
||||||
|
If dr.Item(li.Text) Is DBNull.Value Then
|
||||||
|
propInfo.SetValue(Me, Nothing)
|
||||||
|
Else
|
||||||
|
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
hasEntry = True
|
||||||
|
End If
|
||||||
|
dr.Close()
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
Public Function getUpdateCmd() As String
|
||||||
|
Try
|
||||||
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
Dim str As String = ""
|
||||||
|
For Each i In list
|
||||||
|
If Not i.isPrimaryParam Then
|
||||||
|
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||||
|
Return (" UPDATE [tblIDSInvoicesNewSplittedByCountry] SET " & str & " WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country")
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
Public Function getInsertCmd() As String
|
||||||
|
Try
|
||||||
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
Dim str As String = ""
|
||||||
|
Dim values As String = ""
|
||||||
|
For Each i In list
|
||||||
|
If Not i.isPrimaryParam Then
|
||||||
|
str &= "[" & i.Text & "],"
|
||||||
|
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||||
|
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||||
|
Return (" INSERT INTO tblIDSInvoicesNewSplittedByCountry (" & str & ") VALUES(" & values & ") ")
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user