private static TransactionReconcile CategoriseTransaction(Transaction transaction) { var reconcile = new TransactionReconcile { TransactionId = transaction.TransactionId, Description = transaction.Narrative, Gst = 0 }; var description = transaction.Narrative.ToUpper(); if (transaction.Categories.Contains("FEE") || transaction.Categories.Contains("INT")) { reconcile.Category = AccountCategory.Expense.ToString(); reconcile.Amount = GetAmountNegative(transaction); reconcile.GstType = GstCategory.Gst.ToString(); } if (transaction.Categories.Contains("CREDIT")) { reconcile.Category = AccountCategory.AccountTransferIn.ToString(); reconcile.Amount = GetAmountAbsolute(transaction); reconcile.Description = "Transfer In"; reconcile.GstType = GstCategory.Free.ToString(); } if (transaction.Categories.Contains("PAYMENT")) { if (description.Contains("TFR")) { reconcile.Category = AccountCategory.AccountTransferOut.ToString(); reconcile.Description = "Transfer Out"; reconcile.Amount = GetAmountNegative(transaction); } if (description.Contains("PYMNT")) { reconcile.Category = AccountCategory.Expense.ToString(); reconcile.Amount = GetAmountAbsolute(transaction); reconcile.Description = transaction.Narrative + " - Royalties/Payments"; reconcile.GstType = GstCategory.Gst.ToString(); } if (description.Contains("ASIC") || description.Contains("ATO") ) { reconcile.Category = AccountCategory.Expense.ToString(); reconcile.Amount = GetAmountNegative(transaction); reconcile.Description = transaction.Narrative + "ASIC EXPENSE"; reconcile.GstType = GstCategory.Free.ToString(); } reconcile.Category = AccountCategory.Expense.ToString(); reconcile.Amount = GetAmountNegative(transaction); reconcile.Description = transaction.Narrative + " - EXPENSE OTHER"; reconcile.GstType = GstCategory.Gst.ToString(); } if (transaction.Categories.Contains("DEP")) { // Receive Money if (description.Contains("FUNDS TFR")) { reconcile.Category = AccountCategory.AccountTransferIn.ToString(); reconcile.Amount = GetAmountAbsolute(transaction); reconcile.Description = "Transfer In"; reconcile.GstType = GstCategory.Free.ToString(); } reconcile.Category = AccountCategory.Revenue.ToString(); reconcile.Amount = GetAmountAbsolute(transaction); reconcile.Description = transaction.Narrative + " - INCOME"; reconcile.GstType = GstCategory.Free.ToString(); } if (transaction.Categories.Contains("XFER")) { // Transfer Out for Payment mostly reconcile.Category = AccountCategory.AccountTransferOut.ToString(); reconcile.Description = "Transfer Out"; reconcile.Amount = GetAmountNegative(transaction); reconcile.GstType = GstCategory.Free.ToString(); } reconcile.Gst = GetGstAmount(reconcile); return reconcile; }
private static decimal GetGstAmount(TransactionReconcile reconcile) { if (reconcile.GstType == GstCategory.Free.ToString()) return 0; if (reconcile.GstType == GstCategory.InputTaxed.ToString()) return 0; if (reconcile.GstType == GstCategory.Gst.ToString()) return Math.Round(reconcile.Amount / 11m, 2); return 0; }