public DataTable ListaEncabezados(int idReferencia) { String SQLWhere = ""; if (idReferencia != -1) { SQLWhere = "AND B.idReferencia = " + idReferencia.ToString(); } BandejaEntradaDal bandeja = new BandejaEntradaDal(); DataTable Datos = bandeja.ListaEncabezados(SQLWhere, Pagina, RegPorPagina); return(Datos); }
public DataTable ListaEncabezadosMovimientosCC(int nroMovimiento) { string SQLWhere = ""; int vRegPorPagina = 0; SQLWhere = SQLWhere + " AND B.idEncabezado NOT IN ( "; SQLWhere = SQLWhere + "SELECT bb.idEncabezado FROM remitoinforme ri "; SQLWhere = SQLWhere + "INNER JOIN bandejaentrada bb ON ri.idEncabezado=bb.idEncabezado "; SQLWhere = SQLWhere + "WHERE bb.idCliente = " + nroMovimiento.ToString() + " ) "; BandejaEntradaDal bandeja = new BandejaEntradaDal(); DataTable Datos = bandeja.ListaEncabezados(SQLWhere, Pagina, RegPorPagina); return(Datos); }
public DataTable ListaEncabezados(int idCliente, int Usuario, string Estado, string FechaDesde, string FechaHasta, int vRegPorPagina, int excepcion) { String SQLWhere = ""; if (Usuario != -1) { SQLWhere = SQLWhere + " AND B.idUsuario = " + Usuario.ToString(); } if (idCliente != -1) { SQLWhere = SQLWhere + " AND B.idCliente = " + idCliente.ToString(); } if (Estado != "") { string[] Est = Estado.Split(",".ToCharArray()); if (Est[0] != "-1") { SQLWhere = SQLWhere + " AND ( "; for (int i = 0; i < Est.Length; i++) { if (i < Est.Length && i > 0) { SQLWhere = SQLWhere + " OR "; } SQLWhere = SQLWhere + " B.Estado = " + Est[i].ToString(); } SQLWhere = SQLWhere + ")"; } } if (FechaDesde != "") { FechaDesde = "'" + FechaDesde + " 00:00:00.000'"; } else { FechaDesde = DateTime.Today.AddMonths(-3).ToShortDateString(); FechaDesde = "'" + FechaDesde + " 00:00:00.000'"; } if (FechaHasta != "") { FechaHasta = "'" + FechaHasta + " 23:59:59.999'"; } else { FechaHasta = DateTime.Today.ToShortDateString(); FechaHasta = "'" + FechaHasta + " 23:59:59.999'"; } if (vRegPorPagina != 0) { intRegPorPagina = vRegPorPagina; } SQLWhere = SQLWhere + " AND B.FechaCarga BETWEEN '" + FechaDesde + "' AND '" + FechaHasta + "'"; if (excepcion != 0) { SQLWhere = SQLWhere + " AND B.idEncabezado NOT IN ( "; SQLWhere = SQLWhere + "SELECT bb.idEncabezado FROM remitoinforme ri "; SQLWhere = SQLWhere + "INNER JOIN bandejaentrada bb ON ri.idEncabezado=bb.idEncabezado "; SQLWhere = SQLWhere + "WHERE bb.idCliente = " + idCliente.ToString() + " ) "; SQLWhere = SQLWhere + " AND B.idEncabezado NOT IN ( "; SQLWhere = SQLWhere + "SELECT bb.idEncabezado FROM parteEntregaInforme ri "; SQLWhere = SQLWhere + "INNER JOIN bandejaentrada bb ON ri.idEncabezado=bb.idEncabezado "; SQLWhere = SQLWhere + "WHERE bb.idCliente = " + idCliente.ToString() + " ) "; } BandejaEntradaDal bandeja = new BandejaEntradaDal(); DataTable Datos = bandeja.ListaEncabezados(SQLWhere, Pagina, RegPorPagina); return(Datos); }
public DataTable ListaEncabezados(int tipo, String Texto, int idCliente, int Usuario, string Estado, int Caracter, String FechaDesde, String FechaHasta, int vRegPorPagina, bool Extranet) { String SQLWhere = ""; if (tipo != -1) { SQLWhere = SQLWhere + "AND B.idTipoInforme = " + tipo.ToString(); } if (Texto != "") { SQLWhere = SQLWhere + " AND (B.Nombre like '%" + Texto + "%' "; SQLWhere = SQLWhere + " OR B.Apellido like '%" + Texto + "%' "; SQLWhere = SQLWhere + " OR B.RazonSocial like '%" + Texto + "%' "; SQLWhere = SQLWhere + " OR B.RazonSocial like '%" + Texto + "%' "; SQLWhere = SQLWhere + " OR B.DescripcionInf like '%" + Texto + "%' )"; } if (Usuario != -1) { SQLWhere = SQLWhere + " AND B.idUsuario = " + Usuario.ToString(); } if (idCliente != -1) { SQLWhere = SQLWhere + " AND B.idCliente = " + idCliente.ToString(); } if (Estado != "") { string[] Est = Estado.Split(",".ToCharArray()); if (Est[0] != "-1") { SQLWhere = SQLWhere + " AND ( "; for (int i = 0; i < Est.Length; i++) { if (i < Est.Length && i > 0) { SQLWhere = SQLWhere + " OR "; } SQLWhere = SQLWhere + " B.Estado = " + Est[i].ToString(); } SQLWhere = SQLWhere + ")"; } } if (Caracter != -1) { SQLWhere = SQLWhere + " AND B.Caracter = " + Caracter.ToString(); } /*else { * if (Extranet) { * SQLWhere = SQLWhere + " AND B.Estado in (1,5,9) "; * } * }*/ if (FechaDesde != "") { FechaDesde = "'" + FechaDesde + " 00:00:00.000'"; } else { FechaDesde = DateTime.Today.AddMonths(-3).ToShortDateString(); FechaDesde = "'" + FechaDesde + " 00:00:00.000'"; } if (FechaHasta != "") { FechaHasta = "'" + FechaHasta + " 23:59:59.999'"; } else { FechaHasta = DateTime.Today.ToShortDateString(); FechaHasta = "'" + FechaHasta + " 23:59:59.999'"; } if (vRegPorPagina != 0) { intRegPorPagina = vRegPorPagina; } SQLWhere = SQLWhere + " AND B.FechaCarga BETWEEN '" + FechaDesde + "' AND '" + FechaHasta + "'"; BandejaEntradaDal bandeja = new BandejaEntradaDal(); DataTable Datos; if (Extranet) { Datos = bandeja.ListaEncabezadosExtranet(SQLWhere, Pagina, intRegPorPagina); } else { Datos = bandeja.ListaEncabezados(SQLWhere, Pagina, intRegPorPagina); } intTotalRegistros = bandeja.TotalRegistros; intPaginas = ((int)(intTotalRegistros / intRegPorPagina)) + 1; return(Datos); }