Report generation method and device supporting multiple layouts and multiple templates

Report template identification is generated through a hash algorithm, combined with layout coding and visual formula builder, the efficiency and accuracy of multi-layout multi-template report generation in the existing technology is solved, and flexible customization and efficient generation are achieved.

CN120257955AActive Publication Date: 2025-07-04BEIJING XINLONG TECH CO LTD

Patent Information

Application Number
CN202510282741.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-07-04
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

Existing report generation technology is difficult to meet the needs of multiple layout forms and personalized template customization, resulting in inefficiency and error-prone.

Method used

The hash algorithm is used to generate a unique identity of the report template, determine the layout encoding based on the identity, select the target layout component from the preset layout component library, build an element relationship network, and provide a visual formula builder, and dynamically load the account tree to generate reports with multiple layouts and multiple templates.

Benefits of technology

It realizes systematic management of report templates, improves generation efficiency and accuracy, ensures layout consistency and accurate data calculation, and supports diversified needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120257955A_ABST
    Figure CN120257955A_ABST
Patent Text Reader

Abstract

The invention discloses a report generation method and device supporting multiple layouts and multiple templates, and relates to the field of report generation. In the method, a report template table is created to determine a core parameter and an extension parameter of a target template, and a unique identifier of the target template is created based on the core parameter, the extension parameter and a timestamp; determining a layout code corresponding to the target template according to the identifier, selecting a target layout component from a preset layout component library according to the layout code to generate a layout description file, and generating a style sheet having a mapping relationship with the identifier according to the layout description file; constructing an element relationship network according to a row and column position relationship in the layout description file to record row and column coordinates and style marks of each report element so as to generate an element table, dynamically loading a subject tree, and providing a visual formula constructor to perform formula configuration so as to generate a formula table; and generating a report based on the element table, the formula table and the style table according to the target identifier. By implementing the technical scheme provided by the invention, the report template and layout can be flexibly customized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of report generation, and particularly relates to a report generation method and device supporting multiple layouts and multiple templates. Background Art

[0002] Report generation technology is an important part of modern enterprise management and data analysis, and is widely used in fields such as finance and statistics. With the improvement of the informatization level of enterprises, the demand for report generation is becoming increasingly diverse, and traditional static reports can no longer meet the complex and changing actual needs. To address this challenge, various flexible report generation tools and technologies have gradually emerged in the industry, aiming to improve data processing efficiency and report presentation quality.

[0003] In existing report generation technologies, the design and generation of reports are usually achieved by means of predefined templates. Specifically, technicians will pre-design report templates with fixed formats and complete data filling through manual input or script programming. Although the above traditional methods can meet the basic report production requirements to a certain extent, they are unable to cope when it comes to supporting multiple layout forms and personalized template customization. Especially when generating a large number of different types of reports simultaneously, there is a lack of an effective mechanism to ensure the consistency and accuracy among reports, resulting in low work efficiency and easy errors.

[0004] Therefore, there is an urgent need for a report generation method that can efficiently manage multiple layouts and multiple templates to overcome the limitations of the existing technology. Summary of the Invention

[0005] This application provides a report generation method and device supporting multiple layouts and multiple templates, which realizes flexible customization of report templates and layouts, improves report generation efficiency and accuracy, and meets diverse requirements.

[0006] In the first aspect of this application, a report generation method supporting multiple layouts and multiple templates is provided, which is applied to a report generation platform. The method includes: Create a report template table to determine the core parameters and extended parameters of the target template, and use the hash algorithm to create a unique identifier of the target template based on the core parameters, the extended parameters, and the timestamp; Determine the layout code corresponding to the target template according to the identifier, select target layout components from a preset layout component library according to the layout code to generate a layout description file, and generate a style sheet having a mapping relationship with the identifier according to the layout description file; Construct an element relationship network according to the row and column position relationships in the layout description file to record the row and column coordinates and style tags of each report element to generate an element table, dynamically load a subject tree, and provide a visual formula builder for formula configuration to generate a formula table; After receiving the target identifier, obtain the row-column structure from the element table according to the target identifier, load the calculation logic from the formula table, and obtain the layout description from the style table, and generate a report according to the row-column structure, the calculation logic, and the layout description.

[0007] Optionally, determining a layout code corresponding to the target template according to the identifier, selecting a target layout component from a preset layout component library according to the layout code to generate a layout description file, and generating a style sheet mapped to the identifier according to the layout description file includes: Query a predefined layout rule library based on the identifier, and obtain the layout code associated with the report type in the core parameters; Match a target layout component from a preset layout component library according to the layout code, and the preset layout component library includes XML structure definitions of a table header layout and a table footer layout; Generate the layout description file according to the target layout component, and the layout description file includes row-column position relationships and style placeholders; Map the layout description file to the identifier, generate a corresponding CSS style sheet path, and store it in the style sheet.

[0008] Optionally, constructing an element relationship network according to the row-column position relationships in the layout description file to record the row-column coordinates and style tags of each report element to generate an element table includes: Parse the XML structure in the layout description file, and extract all row-column nodes and corresponding attributes; Create an initial element table, create corresponding row records and column records in the initial element table according to the first-level relationship and coordinate information of the row-column nodes, and assign a unique element identifier to each cell; Obtain a CSS style sheet from the style sheet according to the style placeholder, parse the style tags and associate them with the corresponding element identifiers to generate an element table.

[0009] Optionally, dynamically loading a subject tree and providing a visual formula builder for formula configuration to generate a formula table includes: Filter out the first subject code and the second-level relationship associated with the current accounting set from a preset subject database according to the accounting set identifier in the core parameters, and generate a dynamic subject tree; Render the subject tree in the visual formula builder, and receive operation instructions from the user by dragging subject nodes, selecting debit / credit directions, and operators; An abstract syntax tree is generated according to the operation instruction, an initial public table is created, and the structure of the abstract syntax tree, the associated first subject code and the corresponding element identifier are bound and stored in the initial formula table to generate a formula table.

[0010] Optionally, generating an abstract syntax tree according to the operation instruction includes: Parsing the second subject code, operator and direction mark in the operation instruction to construct an initial syntax tree node; Performing a validity check on the initial syntax tree node according to preset verification rules, wherein the validity check includes subject existence check, debit and credit direction conflict check, and circular reference interception; The verified initial syntax tree nodes are rearranged according to operator priority to generate an abstract syntax tree, and metadata is added to the abstract syntax tree, the metadata including the dependent account set identifier, report period and calculation precision parameter.

[0011] Optionally, acquiring a row and column structure from the element table according to the target identifier, loading calculation logic from the formula table, and acquiring a layout description from the style sheet, and generating a report according to the row and column structure, the calculation logic, and the layout description includes: Obtaining a target layout description file and a CSS style sheet path from the style sheet according to the target identifier, and parsing row and column structures and style tags; Traversing each element identifier in the element table, querying the debit and credit data in the account balance table in real time according to the structure of the abstract syntax tree bound to the formula table and the third account code; Substituting the query result into the formula of the abstract syntax tree for calculation, generating a cell value, and filling the cell value into the corresponding coordinate according to the row and column position relationship in the target layout description file; The CSS style sheet is obtained according to the CSS style sheet path, and the CSS style sheet is combined with the filled data and rendered into the report.

[0012] Optionally, the method further includes: Parsing the structure of the abstract syntax tree in the formula table, extracting all dependent fourth subject codes and calculation logics; Reversely query the account balance table according to the fourth account code, obtain the original voucher number, amount and transaction date, and generate a list of original data sources; A data traceability mark is added to each cell in the report, and a visual traceability path diagram is displayed when clicked, wherein the path diagram includes the account calculation link and the details of the associated vouchers; Mark abnormal data nodes in the traceability path diagram and provide original voucher jump links.

[0013] In a second aspect of the present application, a report generation system supporting multiple layouts and multiple templates is provided, including an identification module, a description module, a formula module, and an execution module, where: The identification module is configured to create a report template table to determine the core parameters and extension parameters of the target template, and use the hash algorithm to create a unique identifier of the target template based on the core parameters, the extension parameters, and the timestamp; The description module is configured to determine the layout code corresponding to the target template according to the identifier, select target layout components from a preset layout component library according to the layout code to generate a layout description file, and generate a style sheet mapped to the identifier according to the layout description file; The formula module is configured to construct an element relationship network according to the row-column position relationship in the layout description file to record the row-column coordinates and style tags of each report element to generate an element table, dynamically load a subject tree, and provide a visual formula builder for formula configuration to generate a formula table; The execution module is configured to, after receiving the target identifier, obtain the row-column structure from the element table, load the calculation logic from the formula table, and obtain the layout description from the style sheet, and generate a report according to the row-column structure, the calculation logic, and the layout description.

[0014] In a third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, and both the user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory so that the electronic device executes the method described in any one of the above.

[0015] In a fourth aspect of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions, and when the instructions are executed, the method described in any one of the above is executed.

[0016] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Create a report template table to determine the core parameters and extension parameters of the target template, and use the hash algorithm to create a unique identifier of the template based on the parameter values and the timestamp, making the template management more systematic and standardized. The distinction and management of the core parameters and extension parameters help to quickly generate report templates that meet the requirements in different application scenarios, and the generation of the unique identifier facilitates the accurate identification and version tracking of the template, providing convenience for the update, reuse, and sharing of the template; 2. Determine the layout encoding according to the template identifier, select target layout components from a preset layout component library to generate a layout description file, and generate a style sheet mapped to the identifier. This process realizes the reuse and rapid configuration of the layout. Users do not need to design the layout from scratch. They only need to select the appropriate layout encoding to quickly generate the layout description file and style sheet, greatly saving the layout design time. At the same time, the provision of the preset layout component library ensures the standardization and consistency of the report layout, meeting the diverse needs of different users for the appearance and format of the report; 3. Construct an element relationship network based on the layout description file, record the row and column coordinates and style tags of each report element, generate an element table, and realize the refined management of report elements. Dynamically load the subject tree and provide a visual formula builder for formula configuration, making the formula configuration more intuitive and convenient, reducing the difficulty and error rate of formula configuration. Through the generation and management of the formula table, it ensures that the calculation logic of each cell is clear and accurate, providing a basis for the accurate calculation of report data; 4. After receiving the target identifier, the system can quickly obtain the required row and column structure, calculation logic, and layout description from the element table, formula table, and style sheet, realizing the efficient generation of reports. The application of the real-time calculation engine and the distributed calculation mode improves the calculation speed and processing ability of report data, ensuring the real-time and accuracy of reports. At the same time, the generation of data lineage reports and calculation logs provides strong support for data traceability and problem troubleshooting of reports, helping to improve the credibility and reliability of report data.

[0017] 5. Adopt the state machine mode to manage the template life cycle, including states such as draft, pending review, and published, ensuring the standardization and orderliness of the report generation process. The integration of the approval process and the generation of the difference comparison view enable the approval personnel to clearly understand the changes in the report configuration, improving the accuracy and efficiency of approval. Through page configuration, the report disclosure template is displayed, and the report formula is adjusted and displayed in real time, providing convenience for report analysis and adjustment, and helping to improve the quality and application value of reports. Description of the Drawings

[0018] Figure 1 is a schematic flowchart of a report generation method supporting multiple layouts and multiple templates disclosed in an embodiment of the present application; Figure 2 is a schematic diagram of a newly added report template disclosed in an embodiment of the present application; Figure 3 is a schematic diagram of editing a template layout disclosed in an embodiment of the present application; Figure 4 is a schematic diagram of designing a table header disclosed in an embodiment of the present application; Figure 5 is a schematic diagram of editing a template design disclosed in an embodiment of the present application; Figure 6 It is a schematic diagram of adding a formula disclosed in an embodiment of the present application; Figure 7 It is a schematic diagram of submitting for approval disclosed in an embodiment of the present application; Figure 8 It is a schematic diagram of the statement details after approval passed disclosed in an embodiment of the present application; Figure 9 It is a module schematic diagram of a report generation system that supports multiple layouts and multiple templates disclosed in an embodiment of the present application; Figure 10 It is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application.

[0019] Description of reference numerals: 901, identification module; 902, description module; 903, formula module; 904, execution module; 1001, processor; 1002, communication bus; 1003, user interface; 1004, network interface; 1005, memory. Detailed implementation manners

[0020] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.

[0021] In the description of the embodiments of the present application, words such as "for example" or "for illustration" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "for example" or "for illustration" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, the use of words such as "for example" or "for illustration" is intended to present relevant concepts in a specific manner.

[0022] In the description of the embodiments of the present application, the meaning of the term "plurality" refers to two or more. For example, a plurality of systems refers to two or more systems, and a plurality of screen terminals refers to two or more screen terminals. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly indicating the technical features indicated. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0023] This embodiment discloses a report generation method that supports multiple layouts and multiple templates, which is applied to a report generation platform, Figure 1It is a schematic flowchart of a report generation method supporting multiple layouts and multiple templates disclosed in an embodiment of the present application. As Figure 1 shown, the method includes the following steps: S101. Create a report template table to determine the core parameters and extended parameters of the target template, and use the hash algorithm to create a unique identifier of the target template based on the core parameters, the extended parameters, and the timestamp; S102. Determine the layout code corresponding to the target template according to the identifier, select target layout components from a preset layout component library according to the layout code to generate a layout description file, and generate a style sheet having a mapping relationship with the identifier according to the layout description file; S103. Construct an element relationship network according to the row-column position relationship in the layout description file to record the row-column coordinates and style tags of each report element to generate an element table, dynamically load a subject tree, and provide a visual formula builder for formula configuration to generate a formula table; S104. After receiving the target identifier, obtain the row-column structure from the element table according to the target identifier, load the calculation logic from the formula table, and obtain the layout description from the style sheet, and generate a report according to the row-column structure, the calculation logic, and the layout description.

[0024] Define core parameters (structured fields) in the report template table, including: company name (associated with the organizational structure), accounting set name (bound to the financial data source), report type (such as balance sheet, income statement, etc.), number of columns (determining the horizontal structure of the report), contract group type (extending business scenario adaptability). Extended parameters are stored in JSONB format for dynamic configuration (such as custom tags, approval process identifiers). Use SHA-256 to calculate the digest of the core parameter values (such as company name + accounting set name + report type) and the timestamp to generate a globally unique identifier (template ID). If the hash result is repeated, append a random salt value and recalculate to ensure uniqueness. Generate a new version identifier for each template modification and form a chained association with the historical versions. According to the report type field in the template ID (such as "cash flow statement"), match the corresponding layout code from the predefined layout rule library. The rule library is stored in key-value pairs, with the key being the report type and the value being the layout code and constraint conditions (such as "the cash flow statement must include a three-level header"). Preset layout component library: XML definition files containing components such as headers, footers, and page breaks. Accurately match the XML template file according to the layout code. Parse the style placeholders (such as {{style_title}}) in the layout description file and extract the corresponding CSS rules (such as font, color, border) from the preset style library. Generate an independent CSS file (such as style_8a1f6d.css) and associate its path with the template ID and store it in the style sheet (template style association table). Extract the row and column nodes and their attributes from the layout description file to generate a row and column coordinate mapping table. Associate CSS rules according to the placeholder markers (such as bold). Query the enabled accounts from the account database according to the account set ID and construct a tree structure (such as "Assets → Current Assets → Cash"). When a test account set is detected, load the predefined simulated account tree (such as "Test Account A → Sub-Account A1"). The user selects the target cell in the grid interface (element ID = E001), drags the account node (such as the account code of "Cash" = 1001), selects the operator (+ / -) and direction (debit / credit). Generate a batch query SQL according to the account code list in the formula table to reduce the number of database accesses. Distribute the cell calculation tasks to the distributed computing nodes and aggregate the results in MapReduce mode (such as parallel summation of multiple account balances). Inject CSS classes into the corresponding cells according to the style markers (such as bold) in the element table. Dynamically generate front-end scripts for the collapsed rows (collapsed marker) to implement the expand / collapse function. Parse the AST structure, extract the dependent account codes (such as 1001, 1002); query the account balance table in reverse to obtain the original voucher information (such as voucher number, date, amount); generate a visualization link diagram: cell value → formula AST → account balance → original voucher. Add a floating hint or hyperlink to the cell in the report, and click to jump to the traceability details page.

[0025] Figure 2 It is a schematic diagram of the newly added report template disclosed in the embodiments of the present application. As Figure 2 shown, the newly added report template includes company name, account set name, report template type, report template name, number of columns generated by the report, and contract group type.

[0026] Figure 3 It is a schematic diagram of editing the template layout disclosed in the embodiments of the present application. As Figure 3 shown, the template layout includes header layout settings and footer layout settings.

[0027] Figure 4 It is a schematic diagram of designing the header disclosed in the embodiments of the present application. As Figure 4 shown, the header design includes three parts: left, middle, and right. The left part can be the report name, the middle part can be the report year, and the right part can be remarks.

[0028] Figure 5 It is a schematic diagram of editing the template design disclosed in the embodiments of the present application. As Figure 5 shown, the template can add report items, specifically including report item name and data fetching source.

[0029] Figure 6 It is a schematic diagram of adding a formula disclosed in the embodiments of the present application. As Figure 6 shown, normally all the account configurations under this account set will be displayed, and then the debit and credit directions of the accounts are selected for addition and subtraction summation operations. Since there is no account configuration in the test account set, it is displayed as empty.

[0030] Figure 7 It is a schematic diagram of submitting for approval disclosed in the embodiments of the present application. As Figure 7 shown, there will be report information and approval records after submitting for approval.

[0031] Figure 8 It is a schematic diagram of the report details after approval passed disclosed in the embodiments of the present application. As Figure 8 shown, the specific configurations can be seen after approval passed, that is Figure 8 the test column 1, test column 2, and test column 3 in

[0032] Optionally, the determining the layout code corresponding to the target template according to the identifier, selecting the target layout component from the preset layout component library according to the layout code to generate the layout description file, and generating the style sheet mapped with the identifier includes: Querying the predefined layout rule library based on the identifier to obtain the layout code associated with the report type in the core parameters; Match the target layout component from a preset layout component library according to the layout code, where the preset layout component library includes XML structure definitions of a table header layout and a table footer layout; Generate the layout description file according to the target layout component, where the layout description file includes row and column position relationships and style placeholders; Map the layout description file with the identifier to generate a corresponding CSS style sheet path and store it in the style sheet.

[0033] When the layout code needs to be determined for the template, the system queries a predefined layout rule library according to the unique identifier of the template. Different layout codes corresponding to different report types are stored in the layout rule library. For example, if the target template is for a financial report, the system will find the layout code related to the financial report in the layout rule library according to the report type information (one of the core parameters) included in the template identifier. The preset layout component library is a resource library storing various layout components, including table header layouts, table footer layouts, etc. Each layout component has a unique layout code. The system matches the corresponding target layout component in the preset layout component library according to the layout code obtained in the previous step. For example, if the layout code is "layout - financial - 001", the system will find the XML structure definitions of the table header layout and the table footer layout corresponding to this code. The table header layout may define information such as the title style and the position of column names, while the table footer layout may define the position and style of the total row. Once the target layout components are determined, the system generates a layout description file according to these components. The layout description file is an XML file that details the row and column position relationships and style placeholders of the report. For example, it defines the number of rows and columns of the report, and the width, height, alignment and other attributes of each row and column. The style placeholders are markers used to insert specific styles in subsequent steps, such as font color, background color, etc. After generating the layout description file, the system maps the file with the template identifier and generates a corresponding CSS style sheet path. The style sheet stores specific style information, such as fonts, colors, borders, etc. The generation of the style sheet is based on the style placeholders in the layout description file. For example, if there is a style placeholder "header - title" in the layout description file, the system will write the style information corresponding to this placeholder (such as bold font, 14pt font size, black color, etc.) into the style sheet according to the predefined style rules. The generated style sheet path will be stored in the template style association table so that the corresponding style can be quickly found and applied during report rendering.

[0034] Querying the predefined layout rule library based on the template identifier can accurately find the layout code corresponding to the report type, avoiding the errors that may occur during manual layout selection, ensuring a high degree of matching between the report layout and content, and enhancing the accuracy and professionalism of report generation. The use of the preset layout component library enables the layout components to be reused multiple times, reducing the workload of repeated design and configuration. When generating reports with similar layouts, the pre-stored layout components can be directly called, greatly saving time and effort and improving the efficiency of report generation. The layout description file details the row and column position relationships and style placeholders, providing a unified standard for the row and column structure and style of the report, ensuring format consistency of the report in different scenarios, facilitating user understanding and use, and also facilitating subsequent data analysis and processing. Mapping the layout description file with the identifier and generating the corresponding CSS style sheet path enables the style of the report to be dynamically adjusted and applied according to the template identifier. This not only ensures the flexibility and aesthetics of the report style but also facilitates unified management and maintenance of the style, improving the maintainability of the system.

[0035] Optionally, constructing an element relationship network according to the row and column position relationships in the layout description file to record the row and column coordinates and style tags of each report element to generate an element table includes: Parsing the XML structure in the layout description file and extracting all row and column nodes and corresponding attributes; Creating an initial element table, creating corresponding row records and column records in the initial element table according to the first-level relationship and coordinate information of the row and column nodes, and assigning a unique element identifier to each cell; Obtaining the CSS style sheet from the style sheet according to the style placeholder, parsing the style tags and associating them with the corresponding element identifiers to generate an element table.

[0036] The layout description file is defined in XML structure, which contains information such as the row and column position relationships and style placeholders of the report. By parsing the XML file, all row and column nodes and their corresponding attributes can be extracted. These attributes include but are not limited to row numbers, column numbers, style categories, etc., and this information is the basic data for constructing report elements. According to the first-level relationship and coordinate information of the parsed row and column nodes, an initial element table is created. In this initial element table, corresponding row records and column records will be created for each row and column in the report, and a unique element identifier will be assigned to each cell in the report. This unique element identifier is used to uniquely identify each cell in the subsequent processing process, facilitating the operation and management of cells. Obtain the corresponding CSS style sheet from the style sheet according to the style placeholder. By parsing the style tags in the CSS style sheet and associating these style tags with the corresponding element identifiers in the initial element table, the final element table is generated. In this way, each cell not only contains row and column coordinate information, but also contains specific style tags such as font, color, alignment method, etc., ensuring that the appearance format of the report can be displayed according to the preset style.

[0037] By parsing the XML structure in the layout description file and extracting all row and column nodes and their corresponding attributes, the layout information is transformed into an operable data structure. This enables the system to more clearly understand and process the layout of the report, laying a foundation for subsequent element management and report generation. After the data is structured, the system can more conveniently operate and manage row and column nodes, improving the efficiency and accuracy of data processing. When creating the initial element table, according to the first-level relationship and coordinate information of the row and column nodes, a unique element identifier is assigned to each cell. This ensures the uniqueness and identifiability of each report element in the entire report, avoiding confusion and duplication between elements. The assignment of unique element identifiers enables the system to accurately locate and manage each cell, improving the accuracy and reliability of report generation. By obtaining the CSS style sheet from the style sheet and parsing the style tags and associating them with the corresponding element identifiers, the tight combination of styles and report elements is achieved. This enables the styles of the report to be accurately applied to each element, ensuring the beauty and consistency of the report. The association between styles and elements enables the system to flexibly adjust and apply styles according to different report requirements, improving the customizability and adaptability of the report.

[0038] Optionally, the dynamically loading the subject tree and providing a visual formula builder for formula configuration to generate a formula table includes: Filter the first subject code and the second-level relationship associated with the current accounting set from the preset subject database according to the accounting set identifier in the core parameters to generate a dynamic subject tree; Render the subject tree in the visual formula builder and receive operation instructions from the user by dragging subject nodes, selecting debit / credit directions, and operators; Generate an abstract syntax tree according to the operation instructions, create an initial formula table, and bind and store the structure of the abstract syntax tree, the associated first subject code, and the corresponding element identifier in the initial formula table to generate a formula table.

[0039] Obtain the accounting set identifier in the core parameters, and then filter out the first subject code and the second-level relationship associated with the current accounting set from the preset subject database according to this accounting set identifier. This process is similar to setting and obtaining corresponding subject information according to different accounting sets in an enterprise ERP system to ensure that the subject tree matches the current accounting set. For example, when creating a new accounting set, accounting subjects need to be set, and this subject information will be stored in the database for use when generating reports. Based on the subject codes and hierarchical relationships obtained through the above filtering, the system generates a dynamic subject tree. The dynamic tree component supports asynchronous data loading and can dynamically obtain data during user interaction as needed, avoiding problems such as page freezing or excessive loading time caused by loading a large amount of data at one time. For example, in the dynamic tree component of Layui, data can be dynamically loaded according to user needs to improve the system's response speed and user experience. In the visual formula builder, the system renders the generated subject tree above. This enables users to intuitively view the structure and content of the subject tree, facilitating subsequent operations. For example, in the JTree component of Java, the display style of nodes can be customized by setting the properties and renderers of the tree to improve the friendliness of the user interface. The system receives operation instructions from the user by dragging subject nodes, selecting debit / credit directions, and operators. This interaction method is similar to that in financial software where users can process and analyze financial data by dragging subjects. For example, in the NetSuite general ledger model, users can enter and query financial data by selecting subjects and debit / credit directions. According to the user's operation instructions, the system generates an abstract syntax tree. An abstract syntax tree is a tree-shaped data structure used to represent the structure of program source code, which can transform the user's operation instructions into an executable code structure. For example, in Python, the ast module can be used to parse and generate an abstract syntax tree. The system creates an initial formula table and binds and stores the structure of the abstract syntax tree, the associated first subject code, and the corresponding element identifier in the initial formula table to generate a formula table. This process is similar to storing and managing financial data in a database to ensure the accuracy and integrity of the data. For example, in a bank general ledger system, subject and accounting set information will be stored in the database for subsequent query and analysis.

[0040] According to the account set identifier in the core parameters, filter out the first subject code and the second-level relationship associated with the current account set from the preset subject database to generate a dynamic subject tree. This ensures the accuracy and relevance of the subject data, avoids the interference of irrelevant subjects, and improves the configuration efficiency and accuracy of the report formula. Render the subject tree in the visual formula builder, and users can configure the formula through operation instructions such as dragging subject nodes, selecting debit / credit directions, and operators. This intuitive operation method reduces the difficulty of formula configuration, improves the user experience, and enables non-technical personnel to easily configure complex report formulas. Generate an abstract syntax tree according to the operation instructions, create an initial formula table, and bind and store the structure of the abstract syntax tree, the associated first subject code, and the corresponding element identifier in the initial formula table to generate a formula table. The use of the abstract syntax tree makes the formula structure clearer, facilitates subsequent formula parsing and calculation, and improves the efficiency and accuracy of report generation. By binding and storing the structure of the abstract syntax tree, the associated subject code, and the corresponding element identifier, it is convenient to manage formula versions. This enables the rapid generation of a new formula table when the report formula needs to be adjusted without modifying the code, ensuring the real-time performance and flexibility of the report.

[0041] Optionally, the generating the abstract syntax tree according to the operation instructions includes: Parse the second subject code, operator, and direction marker in the operation instructions to construct an initial syntax tree node; Perform a legality check on the initial syntax tree node according to the preset verification rules, and the legality check includes subject existence verification, debit / credit direction conflict detection, and circular reference interception; Rearrange the verified initial syntax tree nodes according to the operator precedence to generate an abstract syntax tree, and attach metadata to the abstract syntax tree, where the metadata includes the dependent account set identifier, report period, and calculation precision parameter.

[0042] The operation instructions include the subject nodes, debit / credit directions, and operators selected by the user. For example, the user may select subject A and subject B and specify an addition operator. The system first parses these instructions to extract key information such as the subject code (second subject code), operator type (such as addition, subtraction, multiplication, division), and direction marker (debit / credit direction). Suppose the user selects the credit occurrence amount of subject A (coded as 1001) and the debit occurrence amount of subject B (coded as 1002) and selects the addition operator, then the operation instructions will be parsed as: Second subject code: 1001 (subject A) and 1002 (subject B); Operator: addition (+); Direction marker: credit of subject A and debit of subject B.

[0043] The initial syntax tree nodes are the basic components of the abstract syntax tree. Each node represents an operation or a data item. The system constructs the initial syntax tree nodes according to the parsed operation instructions. For example: Create a node representing the credit amount of subject A, which contains the subject code 1001 and the direction flag "credit". Create another node representing the debit amount of subject B, which contains the subject code 1002 and the direction flag "debit". Create an operator node representing the addition operation, which takes the above two subject nodes as child nodes. After constructing the initial syntax tree nodes, the system performs a legality check according to the preset verification rules to ensure the correctness and validity of the formula. Check whether the selected subjects exist in the subject database of the current accounting set. For example, verify whether the subject codes 1001 and 1002 are valid subjects, that is, whether they are defined and associated with the current accounting set. Ensure that the selected debit and credit directions conform to accounting standards and business logic. For example, in some business scenarios, certain subjects may only appear on the debit or credit side, and the system needs to detect whether there are conflicts. Prevent circular references in the formula, that is, avoid a cell's value depending on its own value. For example, if the formula attempts to calculate a cell's value as another cell's value, and the latter depends on the former, a circular reference error will occur. After passing the legality check, the system rearranges the verified initial syntax tree nodes according to the operator precedence to generate the abstract syntax tree. For example, if there are multiple operators in the formula, the system will rearrange the nodes according to the precedence (such as multiplication and division taking precedence over addition and subtraction). Determine the operator precedence order. For example, the precedence of addition and subtraction is lower than that of multiplication and division. Rearrange the initial syntax tree nodes so that the operators are arranged in the order of precedence. For example, if there is a formula containing multiplication and addition, the system will process the multiplication operation first and then the addition operation. Construct the final abstract syntax tree, where each node is arranged in the correct order of operations. Finally, the system attaches metadata to the abstract syntax tree, and these metadata include the dependent accounting set identifier, reporting period, and calculation precision parameters. Dependent accounting set identifier: Identifies the accounting set on which the formula depends to ensure that the correct accounting set data is used during calculation. Reporting period: Specifies the time range covered by the report, such as month, quarter, or year, to ensure the timeliness of the data. Calculation precision parameters: Define precision requirements such as the number of decimal places of the calculation result to meet the data precision requirements in different business scenarios. For example, it can be set to retain two decimal places for the calculation result.

[0044] The system can accurately parse various elements in the operation instructions input by the user during the formula configuration process, such as subject codes, operators, and debit / credit direction markers, and precisely construct the initial syntax tree nodes. This provides accurate basic data for subsequent formula verification and calculation, ensuring the accuracy of formula configuration. Just like in a factory production line, accurately measuring the composition and proportion of raw materials provides an accurate basis for subsequent processing and manufacturing. The preset verification rules perform legality detection on the initial syntax tree nodes, covering multiple aspects such as subject existence verification, debit / credit direction conflict detection, and circular reference interception. For example, subject existence verification is like checking whether the commodity inventory is sufficient before shipping, ensuring that the accounting subjects used are real and avoiding errors in statement data caused by using non-existent subjects. This strict verification mechanism is like a solid defense line, blocking illegal formula configurations and ensuring the accuracy and reliability of statement data. Rearranging the verified initial syntax tree nodes according to the operator precedence, the generated abstract syntax tree can clearly express the calculation logic of the formula, improving the readability and maintainability of the formula.

[0045] Optionally, the generating the report according to the row-column structure obtained from the element table, the calculation logic loaded from the formula table, and the layout description obtained from the style table according to the target identifier includes: Obtaining the target layout description file and the CSS style sheet path from the style table according to the target identifier, and parsing the row-column structure and style markers; Traversing each element identifier in the element table, and querying the debit / credit data in the subject balance table in real time according to the structure of the abstract syntax tree bound in the formula table and the third subject code; Substituting the query result into the formula of the abstract syntax tree for calculation, generating cell values, and filling the cell values to the corresponding coordinates according to the row-column position relationship in the target layout description file; Obtaining the CSS style sheet according to the CSS style sheet path, and rendering the filled data combined with the CSS style sheet into the report.

[0046] According to the incoming target identifier, obtain the target layout description file corresponding to the target identifier and the CSS style sheet path from the style sheet. The target layout description file contains information such as the row and column structure and style tags of the report, and the CSS style sheet path points to the CSS file used to define the report style. By obtaining the layout description file and the CSS style sheet path, the system can understand the overall layout structure and style requirements of the report, providing guidance on layout and style for subsequent report generation. Parse the obtained target layout description file to extract the row and column structure information and style tags. The row and column structure information clarifies the arrangement method, quantity, etc. of rows and columns in the report, and the style tags define the style characteristics of each element in the report, such as font, color, border, etc. Parsing the row and column structure and style tags is to accurately place data and present the report content according to the predetermined layout and style requirements when generating the report, ensuring that the format and appearance of the report meet expectations. The system traverses each element identifier in the element table. For each element identifier, query the debit and credit data in the subject balance table in real time according to the abstract syntax tree structure and the third subject code bound to the element identifier in the formula table. Here, the third subject code is the subject code associated with the formula configuration, used to determine the specific subject when querying the subject balance table. By traversing the element table and querying the corresponding subject balance data, the system can obtain the data required for each cell in the report, providing a basis for subsequent report data filling. Querying the subject balance table in real time ensures the timeliness and accuracy of the data, enabling the report to reflect the latest financial data situation. Substitute the queried subject balance data into the formula represented by the abstract syntax tree for calculation to generate the corresponding cell value. Then, according to the row and column position relationship in the target layout description file, fill the calculated cell value into the corresponding coordinate position in the report. For example, if the target layout description file specifies that a certain cell is located in the 3rd row and 5th column, then the system will fill the calculated cell value into the corresponding position in the report. By calculating the cell value and filling it according to the row and column position relationship in the layout description file, the system can generate the complete report data content and ensure that the data is accurately positioned in the report, meeting the layout requirements of the report. The system obtains the corresponding CSS style sheet according to the CSS style sheet path obtained previously. Then, combine the CSS style sheet with the report content that has been filled with data to perform report rendering. During the rendering process, the system will perform style settings on each element in the report according to the style definitions in the CSS style sheet, such as setting font styles, colors, borders, backgrounds, etc., and finally generate a report with complete content and beautiful style. Obtaining the CSS style sheet and performing report rendering is to make the report have a good visual effect and professionalism when presented, meet the user's requirements for the report appearance, and improve the readability and usability of the report.

[0047] Accurately obtain the target layout description file and CSS style sheet path through the target identifier, parse the row and column structure and style tags therein, which provides clear structure and style guidance for report generation, ensuring that the layout and appearance of the report meet expectations. Traverse each element identifier in the element table, and query the debit and credit data in the subject balance table in real time according to the abstract syntax tree structure and subject code in the formula table. This on-demand query method avoids full table scanning, improves the efficiency of data query, and ensures the timeliness and accuracy of report data. Substitute the queried data into the formula of the abstract syntax tree for calculation to generate cell values, and fill the values into the corresponding coordinates according to the row and column position relationship in the target layout description file. This process ensures the accurate calculation and correct layout of report data, avoiding data misalignment or calculation errors, and enabling the report to clearly and accurately display data information.

[0048] Optionally, the method further includes: Parse the structure of the abstract syntax tree in the formula table, and extract all dependent fourth subject codes and calculation logics; Reverse query the subject balance table according to the fourth subject code to obtain the original voucher number, amount and business date, and generate a list of original data sources; Attach a data traceability identifier to each cell in the report, and display a visual traceability path diagram when clicked. The path diagram includes the subject calculation link and associated voucher details; Mark abnormal data nodes in the traceability path diagram and provide a jump link to the original voucher.

[0049] By parsing the Abstract Syntax Tree (AST) structure in the formula table, all the fourth subject codes and corresponding calculation logics relied on during the report generation process can be accurately extracted. This process is similar to syntax analysis of code. By analyzing the nodes and branches of the AST, the system can clearly understand the subjects involved in each formula and the arithmetic relationships between them. For example, if a formula is "Credit amount of subject A + Debit amount of subject B", the system can extract the codes of subject A and subject B, as well as the addition operation logic by parsing the AST. This extraction process ensures that the system accurately obtains all the subject information related to report calculation, providing accurate basic data for subsequent data query and calculation. After extracting the fourth subject codes, the system will perform a reverse query on the subject balance table. The subject balance table records information such as the debit and credit amounts, balances, etc. of each subject in different periods, as well as the corresponding original voucher numbers and business dates. Through the reverse query, the system can obtain the original voucher information corresponding to each cell data in the report, including voucher numbers, amounts, and business dates. This information is organized into a list of original data sources, providing detailed data support for data traceability of the report. For example, if a cell data in the report is calculated based on the credit amount of subject A, the system can, through reverse query of the subject balance table, find the original voucher number, amount, and business date corresponding to this credit amount and record this information in the list of original data sources. The system attaches a data traceability identifier to each cell in the report. When the user clicks on a cell, the system will display a visual traceability path diagram. This path diagram graphically presents the entire data calculation link from the original voucher to the report cell, including the calculation relationships between subjects and the details of associated vouchers. For example, if a cell data in the report is calculated through the calculation of subject A and subject B, the traceability path diagram will show the arithmetic relationship between subject A and subject B, as well as the original voucher information related to these subjects. This visual traceability path diagram can help users intuitively understand the source and calculation process of report data, improving the transparency and credibility of report data. The system marks the abnormal data nodes in the traceability path diagram. These abnormal data nodes may be caused by data errors, calculation anomalies, etc. Users can quickly locate the abnormal data nodes by viewing the marks in the traceability path diagram and understand the source and scope of influence of the abnormal data. At the same time, the system also provides a jump link to the original voucher. Users can click on the link to directly jump to the corresponding original voucher and view the detailed information of the original voucher. This function can help users quickly troubleshoot and resolve data anomaly problems, ensuring the accuracy and reliability of report data.

[0050] By parsing the abstract syntax tree structure in the formula sheet and extracting all the dependent fourth subject codes and calculation logics, the data sources and calculation rules required for report generation can be accurately obtained. This ensures the accuracy and integrity of the report data and provides clear guidance for subsequent data query and calculation. By querying the subject balance sheet in reverse according to the fourth subject code, the original voucher number, amount, and business date are obtained, and a list of original data sources is generated. This process realizes data traceability, enabling each data point in the report to be traced back to its original source, facilitating data verification and anomaly troubleshooting. Attach a data traceability identifier to each cell in the report, and when clicked, display a visual traceability path diagram that includes the subject calculation link and associated voucher details. This visual display method enables users to intuitively understand the data sources and calculation processes, improving the transparency and credibility of the report. Mark the abnormal data nodes in the traceability path diagram and provide a jump link to the original voucher. This enables users to quickly locate and process abnormal data, improving the efficiency and accuracy of data processing. By directly jumping to the original voucher, users can quickly verify and correct the data to ensure the accuracy of the report.

[0051] In the embodiment of the present application, when the ID of the front-end transmitted report template is received, the back-end starts to render the data of this report. First, query the report element table to query the rows and columns that need to be rendered for this report, and then loop through them one by one according to the row order. For example, if the data in the first row and first column needs to be rendered, the formula for querying the first row and first column is the credit amount of subject A + the debit amount of subject B. Loop through and query the total sum of all credit amounts of subject A in the current accounting period in the subject balance sheet, and query the total sum of all debit amounts of subject B in the current accounting period in the subject balance sheet, and so on. The data rendering of this system is real-time. The advantage of doing this is that as long as the basic data remains unchanged and the formula configuration changes, there is no need to modify the code. The report results can be correctly displayed according to the modified formula configuration. Another advantage is that by querying the subject configuration of a certain row and a certain column, the data source can be known, enabling data traceability and facilitating later verification.

[0052] This embodiment also discloses a report generation system that supports multiple layouts and multiple templates. Figure 9 is a schematic diagram of the modules of the report generation system that supports multiple layouts and multiple templates disclosed in the embodiment of the present application, as Figure 9 shown. The system includes an identification module 901, a description module 902, a formula module 903, and an execution module 904, where: The identification module 901 is configured to create a report template table to determine the core parameters and extended parameters of the target template, and use the hash algorithm to create a unique identifier of the target template based on the core parameters, the extended parameters, and the timestamp; The description module 902 is configured to determine a layout code corresponding to the target template according to the identifier, select target layout components from a preset layout component library according to the layout code to generate a layout description file, and generate a style sheet mapped to the identifier according to the layout description file; The formula module 903 is configured to construct an element relationship network according to the row-column position relationship in the layout description file, record the row-column coordinates and style tags of each report element to generate an element table, dynamically load a subject tree, and provide a visual formula builder for formula configuration to generate a formula table; The execution module 904 is configured to, after receiving the target identifier, obtain the row-column structure from the element table according to the target identifier, load the calculation logic from the formula table, and obtain the layout description from the style sheet, and generate a report according to the row-column structure, the calculation logic, and the layout description.

[0053] Optionally, the description module 902 is configured to: Query a predefined layout rule library based on the identifier, and obtain the layout code associated with the report type in the core parameters; Match target layout components from a preset layout component library according to the layout code, and the preset layout component library includes XML structure definitions of a table header layout and a table footer layout; Generate the layout description file according to the target layout components, and the layout description file includes row-column position relationships and style placeholders; Map the layout description file to the identifier, generate a corresponding CSS style sheet path, and store it in the style sheet.

[0054] Optionally, the formula module 903 is configured to: Parse the XML structure in the layout description file, and extract all row and column nodes and corresponding attributes; Create an initial element table, create corresponding row records and column records in the initial element table according to the first-level relationship and coordinate information of the row and column nodes, and assign a unique element identifier to each cell; Obtain a CSS style sheet from the style sheet according to the style placeholder, parse the style tags and associate them with the corresponding element identifiers to generate an element table.

[0055] Optionally, the formula module 903 is configured to: Filter out the first subject code and the second-level relationship associated with the current account set from a preset subject database according to the account set identifier in the core parameters to generate a dynamic subject tree; Render the subject tree in a visual formula builder, and receive operation instructions from the user by dragging subject nodes, selecting debit / credit directions, and operators; An abstract syntax tree is generated according to the operation instruction, an initial public table is created, and the structure of the abstract syntax tree, the associated first subject code and the corresponding element identifier are bound and stored in the initial formula table to generate a formula table.

[0056] Optionally, the formula module 903 is configured to: Parsing the second subject code, operator and direction mark in the operation instruction to construct an initial syntax tree node; Performing a validity check on the initial syntax tree node according to preset verification rules, wherein the validity check includes subject existence check, debit and credit direction conflict check, and circular reference interception; The verified initial syntax tree nodes are rearranged according to operator priority to generate an abstract syntax tree, and metadata is added to the abstract syntax tree, the metadata including the dependent account set identifier, report period and calculation precision parameter.

[0057] Optionally, the execution module 904 is configured to: Obtaining a target layout description file and a CSS style sheet path from the style sheet according to the target identifier, and parsing row and column structures and style tags; Traversing each element identifier in the element table, querying the debit and credit data in the account balance table in real time according to the structure of the abstract syntax tree bound to the formula table and the third account code; Substituting the query result into the formula of the abstract syntax tree for calculation, generating a cell value, and filling the cell value into the corresponding coordinate according to the row and column position relationship in the target layout description file; The CSS style sheet is obtained according to the CSS style sheet path, and the CSS style sheet is combined with the filled data and rendered into the report.

[0058] Optionally, the system further includes a traceability module configured to: Parsing the structure of the abstract syntax tree in the formula table, extracting all dependent fourth subject codes and calculation logics; Reversely query the account balance table according to the fourth account code, obtain the original voucher number, amount and transaction date, and generate a list of original data sources; A data traceability mark is added to each cell in the report, and a visual traceability path diagram is displayed when clicked, wherein the path diagram includes the account calculation link and the details of the associated vouchers; Mark abnormal data nodes in the traceability path diagram and provide original voucher jump links.

[0059] It should be noted that: when the device provided in the above embodiment realizes its functions, only the division of the above functional modules is used for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept. For the specific implementation process, please refer to the method embodiment, which will not be elaborated here.

[0060] This embodiment also discloses an electronic device. Referring to Figure 10 , the electronic device may include: at least one processor 1001, at least one communication bus 1002, a user interface 1003, a network interface 1004, and at least one memory 1005.

[0061] Among them, the communication bus 1002 is used to realize the connection and communication between these components.

[0062] Among them, the user interface 1003 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface.

[0063] Among them, the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

[0064] Among them, the processor 1001 may include one or more processing cores. The processor 1001 connects various parts within the entire server through various interfaces and lines, and executes various functions of the server and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling the data stored in the memory 1005. Optionally, the processor 1001 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 1001 may integrate one or a combination of several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above modem may not be integrated into the processor 1001 and may be implemented separately by a single chip.

[0065] Among them, the memory 1005 may include a Random Access Memory (RAM), or may include a Read-Only Memory. Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a program storage area and a data storage area. Among them, the program storage area can store instructions for implementing the operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above method embodiments, etc.; the data storage area can store the data involved in the above method embodiments. Optionally, the memory 1005 may also be at least one storage device located far from the aforementioned processor 1001. As Figure 10 shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program that supports the report generation method with multiple layouts and multiple templates.

[0066] In Figure 10 the electronic device shown, the user interface 1003 is mainly used to provide an input interface for the user to obtain the data input by the user; and the processor 1001 can be used to call the application program stored in the memory 1005 that supports the report generation method with multiple layouts and multiple templates. When executed by one or more processors 1001, the electronic device executes the method in one or more of the above embodiments.

[0067] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0068] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0069] In several embodiments provided by the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some service interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.

[0070] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0071] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0072] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory 1005 and includes several instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. And the aforementioned memory 1005 includes: various media such as USB flash drives, mobile hard disks, magnetic disks or optical discs that can store program codes.

[0073] The above are only exemplary embodiments of the present disclosure and should not be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure still fall within the scope covered by the present disclosure. Those skilled in the art will easily think of other implementation schemes of the present disclosure after considering the disclosure of the specification. The present application aims to cover any variations, uses or adaptive changes of the present disclosure, and these variations, uses or adaptive changes follow the general principles of the present disclosure and include the common general knowledge or conventional technical means in the technical field not recorded in the present disclosure. The specification and the embodiments are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A report generation method supporting multiple layouts and multiple templates, characterized in that, Applied to a report generation platform, the method includes: Create a report template table to determine the core parameters and extended parameters of the target template, and use the hash algorithm to create a unique identifier of the target template based on the core parameters, the extended parameters, and the timestamp; Determine the layout code corresponding to the target template according to the identifier, select target layout components from a preset layout component library according to the layout code to generate a layout description file, and generate a style sheet having a mapping relationship with the identifier according to the layout description file; Construct an element relationship network according to the row and column position relationships in the layout description file to record the row and column coordinates and style tags of each report element to generate an element table, dynamically load a subject tree, and provide a visual formula builder for formula configuration to generate a formula table; After receiving the target identifier, obtain the row and column structure from the element table according to the target identifier, load the calculation logic from the formula table, and obtain the layout description from the style sheet, and generate a report according to the row and column structure, the calculation logic, and the layout description.

2. The report generation method supporting multiple layouts and multiple templates according to claim 1, characterized in that, The determining the layout code corresponding to the target template according to the identifier, selecting target layout components from a preset layout component library according to the layout code to generate a layout description file, and generating a style sheet mapped with the identifier according to the layout description file includes: Query a predefined layout rule library based on the identifier to obtain the layout code associated with the report type in the core parameters; Match target layout components from a preset layout component library according to the layout code, and the preset layout component library includes XML structure definitions of a table header layout and a table footer layout; Generate the layout description file according to the target layout components, and the layout description file includes row and column position relationships and style placeholders; Map the layout description file with the identifier to generate a corresponding CSS style sheet path, and store it in the style sheet.

3. The report generation method supporting multiple layouts and multiple templates according to claim 2, characterized in that, The constructing an element relationship network according to the row and column position relationships in the layout description file to record the row and column coordinates and style tags of each report element to generate an element table includes: Parse the XML structure in the layout description file, and extract all row and column nodes and corresponding attributes; Create an initial element table, and create corresponding row records and column records in the initial element table according to the first-level relationship and coordinate information of the row and column nodes, and assign a unique element identifier to each cell; Obtain a CSS style sheet from the style sheet according to the style placeholder, parse the style tags and associate them with the corresponding element identifiers to generate an element table.

4. The report generation method supporting multiple layouts and multiple templates according to claim 1, characterized in that The dynamically loading a subject tree and providing a visual formula builder for formula configuration to generate a formula table includes: Filter out the first subject code and the second-level relationship associated with the current account set from a preset subject database according to the account set identifier in the core parameters to generate a dynamic subject tree; Render the subject tree in a visual formula builder, and receive operation instructions from the user by dragging subject nodes, selecting debit / credit directions, and operators; Generate an abstract syntax tree according to the operation instruction, create an initial formula table, and bind and store the structure of the abstract syntax tree, the associated first subject code, and the corresponding element identifier in the initial formula table to generate a formula table.

5. The report generation method supporting multiple layouts and multiple templates according to claim 4, characterized in that The generating an abstract syntax tree according to the operation instruction includes: Parse the second subject code, operator, and direction flag in the operation instruction to construct an initial syntax tree node; Perform a legality check on the initial syntax tree node according to a preset verification rule, and the legality check includes subject existence verification, debit-credit direction conflict detection, and circular reference interception; Rearrange the verified initial syntax tree nodes according to the operator precedence to generate an abstract syntax tree, and attach metadata to the abstract syntax tree, where the metadata includes the dependent account set identifier, report period, and calculation precision parameter.

6. The report generation method supporting multiple layouts and multiple templates according to claim 4, characterized in that The generating a report according to the row-column structure obtained from the element table according to the target identifier, loading the calculation logic from the formula table, and obtaining the layout description from the style table, according to the row-column structure, the calculation logic, and the layout description includes: Obtain a target layout description file and a CSS style sheet path from the style table according to the target identifier, and parse the row-column structure and style flag; Traverse each element identifier in the element table, and query the debit-credit data in the subject balance table in real time according to the structure of the abstract syntax tree and the third subject code bound in the formula table; Substitute the query result into the formula of the abstract syntax tree for calculation to generate a cell value, and fill the cell value to the corresponding coordinates according to the row-column position relationship in the target layout description file; Obtain a CSS style sheet according to the CSS style sheet path, and combine the CSS style sheet with the filled data to render the report.

7. The report generation method supporting multiple layouts and multiple templates according to claim 1, characterized in that, The method further includes: Parse the structure of the abstract syntax tree in the formula table, and extract all dependent fourth subject codes and calculation logics; Reverse query the subject balance table according to the fourth subject code to obtain the original voucher number, amount, and business date, and generate a list of original data sources; Attach a data traceability identifier to each cell in the report, and display a visual traceability path diagram when clicked, where the path diagram includes a subject calculation link and associated voucher details; Mark abnormal data nodes in the traceability path diagram, and provide a jump link to the original voucher.

8. A report generation system supporting multiple layouts and multiple templates, characterized in that, Includes an identification module, a description module, a formula module, and an execution module, where: The identification module is configured to create a report template table to determine the core parameters and extension parameters of the target template, and use a hash algorithm to create a unique identifier of the target template based on the core parameters, the extension parameters, and the timestamp; The description module is configured to determine a layout code corresponding to the target template according to the identifier, select a target layout component from a preset layout component library according to the layout code to generate a layout description file, and generate a style sheet mapped to the identifier according to the layout description file; A formula module, configured to construct an element relationship network according to the row-column position relationship in the layout description file, record the row-column coordinates and style tags of each report element to generate an element table, dynamically load a subject tree, and provide a visual formula builder for formula configuration to generate a formula table; An execution module, configured to, after receiving a target identifier, obtain a row-column structure from the element table according to the target identifier, load calculation logic from the formula table, and obtain a layout description from the style table, and generate a report according to the row-column structure, the calculation logic, and the layout description.

9. An electronic device, characterized in that, It includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions. Both the user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory, so that the electronic device executes the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1-7 is executed.

Citation Information

Patent Citations

  • Analytical report generation method, device and system and storage medium

    CN117009417A

  • Method, system and program for joining source table rows with target table rows

    US20060224551A1

Cited By

  • Visual report design method and system

    CN120850970A

  • Automatic auditing system and method for difference between final settlement and payment tax of enterprise income tax

    CN122023050A

  • A system and method for automatically auditing differences in corporate income tax settlement and final tax meeting

    CN122023050B