Esempio n. 1
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;
        }
Esempio n. 2
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;
        }
Esempio n. 3
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;
        }
Esempio n. 4
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;
        }
Esempio n. 5
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=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
     connection.Open();
     SqlCommand command3 = new SqlCommand("SELECT * from NovedadesOV where NroOV='" + Variables.gNroOV + "'", connection);
     command3.CommandTimeout = 500;
     this.AdapOR01 = new SqlDataAdapter();
     this.AdapOR01.SelectCommand = command3;
     dataSet.Clear();
     this.AdapOR01.Fill(dataSet, "NovedadesOV");
     this.Informe.Load(Application.StartupPath + @"\ConsultaOVNov.rpt");
     this.Informe.SetDataSource(dataSet);
     connection.Close();
     this.CrystalReportViewer1.set_ReportSource(this.Informe);
 }
Esempio n. 6
0
 protected void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
 {
     OnInit(e);
     ViewCystalReport();
 }
Esempio n. 7
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            SqlDataAdapter adapter2;
            SqlCommand     command2;
            DataRow        row;
            DataRow        row2;
            int            num;
            int            num3;

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

            connection2.Open();
            string        str6       = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
            SqlConnection connection = new SqlConnection(str6);

            connection.Open();
            this.DS.Clear();
            string selectCommandText = "select * from PrepPed where ContFinal='N' and NroRemito is null";

            new SqlDataAdapter(selectCommandText, connectionString).Fill(this.DS, "PrepPed");
            if (this.DS.Tables["PrepPed"].Rows.Count != 0)
            {
                int num7 = this.DS.Tables["PrepPed"].Rows.Count - 1;
                for (num = 0; num <= num7; num++)
                {
                    SqlCommand    command;
                    int           num2;
                    SqlDataReader reader;
                    row      = this.DS.Tables["PrepPed"].Rows[num];
                    adapter2 = 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")), str6);
                    this.DS19.Clear();
                    adapter2.Fill(this.DS19, "OR190100");
                    if (this.DS19.Tables["OR190100"].Rows.Count != 0)
                    {
                        int num6 = this.DS19.Tables["OR190100"].Rows.Count - 1;
                        num2 = 0;
                        while (num2 <= num6)
                        {
                            row2    = this.DS19.Tables["OR190100"].Rows[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 exception1)
                                {
                                    ProjectData.SetProjectError(exception1);
                                    Exception exception = exception1;
                                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                                    connection2.Close();
                                    connection.Close();
                                    this.Close();
                                    ProjectData.ClearProjectError();
                                }
                                break;
                            }
                            num2++;
                        }
                    }
                    else if (ObjectType.ObjTst(row["Producto"], 1, false) == 0)
                    {
                        command = new SqlCommand(StringType.FromObject(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<>'000' and OR19011='"), Strings.Format(RuntimeHelpers.GetObjectValue(row["FechaPrep"]), "MM/dd/yyyy")), "' and OR19012<>'' order by OR19012")), connection);
                        reader  = command.ExecuteReader();
                        if (reader.Read())
                        {
                            try
                            {
                                string cmdText = 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='", reader["OR19012"]), "' where NroOV='"), row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito is null"));
                                reader.Close();
                                command2 = new SqlCommand(cmdText, connection2);
                                num3     = command2.ExecuteNonQuery();
                            }
                            catch (Exception exception6)
                            {
                                ProjectData.SetProjectError(exception6);
                                Exception exception2 = exception6;
                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                                this.cmbSalir.Enabled = true;
                                connection2.Close();
                                connection.Close();
                                this.Close();
                                ProjectData.ClearProjectError();
                            }
                        }
                        else
                        {
                            reader.Close();
                        }
                    }
                    else
                    {
                        adapter2 = 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")), str6);
                        this.DS20.Clear();
                        adapter2.Fill(this.DS20, "OR230100");
                        if (this.DS20.Tables["OR230100"].Rows.Count != 0)
                        {
                            int num5 = this.DS20.Tables["OR230100"].Rows.Count - 1;
                            for (num2 = 0; num2 <= num5; num2++)
                            {
                                row2   = this.DS20.Tables["OR230100"].Rows[num2];
                                reader = 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).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 exception7)
                                    {
                                        ProjectData.SetProjectError(exception7);
                                        Exception exception3 = exception7;
                                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null);
                                        connection2.Close();
                                        this.Close();
                                        ProjectData.ClearProjectError();
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            selectCommandText = "select NroOV from PrepPed where ContFinal='N' group by NroOV";
            new SqlDataAdapter(selectCommandText, connectionString).Fill(this.DS, "PrepPed");
            if (this.DS.Tables["PrepPed"].Rows.Count != 0)
            {
                int num4 = this.DS.Tables["PrepPed"].Rows.Count - 1;
                for (num = 0; num <= num4; num++)
                {
                    row      = this.DS.Tables["PrepPed"].Rows[num];
                    adapter2 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR01015,OR01072 from OR010100 where OR01001='", row["NroOV"]), "'")), str6);
                    this.DS19.Clear();
                    adapter2.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 exception8)
                        {
                            ProjectData.SetProjectError(exception8);
                            Exception exception4 = exception8;
                            Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null);
                            connection2.Close();
                            this.Close();
                            ProjectData.ClearProjectError();
                        }
                    }
                    else
                    {
                        adapter2 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR20015,OR20072 from OR200100 where OR20001='", row["NroOV"]), "'")), str6);
                        this.DS20.Clear();
                        adapter2.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 exception9)
                            {
                                ProjectData.SetProjectError(exception9);
                                Exception exception5 = exception9;
                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception5.Message, MsgBoxStyle.OKOnly, null);
                                connection2.Close();
                                this.Close();
                                ProjectData.ClearProjectError();
                            }
                        }
                    }
                }
            }
            connection2.Close();
            connectionString  = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
            this.AdapProdPend = new SqlDataAdapter("Select NroOV,NroLinea,EstLinea,Codigo,Desc1,Desc2,CantOrden,CantPrep,FechaPrep,NroRemito,Cliente,NomCli,OCompra,FechaOV from PrepPed where ContFinal='N'", connectionString);
            this.DS.Clear();
            this.AdapProdPend.Fill(this.DS, "PrepPed");
            if (Variables.gOrdenProdPend == 1)
            {
                this.CrystalReportViewer1.ShowGroupTreeButton = true;
                this.Informe.Load(Application.StartupPath + @"\repprodpend.rpt");
            }
            else if (Variables.gOrdenProdPend == 2)
            {
                this.CrystalReportViewer1.ShowGroupTreeButton = false;
                this.Informe.Load(Application.StartupPath + @"\repprodpend2.rpt");
            }
            else if (Variables.gOrdenProdPend == 3)
            {
                this.CrystalReportViewer1.ShowGroupTreeButton = true;
                this.Informe.Load(Application.StartupPath + @"\repprodpend3.rpt");
            }
            else if (Variables.gOrdenProdPend == 4)
            {
                this.CrystalReportViewer1.ShowGroupTreeButton = false;
                this.Informe.Load(Application.StartupPath + @"\repprodpend4.rpt");
            }
            else if (Variables.gOrdenProdPend == 5)
            {
                this.CrystalReportViewer1.ShowGroupTreeButton = false;
                this.Informe.Load(Application.StartupPath + @"\repprodpend5.rpt");
            }
            this.Informe.SetDataSource(this.DS);
            this.CrystalReportViewer1.ReportSource = this.Informe;
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Esempio n. 8
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();
            }
        }
Esempio n. 9
0
 protected void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
 {
     OnInit(e);
     ViewReport();
 }
Esempio n. 10
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            string str;
            bool   flag = false;

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            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);
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Esempio n. 11
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();
            }
        }
Esempio n. 12
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            DataSet dataSet = new DataSet();

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            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";
                dataSet.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(dataSet, "OR010100");
                this.AdapOR03.Fill(dataSet, "OR030100");
                this.AdapSL01.Fill(dataSet, "SL010100");
                this.AdapSC23.Fill(dataSet, "SC230100");
                this.AdapPC03.Fill(dataSet, "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();
                long       num3    = this.DS1.Tables["PL230100"].Rows.Count - 1;
                for (long i = 0L; i <= num3; i += 1L)
                {
                    DataRow row = this.DS1.Tables["PL230100"].Rows[(int)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;
                new SqlDataAdapter("select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp", connectionString).Fill(dataSet, "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(dataSet);
                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;
                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();
            }
        }
Esempio n. 13
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            bool flag = false;

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            this.DS.Clear();
            this.DS1.Clear();
            string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
            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;
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Esempio n. 14
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;
            }
        }
Esempio n. 15
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            string str3;
            string str4;

            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 + "TmpGesEns", 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();
            }
            SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=True;packet size=4096");

            connection.Open();
            command = new SqlCommand("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.OR01001='" + Variables.gNroOE + "' and OR010100.OR01002=6 and OR030100.OR03003='000'", connection);
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,CantOE,CantArmado,Cliente,NroOV,Observaciones,TiempoAsig,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"])))
                {
                    str4 = str4 + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR19011"]), "MM/dd/yyyy") + "',";
                }
                else
                {
                    str4 = str4 + "Null,";
                }
                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(str4 + "'", reader["OR03002"]), "','"), reader["OR03005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR03006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR03007"]))), "',"), ObjectType.MulObj(reader["OR03011"], -1)), ","), ObjectType.MulObj(reader["OR03012"], -1)), ","));
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04002"])), "0", false) == 0)
                {
                    str4 = str4 + "'',";
                }
                else
                {
                    str4 = str4 + "'" + Strings.Trim(StringType.FromObject(reader["OR04002"])) + "',";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04003"])), "0", false) == 0)
                {
                    str4 = str4 + "'',";
                }
                else
                {
                    str4 = str4 + "'" + Strings.Mid(Strings.Trim(StringType.FromObject(reader["OR04003"])), 1, 10) + "',";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04004"])), "0", false) == 0)
                {
                    str3 = "";
                }
                else
                {
                    str3 = Strings.Trim(StringType.FromObject(reader["OR04004"])) + " ";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04005"])), "0", false) == 0)
                {
                    str3 = str3 + "";
                }
                else
                {
                    str3 = str3 + Strings.Trim(StringType.FromObject(reader["OR04005"]));
                }
                str4 = str4 + "'" + str3 + "',";
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04008"])), "0", false) == 0)
                {
                    str4 = str4 + "'','')";
                }
                else
                {
                    str4 = str4 + "'" + Strings.Trim(StringType.FromObject(reader["OR04008"])) + "','')";
                }
                command = new SqlCommand(str4, connection2);
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception exception7)
                {
                    ProjectData.SetProjectError(exception7);
                    Exception exception2 = exception7;
                    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();
            command = new SqlCommand("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 where OR200100.OR20001='" + Variables.gNroOE + "' and OR200100.OR20002=6 and OR210100.OR21003='000'", connection);
            command.CommandTimeout = 500;
            reader = command.ExecuteReader();
            while (reader.Read())
            {
                str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,CantOE,CantArmado,Cliente,NroOV,Observaciones,TiempoAsig,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"])))
                {
                    str4 = str4 + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR23011"]), "MM/dd/yyyy") + "',";
                }
                else
                {
                    str4 = str4 + "Null,";
                }
                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(str4 + "'", reader["OR21002"]), "','"), reader["OR21005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR21006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR21007"]))), "',"), ObjectType.MulObj(reader["OR21011"], -1)), ","), ObjectType.MulObj(reader["OR21012"], -1)), ","));
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22002"])), "0", false) == 0)
                {
                    str4 = str4 + "'',";
                }
                else
                {
                    str4 = str4 + "'" + Strings.Trim(StringType.FromObject(reader["OR22002"])) + "',";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22003"])), "0", false) == 0)
                {
                    str4 = str4 + "'',";
                }
                else
                {
                    str4 = str4 + "'" + Strings.Mid(Strings.Trim(StringType.FromObject(reader["OR22003"])), 1, 10) + "',";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22004"])), "0", false) == 0)
                {
                    str3 = "";
                }
                else
                {
                    str3 = Strings.Trim(StringType.FromObject(reader["OR22004"])) + " ";
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22005"])), "0", false) == 0)
                {
                    str3 = str3 + "";
                }
                else
                {
                    str3 = str3 + Strings.Trim(StringType.FromObject(reader["OR22005"]));
                }
                str4 = str4 + "'" + str3 + "',";
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22008"])), "0", false) == 0)
                {
                    str4 = str4 + "'','')";
                }
                else
                {
                    str4 = str4 + "'" + Strings.Trim(StringType.FromObject(reader["OR22008"])) + "','')";
                }
                command = new SqlCommand(str4, connection2);
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception exception8)
                {
                    ProjectData.SetProjectError(exception8);
                    Exception exception3 = exception8;
                    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();
            command = new SqlCommand("SELECT NroOE,NroLinea from " + Variables.gTermi + "TmpGesEns", connection2);
            command.CommandTimeout    = 500;
            this.xAdap1               = new SqlDataAdapter();
            this.xAdap1.SelectCommand = command;
            this.DS2.Clear();
            this.xAdap1.Fill(this.DS2, Variables.gTermi + "TmpGesEns");
            int num3 = this.DS2.Tables[Variables.gTermi + "TmpGesEns"].Rows.Count - 1;

            for (int i = 0; i <= num3; i++)
            {
                DataRow row2   = this.DS2.Tables[Variables.gTermi + "TmpGesEns"].Rows[i];
                string  vRight = StringType.FromObject(row2["NroOE"]);
                string  str    = StringType.FromObject(row2["NroLinea"]);
                command = new SqlCommand("SELECT OpRecoleccion,OpArmado,OpPrueba,OpEmbalaje,TRecoleccion,TArmado,TPrueba,TEmbalaje FROM dbo.GesEns where NroOE='" + vRight + "' and NroLinea='" + str + "'", connection2);
                command.CommandTimeout   = 500;
                this.xAdap               = new SqlDataAdapter();
                this.xAdap.SelectCommand = command;
                this.DS1.Clear();
                this.xAdap.Fill(this.DS1, "GesEns");
                if (this.DS1.Tables["GesEns"].Rows.Count != 0)
                {
                    DataRow row = this.DS1.Tables["GesEns"].Rows[0];
                    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(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpGesEns set OpRecoleccion='", row["OpRecoleccion"]), "',OpArmado='"), row["OpArmado"]), "',OpPrueba='"), row["OpPrueba"]), "',OpEmbalaje='"), row["OpEmbalaje"]), "',TRecoleccion="), row["TRecoleccion"]), ",TArmado="), row["TArmado"]), ",TPrueba="), row["TPrueba"]), ",TEmbalaje="), row["TEmbalaje"]), " where NroOE='"), vRight), "' and NroLinea='"), str), "'")), connection2);
                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    catch (Exception exception9)
                    {
                        ProjectData.SetProjectError(exception9);
                        Exception exception4 = exception9;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null);
                        reader.Close();
                        connection.Close();
                        connection2.Close();
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
            }
            command = new SqlCommand("update " + Variables.gTermi + "TmpGesEns set Obs='OBS'where (NroOE in (select NroOE from GesEnsObs)) and (NroLinea in (select NroLinea from GesEnsObs))", connection2);
            try
            {
                command.ExecuteNonQuery();
            }
            catch (Exception exception10)
            {
                ProjectData.SetProjectError(exception10);
                Exception exception5 = exception10;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception5.Message, MsgBoxStyle.OKOnly, null);
                reader.Close();
                connection.Close();
                connection2.Close();
                ProjectData.ClearProjectError();
                return;

                ProjectData.ClearProjectError();
            }
            connection2.Close();
            connection.Close();
            try
            {
                SqlConnection connection3 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");
                connection3.Open();
                SqlCommand command2 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpGesEns as PC1TmpGesEns", connection3);
                command2.CommandTimeout = 500;
                this.Adap1 = new SqlDataAdapter();
                this.Adap1.SelectCommand = command2;
                this.DS.Clear();
                this.Adap1.Fill(this.DS, "PC1TmpGesEns");
                command2 = new SqlCommand("SELECT * from GesEnsObs where NroOE='" + Variables.gNroOE + "'", connection3);
                command2.CommandTimeout = 500;
                this.Adap2 = new SqlDataAdapter();
                this.Adap2.SelectCommand = command2;
                this.Adap2.Fill(this.DS, "GesEnsOBs");
                this.Informe.Load(Application.StartupPath + @"\ConsultaOE.rpt");
                this.Informe.SetDataSource(this.DS);
                connection3.Close();
                this.CrystalReportViewer1.ReportSource = this.Informe;
                this.CrystalReportViewer1.Refresh();
                this.cmbSalir.Enabled = true;
            }
            catch (Exception exception11)
            {
                ProjectData.SetProjectError(exception11);
                Exception exception6 = exception11;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception6.Message, MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
        }
Esempio n. 16
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            bool flag = false;

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            this.DS.Clear();
            this.DS1.Clear();
            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 no despachados'";
            }
            else
            {
                definition4.Text = "'Items despachados y no despachados'";
            }
            this.CrystalReportViewer1.ShowGroupTreeButton = true;
            this.CrystalReportViewer1.ReportSource        = this.Informe;
            this.CrystalReportViewer1.Refresh();
            this.cmbSalir.Enabled = true;
        }
Esempio n. 17
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();
            }
        }