コード例 #1
0
        private void printDocWeek_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float topMargin   = 30;
            float leftMargin  = 0;
            float RightMargin = e.MarginBounds.Right;

            //Facrication des objet font
            Font printFont6      = new Font("Times New Roman", 6, FontStyle.Regular);
            Font printFont       = new Font("Times New Roman", 8, FontStyle.Regular);
            Font printFontBold   = new Font("Times New Roman", 8, FontStyle.Bold);
            Font printFont10     = new Font("Times New Roman", 12, FontStyle.Regular);
            Font printFont12     = new Font("Times New Roman", 12, FontStyle.Regular);
            Font printFontBold12 = new Font("Times New Roman", 12, FontStyle.Bold);
            Font printFontBold10 = new Font("Times New Roman", 10, FontStyle.Bold);
            Font printFontBold14 = new Font("Times New Roman", 14, FontStyle.Bold);
            Font printFontBold16 = new Font("Times New Roman", 16, FontStyle.Bold);

            float yPos         = 0f;
            float yPosCalandar = 0f;
            float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);

            //en-tête
            yPos = topMargin;
            e.Graphics.DrawString("Gestion Auto Ecole - Horaire : " + cbEmploye.Text, printFontBold14, Brushes.Black, leftMargin, yPos, new StringFormat());
            yPos += printFontBold16.Height;

            //Cadrage et ligne de séparation
            const int TotalDay            = 7;
            int       CadrageWidth        = e.MarginBounds.Width + 150;
            int       CacrageHeigth       = e.MarginBounds.Height + 100;
            int       CadrageSectionWidth = (e.MarginBounds.Width + 150) / TotalDay;
            Rectangle Cadrage             = new Rectangle((int)leftMargin, (int)yPos, CadrageWidth, CacrageHeigth);

            e.Graphics.DrawRectangle(Pens.Black, Cadrage);

            //Creation des Description de chaque jours pour l'impression
            ScheduleDescriptionCollection HoraireDescriptions = new ScheduleDescriptionCollection();

            HoraireDescriptions.Add(scheduleControl1.HoraireDescription);
            HoraireDescriptions.Add(scheduleControl2.HoraireDescription);
            HoraireDescriptions.Add(scheduleControl3.HoraireDescription);
            HoraireDescriptions.Add(scheduleControl4.HoraireDescription);
            HoraireDescriptions.Add(scheduleControl5.HoraireDescription);
            HoraireDescriptions.Add(scheduleControl6.HoraireDescription);
            HoraireDescriptions.Add(scheduleControl7.HoraireDescription);

            //Imprime les ligne de séparation et le calandrier
            int LeftColumn = 0;             //Position gauche de la colone courante

            for (int i = 0; i < TotalDay; i++)
            {
                LeftColumn = (int)leftMargin + CadrageSectionWidth * i;
                Point pTop  = new Point(LeftColumn, Cadrage.Top);
                Point pDown = new Point(LeftColumn, Cadrage.Bottom);
                e.Graphics.DrawLine(Pens.Black, pTop, pDown);

                //Cree le calandrier en parcourant la liste des horaires
                yPosCalandar = Cadrage.Top + 3;
                e.Graphics.DrawString(DateTimeFunc.DayOfWeekFRShort(HoraireDescriptions[i].Jour.DayOfWeek) + " " + HoraireDescriptions[i].Jour.ToLongDateString(), printFontBold12, Brushes.Black, LeftColumn + 3, yPosCalandar);
                yPosCalandar += printFontBold12.Height;
                e.Graphics.DrawString(GetOffDate(HoraireDescriptions[i].Jour), printFont10, Brushes.Black, LeftColumn + 3, yPosCalandar);
                yPosCalandar += printFont10.Height;
                string[] ClientName;
                for (int j = 0; j < HoraireDescriptions[i].HoraireJour.Count; j++)
                {
                    ClientName = HoraireDescriptions[i].HoraireJour[j].ClientName.Split(' ');
                    e.Graphics.DrawString(DateTimeFunc.FormatHour(HoraireDescriptions[i].HoraireJour[j].Heures), printFont, Brushes.Black, LeftColumn + 2, yPosCalandar);
                    if (ClientName.Length > 1)
                    {
                        e.Graphics.DrawString(ClientName[ClientName.Length - 1], printFont6, Brushes.Black, LeftColumn + 38, yPosCalandar);
                        e.Graphics.DrawString(HoraireDescriptions[i].HoraireJour[j].SeanceNumber, printFont6, Brushes.Black, LeftColumn + 150, yPosCalandar);
                        e.Graphics.DrawString(HoraireDescriptions[i].HoraireJour[j].SeanceCode, printFont6, Brushes.Black, LeftColumn + 165, yPosCalandar);

                        e.Graphics.DrawString(HoraireDescriptions[i].HoraireJour[j].PhoneNumber, printFont6, Brushes.Black, LeftColumn + 38, yPosCalandar + printFont6.Height);
                        e.Graphics.DrawString("(" + HoraireDescriptions[i].HoraireJour[j].ContratNumber + ")", printFont6, Brushes.Black, LeftColumn + 150, yPosCalandar + printFont6.Height);
                    }

                    yPosCalandar += printFont.Height * 1.75f;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Chargement de la liste de cours en fonction du nom de l'employé qui à
        /// été sélectionné dans la liste
        /// </summary>
        private void LoadListCours()
        {
            ListViewItem itm;
            Seance       cours;
            Customer     client;

            listViewEx1.Items.Clear();

            //Notes
            txtNotes.Text = "";
            txtNotes.Text = GetNotes(vCalendar.SelectionStart.Date).Message;

            //Boucle dans tous les clients
            for (int i = 0; i < _ClientList.Count; i++)
            {
                //if (this._ClientList[i].TypeClient != ProfileType.CoursTerminer )
                for (int j = 0; j < _ClientList[i].Seances.Count; j++)
                {
                    cours = _ClientList[i].Seances[j];

                    //Voila nous avons trouvé une séance qui est de cette employé
                    if ((cours.Employer == cbEmploye.Text) &&
                        (cours.DateHeure.Date == vCalendar.SelectionStart.Date) &&
                        (cours.Active == true))
                    {
                        client = _ClientList[i];
                        itm    = new ListViewItem
                        {
                            Text = DateTimeFunc.FormatHour(cours.DateHeure),

                            Tag = client
                        };
                        itm.SubItems.Add(client.ContratNumber);
                        itm.SubItems.Add(client.Name + " " + client.FirstName);
                        itm.SubItems.Add(cours.SceanceNumber.ToString());
                        itm.SubItems.Add(cours.Montant);
                        itm.SubItems.Add(cours.Code);
                        itm.SubItems.Add(client.Phone);

                        switch (client.TypeVehicule)
                        {
                        case VehiculeType.Automatique:
                            itm.ImageKey = "Auto";
                            itm.SubItems.Add("Auto.");
                            break;

                        case VehiculeType.Cyclomoteur:
                            itm.ImageKey = "Camion";
                            itm.SubItems.Add("Camion");
                            break;

                        case VehiculeType.Manuel:
                            itm.ImageKey = "Auto";
                            itm.SubItems.Add("Manuel");
                            break;

                        case VehiculeType.Moto:
                            itm.ImageKey = "Moto";
                            itm.SubItems.Add("Moto");
                            break;
                        }

                        listViewEx1.Items.Add(itm);
                    }
                }
            }
        }
コード例 #3
0
        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float    topMargin     = 30;
            float    leftMargin    = 0;
            float    RightMargin   = e.MarginBounds.Right;
            bool     isBetween     = false;
            string   Hours         = "";
            int      indexFromList = 0;
            Seance   cours         = null;
            Customer client        = null;

            string[] notesSplited;

            //Facrication de la font
            Font printFont       = new Font("Times New Roman", 8, FontStyle.Regular);
            Font printFontBold   = new Font("Times New Roman", 8, FontStyle.Bold);
            Font printFont10     = new Font("Times New Roman", 10, FontStyle.Regular);
            Font printFont12     = new Font("Times New Roman", 12, FontStyle.Regular);
            Font printFontBold10 = new Font("Times New Roman", 10, FontStyle.Bold);
            Font printFontBold12 = new Font("Times New Roman", 12, FontStyle.Bold);
            Font printFontBold14 = new Font("Times New Roman", 14, FontStyle.Bold);
            Font printFontBold16 = new Font("Times New Roman", 16, FontStyle.Bold);

            float yPos         = 0f;
            float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);

            //en-tête
            yPos = topMargin;

            //Barette logo
            Stream strm = Type.GetType("Barette.IDE.Forms.Calendar.FormHoraire").Assembly.GetManifestResourceStream("Barette.IDE.Resources.Printlogo.png");
            Bitmap img  = new Bitmap(strm);

            e.Graphics.DrawImage(img, 0, 0, 180, 100);
            e.Graphics.DrawString("Fiche horaire journalière", printFontBold16, Brushes.Black, 225, 30, new StringFormat());
            yPos += printFontBold16.Height + 0;
            e.Graphics.DrawString("Employé : " + cbEmploye.Text, printFontBold12, Brushes.Black, 225, yPos, new StringFormat());
            yPos += printFontBold16.Height;
            e.Graphics.DrawString("Date : " + DateTimeFunc.DayOfWeekFRLong(vCalendar.SelectionStart.Date.DayOfWeek) + ", " + vCalendar.SelectionStart.Date.ToLongDateString(), printFont12, Brushes.Black, 225, yPos, new StringFormat());

            //Header du tableau
            yPos += printFont.Height + 20;
            e.Graphics.DrawString("Heures", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat());
            e.Graphics.DrawString("# Contrat", printFontBold10, Brushes.Black, leftMargin + 50, yPos, new StringFormat());
            e.Graphics.DrawString("Nom du client", printFontBold10, Brushes.Black, leftMargin + 125, yPos, new StringFormat());
            e.Graphics.DrawString("Téléphone 1", printFontBold10, Brushes.Black, leftMargin + 310, yPos, new StringFormat());
            e.Graphics.DrawString("Téléphone 2", printFontBold10, Brushes.Black, leftMargin + 410, yPos, new StringFormat());
            e.Graphics.DrawString("Type", printFontBold10, Brushes.Black, leftMargin + 510, yPos, new StringFormat());
            e.Graphics.DrawString("# Séance", printFontBold10, Brushes.Black, leftMargin + 560, yPos, new StringFormat());
            e.Graphics.DrawString("Paiment", printFontBold10, Brushes.Black, leftMargin + 620, yPos, new StringFormat());
            e.Graphics.DrawString("Endroit", printFontBold10, Brushes.Black, leftMargin + 690, yPos, new StringFormat());
            e.Graphics.DrawString("Absence", printFontBold10, Brushes.Black, leftMargin + 755, yPos, new StringFormat());

            //Impression du tableau d'horraire
            yPos += printFont12.Height + 15;

            //Mettre l'heure de départ à 7h00 de la date selectionné sur le calendrier
            DateTime HeureDepart  = new DateTime(vCalendar.SelectionStart.Year, vCalendar.SelectionStart.Month, vCalendar.SelectionStart.Day, 7, 0, 0);
            DateTime HeureCourant = HeureDepart;             //Heure courant dans l'iteration

            //for (int i = 0; i < 30; i++) {
            while (DateTimeFunc.FormatHour(HeureCourant) != "22h30")               //max 22h00
            {
                yPos += printFont12.Height;

                cours = GetCoursBetweenFromList(out isBetween, out indexFromList, HeureCourant, out client);
                if (cours != null)                   //Cours à imprimer
                {
                    Hours = DateTimeFunc.FormatHour(cours.DateHeure);
                    e.Graphics.DrawString(Hours, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat());
                    e.Graphics.DrawString(client.ContratNumber, printFont10, Brushes.Black, leftMargin + 50, yPos, new StringFormat());
                    e.Graphics.DrawString(client.Name + " " + client.FirstName, printFont10, Brushes.Black, leftMargin + 125, yPos, new StringFormat());
                    e.Graphics.DrawString(client.Phone, printFont10, Brushes.Black, leftMargin + 310, yPos, new StringFormat());
                    e.Graphics.DrawString(client.PhoneBureau, printFont10, Brushes.Black, leftMargin + 410, yPos, new StringFormat());
                    e.Graphics.DrawString(client.GetShortVehiculeType(), printFont10, Brushes.Black, leftMargin + 510, yPos, new StringFormat());
                    e.Graphics.DrawString(cours.SceanceNumber.ToString(), printFont10, Brushes.Black, leftMargin + 560, yPos, new StringFormat());
                    e.Graphics.DrawString(cours.Montant, printFont10, Brushes.Black, leftMargin + 620, yPos, new StringFormat());
                    e.Graphics.DrawString(cours.Code, printFont10, Brushes.Black, leftMargin + 690, yPos, new StringFormat());
                }
                else
                {
                    Hours = DateTimeFunc.FormatHour(HeureCourant);
                    e.Graphics.DrawString(Hours, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat());
                }

                cours = null;
                //Ajoute 30 min a l'heure courante
                HeureCourant = HeureCourant.AddMinutes(30);
            }

            //Impression des notes de la journée
            if (txtNotes.Text != "")
            {
                yPos += printFontBold14.Height + 35;
                e.Graphics.DrawString("Notes", printFontBold14, Brushes.Black, leftMargin + 20, yPos, new StringFormat());

                yPos        += printFont12.Height;
                notesSplited = txtNotes.Text.Split('\n');
                for (int i = 0; i < notesSplited.Length; i++)
                {
                    yPos += printFont12.Height;
                    e.Graphics.DrawString(notesSplited[i], printFont10, Brushes.Black, leftMargin + 20, yPos, new StringFormat());
                }
            }
        }
コード例 #4
0
        private void printDocument2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float    topMargin   = 30;
            float    leftMargin  = 0;
            float    RightMargin = e.MarginBounds.Right;
            string   Hours       = "";
            string   HoursEnd    = "";
            Seance   cours       = null;
            Customer client      = null;

            Employe employe = _formMain.EmployeList.GetFromNameOrDefault(cbEmploye.Text);

            string[] notesSplited;

            //Facrication de la font
            Font printFont       = new Font("Times New Roman", 8, FontStyle.Regular);
            Font printFontBold   = new Font("Times New Roman", 8, FontStyle.Bold);
            Font printFont10     = new Font("Times New Roman", 10, FontStyle.Regular);
            Font printFont12     = new Font("Times New Roman", 12, FontStyle.Regular);
            Font printFontBold10 = new Font("Times New Roman", 10, FontStyle.Bold);
            Font printFontBold12 = new Font("Times New Roman", 12, FontStyle.Bold);
            Font printFontBold14 = new Font("Times New Roman", 14, FontStyle.Bold);
            Font printFontBold16 = new Font("Times New Roman", 16, FontStyle.Bold);

            float yPos         = 0f;
            float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);

            //en-tête
            yPos = topMargin;

            //Barette logo
            Stream strm = Type.GetType("Barette.IDE.Forms.Calendar.FormHoraire").Assembly.GetManifestResourceStream("Barette.IDE.Resources.Printlogo.png");
            Bitmap img  = new Bitmap(strm);

            e.Graphics.DrawImage(img, 0, 0, 180, 100);

            switch (_printMode)
            {
            case PrintMode.AM:
                e.Graphics.DrawString("Fiche horaire journalière : Avant-midi", printFontBold16, Brushes.Black, 225, 30, new StringFormat());
                break;

            case PrintMode.PM:
                e.Graphics.DrawString("Fiche horaire journalière : Après-midi", printFontBold16, Brushes.Black, 225, 30, new StringFormat());
                break;

            case PrintMode.Evening:
                e.Graphics.DrawString("Fiche horaire journalière : Soirée", printFontBold16, Brushes.Black, 225, 30, new StringFormat());
                break;

            case PrintMode.Day:
                e.Graphics.DrawString("Fiche horaire journalière", printFontBold16, Brushes.Black, 225, 30, new StringFormat());
                break;
            }

            yPos += printFontBold16.Height + 0;
            e.Graphics.DrawString("Employé : " + employe.Nom + " (" + employe.NomAffichageRapport + ")", printFontBold12, Brushes.Black, 225, yPos, new StringFormat());
            yPos += printFontBold16.Height;
            e.Graphics.DrawString("Date : " + DateTimeFunc.DayOfWeekFRLong(vCalendar.SelectionStart.Date.DayOfWeek) + ", " + vCalendar.SelectionStart.Date.ToLongDateString(), printFont12, Brushes.Black, 225, yPos, new StringFormat());

            //Header du tableau
            yPos += printFont.Height + 20;
            e.Graphics.DrawString("Heures", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat());
            e.Graphics.DrawString("# Contrat", printFontBold10, Brushes.Black, leftMargin + 95, yPos, new StringFormat());
            e.Graphics.DrawString("Nom du client", printFontBold10, Brushes.Black, leftMargin + 160, yPos, new StringFormat());
            e.Graphics.DrawString("Téléphone 1", printFontBold10, Brushes.Black, leftMargin + 340, yPos, new StringFormat());
            e.Graphics.DrawString("Téléphone 2", printFontBold10, Brushes.Black, leftMargin + 440, yPos, new StringFormat());
            e.Graphics.DrawString("Type", printFontBold10, Brushes.Black, leftMargin + 540, yPos, new StringFormat());
            e.Graphics.DrawString("# Séance", printFontBold10, Brushes.Black, leftMargin + 590, yPos, new StringFormat());
            e.Graphics.DrawString("Paiment", printFontBold10, Brushes.Black, leftMargin + 650, yPos, new StringFormat());
            e.Graphics.DrawString("Endroit", printFontBold10, Brushes.Black, leftMargin + 720, yPos, new StringFormat());
            //e.Graphics.DrawString("Absence", printFontBold10, Brushes.Black, leftMargin + 755, yPos, new StringFormat());

            //Impression du tableau d'horraire
            yPos += printFont12.Height + 15;

            /////////////////////////////////////////////////////////////////////////////////
            var ClientCourslist = GetListCours(vCalendar.SelectionStart, _printMode);

            foreach (KeyValuePair <Seance, Customer> pair in ClientCourslist)
            {
                yPos += printFont12.Height;

                cours  = pair.Key;
                client = pair.Value;

                Hours    = DateTimeFunc.FormatHour(cours.DateHeure);
                HoursEnd = DateTimeFunc.FormatHour(cours.DateModified);

                if (client.TypeVehicule == VehiculeType.Moto)
                {
                    e.Graphics.DrawString(Hours + " à " + HoursEnd, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat());
                }
                else
                {
                    e.Graphics.DrawString(Hours, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat());
                }

                e.Graphics.DrawString(client.ContratNumber, printFont10, Brushes.Black, leftMargin + 95, yPos, new StringFormat());
                e.Graphics.DrawString(client.Name + " " + client.FirstName, printFont10, Brushes.Black, leftMargin + 160, yPos, new StringFormat());
                e.Graphics.DrawString(client.Phone, printFont10, Brushes.Black, leftMargin + 340, yPos, new StringFormat());
                e.Graphics.DrawString(client.PhoneBureau, printFont10, Brushes.Black, leftMargin + 440, yPos, new StringFormat());
                e.Graphics.DrawString(client.GetShortVehiculeType(), printFont10, Brushes.Black, leftMargin + 540, yPos, new StringFormat());
                e.Graphics.DrawString(cours.SceanceNumber.ToString(), printFont10, Brushes.Black, leftMargin + 590, yPos, new StringFormat());
                e.Graphics.DrawString(cours.Montant, printFont10, Brushes.Black, leftMargin + 650, yPos, new StringFormat());
                e.Graphics.DrawString(cours.Code, printFont10, Brushes.Black, leftMargin + 720, yPos, new StringFormat());
            }
            /////////////////////////////////////////////////////////////////////////////////


            yPos += 50;
            e.Graphics.DrawString("____ Cours en circuit fermé", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat());
            yPos += printFont12.Height;
            e.Graphics.DrawString("____ Cours sur route", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat());

            yPos += printFont12.Height * 2;
            e.Graphics.DrawString("No. Permis  : " + employe.NumeroPermis, printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat());
            yPos += printFont12.Height * 2;
            e.Graphics.DrawString("Signature    ______________________________", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat());
            yPos += printFont12.Height;
            e.Graphics.DrawString(employe.NomAffichageRapport, printFont10, Brushes.Black, leftMargin + 70, yPos, new StringFormat());


            //Impression des notes de la journée
            if (txtNotes.Text != "")
            {
                yPos += printFontBold14.Height + 35;
                e.Graphics.DrawString("Notes", printFontBold14, Brushes.Black, leftMargin + 20, yPos, new StringFormat());

                yPos        += printFont12.Height;
                notesSplited = txtNotes.Text.Split('\n');
                for (int i = 0; i < notesSplited.Length; i++)
                {
                    yPos += printFont12.Height;
                    e.Graphics.DrawString(notesSplited[i], printFont10, Brushes.Black, leftMargin + 20, yPos, new StringFormat());
                }
            }
        }