Beispiel #1
0
        public void Genereted_PCRaport()
        {
            System.Data.DataTable ActionList = new System.Data.DataTable();
            System.Data.DataTable NewActionPozitive;
            System.Data.DataTable NewActionNegative;
            System.Data.DataTable NewActionPozitiveFinish;
            System.Data.DataTable NewActionNegativeFinish;
            string    Link;
            Worksheet worksheet;


            Link = data_Import.Load_Link("Action");
            data_Import.Load_TxtToDataTable(ref ActionList, Link);

            NewActionPozitive = Load_Table(ActionList, "2019", "Pozytywna");
            NewActionNegative = Load_Table(ActionList, "2019", "Negatywna");

            NewActionPozitiveFinish = Prepare_Table(NewActionPozitive);
            NewActionNegativeFinish = Prepare_Table(NewActionNegative);

            Microsoft.Office.Interop.Excel.Application excel;
            Workbook workbook;

            Create_Excel_Application Application = new Create_Excel_Application();

            excel = Application.Create_Application();

            Create_Excel_WorkBooks Workbooks = new Create_Excel_WorkBooks();

            workbook = Workbooks.Create_WorkBooks(excel);

            Create_Excel_WorkSheet Excel_worksheet = new Create_Excel_WorkSheet();

            worksheet = Excel_worksheet.Create_WorkSheet(workbook, "DM 2019");
            worksheet.Application.ActiveWindow.Zoom = 85;


            Action_WorkSheet(worksheet, NewActionPozitiveFinish, 10);
            Action_WorkSheet(worksheet, NewActionNegativeFinish, 14 + NewActionPozitiveFinish.Rows.Count);

            Save_Excel_WorkBook Save = new Save_Excel_WorkBook();

            Save.Save_WorkBook(excel, workbook);
        }
Beispiel #2
0
        private DataRow Load_Frozen(decimal Year)
        {
            System.Data.DataTable Frozen = new System.Data.DataTable();
            DataRow Frozen_Row;
            string  Link;

            Link = data_Import.Load_Link("Frozen");
            data_Import.Load_TxtToDataTable(ref Frozen, Link);

            Frozen_Row = Frozen.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).FirstOrDefault();

            return(Frozen_Row);
        }
Beispiel #3
0
        public void Approve_Info(string Devision, decimal Year, Data_Import data_Import)
        {
            DataTable Action = new DataTable();
            DataTable ANC    = new DataTable();
            DataTable PNC    = new DataTable();
            DataTable Kurs   = new DataTable();

            string Link;
            string DevisionFinal = Dewizje[Devision];

            //decimal Euro;

            Link = data_Import.Load_Link("Action");
            data_Import.Load_TxtToDataTable(ref Action, Link);

            Link = data_Import.Load_Link("Kurs");
            data_Import.Load_TxtToDataTable(ref Kurs, Link);

            Link = data_Import.Load_Link("ANC");
            data_Import.Load_TxtToDataTable(ref ANC, Link);

            Link = data_Import.Load_Link("PNC");
            data_Import.Load_TxtToDataTable(ref PNC, Link);

            //Euro = decimal.Parse((Kurs.Select(string.Format("Year LIKE '%{0}%'", Year)).FirstOrDefault())["EURO"].ToString());

            foreach (DataRow Row in Action.Rows)
            {
                if (Row["Group"].ToString() == DevisionFinal && Row["StartYear"].ToString() == Year.ToString())
                {
                    //Row.ItemArray = CalcSpecjal(Row, Rewizion, Euro, ref ANC, ref PNC).ItemArray;
                }
            }

            Link = data_Import.Load_Link("Action");
            data_Import.Save_DataTableToTXT(ref Action, Link);
        }
Beispiel #4
0
        //Funkcje pomocnicze

        //Ładowanie używanych STK do Słownika plus Ładowanie IDCO do słownika
        private void LoadSTK(decimal Year)
        {
            //Deklaracja zmiennych
            DataTable STK = new DataTable();
            DataRow   FoundRow;
            string    LinkSTK;

            string[] ANC     = new string[3];
            string[] ANCSpec = new string[2];
            string   STKYear;
            decimal  STKValue;
            bool     STKCheck;
            bool     Zero = false;

            //
            LinkSTK = ImportData.Load_Link("STK");
            ImportData.Load_TxtToDataTable(ref STK, LinkSTK);

            //Sprawdzenie czy STK na dany rok jest już w bazie czy nie ma - jak nie ma daje wybrór użytkowanikowi aby użył z poprzedniego roku
            do
            {
                DataColumnCollection Columns = STK.Columns;
                if (!Columns.Contains(Year.ToString()))
                {
                    STKCheck = true;
                    DialogResult dialogResult = MessageBox.Show("STK for this Year not exist, Do you want to take for calculation STK from Year Before?", "STK Issue", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        Zero = false;
                        Year = Year - 1;
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        Zero     = true;
                        STKCheck = false;
                    }
                }
                else
                {
                    STKCheck = false;
                }
            } while (STKCheck);

            STKYear = "STK/" + Year.ToString();

            //Dodanie do słownika ANC z Old/New
            for (int counter = 1; counter <= ANCChangeNumber; counter++)
            {
                ANC[0] = ((TextBox)mainProgram.TabControl.Controls.Find("TB_OldANC" + counter.ToString(), true).First()).Text;
                ANC[1] = ((TextBox)mainProgram.TabControl.Controls.Find("TB_NewANC" + counter.ToString(), true).First()).Text;
                ANC[2] = ((TextBox)mainProgram.TabControl.Controls.Find("TB_NextANC" + counter.ToString(), true).First()).Text;

                for (int counter2 = 0; counter2 < 3; counter2++)
                {
                    if (ANC[counter2].ToString() != "")
                    {
                        if (!STKDictionary.ContainsKey(ANC[counter2]))
                        {
                            if (!Zero)
                            {
                                FoundRow = STK.Select(string.Format("ANC LIKE '%{0}%'", ANC[counter2])).FirstOrDefault();
                                if (FoundRow != null)
                                {
                                    if (FoundRow[STKYear].ToString() != "")
                                    {
                                        STKValue = decimal.Parse(FoundRow[STKYear].ToString());
                                        STKDictionary.Add(ANC[counter2], STKValue);
                                        IDCODictionary.Add(ANC[counter2], FoundRow["IDCO"].ToString());
                                    }
                                    else
                                    {
                                        STKDictionary.Add(ANC[counter2], 0);
                                        IDCODictionary.Add(ANC[counter2], "");
                                    }
                                }
                                else
                                {
                                    STKDictionary.Add(ANC[counter2], 0);
                                    IDCODictionary.Add(ANC[counter2], "");
                                }
                            }
                            else
                            {
                                STKDictionary.Add(ANC[counter2], 0);
                                IDCODictionary.Add(ANC[counter2], "");
                            }
                        }
                    }
                }
            }

            //Jeśli jest PNCSpec to musi przelecieć kolejną tabele aby dodać brakujące ANC
            if (((CheckBox)mainProgram.TabControl.Controls.Find("cb_CalcPNCSpec", true).First()).Checked)
            {
                DataGridView PNC = (DataGridView)mainProgram.TabControl.Controls.Find("dg_PNC", true).First();

                DataGridViewColumnCollection Columns = PNC.Columns;
                if (Columns.Contains("OLD ANC"))
                {
                    foreach (DataGridViewRow Row in PNC.Rows)
                    {
                        if (Row.Cells["PNC"].Value == null || Row.Cells["PNC"].Value.ToString() == "")
                        {
                            ANCSpec[0] = Row.Cells["OLD ANC"].Value.ToString();
                            ANCSpec[1] = Row.Cells["NEW ANC"].Value.ToString();

                            for (int counter = 0; counter < 2; counter++)
                            {
                                if (ANCSpec[counter] != "")
                                {
                                    if (!STKDictionary.ContainsKey(ANCSpec[counter]))
                                    {
                                        if (!Zero)
                                        {
                                            FoundRow = STK.Select(string.Format("ANC LIKE '%{0}%'", ANCSpec[counter])).FirstOrDefault();
                                            if (FoundRow != null && FoundRow[STKYear].ToString() != "")
                                            {
                                                STKValue = decimal.Parse(FoundRow[STKYear].ToString());
                                                STKDictionary.Add(ANCSpec[counter], STKValue);
                                                IDCODictionary.Add(ANCSpec[counter], FoundRow["IDCO"].ToString());
                                            }
                                            else
                                            {
                                                STKDictionary.Add(ANCSpec[counter], 0);
                                                IDCODictionary.Add(ANCSpec[counter], "");
                                            }
                                        }
                                        else
                                        {
                                            STKDictionary.Add(ANCSpec[counter], 0);
                                            IDCODictionary.Add(ANCSpec[counter], "");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }