public static void Exec(MercatorUi.MovableControls.MovableButton clickedButton)
{
// enter your customized code here
MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)clickedButton.Form;
MercatorUi.Engine.Gescom.BillingEngine billingEngine = billingForm.BillingEngine;
if (billingEngine.ReadOnly) // si l'utilisateur n'a pas le droit de modifier ce document
return;
int index = Api.DataGridViewCurrentRowToDataTableRowIndex(billingForm.LinesEditor.Grid);
if (index < 0)
return;
if (!string.IsNullOrWhiteSpace(billingEngine.LignesVRecords[index].ID_ARTICLE))
{
billingEngine.LignesVRecords[index].DataRow[billingEngine.VarQ] = (double)billingEngine.LignesVRecords[index].DataRow[billingEngine.VarQ] * -1;
billingEngine.UpdateAmounts();
}
else
{
index = index - 1;
if (index < 0)
return;
if (!string.IsNullOrWhiteSpace(billingEngine.LignesVRecords[index].ID_ARTICLE))
{
billingEngine.LignesVRecords[index].DataRow[billingEngine.VarQ] = (double)billingEngine.LignesVRecords[index].DataRow[billingEngine.VarQ] * -1;
billingEngine.UpdateAmounts();
}
}
MercatorUi._Divers.SuperFocus(billingForm.LinesEditor);
}