This commit is contained in:
2026-03-27 10:19:40 +01:00
25 changed files with 905 additions and 219 deletions

View File

@@ -81,24 +81,40 @@ Public Class cMSEAPI
End Function
Public Shared Function countBackToCustomerNotSet(SQL As SQL) As Integer
Return SQL.getValueTxtBySql("SELECT count(InvToCustomer) FROM [tblMSEInvoices] where InvToCustomer Is null ", "FMZOLL",,, -1)
Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblMSEInvoices] where InvToCustomer Is null ", "FMZOLL",,, -1)
End Function
Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing) As DataTable
Public Shared Function countBackToCustomerNotSet(SQL As SQL, AdressenNrVon As Integer, AdressenNrBis As Integer) As Integer
Return SQL.getValueTxtBySql("SELECT count(*) FROM [tblMSEInvoices] inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] where InvToCustomer Is null AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis, "FMZOLL",,, -1)
End Function
Public Shared Function checkPDFInvoices(Optional reDatVon As Date = Nothing, Optional reDatBis As Date = Nothing, Optional dt As DataTable = Nothing, Optional AdressenNrVon As Integer = -1, Optional AdressenNrBis As Integer = -1) As Integer
Try
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim sqlTime As String = ""
Dim sqlAdressenNr As String = ""
If IsDate(reDatVon) AndAlso CDate(reDatVon) > "01.01.2020" AndAlso IsDate(reDatBis) AndAlso CDate(reDatBis) > "01.01.2020" Then
sqlTime = " And cast(invoice_date As Date) between '" & reDatVon.ToShortDateString & "' and '" & reDatBis.ToShortDateString & "'"
End If
Dim SQLstr = "Select invoice_id As RechnungsNr,[invoice_date] As Rechnungsdatum, Adressen.AdressenNr As KundenNr,Adressen.[Name 1] As Kunde, kde_keineMWSt As keineMWST from tblMSEInvoices inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where daId Is null " & sqlTime & " group by invoice_id, Adressen.AdressenNr, Adressen.[Name 1], invoice_date, kde_keineMWSt"
If AdressenNrVon > 0 AndAlso AdressenNrBis > 0 Then
sqlAdressenNr = " AND Adressen.AdressenNr between " & AdressenNrVon & " AND " & AdressenNrBis
End If
If dt IsNot Nothing Then
Dim SQLstr = "Select invoice_id As RechnungsNr,[invoice_date] As Rechnungsdatum, Adressen.AdressenNr As KundenNr,Adressen.[Name 1] As Kunde, kde_keineMWSt As keineMWST from tblMSEInvoices inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where daId Is null " & sqlTime & sqlAdressenNr & " group by invoice_id, Adressen.AdressenNr, Adressen.[Name 1], invoice_date, kde_keineMWSt"
dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL")
Return dt.Rows.Count
Else
Dim SQLstr = "Select count(*) from tblMSEInvoices inner join [tblMSECustomers] On [customer_number] = [customer_id] INNER JOIN Adressen On Adressen.MSEKundenNr = [customer_number] INNER JOIN tblKundenErweitert On AdressenNr = kde_KundenNr where daId Is null " & sqlTime & sqlAdressenNr
Return SQL.getValueTxtBySql(SQLstr, "FMZOLL",,, 0)
End If
Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql(SQLstr, "FMZOLL")
Return dt
Catch ex As Exception
@@ -1179,36 +1195,46 @@ Public Class cMSEAPI
' Amounts
If Not IsDBNull(currentRow(35)) Then
Double.TryParse(currentRow(35).ToString(), total_amount_euro)
Double.TryParse(currentRow(35).ToString().Replace(".", ","), total_amount_euro)
End If
If Not IsDBNull(currentRow(36)) Then
Double.TryParse(currentRow(36).ToString().Replace(".", ","), total_vat_amount_euro)
End If
'If total_amount_euro <> 0 OrElse total_vat_amount_euro <> 0 Then
' MsgBox("Hier " & total_amount_euro & " " & total_vat_amount_euro)
'End If
Dim inv As New cMSEInvoices(invoiceDate, Country, customerID)
inv.invoice_id = invoiceID
If lngRecordCount = 2 Then
MDMEinarb.invoicedate = invoiceDate
End If
If Not inv.hasEntry Then
inv.invoice_id = invoiceID
If lngRecordCount = 2 Then
MDMEinarb.invoicedate = invoiceDate
End If
If inv.hasEntry Then
inv.total_amount_euro += total_amount_euro
inv.total_vat_amount_euro += total_vat_amount_euro
Else
inv.total_amount_euro = total_amount_euro
inv.total_vat_amount_euro = total_vat_amount_euro
End If
inv.name = "TEMP"
inv.msts_vat_number = -1
inv.alternativeImport = True
inv.SAVEBYCUSTOMERIDDATE()
inv.name = "TEMP"
inv.msts_vat_number = -1
inv.alternativeImport = True
inv.SAVEBYCUSTOMERIDDATE()
Console.WriteLine("MSE: " & isleernothing((currentRow(1))) & " - " & lngRecordCount & " - " & isleernothing((currentRow(10))))
Else
If total_amount_euro <> 0 OrElse total_vat_amount_euro <> 0 Then 'nicht relevanten Änderungen überspringen!
inv.total_amount_euro += total_amount_euro
inv.total_vat_amount_euro += total_vat_amount_euro
inv.SAVEBYCUSTOMERIDDATE()
End If
End If
Console.WriteLine("MSE: " & isleernothing((currentRow(1))) & " - " & lngRecordCount & " - " & isleernothing((currentRow(10))))
@@ -1780,7 +1806,7 @@ Public Class cMSEInvoices
Public Function SAVEBYCUSTOMERIDDATE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblMSEInvoices WHERE invoice_date=@invoice_date AND invoice_id = @invoice_id AND customer_number = @customer_number) " &
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblMSEInvoices WHERE invoice_date=@invoice_date AND invoice_id = @invoice_id AND customer_number = @customer_number AND country = @country) " &
" BEGIN " & getUpdateCmdBYCustomeridDate() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
@@ -1793,7 +1819,7 @@ Public Class cMSEInvoices
Public Function SAVEBYCountry() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblMSEInvoices WHERE invoice_date=@invoice_date AND invoice_id = @invoice_id AND customer_number = @customer_number) " &
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblMSEInvoices WHERE invoice_date=@invoice_date AND country = @country AND customer_number = @customer_number) " &
" BEGIN " & getUpdateCmdBYCustomeridDateCountry() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
@@ -1950,7 +1976,7 @@ Public Class cMSEInvoices
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
Return (" UPDATE tblMSEInvoices SET " & str & " WHERE invoice_date=@invoice_date AND invoice_id = @invoice_id AND customer_number = @customer_number ")
Return (" UPDATE tblMSEInvoices SET " & str & " WHERE invoice_date=@invoice_date AND invoice_id = @invoice_id AND customer_number = @customer_number AND country = @country ")
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)

View File

@@ -304,14 +304,14 @@ Public Class cTimasAPI
Dim success As Boolean
Dim json As New Chilkat.JsonObject
success = json.UpdateString("externid", mitarbeiter.mit_id)
success = json.UpdateString("externid", mitarbeiter.mit_terminalTimasId)
success = json.UpdateString("markingColor", "#3acc2d")
success = json.UpdateString("pnr1", mitarbeiter.mit_PersonalNr) 'für Personalverr.
'success = json.UpdateString("pnr2", "ZZ-3A-Q")
success = json.UpdateString("firstname", mitarbeiter.mit_vname)
success = json.UpdateString("lastname", mitarbeiter.mit_nname)
success = json.UpdateString("gender", IIf(mitarbeiter.mit_geschlecht = "m", "male", "female"))
success = json.UpdateInt("card", mitarbeiter.mit_id)
success = json.UpdateInt("card", mitarbeiter.mit_terminalTimasId)
success = json.UpdateString("info", mitarbeiter.mit_firma & " - " & mitarbeiter.mit_abteilung)
If mitarbeiter.mit_gebdat <> "" And IsDate(mitarbeiter.mit_gebdat) Then
success = json.UpdateString("birthday", CDate(mitarbeiter.mit_gebdat).ToString("yyyy-MM-dd"))