Exemple #1
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            if (Variables.gOrdenOA == 1)
            {
                this.ActTmp();
            }
            this.DS.Clear();
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            string selectCommandText      = "SELECT * from " + Variables.gTermi + "TmpCalendario as PC1TmpCalendario where FechaEnt<'" + Strings.Format(DateTime.Now, "MM/dd/yyyy") + "'";

            this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapTmp.Fill(this.DS, "PC1TmpCalendario");
            selectCommandText = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs";
            this.AdapObs      = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapObs.Fill(this.DS, "GesEnsObs");
            selectCommandText = "SELECT * from " + Variables.gTermi + "TmpCalendarioStkComp as PC1TmpCalendarioStkComp";
            this.AdapTmp1     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapTmp1.Fill(this.DS, "PC1TmpCalendarioStkComp");
            this.Informe.Load(Application.StartupPath + @"\repoapendcal.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinition definition = this.Informe.DataDefinition.FormulaFields["orden"];

            definition.Text = "'ordenado por Fecha Entrega'";
            this.CrystalReportViewer1.ShowGroupTreeButton = true;
            this.CrystalReportViewer1.ReportSource        = this.Informe;
            this.CrystalReportViewer1.Zoom(1);
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Exemple #2
0
 public frmConsInv1_1()
 {
     base.Closed += new EventHandler(this.frmConsInv1_1_Closed);
     base.Load   += new EventHandler(this.frmConsInv1_1_Load);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.DS1     = new DataSet();
     this.DS2     = new DataSet();
     this.InitializeComponent();
     try
     {
         SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
         connection.Open();
         SqlCommand command = new SqlCommand("SELECT distinct Posicion,FechaInv from Inventario where FechaInv<'" + Strings.Format(DateAndTime.DateAdd(DateInterval.Month, (double)(Variables.gCantMeses * -1), DateAndTime.Now), "MM/dd/yyyy") + "'", connection);
         command.CommandTimeout   = 500;
         this.Adap1               = new SqlDataAdapter();
         this.Adap1.SelectCommand = command;
         this.DS.Clear();
         this.Adap1.Fill(this.DS, "Inventario");
         this.Informe.Load(Application.StartupPath + @"\ConsPosSinInv.rpt");
         this.Informe.SetDataSource(this.DS);
         connection.Close();
         FormulaFieldDefinition definition = this.Informe.DataDefinition.FormulaFields["cantmeses"];
         definition.Text = "'" + Strings.Format(Variables.gCantMeses, "##0") + "'";
         this.CrystalReportViewer1.ReportSource = this.Informe;
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #3
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096";
            string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
            string selectCommandText = "Select * from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty";

            this.AdapOCPend = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.DS.Clear();
            this.AdapOCPend.Fill(this.DS, "detdes");
            selectCommandText = "Select * from hdrdes where packlist in (Select packlist from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty)";
            this.AdapHdrdes   = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapHdrdes.Fill(this.DS, "hdrdes");
            selectCommandText = "Select SC01001,SC01002,SC01003 from SC010100";
            this.AdapProd     = new SqlDataAdapter(selectCommandText, str3);
            this.AdapProd.Fill(this.DS, "SC010100");
            this.Informe.Load(Application.StartupPath + @"\repdifocprov.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["desdefechaexp"];

            definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'";
            FormulaFieldDefinition definition2 = formulaFields["hastafechaexp"];

            definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'";
            this.CrystalReportViewer1.ReportSource = this.Informe;
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Exemple #4
0
        public frmDifOCProv1()
        {
            base.Closed += new EventHandler(this.frmDifOCProv1_Closed);
            base.Load   += new EventHandler(this.frmDifOCProv1_Load);
            this.Informe = new ReportDocument();
            this.DS      = new DataSet();
            this.InitializeComponent();
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096";
            string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
            string selectCommandText = "Select * from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty";

            this.AdapOCPend = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapOCPend.Fill(this.DS, "detdes");
            selectCommandText = "Select * from hdrdes where packlist in (Select packlist from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty)";
            this.AdapHdrdes   = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapHdrdes.Fill(this.DS, "hdrdes");
            selectCommandText = "Select SC01001,SC01002,SC01003 from SC010100";
            this.AdapProd     = new SqlDataAdapter(selectCommandText, str3);
            this.AdapProd.Fill(this.DS, "SC010100");
            this.Informe.Load(Application.StartupPath + @"\repdifocprov.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["desdefechaexp"];

            definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'";
            FormulaFieldDefinition definition2 = formulaFields["hastafechaexp"];

            definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'";
            this.CrystalReportViewer1.ReportSource = this.Informe;
        }
Exemple #5
0
 public frmRepEnsXFecha1()
 {
     base.Closed += new EventHandler(this.frmRepEnsXFecha1_Closed);
     base.Load   += new EventHandler(this.frmRepEnsXFecha1_Load);
     base.Click  += new EventHandler(this.frmRepEnsXFecha1_Click);
     base.Leave  += new EventHandler(this.frmRepEnsXFecha1_Leave);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.InitializeComponent();
     try
     {
         SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
         connection.Open();
         SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection);
         command.CommandTimeout     = 500;
         this.AdapTmp               = new SqlDataAdapter();
         this.AdapTmp.SelectCommand = command;
         this.DS.Clear();
         this.AdapTmp.Fill(this.DS, "PC1TmpRepGesEns");
         if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0)
         {
             this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt");
             this.Informe.SetDataSource(this.DS);
             connection.Close();
         }
         else
         {
             this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt");
             this.Informe.SetDataSource(this.DS);
             connection.Close();
         }
         FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
         FormulaFieldDefinition  definition    = formulaFields["desdefecha"];
         if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0)
         {
             definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition.Text = "''";
         }
         FormulaFieldDefinition definition2 = formulaFields["hastafecha"];
         if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)
         {
             definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition2.Text = "''";
         }
         this.CrystalReportViewer1.ReportSource = this.Informe;
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #6
0
 public frmGenOC3()
 {
     base.Closed += new EventHandler(this.frmGenOC3_Closed);
     base.Load   += new EventHandler(this.frmGenOC3_Load);
     base.Click  += new EventHandler(this.frmGenOC3_Click);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.DS1     = new DataSet();
     this.DS2     = new DataSet();
     this.InitializeComponent();
     try
     {
         SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
         connection.Open();
         SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOCGen as PC1TmpOCGen", connection);
         command.CommandTimeout   = 500;
         this.Adap1               = new SqlDataAdapter();
         this.Adap1.SelectCommand = command;
         this.DS.Clear();
         this.Adap1.Fill(this.DS, "PC1TmpOCGen");
         this.Informe.Load(Application.StartupPath + @"\OCGen.rpt");
         this.Informe.SetDataSource(this.DS);
         connection.Close();
         FormulaFieldDefinition definition = this.Informe.DataDefinition.FormulaFields["almacen"];
         definition.Text = "'Almacen: " + Strings.Trim(Variables.gAlmacen1) + "'";
         this.CrystalReportViewer1.ReportSource = this.Informe;
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #7
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");

            connection.Open();
            string str3 = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null";

            if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)))
            {
                if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))
                {
                    str3 = str3 + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'";
                }
                else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0))
                {
                    str3 = str3 + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
                }
                else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0))
                {
                    str3 = (str3 + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
                }
            }
            SqlCommand command = new SqlCommand(str3 + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection);

            command.CommandTimeout     = 500;
            this.AdapTmp               = new SqlDataAdapter();
            this.AdapTmp.SelectCommand = command;
            this.DS.Clear();
            this.AdapTmp.Fill(this.DS, "PrepPed");
            this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt");
            this.Informe.SetDataSource(this.DS);
            connection.Close();
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["desdefecha"];

            if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0)
            {
                definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy HH:mm:ss") + "'";
            }
            else
            {
                definition.Text = "''";
            }
            FormulaFieldDefinition definition2 = formulaFields["hastafecha"];

            if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)
            {
                definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy HH:mm:ss") + "'";
            }
            else
            {
                definition2.Text = "''";
            }
            this.CrystalReportViewer1.ReportSource = this.Informe;
            this.CrystalReportViewer1.Zoom(1);
            this.cmbSalir.Enabled = true;
        }
Exemple #8
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            string str;
            string str3;

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            if (Variables.gOrdenOA == 1)
            {
                this.ActTmp();
            }
            this.DS.Clear();
            if (Variables.gOrdenOA == 1)
            {
                str3         = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                str          = "SELECT * from " + Variables.gTermi + "TmpCalendario as PC1TmpCalendario where FechaEnt<'" + Strings.Format(DateTime.Now, "MM/dd/yyyy") + "' and not NroOA is null";
                this.AdapTmp = new SqlDataAdapter(str, str3);
                this.AdapTmp.Fill(this.DS, "PC1TmpCalendario");
                str          = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs";
                this.AdapObs = new SqlDataAdapter(str, str3);
                this.AdapObs.Fill(this.DS, "GesEnsObs");
                str           = "SELECT * from " + Variables.gTermi + "TmpCalendarioStkComp as PC1TmpCalendarioStkComp";
                this.AdapTmp1 = new SqlDataAdapter(str, str3);
                this.AdapTmp1.Fill(this.DS, "PC1TmpCalendarioStkComp");
                this.Informe.Load(Application.StartupPath + @"\repoapendcalatr.rpt");
                this.Informe.SetDataSource(this.DS);
                FormulaFieldDefinition definition = this.Informe.DataDefinition.FormulaFields["orden"];
                definition.Text = "'ordenado por Fecha Entrega'";
                this.CrystalReportViewer1.ShowGroupTreeButton = true;
                this.CrystalReportViewer1.ReportSource        = this.Informe;
                this.CrystalReportViewer1.Zoom(1);
            }
            else
            {
                string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
                str           = "SELECT OR01001,OR01015,OR01016 FROM dbo.OR010100 where OR010100.OR01002=6 and OR010100.OR01091=0 order by OR010100.OR01001";
                this.AdapOR01 = new SqlDataAdapter(str, selectConnectionString);
                str           = "SELECT OR03001,OR03002,OR03005,OR03006,OR03007,OR03011,OR03012,OR03034 FROM dbo.OR030100 where OR03011-OR03012<>0 and OR03034=1 order by OR03005";
                this.AdapOR03 = new SqlDataAdapter(str, selectConnectionString);
                str           = "SELECT OR04001,OR04002,OR04003,OR04004,OR04005,OR04008 FROM dbo.OR040100";
                this.AdapSL01 = new SqlDataAdapter(str, selectConnectionString);
                this.AdapOR01.Fill(this.DS, "OR010100");
                this.AdapOR03.Fill(this.DS, "OR030100");
                this.AdapSL01.Fill(this.DS, "OR040100");
                str3         = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                str          = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs";
                this.AdapObs = new SqlDataAdapter(str, str3);
                this.AdapObs.Fill(this.DS, "GesEnsObs");
                this.Informe.Load(Application.StartupPath + @"\repoapend.rpt");
                this.Informe.SetDataSource(this.DS);
                FormulaFieldDefinition definition2 = this.Informe.DataDefinition.FormulaFields["orden"];
                definition2.Text = "'ordenado por N\x00b0 O.Armado'";
                this.CrystalReportViewer1.ShowGroupTreeButton = false;
                this.CrystalReportViewer1.ReportSource        = this.Informe;
                this.CrystalReportViewer1.Zoom(1);
            }
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Exemple #9
0
 private static void ProcessFormulaFieldDefinition(FormulaFieldDefinition ffd, XmlWriter xmlw)
 {
     xmlw.WriteStartElement("FormulaFieldDefinition");
     xmlw.WriteAttributeString("FormulaName", ffd.FormulaName);
     xmlw.WriteAttributeString("Kind", ffd.Kind.ToStringSafe());
     xmlw.WriteAttributeString("Name", ffd.Name);
     xmlw.WriteAttributeString("NumberOfBytes", ffd.NumberOfBytes.ToStringSafe());
     xmlw.WriteAttributeString("Text", ffd.Text);
     xmlw.WriteAttributeString("UseCount", ffd.UseCount.ToStringSafe());
     xmlw.WriteAttributeString("ValueType", ffd.ValueType.ToStringSafe());
     xmlw.WriteEndElement();
 }
Exemple #10
0
 public frmRepRegPedExp1()
 {
     base.Closed += new EventHandler(this.frmRepRegPedExp1_Closed);
     base.Load   += new EventHandler(this.frmRepRegPedExp1_Load);
     base.Click  += new EventHandler(this.frmRepRegPedExp1_Click);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.InitializeComponent();
     try
     {
         SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
         connection.Open();
         SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRegPedExp as PC1TmpRegPedExp", connection);
         command.CommandTimeout      = 500;
         this.AdapOR01               = new SqlDataAdapter();
         this.AdapOR01.SelectCommand = command;
         this.DS.Clear();
         this.AdapOR01.Fill(this.DS, "PC1TmpRegPedExp");
         this.Informe.Load(Application.StartupPath + @"\repregpedexp.rpt");
         this.Informe.SetDataSource(this.DS);
         connection.Close();
         FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields();
         FormulaFieldDefinition  definition  = definitions.get_Item("desdefechaent");
         if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0)
         {
             definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'");
         }
         else
         {
             definition.set_Text("''");
         }
         FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaent");
         if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0)
         {
             definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'");
         }
         else
         {
             definition2.set_Text("''");
         }
         this.CrystalReportViewer1.set_ReportSource(this.Informe);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #11
0
        public frmGenDifInv1()
        {
            base.Load   += new EventHandler(this.frmGenDifInv1_Load);
            base.Closed += new EventHandler(this.frmGenDifInv1_Closed);
            this.InitializeComponent();
            ReportDocument document = new ReportDocument();
            DataSet        dataSet  = new DataSet();

            try
            {
                SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
                SqlCommand    command    = new SqlCommand("SELECT * FROM dbo.RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "' and (Cantidad<>CantSist or Posicion<>PosSist) and Aceptar=0", connection);
                command.CommandTimeout = 500;
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = command;
                connection.Open();
                adapter.Fill(dataSet, "RepDifInv");
                document.Load(Application.StartupPath + @"\repdifinv.rpt");
                document.SetDataSource(dataSet);
                connection.Close();
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
            FormulaFieldDefinitions formulaFields = document.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["FechaInv"];

            definition.Text = "'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'";
            FormulaFieldDefinition definition2 = formulaFields["DesdeRack"];

            definition2.Text = "'" + Variables.gDesdeRack + "'";
            FormulaFieldDefinition definition3 = formulaFields["HastaRack"];

            definition3.Text = "'" + Variables.gHastaRack + "'";
            FormulaFieldDefinition definition4 = formulaFields["Almacen"];

            definition4.Text = "'" + Variables.gCodAlmacen + "-" + Variables.gNomAlmacen + "'";
            this.CrystalReportViewer1.ReportSource = document;
        }
Exemple #12
0
        public frmRepOAPend2()
        {
            base.Load   += new EventHandler(this.frmRepOAPend2_Load);
            base.Closed += new EventHandler(this.frmRepOAPend2_Closed);
            this.Informe = new ReportDocument();
            this.DS      = new DataSet();
            this.InitializeComponent();
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            string selectCommandText      = "SELECT * from " + Variables.gTermi + "TmpCalendario as PC1TmpCalendario where FechaEnt>='" + Strings.Format(DateTime.Now, "MM/dd/yyyy") + "'";

            this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapTmp.Fill(this.DS, "PC1TmpCalendario");
            selectCommandText = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs";
            this.AdapObs      = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapObs.Fill(this.DS, "GesEnsObs");
            selectCommandText = "SELECT * from " + Variables.gTermi + "TmpCalendarioStkComp as PC1TmpCalendarioStkComp";
            this.AdapTmp1     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapTmp1.Fill(this.DS, "PC1TmpCalendarioStkComp");
            this.Informe.Load(Application.StartupPath + @"\repoapendcal.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["orden"];

            definition.Text = "'ordenado por Fecha Entrega'";
            FormulaFieldDefinition definition2 = formulaFields["Intr01"];

            definition2.Text = "'" + Variables.gNomIntr01 + "'";
            FormulaFieldDefinition definition3 = formulaFields["Intr02"];

            definition3.Text = "'" + Variables.gNomIntr02 + "'";
            FormulaFieldDefinition definition4 = formulaFields["Intr03"];

            definition4.Text = "'" + Variables.gNomIntr03 + "'";
            FormulaFieldDefinition definition5 = formulaFields["Intr04"];

            definition5.Text = "'" + Variables.gNomIntr04 + "'";
            this.CrystalReportViewer1.ShowGroupTreeButton = true;
            this.CrystalReportViewer1.ReportSource        = this.Informe;
            this.CrystalReportViewer1.Zoom(1);
        }
Exemple #13
0
        public frmRepOCPend1()
        {
            string str;

            base.Closed += new EventHandler(this.frmRepOCPend1_Closed);
            base.Load   += new EventHandler(this.frmRepOCPend1_Load);
            this.DS      = new DataSet();
            this.DS1     = new DataSet();
            this.DSTmp   = new DataSet();
            this.Informe = new ReportDocument();
            this.InitializeComponent();
            bool   flag = false;
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";

            if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) == 0)
            {
                str = "Select PC03001,PC03002,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016 from PC030100 where PC03010-PC03011<>0 and PC03010<>0";
                if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0)
                {
                    str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'";
                    if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0)
                    {
                        str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'";
                    }
                }
                else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0)
                {
                    str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'";
                }
                if (StringType.StrCmp(Variables.gCodProd, "", false) != 0)
                {
                    str = str + " and PC03005='" + Variables.gCodProd + "'";
                }
                str = str + " order by PC03001,PC03016,PC03002";
            }
            else
            {
                str = "Select PC03001,PC03002,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016 from PC030100 where PC03010-PC03011<>0 and PC03010<>0 and PC03016>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and PC03016<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
                if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0)
                {
                    if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0)
                    {
                        str = (str + " and (PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'") + " or PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "')";
                    }
                    else
                    {
                        str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'";
                    }
                }
                else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0)
                {
                    str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'";
                }
                if (StringType.StrCmp(Variables.gCodProd, "", false) != 0)
                {
                    str = str + " and PC03005='" + Variables.gCodProd + "'";
                }
                str = str + " order by PC03001,PC03016,PC03002";
            }
            this.DS.Clear();
            this.AdapOCPend = new SqlDataAdapter(str, selectConnectionString);
            this.AdapOCPend.Fill(this.DS, "PC030100");
            string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096";

            str = "Select distinct detdes.colnb,detdes.ordnb,detdes.lignb,detdes.datexp,detinv.invno,detinv.stamp,detinv.desqty,hdrdes.trind from detdes left outer join detinv on detdes.ordnb=detinv.purno and detdes.lignb=detinv.purlin inner join hdrdes on detdes.packlist=hdrdes.packlist where detdes.cntqty=0";
            if (StringType.StrCmp(Variables.gCodProd, "", false) != 0)
            {
                str = str + " and detdes.itnbr='" + Variables.gCodProd + "'";
            }
            this.AdapDetDes = new SqlDataAdapter(str, str3);
            this.DS1.Clear();
            this.AdapDetDes.Fill(this.DS1, "detdes");
            string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();
            flag = true;
            SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpDetDes", connection);
            int        num2    = command.ExecuteNonQuery();
            int        num3    = this.DS1.Tables["detdes"].Rows.Count - 1;

            for (int i = 0; i <= num3; i++)
            {
                DataRow row = this.DS1.Tables["detdes"].Rows[i];
                str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into " + Variables.gTermi + "TmpDetDes (NroOC,NroLinea,NroBulto,PackList,FechaPL,NroFC,FechaFC,EnTransito) values ('" + Strings.Format(RuntimeHelpers.GetObjectValue(row["ordnb"]), "0000000000")) + "','" + Strings.Format(RuntimeHelpers.GetObjectValue(row["lignb"]), "000000")) + "','", row["colnb"]), "','"), row["trind"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["datexp"]), "MM/dd/yyyy")), "',"));
                if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["invno"])))
                {
                    str = str + "'',";
                }
                else
                {
                    str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str + "'", row["invno"]), "',"));
                }
                if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["stamp"])))
                {
                    str = str + "'',";
                }
                else
                {
                    str = str + "'" + Strings.Format(DateType.FromString(Strings.Mid(StringType.FromObject(row["stamp"]), 1, 10)), "MM/dd/yyyy") + "',";
                }
                if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["desqty"])))
                {
                    str = str + "0)";
                }
                else
                {
                    str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str, row["desqty"]), ")"));
                }
                command = new SqlCommand(str, connection);
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null);
                    if (flag)
                    {
                        connection.Close();
                        flag = false;
                    }
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            str          = "select * from " + Variables.gTermi + "TmpDetDes as PC1TmpDetDes";
            this.AdapTmp = new SqlDataAdapter(str, connectionString);
            this.AdapTmp.Fill(this.DS, "PC1TmpDetDes");
            if (Variables.gOrdenList == 1)
            {
                this.Informe.Load(Application.StartupPath + @"\repocpend.rpt");
            }
            else
            {
                this.Informe.Load(Application.StartupPath + @"\repocpend1.rpt");
            }
            this.Informe.SetDataSource(this.DS);
            connection.Close();
            flag = false;
            FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields();
            FormulaFieldDefinition  definition  = definitions.get_Item("desde");

            if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) == 0)
            {
                definition.set_Text("'" + Variables.gDesde + "'");
            }
            else
            {
                definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'");
            }
            FormulaFieldDefinition definition2 = definitions.get_Item("hasta");

            if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) == 0)
            {
                definition2.set_Text("'" + Variables.gHasta + "'");
            }
            else
            {
                definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'");
            }
            FormulaFieldDefinition definition3 = definitions.get_Item("almacen");

            if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0)
            {
                if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0)
                {
                    definition3.set_Text("'Almacenes: " + Strings.Trim(Variables.gAlmacen1) + "-" + Strings.Trim(Variables.gAlmacen2) + "'");
                }
                else
                {
                    definition3.set_Text("'Almacen: " + Strings.Trim(Variables.gAlmacen1) + "'");
                }
            }
            else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0)
            {
                definition3.set_Text("'Almacen: " + Strings.Trim(Variables.gAlmacen2) + "'");
            }
            else
            {
                definition3.set_Text("'Todos los almacenes'");
            }
            this.CrystalReportViewer1.set_ReportSource(this.Informe);
        }
Exemple #14
0
        public frmRepOCConfPend1()
        {
            base.Closed += new EventHandler(this.frmRepOCConfPend1_Closed);
            base.Load   += new EventHandler(this.frmRepOCConfPend1_Load);
            this.Informe = new ReportDocument();
            this.DS      = new DataSet();
            this.DS1     = new DataSet();
            this.InitializeComponent();
            bool   flag = false;
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
            string str4 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096";

            this.DS.Clear();
            this.DS1.Clear();
            string selectCommandText = "SELECT PC01001,PC01003,PC01004,PC01014,PC01015,PC01016,PC03001,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016,SL01001,SL01002,PL01001,PL01002,PL23003,PL23004,ordnb,lignb FROM dbo.PC010100 inner join PC030100 on PC01001=PC03001 inner join PL010100 on PC01003=PL01001 left outer join SL010100 on PC01004=SL01001 inner join PL230100 on PC01014=PL23003 LEFT OUTER JOIN edibar.dbo.detdes ON PC030100.PC03001 = edibar.dbo.detdes.ordnb AND PC030100.PC03002 = edibar.dbo.detdes.lignb where PC01001>'0000014500' and PC03011<PC03010 and PC03029='1' and PL23001='2' and PL23002='00'";

            if (StringType.StrCmp(Variables.gCodProv, "", false) != 0)
            {
                selectCommandText = selectCommandText + " and PC01003='" + Variables.gCodProv + "'";
            }
            if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0)
            {
                selectCommandText = selectCommandText + " and PC01014=" + Variables.gCodMetEnt;
            }
            if (StringType.StrCmp(Variables.gCodAlmacen, "", false) != 0)
            {
                selectCommandText = selectCommandText + " and PC03035='" + Variables.gCodAlmacen + "'";
            }
            if (Variables.gNoDespachado)
            {
                selectCommandText = selectCommandText + " and edibar.dbo.detdes.ordnb is null";
            }
            this.AdapPC01 = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapPC01.Fill(this.DS1, "PC010100");
            string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();
            flag = true;
            SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpOCConfPend", connection);
            int        num2    = command.ExecuteNonQuery();
            int        num3    = this.DS1.Tables["PC010100"].Rows.Count - 1;

            for (int i = 0; i <= num3; i++)
            {
                DataRow row = this.DS1.Tables["PC010100"].Rows[i];
                if (DateAndTime.DateDiff(DateInterval.Day, DateType.FromObject(row["PC01016"]), DateType.FromObject(row["PC03016"]), FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1) >= Variables.gDiasDif)
                {
                    selectCommandText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOCConfPend (CodProv,NomProv,NroOC,FechaOC,FEntSolic,FEntConf,Codigo,Descripcion,Cantidad,FormaDesp,Destinatario,EnTransito) values ('", row["PC01003"]), "','"), row["PL01002"]), "','"), row["PC01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["PC01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["PC01016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["PC03016"]), "MM/dd/yyyy")), "','"), row["PC03005"]), "','"), Strings.Trim(StringType.FromObject(row["PC03006"]))), " "), Strings.Trim(StringType.FromObject(row["PC03007"]))), "',"), ObjectType.SubObj(row["PC03010"], row["PC03011"])), ",'"), row["PL23004"]), "',"));
                    if (ObjectType.ObjTst(row["PC01004"], "+", false) == 0)
                    {
                        selectCommandText = selectCommandText + "'BGA',";
                    }
                    else
                    {
                        selectCommandText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(selectCommandText + "'", row["SL01002"]), "',"));
                    }
                    if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["ordnb"])))
                    {
                        selectCommandText = selectCommandText + "'N')";
                    }
                    else
                    {
                        selectCommandText = selectCommandText + "'S')";
                    }
                    command = new SqlCommand(selectCommandText, connection);
                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                        if (flag)
                        {
                            connection.Close();
                            flag = false;
                        }
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
            }
            connection.Close();
            flag = false;
            selectCommandText = "select * from " + Variables.gTermi + "TmpOCConfPend as PC1TmpOCConfPend";
            this.AdapTmp      = new SqlDataAdapter(selectCommandText, connectionString);
            this.AdapTmp.Fill(this.DS, "PC1TmpOCConfPend");
            this.Informe.Load(Application.StartupPath + @"\repocconfpend.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["almacen"];

            if (StringType.StrCmp(Variables.gCodAlmacen, Strings.Space(0), false) != 0)
            {
                definition.Text = "'Almacen: " + Strings.Trim(Variables.gNomAlmacen) + "'";
            }
            else
            {
                definition.Text = "'Todos los almacenes'";
            }
            FormulaFieldDefinition definition2 = formulaFields["formadesp"];

            if (StringType.StrCmp(Variables.gCodMetEnt, Strings.Space(0), false) != 0)
            {
                definition2.Text = "'Forma Despacho: " + Strings.Trim(Variables.gDescMetEnt) + "'";
            }
            else
            {
                definition2.Text = "'Todos las formas de despacho'";
            }
            FormulaFieldDefinition definition3 = formulaFields["diasdif"];

            definition3.Text = "'" + Strings.Format(Variables.gDiasDif, "###0") + "'";
            FormulaFieldDefinition definition4 = formulaFields["nodesp"];

            if (Variables.gNoDespachado)
            {
                definition4.Text = "'Solamente los items con tr\x00e1nsito no registrado'";
            }
            else
            {
                definition4.Text = "'Items despachados y no despachados'";
            }
            this.CrystalReportViewer1.ShowGroupTreeButton = true;
            this.CrystalReportViewer1.ReportSource        = this.Informe;
        }
Exemple #15
0
        public static void ReplaceTextsRpt(String RptFilePath, String OldText, String NewText, String DestFolder, String DestFilePrefix)
        {
            var CrDoc = new ReportDocument();

            Console.WriteLine(String.Format("Loading file {0}", RptFilePath));
            try {
                CrDoc.Load(RptFilePath);
                Console.WriteLine(String.Format("File {0} loaded successfully, report title: \"{1}\"", RptFilePath, CrDoc.SummaryInfo.ReportTitle));
            } catch (Exception e) {
                Console.WriteLine(String.Format("Error loading {0}: {1}", RptFilePath, e.Message));
                return;
            }
            ISCDReportClientDocument ClientDoc = CrDoc.ReportClientDocument;
            int ChangesCount = 0;

            foreach (var RepObj in CrDoc.ReportDefinition.ReportObjects)
            {
                switch (RepObj.GetType().ToString())
                {
                case "CrystalDecisions.CrystalReports.Engine.TextObject":
                    TextObject TextObj = (TextObject)RepObj;
                    if (TextObj.Text.Contains(OldText))
                    {
                        String TextBefore = TextObj.Text;
                        TextObj.Text = TextObj.Text.Replace(OldText, NewText);
                        Console.WriteLine("Replacing static text:");
                        Console.WriteLine(TextBefore);
                        Console.WriteLine("With:");
                        Console.WriteLine(TextObj.Text);
                        ChangesCount++;
                    }
                    break;

                case "CrystalDecisions.CrystalReports.Engine.FieldObject":
                    FieldObject FldObj = (FieldObject)RepObj;
                    if (FldObj.DataSource.GetType().ToString() == "CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition")
                    {
                        FormulaFieldDefinition FldDef = (FormulaFieldDefinition)FldObj.DataSource;
                        if (FldDef.Text.Contains(OldText))
                        {
                            String TextBefore = FldDef.Text;
                            FldDef.Text = FldDef.Text.Replace(OldText, NewText);
                            Console.WriteLine("Replacing formula:");
                            Console.WriteLine(Regex.Escape(TextBefore));
                            Console.WriteLine("With:");
                            Console.WriteLine(Regex.Escape(FldDef.Text));
                            ChangesCount++;
                        }
                    }
                    break;
                }
            }
            if (ChangesCount > 0)
            {
                Console.WriteLine(String.Format("No of changes in {0}: {1}", RptFilePath, ChangesCount));
                FileInfo oldRptFileInfo = new FileInfo(RptFilePath);
                String   NewFileName    = oldRptFileInfo.FullName.Replace(oldRptFileInfo.DirectoryName, DestFolder).Replace(@"\" + oldRptFileInfo.Name, @"\" + DestFilePrefix + oldRptFileInfo.Name);
                try {
                    CrDoc.SaveAs(NewFileName);
                    Console.WriteLine(String.Format("Saved as {0}", NewFileName));
                } catch (Exception e) {
                    Console.WriteLine(String.Format("Error saving {0}: {1}", NewFileName, e.Message));
                }
            }
            else
            {
                Console.WriteLine(String.Format("Number \"New text\" occurrences in {0}, skipping", RptFilePath));
            }
        }
Exemple #16
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            SqlDataAdapter adapter4;
            DataRow        row;
            DataSet        dataSet = new DataSet();

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096");

            connection2.Open();
            SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpRepGesEns", connection2);

            try
            {
                command.ExecuteNonQuery();
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                connection2.Close();
                ProjectData.ClearProjectError();
                return;

                ProjectData.ClearProjectError();
            }
            string        connectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=True;packet size=4096";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();
            string cmdText = "SELECT DISTINCT OR010100.OR01001,OR010100.OR01015,OR010100.OR01016,OR030100.OR03002,OR030100.OR03005,OR030100.OR03006,OR030100.OR03007,OR030100.OR03011,OR030100.OR03012,OR190100.OR19011,OR040100.OR04002,OR040100.OR04003,OR040100.OR04004,OR040100.OR04005,OR040100.OR04008 FROM dbo.OR010100 INNER JOIN dbo.OR030100 on OR010100.OR01001=OR030100.OR03001 LEFT OUTER JOIN dbo.OR040100 on OR010100.OR01001=OR040100.OR04001 LEFT OUTER JOIN dbo.OR190100 on OR030100.OR03001=OR190100.OR19001 and OR030100.OR03002=OR190100.OR19002 where OR010100.OR01002=6 and OR030100.OR03003='000' and OR190100.OR19003='000' ";

            if ((StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0))
            {
                cmdText = cmdText + " and OR190100.OR19011>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and OR190100.OR19011<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
            }
            if (StringType.StrCmp(Variables.gNroOE, "", false) != 0)
            {
                cmdText = cmdText + " and OR010100.OR01001='" + Variables.gNroOE + "'";
            }
            if (StringType.StrCmp(Variables.gNroOV, "", false) != 0)
            {
                cmdText = cmdText + " and rtrim(OR040100.OR04003)='" + Variables.gNroOV + "'";
            }
            command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                adapter4 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("Select SC01128,SY24003 from SC010100 inner join SY240100 on SC01128=SY24002 where SC01001='", reader["OR03005"]), "' and SY24001='II'")), connectionString);
                dataSet.Clear();
                adapter4.Fill(dataSet, "SC010100");
                row     = dataSet.Tables["SC010100"].Rows[0];
                cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRepGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,Grupo,NomGrupo,CantOE,CantArmado,Cliente,NroOV,Obs) values ('", reader["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',"));
                if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OR19011"])))
                {
                    cmdText = cmdText + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR19011"]), "MM/dd/yyyy") + "',";
                }
                else
                {
                    cmdText = cmdText + "Null,";
                }
                cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(cmdText + "'", reader["OR03002"]), "','"), reader["OR03005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR03006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR03007"]))), "','"), row["SC01128"]), "','"), row["SY24003"]), "',"), ObjectType.MulObj(reader["OR03011"], -1)), ","), ObjectType.MulObj(reader["OR03012"], -1)), ","));
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04002"])), "0", false) == 0)
                {
                    cmdText = cmdText + "'',";
                }
                else
                {
                    cmdText = cmdText + "'" + Strings.Trim(StringType.FromObject(reader["OR04002"])) + "',";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04003"])), "0", false) == 0)
                {
                    cmdText = cmdText + "'','')";
                }
                else
                {
                    cmdText = cmdText + "'" + Strings.Format(Conversion.Val(RuntimeHelpers.GetObjectValue(reader["OR04003"])), "0000000000") + "','')";
                }
                command = new SqlCommand(cmdText, connection2);
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception exception5)
                {
                    ProjectData.SetProjectError(exception5);
                    Exception exception2 = exception5;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                    reader.Close();
                    connection.Close();
                    connection2.Close();
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            reader.Close();
            cmdText = "SELECT DISTINCT OR200100.OR20001,OR200100.OR20015,OR200100.OR20016,OR210100.OR21002,OR210100.OR21005,OR210100.OR21006,OR210100.OR21007,OR210100.OR21011,OR210100.OR21012,OR230100.OR23011,OR220100.OR22002,OR220100.OR22003,OR220100.OR22004,OR220100.OR22005,OR220100.OR22008 FROM dbo.OR200100 INNER JOIN dbo.OR210100 on OR200100.OR20001=OR210100.OR21001 LEFT OUTER JOIN dbo.OR220100 on OR200100.OR20001=OR220100.OR22001 LEFT OUTER JOIN dbo.OR230100 on OR210100.OR21001=OR230100.OR23001 and OR210100.OR21002=OR230100.OR23002 and OR210100.OR21065=OR230100.OR23034 where OR200100.OR20002=6 and OR210100.OR21003='000' and OR230100.OR23003='000' ";
            if ((StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0))
            {
                cmdText = cmdText + " and OR230100.OR23011>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and OR230100.OR23011<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
            }
            if (StringType.StrCmp(Variables.gNroOE, "", false) != 0)
            {
                cmdText = cmdText + " and OR200100.OR20001='" + Variables.gNroOE + "'";
            }
            if (StringType.StrCmp(Variables.gNroOV, "", false) != 0)
            {
                cmdText = cmdText + " and rtrim(OR220100.OR22003)='" + Variables.gNroOV + "'";
            }
            command = new SqlCommand(cmdText, connection);
            command.CommandTimeout = 500;
            reader = command.ExecuteReader();
            while (reader.Read())
            {
                adapter4 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("Select SC01128,SY24003 from SC010100 inner join SY240100 on SC01128=SY24002 where SC01001='", reader["OR21005"]), "' and SY24001='II'")), connectionString);
                dataSet.Clear();
                adapter4.Fill(dataSet, "SC010100");
                row     = dataSet.Tables["SC010100"].Rows[0];
                cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRepGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,Grupo,NomGrupo,CantOE,CantArmado,Cliente,NroOV,Obs) values ('", reader["OR20001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR20015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR20016"]), "MM/dd/yyyy")), "',"));
                if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OR23011"])))
                {
                    cmdText = cmdText + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR23011"]), "MM/dd/yyyy") + "',";
                }
                else
                {
                    cmdText = cmdText + "Null,";
                }
                cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(cmdText + "'", reader["OR21002"]), "','"), reader["OR21005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR21006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR21007"]))), "','"), row["SC01128"]), "','"), row["SY24003"]), "',"), ObjectType.MulObj(reader["OR21011"], -1)), ","), ObjectType.MulObj(reader["OR21012"], -1)), ","));
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22002"])), "0", false) == 0)
                {
                    cmdText = cmdText + "'',";
                }
                else
                {
                    cmdText = cmdText + "'" + Strings.Trim(StringType.FromObject(reader["OR22002"])) + "',";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22003"])), "0", false) == 0)
                {
                    cmdText = cmdText + "'','')";
                }
                else
                {
                    cmdText = cmdText + "'" + Strings.Format(Conversion.Val(RuntimeHelpers.GetObjectValue(reader["OR22003"])), "0000000000") + "','')";
                }
                command = new SqlCommand(cmdText, connection2);
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception exception6)
                {
                    ProjectData.SetProjectError(exception6);
                    Exception exception3 = exception6;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null);
                    reader.Close();
                    connection.Close();
                    connection2.Close();
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            reader.Close();
            connection.Close();
            connection2.Close();
            try
            {
                SqlConnection connection4 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
                connection4.Open();
                SqlCommand command2 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection4);
                command2.CommandTimeout = 500;
                SqlDataAdapter adapter5 = new SqlDataAdapter();
                adapter5.SelectCommand = command2;
                dataSet.Clear();
                adapter5.Fill(dataSet, "PC1TmpRepGesEns");
                if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0)
                {
                    this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt");
                    this.Informe.SetDataSource(dataSet);
                    connection4.Close();
                }
                else
                {
                    this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt");
                    this.Informe.SetDataSource(dataSet);
                    connection4.Close();
                }
                FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
                FormulaFieldDefinition  definition    = formulaFields["desdefecha"];
                if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0)
                {
                    definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'";
                }
                else
                {
                    definition.Text = "''";
                }
                FormulaFieldDefinition definition2 = formulaFields["hastafecha"];
                if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)
                {
                    definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'";
                }
                else
                {
                    definition2.Text = "''";
                }
                this.CrystalReportViewer1.ReportSource = this.Informe;
                this.cmbSalir.Enabled = true;
            }
            catch (Exception exception7)
            {
                ProjectData.SetProjectError(exception7);
                Exception exception4 = exception7;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
        }
Exemple #17
0
 public frmRepOVPend1()
 {
     base.Closed += new EventHandler(this.frmRepOVPend1_Closed);
     base.Load   += new EventHandler(this.frmRepOVPend1_Load);
     base.Click  += new EventHandler(this.frmRepOVPend1_Click);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.InitializeComponent();
     try
     {
         string str;
         FormulaFieldDefinition definition6;
         SqlConnection          connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
         connection.Open();
         if (Variables.gOVaListar == 1)
         {
             str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend";
         }
         else if (Variables.gOVaListar == 2)
         {
             str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))";
         }
         else if (Variables.gOVaListar == 3)
         {
             str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1";
         }
         else if (Variables.gOVaListar == 4)
         {
             str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1";
         }
         else if (Variables.gOVaListar == 5)
         {
             str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)";
         }
         else if (Variables.gOVaListar == 6)
         {
             str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)";
         }
         SqlCommand command = new SqlCommand(str, connection);
         command.CommandTimeout      = 500;
         this.AdapOR01               = new SqlDataAdapter();
         this.AdapOR01.SelectCommand = command;
         this.DS.Clear();
         this.AdapOR01.Fill(this.DS, "PC1TmpOVPend");
         if (Variables.gOrdenList == 1)
         {
             this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt");
         }
         else if (Variables.gOrdenList == 2)
         {
             this.Informe.Load(Application.StartupPath + @"\repovpend.rpt");
         }
         else if (Variables.gOrdenList == 3)
         {
             this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt");
         }
         this.Informe.SetDataSource(this.DS);
         connection.Close();
         FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
         FormulaFieldDefinition  definition    = formulaFields["desdefechaov"];
         if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0)
         {
             definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition.Text = "''";
         }
         FormulaFieldDefinition definition2 = formulaFields["hastafechaov"];
         if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0)
         {
             definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition2.Text = "''";
         }
         FormulaFieldDefinition definition3 = formulaFields["desdefechaent"];
         if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0)
         {
             definition3.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition3.Text = "''";
         }
         FormulaFieldDefinition definition4 = formulaFields["hastafechaent"];
         if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0)
         {
             definition4.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition4.Text = "''";
         }
         FormulaFieldDefinition definition5 = formulaFields["tipo"];
         definition5.Text = "'" + Variables.gTipoList + "'";
         if (Variables.gOrdenList == 1)
         {
             definition6      = formulaFields["orden"];
             definition6.Text = "'Ordenado por Fecha de Entrega Prevista'";
         }
         else if (Variables.gOrdenList == 2)
         {
             definition6      = formulaFields["orden"];
             definition6.Text = "'Ordenado por N\x00b0 de Cliente'";
         }
         else if (Variables.gOrdenList == 3)
         {
             definition6      = formulaFields["orden"];
             definition6.Text = "'Ordenado por Fecha de Orden de Venta'";
         }
         this.CrystalReportViewer1.ReportSource = this.Informe;
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
         ProjectData.ClearProjectError();
     }
 }
        static void Main(string[] args)
        {
            if (args.Count() >= 1 && args[0] == "-s")
            {
                Simplified = true;
                args       = args.Skip(1).ToArray();
            }

            if (args.Count() < 1 || args[0] == "-h")
            {
                Console.WriteLine("CrystalReportReaderFramework [-s]  report_file_name.rpt");
                Console.WriteLine("");
                Console.WriteLine("    -s  : Simplify output by removing numbers from sections and text fields and by removing location information.");
                Console.WriteLine("          Simplified output makes it easier to compare reports where layout is not important.");
                Console.WriteLine("");
                return;
            }

            string fileName = args[0];

            ReportDocument reportDocument = new ReportDocument();

            reportDocument.Load(fileName);

            Database db = reportDocument.Database;

            foreach (var t in db.Tables)
            {
                Table  tbl    = t as Table;
                string prefix = "Database:Table:Name:" + tbl.Name + ":";
                Console.WriteLine(prefix);
                Console.WriteLine(prefix + "Location:" + tbl.Location);
                foreach (var f in tbl.Fields)
                {
                    FieldDefinition fd          = f as FieldDefinition;
                    string          fieldPrefix = prefix + "Field:Name:" + fd.Name + ":";
                    Console.WriteLine(fieldPrefix);
                    Console.WriteLine(fieldPrefix + "Kind:" + fd.Kind);
                    Console.WriteLine(fieldPrefix + "ValueType:" + fd.ValueType);
                }
            }

            foreach (var l in db.Links)
            {
                TableLink lnk        = l as TableLink;
                string    linkPRefix = "Database:TableLink:SourceTable:" + lnk.SourceTable.Name + ":DestinationTable:" + lnk.DestinationTable.Name + ":";
                Console.WriteLine(linkPRefix);
                Console.WriteLine(linkPRefix + "JoinType:" + lnk.JoinType);
                for (int i = 0; i < lnk.SourceFields.Count; i++)
                {
                    DatabaseFieldDefinition sfd = lnk.SourceFields[i] as DatabaseFieldDefinition;
                    DatabaseFieldDefinition dfd = lnk.DestinationFields[i] as DatabaseFieldDefinition;
                    Console.WriteLine(linkPRefix + "SourceField:Name:" + sfd.Name + ":DestinationField:Name:" + dfd.Name);
                }
            }


            var ffs = reportDocument.DataDefinition.FormulaFields;

            foreach (var ff in ffs)
            {
                FormulaFieldDefinition ffd = ff as FormulaFieldDefinition;
                Console.WriteLine("Formula:FormulaName:" + ffd.FormulaName + ":");
                if (ffd.Text != null)
                {
                    Console.WriteLine("Formula:FormulaName:" + ffd.FormulaName + ":Text:'" + MakeSingleLine(ffd.Text));
                }
            }

            var rtfs = reportDocument.DataDefinition.RunningTotalFields;

            foreach (var rtf in rtfs)
            {
                RunningTotalFieldDefinition rtfd = rtf as RunningTotalFieldDefinition;
                Group  rc     = rtfd.ResetCondition as Group;
                string prefix = "RunningTotal:FormulaName:" + rtfd.FormulaName + ":";
                Console.WriteLine(prefix + "Operation:" + rtfd.Operation);
                Console.WriteLine(prefix + "SummarizedField:" + rtfd.SummarizedField.Name + "," + rtfd.SummarizedField.FormulaName);
                Console.WriteLine(prefix + "EvaluationCondition:" + rtfd.EvaluationCondition);
                Console.WriteLine(prefix + "ResetCondition:" + rc.ConditionField.FormulaName);
            }


            var groups = reportDocument.DataDefinition.Groups;

            foreach (var gp in groups)
            {
                Group  gpd    = gp as Group;
                string prefix = "Group:GroupName:" + RemoveNumbersIfSimplified(gpd.ConditionField.FormulaName) + ":";
                Console.WriteLine(prefix);
                Console.WriteLine(prefix + "GroupOptions.Condition:" + gpd.GroupOptions.Condition);
            }



            var parameterFields = reportDocument.DataDefinition.ParameterFields;

            foreach (var pf in parameterFields)
            {
                ParameterFieldDefinition pfd = pf as ParameterFieldDefinition;
                var x = "ParameterFields:FormulaName:" + pfd.FormulaName + ":" +
                        "ParameterFieldName:" + pfd.ParameterFieldName;
                Console.WriteLine(x);
            }


            var sections = reportDocument.ReportDefinition.Sections;

            foreach (var section in sections)
            {
                Section sd     = section as Section;
                string  prefix = "Section:Name:" + RemoveNumbersIfSimplified(sd.Name) + ":";
                Console.WriteLine(prefix);
                Console.WriteLine(prefix + "Kind:" + sd.Kind);
                Console.WriteLine(prefix + "EnableKeepTogether:" + sd.SectionFormat.EnableKeepTogether);
                Console.WriteLine(prefix + "EnableSuppress:" + sd.SectionFormat.EnableSuppress);
                if (!Simplified)
                {
                    Console.WriteLine(prefix + "Height:" + sd.Height);
                    Console.WriteLine(prefix + "Height:" + sd.Height);
                }


                AddReportObjects(prefix, sd.ReportObjects);
            }

            // Console.WriteLine(reportDocument);
            //Console.ReadLine();
        }
Exemple #19
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            SqlDataAdapter adapter3;
            SqlCommand     command;
            DataRow        row;
            DataRow        row2;
            long           num;
            long           num2;
            SqlDataReader  reader;
            int            num3;
            SqlCommand     command3;
            SqlCommand     command5;
            string         str5;
            DataSet        dataSet = new DataSet();

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            string        connectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
            SqlConnection connection       = new SqlConnection(connectionString);
            string        str9             = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            SqlConnection connection2      = new SqlConnection(str9);

            connection2.Open();
            if ((Variables.gCodEstado == 1) | (Variables.gCodEstado == 4))
            {
                command5 = new SqlCommand("delete " + Variables.gTermi + "TmpOVPend", connection2);
                num3     = command5.ExecuteNonQuery();
                string str = "SELECT SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,sum(SC03003) as SC03003,sum(SC03004+SC03005) as StkComp,OR010100.OR01079 FROM dbo.SL010100,dbo.OR010100,dbo.OR030100,dbo.SC030100 where OR010100.OR01002<>6 and OR03011-OR03012<>0 ";
                command3 = new SqlCommand(((str + "and SC03002='01' and OR01050='01'") + " and OR01001='" + Variables.gNroOV + "'") + " and OR01001=OR03001 and OR01004=SL01001 and OR03005=SC03001" + " group by SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,OR010100.OR01079", connection);
                command3.CommandTimeout = 500;
                SqlDataAdapter adapter5 = new SqlDataAdapter();
                adapter5.SelectCommand = command3;
                connection.Open();
                adapter5.Fill(dataSet, "SC030100");
                long num10 = dataSet.Tables["SC030100"].Rows.Count - 1;
                for (num = 0L; num <= num10; num += 1L)
                {
                    row = dataSet.Tables["SC030100"].Rows[(int)num];
                    if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) > 0)
                    {
                        command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row["OR03005"]), "' and PC03043<PC03044 and PC03029=1 ")) + "and PC03035='01' order by PC03016", connection);
                        reader  = command.ExecuteReader();
                        if (reader.Read())
                        {
                            str5 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ",'"), row["OR01079"]), "')"));
                            reader.Close();
                            command5 = new SqlCommand(str5, connection2);
                        }
                        else
                        {
                            reader.Close();
                            command5 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2);
                        }
                    }
                    else if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) == 0)
                    {
                        command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR010100.OR01016,OR030100.OR03011,OR030100.OR03012 FROM dbo.OR030100,OR010100 where OR03005='", row["OR03005"]), "' and OR03012<OR03011 and OR01002=6 and OR03001=OR01001 order by OR01016")), connection);
                        reader  = command.ExecuteReader();
                        if (reader.Read())
                        {
                            str5 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["OR03011"], reader["OR03012"])), ",'"), row["OR01079"]), "')"));
                            reader.Close();
                            command5 = new SqlCommand(str5, connection2);
                        }
                        else
                        {
                            reader.Close();
                            command5 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2);
                        }
                    }
                    else
                    {
                        command5 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2);
                    }
                    try
                    {
                        num3 = command5.ExecuteNonQuery();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null);
                        connection.Close();
                        connection2.Close();
                        this.Close();
                        ProjectData.ClearProjectError();
                    }
                }
                connection.Close();
                connection2.Close();
                try
                {
                    connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                    connection       = new SqlConnection(connectionString);
                    connection.Open();
                    command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend", connection);
                    command3.CommandTimeout     = 500;
                    this.AdapOR01               = new SqlDataAdapter();
                    this.AdapOR01.SelectCommand = command3;
                    dataSet.Clear();
                    this.AdapOR01.Fill(dataSet, "PC1TmpOVPend");
                    this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendEnt.rpt");
                    this.Informe.SetDataSource(dataSet);
                    connection.Close();
                    FormulaFieldDefinition definition = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo");
                    if (Variables.gCodEstado == 1)
                    {
                        definition.set_Text("'Consulta Ordenes de Venta - Estado Pendiente de Entrega'");
                    }
                    else
                    {
                        definition.set_Text("'Consulta Ordenes de Venta - Estado Preparado pend.imp.doc.exp.'");
                    }
                    this.CrystalReportViewer1.set_ReportSource(this.Informe);
                    this.CrystalReportViewer1.Refresh();
                    this.cmbSalir.Enabled = true;
                }
                catch (Exception exception7)
                {
                    ProjectData.SetProjectError(exception7);
                    Exception exception2 = exception7;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, 0, null);
                    ProjectData.ClearProjectError();
                }
            }
            if (Variables.gCodEstado == 2)
            {
                if (Variables.gCodEstado == 2)
                {
                    SqlCommand     command2;
                    SqlDataAdapter adapter2 = new SqlDataAdapter("select * from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and NroRemito is null", str9);
                    adapter2.Fill(dataSet, "PrepPed");
                    if (dataSet.Tables["PrepPed"].Rows.Count != 0)
                    {
                        long num9 = dataSet.Tables["PrepPed"].Rows.Count - 1;
                        for (num = 0L; num <= num9; num += 1L)
                        {
                            row      = dataSet.Tables["PrepPed"].Rows[(int)num];
                            adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR19012 from OR190100 where OR19001='", row["NroOV"]), "' and OR19002='"), row["NroLinea"]), "' and OR19003='"), row["EstLinea"]), "' and OR19011='"), Strings.Format(RuntimeHelpers.GetObjectValue(row["FechaPrep"]), "MM/dd/yyyy")), "' and OR19012<>'' order by OR19012")), connectionString);
                            this.DS19.Clear();
                            adapter3.Fill(this.DS19, "OR190100");
                            if (this.DS19.Tables["OR190100"].Rows.Count != 0)
                            {
                                long num8 = this.DS19.Tables["OR190100"].Rows.Count - 1;
                                num2 = 0L;
                                while (num2 <= num8)
                                {
                                    row2    = this.DS19.Tables["OR190100"].Rows[(int)num2];
                                    command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("Select NroRemito from PrepPed where NroOV='", row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and EstLinea='"), row["EstLinea"]), "' and NroRemito='"), row2["OR19012"]), "'")), connection2);
                                    reader  = command.ExecuteReader();
                                    if (reader.Read())
                                    {
                                        reader.Close();
                                    }
                                    else
                                    {
                                        reader.Close();
                                        try
                                        {
                                            command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set NroRemito='", row2["OR19012"]), "' where NroOV='"), row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito is null")), connection2);
                                            num3     = command2.ExecuteNonQuery();
                                        }
                                        catch (Exception exception8)
                                        {
                                            ProjectData.SetProjectError(exception8);
                                            Exception exception3 = exception8;
                                            Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, 0, null);
                                            connection.Close();
                                            connection2.Close();
                                            this.Close();
                                            ProjectData.ClearProjectError();
                                        }
                                        goto Label_167A;
                                    }
                                    num2 += 1L;
                                }
                            }
                            else
                            {
                                adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR23012 from OR230100 where OR23001='", row["NroOV"]), "' and OR23002='"), row["NroLinea"]), "' and OR23003='"), row["EstLinea"]), "' and OR23011='"), Strings.Format(RuntimeHelpers.GetObjectValue(row["FechaPrep"]), "MM/dd/yyyy")), "' and OR23012<>'' order by OR23012")), connectionString);
                                this.DS20.Clear();
                                adapter3.Fill(this.DS20, "OR230100");
                                if (this.DS20.Tables["OR230100"].Rows.Count != 0)
                                {
                                    long num7 = this.DS20.Tables["OR230100"].Rows.Count - 1;
                                    num2 = 0L;
                                    while (num2 <= num7)
                                    {
                                        row2    = this.DS20.Tables["OR230100"].Rows[(int)num2];
                                        command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("Select NroRemito from PrepPed where NroOV='", row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito='"), row2["OR23012"]), "'")), connection2);
                                        reader  = command.ExecuteReader();
                                        if (reader.Read())
                                        {
                                            reader.Close();
                                        }
                                        else
                                        {
                                            reader.Close();
                                            try
                                            {
                                                command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set NroRemito='", row2["OR23012"]), "' where NroOV='"), row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito is null")), connection2);
                                                num3     = command2.ExecuteNonQuery();
                                            }
                                            catch (Exception exception9)
                                            {
                                                ProjectData.SetProjectError(exception9);
                                                Exception exception4 = exception9;
                                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, 0, null);
                                                connection.Close();
                                                connection2.Close();
                                                this.Close();
                                                ProjectData.ClearProjectError();
                                            }
                                            goto Label_167A;
                                        }
                                        num2 += 1L;
                                    }
                                }
                            }
                            Label_167A :;
                        }
                    }
                    new SqlDataAdapter("select NroOV from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and Producto=0 group by NroOV", str9).Fill(dataSet, "PrepPed");
                    if (dataSet.Tables["PrepPed"].Rows.Count != 0)
                    {
                        long num6 = dataSet.Tables["PrepPed"].Rows.Count - 1;
                        for (num = 0L; num <= num6; num += 1L)
                        {
                            row      = dataSet.Tables["PrepPed"].Rows[(int)num];
                            adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR01015,OR01072 from OR010100 where OR01001='", row["NroOV"]), "'")), connectionString);
                            this.DS19.Clear();
                            adapter3.Fill(this.DS19, "OR190100");
                            if (this.DS19.Tables["OR190100"].Rows.Count != 0)
                            {
                                row2 = this.DS19.Tables["OR190100"].Rows[0];
                                try
                                {
                                    command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set OCompra='", row2["OR01072"]), "',FechaOV='"), Strings.Format(RuntimeHelpers.GetObjectValue(row2["OR01015"]), "MM/dd/yyyy")), "' where NroOV='"), row["NroOV"]), "'")), connection2);
                                    num3     = command2.ExecuteNonQuery();
                                }
                                catch (Exception exception10)
                                {
                                    ProjectData.SetProjectError(exception10);
                                    Exception exception5 = exception10;
                                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception5.Message, 0, null);
                                    connection.Close();
                                    connection2.Close();
                                    this.Close();
                                    ProjectData.ClearProjectError();
                                }
                            }
                            else
                            {
                                adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR20015,OR20072 from OR200100 where OR20001='", row["NroOV"]), "'")), connectionString);
                                this.DS20.Clear();
                                adapter3.Fill(this.DS20, "OR230100");
                                if (this.DS20.Tables["OR230100"].Rows.Count != 0)
                                {
                                    row2 = this.DS20.Tables["OR230100"].Rows[0];
                                    try
                                    {
                                        num3 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set OCompra='", row2["OR20072"]), "',FechaOV='"), Strings.Format(RuntimeHelpers.GetObjectValue(row2["OR20015"]), "MM/dd/yyyy")), "' where NroOV='"), row["NroOV"]), "'")), connection2).ExecuteNonQuery();
                                    }
                                    catch (Exception exception11)
                                    {
                                        ProjectData.SetProjectError(exception11);
                                        Exception exception6 = exception11;
                                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception6.Message, 0, null);
                                        connection.Close();
                                        connection2.Close();
                                        this.Close();
                                        ProjectData.ClearProjectError();
                                    }
                                }
                            }
                        }
                    }
                }
                connection.Close();
                connection2.Close();
                this.AdapProdPend = new SqlDataAdapter("Select NroOV,NroLinea,EstLinea,Codigo,Desc1,Desc2,CantOrden,CantPrep,FechaPrep,NroRemito,Cliente,NomCli,OCompra,FechaOV from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and Producto=0", connectionString);
                this.AdapProdPend.Fill(dataSet, "PrepPed");
                this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendExp.rpt");
                this.Informe.SetDataSource(dataSet);
                this.CrystalReportViewer1.set_ReportSource(this.Informe);
                this.CrystalReportViewer1.Refresh();
                this.cmbSalir.Enabled = true;
            }
            if ((Variables.gCodEstado == 3) | (Variables.gCodEstado == 5))
            {
                command5 = new SqlCommand("delete " + Variables.gTermi + "TmpOVExped", connection2);
                num3     = command5.ExecuteNonQuery();
                reader   = new SqlCommand("Select Fecha from RecConfCliOV where NroOV='" + Variables.gNroOV + "'", connection2).ExecuteReader();
                if (reader.Read())
                {
                    Variables.gFechaRecConfCli = StringType.FromObject(reader["Fecha"]);
                    reader.Close();
                }
                else
                {
                    Variables.gFechaRecConfCli = "";
                    reader.Close();
                }
                adapter3 = new SqlDataAdapter("select OR19012,OR19034,OR01057,OR01058,OR01059,OR01060,OR03005,OR03006,OR03007,OR19030 from OR190100,OR010100,OR030100 where OR19001=OR01001 and OR19001=OR03001 AND OR19002=OR03002 AND OR19003=OR03003 and OR19001='" + Variables.gNroOV + "' and OR01002='" + StringType.FromInteger(Variables.gTipoOV) + "' and OR19011='" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy") + "' and OR19012<>''", connectionString);
                this.DS19.Clear();
                adapter3.Fill(this.DS19, "OR190100");
                if (this.DS19.Tables["OR190100"].Rows.Count != 0)
                {
                    long num5 = this.DS19.Tables["OR190100"].Rows.Count - 1;
                    for (num2 = 0L; num2 <= num5; num2 += 1L)
                    {
                        row2 = this.DS19.Tables["OR190100"].Rows[(int)num2];
                        str5 = ((((((((("insert into " + Variables.gTermi + "TmpOVExped (NroOV,TipoOV,Cliente,NomCli,OCompra,CodMetEnt,DescMetEnt,LugarEnt,FechaOV,FechaEnt,FechaPrep,FechaExp,FechaRecConfCli,NroRemito,NroFactura,PesoNeto,PesoBruto,Volumen,Bultos,CodProd,Desc1,Desc2,Cantidad) values ('" + Variables.gNroOV + "'," + StringType.FromInteger(Variables.gTipoOV)) + ",'" + Variables.gCliente) + "','" + Variables.gNomCli) + "','" + Variables.gNroOC + "'," + Variables.gCodMetEnt) + ",'" + Variables.gDescMetEnt) + "','" + Variables.gLugarEnt) + "','" + Strings.Format(Variables.gFechaOV, "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaEntOV), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaExp), "MM/dd/yyyy") + "',";
                        if (StringType.StrCmp(Variables.gFechaRecConfCli, Strings.Space(0), false) != 0)
                        {
                            str5 = str5 + "'" + Strings.Format(DateType.FromString(Variables.gFechaRecConfCli), "MM/dd/yyyy") + "',";
                        }
                        else
                        {
                            str5 = str5 + "Null,";
                        }
                        str5 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(str5 + "'", row2["OR19012"]), "','"), row2["OR19034"]), "',"), row2["OR01057"]), ","), row2["OR01058"]), ","), row2["OR01059"]), ","), row2["OR01060"]), ",'"), row2["OR03005"]), "','"), row2["OR03006"]), "','"), row2["OR03007"]), "',"), row2["OR19030"]), ")"));
                        reader.Close();
                        command5 = new SqlCommand(str5, connection2);
                        num3     = command5.ExecuteNonQuery();
                    }
                }
                else
                {
                    adapter3 = new SqlDataAdapter("select OR23012,OR23034,OR20057,OR20058,OR20059,OR20060,OR21005,OR21006,OR21007,OR23030 from OR230100,OR200100,OR210100 where OR23001=OR20001 and OR23001=OR21001 AND OR23002=OR21002 AND OR23003=OR21003 and OR23001='" + Variables.gNroOV + "' and OR20002='" + StringType.FromInteger(Variables.gTipoOV) + "' and OR23011='" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy") + "' and OR23012<>''", connectionString);
                    this.DS20.Clear();
                    adapter3.Fill(this.DS20, "OR200100");
                    if (this.DS20.Tables["OR200100"].Rows.Count != 0)
                    {
                        long num4 = this.DS20.Tables["OR200100"].Rows.Count - 1;
                        for (num2 = 0L; num2 <= num4; num2 += 1L)
                        {
                            row2 = this.DS20.Tables["OR200100"].Rows[(int)num2];
                            str5 = ((((((((("insert into " + Variables.gTermi + "TmpOVExped (NroOV,TipoOV,Cliente,NomCli,OCompra,CodMetEnt,DescMetEnt,LugarEnt,FechaOV,FechaEnt,FechaPrep,FechaExp,FechaRecConfCli,NroRemito,NroFactura,PesoNeto,PesoBruto,Volumen,Bultos,CodProd,Desc1,Desc2,Cantidad) values ('" + Variables.gNroOV + "'," + StringType.FromInteger(Variables.gTipoOV)) + ",'" + Variables.gCliente) + "','" + Variables.gNomCli) + "','" + Variables.gNroOC + "'," + Variables.gCodMetEnt) + ",'" + Variables.gDescMetEnt) + "','" + Variables.gLugarEnt) + "','" + Strings.Format(Variables.gFechaOV, "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaEntOV), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaExp), "MM/dd/yyyy") + "',";
                            if (StringType.StrCmp(Variables.gFechaRecConfCli, Strings.Space(0), false) != 0)
                            {
                                str5 = str5 + "'" + Strings.Format(DateType.FromString(Variables.gFechaRecConfCli), "MM/dd/yyyy") + "',";
                            }
                            else
                            {
                                str5 = str5 + "Null,";
                            }
                            str5 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(str5 + "'", row2["OR23012"]), "','"), row2["OR23034"]), "',"), row2["OR20057"]), ","), row2["OR20058"]), ","), row2["OR20059"]), ","), row2["OR20060"]), ",'"), row2["OR21005"]), "','"), row2["OR21006"]), "','"), row2["OR21007"]), "',"), row2["OR23030"]), ")"));
                            reader.Close();
                            num3 = new SqlCommand(str5, connection2).ExecuteNonQuery();
                        }
                    }
                }
                connection.Close();
                connection2.Close();
                command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVExped as PC1TmpOVExped", connection);
                command3.CommandTimeout     = 500;
                this.AdapOR01               = new SqlDataAdapter();
                this.AdapOR01.SelectCommand = command3;
                dataSet.Clear();
                this.AdapOR01.Fill(dataSet, "PC1TmpOVExped");
                this.Informe.Load(Application.StartupPath + @"\ConsultaOVExped.rpt");
                this.Informe.SetDataSource(dataSet);
                connection.Close();
                FormulaFieldDefinition definition2 = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo");
                if (Variables.gCodEstado == 3)
                {
                    definition2.set_Text("'Consulta Ordenes de Venta - Estado Expedido'");
                }
                else
                {
                    definition2.set_Text("'Consulta Ordenes de Venta - Estado Recepci\x00f3n Conformada'");
                }
                this.CrystalReportViewer1.set_ReportSource(this.Informe);
                this.CrystalReportViewer1.Refresh();
                this.cmbSalir.Enabled = true;
            }
        }
Exemple #20
0
 public frmConsultaOV2()
 {
     base.Closed += new EventHandler(this.frmConsultaOV2_Closed);
     base.Load   += new EventHandler(this.frmConsultaOV2_Load);
     base.Click  += new EventHandler(this.frmConsultaOV2_Click);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.DS19    = new DataSet();
     this.DS20    = new DataSet();
     this.InitializeComponent();
     try
     {
         SqlCommand    command;
         string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
         SqlConnection connection       = new SqlConnection(connectionString);
         connection.Open();
         if ((Variables.gCodEstado == 1) | (Variables.gCodEstado == 4))
         {
             command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend", connection);
             command.CommandTimeout      = 500;
             this.AdapOR01               = new SqlDataAdapter();
             this.AdapOR01.SelectCommand = command;
             this.DS.Clear();
             this.AdapOR01.Fill(this.DS, "PC1TmpOVPend");
             this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendEnt.rpt");
             this.Informe.SetDataSource(this.DS);
             connection.Close();
             FormulaFieldDefinition definition = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo");
             if (Variables.gCodEstado == 1)
             {
                 definition.set_Text("'Consulta Ordenes de Venta - Estado Pendiente de Entrega'");
             }
             else
             {
                 definition.set_Text("'Consulta Ordenes de Venta - Estado Preparado pend.imp.doc.exp.'");
             }
             this.CrystalReportViewer1.set_ReportSource(this.Informe);
         }
         if (Variables.gCodEstado == 2)
         {
             this.AdapProdPend = new SqlDataAdapter("Select NroOV,NroLinea,EstLinea,Codigo,Desc1,Desc2,CantOrden,CantPrep,FechaPrep,NroRemito,Cliente,NomCli,OCompra,FechaOV from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and Producto=0", connectionString);
             this.AdapProdPend.Fill(this.DS, "PrepPed");
             this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendExp.rpt");
             this.Informe.SetDataSource(this.DS);
             this.CrystalReportViewer1.set_ReportSource(this.Informe);
         }
         if ((Variables.gCodEstado == 3) | (Variables.gCodEstado == 5))
         {
             command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVExped as PC1TmpOVExped", connection);
             command.CommandTimeout      = 500;
             this.AdapOR01               = new SqlDataAdapter();
             this.AdapOR01.SelectCommand = command;
             this.DS.Clear();
             this.AdapOR01.Fill(this.DS, "PC1TmpOVExped");
             this.Informe.Load(Application.StartupPath + @"\ConsultaOVExped.rpt");
             this.Informe.SetDataSource(this.DS);
             connection.Close();
             FormulaFieldDefinition definition2 = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo");
             if (Variables.gCodEstado == 3)
             {
                 definition2.set_Text("'Consulta Ordenes de Venta - Estado Expedido'");
             }
             else
             {
                 definition2.set_Text("'Consulta Ordenes de Venta - Estado Recepci\x00f3n Conformada'");
             }
             this.CrystalReportViewer1.set_ReportSource(this.Informe);
         }
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #21
0
        public frmRepOCPendConf1()
        {
            base.Closed += new EventHandler(this.frmRepOCPendConf1_Closed);
            base.Load   += new EventHandler(this.frmRepOCPendConf1_Load);
            this.Informe = new ReportDocument();
            this.DS      = new DataSet();
            this.DS1     = new DataSet();
            this.InitializeComponent();
            bool   flag = false;
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";

            this.DS.Clear();
            this.DS1.Clear();
            string selectCommandText = "SELECT PC01001,PC01003,PC01004,PC01014,PC01015,PC01016 FROM dbo.PC010100";

            if (StringType.StrCmp(Variables.gCodProv, "", false) != 0)
            {
                selectCommandText = selectCommandText + " where PC01003='" + Variables.gCodProv + "'";
                if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and PC01014=" + Variables.gCodMetEnt;
                }
            }
            else if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0)
            {
                selectCommandText = selectCommandText + " where PC01014=" + Variables.gCodMetEnt;
            }
            this.AdapPC01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            selectCommandText = "SELECT PC03001,PC03005,PC03006,PC03007,PC03010,PC03011 FROM dbo.PC030100 where PC03011<PC03010 and PC03029=''";
            if (StringType.StrCmp(Variables.gCodAlmacen, "", false) != 0)
            {
                selectCommandText = selectCommandText + " and PC03035='" + Variables.gCodAlmacen + "'";
            }
            this.AdapPC03     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            selectCommandText = "SELECT SL01001,SL01002 FROM dbo.SL010100";
            this.AdapSL01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            selectCommandText = "SELECT PL01001,PL01002 FROM dbo.PL010100";
            this.AdapPL01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapPC01.Fill(this.DS, "PC010100");
            this.AdapPC03.Fill(this.DS, "PC030100");
            this.AdapSL01.Fill(this.DS, "SL010100");
            this.AdapPL01.Fill(this.DS, "PL010100");
            selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'";
            this.AdapPL23     = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapPL23.Fill(this.DS1, "PL230100");
            string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();
            flag = true;
            SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection);
            int        num2    = command.ExecuteNonQuery();
            int        num3    = this.DS1.Tables["PL230100"].Rows.Count - 1;

            for (int i = 0; i <= num3; i++)
            {
                DataRow row = this.DS1.Tables["PL230100"].Rows[i];
                command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection);
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                    if (flag)
                    {
                        connection.Close();
                        flag = false;
                    }
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            connection.Close();
            flag = false;
            selectCommandText = "select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp";
            this.AdapTmp      = new SqlDataAdapter(selectCommandText, connectionString);
            this.AdapTmp.Fill(this.DS, "PC1TmpFormaDesp");
            this.Informe.Load(Application.StartupPath + @"\repocpendconf.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["almacen"];

            if (StringType.StrCmp(Variables.gCodAlmacen, Strings.Space(0), false) != 0)
            {
                definition.Text = "'Almacen: " + Strings.Trim(Variables.gNomAlmacen) + "'";
            }
            else
            {
                definition.Text = "'Todos los almacenes'";
            }
            FormulaFieldDefinition definition2 = formulaFields["formadesp"];

            if (StringType.StrCmp(Variables.gCodMetEnt, Strings.Space(0), false) != 0)
            {
                definition2.Text = "'Forma Despacho: " + Strings.Trim(Variables.gDescMetEnt) + "'";
            }
            else
            {
                definition2.Text = "'Todos las formas de despacho'";
            }
            this.CrystalReportViewer1.ShowGroupTreeButton = true;
            this.CrystalReportViewer1.ReportSource        = this.Informe;
        }
Exemple #22
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            DataSet dataSet = new DataSet();

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            SqlConnection connection  = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096");
            SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");

            connection2.Open();
            SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpOVPend", connection2);
            int        num2     = command4.ExecuteNonQuery();
            string     cmdText  = "SELECT SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,sum(SC03003) as SC03003,sum(SC03004+SC03005) as StkComp,OR010100.OR01079 FROM dbo.SL010100,dbo.OR010100,dbo.OR030100,dbo.SC030100 where OR010100.OR01002<>6 and OR03011-OR03012<>0 ";

            if (StringType.StrCmp(Variables.gAlmacen1, "01", false) == 0)
            {
                cmdText = cmdText + "and SC03002='01' and OR01050='01'";
            }
            else
            {
                cmdText = cmdText + "and SC03002='02' and OR01050='02'";
            }
            if ((StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0))
            {
                cmdText = cmdText + " and OR01015>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "MM/dd/yyyy") + "' and OR01015<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "MM/dd/yyyy") + "'";
            }
            if ((StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0))
            {
                cmdText = cmdText + " and OR01016>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR01016<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'";
            }
            if (StringType.StrCmp(Variables.gCodCli, Strings.Space(0), false) != 0)
            {
                cmdText = cmdText + " and OR01004='" + Variables.gCodCli + "'";
            }
            cmdText = cmdText + " and OR01001=OR03001 and OR01004=SL01001 and OR03005=SC03001" + " group by SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,OR010100.OR01079";
            SqlCommand command2 = new SqlCommand(cmdText, connection);

            command2.CommandTimeout = 500;
            SqlDataAdapter adapter3 = new SqlDataAdapter();

            adapter3.SelectCommand = command2;
            connection.Open();
            adapter3.Fill(dataSet, "SC030100");
            long num3 = dataSet.Tables["SC030100"].Rows.Count - 1;

            for (long i = 0L; i <= num3; i += 1L)
            {
                SqlDataReader reader;
                string        str4;
                DataRow       row = dataSet.Tables["SC030100"].Rows[(int)i];
                if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) > 0)
                {
                    cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row["OR03005"]), "' and PC03043<PC03044 and PC03029=1 "));
                    if (StringType.StrCmp(Variables.gAlmacen1, "01", false) == 0)
                    {
                        cmdText = cmdText + "and PC03035='01' order by PC03016";
                    }
                    else
                    {
                        cmdText = cmdText + "and PC03035='02' order by PC03016";
                    }
                    SqlCommand command = new SqlCommand(cmdText, connection);
                    reader = command.ExecuteReader();
                    if (reader.Read())
                    {
                        str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ",'"), row["OR01079"]), "')"));
                        reader.Close();
                        command4 = new SqlCommand(str4, connection2);
                    }
                    else
                    {
                        reader.Close();
                        command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2);
                    }
                }
                else if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) == 0)
                {
                    cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR010100.OR01016,OR030100.OR03011,OR030100.OR03012 FROM dbo.OR030100,OR010100 where OR03005='", row["OR03005"]), "' and OR03012<OR03011 and OR01002=6 and OR03001=OR01001 order by OR01016"));
                    reader  = new SqlCommand(cmdText, connection).ExecuteReader();
                    if (reader.Read())
                    {
                        str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["OR03011"], reader["OR03012"])), ",'"), row["OR01079"]), "')"));
                        reader.Close();
                        command4 = new SqlCommand(str4, connection2);
                    }
                    else
                    {
                        reader.Close();
                        command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2);
                    }
                }
                else
                {
                    command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2);
                }
                try
                {
                    num2 = command4.ExecuteNonQuery();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                    connection.Close();
                    connection2.Close();
                    this.Close();
                    ProjectData.ClearProjectError();
                }
            }
            connection.Close();
            connection2.Close();
            try
            {
                FormulaFieldDefinition definition6;
                connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
                connection.Open();
                if (Variables.gOVaListar == 1)
                {
                    cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend";
                }
                else if (Variables.gOVaListar == 2)
                {
                    cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))";
                }
                else if (Variables.gOVaListar == 3)
                {
                    cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1";
                }
                else if (Variables.gOVaListar == 4)
                {
                    cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1";
                }
                else if (Variables.gOVaListar == 5)
                {
                    cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)";
                }
                else if (Variables.gOVaListar == 6)
                {
                    cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)";
                }
                command2 = new SqlCommand(cmdText, connection);
                command2.CommandTimeout     = 500;
                this.AdapOR01               = new SqlDataAdapter();
                this.AdapOR01.SelectCommand = command2;
                dataSet.Clear();
                this.AdapOR01.Fill(dataSet, "PC1TmpOVPend");
                if (Variables.gOrdenList == 1)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt");
                }
                else if (Variables.gOrdenList == 2)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovpend.rpt");
                }
                else if (Variables.gOrdenList == 3)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt");
                }
                this.Informe.SetDataSource(dataSet);
                connection.Close();
                FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
                FormulaFieldDefinition  definition    = formulaFields["desdefechaov"];
                if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0)
                {
                    definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'";
                }
                else
                {
                    definition.Text = "''";
                }
                FormulaFieldDefinition definition2 = formulaFields["hastafechaov"];
                if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0)
                {
                    definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'";
                }
                else
                {
                    definition2.Text = "''";
                }
                FormulaFieldDefinition definition3 = formulaFields["desdefechaent"];
                if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0)
                {
                    definition3.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'";
                }
                else
                {
                    definition3.Text = "''";
                }
                FormulaFieldDefinition definition4 = formulaFields["hastafechaent"];
                if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0)
                {
                    definition4.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'";
                }
                else
                {
                    definition4.Text = "''";
                }
                FormulaFieldDefinition definition5 = formulaFields["tipo"];
                definition5.Text = "'" + Variables.gTipoList + "'";
                if (Variables.gOrdenList == 1)
                {
                    definition6      = formulaFields["orden"];
                    definition6.Text = "'Ordenado por Fecha de Entrega Prevista'";
                }
                else if (Variables.gOrdenList == 2)
                {
                    definition6      = formulaFields["orden"];
                    definition6.Text = "'Ordenado por N\x00b0 de Cliente'";
                }
                else if (Variables.gOrdenList == 3)
                {
                    definition6      = formulaFields["orden"];
                    definition6.Text = "'Ordenado por Fecha de Orden de Venta'";
                }
                this.CrystalReportViewer1.ReportSource = this.Informe;
                this.CrystalReportViewer1.Refresh();
                this.cmbSalir.Enabled = true;
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
        }
Exemple #23
0
 public frmRepRMDesp1()
 {
     base.Closed += new EventHandler(this.frmRepRMDesp1_Closed);
     base.Load   += new EventHandler(this.frmRepRMDesp1_Load);
     base.Click  += new EventHandler(this.frmRepRMDesp1_Click);
     base.Leave  += new EventHandler(this.frmRepRMDesp1_Leave);
     this.Informe = new ReportDocument();
     this.DS      = new DataSet();
     this.InitializeComponent();
     try
     {
         SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
         connection.Open();
         string str = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null";
         if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)))
         {
             if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))
             {
                 str = str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'";
             }
             else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0))
             {
                 str = str + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
             }
             else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0))
             {
                 str = (str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'";
             }
         }
         SqlCommand command = new SqlCommand(str + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection);
         command.CommandTimeout     = 500;
         this.AdapTmp               = new SqlDataAdapter();
         this.AdapTmp.SelectCommand = command;
         this.DS.Clear();
         this.AdapTmp.Fill(this.DS, "PrepPed");
         this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt");
         this.Informe.SetDataSource(this.DS);
         connection.Close();
         FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
         FormulaFieldDefinition  definition    = formulaFields["desdefecha"];
         if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0)
         {
             definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition.Text = "''";
         }
         FormulaFieldDefinition definition2 = formulaFields["hastafecha"];
         if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)
         {
             definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'";
         }
         else
         {
             definition2.Text = "''";
         }
         this.CrystalReportViewer1.ReportSource = this.Informe;
         this.CrystalReportViewer1.Zoom(1);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #24
0
        public frmRepInvFis1()
        {
            base.Closed += new EventHandler(this.frmRepInvFis1_Closed);
            this.DS      = new DataSet();
            this.DS1     = new DataSet();
            this.DSTmp   = new DataSet();
            this.Informe = new ReportDocument();
            this.InitializeComponent();
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            string selectCommandText      = "select * from Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "'";

            if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) != 0)
            {
                selectCommandText = selectCommandText + " and Operador='" + Variables.gOperario + "'";
            }
            if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) != 0))
            {
                selectCommandText = selectCommandText + " and Codigo>='" + Variables.gCodProdDesde + "' and Codigo<='" + Variables.gCodProdHasta + "'";
            }
            if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) != 0)
            {
                selectCommandText = selectCommandText + " and Fecha='" + Strings.Format(DateType.FromString(Variables.gFechaLec), "MM/dd/yyyy") + "'";
            }
            this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString);
            this.AdapTmp.Fill(this.DS, "Inventario");
            this.Informe.Load(Application.StartupPath + @"\repinvfis.rpt");
            this.Informe.SetDataSource(this.DS);
            FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
            FormulaFieldDefinition  definition    = formulaFields["fechainv"];

            definition.Text = "'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'";
            FormulaFieldDefinition definition2 = formulaFields["operario"];

            if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) == 0)
            {
                definition2.Text = "'Todos los operarios'";
            }
            else
            {
                definition2.Text = "'Operario: " + Variables.gOperario + "'";
            }
            FormulaFieldDefinition definition3 = formulaFields["productos"];

            if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) == 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) == 0))
            {
                definition3.Text = "'Todos los productos'";
            }
            else
            {
                definition3.Text = "'Desde Producto: " + Variables.gCodProdDesde + "-" + Strings.Trim(Variables.gDescProdDesde1) + " " + Strings.Trim(Variables.gDescProdDesde2) + " Hasta Producto: " + Variables.gCodProdHasta + "-" + Strings.Trim(Variables.gDescProdHasta1) + " " + Strings.Trim(Variables.gDescProdHasta2) + "'";
            }
            FormulaFieldDefinition definition4 = formulaFields["fechalec"];

            if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) == 0)
            {
                definition4.Text = "'Todos las fechas de lectura'";
            }
            else
            {
                definition4.Text = "'Fecha de Lectura: " + Strings.Format(DateType.FromString(Variables.gFechaLec), "dd/MM/yyyy") + "'";
            }
            this.CrystalReportViewer1.ReportSource = this.Informe;
        }
Exemple #25
0
        public frmRepOAPend1()
        {
            string str;
            string str3;

            base.Closed += new EventHandler(this.frmRepOAPend1_Closed);
            base.Load   += new EventHandler(this.frmRepOAPend1_Load);
            this.Informe = new ReportDocument();
            this.DS      = new DataSet();
            this.InitializeComponent();
            if (Variables.gOrdenOA == 1)
            {
                str3         = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                str          = "SELECT * from " + Variables.gTermi + "TmpCalendario as PC1TmpCalendario where FechaEnt<'" + Strings.Format(DateTime.Now, "MM/dd/yyyy") + "' and not NroOA is null";
                this.AdapTmp = new SqlDataAdapter(str, str3);
                this.AdapTmp.Fill(this.DS, "PC1TmpCalendario");
                str          = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs";
                this.AdapObs = new SqlDataAdapter(str, str3);
                this.AdapObs.Fill(this.DS, "GesEnsObs");
                str           = "SELECT * from " + Variables.gTermi + "TmpCalendarioStkComp as PC1TmpCalendarioStkComp";
                this.AdapTmp1 = new SqlDataAdapter(str, str3);
                this.AdapTmp1.Fill(this.DS, "PC1TmpCalendarioStkComp");
                this.Informe.Load(Application.StartupPath + @"\repoapendcalatr.rpt");
                this.Informe.SetDataSource(this.DS);
                FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
                FormulaFieldDefinition  definition    = formulaFields["orden"];
                definition.Text = "'ordenado por Fecha Entrega'";
                FormulaFieldDefinition definition2 = formulaFields["Intr01"];
                definition2.Text = "'" + Variables.gNomIntr01 + "'";
                FormulaFieldDefinition definition3 = formulaFields["Intr02"];
                definition3.Text = "'" + Variables.gNomIntr02 + "'";
                FormulaFieldDefinition definition4 = formulaFields["Intr03"];
                definition4.Text = "'" + Variables.gNomIntr03 + "'";
                FormulaFieldDefinition definition5 = formulaFields["Intr04"];
                definition5.Text = "'" + Variables.gNomIntr04 + "'";
                this.CrystalReportViewer1.ShowGroupTreeButton = true;
                this.CrystalReportViewer1.ReportSource        = this.Informe;
                this.CrystalReportViewer1.Zoom(1);
            }
            else
            {
                string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
                str           = "SELECT OR01001,OR01015,OR01016 FROM dbo.OR010100 where OR010100.OR01002=6 and OR010100.OR01091=0 order by OR010100.OR01001";
                this.AdapOR01 = new SqlDataAdapter(str, selectConnectionString);
                str           = "SELECT OR03001,OR03002,OR03005,OR03006,OR03007,OR03011,OR03012,OR03034 FROM dbo.OR030100 where OR03011-OR03012<>0 and OR03034=1 order by OR03005";
                this.AdapOR03 = new SqlDataAdapter(str, selectConnectionString);
                str           = "SELECT OR04001,OR04002,OR04003,OR04004,OR04005,OR04008 FROM dbo.OR040100";
                this.AdapSL01 = new SqlDataAdapter(str, selectConnectionString);
                this.AdapOR01.Fill(this.DS, "OR010100");
                this.AdapOR03.Fill(this.DS, "OR030100");
                this.AdapSL01.Fill(this.DS, "OR040100");
                str3         = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                str          = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs";
                this.AdapObs = new SqlDataAdapter(str, str3);
                this.AdapObs.Fill(this.DS, "GesEnsObs");
                this.Informe.Load(Application.StartupPath + @"\repoapend.rpt");
                this.Informe.SetDataSource(this.DS);
                FormulaFieldDefinition definition6 = this.Informe.DataDefinition.FormulaFields["orden"];
                definition6.Text = "'ordenado por N\x00b0 O.Armado'";
                this.CrystalReportViewer1.ShowGroupTreeButton = false;
                this.CrystalReportViewer1.ReportSource        = this.Informe;
                this.CrystalReportViewer1.Zoom(1);
            }
        }
Exemple #26
0
        public frmRepOVExp1()
        {
            base.Closed += new EventHandler(this.frmRepOVExp1_Closed);
            base.Load   += new EventHandler(this.frmRepOVExp1_Load);
            base.Click  += new EventHandler(this.frmRepOVExp1_Click);
            this.Informe = new ReportDocument();
            this.DS      = new DataSet();
            this.DS1     = new DataSet();
            this.InitializeComponent();
            try
            {
                FormulaFieldDefinition definition2;
                bool   flag = false;
                string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
                this.DS.Clear();
                this.DS1.Clear();
                string selectCommandText = "SELECT OR01001,OR01004,OR01014,OR01016,OR01050,OR01072 from OR010100 where OR01002<>6";
                if ((StringType.StrCmp(Variables.gAlmacen1, "", false) != 0) & (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0))
                {
                    selectCommandText = selectCommandText + " and (OR01050='" + Variables.gAlmacen1 + "' or OR01050='" + Variables.gAlmacen2 + "')";
                }
                else if (StringType.StrCmp(Variables.gAlmacen1, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen1 + "'";
                }
                else if (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen2 + "'";
                }
                if (StringType.StrCmp(Variables.gCodCli, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and OR01004='" + Variables.gCodCli + "'";
                }
                else
                {
                    selectCommandText = selectCommandText + " and ((OR01004>='600000' and OR01004<='699000') or OR01004='00WARREXPO')";
                }
                this.AdapOR01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                selectCommandText = "SELECT OR03001,OR03005,OR03006,OR03007,OR03011,OR03012,OR03019,OR03067,OR03068 FROM dbo.OR030100 where OR03011-OR03012<>0";
                this.AdapOR03     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                if (Variables.gOVaListar == 1)
                {
                    selectCommandText = "SELECT SL01001,SL01002 from SL010100";
                }
                else if (Variables.gOVaListar == 2)
                {
                    selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01060='1'";
                }
                else if (Variables.gOVaListar == 3)
                {
                    selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01075='1'";
                }
                this.AdapSL01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                selectCommandText = "SELECT SC23001,SC23002 FROM dbo.SC230100";
                this.AdapSC23     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                selectCommandText = "SELECT PC03001,PC03002,PC03029 FROM dbo.PC030100";
                this.AdapPC03     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                this.AdapOR01.Fill(this.DS, "OR010100");
                this.AdapOR03.Fill(this.DS, "OR030100");
                this.AdapSL01.Fill(this.DS, "SL010100");
                this.AdapSC23.Fill(this.DS, "SC230100");
                this.AdapPC03.Fill(this.DS, "PC030100");
                selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'";
                this.AdapPL23     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                this.AdapPL23.Fill(this.DS1, "PL230100");
                string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                SqlConnection connection       = new SqlConnection(connectionString);
                connection.Open();
                flag = true;
                SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection);
                int        num2    = command.ExecuteNonQuery();
                int        num3    = this.DS1.Tables["PL230100"].Rows.Count - 1;
                for (int i = 0; i <= num3; i++)
                {
                    DataRow row = this.DS1.Tables["PL230100"].Rows[i];
                    command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection);
                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                        if (flag)
                        {
                            connection.Close();
                            flag = false;
                        }
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
                connection.Close();
                flag = false;
                selectCommandText = "select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp";
                this.AdapTmp      = new SqlDataAdapter(selectCommandText, connectionString);
                this.AdapTmp.Fill(this.DS, "PC1TmpFormaDesp");
                if (Variables.gOrdenList == 1)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovexp1.rpt");
                }
                else if (Variables.gOrdenList == 2)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovexp2.rpt");
                }
                this.Informe.SetDataSource(this.DS);
                FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
                FormulaFieldDefinition  definition    = formulaFields["tipo"];
                definition.Text = "'" + Variables.gTipoList + "'";
                if (Variables.gOrdenList == 1)
                {
                    definition2      = formulaFields["orden"];
                    definition2.Text = "'Ordenado por Orden de Compra Cliente'";
                }
                else if (Variables.gOrdenList == 2)
                {
                    definition2      = formulaFields["orden"];
                    definition2.Text = "'Ordenado por Fecha Confirmada'";
                }
                this.CrystalReportViewer1.ReportSource = this.Informe;
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
        }
Exemple #27
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            DataRow       row;
            long          num;
            SqlDataReader reader;
            string        str4;
            DataSet       dataSet = new DataSet();

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            SqlConnection connection  = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096");
            SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");

            connection2.Open();
            SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpRegPedExp", connection2);
            int        num2     = command4.ExecuteNonQuery();
            string     str      = "SELECT OR01001,OR01004,OR01016,OR01024,OR01072,OR03019,sum((OR03011-OR03012)*OR03008) as ImpAFac,OR04005,SL01002,PL23004,SY14002 FROM dbo.OR010100 inner join OR030100 on OR010100.OR01001=OR030100.OR03001 inner join OR040100 on OR010100.OR01001=OR040100.OR04001 inner join SL010100 on OR010100.OR01004=SL010100.SL01001 inner join PL230100 on OR010100.OR01014=convert(int,PL230100.PL23003)  inner join SY140100 on OR010100.OR01028=SY140100.SY14001 where OR010100.OR01002<>6 and OR03011-OR03012<>0 and ((OR01004>='600000' and OR01004<='699000') or OR01004='00WARREXPO')";

            if ((StringType.StrCmp(Variables.gDesdeFechaEnt, "", false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, "", false) != 0))
            {
                str = str + " and OR03019>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR03019<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'";
            }
            SqlCommand command2 = new SqlCommand(str + " and PL23001='2' and PL23002='00'" + " group by OR01001,OR01004,OR01016,OR01024,OR01072,OR03019,OR04005,SL01002,PL23004,SY14002", connection);

            command2.CommandTimeout = 500;
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = command2;
            connection.Open();
            adapter.Fill(dataSet, "OR010100");
            long num4 = dataSet.Tables["OR010100"].Rows.Count - 1;

            for (num = 0L; num <= num4; num += 1L)
            {
                row = dataSet.Tables["OR010100"].Rows[(int)num];
                SqlCommand command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC01001,PL01002 FROM dbo.PC010100 inner join PL010100 on PC010100.PC01003=PL010100.PL01001 where PC01017='ORDEN VENT", row["OR01001"]), "'")), connection);
                reader = command.ExecuteReader();
                if (reader.Read())
                {
                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (1,'", row["OR01004"]), "','"), row["SL01002"]), "','"), row["OR01072"]), "','"), row["OR01001"]), "','"), reader["PC01001"]), "','"), reader["PL01002"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR03019"]), "MM/dd/yyyy")), "','"), row["OR04005"]), "','"), row["SY14002"]), "',"), row["OR01024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')"));
                    reader.Close();
                    command4 = new SqlCommand(str4, connection2);
                }
                else
                {
                    reader.Close();
                    command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (1,'", row["OR01004"]), "','"), row["SL01002"]), "','"), row["OR01072"]), "','"), row["OR01001"]), "','','','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR03019"]), "MM/dd/yyyy")), "','"), row["OR04005"]), "','"), row["SY14002"]), "',"), row["OR01024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')")), connection2);
                }
                try
                {
                    num2 = command4.ExecuteNonQuery();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null);
                    connection.Close();
                    connection2.Close();
                    this.Close();
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            str = "SELECT OR20001,OR20004,OR20016,OR20024,OR20072,OR21019,sum((OR21011-OR21012)*OR21008) as ImpAFac,OR22005,SL01002,PL23004,SY14002 FROM dbo.OR200100 inner join OR210100 on OR200100.OR20001=OR210100.OR21001 inner join OR220100 on OR200100.OR20001=OR220100.OR22001 inner join SL010100 on OR200100.OR20004=SL010100.SL01001 inner join PL230100 on OR200100.OR20014=convert(int,PL230100.PL23003)  inner join SY140100 on OR200100.OR20028=SY140100.SY14001 where OR200100.OR20002<>6 and OR21011-OR21012<>0 and ((OR20004>='600000' and OR20004<='699000') or OR20004='00WARREXPO')";
            if ((StringType.StrCmp(Variables.gDesdeFechaEnt, "", false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, "", false) != 0))
            {
                str = str + " and OR21019>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR21019<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'";
            }
            command2 = new SqlCommand(str + " and PL23001='2' and PL23002='00'" + " group by OR20001,OR20004,OR20016,OR20024,OR20072,OR21019,OR22005,SL01002,PL23004,SY14002", connection);
            command2.CommandTimeout = 500;
            SqlDataAdapter adapter2 = new SqlDataAdapter();

            adapter2.SelectCommand = command2;
            adapter2.Fill(dataSet, "OR200100");
            long num3 = dataSet.Tables["OR200100"].Rows.Count - 1;

            for (num = 0L; num <= num3; num += 1L)
            {
                row    = dataSet.Tables["OR200100"].Rows[(int)num];
                reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC01001,PL01002 FROM dbo.PC010100 inner join PL010100 on PC010100.PC01003=PL010100.PL01001 where PC01017='ORDEN VENT", row["OR20001"]), "'")), connection).ExecuteReader();
                if (reader.Read())
                {
                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (2,'", row["OR20004"]), "','"), row["SL01002"]), "','"), row["OR20072"]), "','"), row["OR20001"]), "','"), reader["PC01001"]), "','"), reader["PL01002"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR20016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR21019"]), "MM/dd/yyyy")), "','"), row["OR22005"]), "','"), row["SY14002"]), "',"), row["OR20024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')"));
                    reader.Close();
                    command4 = new SqlCommand(str4, connection2);
                }
                else
                {
                    reader.Close();
                    command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (2,'", row["OR20004"]), "','"), row["SL01002"]), "','"), row["OR20072"]), "','"), row["OR20001"]), "','','','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR20016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR21019"]), "MM/dd/yyyy")), "','"), row["OR22005"]), "','"), row["SY14002"]), "',"), row["OR20024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')")), connection2);
                }
                try
                {
                    num2 = command4.ExecuteNonQuery();
                }
                catch (Exception exception4)
                {
                    ProjectData.SetProjectError(exception4);
                    Exception exception2 = exception4;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, 0, null);
                    connection.Close();
                    connection2.Close();
                    this.Close();
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            connection.Close();
            connection2.Close();
            try
            {
                connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
                connection.Open();
                command2 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRegPedExp as PC1TmpRegPedExp", connection);
                command2.CommandTimeout = 500;
                adapter = new SqlDataAdapter();
                adapter.SelectCommand = command2;
                dataSet.Clear();
                adapter.Fill(dataSet, "PC1TmpRegPedExp");
                this.Informe.Load(Application.StartupPath + @"\repregpedexp.rpt");
                this.Informe.SetDataSource(dataSet);
                connection.Close();
                FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields();
                FormulaFieldDefinition  definition  = definitions.get_Item("desdefechaent");
                if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0)
                {
                    definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'");
                }
                else
                {
                    definition.set_Text("''");
                }
                FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaent");
                if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0)
                {
                    definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'");
                }
                else
                {
                    definition2.set_Text("''");
                }
                this.CrystalReportViewer1.set_ReportSource(this.Informe);
                this.CrystalReportViewer1.Refresh();
                this.cmbSalir.Enabled = true;
            }
            catch (Exception exception5)
            {
                ProjectData.SetProjectError(exception5);
                Exception exception3 = exception5;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, 0, null);
                ProjectData.ClearProjectError();
            }
        }