620 lines
29 KiB
VB.net
620 lines
29 KiB
VB.net
Imports com.sun.net.httpserver.Authenticator
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class ustCntlUSTV_AntragPosition
|
|
Public UStV_POS As VERAG_PROG_ALLGEMEIN.cUStVPositionen = Nothing
|
|
Public UStV_Leist As VERAG_PROG_ALLGEMEIN.cUStVLeistender = Nothing
|
|
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
|
|
Public Antrag_LandKz = ""
|
|
Dim kdnr = ""
|
|
|
|
Public Event EV_PREV()
|
|
Public Event EV_NEXT()
|
|
Public Event CHANGED(UStVPo_ID)
|
|
Dim gridAktiv = False
|
|
Dim txtChanged As Boolean = False
|
|
Dim API As cATEZ_NCTS_IN
|
|
Private Sub btnBildAuf_Click(sender As Object, e As EventArgs) Handles btnBildAuf.Click
|
|
RaiseEvent EV_PREV()
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
RaiseEvent EV_NEXT()
|
|
End Sub
|
|
|
|
Sub reset()
|
|
txtRgDatum._value = ""
|
|
txtRgNr._value = ""
|
|
btnLeistenderSave.Visible = False
|
|
txtUmrechnungskurs._value = 1
|
|
txtLeistungsbezeichnung._value = ""
|
|
txtUmrechnungskurs._value = 1
|
|
txtUSTBetrag._value = 0
|
|
txtUSTBetragEUR._value = 0
|
|
cbxAPI.Checked = False
|
|
cboSchnittstellennr.changeItem("")
|
|
lblAenderungsdatum.Text = "-"
|
|
lblSachbearbeiter.Text = "-"
|
|
sbLeistender._value = ""
|
|
sbLeistender.Text = ""
|
|
|
|
pnlAdresse.Enabled = True 'enablePanel 'immer änderbar!
|
|
txtStrasse.Text = ""
|
|
txtStrassenNr.Text = ""
|
|
txtPLZ.Text = ""
|
|
txtOrt.Text = ""
|
|
txtLand.Text = ""
|
|
txtUIDNr.Text = ""
|
|
|
|
gridAktiv = True
|
|
|
|
Dim filter As String = "UstV_aktiv = 1"
|
|
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
|
|
|
|
End Sub
|
|
|
|
Sub setValues(kdnr As Integer, UStV_POS As VERAG_PROG_ALLGEMEIN.cUStVPositionen, Antrag_LandKz As String, UStV_Leitender As VERAG_PROG_ALLGEMEIN.cUStVLeistender, atez_api As cATEZ_NCTS_IN)
|
|
|
|
initSchnittstellenNr()
|
|
|
|
gridAktiv = False
|
|
btnLeistenderSave.Visible = False
|
|
Me.Antrag_LandKz = Antrag_LandKz
|
|
Me.UStV_POS = UStV_POS
|
|
Me.kdnr = kdnr
|
|
cbxAPI.Checked = If(UStV_POS.UStVPo_Schnittstelle, False)
|
|
cboSchnittstellennr.changeItem(If(UStV_POS.UStVPo_SchnittstellenNr, ""))
|
|
txtRgDatum._value = If(UStV_POS.UStVPo_ReDat, "")
|
|
txtRgNr._value = If(UStV_POS.UStVPo_ReNr, "")
|
|
lblSachbearbeiter.Text = If(UStV_POS.UStVPo_Sachbearbeiter, "")
|
|
If UStV_POS.UStVPo_Zeitstempel IsNot Nothing Then lblAenderungsdatum.Text = CDate(UStV_POS.UStVPo_Zeitstempel).ToString("dd.MM.yyyy HH:mm")
|
|
cboLeistungsgeber.Text = If(UStV_POS.UStVPo_Leistender, "")
|
|
txtLeistungsbezeichnung.Text = If(UStV_POS.UStVPo_Leistungsbezeichnung, "")
|
|
txtUSTBetrag.Text = If(UStV_POS.UStVPo_USteuerbetrag, "")
|
|
txtUmrechnungskurs.Text = If(UStV_POS.UStVPo_Umrechnungskurs, "")
|
|
txtUSTBetragEUR.Text = If(UStV_POS.UStVPo_USteuerbetragEUR, "")
|
|
|
|
sbLeistender.Text = UStV_Leitender.UStV_Leistender
|
|
loadChangedDSToPanel(UStV_Leitender, True)
|
|
API = atez_api
|
|
|
|
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)
|
|
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)
|
|
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 : scanSonstiges.Enabled = False 'VERAG-RECHNUGNEN werden immer direkt OHNE daid geöffnet!
|
|
Case -1 : da_id = IIf(UStV_POS.UStVPo_daId > 0, UStV_POS.UStVPo_daId, -1)
|
|
End Select
|
|
|
|
End If
|
|
|
|
|
|
If da_id > -1 Then
|
|
scanSonstiges.INIT_daId(da_id)
|
|
scanSonstiges.Enabled = UStV_POS.UStVPo_daId_loeschbar 'Not UStV_POS.UStVPo_SchnittstellenNr > 0
|
|
btnAPIUbload.Enabled = UStV_POS.UStVPo_daId_loeschbar
|
|
Else
|
|
scanSonstiges.INIT(kdnr, "MDM", "MDM_DATEN", "USTVA_" & UStV_POS.UStVAn_ID & "_" & UStV_POS.UStVPo_ID)
|
|
'scanSonstiges.INIT_daId(da_id)
|
|
scanSonstiges.Enabled = True
|
|
btnAPIUbload.Enabled = False
|
|
End If
|
|
|
|
|
|
scanUSTVFABest.INIT(kdnr, "KUNDENDATEN", "FA_Bestaetigungen")
|
|
scanUSTVVollmachten.INIT(kdnr, "KUNDENDATEN", "USTV_Vollmachten")
|
|
|
|
Dim filter As String = "UstV_aktiv = 1"
|
|
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
|
|
|
|
'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"}, "UstV_aktiv = 1", "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
|
|
|
gridAktiv = True
|
|
End Sub
|
|
|
|
Sub getValues(ByRef UStV_POS, ByRef save)
|
|
|
|
If UStV_POS Is Nothing OrElse UStV_POS.UStVAn_ID = 0 Then UStV_POS = New VERAG_PROG_ALLGEMEIN.cUStVPositionen()
|
|
|
|
UStV_POS.UStVPo_Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
|
UStV_POS.UStVPo_Zeitstempel = Now
|
|
|
|
If txtRgNr.Text <> "" Then
|
|
UStV_POS.UStVPo_ReNr = txtRgNr.Text
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtRgDatum.Text <> "" AndAlso IsDate(txtRgDatum.Text) Then
|
|
UStV_POS.UStVPo_ReDat = txtRgDatum._value
|
|
Else
|
|
save = False
|
|
End If
|
|
If txtUSTBetrag.Text <> "" Then
|
|
UStV_POS.UStVPo_USteuerbetrag = txtUSTBetrag.Text.Replace(",", ".")
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtUSTBetragEUR.Text <> "" Then
|
|
UStV_POS.UStVPo_USteuerbetragEUR = txtUSTBetragEUR.Text.Replace(",", ".")
|
|
Else
|
|
save = False
|
|
End If
|
|
If txtLeistungsbezeichnung.Text <> "" Then
|
|
UStV_POS.UStVPo_Leistungsbezeichnung = txtLeistungsbezeichnung.Text
|
|
Else
|
|
save = False
|
|
End If
|
|
If Not txtUmrechnungskurs.Text = "" Then
|
|
If txtUmrechnungskurs.Text <> "" Then
|
|
UStV_POS.UStVPo_Umrechnungskurs = txtUmrechnungskurs.Text.Replace(",", ".")
|
|
End If
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
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_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
|
If UStV_Leist.UStV_LeistenderId > 0 Then UStV_POS.UStVPo_LeistenderId = UStV_Leist.UStV_LeistenderId
|
|
Else
|
|
'save = False
|
|
End If
|
|
|
|
UStV_POS.UStVPo_Schnittstelle = cbxAPI.Checked
|
|
|
|
UStV_POS.UStVPo_SchnittstellenNr = IIf(cboSchnittstellennr.SelectedItem IsNot Nothing, cboSchnittstellennr._value, -1)
|
|
|
|
End Sub
|
|
|
|
Private Sub ustCntlUSTV_AntragPosition_KeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles Me.PreviewKeyDown
|
|
If e.KeyValue = Keys.PageDown Then
|
|
RaiseEvent EV_NEXT()
|
|
End If
|
|
If e.KeyValue = Keys.PageUp Then
|
|
RaiseEvent EV_PREV()
|
|
End If
|
|
End Sub
|
|
|
|
Function save()
|
|
Dim setSave As Boolean = True
|
|
getValues(UStV_POS, setSave)
|
|
'MsgBox("TEST")
|
|
If setSave Then Return UStV_POS.SAVE
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub txtBestellung_TextChanged(sender As Object, e As EventArgs) Handles txtLeistungsbezeichnung.TextChanged, txtRgDatum.TextChanged, txtRgNr.TextChanged, txtUSTBetrag.TextChanged, txtUmrechnungskurs.TextChanged, txtUSTBetragEUR.TextChanged
|
|
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
|
|
|
If gridAktiv And Me.FindForm IsNot Nothing Then
|
|
|
|
'If sender Is txtLieferung Then
|
|
' If Not PROG.checkSDLNrPartnerKdNr(kdNr, SDLNr) Then MsgBox("Bitte geben Sie die Partner-Kundennummer im Kundenblatt oder im FM-ZOLL ein!")
|
|
'End If
|
|
|
|
If sender Is cboLeistungsgeber AndAlso cboLeistungsgeber.SelectedItem <> "" Then
|
|
'UStV_POS.UStVPo_Leistender = cboLeistungsgeber.SelectedItem
|
|
'values_changed()
|
|
|
|
Else
|
|
'txtChanged = True
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Sub values_changed()
|
|
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)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub loadChangedDSToPanel(UStV_Leitender As VERAG_PROG_ALLGEMEIN.cUStVLeistender, Optional initial As Boolean = False)
|
|
Dim adressLoadedByLeistender As Boolean = False
|
|
UStV_Leist = UStV_Leitender
|
|
|
|
'If newLeistender <> "" Then UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(newLeistender)
|
|
|
|
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, "")
|
|
If UStV_Leist.hasEntry Then adressLoadedByLeistender = True
|
|
|
|
End If
|
|
|
|
If Not initial Then
|
|
'Listener für Änderungen im Detail-Panel
|
|
If Not adressLoadedByLeistender Then
|
|
For Each c As Control In pnlAdresse.Controls
|
|
|
|
If TypeOf (c) Is TextBox Then
|
|
AddHandler CType(c, TextBox).TextChanged, AddressOf SomethingChanged
|
|
End If
|
|
If TypeOf (c) Is MyComboBox Then
|
|
AddHandler CType(c, MyComboBox).TextChanged, AddressOf SomethingChanged
|
|
End If
|
|
|
|
|
|
Next
|
|
Else
|
|
btnLeistenderSave.Visible = False
|
|
End If
|
|
Else
|
|
|
|
btnLeistenderSave.Visible = False
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub SomethingChanged(sender As Object, e As EventArgs)
|
|
btnLeistenderSave.Visible = True
|
|
End Sub
|
|
|
|
Private Sub picSave_Click(sender As Object, e As EventArgs) Handles btnLeistenderSave.Click
|
|
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then
|
|
MsgBox("keine Berechtigung!")
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim leistNew = sbLeistender.Text
|
|
|
|
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(leistNew)
|
|
|
|
If Not UStV_Leist.hasEntry Then
|
|
If vbYes = MsgBox("Dieser Leistende wurde noch nicht angelegt!" & vbNewLine & UStV_Leist.UStV_Leistender & " anlegen? ", vbYesNo) Then
|
|
'adresseChanged = True
|
|
UStV_Leist.UstV_Leistender_Strasse = If(txtStrasse.Text, "")
|
|
UStV_Leist.UstV_Leistender_StrasseNr = If(txtStrassenNr.Text, "")
|
|
UStV_Leist.UstV_Leistender_PLZ = If(txtPLZ.Text, "")
|
|
UStV_Leist.UstV_Leistender_Stadt = If(txtOrt.Text, "")
|
|
UStV_Leist.UstV_Leistender_Land = If(txtLand.Text, "")
|
|
UStV_Leist.UstV_Leistender_UstNr = If(txtUIDNr.Text, "")
|
|
|
|
Dim saveid = UStV_Leist.SAVEID
|
|
If saveid > 0 Then
|
|
|
|
btnLeistenderSave.Visible = False
|
|
UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
|
UStV_POS.UStVPo_LeistenderId = saveid
|
|
'RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
|
values_changed()
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
Dim adresseChanged As Boolean = False
|
|
|
|
If UStV_Leist.UstV_Leistender_Strasse <> If(txtStrasse.Text, "") Then adresseChanged = True
|
|
If UStV_Leist.UstV_Leistender_StrasseNr <> If(txtStrassenNr.Text, "") Then adresseChanged = True
|
|
If UStV_Leist.UstV_Leistender_PLZ <> If(txtPLZ.Text, "") Then adresseChanged = True
|
|
If UStV_Leist.UstV_Leistender_Stadt <> If(txtOrt.Text, "") Then adresseChanged = True
|
|
If UStV_Leist.UstV_Leistender_Land <> If(txtLand.Text, "") Then adresseChanged = True
|
|
If UStV_Leist.UstV_Leistender_UstNr <> If(txtUIDNr.Text, "") Then adresseChanged = True
|
|
|
|
|
|
UStV_Leist.UstV_Leistender_Strasse = If(txtStrasse.Text, "")
|
|
UStV_Leist.UstV_Leistender_StrasseNr = If(txtStrassenNr.Text, "")
|
|
UStV_Leist.UstV_Leistender_PLZ = If(txtPLZ.Text, "")
|
|
UStV_Leist.UstV_Leistender_Stadt = If(txtOrt.Text, "")
|
|
UStV_Leist.UstV_Leistender_Land = If(txtLand.Text, "")
|
|
UStV_Leist.UstV_Leistender_UstNr = If(txtUIDNr.Text, "")
|
|
UStV_Leist.UstV_Leistender_Adresse = True
|
|
|
|
If UStV_Leist.UstV_Leistender_Adresse And adresseChanged Then
|
|
If Not vbYes = MsgBox("Bei diesem Leistenden ist bereits eine Adresse hinterlegt, soll diese Adresse wirklich geändert werden?", vbYesNo) Then
|
|
|
|
btnLeistenderSave.Visible = False
|
|
UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
|
'RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
|
values_changed()
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
If UStV_Leist.SAVE() Then
|
|
If Not UStV_Leist.UstV_Leistender_Adresse And adresseChanged Then UStV_Leist.UstV_Leistender_Adresse = True
|
|
btnLeistenderSave.Visible = False
|
|
UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
|
'RaiseEvent CHANGED(UStV_POS.UStVPo_ID)
|
|
values_changed()
|
|
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub cboLeistungsgeber_Enter(sender As Object, e As EventArgs) Handles cboLeistungsgeber.Enter
|
|
|
|
End Sub
|
|
|
|
Private Sub cboLeistungsgeber_DropDown(sender As Object, e As EventArgs) Handles cboLeistungsgeber.DropDown
|
|
cboLeistungsgeber.Items.Clear()
|
|
cboLeistungsgeber.fillWithSQL("select top 100 UStV_Leistender from tblUStVLeistender Where 1= 1 " & IIf(cboLeistungsgeber.Text <> "", "AND UStV_Leistender like '" & cboLeistungsgeber.Text & "%'", ""), False, "FMZOLL", True)
|
|
cboLeistungsgeber.changeItem(If(cboLeistungsgeber.Text, ""))
|
|
|
|
End Sub
|
|
|
|
Private Sub initSchnittstellenNr()
|
|
|
|
If cboSchnittstellennr.Items.Count = 0 Then
|
|
|
|
cboSchnittstellennr.Items.Add(New MyListItem("", -1))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("VERAG 360", 1))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("IDS alt", 2))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("TELEPASS", 3))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("MSE alt", 4))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("UTA alt", 5))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("PLOSE", 6))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("RMC", 7))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("IDS neu", 8))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("MSE neu", 9))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("UTA neu", 10))
|
|
cboSchnittstellennr.Items.Add(New MyListItem("PLOSE neu", 11))
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub sbLeistender_VALUE_CHANGED() Handles sbLeistender.VALUE_CHANGED
|
|
|
|
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
|
|
|
|
loadChangedDSToPanel(UStV_Leist)
|
|
Else
|
|
loadChangedDSToPanel(Nothing, True)
|
|
End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub txtUSTBetrag_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtUSTBetrag.PreviewKeyDown, txtUSTBetragEUR.PreviewKeyDown, txtRgDatum.PreviewKeyDown, txtRgNr.PreviewKeyDown, txtUmrechnungskurs.PreviewKeyDown, sbLeistender.PreviewKeyDown
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
|
|
|
If gridAktiv And Me.FindForm IsNot Nothing Then
|
|
|
|
' Eingabeprüfung
|
|
If e.KeyValue = 9 Then
|
|
|
|
lblWarning.Text = ""
|
|
If sender Is txtUSTBetrag Or sender Is txtUSTBetragEUR Or sender Is txtUmrechnungskurs Then
|
|
|
|
If txtUSTBetrag.Text = "" Then
|
|
lblWarning.Text = "Bitte Umsatzsteuerbetrag eingeben."
|
|
Exit Sub
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
If sender Is txtUSTBetrag Then
|
|
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs.Text) Then
|
|
|
|
If CDbl(UStV_POS.UStVPo_USteuerbetrag) <> CDbl(txtUSTBetrag.Text) OrElse UStV_POS.UStVPo_USteuerbetrag Is Nothing 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) OrElse (txtRgDatum.Text <> "" AndAlso IsDate(txtRgDatum.Text))) Then
|
|
If txtUmrechnungskurs.Text = 1 Or txtUmrechnungskurs.Text = "" Then
|
|
Dim kurs As New cEZB_Waehrungskurse(antr.UStVAn_Währungscode)
|
|
|
|
If IsDate(UStV_POS.UStVPo_ReDat) Then
|
|
txtUmrechnungskurs.Text = kurs.GET_KURS(antr.UStVAn_Währungscode, CDate(UStV_POS.UStVPo_ReDat))
|
|
ElseIf IsDate(txtRgDatum.Text) Then
|
|
txtUmrechnungskurs.Text = kurs.GET_KURS(antr.UStVAn_Währungscode, CDate(txtRgDatum.Text))
|
|
Else
|
|
txtUmrechnungskurs.Text = kurs.ezb_kurs
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
|
txtChanged = True
|
|
End If
|
|
|
|
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
|
|
' 'values_changed()
|
|
'End If
|
|
|
|
|
|
If IsNumeric(txtUSTBetragEUR.Text) AndAlso IsNumeric(txtUSTBetrag.Text) Then
|
|
|
|
If CDbl(UStV_POS.UStVPo_USteuerbetragEUR) <> CDbl(txtUSTBetragEUR.Text) OrElse UStV_POS.UStVPo_USteuerbetragEUR Is Nothing Then
|
|
|
|
Dim zahl1 = CDbl(txtUSTBetrag.Text) / CDbl(txtUSTBetragEUR.Text)
|
|
|
|
txtUmrechnungskurs.Text = Math.Round(zahl1, 2)
|
|
txtChanged = True
|
|
End If
|
|
End If
|
|
|
|
ElseIf sender Is txtUmrechnungskurs Then
|
|
|
|
|
|
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
|
|
|
If UStV_POS.UStVPo_Umrechnungskurs <> txtUmrechnungskurs.Text.Replace(",", ".") OrElse UStV_POS.UStVPo_Umrechnungskurs Is Nothing 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
|
|
|
|
|
|
' 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
|
|
|
|
' End If
|
|
|
|
|
|
|
|
ElseIf sender Is txtRgDatum Then
|
|
|
|
If txtRgDatum.Text <> "" Then
|
|
txtRgDatum.Text = txtRgDatum.Text.Replace("-", ".")
|
|
'If IsDate(txtRgDatum.Text) Then txtChanged = True
|
|
End If
|
|
|
|
|
|
ElseIf sender Is sbLeistender Then
|
|
If sbLeistender.Text <> "" Then
|
|
If sbLeistender.Text IsNot Nothing AndAlso sbLeistender.Text <> "" Then
|
|
If IsNumeric(sbLeistender.Text) Then
|
|
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(CInt(sbLeistender.Text))
|
|
Else
|
|
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(sbLeistender.Text)
|
|
End If
|
|
|
|
loadChangedDSToPanel(UStV_Leist)
|
|
Else
|
|
loadChangedDSToPanel(Nothing, True)
|
|
End If
|
|
End If
|
|
'MsgBox()
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
If txtChanged Then
|
|
values_changed()
|
|
txtChanged = False
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub scanSonstiges_FileAdded(id As String, path As String, name As String) Handles scanSonstiges.FileAdded
|
|
getValues(UStV_POS, True)
|
|
UStV_POS.UStVPo_daId = id
|
|
If UStV_POS.SAVE() Then scanSonstiges.INIT_daId(UStV_POS.UStVPo_daId)
|
|
End Sub
|
|
|
|
Private Sub scanSonstiges_FileDeleted() Handles scanSonstiges.FileDeleted
|
|
getValues(UStV_POS, True)
|
|
UStV_POS.UStVPo_daId = Nothing
|
|
UStV_POS.SAVE()
|
|
|
|
End Sub
|
|
|
|
Private Sub cbxAntragsfilter_CheckedChanged(sender As Object, e As EventArgs) Handles cbxAntragsfilter.CheckedChanged
|
|
|
|
Dim filter As String = "UstV_aktiv = 1"
|
|
If Antrag_LandKz <> "" Then
|
|
If 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"})
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnAPIUbload_Click(sender As Object, e As EventArgs) Handles btnAPIUbload.Click
|
|
If API IsNot Nothing Then
|
|
If vbYes = MsgBox("Möchten Sie die Rechnungsdaten per ATEZ-API auslesen lassen?", vbYesNoCancel) Then
|
|
|
|
Dim failreDesc As String
|
|
Dim authResp = API.authenticate("VAT", "client1", "password")
|
|
Dim resp
|
|
If authResp <> "200" Then
|
|
MsgBox("Authentifizierung fehlgeschlagen" & vbNewLine & authResp)
|
|
Exit Sub
|
|
Else
|
|
If API.SendRequestWithAuthHeader("application/json", failreDesc, "/health", "GET") = "200" Then
|
|
|
|
'document_type = vat_invoice or receipt
|
|
If API.setJsonVAT("vat_invoice", UStV_POS.UStVPo_daId) Then
|
|
resp = API.SendRequestWithAuthHeader("application/json", failreDesc, "/process", "POST")
|
|
End If
|
|
|
|
Else
|
|
MsgBox("Service is not running!")
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
End Class
|