using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorUi;
namespace Billing
{
public class Customizer : MercatorUi.ICustomizers.IBillingEngineCreated, MercatorUi.ICustomizers.IBillingEngineClosed
{
public void BillingEngineCreated(MercatorUi.Engine.Gescom.BillingEngine BillingEngine)
{
BillingEngine.AfterInsertItem += new MercatorUi.Engine.Gescom.BillingEngine.AfterInsertItemEventHandler(BillingEngine_AfterInsertItem);
}
public void BillingEngineClosed(MercatorUi.Engine.Gescom.BillingEngine BillingEngine)
{
BillingEngine.AfterInsertItem -= new MercatorUi.Engine.Gescom.BillingEngine.AfterInsertItemEventHandler(BillingEngine_AfterInsertItem);
}
void BillingEngine_AfterInsertItem(object sender, MercatorUi.Engine.Gescom.BillingEngine.AfterInsertItemEventArgs e)
{
DataSet ds = Api.Zselect(MercatorUi.Globals.RepData, "select fou.f_id,fou.f_nom from ARTFOU inner join FOU on (artfou.id_fou=fou.f_id) where (id_art=@s_id) and (principal=1)", new MercatorSqlParam("@s_id", e.StockRecord.S_ID, SqlDbType.Char));
if ((ds != null) && (ds.Tables[0].Rows.Count > 0))
{
e.LignesVRecord.ID_FOU_COM = ds.Tables[0].Rows[0]["f_id"].ToString().TrimEnd();
e.DataRowLignes["NOM_FOU_COM"] = ds.Tables[0].Rows[0]["f_nom"].ToString().TrimEnd();
}
}
}
}