Voorbeeld 1: implementatie van middelenverbruik

0000002556     -      30-07-2025

Vanuit een 'Commercieel Beheer'-document wordt het middelenbeheer geactiveerd op artikelniveau. De verbruikshoeveelheid komt overeen met de hoeveelheid vermeld in het verkoopdocument. De kleur komt overeen met het documenttype. De omschrijving komt overeen met de naam van de klant.

Installatie van deze configuratie:

  • Installeer de trigger TR_LIGNESV_RESS_STOCK_DEL door de content van het bestand TR_LIGNESV_RESS_STOCK_DEL.sql te kopiëren op een SQL tabblad van de code editor (deze trigger kan worden verwijderd door uitvoering van het volgende commando: drop trigger TR_LIGNESV_RESS_STOCK_DEL).
     
  • Installeer de trigger TR_LIGNESV_RESS_STOCK_INS door de content van het bestand TR_LIGNESV_RESS_STOCK_INS.sql te kopiëren op het een SQL tabblad van de code editor (deze trigger kan worden verwijderd door uitvoering van het volgende commando: drop trigger TR_LIGNESV_RESS_STOCK_INS).
     
  • Plaats deze customizer in de betreffende sequentie(s):
Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorUi;
using System.Drawing;

namespace Billing
{
    public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer, MercatorUi.ICustomizers.IFormClosedCustomizer
    {
        public void FormLoadCustomize(System.Windows.Forms.Form form)
        {
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)form;
            LinesEditorGrid_DefineColumns(billingForm.LinesEditor.Grid);
            billingForm.LinesEditor.Grid.CellSuperClick += LinesEditorGrid_CellSuperClick;
        }
        public void FormClosedCustomize(System.Windows.Forms.Form form)
        {
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)form;
            billingForm.LinesEditor.Grid.CellSuperClick -= LinesEditorGrid_CellSuperClick;
        }

        private void LinesEditorGrid_DefineColumns(MercatorUi.GridPro.DataGridViewXPro grid)
        {
            MercatorUi.GridPro.DataGridViewHidableButtonXColumn btnRess = new MercatorUi.GridPro.DataGridViewHidableButtonXColumn();
            btnRess.Name = "btnRess";
            btnRess.Width = 30;
            btnRess.HeaderText = "";
            btnRess.Text = "Gantt";
            btnRess.ToolTipText = "Gantt";
            grid.Columns.Add(btnRess);
            grid.Columns["btnRess"].Width = 30;
        }

        private void LinesEditorGrid_CellSuperClick(object sender, DataGridViewCellEventArgs e)
        {
            MercatorUi.GridPro.DataGridViewXPro Grid = (MercatorUi.GridPro.DataGridViewXPro)sender;
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)Grid.FindForm();

            if ((e.RowIndex > -1) && (e.ColumnIndex > -1))
            {
                if (Grid.Columns[e.ColumnIndex].Name == "btnRess")
                {
                    MercatorUi.GridPro.DataGridViewHidableButtonXCell cellBtnRess = (MercatorUi.GridPro.DataGridViewHidableButtonXCell)Grid.Rows[e.RowIndex].Cells[e.ColumnIndex];

                    if (Grid.Rows[e.RowIndex].Cells["ID_ARTICLE"].Value.ToString() != "")
                    {
                        using (MercatorUi.Forms.Sig.SigDialogs.Ress.RessSelect ressSelect = new MercatorUi.Forms.Sig.SigDialogs.Ress.RessSelect(MercatorUi.Sig._SigEnum.STOCK, Grid.Rows[e.RowIndex].Cells["ID_ARTICLE"].Value.ToString(), (DateTime)billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT1"], (DateTime)billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT2"]))
                        {
                            ressSelect.ShowDialog(Globals.iw);
                            if (ressSelect.DialogResult == DialogResult.OK)
                            {
                                billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT1"] = ressSelect.ret_moment1;
                                billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT2"] = ressSelect.ret_moment2;
                                if (ressSelect.ret_id_sig != "" && ressSelect.ret_id_sig != Grid.Rows[e.RowIndex].Cells["ID_ARTICLE"].Value.ToString())
                                {
                                    double q = Convert.ToDouble(billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["q"]);
                                    billingForm.BillingEngine.InsertItem(ressSelect.ret_id_sig, billingForm.BillingEngine.LIGNES.Rows[e.RowIndex], q);
                                }
                            }
                        }

                    }
                }
            }
        }
    }

 



Te laden : 0000002556.zip (1 Kb - 09-10-2015)


Functionele cookies: Cookies die nodig zijn voor het gebruik van de website en voorkeurscookies. Ze bevatten geen persoonsgegevens. (Meer informatie)

Analytische cookies: Verzamelen van statistieken met betrekking tot het gedrag van internetgebruikers. (Meer informatie)

Marketingcookies: Om bezoekers op verschillende websites te volgen voor advertentiedoeleinden. (Meer informatie)