Example #1
0
 public static bool GetDelStatus(int ProfileId)
 {
     TDayDataSet tDayDataSet = new TDayDataSet();
     TDayDataSetTableAdapters.ProfilesTableAdapter ProfilesTableAdapter = new TDayDataSetTableAdapters.ProfilesTableAdapter();
     ProfilesTableAdapter.FillAll(tDayDataSet.Profiles);
     DataRow Row = tDayDataSet.Profiles.FindByProfileId(ProfileId);
     return (bool)Row["DelStatus"];
 }
Example #2
0
 public static string GetName(int ProfileId)
 {
     TDayDataSet tDayDataSet = new TDayDataSet();
     TDayDataSetTableAdapters.ProfilesTableAdapter ProfilesTableAdapter = new TDayDataSetTableAdapters.ProfilesTableAdapter();
     ProfilesTableAdapter.FillAll(tDayDataSet.Profiles);
     DataRow Row = tDayDataSet.Profiles.FindByProfileId(ProfileId);
     return Row["Name"].ToString();
 }
Example #3
0
 public static int GetCategory(int ProfileId)
 {
     TDayDataSet tDayDataSet = new TDayDataSet();
     TDayDataSetTableAdapters.ProfilesTableAdapter ProfilesTableAdapter = new TDayDataSetTableAdapters.ProfilesTableAdapter();
     ProfilesTableAdapter.FillAll(tDayDataSet.Profiles);
     DataRow Row = tDayDataSet.Profiles.FindByProfileId(ProfileId);
     return (int)Row["Category"];
 }
Example #4
0
        public static void PrintTransportation(string Day)
        {
            TDayDataSet tDayDataSet = new TDayDataSet();
            TDayDataSetTableAdapters.TransportationTableAdapter transportationTableAdapter = new TDayDataSetTableAdapters.TransportationTableAdapter();
            TDayDataSetTableAdapters.ProfilesTableAdapter profilesTableAdapter = new TDayDataSetTableAdapters.ProfilesTableAdapter();
            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Transportation.pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Transportation.pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Transportation.pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Transportation.pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Transportation.pdf"); }
            }
            FileStream FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath + @"\Transportation.pdf", FileMode.CreateNew);
            var Doc = new iTextSharp.text.Document(PageSize.A4.Rotate(), 20, 20, 20, 20);

            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            PdfPTable table;
            if (Day == "Master")
            {
                table = new PdfPTable(20);
                table.HorizontalAlignment = Element.ALIGN_LEFT;
                table.WidthPercentage = 100;

                AddHeader(table, "Transportation", 20, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
                AddHeader(table, Day, 16, new BaseColor(Color.DimGray), new BaseColor(Color.White));
                transportationTableAdapter.Fill(tDayDataSet.Transportation);
                AddPriviewCell(table, "Numb", 1);
                AddPriviewCell(table, "Name", 4);
                AddPriviewCell(table, "Category", 2);
                AddPriviewCell(table, "Address", 4);
                AddPriviewCell(table, "Phone", 2);
                AddPriviewCell(table, "HD#", 2);
                AddPriviewCell(table, "Mon", 1);
                AddPriviewCell(table, "Tue", 1);
                AddPriviewCell(table, "Wed", 1);
                AddPriviewCell(table, "Thu", 1);
                AddPriviewCell(table, "Fri", 1);
                //AddPriviewCell(table, "Comment", 1);
            }
            else
            {
                table = new PdfPTable(15);
                table.HorizontalAlignment = Element.ALIGN_LEFT;
                table.WidthPercentage = 100;

                AddHeader(table, "Transportation", 20, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
                AddHeader(table, Day, 16, new BaseColor(Color.DimGray), new BaseColor(Color.White));
                transportationTableAdapter.Fill(tDayDataSet.Transportation);
                AddPriviewCell(table, "Numb", 1);
                AddPriviewCell(table, "Name", 4);
                AddPriviewCell(table, "Category", 2);
                AddPriviewCell(table, "Address", 4);
                AddPriviewCell(table, "Phone", 2);
                AddPriviewCell(table, "HD#", 2);
            }
            int Counter = 1;
            foreach (DataRow Row in tDayDataSet.Transportation)
            {
                switch (Day)
                {
                    case "Master":
                        AddPriviewCell(table, Counter.ToString(), 1);
                        AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 4);
                        AddPriviewCell(table, Row["Category"].ToString(), 2);
                        AddPriviewCell(table, Row["Adress"].ToString(), 4);
                        AddPriviewCell(table, Row["Phone"].ToString(), 2);
                        AddPriviewCell(table, Row["HandyDARTNumber"].ToString(), 2);
                        AddValueCell(table, (bool)Row["Monday"], true, 1);
                        AddValueCell(table, (bool)Row["Tuesday"], true, 1);
                        AddValueCell(table, (bool)Row["Wednesday"], true, 1);
                        AddValueCell(table, (bool)Row["Thursday"], true, 1);
                        AddValueCell(table, (bool)Row["Friday"], true, 1);
                        //AddPriviewCell(table, Row["Comments"].ToString(), 1);
                        Counter++;
                        break;
                    case "Monday":
                        if ((bool)Row["Monday"])
                        {
                            AddPriviewCell(table, Counter.ToString(), 1);
                            AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 4);
                            AddPriviewCell(table, Row["Category"].ToString(), 2);
                            AddPriviewCell(table, Row["Adress"].ToString(), 4);
                            AddPriviewCell(table, Row["Phone"].ToString(), 2);
                            AddPriviewCell(table, Row["HandyDARTNumber"].ToString(), 2);
                            Counter++;
                        }
                        break;
                    case "Tuesday":
                        if ((bool)Row["Tuesday"])
                        {
                            AddPriviewCell(table, Counter.ToString(), 1);
                            AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 4);
                            AddPriviewCell(table, Row["Category"].ToString(), 2);
                            AddPriviewCell(table, Row["Adress"].ToString(), 4);
                            AddPriviewCell(table, Row["Phone"].ToString(), 2);
                            AddPriviewCell(table, Row["HandyDARTNumber"].ToString(), 2);
                            Counter++;
                        }
                        break;
                    case "Wednesday":
                        if ((bool)Row["Wednesday"])
                        {
                            AddPriviewCell(table, Counter.ToString(), 1);
                            AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 4);
                            AddPriviewCell(table, Row["Category"].ToString(), 2);
                            AddPriviewCell(table, Row["Adress"].ToString(), 4);
                            AddPriviewCell(table, Row["Phone"].ToString(), 2);
                            AddPriviewCell(table, Row["HandyDARTNumber"].ToString(), 2);
                            Counter++;
                        }
                        break;
                    case "Thursday":
                        if ((bool)Row["Thursday"])
                        {
                            AddPriviewCell(table, Counter.ToString(), 1);
                            AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 4);
                            AddPriviewCell(table, Row["Category"].ToString(), 2);
                            AddPriviewCell(table, Row["Adress"].ToString(), 4);
                            AddPriviewCell(table, Row["Phone"].ToString(), 2);
                            AddPriviewCell(table, Row["HandyDARTNumber"].ToString(), 2);
                            Counter++;
                        }
                        break;
                    case "Friday":
                        if ((bool)Row["Friday"])
                        {
                            AddPriviewCell(table, Counter.ToString(), 1);
                            AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 4);
                            AddPriviewCell(table, Row["Category"].ToString(), 2);
                            AddPriviewCell(table, Row["Adress"].ToString(), 4);
                            AddPriviewCell(table, Row["Phone"].ToString(), 2);
                            AddPriviewCell(table, Row["HandyDARTNumber"].ToString(), 2);
                            Counter++;
                        }
                        break;
                }

            }
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Transportation.pdf");
        }
Example #5
0
        public static void PrintAttendance(Day _CurrentDay)
        {
            TDayDataSet tDayDataSet = new TDayDataSet();
            TDayDataSetTableAdapters.DaysTableAdapter daysTableAdapter = new TDayDataSetTableAdapters.DaysTableAdapter();
            TDayDataSetTableAdapters.ProfilesTableAdapter profilesTableAdapter = new TDayDataSetTableAdapters.ProfilesTableAdapter();

            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Attendance_" + _CurrentDay.Date.Day.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Attendance_" + _CurrentDay.Date.Day.ToString() + ".pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Attendance_" + _CurrentDay.Date.Day.ToString() + ".pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Attendance_" + _CurrentDay.Date.Day.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Attendance_" + _CurrentDay.Date.Day.ToString() + ".pdf"); }
            }
            FileStream FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath + @"\Attendance_" + _CurrentDay.Date.Day.ToString()
                + ".pdf", FileMode.CreateNew);
            var Doc = new iTextSharp.text.Document(PageSize.A4.Rotate(), 20, 20, 20, 20);

            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            PdfPTable table = new PdfPTable(14);
            table.HorizontalAlignment = Element.ALIGN_LEFT;
            table.WidthPercentage = 100;

            AddHeader(table, "Attendance", 20, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddHeader(table, _CurrentDay.Date.DayOfWeek + "  " + _CurrentDay.Date.ToShortDateString(), 16, new BaseColor(Color.DimGray), new BaseColor(Color.White));
            daysTableAdapter.Fill(tDayDataSet.Days, _CurrentDay.Date);

            int Counter = 0;
            int TotalLC = 0;
            double TotalLCP = 0;
            double TotalTOP = 0;
            double TotalMisoP = 0;
            double TotalVan = 0;
            double TotalP = 0;
            double TotalRTP = 0;
            double TotalBFT = 0;
            double TotalT = 0;
            AddHeader(table, "Billed Clients", 12, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Numb", 1);
            AddPriviewCell(table, "Name", 3);
            AddPriviewCell(table, "A", 1);
            AddPriviewCell(table, "LC", 1);
            AddPriviewCell(table, "L$", 1);
            AddPriviewCell(table, "TO$", 1);
            AddPriviewCell(table, "Miso$", 1);
            AddPriviewCell(table, "P$", 1);
            AddPriviewCell(table, "Van", 1);
            AddPriviewCell(table, "RT", 1);
            AddPriviewCell(table, "BFT", 1);
            AddPriviewCell(table, "Total", 1);
            foreach (DataRow Row in tDayDataSet.Days)
            {
                if (ProfileProvider.GetCategory((int)Row["ProfileId"]) == 1)
                {
                    AddPriviewCell(table, Counter.ToString(), 1);
                    AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 3);
                    AddValueCell(table, (bool)Row["Attendance"], true, 1);
                    AddValueCell(table, (bool)Row["Lunch"], true, 1);
                    if ((bool)Row["Lunch"]) { TotalLC++; }
                    AddPriviewCell(table, Row["LunchPrice"].ToString(), 1);
                    TotalLCP += Convert.ToDouble(Row["LunchPrice"]);
                    AddPriviewCell(table, Row["TakeOutPrice"].ToString(), 1);
                    TotalTOP += Convert.ToDouble(Row["TakeOutPrice"]);
                    AddPriviewCell(table, Row["MiscellaneousPrice"].ToString(), 1);
                    TotalMisoP += Convert.ToDouble(Row["MiscellaneousPrice"]);
                    if (ProfileProvider.GetCategory((int)Row["ProfileId"]) == 1)
                    {
                        AddPriviewCell(table, Row["ProgramPrice"].ToString(), 1);
                        TotalP += Convert.ToDouble(Row["ProgramPrice"]);
                        AddPriviewCell(table, Row["VanPrice"].ToString(), 1);
                        TotalVan += Convert.ToDouble(Row["VanPrice"]);
                        AddPriviewCell(table, Row["RoundTripPrice"].ToString(), 1);
                        TotalRTP += Convert.ToDouble(Row["RoundTripPrice"]);
                        AddPriviewCell(table, Row["BookOfTickets"].ToString(), 1);
                        TotalBFT += Convert.ToDouble(Row["BookOfTickets"]);
                    }
                    else
                    {
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalP += Convert.ToDouble(Row["ProgramPrice"]);
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalVan += Convert.ToDouble(Row["VanPrice"]);
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalRTP += Convert.ToDouble(Row["RoundTripPrice"]);
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalBFT += Convert.ToDouble(Row["BookOfTickets"]);
                    }
                    AddPriviewCell(table, Row["Total"].ToString(), 1);
                    Counter++;

                }

            }
            AddPriviewCell(table, "", 1);
            AddPriviewCell(table, "Total:", 3);
            AddPriviewCell(table, Counter.ToString(), 1);
            AddPriviewCell(table, TotalLC.ToString(), 1);
            AddPriviewCell(table, TotalLCP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalTOP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalMisoP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalVan.ToString("0.00"), 1);
            AddPriviewCell(table, TotalRTP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalBFT.ToString("0.00"), 1);
            AddPriviewCell(table, (TotalLCP + TotalMisoP + TotalTOP + TotalVan + TotalP + TotalRTP + TotalBFT).ToString("0.00"), 1);

            AddHeader(table, "Staff/Volunteers", 12, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Numb", 1);
            AddPriviewCell(table, "Name", 3);
            AddPriviewCell(table, "A", 1);
            AddPriviewCell(table, "LC", 1);
            AddPriviewCell(table, "L$", 1);
            AddPriviewCell(table, "TO$", 1);
            AddPriviewCell(table, "Miso$", 1);
            AddPriviewCell(table, "P$", 1);
            AddPriviewCell(table, "Van", 1);
            AddPriviewCell(table, "RT", 1);
            AddPriviewCell(table, "BFT", 1);
            AddPriviewCell(table, "Total", 1);

            Counter = 0;
            TotalLC = 0;
            TotalLCP = 0;
            TotalTOP = 0;
            TotalMisoP = 0;
            TotalVan = 0;
            TotalP = 0;
            TotalRTP = 0;
            TotalBFT = 0;
            TotalT = 0;
            foreach (DataRow Row in tDayDataSet.Days)
            {
                if (ProfileProvider.GetCategory((int)Row["ProfileId"]) != 1)
                {
                    AddPriviewCell(table, Counter.ToString(), 1);
                    AddPriviewCell(table, ProfileProvider.GetName((int)Row["ProfileId"]), 3);
                    AddValueCell(table, (bool)Row["Attendance"], true, 1);
                    AddValueCell(table, (bool)Row["Lunch"], true, 1);
                    if ((bool)Row["Lunch"]) { TotalLC++; }
                    AddPriviewCell(table, Row["LunchPrice"].ToString(), 1);
                    TotalLCP += Convert.ToDouble(Row["LunchPrice"]);
                    AddPriviewCell(table, Row["TakeOutPrice"].ToString(), 1);
                    TotalTOP += Convert.ToDouble(Row["TakeOutPrice"]);
                    AddPriviewCell(table, Row["MiscellaneousPrice"].ToString(), 1);
                    TotalMisoP += Convert.ToDouble(Row["MiscellaneousPrice"]);
                    if (ProfileProvider.GetCategory((int)Row["ProfileId"]) == 1)
                    {
                        AddPriviewCell(table, Row["ProgramPrice"].ToString(), 1);
                        TotalP += Convert.ToDouble(Row["ProgramPrice"]);
                        AddPriviewCell(table, Row["VanPrice"].ToString(), 1);
                        TotalVan += Convert.ToDouble(Row["VanPrice"]);
                        AddPriviewCell(table, Row["RoundTripPrice"].ToString(), 1);
                        TotalRTP += Convert.ToDouble(Row["RoundTripPrice"]);
                        AddPriviewCell(table, Row["BookOfTickets"].ToString(), 1);
                        TotalBFT += Convert.ToDouble(Row["BookOfTickets"]);
                    }
                    else
                    {
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalP += Convert.ToDouble(Row["ProgramPrice"]);
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalVan += Convert.ToDouble(Row["VanPrice"]);
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalRTP += Convert.ToDouble(Row["RoundTripPrice"]);
                        AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
                        TotalBFT += Convert.ToDouble(Row["BookOfTickets"]);
                    }

                    AddPriviewCell(table, Row["Total"].ToString(), 1);
                    Counter++;
                }

            }
            AddPriviewCell(table, "", 1);
            AddPriviewCell(table, "Total:", 3);
            AddPriviewCell(table, Counter.ToString(), 1);
            AddPriviewCell(table, TotalLC.ToString(), 1);
            AddPriviewCell(table, TotalLCP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalTOP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalMisoP.ToString("0.00"), 1);
            AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "", 1, new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, (TotalLCP + TotalMisoP + TotalTOP + TotalVan + TotalP + TotalRTP + TotalBFT).ToString("0.00"), 1);

            //********************
            TotalLC = 0;
            TotalLCP = 0;
            TotalTOP = 0;
            TotalMisoP = 0;
            TotalVan = 0;
            TotalP = 0;
            TotalRTP = 0;
            TotalBFT = 0;
            TotalT = 0;
            foreach (DataRow Row in tDayDataSet.Days)
            {
                    if ((bool)Row["Lunch"]) { TotalLC++; }
                    TotalLCP += Convert.ToDouble(Row["LunchPrice"]);
                    TotalTOP += Convert.ToDouble(Row["TakeOutPrice"]);
                    TotalMisoP += Convert.ToDouble(Row["MiscellaneousPrice"]);
                    if (ProfileProvider.GetCategory((int)Row["ProfileId"]) == 1)
                    {
                        TotalP += Convert.ToDouble(Row["ProgramPrice"]);
                        TotalVan += Convert.ToDouble(Row["VanPrice"]);
                        TotalRTP += Convert.ToDouble(Row["RoundTripPrice"]);
                        TotalBFT += Convert.ToDouble(Row["BookOfTickets"]);
                    }
                    else
                    {
                        TotalP += Convert.ToDouble(Row["ProgramPrice"]);
                        TotalVan += Convert.ToDouble(Row["VanPrice"]);
                        TotalRTP += Convert.ToDouble(Row["RoundTripPrice"]);
                        TotalBFT += Convert.ToDouble(Row["BookOfTickets"]);
                    }
            }

            //******************
            TotalT += TotalLCP + TotalMisoP + TotalTOP + TotalVan + TotalP + TotalRTP + TotalBFT;
            AddPriviewCell(table, "", 1);
            AddPriviewCell(table, "GrandTotal:", 3);
            AddPriviewCell(table, tDayDataSet.Days.Rows.Count.ToString(), 1);
            AddPriviewCell(table, TotalLC.ToString(), 1);
            AddPriviewCell(table, TotalLCP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalTOP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalMisoP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalVan.ToString("0.00"), 1);
            AddPriviewCell(table, TotalRTP.ToString("0.00"), 1);
            AddPriviewCell(table, TotalBFT.ToString("0.00"), 1);
            AddPriviewCell(table, TotalT.ToString("0.00"), 1);
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Attendance_" + _CurrentDay.Date.Day.ToString() + ".pdf");
        }