IDS RechnungenNachLand, PloseImport, etc.
This commit is contained in:
@@ -4,8 +4,8 @@ Imports System.Net
|
||||
Imports System.Net.Security
|
||||
Imports System.Security.Cryptography.X509Certificates
|
||||
Imports System.Text
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Xml
|
||||
Imports io.konik.zugferd
|
||||
Imports MDM_Worker
|
||||
Imports Renci.SshNet
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
@@ -4965,7 +4965,7 @@ Public Class frmStartOptions
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cbxTestsystem.Checked
|
||||
Dim f As New frmNachrichtenVerarbeitung_MDM_divers("UTA", False, False, cbxDateienlöschenUTA.Checked)
|
||||
f.year = txtUTAYear.Text
|
||||
f.UtaTestkunden = cbxUTATestkunden.Checked
|
||||
f.UtaTestkunden = False
|
||||
f.ShowDialog()
|
||||
Me.Visible = True
|
||||
End Sub
|
||||
@@ -5620,9 +5620,188 @@ Public Class frmStartOptions
|
||||
|
||||
Private Sub LinkLabel72_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel72.LinkClicked
|
||||
If txtPloseJahr.Text.ToString.Length <> 4 Then MsgBox("Bitte Jahr eingeben!") : Exit Sub
|
||||
Dim kdNrPlose As Integer = -1
|
||||
If txtPLoseKdNr.Text <> "" AndAlso IsNumeric(txtPLoseKdNr.Text) Then kdNrPlose = txtPLoseKdNr.Text
|
||||
|
||||
cPLOSE_Inv_Data.setDatenarchivID(txtPloseJahr.Text, True)
|
||||
cPLOSE_Inv_Data.setDatenarchivID(txtPloseJahr.Text, True, kdNrPlose)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel73_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel73.LinkClicked
|
||||
|
||||
|
||||
Dim fehlendeRechungsdatenOhneDVR As String = "select upper([Invoicenumber]) as Invoicenumber, CustomerCode, cast(YearMonthDay as Date) as YearMonthDay FROM [VERAG].[dbo].tblIDSInvoicesNewSplittedByCountry where TransactionVolume is null and AmminclVAT is null and TotalNetAmount is null and VATAmount is null and [Invoicenumber] not like 'DEVR%'"
|
||||
|
||||
Dim fehlendeRechungsdatenMitDVR As String = "select upper([Invoicenumber]) as Invoicenumber, CustomerCode, cast(YearMonthDay as Date) as YearMonthDay FROM [VERAG].[dbo].tblIDSInvoicesNewSplittedByCountry where TransactionVolume is null and AmminclVAT is null and TotalNetAmount is null and VATAmount is null and [Invoicenumber] like 'DEVR%'"
|
||||
|
||||
Dim fehlendeRechungsdatenTotalInvoiceID As String = "select CustomerCode, cast(YearMonthDay as Date) as YearMonthDay FROM [VERAG].[dbo].tblIDSInvoicesNewSplittedByCountry where TotalInvoiceId is null"
|
||||
|
||||
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dtRechnnungsdatenOhneDVR As DataTable = SQL.loadDgvBySql(fehlendeRechungsdatenOhneDVR, "FMZOLL")
|
||||
|
||||
Dim dtRechnnungsdatenMitDVR As DataTable = SQL.loadDgvBySql(fehlendeRechungsdatenMitDVR, "FMZOLL")
|
||||
|
||||
Dim dtRechnnungsdatenTotalInvoiceID As DataTable = SQL.loadDgvBySql(fehlendeRechungsdatenTotalInvoiceID, "FMZOLL")
|
||||
|
||||
If dtRechnnungsdatenOhneDVR.Rows.Count > 0 Then
|
||||
For Each r As DataRow In dtRechnnungsdatenOhneDVR.Rows
|
||||
|
||||
|
||||
SQL.doSQL("
|
||||
UPDATE
|
||||
inv
|
||||
SET
|
||||
inv.TransactionVolume = t.calcTrans,
|
||||
inv.AmminclVAT = t.calcInclvat,
|
||||
inv.TotalNetAmount = t.totalNet,
|
||||
inv.VATAmount = t.net
|
||||
FROM
|
||||
[VERAG].[dbo].[tblIDSInvoicesNewSplittedByCountry] AS inv
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
OBONumber,CustomerCode, YearMonthDay,
|
||||
sum([TransactionVolume]) as calcTrans, sum([AmminclVAT]) as calcInclvat, sum([TotalNetAmount]) as totalNet, sum([VATAmount]) as net
|
||||
|
||||
FROM [VERAG].[dbo].[tblIDSTransactionsNew]
|
||||
|
||||
WHERE
|
||||
Replace([OBONumber],'/','') = '" & r.Item("Invoicenumber") & "' and CustomerCode = '" & r.Item("CustomerCode") & "' and YearMonthDay = '" & r.Item("YearMonthDay") & "'
|
||||
GROUP BY
|
||||
OBONumber,CustomerCode, YearMonthDay
|
||||
) t
|
||||
ON
|
||||
Replace(t.OBONumber,'/','') = inv.Invoicenumber
|
||||
WHERE
|
||||
inv.Invoicenumber = '" & r.Item("Invoicenumber") & "' and inv.CustomerCode = '" & r.Item("CustomerCode") & "' and inv.YearMonthDay = '" & r.Item("YearMonthDay") & "' ", "FMZOLL")
|
||||
|
||||
|
||||
Next
|
||||
MsgBox("alle Rechnungspositionsdaten gesetzt!")
|
||||
Else
|
||||
MsgBox("keine fehlenden Rechnungspositionsdaten vorhanden!")
|
||||
End If
|
||||
|
||||
|
||||
If dtRechnnungsdatenMitDVR.Rows.Count > 0 Then
|
||||
For Each r As DataRow In dtRechnnungsdatenMitDVR.Rows
|
||||
|
||||
|
||||
SQL.doSQL("
|
||||
UPDATE
|
||||
inv
|
||||
SET
|
||||
inv.TransactionVolume = t.calcTrans,
|
||||
inv.AmminclVAT = t.calcInclvat,
|
||||
inv.TotalNetAmount = t.totalNet,
|
||||
inv.VATAmount = t.net
|
||||
FROM
|
||||
[VERAG].[dbo].[tblIDSInvoicesNewSplittedByCountry] AS inv
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
VRNumber,CustomerCode, YearMonthDay,
|
||||
sum([TransactionVolume]) as calcTrans, sum([AmminclVAT]) as calcInclvat, sum([TotalNetAmount]) as totalNet, sum([VATAmount]) as net
|
||||
|
||||
FROM [VERAG].[dbo].[tblIDSTransactionsNew]
|
||||
|
||||
WHERE
|
||||
VRNumber = '" & r.Item("Invoicenumber") & "' and CustomerCode = '" & r.Item("CustomerCode") & "' and YearMonthDay = '" & r.Item("YearMonthDay") & "'
|
||||
GROUP BY
|
||||
VRNumber,CustomerCode, YearMonthDay
|
||||
) t
|
||||
ON
|
||||
VRNumber = inv.Invoicenumber
|
||||
WHERE
|
||||
inv.Invoicenumber = '" & r.Item("Invoicenumber") & "' and inv.CustomerCode = '" & r.Item("CustomerCode") & "' and inv.YearMonthDay = '" & r.Item("YearMonthDay") & "' ", "FMZOLL")
|
||||
|
||||
|
||||
Next
|
||||
MsgBox("alle Rechnungspositionsdaten gesetzt!")
|
||||
Else
|
||||
MsgBox("keine fehlenden Rechnungspositionsdaten vorhanden!")
|
||||
End If
|
||||
|
||||
|
||||
If dtRechnnungsdatenTotalInvoiceID.Rows.Count > 0 Then
|
||||
For Each r As DataRow In dtRechnnungsdatenTotalInvoiceID.Rows
|
||||
|
||||
|
||||
SQL.doSQL("
|
||||
UPDATE
|
||||
inv
|
||||
SET
|
||||
inv.TotalInvoiceId = t.invoice_id
|
||||
|
||||
FROM
|
||||
[VERAG].[dbo].[tblIDSInvoicesNewSplittedByCountry] AS inv
|
||||
INNER JOIN
|
||||
(
|
||||
|
||||
SELECT
|
||||
|
||||
invoice_id
|
||||
|
||||
FROM [VERAG].[dbo].[tblIDSInvoicesNew]
|
||||
|
||||
WHERE
|
||||
CustomerCode = '" & r.Item("CustomerCode") & "' and YearMonthDay = '" & r.Item("YearMonthDay") & "'
|
||||
|
||||
) t
|
||||
ON
|
||||
CustomerCode = inv.CustomerCode and YearMonthDay = inv.YearMonthDay
|
||||
WHERE
|
||||
inv.CustomerCode = '" & r.Item("CustomerCode") & "' and inv.YearMonthDay = '" & r.Item("YearMonthDay") & "' ", "FMZOLL")
|
||||
|
||||
|
||||
Next
|
||||
MsgBox("alle TotalInvoiceIDs gesetzt!")
|
||||
Else
|
||||
MsgBox("keine fehlenden TotalInvoiceIDs vorhanden!")
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel74_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel74.LinkClicked
|
||||
|
||||
Dim utaDate As New Date
|
||||
|
||||
If IsDate(txtUTADate.Text) Then
|
||||
utaDate = CDate(txtUTADate.Text)
|
||||
Else
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim fehlendePDFzuRE As String = "select Rechnungsnummer_pro_Lieferland, cast([Rechnungsdatum] as Date) as Rechnungsdatum, Kundennummer, Abrechnungsnummer from tblUTAImportNew where daId is null and cast([Rechnungsdatum] as Date) = '" & utaDate & "' and Lieferland <> 'ROM' and Steuerliches_Lieferland <> 'ROM' group by Rechnungsdatum, Kundennummer, Abrechnungsnummer, Rechnungsnummer_pro_Lieferland "
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dtRechnnungsdaten As DataTable = SQL.loadDgvBySql(fehlendePDFzuRE, "FMZOLL")
|
||||
|
||||
If dtRechnnungsdaten.Rows.Count > 0 Then
|
||||
|
||||
For Each r As DataRow In dtRechnnungsdaten.Rows
|
||||
|
||||
|
||||
Dim daId As Integer = 0
|
||||
daId = CInt(SQL.getValueTxtBySql("Select top(1) isnull(da_id,0) FROM tblDatenarchiv WHERE da_KundenNr = 0 And da_kategorie = 'MDM' AND da_ordner='MDM_DATEN' AND da_uOrdner1= 'UTA' AND da_uOrdner2= '" & utaDate.Year & "' AND da_name like '%ZUGFERD.pdf' AND da_name like '%" & r.Item("Kundennummer") & "_" & r.Item("Abrechnungsnummer") & "_" & r.Item("Rechnungsnummer_pro_Lieferland") & "%'", "FMZOLL",,, 0))
|
||||
If daId > 0 Then
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(daId)
|
||||
Dim Path As String = DS.GET_TOP1_PATH()
|
||||
If Path <> "" And System.IO.File.Exists(Path) Then
|
||||
SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "', daIdgesetztDatum = getdate() where [Rechnungsnummer_pro_Lieferland] = '" & r.Item("Rechnungsnummer_pro_Lieferland") & "' AND cast(Rechnungsdatum as Date) = '" & utaDate & "' AND Kundennummer =" & r.Item("Kundennummer") & " and Abrechnungsnummer =" & r.Item("Abrechnungsnummer") & " and daId is null", "FMZOLL")
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user