diff --git a/.gitignore b/.gitignore index c1c000c04..87f32d266 100644 --- a/.gitignore +++ b/.gitignore @@ -288,3 +288,5 @@ vwd.webinfo /A/a.aspx /A/a.aspx.vb /General/Report.rdlc +/TmpPruebas.aspx +/TmpPruebas.aspx.vb diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index 3fb0c1389..08a417153 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -30,6 +30,7 @@ Public Class ClsOC Public Property CveOrdenCompra As Integer Public Property CveOrdenCompraDetalle As Integer Public Property Folio As Integer + Public Property Serie As String = "" Public Property CveIEAnticipo As Integer Public Property CveProveedorAnticipo As Integer Public Property FolioIEAnticipo As Integer @@ -120,6 +121,8 @@ Public Class ClsOC Public Property Promocion As String Public Property CveProveedorContacto As Integer Public Property NumRemision As String + Public Property PorcentajeProntoPago As Decimal = 0 + Public ReadOnly Property DtResultados() As DataTable Get @@ -606,6 +609,7 @@ Public Class ClsOC Dim dr As DataRow = Data.Rows(0) _CveOrdenCompra = dr("CveOrdenCompra").ToString.ToEntero _Folio = dr("Folio").ToString.ToEntero + _Serie = dr("Serie").ToString _CveIEAnticipo = dr("CveIEAnticipo").ToString.ToEntero _FolioIEAnticipo = dr("FolioIEAnticipo").ToString.ToEntero _ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDecimal @@ -688,6 +692,7 @@ Public Class ClsOC Promocion = IfNull(dr("Promocion"), "", dr("Promocion").ToString).ToString CveProveedorContacto = If(Not IsDBNull(dr("CveProveedorContacto")), dr("CveProveedorContacto").ToString.ToEntero, -1) NumRemision = dr("NumRemision").ToString + PorcentajeProntoPago = dr("PorcentajeProntoPago").ToString.ToDecimal Retorno = True ElseIf Data.Rows.Count > 0 Then @@ -708,7 +713,7 @@ Public Class ClsOC Optional PorcentajeIVA As Decimal = 0.16D, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional FechaExpiracion As Date = Nothing, Optional CveCotizacion As Integer = -1, Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Decimal = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1, Optional NumRemision As String = "-1", - Optional CveColectiva As Integer = -1, Optional MetodoPago As Integer = -1, Optional CveSubProyectoEntrega As Integer = -1) As Boolean + Optional CveColectiva As Integer = -1, Optional MetodoPago As Integer = -1, Optional CveSubProyectoEntrega As Integer = -1, Optional PorcentajeProntoPago As Decimal = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OC_OrdenesCompraAdd") @@ -755,6 +760,7 @@ Public Class ClsOC .Add("@CveColectiva", SqlDbType.Int).Value = CveColectiva .Add("@MetodoPago", SqlDbType.Int).Value = MetodoPago ' 0 Contado, 1 Credito .Add("@CveSubProyectoEntrega", SqlDbType.Int).Value = CveSubProyectoEntrega ' 0 Contado, 1 Credito + .Add("@PorcentajeProntoPago", SqlDbType.Decimal).Value = PorcentajeProntoPago .Add("@vCveOrdenCompra", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output @@ -919,7 +925,7 @@ Public Class ClsOC Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional IDPoliza As Integer = -1, Optional FechaExpiracion As Date = Nothing, Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Decimal = 0.16D, Optional NumRemision As String = "-1", Optional MetodoPago As Integer = -1, - Optional CveSubProyectoEntrega As Integer = -1) As Boolean + Optional CveSubProyectoEntrega As Integer = -1, Optional PorcentajeProntoPago As Decimal = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OC_OrdenesCompraUpdate") @@ -956,6 +962,8 @@ Public Class ClsOC .Add("@NumRemision", SqlDbType.VarChar).Value = NumRemision .Add("@MetodoPago", SqlDbType.Int).Value = MetodoPago ' 0 Contado, 1 Credito .Add("@CveSubProyectoEntrega", SqlDbType.Int).Value = CveSubProyectoEntrega + .Add("@PorcentajeProntoPago", SqlDbType.Decimal).Value = PorcentajeProntoPago + End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 5bc558e69..c5f809bda 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -7845,7 +7845,10 @@ Public Class ClsPaginas params.Add(New ReportParameter("Proyecto", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("Proyecto").ToString, ""))) End If params.Add(New ReportParameter("CentroCostos", If(DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0, DtDetalle.MAX("Proyecto").ToString, ""))) - params.Add(New ReportParameter("Folio", ObjOC.Folio.ToString)) + + + params.Add(New ReportParameter("Folio", If(ObjOC.Serie.Length > 0, $"{ObjOC.Serie}-{ObjOC.Folio.ToString}", ObjOC.Folio.ToString))) + params.Add(New ReportParameter("ProveedorNombre", ObjOC.RazonSocial)) params.Add(New ReportParameter("ProveedorLugar", ObjOC.LugarEntrega)) params.Add(New ReportParameter("Estatus", ObjOC.Estatus)) diff --git a/App_Code/ClsValidaCFDi.vb b/App_Code/ClsValidaCFDi.vb index c2e19cc0c..35248b76d 100644 --- a/App_Code/ClsValidaCFDi.vb +++ b/App_Code/ClsValidaCFDi.vb @@ -97,18 +97,24 @@ Public Class ClsValidaCFDi oAcuse = wsConsultaCFDI.Consulta(String.Format("?re={0}&rr={1}&tt={2}&id={3}", LRFCEmisor, LRFCReceptor, Importe, LFolioFiscal.ToUpper)) 'oAcuse = wsConsultaCFDI.Consulta("?re=LESA6211234B2&rr=GCO890418M56&tt=0000001360.000000&id=0C8BAD9C-A8C6-4A48-8FF5-0687AC6F1581") 'Alert(oAcuse.Estado) - If oAcuse.Estado.ToLower = "vigente" Then - EsValida = 1 - End If - If oAcuse.Estado.ToLower = "cancelado" Then - EsValida = 2 - End If - If oAcuse.ValidacionEFOS = "100" Then - EnListaEFOS = True + If oAcuse IsNot Nothing AndAlso oAcuse.Estado IsNot Nothing AndAlso oAcuse.ValidacionEFOS IsNot Nothing Then + If oAcuse.Estado.ToLower = "vigente" Then + EsValida = 1 + End If + If oAcuse.Estado.ToLower = "cancelado" Then + EsValida = 2 + End If + + If oAcuse.ValidacionEFOS = "100" Then + EnListaEFOS = True + Else + EnListaEFOS = False + End If Else - EnListaEFOS = False + EsValida = 0 End If + Catch ex As Exception MsgError = "Op1. No se pudo validar la vigencia ante el SAT " GuardaLog(String.Format("Op1. {0}", ex.Message)) @@ -122,7 +128,7 @@ Public Class ClsValidaCFDi Dim Vigencia As Timbrado.AcuseCancelacionSAT = Timbrado.VerificarVigenciaSAT(LFolioFiscal.ToUpper, LRFCEmisor.Replace("%26", "&"), LRFCReceptor.Replace("%26", "&"), Importe, True) - If Vigencia IsNot Nothing Then + If Vigencia IsNot Nothing AndAlso Vigencia.Estado IsNot Nothing AndAlso Vigencia.EsCancelable IsNot Nothing AndAlso Vigencia.EstatusCancelacion IsNot Nothing Then If Not Vigencia.Estado.ToUpper().Contains("NO ENCONTRADO") AndAlso Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then EsValida = 1 End If diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 2732e461b..abc48596e 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5221,7 +5221,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function AutorizacionLimitesUpdate(CveAutorizacion As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer) As Boolean + Public Function AutorizacionLimitesUpdate(CveAutorizacion As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuarioAutorizo As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_AutorizacionLimitesUpdate", CommandType.StoredProcedure) @@ -5233,7 +5233,7 @@ Public Class ClsVentas .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor .Add("@Importe", SqlDbType.Money).Value = Importe .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - + .Add("@CveUsuarioAutorizo", SqlDbType.Int).Value = CveUsuarioAutorizo End With Try diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index ace453f1d..579856c52 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -452,6 +452,7 @@ Namespace Modelos Dim ObjVentas As New ClsVentas() If ObjVentas.GetVenta(CveVenta, CveEmpresa, VerificaAlmacen:=VerificaAlmacen) Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + setValues(ObjVentas.DtResultados.Rows(0)) SetMetodoPago() SetMoneda() @@ -466,26 +467,33 @@ Namespace Modelos Else Me.VentaDesglosaIEPS = True End If + SetTotales(ObjVentas.DtResultados, ObjVentas) + If CargaDTDetalle Then If ObjVentas.GetVentaDetalle(CveVenta) Then Me.DtDetalle = ObjVentas.DtResultados.Copy() End If End If + + If CargaDatosCliente Then SetCliente() + + If CargaDatosRelacionados Then IniciaValoresVentas(EsCancelacion) + + If String.IsNullOrEmpty(DirectorioServidor) Then DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas + + Me.DirectorioServidor = DirectorioServidor + Timbre = New CFDITimbre End If Else + Me.CveVenta = -1 + Me.CveEmpresa = -1 + Me.CveCliente = -1 + ErrorList.Add("No se pudo cargar la información de la factura.") End If + ObjVentas.Dispose() - - If CargaDatosCliente Then SetCliente() - - If CargaDatosRelacionados Then IniciaValoresVentas(EsCancelacion) - - If String.IsNullOrEmpty(DirectorioServidor) Then DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas - - Me.DirectorioServidor = DirectorioServidor - Timbre = New CFDITimbre End Sub Private Sub SetTotales(dtVentas As DataTable, ObjVentas As ClsVentas) Dim TmpDTImpuestos As New DataTable @@ -6329,95 +6337,96 @@ Namespace Modelos 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN ORGINAL (GENERAL,SIN COSTO) If Not ErrorCancelar AndAlso DtDevoluciones IsNot Nothing AndAlso DtDevoluciones.Rows.Count > 0 Then For Each CveRemision As Integer In ListaRemisionesCancelar - Dim ObjRemision As New Factura(UsuarioActual, CveRemision, UsuarioActual.CveEmpresa) + Dim ObjRemision As New Factura(UsuarioActual, CveRemision, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) - If ObjRemision IsNot Nothing AndAlso ObjRemision.SaldoAlmacen <> 0 Then + If ObjRemision IsNot Nothing AndAlso ObjRemision.CveVenta > 0 Then - Dim SaldoAlmacenExA As Decimal = 0 - Dim SaldoAlmacenUsados As Decimal = 0 - Dim DtSaldosAlmacenRemision As DataTable = Nothing - 'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO - If Not ErrorCancelar Then - If ObjInventario.GetSaldoVentaDetalleAlmacen(ObjRemision.CveVenta, UsuarioActual.CveEmpresa) Then - DtSaldosAlmacenRemision = ObjInventario.DtResultados.Copy() - Else - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los saldos de devolución. Por favor vuelva a intentar." - End If - End If - - - Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") - - Dim DtDevMovs As DataTable = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveRemision", "CveAlmacen", "CveAlmacenDestino"}) - - For Each RowDevolucion As DataRow In DtDevMovs.Rows - CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() - CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() - - If CveAlmacen > 0 AndAlso DtSaldosAlmacenRemision IsNot Nothing Then - SaldoAlmacenExA = DtSaldosAlmacenRemision.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacen}") - End If - - If SaldoAlmacenExA <> 0 Then - If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")}"), ObjVentas, ObjInventario, ObjConta) Then + If ObjRemision.SaldoAlmacen <> 0 Then + Dim SaldoAlmacenExA As Decimal = 0 + Dim SaldoAlmacenUsados As Decimal = 0 + Dim DtSaldosAlmacenRemision As DataTable = Nothing + 'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO + If Not ErrorCancelar Then + If ObjInventario.GetSaldoVentaDetalleAlmacen(ObjRemision.CveVenta, UsuarioActual.CveEmpresa) Then + DtSaldosAlmacenRemision = ObjInventario.DtResultados.Copy() + Else ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." - Exit For + MensajeError = "Ocurrió un error al cargar los saldos de devolución. Por favor vuelva a intentar." End If End If - Next - 'CANCELAR MOVIMIENTOS DE USADOS SI TIENE - If Not ErrorCancelar AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - Dim CveAlmacenUsado As Integer = 0 - Dim CveMovimientoUsado As Integer = 0 + Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") - If ObjInventario.GetInv_Mov(ObjRemision.CveVenta, UsuarioActual.CveEmpresa) Then - CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() - CveAlmacenUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero() - Else - ErrorCancelar = True - MensajeError = "Ocurrió un error al cargar los datos de devolución de usado. Por favor vuelva a intentar." - End If + Dim DtDevMovs As DataTable = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveRemision", "CveAlmacen", "CveAlmacenDestino"}) - If CveAlmacenUsado > 0 AndAlso DtSaldosAlmacenRemision IsNot Nothing Then - SaldoAlmacenUsados = DtSaldosAlmacenRemision.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenUsado}") - End If + For Each RowDevolucion As DataRow In DtDevMovs.Rows + CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() + CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() - If Not ErrorCancelar AndAlso CveMovimientoUsado > 0 AndAlso SaldoAlmacenUsados <> 0 Then - If CancelarInventarioUsado(ObjRemision, CveAlmacenUsado, CveMovimientoUsado, ObjInventario, ObjConta, Contabilizable:=False) <= 0 Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los usados. Por favor vuelva a intentar." + If CveAlmacen > 0 AndAlso DtSaldosAlmacenRemision IsNot Nothing Then + SaldoAlmacenExA = DtSaldosAlmacenRemision.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacen}") End If + + If SaldoAlmacenExA <> 0 Then + If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")}"), ObjVentas, ObjInventario, ObjConta) Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." + Exit For + End If + End If + + Next + + 'CANCELAR MOVIMIENTOS DE USADOS SI TIENE + If Not ErrorCancelar AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim CveAlmacenUsado As Integer = 0 + Dim CveMovimientoUsado As Integer = 0 + + If ObjInventario.GetInv_Mov(ObjRemision.CveVenta, UsuarioActual.CveEmpresa) Then + CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() + CveAlmacenUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero() + Else + ErrorCancelar = True + MensajeError = "Ocurrió un error al cargar los datos de devolución de usado. Por favor vuelva a intentar." + End If + + If CveAlmacenUsado > 0 AndAlso DtSaldosAlmacenRemision IsNot Nothing Then + SaldoAlmacenUsados = DtSaldosAlmacenRemision.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenUsado}") + End If + + If Not ErrorCancelar AndAlso CveMovimientoUsado > 0 AndAlso SaldoAlmacenUsados <> 0 Then + If CancelarInventarioUsado(ObjRemision, CveAlmacenUsado, CveMovimientoUsado, ObjInventario, ObjConta, Contabilizable:=False) <= 0 Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al cancelar los usados. Por favor vuelva a intentar." + End If + End If + + 'CANCELAR MOVIMIENTOS DE GARANTIA SI TIENE + If Not ErrorCancelar AndAlso Not GenerarMovimientoGarantia(15, "Salida Garantía", ClsPaginas.NowADS(), ObjRemision, ObjAcum, ObjInventario, ObjConta) Then + ErrorCancelar = True + End If + + 'CANCELA LOS FOLIOS DE GARANTIA + If Not ErrorCancelar AndAlso Not ObjAcum.UpdateGarantiaCancelacion(ObjRemision.CveVenta) Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al actualizar la garantía" + End If + End If - End If + If DtDevRemision IsNot Nothing Then + DtDevRemision.Dispose() + End If - 'CANCELAR MOVIMIENTOS DE GARANTIA SI TIENE - If Not ErrorCancelar AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - If Not GenerarMovimientoGarantia(15, "Salida Garantía", ClsPaginas.NowADS(), ObjRemision, ObjAcum, ObjInventario, ObjConta) Then - ErrorCancelar = True + If DtDevMovs IsNot Nothing Then + DtDevMovs.Dispose() End If End If - 'CANCELA LOS FOLIOS DE GARANTIA - If Not ErrorCancelar Then - If Not ObjAcum.UpdateGarantiaCancelacion(ObjRemision.CveVenta) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al actualizar la garantía" - End If - End If - - If DtDevRemision IsNot Nothing Then - DtDevRemision.Dispose() - End If - - If DtDevMovs IsNot Nothing Then - DtDevMovs.Dispose() - End If - + Else + ErrorCancelar = True + MensajeError = "Ocurrió un error al cargar los datos de la remisión. Por favor vuelva a intentar." End If If ObjRemision IsNot Nothing Then @@ -6978,7 +6987,7 @@ Namespace Modelos Dim SeCancela As Boolean = (ListaRemisionesCancelar IsNot Nothing) AndAlso (ListaRemisionesCancelar.Any(Function(CveRemisionCancelar) CveRemisionCancelar = DrMovtos("CveRem").ToString.ToEntero())) If Not SeCancela Then - Dim ObjRem As New Modelos.Factura(UsuarioActual, DrMovtos("CveRem").ToString.ToEntero(), UsuarioActual.CveEmpresa) + Dim ObjRem As New Modelos.Factura(UsuarioActual, DrMovtos("CveRem").ToString.ToEntero(), UsuarioActual.CveEmpresa, CargaDatosCliente:=False, CargaDTDetalle:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=True) 'SI LA REMISION ESTA SALDADA DEBE REVIVIR LOS MOVIMIENTOS COMPLETAMENTE O PARCIALMENTE If ObjRem.SaldoAlmacen >= 0 Then CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index cce796c97..dab9d8862 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -112,12 +112,25 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState FI = context.Request("start").ToDate FF = context.Request("end").ToDate - If Not GetContratos(context:=context) Then - 'Convierte el objeto de Eventos en JSON - 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer - Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) + If Not GetContratos(context:=context) Then + 'Convierte el objeto de Eventos en JSON + 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer + + + 'Dim settings As New Newtonsoft.Json.JsonSerializerSettings With { + ' .NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ' .Formatting = Newtonsoft.Json.Formatting.None + ' } + 'Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events, settings) + 'context.Response.Write(sJSON) + + Dim serializer As New Newtonsoft.Json.JsonSerializer() + Using writer As New IO.StringWriter() + serializer.Serialize(writer, events) + context.Response.Write(writer.ToString()) + End Using + - context.Response.Write(sJSON) End If End If Exit Select diff --git a/Bancos/Creditos.aspx.vb b/Bancos/Creditos.aspx.vb index 7ae86544c..6d1bb5b0a 100644 --- a/Bancos/Creditos.aspx.vb +++ b/Bancos/Creditos.aspx.vb @@ -965,7 +965,7 @@ Partial Class Bancos_Creditos If CveCredito > 0 Then If ObjCredito.UpdateCreditos(CveCredito, DdlTipoCredito.SelectedValue.ToEntero, TxtReferencia.Text, TxtObservaciones.Text, -1, -1, -1, DdlTipoMoneda.SelectedValue.ToEntero, TxtFechaInicio.Text.ToString.ToDate, FechaVencimiento, TxtTasa.Text.Trim.ToDouble, TxtSobreTasa.Text.Trim.ToDouble, TxtIVA.Text.ToDouble / 100, TxtPlazo.Text.Trim.ToEntero, -1, TxtVehiculoValor.Text.ToString.ToDouble, TxtComisionValor.Text.ToString.ToDouble, TxtSeguroMensual.Text.ToString.ToDouble, TxtOtrosGastosValor.Text.ToString.ToDouble, - DdlProveedores.SelectedValue.ToEntero, RBLClasificacionContable.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, AplicaAnticipo:=If(RBLAnticipo.SelectedValue.ToEntero = 1, True, False), + DdlProveedores.SelectedValue.ToEntero, RBLClasificacionContable.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, AplicaAnticipo:=If(RBLAnticipo.SelectedValue.ToEntero = 1, True, False), CreditoAnticipo:=TxtVehiculoAnticipo.Text.ToDouble, ComisionAnticipo:=TxtComisionAnticipo.Text.ToDouble, SeguroAnticipo:=TxtSeguroAnticipo.Text.ToDouble, OtrosGastosAnticipo:=TxtOtrosGastosAnticipo.Text.ToDouble, FondoGarantia:=TxtFondoGarantia.Text.ToDouble, SeguroValor:=TxtSeguroValor.Text.ToDouble, TipoInteres:=ChkTipoInteres.Checked) Then If RegeneraTablaAmortizacion Then diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 6b88b2c14..e59d1b23d 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -29,25 +29,28 @@ Partial Class Bancos_DepositosCaja TxtIVA.Attributes.Add("onKeyUp", "txtSumaIVA(this);") TxtComisionIntermediario.Attributes.Add("onKeyUp", "txtSumaTntermediario(this);") - - CargaCuentas() - ChkFaltante.Attributes.Add("onclick", "CheckFaltante(this);") - ChkDescuento.Attributes.Add("onclick", "CheckDescuento(this);") + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then 'quita la opción de todos + DdlTipoDeposito.Items.Remove("-1") + End If + + CargaCuentas() + ChkFaltante.Attributes.Add("onclick", "CheckFaltante(this);") + ChkDescuento.Attributes.Add("onclick", "CheckDescuento(this);") ChkIntermediario.Attributes.Add("onclick", "CheckIntermediario(this);") - ChkCuentaRetorno.Attributes.Add("onclick", "CheckRowCuenta(this);") - BtnConsultar.Attributes.Add("onclick", "Consultar(this);") - BtnDepositar.Attributes.Add("onclick", "Depositar(this);") - + ChkCuentaRetorno.Attributes.Add("onclick", "CheckRowCuenta(this);") + BtnConsultar.Attributes.Add("onclick", "Consultar(this);") + BtnDepositar.Attributes.Add("onclick", "Depositar(this);") + 'Dim StrEncriptPrueba As String = Encripta($"OP=DC&CveIE={2784391}&CuentaCaja={"TestCuantaCaja"}&CuentaDepo={"Test cuenta"}") - 'HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={StrEncriptPrueba}" - + 'HplImprimirPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={StrEncriptPrueba}" + If UsuarioActual.CveEmpresa = 189 Then - If DdlTipoPago.Items.FindByValue("-1") IsNot Nothing Then - DdlTipoPago.Items.Remove(DdlTipoPago.Items.FindByValue("-1")) + If DdlTipoPago.Items.FindByValue("-1") IsNot Nothing Then + DdlTipoPago.Items.Remove(DdlTipoPago.Items.FindByValue("-1")) + End If End If + End If - - End If End Sub Private Sub CargaCuentas() diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb index fae2d1f41..53b099b94 100644 --- a/Bancos/PagoElectronicoGrupos.aspx.vb +++ b/Bancos/PagoElectronicoGrupos.aspx.vb @@ -8,8 +8,7 @@ Imports Ionic.Zip Imports Microsoft.Reporting.WebForms Partial Class Bancos_PagoElectronicoGrupos - Inherits ClsPaginas - Private Shared missing As Object = System.Reflection.Missing.Value + Inherits ClsPaginas #Region "PROPIEDADES" Private Property HeaderTexto As String diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 8da9cddc6..aef8546d1 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -3502,7 +3502,7 @@ Partial Class Compras_Compras ViewState("CveProveedor") = ObjProveedor.CveProveedor ViewState("CveTipoProveedor") = ObjProveedor.CveTipoProveedor - + RFCProveedor = ObjProveedor.RFC If ObjProveedor.CveTipoProveedor = 2 Then LblProveedor.Text = "Acreedor:" Else @@ -13318,10 +13318,11 @@ Partial Class Compras_Compras dtt = dtt.FiltraParametros($"Fecha >= #{NowADS.AddMonths(-12).ToString("yyyy/MM/dd")}#") End If DDLDevolucion.DataSource = dtt - DDLDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If objcompras.Dispose() DDLDevolucion.DataBind() + DDLDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1")) UPDevolucion.Update() End Sub @@ -14242,6 +14243,7 @@ Partial Class Compras_Compras HdnVCveOC.Value = "" HdnCveEstatusOC.Value = "" + Dim tmpPorcentajeProntoPago As Decimal = 0 Dim OC As New ClsOC If PopUpOC Then Dim ArrayCveOC As String() = CvesOC.Split(New Char() {","c}) @@ -14252,6 +14254,7 @@ Partial Class Compras_Compras HdnCveEstatusOC.Value += String.Format("{0}{1}", If(HdnCveEstatusOC.Value <> "", ",", ""), OC.DtResultados.Rows(0)("CveEstatusSiguiente").ToString) EntregaDirecta += If(OC.DtResultados.Rows(0)("EntregaDirecta").ToString = "True", 1, 0) MetodoPagoOC = OC.DtResultados.Rows(0)("MetodoPagoOC").ToString.ToEntero + tmpPorcentajeProntoPago = OC.DtResultados.Rows(0)("PorcentajeProntoPago").ToString.ToDecimal End If End If Next @@ -14268,6 +14271,11 @@ Partial Class Compras_Compras HdnCveEstatusOC.Value += String.Format("{0}{1}", If(HdnCveEstatusOC.Value <> "", ",", ""), OC.DtResultados.Rows(0)("CveEstatusSiguiente").ToString) EntregaDirecta += If(OC.DtResultados.Rows(0)("EntregaDirecta").ToString = "True", 1, 0) MetodoPagoOC = OC.DtResultados.Rows(0)("MetodoPagoOC").ToString.ToEntero + + If tmpPorcentajeProntoPago = 0 Then + tmpPorcentajeProntoPago = OC.DtResultados.Rows(0)("PorcentajeProntoPago").ToString.ToDecimal + End If + End If End If Next @@ -14281,6 +14289,11 @@ Partial Class Compras_Compras PopUpOC = False + If tmpPorcentajeProntoPago > 0 Then + PorcentajeProntoPago = tmpPorcentajeProntoPago + End If + + If HdnVCveOC.Value <> "" Then If HdnCveEstatusOC.Value = "" Then Alert("No se tiene especificado el siguiente estatus de la Orden(es) de Compra. Por favor verifique los estatus y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -20933,7 +20946,7 @@ Partial Class Compras_Compras Dim respuesta As Boolean = False - If UsuarioActual.Empresa.Funcionalidad(532).Contiene("1", "2") Then + If UsuarioActual.Empresa.Funcionalidad(532).Contiene("1") Then If Opcion = 1 Or OCVinculada Or DdlTipoComprobante.SelectedValue <> "Fac" Then Return True diff --git a/Contratos/Presupuestos.aspx.vb b/Contratos/Presupuestos.aspx.vb index 65d860f72..caa64a63f 100644 --- a/Contratos/Presupuestos.aspx.vb +++ b/Contratos/Presupuestos.aspx.vb @@ -412,7 +412,7 @@ Partial Class Contratos_Presupuestos CveConceptoContableNom = CveAgrupador End If - If CveClasificacion > 0 Then + If CveClasificacion > 0 Or CveConceptoContableNom > 0 Then If ImporteClasi > 0 Then TieneError = Not ObjCont.AddPresupuestosDetalle(CvePresupuestoNuevo, CveClasificacion, CveTipoGasto, ImporteClasi, ObsDetalle, CveConceptoContableNom:=CveConceptoContableNom) If TieneError Then diff --git a/OC/OC.aspx b/OC/OC.aspx index 88f22bc33..2cd3d524d 100644 --- a/OC/OC.aspx +++ b/OC/OC.aspx @@ -477,6 +477,25 @@ + + Descuento: + + + + + + + + Descuento Pronto Pago: + + + + + + + + + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 419e71f4c..0b8fc655a 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -6,6 +6,7 @@ Imports System.Data.SqlClient Imports System.IO Imports Extensiones Imports GemBox.Spreadsheet +Imports Microsoft.Ajax.Utilities Imports Newtonsoft.Json Partial Class OC_OC @@ -964,6 +965,11 @@ Partial Class OC_OC DdlSubProyectoGral.Visible = True End If + If UsuarioActual.CveRol = 1 Then + TrDescuentoEscalonado.Visible = True + TrDescuentoProntoPago.Visible = True + End If + End If MostrarUsuarioAsignado() @@ -1521,6 +1527,8 @@ Partial Class OC_OC TxtNumRemision.Text = objOC.NumRemision NumeroRemisionOriginal = objOC.NumRemision + TxtPorcentajeProntoPago.Text = (100 * objOC.PorcentajeProntoPago).ToString("###.00") + If Not IsNothing(objOC.Tipo) Then Select Case objOC.Tipo.ToUpper @@ -2709,6 +2717,11 @@ Partial Class OC_OC Dim LugarEntrega As String = If(txtLugarEntrega.Text.Trim = "", "-1", txtLugarEntrega.Text.Trim) LugarEntrega = If(DivLugarEntrega1.Visible, LugarEntrega, If(TxtLugarEntregaDirecta.Visible, TxtLugarEntregaDirecta.Text.Trim, "")) + Dim PorcentajeProntoPago As Decimal = 0 + If TxtPorcentajeProntoPago.Text.ToDecimal > 0 Then + PorcentajeProntoPago = TxtPorcentajeProntoPago.Text.ToDecimal / 100 + End If + 'GUARDA' If EsNuevo Then @@ -2753,7 +2766,7 @@ Partial Class OC_OC RequiereCotizacion:=ChkCotizacion.Checked, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto, NumRemision:=TxtNumRemision.Text.Trim(), MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), - CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero) Then + CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero, PorcentajeProntoPago:=PorcentajeProntoPago) Then CveOrdenCompraPadre = OC.CveOrdenCompra If CveOrdenCompraPadre > 0 Then @@ -2795,7 +2808,8 @@ Partial Class OC_OC RequiereCotizacion:=ChkCotizacion.Checked, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, - Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto, NumRemision:=TxtNumRemision.Text, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero) Then + Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto, NumRemision:=TxtNumRemision.Text, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero, + PorcentajeProntoPago:=PorcentajeProntoPago) Then CveOrdenCompra = OC.CveOrdenCompra CveEstatus = CboE.SelectedValue.ToEntero @@ -2978,7 +2992,8 @@ Partial Class OC_OC LugarEntrega, DdlMoneda.SelectedValue.ToEntero, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.txtValue.Value.ToEntero, DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, - PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), NumRemision:=TxtNumRemision.Text, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero) Then + PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), NumRemision:=TxtNumRemision.Text, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero, + PorcentajeProntoPago:=PorcentajeProntoPago) Then If CveProveedorOriginal <> CveProveedor Then If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then TieneError = True @@ -3403,8 +3418,16 @@ Partial Class OC_OC ' Exit Function 'End If + + If TipoOS Then Return False + + Dim PorcentajeProntoPago As Decimal = 0 + If TxtPorcentajeProntoPago.Text.ToDecimal > 0 Then + PorcentajeProntoPago = TxtPorcentajeProntoPago.Text.ToDecimal / 100 + End If + Dim CveCotizacion As Integer = 0 Dim CveColectiva As Integer = 0 Dim HuboError As Boolean = False @@ -3452,7 +3475,7 @@ Partial Class OC_OC PorcentajeIVA:=PorIVA, IVA:=IVACot, RetIVA:=RetIVA.ToString.ToDecimal, RetISR:=RetISR.ToString.ToDecimal, IDPoliza:=IdPoliza, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, Promocion:=Promocion, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, NumRemision:=TxtNumRemision.Text.Trim, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), - CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero) Then + CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero, PorcentajeProntoPago:=PorcentajeProntoPago) Then 'CREA POLIZA POR CADA PROVEEDOR @@ -3528,7 +3551,7 @@ Partial Class OC_OC CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero(), CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, IDPoliza:=IDPolizaPresupuestal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, - Promocion:=Promocion, NumRemision:=TxtNumRemision.Text.Trim, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero) Then + Promocion:=Promocion, NumRemision:=TxtNumRemision.Text.Trim, MetodoPago:=DdlMetodoPago.SelectedValue.ToEntero(), CveSubProyectoEntrega:=DdlSubProyectoEntrega.SelectedValue.ToEntero, PorcentajeProntoPago:=PorcentajeProntoPago) Then 'USA AC @@ -4237,14 +4260,14 @@ Partial Class OC_OC If CvePresupuesto > 0 And Autorizado > 0 Then Dim Diferencia As Decimal = (Ejercido + Total) - Autorizado If Diferencia > 0 Then - Alert($"No hay presupuesto disponible en el subproyecto {SubProyecto} y la clasificación {Clasificacion} se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia) + Alert($"No hay presupuesto disponible:
- Subproyecto {SubProyecto}
- Clasificación {Clasificacion}
se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia) Exit Sub End If End If End If - 'Agarra el nuevo AF si se modifico o deja el pasado - CveActivoFijo = If(gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero > 0, gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero, HdnEditCveActivoFijo.Value.ToEntero) + 'Agarra el nuevo AF si se modifico o deja el pasado + CveActivoFijo = If(gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero > 0, gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero, HdnEditCveActivoFijo.Value.ToEntero) Codigo = If(gvr.FCHiddenField("HdnCodigoAF").Value <> "-1", gvr.FCHiddenField("HdnCodigoAF").Value, HdnEditCodigo.Value) HdnEditCveActivoFijo.Value = "" @@ -9289,5 +9312,65 @@ Partial Class OC_OC UPPDetalle.Update() CargaFolios() End Sub + + Protected Sub BtnDescuenEscalonado_Click(sender As Object, e As EventArgs) + + Dim descuentoParts As String() = TxtDescuentoEscalonado.Text.Split("+"c) + + + For Each dRow As DataRow In DtDetalle.Rows + + Dim PU As Decimal = dRow("Importe").ToString.ToDecimal + Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal + Dim IVAPorcentaje As Decimal = dRow("IVAPorcentaje").ToString.ToDecimal + Dim IEPSPSPorcentaje As Decimal = dRow("IEPSPSPorcentaje").ToString.ToDecimal + Dim IEPSPSIVAPorcentaje As Decimal = dRow("IEPSPSIVAPorcentaje").ToString.ToDecimal + Dim RetIVAPorcentaje As Decimal = dRow("RetIVAPorcentaje").ToString.ToDecimal + Dim RetISRPorcentaje As Decimal = dRow("RetISRPorcentaje").ToString.ToDecimal + + Dim TotalTemp As Decimal = (PU * Cantidad) + Dim Descuento As Decimal = 0 + If descuentoParts.Length = 0 Then + Descuento = 0 + Else + + For i As Integer = 0 To descuentoParts.Length - 1 + Dim descuentoPart As Decimal = descuentoParts(i).Trim().ToDecimal + If descuentoPart > 0 Then + Descuento = Descuento + ((TotalTemp - Descuento) * (descuentoPart / 100)) + Else + Continue For + End If + Next + + End If + + Dim Total As Decimal = If(PU > 0, (PU * Cantidad) - Descuento, 0) + + dRow("Descuento") = Descuento + dRow("Total") = Total + dRow("IEPSPS") = Math.Round(IEPSPSPorcentaje * Total, 2) + dRow("IEPSPSIVA") = Math.Round(IEPSPSIVAPorcentaje * Total, 2) + + dRow("IVA") = Math.Round(IVAPorcentaje * Total, 2) + + dRow("RetIVA") = (RetIVAPorcentaje * Total).RoundSQL(2) + dRow("RetISR") = (RetISRPorcentaje * Total).RoundSQL(2) + + + Next + + DtDetalle.AcceptChanges() + + CalculaGenerales() + + GvD.DataSource = DtDetalle + GvD.DataBind() + + UpIvas.Update() + UPPDetalle.Update() + + + End Sub End Class diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index eca2e6001..42019cf5f 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -266,7 +266,7 @@ Partial Class RepContratoDetalle Response.Clear() Response.ClearHeaders() Response.ClearContent() - Response.AddHeader("Content-Disposition", "attachment; filename=" & LbFolio.Text & ".pdf") + Response.AddHeader("Content-Disposition", "attachment; filename=" & LbFolio.Text & $"{File.Extension}") Response.AddHeader("Content-Length", File.Length.ToString()) 'Response.ContentType = "text/plain" Response.ContentType = "application/octet-stream" diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index 028bcf371..0a69f7351 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -388,7 +388,7 @@
+ Rows="6">
diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index 295100756..517fb0db7 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -127,13 +127,14 @@ - + + diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb index 2c36f3c7b..91757d72a 100644 --- a/Ventas/CatAutorizacionLimites.aspx.vb +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -263,7 +263,7 @@ Partial Class Ventas_CatAutorizacionLimites End If Dim ObjVentas As New ClsVentas - If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then + If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion, UsuarioActual.CveUsuario) Then Alert("El límite de crédito fue autorizado.") End If ObjVentas.Dispose() @@ -280,7 +280,7 @@ Partial Class Ventas_CatAutorizacionLimites Dim CveEstatusAutorizacion As Integer = 3 Dim ObjVentas As New ClsVentas - If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then + If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion, UsuarioActual.CveUsuario) Then Alert("El límite de crédito fue rechazado.") End If ObjVentas.Dispose() diff --git a/Ventas/CatPreciosLista.aspx.vb b/Ventas/CatPreciosLista.aspx.vb index d71056c60..ea79b3b4f 100644 --- a/Ventas/CatPreciosLista.aspx.vb +++ b/Ventas/CatPreciosLista.aspx.vb @@ -59,19 +59,21 @@ Partial Class Ventas_CatPreciosLista Dim GvRow As GridViewRow = DirectCast(Boton.NamingContainer, GridViewRow) TxtPrecioLista.Text = GvRow.DataKey("PrecioLista").ToString ChkPredeterminada.Checked = GvRow.DataKey("Predeterminada") = "True" - chkEstatus.Checked = CBool(GvRow.DataKey("Estatus")) - ChkRestringida.Checked = CBool(GvRow.DataKey("Restringuida")) + chkEstatus.Checked = GvRow.DataKey("Estatus") = "True" + ChkRestringida.Checked = GvRow.DataKey("Restringuida") = "True" EsEditar = 1 BtnAgregarCatalogo.Text = "Actualizar" dvEstatus.Visible = True - Using ObjVenta As New ClsVentas - If ObjVenta.GetPreciosListasSubProyecto(CvePrecioLista, UsuarioActual.CveEmpresa) Then - GvSubProyectos.DataSource = ObjVenta.DtResultados.Copy() - End If - End Using - GvSubProyectos.DataBind() + If divSP.Visible Then + Using ObjVenta As New ClsVentas + If ObjVenta.GetPreciosListasSubProyecto(CvePrecioLista, UsuarioActual.CveEmpresa) Then + GvSubProyectos.DataSource = ObjVenta.DtResultados.Copy() + End If + End Using + GvSubProyectos.DataBind() + End If UpBodyCo.Update() UpFooter.Update() diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 34c0b0272..5e4ec35f7 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -924,6 +924,7 @@ + Estatus:  @@ -933,6 +934,13 @@