Example #1
0
        public List <C_t_interimeur> Lire(string Index)
        {
            CreerCommande("Selectionnert_interimeur");
            Commande.Parameters.AddWithValue("@Index", Index);
            Commande.Connection.Open();
            SqlDataReader         dr  = Commande.ExecuteReader();
            List <C_t_interimeur> res = new List <C_t_interimeur>();

            while (dr.Read())
            {
                C_t_interimeur tmp = new C_t_interimeur();
                tmp.id_inte        = int.Parse(dr["id_inte"].ToString());
                tmp.nom_inte       = dr["nom_inte"].ToString();
                tmp.prenom_inte    = dr["prenom_inte"].ToString();
                tmp.specialisation = dr["specialisation"].ToString();
                tmp.bonus_sal      = double.Parse(dr["bonus_sal"].ToString());
                res.Add(tmp);
            }
            dr.Close();
            Commande.Connection.Close();
            return(res);
        }
Example #2
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();
        }