Example #1
0
        private void buttonAjout_Click(object sender, EventArgs e)
        {
            if (comboSelectVehicule.SelectedItem == null || textQuantite.Text == "" || comboSelectPiece.SelectedItem == null )
            {
                MessageBox.Show("Veuillez renseigner tous les champs");
            }
            else
            {
                //Pour remplir la listeView
                piecesManager pieceManage = new piecesManager();
                tvaManager tvaManage = new tvaManager();
                piece unePiece = pieceManage.unePiece(comboSelectPiece.SelectedItem.ToString());
                tva uneTva = tvaManage.uneTva();

                double prixTTC = (float)unePiece.getPrixHT() * (1 + (float)uneTva.getTaux() / 100);
                prixTTC = Math.Round(prixTTC, 2);
                double prixTotal = Convert.ToInt32(textQuantite.Text) * prixTTC;

                ListViewItem item = new ListViewItem(unePiece.getLibelle().ToString());
                item.SubItems.Add(textQuantite.Text);
                item.SubItems.Add(unePiece.getPrixHT().ToString());
                item.SubItems.Add(prixTTC.ToString());
                item.SubItems.Add(prixTotal.ToString());

                listPiece.Items.Add(item);

                textQuantite.Clear();
                comboSelectPiece.SelectedIndex = -1;
            }

            labelPrixTTC.Text = compteTotalTTC().ToString() + " €";
        }
Example #2
0
        private void buttonAjoutPiece_Click(object sender, EventArgs e)
        {
            if (textLibellePiece.Text == "" || textPrixHt.Text == "" || comboTva.SelectedItem == null )
            {
                MessageBox.Show("Veuillez remplir tous les champs.");
            }
            else
            {
                string libelle = textLibellePiece.Text;
                float prixHT = float.Parse(textPrixHt.Text);
                item itemSectionne = (item)comboTva.Items[comboTva.SelectedIndex];

                piece unePiece = new piece(0, (int)itemSectionne.Value, prixHT, libelle);

                piecesManager pieceManage = new piecesManager();
                pieceManage.ajoutPiece(unePiece);

                MessageBox.Show("Pièces ajoutée.");

                textLibellePiece.Clear();
                textPrixHt.Clear();
            }
        }
Example #3
0
        private void buttonEditer_Click(object sender, EventArgs e)
        {
            if (comboSelectVehicule.SelectedItem == null || listPiece.Items.Count <= 0)
            {
                MessageBox.Show("Veuillez remplir tous les champs");
            }
            else
            {
                //On créé un nouveau devis avec la date et l'immatriculation
                String laDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                String immat = comboSelectVehicule.SelectedItem.ToString();

                devis unDevis = new devis(0, laDate, immat);
                devisManager devisManage = new devisManager();

                //Id du dernier devis.
                long dernierId = devisManage.editeDevis(unDevis);

                foreach (ListViewItem unItem in listPiece.Items)
                {
                    //On récupere la quantité
                    int quantite = Convert.ToInt32(unItem.SubItems[1].Text);
                    //On créer une piece pour avoir l'id
                    piecesManager pieceManage = new piecesManager();
                    piece unePiece = pieceManage.unePiece(unItem.SubItems[0].Text.ToString());

                    repareManager repareManage = new repareManager();
                    repareManage.ajouteRepare((int)dernierId, unePiece.getId(), quantite);
                }
                MessageBox.Show("Le devis à été édité.");

                feuilleDevis feuilleDevis = new feuilleDevis((int)dernierId);
                this.Close();
                feuilleDevis.ShowDialog();
            }
        }
Example #4
0
        private void feuilleDevis_Load(object sender, EventArgs e)
        {
            //On recupère les infos client
            clientManager clientManage = new clientManager();
            client leClient = clientManage.getUnclient(idDevis);

            //On récupère la date
            devisManager devisManage = new devisManager();
            DateTime laDate = devisManage.getDate(idDevis);

            //On récupere l'immatriculation
            vehiculesManager vehiculeManage = new vehiculesManager();
            string immat = vehiculeManage.getImmat(idDevis);

            //On récupère la TVA
            tvaManager tvaManage = new tvaManager();
            tva laTva = tvaManage.uneTva();

            //On affiche les informartion du client
            labelNomClient.Text = leClient.getNom();
            labelPrenomClient.Text = leClient.getPrenom();
            labelAdresse1.Text = leClient.getAdr1();
            labelAdresse2.Text = leClient.getAdr2();
            labelCP.Text = leClient.getCP().ToString();
            labelVille.Text = leClient.getVille();

            //On affiche la date
            labelDate.Text = laDate.ToString();

            //on affiche l'immatriculation
            labelImmat.Text = immat;

            //On affiche la tva
            labelTauxTva.Text = laTva.getTaux().ToString() + "%";

            //On affiche la liste des pieces
            repareManager repareManage = new repareManager();
            List<repare> listeRepare = repareManage.getListeRepare(idDevis);
            foreach (repare uneReparation in listeRepare)
            {
                piecesManager pieceManage = new piecesManager();
                int idPiece = uneReparation.getPieceId();
                piece unePiece = pieceManage.getPiece(idPiece);

                double prixTTC = (float)unePiece.getPrixHT() * (1 + (float)laTva.getTaux() / 100);
                prixTTC = Math.Round(prixTTC, 2);

                double totalTTC = prixTTC * uneReparation.getQuantite();

                ListViewItem item = new ListViewItem(unePiece.getId().ToString());
                item.SubItems.Add(unePiece.getLibelle());
                item.SubItems.Add(uneReparation.getQuantite().ToString());
                item.SubItems.Add(unePiece.getPrixHT().ToString());
                item.SubItems.Add(prixTTC.ToString());
                item.SubItems.Add(totalTTC.ToString());

                listViewPiece.Items.Add(item);
            }

            labelTotalTTC.Text = calculTotalTTC().ToString() + " €";
        }
Example #5
0
        private void CreationDevis_Load(object sender, EventArgs e)
        {
            //Pour remplir le combobox des véhicules à réparer
            vehiculesManager vehiculeManage = new vehiculesManager();
            List<vehicules> lesVehicules = new List<vehicules>();
            lesVehicules = vehiculeManage.listeVehicules();

            tvaManager tvaManage = new tvaManager();
            tva laTva = tvaManage.uneTva();

            labelTauxTva.Text = laTva.getTaux() + " %";

            foreach (vehicules unVehicule in lesVehicules)
            {
                comboSelectVehicule.Items.Add(unVehicule.getImmat());
            }

            //Pour remplir le combobox des pieces
            piecesManager pieceManage = new piecesManager();
            List<piece> lesPieces = new List<piece>();
            lesPieces = pieceManage.listePiece();

            foreach (piece unePiece in lesPieces)
            {
                comboSelectPiece.Items.Add(unePiece.getLibelle());
            }
        }