neu
This commit is contained in:
@@ -484,7 +484,7 @@ Public Class cDakosyEZA
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status_KEWILL_Equivalent", status, , True))
|
||||
eza_Status = status
|
||||
eza_Status_KEWILL_Equivalent = status
|
||||
Return SQL.doSQLVarList(" UPDATE [tblDakosy_eza] SET eza_Status=@eza_Status WHERE eza_Id=@eza_Id ", "FMZOLL", , list)
|
||||
Return SQL.doSQLVarList(" UPDATE [tblDakosy_eza] SET eza_Status_KEWILL_Equivalent=@eza_Status_KEWILL_Equivalent,eza_Status=@eza_Status WHERE eza_Id=@eza_Id ", "FMZOLL", , list)
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
|
||||
@@ -549,7 +549,7 @@ Public Class cDakosyNCTSOut
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ncts_Status_KEWILL_Equivalent", status, , True))
|
||||
ncts_Status = status
|
||||
ncts_Status_KEWILL_Equivalent = status
|
||||
Return SQL.doSQLVarList(" UPDATE [tblDakosy_NCTSOut] SET ncts_Status=@ncts_Status WHERE ncts_Id=@ncts_Id ", "FMZOLL", , list)
|
||||
Return SQL.doSQLVarList(" UPDATE [tblDakosy_NCTSOut] SET ncts_Status_KEWILL_Equivalent=@ncts_Status_KEWILL_Equivalent,ncts_Status=@ncts_Status WHERE ncts_Id=@ncts_Id ", "FMZOLL", , list)
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
|
||||
@@ -31,74 +31,229 @@ Public Class cZOLL_IMPORT
|
||||
End Function
|
||||
|
||||
Function countSpedbuchEntrysTC_EZA(filiale, BezugsNr) As Integer
|
||||
If If(BezugsNr, "") = "" Then Return 0
|
||||
Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND [AtlasBezNrEZA]='" & BezugsNr & "'", "FMZOLL")
|
||||
If If(BezugsNr, "") = "" Then Return -1
|
||||
Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND [AtlasBezNrEZA]='" & BezugsNr & "'", "FMZOLL",, 0)
|
||||
End Function
|
||||
|
||||
|
||||
Function countSpedbuchEntrysTC_NCTS(filiale, BezugsNr) As Integer
|
||||
If If(BezugsNr, "") = "" Then Return 0
|
||||
Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND [AtlasBezNrNCTS]='" & BezugsNr & "'", "FMZOLL")
|
||||
If If(BezugsNr, "") = "" Then Return -1
|
||||
Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND [AtlasBezNrNCTS]='" & BezugsNr & "'", "FMZOLL",, 0)
|
||||
End Function
|
||||
|
||||
|
||||
Function countSpedbuchEntrys_AbfertigungsNr(filiale, AbfertigungsNr) As Integer
|
||||
If If(AbfertigungsNr, "") = "" Then Return -1
|
||||
Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND [AbfertigungsNr]='" & AbfertigungsNr & "'", "FMZOLL",, 0)
|
||||
End Function
|
||||
|
||||
Public Function TelotecImport(TC As TELOTEC_Worker.cTelotec_Anmeldung) As Boolean
|
||||
|
||||
'Function insertIntoSpedBuch() As Boolean
|
||||
Dim SPEDBUCH As New VERAG_PROG_ALLGEMEIN.cSpeditionsbuch
|
||||
If True Then ' If(Me.telanm_firma, "") = "IMEX" Then
|
||||
If countSpedbuchEntrysTC(5501, TC.telanm_BezugsNr, TC.telanm_ART) = 0 Then
|
||||
SPEDBUCH.FilialenNr = 5501
|
||||
SPEDBUCH.AbfertigungsNr = VERAG_PROG_ALLGEMEIN.cAllgemein.getMaxPosNrIncrement(SPEDBUCH.FilialenNr, Now.Year)
|
||||
SPEDBUCH.NewUNTER_NR()
|
||||
|
||||
SPEDBUCH.Zollsystem = "T"
|
||||
SPEDBUCH.Abfertigungsdatum = Now.ToShortDateString
|
||||
SPEDBUCH.Sachbearbeiter = "AUTO"
|
||||
Dim AbfertigungsNr = getAbfertigungsnummer(TC.telanm_BezugsNr)
|
||||
|
||||
Dim notfound = False
|
||||
If AbfertigungsNr <> "" AndAlso countSpedbuchEntrysTC(5501, TC.telanm_BezugsNr, TC.telanm_ART) = 0 AndAlso countSpedbuchEntrys_AbfertigungsNr(5501, AbfertigungsNr) = 0 Then
|
||||
SPEDBUCH.FilialenNr = 5501
|
||||
' SPEDBUCH.AbfertigungsNr = VERAG_PROG_ALLGEMEIN.cAllgemein.getMaxPosNrIncrement(SPEDBUCH.FilialenNr, Now.Year)
|
||||
SPEDBUCH.AbfertigungsNr = AbfertigungsNr
|
||||
SPEDBUCH.NewUNTER_NR()
|
||||
|
||||
Dim art = ""
|
||||
Select Case TC.telanm_ART
|
||||
Case "NCTS", "T1", "T2", "T2L" : TC.telanm_ART = "NCTS" : SPEDBUCH.AtlasBezNrNCTS = TC.telanm_BezugsNr
|
||||
Case Else : TC.telanm_ART = "EZA" : SPEDBUCH.AtlasBezNrEZA = TC.telanm_BezugsNr
|
||||
End Select
|
||||
SPEDBUCH.Zollsystem = "T"
|
||||
SPEDBUCH.Abfertigungsdatum = Now.ToShortDateString
|
||||
SPEDBUCH.Sachbearbeiter = "AUTO"
|
||||
|
||||
Dim PosAnzahl = 0
|
||||
' TELOTECDatenbereitstellung(SPEDBUCH, Me.telanm_BezugsNr, notfound, art, PosAnzahl)
|
||||
SPEDBUCH = IMPORT(SPEDBUCH, TC.telanm_AvisoId, TC.telanm_SendungsId, "VERA", SPEDBUCH.FilialenNr, 2, SPEDBUCH.AtlasBezNrEZA, SPEDBUCH.AtlasBezNrNCTS, notfound, True)
|
||||
Dim notfound = False
|
||||
|
||||
Dim art = ""
|
||||
Select Case TC.telanm_ART
|
||||
Case "NCTS", "T1", "T2", "T2L" : TC.telanm_ART = "NCTS" : SPEDBUCH.AtlasBezNrNCTS = TC.telanm_BezugsNr
|
||||
Case "EUA", "EZA" : TC.telanm_ART = "EZA" : SPEDBUCH.AtlasBezNrEZA = TC.telanm_BezugsNr
|
||||
' Case Else : TC.telanm_ART = "EZA" : SPEDBUCH.AtlasBezNrEZA = TC.telanm_BezugsNr
|
||||
End Select
|
||||
|
||||
Dim PosAnzahl = 0
|
||||
' TELOTECDatenbereitstellung(SPEDBUCH, Me.telanm_BezugsNr, notfound, art, PosAnzahl)
|
||||
SPEDBUCH = IMPORT(SPEDBUCH, TC.telanm_AvisoId, TC.telanm_SendungsId, "VERA", SPEDBUCH.FilialenNr, 2, SPEDBUCH.AtlasBezNrEZA, SPEDBUCH.AtlasBezNrNCTS, notfound, True)
|
||||
|
||||
|
||||
If Not notfound Then
|
||||
Return SPEDBUCH.SAVE
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
If TC.telanm_SendungsId IsNot Nothing Then
|
||||
|
||||
Else
|
||||
Return False 'Ohne Sendungsverweis kein eintrag...
|
||||
End If
|
||||
|
||||
Return SPEDBUCH.SAVE
|
||||
Else
|
||||
If False Then 'NOCH NCIHT....
|
||||
|
||||
If TC.telanm_SendungsId IsNot Nothing Then
|
||||
|
||||
Else
|
||||
Return False 'Ohne Sendungsverweis kein eintrag...
|
||||
End If
|
||||
|
||||
If Not notfound Then
|
||||
Return SPEDBUCH.SAVE
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
Return False
|
||||
|
||||
' End Function
|
||||
'
|
||||
Return False 'Ohne Sendungsverweis kein eintrag...
|
||||
End Function
|
||||
|
||||
|
||||
Public Sub insertAbgabenTELOTEC(TC As TELOTEC_Worker.cTelotec_Anmeldung)
|
||||
' MsgBox("aso")
|
||||
If TC.ABGABEN IsNot Nothing Then
|
||||
'MsgBox(TC.ABGABEN.Count)
|
||||
For Each ABG In TC.ABGABEN
|
||||
If ABG IsNot Nothing AndAlso ABG.Amnt > 0 Then
|
||||
' MsgBox(ABG.Amnt)
|
||||
Dim ABGABEN As New VERAG_PROG_ALLGEMEIN.cAbgaben(TC.telanm_CRN, ABG.Ty, ABG.Amnt)
|
||||
If Not ABGABEN.hasEntry Then
|
||||
Dim LeistungsNr = ""
|
||||
Dim LeistungsBez = ""
|
||||
|
||||
Dim saveAbgaben = True
|
||||
Select Case ABG.Ty
|
||||
Case "2EU", "2IG", "5EU" ' "2PE",
|
||||
LeistungsNr = "20"
|
||||
Case "B00" 'EUST
|
||||
LeistungsNr = "20"
|
||||
ABGABEN.Status = "A" 'AUSGEBUCHT
|
||||
Case "5EV" '"5EV"--> EV-KONTO!!
|
||||
saveAbgaben = False
|
||||
Case "2DU", "5DU", "5ZO", "5ZZ", "A20", "A30", "A35", "A40", "A45", "C00", "C10", "A00"
|
||||
LeistungsNr = "76"
|
||||
Case Else '1BD,0ML, 0PB, 0PG, 0PS, 1LG, 1ZN, 2AS, 2KO, 2RB, 2SB, 2SI, 2VF, 2VS, 5SI, 5VS, 6AK, 6BE, 6MS, 6SS, 6TS, 6ZW, 9EA, D00,D10,E00
|
||||
LeistungsNr = "482"
|
||||
LeistungsBez = getLeistungsBez(ABG.Ty)
|
||||
End Select
|
||||
If saveAbgaben Then
|
||||
|
||||
ABGABEN.Belegart = ABG.Ty
|
||||
ABGABEN.Betrag = CDbl(ABG.Amnt)
|
||||
ABGABEN.Status = Nothing
|
||||
ABGABEN.LeistungsNr = LeistungsNr
|
||||
ABGABEN.Bezugsnummer = TC.telanm_BezugsNr
|
||||
ABGABEN.Registriernummer = TC.telanm_CRN
|
||||
' ABGABEN.AOFD = A.KennBuchstabenAufschub
|
||||
ABGABEN.AKTO = TC.Hea_DefPayRef '"3027279" 'd1.Abgabenkonto 'IMEX--> FIX!!!
|
||||
'ABGABEN.Fälligkeitsdatum = A.Faelligkeit
|
||||
' ABGABEN.Mandant = "VERG"
|
||||
ABGABEN.Niederlassung = TC.Bereich_ID
|
||||
ABGABEN.Abfertigungsdatum = ABG.Erstelldatum
|
||||
ABGABEN.Übernahmedatum = ABG.Erstelldatum
|
||||
ABGABEN.Eingabedatum = Now.ToShortDateString
|
||||
ABGABEN.Sachbearbeiter = "AUTO"
|
||||
ABGABEN.LeistungsBez = LeistungsBez
|
||||
If If(ABGABEN.Bezugsnummer, "").ToString.Length > 35 Then ABGABEN.Bezugsnummer = ABGABEN.Bezugsnummer.ToString.Substring(0, 35)
|
||||
If If(ABGABEN.Registriernummer, "").ToString.Length > 21 Then ABGABEN.Registriernummer = ABGABEN.Registriernummer.ToString.Substring(0, 21)
|
||||
|
||||
Dim errHInweis = "ATC: " & ABGABEN.Registriernummer & " - BezugsNr: " & ABGABEN.Bezugsnummer
|
||||
ABGABEN.SAVE(errHInweis)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Shared Function getLeistungsBez(LeistungsBez)
|
||||
Select Case LeistungsBez
|
||||
Case "0ML"
|
||||
getLeistungsBez = "Altlastenbeitrag"
|
||||
Case "0PB"
|
||||
getLeistungsBez = "Punzierungskontrollgeb. Platin"
|
||||
Case "0PG"
|
||||
getLeistungsBez = "Punzierungskontrollgebühr Gold"
|
||||
Case "0PS"
|
||||
getLeistungsBez = "Punzierungskontrollgeb. Silber"
|
||||
Case "1BD"
|
||||
getLeistungsBez = "Bemessungsdatum"
|
||||
Case "1LG"
|
||||
getLeistungsBez = "Lagergeld gemäß §104 ZollR-DG"
|
||||
Case "1ZK"
|
||||
getLeistungsBez = "Kreditzinsen, Säumniszinsen"
|
||||
Case "1ZN"
|
||||
getLeistungsBez = "Nebenansprüche"
|
||||
Case "2AS"
|
||||
getLeistungsBez = "Agrarsicherheiten"
|
||||
Case "2DU"
|
||||
getLeistungsBez = "Antidumping-Sicherheit"
|
||||
Case "2EU"
|
||||
getLeistungsBez = "EUSt-Sicherheit"
|
||||
Case "2IG"
|
||||
getLeistungsBez = "Sicherheit EUSt ig. Lieferung"
|
||||
Case "2KO"
|
||||
getLeistungsBez = "Sicherheit für Kontingent"
|
||||
Case "2PE"
|
||||
getLeistungsBez = "Sicherheit bei Einfuhrwerten"
|
||||
Case "2RB"
|
||||
getLeistungsBez = "Sicherheit Bürgerschaft"
|
||||
Case "2SB"
|
||||
getLeistungsBez = "Summe der befreiten Sicherheit"
|
||||
Case "2SI"
|
||||
getLeistungsBez = "Sicherheit Geldbetragerlag"
|
||||
Case "2VF"
|
||||
getLeistungsBez = "Sicherheit bei Verifizierung"
|
||||
Case "2VS"
|
||||
getLeistungsBez = "Summe der vorg. Sicherheit"
|
||||
Case "2ZG"
|
||||
getLeistungsBez = "Zusatzzoll Geflügel"
|
||||
Case "2ZZ"
|
||||
getLeistungsBez = "Zusatzzoll Zucker"
|
||||
Case "2ZZ"
|
||||
getLeistungsBez = "Zusatzzoll 2ZZ"
|
||||
Case "5DU"
|
||||
getLeistungsBez = "Antidumping-und Ausgleichszoll"
|
||||
Case "5EU"
|
||||
getLeistungsBez = "Einfuhrumsatzsteuer"
|
||||
Case "5EV"
|
||||
getLeistungsBez = "EUSt gem. §26 Abs. 3Z.2UStG"
|
||||
Case "5SI"
|
||||
getLeistungsBez = "Agrarsicherheit"
|
||||
Case "5VS"
|
||||
getLeistungsBez = "Verbrauchsteuern"
|
||||
Case "5ZO"
|
||||
getLeistungsBez = "Zoll 5ZO"
|
||||
Case "5ZZ"
|
||||
getLeistungsBez = "Zusatzzoll 5ZZ"
|
||||
Case "6AK"
|
||||
getLeistungsBez = "Alkoholsteuer"
|
||||
Case "6BE"
|
||||
getLeistungsBez = "Biersteuer"
|
||||
Case "6MS"
|
||||
getLeistungsBez = "Mineralölsteuer"
|
||||
Case "6SS"
|
||||
getLeistungsBez = "Schaumweinsteuer"
|
||||
Case "6TS"
|
||||
getLeistungsBez = "Tabaksteuer"
|
||||
Case "6ZW"
|
||||
getLeistungsBez = "Zwischenerzeugnissteuer"
|
||||
Case "9EA"
|
||||
getLeistungsBez = "Summe Gesamtabgaben"
|
||||
Case "A00"
|
||||
getLeistungsBez = "Zölle auf gewerbliche Waren"
|
||||
Case "A00"
|
||||
getLeistungsBez = "Zollabgaben"
|
||||
Case "A10"
|
||||
getLeistungsBez = "Zölle landwirt. Erzeugnisse"
|
||||
Case "A20"
|
||||
getLeistungsBez = "Zusatzzölle"
|
||||
Case "A30"
|
||||
getLeistungsBez = "endgültige Antidumpingzölle"
|
||||
Case "A35"
|
||||
getLeistungsBez = "vorläufige Antidumpingzölle"
|
||||
Case "A40"
|
||||
getLeistungsBez = "endgültiger Ausgleichszoll"
|
||||
Case "A45"
|
||||
getLeistungsBez = "vorläufiger Ausgleichszoll"
|
||||
Case "B00"
|
||||
getLeistungsBez = "Einfuhrumsatzsteuer(EUSt)"
|
||||
Case "B10"
|
||||
getLeistungsBez = "Ausgleichszinsen(EUSt)"
|
||||
Case "C00"
|
||||
getLeistungsBez = "Ausfuhrabgaben"
|
||||
Case "C10"
|
||||
getLeistungsBez = "Ausfuhrabg. landwirt. Erzeug."
|
||||
Case "D00"
|
||||
getLeistungsBez = "Verzugszinsen"
|
||||
Case "D10"
|
||||
getLeistungsBez = "Ausgleichszinsen"
|
||||
Case "E00"
|
||||
getLeistungsBez = "Abgaben anderer Länder"
|
||||
Case Else
|
||||
getLeistungsBez = ""
|
||||
End Select
|
||||
End Function
|
||||
|
||||
|
||||
@@ -380,36 +535,7 @@ Public Class cZOLL_IMPORT
|
||||
Dim FindPOS = SENDUNG.ABRECHNUNG.Find(Function(x) x.sndabr_beteiligter = "AUFTR" And x.sndabr_wert = "ERSTATTUNG")
|
||||
If FindPOS IsNot Nothing Then SPEDITIONSBUCH.AuftraggeberBetragKassiert = If(FindPOS.sndabr_preis, 0)
|
||||
|
||||
Try
|
||||
|
||||
Dim dt As DataTable = KDSQL.loadDgvBySql("SELECT * FROM ( " &
|
||||
" SELECT rksv_BelegId, isnull(rksv_umsatz ,0) as rksv_umsatz, isnull((Select Name from Personal where ID=b.Benutzer),'') as Benutzer FROM [tblEABelegnummer] as b INNER JOIN [tblEABelegposition] as p ON (b.BelegNr = p.BelegNr AND b.BelegDat = p.BelegDat AND b.Benutzer = p.Benutzer AND b.Niederlassung = p.Niederlassung AND b.Mandant = p.Mandant) where b.AbfertigungsNr='" & SPEDITIONSBUCH.AbfertigungsNr & "' and b.FilialenNr='" & SPEDITIONSBUCH.FilialenNr & "' and storniert=0 and gebuchtstorno=0 " &
|
||||
" UNION " &
|
||||
" SELECT rksv_BelegId , sum(p.Betrag) as rksv_umsatz,isnull((Select Name from Personal where ID=b.Benutzer),'') as Benutzer FROM [tblEABelegnummer] as b INNER JOIN [tblEABelegposition] as p ON (b.BelegNr = p.BelegNr AND b.BelegDat = p.BelegDat AND b.Benutzer = p.Benutzer AND b.Niederlassung = p.Niederlassung AND b.Mandant = p.Mandant) where p.AbfertigungsNr='" & SPEDITIONSBUCH.AbfertigungsNr & "' and p.FilialenNr='" & SPEDITIONSBUCH.FilialenNr & "' and storniert=0 and gebuchtstorno=0 group by rksv_BelegId,b.Benutzer " &
|
||||
" ) as Tb order by rksv_BelegId", "FMZOLL")
|
||||
Dim BenutzerTmp = ""
|
||||
Dim BelegNrTmp = ""
|
||||
Dim BetragTmp As Double = 0
|
||||
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
|
||||
For Each r In dt.Rows
|
||||
If BenutzerTmp = "" Then BenutzerTmp = r("Benutzer")
|
||||
If r("Benutzer") <> BenutzerTmp Then BenutzerTmp = "Div.Benutzer"
|
||||
If (IsNumeric(r("rksv_umsatz"))) Then BetragTmp += r("rksv_umsatz")
|
||||
BelegNrTmp &= r("rksv_BelegId") & ","
|
||||
Next
|
||||
BenutzerTmp = getBenutzerShort(BenutzerTmp)
|
||||
If BelegNrTmp.EndsWith(",") Then BelegNrTmp = BelegNrTmp.Substring(0, BelegNrTmp.Length - 1)
|
||||
SPEDITIONSBUCH.Bar = True
|
||||
|
||||
If SPEDITIONSBUCH.ErfassungsNr = "" Then SPEDITIONSBUCH.ErfassungsNr = "VERA/" & VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG & "/" & BenutzerTmp & "/" & CDate(SPEDITIONSBUCH.Abfertigungsdatum).ToShortDateString & "/" & BelegNrTmp & "/" & BetragTmp
|
||||
If SPEDITIONSBUCH.Barzahlungsbetrag = 0 Then SPEDITIONSBUCH.Barzahlungsbetrag = BetragTmp
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name,, "BAR-Err: Beträge konnten nicht geladen werden!", "al@verag.ag", "al@verag.ag")
|
||||
End Try
|
||||
SetBarKassiert(SPEDITIONSBUCH)
|
||||
|
||||
'If If(SENDUNG.tblSnd_bar, False) Then
|
||||
'SPEDITIONSBUCH.Bar = True
|
||||
@@ -584,6 +710,43 @@ Public Class cZOLL_IMPORT
|
||||
Return SPEDITIONSBUCH
|
||||
End Function
|
||||
|
||||
|
||||
Shared Sub SetBarKassiert(ByRef SPEDITIONSBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch)
|
||||
Try
|
||||
|
||||
Dim KDSQL As New SQL
|
||||
Dim dt As DataTable = KDSQL.loadDgvBySql("SELECT * FROM ( " &
|
||||
" SELECT rksv_BelegId, isnull(rksv_umsatz ,0) as rksv_umsatz, isnull((Select Name from Personal where ID=b.Benutzer),'') as Benutzer FROM [tblEABelegnummer] as b INNER JOIN [tblEABelegposition] as p ON (b.BelegNr = p.BelegNr AND b.BelegDat = p.BelegDat AND b.Benutzer = p.Benutzer AND b.Niederlassung = p.Niederlassung AND b.Mandant = p.Mandant) where b.AbfertigungsNr='" & SPEDITIONSBUCH.AbfertigungsNr & "' and b.FilialenNr='" & SPEDITIONSBUCH.FilialenNr & "' and storniert=0 and gebuchtstorno=0 " &
|
||||
" UNION " &
|
||||
" SELECT rksv_BelegId , sum(p.Betrag) as rksv_umsatz,isnull((Select Name from Personal where ID=b.Benutzer),'') as Benutzer FROM [tblEABelegnummer] as b INNER JOIN [tblEABelegposition] as p ON (b.BelegNr = p.BelegNr AND b.BelegDat = p.BelegDat AND b.Benutzer = p.Benutzer AND b.Niederlassung = p.Niederlassung AND b.Mandant = p.Mandant) where p.AbfertigungsNr='" & SPEDITIONSBUCH.AbfertigungsNr & "' and p.FilialenNr='" & SPEDITIONSBUCH.FilialenNr & "' and storniert=0 and gebuchtstorno=0 group by rksv_BelegId,b.Benutzer " &
|
||||
" ) as Tb order by rksv_BelegId", "FMZOLL")
|
||||
Dim BenutzerTmp = ""
|
||||
Dim BelegNrTmp = ""
|
||||
Dim BetragTmp As Double = 0
|
||||
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
|
||||
For Each r In dt.Rows
|
||||
If BenutzerTmp = "" Then BenutzerTmp = r("Benutzer")
|
||||
If r("Benutzer") <> BenutzerTmp Then BenutzerTmp = "Div.Benutzer"
|
||||
If (IsNumeric(r("rksv_umsatz"))) Then BetragTmp += r("rksv_umsatz")
|
||||
BelegNrTmp &= r("rksv_BelegId") & ","
|
||||
Next
|
||||
BenutzerTmp = getBenutzerShort(BenutzerTmp)
|
||||
If BelegNrTmp.EndsWith(",") Then BelegNrTmp = BelegNrTmp.Substring(0, BelegNrTmp.Length - 1)
|
||||
SPEDITIONSBUCH.Bar = True
|
||||
|
||||
If SPEDITIONSBUCH.ErfassungsNr = "" Then SPEDITIONSBUCH.ErfassungsNr = "VERA/" & VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG & "/" & BenutzerTmp & "/" & CDate(SPEDITIONSBUCH.Abfertigungsdatum).ToShortDateString & "/" & BelegNrTmp & "/" & BetragTmp
|
||||
If SPEDITIONSBUCH.Barzahlungsbetrag = 0 Then SPEDITIONSBUCH.Barzahlungsbetrag = BetragTmp
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name,, "BAR-Err: Beträge konnten nicht geladen werden!", "al@verag.ag", "al@verag.ag")
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Shared Function getBenutzerShort(s As String) As String
|
||||
If s.ToString.Contains(" ") Then
|
||||
Dim split() = s.ToString.Split(" ")
|
||||
|
||||
Reference in New Issue
Block a user