Class DatevExportService


  • @DeclareRoles("org.imixs.ACCESSLEVEL.MANAGERACCESS")
    @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
    public class DatevExportService
    extends Object
    Der DatevExportService stellt methoden für den Datev export bereit

    Unter anderem werden metadaten berechnet.

    _stapelzeitraum_start und _stapelzeitraum_ende markieren die äterste und die jüngste Rechnung. Diese Daten weren für die DATEV Kopf Datei benötigt.

    Change: 13.01.2021

    Belegbilder dürfen immer nur einmal in der documents.xml drin stehen auch wenn diese mehrfach in verschiedenne Buchungssätzen verwendet werden. Daher prüfen wir beim Aufbau der documents.xml ob das belegbild schon generiert wurde.

    Version:
    1.0
    Author:
    rsoika
    • Constructor Detail

      • DatevExportService

        public DatevExportService()
    • Method Detail

      • updateExportWorkitem

        public org.imixs.workflow.ItemCollection updateExportWorkitem​(org.imixs.workflow.ItemCollection datevExport,
                                                                      org.imixs.workflow.ItemCollection configuration,
                                                                      List<org.imixs.workflow.ItemCollection> data)
        This method Updates the export workitem

        The datev client id is fetched from the first invoice of the invoice data collection.

        Change 5.5.2022 Die Beraternummer kann nun auch auf Corporate Ebene gepflegt werden. Ist das der Fall, dann gewinnt diese Nummer. Andernfalls wird weiterhin die Beraternummer aus der Zentralen DATEV Config genommen.

        Parameters:
        configuration -
        modelVersion -
        taskID -
        data -
        Returns:
      • buildDocumentsZipFile

        public void buildDocumentsZipFile​(org.imixs.workflow.ItemCollection datevExport,
                                          List<org.imixs.workflow.ItemCollection> data,
                                          String key,
                                          org.imixs.workflow.ItemCollection configuration)
                                   throws org.imixs.workflow.engine.scheduler.SchedulerException,
                                          org.imixs.workflow.exceptions.PluginException
        This method builds the datev zip file containing the XML documents definition and also all attachments. The zip-file is finally attached into the datevExport workitem.

        Change: 13.01.2021

        Belegbilder dürfen immer nur einmal in der documents.xml drin stehen auch wenn diese mehrfach in verschiedenne Buchungssätzen verwendet werden. Daher prüfen wir beim Aufbau der documents.xml ob das belegbild schon generiert wurde.

        Parameters:
        data -
        Throws:
        org.imixs.workflow.engine.scheduler.SchedulerException
        org.imixs.workflow.exceptions.PluginException
      • buildCSVFile

        public void buildCSVFile​(org.imixs.workflow.ItemCollection datevExport,
                                 List<org.imixs.workflow.ItemCollection> data,
                                 String key,
                                 org.imixs.workflow.ItemCollection configuration)
                          throws org.imixs.workflow.engine.scheduler.SchedulerException
        This method builds an DATEV CSV export file containing all given invoices
        Parameters:
        data -
        Throws:
        org.imixs.workflow.engine.scheduler.SchedulerException
      • putFileData

        public boolean putFileData​(org.imixs.workflow.FileData fileData,
                                   org.imixs.workflow.ItemCollection configuration,
                                   String subDirectory,
                                   org.imixs.workflow.ItemCollection datevExport,
                                   int ftpType)
                            throws org.imixs.workflow.engine.scheduler.SchedulerException
        This method exports a fildata object to a ftp server defined by the configuration ItemCollection.

        Das Zielverzeichnis wird mit der MAndanten ID ergänzt!

        Parameters:
        timer -
        Throws:
        org.imixs.workflow.exceptions.QueryException
        org.imixs.workflow.engine.scheduler.SchedulerException
      • buildExportWorkitem

        public org.imixs.workflow.ItemCollection buildExportWorkitem​(org.imixs.workflow.ItemCollection configuration,
                                                                     String modelVersion,
                                                                     int taskID,
                                                                     List<org.imixs.workflow.ItemCollection> data)
        This method builds the export workitem. This method is only used by the IW24DatevImportControler!

        The datev client id is fetched from the first invoice of the invoice data collection.

        Change 5.5.2022 Die Beraternummer kann nun auch auf Corporate Ebene gepflegt werden. Ist das der Fall, dann gewinnt diese Nummer. Andernfalls wird weiterhin die Beraternummer aus der Zentralen DATEV Config genommen.

        Parameters:
        configuration -
        modelVersion -
        taskID -
        data -
        Returns:
      • loadConfiguration

        public org.imixs.workflow.ItemCollection loadConfiguration​(String name)
        Loads the DATEV configuration entity by name. The method returns null if no configuration exits.
        Returns:
      • computeKey

        public String computeKey​(org.imixs.workflow.ItemCollection invoice)
        Helper Method to copute the grouping key (MandantID+Buchungsperiode)
        Returns:
      • findDatevExport

        public org.imixs.workflow.ItemCollection findDatevExport​(String datevKey)
                                                          throws org.imixs.workflow.exceptions.QueryException
        Prüft alle offenen Datev Exporte und gibt den neuesten zur angegebenen Datev Client ID zurück, oder null falls es keinen Offenen Datev Export gibt.
        Parameters:
        datevKey -
        Returns:
        Throws:
        org.imixs.workflow.exceptions.QueryException
      • processDatevExport

        public org.imixs.workflow.ItemCollection processDatevExport​(org.imixs.workflow.ItemCollection datevExport)
                                                             throws org.imixs.workflow.exceptions.AccessDeniedException,
                                                                    org.imixs.workflow.exceptions.ProcessingErrorException,
                                                                    org.imixs.workflow.exceptions.PluginException,
                                                                    org.imixs.workflow.exceptions.ModelException
        Aktualisiert den DATEV Export mit Manager Rechten
        Parameters:
        datevExport -
        Returns:
        Throws:
        org.imixs.workflow.exceptions.ModelException
        org.imixs.workflow.exceptions.PluginException
        org.imixs.workflow.exceptions.ProcessingErrorException
        org.imixs.workflow.exceptions.AccessDeniedException
      • getWorkItemFileFromWorkitem

        public org.imixs.workflow.FileData getWorkItemFileFromWorkitem​(org.imixs.workflow.ItemCollection invoice)
                                                                throws org.imixs.workflow.exceptions.PluginException
        This method first lookups the origin workItem from the given export data entity. Then the method returns the first PDF fileData from a snapshot by a resolved invoice workItem.

        If multiple files are attached, the method returns the latest FileData object

        Parameters:
        uniqueid -
        file - - file name
        Returns:
        FileData object for the given filename.
        Throws:
        org.imixs.workflow.exceptions.PluginException