sdl änderungen

This commit is contained in:
2024-09-19 14:02:39 +02:00
parent 1c3bfacdc6
commit b47be8cbc6
7 changed files with 224 additions and 41 deletions

View File

@@ -78,7 +78,7 @@ Public Class frmMDMDatenverarbetiung
btnDatenLaden.Text = "Daten laden"
Case "ASFINAG" : initDgv_ASFINAG(cbxASFINAGAbgerechnet.Checked, cbxBelegeerstellt.Checked)
btnDatenLaden.Text = "Daten laden"
Case "IDS" : MsgBox("Nicht verfügbar!")
Case "IDS" 'MsgBox("Nicht verfügbar!")
btnDatenLaden.Text = "Daten laden"
Case "MSE" : initDgv_MSE()
btnDatenLaden.Text = "Daten laden"
@@ -988,7 +988,7 @@ Public Class frmMDMDatenverarbetiung
Function genRGAtt_UTA() As Boolean
Dim top = ""
'top = " TOP 20 "
Dim SQLStr = " SELECT " & top & " Kundennummer AS [Customer ID], KundenNr AS [Customer Nr], UTAExportCSV,Rechnungsdruck
Dim SQLStr = " SELECT Kundennummer AS [Customer ID], KundenNr AS [Customer Nr], UTAExportCSV,Rechnungsdruck
FROM tblUTAFakturierwarenarten
INNER JOIN (((Adressen INNER JOIN tblUTAImport ON Adressen.UTAKundenNr = tblUTAImport.Kundennummer)
INNER JOIN Offertenpositionen ON Adressen.AdressenNr = Offertenpositionen.KundenNr)
@@ -1106,7 +1106,7 @@ Public Class frmMDMDatenverarbetiung
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0)
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 0 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0)
order by cust.customer_id"
Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200)
@@ -1118,6 +1118,7 @@ Public Class frmMDMDatenverarbetiung
End If
Dim cnt = 0
If vbYes = MsgBox("Es wurden Daten von " & dt_Main.Rows.Count & " Kunden gefunden " & vbNewLine & " Möchten Sie die Anhänge erstellen?", vbYesNoCancel) Then
Dim dir = "F:\FMZoll\MSE\Archiv\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test", "") & Now.ToShortDateString
If Directory.Exists(dir) Then dir &= "_" & Now.ToShortTimeString.Replace(":", "")
@@ -1140,9 +1141,9 @@ Public Class frmMDMDatenverarbetiung
'' as [Eurovignet K-Number], '' as [LKW-Kostenstelle], trans.original_net_amount as [Original Nett Amount], trans.original_vat_amount as [Original VAT Amount], trans.original_gross_amount as [Original Amount], trans.original_currency as [Original Currency],
trans.transaction_gross_amount as [Transaction Amount ( EUR )], trans.msts_fee_amount as [Admin Fee Amount ( EUR )], '' as [Fees and Costs Amount ( EUR )], trans.msts_vat_amount as [VAT Amount ( EUR )],trans.total_gross_amount as [Total Amount ( EUR )], '' as [Total Dutch VAT ( EUR )], '' as [Total Foreign VAT ( EUR )], trans.[USteuer_EUR] as [USteuer_EUR]
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged <> 1 and (trans.transaction_gross_amount <> 0 or [msts_fee_amount] <> 0) and cust.[customer_id] = " & csv.Item("Customer ID"), "FMZOLL")
dt_CSV_selected.ParentRelations.Clear()
dt_CSV_selected.ChildRelations.Clear()
@@ -1201,12 +1202,13 @@ Public Class frmMDMDatenverarbetiung
' ANHÄNGE WERDEN NCIHT BENÖTIGT::
'Alle Alangen im foglenden VZ löschen und die aktuellen kopieren
Dim dirAnhang = "F: \FMZoll\MSE\Anlagen\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test", "") & Now.ToShortDateString
Dim dirAnhang = "F:\FMZoll\MSE\Anlagen\" & IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "Test", "") & Now.ToShortDateString
If Directory.Exists(dirAnhang) Then 'Directory.Delete(dirAnhang, True)
For Each f In Directory.GetFiles(dirAnhang)
File.Delete(f)
Next
End If
If Not Directory.Exists(dirAnhang) Then Directory.CreateDirectory(dirAnhang)
For Each f In Directory.GetFiles(dir)
@@ -1725,7 +1727,7 @@ Public Class frmMDMDatenverarbetiung
Try
'Zeitstempel
Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Entry Terminal],[Exit Terminal],[Nett Amount],[VAT Amount],[Total Amount]) VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P12) "
Dim SQLQuery = "INSERT INTO tblMautbericht (Datenquelle,[Customer No],[Licence Plate Number],[Transaction Date],[Transaction Country],[Product description],[Card Number],[Entry Terminal],[Exit Terminal],[Nett Amount],[VAT Amount],[Total Amount]) VALUES (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10) "
' "SELECT * FROM DBParent WHERE P_ID = " & UniqeID & ";"
Using Command As New OleDbCommand(SQLQuery, con)
@@ -1736,11 +1738,9 @@ Public Class frmMDMDatenverarbetiung
Command.Parameters.AddWithValue("@P5", r(4))
Command.Parameters.AddWithValue("@P6", r(5))
Command.Parameters.AddWithValue("@P7", r(6))
Command.Parameters.AddWithValue("@P8", r(7))
Command.Parameters.AddWithValue("@P9", r(8))
Command.Parameters.AddWithValue("@P8", CDbl(r(7)))
Command.Parameters.AddWithValue("@P9", CDbl(r(8)))
Command.Parameters.AddWithValue("@P10", CDbl(r(9)))
Command.Parameters.AddWithValue("@P11", CDbl(r(10)))
Command.Parameters.AddWithValue("@P12", CDbl(r(11)))
Command.ExecuteNonQuery()
Command.Dispose()
@@ -1780,13 +1780,22 @@ Public Class frmMDMDatenverarbetiung
End If
sqlstr = " Select adressen.AdressenNr As [Customer No],trans.license_plate_number as [Licence Plate Number],cast(trans.[purchase_datetime] as Date) as [Transaction Date], trans.transaction_country As [Transaction Country],trans.device_product_type As [Product description],trans.device_product_number as [Card Number], trans.entry_point_name as [Entry Terminal],trans.exit_point_name as [Exit Terminal], Sum(trans.transaction_gross_amount) As [Nett Amount],Sum(trans.USteuer_EUR) As [VAT Amount], Sum(trans.total_gross_amount) As [Total Amount]
sqlstr = " Select 'MSE',adressen.AdressenNr As [Customer No],
trans.license_plate_number as [Licence Plate Number],
cast(trans.[purchase_datetime] as Date) as [Transaction Date],
trans.transaction_country As [Transaction Country],trans.device_product_type As [Product description],
trans.device_product_number as [Card Number],
trans.entry_point_name as [Entry Terminal],
trans.exit_point_name as [Exit Terminal],
sum(trans.total_gross_amount) - sum(trans.USteuer_EUR) As [Nett Amount],
Sum(trans.USteuer_EUR) As [VAT Amount],
Sum(trans.total_gross_amount) As [Total Amount]
From [VERAG].[dbo].[tblMSESettlements] as bills
inner Join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner Join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner Join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] And inv.customer_number = cust.[customer_id] And trans.transaction_country = inv.country
left Join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left Join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left Join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] And inv.customer_number = cust.[customer_id] And trans.transaction_country = inv.country
Left Join adressen ON cust.[customer_id] = Adressen.MSEKundenNr
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.chargedDatetime is null " & sqlWhere &
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.chargedDatetime is not null " & sqlWhere &
"GROUP BY Adressen.AdressenNr,trans.license_plate_number,cast(trans.[purchase_datetime] as Date), trans.transaction_country,trans.device_product_type, trans.device_product_number, trans.entry_point_name ,trans.exit_point_name
order by Adressen.AdressenNr "
@@ -2249,9 +2258,9 @@ Public Class frmMDMDatenverarbetiung
trans.original_net_amount as [Original Nett Amount], trans.original_vat_amount as [Original VAT Amount], trans.original_gross_amount as [Original Amount], trans.original_currency as [Original Currency],
trans.transaction_gross_amount as [Transaction Amount ( EUR )], trans.msts_fee_amount as [Admin Fee Amount ( EUR )], '' as [Fees and Costs Amount ( EUR )], trans.msts_vat_amount as [VAT Amount ( EUR )],trans.total_gross_amount as [Total Amount ( EUR )], '' as [Total Dutch VAT ( EUR )], '' as [Total Foreign VAT ( EUR )], trans.[USteuer_EUR] as [USteuer_EUR]
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
inner join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
left join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left join [VERAG].[dbo].[tblMSEInvoices] as inv on inv.[invoice_id] = bills.[invoice_number] and inv.customer_number = cust.[customer_id] and trans.transaction_country = inv.country
where bills.invoice_date = '" & DateTimePicker2.Text & "' and (trans.transaction_gross_amount <> 0 or [msts_fee_amount] <> 0) and cust.[customer_id] = " & MSEKdNr
@@ -3621,7 +3630,7 @@ Public Class frmMDMDatenverarbetiung
PictureBox1.Visible = True
End If
Case "MSE"
If SQL.doSQL("UPDATE [tblMSETransactions] Set charged = 1
If SQL.doSQL("UPDATE [VERAG].[dbo].[tblMSETransactions] Set charged = 1
FROM [VERAG].[dbo].[tblMSESettlements] as bills
inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id]
inner join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id