Example #1
0
        private void Imprimer_Click(object sender, EventArgs e)
        {
            Datasets.Pesage_Header ds = new Datasets.Pesage_Header();
            DateTime date_debut, date_fin;
            string   operation, chauffeur, camion;
            decimal  ecart_min, ecart_max;

            date_debut = DateTime.Parse(datedebut_dtp.Text + " 00:00:00");
            date_fin   = DateTime.Parse(datefin_dtp.Text + " 23:59:59");
            ecart_min  = decimal.Parse(ecartMin_tb.Text);
            ecart_max  = decimal.Parse(ecartMax_tb.Text);
            operation  = type_oper_cb.Text;
            chauffeur  = chauffeur_cb.Text;
            camion     = camion_cb.Text;

            for (int i = 0; i < STOCK_DGV.RowCount - 1; i++)
            {
                ds.Tables["Pesage"].Rows.Add(STOCK_DGV.Rows[i].Cells[0].Value, STOCK_DGV.Rows[i].Cells[1].Value, STOCK_DGV.Rows[i].Cells[2].Value,
                                             STOCK_DGV.Rows[i].Cells[3].Value, STOCK_DGV.Rows[i].Cells[4].Value, STOCK_DGV.Rows[i].Cells[5].Value, STOCK_DGV.Rows[i].Cells[6].Value,
                                             STOCK_DGV.Rows[i].Cells[7].Value, STOCK_DGV.Rows[i].Cells[8].Value, STOCK_DGV.Rows[i].Cells[9].Value, STOCK_DGV.Rows[i].Cells[10].Value,
                                             STOCK_DGV.Rows[i].Cells[11].Value, STOCK_DGV.Rows[i].Cells[12].Value, STOCK_DGV.Rows[i].Cells[13].Value);
            }

            ds.Tables["Divers"].Rows.Add(operation, date_debut, date_fin, chauffeur, camion, ecart_min, ecart_max);
            ImpressionPesage form_ = new ImpressionPesage(0, ds);

            form_.ShowDialog();
        }
Example #2
0
        private void Imprimer_Click(object sender, EventArgs e)
        {
            Datasets.Pesage ds = new Datasets.Pesage();
            DateTime        date_debut, date_fin;
            string          operation, desig_article, nom_frn, nom_clt, chauffeur, camion;
            decimal         ecart_min, ecart_max;

            date_debut    = DateTime.Parse(datedebut_dtp.Text + " 00:00:00");
            date_fin      = DateTime.Parse(datefin_dtp.Text + " 23:59:59");
            ecart_min     = decimal.Parse(ecartMin_tb.Text);
            ecart_max     = decimal.Parse(ecartMax_tb.Text);
            operation     = type_oper_cb.Text;
            desig_article = desig_article_cb.Text;
            nom_frn       = nom_frn_cb.Text;
            nom_clt       = nom_clt_cb.Text;
            chauffeur     = chauffeur_cb.Text;
            camion        = camion_cb.Text;

            DataGridViewRow row_;

            for (int i = 0; i < STOCK_DGV.RowCount - 1; i++)
            {
                row_ = STOCK_DGV.Rows[i];
                string detailarticle = "";
                // article 1
                if (double.Parse(row_.Cells[5].Value.ToString()) > 0)
                {
                    detailarticle += row_.Cells[4].Value.ToString() + " : " + string.Format("{0:0.##}", row_.Cells[5].Value);
                }
                // article 2
                if (double.Parse(row_.Cells[8].Value.ToString()) > 0)
                {
                    detailarticle += "\n" + row_.Cells[7].Value.ToString() + " : " + string.Format("{0:0.##}", row_.Cells[8].Value);
                }
                // article 3
                if (double.Parse(row_.Cells[11].Value.ToString()) > 0)
                {
                    detailarticle += "\n" + row_.Cells[10].Value.ToString() + " : " + string.Format("{0:0.##}", row_.Cells[11].Value);
                }
                // article 4
                if (double.Parse(row_.Cells[14].Value.ToString()) > 0)
                {
                    detailarticle += "\n" + row_.Cells[13].Value.ToString() + " : " + string.Format("{0:0.##}", row_.Cells[14].Value);
                }
                // article 5
                if (double.Parse(row_.Cells[17].Value.ToString()) > 0)
                {
                    detailarticle += "\n" + row_.Cells[16].Value.ToString() + " : " + string.Format("{0:0.##}", row_.Cells[17].Value);
                }

                ds.Tables["Pesage"].Rows.Add(row_.Cells[0].Value, row_.Cells[1].Value, row_.Cells[2].Value, " ",
                                             detailarticle, row_.Cells[18].Value, row_.Cells[19].Value, row_.Cells[20].Value, row_.Cells[21].Value,
                                             row_.Cells[22].Value, row_.Cells[23].Value, row_.Cells[24].Value, row_.Cells[25].Value, row_.Cells[26].Value,
                                             row_.Cells[27].Value, row_.Cells[28].Value, row_.Cells[29].Value, row_.Cells[30].Value, row_.Cells[31].Value,
                                             row_.Cells[32].Value, row_.Cells[33].Value);
            }
            ds.Tables["Divers"].Rows.Add(operation, date_debut, date_fin, desig_article, nom_frn, nom_clt, chauffeur, camion, ecart_min, ecart_max);
            ImpressionPesage form_ = new ImpressionPesage(1, ds);

            form_.ShowDialog();
        }