Exemple #1
0
 private void buttonX4_Click(object sender, EventArgs e)
 {
     // Bouton Recherche
     if (dataGridViewX1.Rows.Count != 0)
     {
         Rechfact form = new Rechfact();
         form.table = "Client";
         form.ShowDialog();
         if (!form.textBoxX3.Text.Equals(""))
         {
             DataRow[] dr = ds.Tables["eentcb"].Select("num = '" + form.textBoxX3.Text + "'");
             if (dr.Length != 0)
             {
                 int i = ds.Tables[0].Rows.IndexOf(dr[0]);
                 dataGridViewX1.Rows[i].Selected = true;
             }
             else
             {
                 MessageBox.Show("N° Bon Comptoir n'existe pas.");
             }
         }
         else if (!form.code.Equals("0") && !form.dateTimeInput1.Text.Equals("") && !form.dateTimeInput2.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,totalttc,facture from eentcb where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem='" + Program.Magasin + "' and (codec='" + form.code + "' AND date>='" + ddebut + "' AND date<='" + dfin + "') order by num";
             ds = met.recuperer_table(req2, "eentcb");
             dataGridViewX1.DataSource = ds.Tables["eentcb"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (!form.code.Equals("0") && !form.dateTimeInput1.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,totalttc,facture from eentcb where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem='" + Program.Magasin + "' and (codec='" + form.code + "' AND date>=#" + ddebut + "# ) order by num";
             ds = met.recuperer_table(req2, "eentcb");
             dataGridViewX1.DataSource = ds.Tables["eentcb"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (!form.code.Equals("0"))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,totalttc,facture from eentcb where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem='" + Program.Magasin + "' and (codec='" + form.code + "') order by num";
             ds = met.recuperer_table(req2, "eentcb");
             dataGridViewX1.DataSource = ds.Tables["eentcb"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (form.code.Equals("0") && !form.dateTimeInput1.Text.Equals("") && !form.dateTimeInput2.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,totalttc,facture from eentcb where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem='" + Program.Magasin + "' and (date>='" + ddebut + "' AND date<='" + dfin + "') order by num";
             ds = met.recuperer_table(req2, "eentcb");
             dataGridViewX1.DataSource = ds.Tables["eentcb"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (form.code.Equals("0") && !form.dateTimeInput1.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,totalttc,facture from eentcb where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and codem='" + Program.Magasin + "' and (date>=#" + ddebut + "# ) order by num";
             ds = met.recuperer_table(req2, "eentcb");
             dataGridViewX1.DataSource = ds.Tables["eentcb"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else
         {
             buttonX1_Click(sender, e);
         }
     }
 }
Exemple #2
0
 private void buttonX4_Click(object sender, EventArgs e)
 {
     // Bouton Recherche
     if (dataGridViewX1.Rows.Count != 0)
     {
         Rechfact form = new Rechfact();
         form.table = "Client";
         form.ShowDialog();
         if (!form.textBoxX3.Text.Equals(""))
         {
             DataRow[] dr = ds.Tables["eentc"].Select("numf = '" + form.textBoxX3.Text + "'");
             if (dr.Length != 0)
             {
                 int i = ds.Tables[0].Rows.IndexOf(dr[0]);
                 dataGridViewX1.Rows[i].Selected = true;
             }
             else
             {
                 MessageBox.Show("N° Facture n'existe pas.");
             }
         }
         else if (!form.code.Equals("0") && !form.dateTimeInput1.Text.Equals("") && !form.dateTimeInput2.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,timbre,totalttc,montavr,montreg,reste,mode,coder from eentc where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "'  and (codec='" + form.code + "' AND date>='" + ddebut + "' AND date<='" + dfin + "') order by num";
             ds = met.recuperer_table(req2, "eentc");
             dataGridViewX1.DataSource = ds.Tables["eentc"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (!form.code.Equals("0") && !form.dateTimeInput1.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,timbre,totalttc,montavr,montreg,reste,mode,coder from eentc where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "'  and (codec='" + form.code + "' AND date>='" + ddebut + "' ) order by num";
             ds = met.recuperer_table(req2, "eentc");
             dataGridViewX1.DataSource = ds.Tables["eentc"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (!form.code.Equals("0"))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,timbre,totalttc,montavr,montreg,reste,mode,coder from eentc where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "'  and  (codec='" + form.code + "') order by num";
             ds = met.recuperer_table(req2, "eentc");
             dataGridViewX1.DataSource = ds.Tables["eentc"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (form.code.Equals("0") && !form.dateTimeInput1.Text.Equals("") && !form.dateTimeInput2.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             //string req2 = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,timbre,totalttc,montavr,montreg,reste,mode,coder from eentc where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' AND codem ='" + Program.Magasin + "' and (date>='" + ddebut + "' AND date<='" + dfin + "') order by num";
             string req = "select NUMF,DATEF,codec,nomc,THT,RGARANTIE,RAVANCE,NETHT,TVA,TTC,RS50,RS15,timbre,NET,TYPE from facture where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and (DATEF>='" + ddebut + "' AND DATEF<='" + dfin + "') order by numf";
             ds = met.recuperer_table(req, "eentc");
             dataGridViewX1.DataSource = ds.Tables["eentc"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else if (form.code.Equals("0") && !form.dateTimeInput1.Text.Equals(""))
         {
             string ddebut = form.dateTimeInput1.Value.ToString("yyyy-MM-dd");
             string dfin   = form.dateTimeInput2.Value.ToString("yyyy-MM-dd");
             string req2   = "select num,date,codec,nomc,totalht,fodec,totalrem,totaltva,totaltaxe,timbre,totalttc,montavr,montreg,reste,mode,coder from eentc where codes = '" + Program.Societe + "' and codee = '" + Program.Exercice + "' and (date>='" + ddebut + "' ) order by num";
             ds = met.recuperer_table(req2, "eentc");
             dataGridViewX1.DataSource = ds.Tables["eentc"].DefaultView;
             if (dataGridViewX1.Rows.Count != 0)
             {
                 charger_lignefacture();
                 total();
             }
             buttonX1.Visible = true;
         }
         else
         {
             buttonX1_Click(sender, e);
         }
     }
 }