diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 7a14674f8..9435c83d1 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -525,7 +525,7 @@ Public Class ClsClientes 'SqlAdapter.Dispose() Return Retorno End Function - Public Function GetHistorialVentas(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional TipoDocto As String = "-1") As Boolean + Public Function GetHistorialVentas(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional TipoDocto As String = "-1", Optional CveEstatusFactura As Integer = -1, Optional FechaI As DateTime = ModExtensiones.MinFecha, Optional FechaF As DateTime = ModExtensiones.MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClienteHistorialVentas") @@ -533,6 +533,9 @@ Public Class ClsClientes SqlAdapter.SelectCommand.Parameters.Add("@SelectTop", SqlDbType.Int).Value = SelectTop SqlAdapter.SelectCommand.Parameters.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal SqlAdapter.SelectCommand.Parameters.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura + SqlAdapter.SelectCommand.Parameters.Add("@FechaI", SqlDbType.DateTime).Value = FechaI + SqlAdapter.SelectCommand.Parameters.Add("@FechaF", SqlDbType.DateTime).Value = FechaF Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 88fb94258..33dc7e050 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -2239,11 +2239,11 @@ Public Class ClsCompras End Try Return Retorno - End Function + End Function #End Region - + #Region "TIPOS DE GASTOS" - + Public Function GetTipoGasto(CveTipoGasto As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Comp_TiposGastosGet") @@ -2261,50 +2261,113 @@ Public Class ClsCompras End Try Return Retorno - End Function + End Function + + Public Function AddTipoGasto(TipoGasto As String, Estatus As Boolean, FechaIng As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_TiposGastosAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@TipoGasto", SqlDbType.NVarChar).Value = TipoGasto + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el tipo de gasto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function UpdateTipoGasto(CveTipoGasto As Integer, TipoGasto As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_TiposGastosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoGasto", SqlDbType.Int).Value = CveTipoGasto + .Add("@TipoGasto", SqlDbType.NVarChar).Value = TipoGasto + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo de gasto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveTipoGasto(CveTipoGasto As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Comp_TiposGastosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTipoGasto", SqlDbType.Int).Value = CveTipoGasto + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el tipo de gasto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + #End Region - + #Region "VINCULAR PAGO" - 'Public Function GetVincularPago(CveProveedor As Integer, CveCompra As Integer, Tipo As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional CveTipoProveedor As Integer = -1) As Boolean - ' Dim Retorno As Boolean = False - ' DataAdapter("PA_Comp_VincularPagoGet") - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - ' .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - ' .Add("@Tipo", SqlDbType.Int).Value = Tipo - ' .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - ' .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - ' .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor - ' End With - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al obtener los pagos a vincular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - ' Return Retorno - 'End Function - - 'Public Function GetVincularPago(CveProveedor As Integer, Monto As Decimal, XMLPagos As String, CveEmpresa As Integer) As Boolean - ' Dim Retorno As Boolean = False - ' DataAdapter("PA_Comp_VincularComplementoPagoGet") - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - ' .Add("@Monto", SqlDbType.Float).Value = Monto - ' .Add("@XMLPagos", SqlDbType.Xml).Value = XMLPagos - ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - ' End With - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al obtener la vinculación de complemento de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - ' Return Retorno - 'End Function - + 'Public Function GetVincularPago(CveProveedor As Integer, CveCompra As Integer, Tipo As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional CveTipoProveedor As Integer = -1) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Comp_VincularPagoGet") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + ' .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + ' .Add("@Tipo", SqlDbType.Int).Value = Tipo + ' .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + ' .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener los pagos a vincular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + ' Return Retorno + 'End Function + + 'Public Function GetVincularPago(CveProveedor As Integer, Monto As Decimal, XMLPagos As String, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Comp_VincularComplementoPagoGet") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + ' .Add("@Monto", SqlDbType.Float).Value = Monto + ' .Add("@XMLPagos", SqlDbType.Xml).Value = XMLPagos + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener la vinculación de complemento de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + ' Return Retorno + 'End Function + Public Function AddComplementoPago(CveIE As Integer, CveCompra As Integer, Importe As Decimal, CvePrePolizaDetalle As Integer, CveFactura As Integer) As Integer Dim Retorno As Integer = 0 DataAdapter("PA_Comp_ComplementoPagoAdd") diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 531cadc14..9a4c0c915 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4100,6 +4100,7 @@ Public Class ClsPaginas PaginaDict.Add("/OI/Circular.aspx".ToUpper(), 756) PaginaDict.Add("/OI/CircularDetalle.aspx".ToUpper(), 757) PaginaDict.Add("/OI/CircularDetalleB.aspx".ToUpper(), 757) + PaginaDict.Add("/Compras/CatTipoGasto.aspx".ToUpper(), 759) #End Region diff --git a/App_Code/ClsValidaCFDi.vb b/App_Code/ClsValidaCFDi.vb index 59aebfc3a..02031dff8 100644 --- a/App_Code/ClsValidaCFDi.vb +++ b/App_Code/ClsValidaCFDi.vb @@ -102,8 +102,35 @@ Public Class ClsValidaCFDi EsValida = 2 End If - Catch ex As Exception + 'SI NO PUEDE ENCONTRAR EL ESTATUS UTILIZA EL SERVICIO PARA ESTATUS DE CANCELACION + If EsValida = 0 Then + + Dim Vigencia = Timbrado.VerificarVigenciaSAT(LFolioFiscal.ToUpper, LRFCEmisor, LRFCReceptor, Importe, True) + + If Vigencia IsNot Nothing Then + If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then + EsValida = 1 + End If + If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then + EsValida = 2 + ElseIf Vigencia.Estado.ToUpper().Contains("VIGENTE") Then + If Vigencia.EstatusCancelacion.ToUpper() = "EN PROCESO" Then + EsValida = 1 + ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE CON ACEPTACIÓN" Then + EsValida = 1 + ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then + EsValida = 1 + End If + Else + EsValida = 0 + End If + Else + EsValida = 0 + End If + End If + Catch ex As Exception + OnError("Ocurrió un error al consultar la vigencia ante el SAT", ex) End Try End Sub diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 5e08bcb3a..9e1941e5c 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4265,6 +4265,14 @@ Namespace Modelos Return Retorno End If + 'VALIDACION DE PEDIDOS: SI ESTA ENTEGADO NO SE PUEDA CANCELAR + If ObjFactura.TipoDocto = "Pd2" AndAlso TieneAlmacen AndAlso ObjFactura.SaldoAlmacen <> 0 Then + Retorno.Mensaje = "El pedido no se puede cancelar debido ha que ya fue entregado." + Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia + + Return Retorno + End If + Dim CveEstatusRefacturacion As Integer = If(ObjFactura.CveEstatusRefacturacion <= 0, 0, ObjFactura.CveEstatusRefacturacion) diff --git a/Compras/CatTipoGasto.aspx b/Compras/CatTipoGasto.aspx new file mode 100644 index 000000000..f930bc624 --- /dev/null +++ b/Compras/CatTipoGasto.aspx @@ -0,0 +1,76 @@ +<%@ Page Title="Compras - Catálogo de Tipos de Gasto" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatTipoGasto.aspx.cs" Inherits="Compras_CatTipoGasto" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Catálogo de Tipo Gastos de Rechazo de Paquetes + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + diff --git a/Compras/CatTipoGasto.aspx.cs b/Compras/CatTipoGasto.aspx.cs new file mode 100644 index 000000000..4ffb4c9b7 --- /dev/null +++ b/Compras/CatTipoGasto.aspx.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; + +public partial class Compras_CatTipoGasto : ClsPaginas +{ + private int CveTipoGasto + { + get + { + return ViewState["CveTipoGasto"].ToString().ToEntero(); + } + + set + { + ViewState["CveTipoGasto"] = value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + + private void CargaDatos() + { + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.GetTipoGasto(-1,UsuarioActual.CveEmpresa)) + { + GvDatos.DataSource = ObjCompras.DtResultados; + GvDatos.DataBind(); + } + ObjCompras.Dispose(); + } + + protected void BtnAgregarTipoGastoD_Click(object sender, EventArgs e) + { + BtnAgregarTipoGasto.Text = "Agregar"; + TxtTipoGasto.Text = ""; + ChkEstatus.Checked = true; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + protected void LnkEditar_Click(object sender, EventArgs e) + { + BtnAgregarTipoGasto.Text = "Actualizar"; + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveTipoGasto = GvRow.DataKey("CveTipoGasto").ToEntero(); + TxtTipoGasto.Text = GvRow.DataKey("TipoGasto"); + ChkEstatus.Checked = GvRow.DataKey("Estatus") == "Activo"; + ChkEstatus.Enabled = true; + UpModalTiposD.Update(); + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); + } + + protected void LnkEliminar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveTipoGasto = GvRow.DataKey("CveTipoGasto").ToEntero(); + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.RemoveTipoGasto(CveTipoGasto)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se eliminó el Tipo de Gasto correctamente"); + } + ObjCompras.Dispose(); + } + + protected void BtnAgregarTipoGasto_Click(object sender, EventArgs e) + { + ClsCompras ObjCompras = new ClsCompras(); + if (BtnAgregarTipoGasto.Text == "Agregar") + { + if (ObjCompras.AddTipoGasto(TxtTipoGasto.Text,ChkEstatus.Checked,DateTime.Now.ToString(),UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se agregó el Tipo de Gasto correctamente"); + } + }else + { + if (ObjCompras.UpdateTipoGasto(CveTipoGasto,TxtTipoGasto.Text,ChkEstatus.Checked,-1,-1)) + { + CargaDatos(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + Alert("Se actualizó el Tipo de Gasto correctamente"); + } + } + ObjCompras.Dispose(); + } +} \ No newline at end of file diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index b55948612..1c4f06b5f 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -105,7 +105,7 @@ Partial Class PopUpVerFactura Dim UsuarioToken = ValidaUsuarioSistema(CveEmpresaToken, CveUsuario) - If UsuarioToken IsNot Nothing AndAlso UsuarioActual Is Nothing Then + If UsuarioToken IsNot Nothing AndAlso Context.Session("UsuarioSIG") Is Nothing Then Context.Session("UsuarioSIG") = UsuarioToken End If End If diff --git a/General/PopUpPaqueteriasGuias.aspx.cs b/General/PopUpPaqueteriasGuias.aspx.cs index 97e830f06..3c8e94472 100644 --- a/General/PopUpPaqueteriasGuias.aspx.cs +++ b/General/PopUpPaqueteriasGuias.aspx.cs @@ -787,11 +787,11 @@ public partial class General_PopUpPaqueteriasGuias : ClsPaginas strBody.Append("
    "); strBody.Append("

    "); strBody.Append(" Gracias por realizar pedido
    "); - strBody.Append(" Compuproveedores"); + //strBody.Append(" Compuproveedores"); strBody.Append("

    "); strBody.Append("

    "); strBody.Append(" Sigue disfrutando de nuestros productos y servicios
    "); - strBody.Append(" www.compuproveedores.com"); + //strBody.Append(" www.compuproveedores.com"); strBody.Append(""); strBody.Append("

    "); strBody.Append(" "); diff --git a/General/RepPaqueteriasGuias.aspx.cs b/General/RepPaqueteriasGuias.aspx.cs index 2633ccd25..af2e3a827 100644 --- a/General/RepPaqueteriasGuias.aspx.cs +++ b/General/RepPaqueteriasGuias.aspx.cs @@ -202,7 +202,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas } CargaDatos(); - + } } @@ -231,7 +231,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas DdlPaqueterias.DataBind(); DdlPaqueterias.Items.Insert(0, new ListItem("Todos ", "-1")); } - + DdlPaqueteriaEditar.DataSource = get_GlobalDTPaqueterias(UsuarioActual.CveEmpresa); DdlPaqueteriaEditar.DataBind(); @@ -254,7 +254,8 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas if (UsuarioActual.CveRol == 1339) { DdlEstatus.Items.Insert(0, new ListItem("En Proceso ", "2")); - }else + } + else { DdlEstatus.Items.Insert(0, new ListItem("Todos ", "-1")); DdlEstatus.Items.Insert(1, new ListItem("Pendiente ", "1")); @@ -272,7 +273,8 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas DdlEstatusEditar.Items.Insert(4, new ListItem("Confirmado por Cliente", "4")); DdlEstatusEditar.SelectedValue = "-1"; - if(UsuarioActual.Empresa.Funcionalidad(280) == "1"){ + if (UsuarioActual.Empresa.Funcionalidad(280) == "1") + { DivEstatusEntrega.Visible = true; } @@ -282,7 +284,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas { if (UsuarioActual.CveRol == 1339) { - DdlUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa:UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveRol = {0}",UsuarioActual.CveRol)); + DdlUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveRol = {0}", UsuarioActual.CveRol)); DdlUsuarios.DataBind(); } else @@ -336,7 +338,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas String FechaIngInicio = TxtFechaInicialIngreso.Text == "" ? "-1" : TxtFechaInicialIngreso.Text; String FechaIngFin = TxtFechaFinalIngreso.Text == "" ? "-1" : TxtFechaFinalIngreso.Text; - if (ObjGeneral.GetPaqueteriasGuias(CvePaqueteriaGuia, CvePaqueteriaGuiaTipo, CvePaqueteria, CveEstatus, CveSubProyecto, CveEmpresa, Guia, FechaInicio, FechaFin, + if (ObjGeneral.GetPaqueteriasGuias(CvePaqueteriaGuia, CvePaqueteriaGuiaTipo, CvePaqueteria, CveEstatus, CveSubProyecto, CveEmpresa, Guia, FechaInicio, FechaFin, FechaIngInicio, FechaIngFin, Filtro: Filtro, CveUsuarioEntrega: CveUsuarioEntrega, EsEntregaInterna: ChkLote.Checked)) { DTDatos = ObjGeneral.DtResultados; @@ -356,7 +358,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas int CvePaqueteriaGuiaTipo = DdlTipoEditar.SelectedValue.ToEntero(); int CveEstatus = DdlEstatusEditar.SelectedValue.ToEntero(); int CveSubProyecto = DdlSucursalesEditar.SelectedValue.ToEntero(); - + String Guia = (TxtGuia.Text != "") ? TxtGuia.Text : "-1"; String Rastreo = TxtRastreo.Text; String Fecha = TxtFecha.Text; @@ -372,7 +374,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas if (ObjGeneral.UpdatePaqueteriasGuias(CvePaqueteriaGuia, CvePaqueteriaGuiaTipo, CveSubProyecto, CvePaqueteria, CveEstatus, Fecha, Rastreo, Guia, NumCajas, Peso, Dimensiones, FechaEstimada, Observaciones, ImplicaCosto)) { - + if (Guia == "-1") { Alert(String.Format("La Guía se ha actualizado correctamente."), ModExtensiones.TipoMensaje.MsgInformacion); @@ -486,7 +488,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas TxtPeso.Text = String.Format("{0:N3}", GvRow.DataKey("Peso").ToDouble()); TxtDimensiones.Text = GvRow.DataKey("Dimensiones"); TxtObservaciones.Text = GvRow.DataKey("Observaciones"); - + ChkImplicaCosto.Checked = Boolean.Parse(GvRow.DataKey("ImplicaCosto")); Boolean mostrarDescarga = CrearArchivo(false); @@ -494,7 +496,8 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas if (mostrarDescarga) { DivDownloadGuia.Visible = true; - } else + } + else { DivDownloadGuia.Visible = false; } @@ -533,9 +536,9 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas { BtnEliminarGuia.Visible = false; } - + UPEditarGuia.Update(); - + this.RegistraScript("$('#DivEditarGuia').modal('show');"); } @@ -716,7 +719,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas int EstatusEntregado = 3; //Mandamos a actualizar solo el estatus - if (!ObjGral.UpdatePaqueteriasGuias(CvePaqueteriaGuia,-1, -1, -1, EstatusEntregado, "-1", "", "", -1, -1, "-1", "-1", "")) + if (!ObjGral.UpdatePaqueteriasGuias(CvePaqueteriaGuia, -1, -1, -1, EstatusEntregado, "-1", "", "", -1, -1, "-1", "-1", "")) { TieneError = true; } @@ -732,7 +735,8 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas if (MensajeEnviado) { Alert(String.Format("El Archivo ha sido guardado y el estatus de la Guía ha sido actualizado correctamente.

    Correo enviado exitosamente a {0}.", Destinatario)); - }else + } + else { Alert(String.Format("El Archivo ha sido guardado y el estatus de la Guía ha sido actualizado correctamente.

    Error al Notificar al Cliente a su correo: {0}.", Destinatario)); } @@ -777,7 +781,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas { String path = Path.Combine(UsuarioActual.Empresa.Ruta, "Documentos", "Guias", CvePaqueteriaGuia.ToString() + ".pdf"); System.IO.FileInfo file = new System.IO.FileInfo(path); - + string[] fileEntries = Directory.GetFiles(Path.Combine(UsuarioActual.Empresa.Ruta, "Documentos", "Guias")); foreach (string fileName in fileEntries) @@ -793,7 +797,8 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas if (descargar) { DescargarArchivo(file); - }else + } + else { if (!file.Exists) { @@ -813,11 +818,11 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas { Response.Clear(); - Response.AddHeader("Content-Disposition", "attachment; filename="+ String.Format("Guia {0} - {1}{2}",Paqueteria, Guia,File.Extension)); + Response.AddHeader("Content-Disposition", "attachment; filename=" + String.Format("Guia {0} - {1}{2}", Paqueteria, Guia, File.Extension)); Response.AddHeader("Content-Length", File.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(File.FullName); - + Response.End(); } catch (Exception e) @@ -1006,7 +1011,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas SerieFolio = String.Format("{0}-{1}", DbRowVenta["Serie"].ToString(), DbRowVenta["Folio"].ToString().ToEntero()); NombreCliente = DbRowVenta["ClienteNombre"].ToString(); - + //Si se subio Archivo if (!SubirArchivo) { @@ -1037,7 +1042,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas private string getCorreoNotificacion(int CveCliente, int CveVendedor) { - DataRow DatosCliente = get_GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveCliente = {0}",CveCliente)); + DataRow DatosCliente = get_GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveCliente = {0}", CveCliente)); DataRow DatosVendedor = get_GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveVendedor = {0}", CveVendedor)); if (DatosCliente != null && DatosVendedor != null) { @@ -1060,11 +1065,11 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas CveVenta = GvRow.DataKey("CveAgrupador").ToString().ToEntero(); Folio = GvRow.DataKey("Folio").ToString(); } - + protected void BtnReasignar_Click(object sender, EventArgs e) { ClsGenerales ObjGeneral = new ClsGenerales(); - if (ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriaGuiaReasignar, -1, CveMotivoRechazoPaqueteria:DdlMotivoRechazoGuia.SelectedValue.ToEntero())) + if (ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriaGuiaReasignar, -1, CveMotivoRechazoPaqueteria: DdlMotivoRechazoGuia.SelectedValue.ToEntero())) { Alert("La guía está lista para volver a ser asignada, disponible en el reporte Entregas Por Realizar"); } @@ -1072,7 +1077,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas CargaDatos(); UPDatos.Update(); CvePaqueteriaGuiaReasignar = -1; - EnviarCorreoNotificacionEntrega(3, Folio, "","","","","",-1,null); + EnviarCorreoNotificacionEntrega(3, Folio, "", "", "", "", "", -1, null); this.RegistraScript("$('#ModalMotivoReasignacion').modal('hide')", "hidemodal3"); } @@ -1080,7 +1085,7 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas { ClsVentas ObjVentas = new ClsVentas(); - if (ObjVentas.GetVenta(CveVenta,UsuarioActual.CveEmpresa)) + if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa)) { DataRow row = ObjVentas.DtResultados.Rows[0]; string ClienteNombre = row["ClienteNombre"].ToString(); @@ -1122,11 +1127,11 @@ public partial class General_RepPaqueteriasGuias : ClsPaginas strBody.Append("
    "); strBody.Append("

    "); strBody.Append(" Agradecemos su preferencia.
    "); - strBody.Append(" Compuproveedores"); + //strBody.Append(" Compuproveedores"); strBody.Append("

    "); strBody.Append("

    "); strBody.Append(" Sigue disfrutando de nuestros productos y servicios
    "); - strBody.Append(" www.compuproveedores.com"); + //strBody.Append(" www.compuproveedores.com"); strBody.Append(""); strBody.Append("

    "); strBody.Append(" "); diff --git a/Inventarios/AjustesSeccionAlmacen.aspx.vb b/Inventarios/AjustesSeccionAlmacen.aspx.vb index 191beda8c..478c321f9 100644 --- a/Inventarios/AjustesSeccionAlmacen.aspx.vb +++ b/Inventarios/AjustesSeccionAlmacen.aspx.vb @@ -13,10 +13,12 @@ Partial Class Inventarios_AjustesSeccionAlmacen End Sub Private Sub CargaCombos() - DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + DdlAlmacen.DataSource = DtAlmacenes DdlAlmacen.DataBind() - DdlAlmacenExcel.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + DdlAlmacenExcel.DataSource = DtAlmacenes DdlAlmacenExcel.DataBind() DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) @@ -216,7 +218,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "") If Tipo = "EXCEL" Then Dim CveAlmacen As Integer = DdlAlmacenExcel.SelectedValue.ToEntero() - Dim CveSubProyecto As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}") + Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}") CargarArchivo(Directorio, file.filename, CveAlmacen, CveSubProyecto) Else @@ -267,7 +269,10 @@ Partial Class Inventarios_AjustesSeccionAlmacen If Not ErrorArchivo Then Dim ErrorMovInv As Boolean = False - Dim RowNoEncontrados As New StringBuilder() + Dim CodigosNoEncontrados As New StringBuilder() + Dim SeccionesNoEncontradas As New StringBuilder() + Dim ExistenciasNoEncontradas As New StringBuilder() + Dim NumAgregados As Integer = 0 Dim ObjInventario As New ClsInventarios() @@ -275,7 +280,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen Try Dim DtExistenciasSecciones As DataTable = Nothing - If ObjInventario.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacen.SelectedValue.ToEntero, DdlClasificaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacenExcel.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then DtExistenciasSecciones = ObjInventario.DtResultados.Copy() End If @@ -293,9 +298,9 @@ Partial Class Inventarios_AjustesSeccionAlmacen For Each RowExcel As DataRow In DtExcel.Rows Dim Codigo As String = RowExcel("Código").ToString.Trim() - Dim PS As String = RowExcel("Producto/Servicio").ToString().Trim() + 'Dim PS As String = RowExcel("Producto/Servicio").ToString().Trim() - Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, Codigo:=Codigo).FiltroPrimero($"PS='{PS}'") + Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimero($"Codigo='{Codigo}'") If DrPS IsNot Nothing Then If Not ErrorMovInv Then @@ -319,7 +324,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen Dim RowExistencia As DataRow = DtExistenciasSecciones.FiltroPrimero($"CvePS={CvePS}") - If RowExistencia IsNot Nothing Then + If RowExistencia IsNot Nothing AndAlso CveSeccionAlmacen > 0 Then Dim CveSeccionAlmacenSalida As Integer = RowExistencia("CveSeccionAlmacen").ToString().ToEntero() Dim CantidadSalida As Decimal = RowExistencia("Existencia").ToString().ToDecimal() Dim SerieSalida As String = RowExistencia("Serie").ToString() @@ -362,13 +367,22 @@ Partial Class Inventarios_AjustesSeccionAlmacen End If Else ErrorMovInv = True - RowNoEncontrados.AppendFormat("{0},", Codigo) + End If + + If RowExistencia Is Nothing Then + ExistenciasNoEncontradas.AppendFormat("{0},", SeccionAlmacen) + ErrorMovInv = True + End If + + If CveSeccionAlmacen <= 0 Then + SeccionesNoEncontradas.AppendFormat("{0},", SeccionAlmacen) + ErrorMovInv = True End If End If Else ErrorMovInv = True - RowNoEncontrados.AppendFormat("{0},", Codigo) + CodigosNoEncontrados.AppendFormat("{0},", Codigo) End If Next @@ -383,10 +397,21 @@ Partial Class Inventarios_AjustesSeccionAlmacen ObjInventario.RollBack() Dim SbError As New StringBuilder() - SbError.Append("Ocurrió un error al guardar") - If RowNoEncontrados.Length > 0 Then - SbError.Append("Los siguientes códigos no fueron encontrados en el sistema.
    ") - SbError.Append(RowNoEncontrados.ToString()) + SbError.Append("Ocurrió un error al guardar.
    ") + + If CodigosNoEncontrados.Length > 0 Then + SbError.Append("
    Los siguientes códigos no fueron encontrados en el sistema.
    ") + SbError.Append(CodigosNoEncontrados.ToString()) + End If + + If ExistenciasNoEncontradas.Length > 0 Then + SbError.Append($"
    Los siguientes códigos no se encontraron existencias en el almacen: '{DdlAlmacenExcel.SelectedItem.Text}'.
    ") + SbError.Append(ExistenciasNoEncontradas.ToString()) + End If + + If SeccionesNoEncontradas.Length > 0 Then + SbError.Append("
    Las siguientes secciones de almacen no fueron encontradas en el sistema.
    ") + SbError.Append(SeccionesNoEncontradas.ToString()) End If Alert(SbError.ToString(), TipoMensaje.MsgError) diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx index 9a90ffba9..6114ccac7 100644 --- a/Inventarios/EntradasSalidas.aspx +++ b/Inventarios/EntradasSalidas.aspx @@ -1,4 +1,5 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasSalidas.aspx.vb" Inherits="Inventarios_EntradasSalidas" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasSalidas.aspx.vb" Inherits="Inventarios_EntradasSalidas" EnableEventValidation="false" %> + <%@ Register Assembly="eWorld.UI" Namespace="eWorld.UI" TagPrefix="ew" %> diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 9eaa25b5d..66928519a 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1193,6 +1193,8 @@ Partial Class Inventarios_EntradasSalidas Dim CveMetodoInventario As Integer = RowPS("Inv_CveMetodoInventario").ToString().ToEntero() + Dim FechaCaducidadVal As Date = If(RowPS("AplicaCaducidad").ToString = "True", FechaCaducidad, MinFecha) + If CveMetodoInventario = 5 And (String.IsNullOrEmpty(SerieLote.Trim()) OrElse SerieLote = "-1") Then Valido = False Alert("El producto requiere Serie-Lote", TipoMensaje.MsgAdvertencia) @@ -1201,7 +1203,7 @@ Partial Class Inventarios_EntradasSalidas 'salida If Valido AndAlso DdlConcepto.SelectedValue.Contiene({"3", "5", "7", "8", "11", "12", "13", "15", "16", "17", "20", "21", "30", "31"}) Then ' salida de almacen - Dim Existencia As Double = GetExistencias(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, -1, If(SerieLote = "", "-1", SerieLote), If(Lote = "", "-1", Lote), FechaCaducidad) + Dim Existencia As Double = GetExistencias(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, -1, If(SerieLote = "", "-1", SerieLote), If(Lote = "", "-1", Lote), FechaCaducidadVal) ' LbAgregar.ToolTip = Existencia.ToString If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUM} {If(SerieLote <> "", $" AND Serie = '{SerieLote}'", "")}") < 0 Then If Existencia <= 0 Then diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index d2acbfd5f..8dff1f8c8 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -3256,11 +3256,11 @@ Partial Class Inventarios_EntregaAlmacen strBody.Append("
    ") strBody.Append("

    ") strBody.Append(" Gracias por su compra
    ") - strBody.Append(" Compuproveedores") + 'strBody.Append(" Compuproveedores") strBody.Append("

    ") strBody.Append("

    ") strBody.Append(" Sigue disfrutando de nuestros productos y servicios
    ") - strBody.Append(" www.compuproveedores.com") + 'strBody.Append(" www.compuproveedores.com") strBody.Append("") strBody.Append("

    ") strBody.Append(" ") diff --git a/Inventarios/EntregasPorRealizar.aspx.cs b/Inventarios/EntregasPorRealizar.aspx.cs index 4a24c6f5a..689c7d368 100644 --- a/Inventarios/EntregasPorRealizar.aspx.cs +++ b/Inventarios/EntregasPorRealizar.aspx.cs @@ -178,11 +178,11 @@ public partial class Inventarios_EntregasPorRealizar : ClsPaginas strBody.Append("
    "); strBody.Append("

    "); strBody.Append(" Gracias por realizar su pedido
    "); - strBody.Append(" Compuproveedores"); + //strBody.Append(" Compuproveedores"); strBody.Append("

    "); strBody.Append("

    "); strBody.Append(" Sigue disfrutando de nuestros productos y servicios
    "); - strBody.Append(" www.compuproveedores.com"); + //strBody.Append(" www.compuproveedores.com"); strBody.Append(""); strBody.Append("

    "); strBody.Append(" "); diff --git a/PortalCliente/PortalCliente.aspx b/PortalCliente/PortalCliente.aspx index bd846d0b1..cf82c513a 100644 --- a/PortalCliente/PortalCliente.aspx +++ b/PortalCliente/PortalCliente.aspx @@ -1,600 +1,657 @@ -<%@ Page Title="Portal Cliente" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PortalCliente.aspx.vb" Inherits="Ventas_PortalCliente" %> - -<%@ Register Assembly="eWorld.UI, Version=2.0.6.2393, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" TagPrefix="ew" %> - - - - - - -
  • - Descargar todos los PDF -
  • -
  • - Descargar todos los XML -
  • - - -
  • - Agregar Concepto -
  • -
    -
    -
    - -   - - - - - - - - - + +
    - - - - - - - - - - - - - - - - - - -
    -
    -
    - Resumen - - - - - - - - - - - - - - - - - - - - - -
    Cantidad de Compras:  -
    Total Comprado:  -
    Compra Mínima:  -
    Promedio de Compras:  -
    Compra Máxima:  -
    -
    -
    -
    -
    -
    - - - - - - - - -
    -
    -
    - -
    -
    - Historial de Compras - - - - - - - - - - -
    - - - - - - - - - - - Tipo - - - - - - - - - Factura - - - - - - - - Fecha - - - - - - - Sub Total - - - - - - - Descuento - - - - - - - Amortización - - - - - - - Total - - - - - - - - Moneda - - - - - - - Estatus - - - - - - - Se Timbró - - - - - - - Envío Mail - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    -
    -
    - - - - - - + +
    -
    -
    - Cuentas por Pagar Activas - - - - - - - - - + + + + +
    - - - - - - - - - - Factura - - - - - - Fecha Compra - - - - - - Fecha Vencimiento - - - - - - - Días Vencidos - +<%@ Page Title="Portal Cliente" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PortalCliente.aspx.vb" EnableEventValidation="false" Inherits="Ventas_PortalCliente" %> + +<%@ Register Assembly="eWorld.UI, Version=2.0.6.2393, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" TagPrefix="ew" %> + + + + + + +
  • + Descargar todos los PDF +
  • +
  • + Descargar todos los XML +
  • +
    + +   + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + +
    +
    +
    + Resumen + + + + + + + + + + + + + + + + + + + + + +
    Cantidad de Compras:  +
    Total Comprado:  +
    Compra Mínima:  +
    Promedio de Compras:  +
    Compra Máxima:  +
    +
    +
    +
    +
    +
    + + + + + + + + +
    +
    +
    + +
    +
    + Historial de Compras + + + + + + + + + + +
    + + + + + + + + + + + Tipo + + + + + + + + + Factura + + + + + + + + Fecha + + + + + + + Sub Total + + + + + + + Descuento + + + + + + + Amortización + + + + + + + Total + + + + + + + + Moneda + + + + + + + Estatus + + + + + + + Se Timbró + + + + + + + Envío Mail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    +
    + + + + + + - - - - - - + + + + + + - -
    +
    +
    + Cuentas por Pagar Activas + + + + + + + + + - + + + + + Pagar + + + <%----%> + + + + Bitácora + + + + + + + + + + <%-- - --%> -
    + + + + + + + + + + Factura + + + + + + Fecha Compra + + + + + + Fecha Vencimiento + + + + + + + Días Vencidos +   - - - - Monto Compra (Saldo Orig) - + + + + + Monto Compra (Saldo Orig) +   - - - - $ Abonado - + + + + + $ Abonado +   - - - - % Abonado - + + + + + % Abonado +   - - - - Saldo - + + + + + Saldo +   - - - - % A Pagar - + + + + + % A Pagar + %  - - - - Pagar - - - <%----%> - - - - Bitácora - - - - - - - - -
    -
    -
    -
     
    -
    -
    - Historial de Cuentas por Pagar - - - - - - --%> +
    - - - - - - - - - - Factura - - - - - - Fecha Compra - - - - - - Fecha Vencimiento - - - - - - Días Vencidos - +
    +
    +
    +
     
    +
    +
    + Historial de Cuentas por Pagar + + + + + + - + + + + + + + + + + + + <%-- - --%> -
    + + + + + + + + + + Factura + + + + + + Fecha Compra + + + + + + Fecha Vencimiento + + + + + + Días Vencidos +   - - - - Monto Compra (Saldo Orig) - + + + + + Monto Compra (Saldo Orig) +   - - - - $ Abonado - + + + + + $ Abonado +   - - - - % Abonado - + + + + + % Abonado +   - - - - Saldo - + + + + + Saldo +   - - - - % A Pagar - + + + + + % A Pagar +   - - - - - - - - - -
    -
    -
    -
    -
    -
    - - - - - - -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    - -
    -
    -
    - - Anticipo del Cliente -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - -
    -
    -
    - -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    - -
    -
    -
    - - Anticipo del Cliente Historial -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - - - -
    -
    - Datos del Orden de Servicio - - - - - - - - - - - - - --%> +
    Persona que Solicitó: - -
    Descripción: - -
    Fecha Cita: +
    +
    +
    +
    +
    + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + +
    +
    +
    + + Anticipo del Cliente +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + +
    +
    +
    + + Anticipo del Cliente Historial +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    + + + + +
    +
    + Datos del Orden de Servicio + + + + + + + + + + + + + - - - - -
    Persona que Solicitó: + +
    Descripción: + +
    Fecha Cita:   - - - - - - + + + + + + +   - + +   Hora:  - - - - - - -
    - Agregar
    -
    -
    - + + + + + + + +
    + Agregar
    +
    +
    + <%-- -
    @@ -850,880 +907,1089 @@
    --%> - - - - - - - - - -
    - - - + +
    -
    -
    - Datos del Reporte - - +
    --%> + + + + + + + + - -
    + + + - + - -
    +
    +
    + Datos del Reporte + + - - - + + + + - - - + + + + - + + + - - -
    Tipo de Buzón: - - - - - - - -
    + + + + + + +
    Sucursal: - - - - - - -
    + + + + + +
    Fecha : - - - - + - - - + + + + + + + + + +
    + + + + - -
      - - - - - - + + + + + + +   - + +   Hora:  - - - - - - -
    -
    +
    Descripción: - - -
    -
    -
    -
    -
    - Reportó - - + + + +
    + +
    +
    +
    +
    +
    + Reportó + + - - - + + + + - - - + + + + - - - + + + + - - -
    Nombre: - - -
    + +
    Teléfono: - - -
    + +
    Mail: - - -
    + +
    Observaciones: - - -
    -
    -
    -
    - -
    -
    -
    -
    - Personal - - - - - + +
    -   - + + + +
    +
    +
    +
    + +
    +
    +
    +
    + Personal + + + + + - - - -
    +   + Nombre - -
    - - - - - - <%----%> - - - - - - - - - - - -
    - <%----%> - <%----%> - -
    - -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - - <%-- - - - --%> - - - - - - - - + +
    -
    -
    - Usuarios - - - + + + + + + +
    + + + + + + <%----%> + + + + + + + + + + + +
    + <%----%> + <%----%> + +
    + +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + +
    +
    +
    + Usuarios + + + <%-- --%> - --%> + - + - - - - - - - - - - - + + + + + + + + + + + - + - + - - - - - + + + + + + + + <%-- --%> - - - - - - - - - - - - - - - - - -
    Usuario - - + + Nombre - - - + + + + Correo/Usuario - - - Compras - CxP - Anticip - R.H. - O.S. - Cotiza--- - Sist - + + + + Compras + CxP + Anticip + R.H. + O.S. + Cotiza--- + Sist + Est - - - + + + + Fecha - - - + + + + Usuario - - Comandos
    Comandos
    - - - - - - - - - - - - - - - - - - -     -
    - - +
    + + + + + + + + + + + + + + + + + +     +
    + + <%-- - --%> - - - - - - - - - - - - - - - - - - <%----%> - - - - <%----%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + --%> + + + + + + + + + + + + + + + + + + <%----%> + + + + <%----%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      -
    -
    - - -   -   - -
    -
    - - -
    - - -
    -
    - - -
    - - - - - -
    -
    -
    -
    -
    - - Cambio Contraseña -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - -
    - -
    -
    -
    -
    - -
    - - -
    - -
    -
    -
    -
    - -
    - - -
    - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - -
    - -
    - -
    -
    -
    -
    -
    - - - <%--0--%> - - <%--1--%> - - <%--2--%> - - <%--3--%> - - - - - -
    - -
    -
    - <%--4--%> - - <%--5--%> - <%-- + + + + +   +   + + +
    + + +
    + +
    +
    +
    +
    + + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    + +
    + + + +
    +
    + Fecha Inicio: +
    +
    +
    + + + + +
    + + + + + + +
    +
    + Fecha Fin: +
    +
    +
    + + + + +
    + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + Historial de Pedidos +   Agregar Pedido  +   Descarga Excel  + + + + + + + + +
    + + + + Pedido + + + + + + Fecha + + + + + + Sub Total + + + + + + Descuento + + + + + + Amortización + + + + + + Total + + + + + + Moneda + + + + + + Estatus + + + + + + + + + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    + + + + + +
    +
    +
    +
    +
    + + Cambio Contraseña +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + +
    + +
    +
    +
    +
    + +
    + + +
    + +
    +
    +
    +
    + +
    + + +
    + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + +
    + + + + + + + + + + <%-- IxC --%> + + +
    + + - + +
    diff --git a/PortalCliente/PortalCliente.aspx.vb b/PortalCliente/PortalCliente.aspx.vb index d17ec4cc3..c2dd24273 100644 --- a/PortalCliente/PortalCliente.aspx.vb +++ b/PortalCliente/PortalCliente.aspx.vb @@ -8,13 +8,14 @@ Imports System.Xml Imports System.IO.Compression Imports System.Net Imports Microsoft.Reporting.WebForms - +Imports System.Net.Http + Partial Class Ventas_PortalCliente Inherits ClsPaginas - Const TopRegistros = 20 - - + Const TopRegistros = 20 + + #Region " PROPIEDADES " Private Property CveCliente As Integer Get @@ -177,10 +178,10 @@ Partial Class Ventas_PortalCliente Set(value As Modelos.Factura) ViewState("ObjFactura") = value End Set - End Property - + End Property + #End Region - + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Destino = String.Format("{0}\Compras\", UsuarioActual.Empresa.Ruta) @@ -223,7 +224,10 @@ Partial Class Ventas_PortalCliente CargarClienteSucursal() End If - '??ESTE TAB VA DESAPARECER - PARA QUE SOLO LA EMPRESA GESTIONE A LOS USUARIOS POR CLIENTE?? + CargaPedidos() + CargaCuentasDepositos() + + '??ESTE TAB VA DESAPARECER - PARA QUE SOLO LA EMPRESA GESTIONE A LOS USUARIOS POR CLIENTE?? If UsuarioActual.TienePermisoProceso(234) Then ' CARGA TAB SISTEMA TabSistema.Visible = False 'CargaUsuariosPortal() @@ -245,8 +249,8 @@ Partial Class Ventas_PortalCliente InicializaTabPedido() End If - End Sub - + End Sub + #Region "DATOS DEL CLIENTE" Private Sub CargaDatosCliente() LtlTitulo.Text = "Portal del Cliente:" @@ -261,11 +265,11 @@ Partial Class Ventas_PortalCliente End If End If ObjClientes.Dispose() - End Sub + End Sub #End Region - + #Region "TAB HISTORIAL DE VENTAS" - + Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) Dim ObjClientes As New ClsClientes() If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=CveClienteSucursal) Then @@ -400,9 +404,9 @@ Partial Class Ventas_PortalCliente ObjVentas.UpdateVentaMail(3, HdnCveVenta.Value.ToEntero) ObjVentas.Dispose() End Try - End Sub + End Sub #End Region - + #Region "TAB CUENTAS X PAGAR" Private Sub CargaCxP(Optional VerMas As Integer = -1) If TabCxP.Visible = True Then @@ -539,8 +543,8 @@ Partial Class Ventas_PortalCliente End If ObjEventoBitacora.Dispose() UPAddEventoBitacora.Update() - End Sub - + End Sub + #Region " PAGO PROSEPAGO " Private Sub InicializaProsepago() If Not UsuarioActual.CveEmpresa.Contiene(1, 4, 7, 11, 12, 145) Then @@ -1231,12 +1235,12 @@ Partial Class Ventas_PortalCliente Dim Mail As New ClsSisMail() Mail.SendMail(ClsPaginas.EmpresaNotificaciones, CorreoDestino, Asunto, Body) - End Sub + End Sub #End Region - - + + #End Region - + #Region "TAB ANTICIPOS" Private Sub CargaAnticipos(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) Dim ObjMovtos As New ClsMovimientos() @@ -1290,9 +1294,9 @@ Partial Class Ventas_PortalCliente CargaAnticipos(21) BtnVerMasAnticipos.Text = "Ver Más" End If - End Sub + End Sub #End Region - + #Region "TAB BUZON DE CALIDAD" Private Sub CargarTipoBuzon() If TabBuzonCalidad.Visible = True Then @@ -1378,9 +1382,9 @@ Partial Class Ventas_PortalCliente End If Next ObjQueja.Dispose() - End Sub + End Sub #End Region - + #Region "TAB SISTEMA" Private Sub CargaUsuariosPortal() Dim ObjUsuario As New ClsSisUsuarios() @@ -1424,11 +1428,11 @@ Partial Class Ventas_PortalCliente End If ObjUsuario.Dispose() GvUsuariosPortal.DataBind() - End Sub - - + End Sub + + #Region "GESTION DE USUARIOS DEL PORTAL" - + Protected Sub LnkAgregarUsuario_Click(sender As Object, e As EventArgs) Handles LnkAgregarUsuario.Click Dim ObjParametro As SisParametro = GlobalDTParametros(SisParametros.URL) Dim ObjUsuario As New ClsSisUsuarios @@ -1673,13 +1677,13 @@ Partial Class Ventas_PortalCliente a.GuardaLog() Dim Mail As New ClsSisMail() Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - End Sub + End Sub #End Region - + #End Region - + #Region "TAB CONTRASENIA" - + Protected Sub BtnGuardarContraseña_Click(sender As Object, e As EventArgs) Handles BtnGuardarContraseña.Click If Decripta(UsuarioActual.Contraseña) = TxtContraseniaActual.Text Then @@ -1702,9 +1706,459 @@ Partial Class Ventas_PortalCliente Alert("La Contraseña Actual es incorrecta.", TipoMensaje.MsgAdvertencia) End If - End Sub + End Sub #End Region + +#Region "TAB PEDIDOS" + + Private Sub CargaCuentasDepositos() + + 'CargaEstatus + DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(" CveEstatusFactura IN (2, 5, 21) ") + DdlEstatus.DataBind() + + DdlCuenta.Items.Clear() + + 'Dim ObjGral As New ClsGenerales + 'If ObjGral.GetCuentasDepositos(CveProveedor:=-1, CveCliente:=CveCliente, CvePersonal:=-1) Then + ' DdlCuentaDeposito.DataSource = ObjGral.DtResultados.FiltraParametros("Estatus ='True'") + ' If ObjGral.DtResultados.Rows.Count > 0 Then + ' DdlCuentaDeposito.Items.Insert(0, New ListItem("Seleccione una cuenta", "-1")) + ' End If + 'End If + 'ObjGral.Dispose() + + 'DdlCuentaDeposito.DataBind() + + + Dim dt As DataTable + If UsuarioActual.Empresa.Funcionalidad(127) = "1" Then + dt = GlobalDTBancosCuentas(-1) + Else + dt = GlobalDTBancosCuentas(-1).FiltraParametros("CveTipoCuenta <> 1") ' quito las cajas chicas + End If + + + DdlCuenta.DataSource = dt + DdlCuenta.DataBind() + + UpIxC.Update() + End Sub + Private Sub CargaPedidos(Optional TopPedidos As Integer = 21) + Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim.ToDate, MinFecha) + Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim.ToDate, MaxFecha) + Dim ObjClientes As New ClsClientes + If ObjClientes.GetHistorialVentas(CveCliente, TopPedidos, CveClienteSucursal:=-1, TipoDocto:="Pd2", CveEstatusFactura:=DdlEstatus.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF) Then + GvPedidos.DataSource = ObjClientes.DtResultados + If ObjClientes.DtResultados.Rows.Count < 21 Then + LnkVerMasPedidos.Visible = False + End If + End If + ObjClientes.Dispose() + GvPedidos.DataBind() + + UpTabPedidos.Update() + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaPedidos() + End Sub + + Protected Sub BtnVerMasPedidos_Click(sender As Object, e As EventArgs) + If BtnVerMasVentas.Text = "Ver Más" Then + CargaPedidos(-1) + BtnVerMasVentas.Text = "Ver Menos" + Else + CargaPedidos(21) + BtnVerMasVentas.Text = "Ver Más" + End If + End Sub + + Protected Sub GvPedidos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveVenta") <> "" Then + 'e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/PopIEVentas.aspx?CveVenta={0}&TB_iframe=true&height=550&width=700", e.Row.DBCampo("CveVenta")) + If e.Row.DBCampo("CveEstatusFactura").ToEntero().Contiene(4, 5) Then + e.Row.FCLinkButton("ImgAbonar").Visible = False + e.Row.FCLinkButton("ImgCancelar").Visible = False + End If + Else + e.Row.FCLinkButton("ImgAbonar").Visible = False + e.Row.FCLinkButton("ImgCancelar").Visible = False + e.Row.CssClass = "Totales" + End If + End If + End Sub + + Protected Sub ImgCancelar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = (DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)) + If GvRow.DataKey("CveVenta").ToEntero() > 0 Then + Dim ObjFactura As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa) + If ObjFactura IsNot Nothing Then + Dim Resp = ObjFactura.CancelarFactura(RealizarDevolucionAlmacen:=False, ListaRemisionesCancelar:=New List(Of Integer)) + Alert(Resp.Mensaje, If(Resp.HuboError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) + End If + Else + Alert("No se encontro pedido para cancelar", TipoMensaje.MsgAdvertencia) + End If + End Sub + + Protected Sub ImgAbonar_Click(sender As Object, e As EventArgs) + + TxtTotalPedido.Text = "" + TxtFolio.Text = "" + + Me.CveVenta = -1 + Dim GvRow As GridViewRow = (DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)) + If GvRow.DataKey("CveVenta").ToEntero() > 0 Then + + LblPedido.Text = GvRow.DataKey("SerieFolio") + TxtTotalPedido.Text = GvRow.DataKey("Total").ToDecimal().FormatoNumero(2) + RVPedido.MaximumValue = GvRow.DataKey("Total").ToDecimal().FormatoNumero(2) + Me.CveVenta = GvRow.DataKey("CveVenta").ToEntero() + + RegistraScript("$('#DivIxC').modal({backdrop: 'static',keyboard: false});") + End If + UpIxC.Update() + End Sub + + Protected Sub BtnPagarPedido_Click(sender As Object, e As EventArgs) + GuargarIxC(CveCliente, TxtTotalPedido.Text.ToDecimal(), New Modelos.Factura(UsuarioActual, Me.CveVenta, UsuarioActual.CveEmpresa)) + End Sub + + Private Sub GuargarIxC(CveCliente As Integer, ImportePagado As Decimal, ObjFactura As Modelos.Factura) + + Dim MsgError As String = "" + Dim CveConceptoContable As Integer = 30 + Dim CveConceptoCompra As Integer = 10 + Dim CveCreditoDetalle As Integer = -1 + Dim CIF As Decimal = 0 + Dim CvePlantillaPoliza As Integer = 3 + Dim CvePrePoliza As Integer = 0 + Dim ComprobanteIE As String = "" + Dim CveIE As Integer = -1 + Dim CveTipoTransaccion As Integer = 11 + Dim FechaDoc As DateTime = Now + + Dim ConceptoContable As Integer + Dim TipoMovimiento As Boolean + Dim importeMovimiento As Decimal + Dim FechaMovimiento As Date = Now + Dim Concepto As String = "" + + Dim Importe As Decimal = ImportePagado + + Dim Msg As New StringBuilder + + Dim ObjIE As New ClsBancos() + Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) + Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) + + Try + Dim CveCuentaDeposito As Integer = 0 + 'If DdlCuentaDeposito.Items.Count > 0 Then + ' CveCuentaDeposito = DdlCuentaDeposito.SelectedValue.ToEntero + 'End If + + '*****-_- INICIA: CONFIGURACION REGISTRO -_-***** + Dim AgregaPolizaSaldoInicial As Boolean = False + + 'INGPC + CvePlantillaPoliza = 6 + If CveCliente > 0 Then + CveConceptoCompra = 66 'Anticipo doc por pagar + CveConceptoContable = 30 'Bancos + End If + + Dim FolioFijo As Integer = 0 + Dim tCveMoneda As Integer = ObjFactura.CveMoneda + Dim tImporteMonedaExtranjera As Decimal = 0 + If tCveMoneda <> 1 Then tImporteMonedaExtranjera = TxtImporte.Text.ToDecimal * GlobalTipoCambio(Now).ToString.ToDecimal + Dim PagueseA = ObjFactura.Cliente.Nombre + + If MsgError = "" Then + + CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, CveTipoTransaccion, FechaDoc, TxtFolio.Text.Trim, PagueseA, Importe, ObjFactura.CveMoneda, + TxtTipoCambio.Text.Trim.ToDouble, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePoliza, ComprobanteIE, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + CveCuentaDeposito:=CveCuentaDeposito, CveEstatusIE:=1, Referencia:="-1", CveCuentaTarjeta:=-1, ConceptoCIE:="-1") + + If CveIE > 0 Then + + If CveTipoTransaccion = 1 AndAlso UsuarioActual.CveEmpresa <> 119 Then FolioFijo = ObjIE.Folio.ToEntero 'cheque + CvePrePoliza = ObjMov.AddPrePolizas("PortalCliente/IE " + "INGPC", CvePlantillaPoliza, Importe, Importe, tCveMoneda, FechaDoc, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(CveTipoTransaccion.ToString(), Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(CveTipoTransaccion.ToString(), "-1", UsuarioActual.CveEmpresa)) + + 'valida prepoliza + If CvePrePoliza > 0 Then + + If Not ObjIE.UpdateIEPrePoliza(MinFecha, "", -1, CvePrePoliza, CveIE, -1) Then + MsgError = "Ocurrio un error al agregar la prepoliza al IE." + End If + + Dim Conc As String = ObjIE.Folio + Dim Ref As String = ObjIE.Folio + + ComprobanteIE = $"{CveIE}" + + 'GUARDA PREPOLIZAS DETALLE [PRIMERO SON LOS CASOS ESPECIALES, AL FINAL (ELSE) LOS CASOS NORMALES] --REEMPLAZA IFs + + Dim importeMX As Decimal + Dim Multiplicador As Integer + + If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then + + For Each Row As DataRow In ObjMov.DtResultados.Rows + + ConceptoContable = Row("CveConcepto").ToString.ToEntero + TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False) + importeMovimiento = 0 + Multiplicador = (Row("Multiplicador").ToString.ToEntero) + Concepto = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, PagueseA, "", ObjIE.Folio) + + Select Case ConceptoContable + Case 66 + importeMovimiento = Importe '- TxtIvaIxC.Text.ToDecimal + importeMX = importeMovimiento + Case 30 + importeMovimiento = Importe + importeMX = importeMovimiento + End Select + + If importeMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContAnticipos), -1, CveIE:=CveIE, CveCompra:=-1, CveProveedor:=-1, CvePersonal:=-1, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, ObjFactura.Cliente.CveCuentaClientes, ObjFactura.Cliente.CveCuentaAnticipos)) Then + MsgError = "Ocurrió un error al registrar el asiento del ingreso." + End If + End If + + Next + End If + + If MsgError = "" Then + If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Bancos/IE | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + Else + MsgError = "No se pudo validar la prepoliza de cuadre." + End If + End If + + 'El movimiento 1 es el de Venta + + 'Conta ContPAQ + 'If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then + ' If IDCtaBeneficiario > 0 And IDCtaContable > 0 Then + ' If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + ' IDPoliza = ObjMov.ContaIdPoliza + ' 'Alert(alertaContabilizacion & ObjMov.AlertaMensaje, ModExtensiones.TipoMensaje.MsgInformacion) + ' Else + ' Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) + ' End If + ' Else + ' If IDCtaContable < 1 Then + ' Alert("No se puede contabilizar la Prepoliza debido a que la cuenta de Bancos es invalida", TipoMensaje.MsgAdvertencia) + ' End If + ' If IDCtaBeneficiario < 1 Then + ' Alert("No se puede contabilizar la Prepoliza debido a que las cuenta del Beneficiario es invalida", TipoMensaje.MsgAdvertencia) + ' End If + ' End If + 'End If + + 'If UsuarioActual.Empresa.UsaAC Then + ' Dim ConceptoRenglon, Referencia As String + ' Dim FolioPoliza As Integer + ' Dim Fecha As Date = FechaDoc + ' Dim TipoChq As String = "" + ' Dim Total As Double = TxtImporte.Text.ToDouble + + ' Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) + ' Conta.IniciaTransacSQL() + + ' If CveTipoTransaccion = 1 Then TipoChq = "CHQ" + ' ConceptoRenglon = String.Format("Anticipo {0}", PagueseA) + + ' Dim IDPoliza = Conta.AddPoliza(2, ConceptoRenglon, Total, Total, UsuarioActual.CveUsuario, Fecha, ObjIE.Folio, TipoChq) + + ' If IDPoliza > 0 Then + ' FolioPoliza = Conta.Folio + ' Referencia = ObjIE.Folio + ' ConceptoRenglon = String.Format("Anticipo {0} {1}", PagueseA, TxtObservaciones.Text) + + ' Total = TxtImporte.Text.ToDouble + + ' If Not Conta.AddMovimiento(IDPoliza, IDCtaContable, True, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" + + ' If Not Conta.AddMovimiento(IDPoliza, IDCtaBeneficiario, False, Total, Referencia, ConceptoRenglon, 0, Fecha, "") Then MsgError = "No se insertó el movimiento" + + ' Else + ' MsgError = "No se insertó el encabezado" + ' End If + + ' If MsgError = "" Then + ' Conta.Commit() + + ' Conta.AjustaPoliza(IDPoliza) + ' 'actualizar la conta del IE + ' ObjIE.UpdateIEPrePoliza(Fecha, FolioPoliza.ToString, IDPoliza, CvePrePoliza, CveIE, 0) + ' Else + ' Conta.RollBack() + ' IDPoliza = 0 + ' End If + + ' Conta.Dispose() + 'End If + + 'Notificación de Pago + 'If TxtNotificarA.Text.Trim <> "" And MsgError = "" Then + ' 'NotificacionPago(CveIE, TxtNotificarA.Text.Trim) + ' EnviarCorreoNotificacion(CveIE, TxtNotificarA.Text.Trim, "", UsuarioActual, False) + 'End If + Else + MsgError = "No se pudo insertar la póliza" + End If + + Else + MsgError = "No se insertó el encabezado" + End If + + End If + + Catch ex As Exception + MsgError = ex.ToString() + End Try + + If MsgError = "" Then + 'IMPRIME CHEQUE + 'GeneraChequePDF(CveIE, UsuarioActual.Empresa, IDPoliza) + If Msg.ToString = "" Then + ObjIE.Commit() + Msg.Append("El Documento se guardo correctamente: Folio:" + ObjIE.Folio) + Alert(Msg.ToString(), TipoMensaje.MsgInformacion) + End If + 'Dim Archivo As System.IO.FileInfo = Nothing + ''VERIFICA SI EXISTE EL FORMATO + ''If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then + '' Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta)) + ''ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then + '' Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) + '' If Not Archivo.Exists Then + '' Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas)) + '' End If + ''ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then + '' Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero)) + ''End If + + 'If Archivo IsNot Nothing Then + ' If Archivo.Exists Then + ' Msg.AppendFormat("

    {1} ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), "Imprimir Ingre") + ' End If + 'End If + + Else + ObjIE.RollBack() + Alert(MsgError, TipoMensaje.MsgAdvertencia) + End If + + ObjIE.Dispose() + ObjMov.Dispose() + ObjComp.Dispose() + + End Sub + + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte() + Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) + Dim File As Byte() = Nothing + Try + Using httpClient = New HttpClient() + httpClient.Timeout = New TimeSpan(0, 15, 0) + Using request = New HttpRequestMessage(HttpMethod.Get, Url) + request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks))) + Dim response = httpClient.SendAsync(request).Result + If response.StatusCode = Net.HttpStatusCode.OK Then + File = response.Content.ReadAsByteArrayAsync().Result + End If + End Using + End Using + Catch ex As Exception + File = Nothing + OnError("Ocurrió un error al descargar la factura", ex) + End Try + + Return File + End Function + + Private Sub MandaMails(UsuarioActual As Usuario, CveVenta As Integer, EnviarFactura As Boolean, ObjFactura As Modelos.Factura) + + Dim ObjMail As New ClsSisMail() + Dim ObjVentas As New ClsVentas + + Dim ArchivoPDF As String = "" + Dim ArchivoPDFBytes As Byte() = Nothing + Dim ExistePDF As Boolean = False + + Try + + Dim Asunto As String = String.Empty + Dim Cuerpo As String = String.Empty + Dim ResultadoMail As Integer = 0 + + Dim TipoComprobante = "Pedido" + + If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then + Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta + Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) + Cuerpo = Cuerpo.Replace("{""NombreCliente""}", ObjFactura.Cliente.Nombre) + Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) + Cuerpo = Cuerpo.Replace("{""Fecha""}", ObjFactura.Fecha.ToString("dd/MM/yyyy")) + Cuerpo = Cuerpo.Replace("{""Total""}", ObjFactura.Total.FormatoNumero(2)) + Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", ObjFactura.FechaVencimiento.ToString("dd/MM/yyyy")) + Cuerpo = Cuerpo.Replace("{""SerieFolio""}", ObjFactura.SerieFolio) + End If + + If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then + Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta + Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) + Asunto = Asunto.Replace("{""Sucursal""}", ObjFactura.SubProyecto.SubProyecto) + Asunto = Asunto.Replace("{""SerieFolio""}", ObjFactura.SerieFolio) + End If + + If Not EnviarFactura Then + ObjVentas.UpdateVentaMail(0, CveVenta) + End If + + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + + ArchivoPDF = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) + + If Not File.Exists(ArchivoPDF) Then + ArchivoPDFBytes = DescargarFactura(ObjFactura.CveVenta, ObjFactura.CveEmpresa) + Else + ExistePDF = True + End If + + If ExistePDF Then + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = ArchivoPDF}) + Else + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ArchivoPDFBytes, .NombreArchivo = String.Format("{0}.pdf", ObjFactura.SerieFolio)}) + End If + + If ObjMail.SendMail(UsuarioActual.Empresa, ObjFactura.Cliente.Mail, Asunto, Cuerpo, "japmx95@gmail.com", LSRutasMail, Displayname:="") Then + ResultadoMail = 1 + Else + ResultadoMail = 3 + End If + ObjVentas.UpdateVentaMail(ResultadoMail, CveVenta) + + Catch ex As Exception + OnError("Ocurrió error al mandar el Mail", ex) + ObjVentas.UpdateVentaMail(3, CveVenta) + Finally + ObjVentas.Dispose() + End Try + + End Sub +#End Region + #Region "O R D E N A M I E N T O" Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) Dim Orden As String = "" @@ -1739,12 +2193,12 @@ Partial Class Ventas_PortalCliente ElseIf gvi = 1 Then CargaGridUsuarios(Orden) End If - End Sub + End Sub #End Region - + #Region "DESCARGA Todos los Archivos" - - + + Private Sub BtnDescargarPDF_Click(sender As Object, e As EventArgs) Handles BtnDescargarPDF.Click If Not Directory.Exists(AppDomain.CurrentDomain.BaseDirectory & "Temp") Then Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory & "Temp") @@ -1827,14 +2281,14 @@ Partial Class Ventas_PortalCliente 'Elimine el .zip que se genero If File.Exists(RutaArchivo) Then File.Delete(RutaArchivo) - End Sub - + End Sub + #End Region - - + + #Region "IMPRIMIR GVHistorial" - - + + Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = Nothing Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -1870,6 +2324,10 @@ Partial Class Ventas_PortalCliente End Sub + Protected Sub BtnExcelHistorialPedidos_Click(sender As Object, e As EventArgs) + GvPedidos.ExportToExcel("Pedidos") + End Sub + Protected Sub BtnPDFHistorial_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = ImprimirReporteHistorial() @@ -1913,12 +2371,12 @@ Partial Class Ventas_PortalCliente ObjClientes.Dispose() Return retorno - End Function - - + End Function + + #End Region - - + + #Region "IMPRIMIR CxC Activas" Protected Sub LbExcelCxCActivas_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = Nothing @@ -1984,13 +2442,13 @@ Partial Class Ventas_PortalCliente End If ObjMovtos.Dispose() Return retorno - End Function - + End Function + #End Region - - + + #Region "IMPRIMIR CxCHistorial" - + Protected Sub LbExcelCxCHistorial_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = Nothing Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -2055,34 +2513,34 @@ Partial Class Ventas_PortalCliente End If ObjMovtos.Dispose() Return retorno - End Function - + End Function + #End Region - - 'Protected Sub BtnCxPActivas_Click(sender As Object, e As EventArgs) - ' If BtnCxPActivas.Text = "Ver Más " Then - ' BtnCxPActivas.Text = "Ver Menos " - ' CargaCxP() - ' Else - ' BtnCxPActivas.Text = "Ver Más " - ' CargaCxP(1) - ' End If - 'End Sub - - 'Protected Sub BtnHistorialCxP_Click(sender As Object, e As EventArgs) - ' If BtnHistorialCxP.Text = "Ver Más " Then - ' BtnHistorialCxP.Text = "Ver Menos " - ' CargaCxP(2) - ' Else - ' BtnHistorialCxP.Text = "Ver Más " - ' CargaCxP(2) - ' End If - 'End Sub - + + 'Protected Sub BtnCxPActivas_Click(sender As Object, e As EventArgs) + ' If BtnCxPActivas.Text = "Ver Más " Then + ' BtnCxPActivas.Text = "Ver Menos " + ' CargaCxP() + ' Else + ' BtnCxPActivas.Text = "Ver Más " + ' CargaCxP(1) + ' End If + 'End Sub + + 'Protected Sub BtnHistorialCxP_Click(sender As Object, e As EventArgs) + ' If BtnHistorialCxP.Text = "Ver Más " Then + ' BtnHistorialCxP.Text = "Ver Menos " + ' CargaCxP(2) + ' Else + ' BtnHistorialCxP.Text = "Ver Más " + ' CargaCxP(2) + ' End If + 'End Sub + #Region "TAB PEDIDO" - + #Region "CARGAS" - + Private Sub CargaFolios() If CveSubProyecto <= 0 Then @@ -2280,11 +2738,11 @@ Partial Class Ventas_PortalCliente TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) - End Sub - - + End Sub + + #End Region - + #Region "SELECTED INDEX CHANGE" Protected Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As EventArgs) TrConversionTipoCambio.Visible = False @@ -2364,13 +2822,15 @@ Partial Class Ventas_PortalCliente Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS) UpClasificacion.Update() - End Sub - + End Sub + #End Region - + #Region "AGREGAR/EDITAR/ELIMINAR" - Protected Sub LnkAddVenta_Click(sender As Object, e As EventArgs) - + Protected Sub LnkAddPedido_Click(sender As Object, e As EventArgs) + RegistraScript("$('#DivVenta').modal({backdrop: 'static',keyboard: false});") + End Sub + Protected Sub LnkAddPSVenta_Click(sender As Object, e As EventArgs) Modalidad = "A" LnkAgregar.Text = "Agregar" TxtCantidad.Text = "" @@ -2386,9 +2846,9 @@ Partial Class Ventas_PortalCliente DdlClasificacion.SelectedIndex = -1 DdlUM.Items.Clear() ChkAgregar.Checked = True - UpVenta.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta")) + UpAddPedido.Update() + RegistraScript("$('#DivAddVenta').modal({backdrop: 'static',keyboard: false});") End Sub Protected Sub LnkEditar_Click(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) @@ -2411,17 +2871,22 @@ Partial Class Ventas_PortalCliente TxtPrecio.Text = GvRow.DataKey("PU") LblTotal.Text = GvRow.DataKey("Total") ChkAgregar.Checked = False - UpVenta.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta") + UpAddPedido.Update() + + RegistraScript("$('#DivAddVenta').modal('show');", "EdicionVenta") End Sub Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim DbRow As DataRow = Nothing + DbRow = TmpDT.Rows(GvRow.RowIndex) TmpDT.Rows.Remove(DbRow) + GvPS.DataSource = TmpDT GvPS.DataBind() + CalculaTotalesVenta() + Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion) End Sub @@ -2442,22 +2907,15 @@ Partial Class Ventas_PortalCliente End If DdlClasificacion.SelectedIndex = -1 DdlUM.Items.Clear() - UpVenta.Update() Else RegistraScript("ClosePopup();", "AddUpdatePS") - End If + End If + + UpAddPedido.Update() End Sub Private Sub AgregarPS() - If Modalidad = "A" Then - AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUM.SelectedValue.ToEntero, DdlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, - DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, TxtObs.Text, TxtPrecio.Text.ToDecimal, 0, -1, "", CveSubProyecto, "") - - CalculaTotalesVenta() - - - - ElseIf Modalidad = "U" Then + If Modalidad = "U" Then Dim ErrorEdit As Boolean = True Dim Contador As Integer = 0 @@ -2475,7 +2933,12 @@ Partial Class Ventas_PortalCliente TmpDT.Rows.RemoveAt(Contador) TmpDT.AcceptChanges() End If - End If + End If + + AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUM.SelectedValue.ToEntero, DdlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, + DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, TxtObs.Text, TxtPrecio.Text.ToDecimal, 0, -1, "", CveSubProyecto, "") + + CalculaTotalesVenta() End Sub @@ -2616,13 +3079,13 @@ Partial Class Ventas_PortalCliente GvPS.DataSource = view GvPS.DataBind() - UpTabPedidos.Update() - End Sub - + UpAddPedido.Update() + End Sub + #End Region - + #Region "GUARDAR VENTA" - + Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False) ObjFactura = New Modelos.Factura ObjFactura.Version = "3.3" @@ -2911,6 +3374,10 @@ Partial Class Ventas_PortalCliente ViewState("CveVenta") = ObjFactura.CveVenta + If ObjFactura.CveVenta > 0 Then + EnviarCorreoPedido(ObjFactura) + End If + 'MENSAJE PRINCIPAL MensajeAlert.AppendFormat(String.Format("
    El {0}: {1} se generó correctamente.

    ", ObjFactura.TipoDocumento, ObjFactura.SerieFolio)) @@ -2970,6 +3437,10 @@ Partial Class Ventas_PortalCliente End If End Sub + Private Sub EnviarCorreoPedido(ObjFactura As Modelos.Factura) + Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, ObjFactura.CveVenta, True, ObjFactura, "")) + Hilo.Start() + End Sub Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing) @@ -3067,11 +3538,12 @@ Partial Class Ventas_PortalCliente TxtObs.Text = "" CalculaTotalesVenta() UpTabPedidos.Update() - End Sub - + End Sub + #End Region - -#End Region - - + +#End Region + + End Class + diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index d537bc6bb..71897ac72 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -7028,8 +7028,6 @@ } - +