Imports Microsoft.Web.Http Namespace ApiController.Controllers Public Class ATEZControllerCBAM Inherits System.Web.Http.ApiController ''' ''' Delivers the CBAM-Data ''' Currently only data for DE and Q3 2024 available. ''' ''' ''' Base64 String with CBAM-Data ''' ''' Request OK and returns CBAM Data as Base64 String ''' Returns Parameter are not valid ''' Public Function getCBAM(ByVal Firma As String, country As String, Year As Integer, Quarter As Integer, DirectRepresenation As Boolean) As String Dim Teilnehmner = "" Dim von As Date Dim bis As Date Select Case Firma Case "VERAG" : Teilnehmner = "SUB" Case "IMEX" : Teilnehmner = "IME" Case "UNISPED" : Teilnehmner = "UNAT" End Select Select Case Quarter Case 1 : von = New Date("01.01." & Year) : bis = New Date("30.03" & Year) Case 2 : von = New Date("01.04." & Year) : bis = New Date("30.06" & Year) Case 3 : von = New Date("01.07." & Year) : bis = New Date("30.09" & Year) Case 4 : von = New Date("01.10." & Year) : bis = New Date("31.12" & Year) End Select 'country aktuell nur DE -> Weil aktuell nur DAKOSY-Datensätzr 'Year aktuell nur 2024 Datensätze 'Quartal aktuell nur q3 Datensätze Dim where = "where 1 = 1 " If Teilnehmner <> "" Then where &= "and Teilnehmer =" & Teilnehmner where &= "and [Vertreter_des_Anmelders] = " & IIf(DirectRepresenation, "1", "2") where &= "and [Überlassungsdatum] is between" & von & " and " & bis Dim sql As New VERAG_PROG_ALLGEMEIN.SQL Dim sqlString = "select * from tbl_DY_Zollmeldungen_Import " & where Dim dt As DataTable = sql.loadDgvBySql(sqlString, "AVISO") If dt.Rows.Count > 0 Then Dim Bytes = System.IO.File.ReadAllBytes(VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt)) Return Convert.ToBase64String(Bytes) End If End Function End Class End Namespace