public void Initialisation() { string reqrechart = ""; reqrechart = "SELECT article.idarticle as idcodearticle, codearticle, descriptif_ligne1, descriptif_ligne2, unitelibelle as unitecode, prix.idprix, if(isnull(rabais.idrabais), 0, rabais.idrabais) as idrabais, prix.prix, if(isnull(rabais.rabaispourcent), 0, rabais.rabaispourcent) as rabaispourcent, if(rabais.rabaispourcent > 0, prix.prix*rabais.rabaispourcent/100, if(isnull(rabais.rabaismontant), 0, rabais.rabaismontant)) as rabaismontant from fact_articles article " + "left join (select idprix, idarticleprix, prix, dateprix from fact_prix group by idarticleprix, idprix order by dateprix desc) prix on prix.idarticleprix = article.idarticle and prix.dateprix <= '" + string.Format("{0:yyyy-MM-dd}", datyfact) + "' " + "LEFT JOIN (Select idrabais, idarticlerabais, rabaismontant, rabaispourcent, daterabaisde, daterabaisa FROM fact_rabais group by idarticlerabais, idrabais order by daterabaisa desc) rabais ON rabais.idarticlerabais = article.idarticle AND '" + string.Format("{0:yyyy-MM-dd}", datyfact) + "' between rabais.daterabaisde and rabais.daterabaisa " + "INNER Join fact_unite unite ON unite.idunite = article.idunite "; if (edcode.Text.Trim() == "") { Ul.afficherInfo(null, reqrechart + " ORDER BY codearticle ", DeltaSQLCon, dgView); } else { if (first) { reqrechart += " WHERE article.codearticle = '" + edcode.Text.Trim() + "'"; } else { reqrechart += " WHERE codearticle LIKE '" + edcode.Text.Trim() + "%' ORDER BY codearticle LIKE '" + edcode.Text.Trim() + "%' desc, codearticle, descriptif_ligne1"; } Ul.afficherInfo(null, reqrechart, DeltaSQLCon, dgView); if (dgView.RowCount == 0) { edcode.Text = edcode.Text.Substring(0, 1); trouve = false; first = false; Initialisation(); } else if (dgView.RowCount == 1) { code = dgView.Rows[0].Cells["g_codearticle"].FormattedValue.ToString(); idcode = dgView.Rows[0].Cells["g_idcodearticle"].FormattedValue.ToString(); lib = dgView.Rows[0].Cells["g_descriptif_ligne1"].FormattedValue.ToString(); unite = dgView.Rows[0].Cells["g_unitecode"].FormattedValue.ToString(); prix = dgView.Rows[0].Cells["g_prix"].FormattedValue.ToString(); rabaismontant = dgView.Rows[0].Cells["g_rabaismontant"].FormattedValue.ToString(); rabaispourcent = dgView.Rows[0].Cells["g_rabaispourcent"].FormattedValue.ToString(); idrabais = dgView.Rows[0].Cells["g_idrabais"].FormattedValue.ToString(); idprix = dgView.Rows[0].Cells["g_idprix"].FormattedValue.ToString(); trouve = true; first = false; } else { this.Show(); trouve = false; first = false; } } //gv_City.Columns[3].Visible = 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); } }
private void annule() //affichage du client en cours { bt_recherche.Text = "recherche"; p_button.Enabled = true; refclient.Enabled = false; uf.enablecontrol(p_button, "2", false); uf.enablecontrol(p_button, "1", false); bt_ajout.Enabled = true; if (curligne > gv_client.RowCount - 1) { curligne = gv_client.RowCount - 1; } if (curligne > -1 && bt_recherche.Text == "recherche") { gv_client.Rows[curligne].Selected = true; gv_client.CurrentCell = gv_client.Rows[curligne].Cells[1]; } if (gv_client.RowCount > 0 && gv_client.CurrentRow.Index > -1) { uf.afficherInfo(p_affiche, reqdon.Replace("ORDER", "WHERE cli.idclient =" + gv_client.CurrentRow.Cells["g_refclient"].Value.ToString() + " ORDER"), comrealvista, null, ""); uf.enablemulticontrol(p_button, "1", "2"); } else { uf.initcontrol(p_affiche, "", raisonsociale); } p_button.Focus(); if (refclient.Text.Trim() != "") { valclient = prendrevaleurclient(); } uf.enablecontrol(p_affiche, "2", false); bt_recherche.Enabled = true; remplirarchive(); etat = 0; }
public void chargerclient(string cond) { gv_client.Visible = true; string 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 " + cond + " ORDER BY nom, prenom, socligne"; uf.afficherInfo(this, reqdon, comrealvistamod, gv_client, ""); }
private void chargerprix(string idarticle) { edprix.Text = ""; eddateprix.Value = DateTime.Now; edprix.Enabled = eddateprix.Enabled = false; bt_ajoutprix.Enabled = bt_supligne.Enabled = false; ajoutp = false; string sq = "SELECT idprix, prix, date_format(dateprix, '%d.%m.%Y') as dateprix FrOM fact_prix prix where idarticleprix =" + idarticle + " order by dateprix desc"; uf.afficherInfo(this, sq, comrealvista, gv_prix); eddateprix.Enabled = edprix.Enabled = false; if (gv_prix.RowCount > 0) { eddateprix.Enabled = edprix.Enabled = true; gv_prix_CellClick(gv_prix, new DataGridViewCellEventArgs(1, 0)); bt_ajoutprix.Enabled = bt_supligne.Enabled = true; } else { bt_ajoutprix.Enabled = true; } //uf.RemplirCombo(lprix, sq, comrealvista, mySqlDataAdapter1); }
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;*/ }