diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx b/Acumuladores/RepEntradasUsadosClientes.aspx index f1fe85c14..a2dd036e1 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx +++ b/Acumuladores/RepEntradasUsadosClientes.aspx @@ -78,7 +78,7 @@ + ToolTip="Listado de Movimientos" DataKeyNames="EsDistribuidor,Codigo,Codigo_Clientes,Total,CveCliente,NombreComercial,CvePS" CssClass="Widthall table table-striped table-hover ScrollAD" GridLines="None"> diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx.vb b/Acumuladores/RepEntradasUsadosClientes.aspx.vb index e23ddf41d..e83cfdea4 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx.vb +++ b/Acumuladores/RepEntradasUsadosClientes.aspx.vb @@ -95,8 +95,9 @@ Partial Class Acumuladores_RepEntradasUsadosClientes LbCliente.Text = renglon.DataKey("NombreComercial") LbTam.Text = renglon.DataKey("Codigo_Clientes") + Dim CveAlmacen As Integer = -1 Dim ObjAcum As New ClsAcumuladores - If ObjAcum.GetUsadosClasificacionVentas(renglon.DataKey("CveCliente"), renglon.DataKey("Codigo_Clientes"), TxtFechaI.Text, TxtFechaF.Text) Then + If ObjAcum.EntradasUsadosClientesDetalleRep(renglon.DataKey("EsDistribuidor"), renglon.DataKey("CveCliente"), renglon.DataKey("CvePS"), TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate, CveAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then GvVentas.DataSource = ObjAcum.DtResultados End If ObjAcum.Dispose() diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 3720d4918..75fc8ce98 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -1011,6 +1011,35 @@ Public Class ClsAcumuladores Return Retorno End Function + Public Function EntradasUsadosClientesDetalleRep(EsDistribuidor As Boolean, CveCliente As Integer, CvePS As Integer, FechaInicio As Date, FechaFin As Date, CveAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + 'Data = New DataTable + + SqlDataAdapter("PA_Acum_EntradasUsadosClientesDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EsDistribuidor", SqlDbType.Bit).Value = If(EsDistribuidor, 1, 0) + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + + OnError("Ocurrió un error al consultar los movimientos. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + End Try + + Return Retorno + End Function + Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProeycto As Integer, CveEmpresa As Integer) As Boolean @@ -1039,15 +1068,15 @@ Public Class ClsAcumuladores Return Retorno End Function - Public Function GetUsadosClasificacionVentas(CveCliente As Integer, Codigo As String, FechaInicio As String, FechaFin As String) As Boolean + Public Function GetUsadosClasificacionVentas(CveCliente As Integer, CvePS As Integer, FechaInicio As String, FechaFin As String) As Boolean Dim Retorno As Boolean = False - SqlDataAdapter("PA_Acum_UsadosClasificacionVentas") - + SqlDataAdapter("PA_Acum_UsadosClasificacionVentas") + With SqlAdapter.SelectCommand.Parameters .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.Date).Value = FechaFin End With diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 4dbde281c..d125b8e70 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -245,7 +245,7 @@ Public Class ClsBancos - Public Function ExisteConeccion() As Boolean + Public Function ExisteConexion() As Boolean If SqlTransacc.Connection Is Nothing Then Return False diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 8a0552af2..fc4d4beab 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1732,13 +1732,14 @@ Public Class ClsPaginas Application("GlobalDTSeccionAlmacen") = value End Set End Property - Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1) As DataTable + Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1, Optional CveEstatus As Integer = 1) As DataTable Get If CveEmpresa <> -1 Then Dim Str As New StringBuilder Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) + If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacen"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) GlobalDTAlmacen = Dv.ToTable @@ -1752,12 +1753,13 @@ Public Class ClsPaginas Application("GlobalDTAlmacen") = value End Set End Property - Property GlobalDTAlmacenUsuarios(CveUsuario As Integer, CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = 1) As DataTable + Property GlobalDTAlmacenUsuarios(CveUsuario As Integer, CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = 1, Optional CveEstatus As Integer = 1) As DataTable Get If CveEmpresa <> -1 Then Dim Str As New StringBuilder Str.AppendFormat("CveUsuario = {0} AND CveEmpresa = {1} ", CveUsuario, CveEmpresa) If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) + If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacenUsuarios"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) GlobalDTAlmacenUsuarios = Dv.ToTable diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index b261ef977..833d6b4c2 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -499,6 +499,15 @@ Namespace Modelos If ObjVentas.GetVentasAntNC(-1, CveVenta, AplicaAmortizacion:=EsNCAmortizacion) Then Me.DtAnticipos = ObjVentas.DtResultados.Copy() End If + + If (DtAnticipos Is Nothing OrElse DtAnticipos.Rows.Count = 0) Then + 'SI ES EGRESO Y TIENE ANTICIPOS VINCULADOS + If TipoDocto.Contiene("Egs") AndAlso EsNCAmortizacion AndAlso EsCancelacion Then + If ObjVentas.GetVentasAntNC(CveVenta, -1, AplicaAmortizacion:=EsNCAmortizacion) Then + Me.DtAnticipos = ObjVentas.DtResultados.Copy() + End If + End If + End If End If End If @@ -2484,6 +2493,12 @@ Namespace Modelos CveVentaAmortizacion = ObjFactura.CveVenta End If + 'SI ES EGRESO Y TIENE ANTICIPOS VINCULADOS + If (ObjFactura.TipoDocto.Contiene("Egs") AndAlso row2("TipoDocto").ToString() = "Ant" AndAlso EsNCAmortizacion) Then + CveVenta = row2("CveVenta").ToString().ToEntero + CveVentaAmortizacion = ObjFactura.CveVenta + End If + If importeMovimiento <> 0 Then If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveVentaAmortizacion:=CveVentaAmortizacion, CveCliente:=ObjFactura.CveCliente, @@ -2505,9 +2520,9 @@ Namespace Modelos ' cuando es amortización de nota de crédito, y es la nc ' cuando es amortización por descuento, y es el ingreso ' cuando es amortización en cero - If ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse + If (ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse ObjFactura.CveTipoAmortizacionAnticipo = 1 AndAlso ObjFactura.TipoDocto.Contiene("Ing") OrElse - ObjFactura.CveTipoAmortizacionAnticipo = 3 Then + ObjFactura.CveTipoAmortizacionAnticipo = 3) Then For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows If row2("CveConceptoContable").ToString().ToEntero = 11 Then CveIEAnticipo = -1 @@ -5316,6 +5331,7 @@ Namespace Modelos Public Property DtContratosSerieDetalle As Data.DataTable Public Property DtOtrosConceptos As Data.DataTable Public Property DtInventario As Data.DataTable + 'Public Property DtAnticipoAmortizacion As Data.DataTable Public Property DtRemConceptosSurtidos As Data.DataTable Public Property UsadosBonificacion As List(Of Integer) Public Property TipoBonificacion As Integer = 0 diff --git a/Ashx/SIGGPS.ashx b/Ashx/SIGGPS.ashx index a58642f67..600e75669 100644 --- a/Ashx/SIGGPS.ashx +++ b/Ashx/SIGGPS.ashx @@ -231,40 +231,43 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState #Region "N O T F I C A C I O N - T R A Y E C T O S" Private Sub EnviarCorreoTrayectos(ByVal context As HttpContext, CveTrayecto As Integer) Dim Retorno As JObject = New JObject(New JProperty("EnvioCorreo", False), New JProperty("Mensaje", "")) + Try + Dim DtInfoTrayecto As DataTable = Nothing + Dim DtTrayecto As DataTable = Nothing - Dim DtInfoTrayecto As DataTable = Nothing - Dim DtTrayecto As DataTable = Nothing + Using ObjGPS As New ClsGPS + If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then + DtTrayecto = ObjGPS.DtResultados.Copy() + End If + + If ObjGPS.GetTrayectosDatos(CveTrayecto) Then + DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy() + End If + End Using + + If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then + Dim RowTrayecto As DataRow = DtTrayecto.Rows(0) + Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0) + + Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString()) + + Dim Asunto As String = "Estatus de Trayecto" + Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo) + Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString() + + Dim ObjMail As New ClsSisMail + If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then + Retorno("EnvioCorreo") = True + Retorno("Mensaje") = "El correo fue enviado correctamente" + Else + Retorno("EnvioCorreo") = False + Retorno("Mensaje") = "Ocurrió un error al enviar el correo" + End If - Using ObjGPS As New ClsGPS - If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then - DtTrayecto = ObjGPS.DtResultados.Copy() End If - - If ObjGPS.GetTrayectosDatos(CveTrayecto) Then - DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy() - End If - End Using - - If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then - Dim RowTrayecto As DataRow = DtTrayecto.Rows(0) - Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0) - - Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString()) - - Dim Asunto As String = "Estatus de Trayecto" - Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo) - Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString() - - Dim ObjMail As New ClsSisMail - If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then - Retorno("EnvioCorreo") = True - Retorno("Mensaje") = "El correo fue enviado correctamente" - Else - Retorno("EnvioCorreo") = False - Retorno("Mensaje") = "Ocurrió un error al enviar el correo" - End If - - End If + Catch ex As Exception + OnError("Ocurrió un error al enviar el correo", ex) + End Try context.Response.Write(Retorno.ToString()) End Sub diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index e56e4f732..6699f469a 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4808,7 +4808,7 @@ Partial Class Bancos_IE If ObjAC IsNot Nothing Then ObjAC.Commit() - If Banc.ExisteConeccion Then + If Banc.ExisteConexion Then Banc.Commit() Alert("El documento bancario quedó eliminado.", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") End If @@ -4819,7 +4819,7 @@ Partial Class Bancos_IE If ObjAC IsNot Nothing Then ObjAC.RollBack() - If Banc.ExisteConeccion Then + If Banc.ExisteConexion Then Banc.RollBack() diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 5558e5e69..c8104569b 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2758,11 +2758,11 @@ Partial Class Compras_Compras 'ImgAmort.Attributes.Clear() LbAgregar.Enabled = False TxtSerie.Enabled = False - TxtFolio.Enabled = False - - TxtFecha.Enabled = False - ImgFecha.Enabled = False - CEFecha.Enabled = False + TxtFolio.Enabled = False + + TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + CEFecha.Enabled = UsuarioActual.TienePermisoProceso(216) DdlProveedor.Enabled = False DdlProveedorSucursal.Enabled = False diff --git a/GPS/Trayectos.aspx b/GPS/Trayectos.aspx index 0d42e5047..087839253 100644 --- a/GPS/Trayectos.aspx +++ b/GPS/Trayectos.aspx @@ -159,7 +159,7 @@ - + diff --git a/GPS/Trayectos.aspx.vb b/GPS/Trayectos.aspx.vb index ac950d613..8e0b5654e 100644 --- a/GPS/Trayectos.aspx.vb +++ b/GPS/Trayectos.aspx.vb @@ -295,7 +295,9 @@ Partial Class GPS_Trayectos ElseIf e.Row.DBCampo("EsInicio") = "False" AndAlso e.Row.DBCampo("EsFin") = "False" Then e.Row.FCLabel("LblEstatus").CssClass = "badge badge-secondary" End If - + If CBool(e.Row.DBCampo("EnviarNotificacion")) Then + e.Row.FCLinkButton("LnkEnviar").Visible = True + End If End If End Sub Protected Sub DdlTrayecto_SelectedIndexChanged(sender As Object, e As EventArgs) @@ -415,7 +417,7 @@ Partial Class GPS_Trayectos Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero() If CveTrayecto > 0 Then - Dim Url = New Uri(String.Format("{0}/ashx/SIGGPS.ashx?metodo=EjecutaTrayectos&CveTrayecto={1}", "https://gps.signalsgps.com", CveTrayecto)) + Dim Url = New Uri(String.Format("{0}/ashx/SIGGPS.ashx?metodo=EjecutaTrayectos&CveTrayecto={1}", "http://gps.signalsgps.com", CveTrayecto)) Dim Retorno As String = "{}" Try Using httpClient = New HttpClient() @@ -435,8 +437,10 @@ Partial Class GPS_Trayectos Alert(Resp("Mensaje").ToString(), TipoMensaje.MsgError) End If Catch ex As Exception - OnError("Ocurrió un error al descargar la factura", ex) + OnError("Ocurrió un error al enviar el correo", ex) End Try + Else + Alert("No se pudo identificar el trayecto", TipoMensaje.MsgError) End If End Sub End Class diff --git a/Inventarios/RepOcInv.aspx b/Inventarios/RepOcInv.aspx index 7a164ccae..b3e143a13 100644 --- a/Inventarios/RepOcInv.aspx +++ b/Inventarios/RepOcInv.aspx @@ -40,7 +40,7 @@
Proveedor
- +
<%--
Folio
diff --git a/Inventarios/RepOcInv.aspx.vb b/Inventarios/RepOcInv.aspx.vb index d128a943f..8dabef84e 100644 --- a/Inventarios/RepOcInv.aspx.vb +++ b/Inventarios/RepOcInv.aspx.vb @@ -39,9 +39,13 @@ Partial Class Inventarios_RepOcInv TxtFechaI.Text = Now.AddMonths(-1).ToShortDateString 'Llenar dropdownlist de proveedores - DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedor.DataBind() - DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) + DdlProveedor.setEsWebService(True) + DdlProveedor.Attributes.Add("data-metodo", "getproveedores") + DdlProveedor.SelectedText = "Todos" + DdlProveedor.SelectedValue = "-1" + 'DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + 'DdlProveedor.DataBind() + 'DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) DdlSubProyecto.DataBind() @@ -100,7 +104,7 @@ Partial Class Inventarios_RepOcInv Private Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click If DtOCXSurtir IsNot Nothing Then Dim StrFiltro As New StringBuilder - If DdlProveedor.SelectedValue <> "-1" Then StrFiltro.AppendFormat("Proveedor: {0}", DdlProveedor.SelectedItem.Text) + If DdlProveedor.SelectedValue <> "-1" Then StrFiltro.AppendFormat("Proveedor: {0}", DdlProveedor.SelectedText) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) diff --git a/Ventas/RepVentas.aspx.vb b/Ventas/RepVentas.aspx.vb index 56346f6fd..922b121b0 100644 --- a/Ventas/RepVentas.aspx.vb +++ b/Ventas/RepVentas.aspx.vb @@ -355,7 +355,7 @@ Partial Class Ventas_RepVentas Protected Sub DdlTipoComprobante_SelectedIndexChanged(sender As Object, e As EventArgs) DdlEstatus.Items.Clear() If DdlTipoComprobante.GetSelectedValuesM <> "" Then - DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(String.Format("TipoDocto IN ({0}) OR ('Cot' IN ({0}) AND CveEstatusFactura = 2)", DdlTipoComprobante.GetSelectedValuesM(True))) + DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(String.Format("TipoDocto IN ({0}) OR ('Cot' IN ({0}) AND CveEstatusFactura = 2)", DdlTipoComprobante.GetSelectedValuesM(True).Replace("Ant", "Ing"))) Else DdlEstatus.DataSource = GlobalDTEstatusFactura End If diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 42dcf3995..4efe66eda 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1184,6 +1184,22 @@ Partial Class Ventas ViewState("PermiteCredito") = value End Set End Property + Private Property DtAnticipoAmortizacion As DataTable + Get + Return CType(ViewState("DtAnticipoAmortizacion"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtAnticipoAmortizacion") = value + End Set + End Property + Private Property SaldoAnticipo As Decimal + Get + Return If(IsNothing(ViewState("SaldoAnticipo")), 0, ViewState("SaldoAnticipo").ToString().ToDecimal()) + End Get + Set(value As Decimal) + ViewState("SaldoAnticipo") = value + End Set + End Property #End Region @@ -3699,7 +3715,14 @@ Partial Class Ventas LblNCSaldoAnticipo.Visible = True ChkAplicaNCAnticipo.Visible = True ChkAplicaNCAnticipo.Checked = True - If DbRowVenta("SaldoAnticipo").ToString.ToDouble <= 0 Then ChkAplicaNCAnticipo.Checked = False : ChkAplicaNCAnticipo.Enabled = False + Me.SaldoAnticipo = DbRowVenta("SaldoAnticipo").ToString.ToDecimal + If SaldoAnticipo > 0 Then + InicializaDTAnticiposAmortizacion() + ChkAplicaNCAnticipo.Enabled = False + Else + ChkAplicaNCAnticipo.Checked = False + End If + 'If DbRowVenta("SaldoAnticipo").ToString.ToDouble <= 0 Then ChkAplicaNCAnticipo.Checked = False : ChkAplicaNCAnticipo.Enabled = False LblNCSaldoAnticipo.Text = String.Format("Saldo Anticipo: $ {0}", DbRowVenta("SaldoAnticipo").ToString.ToDouble.FormatoNumero) Case "Dev" DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev")) @@ -4214,7 +4237,7 @@ Partial Class Ventas DdlUsoCFDI.Enabled = False DdlMetodoPago33.Enabled = False 'TxtNumCtaPago.Enabled = False - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") Then TxtFechaPago.ReadOnly = Not UsuarioActual.TienePermisoProceso(260) LnkUpdateFechaVencimiento.Visible = UsuarioActual.TienePermisoProceso(260) Else @@ -6581,7 +6604,7 @@ Partial Class Ventas EsValidoPU = False ' SI NO TIENE PROMOCION NO SE PUEDE VENDER A 0 End If End If - + EsValido = True 'NO DEJA REGISTRAR CON VALIDACION DE COSTO ALMACEN O PROMOCION Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) If Not EsValido Then @@ -9320,7 +9343,7 @@ Partial Class Ventas Next End If - Dim CveTipoRetencion As Integer = -1 + Dim CveTipoRetencion As Integer = 0 If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero() End If @@ -10193,6 +10216,31 @@ Partial Class Ventas Next End If + 'CUANDO APLICAN UNA NOTA DE CREDITO SOBRE UN ANTICIPO + If ObjFactura.TipoDocto = "Egs" AndAlso EsNCAmortizacion Then + If DtAnticipoAmortizacion IsNot Nothing AndAlso DtAnticipoAmortizacion.Rows.Count > 0 Then + For Each RowAnticipo As DataRow In DtAnticipoAmortizacion.Rows + Dim CveVentaAnticipo As Integer = RowAnticipo("CveVenta").ToString().ToEntero + importeMovimiento = RowAnticipo("SaldoAnticipo").ToString().ToDecimal + If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + + IdCtaContable = IdCtaContAnticipos + CveCuenta = CveCuentaAnticipos + CveSubProyectoContabilizar = CveSubProyectoVenta + + If importeMovimiento <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + ErrorPrepoliza = True + Exit For + Else + ViewState("SeGuardoPrePoliza") = True + End If + End If + Next + + End If + End If + 'cuando es anticipo ' cuando es amortización de nota de crédito, y es la nc ' cuando es amortización por descuento, y es el ingreso @@ -21440,12 +21488,12 @@ Partial Class Ventas End If DdlTipoComprobante.SelectedValue = "Egs" - AplicarNC(DdlNCPS.SelectedValue.ToEntero) + AplicarNC(DdlNCPS.SelectedValue.ToEntero, EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked) RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") End Sub - Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False) + Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False) Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DrPS Is Nothing Then Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) @@ -21461,6 +21509,7 @@ Partial Class Ventas Exit Sub End If End If + 'CREAMOS DT PARA UTILIZAR AL TIMBRAR InicializaDTVentasNC() @@ -21497,6 +21546,21 @@ Partial Class Ventas End If Else DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal) + + If EsNCAmortizacion Then + If DtAnticipoAmortizacion Is Nothing Then + InicializaDTAnticiposAmortizacion() + End If + Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D) + + Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow + RowAnticipo("CveVenta") = Me.CveVenta + RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal + RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado + + DtAnticipoAmortizacion.Rows.Add(RowAnticipo) + End If + End If Dim query = From dr In DtImpuestos @@ -21834,7 +21898,12 @@ Partial Class Ventas BloqueaCondiconesPago() End Sub - + Private Sub InicializaDTAnticiposAmortizacion() + Me.DtAnticipoAmortizacion = New DataTable + Me.DtAnticipoAmortizacion.Columns.Add("CveVenta", GetType(Integer)) + Me.DtAnticipoAmortizacion.Columns.Add("Importe", GetType(Decimal)) + Me.DtAnticipoAmortizacion.Columns.Add("SaldoAnticipo", GetType(Decimal)) + End Sub Private Sub InicializaDTVentasNC() DtVentasNC = New DataTable DtVentasNC.Columns.Add("CveVenta", GetType(Integer))