コード例 #1
0
        /// <summary>
        /// Exécute le calcul des pièces
        /// </summary>
        /// <returns>Le montant total des pièces</returns>
        private double CalculPieces()
        {
            /* Récupération des données */
            if (String.IsNullOrEmpty(txtP2.Text))
            {
                nbP2 = 0;
            }
            else
            {
                nbP2 = double.Parse(txtP2.Text);;
            }
            if (String.IsNullOrEmpty(txtP1.Text))
            {
                nbP1 = 0;
            }
            else
            {
                nbP1 = double.Parse(txtP1.Text);;
            }
            if (String.IsNullOrEmpty(txtP050.Text))
            {
                nbP050 = 0;
            }
            else
            {
                nbP050 = double.Parse(txtP050.Text);;
            }
            if (String.IsNullOrEmpty(txtP020.Text))
            {
                nbP020 = 0;
            }
            else
            {
                nbP020 = double.Parse(txtP020.Text);;
            }
            if (String.IsNullOrEmpty(txtP010.Text))
            {
                nbP010 = 0;
            }
            else
            {
                nbP010 = double.Parse(txtP010.Text);;
            }
            if (String.IsNullOrEmpty(txtP005.Text))
            {
                nbP005 = 0;
            }
            else
            {
                nbP005 = double.Parse(txtP005.Text);;
            }
            if (String.IsNullOrEmpty(txtP002.Text))
            {
                nbP002 = 0;
            }
            else
            {
                nbP002 = double.Parse(txtP002.Text);;
            }
            if (String.IsNullOrEmpty(txtP001.Text))
            {
                nbP001 = 0;
            }
            else
            {
                nbP001 = double.Parse(txtP001.Text);;
            }

            /* Calcul */
            double totalP2   = P2.Total(nbP2);
            double totalP1   = P1.Total(nbP1);
            double totalP050 = P050.Total(nbP050);
            double totalP020 = P020.Total(nbP020);
            double totalP010 = P010.Total(nbP010);
            double totalP005 = P005.Total(nbP005);
            double totalP002 = P002.Total(nbP002);
            double totalP001 = P001.Total(nbP001);

            double totalPieces = totalP1 + totalP2 + totalP050 + totalP020 + totalP010 + totalP005 + totalP002 + totalP001;

            /* Affichage */
            txtTotalP2.Text     = totalP2.ToString("0.00");
            txtTotalP1.Text     = totalP1.ToString("0.00");
            txtTotalP050.Text   = totalP050.ToString("0.00");
            txtTotalP020.Text   = totalP020.ToString("0.00");
            txtTotalP010.Text   = totalP010.ToString("0.00");
            txtTotalP005.Text   = totalP005.ToString("0.00");
            txtTotalP002.Text   = totalP002.ToString("0.00");
            txtTotalP001.Text   = totalP001.ToString("0.00");
            txtTotalPieces.Text = totalPieces.ToString("0.00");

            return(totalPieces);
        }
コード例 #2
0
        /// <summary>
        /// Exécute le calcul des rouleaux
        /// </summary>
        /// <returns>Le montant total des rouleaux</returns>
        private double CalculRouleaux()
        {
            /* Récupération des données */
            if (String.IsNullOrEmpty(txtR2.Text))
            {
                nbR2 = 0;
            }
            else
            {
                nbR2 = double.Parse(txtR2.Text);;
            }
            if (String.IsNullOrEmpty(txtR1.Text))
            {
                nbR1 = 0;
            }
            else
            {
                nbR1 = double.Parse(txtR1.Text);;
            }
            if (String.IsNullOrEmpty(txtR050.Text))
            {
                nbR050 = 0;
            }
            else
            {
                nbR050 = double.Parse(txtR050.Text);;
            }
            if (String.IsNullOrEmpty(txtR020.Text))
            {
                nbR020 = 0;
            }
            else
            {
                nbR020 = double.Parse(txtR020.Text);;
            }
            if (String.IsNullOrEmpty(txtR010.Text))
            {
                nbR010 = 0;
            }
            else
            {
                nbR010 = double.Parse(txtR010.Text);;
            }
            if (String.IsNullOrEmpty(txtR005.Text))
            {
                nbR005 = 0;
            }
            else
            {
                nbR005 = double.Parse(txtR005.Text);;
            }
            if (String.IsNullOrEmpty(txtR002.Text))
            {
                nbR002 = 0;
            }
            else
            {
                nbR002 = double.Parse(txtR002.Text);;
            }
            if (String.IsNullOrEmpty(txtR001.Text))
            {
                nbR001 = 0;
            }
            else
            {
                nbR001 = double.Parse(txtR001.Text);;
            }

            /* Calcul */
            double totalR2   = R2.Total(nbR2);
            double totalR1   = R1.Total(nbR1);
            double totalR050 = R050.Total(nbR050);
            double totalR020 = R020.Total(nbR020);
            double totalR010 = R010.Total(nbR010);
            double totalR005 = R005.Total(nbR005);
            double totalR002 = R002.Total(nbR002);
            double totalR001 = R001.Total(nbR001);

            double totalRouleaux = totalR2 + totalR1 + totalR050 + totalR020 + totalR010 + totalR005 + totalR002 + totalR001;

            /* Affichage */
            txtTotalR2.Text       = totalR2.ToString("0.00");
            txtTotalR1.Text       = totalR1.ToString("0.00");
            txtTotalR050.Text     = totalR050.ToString("0.00");
            txtTotalR020.Text     = totalR020.ToString("0.00");
            txtTotalR010.Text     = totalR010.ToString("0.00");
            txtTotalR005.Text     = totalR005.ToString("0.00");
            txtTotalR002.Text     = totalR002.ToString("0.00");
            txtTotalR001.Text     = totalR001.ToString("0.00");
            txtTotalRouleaux.Text = totalRouleaux.ToString("0.00");

            return(totalRouleaux);
        }
コード例 #3
0
        /// <summary>
        /// Exécute le calcul des billest
        /// </summary>
        /// <returns>Le montant total des billets</returns>
        private double CalculBillets()
        {
            /* Récupération des données */
            if (String.IsNullOrEmpty(txtB500.Text))
            {
                nbB500 = 0;
            }
            else
            {
                try { nbB500 = double.Parse(txtB500.Text); txtB500.BackColor = CouleurCellDefaut(); } catch { txtB500.BackColor = CouleurCellErreur(); }
            }
            if (String.IsNullOrEmpty(txtB200.Text))
            {
                nbB200 = 0;
            }
            else
            {
                try { nbB200 = double.Parse(txtB200.Text); txtB200.BackColor = CouleurCellDefaut(); } catch { txtB200.BackColor = CouleurCellErreur(); }
            }
            if (String.IsNullOrEmpty(txtB100.Text))
            {
                nbB100 = 0;
            }
            else
            {
                try { nbB100 = double.Parse(txtB100.Text); txtB100.BackColor = CouleurCellDefaut(); } catch { txtB100.BackColor = CouleurCellErreur(); }
            }
            if (String.IsNullOrEmpty(txtB50.Text))
            {
                nbB50 = 0;
            }
            else
            {
                nbB50 = double.Parse(txtB50.Text);
            }
            if (String.IsNullOrEmpty(txtB20.Text))
            {
                nbB20 = 0;
            }
            else
            {
                nbB20 = double.Parse(txtB20.Text);
            }
            if (String.IsNullOrEmpty(txtB10.Text))
            {
                nbB10 = 0;
            }
            else
            {
                nbB10 = double.Parse(txtB10.Text);
            }
            if (String.IsNullOrEmpty(txtB5.Text))
            {
                nbB5 = 0;
            }
            else
            {
                nbB5 = double.Parse(txtB5.Text);
            }

            /* Calcul */
            double totalB500    = B500.Total(nbB500);
            double totalB200    = B200.Total(nbB200);
            double totalB100    = B200.Total(nbB100);
            double totalB50     = B200.Total(nbB50);
            double totalB20     = B200.Total(nbB20);
            double totalB10     = B200.Total(nbB10);
            double totalB5      = B200.Total(nbB5);
            double totalBillets = totalB500 + totalB200 + totalB100 + totalB50 + totalB20 + totalB10 + totalB5;

            /* Affichage */
            txtTotalB500.Text    = totalB500.ToString("0.00");
            txtTotalB200.Text    = totalB200.ToString("0.00");
            txtTotalB100.Text    = totalB100.ToString("0.00");
            txtTotalB50.Text     = totalB50.ToString("0.00");
            txtTotalB20.Text     = totalB20.ToString("0.00");
            txtTotalB10.Text     = totalB10.ToString("0.00");
            txtTotalB5.Text      = totalB5.ToString("0.00");
            txtTotalBillets.Text = totalBillets.ToString("0.00");

            return(totalBillets);
        }