Ejemplo 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);
        }
Ejemplo n.º 2
0
        private void AvailabilityDataTable(DataTable sheetInfo)
        {
            DataStrctures structure = new DataStrctures();

            DataTable BalanceSheet = reader.ExcelToDataTable("Наличност", AssemblyDirectory + @"\Zimnina\_Компот-ЦЛ.xlsx");
            int       startingRow  = StartingRowForExport(BalanceSheet, date);

            for (int i = 0; i < StudioNames.Length; i++)
            {
                var       lowestBalance             = LowestAmmountPopulating(StudioNames[i], StartingBalances, "Balance");
                var       cashRegisterLowestBalance = LowestAmmountPopulating(StudioNames[i], StartingBalances, "CashRegister");
                DataTable table = new DataTable();

                if (StudioNames[i].Equals("Студентски"))
                {
                    table = structure.AvailabilityTableStructure(date, lowestBalance, StudentskiIncome, StudentskiHonorary, "", cashRegisterLowestBalance);
                    reader.ExportToExcel(table, AssemblyDirectory + @"\Zimnina\_Компот-Студентски.xlsx", "Наличност", numberOfLastRow: startingRow);
                }
                else
                {
                    if (StudioNames[i].Equals("Лозенец"))
                    {
                        table = structure.AvailabilityTableStructure(date, lowestBalance, LozenecIncome, LozenecHonorary, "", cashRegisterLowestBalance);
                        reader.ExportToExcel(table, AssemblyDirectory + @"\Zimnina\_Компот-ЦЛ.xlsx", "Наличност", numberOfLastRow: startingRow, startingCellIndex: 8);
                    }
                    else
                    {
                        table = structure.AvailabilityTableStructure(date, lowestBalance, CenteryIncome, CenterHonorary, "", cashRegisterLowestBalance);
                        reader.ExportToExcel(table, AssemblyDirectory + @"\Zimnina\_Компот-ЦЛ.xlsx", "Наличност", numberOfLastRow: startingRow);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private List <DataTable> CardValidityDataTable(DataTable sheetInfo, List <int> trueExpenses, int year, int month, int day)
        {
            DataStrctures    structure    = new DataStrctures();
            List <DataTable> listOfTables = new List <DataTable>();
            MoneyData        moneyData    = new MoneyData();

            for (int i = 0; i < trueExpenses.Count; i++)
            {
                DataTable table              = structure.CardValidityTableStructure();
                int       indexOfRow         = trueExpenses[i];
                var       money              = sheetInfo.Rows[indexOfRow][moneyIndex].ToString();
                var       cardName           = sheetInfo.Rows[indexOfRow][nOfCardIndex].ToString();
                var       firstAndFamilyName = sheetInfo.Rows[indexOfRow][firstAndFamiliyNameIndex].ToString();
                var       wayOfPaying        = moneyData.deferredPayment(money);
                var       typeOfood          = sheetInfo.Rows[indexOfRow][typeOfGoodIndex].ToString();
                var       ammountOfMoney     = moneyData.Ammout(money, typeOfood);
                var       ValidityTo         = moneyData.CardPeriodExpiration(year, month, day, ammountOfMoney);
                if (!cardName.Equals("") || typeOfood.Equals("ваучер"))
                {
                    table.Rows.Add(cardName, firstAndFamilyName, date, ValidityTo, typeOfood, wayOfPaying, ammountOfMoney);
                    listOfTables.Add(table);
                }
            }
            return(listOfTables);
        }
Ejemplo n.º 4
0
        private DataTable IncomeDataTable(DataTable sheetInfo, string instrctorName, string studioName, List <int> trueExpenses)
        {
            DataStrctures structure = new DataStrctures();
            DataTable     table     = structure.IncomeDataTableStructure();

            for (int i = 0; i < trueExpenses.Count; i++)
            {
                int indexOfRow         = trueExpenses[i];
                var typeOfGood         = sheetInfo.Rows[indexOfRow][typeOfGoodIndex].ToString();
                var FirstAndFamilyName = sheetInfo.Rows[indexOfRow][firstAndFamiliyNameIndex].ToString();
                var Money   = sheetInfo.Rows[indexOfRow][moneyIndex].ToString();
                var Receipt = sheetInfo.Rows[indexOfRow][receiptIndex].ToString();
                if (!Receipt.ToLower().Equals("да"))
                {
                    Receipt = "-";
                }
                var AddditionalInfo = sheetInfo.Rows[indexOfRow][additionalInfoIndex].ToString();
                switch (studioName)
                {
                case "Лозенец":
                    LozenecIncome = LozenecIncome + Convert.ToDouble(Money);
                    break;

                case "Студентски":
                    StudentskiIncome = StudentskiIncome + Convert.ToDouble(Money);
                    break;

                case "Център":
                    CenteryIncome = CenteryIncome + Convert.ToDouble(Money);
                    break;
                }
                table.Rows.Add(date, Receipt, studioName, FirstAndFamilyName, typeOfGood, AddditionalInfo, instrctorName, Money);
            }
            return(table);
        }
Ejemplo n.º 5
0
        public void ExtractDataToArchive(int year, int month, int day)
        {
            SpreadSheetToExcel toExcel   = new SpreadSheetToExcel();
            DataStrctures      structure = new DataStrctures();

            for (int i = 0; i < Instructors().Length; i++)
            {
                string dayDirectory = ArchiveDayDirectory(year, MonthName(month), day, Instructors()[i]);
                Directory.CreateDirectory(dayDirectory);
                string sourcePath = InstructorsDirectory(year, Instructors()[i]) + @"\" +
                                    day;
                toExcel.Transformer(sourcePath, structure.BananasDataTableStructure());
                CopyPasteFiles(sourcePath, dayDirectory);
            }
        }
Ejemplo n.º 6
0
        private DataTable ExpenseDataTable(DataTable sheetInfo, string instrctorName, string studioName)
        {
            DataStrctures structure        = new DataStrctures();
            DataTable     table            = structure.ExpenseDataTableStructure();
            string        motive           = "инструкторски хонорар";
            double        honorarySum      = 0;
            double        honorarySumToAdd = 0;

            for (int i = 0; i < sheetInfo.Rows.Count; i++)
            {
                string honorary = sheetInfo.Rows[i][honoraryIndex].ToString();

                if (honorary.Equals("") || honorary.Equals("хонорар") || i == sheetInfo.Rows.Count - 1)
                {
                    honorarySumToAdd = 0;
                }
                else
                {
                    honorarySumToAdd = DelimterConvertor(honorary);
                }
                honorarySum = honorarySum + honorarySumToAdd;
            }
            switch (studioName)
            {
            case "Лозенец":
                LozenecHonorary = LozenecHonorary + honorarySum;
                break;

            case "Студентски":
                StudentskiHonorary = StudentskiHonorary + honorarySum;
                break;

            case "Център":
                CenterHonorary = CenterHonorary + honorarySum;
                break;
            }
            table.Rows.Add(date, studioName, motive, instrctorName, honorarySum);
            return(table);
        }