Пример #1
0
 private void btnEmplDuTmp_Click(object sender, EventArgs e)
 {
     // the creation of the repport document of "emploi du temps de l'interimaire"
     if (dgvInterimeur.Rows.Count > 0)//si il y a des trus dans le dgv
     {
         Document  doc = new Document(PageSize.LETTER, 40, 40, 30, 25);
         PdfWriter pw  = PdfWriter.GetInstance(doc, new FileStream(@"E:\C#\InterimDesktopApp\Doc\Emploid de temps des interimairs.pdf", FileMode.Create));
         doc.Open();// opening the pdf to write in
         Image     logo      = Image.GetInstance(@"E:\C#\InterimDesktopApp\Images\circle.png");
         Paragraph logo_name = new Paragraph("Circle", small_font);
         Paragraph date      = new Paragraph("Le" + " " + DateTime.Today.ToString("dd/MM/yyyy"), date_font);
         Paragraph title     = new Paragraph("Emploi de temps de chaque interimaire", header_font);
         Paragraph newLine   = new Paragraph("\n");
         logo.ScalePercent(10.0f);
         logo.Alignment  = 0;// 0 = left; 1=center ; 2=right
         logo.Alignment  = 0;
         date.Alignment  = 2;
         title.Alignment = 1;
         doc.Add(logo);
         doc.Add(logo_name);
         doc.Add(date);
         doc.Add(title);
         doc.Add(newLine);
         for (int i = 0; i < dgvInterimeur.RowCount - 1; i++)
         {
             var            nId        = Convert.ToInt32(dgvInterimeur.Rows[i].Cells[0].Value);
             C_t_interimeur interimeur = Interimeurs.Find(x => x.id_inte == (int)nId);
             C_t_categorie  categorie  = Categories.Find(x => x.nom_categ == interimeur.specialisation);
             C_t_travail    prestation = Prestations.Find(x => x.id_categ == categorie.id_categ);
             //MessageBox.Show(categorie.nom_categ + "=>" + prestation.nom_travail);
             PdfPTable table_interimeur = new PdfPTable(2);
             PdfPCell  nom_interimeur   = new PdfPCell(new Phrase(interimeur.nom_inte, normal_font));
             PdfPCell  col_date_debut   = new PdfPCell(new Phrase("Debut", normal_font));
             PdfPCell  col_date_fin     = new PdfPCell(new Phrase("Fin", normal_font));
             nom_interimeur.Colspan             = 2;
             nom_interimeur.BackgroundColor     = BaseColor.ORANGE;
             nom_interimeur.HorizontalAlignment = 1;
             col_date_debut.HorizontalAlignment = 1;
             col_date_fin.HorizontalAlignment   = 1;
             table_interimeur.AddCell(nom_interimeur);
             table_interimeur.AddCell(col_date_debut);
             table_interimeur.AddCell(col_date_fin);
             table_interimeur.AddCell(prestation.date_debut.ToString("dd/MM/yyyy"));
             table_interimeur.AddCell(prestation.date_fin.ToString("dd/MM/yyyy"));
             //table_interimeur.AddCell(interimeur.nom_inte);
             //table_interimeur.AddCell("nothing");
             doc.Add(table_interimeur);
             doc.Add(newLine);
         }
         doc.Close(); //closing the pdf
     }
     else
     {
         MessageBox.Show(@"Vous n'aves pas d'interimaire dans vorte base de donneés");
     }
 }
Пример #2
0
        public C_t_travail Lire_ID(int Id_travail)
        {
            CreerCommande("Selectionnert_travail_ID");
            Commande.Parameters.AddWithValue("@Id_travail", Id_travail);
            Commande.Connection.Open();
            SqlDataReader dr  = Commande.ExecuteReader();
            C_t_travail   res = new C_t_travail();

            while (dr.Read())
            {
                res.Id_travail   = int.Parse(dr["Id_travail"].ToString());
                res.nom_travail  = dr["nom_travail"].ToString();
                res.prix_travail = double.Parse(dr["prix_travail"].ToString());
                res.date_debut   = DateTime.Parse(dr["date_debut"].ToString());
                res.date_fin     = DateTime.Parse(dr["date_fin"].ToString());
                res.id_categ     = int.Parse(dr["id_categ"].ToString());
                res.id_fact      = int.Parse(dr["id_fact"].ToString());
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Пример #3
0
        public List <C_t_travail> Lire(string Index)
        {
            CreerCommande("Selectionnert_travail");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader      dr  = Commande.ExecuteReader();
            List <C_t_travail> res = new List <C_t_travail>();

            while (dr.Read())
            {
                C_t_travail tmp = new C_t_travail();
                tmp.Id_travail   = int.Parse(dr["Id_travail"].ToString());
                tmp.nom_travail  = dr["nom_travail"].ToString();
                tmp.prix_travail = double.Parse(dr["prix_travail"].ToString());
                tmp.date_debut   = DateTime.Parse(dr["date_debut"].ToString());
                tmp.date_fin     = DateTime.Parse(dr["date_fin"].ToString());
                tmp.id_categ     = int.Parse(dr["id_categ"].ToString());
                tmp.id_fact      = int.Parse(dr["id_fact"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Пример #4
0
        private void btnCAmensuel_Click(object sender, EventArgs e)
        {
            float total  = 0f;
            float amount = 0f;

            if (dgvPrestation.Rows.Count > 0)
            {
                Document  doc = new Document(PageSize.LETTER, 40, 40, 30, 25);
                PdfWriter pw  = PdfWriter.GetInstance(doc, new FileStream(@"E:\C#\InterimDesktopApp\Doc\CAM12.pdf", FileMode.Create));
                doc.Open();// opening the pdf to write in
                Image     logo      = Image.GetInstance(@"E:\C#\InterimDesktopApp\Images\circle.png");
                Paragraph logo_name = new Paragraph("Circle", small_font);
                Paragraph date      = new Paragraph("Le" + " " + DateTime.Today.ToString("dd/MM/yyyy"), date_font);
                Paragraph title     = new Paragraph("Chiffre d'affaire mensuel par 12 mois", header_font);
                Paragraph newLine   = new Paragraph("\n");
                logo.ScalePercent(10.0f);
                logo.Alignment  = 0;// 0 = left; 1=center ; 2=right
                logo.Alignment  = 0;
                date.Alignment  = 2;
                title.Alignment = 1;
                doc.Add(logo);
                doc.Add(logo_name);
                doc.Add(date);
                doc.Add(title);
                doc.Add(newLine);
                PdfPTable table_prestation = new PdfPTable(2);
                PdfPCell  title_table      = new PdfPCell(new Phrase("chiffre d' affaires", normal_font));
                title_table.Colspan             = 2;
                title_table.BackgroundColor     = BaseColor.ORANGE;
                title_table.HorizontalAlignment = 1;
                PdfPCell col_prestation    = new PdfPCell(new Phrase("Nom Prestation", normal_font));
                PdfPCell col_Amount        = new PdfPCell(new Phrase("Prix", normal_font));
                PdfPCell description_total = new PdfPCell(new Phrase("Total"));
                col_prestation.HorizontalAlignment = 1;
                col_Amount.HorizontalAlignment     = 1;
                table_prestation.AddCell(title_table);
                table_prestation.AddCell(col_prestation);
                table_prestation.AddCell(col_Amount);
                for (int i = 0; i < dgvPrestation.RowCount - 1; i++)
                {
                    var            nId        = Convert.ToInt32(dgvPrestation.Rows[i].Cells[0].Value);
                    C_t_travail    prestation = Prestations.Find(x => x.Id_travail == (int)nId);
                    C_t_categorie  categorie  = Categories.Find(x => x.id_categ == prestation.id_categ);
                    C_t_interimeur interimeur = Interimeurs.Find(x => x.specialisation == categorie.nom_categ);
                    //MessageBox.Show(categorie.nom_categ + "=>" + interimeur.nom_inte);
                    amount = (float)prestation.prix_travail + (float)((prestation.prix_travail * interimeur.bonus_sal) / 100);
                    total += amount;
                    PdfPCell cell_prestation = new PdfPCell(new Phrase(prestation.nom_travail, normal_font));
                    table_prestation.AddCell(cell_prestation);
                    table_prestation.AddCell(amount + "€");
                }
                doc.Add(newLine);
                table_prestation.AddCell(description_total);
                table_prestation.AddCell(total.ToString() + "€");
                doc.Add(table_prestation);
                total = 0f;
                doc.Close(); //closing the pdf
            }
            else
            {
                MessageBox.Show("Vous n'avez aucune prestation !");
            }
        }
Пример #5
0
        private void btnMomntLbr_Click(object sender, EventArgs e)
        {
            Document doc = new Document(PageSize.LETTER, 40, 40, 30, 25);

            doc.Open();
            //the creation of the repport concerning " les moments libre de l'interimaire"
            PdfWriter pw = PdfWriter.GetInstance(doc, new FileStream(@"E:\C#\InterimDesktopApp\Doc\moments libres des interimaires.pdf", FileMode.Create));

            doc.Open();//open for writing
            Image     logo      = Image.GetInstance(@"E:\C#\InterimDesktopApp\Images\circle.png");
            Paragraph logo_name = new Paragraph("Circle", small_font);
            Paragraph date      = new Paragraph("Le" + " " + DateTime.Today.ToString("dd/MM/yyyy"), date_font);
            Paragraph title     = new Paragraph("Moments libres des interimaires par specialisation", header_font);
            Paragraph newLine   = new Paragraph("\n");

            logo.ScalePercent(10.0f);
            logo.Alignment  = 0;// 0 = left; 1=center ; 2=right
            logo.Alignment  = 0;
            date.Alignment  = 2;
            title.Alignment = 1;
            doc.Add(logo);
            doc.Add(logo_name);
            doc.Add(date);
            doc.Add(title);
            doc.Add(newLine);
            for (int i = 0; i < dgvInterimeur.RowCount - 1; i++)
            {
                string    specialite     = (string)dgvInterimeur.Rows[i].Cells[3].Value;
                Paragraph nom_specialite = new Paragraph(specialite, header_font);
                nom_specialite.Alignment = 1;
                doc.Add(nom_specialite);
                doc.Add(newLine);
                for (int j = 0; j < dgvInterimeur.RowCount - 1; j++)
                {
                    var            nId        = Convert.ToInt32(dgvInterimeur.Rows[j].Cells[0].Value);
                    C_t_interimeur interimeur = Interimeurs.Find(x => x.id_inte == (int)nId);
                    if (interimeur.specialisation == specialite)
                    {
                        C_t_categorie categorie  = Categories.Find(x => x.nom_categ == interimeur.specialisation);
                        C_t_travail   prestation = Prestations.Find(x => x.id_categ == categorie.id_categ);
                        //MessageBox.Show(categorie.nom_categ + "=>" + prestation.nom_travail);
                        //if (interimeur.specialisation != specialite) continue;
                        //else
                        //{
                        //MessageBox.Show(interimeur.specialisation+" "+specialite+" "+ "=>" +prestation.date_fin.ToString("dd/MM/yyyy"));

                        PdfPTable table_interimeur = new PdfPTable(2);
                        PdfPCell  nom_interimeur   = new PdfPCell(new Phrase(interimeur.nom_inte, normal_font));
                        PdfPCell  col_date_debut   = new PdfPCell(new Phrase("Debut", normal_font));
                        PdfPCell  col_date_fin     = new PdfPCell(new Phrase("Fin", normal_font));
                        nom_interimeur.Colspan             = 2;
                        nom_interimeur.BackgroundColor     = BaseColor.ORANGE;
                        nom_interimeur.HorizontalAlignment = 1;
                        col_date_debut.HorizontalAlignment = 1;
                        col_date_fin.HorizontalAlignment   = 1;
                        table_interimeur.AddCell(nom_interimeur);
                        table_interimeur.AddCell(col_date_debut);
                        table_interimeur.AddCell(col_date_fin);
                        table_interimeur.AddCell("Libre depuis");
                        table_interimeur.AddCell(prestation.date_fin.ToString("dd/MM/yyyy"));
                        //table_interimeur.AddCell(interimeur.nom_inte);
                        //table_interimeur.AddCell("nothing");
                        doc.Add(table_interimeur);
                        doc.Add(newLine); // simply adding a new line
                                          //}
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            doc.Close();
        }