Stuff
This commit is contained in:
@@ -823,7 +823,7 @@ Public Class frmMDMDatenverarbetiung
|
||||
,trans.[UStVAn_ID]
|
||||
,trans.[VRNumber]
|
||||
,trans.[OBONumber]
|
||||
,Kunde.CustomerCode
|
||||
,Kunde.CustomerCode as KundeCustomerCode
|
||||
,isnull(KundeOhneR.CustomerCode,0) as KundeOhneRabatt
|
||||
from tblIDSTransactionsNew as trans
|
||||
left join tbl_IDS_Kunden as Kunde on Kunde.CustomerCode = trans.CustomerCode
|
||||
@@ -841,7 +841,10 @@ Public Class frmMDMDatenverarbetiung
|
||||
|
||||
'.Columns("VERAGLeistungsNr").ReadOnly = False
|
||||
.Columns("transaction_id").Visible = False
|
||||
.Columns("Kunde.CustomerCode").Visible = False
|
||||
.Columns("KundeCustomerCode").Visible = False
|
||||
.Columns("Datum").Visible = False
|
||||
.Columns("KundeOhneRabatt").Visible = False
|
||||
.Columns("UStVAn_ID").Visible = False
|
||||
|
||||
'For Each r As DataGridViewColumn In .Columns
|
||||
' If r.Name = "VERAGLeistungsNr" Or r.Name = "VERAGKdNr" Then
|
||||
@@ -1001,6 +1004,7 @@ Public Class frmMDMDatenverarbetiung
|
||||
pnlAsfinag.Visible = True
|
||||
Exit Sub
|
||||
Case "IDS"
|
||||
Panel5.Visible = True
|
||||
Dim c As New usrCntlMDMDatenverarbeitungAuswertungen_divers(Me, Me.LIEFERANT)
|
||||
Panel3.Controls.Add(c)
|
||||
c.Dock = DockStyle.Fill
|
||||
@@ -4074,6 +4078,8 @@ Public Class frmMDMDatenverarbetiung
|
||||
Private Function setRechenwerteIDS() As Boolean
|
||||
'Abrechnungsdatum setzen
|
||||
|
||||
Return False
|
||||
|
||||
If Not LIEFERANT = "IDS" Then Return False
|
||||
|
||||
If MyDatagridview1.Rows.Count = 0 Then
|
||||
@@ -4093,31 +4099,93 @@ Public Class frmMDMDatenverarbetiung
|
||||
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
|
||||
Dim rechnenwertVorhanden = False
|
||||
|
||||
If Not IsDBNull(row.Cells("KundeCustomerCode").Value) AndAlso CInt(row.Cells("KundeCustomerCode").Value) > 0 Then
|
||||
|
||||
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"
|
||||
Dim sqlStringLandStationKundeProdukt = "select Rechenwert, Kz, KategorieNr FROM tbl_IDS_Rechenwerte WHERE (((OutletCountryCode)=" & row.Cells("OutletCountryCode").Value & ") AND ((OutletCode)=" & row.Cells("OutletCode").Value & ") And ((CustomerCode)=" & row.Cells("KundeCustomerCode").Value & ") AND ((ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & ")) ORDER BY Zeitstempel DESC"
|
||||
Dim dtLandStationKundeProdukt As DataTable = SQL.loadDgvBySql(sqlStringLandStationKundeProdukt, "FMZOLL")
|
||||
If dtLandStationKundeProdukt.Rows.Count > 0 Then
|
||||
rechnenwertVorhanden = True
|
||||
For Each r In dtLandStationKundeProdukt.Rows
|
||||
|
||||
Next
|
||||
|
||||
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
|
||||
|
||||
'Rechenwert für Land/Kunde/Produkt ermittteln
|
||||
If Not rechnenwertVorhanden Then
|
||||
Dim sqlStringLandKundeProdukt = "Select Rechenwert, Kz, KategorieNr FROM tbl_IDS_Rechenwerte WHERE (((OutletCountryCode)=" & row.Cells("OutletCountryCode").Value & ") And ((OutletCode) Is Null) AND ((CustomerCode)=" & row.Cells("KundeCustomerCode").Value & ") And ((ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & ")) ORDER BY Zeitstempel DESC"
|
||||
Dim dtLandKundeProdukt As DataTable = SQL.loadDgvBySql(sqlStringLandStationKundeProdukt, "FMZOLL")
|
||||
If dtLandKundeProdukt.Rows.Count > 0 Then
|
||||
rechnenwertVorhanden = True
|
||||
For Each r In dtLandKundeProdukt.Rows
|
||||
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
' Rechenwert für Land/Station/Produkt ermitteln
|
||||
If Not rechnenwertVorhanden Then
|
||||
Dim sqlStringLandStationProdukt = "select Rechenwert, Kz, KategorieNr FROM tbl_IDS_Rechenwerte WHERE (((OutletCountryCode)=" & row.Cells("OutletCountryCode").Value & ") AND ((OutletCode)=" & row.Cells("OutletCode").Value & ") AND ((ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & ")) ORDER BY Zeitstempel DESC"
|
||||
Dim dtLandStationProdukt As DataTable = SQL.loadDgvBySql(sqlStringLandStationProdukt, "FMZOLL")
|
||||
If dtLandStationProdukt.Rows.Count > 0 Then
|
||||
rechnenwertVorhanden = True
|
||||
For Each r In dtLandStationProdukt.Rows
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
' Rechenwert für Land/Produkt ermitteln
|
||||
If Not rechnenwertVorhanden Then
|
||||
Dim sqlStringLandProdukt = "Select Rechenwert, Kz, KategorieNr FROM tbl_IDS_Rechenwerte WHERE (((OutletCountryCode)=" & row.Cells("OutletCountryCode").Value & ") And ((OutletCode) Is Null) And ((ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & ")) ORDER BY Zeitstempel DESC"
|
||||
Dim dtLandProdukt As DataTable = SQL.loadDgvBySql(sqlStringLandProdukt, "FMZOLL")
|
||||
If dtLandProdukt.Rows.Count > 0 Then
|
||||
rechnenwertVorhanden = True
|
||||
For Each r In dtLandProdukt.Rows
|
||||
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
If trans.Rechenwert > 0 Then
|
||||
'!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 If
|
||||
|
||||
'Rabatt_errechnen:
|
||||
Select Case trans.Kz
|
||||
@@ -4130,6 +4198,11 @@ Public Class frmMDMDatenverarbetiung
|
||||
|
||||
End Select
|
||||
|
||||
|
||||
|
||||
|
||||
'Rechenwert eintragen:
|
||||
|
||||
If trans.TransactionVolume <> 0 Then
|
||||
trans.RabattbetragProLiter = row.Cells("Rabattbetrag").Value / row.Cells("TransactionVolume").Value
|
||||
End If
|
||||
@@ -4139,8 +4212,13 @@ Public Class frmMDMDatenverarbetiung
|
||||
|
||||
Next
|
||||
|
||||
' Kunde ohne Rabatt
|
||||
'1390 strSQL = "Select *" & _
|
||||
' Public Function fktDieselIDSImportiereCSV()
|
||||
|
||||
|
||||
'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)
|
||||
@@ -4150,12 +4228,12 @@ Public Class frmMDMDatenverarbetiung
|
||||
'1440 rstIDSRechenwert.Close
|
||||
|
||||
' ' Rechenwert für Land/Station/Kunde/Produkt ermitteln
|
||||
'1450 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
'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] & "))" & _
|
||||
' " 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
|
||||
@@ -4164,12 +4242,12 @@ Public Class frmMDMDatenverarbetiung
|
||||
'1500 rstIDSRechenwert.Close
|
||||
|
||||
' ' Rechenwert für Land/Kunde/Produkt ermittteln
|
||||
'1510 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
'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] & "))" & _
|
||||
' " 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
|
||||
@@ -4180,12 +4258,12 @@ Public Class frmMDMDatenverarbetiung
|
||||
'1570 End If
|
||||
|
||||
' ' Rechenwert für Land/Station/Produkt ermitteln
|
||||
'1580 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
'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] & "))" & _
|
||||
' " 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
|
||||
@@ -4194,12 +4272,12 @@ Public Class frmMDMDatenverarbetiung
|
||||
'1630 rstIDSRechenwert.Close
|
||||
|
||||
' ' Rechenwert für Land/Produkt ermitteln
|
||||
'1640 strSQL = "Select Rechenwert, Kz, KategorieNr" & _
|
||||
'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] & "))" & _
|
||||
' " 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
|
||||
@@ -4229,6 +4307,85 @@ Public Class frmMDMDatenverarbetiung
|
||||
'1870 rstIDSRechenwert.Close
|
||||
|
||||
|
||||
'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
|
||||
'2250 wrk.CommitTrans
|
||||
'2260 On Error GoTo Fehler
|
||||
'2270 .Close
|
||||
'2280 End With
|
||||
'2290 Call SysCmd(acSysCmdClearStatus)
|
||||
'2300 DoCmd.Hourglass False
|
||||
'2310 strPrompt = "Es wurden " & lngDatensätzeAngefügt & " Datensätze in das Archiv übernommen."
|
||||
'2320 If lngDatensätzeAktualisiert > 0 Then
|
||||
'2330 strPrompt = strPrompt & vbNewLine & lngDatensätzeAktualisiert & " Archivsätze wurden aktualisiert."
|
||||
'2340 End If
|
||||
'2350 strTitle = "Diesel-Datenarchiv"
|
||||
'2360 MsgBox strPrompt, , strTitle
|
||||
' ' intAntwort = MsgBox("Das Einlesen ist beendet. Soll die Datei gelöscht werden?", vbYesNo + vbQuestion + vbDefaultButton2, Trim(dlg.SelectedItems(1)))
|
||||
' ' If intAntwort = vbYes Then Kill (Trim(dlg.SelectedItems(1)))
|
||||
'2370 Else
|
||||
'2380 MsgBox "Es wurde keine Datei ausgewählt.", vbInformation, "Daten einlesen."
|
||||
'2390 End If
|
||||
|
||||
'Ende:
|
||||
'2400 DoCmd.Hourglass False
|
||||
'2410 Exit Function
|
||||
|
||||
'Rollback:
|
||||
'2420 wrk.Rollback
|
||||
|
||||
'Fehler:
|
||||
'2430 Call SysCmd(acSysCmdClearStatus)
|
||||
'2440 DoCmd.Hourglass False
|
||||
'2450 DoCmd.Beep
|
||||
'2460 MsgBox "Error: " & Err.Number & ". " & Err.Description, , "fktDieselIDSImportiereCSV"
|
||||
'2470 Resume Ende
|
||||
|
||||
' End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4315,4 +4472,12 @@ Public Class frmMDMDatenverarbetiung
|
||||
Private Sub btnRechenwertesetzen_Click(sender As Object, e As EventArgs) Handles btnRechenwertesetzen.Click
|
||||
If vbYes = MsgBox("Haben Sie die Rechenwerte in den IDS-Tabellen aktualisiert?" & vbNewLine & "(Diese werden beim Importieren in die Abrechnungsdaten übernommen)", vbYesNoCancel) Then setRechenwerteIDS()
|
||||
End Sub
|
||||
|
||||
Private Sub Button10_Click_1(sender As Object, e As EventArgs) Handles Button10.Click
|
||||
|
||||
If vbYes = MsgBox("Haben Sie die Rechenwerte in den IDS-Tabellen zurücksetzen?", vbYesNoCancel) Then
|
||||
setRechenwerteIDS()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user