public frmRepEnsXFecha1() { base.Closed += new EventHandler(this.frmRepEnsXFecha1_Closed); base.Load += new EventHandler(this.frmRepEnsXFecha1_Load); base.Click += new EventHandler(this.frmRepEnsXFecha1_Click); base.Leave += new EventHandler(this.frmRepEnsXFecha1_Leave); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PC1TmpRepGesEns"); if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0) { this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); } else { this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); } FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefecha"); if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafecha"); if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } }
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 definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefecha"); if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy HH:mm:ss") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafecha"); if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy HH:mm:ss") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Zoom(1); this.cmbSalir.Enabled = true; }
public frmRepOCPend1() { string str; base.Closed += new EventHandler(this.frmRepOCPend1_Closed); base.Load += new EventHandler(this.frmRepOCPend1_Load); this.DS = new DataSet(); this.DS1 = new DataSet(); this.DSTmp = new DataSet(); this.Informe = new ReportDocument(); this.InitializeComponent(); bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) == 0) { str = "Select PC03001,PC03002,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016 from PC030100 where PC03010-PC03011<>0 and PC03010<>0"; if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'"; if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'"; } } else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'"; } if (StringType.StrCmp(Variables.gCodProd, "", false) != 0) { str = str + " and PC03005='" + Variables.gCodProd + "'"; } str = str + " order by PC03001,PC03016,PC03002"; } else { str = "Select PC03001,PC03002,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016 from PC030100 where PC03010-PC03011<>0 and PC03010<>0 and PC03016>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and PC03016<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0) { if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = (str + " and (PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'") + " or PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "')"; } else { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'"; } } else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'"; } if (StringType.StrCmp(Variables.gCodProd, "", false) != 0) { str = str + " and PC03005='" + Variables.gCodProd + "'"; } str = str + " order by PC03001,PC03016,PC03002"; } this.DS.Clear(); this.AdapOCPend = new SqlDataAdapter(str, selectConnectionString); this.AdapOCPend.Fill(this.DS, "PC030100"); string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; str = "Select distinct detdes.colnb,detdes.ordnb,detdes.lignb,detdes.datexp,detinv.invno,detinv.stamp,detinv.desqty,hdrdes.trind from detdes left outer join detinv on detdes.ordnb=detinv.purno and detdes.lignb=detinv.purlin inner join hdrdes on detdes.packlist=hdrdes.packlist where detdes.cntqty=0"; if (StringType.StrCmp(Variables.gCodProd, "", false) != 0) { str = str + " and detdes.itnbr='" + Variables.gCodProd + "'"; } this.AdapDetDes = new SqlDataAdapter(str, str3); this.DS1.Clear(); this.AdapDetDes.Fill(this.DS1, "detdes"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpDetDes", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["detdes"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["detdes"].Rows[i]; str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into " + Variables.gTermi + "TmpDetDes (NroOC,NroLinea,NroBulto,PackList,FechaPL,NroFC,FechaFC,EnTransito) values ('" + Strings.Format(RuntimeHelpers.GetObjectValue(row["ordnb"]), "0000000000")) + "','" + Strings.Format(RuntimeHelpers.GetObjectValue(row["lignb"]), "000000")) + "','", row["colnb"]), "','"), row["trind"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["datexp"]), "MM/dd/yyyy")), "',")); if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["invno"]))) { str = str + "'',"; } else { str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str + "'", row["invno"]), "',")); } if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["stamp"]))) { str = str + "'',"; } else { str = str + "'" + Strings.Format(DateType.FromString(Strings.Mid(StringType.FromObject(row["stamp"]), 1, 10)), "MM/dd/yyyy") + "',"; } if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["desqty"]))) { str = str + "0)"; } else { str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str, row["desqty"]), ")")); } command = new SqlCommand(str, connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); if (flag) { connection.Close(); flag = false; } ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } str = "select * from " + Variables.gTermi + "TmpDetDes as PC1TmpDetDes"; this.AdapTmp = new SqlDataAdapter(str, connectionString); this.AdapTmp.Fill(this.DS, "PC1TmpDetDes"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repocpend.rpt"); } else { this.Informe.Load(Application.StartupPath + @"\repocpend1.rpt"); } this.Informe.SetDataSource(this.DS); connection.Close(); flag = false; FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desde"); if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) == 0) { definition.set_Text("'" + Variables.gDesde + "'"); } else { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"); } FormulaFieldDefinition definition2 = definitions.get_Item("hasta"); if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) == 0) { definition2.set_Text("'" + Variables.gHasta + "'"); } else { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"); } FormulaFieldDefinition definition3 = definitions.get_Item("almacen"); if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0) { if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { definition3.set_Text("'Almacenes: " + Strings.Trim(Variables.gAlmacen1) + "-" + Strings.Trim(Variables.gAlmacen2) + "'"); } else { definition3.set_Text("'Almacen: " + Strings.Trim(Variables.gAlmacen1) + "'"); } } else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { definition3.set_Text("'Almacen: " + Strings.Trim(Variables.gAlmacen2) + "'"); } else { definition3.set_Text("'Todos los almacenes'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); }
public frmRepInvFis1() { base.Closed += new EventHandler(this.frmRepInvFis1_Closed); this.DS = new DataSet(); this.DS1 = new DataSet(); this.DSTmp = new DataSet(); this.Informe = new ReportDocument(); this.InitializeComponent(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; string selectCommandText = "select * from Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "'"; if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) != 0) { selectCommandText = selectCommandText + " and Operador='" + Variables.gOperario + "'"; } if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) != 0)) { selectCommandText = selectCommandText + " and Codigo>='" + Variables.gCodProdDesde + "' and Codigo<='" + Variables.gCodProdHasta + "'"; } if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) != 0) { selectCommandText = selectCommandText + " and Fecha='" + Strings.Format(DateType.FromString(Variables.gFechaLec), "MM/dd/yyyy") + "'"; } this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapTmp.Fill(this.DS, "Inventario"); this.Informe.Load(Application.StartupPath + @"\repinvfis.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); definitions.get_Item("fechainv").set_Text("'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'"); FormulaFieldDefinition definition2 = definitions.get_Item("operario"); if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) == 0) { definition2.set_Text("'Todos los operarios'"); } else { definition2.set_Text("'Operario: " + Variables.gOperario + "'"); } FormulaFieldDefinition definition3 = definitions.get_Item("productos"); if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) == 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) == 0)) { definition3.set_Text("'Todos los productos'"); } else { definition3.set_Text("'Desde Producto: " + Variables.gCodProdDesde + "-" + Strings.Trim(Variables.gDescProdDesde1) + " " + Strings.Trim(Variables.gDescProdDesde2) + " Hasta Producto: " + Variables.gCodProdHasta + "-" + Strings.Trim(Variables.gDescProdHasta1) + " " + Strings.Trim(Variables.gDescProdHasta2) + "'"); } FormulaFieldDefinition definition4 = definitions.get_Item("fechalec"); if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) == 0) { definition4.set_Text("'Todos las fechas de lectura'"); } else { definition4.set_Text("'Fecha de Lectura: " + Strings.Format(DateType.FromString(Variables.gFechaLec), "dd/MM/yyyy") + "'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); }
public frmRepOCConfPend1() { base.Closed += new EventHandler(this.frmRepOCConfPend1_Closed); base.Load += new EventHandler(this.frmRepOCConfPend1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.DS1 = new DataSet(); this.InitializeComponent(); bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; string str4 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; this.DS.Clear(); this.DS1.Clear(); string selectCommandText = "SELECT PC01001,PC01003,PC01004,PC01014,PC01015,PC01016,PC03001,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016,SL01001,SL01002,PL01001,PL01002,PL23003,PL23004,ordnb,lignb FROM dbo.PC010100 inner join PC030100 on PC01001=PC03001 inner join PL010100 on PC01003=PL01001 left outer join SL010100 on PC01004=SL01001 inner join PL230100 on PC01014=PL23003 LEFT OUTER JOIN edibar.dbo.detdes ON PC030100.PC03001 = edibar.dbo.detdes.ordnb AND PC030100.PC03002 = edibar.dbo.detdes.lignb where PC01001>'0000014500' and PC03011<PC03010 and PC03029='1' and PL23001='2' and PL23002='00'"; if (StringType.StrCmp(Variables.gCodProv, "", false) != 0) { selectCommandText = selectCommandText + " and PC01003='" + Variables.gCodProv + "'"; } if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0) { selectCommandText = selectCommandText + " and PC01014=" + Variables.gCodMetEnt; } if (StringType.StrCmp(Variables.gCodAlmacen, "", false) != 0) { selectCommandText = selectCommandText + " and PC03035='" + Variables.gCodAlmacen + "'"; } if (Variables.gNoDespachado) { selectCommandText = selectCommandText + " and edibar.dbo.detdes.ordnb is null"; } this.AdapPC01 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPC01.Fill(this.DS1, "PC010100"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpOCConfPend", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["PC010100"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["PC010100"].Rows[i]; if (DateAndTime.DateDiff(4, DateType.FromObject(row["PC01016"]), DateType.FromObject(row["PC03016"]), 1, 1) >= 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, 0, 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 definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("almacen"); if (StringType.StrCmp(Variables.gCodAlmacen, Strings.Space(0), false) != 0) { definition.set_Text("'Almacen: " + Strings.Trim(Variables.gNomAlmacen) + "'"); } else { definition.set_Text("'Todos los almacenes'"); } FormulaFieldDefinition definition2 = definitions.get_Item("formadesp"); if (StringType.StrCmp(Variables.gCodMetEnt, Strings.Space(0), false) != 0) { definition2.set_Text("'Forma Despacho: " + Strings.Trim(Variables.gDescMetEnt) + "'"); } else { definition2.set_Text("'Todos las formas de despacho'"); } definitions.get_Item("diasdif").set_Text("'" + Strings.Format(Variables.gDiasDif, "###0") + "'"); FormulaFieldDefinition definition4 = definitions.get_Item("nodesp"); if (Variables.gNoDespachado) { definition4.set_Text("'Solamente los items con tr\x00e1nsito no registrado'"); } else { definition4.set_Text("'Items despachados y no despachados'"); } this.CrystalReportViewer1.set_ShowGroupTreeButton(true); this.CrystalReportViewer1.set_ReportSource(this.Informe); }
public frmRepOCPendConf1() { base.Closed += new EventHandler(this.frmRepOCPendConf1_Closed); base.Load += new EventHandler(this.frmRepOCPendConf1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.DS1 = new DataSet(); this.InitializeComponent(); bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; this.DS.Clear(); this.DS1.Clear(); string selectCommandText = "SELECT PC01001,PC01003,PC01004,PC01014,PC01015,PC01016 FROM dbo.PC010100"; if (StringType.StrCmp(Variables.gCodProv, "", false) != 0) { selectCommandText = selectCommandText + " where PC01003='" + Variables.gCodProv + "'"; if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0) { selectCommandText = selectCommandText + " and PC01014=" + Variables.gCodMetEnt; } } else if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0) { selectCommandText = selectCommandText + " where PC01014=" + Variables.gCodMetEnt; } this.AdapPC01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT PC03001,PC03005,PC03006,PC03007,PC03010,PC03011 FROM dbo.PC030100 where PC03011<PC03010 and PC03029=''"; if (StringType.StrCmp(Variables.gCodAlmacen, "", false) != 0) { selectCommandText = selectCommandText + " and PC03035='" + Variables.gCodAlmacen + "'"; } this.AdapPC03 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT SL01001,SL01002 FROM dbo.SL010100"; this.AdapSL01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT PL01001,PL01002 FROM dbo.PL010100"; this.AdapPL01 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPC01.Fill(this.DS, "PC010100"); this.AdapPC03.Fill(this.DS, "PC030100"); this.AdapSL01.Fill(this.DS, "SL010100"); this.AdapPL01.Fill(this.DS, "PL010100"); selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'"; this.AdapPL23 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPL23.Fill(this.DS1, "PL230100"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["PL230100"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["PL230100"].Rows[i]; command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, 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 definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("almacen"); if (StringType.StrCmp(Variables.gCodAlmacen, Strings.Space(0), false) != 0) { definition.set_Text("'Almacen: " + Strings.Trim(Variables.gNomAlmacen) + "'"); } else { definition.set_Text("'Todos los almacenes'"); } FormulaFieldDefinition definition2 = definitions.get_Item("formadesp"); if (StringType.StrCmp(Variables.gCodMetEnt, Strings.Space(0), false) != 0) { definition2.set_Text("'Forma Despacho: " + Strings.Trim(Variables.gDescMetEnt) + "'"); } else { definition2.set_Text("'Todos las formas de despacho'"); } this.CrystalReportViewer1.set_ShowGroupTreeButton(true); this.CrystalReportViewer1.set_ReportSource(this.Informe); }
public frmConsultaOV2() { base.Closed += new EventHandler(this.frmConsultaOV2_Closed); base.Load += new EventHandler(this.frmConsultaOV2_Load); base.Click += new EventHandler(this.frmConsultaOV2_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.DS19 = new DataSet(); this.DS20 = new DataSet(); this.InitializeComponent(); try { SqlCommand command; string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); if ((Variables.gCodEstado == 1) | (Variables.gCodEstado == 4)) { command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend", connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpOVPend"); this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendEnt.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinition definition = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo"); if (Variables.gCodEstado == 1) { definition.set_Text("'Consulta Ordenes de Venta - Estado Pendiente de Entrega'"); } else { definition.set_Text("'Consulta Ordenes de Venta - Estado Preparado pend.imp.doc.exp.'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); } if (Variables.gCodEstado == 2) { this.AdapProdPend = new SqlDataAdapter("Select NroOV,NroLinea,EstLinea,Codigo,Desc1,Desc2,CantOrden,CantPrep,FechaPrep,NroRemito,Cliente,NomCli,OCompra,FechaOV from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and Producto=0", connectionString); this.AdapProdPend.Fill(this.DS, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendExp.rpt"); this.Informe.SetDataSource(this.DS); this.CrystalReportViewer1.set_ReportSource(this.Informe); } if ((Variables.gCodEstado == 3) | (Variables.gCodEstado == 5)) { command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVExped as PC1TmpOVExped", connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpOVExped"); this.Informe.Load(Application.StartupPath + @"\ConsultaOVExped.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinition definition2 = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo"); if (Variables.gCodEstado == 3) { definition2.set_Text("'Consulta Ordenes de Venta - Estado Expedido'"); } else { definition2.set_Text("'Consulta Ordenes de Venta - Estado Recepci\x00f3n Conformada'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); } } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } }
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; } }
public frmRepOVPend1() { base.Closed += new EventHandler(this.frmRepOVPend1_Closed); base.Load += new EventHandler(this.frmRepOVPend1_Load); base.Click += new EventHandler(this.frmRepOVPend1_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { string str; SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); if (Variables.gOVaListar == 1) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend"; } else if (Variables.gOVaListar == 2) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))"; } else if (Variables.gOVaListar == 3) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1"; } else if (Variables.gOVaListar == 4) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1"; } else if (Variables.gOVaListar == 5) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)"; } else if (Variables.gOVaListar == 6) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)"; } SqlCommand command = new SqlCommand(str, connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpOVPend"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovpend.rpt"); } else if (Variables.gOrdenList == 3) { this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt"); } this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefechaov"); if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaov"); if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } FormulaFieldDefinition definition3 = definitions.get_Item("desdefechaent"); if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition3.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"); } else { definition3.set_Text("''"); } FormulaFieldDefinition definition4 = definitions.get_Item("hastafechaent"); if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition4.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"); } else { definition4.set_Text("''"); } definitions.get_Item("tipo").set_Text("'" + Variables.gTipoList + "'"); if (Variables.gOrdenList == 1) { definitions.get_Item("orden").set_Text("'Ordenado por Fecha de Entrega Prevista'"); } else if (Variables.gOrdenList == 2) { definitions.get_Item("orden").set_Text("'Ordenado por N\x00b0 de Cliente'"); } else if (Variables.gOrdenList == 3) { definitions.get_Item("orden").set_Text("'Ordenado por Fecha de Orden de Venta'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } }
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, 0, null); connection.Close(); connection2.Close(); this.Close(); 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(); 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 definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefechaov"); if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaov"); if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } FormulaFieldDefinition definition3 = definitions.get_Item("desdefechaent"); if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition3.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"); } else { definition3.set_Text("''"); } FormulaFieldDefinition definition4 = definitions.get_Item("hastafechaent"); if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition4.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"); } else { definition4.set_Text("''"); } definitions.get_Item("tipo").set_Text("'" + Variables.gTipoList + "'"); if (Variables.gOrdenList == 1) { definitions.get_Item("orden").set_Text("'Ordenado por Fecha de Entrega Prevista'"); } else if (Variables.gOrdenList == 2) { definitions.get_Item("orden").set_Text("'Ordenado por N\x00b0 de Cliente'"); } else if (Variables.gOrdenList == 3) { definitions.get_Item("orden").set_Text("'Ordenado por Fecha de Orden de Venta'"); } this.CrystalReportViewer1.set_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, 0, null); ProjectData.ClearProjectError(); } }
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(); } }
public frmRepRMDesp1() { base.Closed += new EventHandler(this.frmRepRMDesp1_Closed); base.Load += new EventHandler(this.frmRepRMDesp1_Load); base.Click += new EventHandler(this.frmRepRMDesp1_Click); base.Leave += new EventHandler(this.frmRepRMDesp1_Leave); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); string str = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null"; if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))) { if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)) { str = str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str = str + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str = (str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } } SqlCommand command = new SqlCommand(str + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefecha"); if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafecha"); if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Zoom(1); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } }
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, 0, 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, 0, 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, 0, 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 definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefecha"); if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafecha"); if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_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, 0, null); ProjectData.ClearProjectError(); } }