MDM
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Imports System.Data.OleDb
|
||||
Imports System.DirectoryServices.ActiveDirectory
|
||||
Imports System.IO
|
||||
Imports GrapeCity.ActiveReports.Design.DdrDesigner.ReportViewerWinForms.UI.Controls
|
||||
Imports Microsoft.Office.Interop.Outlook
|
||||
|
||||
Public Class frmMDMDatenverarbetiung
|
||||
@@ -794,36 +795,42 @@ Public Class frmMDMDatenverarbetiung
|
||||
'Exit Sub
|
||||
'MsgBox(.sql)
|
||||
|
||||
.SET_SQL("SELECT [transaction_id]
|
||||
,[YearMonthDay] as Datum
|
||||
,[Paymentsummarynumber] as ZahlungsNr
|
||||
,[CustomerCode]
|
||||
,[CustomerName]
|
||||
,[OutletCountryCode]
|
||||
,[OutletCountry]
|
||||
,[OutletCode]
|
||||
,[OutletName]
|
||||
,[ProductTypeCode]
|
||||
,[TransactionVolume] as Transaktionsbetrag
|
||||
,[AmminclVAT] as Gesamtbetrag
|
||||
,[TotalNetAmount] as Net
|
||||
,[VATAmount] as UST
|
||||
,[avpriceexclVAT]
|
||||
,[Rechenwert]
|
||||
,[Kz]
|
||||
,[Rabattbetrag]
|
||||
,[RabattbetragProLiter]
|
||||
,[Zeitstempel]
|
||||
,[Sachbearbeiter]
|
||||
,[KdNrVERAG]
|
||||
,[CardNumber]
|
||||
,[EmissionNumber]
|
||||
,[CardComments]
|
||||
,[CalendarDate]
|
||||
,[TransactionHHMM]
|
||||
,[UStVAn_ID]
|
||||
,[VRNumber]
|
||||
,[OBONumber] from tblIDSTransactionsNew where cast(YearMonthDay as Date) = '" & DateTimePicker2.Text & "' and UStVAn_ID is null", "FMZOLL")
|
||||
.SET_SQL("SELECT trans.[transaction_id]
|
||||
,trans.[YearMonthDay] as Datum
|
||||
,trans.[Paymentsummarynumber] as ZahlungsNr
|
||||
,trans.[CustomerCode]
|
||||
,trans.[CustomerName]
|
||||
,trans.[OutletCountryCode]
|
||||
,trans.[OutletCountry]
|
||||
,trans.[OutletCode]
|
||||
,trans.[OutletName]
|
||||
,trans.[ProductTypeCode]
|
||||
,trans.[TransactionVolume] as Transaktionsbetrag
|
||||
,trans.[AmminclVAT] as Gesamtbetrag
|
||||
,trans.[TotalNetAmount] as Net
|
||||
,trans.[VATAmount] as UST
|
||||
,trans.[avpriceexclVAT]
|
||||
,trans.[Rechenwert]
|
||||
,trans.[Kz]
|
||||
,trans.[Rabattbetrag]
|
||||
,trans.[RabattbetragProLiter]
|
||||
,trans.[Zeitstempel]
|
||||
,trans.[Sachbearbeiter]
|
||||
,trans.[KdNrVERAG]
|
||||
,trans.[CardNumber]
|
||||
,trans.[EmissionNumber]
|
||||
,trans.[CardComments]
|
||||
,trans.[CalendarDate]
|
||||
,trans.[TransactionHHMM]
|
||||
,trans.[UStVAn_ID]
|
||||
,trans.[VRNumber]
|
||||
,trans.[OBONumber]
|
||||
,Kunde.CustomerCode
|
||||
,isnull(KundeOhneR.CustomerCode,0) as KundeOhneRabatt
|
||||
from tblIDSTransactionsNew as trans
|
||||
left join tbl_IDS_Kunden as Kunde on Kunde.CustomerCode = trans.CustomerCode
|
||||
left join tbl_IDS_Kunden_ohne_Rabatt as KundeOhneR on KundeOhneR.CustomerCode = trans.CustomerCode
|
||||
where cast(trans.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' and trans.UStVAn_ID is null", "FMZOLL")
|
||||
|
||||
.LOAD()
|
||||
|
||||
@@ -836,6 +843,7 @@ Public Class frmMDMDatenverarbetiung
|
||||
|
||||
'.Columns("VERAGLeistungsNr").ReadOnly = False
|
||||
.Columns("transaction_id").Visible = False
|
||||
.Columns("Kunde.CustomerCode").Visible = False
|
||||
|
||||
'For Each r As DataGridViewColumn In .Columns
|
||||
' If r.Name = "VERAGLeistungsNr" Or r.Name = "VERAGKdNr" Then
|
||||
@@ -1217,12 +1225,12 @@ Public Class frmMDMDatenverarbetiung
|
||||
If Directory.Exists(dir) Then
|
||||
dir &= "_" & Now.ToShortTimeString.Replace(":", "")
|
||||
End If
|
||||
Directory.CreateDirectory(dir)
|
||||
Directory.CreateDirectory(dir)
|
||||
|
||||
|
||||
|
||||
|
||||
Dim displayView = New DataView(dt_Main, "MSEExportCSV = 1", "Customer ID", DataViewRowState.CurrentRows)
|
||||
Dim displayView = New DataView(dt_Main, "MSEExportCSV = 1", "Customer ID", DataViewRowState.CurrentRows)
|
||||
Dim distinctDT_CSV As DataTable = displayView.ToTable(True, "Customer ID", "Customer Nr")
|
||||
|
||||
|
||||
@@ -4073,248 +4081,157 @@ Directory.CreateDirectory(dir)
|
||||
If MyDatagridview1.Rows.Count = 0 Then
|
||||
MsgBox("Keine Daten zum Setzen vorhanden!")
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
For each row In MyDatagridview1.Rows
|
||||
|
||||
Dim Rechenwert = 0
|
||||
Dim mKZ = "R"
|
||||
Dim kundeOhneRabatt = True
|
||||
|
||||
Dim trans As New VERAG.PROG.ALLGEMEIN.cIDS(row.Cells("transaction_id").Value )
|
||||
Dim trans As New VERAG_PROG_ALLGEMEIN.cIDS(row.Cells("transaction_id").Value)
|
||||
trans.Rechenwert = 0
|
||||
trans.Kz = "R"
|
||||
|
||||
If row.Cells("TransactionVolume").Value <> 0
|
||||
row.Cells("avpriceexclVAT").Value = row.Cells("TotalNetAmount").Value / row.Cells("TransactionVolume").Value
|
||||
If trans.TransactionVolume <> 0 Then
|
||||
trans.avpriceexclVAT = trans.TotalNetAmount / trans.TransactionVolume
|
||||
End If
|
||||
|
||||
If Not IsDBNull(row.Cells("Kunde.CustomerCode").Value) AndAlso CInt(row.Cells("Kunde.CustomerCode").Value) > 0 Then
|
||||
|
||||
Next
|
||||
kundeOhneRabatt = row.Cells("KundeOhneRabatt").Value
|
||||
|
||||
If Not kundeOhneRabatt Then 'kundeOhneRabatt -> gleich zu Rabattberechnen!
|
||||
|
||||
'Rechenwert für Land/Station/Kunde/Produkt ermitteln
|
||||
Dim sqlStringLandStationKundeProdukt = "select Case Rechenwert, Kz, KategorieNr FROM tbl_IDS_Rechenwerte WHERE (((OutletCountryCode)=" & row.Cells("OutletCountryCode").Value & ") & AND ((OutletCode)=" & row.Cells("OutletCode").Value & ") & And ((CustomerCode)=" & row.Cells("Kunde.CustomerCode").Value & ") AND ((ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & ")) & ORDER BY Zeitstempel DESC"
|
||||
'Rechenwert für Land/Kunde/Produkt ermittteln
|
||||
Dim sqlStringLandKundeProdukt = "Select Case Rechenwert, Kz, KategorieNr FROM tbl_IDS_Rechenwerte WHERE (((OutletCountryCode)=" & row.Cells("OutletCountryCode").Value & ") And ((OutletCode) Is Null) AND ((CustomerCode)=" & row.Cells("Kunde.CustomerCode").Value & ") & And ((ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & ")) ORDER BY Zeitstempel DESC"
|
||||
|
||||
|
||||
' Literpreis errechnen
|
||||
1340 If ![Transaction Volume] <> 0 Then
|
||||
1350 ![av price excl VAT] = ![Total Net Amount] / ![Transaction Volume]
|
||||
1360 End If
|
||||
|
||||
' Über den IDS-CustomerCode die VERAG-Kundennummer ermitteln und eintragen.
|
||||
1370 ![KdNrVERAG] = DLookup("KdNrVERAG", "tbl_IDS_Kunden", "CustomerCode=" & ![Customer Code])
|
||||
|
||||
1380 If Not IsNull(![KdNrVERAG]) Then
|
||||
|
||||
' Kunde ohne Rabatt
|
||||
1390 strSQL = "SELECT *" & _
|
||||
" FROM tbl_IDS_Kunden_ohne_Rabatt" & _
|
||||
" WHERE (((tbl_IDS_Kunden_ohne_Rabatt.CustomerCode)=" & ![KdNrVERAG] & "));"
|
||||
1400 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
1410 If Not rstIDSRechenwert.EOF Then
|
||||
1420 GoTo Rabatt_errechnen
|
||||
1430 End If
|
||||
1440 rstIDSRechenwert.Close
|
||||
|
||||
' Rechenwert für Land/Station/Kunde/Produkt ermitteln
|
||||
1450 strSQL = "SELECT Rechenwert, Kz, KategorieNr" & _
|
||||
" FROM tbl_IDS_Rechenwerte" & _
|
||||
" WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
" AND ((OutletCode)=" & ![Outlet Code] & ")" & _
|
||||
" AND ((CustomerCode)=" & ![KdNrVERAG] & ")" & _
|
||||
" AND ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
" ORDER BY Zeitstempel DESC;"
|
||||
1460 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
1470 If Not rstIDSRechenwert.EOF Then
|
||||
1480 GoTo Rechenwert_eintragen
|
||||
1490 End If
|
||||
1500 rstIDSRechenwert.Close
|
||||
|
||||
' Rechenwert für Land/Kunde/Produkt ermittteln
|
||||
1510 strSQL = "SELECT Rechenwert, Kz, KategorieNr" & _
|
||||
" FROM tbl_IDS_Rechenwerte" & _
|
||||
" WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
" AND ((OutletCode) Is Null)" & _
|
||||
" AND ((CustomerCode)=" & ![KdNrVERAG] & ")" & _
|
||||
" AND ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
" ORDER BY Zeitstempel DESC;"
|
||||
1520 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
1530 If Not rstIDSRechenwert.EOF Then
|
||||
1540 GoTo Rechenwert_eintragen
|
||||
1550 End If
|
||||
1560 rstIDSRechenwert.Close
|
||||
|
||||
1570 End If
|
||||
|
||||
' Rechenwert für Land/Station/Produkt ermitteln
|
||||
1580 strSQL = "SELECT Rechenwert, Kz, KategorieNr" & _
|
||||
" FROM tbl_IDS_Rechenwerte" & _
|
||||
" WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
" AND ((OutletCode)=" & ![Outlet Code] & ")" & _
|
||||
" AND ((CustomerCode) Is Null)" & _
|
||||
" AND ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
" ORDER BY Zeitstempel DESC;"
|
||||
1590 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
1600 If Not rstIDSRechenwert.EOF Then
|
||||
1610 GoTo Rechenwert_eintragen
|
||||
1620 End If
|
||||
1630 rstIDSRechenwert.Close
|
||||
|
||||
' Rechenwert für Land/Produkt ermitteln
|
||||
1640 strSQL = "SELECT Rechenwert, Kz, KategorieNr" & _
|
||||
" FROM tbl_IDS_Rechenwerte" & _
|
||||
" WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
" AND ((OutletCode) Is Null)" & _
|
||||
" AND ((CustomerCode) Is Null)" & _
|
||||
" AND ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
" ORDER BY Zeitstempel DESC;"
|
||||
1650 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
1660 If Not rstIDSRechenwert.EOF Then
|
||||
1670 GoTo Rechenwert_eintragen
|
||||
1680 End If
|
||||
1690 rstIDSRechenwert.Close
|
||||
|
||||
1700 GoTo Rabatt_errechnen
|
||||
|
||||
Rechenwert_eintragen:
|
||||
1710 !Rechenwert = rstIDSRechenwert!Rechenwert
|
||||
1720 !Kz = rstIDSRechenwert!Kz
|
||||
1730 If Not IsNull(rstIDSRechenwert!KategorieNr) Then
|
||||
1740 Set qry = dbs.QueryDefs("qry_IDS_KategorieNr_ProductTypeCode_Rechenwert")
|
||||
1750 qry.Parameters("[prmKategorieNr]") = rstIDSRechenwert!KategorieNr
|
||||
1760 qry.Parameters("[prmProductTypeCode]") = ![Product Type Code]
|
||||
1770 Set rst = qry.OpenRecordset(dbOpenSnapshot)
|
||||
1780 If Not rst.EOF Then
|
||||
1790 !Rechenwert = !Rechenwert + rst!Rechenwert
|
||||
1800 If !Rechenwert < 0 Then
|
||||
1810 !Rechenwert = 0
|
||||
1820 End If
|
||||
1830 End If
|
||||
1840 rst.Close
|
||||
1850 qry.Close
|
||||
1860 End If
|
||||
1870 rstIDSRechenwert.Close
|
||||
|
||||
' Ab 24.03.2010 ist die Kategorie neu hinzugekommen.
|
||||
' Lt. Hr. Siener wird der Kategorierabatt nur dann berücksichtigt,
|
||||
' wenn [Outlet Country Code] <> 740543 (Österreich)
|
||||
' und [Rechenwert] > 0 (aus Land/Produkt oder Land/Station/Produkt)
|
||||
' und [Kz = R] (Rabatt) ist.
|
||||
' Der Kategorierabatt kann auch ein Minusbetrag sein.
|
||||
' Der Rechenwert darf aber nicht negativ werden.
|
||||
' Dieser Teil entfällt ab 31.01.2019
|
||||
' If Not IsNull(![KdNrVERAG]) Then
|
||||
' If ![Outlet Country Code] <> 740543 And _
|
||||
' ![Rechenwert] > 0 And _
|
||||
' ![Kz] = "R" Then
|
||||
' Set qry = dbs.QueryDefs("qry_IDS_Kunde_Kategorie_Produkt_Rechenwert")
|
||||
' qry.Parameters("[parCustomerCode]") = ![KdNrVERAG]
|
||||
' qry.Parameters("[parProductTypeCode]") = ![Product Type Code]
|
||||
' Set rst = qry.OpenRecordset(dbOpenSnapshot)
|
||||
' If Not rst.EOF Then
|
||||
' !Rechenwert = !Rechenwert + rst!Rechenwert
|
||||
' If !Rechenwert < 0 Then
|
||||
' !Rechenwert = 0
|
||||
' End If
|
||||
' End If
|
||||
' rst.Close
|
||||
' qry.Close
|
||||
' End If
|
||||
' End If
|
||||
|
||||
Rabatt_errechnen:
|
||||
1880 Select Case !Kz
|
||||
Case "P" 'Rechenwert ist Preis pro Liter
|
||||
1890 !Rabattbetrag = ![Total Net Amount] - Int(!Rechenwert * ![Transaction Volume] * 100 + 0.5) / 100
|
||||
1900 Case "R" 'Rechenwert ist Rabatt pro Liter
|
||||
1910 !Rabattbetrag = Int(!Rechenwert * ![Transaction Volume] * 100 + 0.5) / 100
|
||||
1920 End Select
|
||||
1930 If ![Transaction Volume] <> 0 Then
|
||||
1940 !RabattbetragProLiter = !Rabattbetrag / ![Transaction Volume]
|
||||
1950 End If
|
||||
|
||||
' Zeitstempel und Sachbearbeiter in tblDiesel eintragen
|
||||
1960 !Zeitstempel = Now
|
||||
1970 !Sachbearbeiter = CurrentUser()
|
||||
1980 .Update
|
||||
|
||||
' Daten in das Archiv schreiben.
|
||||
1990 Set qryIDSDieselArchiv = dbs.QueryDefs("qryDieselArchivPKey")
|
||||
2000 qryIDSDieselArchiv.Parameters("[prmYearMonthDay]") = ![Year Month Day]
|
||||
2010 qryIDSDieselArchiv.Parameters("[prmPaymentSummaryNumber]") = ![Payment summary number]
|
||||
2020 qryIDSDieselArchiv.Parameters("[prmCustomerCode]") = ![Customer Code]
|
||||
2030 qryIDSDieselArchiv.Parameters("[prmOutletCountryCode]") = ![Outlet Country Code]
|
||||
2040 qryIDSDieselArchiv.Parameters("[prmOutletCode]") = ![Outlet Code]
|
||||
2050 qryIDSDieselArchiv.Parameters("[prmProductTypeCode]") = ![Product Type Code]
|
||||
2060 Set rstIDSDieselArchiv = qryIDSDieselArchiv.OpenRecordset(dbOpenDynaset)
|
||||
2070 If rstIDSDieselArchiv.EOF Then
|
||||
2080 rstIDSDieselArchiv.AddNew
|
||||
2090 lngDatensätzeAngefügt = lngDatensätzeAngefügt + 1
|
||||
2100 Call SysCmd(acSysCmdSetStatus, "IDS-Diesel-Archiv Neuzugang: " & ![Year Month Day] & "-" & ![Payment summary number] & "-" & ![Customer Code] & "-" & ![Outlet Country Code] & "-" & ![Outlet Code] & "-" & ![Product Type Code])
|
||||
2110 Else
|
||||
2120 rstIDSDieselArchiv.Edit
|
||||
2130 lngDatensätzeAktualisiert = lngDatensätzeAktualisiert + 1
|
||||
2140 Call SysCmd(acSysCmdSetStatus, "IDS-Diesel-Archiv Änderung: " & ![Year Month Day] & "-" & ![Payment summary number] & "-" & ![Customer Code] & "-" & ![Outlet Country Code] & "-" & ![Outlet Code] & "-" & ![Product Type Code])
|
||||
2150 End If
|
||||
2160 For Each fld In .Fields
|
||||
2170 rstIDSDieselArchiv(fld.Name) = fld.Value
|
||||
2180 Next
|
||||
2190 rstIDSDieselArchiv.Update
|
||||
2200 rstIDSDieselArchiv.Close
|
||||
2210 qryIDSDieselArchiv.Close
|
||||
|
||||
2220 DoEvents
|
||||
2230 .MoveNext
|
||||
2240 Loop
|
||||
|
||||
|
||||
|
||||
|
||||
datum = f.Datum
|
||||
SQL.doSQL("DELETE FROM tblAsfinagMaut", "FMZOLL")
|
||||
If SQL.doSQL("Update Abrechnungsdatum SET Abrechnungsdatum = '" & f.Datum.ToShortDateString & "'", "ASFINAG") Then
|
||||
If SQL.doSQL("UPDATE dbo.TTRBody SET Abrechnungsdatum = '" & f.Datum.ToShortDateString & "' WHERE (PKHistory = 0) AND (PKFileName LIKE N'" & checkifTestfiles() & ".%') AND (FileCreationDate <= '" & f.Datum.ToShortDateString & "') AND abrechnungsdatum IS NULL AND belegerstellungsdatum IS NULL", "ASFINAG") Then
|
||||
|
||||
Dim dt As DataTable = SQL.loadDgvBySql("Select dbo.TTRBody.OBUID, dbo.TTRBody.CardNumber, dbo.TTRBody.receiptNumber, dbo.TTRBody.VATAmount, dbo.TTRBody.amountInclVAT, dbo.TTRBody.DeliveryDate,dbo.TTRBody.abrechnungsdatum,dbo.TTRBody.belegerstellungsdatum, dbo.tblWarenarten.WarenartDE, dbo.CLFArchiv.vehicleLicensePlate, dbo.TTRBody.InfoField, dbo.TTRBody.ProductCode, dbo.TTRBody.Town, dbo.TTRBody.PKFileName
|
||||
From dbo.CLFArchiv
|
||||
RIGHT OUTER Join dbo.TTRBody ON dbo.CLFArchiv.OBUID = dbo.TTRBody.OBUID
|
||||
LEFT OUTER Join dbo.tblWarenarten ON dbo.TTRBody.ProductCode = dbo.tblWarenarten.ProductCode
|
||||
Where (dbo.TTRBody.PKHistory = 0) And (dbo.TTRBody.PKFileName Like N'" & checkifTestfiles() & ".%') AND TTRBody.abrechnungsdatum = '" & f.Datum.ToShortDateString & "'
|
||||
Order By dbo.TTRBody.CardNumber, dbo.TTRBody.FileCreationDate, dbo.TTRBody.PKHistory, dbo.TTRBody.PKFileName, dbo.TTRBody.PKLine", "ASFINAG")
|
||||
If dt.Rows.Count = 0 Then
|
||||
MsgBox("Es wurden keine Daten in tblAsfinagMaut geschrieben!")
|
||||
Return False
|
||||
End If
|
||||
For Each row As DataRow In dt.Rows
|
||||
Dim maut As New VERAG_PROG_ALLGEMEIN.cAsfinagMaut()
|
||||
maut.cardnumber = row.Item("CardNumber")
|
||||
maut.licenceplate = IIf(Not IsDBNull(row.Item("vehicleLicensePlate")), row.Item("vehicleLicensePlate"), row.Item("InfoField"))
|
||||
maut.turnoverdate = row.Item("DeliveryDate")
|
||||
maut.contractPartner = "ASFINAG " & IIf(Not IsDBNull(row.Item("WarenartDE")), row.Item("WarenartDE"), "Product Code " & row.Item("ProductCode"))
|
||||
maut.netAmount = CDbl(row.Item("amountInclVAT")) - CDbl(row.Item("VATAmount"))
|
||||
maut.VATamount = CDbl(row.Item("VATAmount"))
|
||||
maut.totalAmount = CDbl(row.Item("amountInclVAT"))
|
||||
maut.additionalData = row.Item("Town") 'wird nicht mehr verwendet????
|
||||
maut.receiptnumber = row.Item("receiptNumber")
|
||||
maut.receiptCreated = IIf(IsDBNull(row.Item("belegerstellungsdatum")), False, True)
|
||||
maut.SAVE()
|
||||
Next
|
||||
|
||||
Dim pruefSumTTR = SQL.getValueTxtBySql("select sum(checksumAmounntInclVAT) from [ASFINAG].[dbo].[TTRTrailer] where PKHistory = 0 and [TTRTrailer].PKFileName in (select distinct([TTRBody].PKFileName) as Test from [ASFINAG].[dbo].[TTRBody] where (TTRBody.PKHistory = 0) And (TTRBody.PKFileName Like N'" & checkifTestfiles() & ".%') AND TTRBody.abrechnungsdatum = '" & f.Datum.ToShortDateString & "')", "ASFINAG")
|
||||
If pruefSumTTR IsNot Nothing AndAlso IsNumeric(pruefSumTTR) Then
|
||||
txtTTRSum.Text = CDbl(pruefSumTTR).ToString("C2")
|
||||
lblTTRSum.Visible = True
|
||||
txtTTRSum.Visible = True
|
||||
lblTTRSum.Text = "Prüfsumme TTR:"
|
||||
Else
|
||||
lblTTRSum.Visible = False
|
||||
txtTTRSum.Visible = False
|
||||
Dim sum As Double = 0
|
||||
If Not IsDBNull(row.Cells("Kunde.CustomerCode").Value) AndAlso CInt(row.Cells("Kunde.CustomerCode").Value) > 0 Then
|
||||
sum = +row.Cells("transaction_id").Value
|
||||
End If
|
||||
|
||||
|
||||
MsgBox("Abrechnungsdatum gesetzt!")
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
cbxASFINAGAbgerechnet.Checked = True
|
||||
'initDgv_ASFINAG(Not cbxASFINAGNichtAbgerechnet.Checked)
|
||||
End If
|
||||
'Rabatt_errechnen:
|
||||
Select Case trans.Kz
|
||||
|
||||
Case "P" 'Rechenwert ist Preis pro Liter
|
||||
trans.Rabattbetrag = row.Cells("TotalNetAmount").Value - (row.Cells("Rechenwert").Value * row.Cells("TransactionVolume").Value * 100 + 0.5) / 100
|
||||
|
||||
Case "R" 'Rechenwert ist Rabatt pro Liter
|
||||
trans.Rabattbetrag = (row.Cells("Rechenwert").Value * row.Cells("TransactionVolume").Value * 100 + 0.5) / 100
|
||||
|
||||
End Select
|
||||
|
||||
If trans.TransactionVolume <> 0 Then
|
||||
trans.RabattbetragProLiter = row.Cells("Rabattbetrag").Value / row.Cells("TransactionVolume").Value
|
||||
End If
|
||||
|
||||
trans.Zeitstempel = Now()
|
||||
trans.Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
||||
|
||||
Next
|
||||
|
||||
' Kunde ohne Rabatt
|
||||
'1390 strSQL = "Select *" & _
|
||||
' " FROM tbl_IDS_Kunden_ohne_Rabatt" & _
|
||||
' " WHERE (((tbl_IDS_Kunden_ohne_Rabatt.CustomerCode)=" & ![KdNrVERAG] & "));"
|
||||
'1400 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
'1410 If Not rstIDSRechenwert.EOF Then
|
||||
'1420 GoTo Rabatt_errechnen
|
||||
'1430 End If
|
||||
'1440 rstIDSRechenwert.Close
|
||||
|
||||
' ' Rechenwert für Land/Station/Kunde/Produkt ermitteln
|
||||
'1450 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
' " FROM tbl_IDS_Rechenwerte" & _
|
||||
' " WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
' " And ((OutletCode)=" & ![Outlet Code] & ")" & _
|
||||
' " And ((CustomerCode)=" & ![KdNrVERAG] & ")" & _
|
||||
' " And ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
' " ORDER BY Zeitstempel DESC;"
|
||||
'1460 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
'1470 If Not rstIDSRechenwert.EOF Then
|
||||
'1480 GoTo Rechenwert_eintragen
|
||||
'1490 End If
|
||||
'1500 rstIDSRechenwert.Close
|
||||
|
||||
' ' Rechenwert für Land/Kunde/Produkt ermittteln
|
||||
'1510 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
' " FROM tbl_IDS_Rechenwerte" & _
|
||||
' " WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
' " And ((OutletCode) Is Null)" & _
|
||||
' " And ((CustomerCode)=" & ![KdNrVERAG] & ")" & _
|
||||
' " And ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
' " ORDER BY Zeitstempel DESC;"
|
||||
'1520 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
'1530 If Not rstIDSRechenwert.EOF Then
|
||||
'1540 GoTo Rechenwert_eintragen
|
||||
'1550 End If
|
||||
'1560 rstIDSRechenwert.Close
|
||||
|
||||
'1570 End If
|
||||
|
||||
' ' Rechenwert für Land/Station/Produkt ermitteln
|
||||
'1580 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
' " FROM tbl_IDS_Rechenwerte" & _
|
||||
' " WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
' " And ((OutletCode)=" & ![Outlet Code] & ")" & _
|
||||
' " And ((CustomerCode) Is Null)" & _
|
||||
' " And ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
' " ORDER BY Zeitstempel DESC;"
|
||||
'1590 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
'1600 If Not rstIDSRechenwert.EOF Then
|
||||
'1610 GoTo Rechenwert_eintragen
|
||||
'1620 End If
|
||||
'1630 rstIDSRechenwert.Close
|
||||
|
||||
' ' Rechenwert für Land/Produkt ermitteln
|
||||
'1640 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
' " FROM tbl_IDS_Rechenwerte" & _
|
||||
' " WHERE (((OutletCountryCode)=" & ![Outlet Country Code] & ")" & _
|
||||
' " And ((OutletCode) Is Null)" & _
|
||||
' " And ((CustomerCode) Is Null)" & _
|
||||
' " And ((ProductTypeCode)=" & ![Product Type Code] & "))" & _
|
||||
' " ORDER BY Zeitstempel DESC;"
|
||||
'1650 Set rstIDSRechenwert = dbs.OpenRecordset(strSQL, dbOpenSnapshot)
|
||||
'1660 If Not rstIDSRechenwert.EOF Then
|
||||
'1670 GoTo Rechenwert_eintragen
|
||||
'1680 End If
|
||||
'1690 rstIDSRechenwert.Close
|
||||
|
||||
'1700 GoTo Rabatt_errechnen
|
||||
|
||||
'Rechenwert_eintragen:
|
||||
'1710 !Rechenwert = rstIDSRechenwert!Rechenwert
|
||||
'1720 !Kz = rstIDSRechenwert!Kz
|
||||
'1730 If Not IsNull(rstIDSRechenwert!KategorieNr) Then
|
||||
'1740 Set qry = dbs.QueryDefs("qry_IDS_KategorieNr_ProductTypeCode_Rechenwert")
|
||||
'1750 qry.Parameters("[prmKategorieNr]") = rstIDSRechenwert!KategorieNr
|
||||
'1760 qry.Parameters("[prmProductTypeCode]") = ![Product Type Code]
|
||||
'1770 Set rst = qry.OpenRecordset(dbOpenSnapshot)
|
||||
'1780 If Not rst.EOF Then
|
||||
'1790 !Rechenwert = !Rechenwert + rst!Rechenwert
|
||||
'1800 If !Rechenwert < 0 Then
|
||||
'1810 !Rechenwert = 0
|
||||
'1820 End If
|
||||
'1830 End If
|
||||
'1840 rst.Close
|
||||
'1850 qry.Close
|
||||
'1860 End If
|
||||
'1870 rstIDSRechenwert.Close
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user