Beispiel #1
0
        public ReadInKandH(ImportReadIn importReadin, Workbook workbook, Worksheet worksheet)
        {
            worksheet        = workbook.Worksheets[1];
            this.bankHanlder = importReadin;
            transactions     = new List <Transaction>();
            string transactionDate = "";
            string osszegString    = "";
            //string egyenlegString = "";
            int    osszeg          = 0;
            int    currentEgyenleg = 0;
            string accountNumber   = worksheet.Cells[2, 4].Value.ToString();

            int tempIndex = 2;

            while (worksheet.Cells[tempIndex, 1].Value != null)
            {
                tempIndex++;
            }
            int i = tempIndex;

            while (i != 2)
            {
                transactionDate  = worksheet.Cells[i, 1].Value.ToString();
                osszegString     = worksheet.Cells[i, 8].Value.ToString();
                osszeg           = int.Parse(osszegString);
                currentEgyenleg += osszeg;
                transactions.Add(new Transaction(currentEgyenleg, transactionDate, osszeg, "old read IN OTP", accountNumber));
                i--;
            }
            bankHanlder.addTransactions(transactions);
        }
Beispiel #2
0
 public TemplateStockReadIn(ImportReadIn _stockHandler, string filePath)
 {
     stockHandler    = _stockHandler;
     folderAddresses = filePath;
     workbook        = excel.Workbooks.Open(folderAddresses);
     stockWorksheet  = workbook.Worksheets[1];
 }
Beispiel #3
0
        public ReadInOTP(ImportReadIn importReadin, Workbook workbook, Worksheet worksheet)
        {
            worksheet        = workbook.Worksheets[1];
            this.bankHanlder = importReadin;
            transactions     = new List <Transaction>();
            int    i                  = 1;
            int    egyenleg_rn        = 0;
            string transactionDate    = "";
            int    osszeg             = 0;
            int    new_egyenleg       = 0;
            bool   need_values        = true;
            string osszeg_string      = "";
            string new_balance_string = "";
            string accountNumber      = worksheet.Cells[3, 2].Value.ToString();

            i = 15;

            while (worksheet.Cells[i, 1].Value != null)
            {
                //egyenleg += osszeg;
                while (need_values)
                {
                    transactionDate = worksheet.Cells[i, 3].Value.ToString();
                    osszeg_string   = worksheet.Cells[i, 5].Value.ToString();
                    if (i > 15)
                    {
                        egyenleg_rn = new_egyenleg;
                    }
                    new_balance_string = worksheet.Cells[i, 6].Value.ToString();
                    if (i == 15)
                    {
                        egyenleg_rn = int.Parse(new_balance_string);
                    }
                    need_values  = false;
                    osszeg       = int.Parse(osszeg_string);
                    new_egyenleg = int.Parse(new_balance_string);
                }
                i++;
                need_values = true;
                transactions.Add(new Transaction(egyenleg_rn, transactionDate, osszeg, "old read IN OTP", accountNumber));
            }
            bankHanlder.addTransactions(transactions);
        }
Beispiel #4
0
        public ReadInFHB(ImportReadIn importReadin, Workbook workbook, Worksheet worksheet)
        {
            worksheet        = workbook.Worksheets[1];
            this.bankHanlder = importReadin;
            transactions     = new List <Transaction>();

            int    i = 20;
            string transactionDate    = "";
            string osszegString       = "";
            string egyenlegString     = "";
            string accountNumberExtra = worksheet.Cells[8, 2].Value.ToString();
            string accountNumber      = accountNumberExtra.Substring(0, 25); //substraction the HUF word
            int    osszeg             = 0;
            int    currentEgyenleg    = 0;

            while ((worksheet.Cells[i, 1].Value != null) || (worksheet.Cells[i + 1, 1].Value != null))//interesing FHB file..
            {
                if (worksheet.Cells[i, 1].Value != null)
                {
                    transactionDate = worksheet.Cells[i, 1].Value.ToString();
                    if (worksheet.Cells[i, 9].Value != null) //cost
                    {
                        osszegString = worksheet.Cells[i, 9].Value.ToString();
                        osszeg       = int.Parse(osszegString);
                    }
                    else if (worksheet.Cells[i, 11].Value != null)//income
                    {
                        osszegString = worksheet.Cells[i, 11].Value.ToString();
                        osszeg       = int.Parse(osszegString) * (-1);
                    }
                    if (worksheet.Cells[i, 13].Value == null) //in case if the Egyenleg cell is null in the first transaction (interesting FHB file)
                    {
                        int tempIndex = i + 1;                //don't scan the current cell because we already know it's null
                        while (worksheet.Cells[tempIndex, 13].Value == null)
                        {
                            tempIndex++;
                        }
                        string oldEgyenlegString = "";
                        oldEgyenlegString = worksheet.Cells[tempIndex, 13].Value.ToString();
                        int oldEgyenlegInt = int.Parse(oldEgyenlegString);
                        //adding or substracting other transactions -- to get the real Egyenleg
                        while (tempIndex != i - 1)
                        {
                            string tempOsszegString = "";
                            int    tempOsszegInt    = 0;
                            if (worksheet.Cells[tempIndex, 9].Value != null)//cost
                            {
                                tempOsszegString = worksheet.Cells[tempIndex, 9].Value.ToString();
                                tempOsszegInt    = int.Parse(tempOsszegString);
                            }
                            else if (worksheet.Cells[tempIndex, 11].Value != null)//income
                            {
                                tempOsszegString = worksheet.Cells[tempIndex, 11].Value.ToString();
                                tempOsszegInt    = int.Parse(tempOsszegString) * (-1);
                            }
                            oldEgyenlegInt += tempOsszegInt;
                            tempIndex--;//going back up
                        }
                        currentEgyenleg = oldEgyenlegInt;
                    }
                    else
                    {
                        if (worksheet.Cells[i, 13].value != null)
                        {
                            egyenlegString  = worksheet.Cells[i, 13].Value.ToString();
                            currentEgyenleg = int.Parse(egyenlegString);
                        }
                        else
                        {
                            int tempEgyenleg = 0;
                            if (worksheet.Cells[i, 9].Value != null)
                            {
                                egyenlegString   = worksheet.Cells[i, 9].Value.ToString();
                                tempEgyenleg     = int.Parse(egyenlegString) * (-1);
                                currentEgyenleg += tempEgyenleg;
                            }
                            else if (worksheet.Cells[i, 11].Value != null)
                            {
                                egyenlegString   = worksheet.Cells[i, 11].Value.ToString();
                                tempEgyenleg     = int.Parse(egyenlegString);
                                currentEgyenleg += tempEgyenleg;
                            }
                        }
                    }
                    Console.WriteLine(currentEgyenleg);
                    transactions.Add(new Transaction(currentEgyenleg, transactionDate, osszeg, "old read IN FHB", accountNumber));
                }
                i++;
            }
            bankHanlder.addTransactions(transactions);
        }
Beispiel #5
0
 public TemplateStockReadIn(ImportReadIn _stockHandler, List <string> _folderAddresses)
 {
     stockHandler    = _stockHandler;
     folderAddresses = _folderAddresses;
 }