MDM. TrierAuswertung

This commit is contained in:
2024-11-15 15:50:22 +01:00
parent ee7972741a
commit a13d1b06d6
4 changed files with 166 additions and 140 deletions

View File

@@ -602,8 +602,8 @@ Public Class frmMDMDatenverarbetiung
rpt.lblUeberschrift.Text = "IDS Summenbericht (Offert " & typ & ") " & CDate(Now.ToShortDateString)
rpt.lblSachbearbeiter.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME
rpt.lblBrutto.Text = "Brutto"
rpt.lblNetto.Text = "Netto"
rpt.lblMWST.Text = "MwSt."
rpt.lblNetto.Text = "Liter"
rpt.lblMWST.Text = "Netto"
rpt.Label4.Text = rpt.lblNetto.Text
rpt.Label2.Text = rpt.lblMWST.Text
rpt.Label14.Text = rpt.lblBrutto.Text
@@ -626,19 +626,19 @@ Public Class frmMDMDatenverarbetiung
rpt.lblKundennr.Text = SQL.isDbnullEmpty(rpt.Fields.Item("CustomerCode").Value, "")
rpt.lblName1.Text = SQL.isDbnullEmpty(rpt.Fields.Item("Name").Value, "")
rpt.lblKartennr.Text = "Liter: " & SQL.isDbnullEmpty(rpt.Fields.Item("Liter").Value, "") & IIf(SQL.isDbnullEmpty(rpt.Fields.Item("Rabatt").Value, "") <> "", " (abgezogener Rabatt:" & SQL.isDbnullEmpty(rpt.Fields.Item("Rabatt").Value & ")", ""), "")
rpt.lblKartennr.Text = "VERAG-KdNr: " & SQL.isDbnullEmpty(rpt.Fields.Item("AdressenNr").Value, "") & IIf(SQL.isDbnullEmpty(rpt.Fields.Item("Rabatt").Value, "") <> "", " abgezogener Rabatt:" & SQL.isDbnullEmpty(rpt.Fields.Item("Rabatt").Value & "", ""), "")
rpt.lblNetto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Netto").Value, 2, "")
rpt.lblMWST.Text = SQL.isDbnullEmptyDbl(CDbl(rpt.Fields.Item("Brutto").Value) - CDbl(rpt.Fields.Item("Netto").Value), 2, "")
rpt.lblNetto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Liter").Value, 2, "")
rpt.lblMWST.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Netto").Value, 2, "")
rpt.lblBrutto.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Brutto").Value, 2, "")
rpt.lblSumNet.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Netto").Value, 2, "")
rpt.lblSumVat.Text = SQL.isDbnullEmptyDbl(CDbl(rpt.Fields.Item("Brutto").Value) - CDbl(rpt.Fields.Item("Netto").Value), 2, "")
rpt.lblSumNet.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Liter").Value, 2, "")
rpt.lblSumVat.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Netto").Value, 2, "")
rpt.lblSumBrt.Text = SQL.isDbnullEmptyDbl(rpt.Fields.Item("Brutto").Value, 2, "")
sumNetto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Netto").Value, 4, 0)
sumMWST += SQL.isDbnullEmptyDbl(CDbl(rpt.Fields.Item("Brutto").Value) - CDbl(rpt.Fields.Item("Netto").Value), 4, 0)
sumNetto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Liter").Value, 4, 0)
sumMWST += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Netto").Value, 4, 0)
sumBrutto += SQL.isDbnullEmptyDbl(rpt.Fields.Item("Brutto").Value, 4, 0)
@@ -901,8 +901,9 @@ Public Class frmMDMDatenverarbetiung
,trans.[OutletCountry]
,trans.[OutletCode]
,trans.[OutletName]
,trans.[ProductTypeCode]
,trans.[TransactionVolume] as Transaktionsbetrag
,prod.[ProductDescription] Produkt
,trans.ProductTypeCode
,trans.[TransactionVolume] as Liter
,trans.[AmminclVAT] as Gesamtbetrag
,trans.[TotalNetAmount] as Net
,trans.[VATAmount] as UST
@@ -927,6 +928,7 @@ Public Class frmMDMDatenverarbetiung
from tblIDSTransactionsNew as trans
left join tbl_IDS_Kunden as Kunde on Kunde.CustomerCode = trans.CustomerCode And Kunde.KdNrAlt = 0
left join tbl_IDS_Kunden_ohne_Rabatt as KundeOhneR on KundeOhneR.CustomerCode = trans.CustomerCode
left join tbl_IDS_Produkte as prod on prod.ProductTypeCode = trans.ProductTypeCode
where cast(trans.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' and trans.UStVAn_ID is null", "FMZOLL")
.LOAD()
@@ -945,6 +947,20 @@ Public Class frmMDMDatenverarbetiung
.Columns("KundeOhneRabatt").Visible = False
.Columns("UStVAn_ID").Visible = False
.Columns("OutletCountryCode").Visible = False
.Columns("OutletCode").Visible = False
.Columns("OutletName").Visible = False
.Columns("CalendarDate").Visible = False
.Columns("TransactionHHMM").Visible = False
.Columns("CalendarDate").Visible = False
.Columns("CardNumber").Visible = False
.Columns("CardComments").Visible = False
.Columns("EmissionNumber").Visible = False
.Columns("ProductTypeCode").Visible = False
'For Each r As DataGridViewColumn In .Columns
' If r.Name = "VERAGLeistungsNr" Or r.Name = "VERAGKdNr" Then
' r.ReadOnly = False
@@ -989,7 +1005,7 @@ Public Class frmMDMDatenverarbetiung
Dim sumTr As Double = 0
For Each r As DataGridViewRow In .Rows
sumGes += If(IsNumeric(r.Cells("Gesamtbetrag").Value), CDbl(r.Cells("Gesamtbetrag").Value), 0)
sumTr += If(IsNumeric(r.Cells("Transaktionsbetrag").Value), CDbl(r.Cells("Transaktionsbetrag").Value), 0)
sumTr += If(IsNumeric(r.Cells("Liter").Value), CDbl(r.Cells("Liter").Value), 0)
sumFee += If(IsNumeric(r.Cells("Net").Value), CDbl(r.Cells("Net").Value), 0)
Next
@@ -1001,7 +1017,7 @@ Public Class frmMDMDatenverarbetiung
lblTTRSum.Visible = True
txtTTRSum.Visible = True
lblTTRSum.Text = "Tr-Kosten"
lblTTRSum.Text = "Liter"
.ClearSelection()
@@ -3822,7 +3838,7 @@ Public Class frmMDMDatenverarbetiung
Return False
End If
Dim sqlStringfehlendeKdNr = "SELECT count(*) from tblIDSTransactionsNew as trans left join tbl_IDS_Kunden as Kunde on Kunde.CustomerCode = trans.CustomerCode where cast(trans.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' and Kunde.CustomerCode is null and trans.[CustomerCode] not in (60004479,60013994)" 'Verag360 und VeragAG
Dim sqlStringfehlendeKdNr = "SELECT count(*) from tblIDSTransactionsNew as trans left join tbl_IDS_Kunden as Kunde on Kunde.CustomerCode = trans.CustomerCode where cast(trans.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' and Kunde.CustomerCode is null and trans.[CustomerCode] not in (60004479,60025994)" 'Verag360 und VeragAG
Dim fehlendeKdNr As Integer = CInt((New SQL).getValueTxtBySql(sqlStringfehlendeKdNr, "FMZOLL"))
If fehlendeKdNr > 0 Then
@@ -3832,19 +3848,15 @@ Public Class frmMDMDatenverarbetiung
End If
'Dim nichtAufAbgerechnetGesetzteTransactionen As Integer = 0
Dim OBONumberOderVRNumberfehlern As Integer = 0
'nichtAufAbgerechnetGesetzteTransactionen = CInt((New SQL).getValueTxtBySql("select count (*) FROM [VERAG].[dbo].[tblMSESettlements] as bills inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] where trans.[transaction_status] <> 'Billed' and [invoice_date] = '" & DateTimePicker2.Text & "'", "FMZOLL"))
OBONumberOderVRNumberfehlern = CInt((New SQL).getValueTxtBySql("select count(*) from [tblIDSTransactionsNew] WHERE cast(YearMonthDay as Date) = '" & DateTimePicker2.Text & "' AND [UStVAn_ID] is null AND [VRNumber] is null AND [OBONumber] is null", "FMZOLL"))
'If nichtAufAbgerechnetGesetzteTransactionen > 0 Then
' Dim hint As String = ""
' pruefData_IDS = False
' If nichtAufAbgerechnetGesetzteTransactionen > 500 Then
' hint = "Batch-Nr: "
' hint &= SQL.getValueTxtBySql("select distinct(trans.batch_seq_nr) FROM [VERAG].[dbo].[tblMSESettlements] as bills inner join [VERAG].[dbo].[tblMSETransactions] as trans on bills.[transaction_id] = trans.[transaction_id] where trans.[transaction_status] <> 'Billed' and [invoice_date] = '" & DateTimePicker2.Text & "'", "FMZOLL")
' End If
' MsgBox("Es sind " & nichtAufAbgerechnetGesetzteTransactionen & " Transaktionen in der Datenbank, die noch nicht auf VERRECHNET gesetzt sind!" & vbNewLine & "Diese Transaktionen (von Rechnung " & DateTimePicker2.Text & ") müssen aktualisiert werden. (bitte an Administrator wenden)." & IIf(hint <> "", vbNewLine & hint, ""))
'End If
If OBONumberOderVRNumberfehlern > 0 Then
Dim hint As String = ""
pruefData_IDS = False
MsgBox("Bei " & OBONumberOderVRNumberfehlern & " Transaktionen fehlt die OBONumber oder VRNumber!" & vbNewLine & "Diese Transaktionen (von Rechnung " & DateTimePicker2.Text & ") müssen aktualisiert werden. (bitte an Administrator wenden).")
End If
''das muss die letzte Prüfung sein, da uU eine Transaktion fehlen kann!
@@ -4167,6 +4179,8 @@ Public Class frmMDMDatenverarbetiung
'Return False
If Not LIEFERANT = "IDS" Then Return False
If MyDatagridview1.Rows.Count = 0 Then
@@ -4176,155 +4190,164 @@ Public Class frmMDMDatenverarbetiung
Dim i As Integer = 0
For Each row In MyDatagridview1.Rows
Dim kundeOhneRabatt = True
Dim trans As New VERAG_PROG_ALLGEMEIN.cIDS(row.Cells("transaction_id").value)
trans.Rechenwert = 0
trans.Kz = "R"
Dim KategorieNr = 0
If trans.KdNrVERAG Is Nothing Then
If trans.TransactionVolume <> 0 Then
trans.avpriceexclVAT = trans.TotalNetAmount / trans.TransactionVolume
End If
If Not IsDBNull(row.Cells("KundeCustomerCode").Value) AndAlso CInt(row.Cells("KundeCustomerCode").Value) > 0 Then
trans.KdNrVERAG = row.Cells("KundeCustomerCode").Value
kundeOhneRabatt = row.Cells("KundeOhneRabatt").Value
If kundeOhneRabatt Then GoTo RabattBerechnen 'kundeOhneRabatt -> gleich zu Rabattberechnen!
Try
'Rechenwert für Land/Station/Kunde/Produkt ermitteln
Dim sqlStringLandStationKundeProdukt = "select Top(1) 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
For Each r In dtLandStationKundeProdukt.Rows
For Each row In MyDatagridview1.Rows
Dim kundeOhneRabatt = True
Dim trans As New VERAG_PROG_ALLGEMEIN.cIDS(row.Cells("transaction_id").value)
trans.Rechenwert = 0
trans.Kz = "R"
Dim KategorieNr = 0
If trans.KdNrVERAG Is Nothing Then
If trans.TransactionVolume <> 0 Then
trans.avpriceexclVAT = trans.TotalNetAmount / trans.TransactionVolume
End If
If Not IsDBNull(row.Cells("KundeCustomerCode").Value) AndAlso CInt(row.Cells("KundeCustomerCode").Value) > 0 Then
trans.KdNrVERAG = row.Cells("KundeCustomerCode").Value
kundeOhneRabatt = row.Cells("KundeOhneRabatt").Value
If kundeOhneRabatt Then GoTo RabattBerechnen 'kundeOhneRabatt -> gleich zu Rabattberechnen!
'Rechenwert für Land/Station/Kunde/Produkt ermitteln
Dim sqlStringLandStationKundeProdukt = "select Top(1) 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
For Each r In dtLandStationKundeProdukt.Rows
KategorieNr = IIf(IsDBNull(r.Item("KategorieNr")), 0, r.Item("KategorieNr"))
trans.Rechenwert = r.Item("Rechenwert")
trans.Kz = r.Item("Kz")
Next
GoTo RechenwertBerechnen
End If
'Rechenwert für Land/Kunde/Produkt ermittteln
Dim sqlStringLandKundeProdukt = "Select Top(1) 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
For Each r In dtLandKundeProdukt.Rows
KategorieNr = IIf(IsDBNull(r.Item("KategorieNr")), 0, r.Item("KategorieNr"))
trans.Rechenwert = r.Item("Rechenwert")
trans.Kz = r.Item("Kz")
Next
GoTo RechenwertBerechnen
End If
End If
' Rechenwert für Land/Station/Produkt ermitteln
Dim sqlStringLandStationProdukt = "select Top(1) 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
For Each r In dtLandStationProdukt.Rows
KategorieNr = IIf(IsDBNull(r.Item("KategorieNr")), 0, r.Item("KategorieNr"))
trans.Rechenwert = r.Item("Rechenwert")
trans.Rechenwert += r.Item("Rechenwert")
trans.Kz = r.Item("Kz")
Next
GoTo RechenwertBerechnen
End If
'Rechenwert für Land/Kunde/Produkt ermittteln
Dim sqlStringLandKundeProdukt = "Select Top(1) 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
For Each r In dtLandKundeProdukt.Rows
' Rechenwert für Land/Produkt ermitteln
Dim sqlStringLandProdukt = "Select Top(1) 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
For Each r In dtLandProdukt.Rows
KategorieNr = IIf(IsDBNull(r.Item("KategorieNr")), 0, r.Item("KategorieNr"))
trans.Rechenwert = r.Item("Rechenwert")
trans.Rechenwert += r.Item("Rechenwert")
trans.Kz = r.Item("Kz")
Next
GoTo RechenwertBerechnen
End If
End If
' Rechenwert für Land/Station/Produkt ermitteln
Dim sqlStringLandStationProdukt = "select Top(1) 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
For Each r In dtLandStationProdukt.Rows
KategorieNr = IIf(IsDBNull(r.Item("KategorieNr")), 0, r.Item("KategorieNr"))
trans.Rechenwert += r.Item("Rechenwert")
trans.Kz = r.Item("Kz")
Next
GoTo RechenwertBerechnen
End If
' Rechenwert für Land/Produkt ermitteln
Dim sqlStringLandProdukt = "Select Top(1) 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
For Each r In dtLandProdukt.Rows
KategorieNr = IIf(IsDBNull(r.Item("KategorieNr")), 0, r.Item("KategorieNr"))
trans.Rechenwert += r.Item("Rechenwert")
trans.Kz = r.Item("Kz")
Next
GoTo RechenwertBerechnen
End If
GoTo RabattBerechnen
GoTo RabattBerechnen
RechenwertBerechnen:
If KategorieNr > 0 Then
If KategorieNr > 0 Then
Dim sqlRechenwert = "SELECT tbl_IDS_Kategorien_Rechenwerte.KategorieNr, tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode, tbl_IDS_Kategorien_Rechenwerte.Rechenwert
Dim sqlRechenwert = "SELECT tbl_IDS_Kategorien_Rechenwerte.KategorieNr, tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode, tbl_IDS_Kategorien_Rechenwerte.Rechenwert
FROM tbl_IDS_Kategorien_Rechenwerte
WHERE (((tbl_IDS_Kategorien_Rechenwerte.KategorieNr)=" & KategorieNr & ") AND ((tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode)=" & row.Cells("ProductTypeCode").Value & "))
ORDER BY tbl_IDS_Kategorien_Rechenwerte.Zeitstempel DESC"
Dim dtRechenwert As DataTable = SQL.loadDgvBySql(sqlRechenwert, "FMZOLL")
If dtRechenwert.Rows.Count > 0 Then
Dim dtRechenwert As DataTable = SQL.loadDgvBySql(sqlRechenwert, "FMZOLL")
If dtRechenwert.Rows.Count > 0 Then
For Each r In dtRechenwert.Rows
trans.Rechenwert += r.Item("Rechenwert")
If trans.Rechenwert < 0 Then trans.Rechenwert = 0
Next
End If
'!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
For Each r In dtRechenwert.Rows
trans.Rechenwert += r.Item("Rechenwert")
If trans.Rechenwert < 0 Then trans.Rechenwert = 0
Next
End If
'!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
RabattBerechnen:
Select Case trans.Kz
Select Case trans.Kz
Case "P" 'Rechenwert ist Preis pro Liter
trans.Rabattbetrag = trans.TotalNetAmount - (trans.Rechenwert * trans.TransactionVolume * 100 + 0.5) / 100
Case "P" 'Rechenwert ist Preis pro Liter
trans.Rabattbetrag = trans.TotalNetAmount - (trans.Rechenwert * trans.TransactionVolume * 100 + 0.5) / 100
Case "R" 'Rechenwert ist Rabatt pro Liter
trans.Rabattbetrag = (trans.Rechenwert * trans.TransactionVolume * 100 + 0.5) / 100
Case "R" 'Rechenwert ist Rabatt pro Liter
trans.Rabattbetrag = (trans.Rechenwert * trans.TransactionVolume * 100 + 0.5) / 100
End Select
End Select
If trans.TransactionVolume <> 0 Then
trans.RabattbetragProLiter = trans.Rabattbetrag / trans.TransactionVolume
If trans.TransactionVolume <> 0 Then
trans.RabattbetragProLiter = trans.Rabattbetrag / trans.TransactionVolume
End If
trans.Zeitstempel = Now()
trans.Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
If trans.SAVE() Then i += 1
End If
trans.Zeitstempel = Now()
trans.Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
If trans.SAVE() Then i += 1
End If
Next
Next
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
Me.Cursor = Cursors.Default
End Try
initDgv_IDS()
MsgBox(i & " Rechenwerte wurden gesetzt!")
@@ -4563,7 +4586,6 @@ RabattBerechnen:
Private Sub cbxBelegeerstellt_CheckedChanged(sender As Object, e As EventArgs) Handles cbxBelegeerstellt.CheckedChanged
If Me.LIEFERANT = "ASFINAG" Then
If cbxBelegeerstellt.Checked Then
Panel2.Enabled = False
bntDatumsetzen.Enabled = False
@@ -4587,7 +4609,11 @@ RabattBerechnen:
End Sub
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()
If vbYes = MsgBox("Haben Sie die Rechenwerte in den IDS-Tabellen aktualisiert?" & vbNewLine & "(Diese werden beim Importieren in die Abrechnungsdaten übernommen)", vbYesNoCancel) Then
Me.Cursor = Cursors.WaitCursor
setRechenwerteIDS()
Me.Cursor = Cursors.Default
End If
End Sub
Private Sub Button10_Click_1(sender As Object, e As EventArgs) Handles Button10.Click

View File

@@ -591,7 +591,7 @@ Public Class usrCntlMDMDatenverarbeitungAuswertungen_divers
FROM Offerten
WHERE Offerten.KundenNr = ISNULL(tblIDSTransactionsNew.KdNrVERAG, 0)
AND Offerten.OffertenNr = 21) IS NULL))
AND CustomerCode not in (60013994, 60004479)
AND CustomerCode not in (60004479,60025994)
ORDER BY
tblIDSTransactionsNew.[CustomerCode];"

View File

@@ -78,7 +78,7 @@ Public Class usrCntlAuswertungenAufschub_AbgabenKontrolleTRIER
Dim betrag As Double = CDbl(line.Substring(63, 16).Trim)
' Dim fakturiert = CDbl(SQL.DLookup("Betrag", "Zkteing", "[Status]='F' AND [Registriernummer]='" & atc & "' AND [AKTO]=" & AKTONr & "", "FMZOLL", "0"))
Dim fakturiert = CDbl(SQL.DLookup("sum(Preis)", "Rechnungsausgang inner join [RechnungsausgangPositionen] On Rechnungsausgang.RK_ID=[RechnungsausgangPositionen].RK_ID", " [Status]<>0 and DruckDatumZeit is not null and left([RechnungsausgangPositionen].Belegdaten,21)='" & atc & "' AND [AufschubkontoNr]='" & AKTO & "'", "FMZOLL", "0"))
Dim fakturiert = CDbl(SQL.DLookup("sum(Preis)", "Rechnungsausgang inner join [RechnungsausgangPositionen] On Rechnungsausgang.RK_ID=[RechnungsausgangPositionen].RK_ID", " [Status]<>0 and DruckDatumZeit is not null and (left([RechnungsausgangPositionen].Belegdaten,21)='" & atc & "' or [RechnungsausgangPositionen].[Weitere_Reg_Nr] ='" & atc & "' )AND [AufschubkontoNr]='" & AKTO & "'", "FMZOLL", "0"))
Dim differenz = fakturiert - betrag

View File

@@ -231,7 +231,7 @@ Public Class cIDS
objFileRead.BaseStream.Seek(0, System.IO.SeekOrigin.Begin)
Do While (objFileRead.Peek() > -1) 'header ignoríeren
Do While (objFileRead.Peek() > -1)
Dim currentRow As String()
currentRow = objFileRead.ReadLine().Split(",")
@@ -441,7 +441,7 @@ Public Class cIDSInvoice
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNew WHEREYearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber ", conn)
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNew WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber ", conn)
cmd.Parameters.AddWithValue("@YearMonthDay", YearMonthDay)
cmd.Parameters.AddWithValue("@Invoicenumber", Invoicenumber)
cmd.Parameters.AddWithValue("@CustomerCode", CustomerCode)