MDM, IDS, USTVA

This commit is contained in:
2024-12-04 11:04:21 +01:00
parent 9fd1c28b5a
commit 890818df47
12 changed files with 177 additions and 148 deletions

View File

@@ -457,7 +457,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
where bills.invoice_date = '" & DateTimePicker2.Text & "' and isnull(trans.charged,0) = 0
GROUP BY Adressen.AdressenNr, Adressen.[Name 1], trans.transaction_country, trans.device_product_type--, trans.device_product_number
order by KundenNr"
@@ -829,7 +829,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
where bills.invoice_date = '" & DateTimePicker2.Text & "' and isnull(trans.charged,0) = 0
GROUP BY Adressen.AdressenNr, Adressen.[Name 1], trans.transaction_country, trans.device_product_type", "FMZOLL")
.LOAD()
@@ -911,7 +911,7 @@ Public Class frmMDMDatenverarbetiung
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.charged <> 1 AND trans.[UStVAn_ID] is null ", "FMZOLL")
where cast(trans.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' and isnull(trans.charged,0) = 0 AND trans.[UStVAn_ID] is null ", "FMZOLL")
.LOAD()
@@ -1199,7 +1199,7 @@ Public Class frmMDMDatenverarbetiung
INNER JOIN (((Adressen INNER JOIN tblUTAImportNew ON Adressen.UTAKundenNr = tblUTAImportNew.Kundennummer)
INNER JOIN Offertenpositionen ON Adressen.AdressenNr = Offertenpositionen.KundenNr)
INNER JOIN tblUTALeistungen ON (tblUTALeistungen.VERAG_LeistungsNr = Offertenpositionen.LeistungsNr) AND (tblUTALeistungen.VERAG_OffertenNr = Offertenpositionen.OffertenNr) AND (tblUTAImportNew.Lieferland = tblUTALeistungen.Lieferland) AND (tblUTAImportNew.Fakturierwarenart = tblUTALeistungen.Fakturierwarenart)) ON tblUTAFakturierwarenarten.Fakturierwarenart = tblUTALeistungen.Fakturierwarenart
where abgerechnet <> 1 and [Rechnungsdatum] = '" & DateTimePicker2.Text & "'
where isnull(abgerechnet,0) = 0 and [Rechnungsdatum] = '" & DateTimePicker2.Text & "'
group by Kundennummer, KundenNr, UTAExportCSV,Rechnungsdruck"
Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200)
@@ -1327,7 +1327,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) " & sqlWhere & "
where bills.invoice_date = '" & DateTimePicker2.Text & "' and isnull(trans.charged,0)= 0 and (trans.transaction_gross_amount <> 0 or trans.[msts_fee_amount] <> 0) " & sqlWhere & "
order by cust.customer_id"
Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200)
@@ -1376,7 +1376,7 @@ Public Class frmMDMDatenverarbetiung
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")
where bills.invoice_date = '" & DateTimePicker2.Text & "' and isnull(trans.charged,0)= 0 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()
@@ -1487,7 +1487,7 @@ Public Class frmMDMDatenverarbetiung
LEFT JOIN
tblIDSInvoicesNew
on tblIDSInvoicesNew.CustomerCode = tblIDSTransactionsNew.CustomerCode and tblIDSInvoicesNew.Invoicenumber = Paymentsummarynumber
WHERE cast(tblIDSTransactionsNew.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' AND tblIDSTransactionsNew.[UStVAn_ID] is null " & sqlWhere & "
WHERE cast(tblIDSTransactionsNew.YearMonthDay as Date) = '" & DateTimePicker2.Text & "' AND tblIDSTransactionsNew.[UStVAn_ID] is null and isnull(charged,0)= 0 and " & sqlWhere & "
order by tblIDSTransactionsNew.KdNrVERAG"
Dim dt_Main As DataTable = SQL.loadDgvBySql_Param(SQLStr, "FMZOLL", 1200)
@@ -1534,7 +1534,7 @@ Public Class frmMDMDatenverarbetiung
If IDS("InvoiceID") > 0 Then
Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER(IDS("InvoiceID"))
File.Copy(DS.GET_TOP1_PATH, dir & "\" & IDS("KdNrVERAG") & "_" & (DS.da_name), False)
File.Copy(DS.GET_TOP1_PATH, dir & "\" & IDS("KdNrVERAG") & "_" & (DS.da_name), True)
End If
@@ -3506,7 +3506,7 @@ Public Class frmMDMDatenverarbetiung
left join [VERAG].[dbo].[tblMSECustomers] as cust on cust.partner_customer_number = trans.partner_haulier_id
left JOIN tblMSELeistungen ON (tblMSELeistungen.[Card Type] = trans.device_product_type) AND (tblMSELeistungen.[Transaction Country] = trans.transaction_country)
left JOIN Offertenpositionen ON cust.partner_customer_number = Offertenpositionen.KundenNr and tblMSELeistungen.LeistungsNr = Offertenpositionen.LeistungsNr and Offertenpositionen.OffertenNr = " & OffertenNr & "
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.charged = 0 and cust.[partner_customer_number] = " & KdNr & "
where bills.invoice_date = '" & DateTimePicker2.Text & "' and isnull(trans.charged,0) = 0 and cust.[partner_customer_number] = " & KdNr & "
group by cust.[customer_id], trans.device_product_type, Offertenpositionen.LeistungsNr , Offertenpositionen.LeistungsBez ) as temp group by customer_id, LeistungsNr"
Dim dt As DataTable = SQL.loadDgvBySql_Param(sqlstr, "FMZOLL", 1200)
@@ -4142,6 +4142,15 @@ Public Class frmMDMDatenverarbetiung
End If
Dim sqlStringfehlendeLeistungsNr = "select count(*) from (SELECT Leistungen.LeistungsNr, Leistungen.LeistungsBez,tblIDSTransactionsNew.KdNrVERAG FROM Leistungen INNER Join tbl_IDS_Länder On Leistungen.LeistungsNr = tbl_IDS_Länder.LeistungsNr INNER Join tblIDSTransactionsNew On tblIDSTransactionsNew.[OutletCountryCode] = tbl_IDS_Länder.OutletCountryCode Left JOIN Offertenpositionen on Offertenpositionen.KundenNr IN (select tblIDSTransactionsNew.KdNrVERAG from tblIDSTransactionsNew where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "') and Leistungen.LeistungsNr = Offertenpositionen.LeistungsNr and ( Offertenpositionen.OffertenNr=17 or Offertenpositionen.OffertenNr=21) where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "' and Offertenpositionen.LeistungsNr is null Group by Leistungen.LeistungsNr, Leistungen.LeistungsBez,tblIDSTransactionsNew.KdNrVERAG ) as t1" 'Verag360 und VeragAG
Dim fehlendeLeistungsNr As Integer = CInt((New SQL).getValueTxtBySql(sqlStringfehlendeLeistungsNr, "FMZOLL"))
If fehlendeLeistungsNr > 0 Then
pruefData_IDS = False
MsgBox("Bei " & fehlendeLeistungsNr & " Leistungen fehlt die Offertenzuweisung !" & vbNewLine & "Diese Offerten (von Rechnungsdatum " & DateTimePicker2.Text & ") müssen nachgetragen werden.")
Return False
End If
Dim OBONumberOderVRNumberfehlern As Integer = 0
OBONumberOderVRNumberfehlern = CInt((New SQL).getValueTxtBySql("select count(*) from [tblIDSTransactionsNew] WHERE cast(YearMonthDay as Date) = '" & DateTimePicker2.Text & "' AND tblIDSTransactionsNew.[UStVAn_ID] is null AND [VRNumber] is null AND [OBONumber] is null", "FMZOLL"))
@@ -4293,7 +4302,7 @@ Public Class frmMDMDatenverarbetiung
PictureBox1.Visible = True
End If
Case "UTA"
If SQL.doSQL("UPDATE [tblUTAImportNew] set abgerechnet=1 where abgerechnetDatum is not null and abgerechnet <> 1 And and tblUTAImportNew.Rechnungsdatum = '" & DateTimePicker2.Text & "'", "FMZOLL") Then
If SQL.doSQL("UPDATE [tblUTAImportNew] set abgerechnet=1 where abgerechnetDatum is not null and isnull(abgerechnet,0) = 0 And and tblUTAImportNew.Rechnungsdatum = '" & DateTimePicker2.Text & "'", "FMZOLL") Then
PictureBox1.Visible = True
End If
Case "MSE"
@@ -4301,21 +4310,21 @@ Public Class frmMDMDatenverarbetiung
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
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.chargedDatetime is not null and charged <> 1 ") Then
where bills.invoice_date = '" & DateTimePicker2.Text & "' and trans.chargedDatetime is not null and isnull(trans.charged) = 0 ", "FMZOLL") Then
PictureBox1.Visible = True
End If
Case "IDS"
If SQL.doSQL("UPDATE [VERAG].[dbo].[tblIDSTransactionsNew] Set charged = 1
FROM [VERAG].[dbo].[tblIDSTransactionsNew]
where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "' and chargedDatetime is not null and charged <> 1 and tblIDSTransactionsNew.OutletCountryCode <> 740543 ") Then
where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "' and chargedDatetime is not null and isnull(charged,0) = 0 and tblIDSTransactionsNew.OutletCountryCode <> 740543 ", "FMZOLL") Then
PictureBox1.Visible = True
End If
Case "IDS_AT"
If SQL.doSQL("UPDATE [VERAG].[dbo].[tblIDSTransactionsNew] Set charged = 1
FROM [VERAG].[dbo].[tblIDSTransactionsNew]
where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "' and chargedDatetime is not null and charged <> 1 and tblIDSTransactionsNew.OutletCountryCode = 740543 ") Then
where cast(tblIDSTransactionsNew.YearMonthDay As Date) = '" & DateTimePicker2.Text & "' and chargedDatetime is not null and isnull(charged,0) = 0 and tblIDSTransactionsNew.OutletCountryCode = 740543 ", "FMZOLL") Then
PictureBox1.Visible = True
End If
Case Else