Ejemplo n.º 1
0
        void InitPage(CrudAPI crudapi)
        {
            RemoveMenuItem();
            BusyIndicator                = busyIndicator;
            dAddress.Header              = Uniconta.ClientTools.Localization.lookup("DeliveryAddr");
            layoutControl                = layoutItems;
            PrCategorylookupeditor.api   = Projectlookupeditor.api =
                Employeelookupeditor.api = leAccount.api = lePayment.api = cmbDim1.api = cmbDim2.api =
                    cmbDim3.api          = cmbDim4.api = cmbDim5.api = leTransType.api = leGroup.api = lePostingAccount.api
                                                                                                           = leLayoutGroup.api = leInvoiceAccount.api =
                                                                                                                 leDeliveryAddress.api = leApprover.api = leSplit.api = leVat.api = prTasklookupeditor.api = lePrWorkSpace.api = crudapi;

            cbDeliveryCountry.ItemsSource = Enum.GetValues(typeof(Uniconta.Common.CountryCode));
            AdjustLayout();
            if (editrow == null)
            {
                frmRibbon.DisableButtons("Delete");
                liCreatedTime.Visibility = Visibility.Collapsed;
                editrow          = CreateNew() as ProjectInvoiceProposalClient;
                editrow._Created = DateTime.MinValue;
                if (Debtor != null)
                {
                    SetFieldFromDebtor(editrow, Debtor);
                    leAccount.IsEnabled = txtName.IsEnabled = false;
                }
                if (Contact != null)
                {
                    editrow.SetMaster(Contact);
                    leAccount.IsEnabled = txtName.IsEnabled = cmbContactName.IsEnabled = false;
                }
                else if (Project != null)
                {
                    editrow.SetMaster(Project);
                    leAccount.IsEnabled           = txtName.IsEnabled = false;
                    Projectlookupeditor.IsEnabled = false;
                    SetPrCategory(editrow);
                }
            }
            else
            {
                BindContact(editrow.Debtor);
            }

            layoutItems.DataContext  = editrow;
            frmRibbon.OnItemClicked += frmRibbon_OnItemClicked;

            AcItem.ButtonClicked += AcItem_ButtonClicked;
#if !SILVERLIGHT
            editrow.PropertyChanged += Editrow_PropertyChanged;
            AcItem.ToolTip           = string.Format(Uniconta.ClientTools.Localization.lookup("CreateOBJ"), Uniconta.ClientTools.Localization.lookup("Debtor"));
#endif
            StartLoadCache();
        }
Ejemplo n.º 2
0
 public override void RowsPastedDone()
 {
     if (Debtor != null)
     {
         editrow.SetMaster(Debtor);
     }
     if (Contact != null)
     {
         editrow.SetMaster(Contact);
     }
     else if (Project != null)
     {
         editrow.SetMaster(Project);
     }
     SetFieldFromDebtor(editrow, Debtor);
 }
Ejemplo n.º 3
0
        async void SetFieldFromDebtor(ProjectInvoiceProposalClient editrow, Debtor debtor)
        {
            if (debtor == null)
            {
                return;
            }
            var loadedOrder = LoadedRow as DCOrder;

            editrow.SetMaster(debtor);
            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;
                }
            }
            if (ProjectCache != null)
            {
                Projectlookupeditor.cache = ProjectCache;
            }

            TableField.SetUserFieldsFromRecord(debtor, editrow);
            BindContact(debtor);
            if (installationCache != null)
            {
                leDeliveryAddress.cacheFilter = new AccountCacheFilter(installationCache, 1, debtor._Account);
                leDeliveryAddress.InvalidCache();
            }
            layoutItems.DataContext = null;
            layoutItems.DataContext = editrow;

            await api.Read(debtor);

            editrow.RefreshBalance();
        }