Beispiel #1
0
        private void f_debiteur_Load(object sender, EventArgs e)
        {
            //lb_entreprise.Text = uf.ValeurParCond(comrealvista, "fact_entreprise entreprise left join " + Fmain.baseInit + ".client clidelta ON clidelta.idclient = entreprise.iddeltareal", "if (entreprise.iddeltareal > 0, concat(clidelta.socligne1, ' ', clidelta.socligne2), concat(entreprise.socligne1, ' ', entreprise.socligne2)) as entreprise", "entreprise", "identreprise = " + Fmain.identreprisesel);
            uf.initialisation(p_affiche);
            string sz = "SELECT idCity, zip, cityname FROM " + Fmain.baseInit + ".City ORDER BY Zip";

            comrealvista.CommandText = sz;
            MySqlDataReader myReader;

            myReader = comrealvista.ExecuteReader();
            while (myReader.Read())
            {
                npa.charger(myReader.GetValue(myReader.GetOrdinal("zip")).ToString(),
                            myReader.GetValue(myReader.GetOrdinal("cityname")).ToString(),
                            myReader.GetValue(myReader.GetOrdinal("idcity")).ToString());
                ville.charger(myReader.GetValue(myReader.GetOrdinal("cityname")).ToString(),
                              myReader.GetValue(myReader.GetOrdinal("zip")).ToString(),
                              myReader.GetValue(myReader.GetOrdinal("idcity")).ToString());
            }
            ville.drom.dataGridView1.Sort(ville.drom.dataGridView1.Columns[0], System.ComponentModel.ListSortDirection.Ascending);

            myReader.Close();

            uf.RemplirCombo(politesse, "SELECT politesse, idpolitesse FROM " + Fmain.baseInit + ".typepolitesse ORDER by idlangue, idpolitesse", comrealvista, mySqlDataAdapter1);

            reqdon = "select cli.idclient as refclient, socligne as raisonsociale, pol.idlangue as idlanguage, lang.language as language, " +
                     "cli.idpolitesse as idpolitesse, pol.politesse as politesse, cli.nom, cli.prenom, cli.co, " +
                     "cli.adresse1 as adresse1, cli.adresse2 as adresse2, city.zip as npa, city.cityname as ville, " +
                     "cli.idville as idville, cli.telpro as telpro, cli.telmob as telmob, " +
                     "cli.fax as fax, cli.email as email " +
                     "FROM fact_client cli " +
                     "LEFT join " + Fmain.baseInit + ".typepolitesse pol ON pol.idpolitesse = cli.idpolitesse LEFT join " + Fmain.baseInit + ".language lang ON lang.idlanguage = pol.idlangue " +
                     "left join " + Fmain.baseInit + ".city ON city.idcity = cli.idville " +
                     "ORDER BY idclient, nom, prenom, socligne";
            reqarch = reqdon.Replace("fact_client", "fact_clientarchive").Replace("select", "select cli.idarchive as refarchive, cli.datearchive, ");
            if (etatrech == 0 && etatajoutimport == 0)
            {
                affichedonnees(reqdon);
            }
            else if (etatajoutimport > 0)
            {
                recherche(false, "", ((f_importation)fImport).GetDonnee("socligne"), ((f_importation)fImport).GetDonnee("nom"), ((f_importation)fImport).GetDonnee("prenom"), "", ((f_importation)fImport).GetDonnee("zip"));
                //recherche noprenom, soclign si existe. Si resultat, remplir grille par recherche, sinon ajout
                if (gv_client.RowCount == 0)
                {
                    AfficherDonneesAjout(true);
                    bt_valider_Click(bt_valider, new EventArgs());
                }
                else
                {
                    AfficherDonneesAjout(false);
                }
            }
        }
        public int typemod = 0; //1=ajout 2=modif

        private void f_paiement_Load(object sender, EventArgs e)
        {
            uf.initialisation(p_frais);
            uf.initcontrol(p_frais, "");
            uf.enablecontrol(p_frais, "", false);
            uf.enablecontrol(p_payeur, "", false);
            typetransfert.SelectedIndex = 0;
            foreach (DataGridViewColumn dd in gv_import.Columns)
            {
                dd.ReadOnly = false;
            }
            ck_poste.Checked           = true;
            typepaiement.SelectedIndex = 0;
            if (typefen == 1) //liste paiement d'une facture sélectionnée.
            {
                gv_listepaiement.Visible = bt_pmodif.Visible = bt_psuppr.Visible = true;
                p_payeur.Visible         = true;
                bt_valid.Visible         = true;
                this.Height  = 520;
                bt_annul.Top = 435;
                string s = " select reffacturedeltareal as reffacture, montantapayer as totfacture, if(isnull(paie.totalpaye), 0, paie.totalpaye) as totalpaye, (montantapayer - if(isnull(paie.totalpaye), 0, paie.totalpaye)) as solde FROM fact_facturation fact LEFT JOIN (select sum(montant) as totalpaye, numfacture, identreprise FROM fact_paiement group by identreprise, numfacture) paie on paie.identreprise = fact.identreprise and paie.numfacture = fact.reffacturedeltareal WHERE fact.reffacturedeltareal ='" + numfact + "'";

                uf.afficherInfo(p_solde, s, comrech, null);
                chargerpaiement();
                bt_valid.Enabled = false;
                if (typemod == 1) // ajout paiement
                {
                    uf.enablecontrol(p_payeur, "", true);
                    uf.enablecontrol(p_frais, "", true);
                    bt_valid.Enabled = true;
                }
            }
            else
            {
                button1.Visible     = gv_import.Visible = bt_valider.Visible = bt_impsuppr.Visible = bt_impverif.Visible = true;
                bt_impverif.Enabled = bt_impsuppr.Enabled = false;
                uf.enablecontrol(p_frais, "", true);
            }
        }
Beispiel #3
0
        private void f_marchandises_Load(object sender, EventArgs e)
        {
            uf.initialisation(p_affiche);
            //remplir les combos
            //uf.RemplirCombo(client, "SELECT if (entreprise.iddeltareal > 0, concat(clidelta.socligne1, ' ', clidelta.socligne2), concat(entreprise.socligne1, ' ', entreprise.socligne2)) as entreprise, entreprise.identreprise FROM fact_entreprise entreprise left join " + Fmain.baseInit + ".client clidelta ON clidelta.idclient = entreprise.iddeltareal ORDER BY entreprise.identreprise ", comrealvista, mySqlDataAdapter1);
            lb_entreprise.Text = uf.ValeurParCond(comrealvista, "fact_entreprise entreprise left join " + Fmain.baseInit + ".client clidelta ON clidelta.idclient = entreprise.iddeltareal", "if (entreprise.iddeltareal > 0, concat(clidelta.socligne1, ' ', clidelta.socligne2), concat(entreprise.socligne1, ' ', entreprise.socligne2)) as entreprise", "entreprise", "identreprise = " + Fmain.identreprisesel);
            uf.RemplirCombo(unite, "SELECT unitecode, unitelibelle, idunite FROM fact_unite ORDER BY unitecode", comrealvista, mySqlDataAdapter1);
            reqdon = "select idarticle, codearticle, descriptif_ligne1, descriptif_ligne2, descriptif_ligne3, descriptif_ligne4, descriptif_ligne5, " +
                     "remarque, concat(unitecode, ' ', unitelibelle) as unite, fact_unite.idunite as idunite FROM fact_articles " +
                     //"LEFT JOIN fact_entreprise entreprise ON entreprise.identreprise = fact_articles.identreprise AND entreprise.identreprise =" + Fmain.identreprisesel + " " +
                     //"left join " + Fmain.baseInit + ".client clidelta ON clidelta.idclient = entreprise.iddeltareal " +
                     "LEFT JOIN fact_unite ON fact_unite.idunite = fact_articles.idunite WHERE fact_articles.identreprise =" + Fmain.identreprisesel + " ORDER BY codearticle";
            //uf.afficherInfo(this, reqdon, comrealvista, gv_article, "");

            //if (gv_article.RowCount > 0)
            //    uf.afficherInfo(this, reqdon.Replace("ORDER", "WHERE idarticle =" + gv_article.Rows[0].Cells["g_idarticle"].Value.ToString() + " ORDER"), comrealvista, null, "");
            affichedonnees();
            //uf.enablecontrol(p_affiche, "2", false);
            //uf.enablemulticontrol(p_button, "1", "2,3");
        }
Beispiel #4
0
        private void f_client_Load(object sender, EventArgs e)
        {
            uf.initialisation(p_client);
            string sz = "SELECT idCity, zip, cityname FROM " + Fmain.baseInit + ".City ORDER BY Zip";

            comrealvista.CommandText = sz;
            MySqlDataReader myReader;

            myReader = comrealvista.ExecuteReader();
            while (myReader.Read())
            {
                npa.charger(myReader.GetValue(myReader.GetOrdinal("zip")).ToString(),
                            myReader.GetValue(myReader.GetOrdinal("cityname")).ToString(),
                            myReader.GetValue(myReader.GetOrdinal("idcity")).ToString());
                ville.charger(myReader.GetValue(myReader.GetOrdinal("cityname")).ToString(),
                              myReader.GetValue(myReader.GetOrdinal("zip")).ToString(),
                              myReader.GetValue(myReader.GetOrdinal("idcity")).ToString());
            }
            ville.drom.dataGridView1.Sort(ville.drom.dataGridView1.Columns[0], System.ComponentModel.ListSortDirection.Ascending);

            myReader.Close();


            uf.RemplirCombo(tauxtva, "SELECT idtva as idtauxtva, taux, desctva, concat(taux, '>', desctva) as tva FROM typetva order by idtva", comrealvista, mySqlDataAdapter1);
            uf.RemplirCombo(monnaie, "SELECT idmonnaie, monnaie FROM fact_monnaie ORDER by (idmonnaie='F') DESC", comrealvista, mySqlDataAdapter1);
            uf.RemplirCombo(politesse, "SELECT politesse, idpolitesse FROM " + Fmain.baseInit + ".typepolitesse ORDER by idlangue, idpolitesse", comrealvista, mySqlDataAdapter1);
            //uf.RemplirCombo(compte, "SELECT codecompte, idcompte FROM " + Fmain.baseInit + ".cpta_compte where codecompte like '25%' AND length(codecompte) > 3 ORDER BY codecompte ", comrealvista, mySqlDataAdapter1);
            //uf.remplircombo(language, comrealvista, "SELECT language, idlanguage FROM " + Fmain.baseInit + ".language ORDER by idlanguage");
            reqdon = Fmain.reqdoncli;

            uf.afficherInfo(this, reqdon, comrealvista, g_client, "");
            annule();

            /*
             * //sz = sz.Replace("ORDER", "WHERE idarticle =" + g_article.Rows[0].Cells["g_idarticle"].Value.ToString() + " ORDER");
             * if (g_client.RowCount > 0)
             * {
             *  uf.afficherInfo(p_client, reqdon.Replace("ORDER", "WHERE client.identreprise =" + g_client.Rows[0].Cells["g_refentreprise"].Value.ToString() + " ORDER"), comrealvista, null, "");
             *  chargertypeadr(false, g_client.Rows[0].Cells["g_refentreprise"].Value.ToString(), "");
             *  if (l_adresses.Items.Count > 0)
             *  {
             *      l_adresses.SelectedIndex = 0;
             *      afficheadresse(g_client.Rows[0].Cells["g_refentreprise"].Value.ToString(), "");
             *  }
             *  affichefrais(g_client.CurrentRow.Cells["g_refentreprise"].Value.ToString());
             *  affichecommentaire(g_client.CurrentRow.Cells["g_refentreprise"].Value.ToString());
             * }
             * else
             * {
             *  uf.enablecontrol(p_adresse, "2", false);
             *  uf.enablecontrol(p_adresse, "4", false);
             *
             * }
             * //affichedonnees();
             * //uf.enablecontrol(p_affiche, "2", false);
             * //uf.enablemulticontrol(p_button, "1", "2,3");
             *
             * uf.enablemulticontrol(p_button, "1", "2");
             * uf.enablecontrol(p_client, "2", false);
             * uf.enablecontrol(p_client, "3", false);
             * uf.enablecontrol(p_client, "12", false);
             * uf.enablecontrol(p_client, "8", false);
             * pub.Enabled = false;
             * if (g_client.RowCount == 0)
             *  bt_modif.Enabled = bt_suppr.Enabled = false;*/
        }