Example #1
0
        public CreditCard(ExcelWorksheet sheet, Dictionary <string, ColumnHeader> ch, int rownum, IEnumerable <Category> categoryRows)
        {
            RowNumber              = rownum;
            PaidDate               = new ColumnDateTime(sheet, rownum, ch["Paid Date"]);
            StatementDate          = new ColumnDateTime(sheet, rownum, ch["Statement Date"]);
            TransactionDate        = new ColumnDateTime(sheet, rownum, ch["Transaction Date"]);
            TransactionDescription = new ColumnString(sheet, rownum, ch["Transaction Description"]);
            TransactionAmount      = new ColumnDecimal(sheet, rownum, ch["Transaction Amount"]);
            VatContent             = new ColumnDecimal(sheet, rownum, ch["Vat Content"]);
            Postage = new ColumnDecimal(sheet, rownum, ch["P & P"]);

            Category = new ColumnString(sheet, rownum, ch["Category"]);
            Notes    = new ColumnString(sheet, rownum, ch["Notes"]);
            if (sheet.Cells[rownum, ch["Notes"].ColumnNumber].Hyperlink != null)
            {
                NotesHyperLink = sheet.Cells[rownum, ch["Notes"].ColumnNumber].Hyperlink;
            }
            if (categoryRows.Any())
            {
                Categorise(categoryRows);
            }
            if (PaidDate.Value != null && StatementDate.Value == null)
            {
                StatementDate.Errors.Add("Statement date is missing.");
            }
        }
Example #2
0
        public static void UpdateCellDate(ExcelWorksheet sheet, int rownumber, ColumnDateTime field)
        {
            if (field == null || field?.Value == null && !field.Errors.Any())
            {
                return;
            }
            if (field.Value != null)
            {
                sheet.Cells[rownumber, field.ColumnNumber].Value = ((DateTime)field.Value).ToOADate();
            }
            sheet.Cells[rownumber, field.ColumnNumber].Style.Numberformat.Format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;

            WriteErrors(sheet, rownumber, field.ColumnNumber, field.Errors);
        }
Example #3
0
        public CurrentAccount(ExcelWorksheet sheet, Dictionary <string, ColumnHeader> ch, int rownum, IEnumerable <Category> categories, IEnumerable <CreditCard> ccRows)
        {
            RowNumber = rownum;
            Date      = new ColumnDateTime(sheet, rownum, ch["Date"]);
            //if (Date.Value == null)
            //{
            //    Date = null;
            //    rownum = -1;
            //    return ;
            //}

            Description = new ColumnString(sheet, rownum, ch["Description"]);
            Debit       = new ColumnDecimal(sheet, rownum, ch["Debit"]);
            if (Debit.Value != null)
            {
                Debit.Value = -1 * Math.Abs((decimal)Debit.Value);
            }
            Credit  = new ColumnDecimal(sheet, rownum, ch["Credit"]);
            Balence = new ColumnDecimal(sheet, rownum, ch["Balence"]);
            CalculatedMonthlyBalence = new ColumnDecimal(sheet, rownum, ch["Monthly"]);
            CalculatedYearlyBalence  = new ColumnDecimal(sheet, rownum, ch["Yearly"]);
            Category = new ColumnString(sheet, rownum, ch["Category Override"]);
            Notes    = new ColumnString(sheet, rownum, ch["Notes"]);
            if (sheet.Cells[rownum, ch["Notes"].ColumnNumber].Hyperlink != null)
            {
                NotesHyperLink = sheet.Cells[rownum, ch["Notes"].ColumnNumber].Hyperlink;
            }
            if (Date == null)
            {
                IsDivider = true;
                if (Debit != null || Credit != null)
                {
                    IsMonthlySummary = true;
                }
            }
            IsStartingBalence = (rownum == 3);
            // set the categories
            Categorise(categories, ccRows);
            //Set the train flag
            IsTrainTravel = (Notes.Value.Equals("IsTrainTravel", StringComparison.CurrentCultureIgnoreCase));
        }