fremdrechnungen, etc.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Windows.Documents
|
||||
Imports com.sun.org.apache.xml.internal.utils
|
||||
Imports DAKOSY_Worker.InformationEXITDE
|
||||
Imports itextsharp.text.pdf
|
||||
Imports itextsharp.text.pdf.parser
|
||||
Imports Microsoft.Office.Interop
|
||||
@@ -43,7 +45,7 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
End Sub
|
||||
|
||||
Sub init(Optional Lieferant As String = "")
|
||||
Sub init(Optional posIndex As Integer = -1, Optional Lieferant As String = "")
|
||||
pnlBody.AutoScroll = False
|
||||
|
||||
lblGesamtUSteuerFW.Text = "-"
|
||||
@@ -265,7 +267,21 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
End If
|
||||
|
||||
If posIndex > 0 Then
|
||||
posIndex = posIndex - 1
|
||||
If posIndex > 0 And dgvUSTVPositionen.Rows.Count > posIndex Then
|
||||
dgvUSTVPositionen.ClearSelection()
|
||||
dgvUSTVPositionen.Rows(posIndex).Selected = True
|
||||
For Each c As DataGridViewCell In dgvUSTVPositionen.Rows(posIndex).Cells
|
||||
If c.Visible Then
|
||||
dgvUSTVPositionen.CurrentCell = c 'Damit der Cursor in der DGV richtig steht
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -375,7 +391,23 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
Private Sub UsrCntlDatenDetails1_Changed(POSId) Handles UstCntlUSTV_AntragPosition1.CHANGED
|
||||
'refreshDgv(kdNr, SDLNr, Kfz, History)'?????????????? ausgebelndet,was das ein VErsuch? 31.07.2017
|
||||
dgvUSTVPositionen.VALUE_CHANGED = True
|
||||
|
||||
Dim posIdinDGV As Boolean = False
|
||||
For Each r As DataGridViewRow In dgvUSTVPositionen.Rows
|
||||
If r.Cells("UStVPo_ID").Value = POSId Then
|
||||
posIdinDGV = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If posIdinDGV Then
|
||||
dgvUSTVPositionen.VALUE_CHANGED = True
|
||||
Else
|
||||
init(dgvUSTVPositionen.Rows.Count + 1)
|
||||
End If
|
||||
|
||||
'Dim dgvUSTVPositionen.
|
||||
'init()
|
||||
End Sub
|
||||
|
||||
Private Sub usrCntlUSTVA_Antrag_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
@@ -613,7 +645,7 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
Shared Function loadUSTVFrom_PLOSE(UStVAn_ID, Antrag_LandKz, ArchivierteEintracheNochmalsEinarbetien, MWSTSummenAusBeleg) As Boolean
|
||||
Try
|
||||
Dim bytSchnittstellenNr = 6
|
||||
Dim bytSchnittstellenNr = IIf(MWSTSummenAusBeleg, 11, 6)
|
||||
Dim USTV_ANTRAG As New VERAG_PROG_ALLGEMEIN.cUSTVAntrag(UStVAn_ID)
|
||||
Dim GET_Antraege = MDM_Worker.cPLOSE.GET_Antraege(USTV_ANTRAG.UStVAn_ReDatVon, USTV_ANTRAG.UStVAn_ReDatBis, USTV_ANTRAG.UStVAn_KuNr, Antrag_LandKz, ArchivierteEintracheNochmalsEinarbetien, MWSTSummenAusBeleg)
|
||||
|
||||
@@ -711,7 +743,7 @@ Public Class frmMDM_USTVAntrag
|
||||
End If
|
||||
|
||||
If USTV_POS.INSERT() Then
|
||||
If CDate(USTV_ANTRAG.UStVAn_ReDatVon).Year >= 2025 Then
|
||||
If bytSchnittstellenNr = 11 Then
|
||||
MDM_Worker.cPLOSE.UPDATE_ARCHIV_NEULOGIK(USTV_ANTRAG.UStVAn_ReDatVon, USTV_ANTRAG.UStVAn_ReDatBis, USTV_ANTRAG.UStVAn_KuNr, USTV_ANTRAG.UStVAn_ID, USTV_POS.UStVPo_ReNr, True)
|
||||
Else
|
||||
MDM_Worker.cPLOSE.UPDATE_ARCHIV(USTV_ANTRAG.UStVAn_ReDatVon, USTV_ANTRAG.UStVAn_ReDatBis, USTV_ANTRAG.UStVAn_KuNr, USTV_ANTRAG.UStVAn_ID, USTV_POS.UStVPo_ReNr, True)
|
||||
@@ -1038,7 +1070,7 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
USTV_POS.UStVPo_Schnittstelle = True
|
||||
|
||||
Dim Leistender As New cUStVLeistender("Union Tank Eckstein Gmbh&Co KG, Kleinostheim" & " " & Antrag_LandKz, Antrag_LandKz)
|
||||
Dim Leistender As New cUStVLeistender("Union Tank Eckstein Gmbh&Co KG" & " " & Antrag_LandKz, Antrag_LandKz)
|
||||
|
||||
If Leistender IsNot Nothing Then
|
||||
USTV_POS.UStVPo_LeistenderId = Leistender.UStV_LeistenderId
|
||||
@@ -1527,25 +1559,15 @@ Public Class frmMDM_USTVAntrag
|
||||
AND ([Gesamtbetrag_Brutto_in_Lieferlandwährung]-[Gesamtbetrag_Netto_in_Lieferlandwährung])<>0"
|
||||
If Not test Then updated = SQL.doSQL(sqlText, "FMZOLL")
|
||||
|
||||
Case 6 'PLOSE
|
||||
|
||||
If CDate(UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReDat).Year >= 2025 Then
|
||||
|
||||
sqlText = "Update [tblPLOSE_Inv_Data]
|
||||
set plInv_Archiv=0, [plInv_ArchiviertDatum]=NULL, plInv_UStVAn_ID = NULL
|
||||
From [tblPLOSE_Inv_Data] INNER Join Adressen On PLOSEKundenNr=plInv_PLOSEKundennummer
|
||||
WHERE cast(plInv_SupplierRechnungsDatum As Date) = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReDat & "' And AdressenNr=" & USTV_ANTRAG.UStVAn_KuNr & " AND [plInv_SupplierRechnungsNr] = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReNr & "'"
|
||||
Case 6 'PLOSE-alte Logik -> aus Transaktionen
|
||||
|
||||
|
||||
Else
|
||||
sqlText = "Update [tblPLOSE_Details]
|
||||
sqlText = "Update [tblPLOSE_Details]
|
||||
set plose_Archiv=0, [plose_ArchiviertDatum]=NULL, UStVAn_ID = NULL
|
||||
From [tblPLOSE_Details] INNER Join Adressen On PLOSEKundenNr=plose_POLSEKundennummer
|
||||
INNER Join [tblPLOSE_Produktbeschreibung] ON [plp_ProductCode]=[plose_ProduktCode]
|
||||
WHERE cast(plose_RechnungsDatum As Date) = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReDat & "' And AdressenNr=" & USTV_ANTRAG.UStVAn_KuNr & " AND plose_RechnungsNr = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReNr & "'
|
||||
And plose_LieferantCode IN (0,1,7,9) "
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not test Then updated = SQL.doSQL(sqlText, "FMZOLL")
|
||||
@@ -1578,6 +1600,15 @@ Public Class frmMDM_USTVAntrag
|
||||
sqlText = "UPDATE [tblUTAImportNew] set UStVAn_ID = NULL, archiv = 0, archiviertDatum = NULL from [tblUTAImportNew] INNER JOIN Adressen ON [tblUTAImportNew].Kundennummer = Adressen.UTAKundenNr WHERE cast(Rechnungsdatum as date) = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReDat & "' And Rechnungsnummer_pro_Lieferland = " & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReNr & " And Adressen.AdressenNr= " & USTV_ANTRAG.UStVAn_KuNr & " AND Lieferland_ISO2 = '" & UstCntlUSTV_AntragPosition1.Antrag_LandKz & "'"
|
||||
If Not test Then updated = SQL.doSQL(sqlText, "FMZOLL")
|
||||
|
||||
Case 11 'PLOSE-neue Logik -> aus Belegen
|
||||
|
||||
sqlText = "Update [tblPLOSE_Inv_Data]
|
||||
set plInv_Archiv=0, [plInv_ArchiviertDatum]=NULL, plInv_UStVAn_ID = NULL
|
||||
From [tblPLOSE_Inv_Data] INNER Join Adressen On PLOSEKundenNr=plInv_PLOSEKundennummer
|
||||
WHERE cast(plInv_SupplierRechnungsDatum As Date) = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReDat & "' And AdressenNr=" & USTV_ANTRAG.UStVAn_KuNr & " AND [plInv_SupplierRechnungsNr] = '" & UstCntlUSTV_AntragPosition1.UStV_POS.UStVPo_ReNr & "'"
|
||||
|
||||
If Not test Then updated = SQL.doSQL(sqlText, "FMZOLL")
|
||||
|
||||
End Select
|
||||
|
||||
If UstCntlUSTV_AntragPosition1.cboSchnittstellennr._value IsNot Nothing AndAlso (UstCntlUSTV_AntragPosition1.cboSchnittstellennr._value > 0 And UstCntlUSTV_AntragPosition1.cboSchnittstellennr._value < 11) Then
|
||||
@@ -1744,7 +1775,7 @@ Public Class frmMDM_USTVAntrag
|
||||
Select Case If(SchnittstellenNr, -1)
|
||||
Case 1 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) RK_ID FROM Rechnungsausgang where cast(Rechnungsausgang.RechnungsDatum as Date) ='" & reDat & "' and Rechnungsausgang.RechnungsNr='" & reNr & "' AND FilialenNr = 4814 AND RK_ID is not null", "FMZOLL",,, -1)
|
||||
'Case 6, 0 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [plInv_daId] FROM [tblPLOSE_Inv_Data] where plInv_SupplierRechnungsDatum='" & reDat & "' and isnull(plose_RechnungsNr,plInv_SupplierRechnungsNr)='" & 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='" & reDat & "' and plInv_SupplierRechnungsNr='" & reNr & "' and plInv_SupplierCountry='" & Antrag_LandKz & "' AND [plInv_daId] is not null", "FMZOLL",,, -1)
|
||||
Case 6, 0, 11 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [plInv_daId] FROM [tblPLOSE_Inv_Data] where plInv_SupplierRechnungsDatum='" & reDat & "' and plInv_SupplierRechnungsNr='" & reNr & "' and plInv_SupplierCountry='" & Antrag_LandKz & "' AND [plInv_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='" & reDat & "' and country='" & Antrag_LandKz & "' AND partner_customer_number = " & USTV_ANTRAG.UStVAn_KuNr & " AND daId is not null", "FMZOLL",,, -1)
|
||||
Case 10 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [daId] FROM [tblUTAImportNew] where Rechnungsdatum='" & reDat & "' and Abrechnungsnummer='" & reNr & "' and Lieferland_ISO2='" & Antrag_LandKz & "' AND daId is not null", "FMZOLL",,, -1)
|
||||
Case 7 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [rmc_daId] FROM [tblRMCImport] where rmc_reDatum='" & reDat & "' and rmc_reNr='" & reNr & "' and rmc_landKZ='" & Antrag_LandKz & "' AND [rmc_daId] is not null", "FMZOLL",,, -1)
|
||||
@@ -2083,9 +2114,14 @@ Public Class frmMDM_USTVAntrag
|
||||
USTV_POS.UStVPo_USteuerbetrag = 0
|
||||
USTV_POS.UStVPo_Umrechnungskurs = 1
|
||||
USTV_POS.UStVPo_Zeitstempel = Now()
|
||||
If USTV_POS.SAVE() Then init()
|
||||
If USTV_POS.SAVE() Then
|
||||
init()
|
||||
dgvUSTVPositionen.SetOrder()
|
||||
Else
|
||||
|
||||
End If
|
||||
|
||||
|
||||
dgvUSTVPositionen.SetOrder()
|
||||
|
||||
End If
|
||||
|
||||
@@ -2216,7 +2252,8 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
Private Sub picExcel_Click(sender As Object, e As EventArgs) Handles picExcel.Click
|
||||
|
||||
Dim dtNew As DataTable = cProgramFunctions.dgridViewTods(dgvUSTVPositionen, True)
|
||||
Dim dtNew As DataTable = cProgramFunctions.dgridViewTods(dgvUSTVPositionen, True, IIf(dgvUSTVPositionen.SelectedRows.Count > 0, True, False))
|
||||
|
||||
|
||||
If dtNew IsNot Nothing AndAlso dtNew.Rows.Count > 0 Then
|
||||
|
||||
@@ -2235,6 +2272,9 @@ Public Class frmMDM_USTVAntrag
|
||||
For Each row In dtNew.Rows
|
||||
If Not IsDBNull(row("UStVPo_USteuerbetrag")) AndAlso IsNumeric(row("UStVPo_USteuerbetrag")) Then sumVAT += CDbl(row("UStVPo_USteuerbetrag"))
|
||||
If Not IsDBNull(row("UStVPo_USteuerbetrag")) AndAlso IsNumeric(row("UStVPo_USteuerbetrag")) Then row("UStVPo_USteuerbetrag") = CDbl(row("UStVPo_USteuerbetrag"))
|
||||
If Not IsDBNull(row("UStVPo_Leistender")) AndAlso row("UStVPo_Leistender") <> "" AndAlso Not IsDBNull(row("UstV_Leistender_UstNr")) AndAlso row("UstV_Leistender_UstNr") <> "" Then
|
||||
row("UStVPo_Leistender") = row("UStVPo_Leistender").ToString.Replace(" " & row("UstV_Leistender_UstNr").ToString.Substring(0, 2), "")
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim drLast = dtNew.NewRow
|
||||
|
||||
@@ -36,6 +36,14 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
sbLeistender._value = ""
|
||||
sbLeistender.Text = ""
|
||||
|
||||
pnlAdresse.Enabled = True 'enablePanel 'immer änderbar!
|
||||
txtStrasse.Text = ""
|
||||
txtStrassenNr.Text = ""
|
||||
txtPLZ.Text = ""
|
||||
txtOrt.Text = ""
|
||||
txtLand.Text = ""
|
||||
txtUIDNr.Text = ""
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -72,7 +80,7 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
Else
|
||||
|
||||
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, 11 : 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 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)
|
||||
@@ -97,10 +105,9 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
scanUSTVVollmachten.INIT(kdnr, "KUNDENDATEN", "USTV_Vollmachten")
|
||||
|
||||
Dim filter As String = "UstV_aktiv = 1"
|
||||
If Antrag_LandKz <> "" Then
|
||||
If cbxAntragsfilter.Checked Then filter &= " and left(UstV_Leistender_UstNr,2)='" & Antrag_LandKz & "'"
|
||||
If Antrag_LandKz <> "" AndAlso cbxAntragsfilter.Checked Then
|
||||
filter &= " and left(UstV_Leistender_UstNr,2)='" & Antrag_LandKz & "'"
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender] + ' ' + isnull([UstV_Leistender_UstNr],'')) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
|
||||
Else
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender] + ' ' + isnull([UstV_Leistender_UstNr],'')) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
End If
|
||||
@@ -155,10 +162,10 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
If sbLeistender._value IsNot Nothing AndAlso sbLeistender._value <> "" Then
|
||||
|
||||
If IsNumeric(sbLeistender._value) Then
|
||||
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(CInt(sbLeistender._value))
|
||||
Else
|
||||
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(sbLeistender._value)
|
||||
End If
|
||||
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(CInt(sbLeistender._value))
|
||||
Else
|
||||
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(sbLeistender._value)
|
||||
End If
|
||||
|
||||
UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
||||
If UStV_Leist.UStV_LeistenderId > 0 Then UStV_POS.UStVPo_LeistenderId = UStV_Leist.UStV_LeistenderId
|
||||
@@ -217,7 +224,9 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
lblSachbearbeiter.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
||||
lblAenderungsdatum.Text = Now.ToString("dd.MM.yyyy HH:mm")
|
||||
' If e.Column.ColumnName = "Sachbearbeiter" Or e.Column.ColumnName = "Änderungsdatum" Then Exit Sub
|
||||
If save() Then RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
||||
If save() Then
|
||||
RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -227,13 +236,24 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
'If newLeistender <> "" Then UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(newLeistender)
|
||||
|
||||
pnlAdresse.Enabled = True 'enablePanel 'immer änderbar!
|
||||
txtStrasse.Text = If(UStV_Leist.UstV_Leistender_Strasse, "")
|
||||
txtStrassenNr.Text = If(UStV_Leist.UstV_Leistender_StrasseNr, "")
|
||||
txtPLZ.Text = If(UStV_Leist.UstV_Leistender_PLZ, "")
|
||||
txtOrt.Text = If(UStV_Leist.UstV_Leistender_Stadt, "")
|
||||
txtLand.Text = If(UStV_Leist.UstV_Leistender_Land, "")
|
||||
txtUIDNr.Text = If(UStV_Leist.UstV_Leistender_UstNr, "")
|
||||
If UStV_Leist Is Nothing Then
|
||||
txtStrasse.Text = ""
|
||||
txtStrassenNr.Text = ""
|
||||
txtPLZ.Text = ""
|
||||
txtOrt.Text = ""
|
||||
txtLand.Text = ""
|
||||
txtUIDNr.Text = ""
|
||||
|
||||
Else
|
||||
|
||||
pnlAdresse.Enabled = True 'enablePanel 'immer änderbar!
|
||||
txtStrasse.Text = If(UStV_Leist.UstV_Leistender_Strasse, "")
|
||||
txtStrassenNr.Text = If(UStV_Leist.UstV_Leistender_StrasseNr, "")
|
||||
txtPLZ.Text = If(UStV_Leist.UstV_Leistender_PLZ, "")
|
||||
txtOrt.Text = If(UStV_Leist.UstV_Leistender_Stadt, "")
|
||||
txtLand.Text = If(UStV_Leist.UstV_Leistender_Land, "")
|
||||
txtUIDNr.Text = If(UStV_Leist.UstV_Leistender_UstNr, "")
|
||||
End If
|
||||
|
||||
btnLeistenderSave.Visible = True
|
||||
|
||||
@@ -375,6 +395,8 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
End If
|
||||
|
||||
loadChangedDSToPanel(UStV_Leist)
|
||||
Else
|
||||
loadChangedDSToPanel(Nothing)
|
||||
End If
|
||||
|
||||
|
||||
@@ -403,24 +425,29 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
If sender Is txtUSTBetrag Then
|
||||
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs.Text) Then
|
||||
|
||||
'Umrechnung bei Währung <> EUR im Antrag!
|
||||
Dim antr As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
If CDbl(UStV_POS.UStVPo_USteuerbetrag) <> CDbl(txtUSTBetrag.Text) Then
|
||||
'Umrechnung bei Währung <> EUR im Antrag!
|
||||
Dim antr As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
|
||||
If antr.UStVAn_Währungscode <> "EUR" AndAlso IsDate(UStV_POS.UStVPo_ReDat) Then
|
||||
If txtUmrechnungskurs.Text = 1 Or txtUmrechnungskurs.Text = "" Then
|
||||
Dim kurs As New cEZB_Waehrungskurse(antr.UStVAn_Währungscode)
|
||||
txtUmrechnungskurs.Text = kurs.ezb_kurs
|
||||
End If
|
||||
|
||||
If antr.UStVAn_Währungscode <> "EUR" AndAlso IsDate(UStV_POS.UStVPo_ReDat) Then
|
||||
If txtUmrechnungskurs.Text = 1 Or txtUmrechnungskurs.Text = "" Then
|
||||
Dim kurs As New cEZB_Waehrungskurse(antr.UStVAn_Währungscode)
|
||||
txtUmrechnungskurs.Text = kurs.ezb_kurs
|
||||
End If
|
||||
|
||||
|
||||
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
txtChanged = True
|
||||
End If
|
||||
|
||||
|
||||
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
txtChanged = True
|
||||
End If
|
||||
|
||||
ElseIf sender Is txtUSTBetragEUR Then
|
||||
|
||||
|
||||
|
||||
'so herum nicht umrechnen!!!!
|
||||
'If IsNumeric(txtUSTBetragEUR._value) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
||||
' txtUSTBetrag.Text = Math.Floor((txtUSTBetragEUR._value * txtUmrechnungskurs._value) * 100 + 0.5) / 100
|
||||
@@ -430,42 +457,50 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
If IsNumeric(txtUSTBetragEUR.Text) AndAlso IsNumeric(txtUSTBetrag.Text) Then
|
||||
|
||||
Dim zahl1 = txtUSTBetragEUR.Text / txtUSTBetrag.Text
|
||||
If CDbl(UStV_POS.UStVPo_USteuerbetragEUR) <> CDbl(txtUSTBetragEUR.Text) Then
|
||||
|
||||
txtUmrechnungskurs.Text = zahl1
|
||||
txtChanged = True
|
||||
Dim zahl1 = txtUSTBetragEUR.Text / txtUSTBetrag.Text
|
||||
|
||||
txtUmrechnungskurs.Text = zahl1
|
||||
txtChanged = True
|
||||
End If
|
||||
End If
|
||||
|
||||
ElseIf sender Is txtUmrechnungskurs Then
|
||||
|
||||
|
||||
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
||||
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
txtChanged = True
|
||||
|
||||
If UStV_POS.UStVPo_Umrechnungskurs <> txtUmrechnungskurs.Text.Replace(",", ".") Then
|
||||
|
||||
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
txtChanged = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
ElseIf sender Is sbLeistender Then
|
||||
|
||||
|
||||
|
||||
If UStV_Leist.hasEntry Then
|
||||
If UStV_Leist.hasEntry Then
|
||||
|
||||
|
||||
UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
||||
If UStV_Leist.UStV_LeistenderId > 0 Then UStV_POS.UStVPo_LeistenderId = UStV_Leist.UStV_LeistenderId
|
||||
UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
||||
If UStV_Leist.UStV_LeistenderId > 0 Then UStV_POS.UStVPo_LeistenderId = UStV_Leist.UStV_LeistenderId
|
||||
|
||||
txtChanged = True
|
||||
'UStV_POS.SAVE()
|
||||
'RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
||||
End If
|
||||
txtChanged = True
|
||||
'UStV_POS.SAVE()
|
||||
'RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ElseIf sender Is txtRgDatum Then
|
||||
ElseIf sender Is txtRgDatum Then
|
||||
|
||||
If txtRgDatum.Text <> "" Then
|
||||
If txtRgDatum.Text <> "" Then
|
||||
txtRgDatum.Text = txtRgDatum.Text.Replace("-", ".")
|
||||
'If IsDate(txtRgDatum.Text) Then txtChanged = True
|
||||
End If
|
||||
|
||||
42
SDL/buchhaltung/frmBU_Mahnlauf.Designer.vb
generated
42
SDL/buchhaltung/frmBU_Mahnlauf.Designer.vb
generated
@@ -40,6 +40,7 @@ Partial Class frmBU_Mahnlauf
|
||||
Me.Panel2 = New System.Windows.Forms.Panel()
|
||||
Me.MyDatagridview1 = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||
Me.Panel3 = New System.Windows.Forms.Panel()
|
||||
Me.btnKunde = New System.Windows.Forms.Button()
|
||||
Me.cbxMahnstufeErh = New System.Windows.Forms.CheckBox()
|
||||
Me.Label8 = New System.Windows.Forms.Label()
|
||||
Me.Button6 = New System.Windows.Forms.Button()
|
||||
@@ -54,7 +55,7 @@ Partial Class frmBU_Mahnlauf
|
||||
Me.Button2 = New System.Windows.Forms.Button()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.MyTextBox2 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
|
||||
Me.btnKunde = New System.Windows.Forms.Button()
|
||||
Me.cbxZahlungseingaenge = New System.Windows.Forms.CheckBox()
|
||||
Me.Panel1.SuspendLayout()
|
||||
Me.pnlTop.SuspendLayout()
|
||||
Me.Panel2.SuspendLayout()
|
||||
@@ -64,6 +65,7 @@ Partial Class frmBU_Mahnlauf
|
||||
'
|
||||
'Panel1
|
||||
'
|
||||
Me.Panel1.Controls.Add(Me.cbxZahlungseingaenge)
|
||||
Me.Panel1.Controls.Add(Me.cbxNurFaellig)
|
||||
Me.Panel1.Controls.Add(Me.MyComboBox1)
|
||||
Me.Panel1.Controls.Add(Me.Label7)
|
||||
@@ -288,6 +290,21 @@ Partial Class frmBU_Mahnlauf
|
||||
Me.Panel3.Size = New System.Drawing.Size(1287, 147)
|
||||
Me.Panel3.TabIndex = 1
|
||||
'
|
||||
'btnKunde
|
||||
'
|
||||
Me.btnKunde.Enabled = False
|
||||
Me.btnKunde.FlatStyle = System.Windows.Forms.FlatStyle.Flat
|
||||
Me.btnKunde.Image = Global.SDL.My.Resources.Resources.person1
|
||||
Me.btnKunde.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
Me.btnKunde.Location = New System.Drawing.Point(38, 87)
|
||||
Me.btnKunde.Name = "btnKunde"
|
||||
Me.btnKunde.Padding = New System.Windows.Forms.Padding(0, 0, 2, 0)
|
||||
Me.btnKunde.Size = New System.Drawing.Size(123, 32)
|
||||
Me.btnKunde.TabIndex = 46
|
||||
Me.btnKunde.Text = "zum Kundenblatt"
|
||||
Me.btnKunde.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||
Me.btnKunde.UseVisualStyleBackColor = True
|
||||
'
|
||||
'cbxMahnstufeErh
|
||||
'
|
||||
Me.cbxMahnstufeErh.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||
@@ -473,20 +490,16 @@ Partial Class frmBU_Mahnlauf
|
||||
Me.MyTextBox2.TabIndex = 39
|
||||
Me.MyTextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
|
||||
'
|
||||
'btnKunde
|
||||
'cbxZahlungseingaenge
|
||||
'
|
||||
Me.btnKunde.Enabled = False
|
||||
Me.btnKunde.FlatStyle = System.Windows.Forms.FlatStyle.Flat
|
||||
Me.btnKunde.Image = Global.SDL.My.Resources.Resources.person1
|
||||
Me.btnKunde.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
Me.btnKunde.Location = New System.Drawing.Point(38, 87)
|
||||
Me.btnKunde.Name = "btnKunde"
|
||||
Me.btnKunde.Padding = New System.Windows.Forms.Padding(0, 0, 2, 0)
|
||||
Me.btnKunde.Size = New System.Drawing.Size(123, 32)
|
||||
Me.btnKunde.TabIndex = 46
|
||||
Me.btnKunde.Text = "zum Kundenblatt"
|
||||
Me.btnKunde.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||
Me.btnKunde.UseVisualStyleBackColor = True
|
||||
Me.cbxZahlungseingaenge.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||
Me.cbxZahlungseingaenge.AutoSize = True
|
||||
Me.cbxZahlungseingaenge.Location = New System.Drawing.Point(568, 87)
|
||||
Me.cbxZahlungseingaenge.Name = "cbxZahlungseingaenge"
|
||||
Me.cbxZahlungseingaenge.Size = New System.Drawing.Size(114, 17)
|
||||
Me.cbxZahlungseingaenge.TabIndex = 39
|
||||
Me.cbxZahlungseingaenge.Text = "Zahlungseingänge"
|
||||
Me.cbxZahlungseingaenge.UseVisualStyleBackColor = True
|
||||
'
|
||||
'frmBU_Mahnlauf
|
||||
'
|
||||
@@ -544,4 +557,5 @@ Partial Class frmBU_Mahnlauf
|
||||
Friend WithEvents Button6 As Button
|
||||
Friend WithEvents cbxMahnstufeErh As CheckBox
|
||||
Friend WithEvents btnKunde As Button
|
||||
Friend WithEvents cbxZahlungseingaenge As CheckBox
|
||||
End Class
|
||||
|
||||
@@ -9,10 +9,10 @@ Public Class frmBU_Mahnlauf
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim listOfTextconserven As cTextkonserve_LIST
|
||||
Private Sub btnSuche_Click(sender As Object, e As EventArgs) Handles btnSuche.Click
|
||||
initDGV()
|
||||
initDGV(cbxZahlungseingaenge.Checked)
|
||||
End Sub
|
||||
|
||||
Sub initDGV()
|
||||
Sub initDGV(Optional zahlungseingaenge As Boolean = False)
|
||||
With MyDatagridview1
|
||||
.Columns.Clear()
|
||||
|
||||
@@ -69,8 +69,35 @@ Public Class frmBU_Mahnlauf
|
||||
" & If(MyComboBox1._value > 0, " and max(si_mahnstufe)>='" & MyComboBox1._value & "'", "") & "
|
||||
ORDER BY KTO.c_name"
|
||||
|
||||
|
||||
|
||||
Dim sqlStringVerag360Zahlungseingaenge = "SELECT i_personenkonto Konto,KTO.c_name, KTO.c_landid Land,/*KTO.c_plz + ' ' + KTO.c_ort Ort,isnull(KTO.c_email,'') Email, */ " &
|
||||
"isnull(( SELECT TOP 1 [Zahlungsinformationen] FROM [FMZOLL\SQLFMZOLL].[VERAG].[dbo].Kunden where KundenNr=i_personenkonto ) ,'') Zahlungsinfo, cast(min (OWNFIELD_Belegdatum)as date) as 'ältesteRg'," &
|
||||
"count(*) Anzahl, sum(eur_bruttobetrag+eur_zahlung) Ausstand ,min(op.d_netto) Faelligkeit,max(si_mahnstufe) Mahnstufe, cast(MAX(d_mahnung)as date) Mahndatum, max(replace(KTO.c_zahlziel,'0/0/','')) ZZ,
|
||||
|
||||
case
|
||||
when max(si_mahnstufe) = 1 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 20 Then 'telefonisch'
|
||||
when max(si_mahnstufe) = 1 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 30 Then 'ZZ 30 Tage'
|
||||
when max(si_mahnstufe) = 1 and cast(MAX(d_mahnung)as date) < (GETDATE()- 60) Then 'Sperre Donnerstag'
|
||||
when max(si_mahnstufe) = 2 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 20 Then 'Sperre Freitag'
|
||||
when max(si_mahnstufe) = 2 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 30 Then 'ZZ 30 Tage'
|
||||
when max(si_mahnstufe) >= 3 Then 'Sperre Donnerstag'
|
||||
else '-'
|
||||
End as sperre" & If(cbxNurFaellig.Checked, "", ",SUM(CASE WHEN op.d_netto<getDATE() THEN (eur_bruttobetrag+eur_zahlung) ELSE 0 END) Summe_Faellig") & "
|
||||
FROM op_debitor OP
|
||||
RIGHT join fibu_konto KTO on i_personenkonto=i_konto AND KTO.i_firm_refid=OP.i_firm_refid
|
||||
WHERE (OP.i_firm_refid = '" & Firma_ID & "') AND (dt_geloescht IS NULL)
|
||||
" & If(cbxNurFaellig.Checked, " and op.d_netto<=getdate() and isnull(si_mahnflags,0) <>(1) ", "") & "
|
||||
" & If(KdNr > 0, " AND i_personenkonto ='" & KdNr & "'", "") & "
|
||||
" & If(KdTxt <> "", " AND KTO.c_name LIKE '" & KdTxt.Replace("*", "%") & "'", "") & "
|
||||
group by i_personenkonto ,KTO.c_name,KTO.c_landid,KTO.c_ort,KTO.c_plz,KTO.c_email
|
||||
HAVING sum(eur_bruttobetrag+eur_zahlung)>'" & MyTextBox1._value & "'
|
||||
" & If(MyComboBox1._value > 0, " and max(si_mahnstufe)>='" & MyComboBox1._value & "'", "") & "
|
||||
ORDER BY KTO.c_name"
|
||||
|
||||
|
||||
'MsgBox(sqlStr)
|
||||
Dim dt_OP As DataTable = SQL.loadDgvBySql(If(Firma_ID = 19, sqlStringVerag360, sqlStr), "FIBU")
|
||||
Dim dt_OP As DataTable = SQL.loadDgvBySql(If(Firma_ID = 19, IIf(zahlungseingaenge, sqlStringVerag360Zahlungseingaenge, sqlStringVerag360), sqlStr), "FIBU")
|
||||
|
||||
.DataSource = dt_OP
|
||||
If .Columns.Count = 0 Then Exit Sub
|
||||
@@ -1248,4 +1275,7 @@ Public Class frmBU_Mahnlauf
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub cbxZahlungseingaenge_CheckedChanged(sender As Object, e As EventArgs) Handles cbxZahlungseingaenge.CheckedChanged
|
||||
'initDGV(cbxZahlungseingaenge.Checked)
|
||||
End Sub
|
||||
End Class
|
||||
@@ -95,6 +95,7 @@ Public Class usrCntlBH
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
Me.Cursor = Cursors.Default
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -1330,7 +1330,7 @@ Public Class cProgramFunctions
|
||||
MsgBox("Excel konnte nicht gestartet werden!" & vbNewLine & vbNewLine & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Function dgridViewTods(ByVal dgv As DataGridView, Optional replaceZeroDate As Boolean = False) As DataTable
|
||||
Public Shared Function dgridViewTods(ByVal dgv As DataGridView, Optional replaceZeroDate As Boolean = False, Optional onlySelectedRows As Boolean = False) As DataTable
|
||||
Dim dt As New DataTable
|
||||
Try
|
||||
' Add Table
|
||||
@@ -1338,27 +1338,54 @@ Public Class cProgramFunctions
|
||||
|
||||
' Add Columns
|
||||
Dim col As DataColumn
|
||||
|
||||
|
||||
|
||||
For Each dgvCol As DataGridViewColumn In dgv.Columns
|
||||
col = New DataColumn(dgvCol.Name)
|
||||
dt.Columns.Add(col)
|
||||
Next
|
||||
col = New DataColumn(dgvCol.Name)
|
||||
dt.Columns.Add(col)
|
||||
Next
|
||||
|
||||
'Add Rows from the datagridview
|
||||
Dim row As DataRow
|
||||
Dim colcount As Integer = dgv.Columns.Count - 1
|
||||
For i As Integer = 0 To dgv.Rows.Count - 1
|
||||
row = dt.Rows.Add
|
||||
For Each column As DataGridViewColumn In dgv.Columns
|
||||
Dim valueTmp As Object = dgv.Rows.Item(i).Cells(column.Index).Value
|
||||
If valueTmp Is DBNull.Value Then
|
||||
row.Item(column.Index) = ""
|
||||
Else
|
||||
If replaceZeroDate AndAlso valueTmp IsNot Nothing AndAlso Not IsNumeric(valueTmp) Then valueTmp = valueTmp.ToString.Replace(" 00:00:00", "")
|
||||
|
||||
row.Item(column.Index) = valueTmp
|
||||
End If
|
||||
If onlySelectedRows Then
|
||||
|
||||
For i As Integer = 0 To dgv.SelectedRows.Count - 1
|
||||
row = dt.Rows.Add
|
||||
For Each column As DataGridViewColumn In dgv.Columns
|
||||
Dim valueTmp As Object = dgv.SelectedRows.Item(i).Cells(column.Index).Value
|
||||
If valueTmp Is DBNull.Value Then
|
||||
row.Item(column.Index) = ""
|
||||
Else
|
||||
If replaceZeroDate AndAlso valueTmp IsNot Nothing AndAlso Not IsNumeric(valueTmp) Then valueTmp = valueTmp.ToString.Replace(" 00:00:00", "")
|
||||
|
||||
row.Item(column.Index) = valueTmp
|
||||
End If
|
||||
Next
|
||||
|
||||
Next
|
||||
Next
|
||||
|
||||
Else
|
||||
|
||||
For i As Integer = 0 To dgv.Rows.Count - 1
|
||||
row = dt.Rows.Add
|
||||
For Each column As DataGridViewColumn In dgv.Columns
|
||||
Dim valueTmp As Object = dgv.Rows.Item(i).Cells(column.Index).Value
|
||||
If valueTmp Is DBNull.Value Then
|
||||
row.Item(column.Index) = ""
|
||||
Else
|
||||
If replaceZeroDate AndAlso valueTmp IsNot Nothing AndAlso Not IsNumeric(valueTmp) Then valueTmp = valueTmp.ToString.Replace(" 00:00:00", "")
|
||||
|
||||
row.Item(column.Index) = valueTmp
|
||||
End If
|
||||
Next
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Return dt
|
||||
|
||||
|
||||
@@ -240,13 +240,13 @@ Public Class usrcntlFremdrechnungen
|
||||
Case "ALLE" : Dim anzahl As Integer = anzahlTop / 6 : SQL_STR = " select * from (SELECT " & IIf(cbxMax1000Eintrage.Checked, " top " & anzahl, "") &
|
||||
"
|
||||
--IDS
|
||||
'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("IDS", "") & " 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] in (SELECT [CustomerCode] FROM [VERAG].[dbo].[tbl_IDS_Kunden] WHERE 1 = 1 " & IIf(kdNr > 0, " AND [KdNrVERAG]=" & kdNr, "") & " ) and [YearMonthDay] " & setSQLWhere("IDS", "") & " -- order by [YearMonthDay], [Invoicenumber]
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
||||
--MSE
|
||||
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 inner join tblMSECustomers on customer_id = [customer_number] where 1 = 1 " & IIf(kdNr > 0, " AND [partner_customer_number]=" & kdNr, "") & " and [invoice_date] " & setSQLWhere("MSE", "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 inner join tblMSECustomers on customer_id = [customer_number] where 1 = 1 " & IIf(kdNr > 0, " AND [partner_customer_number]=" & kdNr, "") & " and [invoice_date] " & setSQLWhere("MSE", "country") & " --order by invoice_date, invoice_id
|
||||
|
||||
UNION ALL
|
||||
|
||||
@@ -256,18 +256,18 @@ Public Class usrcntlFremdrechnungen
|
||||
UNION ALL
|
||||
--VERAG
|
||||
|
||||
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("VERAG", "'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("VERAG", "'AT'") & " AND tblTrdinInvoice.FilialenNr = 4814 --ORDER BY tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer
|
||||
|
||||
|
||||
UNION ALL
|
||||
--PLOSE
|
||||
|
||||
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("PLOSE", "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("PLOSE", "plInv_SupplierCountry") & "-- Order by plInv_SupplierRechnungsDatum desc, [plInv_SupplierRechnungsNr]
|
||||
|
||||
UNION ALL
|
||||
|
||||
--RMC
|
||||
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("RMC", "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("RMC", "rmc_landKZ") & "-- order by rmc_reDatum, rmc_reNr
|
||||
|
||||
) as temp where 1=1 and temp.Rechnungsdatum" & setSQLWhere(SDLNrTmp, "temp.Land") & " order by Rechnungsdatum desc"
|
||||
|
||||
@@ -1013,7 +1013,7 @@ Public Class usrcntlFremdrechnungen
|
||||
Try
|
||||
If dgvLFRechnung.SelectedRows.Count > 0 AndAlso (aktLieferant = "IDS" Or aktLieferant = "ALLE") Then
|
||||
|
||||
If dgvLFRechnung.SelectedRows.Count = 1 AndAlso dgvLFRechnung.SelectedRows(0).Cells("Lieferant").Value <> "IDS" Then
|
||||
If dgvLFRechnung.SelectedRows.Count = 1 AndAlso aktLieferant = "ALLE" AndAlso dgvLFRechnung.SelectedRows(0).Cells("Lieferant").Value <> "IDS" Then
|
||||
dgvDetails.Visible = False
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -1022,8 +1022,8 @@ Public Class usrcntlFremdrechnungen
|
||||
|
||||
If Not SplitContainer1.Panel2Collapsed Then
|
||||
|
||||
Select Case aktLieferant
|
||||
Case "IDS" : initDGVRechnungsdetails(dgvLFRechnung.SelectedRows(0).Cells("invoice_id").Value)
|
||||
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)
|
||||
@@ -1036,11 +1036,15 @@ Public Class usrcntlFremdrechnungen
|
||||
|
||||
Else
|
||||
|
||||
dgvDetails.Visible = False
|
||||
End If
|
||||
|
||||
dgvDetails.Visible = False
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
dgvDetails.Visible = False
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
'Neuer eintrag
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
|
||||
@@ -364,6 +364,20 @@ Public Class cUStVPositionen
|
||||
End Function
|
||||
|
||||
|
||||
Public Function SAVEID() As Integer
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
Dim ustava_posId = -1
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblUStVPositionen WHERE UStVAn_ID=@UStVAn_ID AND UStVPo_ID=@UStVPo_ID) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
" commit tran "
|
||||
|
||||
ustava_posId = SQL.doSQLVarListID(ustava_posId, sqlstr, "FMZOLL", , list)
|
||||
|
||||
Return ustava_posId
|
||||
End Function
|
||||
|
||||
Public Function getUpdateCmd() As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Reference in New Issue
Block a user