U bevindt zich nu op een technische pagina over de software Mercator. Deze pagina bevat specifieke informatie die bestemd is voor professionals van de software Mercator. Wenst u naar algemenere informatie over Mercator door te gaan?


   Deze vraag niet meer stellen

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

0000002221     -      27-08-2017

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 (voor zover het de Aruba-versie betreft).

In het huidige voorbeeld gebeurt dit vanuit een informatiebestand.

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

namespace MercatorUi.MovableControls.ButtonsCodes
{
    public static class Script
    {

        public static void Exec(MercatorUi.MovableControls.MovableButton clickedButton)
        {
            MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)clickedButton.Form;
            string journal = Dialogs.AskJournal("Welk type document?", MercatorUi._Dialogs.AskPieceEnum.V, 3, true, "").Journal;
            if (!string.IsNullOrEmpty(journal))
            {
                MercatorUi.Engine.Gescom.BillingEngine billingEngine = MercatorUi.Engine.Gescom.BillingEngine.InitNew(MercatorUi.Engine.Gescom.Billing.TypeVAEnum.V, 3, journal);
                billingEngine.ApplyCustomerSupplier(sigForm.CliRecord.C_IDCOMPTA);
                billingEngine.ApplyCliLiv(sigForm.CliRecord.C_ID);
                MercatorUi.Forms.Billing.BillingForm billingForm = Globals.Main.ShowBillingNewInThread(billingEngine);
                billingForm.FullInitialized += billingForm_fullInitialized;
            }
        }
        private static void billingForm_fullInitialized(object sender, EventArgs e)
        {
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)sender;
            billingForm.FullInitialized -= billingForm_fullInitialized;
            List<Control> controls = billingForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Billing.BillingObjects.LinesEditor));
            if (controls.Count > 0)
            {
                MercatorUi.Forms.Billing.BillingObjects.LinesEditor ln = (MercatorUi.Forms.Billing.BillingObjects.LinesEditor)controls[0];
                ln.Focus();
            }
        }
    }
}