Exemplo n.º 1
0
        private void SelectedItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var rec = sender as GLAccountClosingSheetClient;

            switch (e.PropertyName)
            {
            case "IsReconciled":
                if (rec._Reconciled != this.prevReconciled)
                {
                    var GlobalRec = (GLAccount)LedgerCache.Get(rec.RowId);
                    var old       = (GLAccount)StreamingManager.Clone(GlobalRec);
                    GlobalRec._Reconciled = rec._Reconciled;
                    api.UpdateNoResponse(old, rec);
                }
                break;
            }
        }
        private void VoucherClientRow_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var rec = sender as VouchersClient;

            var prop = e.PropertyName;

            if (prop == "DocumentDate" || prop == "Date" || prop == "CreditorAccount")
            {
                var cre = rec.Creditor;
                if (cre != null)
                {
                    UnicontaClient.Pages.Vouchers.SetPayDate(PaymentCache, rec, cre);
                    if (prop == "CreditorAccount")
                    {
                        rec.PaymentMethod = cre.PaymentMethod;
                        if (cre._PostingAccount != null)
                        {
                            rec.CostAccount = cre._PostingAccount;
                        }
                    }
                }
            }
            else if (prop == "CostAccount")
            {
                var Acc = (Uniconta.DataModel.GLAccount)LedgerCache?.Get(rec._CostAccount);
                if (Acc == null)
                {
                    return;
                }
                if (Acc._PrCategory != null)
                {
                    rec.PrCategory = Acc._PrCategory;
                }
                if (Acc._MandatoryTax == VatOptions.NoVat)
                {
                    rec.Vat          = null;
                    rec.VatOperation = null;
                }
                else
                {
                    rec.Vat          = Acc._Vat;
                    rec.VatOperation = Acc._VatOperation;
                }
                if (Acc._DefaultOffsetAccount != null)
                {
                    if (Acc._DefaultOffsetAccountType == GLJournalAccountType.Creditor)
                    {
                        rec.CreditorAccount = Acc._DefaultOffsetAccount;
                    }
                    else if (Acc._DefaultOffsetAccountType == GLJournalAccountType.Finans)
                    {
                        rec.PayAccount = Acc._DefaultOffsetAccount;
                    }
                }
            }
            else if (prop == "TransType")
            {
                var glTransTYpe = (Uniconta.DataModel.GLTransType)GLTransTypeCache?.Get(rec._TransType);
                if (glTransTYpe != null)
                {
                    if (glTransTYpe._AccountType == GLJournalAccountType.Finans && glTransTYpe._Account != null)
                    {
                        rec.Text = glTransTYpe._TransType;
                        if (glTransTYpe._AccountType == 0 && glTransTYpe._Account != null)
                        {
                            rec.CostAccount = glTransTYpe._Account;
                        }
                        if (glTransTYpe._OffsetAccount != null)
                        {
                            if (glTransTYpe._OffsetAccountType == 0)
                            {
                                rec.PayAccount = glTransTYpe._OffsetAccount;
                            }
                            else if (glTransTYpe._OffsetAccountType == GLJournalAccountType.Creditor)
                            {
                                rec.CreditorAccount = glTransTYpe._OffsetAccount;
                            }
                        }
                    }
                }
            }
        }