Vous consultez une page technique concernant le logiciel de gestion Mercator. Celle-ci contient des informations spécifiques destinées aux professionnels de Mercator. Souhaitez-vous être redirigés vers des informations plus générales ?


   Ne plus poser cette question

Ajout de la date d'échéance dans le grand-livre de la fiche clients (version Aruba)

0000002319     -      24/04/2017

Cette programmation permet d'ajouter la date d'échéance sur l'onglet "Grand-livre" du signalétique clients. Ce développement est basé sur un customizer SigCli qui implémente ces interfaces :

Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;

namespace SigCli
{
    public class Customizer : MercatorUi.ICustomizers.IStringUpdater, MercatorUi.ICustomizers.IFormLoadCustomizer,
        MercatorUi.ICustomizers.IFormClosedCustomizer
    {
        
        public string StringUpdate(string StringToModify)
        {
            string id = Api.StrExtract(StringToModify, "<ID>", "</ID>");
                        
            if(id == "LEDGER_CLI")
                return StringToModify.Replace("lignes_c.date,", "lignes_c.date,lignes_c.echeance,").Replace(",date,", ",date,echeance,").Replace("convert(datetime, '2999-12-31 0:0:0.0', 121),", "convert(datetime, '2999-12-31 0:0:0.0', 121),convert(datetime, '2999-12-31 0:0:0.0', 121),");
            else
                return StringToModify;
        }

        public void FormLoadCustomize(System.Windows.Forms.Form WindowsForm)
        {
            MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm) WindowsForm;
            List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Ledger));
            if (l.Count > 0)
            {
                MercatorUi.Forms.Sig.SigGrids.Ledger ledger = (MercatorUi.Forms.Sig.SigGrids.Ledger) l[0];
                ledger.AfterColumnsCreated += new MercatorUi.Forms.Sig.SigGrids.Ledger.AfterColumnsCreatedHandler(Ledger_AfterColumnsCreated);
            }
        }

        public void FormClosedCustomize(System.Windows.Forms.Form WindowsForm)
        {
            MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm) WindowsForm;
            List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Ledger));
            if (l.Count > 0)
            {
                MercatorUi.Forms.Sig.SigGrids.Ledger ledger = (MercatorUi.Forms.Sig.SigGrids.Ledger) l[0];
                ledger.AfterColumnsCreated -= new MercatorUi.Forms.Sig.SigGrids.Ledger.AfterColumnsCreatedHandler(Ledger_AfterColumnsCreated);
            }
        }
        
        private void Ledger_AfterColumnsCreated(object sender, EventArgs e)
        {
            MercatorUi.Forms.Sig.SigGrids.Ledger ledger = (MercatorUi.Forms.Sig.SigGrids.Ledger) sender;
            ledger.Grid.Columns.Add("echeance", "Echéance");
            ledger.Grid.Columns["echeance"].Width = 68;
            ledger.Grid.Columns["echeance"].DataPropertyName = "echeance";
            ledger.Grid.Columns["echeance"].DefaultCellStyle.Format = Api.Iif(MercatorUi.Globals.DateMDY, "MM/dd/yyyy", "dd/MM/yyyy");     
        }
    }
}