public List <CatProveedorModels> ObteneComboProveedoresXID(DocumentoPorPagarModels Datos) { try { object[] parametros = { Datos.IDTProveedor, }; CatProveedorModels item; List <CatProveedorModels> lista = new List <CatProveedorModels>(); SqlDataReader dr = null; dr = SqlHelper.ExecuteReader(Datos.Conexion, "spCSLDB_Combo_get_CatTipoProveedorXID", parametros); while (dr.Read()) { item = new CatProveedorModels(); item.IDProveedor = !dr.IsDBNull(dr.GetOrdinal("id_proveedor")) ? dr.GetString(dr.GetOrdinal("id_proveedor")) : string.Empty; item.NombreRazonSocial = !dr.IsDBNull(dr.GetOrdinal("Descripcion")) ? dr.GetString(dr.GetOrdinal("Descripcion")) : string.Empty; lista.Add(item); } dr.Close(); return(lista); } catch (Exception ex) { throw ex; } }
// GET: Admin/DocumentoXPagar/Create public ActionResult Create() { try { Token.SaveToken(); _Combos_Datos CMB = new _Combos_Datos(); DocumentoXPagar_Datos datos = new DocumentoXPagar_Datos(); DocumentoPorPagarModels documentos = new DocumentoPorPagarModels(); documentos.Fecha = DateTime.Now; documentos.ListaSucursal = CMB.ObtenerComboSucursales(Conexion); documentos.ListaCDocumento = datos.ObtenerConceptosDocumento(Conexion); documentos.LisTipoProveedor = datos.ObteneComboCatTipoProveedor(Conexion); documentos.IDTProveedor = 0; documentos.Conexion = Conexion; documentos.LisProveedor = datos.ObteneComboProveedoresXID(documentos); return(View(documentos)); } catch (Exception) { DocumentoPorPagarModels documentos = new DocumentoPorPagarModels(); TempData["typemessage"] = "2"; TempData["message"] = "No se puede cargar la vista"; return(View(documentos)); } }
public DocumentoPorPagarModels AbcDocumentoXPagar(DocumentoPorPagarModels datos) { try { object[] parametros = { datos.Opcion, datos.IDDocumentoPagar ?? string.Empty, datos.IDSucursal ?? string.Empty, datos.Fecha, datos.Usuario, datos.id_concepto, datos.precio, datos.IDTProveedor, datos.IDProveedor }; object aux = SqlHelper.ExecuteScalar(datos.Conexion, "spCSLDB_DocumentoPorPagar_AC", parametros); datos.IDDocumentoPagar = aux.ToString(); if (!string.IsNullOrEmpty(datos.IDDocumentoPagar)) { datos.Completado = true; } else { datos.Completado = false; } return(datos); } catch (Exception ex) { throw ex; } }
public ActionResult ObtenerProveedoresXID(int IDP) { try { DocumentoPorPagarModels Documento = new DocumentoPorPagarModels(); DocumentoXPagar_Datos DocumentoDatos = new DocumentoXPagar_Datos(); Documento.IDTProveedor = IDP; Documento.Conexion = Conexion; List <CatProveedorModels> Lista = DocumentoDatos.ObteneComboProveedoresXID(Documento); return(Json(Lista, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ex.Message.ToString(); return(Json("", JsonRequestBehavior.AllowGet)); } }
// GET: Admin/DocumentoXPagar public ActionResult Index() { try { DocumentoPorPagarModels Documentos = new DocumentoPorPagarModels(); DocumentoXPagar_Datos DocumentosDatos = new DocumentoXPagar_Datos(); Documentos.Conexion = Conexion; Documentos.ListaDocumentos = DocumentosDatos.ObtenerListaDocumentosPagar(Documentos); return(View(Documentos)); } catch (Exception) { DocumentoPorPagarModels Documentos = new DocumentoPorPagarModels(); TempData["typemessage"] = "2"; TempData["message"] = "No se puede cargar la vista"; return(View(Documentos)); } }
public ActionResult DetailsPagos(string id, int id2) { try { DocumentoPorPagarDetallePagosModels pago = new DocumentoPorPagarDetallePagosModels(); DocumentoXPagar_Datos documentoDatos = new DocumentoXPagar_Datos(); pago.Conexion = Conexion; pago.Id_documentoPorPagar = id; pago.id_status = id2; pago.ListaPagosDocumento = documentoDatos.ObtenerListaDetallePagos(pago); return(View(pago)); } catch (Exception) { DocumentoPorPagarModels docu = new DocumentoPorPagarModels(); TempData["typemessage"] = "2"; TempData["message"] = "No se puede cargar la vista"; return(RedirectToAction("Index")); } }
public List <DocumentoPorPagarModels> ObtenerListaDocumentosPagar(DocumentoPorPagarModels datos) { try { List <DocumentoPorPagarModels> Lista = new List <DocumentoPorPagarModels>(); DocumentoPorPagarModels Item; SqlDataReader dr = null; dr = SqlHelper.ExecuteReader(datos.Conexion, "spCSLDB_Documento_get_DocumentoXPagar"); while (dr.Read()) { Item = new DocumentoPorPagarModels(); Item.numFactura = !dr.IsDBNull(dr.GetOrdinal("Factura")) ? dr.GetString(dr.GetOrdinal("Factura")) : string.Empty; Item.IDTipoDocumento = !dr.IsDBNull(dr.GetOrdinal("IDTipo")) ? dr.GetInt32(dr.GetOrdinal("IDTipo")) : 0; Item.IDDocumentoPagar = !dr.IsDBNull(dr.GetOrdinal("IDDocuemntoPagar")) ? dr.GetString(dr.GetOrdinal("IDDocuemntoPagar")) : string.Empty; Item.IDSucursal = !dr.IsDBNull(dr.GetOrdinal("IDSucursal")) ? dr.GetString(dr.GetOrdinal("IDSucursal")) : string.Empty; Item.Fecha = !dr.IsDBNull(dr.GetOrdinal("Fecha")) ? dr.GetDateTime(dr.GetOrdinal("Fecha")) : DateTime.Today; Item.IDEstatus = !dr.IsDBNull(dr.GetOrdinal("IDEstatus")) ? dr.GetInt16(dr.GetOrdinal("IDEstatus")) : 1; Item.EsSistema = !dr.IsDBNull(dr.GetOrdinal("EsSistema")) ? dr.GetBoolean(dr.GetOrdinal("EsSistema")) : false; Item.Total = !dr.IsDBNull(dr.GetOrdinal("Total")) ? dr.GetDecimal(dr.GetOrdinal("Total")) : 0; Item.Pagos = !dr.IsDBNull(dr.GetOrdinal("Pagos")) ? dr.GetDecimal(dr.GetOrdinal("Pagos")) : 0; Item.Pendientes = !dr.IsDBNull(dr.GetOrdinal("Pendiente")) ? dr.GetDecimal(dr.GetOrdinal("Pendiente")) : 0; Item.NombreSucursal = !dr.IsDBNull(dr.GetOrdinal("NombreSucursal")) ? dr.GetString(dr.GetOrdinal("NombreSucursal")) : string.Empty; Item.EstatusNombre = !dr.IsDBNull(dr.GetOrdinal("EstatusDocumento")) ? dr.GetString(dr.GetOrdinal("EstatusDocumento")) : string.Empty; Item.NombreRazonSocial = !dr.IsDBNull(dr.GetOrdinal("nombreRazonSocial")) ? dr.GetString(dr.GetOrdinal("nombreRazonSocial")) : string.Empty; Item.MontoPagado = !dr.IsDBNull(dr.GetOrdinal("montoPagado")) ? dr.GetDecimal(dr.GetOrdinal("montoPagado")) : 0; Lista.Add(Item); } dr.Close(); return(Lista); } catch (Exception ex) { throw ex; } }
public ActionResult ReporteExcel() { try { //Cabecera Reporte_Datos R = new Reporte_Datos(); CatEmpresaModels Empresa = new CatEmpresaModels(); _CatEmpresa_Datos EmpresaDatos = new _CatEmpresa_Datos(); Empresa.Conexion = Conexion; Empresa = EmpresaDatos.GetDatosEmpresaPrincipal(Empresa); //Lista DocumentoPorPagarModels Documentos = new DocumentoPorPagarModels(); DocumentoXPagar_Datos DocumentosDatos = new DocumentoXPagar_Datos(); Documentos.Conexion = Conexion; Documentos.ListaDocumentos = DocumentosDatos.ObtenerListaDocumentosPagar(Documentos); for (int i = 0; i < Documentos.ListaDocumentos.Count; i++) { Documentos.ListaDocumentos[i].TotalString = Auxiliar.StringToMoneda_MX(Documentos.ListaDocumentos[i].Total.ToString()); Documentos.ListaDocumentos[i].PagadoString = Auxiliar.StringToMoneda_MX(Documentos.ListaDocumentos[i].MontoPagado.ToString()); Documentos.ListaDocumentos[i].PendienteString = Auxiliar.StringToMoneda_MX(Documentos.ListaDocumentos[i].Pendientes.ToString()); } LocalReport Rtp = new LocalReport(); Rtp.EnableExternalImages = true; Rtp.DataSources.Clear(); string path = Path.Combine(Server.MapPath("~/Formatos"), "ConcentradoDocumentosPorPagar.rdlc"); if (System.IO.File.Exists(path)) { Rtp.ReportPath = path; } else { return(RedirectToAction("Index")); } string GeneralesEmpresa = "<b>Representante: </b>" + Empresa.Representante + "<br/>"; GeneralesEmpresa += "<b>RFC: </b>" + Empresa.RFC + "<br/>"; GeneralesEmpresa += "<b>Horario de atención: </b>" + Empresa.HorarioAtencion + "<br/>"; string Telefonos = string.IsNullOrEmpty(Empresa.NumTelefonico1) ? string.Empty : Empresa.NumTelefonico1; Telefonos += string.IsNullOrEmpty(Empresa.NumTelefonico2) ? string.Empty : " " + Empresa.NumTelefonico1; if (!string.IsNullOrEmpty(Telefonos)) { GeneralesEmpresa += "<b>Teléfono(s): </b>" + Telefonos + "<br/>"; } if (!string.IsNullOrEmpty(Empresa.Email)) { GeneralesEmpresa += "<b>Email: </b>" + Empresa.Email; } ReportParameter[] Parametros = new ReportParameter[4]; Parametros[0] = new ReportParameter("LogoEmpresa", Empresa.LogoEmpresa); Parametros[1] = new ReportParameter("NombreEmpresa", Empresa.RazonFiscal); Parametros[2] = new ReportParameter("DireccionEmpresa", Empresa.DireccionFiscal); Parametros[3] = new ReportParameter("GeneralesEmpresa", GeneralesEmpresa); Rtp.SetParameters(Parametros); Documentos.ListaDocumentos = Documentos.ListaDocumentos.OrderByDescending(x => x.Fecha).ToList(); Rtp.DataSources.Add(new ReportDataSource("Lista", Documentos.ListaDocumentos)); Rtp.Refresh(); string reportType = "EXCEL"; string mimeType; string encoding; string fileNameExtension; string deviceInfo = "<DeviceInfo>" + " <OutputFormat>" + "Documentos por pagar" + "</OutputFormat>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = Rtp.Render( reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); return(File(renderedBytes, mimeType)); } catch (Exception ex) { string Mensaje = ex.Message.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""); TempData["typemessage"] = "2"; TempData["message"] = "No se puede cargar la vista, error: " + Mensaje; return(View("Index")); } }
public ActionResult Create(DocumentoPorPagarModels documentosss) { _Combos_Datos CMB = new _Combos_Datos(); DocumentoXPagar_Datos documentoDatos = new DocumentoXPagar_Datos(); try { if (Token.IsTokenValid()) { if (ModelState.IsValid) { documentosss.Conexion = Conexion; documentosss.Opcion = 1; documentosss.Usuario = User.Identity.Name; documentosss = documentoDatos.AbcDocumentoXPagar(documentosss); if (documentosss.Completado == true) { TempData["typemessage"] = "1"; TempData["message"] = "Los datos se guardaron correctamente."; Token.ResetToken(); return(RedirectToAction("Index")); } else { documentosss.ListaSucursal = CMB.ObtenerComboSucursales(Conexion); documentosss.ListaCDocumento = documentoDatos.ObtenerConceptosDocumento(Conexion); documentosss.LisTipoProveedor = documentoDatos.ObteneComboCatTipoProveedor(Conexion); documentosss.IDTProveedor = 0; documentosss.Conexion = Conexion; documentosss.LisProveedor = documentoDatos.ObteneComboProveedoresXID(documentosss); TempData["typemessage"] = "2"; TempData["message"] = "Ocurrió un error al intentar guardar."; return(View(documentosss)); } } else { documentosss.Conexion = Conexion; documentosss.ListaSucursal = CMB.ObtenerComboSucursales(Conexion); documentosss.ListaCDocumento = documentoDatos.ObtenerConceptosDocumento(Conexion); documentosss.LisTipoProveedor = documentoDatos.ObteneComboCatTipoProveedor(Conexion); documentosss.IDTProveedor = 0; documentosss.LisProveedor = documentoDatos.ObteneComboProveedoresXID(documentosss); return(View(documentosss)); } } else { return(RedirectToAction("Index")); } } catch { documentosss.ListaSucursal = CMB.ObtenerComboSucursales(Conexion); documentosss.ListaCDocumento = documentoDatos.ObtenerConceptosDocumento(Conexion); documentosss.LisTipoProveedor = documentoDatos.ObteneComboCatTipoProveedor(Conexion); documentosss.IDTProveedor = 0; documentosss.Conexion = Conexion; documentosss.LisProveedor = documentoDatos.ObteneComboProveedoresXID(documentosss); TempData["typemessage"] = "2"; TempData["message"] = "Ocurrió un error el intentar guardar. Contacte a soporte técnico"; return(View(documentosss)); } }