async void SetValuesFromMaster(Debtor debtor)
        {
            if (debtor == null)
            {
                return;
            }
            var loadedOrder = LoadedRow as DCOrder;

            if (loadedOrder?._DCAccount == debtor._Account)
            {
                return;
            }
            editrow.Account = debtor._Account;
            editrow.SetCurrency(debtor._Currency);
            editrow.Payment        = debtor._Payment;
            editrow.PricesInclVat  = debtor._PricesInclVat;
            editrow.EndDiscountPct = debtor._EndDiscountPct;
            editrow.PostingAccount = debtor._PostingAccount;
            editrow.LayoutGroup    = debtor._LayoutGroup;
            editrow.Shipment       = debtor._Shipment;
            editrow.Employee       = debtor._Employee;
            editrow.DeliveryTerm   = debtor._DeliveryTerm;
            if (!RecordLoadedFromTemplate || debtor._DeliveryAddress1 != null)
            {
                editrow.DeliveryName     = debtor._DeliveryName;
                editrow.DeliveryAddress1 = debtor._DeliveryAddress1;
                editrow.DeliveryAddress2 = debtor._DeliveryAddress2;
                editrow.DeliveryAddress3 = debtor._DeliveryAddress3;
                editrow.DeliveryZipCode  = debtor._DeliveryZipCode;
                editrow.DeliveryCity     = debtor._DeliveryCity;
                if (debtor._DeliveryCountry != 0)
                {
                    editrow.DeliveryCountry = debtor._DeliveryCountry;
                }
                else
                {
                    editrow.DeliveryCountry = null;
                }
            }
            TableField.SetUserFieldsFromRecord(debtor, editrow);
            if (ProjectCache != null)
            {
                Projectlookupeditor.cacheFilter = new DebtorProjectFilter(ProjectCache, debtor._Account);
                Projectlookupeditor.InvalidCache();
            }

            BindContact(debtor);
            if (installationCache != null)
            {
                leDeliveryAddress.cacheFilter = new AccountCacheFilter(installationCache, 1, debtor._Account);
                leDeliveryAddress.InvalidCache();
            }
            await api.Read(debtor);

            editrow.RefreshBalance();
        }
        async void SetValuesFromMaster(Debtor debtor)
        {
            if (debtor == null)
            {
                return;
            }
            var loadedOrder = LoadedRow as DCOrder;

            if (loadedOrder?._DCAccount == debtor._Account)
            {
                return;
            }
            if (this.Prospect == null) // no master
            {
                editrow.SetMaster(debtor);
                layoutItems.DataContext = null;
                layoutItems.DataContext = editrow;
            }
            else
            {
                editrow.Account = debtor._Account;
                editrow.SetCurrency(debtor._Currency);
            }
            editrow.PricesInclVat = debtor._PricesInclVat;
            if (!RecordLoadedFromTemplate || debtor._DeliveryAddress1 != null)
            {
                editrow.DeliveryName     = debtor._DeliveryName;
                editrow.DeliveryAddress1 = debtor._DeliveryAddress1;
                editrow.DeliveryAddress2 = debtor._DeliveryAddress2;
                editrow.DeliveryAddress3 = debtor._DeliveryAddress3;
                editrow.DeliveryCity     = debtor._DeliveryCity;
                if (editrow.DeliveryZipCode != debtor._DeliveryZipCode)
                {
                    lookupZipCode           = false;
                    editrow.DeliveryZipCode = debtor._DeliveryZipCode;
                }
                if (debtor._DeliveryCountry != 0)
                {
                    editrow.DeliveryCountry = debtor._DeliveryCountry;
                }
                else
                {
                    editrow.DeliveryCountry = null;
                }
            }



            TableField.SetUserFieldsFromRecord(debtor, editrow);
            if (ProjectCache != null)
            {
                Projectlookupeditor.cacheFilter = new DebtorProjectFilter(ProjectCache, debtor._Account);
                Projectlookupeditor.InvalidCache();
            }

            BindContact(debtor);
            if (installationCache != null)
            {
                leDeliveryAddress.cacheFilter = new AccountCacheFilter(installationCache, 1, debtor._Account);
                leDeliveryAddress.InvalidCache();
            }
            await api.Read(debtor);

            editrow.RefreshBalance();
        }