private void textBoxX2_TextChanged(object sender, EventArgs e) { if (textBoxX2.Text.Trim() != "") { buttonX6.Visible = true; string sql = "select distinct ID,code,libelle from " + table + " where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and code like '%" + textBoxX2.Text + "%'"; ds = met.recuperer_table(sql, table); listBox1.Items.Clear(); foreach (DataRow dr in ds.Tables[table].Rows) { listBox1.Items.Add(dr["libelle"]); } if (listBox1.Items.Count != 0) { listBox1.SelectedIndex = 0; listBox1.Visible = true; } else { listBox1.Visible = false; buttonX6.Visible = false; } } }
public void Init() { Double Vtimbre = 0, VtauxM = 0; string sql1 = "Select value From parametre where param ='Timbre'"; DataSet tmp1 = met.recuperer_table(sql1); if (tmp1.Tables[0].Rows.Count != 0) { Double.TryParse(tmp1.Tables[0].Rows[0].ItemArray[0] + "", out Vtimbre); } Timbre = Vtimbre; string sql = "Select value From parametre where param ='TauxMajoration'"; DataSet tmp = met.recuperer_table(sql); if (tmp.Tables[0].Rows.Count != 0) { double.TryParse(tmp.Tables[0].Rows[0].ItemArray[0] + "", out VtauxM); } tauxM = VtauxM; String sqlcc = "SELECT codecomptant FROM pnumste WHERE codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "'"; DataSet tmpcc = met.recuperer_table(sqlcc); if (tmpcc.Tables[0].Rows.Count != 0) { Code_Cli_Comptant = tmpcc.Tables[0].Rows[0][0] + ""; } }
private void Tcod_TextChanged(object sender, EventArgs e) { string req = "SELECT code,libelle FROM " + table + " where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and code like '%" + Tcod.Text + "%' and libelle like '%" + Tlib.Text + "%' order by code"; ds = met.recuperer_table(req, table); if (ds != null) { dataGridViewX1.DataSource = ds.Tables[table].DefaultView; } }
private void Connect_Load(object sender, EventArgs e) { DataSet ds = met.recuperer_table("Select * From ste order by code", "ste"); BindingSource bs = new BindingSource(ds, "ste"); Soc.DisplayMember = "libelle"; Soc.ValueMember = "code"; Exerc.DisplayMember = "libelle"; Exerc.ValueMember = "codee"; Soc.DataSource = bs; }
private void exercice_Load(object sender, EventArgs e) { //string req = "select * from exercice where codes='"+Program .Societe+"'"; string req = "select * from exercice where codes='" + xcodes + "' "; comboBoxEx1.DisplayMember = "codee"; comboBoxEx1.ValueMember = "codee"; BindingSource bs = new BindingSource(met.recuperer_table(req, "exercice"), "exercice"); comboBoxEx1.DataSource = bs; }
private void affiche() { String req = "SELECT * FROM secteura where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' Order by code "; ds = met.recuperer_table(req); if (ds.Tables[0].Rows.Count != 0) { textBox1.Text = ds.Tables[0].Rows[index].Field <Object>("code") + ""; textBox2.Text = ds.Tables[0].Rows[index].Field <Object>("libelle") + ""; } }
private void impfour_Load(object sender, EventArgs e) { String req2 = "SELECT * FROM famillefour where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' Order by code "; ds = met.recuperer_table(req2, "famillefour"); BindingSource bs2 = new BindingSource(ds, "famillefour"); cmbsec.ValueMember = "Code"; cmbsec.DisplayMember = "Libelle"; cmbsec.DataSource = bs2; cmbsec.SelectedIndex = -1; }
public MetierClient(String Code) { Codec = Code; metier met = Program.met; String sql = "SELECT * from client where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and code = '" + Code + "' "; DataSet ds = met.recuperer_table(sql, "client"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables["client"].Rows.Count != 0) { DataRow dr = ds.Tables["client"].Rows[0]; Double.TryParse(dr["remise"] + "", out RemiseFixeClient); Double.TryParse(dr["plafond"] + "", out PlafondCreditClient); RegimeClient = (Boolean)dr["regime"]; TimbreFactClient = (Boolean)dr["timbre"]; ExenorationClient = (Boolean)dr["exenoration"]; CumulRemiseClient = (Boolean)dr["cumulrem"]; NomC = dr["libelle"] + ""; adrc = dr["adrl"] + ""; Comptant = false; } } } }
private void buttonItem1_Click(object sender, EventArgs e) { modif = false; buttonX5.Visible = false; buttonX1.Visible = true; buttonX2.Visible = true; mytext1.ReadOnly = false; mytext2.ReadOnly = false; mytext2.Text = ""; mygrid1.Enabled = false; String req1 = "SELECT * FROM pnumste where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' "; ds1 = met.recuperer_table(req1, "pnumste"); if (ds1 != null) { if (ds1.Tables.Count != 0) { if (ds1.Tables[0].Rows.Count != 0) { index = ds1.Tables[0].Rows.Count - 1; } } } increment(); mytext2.Focus(); }
private void impcli_Load(object sender, EventArgs e) { act = true; string req0 = "Select * from Region where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' Order by code "; DataSet ds0 = met.recuperer_table(req0, "Region"); BindingSource bs0 = new BindingSource(ds0, "Region"); cmbreg.ValueMember = "Code"; cmbreg.DisplayMember = "Libelle"; cmbreg.DataSource = bs0; string req3 = "Select * from secteur where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' Order by code "; DataSet ds3 = met.recuperer_table(req3, "secteur"); BindingSource bs3 = new BindingSource(ds3, "secteur"); cmbs.ValueMember = "Code"; cmbs.DisplayMember = "Libelle"; cmbs.DataSource = bs3; String req2 = "SELECT * FROM familleclient where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' Order by code "; ds = met.recuperer_table(req2, "familleclient"); BindingSource bs2 = new BindingSource(ds, "familleclient"); cmbsec.ValueMember = "Code"; cmbsec.DisplayMember = "Libelle"; cmbsec.DataSource = bs2; cmbreg.SelectedIndex = -1; cmbs.SelectedIndex = -1; cmbsec.SelectedIndex = -1; act = false; }
public void load_contrat() { grd_contrat.Rows.Clear(); String sql = "SELECT * FROM Contrat Where CODEC = '" + cli.Codec + "' and fermer = false"; DataSet dsc = met.recuperer_table(sql); if (dsc.Tables.Count != 0) { int i = 0; foreach (DataRow dr in dsc.Tables[0].Rows) { grd_contrat.Rows.Add(); grd_contrat.Rows[i].Cells["CODE"].Value = dr["CODE"]; grd_contrat.Rows[i].Cells["IDC"].Value = dr["ID"]; grd_contrat.Rows[i].Cells["Fgarantie"].Value = dr["Fgarantie"]; grd_contrat.Rows[i].Cells["Favance"].Value = dr["Favance"]; grd_contrat.Rows[i].Cells["NUMFgarantie"].Value = dr["NUMFgarantie"]; grd_contrat.Rows[i].Cells["NUMFAvance"].Value = dr["NUMFAvance"]; grd_contrat.Rows[i].Cells["XTHT"].Value = dr["THT"]; grd_contrat.Rows[i].Cells["XTVA"].Value = dr["TVA"]; grd_contrat.Rows[i].Cells["XTTC"].Value = dr["TTC"]; grd_contrat.Rows[i].ReadOnly = true; i++; } } }
private void orgstk_Load(object sender, EventArgs e) { string req3 = "select code,libelle from famillearticle where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' "; DataSet ds3 = met.recuperer_table(req3, "famillearticle"); mygrid1.DataSource = ds3.Tables["famillearticle"].DefaultView; libelled.DisplayMember = "libelle"; libelled.ValueMember = "code"; string sql1 = "select * from depot where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codem = '" + Program.Magasin + "'"; DataSet dsa1 = met.recuperer_table(sql1, "depot"); BindingSource bs1 = new BindingSource(dsa1, "depot"); libelled.DataSource = bs1; libelled.DataPropertyName = "coded"; }
private void purge_Load(object sender, EventArgs e) { string req = "Select * from Nomtable"; ds = met.recuperer_table(req, "Nomtable"); checkedListBox1.Items.Clear(); foreach (DataRow dr in ds.Tables["Nomtable"].Rows) { checkedListBox1.Items.Add(dr.Field <object>("libelle")); } }
private void affiche() { String req = "SELECT * FROM compte where codes='" + Program.Societe + "' AND codee='" + Program.Exercice + "' Order by code"; ds = met.recuperer_table(req, "compte"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { textBox1.Text = ds.Tables[0].Rows[index].Field <Object>("code").ToString(); textBox2.Text = ds.Tables[0].Rows[index].Field <Object>("libelle").ToString(); textBox3.Text = ds.Tables[0].Rows[index].Field <Object>("adr") + ""; textBox4.Text = ds.Tables[0].Rows[index].Field <Object>("var") + ""; textBox5.Text = ds.Tables[0].Rows[index].Field <Object>("telfixe") + ""; textBox6.Text = ds.Tables[0].Rows[index].Field <Object>("telgsm") + ""; textBoxX6.Text = ds.Tables[0].Rows[index].Field <Object>("obs") + ""; try { textBoxX1.Text = ds.Tables[0].Rows[index].Field <decimal>("solde1").ToString("N3"); } catch { textBoxX1.Text = ""; } if (ds.Tables[0].Rows[index].Field <Object>("image") != null) { if (!ds.Tables[0].Rows[index].Field <Object>("image").Equals("")) { byte[] tmpbyte = (byte[])ds.Tables[0].Rows[index].Field <Object>("image"); System.IO.MemoryStream str1 = new System.IO.MemoryStream(tmpbyte); Image img = Image.FromStream(str1); Image_stream = tmpbyte; panel1.BackgroundImage = img; str1.Close(); } else { panel1.BackgroundImage = null; } } else { panel1.BackgroundImage = null; Image_stream = new byte[0]; } } } } }
private void util_Load(object sender, EventArgs e) { String req = "SELECT * FROM utilisateur where libelle != '" + xlibadmin + "'"; ds = met.recuperer_table(req); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { index = ds.Tables[0].Rows.Count - 1; affiche(); } else { //buttonX5.Visible; } } } buttonX5.Visible = true; buttonX1.Visible = false; buttonX2.Visible = false; buttonX3.Visible = false; buttonX4.Visible = false; textBox1.ReadOnly = true; textBox2.ReadOnly = true; PWD.ReadOnly = true; buttonX6.Visible = true; buttonX7.Visible = true; buttonX8.Visible = true; buttonX11.Visible = true; }
private void Tcod_TextChanged(object sender, EventArgs e) { string req = "select s.codea ,s.codea as code,a.libelle, a.libelle as Des ,d.libelle as depot ,g.libelle as gamme ,s.qtestk ,a.puht ,a.tva, g.codeg ,d.code as coded from article a ,artdep s ,gamme g , depot d where s.codes = '" + Program.Societe + "' and s.codee = '" + Program.Exercice + "' and s.codem = '" + Program.Magasin + "' and s.`codea` like '%" + Tcod.Text + "%' and a.codes=s.`codes` and a.codee=s.`codee` and s.`codes` = d.`codes` and s.`codee` = d.`codee` and s.`codem` = d.`codem` and s.`coded` = d.`code` and s.`codeg` = g.`codeg` and a.code=s.`codea` and s.`codea` = g.`codea` order by s.codea,g.libelle"; DataSet ds = met.recuperer_table(req, table); dataGridViewX1.Columns["a0"].Visible = false; dataGridViewX1.Columns["a1"].Visible = false; if (ds != null) { textBoxX1.Text = ds.Tables[0].Rows.Count.ToString(); dataGridViewX1.DataSource = ds.Tables[table].DefaultView; String lastnum = ""; foreach (DataGridViewRow dgr in dataGridViewX1.Rows) { string xcode = dgr.Cells["a0"].Value + ""; string xgamme = dgr.Cells["a3"].Value + ""; if (lastnum != xcode) { lastnum = xcode; } else { dgr.Cells["a8"].Value = ""; dgr.Cells["a9"].Value = ""; } if (xgamme == "Defaut") { dgr.Cells["a3"].Value = ""; } } } }
private void param_Load(object sender, EventArgs e) { String req = "SELECT * FROM parametre where codes='" + Program.Societe + "'"; ds = met.recuperer_table(req, "parametre"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { affiche(); buttonX1.Focus(); } } } }
private void pnumste_Load(object sender, EventArgs e) { String req = "SELECT * FROM pnumste where codes='" + Program.Societe + "' AND codee='" + Program.Exercice + "'"; ds = met.recuperer_table(req, "pnumste"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { index = ds.Tables[0].Rows.Count - 1; affiche(); buttonX1.Focus(); } } } }
private void propos_Load(object sender, EventArgs e) { String req = "SELECT * FROM propos "; ds = met.recuperer_table(req, "propos"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { index = ds.Tables[0].Rows.Count - 1; affiche(); buttonX1.Focus(); } } } }
public MetierRep(String Code) { this.CodeR = Code; metier met = Program.met; String sql = "SELECT * from rep where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and code = '" + Code + "' "; DataSet ds = met.recuperer_table(sql, "rep"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables["rep"].Rows.Count != 0) { DataRow dr = ds.Tables["rep"].Rows[0]; Double.TryParse(dr["taux"] + "", out TauxComRep); NomR = dr["libelle"] + ""; AdrR = dr["adrf"] + ""; } } } }
private void tva_Load(object sender, EventArgs e) { Program.desTfunction(this); String req = "SELECT * FROM tva"; ds = met.recuperer_table(req); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { index = ds.Tables[0].Rows.Count - 1; affiche(); } else { toolStripButton1_Click(sender, e); } } } }
public MetierFour(String Code) { metier met = Program.met; String sql = "SELECT * from four where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and code = '" + Code + "' "; DataSet ds = met.recuperer_table(sql, "four"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables["four"].Rows.Count != 0) { DataRow dr = ds.Tables["four"].Rows[0]; FodecFactFour = (Boolean)dr["fodecfact"]; TimbreFactFour = (Boolean)dr["timbre"]; Codec = dr["code"] + ""; Nomc = dr["libelle"] + ""; Adrc = dr["adrf"] + ""; } } } }
private void affiche() { String req = "SELECT * FROM modalite where codes='" + Program.Societe + "' Order by code "; ds = met.recuperer_table(req); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { textBox1.Text = ds.Tables[0].Rows[index].Field <Object>("code") + ""; textBox2.Text = ds.Tables[0].Rows[index].Field <Object>("libelle") + ""; textBox3.Text = ds.Tables[0].Rows[index].Field <Object>("Observation") + ""; } } } }
private void charger_lignefacture() { if (first) { dataGridViewX1.Rows[dataGridViewX1.Rows.Count - 1].Selected = true; } if (dataGridViewX1.SelectedRows.Count != 0) { // type Facture if (dataGridViewX1.SelectedRows[0].Cells["mode"].Value.Equals("D")) { string sqlfac = "Select montreg From eentc where codes = '" + Program.Societe + "' AND codee ='" + Program.Exercice + "' AND codem ='" + Program.Magasin + "' AND num = '" + dataGridViewX1.SelectedRows[0].Cells["num"].Value + "'"; DataSet tmpf = met.recuperer_table(sqlfac); if (tmpf != null) { if (tmpf.Tables.Count != 0) { if (tmpf.Tables[0].Rows.Count != 0) { double xmntreg = 0; double.TryParse(tmpf.Tables[0].Rows[0]["montreg"] + "", out xmntreg); if (xmntreg == 0) { buttonX2.Enabled = true; buttonX3.Enabled = true; } else { buttonX2.Enabled = false; buttonX3.Enabled = false; } } } } } else { string sqlfac = "Select montreg,mode From eentc where codes = '" + Program.Societe + "' AND codee ='" + Program.Exercice + "' AND codem ='" + Program.Magasin + "' AND num = '" + dataGridViewX1.SelectedRows[0].Cells["num"].Value + "'"; DataSet tmpf = met.recuperer_table(sqlfac); if (tmpf != null) { if (tmpf.Tables.Count != 0) { if (tmpf.Tables[0].Rows.Count != 0) { string xmode = tmpf.Tables[0].Rows[0]["mode"] + ""; double xmntreg = 0; double.TryParse(tmpf.Tables[0].Rows[0]["montreg"] + "", out xmntreg); if (xmntreg == 0) { buttonX2.Enabled = false; buttonX3.Enabled = true; } else { buttonX2.Enabled = false; if (xmode == "B") { buttonX3.Enabled = true; } else { buttonX3.Enabled = false; } } } } } } // Chargement ligne Facture string req1 = "select distinct l.num,l.codea, a.libelle , g.libelle as gamme , d.libelle as depot , l.qte , l.pu , l.tva ,l.taxe ,l.tvaf , l.rem , l.netht , l.netttc,l.codesa,l.ID from lentc l , article a , gamme g , depot d where l.codes='" + Program.Societe + "' and l.codee='" + Program.Exercice + "' and l.num= '" + dataGridViewX1.SelectedRows[0].Cells["num"].Value + "' and l.codem='" + Program.Magasin + "' and l.codea = a.code and l.codes= a.codes and l.codee= a.codee and l.codea = g.codea and l.codeg=g.codeg and l.codes=g.codes and l.codee=g.codee and l.coded= d.code and l.codes=d.codes and l.codee=d.codee and l.codem=d.codem "; DataSet ds1 = met.recuperer_table(req1, "lentc"); foreach (DataRow dr in ds1.Tables["lentc"].Rows) { if (dr["codesa"] != DBNull.Value) { string sql = "select libelle from sarticle where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codea= '" + dr["codea"] + "' and code = '" + dr["codesa"] + "'"; DataSet dtmp = met.recuperer_table(sql, "sarticle"); dr["libelle"] = dtmp.Tables[0].Rows[0][0]; dr["codea"] = DBNull.Value; dr["gamme"] = DBNull.Value; dr["depot"] = DBNull.Value; } } dataGridViewX2.DataSource = ds1.Tables["lentc"].DefaultView; } }
private void tarif_Load(object sender, EventArgs e) { Program.desTfunction(this); String req1 = "SELECT * FROM FamilleClient where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' Order by code "; DataSet ds1 = met.recuperer_table(req1, "FamilleClient"); BindingSource bs = new BindingSource(ds1, "FamilleClient"); comboBox1.ValueMember = "Code"; comboBox1.DisplayMember = "Libelle"; comboBox1.DataSource = bs; comboBox3.ValueMember = "Code"; comboBox3.DisplayMember = "Libelle"; comboBox3.DataSource = bs; String req2 = "SELECT * FROM FamilleArticle where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' Order by code "; DataSet ds2 = met.recuperer_table(req2, "FamilleArticle"); BindingSource bs2 = new BindingSource(ds2, "FamilleArticle"); comboBox2.ValueMember = "Code"; comboBox2.DisplayMember = "Libelle"; comboBox2.DataSource = bs2; comboBox4.ValueMember = "Code"; comboBox4.DisplayMember = "Libelle"; comboBox4.DataSource = bs2; comboBox1.SelectedIndex = -1; comboBox2.SelectedIndex = -1; comboBox3.SelectedIndex = -1; comboBox4.SelectedIndex = -1; libc.DisplayMember = "libelle"; libc.ValueMember = "code"; string sql1 = "select * from client where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' "; DataSet dsa1 = met.recuperer_table(sql1, "client"); BindingSource bs1 = new BindingSource(dsa1, "client"); libc.DataSource = bs1; libc.DataPropertyName = "codec"; liba.DisplayMember = "libelle"; liba.ValueMember = "code"; string sql2 = "select * from article where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' "; DataSet dsa2 = met.recuperer_table(sql2, "article"); BindingSource bsa2 = new BindingSource(dsa2, "article"); liba.DataSource = bsa2; liba.DataPropertyName = "codea"; String req3 = "SELECT codec,codea,qdeb,qfin,remisem,remiseq FROM tarif where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' order by codec,codea,qdeb "; DataSet ds3 = met.recuperer_table(req3, "tarif"); label2.Text = ds3.Tables[0].Rows.Count.ToString(); if (ds3 != null) { mygrid2.DataSource = ds3.Tables["tarif"].DefaultView; mygrid2.Columns["c8"].Visible = false; mygrid2.Columns["c9"].Visible = false; } }
private void orgclient_Load(object sender, EventArgs e) { string req3 = "select code,libelle from familleclient where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' "; DataSet ds3 = met.recuperer_table(req3, "familleclient"); mygrid1.DataSource = ds3.Tables["familleclient"].DefaultView; }
private void affiche() { string req = "SELECT * FROM four where codes='" + Program.Societe + "' AND codee='" + Program.Exercice + "' Order by code"; ds = met.recuperer_table(req, "four"); if (ds != null) { if (ds.Tables.Count != 0) { if (ds.Tables[0].Rows.Count != 0) { comboBox1.SelectedValue = ds.Tables[0].Rows[index].Field <Object>("codef"); textBox1.Text = ds.Tables[0].Rows[index].Field <Object>("code").ToString(); textBox2.Text = ds.Tables[0].Rows[index].Field <Object>("libelle").ToString(); textBox3.Text = ds.Tables[0].Rows[index].Field <Object>("adrl") + ""; textBox4.Text = ds.Tables[0].Rows[index].Field <Object>("adrf") + ""; textBox5.Text = ds.Tables[0].Rows[index].Field <Object>("adrm") + ""; textBox6.Text = ds.Tables[0].Rows[index].Field <Object>("telfixe") + ""; textBox7.Text = ds.Tables[0].Rows[index].Field <Object>("telgsm") + ""; textBox8.Text = ds.Tables[0].Rows[index].Field <Object>("fax") + ""; textBox9.Text = ds.Tables[0].Rows[index].Field <Object>("mf") + ""; textBox10.Text = ds.Tables[0].Rows[index].Field <Object>("telfixe1") + ""; textBox11.Text = ds.Tables[0].Rows[index].Field <Object>("telgsm1") + ""; textBox12.Text = ds.Tables[0].Rows[index].Field <Object>("fax1") + ""; textBoxX6.Text = ds.Tables[0].Rows[index].Field <Object>("obs") + ""; try { textBoxX1.Text = ds.Tables[0].Rows[index].Field <Decimal>("solde1").ToString("N3"); } catch { textBoxX1.Text = ""; } try { textBoxX2.Text = ds.Tables[0].Rows[index].Field <Decimal>("debit").ToString("N3"); } catch { textBoxX2.Text = ""; } try { textBoxX3.Text = ds.Tables[0].Rows[index].Field <Decimal>("credit").ToString("N3"); } catch { textBoxX3.Text = ""; } try { textBoxX5.Text = ds.Tables[0].Rows[index].Field <Decimal>("avoir").ToString("N3"); } catch { textBoxX5.Text = ""; } try { textBoxX4.Text = ds.Tables[0].Rows[index].Field <Decimal>("solde").ToString("N3"); } catch { textBoxX4.Text = ""; } if (ds.Tables[0].Rows[index].Field <Object>("image") != null) { if (!ds.Tables[0].Rows[index].Field <Object>("image").Equals("")) { byte[] tmpbyte = (byte[])ds.Tables[0].Rows[index].Field <Object>("image"); System.IO.MemoryStream str1 = new System.IO.MemoryStream(tmpbyte); Image img = Image.FromStream(str1); Image_stream = tmpbyte; panel1.BackgroundImage = img; str1.Close(); } else { panel1.BackgroundImage = null; } } else { panel1.BackgroundImage = null; Image_stream = new byte[0]; } Boolean bt = ds.Tables[0].Rows[index].Field <Boolean>("timbre"); if (bt) { radioButton3.Checked = true; } else { radioButton4.Checked = true; } Boolean btf = ds.Tables[0].Rows[index].Field <Boolean>("fodecfact"); if (btf) { radioButton1.Checked = true; } else { radioButton2.Checked = true; } } } } }
private void affiche() { String req = "SELECT * from " + table + " where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and type = '" + xtype + "' Order by code "; ds = met.recuperer_table(req, table); if (ds.Tables[0].Rows.Count != 0) { textBox1.Text = ds.Tables[0].Rows[index].Field <Object>("code") + ""; textBox2.Text = ds.Tables[0].Rows[index].Field <Object>("libelle") + ""; } }
private void buttonX3_Click(object sender, EventArgs e) { ds = new DataSet(); string sql = "select * from exercice where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "'"; met.recuperer_table(sql, ds, "exercice"); sql = "select * from ste where code='" + Program.Societe + "'"; met.recuperer_table(sql, ds, "ste"); sql = "SELECT * FROM entete where codes='" + Program.Societe + "'"; met.recuperer_table(sql, ds, "entete"); sql = "select * from magasin where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and code = '" + Program.Magasin + "'"; met.recuperer_table(sql, ds, "magasin"); sql = "select * from " + ent + " where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and num ='" + Nmvt + "'"; met.recuperer_table(sql, ds, "eentf"); sql = "select * from " + lent + " where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and num ='" + Nmvt + "'"; met.recuperer_table(sql, ds, "lentl"); sql = "select * from four where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' order by code"; met.recuperer_table(sql, ds, "client"); sql = "SELECT * FROM sarticle where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' "; met.recuperer_table(sql, ds, "sarticle"); sql = "SELECT * FROM gamme where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' "; met.recuperer_table(sql, ds, "gamme"); sql = "SELECT * FROM article WHERE codes='" + Program.Societe + "' AND codee='" + Program.Exercice + "' Order by code"; met.recuperer_table(sql, ds, "article"); if (xmodele == "PO" || xmodele == "") { if (typedition == "E" || typedition == "C") { EPME.rptedit.Ieditent ij = new EPME.rptedit.Ieditent(); ij.numero = numero; ij.ds = ds; ij.ShowDialog(); } else if (typedition == "F") { EPME.rptedit.Ieditfactf ij = new EPME.rptedit.Ieditfactf(); ij.numero = numero; ij.ds = ds; ij.ShowDialog(); } else if (typedition == "L") { sql = "select * from eente where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and num in(select numl from nbefacture where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and numf ='" + Nmvt + "')"; met.recuperer_table(sql, ds, "eentl"); sql = "select * from nbefacture where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and numf ='" + Nmvt + "'"; met.recuperer_table(sql, ds, "nbefacture"); sql = "select * from " + lent + " where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and num in(select numl from nbefacture where codes='" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem = '" + Program.Magasin + "' and numf ='" + Nmvt + "')"; met.recuperer_table(sql, ds, "lentl"); EPME.rptedit.Ieditfactfbl ij = new EPME.rptedit.Ieditfactfbl(); ij.numero = numero; ij.ds = ds; ij.ShowDialog(); } } else { // préimprimé } }
private void buttonX1_Click(object sender, EventArgs e) { progressBarX1.Value = 0; progressBarX1.Visible = true; string xnfact; decimal zmnt = 0, zttc = 0, zavr = 0, zreg = 0; string req = "Select ID,code,libelle,solde1 from client where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' order by code "; ds = met.recuperer_table(req, "client"); progressBarX1.Maximum = (ds.Tables["client"].Rows.Count) / 3; foreach (DataRow dr in ds.Tables["client"].Rows) { decimal xreg = 0, xttc = 0, xavr = 0, xttc1 = 0, xsld1 = 0; textBoxX1.Text = dr.Field <string>("code"); textBoxX2.Text = dr.Field <string>("libelle"); label1.Text = "Client"; this.Update(); try { xsld1 = dr.Field <Decimal>("solde1"); } catch { } string req1 = "Select Sum(totalttc) as totalttc from eentc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "' "; DataSet tmp1 = met.recuperer_table(req1, "eentc"); try { xttc += tmp1.Tables[0].Rows[0].Field <Decimal>("totalttc"); } catch { } string req2 = "Select Sum(totalttc) as totalttc from eentl where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "' and facture = false "; DataSet tmp2 = met.recuperer_table(req2, "eentl"); try { xttc1 += tmp2.Tables[0].Rows[0].Field <Decimal>("totalttc"); } catch { } string req3 = "Select Sum(totalttc) as totalttc from eentvc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "'"; DataSet tmp3 = met.recuperer_table(req3, "eentvc"); try { xavr += tmp3.Tables[0].Rows[0].Field <Decimal>("totalttc"); } catch { } string req4 = "Select Sum(mont) as mont from eregc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "'"; DataSet tmp4 = met.recuperer_table(req4, "eregc"); try { xreg += tmp4.Tables[0].Rows[0].Field <Decimal>("mont"); } catch { } String req5 = "Update Client Set debit = " + (xttc + xttc1) + ", credit = " + xreg + ", avoir = " + xavr + ", solde = " + ((xsld1 + xttc + xttc1) - (xavr + xreg)) + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and code='" + textBoxX1.Text + "'"; met.Execute(req5); progressBarX1.Value++; } string reqr = "Select ID,code,libelle,taux from rep where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' order by code "; ds = met.recuperer_table(reqr, "rep"); progressBarX1.Maximum = (ds.Tables["rep"].Rows.Count) / 3; foreach (DataRow dr in ds.Tables["rep"].Rows) { decimal xven = 0, xven1 = 0; double xtaux = 0, xcom = 0; textBoxX1.Text = dr.Field <string>("code"); textBoxX2.Text = dr.Field <string>("libelle"); label1.Text = "Représentant"; this.Update(); try { xtaux = dr.Field <double>("taux"); } catch { } string req1 = "Select Sum(totalht) as totalht from eentc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and coder='" + textBoxX1.Text + "' "; DataSet tmp1 = met.recuperer_table(req1, "eentc"); try { xven += tmp1.Tables[0].Rows[0].Field <Decimal>("totalht"); } catch { } string req2 = "Select Sum(totalht) as totalht from eentl where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and coder='" + textBoxX1.Text + "' and facture = false "; DataSet tmp2 = met.recuperer_table(req2, "eentl"); try { xven1 += tmp2.Tables[0].Rows[0].Field <Decimal>("totalht"); } catch { } xcom = (double)(xven + xven1) * (xtaux / 100); String req5 = "Update rep Set vente = " + (xven + xven1) + ", com = " + xcom + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and code='" + textBoxX1.Text + "'"; met.Execute(req5); progressBarX1.Value++; } string reqf = "Select ID,code,libelle,solde1 from four where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' order by code "; ds = met.recuperer_table(reqf, "four"); progressBarX1.Maximum += (ds.Tables["four"].Rows.Count) / 3; foreach (DataRow dr in ds.Tables["four"].Rows) { decimal wreg = 0, wttc = 0, wavr = 0, wttc1 = 0, wsld1 = 0; textBoxX1.Text = dr.Field <string>("code"); textBoxX2.Text = dr.Field <string>("libelle"); label1.Text = "Fournisseur"; this.Update(); try { wsld1 = dr.Field <Decimal>("solde1"); } catch { } string req1 = "Select Sum(totalttc) as totalttc from eentf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "' "; DataSet tmp1 = met.recuperer_table(req1, "eentf"); try { wttc += tmp1.Tables[0].Rows[0].Field <Decimal>("totalttc"); } catch { } string req2 = "Select Sum(totalttc) as totalttc from eente where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "' and facture = false "; DataSet tmp2 = met.recuperer_table(req2, "eente"); try { wttc1 += tmp2.Tables[0].Rows[0].Field <Decimal>("totalttc"); } catch { } string req3 = "Select Sum(totalttc) as totalttc from eentvf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "'"; DataSet tmp3 = met.recuperer_table(req3, "eentvf"); try { wavr += tmp3.Tables[0].Rows[0].Field <Decimal>("totalttc"); } catch { } string req4 = "Select Sum(mont) as mont from eregf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and codec='" + textBoxX1.Text + "'"; DataSet tmp4 = met.recuperer_table(req4, "eregf"); try { wreg += tmp4.Tables[0].Rows[0].Field <Decimal>("mont"); } catch { } String req5 = "Update four Set debit = " + (wttc + wttc1) + ", credit = " + wreg + ", avoir = " + wavr + ", solde = " + ((wsld1 + wttc + wttc1) - (wavr + wreg)) + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and code='" + textBoxX1.Text + "'"; met.Execute(req5); progressBarX1.Value++; } // Retour Montant avoir & montant reglement a 0 pour facture client string req10 = "Select montavr,montreg from eentc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp10 = met.recuperer_table(req10, "eentc"); foreach (DataRow dr3 in tmp10.Tables["eentc"].Rows) { String req5 = "Update eentc Set MONTAVR = " + zmnt + ", montreg = " + zmnt + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; met.Execute(req5); } // Retour Montant avoir & montant reglement a 0 pour facture fournisseur string req11 = "Select montavr,montreg from eentf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp11 = met.recuperer_table(req11, "eentf"); foreach (DataRow dr3 in tmp11.Tables["eentf"].Rows) { String req5 = "Update eentf Set MONTAVR = " + zmnt + ", montreg = " + zmnt + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; met.Execute(req5); } // calcul Montant avoir pour facture client string req6 = "Select totalttc,nfact from eentvc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp6 = met.recuperer_table(req6, "eentvc"); foreach (DataRow dr3 in tmp6.Tables["eentvc"].Rows) { xnfact = dr3.Field <string>("nfact"); try { zmnt = dr3.Field <Decimal>("totalttc"); } catch { } String req5 = "Update eentc Set MONTAVR = " + zmnt + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and num ='" + xnfact + "'"; met.Execute(req5); } // calcul Montant reglement pour facture client string req17 = "Select num from eentc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp17 = met.recuperer_table(req17, "eentc"); decimal wzmnt = 0; foreach (DataRow dr3 in tmp17.Tables["eentc"].Rows) { xnfact = dr3.Field <string>("num"); string req7 = "Select mont,nfact from lregc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and nfact ='" + xnfact + "'"; DataSet tmp7 = met.recuperer_table(req7, "lregc"); foreach (DataRow dr2 in tmp7.Tables["lregc"].Rows) { try { wzmnt += dr2.Field <Decimal>("mont"); } catch { } } String req5 = "Update eentc Set MONTREG = " + wzmnt + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and num ='" + xnfact + "'"; met.Execute(req5); wzmnt = 0; } // calcul Montant avoir pour facture fournisseur string req8 = "Select totalttc,nfact from eentvf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp8 = met.recuperer_table(req8, "eentvf"); foreach (DataRow dr3 in tmp8.Tables["eentvf"].Rows) { xnfact = dr3.Field <string>("nfact"); try { zmnt = dr3.Field <Decimal>("totalttc"); } catch { } String req5 = "Update eentf Set MONTAVR = " + zmnt + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and num ='" + xnfact + "'"; met.Execute(req5); } // calcul Montant reglement pour facture fournisseur string req19 = "Select num from eentf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp19 = met.recuperer_table(req19, "eentf"); decimal zzmnt = 0; foreach (DataRow dr3 in tmp19.Tables["eentf"].Rows) { xnfact = dr3.Field <string>("num"); string req7 = "Select mont,nfact from lregf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and nfact ='" + xnfact + "'"; DataSet tmp7 = met.recuperer_table(req7, "lregf"); foreach (DataRow dr2 in tmp7.Tables["lregf"].Rows) { try { zzmnt += dr2.Field <Decimal>("mont"); } catch { } } String req5 = "Update eentf Set MONTREG = " + zzmnt + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and num ='" + xnfact + "'"; met.Execute(req5); zzmnt = 0; } //calcul solde facture client string req12 = "Select num,totalttc,montavr,montreg,reste from eentc where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp12 = met.recuperer_table(req12, "eentc"); foreach (DataRow dr3 in tmp12.Tables["eentc"].Rows) { xnfact = dr3.Field <string>("num"); try { zttc = dr3.Field <Decimal>("totalttc"); } catch { } try { zavr = dr3.Field <Decimal>("montavr"); } catch { } try { zreg = dr3.Field <Decimal>("montreg"); } catch { } String req5 = "Update eentc Set reste = " + ((zttc - (zavr + zreg))) + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and num ='" + xnfact + "'"; met.Execute(req5); } //calcul solde facture fournisseur string req13 = "Select num,totalttc,montavr,montreg,reste from eentf where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "'"; DataSet tmp13 = met.recuperer_table(req13, "eentf"); foreach (DataRow dr3 in tmp13.Tables["eentf"].Rows) { xnfact = dr3.Field <string>("num"); try { zttc = dr3.Field <Decimal>("totalttc"); } catch { } try { zavr = dr3.Field <Decimal>("montavr"); } catch { } try { zreg = dr3.Field <Decimal>("montreg"); } catch { } String req5 = "Update eentf Set reste = " + ((zttc - (zavr + zreg))) + " Where codes='" + Program.Societe + "' and codee='" + Program.Exercice + "' and num ='" + xnfact + "'"; met.Execute(req5); } MessageBox.Show("Organisation effectuée"); progressBarX1.Visible = false; textBoxX1.Text = ""; textBoxX2.Text = ""; label1.Text = ""; }