Пример #1
0
        private void Btn_Sauvegarder_Click(object sender, RoutedEventArgs e)
        {
            if (OpererFactureController.LaFacture.LeClient == null)
            {
                System.Windows.MessageBox.Show("Vous devez assigner un client à la facture avant de la soumettre.");
            }
            if (OpererFactureController.LaFacture.LstProduitFacture.Count() == 0)
            {
                System.Windows.MessageBox.Show("Vous devez ajouter un produit avant de sauvegarder.");
            }
            else
            {
                //OpererFactureController.LaFacture.Date = DateTime.Now;
                Facture f = new Facture(OpererFactureController.LaFacture.LeClient, DateTime.Now, OpererFacture.Gabarit);
                //HibernateFactureService.Create(OpererFactureController.LaFacture);
                HibernateFactureService.Create(f);
                f.LstProduitFacture = ConstruireFacture(OpererFactureController.LaFacture.LstProduitFacture.ToList(), f);
                //f.LstProduitFacture = OpererFactureController.LaFacture.LstProduitFacture;
                InsertProduitFacture(f.LstProduitFacture.ToList());


                OpererFactureController.MiseAJourInventaire();
                btnSauvegarder.IsEnabled = false;
            }
        }
Пример #2
0
        private void BtnConvertirPdf_Click(object sender, RoutedEventArgs e)
        {
            if (OpererFactureController.LaFacture.LstProduitFacture.Count == 0)
            {
                System.Windows.MessageBox.Show("Vous devez ajouter un produit avant de générer un PDF.");
                return;
            }

            OpererFactureController.GenererPdf(OpererFacture.Gabarit.TitreGabarit, OpererFacture.Gabarit.Logo);
        }
Пример #3
0
 public static void RefreshAffichage()
 {
     TxtPrenom.Text       = "Prénom: " + OpererFactureController.LaFacture.LeClient.Prenom;
     TxtNom.Text          = "Nom: " + OpererFactureController.LaFacture.LeClient.Nom;
     TxtEscompte.Text     = "Escompte: " + OpererFactureController.LaFacture.LeClient.Rang.Escompte.ToString() + " %";
     TxtSousTotal.Text    = OpererFactureController.CalculerSousTotal().ToString("c2");
     TxtTPS.Text          = OpererFactureController.CalculerTps().ToString("c2");
     TxtTVQ.Text          = OpererFactureController.CalculerTvq().ToString("c2");
     TxtTotal.Text        = OpererFactureController.CalculerTotal().ToString("c2");
     TxtEscomptePrix.Text = OpererFactureController.CalculerEscompte(OpererFactureController.LaFacture.LeClient.Rang.Escompte).ToString("c2");
 }
Пример #4
0
        private void AjouteTablePied()
        {
            tablePied = new PdfPTable(2)
            {
                WidthPercentage = 100, SpacingBefore = 25
            };
            tablePied.DefaultCell.Padding             = 0;
            tablePied.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            tablePied.DefaultCell.Border = Rectangle.NO_BORDER;

            List <string> labels = new List <string> {
                "Sous-total", "Escompte", "TPS", "TVQ", "Total"
            };
            List <string> montants = new List <string>
            {
                OpererFactureController.CalculerSousTotal().ToString("0.00"),
                OpererFactureController.CalculerEscompte(facture.LeClient.Rang.Escompte).ToString("0.00"),
                OpererFactureController.CalculerTps().ToString("0.00"),
                OpererFactureController.CalculerTvq().ToString("0.00"),
                OpererFactureController.CalculerTotal().ToString("0.00")
            };

            for (int i = 0; i < 5; ++i)
            {
                PdfPCell cellLabel = new PdfPCell(new Phrase(labels[i]));
                cellLabel.Padding             = 5;
                cellLabel.HorizontalAlignment = Element.ALIGN_RIGHT;
                cellLabel.Border = Rectangle.NO_BORDER | Rectangle.BOTTOM_BORDER;
                tablePied.AddCell(cellLabel);

                PdfPCell cellMontant = new PdfPCell(new Phrase($"{montants[i]} $"));
                cellMontant.Padding             = 5;
                cellMontant.HorizontalAlignment = Element.ALIGN_RIGHT;
                cellMontant.Border = Rectangle.NO_BORDER | Rectangle.BOTTOM_BORDER;
                tablePied.AddCell(cellMontant);
            }

            document.Add(tablePied);
        }