Een vooraf ingevuld verkoopdocument aanmaken in commercieel beheer (met BillingEngine)

0000002221     -      16-01-2025

Met onderstaande code kan een verkoopdocument worden gegenereerd in commercieel beheer. Bepaalde gegevens worden op voorhand ingevuld.

Deze module werkt samen met BillingEngine en kan vanop verschillende plaatsen in Mercator worden opgeroepen.

In het huidige voorbeeld gebeurt dit vanuit een informatiebestand.

Voor deze code is de optie ENGG vereist.

Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorExtensions;
using System.Windows.Forms;

// <CompileWithRoslyn />

namespace MercatorUi.MovableControls.ButtonsCodes
{
    public static class Script
    {
        public static void Exec(MovableButton clickedButton)
        {
            Forms.Sig.SigForm sigForm = (Forms.Sig.SigForm)clickedButton.Form;
            string journal = Dialogs.AskJournal("Quel type de document ?", _Dialogs.AskPieceEnum.V, 3, true, "")?.Journal;
            if (!string.IsNullOrEmpty(journal))
            {
                Engine.Gescom.BillingEngine billingEngine = Engine.Gescom.BillingEngine.InitNew(Engine.Gescom.Billing.TypeVAEnum.V, 3, journal);
                if (billingEngine.DataSet == null)
                {
                    Dialogs.Stop(billingEngine.LastError);
                    return;
                }
                billingEngine.ApplyCustomerSupplier(sigForm.CliRecord.C_IDCOMPTA);
                billingEngine.ApplyCliLiv(sigForm.CliRecord.C_ID);
                Forms.Billing.BillingForm billingForm = Globals.Main.ShowBillingNewInThread(billingEngine);
                billingForm.FullInitialized += BillingForm_fullInitialized;
            }
        }
        private static void BillingForm_fullInitialized(object sender, EventArgs e)
        {
            Forms.Billing.BillingForm billingForm = (Forms.Billing.BillingForm)sender;
            billingForm.FullInitialized -= BillingForm_fullInitialized;
            billingForm.LinesEditor?.Focus();
        }
    }
}


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)