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");
     }
 }
Beispiel #2
0
 private void btnEditer_Click(object sender, EventArgs e)
 {
     if (dgvFacture.SelectedRows.Count > 0)
     {
         Activer(false);
         tbId.Text = dgvFacture.SelectedRows[0].Cells["IdFact"].Value.ToString();
         var            facture    = new G_t_facture(SChonn).Lire_ID(int.Parse(tbId.Text));
         C_t_entreprise entreprise = Entreprises.Find(x => x.id_entre == facture.id_entre);
         C_t_interimeur interimeur = Interimeurs.Find(x => x.id_inte == facture.id_inte);
         dtpFacture.Value = facture.date_fact;
         cbEntre2.Text    = entreprise.nom_entre.ToString();
         cbInte2.Text     = interimeur.nom_inte.ToString();
     }
     else
     {
         MessageBox.Show(@"There is no row selected!");
     }
 }
Beispiel #3
0
        private void RemplireDgv()
        {
            DtFacture = new DataTable();
            DtFacture.Columns.Add(new DataColumn("IdFact", Type.GetType("System.Int32") ?? throw new InvalidOperationException()));
            DtFacture.Columns.Add("DateFact");
            DtFacture.Columns.Add("IdEntre");
            DtFacture.Columns.Add("IdInte");
            List <C_t_facture> factures = new G_t_facture(SChonn).Lire("Nom");

            foreach (C_t_facture facture in factures)
            {
                C_t_entreprise entreprise = Entreprises.Find(x => x.id_entre == facture.id_entre);
                C_t_interimeur interimeur = Interimeurs.Find(x => x.id_inte == facture.id_inte);
                DtFacture.Rows.Add(facture.id_fact, facture.date_fact.ToString("dd/MM/yyyy"), entreprise.nom_entre, interimeur.nom_inte);
            }
            BsFacture = new BindingSource {
                DataSource = DtFacture
            };
            dgvFacture.DataSource = BsFacture;
        }
Beispiel #4
0
 private void btnConfirmer_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tbId.Text))
     {
         var nId = new G_t_facture(SChonn).Ajouter(dtpFacture.Value, Convert.ToInt32(cbEntre.SelectedItem), Convert.ToInt32(cbInte.SelectedItem));
         DtFacture.Rows.Add(nId, DtFacture, cbEntre.SelectedItem, cbInte.SelectedItem);
     }
     else
     {
         var            nId        = int.Parse(tbId.Text);
         C_t_interimeur interimeur = Interimeurs.Find(x => x.nom_inte == cbInte2.Text);
         C_t_entreprise entreprise = Entreprises.Find(x => x.nom_entre == cbEntre2.Text);
         new G_t_facture(SChonn).Modifier(nId, dtpFacture.Value, interimeur.id_inte, entreprise.id_entre);
         dgvFacture.SelectedRows[0].Cells["DateFact"].Value = DtFacture;
         dgvFacture.SelectedRows[0].Cells["IdEntre"].Value  = cbEntre.Text;
         dgvFacture.SelectedRows[0].Cells["IdInte"].Value   = cbInte.Text;
         BsFacture.EndEdit();
         Activer(true);
     }
     RefreshDgv();
     ClearTb();
 }
        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 !");
            }
        }
        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();
        }