offeneAntr MDM

This commit is contained in:
2025-01-31 09:48:46 +01:00
parent 9de66fc099
commit 2fffe4cdd5

View File

@@ -93,8 +93,8 @@ Public Class frmUSTVoffeneAntraege
.SET_SQL("select " & top & " Adressen.AdressenNr, Adressen.[Name 1] ,[plose_Lieferant],[plose_RechnungsDatum],[plose_RechnungsNr],plp_Land, sum([plose_MWSTBetrag])[plose_MWSTBetrag], [plInv_daId] as daId FROM [tblPLOSE_Details]
INNER JOIN Adressen on PLOSEKundenNr=plose_POLSEKundennummer
INNER JOIN [tblPLOSE_Produktbeschreibung] ON [plp_ProductCode]=[plose_ProduktCode]
LEFT JOIN [tblPLOSE_Inv_Data] on plInv_SupplierRechnungsDatum=plose_RechnungsDatum and plInv_SupplierRechnungsNr=plose_RechnungsNr and plInv_SupplierCountry=plp_Land AND [plInv_daId] is not null
WHERE plose_Archiv <> 1 /*AND plose_LieferantCode IN (0,1,7) */ AND cast(plose_RechnungsDatum as date) between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and plose_RechnungsNr is not null " & sqlwhere &
INNER JOIN [tblPLOSE_Inv_Data]on plInv_SupplierRechnungsDatum=plose_RechnungsDatum and plInv_SupplierRechnungsNr=plose_RechnungsNr and [plInv_PLOSEKundennummer] = PLOSEKundenNr
WHERE UStVAn_ID is null /*plose_Archiv <> 1 AND plose_LieferantCode IN (0,1,7) */ AND cast(plose_RechnungsDatum as date) between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and plose_RechnungsNr is not null " & sqlwhere &
"group by Adressen.AdressenNr, Adressen.[Name 1] ,[plose_RechnungsDatum],[plose_RechnungsNr],[plose_Lieferant], plp_Land, [plInv_daId]
having sum(plose_MWSTBetrag) <>0", "FMZOLL")
.LOAD()
@@ -522,20 +522,30 @@ Public Class frmUSTVoffeneAntraege
.Columns.Clear()
'Exit Sub
'MsgBox(.sql)
'PLOSE ALT
' FROM [tblPLOSE_Details]
' INNER JOIN Adressen on PLOSEKundenNr=plose_POLSEKundennummer
' INNER JOIN [tblPLOSE_Produktbeschreibung] ON [plp_ProductCode]=[plose_ProduktCode]
' WHERE plose_Archiv <> 1 /*AND plose_LieferantCode IN (0,1,7) */ AND
'cast(plose_RechnungsDatum as date) between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and plose_RechnungsNr is not null " & sqlwherePLOSE & "
'group by Adressen.AdressenNr, Adressen.[Name 1],Adressen.LandKz ,[plose_RechnungsDatum],plp_Land
' having sum(plose_MWSTBetrag)<>0
Dim sqlstring = "select isnull(UStVAn_ID,0) as antragExisitiert,tblSteuernummern.UStV as SteuerNr,Lieferant , KdNr, Kundenname, Kundenland, Einreichland from ( select " & top & "
'PLOSE' as Lieferant,
Adressen.AdressenNr as KdNr,
Adressen.[Name 1] as Kundenname,
Adressen.LandKz as Kundenland,
plp_Land as Einreichland,
[plInv_SupplierCountry] as Einreichland,
[plose_RechnungsDatum] AS Rechnungsdatum,
sum([plose_MWSTBetrag]) as MWST
FROM [tblPLOSE_Details]
INNER JOIN Adressen on PLOSEKundenNr=plose_POLSEKundennummer
INNER JOIN [tblPLOSE_Produktbeschreibung] ON [plp_ProductCode]=[plose_ProduktCode]
INNER JOIN [tblPLOSE_Inv_Data]on plInv_SupplierRechnungsDatum=plose_RechnungsDatum and plInv_SupplierRechnungsNr=plose_RechnungsNr and [plInv_PLOSEKundennummer] = PLOSEKundenNr
WHERE plose_Archiv <> 1 /*AND plose_LieferantCode IN (0,1,7) */ AND
cast(plose_RechnungsDatum as date) between '" & dat_Sum_Von.Value & "' and '" & dat_Sum_Bis.Value & "' and plose_RechnungsNr is not null " & sqlwherePLOSE & "
group by Adressen.AdressenNr, Adressen.[Name 1],Adressen.LandKz ,[plose_RechnungsDatum],plp_Land
group by Adressen.AdressenNr, Adressen.[Name 1],Adressen.LandKz ,[plose_RechnungsDatum],[plInv_SupplierCountry]
having sum(plose_MWSTBetrag)<>0
UNION ALL