Example #1
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         cryRpt.Load(CHEMINRPT);
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = true;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = cryRpt.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         cryRpt.SetParameterValue(PARAMFACT, NUMFACT.Text);
         cryRpt.SetParameterValue("REMISEPARAM", Globals.convertDN(REMVAL.Text));
         cryRpt.SetParameterValue("TIMBREPARAM", Globals.convertDN(TIMVAL.Text));
         cryRpt.SetParameterValue("Profil_Adresse", PROFIL);
         CRV.ReportSource = cryRpt;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Example #2
0
        public reportes_CR(int emp)
        {
            InitializeComponent();
            rpt_empleados emple = new rpt_empleados();

            CRV.Refresh();
            CRV.RefreshReport();
            CRV.ReportSource = emple;
        }
Example #3
0
        public reportes_CR(string ss)
        {
            InitializeComponent();
            rpt_edades CR = new rpt_edades();

            CR.DataDefinition.FormulaFields["edad"].Text = "3";
            //CR.SetDataSource(ss.ToList());

            CRV.Refresh();
            CRV.ReportSource = CR;
        }
Example #4
0
 private void Button5_Click(object sender, EventArgs e)
 {
     try
     {
         cryRpt.Load(CHEMINRPT);
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = true;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = cryRpt.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = NUMFACT.Text;
         ParameterFieldDefinitions parameterFields          = cryRpt.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields[PARAMFACT];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = cryRpt;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
     try
     {
         DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions();
         PdfRtfWordFormatOptions    formatOptions = new PdfRtfWordFormatOptions();
         NOMFICHJOINT = Nommail + " " + DateTime.Now.ToString("yyyy_MM_dd HH_mm_ss");
         diskFileDestinationOptions.DiskFileName = "C:\\SIGC utility\\Fichier joint\\" + NOMFICHJOINT + ".pdf";
         MyProject.Forms.Mail.chemin.Text        = "C:\\SIGC utility\\Fichier joint\\" + NOMFICHJOINT + ".pdf";
         ExportOptions exportOptions  = cryRpt.ExportOptions;
         ExportOptions exportOptions2 = exportOptions;
         exportOptions2.ExportDestinationType = ExportDestinationType.DiskFile;
         exportOptions2.ExportFormatType      = ExportFormatType.PortableDocFormat;
         exportOptions2.DestinationOptions    = diskFileDestinationOptions;
         exportOptions2.FormatOptions         = formatOptions;
         exportOptions2 = null;
         cryRpt.Export();
         MyProject.Forms.Mail.Show();
         MyProject.Forms.Mail.BringToFront();
         MyProject.Forms.Mail.pathT.Text = "C:\\SIGC utility\\Fichier joint\\" + NOMFICHJOINT + ".pdf";
         MyProject.Forms.Mail.AjoutFJ_Click(RuntimeHelpers.GetObjectValue(sender), e);
     }
     catch (Exception ex3)
     {
         ProjectData.SetProjectError(ex3);
         Exception ex4 = ex3;
         Interaction.MsgBox(ex4.ToString(), MsgBoxStyle.OkOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Example #5
0
 public void Frm_Fact_Load(object sender, EventArgs e)
 {
     try
     {
         LB_Article.SelectedItem = "Profil Nb";
         if (Operators.CompareString(TYPEFACT, "D", false) == 0)
         {
             PARAMFACT    = "NUMDEVIS";
             TABLEFACT    = "DEVIS";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_Devis.rpt";
             Label1.Text  = "Entrer Num Devis";
             Button1.Text = "Afficher Devis";
             Nommail      = "Devis";
             Text         = "Devis";
         }
         else if (Operators.CompareString(TYPEFACT, "F", false) == 0)
         {
             PARAMFACT    = "NUMTICKET";
             TABLEFACT    = "TICKET";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_Facture.rpt";
             Label1.Text  = "Entrer Num Facture";
             Button1.Text = "Afficher Facture";
             Text         = "Facture";
             Nommail      = "Facture";
         }
         else if (Operators.CompareString(TYPEFACT, "TIC", false) == 0)
         {
             PARAMFACT    = "NUMTICKET";
             TABLEFACT    = "TICKET";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_Ticket.rpt";
             Label1.Text  = "Entrer Num Ticket";
             Button1.Text = "Afficher Ticket";
             Text         = "Ticket";
             Nommail      = "Ticket";
         }
         else if (Operators.CompareString(TYPEFACT, "BC", false) == 0)
         {
             PARAMFACT    = "NUMBC";
             TABLEFACT    = "BONC";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_BC.rpt";
             Label1.Text  = "Entrer Num Bon C.";
             Button1.Text = "Afficher Bon C.";
             Text         = "Bon Commande";
             Nommail      = "BC";
         }
         else if (Operators.CompareString(TYPEFACT, "BL", false) == 0)
         {
             PARAMFACT    = "NUMBL";
             TABLEFACT    = "BONL";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_BL.rpt";
             Label1.Text  = "Entrer Num Bon L.";
             Button1.Text = "Afficher Bon L.";
             Text         = "Bon livraison";
             Nommail      = "BL";
         }
         else if (Operators.CompareString(TYPEFACT, "DA", false) == 0)
         {
             PARAMFACT    = "NUMDEVIS";
             TABLEFACT    = "A_DEVIS";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_Devis.rpt";
             Label1.Text  = "Entrer Num Devis";
             Button1.Text = "Afficher Devis Achat";
             Text         = "Devis Achat";
             Nommail      = "Devis Achat";
         }
         else if (Operators.CompareString(TYPEFACT, "BCA", false) == 0)
         {
             PARAMFACT    = "NUMBONC";
             TABLEFACT    = "A_BONC";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_BONC.rpt";
             Label1.Text  = "Entrer Num Bon C.";
             Button1.Text = "Afficher Bon C.";
             Text         = "Bon Commande Achat";
             Nommail      = "BC Achat";
         }
         else if (Operators.CompareString(TYPEFACT, "BLA", false) == 0)
         {
             PARAMFACT    = "NUMBONL";
             TABLEFACT    = "A_BONL";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_BONL.rpt";
             Label1.Text  = "Entrer Num Bon L.";
             Button1.Text = "Afficher Bon L.";
             Text         = "Bon livraison Achat";
             Nommail      = "BL Achat";
         }
         else if (Operators.CompareString(TYPEFACT, "FA", false) == 0)
         {
             PARAMFACT    = "NUMFACT";
             TABLEFACT    = "A_FACTURE";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_Facture.rpt";
             Label1.Text  = "Entrer Num Facture";
             Button1.Text = "Afficher Facture";
             Text         = "Facture Achat";
             Nommail      = "Facture Achat";
         }
         if (Globals.conn.State == ConnectionState.Closed)
         {
             Globals.conn.Open();
         }
         Globals.cmd.Connection  = Globals.conn;
         Globals.cmd.CommandText = "select REMISE,TIMBRE from " + TABLEFACT + " where NUM_FACT ='" + NUMFACT.Text + "'";
         MySqlDataReader mySqlDataReader = Globals.cmd.ExecuteReader();
         Globals.cmd.CommandType = CommandType.Text;
         if (mySqlDataReader.Read())
         {
             string text = mySqlDataReader["REMISE"].ToString();
             if (string.IsNullOrEmpty(text) | decimal.Compare(Globals.convertDN(text), decimal.Zero) == 0)
             {
                 REMISE.Checked = false;
                 REMVAL.Visible = false;
                 REMVAL.Text    = "0";
             }
             else
             {
                 REMISE.Checked = true;
                 REMVAL.Visible = true;
                 REMVAL.Text    = text;
             }
             string text2 = mySqlDataReader["TIMBRE"].ToString();
             if (string.IsNullOrEmpty(text2) | decimal.Compare(Globals.convertDN(text2), decimal.Zero) == 0)
             {
                 TIMBRE.Checked = false;
                 TIMVAL.Visible = false;
                 TIMVAL.Text    = "0";
             }
             else
             {
                 TIMBRE.Checked = true;
                 TIMVAL.Visible = true;
                 TIMVAL.Text    = text2;
             }
         }
         mySqlDataReader.Close();
         mySqlDataReader.Dispose();
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
         cryRpt.Load(CHEMINRPT);
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = true;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = cryRpt.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         cryRpt.SetParameterValue(PARAMFACT, NUMFACT.Text);
         if (Operators.CompareString(TYPEFACT, "TIC", false) != 0)
         {
             cryRpt.SetParameterValue("REMISEPARAM", Globals.convertDN(REMVAL.Text));
             cryRpt.SetParameterValue("TIMBREPARAM", Globals.convertDN(TIMVAL.Text));
             cryRpt.SetParameterValue("Profil_Adresse", PROFIL);
         }
         CRV.ReportSource = cryRpt;
         CRV.Refresh();
         Nom_mail.Text = Nommail;
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Example #6
0
 private void FrmFacture_Load(object sender, EventArgs e)
 {
     try
     {
         ReportDocument reportDocument = new ReportDocument();
         reportDocument.Load("C:\\SIGC utility\\Reports\\Report_Facture.rpt");
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = false;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = reportDocument.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         if (Operators.CompareString(NUMFACT.Text, "", false) != 0)
         {
             parameterDiscreteValue.Value = NUMFACT.Text;
         }
         else
         {
             parameterDiscreteValue.Value = "0";
         }
         ParameterFieldDefinitions parameterFields          = reportDocument.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields["NUMTICKET"];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = reportDocument;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Example #7
0
 private void Stat_Stock_Load(object sender, EventArgs e)
 {
     try
     {
         MySqlCommand     mySqlCommand     = new MySqlCommand();
         MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand);
         DataSet          dataSet          = new DataSet();
         if (Globals.conn.State == ConnectionState.Closed)
         {
             Globals.conn.Open();
         }
         mySqlCommand.Connection  = Globals.conn;
         mySqlCommand.CommandText = "select distinct REFART from ARTICLE_D";
         mySqlDataAdapter.Fill(dataSet, "list");
         AutoCompleteStringCollection autoCompleteStringCollection = new AutoCompleteStringCollection();
         ReportDocument reportDocument;
         ConnectionInfo connectionInfo;
         Tables         tables;
         checked
         {
             int num = dataSet.Tables[0].Rows.Count - 1;
             for (int i = 0; i <= num; i++)
             {
                 autoCompleteStringCollection.Add(dataSet.Tables[0].Rows[i]["REFART"].ToString());
             }
             REFART.AutoCompleteSource       = AutoCompleteSource.CustomSource;
             REFART.AutoCompleteCustomSource = autoCompleteStringCollection;
             REFART.AutoCompleteMode         = AutoCompleteMode.Suggest;
             reportDocument = new ReportDocument();
             reportDocument.Load("C:\\SIGC utility\\Reports\\Report_Suivi_Stock.rpt");
             connectionInfo = new ConnectionInfo();
             ConnectionInfo connectionInfo2 = connectionInfo;
             connectionInfo2.ServerName         = "erp_db";
             connectionInfo2.DatabaseName       = "";
             connectionInfo2.UserID             = Globals.BDUSER;
             connectionInfo2.Password           = Globals.BDPW;
             connectionInfo2.IntegratedSecurity = false;
             connectionInfo2 = null;
             TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
             TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
             tables = reportDocument.Database.Tables;
         }
         IEnumerator enumerator = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table          table          = (Table)enumerator.Current;
                 TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = REFART.Text;
         ParameterFieldDefinitions parameterFields          = reportDocument.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields["REFART_P"];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = reportDocument;
         CRV.Refresh();
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Example #8
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         base.WindowState = FormWindowState.Maximized;
         ReportDocument reportDocument = new ReportDocument();
         reportDocument.Load("C:\\SIGC utility\\Reports\\Report_perso_imprim.rpt");
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = false;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = reportDocument.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = CODE_PERSO.Text;
         ParameterFieldDefinitions parameterFields          = reportDocument.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields["code_perso"];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = reportDocument;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }