Esempio n. 1
0
        internal static DataTable LowestOpeningBalance(DataTable table, string studio)
        {
            double        balance            = 0;
            double        casRegisterBalance = 0;
            DataStrctures tables             = new DataStrctures();
            DataTable     tableToReturn      = tables.StartingBalanceTableStructure();
            IndexGetters  indexes            = new IndexGetters();
            var           indexOfRanges      = indexes.ListOfAllRanges(table);
            var           balanceString      = "";
            var           cashRegisterString = "";
            var           time = "";

            for (int i = 0; i < indexOfRanges.Count; i++)
            {
                int range = indexOfRanges[i];

                balanceString      = table.Rows[range + 4][0].ToString().Substring(3);
                cashRegisterString = table.Rows[range + 6][0].ToString().Substring(6);
                if (!balanceString.Equals(""))
                {
                    balance            = DelimterConvertor(balanceString);
                    casRegisterBalance = DelimterConvertor(cashRegisterString);
                    time = table.Rows[range][0].ToString().Substring(0, 5);
                    tableToReturn.Rows.Add(time, balance, casRegisterBalance, studio);
                }
            }
            return(tableToReturn);
        }
Esempio n. 2
0
        private int ColumnIndexGetterCardInfoFile(DataTable sheetInfo, string typeOfWorkout)
        {
            IndexGetters index       = new IndexGetters();
            int          returnIndex = 0;

            for (int i = 0; i < sheetInfo.Columns.Count; i++)
            {
                if (sheetInfo.Rows[index.CardExpirationStartingRowIndex(sheetInfo)][i].ToString().ToLower().Equals(typeOfWorkout.Trim().ToLower()))
                {
                    returnIndex = i;
                    break;
                }
            }
            return(returnIndex);
        }
Esempio n. 3
0
        private void CardValidityPupulation(DataTable sheetInfo, string insctructor, string studio)
        {
            IndexGetters indexes         = new IndexGetters();
            ExcelReader  excel           = new ExcelReader();
            DataTable    expenseInfo     = excel.ExcelToDataTable("Справка карти", expenseFile);
            var          workouts        = indexes.ListOfWorkouts(sheetInfo);
            var          workoutsIndexes = indexes.Ranges(sheetInfo);
            var          workoutType     = "";

            for (int i = 0; i < sheetInfo.Rows.Count; i++)
            {
                var cardName   = sheetInfo.Rows[i][nOfCardIndex].ToString();
                var typeOfGood = sheetInfo.Rows[i][typeOfGoodIndex].ToString();
                var ammount    = 0;
                if (!cardName.Equals("") && !cardName.Equals("N: на карта") && !typeOfGood.Equals("ваучер"))
                {
                    for (int j = 0; j < workouts.Count; j++)
                    {
                        if (i >= workoutsIndexes[j][0] && i < workoutsIndexes[j][1])
                        {
                            workoutType = workouts[j];
                            var cardRowNumber    = indexes.RowOfCard(expenseInfo, cardName);
                            var cardColumnNumber = ColumnIndexGetterCardInfoFile(expenseInfo, workoutType);
                            if (!expenseInfo.Rows[cardRowNumber][cardColumnNumber].ToString().Equals(""))
                            {
                                ammount = int.Parse(expenseInfo.Rows[cardRowNumber][cardColumnNumber].ToString());
                            }
                            var sum = SumForWorkoutType(ammount, workoutType).ToString();
                            excel.EditCellValue(expenseFile, "Справка карти", sum, cardRowNumber + 1, cardColumnNumber + 1);
                            break;
                        }
                    }
                }
            }
            excel.EditRowColor(expenseFile, "Справка карти", (indexes.CardExpirationStartingRowIndex(expenseInfo) + 2), date);
        }