Voeg een raster toe met de Intrastat gegevens in een document van het commercieel beheer!

0000002887     -      28-06-2019

Het voorbeeld hier laat zien hoe een extra kader moet worden afgedrukt met de Intrastat-gegevens van de artikelen in het document. Om dit te doen, gaan we 4 extra parameters toevoegen aan het rapport.

De code moet worden geplaatst in een Billing-customizer die is gemaakt op basis van de bijbehorende sequentie. Het implementeert de volgende interfaces:

Het maakt in feite gebruik van de PrintPrevPrepared-gebeurtenis van de BillingEngine uit het huidige document.

De code is als volgt:

Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorUi;
using System.Linq;
using MercatorExtensions;
using MercatorDatabase;


namespace Billing
{

    public class Customizer : MercatorUi.ICustomizers.IBillingEngineCreated,
        MercatorUi.ICustomizers.IBillingEngineClosed
    {
        public void BillingEngineCreated(MercatorUi.Engine.Gescom.BillingEngine billingEngine)
        {
            billingEngine.PrintPrevPrepared += BillingEngine_PrintPrevPrepared;
        }

        public void BillingEngineClosed(MercatorUi.Engine.Gescom.BillingEngine billingEngine)
        {
            billingEngine.PrintPrevPrepared -= BillingEngine_PrintPrevPrepared;
        }

        void BillingEngine_PrintPrevPrepared(object sender, MercatorUi.Engine.Gescom.BillingEngine.PrintPrevPreparedEventArgs e)
        {
            MercatorUi.Engine.Gescom.BillingEngine billingEngine = (MercatorUi.Engine.Gescom.BillingEngine)sender;
            if (billingEngine.CLI == null) // De klant is niet ingegeven
                return;

            // Voeg Intrastat gegevens toe
            string dossier = "";
            if (billingEngine.SEQUENC.Table.Columns.Contains("DOSSIER"))
                dossier = billingEngine.SEQUENC["DOSSIER"].ToString();

            string cliLangue = billingEngine.CliRecord.C_LANGUE;
            e.Parameters.Add("ISTAT_CODE", MercatorController.xFunctions.xSumIstat(MercatorController.xFunctions.SumIstatType.V, billingEngine.PIEDS, billingEngine.LIGNES, MercatorController.xFunctions.SumIstatInfo.CodeId, dossier)); // ajout d'un paramètre passé au générateur de rapports
            MercatorController.xFunctions.SumIstatInfo libLangue = MercatorController.xFunctions.SumIstatInfo.CodeLibF;
            switch (cliLangue)
            {
                case "N": libLangue = MercatorController.xFunctions.SumIstatInfo.CodeLibN; break;
                case "E": libLangue = MercatorController.xFunctions.SumIstatInfo.CodeLibE; break;
                case "D": libLangue = MercatorController.xFunctions.SumIstatInfo.CodeLibD; break;
                default: libLangue = MercatorController.xFunctions.SumIstatInfo.CodeLibF; break;
            }
            e.Parameters.Add("ISTAT_LIB", MercatorController.xFunctions.xSumIstat(MercatorController.xFunctions.SumIstatType.V, billingEngine.PIEDS, billingEngine.LIGNES, libLangue, dossier)); // ajout d'un paramètre passé au générateur de rapports
            e.Parameters.Add("ISTAT_VALEUR", MercatorController.xFunctions.xSumIstat(MercatorController.xFunctions.SumIstatType.V, billingEngine.PIEDS, billingEngine.LIGNES, MercatorController.xFunctions.SumIstatInfo.Value, dossier)); // ajout d'un paramètre passé au générateur de rapports
            e.Parameters.Add("ISTAT_POIDS", MercatorController.xFunctions.xSumIstat(MercatorController.xFunctions.SumIstatType.V, billingEngine.PIEDS, billingEngine.LIGNES, MercatorController.xFunctions.SumIstatInfo.Weight, dossier)); // ajout d'un paramètre passé au générateur de rapports
            e.Parameters.Add("ISTAT_Q", MercatorController.xFunctions.xSumIstat(MercatorController.xFunctions.SumIstatType.V, billingEngine.PIEDS, billingEngine.LIGNES, MercatorController.xFunctions.SumIstatInfo.Quantity, dossier)); // ajout d'un paramètre passé au générateur de rapports
        }
    }
}

Het bijgevoegde zipbestand bevat een verkooplayout die compatibel is met deze programmering.



Te laden : 0000002887.zip (38 Kb - 28-02-2023)