コード例 #1
0
        private void montantTrancheBE()
        {
            if (cmbTranche.SelectedValue != null & cmbPrestation.SelectedValue != null & txtMatricule.Text != null)
            {
                tranche = cmbTranche.SelectedValue.ToString();
                MontantTrancheBE mt = new MontantTrancheBE();
                mt.annee          = annee;
                mt.codeCatEleve   = categorie;
                mt.codePrestation = cmbPrestation.SelectedValue.ToString();
                mt.codeTranche    = cmbTranche.SelectedValue.ToString();

                mt = prestationBL.rechercherMontantTranche(mt);
                if (mt != null)
                {
                    txtMontant.Text      = Convert.ToString(mt.montant);
                    txtMontant.IsEnabled = false;
                }
                else
                {
                    MessageBox.Show("Cette tranche n'est pas definie pour cette categorie");
                    txtMontant.Text = "";
                    cmbTranche.Text = "";
                }
            }
            else
            {
                txtMontant.IsEnabled = true;
            }
        }
コード例 #2
0
        private List <LignePrestation> chargerGrid()
        {
            AppartenirBE            app         = new AppartenirBE();
            MontantTrancheBE        mt          = new MontantTrancheBE();
            List <LignePrestation>  liste       = new List <LignePrestation>();
            List <MontantTrancheBE> alltranches = new List <MontantTrancheBE>();

            totalAPayer = 0;
            totalVerse  = 0;
            CultureInfo elGR = CultureInfo.CreateSpecificCulture("el-GR");

            alltranches = prestationBL.listerSuivantCritereMontanttranches("codecateleve = " + "'" + categorie + "' and annee = " + "'" + annee + "'");
            foreach (MontantTrancheBE m in alltranches)
            {
                totalAPayer += m.montant;
            }
            //totalAPayer += (double)fraisInscription;

            payers = prestationBL.listerSuivantCriterePayer("matricule = " + "'" + matricule + "' and annee =" + "'" + annee + "'");
            foreach (PayerBE payer in payers)
            {
                app           = new AppartenirBE();
                app.matricule = payer.matricule;
                app.annee     = payer.annee;
                app           = prestationBL.rechercherCategorie(app);

                mt                = new MontantTrancheBE();
                mt.annee          = payer.annee;
                mt.codeCatEleve   = app.codeCatEleve;
                mt.codePrestation = payer.codePrestation;
                mt.codeTranche    = payer.codeTranche;
                mt                = prestationBL.rechercherMontantTranche(mt);

                if (payer.observation == TRANCHE_INCOMPLET)
                {
                    liste.Add(new LignePrestation(payer.codePrestation, payer.codeTranche, (decimal)payer.montant, payer.observation, (decimal)(mt.montant - payer.montant - Convert.ToDouble(payer.remise)),
                                                  payer.remise, payer.datePaiement.ToShortDateString()));
                }
                else
                {
                    liste.Add(new LignePrestation(payer.codePrestation, payer.codeTranche, (decimal)payer.montant, payer.observation, 0,
                                                  payer.remise, payer.datePaiement.ToShortDateString()));
                }
                totalVerse  += payer.montant;
                totalAPayer -= Convert.ToDouble(payer.remise);
            }

            resteAPayer = totalAPayer - totalVerse;

            txtTotal.Text       = totalAPayer.ToString("0,0", elGR);
            txtTotalVerse.Text  = totalVerse.ToString("0,0", elGR);
            txtResteAPayer.Text = (totalAPayer - totalVerse).ToString("0,0", elGR);

            //txtReste.Text = "0";

            return(liste);
        }
コード例 #3
0
        private void gestionDispense()
        {
            double montantDispense = Convert.ToDouble(txtRemise.Text);

            matricule = txtMatricule.Text.ToString();
            login     = Ecole.UI.ConnexionUI.utilisateur.login;
            PayerBE payerBE;

            bool b = true;
            // on recherche dans la bd à la fois les tranches non complètement payées et les tranches qui n'ont pas encore commencé à être payées
            List <PayerBE>   listes = prestationBL.listerTrancheNonPayees(categorie, matricule, annee);
            MontantTrancheBE t      = new MontantTrancheBE();

            if (listes != null)
            {
                PayerBE p = new PayerBE();

                foreach (PayerBE pa in listes)
                {
                    if (b == true)
                    {
                        t.codeCatEleve   = categorie;
                        t.codePrestation = pa.codePrestation;
                        t.codeTranche    = pa.codeTranche;
                        t.annee          = pa.annee;
                        t = prestationBL.rechercherMontantTranche(t);
                        if (montantDispense >= (t.montant - pa.montant - Convert.ToDouble(pa.remise)))
                        {
                            payerBE = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, pa.montant,
                                                  dpiDateOp.SelectedDate.Value, annee, TRANCHE_COMPLET, Convert.ToDecimal(t.montant - pa.montant));
                            p = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, 0,
                                            dpiDateOp.SelectedDate.Value, annee, TRANCHE_COMPLET, Convert.ToDecimal(t.montant - pa.montant - (double)pa.remise));
                            if (prestationBL.modifierPayer(payerBE, p))
                            {
                                payers.Add(payerBE);
                            }
                            montantDispense -= (t.montant - pa.montant - Convert.ToDouble(pa.remise));
                        }
                        else
                        {
                            if (montantDispense > 0)
                            {
                                payerBE = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, pa.montant, dpiDateOp.SelectedDate.Value, annee, TRANCHE_INCOMPLET, pa.remise + Convert.ToDecimal(montantDispense));
                                p       = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, 0, dpiDateOp.SelectedDate.Value, annee, TRANCHE_INCOMPLET, Convert.ToDecimal(montantDispense));
                                if (prestationBL.modifierPayer(payerBE, p))
                                {
                                    payers.Add(payerBE);
                                }
                            }
                            montantDispense = 0;
                            b = false;
                        }
                    }
                }
            }
        }
コード例 #4
0
 private void grdTranches_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (grdTranches.SelectedIndex >= 0)
     {
         ancien_mt                     = montantTranches.ElementAt(grdTranches.SelectedIndex);
         txtMontant.Text               = Convert.ToString(ancien_mt.montant);
         cmbCategorie.SelectedIndex    = cmbCategorie.Items.IndexOf(ancien_mt.codeCatEleve);
         cmbPrestation.SelectedIndex   = cmbPrestation.Items.IndexOf(ancien_mt.codePrestation);
         cmbTranche.SelectedIndex      = cmbTranche.Items.IndexOf(ancien_mt.codeTranche);
         txtAnneeScolaire.Text         = (ancien_mt.annee - 1).ToString();
         dpiDelaiPaiement.Text         = ancien_mt.delai.Date.ToShortDateString();
         dpiDelaiPaiement.SelectedDate = ancien_mt.delai.Date;
         doubleclick                   = true;
         grdTranches.UnselectAll();
     }
 }
コード例 #5
0
        private void cmdValider_Click(object sender, RoutedEventArgs e)
        {
            if (validerFormulaire())
            {
                categorie  = cmbCategorie.SelectedValue.ToString();
                prestation = cmbPrestation.SelectedValue.ToString();
                tranche    = cmbTranche.SelectedValue.ToString();
                montant    = Convert.ToDouble(txtMontant.Text);
                date       = dpiDelaiPaiement.SelectedDate.Value.Date;
                MontantTrancheBE m = new MontantTrancheBE(tranche, categorie, prestation, montant, annee, date);

                if (doubleclick)//c'est une modification
                {
                    //suppression de l'ancienne valeur
                    montantTrancheBL.supprimerMontantTranche(ancien_mt);
                    montantTranches.Remove(ancien_mt);
                    grdTranches.Items.Refresh();
                    doubleclick = false;
                }

                if (montantTrancheBL.rechercherMontantTranche(m) == null)
                {
                    if (montantTrancheBL.enregistrerMontantTranche(m))
                    {
                        MessageBox.Show("Montant de la tranche enregistré avec succès", "School brain : Confirmation");
                        cmbTranche.Text         = "";
                        txtMontant.Text         = "";
                        montantTranches         = montantTrancheBL.listerSuivantCritereMontantTranche("annee = " + "'" + annee + "'");
                        grdTranches.ItemsSource = montantTranches;
                    }
                    else
                    {
                        MessageBox.Show("Montant de la tranche non enregistré", "School brain : Alerte");
                    }
                }
                else
                {
                    MessageBox.Show("Element deja enregistrer, pour les modifications double cliquer sur la ligne correspondante", "School brain : Alerte");
                }
            }
            else
            {
                MessageBox.Show("Formulaire non valide, renseigner tous les champs", "School brain : Alerte");
            }
        }
コード例 #6
0
 private void grdTranches_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         if (MessageBox.Show("Voulez vous supprimer?", "School : Confirmation", System.Windows.MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             if (grdTranches.SelectedIndex != -1)
             {
                 MontantTrancheBE mt = new MontantTrancheBE();
                 mt = montantTranches.ElementAt(grdTranches.SelectedIndex);
                 montantTrancheBL.supprimerMontantTranche(mt);
                 montantTranches.Remove(mt);
                 grdTranches.ItemsSource = montantTranches;
                 grdTranches.Items.Refresh();
             }
             else
             {
                 MessageBox.Show("Aucune ligne sélectionnée", "School brain:Alerte");
             }
         }
     }
 }
コード例 #7
0
        public MontantTrancheUI()
        {
            InitializeComponent();
            dpiDelaiPaiement.SelectedDate       = DateTime.Today;
            dpiDelaiPaiement.IsTodayHighlighted = true;
            dpiDelaiPaiement.Text = DateTime.Today.Date.ToShortDateString();

            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "yyyy-MM-dd";
            Thread.CurrentThread.CurrentCulture = ci;

            ancien_mt        = new MontantTrancheBE();
            categories       = new List <string>();
            prestations      = new List <string>();
            tranches         = new List <string>();
            doubleclick      = false;
            montantTrancheBL = new GestionMontantTrancheBL();
            montantTranches  = new List <MontantTrancheBE>();

            annee       = montantTrancheBL.anneeEnCours();
            categories  = montantTrancheBL.listerValeurColonneCategorieEleve("codecateleve");
            prestations = montantTrancheBL.listerValeurColonnePrestation("codeprestation");
            prestations.Remove(INSCRIPTION);
            tranches        = montantTrancheBL.listerValeurColonneTranche("codetranche");
            montantTranches = montantTrancheBL.listerSuivantCritereMontantTranche("annee = " + "'" + annee + "'");

            txtAnnee.Text               = " / " + annee;
            txtAnneeScolaire.Text       = (annee - 1).ToString();
            cmbCategorie.ItemsSource    = categories;
            cmbCategorie.SelectedIndex  = 0;
            cmbPrestation.ItemsSource   = prestations;
            cmbPrestation.SelectedIndex = 0;
            cmbTranche.ItemsSource      = tranches;
            cmbTranche.SelectedIndex    = 0;
            grdTranches.DataContext     = this;
            grdTranches.ItemsSource     = montantTranches;
        }
コード例 #8
0
 internal MontantTrancheBE rechercherMontantTranche(MontantTrancheBE m)
 {
     return(montantTrancheDA.rechercher(m));
 }
コード例 #9
0
 internal MontantTrancheBE rechercherMontantTranche(MontantTrancheBE t)
 {
     return(montanttrancheDA.rechercher(t));
 }
コード例 #10
0
        private void cmdValider_new_Click(object sender, RoutedEventArgs e)
        {
            if (cmbPrestation.SelectedValue == null || cmbPrestation.Text == "")
            {
                if (checkRemise.IsChecked == true)
                {
                    switch (cmbDispense.Text)
                    {
                    case REMISE:
                        MessageBox.Show("La réduction s'effectue sur une prestation, choisissez d'abord la prestation", "school brain:Alerte", MessageBoxButton.OK, MessageBoxImage.Information);
                        break;

                    case BOURSE:
                        gestionDispense();
                        break;
                    }
                }
            }
            else
            {
                if (txtMontant.Text != "")
                {
                    string codeprestation            = cmbPrestation.SelectedValue.ToString();
                    double remise                    = 0;
                    List <MontantTrancheBE> tranches = new List <MontantTrancheBE>();
                    montant        = Convert.ToDouble(txtMontant.Text);
                    matricule      = txtMatricule.Text.ToString();
                    codeprestation = cmbPrestation.SelectedValue.ToString();
                    login          = Ecole.UI.ConnexionUI.utilisateur.login;
                    tranches       = prestationBL.listerSuivantCritereMontanttranches("codeprestation = " + "'" + codeprestation + "' and codecateleve = " + "'" + categorie + "' and annee = " + "'" + annee + "'");
                    PayerBE   payerBE;
                    double    frais;
                    CreerEtat etat = null;
                    TrancheBE trancheBE;
                    switch (codeprestation)
                    {
                        #region gestion de cas d'un depot
                    case "Depot":
                        if (checkRemise.IsChecked == true)
                        {
                            if (cmbDispense.Text == BOURSE)
                            {
                                gestionDispense();
                            }
                        }

                        // on recherche dans la bd à la fois les tranches non complètement payées et les tranches qui n'ont pas encore commencé à être payées
                        bool             b          = true;
                        List <PayerBE>   listes     = prestationBL.listerTrancheNonPayees(categorie, matricule, annee);
                        MontantTrancheBE t          = new MontantTrancheBE();
                        string           numerorecu = "";

                        if (listes != null)
                        {
                            PayerBE p = new PayerBE();

                            foreach (PayerBE pa in listes)
                            {
                                if (b == true)
                                {
                                    t.codeCatEleve   = categorie;
                                    t.codePrestation = pa.codePrestation;
                                    t.codeTranche    = pa.codeTranche;
                                    t.annee          = pa.annee;
                                    t = prestationBL.rechercherMontantTranche(t);
                                    if (montant >= (t.montant - pa.montant - Convert.ToDouble(pa.remise)))
                                    {
                                        payerBE = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, t.montant - Convert.ToDouble(pa.remise),
                                                              dpiDateOp.SelectedDate.Value, annee, TRANCHE_COMPLET, pa.remise);
                                        p = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, t.montant - pa.montant - Convert.ToDouble(pa.remise),
                                                        dpiDateOp.SelectedDate.Value, annee, TRANCHE_COMPLET, pa.remise);
                                        if (prestationBL.modifierPayer(payerBE, p))
                                        {
                                            payers.Add(payerBE);
                                            numerorecu = prestationBL.rechercherNumeroPayer(payerBE);
                                        }
                                        montant -= (t.montant - pa.montant - Convert.ToDouble(pa.remise));
                                    }
                                    else
                                    {
                                        if (montant > 0)
                                        {
                                            payerBE = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, (pa.montant + montant), dpiDateOp.SelectedDate.Value, annee, TRANCHE_INCOMPLET, pa.remise);
                                            p       = new PayerBE(pa.matricule, login, pa.codePrestation, pa.codeTranche, montant, dpiDateOp.SelectedDate.Value, annee, TRANCHE_INCOMPLET, pa.remise);

                                            if (prestationBL.modifierPayer(payerBE, p))
                                            {
                                                payers.Add(payerBE);
                                                if (numerorecu == "")
                                                {
                                                    numerorecu = prestationBL.rechercherNumeroPayer(payerBE);
                                                }
                                            }
                                        }
                                        montant = 0;
                                        b       = false;
                                    }
                                }
                            }

                            //enregistrement du versement
                            //prestationBL.enregistrer_versement(matricule, "Opération de dépot d'argent pour les frais de : " + cmbPrestation.Text, (Convert.ToDouble(txtMontant.Text) - montant ),
                            //    dpiDateOp.SelectedDate.Value, annee);
                        }
                        lignes = chargerGrid();
                        etat   = new CreerEtat("Paiement_prestation" + matricule + DateTime.Today.ToShortDateString(), "Reçu de versement N° " + numerorecu + "\nDate " + dpiDateOp.SelectedDate.Value);
                        etat.factureDepot(Convert.ToDouble(txtMontant.Text), montant, totalAPayer, totalVerse, resteAPayer, eleve, cmbClasse.Text);
                        initialiser();
                        break;
                        #endregion

                        #region gestion d'un paiement normal d'une tranche
                    default:
                        if (checkRemise.IsChecked == true)
                        {
                            switch (cmbDispense.Text)
                            {
                            case REMISE:
                                gestionRemise();
                                break;

                            case BOURSE:
                                gestionDispense();
                                break;
                            }
                        }
                        else
                        {
                            if (cmbTranche.SelectedValue != null)
                            {
                                payerBE = new PayerBE(matricule, login, codeprestation, tranche, montant, dpiDateOp.SelectedDate.Value, annee, TRANCHE_COMPLET, 0);
                                if (prestationBL.rechercherPayer(payerBE) == null)
                                {
                                    if (prestationBL.ajouterAcheterPayer(payerBE))
                                    {
                                        trancheBE             = new TrancheBE();
                                        trancheBE.codetranche = payerBE.codeTranche;
                                        trancheBE             = prestationBL.rechercherTranche(trancheBE);
                                        etat = new CreerEtat("Paiement_prestation" + matricule + DateTime.Today.ToShortDateString(), "Reçu de paiement N° " + prestationBL.rechercherNumeroPayer(payerBE) + "\nDate " + dpiDateOp.SelectedDate.Value);
                                        etat.facturePrestation(payerBE, eleve, cmbClasse.Text, prestation.nomPrestation, 0, trancheBE.nomtranche);
                                        montant -= montant;

                                        //enregistrement du versement
                                        //prestationBL.enregistrer_versement(matricule, "Opération de dépot d'argent pour les frais de : " + cmbPrestation.Text, Convert.ToDouble(txtMontant.Text),
                                        //    dpiDateOp.SelectedDate.Value, annee);
                                    }
                                    else
                                    {
                                        MessageBox.Show("Enregistrement echoue");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Cette tranche a déjà été payée pour cet étudiant, pour modifier cliquer sur la ligne correspondante dans la grille du bas");
                                }
                            }
                            else
                            {
                                double m = montant;
                                numerorecu = "";
                                foreach (MontantTrancheBE mt in tranches)
                                {
                                    payerBE = new PayerBE(matricule, Ecole.UI.ConnexionUI.utilisateur.login, codeprestation, mt.codeTranche, mt.montant, dpiDateOp.SelectedDate.Value, annee, TRANCHE_COMPLET, Convert.ToDecimal(remise));
                                    if (prestationBL.ajouterAcheterPayer(payerBE))
                                    {
                                        if (numerorecu == "")
                                        {
                                            numerorecu = prestationBL.rechercherNumeroPayer(payerBE);
                                        }
                                        montant -= mt.montant;
                                    }
                                    else
                                    {
                                        MessageBox.Show("Enregistrement echoue");
                                    }
                                }

                                //enregistrement du versement
                                //prestationBL.enregistrer_versement(matricule, "Opération de dépot d'argent pour les frais de : " + cmbPrestation.Text, Convert.ToDouble(txtMontant.Text),
                                //    dpiDateOp.SelectedDate.Value, annee);

                                etat = new CreerEtat("Paiement_prestation" + matricule + DateTime.Today.ToShortDateString(), "Reçu de paiement N° " + numerorecu + "\nDate " + dpiDateOp.SelectedDate.Value);
                                etat.facturePrestation(prestation, eleve, cmbClasse.Text, m, remise);
                            }
                        }
                        initialiser();
                        break;
                        #endregion
                    }
                }
                else
                {
                    MessageBox.Show("Veuillez renseigner le montant!", "school brain:Alerte", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            //enregistrement du versement
            prestationBL.enregistrer_versement(matricule, "Opération de dépot d'argent pour les frais de : " + cmbPrestation.Text, (Convert.ToDouble(txtMontant.Text) - montant),
                                               dpiDateOp.SelectedDate.Value, annee);

            txtReste.Text = montant.ToString();
            lignes.Clear();
            lignes = chargerGrid();
            grdStatus.ItemsSource = lignes;
            grdStatus.Items.Refresh();

            txtMontant.Clear();
            cmbTranche.Text = "";
        }