private void _Mtd_Buscar() { string _Str_Sql = "SELECT * FROM VST_NOTACREDITOEMIT WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cimpresa='1' AND ccaja='" + _Txt_Caja.Text + "'"; if (_Txt_Caja_2.Text.Trim().Length > 0) { _Str_Sql = "SELECT * FROM VST_NOTACREDITOEMIT WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cimpresa='1' AND ccaja BETWEEN " + _Txt_Caja.Text + " AND " + _Txt_Caja_2.Text + " ORDER BY convert(numeric(18,0),ccaja)"; DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Sql); if (_Ds.Tables[0].Rows.Count > 0) { Report.rInfNotaCredEmit2 _My_Reporte = new T3.Report.rInfNotaCredEmit2(); _My_Reporte.SetDataSource(_Ds.Tables[0]); Section _sec = _My_Reporte.ReportDefinition.Sections["Section2"]; TextObject tex1 = _sec.ReportObjects["cabecera"] as TextObject; tex1.Text = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset("SELECT rtrim(cname) FROM TCOMPANY WHERE ccompany='" + Frm_Padre._Str_Comp + "'").Tables[0].Rows[0][0].ToString(); TextObject tex2 = _sec.ReportObjects["txt_desde_hasta"] as TextObject; tex2.Text = " Desde la Caja N#: " + _Txt_Caja.Text + " a la Caja N#: " + _Txt_Caja_2.Text; TextObject tex3 = _sec.ReportObjects["txt_titulo"] as TextObject; tex3.Text = "NOTAS DE CRÉDITO EMITIDAS"; this._Rpv_Main.ReportSource = _My_Reporte; _Rpv_Main.RefreshReport(); } else { this._Rpv_Main.ReportSource = null; MessageBox.Show("No existen Notas de Crédito.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Sql); if (_Ds.Tables[0].Rows.Count > 0) { Report.rInfNotaCredEmit _My_Reporte = new T3.Report.rInfNotaCredEmit(); _My_Reporte.SetDataSource(_Ds.Tables[0]); Section _sec = _My_Reporte.ReportDefinition.Sections["Section2"]; TextObject tex1 = _sec.ReportObjects["cabecera"] as TextObject; tex1.Text = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset("SELECT rtrim(cname) FROM TCOMPANY WHERE ccompany='" + Frm_Padre._Str_Comp + "'").Tables[0].Rows[0][0].ToString(); TextObject tex2 = _sec.ReportObjects["txt_desde_hasta"] as TextObject; tex2.Text = "Caja N#: " + _Txt_Caja.Text; TextObject tex3 = _sec.ReportObjects["txt_titulo"] as TextObject; tex3.Text = "NOTAS DE CRÉDITO EMITIDAS"; this._Rpv_Main.ReportSource = _My_Reporte; _Rpv_Main.RefreshReport(); } else { this._Rpv_Main.ReportSource = null; MessageBox.Show("No existen Notas de Crédito.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void _Mtd_Busqueda() { string _Str_Sql = "SELECT * FROM VST_NOTACREDITOEMIT WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cimpresa='1'"; if (_Rb_Cliente.Checked && _Cb_Cliente.SelectedIndex > 0) { _Str_Sql = _Str_Sql + " AND ccliente='" + _Cb_Cliente.SelectedValue.ToString() + "'"; } if (_Rb_Vendedor.Checked && _Cb_Vendedor.SelectedIndex > 0) { _Str_Sql = _Str_Sql + " AND cvendedor='" + _Cb_Vendedor.SelectedValue.ToString() + "'"; } if (_Rb_Motivo.Checked && _Cb_Motivo.SelectedIndex > 0) { _Str_Sql = _Str_Sql + " AND Codcidmotivo='" + _Cb_Motivo.SelectedValue.ToString() + "'"; } if (_Rb_TipoBolivares.Checked) { _Str_Sql += " AND ctiponc='BOLIVARES' "; } if (_Rb_TipoDevolucion.Checked) { _Str_Sql += " AND ctiponc='DEVOLUCION' "; } _Str_Sql = _Str_Sql + " AND convert(datetime,convert(varchar(255),cfecha,103)) BETWEEN '" + _Cls_Formato._Mtd_fecha(_Dt_Desde.Value) + "' AND '" + _Cls_Formato._Mtd_fecha(_Dt_Hasta.Value) + "'"; DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Sql); if (_Ds.Tables[0].Rows.Count > 0) { Report.rInfNotaCredEmit _My_Reporte = new T3.Report.rInfNotaCredEmit(); _My_Reporte.SetDataSource(_Ds.Tables[0]); Section _sec = _My_Reporte.ReportDefinition.Sections["Section2"]; TextObject tex1 = _sec.ReportObjects["cabecera"] as TextObject; tex1.Text = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset("SELECT rtrim(cname) FROM TCOMPANY WHERE ccompany='" + Frm_Padre._Str_Comp + "'").Tables[0].Rows[0][0].ToString(); TextObject tex2 = _sec.ReportObjects["txt_desde_hasta"] as TextObject; tex2.Text = "DESDE " + _Cls_Formato._Mtd_fecha(_Dt_Desde.Value.Date) + " AL " + _Cls_Formato._Mtd_fecha(_Dt_Hasta.Value.Date); TextObject tex3 = _sec.ReportObjects["txt_titulo"] as TextObject; tex3.Text = "NOTAS DE CRÉDITO EMITIDAS"; this._Rpv_Main.ReportSource = _My_Reporte; _Rpv_Main.RefreshReport(); } else { this._Rpv_Main.ReportSource = null; MessageBox.Show("No existen Notas de Crédito.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } }