DCAccount copyDCAccount(BankStatementLineGridClient rec, GLJournalAccountType type, string Acc) { var dc = getDCAccount(type, Acc); if (dc == null) { return(null); } if (dc._Dim1 != null) { rec.Dimension1 = dc._Dim1; } if (dc._Dim1 != null) { rec.Dimension2 = dc._Dim2; } if (dc._Dim1 != null) { rec.Dimension3 = dc._Dim3; } if (dc._Dim1 != null) { rec.Dimension4 = dc._Dim4; } if (dc._Dim1 != null) { rec.Dimension5 = dc._Dim5; } return(dc); }
async void GetSearchOpenInvoice(BankStatementLineGridClient line, GLJournalAccountType type) { InvoiceAPI InvApi = new InvoiceAPI(api); string strAccount = (string)await InvApi.SearchOpenInvoice(type, line._Invoice); if (strAccount != null) { line.Account = strAccount; } }
DCAccount getDCAccount(GLJournalAccountType type, string Acc) { if (type == GLJournalAccountType.Finans || Acc == null) { return(null); } var cache = (type == GLJournalAccountType.Debtor) ? DebtorCache : CreditorCache; return((DCAccount)cache.Get(Acc)); }
async private void SetOffsetAccountSource(GLJournalAccountType accountType) { var t = GetAccountType(accountType); var api = this.api; var Comp = api.CompanyEntity; var Cache = Comp.GetCache(t); if (Cache == null) { Cache = await Comp.LoadCache(t, api); } leOffsetAccount.ItemsSource = Cache; }
void selectedItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var rec = sender as BankStatementLineGridClient; switch (e.PropertyName) { case "AccountType": SetAccountSource(rec); break; case "Invoice": if (rec._Invoice != null) { GLJournalAccountType type = rec._AmountCent > 0 ? GLJournalAccountType.Debtor : GLJournalAccountType.Creditor; rec.AccountType = AppEnums.GLAccountType.ToString((int)type); GetSearchOpenInvoice(rec, type); } break; case "Account": if (rec._AccountType != (byte)GLJournalAccountType.Finans) { var dc = copyDCAccount(rec, (GLJournalAccountType)rec._AccountType, rec._Account); if (dc != null) { rec.Vat = null; rec.VatOperation = null; } } else { var Acc = (GLAccount)LedgerCache.Get(rec._Account); if (Acc != null) { if (Acc._IsDCAccount || Acc._MandatoryTax == VatOptions.NoVat) { rec.Vat = null; rec.VatOperation = null; } else { rec.Vat = Acc._Vat; rec.VatOperation = Acc._VatOperation; } } } break; } }
private Type GetAccountType(GLJournalAccountType accountType) { Type t = null; switch (accountType) { case GLJournalAccountType.Finans: t = typeof(GLAccount); break; case GLJournalAccountType.Debtor: t = typeof(Debtor); break; case GLJournalAccountType.Creditor: t = typeof(Uniconta.DataModel.Creditor); break; } return(t); }