private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { this.cmbSalir.Enabled = false; this.Informe.Close(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; string selectCommandText = "Select * from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty"; this.AdapOCPend = new SqlDataAdapter(selectCommandText, selectConnectionString); this.DS.Clear(); this.AdapOCPend.Fill(this.DS, "detdes"); selectCommandText = "Select * from hdrdes where packlist in (Select packlist from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty)"; this.AdapHdrdes = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapHdrdes.Fill(this.DS, "hdrdes"); selectCommandText = "Select SC01001,SC01002,SC01003 from SC010100"; this.AdapProd = new SqlDataAdapter(selectCommandText, str3); this.AdapProd.Fill(this.DS, "SC010100"); this.Informe.Load(Application.StartupPath + @"\repdifocprov.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaexp"]; definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["hastafechaexp"]; definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; }
/// <summary> /// Truyền các tham số Formular vào báo cáo /// </summary> void Puth_Data2_Fomulator(ref ReportDocument oRpt) { try { #region Truyền các tham số Formular vào báo cáo // FormulaFieldDefinitions crFFieldDefinitions = oRpt.DataDefinition.FormulaFields; FormulaFieldDefinition crFFieldDefinition; string strFormulaName; for (int i = 0; i < crFFieldDefinitions.Count; i++) { crFFieldDefinition = crFFieldDefinitions[i]; strFormulaName = crFFieldDefinition.Name.ToUpper(); #region Thông tin đơn chung if (strFormulaName == "F_APPHEADER_ID") { crFFieldDefinition.Text = "'" + mv_AppHeader_Id + "'"; } else if (strFormulaName == "F_MASTER_NAME") { crFFieldDefinition.Text = "'" + c_ApplicationHeaderInfo.Master_Name + "'"; } #endregion } #endregion } catch (Exception ex) { Logger.LogException(ex); } }
public frmRepEnsXFecha1() { base.Closed += new EventHandler(this.frmRepEnsXFecha1_Closed); base.Load += new EventHandler(this.frmRepEnsXFecha1_Load); base.Click += new EventHandler(this.frmRepEnsXFecha1_Click); base.Leave += new EventHandler(this.frmRepEnsXFecha1_Leave); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PC1TmpRepGesEns"); if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0) { this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); } else { this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); } FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public frmRepOAPend2() { base.Load += new EventHandler(this.frmRepOAPend2_Load); base.Closed += new EventHandler(this.frmRepOAPend2_Closed); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; string selectCommandText = "SELECT * from " + Variables.gTermi + "TmpCalendario as PC1TmpCalendario where FechaEnt>='" + Strings.Format(DateTime.Now, "MM/dd/yyyy") + "'"; this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapTmp.Fill(this.DS, "PC1TmpCalendario"); selectCommandText = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs"; this.AdapObs = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapObs.Fill(this.DS, "GesEnsObs"); selectCommandText = "SELECT * from " + Variables.gTermi + "TmpCalendarioStkComp as PC1TmpCalendarioStkComp"; this.AdapTmp1 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapTmp1.Fill(this.DS, "PC1TmpCalendarioStkComp"); this.Informe.Load(Application.StartupPath + @"\repoapendcal.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); definitions.get_Item("orden").set_Text("'ordenado por Fecha Entrega'"); definitions.get_Item("Intr01").set_Text("'" + Variables.gNomIntr01 + "'"); definitions.get_Item("Intr02").set_Text("'" + Variables.gNomIntr02 + "'"); definitions.get_Item("Intr03").set_Text("'" + Variables.gNomIntr03 + "'"); definitions.get_Item("Intr04").set_Text("'" + Variables.gNomIntr04 + "'"); this.CrystalReportViewer1.set_ShowGroupTreeButton(true); this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Zoom(1); }
public frmRepDifInv1() { base.Load += new EventHandler(this.frmRepDifInv1_Load); this.InitializeComponent(); ReportDocument document = new ReportDocument(); DataSet dataSet = new DataSet(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); SqlCommand command = new SqlCommand("SELECT Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist FROM dbo." + Variables.gTermi + "TmpInventario as PC1TmpInventario where Rechazar=1", connection); command.CommandTimeout = 500; SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command; connection.Open(); adapter.Fill(dataSet, "PC1TmpInventario"); document.Load(Application.StartupPath + @"\reprechinv.rpt"); document.SetDataSource(dataSet); connection.Close(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } FormulaFieldDefinitions definitions = document.get_DataDefinition().get_FormulaFields(); definitions.get_Item("FechaInv").set_Text("'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'"); definitions.get_Item("DesdeRack").set_Text("'" + Variables.gDesdeRack + "'"); definitions.get_Item("HastaRack").set_Text("'" + Variables.gHastaRack + "'"); definitions.get_Item("Almacen").set_Text("'" + Variables.gCodAlmacen + "-" + Variables.gNomAlmacen + "'"); this.CrystalReportViewer1.set_ReportSource(document); }
public frmDifOCProv1() { base.Closed += new EventHandler(this.frmDifOCProv1_Closed); base.Load += new EventHandler(this.frmDifOCProv1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; string selectCommandText = "Select * from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty"; this.AdapOCPend = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapOCPend.Fill(this.DS, "detdes"); selectCommandText = "Select * from hdrdes where packlist in (Select packlist from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty)"; this.AdapHdrdes = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapHdrdes.Fill(this.DS, "hdrdes"); selectCommandText = "Select SC01001,SC01002,SC01003 from SC010100"; this.AdapProd = new SqlDataAdapter(selectCommandText, str3); this.AdapProd.Fill(this.DS, "SC010100"); this.Informe.Load(Application.StartupPath + @"\repdifocprov.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaexp"]; definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["hastafechaexp"]; definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; this.CrystalReportViewer1.ReportSource = this.Informe; }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { this.cmbSalir.Enabled = false; this.Informe.Close(); SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); string str3 = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null"; if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))) { if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)) { str3 = str3 + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str3 = str3 + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str3 = (str3 + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } } SqlCommand command = new SqlCommand(str3 + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy HH:mm:ss") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy HH:mm:ss") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Zoom(1); this.cmbSalir.Enabled = true; }
public frmRepOAPend1() { string str; string str3; base.Closed += new EventHandler(this.frmRepOAPend1_Closed); base.Load += new EventHandler(this.frmRepOAPend1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); if (Variables.gOrdenOA == 1) { str3 = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; str = "SELECT * from " + Variables.gTermi + "TmpCalendario as PC1TmpCalendario where FechaEnt<'" + Strings.Format(DateTime.Now, "MM/dd/yyyy") + "' and not NroOA is null"; this.AdapTmp = new SqlDataAdapter(str, str3); this.AdapTmp.Fill(this.DS, "PC1TmpCalendario"); str = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs"; this.AdapObs = new SqlDataAdapter(str, str3); this.AdapObs.Fill(this.DS, "GesEnsObs"); str = "SELECT * from " + Variables.gTermi + "TmpCalendarioStkComp as PC1TmpCalendarioStkComp"; this.AdapTmp1 = new SqlDataAdapter(str, str3); this.AdapTmp1.Fill(this.DS, "PC1TmpCalendarioStkComp"); this.Informe.Load(Application.StartupPath + @"\repoapendcalatr.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); definitions.get_Item("orden").set_Text("'ordenado por Fecha Entrega'"); definitions.get_Item("Intr01").set_Text("'" + Variables.gNomIntr01 + "'"); definitions.get_Item("Intr02").set_Text("'" + Variables.gNomIntr02 + "'"); definitions.get_Item("Intr03").set_Text("'" + Variables.gNomIntr03 + "'"); definitions.get_Item("Intr04").set_Text("'" + Variables.gNomIntr04 + "'"); this.CrystalReportViewer1.set_ShowGroupTreeButton(true); this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Zoom(1); } else { string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; str = "SELECT OR01001,OR01015,OR01016 FROM dbo.OR010100 where OR010100.OR01002=6 and OR010100.OR01091=0 order by OR010100.OR01001"; this.AdapOR01 = new SqlDataAdapter(str, selectConnectionString); str = "SELECT OR03001,OR03002,OR03005,OR03006,OR03007,OR03011,OR03012,OR03034 FROM dbo.OR030100 where OR03011-OR03012<>0 and OR03034=1 order by OR03005"; this.AdapOR03 = new SqlDataAdapter(str, selectConnectionString); str = "SELECT OR04001,OR04002,OR04003,OR04004,OR04005,OR04008 FROM dbo.OR040100"; this.AdapSL01 = new SqlDataAdapter(str, selectConnectionString); this.AdapOR01.Fill(this.DS, "OR010100"); this.AdapOR03.Fill(this.DS, "OR030100"); this.AdapSL01.Fill(this.DS, "OR040100"); str3 = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; str = "SELECT NroOE,NroLinea,Observaciones,Fecha FROM dbo.GesEnsObs"; this.AdapObs = new SqlDataAdapter(str, str3); this.AdapObs.Fill(this.DS, "GesEnsObs"); this.Informe.Load(Application.StartupPath + @"\repoapend.rpt"); this.Informe.SetDataSource(this.DS); this.Informe.get_DataDefinition().get_FormulaFields().get_Item("orden").set_Text("'ordenado por N\x00b0 O.Armado'"); this.CrystalReportViewer1.set_ShowGroupTreeButton(false); this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Zoom(1); } }
private static void ProcessFormulaFieldDefinitions(FormulaFieldDefinitions ffds, XmlWriter xmlw) { xmlw.WriteStartElement("FormulaFieldDefinitions"); xmlw.WriteAttributeString("Count", ffds.Count.ToStringSafe()); foreach (FormulaFieldDefinition ffd in ffds) { ProcessFormulaFieldDefinition(ffd, xmlw); } xmlw.WriteEndElement(); }
public frmRepRegPedExp1() { base.Closed += new EventHandler(this.frmRepRegPedExp1_Closed); base.Load += new EventHandler(this.frmRepRegPedExp1_Load); base.Click += new EventHandler(this.frmRepRegPedExp1_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRegPedExp as PC1TmpRegPedExp", connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpRegPedExp"); this.Informe.Load(Application.StartupPath + @"\repregpedexp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefechaent"); if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaent"); if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } }
public frmTerminales1() { SqlConnection connection; base.Load += new EventHandler(this.frmTerminales1_Load); base.Closed += new EventHandler(this.frmTerminales1_Closed); this.InitializeComponent(); ReportDocument document = new ReportDocument(); DataSet dataSet = new DataSet(); bool flag = false; try { connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); string cmdText = "SELECT * FROM dbo.Terminales order by Codigo"; SqlCommand command = new SqlCommand(cmdText, connection); command.CommandTimeout = 500; SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command; connection.Open(); flag = true; adapter.Fill(dataSet, "Terminales"); document.Load(Application.StartupPath + @"\listerminales.rpt"); document.SetDataSource(dataSet); connection.Close(); flag = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (flag) { connection.Close(); flag = false; } Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } FormulaFieldDefinitions formulaFields = document.DataDefinition.FormulaFields; this.CrystalReportViewer1.ReportSource = document; }
public frmGenDifInv1() { base.Load += new EventHandler(this.frmGenDifInv1_Load); base.Closed += new EventHandler(this.frmGenDifInv1_Closed); this.InitializeComponent(); ReportDocument document = new ReportDocument(); DataSet dataSet = new DataSet(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); SqlCommand command = new SqlCommand("SELECT * FROM dbo.RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "' and (Cantidad<>CantSist or Posicion<>PosSist) and Aceptar=0", connection); command.CommandTimeout = 500; SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command; connection.Open(); adapter.Fill(dataSet, "RepDifInv"); document.Load(Application.StartupPath + @"\repdifinv.rpt"); document.SetDataSource(dataSet); connection.Close(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } FormulaFieldDefinitions formulaFields = document.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["FechaInv"]; definition.Text = "'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["DesdeRack"]; definition2.Text = "'" + Variables.gDesdeRack + "'"; FormulaFieldDefinition definition3 = formulaFields["HastaRack"]; definition3.Text = "'" + Variables.gHastaRack + "'"; FormulaFieldDefinition definition4 = formulaFields["Almacen"]; definition4.Text = "'" + Variables.gCodAlmacen + "-" + Variables.gNomAlmacen + "'"; this.CrystalReportViewer1.ReportSource = document; }
/// <summary> /// Truyền các tham số Formular vào báo cáo /// </summary> void Puth_Data2_Fomulator(ref ReportDocument oRpt, List <AppFeeFixInfo> appFeeFixInfos, List <AppDocumentInfo> appDocumentInfos) { try { Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>(); foreach (AppDocumentInfo item in appDocumentInfos) { dic_appDoc[item.Document_Id] = item; } #region Truyền các tham số Formular vào báo cáo // FormulaFieldDefinitions crFFieldDefinitions = oRpt.DataDefinition.FormulaFields; FormulaFieldDefinition crFFieldDefinition; string strFormulaName; for (int i = 0; i < crFFieldDefinitions.Count; i++) { crFFieldDefinition = crFFieldDefinitions[i]; strFormulaName = crFFieldDefinition.Name.ToUpper(); #region Fee if (strFormulaName == "F_DOC_1_ISUSE") { crFFieldDefinition.Text = "'" + dic_appDoc["01_SDD_01"].Isuse.ToString() + "'";; } #endregion #region TL trong đơn #endregion } #endregion } catch (Exception ex) { Logger.LogException(ex); } }
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 frmRepOCConfPend1() { base.Closed += new EventHandler(this.frmRepOCConfPend1_Closed); base.Load += new EventHandler(this.frmRepOCConfPend1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.DS1 = new DataSet(); this.InitializeComponent(); bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; string str4 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; this.DS.Clear(); this.DS1.Clear(); string selectCommandText = "SELECT PC01001,PC01003,PC01004,PC01014,PC01015,PC01016,PC03001,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016,SL01001,SL01002,PL01001,PL01002,PL23003,PL23004,ordnb,lignb FROM dbo.PC010100 inner join PC030100 on PC01001=PC03001 inner join PL010100 on PC01003=PL01001 left outer join SL010100 on PC01004=SL01001 inner join PL230100 on PC01014=PL23003 LEFT OUTER JOIN edibar.dbo.detdes ON PC030100.PC03001 = edibar.dbo.detdes.ordnb AND PC030100.PC03002 = edibar.dbo.detdes.lignb where PC01001>'0000014500' and PC03011<PC03010 and PC03029='1' and PL23001='2' and PL23002='00'"; if (StringType.StrCmp(Variables.gCodProv, "", false) != 0) { selectCommandText = selectCommandText + " and PC01003='" + Variables.gCodProv + "'"; } if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0) { selectCommandText = selectCommandText + " and PC01014=" + Variables.gCodMetEnt; } if (StringType.StrCmp(Variables.gCodAlmacen, "", false) != 0) { selectCommandText = selectCommandText + " and PC03035='" + Variables.gCodAlmacen + "'"; } if (Variables.gNoDespachado) { selectCommandText = selectCommandText + " and edibar.dbo.detdes.ordnb is null"; } this.AdapPC01 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPC01.Fill(this.DS1, "PC010100"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpOCConfPend", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["PC010100"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["PC010100"].Rows[i]; if (DateAndTime.DateDiff(DateInterval.Day, DateType.FromObject(row["PC01016"]), DateType.FromObject(row["PC03016"]), FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1) >= Variables.gDiasDif) { selectCommandText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOCConfPend (CodProv,NomProv,NroOC,FechaOC,FEntSolic,FEntConf,Codigo,Descripcion,Cantidad,FormaDesp,Destinatario,EnTransito) values ('", row["PC01003"]), "','"), row["PL01002"]), "','"), row["PC01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["PC01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["PC01016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["PC03016"]), "MM/dd/yyyy")), "','"), row["PC03005"]), "','"), Strings.Trim(StringType.FromObject(row["PC03006"]))), " "), Strings.Trim(StringType.FromObject(row["PC03007"]))), "',"), ObjectType.SubObj(row["PC03010"], row["PC03011"])), ",'"), row["PL23004"]), "',")); if (ObjectType.ObjTst(row["PC01004"], "+", false) == 0) { selectCommandText = selectCommandText + "'BGA',"; } else { selectCommandText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(selectCommandText + "'", row["SL01002"]), "',")); } if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["ordnb"]))) { selectCommandText = selectCommandText + "'N')"; } else { selectCommandText = selectCommandText + "'S')"; } command = new SqlCommand(selectCommandText, connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); if (flag) { connection.Close(); flag = false; } ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } } connection.Close(); flag = false; selectCommandText = "select * from " + Variables.gTermi + "TmpOCConfPend as PC1TmpOCConfPend"; this.AdapTmp = new SqlDataAdapter(selectCommandText, connectionString); this.AdapTmp.Fill(this.DS, "PC1TmpOCConfPend"); this.Informe.Load(Application.StartupPath + @"\repocconfpend.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["almacen"]; if (StringType.StrCmp(Variables.gCodAlmacen, Strings.Space(0), false) != 0) { definition.Text = "'Almacen: " + Strings.Trim(Variables.gNomAlmacen) + "'"; } else { definition.Text = "'Todos los almacenes'"; } FormulaFieldDefinition definition2 = formulaFields["formadesp"]; if (StringType.StrCmp(Variables.gCodMetEnt, Strings.Space(0), false) != 0) { definition2.Text = "'Forma Despacho: " + Strings.Trim(Variables.gDescMetEnt) + "'"; } else { definition2.Text = "'Todos las formas de despacho'"; } FormulaFieldDefinition definition3 = formulaFields["diasdif"]; definition3.Text = "'" + Strings.Format(Variables.gDiasDif, "###0") + "'"; FormulaFieldDefinition definition4 = formulaFields["nodesp"]; if (Variables.gNoDespachado) { definition4.Text = "'Solamente los items con tr\x00e1nsito no registrado'"; } else { definition4.Text = "'Items despachados y no despachados'"; } this.CrystalReportViewer1.ShowGroupTreeButton = true; this.CrystalReportViewer1.ReportSource = this.Informe; }
public frmRepOVExp1() { base.Closed += new EventHandler(this.frmRepOVExp1_Closed); base.Load += new EventHandler(this.frmRepOVExp1_Load); base.Click += new EventHandler(this.frmRepOVExp1_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.DS1 = new DataSet(); this.InitializeComponent(); try { FormulaFieldDefinition definition2; bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; this.DS.Clear(); this.DS1.Clear(); string selectCommandText = "SELECT OR01001,OR01004,OR01014,OR01016,OR01050,OR01072 from OR010100 where OR01002<>6"; if ((StringType.StrCmp(Variables.gAlmacen1, "", false) != 0) & (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0)) { selectCommandText = selectCommandText + " and (OR01050='" + Variables.gAlmacen1 + "' or OR01050='" + Variables.gAlmacen2 + "')"; } else if (StringType.StrCmp(Variables.gAlmacen1, "", false) != 0) { selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen1 + "'"; } else if (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0) { selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen2 + "'"; } if (StringType.StrCmp(Variables.gCodCli, "", false) != 0) { selectCommandText = selectCommandText + " and OR01004='" + Variables.gCodCli + "'"; } else { selectCommandText = selectCommandText + " and ((OR01004>='600000' and OR01004<='699000') or OR01004='00WARREXPO')"; } this.AdapOR01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT OR03001,OR03005,OR03006,OR03007,OR03011,OR03012,OR03019,OR03067,OR03068 FROM dbo.OR030100 where OR03011-OR03012<>0"; this.AdapOR03 = new SqlDataAdapter(selectCommandText, selectConnectionString); if (Variables.gOVaListar == 1) { selectCommandText = "SELECT SL01001,SL01002 from SL010100"; } else if (Variables.gOVaListar == 2) { selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01060='1'"; } else if (Variables.gOVaListar == 3) { selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01075='1'"; } this.AdapSL01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT SC23001,SC23002 FROM dbo.SC230100"; this.AdapSC23 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT PC03001,PC03002,PC03029 FROM dbo.PC030100"; this.AdapPC03 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapOR01.Fill(this.DS, "OR010100"); this.AdapOR03.Fill(this.DS, "OR030100"); this.AdapSL01.Fill(this.DS, "SL010100"); this.AdapSC23.Fill(this.DS, "SC230100"); this.AdapPC03.Fill(this.DS, "PC030100"); selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'"; this.AdapPL23 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPL23.Fill(this.DS1, "PL230100"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["PL230100"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["PL230100"].Rows[i]; command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); if (flag) { connection.Close(); flag = false; } ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } connection.Close(); flag = false; selectCommandText = "select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp"; this.AdapTmp = new SqlDataAdapter(selectCommandText, connectionString); this.AdapTmp.Fill(this.DS, "PC1TmpFormaDesp"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovexp1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovexp2.rpt"); } this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["tipo"]; definition.Text = "'" + Variables.gTipoList + "'"; if (Variables.gOrdenList == 1) { definition2 = formulaFields["orden"]; definition2.Text = "'Ordenado por Orden de Compra Cliente'"; } else if (Variables.gOrdenList == 2) { definition2 = formulaFields["orden"]; definition2.Text = "'Ordenado por Fecha Confirmada'"; } this.CrystalReportViewer1.ReportSource = this.Informe; } catch (Exception exception3) { ProjectData.SetProjectError(exception3); Exception exception2 = exception3; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
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 frmRepOVPend1() { base.Closed += new EventHandler(this.frmRepOVPend1_Closed); base.Load += new EventHandler(this.frmRepOVPend1_Load); base.Click += new EventHandler(this.frmRepOVPend1_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { string str; FormulaFieldDefinition definition6; SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); if (Variables.gOVaListar == 1) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend"; } else if (Variables.gOVaListar == 2) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))"; } else if (Variables.gOVaListar == 3) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1"; } else if (Variables.gOVaListar == 4) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1"; } else if (Variables.gOVaListar == 5) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)"; } else if (Variables.gOVaListar == 6) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)"; } SqlCommand command = new SqlCommand(str, connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpOVPend"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovpend.rpt"); } else if (Variables.gOrdenList == 3) { this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt"); } this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaov"]; if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafechaov"]; if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } FormulaFieldDefinition definition3 = formulaFields["desdefechaent"]; if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition3.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"; } else { definition3.Text = "''"; } FormulaFieldDefinition definition4 = formulaFields["hastafechaent"]; if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition4.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"; } else { definition4.Text = "''"; } FormulaFieldDefinition definition5 = formulaFields["tipo"]; definition5.Text = "'" + Variables.gTipoList + "'"; if (Variables.gOrdenList == 1) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Entrega Prevista'"; } else if (Variables.gOrdenList == 2) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por N\x00b0 de Cliente'"; } else if (Variables.gOrdenList == 3) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Orden de Venta'"; } this.CrystalReportViewer1.ReportSource = this.Informe; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { SqlDataAdapter adapter4; DataRow row; DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"); connection2.Open(); SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpRepGesEns", connection2); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } string connectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=True;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); string cmdText = "SELECT DISTINCT OR010100.OR01001,OR010100.OR01015,OR010100.OR01016,OR030100.OR03002,OR030100.OR03005,OR030100.OR03006,OR030100.OR03007,OR030100.OR03011,OR030100.OR03012,OR190100.OR19011,OR040100.OR04002,OR040100.OR04003,OR040100.OR04004,OR040100.OR04005,OR040100.OR04008 FROM dbo.OR010100 INNER JOIN dbo.OR030100 on OR010100.OR01001=OR030100.OR03001 LEFT OUTER JOIN dbo.OR040100 on OR010100.OR01001=OR040100.OR04001 LEFT OUTER JOIN dbo.OR190100 on OR030100.OR03001=OR190100.OR19001 and OR030100.OR03002=OR190100.OR19002 where OR010100.OR01002=6 and OR030100.OR03003='000' and OR190100.OR19003='000' "; if ((StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)) { cmdText = cmdText + " and OR190100.OR19011>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and OR190100.OR19011<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } if (StringType.StrCmp(Variables.gNroOE, "", false) != 0) { cmdText = cmdText + " and OR010100.OR01001='" + Variables.gNroOE + "'"; } if (StringType.StrCmp(Variables.gNroOV, "", false) != 0) { cmdText = cmdText + " and rtrim(OR040100.OR04003)='" + Variables.gNroOV + "'"; } command = new SqlCommand(cmdText, connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { adapter4 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("Select SC01128,SY24003 from SC010100 inner join SY240100 on SC01128=SY24002 where SC01001='", reader["OR03005"]), "' and SY24001='II'")), connectionString); dataSet.Clear(); adapter4.Fill(dataSet, "SC010100"); row = dataSet.Tables["SC010100"].Rows[0]; cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRepGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,Grupo,NomGrupo,CantOE,CantArmado,Cliente,NroOV,Obs) values ('", reader["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',")); if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OR19011"]))) { cmdText = cmdText + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR19011"]), "MM/dd/yyyy") + "',"; } else { cmdText = cmdText + "Null,"; } cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(cmdText + "'", reader["OR03002"]), "','"), reader["OR03005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR03006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR03007"]))), "','"), row["SC01128"]), "','"), row["SY24003"]), "',"), ObjectType.MulObj(reader["OR03011"], -1)), ","), ObjectType.MulObj(reader["OR03012"], -1)), ",")); if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04002"])), "0", false) == 0) { cmdText = cmdText + "'',"; } else { cmdText = cmdText + "'" + Strings.Trim(StringType.FromObject(reader["OR04002"])) + "',"; } if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04003"])), "0", false) == 0) { cmdText = cmdText + "'','')"; } else { cmdText = cmdText + "'" + Strings.Format(Conversion.Val(RuntimeHelpers.GetObjectValue(reader["OR04003"])), "0000000000") + "','')"; } command = new SqlCommand(cmdText, connection2); try { command.ExecuteNonQuery(); } catch (Exception exception5) { ProjectData.SetProjectError(exception5); Exception exception2 = exception5; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); reader.Close(); connection.Close(); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } reader.Close(); cmdText = "SELECT DISTINCT OR200100.OR20001,OR200100.OR20015,OR200100.OR20016,OR210100.OR21002,OR210100.OR21005,OR210100.OR21006,OR210100.OR21007,OR210100.OR21011,OR210100.OR21012,OR230100.OR23011,OR220100.OR22002,OR220100.OR22003,OR220100.OR22004,OR220100.OR22005,OR220100.OR22008 FROM dbo.OR200100 INNER JOIN dbo.OR210100 on OR200100.OR20001=OR210100.OR21001 LEFT OUTER JOIN dbo.OR220100 on OR200100.OR20001=OR220100.OR22001 LEFT OUTER JOIN dbo.OR230100 on OR210100.OR21001=OR230100.OR23001 and OR210100.OR21002=OR230100.OR23002 and OR210100.OR21065=OR230100.OR23034 where OR200100.OR20002=6 and OR210100.OR21003='000' and OR230100.OR23003='000' "; if ((StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)) { cmdText = cmdText + " and OR230100.OR23011>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and OR230100.OR23011<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } if (StringType.StrCmp(Variables.gNroOE, "", false) != 0) { cmdText = cmdText + " and OR200100.OR20001='" + Variables.gNroOE + "'"; } if (StringType.StrCmp(Variables.gNroOV, "", false) != 0) { cmdText = cmdText + " and rtrim(OR220100.OR22003)='" + Variables.gNroOV + "'"; } command = new SqlCommand(cmdText, connection); command.CommandTimeout = 500; reader = command.ExecuteReader(); while (reader.Read()) { adapter4 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("Select SC01128,SY24003 from SC010100 inner join SY240100 on SC01128=SY24002 where SC01001='", reader["OR21005"]), "' and SY24001='II'")), connectionString); dataSet.Clear(); adapter4.Fill(dataSet, "SC010100"); row = dataSet.Tables["SC010100"].Rows[0]; cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRepGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,Grupo,NomGrupo,CantOE,CantArmado,Cliente,NroOV,Obs) values ('", reader["OR20001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR20015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR20016"]), "MM/dd/yyyy")), "',")); if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OR23011"]))) { cmdText = cmdText + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR23011"]), "MM/dd/yyyy") + "',"; } else { cmdText = cmdText + "Null,"; } cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(cmdText + "'", reader["OR21002"]), "','"), reader["OR21005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR21006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR21007"]))), "','"), row["SC01128"]), "','"), row["SY24003"]), "',"), ObjectType.MulObj(reader["OR21011"], -1)), ","), ObjectType.MulObj(reader["OR21012"], -1)), ",")); if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22002"])), "0", false) == 0) { cmdText = cmdText + "'',"; } else { cmdText = cmdText + "'" + Strings.Trim(StringType.FromObject(reader["OR22002"])) + "',"; } if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22003"])), "0", false) == 0) { cmdText = cmdText + "'','')"; } else { cmdText = cmdText + "'" + Strings.Format(Conversion.Val(RuntimeHelpers.GetObjectValue(reader["OR22003"])), "0000000000") + "','')"; } command = new SqlCommand(cmdText, connection2); try { command.ExecuteNonQuery(); } catch (Exception exception6) { ProjectData.SetProjectError(exception6); Exception exception3 = exception6; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null); reader.Close(); connection.Close(); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } reader.Close(); connection.Close(); connection2.Close(); try { SqlConnection connection4 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection4.Open(); SqlCommand command2 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection4); command2.CommandTimeout = 500; SqlDataAdapter adapter5 = new SqlDataAdapter(); adapter5.SelectCommand = command2; dataSet.Clear(); adapter5.Fill(dataSet, "PC1TmpRepGesEns"); if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0) { this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt"); this.Informe.SetDataSource(dataSet); connection4.Close(); } else { this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt"); this.Informe.SetDataSource(dataSet); connection4.Close(); } FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.cmbSalir.Enabled = true; } catch (Exception exception7) { ProjectData.SetProjectError(exception7); Exception exception4 = exception7; Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public frmRepOCPendConf1() { base.Closed += new EventHandler(this.frmRepOCPendConf1_Closed); base.Load += new EventHandler(this.frmRepOCPendConf1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.DS1 = new DataSet(); this.InitializeComponent(); bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; this.DS.Clear(); this.DS1.Clear(); string selectCommandText = "SELECT PC01001,PC01003,PC01004,PC01014,PC01015,PC01016 FROM dbo.PC010100"; if (StringType.StrCmp(Variables.gCodProv, "", false) != 0) { selectCommandText = selectCommandText + " where PC01003='" + Variables.gCodProv + "'"; if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0) { selectCommandText = selectCommandText + " and PC01014=" + Variables.gCodMetEnt; } } else if (StringType.StrCmp(Variables.gCodMetEnt, "", false) != 0) { selectCommandText = selectCommandText + " where PC01014=" + Variables.gCodMetEnt; } this.AdapPC01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT PC03001,PC03005,PC03006,PC03007,PC03010,PC03011 FROM dbo.PC030100 where PC03011<PC03010 and PC03029=''"; if (StringType.StrCmp(Variables.gCodAlmacen, "", false) != 0) { selectCommandText = selectCommandText + " and PC03035='" + Variables.gCodAlmacen + "'"; } this.AdapPC03 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT SL01001,SL01002 FROM dbo.SL010100"; this.AdapSL01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT PL01001,PL01002 FROM dbo.PL010100"; this.AdapPL01 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPC01.Fill(this.DS, "PC010100"); this.AdapPC03.Fill(this.DS, "PC030100"); this.AdapSL01.Fill(this.DS, "SL010100"); this.AdapPL01.Fill(this.DS, "PL010100"); selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'"; this.AdapPL23 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPL23.Fill(this.DS1, "PL230100"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["PL230100"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["PL230100"].Rows[i]; command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); if (flag) { connection.Close(); flag = false; } ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } connection.Close(); flag = false; selectCommandText = "select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp"; this.AdapTmp = new SqlDataAdapter(selectCommandText, connectionString); this.AdapTmp.Fill(this.DS, "PC1TmpFormaDesp"); this.Informe.Load(Application.StartupPath + @"\repocpendconf.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["almacen"]; if (StringType.StrCmp(Variables.gCodAlmacen, Strings.Space(0), false) != 0) { definition.Text = "'Almacen: " + Strings.Trim(Variables.gNomAlmacen) + "'"; } else { definition.Text = "'Todos los almacenes'"; } FormulaFieldDefinition definition2 = formulaFields["formadesp"]; if (StringType.StrCmp(Variables.gCodMetEnt, Strings.Space(0), false) != 0) { definition2.Text = "'Forma Despacho: " + Strings.Trim(Variables.gDescMetEnt) + "'"; } else { definition2.Text = "'Todos las formas de despacho'"; } this.CrystalReportViewer1.ShowGroupTreeButton = true; this.CrystalReportViewer1.ReportSource = this.Informe; }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"); SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection2.Open(); SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpOVPend", connection2); int num2 = command4.ExecuteNonQuery(); string cmdText = "SELECT SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,sum(SC03003) as SC03003,sum(SC03004+SC03005) as StkComp,OR010100.OR01079 FROM dbo.SL010100,dbo.OR010100,dbo.OR030100,dbo.SC030100 where OR010100.OR01002<>6 and OR03011-OR03012<>0 "; if (StringType.StrCmp(Variables.gAlmacen1, "01", false) == 0) { cmdText = cmdText + "and SC03002='01' and OR01050='01'"; } else { cmdText = cmdText + "and SC03002='02' and OR01050='02'"; } if ((StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0)) { cmdText = cmdText + " and OR01015>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "MM/dd/yyyy") + "' and OR01015<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "MM/dd/yyyy") + "'"; } if ((StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0)) { cmdText = cmdText + " and OR01016>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR01016<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'"; } if (StringType.StrCmp(Variables.gCodCli, Strings.Space(0), false) != 0) { cmdText = cmdText + " and OR01004='" + Variables.gCodCli + "'"; } cmdText = cmdText + " and OR01001=OR03001 and OR01004=SL01001 and OR03005=SC03001" + " group by SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,OR010100.OR01079"; SqlCommand command2 = new SqlCommand(cmdText, connection); command2.CommandTimeout = 500; SqlDataAdapter adapter3 = new SqlDataAdapter(); adapter3.SelectCommand = command2; connection.Open(); adapter3.Fill(dataSet, "SC030100"); long num3 = dataSet.Tables["SC030100"].Rows.Count - 1; for (long i = 0L; i <= num3; i += 1L) { SqlDataReader reader; string str4; DataRow row = dataSet.Tables["SC030100"].Rows[(int)i]; if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) > 0) { cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row["OR03005"]), "' and PC03043<PC03044 and PC03029=1 ")); if (StringType.StrCmp(Variables.gAlmacen1, "01", false) == 0) { cmdText = cmdText + "and PC03035='01' order by PC03016"; } else { cmdText = cmdText + "and PC03035='02' order by PC03016"; } SqlCommand command = new SqlCommand(cmdText, connection); reader = command.ExecuteReader(); if (reader.Read()) { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ",'"), row["OR01079"]), "')")); reader.Close(); command4 = new SqlCommand(str4, connection2); } else { reader.Close(); command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } } else if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) == 0) { cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR010100.OR01016,OR030100.OR03011,OR030100.OR03012 FROM dbo.OR030100,OR010100 where OR03005='", row["OR03005"]), "' and OR03012<OR03011 and OR01002=6 and OR03001=OR01001 order by OR01016")); reader = new SqlCommand(cmdText, connection).ExecuteReader(); if (reader.Read()) { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["OR03011"], reader["OR03012"])), ",'"), row["OR01079"]), "')")); reader.Close(); command4 = new SqlCommand(str4, connection2); } else { reader.Close(); command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } } else { command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } try { num2 = command4.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); } } connection.Close(); connection2.Close(); try { FormulaFieldDefinition definition6; connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); if (Variables.gOVaListar == 1) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend"; } else if (Variables.gOVaListar == 2) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))"; } else if (Variables.gOVaListar == 3) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1"; } else if (Variables.gOVaListar == 4) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1"; } else if (Variables.gOVaListar == 5) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)"; } else if (Variables.gOVaListar == 6) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)"; } command2 = new SqlCommand(cmdText, connection); command2.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command2; dataSet.Clear(); this.AdapOR01.Fill(dataSet, "PC1TmpOVPend"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovpend.rpt"); } else if (Variables.gOrdenList == 3) { this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt"); } this.Informe.SetDataSource(dataSet); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaov"]; if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafechaov"]; if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } FormulaFieldDefinition definition3 = formulaFields["desdefechaent"]; if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition3.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"; } else { definition3.Text = "''"; } FormulaFieldDefinition definition4 = formulaFields["hastafechaent"]; if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition4.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"; } else { definition4.Text = "''"; } FormulaFieldDefinition definition5 = formulaFields["tipo"]; definition5.Text = "'" + Variables.gTipoList + "'"; if (Variables.gOrdenList == 1) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Entrega Prevista'"; } else if (Variables.gOrdenList == 2) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por N\x00b0 de Cliente'"; } else if (Variables.gOrdenList == 3) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Orden de Venta'"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; } catch (Exception exception3) { ProjectData.SetProjectError(exception3); Exception exception2 = exception3; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public frmRepRMDesp1() { base.Closed += new EventHandler(this.frmRepRMDesp1_Closed); base.Load += new EventHandler(this.frmRepRMDesp1_Load); base.Click += new EventHandler(this.frmRepRMDesp1_Click); base.Leave += new EventHandler(this.frmRepRMDesp1_Leave); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); string str = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null"; if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))) { if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)) { str = str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str = str + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str = (str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } } SqlCommand command = new SqlCommand(str + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Zoom(1); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public frmRepInvFis1() { base.Closed += new EventHandler(this.frmRepInvFis1_Closed); this.DS = new DataSet(); this.DS1 = new DataSet(); this.DSTmp = new DataSet(); this.Informe = new ReportDocument(); this.InitializeComponent(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; string selectCommandText = "select * from Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "'"; if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) != 0) { selectCommandText = selectCommandText + " and Operador='" + Variables.gOperario + "'"; } if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) != 0)) { selectCommandText = selectCommandText + " and Codigo>='" + Variables.gCodProdDesde + "' and Codigo<='" + Variables.gCodProdHasta + "'"; } if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) != 0) { selectCommandText = selectCommandText + " and Fecha='" + Strings.Format(DateType.FromString(Variables.gFechaLec), "MM/dd/yyyy") + "'"; } this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapTmp.Fill(this.DS, "Inventario"); this.Informe.Load(Application.StartupPath + @"\repinvfis.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["fechainv"]; definition.Text = "'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["operario"]; if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) == 0) { definition2.Text = "'Todos los operarios'"; } else { definition2.Text = "'Operario: " + Variables.gOperario + "'"; } FormulaFieldDefinition definition3 = formulaFields["productos"]; if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) == 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) == 0)) { definition3.Text = "'Todos los productos'"; } else { definition3.Text = "'Desde Producto: " + Variables.gCodProdDesde + "-" + Strings.Trim(Variables.gDescProdDesde1) + " " + Strings.Trim(Variables.gDescProdDesde2) + " Hasta Producto: " + Variables.gCodProdHasta + "-" + Strings.Trim(Variables.gDescProdHasta1) + " " + Strings.Trim(Variables.gDescProdHasta2) + "'"; } FormulaFieldDefinition definition4 = formulaFields["fechalec"]; if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) == 0) { definition4.Text = "'Todos las fechas de lectura'"; } else { definition4.Text = "'Fecha de Lectura: " + Strings.Format(DateType.FromString(Variables.gFechaLec), "dd/MM/yyyy") + "'"; } this.CrystalReportViewer1.ReportSource = this.Informe; }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); try { bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; dataSet.Clear(); this.DS1.Clear(); string selectCommandText = "SELECT OR01001,OR01004,OR01014,OR01016,OR01050,OR01072 from OR010100 where OR01002<>6"; if ((StringType.StrCmp(Variables.gAlmacen1, "", false) != 0) & (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0)) { selectCommandText = selectCommandText + " and (OR01050='" + Variables.gAlmacen1 + "' or OR01050='" + Variables.gAlmacen2 + "')"; } else if (StringType.StrCmp(Variables.gAlmacen1, "", false) != 0) { selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen1 + "'"; } else if (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0) { selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen2 + "'"; } if (StringType.StrCmp(Variables.gCodCli, "", false) != 0) { selectCommandText = selectCommandText + " and OR01004='" + Variables.gCodCli + "'"; } else { selectCommandText = selectCommandText + " and ((OR01004>='600000' and OR01004<='699000') or OR01004='00WARREXPO')"; } this.AdapOR01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT OR03001,OR03005,OR03006,OR03007,OR03011,OR03012,OR03019,OR03067,OR03068 FROM dbo.OR030100 where OR03011-OR03012<>0"; this.AdapOR03 = new SqlDataAdapter(selectCommandText, selectConnectionString); if (Variables.gOVaListar == 1) { selectCommandText = "SELECT SL01001,SL01002 from SL010100"; } else if (Variables.gOVaListar == 2) { selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01060='1'"; } else if (Variables.gOVaListar == 3) { selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01075='1'"; } this.AdapSL01 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT SC23001,SC23002 FROM dbo.SC230100"; this.AdapSC23 = new SqlDataAdapter(selectCommandText, selectConnectionString); selectCommandText = "SELECT PC03001,PC03002,PC03029 FROM dbo.PC030100"; this.AdapPC03 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapOR01.Fill(dataSet, "OR010100"); this.AdapOR03.Fill(dataSet, "OR030100"); this.AdapSL01.Fill(dataSet, "SL010100"); this.AdapSC23.Fill(dataSet, "SC230100"); this.AdapPC03.Fill(dataSet, "PC030100"); selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'"; this.AdapPL23 = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapPL23.Fill(this.DS1, "PL230100"); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection); int num2 = command.ExecuteNonQuery(); long num3 = this.DS1.Tables["PL230100"].Rows.Count - 1; for (long i = 0L; i <= num3; i += 1L) { DataRow row = this.DS1.Tables["PL230100"].Rows[(int)i]; command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); if (flag) { connection.Close(); flag = false; } ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } connection.Close(); flag = false; new SqlDataAdapter("select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp", connectionString).Fill(dataSet, "PC1TmpFormaDesp"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovexp1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovexp2.rpt"); } this.Informe.SetDataSource(dataSet); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); definitions.get_Item("tipo").set_Text("'" + Variables.gTipoList + "'"); if (Variables.gOrdenList == 1) { definitions.get_Item("orden").set_Text("'Ordenado por Orden de Compra Cliente'"); } else if (Variables.gOrdenList == 2) { definitions.get_Item("orden").set_Text("'Ordenado por Fecha Confirmada'"); } 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(); } }