private void OutputSplit(TrxSplit split, string transType, string payeeName) { CatDef cat = Categories[GetCatExportKey(split.CategoryKey)]; OutputLine("SPL\t\t" + transType + "\t" + split.Parent.TrxDate.ToString("MM/dd/yyyy") + "\t" + cat.ExportName + "\t" + payeeName + "\t" + (-split.Amount).ToString("##############0.00") + "\t\t" + split.Memo + "\tY"); }
private void OutputAccount(Account acct, string acctType, string extra = "") { CatDef cat; string balExportKey = GetBalanceSheetExportKey(acct.AccountKey.ToString()); if (!Categories.TryGetValue(balExportKey, out cat)) { // We probably don't need to add this CatDef to Categories, because // nothing will search for at after this point in the export, but // we add it for consistency. cat = new CatDef(acct.Title, MakeBalanceSheetExportName(acct), null); Categories.Add(balExportKey, cat); } OutputLine("ACCNT\t" + cat.ExportName + "\t" + acctType); }
/// <summary> /// Determine all names associated with the transaction, and add any /// new ones to the list that must be defined in the IIF file. /// Does not actually output anything to the IIF file here. /// </summary> /// <param name="trx"></param> private void AnalyzeNormalTrx(BankTrx trx) { PayeeDef payee; string trimmedPayee = TrimPayeeName(trx.Description); string normalizedPayee = trimmedPayee.ToLower(); if (!Payees.TryGetValue(normalizedPayee, out payee)) { payee = new PayeeDef(trimmedPayee, MakeUniquePayeeExportName(trimmedPayee)); Payees.Add(normalizedPayee, payee); } if (trx.TrxDate >= StartDate) { switch (GetPayeeUsage(trx)) { case TrxOutputType.JournalEntry: payee.UsedForGeneralJournal = true; break; case TrxOutputType.Check: payee.UsedForCheck = true; break; } } foreach (TrxSplit split in trx.Splits) { CatDef cat; // Create CatDef objects for balance sheet accounts as well as income/expense accounts. string catExportKey = GetCatExportKey(split.CategoryKey); if (!Categories.TryGetValue(catExportKey, out cat)) { string catName = CatTrans.KeyToValue1(split.CategoryKey); // Categories includes balance sheet accounts StringTransElement catElem = this.Company.Categories.get_GetElement(this.Company.Categories.FindIndexOfKey(split.CategoryKey)); // A null intuitCatType value will cause this category to NOT be output to the IIF file. // This is how we prevent categories that are actually asset, liability and equity accounts // from being output to the IIF as income, expense or COGS account. string intuitCatType; if (split.CategoryKey.IndexOf('.') >= 0) { intuitCatType = null; } else { string catType; intuitCatType = null; if (!catElem.ExtraValues.TryGetValue(CategoryTranslator.TypeKey, out catType)) { catType = CategoryTranslator.TypeOfficeExpense; } if (catType == CategoryTranslator.TypeCOGS) { intuitCatType = "COGS"; } else if (catType == CategoryTranslator.TypeOtherIncome) { intuitCatType = "EXINC"; } else if (catType == CategoryTranslator.TypeOtherExpense) { intuitCatType = "EXEXP"; } else if (catType == CategoryTranslator.TypeTaxes) { intuitCatType = "EXEXP"; } else if (catName.ToUpper().StartsWith("E:")) { intuitCatType = "EXP"; } else if (catName.ToUpper().StartsWith("I:")) { intuitCatType = "INC"; } } cat = new CatDef(catName, MakeCatExportName(split, catName), intuitCatType); Categories.Add(catExportKey, cat); } } }
public Cat(CatDef def, Vector2 position) : base(def, position, "cats", state: "idle") { }