Reports |
|
Customizing Reports These models are:
Word Reports There are two ways to customize editions Word (gpmi_xxx.doc). General presentation (colors, logos, font size, etc ...) Content (information given) Overview Open the Word document, for example gpmi_cde.doc:
You can also change in every cell of the tables: * Font, * Color, * The size of the cell (width, height), * The border. Tip: To make the contents of a cell, set the font color to white, so the area will be printed in white on a white background and is invisible. At this stage, do not change: * The order of tables * The number of rows or the number of columns in each table. Content To change the contents of the edition is a bit more complicated, but possible. Indeed, the program source code editing in the model document. It is written in VBA (Visual Basic for Applications), ie Word or Excel macros. With a little knowledge of VBA, you can easily adapt these editions to your needs.Access the code by editing the Tools menu (or Tools) / Macro / Visual Basic Editor or by pressing Alt F11:
The VBA window is displayed:
The source code is organized into 2 modules: * Accès_base * Edition Accès_base module is purely technical. It allows access to tables GPMI. You do not, in principle, to intervene. It is the same for all models of documents GPMI. Edit the module contains the code specific to the edition. Depending on the models, it can contain several macros. The one you want is ... Edition: Sub edition (basic nomlog, num_cde) Do not change the parameters of this subroutine! GPMI can no longer run. Editing is done in a simple way, by filling the cells of the tables in document: ActiveDocument.Tables (1). Cell (1, 2). Range.Text is the first table of the document and the text of the cell in the row 1, column 2. It assigns a value as follows: ActiveDocument.Tables (1). Cell (1, 2). Range.Text = "No" & num_cde The character "&" is the concatenation of strings, here it adds, "No" to the order number, passed as a parameter to publishing. Each table of the database GPMI corresponds to a particular structure. The header of customer order, for example, is the EnteteCdeCli table and corresponds to the structure cce. Accès_base module in the macro Sub db_rechpos (nomfic $ nmoind), gives you the correspondence between the code of the structure and the table name GPMI: If nomfic $ = "cce" Then Set tb = db.OpenRecordset ( "EnteteCdeCli"): If nmoind = 1 Then tb.Index = "Cle_cce" Else If nmoind = 2 Then tb.Index = "Cle_cce1" Else If nmoind = 3 Then tb.Index = "Cle_cce2" Else tb.Index = "Cle_cce3" If nomfic $ = "EPC" Then Set tb = db.OpenRecordset ( "EnteteBL"): If nmoind = 1 Then tb.Index = "Cle_cbe" Else If nmoind = 2 Then tb.Index = "Cle_cbe1" Else If nmoind = 3 Then tb.Index = "Cle_cbe2" Else tb.Index = "Cle_cbe3" If nomfic $ = "cfe" Then Set tb = db.OpenRecordset ( "EnteteFact"): If nmoind = 1 Then tb.Index = "Cle_cfe" Else If nmoind = 2 Then tb.Index = "Cle_cfe1" Else If nmoind = 3 Then tb.Index = "Cle_cfe2" Else tb.Index = "Cle_cfe3" If nomfic $ = "ccl" Then Set tb = db.OpenRecordset ( "LigneCdeCli"): If nmoind = 1 Then tb.Index = "Cle_ccl" Else If nmoind = 2 Then tb.Index = "Cle_ccl1" Else If nmoind = 3 Then tb.Index = "Cle_ccl2" Else tb.Index = "Cle_ccl3" If nomfic $ = "cbl" Then Set tb = db.OpenRecordset ( "LigneBLCli"): If nmoind = 1 Then tb.Index = "Cle_cbl" Else If nmoind = 2 Then tb.Index = "Cle_cbl1" Else If nmoind = 3 Then tb.Index = "Cle_cbl2" Else tb.Index = "Cle_cbl3" If nomfic $ = "cfl" Then Set tb = db.OpenRecordset ( "LigneFactCli"): If nmoind = 1 Then tb.Index = "Cle_cfl" Else If nmoind = 2 Then tb.Index = "Cle_cfl1" Else If nmoind = 3 Then tb.Index = "Cle_cfl2" Else tb.Index = "Cle_cfl3" If nomfic $ = "mvt" Then Set tb = db.OpenRecordset ( "Changes"): If nmoind = 1 Then tb.Index = "Cle_mvt" Else If nmoind = 2 Then tb.Index = "Cle_mvt1" Else If nmoind = 3 Then tb.Index = "Cle_mvt2" Else tb.Index = "Cle_mvt3" nomfic $ = "cce">> Name of the structure db.OpenRecordset ( "EnteteCdeCli")>> table of the database GPMI Macro Sub db_rechlec (nomfic $), for example, will show the connection between the elements of the structure and the corresponding fields of the table: If nomfic $ = "cce" Then cce.nc tb = ( "nc") cce.cc1t tb = ( "cc1t") cce.a11 tb = ( "a11") cce.a21 tb = ( "a21") cce.cp1 tb = ( "CP1") cce.v1 tb = ( "v1") cce.reg1 tb = ( "reg1") cce.pays1 tb = ( "Country1") cce.i1 tb = ( "i1") cce.statut tb = ( "status") cce.n1 tb = ( "n1") cce.cc2t tb = ( "cc2t") cce.a12 tb = ( "a12") cce.a22 tb = ( "a22") cce.cp2 tb = ( "CP2") cce.v2 tb = ( "v2") etc ... cce.nc>> No command Field of the table tb ( "nc") In this case, the element of the structure (nc) is the same as the field in the table. This is not always true. In addition, the table fields themselves are not always immediately comprehensible. An Excel file gives you the clear meaning of these fields (Meaning of fields in the Base.xls). With all these items, you may be able to modify the macro yourself Edition. A simple way to suppress the publication of the data is to make his comment line by putting a simple symbol " '" before the line: 'ActiveDocument.Tables (3). Cell (line + 2, 6). Range.Text = ccl.ct This removes the display of the VAT code. The end of the macro saves the document produced: 'sauvegarge document in the path of the database: name = cde_ <num>. doc $ msg1 = base & "\ cde_" & Trim $ (num_cde) ActiveDocument.Protect Password :="", NoReset: = False, Type: = 2 ActiveDocument.SaveAs FileName: = $ msg1, FileFormat: = _ wdFormatDocument , LockComments: = False, Password :="", AddToRecentFiles: = True, _ WritePassword :="", ReadOnlyRecommended: = False, EmbedTrueTypeFonts: = False, _ SaveNativePictureFormat: = False, SaveFormsData: = False, SaveAsAOCELetter: = _ False The document is protected against modification. To remove this protection finally, put in the comments: ActiveDocument.Protect Password :="", NoReset: = False, Type: = 2 By adding a symbol to: 'Password :="", ActiveDocument.Protect NoReset: = False, Type: = 2 To save under another name, and / or in a different directory than the base, change the line: $ msg1 = base & "\ cde_" & Trim $ (num_cde) That gives the path and name of the document. You can change the path by putting, for example: $ msg1 = "C: \ my commands \ cde_" & Trim $ (num_cde) Excel Reports Open the Visual Basic Editor, as in Word. You will find: * The module Accès_base, * A module by family treatments: o Shopping o Workshops o Needs o Etc. * A module code_standard containing a macro code_std This macro is called by code_std all editions: it opens the database, executes a query, then puts the fields in the request in the tabeau Excel. You will find in the module Données_Techniques the macro: FamillesArt sub (base, query1, query2) Who will give you an example of customization in the publishing business. Sheets ( "Edit"). Cells (j, 5) refers to the sheet "Edit" for the cell line "j" and column 5. We hope this brief little help you will help a little. If this is not enough, do not hesitate to contact us: This e-mail address is being protected from spambots. You need JavaScript enabled to view it |
















