Vanaf versie 10.10 is deze methode verouderd: deze pagina zien.
In elk vrij informatiebestandrooster kan men deze module plaatsen, waarmee men een kolom met een knop kan toevoegen. Met deze knop kan men verwijzen naar een verkoopdocument. De enige voorwaarde hiervoor is dat de SQL-opdracht gelinkt aan dit rooster minstens de kolommen TYPE, ID, JOURNAL en PIECE van LIGNES_V of PIEDS_V oplevert.
Het voorbeeld hieronder is gekoppeld met een rooster waarvan de query is :
select type,id,journal,piece from PIEDS_V where id_cli=@c_id order by date desc
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
namespace SigCli
{
public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer, MercatorUi.ICustomizers.IFormClosedCustomizer
{
private System.Drawing.Image imgZoom = MercatorUi._Divers.ImageFromResource("_catch");
public void FormLoadCustomize(Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
MercatorUi.Forms.Sig.SigGrids.UserDefined userDefinedGrid = (MercatorUi.Forms.Sig.SigGrids.UserDefined)sigForm.MovableControls["9739737CA0"];
userDefinedGrid.Grid.StandardColumnsCreated += new MercatorUi.GridPro.StandardColumnsCreatedHandler(userDefinedGrid_StandardColumnsCreated);
userDefinedGrid.Grid.CellSuperClick += new MercatorUi.GridPro.CellSuperClickHandler(GridBrouillons_CellSuperClick);
}
public void FormClosedCustomize(Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
MercatorUi.Forms.Sig.SigGrids.UserDefined userDefinedGrid = (MercatorUi.Forms.Sig.SigGrids.UserDefined)sigForm.MovableControls["9739737CA0"];
userDefinedGrid.Grid.StandardColumnsCreated -= new MercatorUi.GridPro.StandardColumnsCreatedHandler(userDefinedGrid_StandardColumnsCreated);
userDefinedGrid.Grid.CellSuperClick -= new MercatorUi.GridPro.CellSuperClickHandler(GridBrouillons_CellSuperClick);
}
void userDefinedGrid_StandardColumnsCreated(object sender, EventArgs e)
{
MercatorUi.GridPro.DataGridViewXPro grid = (MercatorUi.GridPro.DataGridViewXPro)sender;
grid.Columns[0].Visible = false; // masquer la colonne TYPE
grid.Columns[1].Visible = false; // masquer la colonne ID
grid.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; // colonne PIECE
((MercatorUi.GridPro.DataGridViewDoubleTextBoxColumn)grid.Columns[3]).DisplayFormat = "#########";
MercatorUi.GridPro.DataGridViewHidableButtonXColumn colButtonZoom = new MercatorUi.GridPro.DataGridViewHidableButtonXColumn();
colButtonZoom.Name = "zoom";
colButtonZoom.HeaderText = "";
colButtonZoom.Image = imgZoom;
colButtonZoom.Width = 34;
grid.Columns.Add(colButtonZoom);
}
void GridBrouillons_CellSuperClick(object sender, DataGridViewCellEventArgs e)
{
MercatorUi.GridPro.DataGridViewXPro grid = (MercatorUi.GridPro.DataGridViewXPro)sender;
MercatorUi.Forms.Sig.SigGrids.UserDefined userDefined = (MercatorUi.Forms.Sig.SigGrids.UserDefined)grid.Parent;
if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) && (grid.Columns[e.ColumnIndex].Name == "zoom"))
MercatorUi.Globals.Main.ShowBillingExisting("V", Convert.ToInt32(grid.Rows[e.RowIndex].Cells[0].Value), grid.Rows[e.RowIndex].Cells[1].Value.ToString(), grid.Rows[e.RowIndex].Cells[2].Value.ToString(), Convert.ToInt64(grid.Rows[e.RowIndex].Cells[3].Value));
}
}
}