diff --git a/App_Code/ClsGPS.vb b/App_Code/ClsGPS.vb index 4cdc9e7f2..d67b7f3d8 100644 --- a/App_Code/ClsGPS.vb +++ b/App_Code/ClsGPS.vb @@ -2201,6 +2201,21 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener la ruta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno + End Function + Public Function GetRutasPuntosRecoleecion(CveRuta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_GPS_RutasPuntosRecoleecionGet") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los puntos de recoleecion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno End Function Public Function UpdateRuta(CveRuta As Integer, Ruta As String, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 44f9bfa8b..e5e7ab30e 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5511,6 +5511,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepVentasMensuales.aspx".ToUpper(), 720) PaginaDict.Add("/Ventas/RepVentasMensualesDetalle.aspx".ToUpper(), 720) PaginaDict.Add("/Ventas/MetasVendedores.aspx".ToUpper(), 722) + PaginaDict.Add("/Ventas/MetasVendedoresDetalle.aspx".ToUpper(), 722) PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723) PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 567) PaginaDict.Add("/Ventas/CatAutorizacionLimites.aspx".ToUpper(), 781) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index c15085155..2770e61a7 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -3158,8 +3158,8 @@ Public Class ClsVentas Dim retorno As Boolean = False Try - Dim objServicio As Cancelacion.CancelacionSoapClient = New Cancelacion.CancelacionSoapClient() - Dim resp As Cancelacion.StructCancel = objServicio.ObtienePendientes(RFC, "UserTest", "1234567890") + Dim objServicio As Cancelacion2022.CancelacionSoapClient = New Cancelacion2022.CancelacionSoapClient() + Dim resp As Cancelacion2022.StructCancel = objServicio.ObtienePendientes(RFC, "UserTest", "1234567890") If resp.Estado = 0 Then Dim XmlPendientes As String = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(resp.Xml)) Dim theReader As IO.StringReader = New IO.StringReader(XmlPendientes) @@ -4953,6 +4953,34 @@ Public Class ClsVentas Return retorno End Function + + Public Function GetRepMetasVendedoresDetalle(FechaMesActual As String, CveEmpresa As Integer, CveVendedor As Integer, CveCategoria As Integer, CveClasificacion As Integer, + CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer, CveCliente As Integer, EsDistribuidor As Integer, + Optional GrupoSuperior As Integer = 0) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Vta_MetasVendedoresDetalle", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaMesActual", SqlDbType.DateTime).Value = FechaMesActual + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveClasificacion2", SqlDbType.Int).Value = CveClasificacion2 + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@GrupoSuperior", SqlDbType.Int).Value = GrupoSuperior + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de metas por vendedores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function + Public Function GetRepTopClientesVentas(CveEmpresa As Integer, Mes As Integer, Año As Integer, Optional Top As Integer = 20, Optional CveSubProyecto As Integer = -1) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_Top20ClientesMasVendidos", CommandType.StoredProcedure) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 948806db8..5e3693e62 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3826,46 +3826,9 @@ Namespace Modelos OcurrioError = True End If - ' COMIENZA: GARANTIAS - Dim CveAlmacenGarantia As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=6).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={factura.CveSubProyecto}").ToEntero() - Dim DtGarantias As DataTable = Nothing - - If ObjAcum.GetGarantiasDetalle(factura.CveVenta) Then - DtGarantias = ObjAcum.DtResultados.Copy() - End If - - If DtGarantias IsNot Nothing AndAlso DtGarantias.Rows.Count > 0 AndAlso CveAlmacenGarantia > 0 Then - Dim TotalGarantia As Decimal = 0 - Dim CveMovimientoGarantia = ObjInventario.AddMovimiento(CveAlmacenGarantia, 2, 1, factura.Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, factura.CveVenta, -1, -1, Observaciones:="", Guia:="", Modulo:="Modelos/SDGA") - Dim FolioGarantia = ObjInventario.Folio - - For Each RowGarantia As DataRow In DtGarantias.Rows - Dim CvePS = RowGarantia("CvePS").ToString().ToEntero() - Dim CveTamaño As Integer = RowGarantia("CveTamaño").ToString().ToEntero() - Dim CveUM As Integer = RowGarantia("CveUnidadMedida").ToString().ToEntero() - Dim PU As Decimal = RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() - Dim Serie As String = RowGarantia("Comprobante").ToString - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, Serie:=Serie, CveVentaDetalle:=RowGarantia("CveVentaDetalle").ToString.ToEntero) Then - OcurrioError = True - Exit For - End If - TotalGarantia += (RowGarantia("Cantidad").ToString().ToDecimal() * PU) - Next - - Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Gar", 53, 0, 0, 1, factura.Fecha, "Entrada Garantía", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CvePrePolizaTraspaso > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, TotalGarantia, "MOVIMIENTO DE GARANTIA", 68, "MOVIMIENTO DE GARANTIA", factura.Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoGarantia, Contabilizable:=True, ImporteMX:=TotalGarantia) Then - OcurrioError = True - End If - - If Not OcurrioError AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, TotalGarantia, "MOVIMIENTO DE GARANTIA", 331, "MOVIMIENTO DE GARANTIA", factura.Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoGarantia, Contabilizable:=True, ImporteMX:=TotalGarantia) Then - OcurrioError = True - End If - Else - OcurrioError = True - End If - + ' GENERA EL MOVIMIENTO DE GARANTIA SI TIENE + If Not GenerarMovimientoGarantia(14, "Entrada Garantía", Now, factura, ObjAcum, ObjInventario, ObjConta) Then + OcurrioError = True End If Else @@ -3902,6 +3865,75 @@ Namespace Modelos Return OcurrioError End Function + + Private Function GenerarMovimientoGarantia(CveConceptoMovimiento As Integer, ConceptoPoliza As String, FechaMovimiento As DateTime, factura As Factura, ByRef ObjAcum As ClsAcumuladores, ByRef ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, Optional Modulo As String = "Modelos/SDGA") As Boolean + Dim OcurrioError As Boolean = False + Try + Dim CveAlmacenGarantia As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=6).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={factura.CveSubProyecto}").ToEntero() + Dim DtGarantias As DataTable = Nothing + + If ObjAcum.GetGarantiasDetalle(factura.CveVenta) Then + DtGarantias = ObjAcum.DtResultados.Copy() + Else + OcurrioError = True + End If + + 'SI TIENE UNA GARANTIA, GENERAR EL MOVIMIENTO DE ALMACEN + If DtGarantias IsNot Nothing AndAlso DtGarantias.Rows.Count > 0 AndAlso CveAlmacenGarantia > 0 Then + Dim TotalGarantia As Decimal = 0 + Dim CveMovimientoGarantia = ObjInventario.AddMovimiento(CveAlmacenGarantia, CveConceptoMovimiento, 1, FechaMovimiento, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, factura.CveVenta, -1, -1, Observaciones:="", Guia:="", Modulo:=Modulo) + Dim FolioGarantia = ObjInventario.Folio + + For Each RowGarantia As DataRow In DtGarantias.Rows + Dim CvePS = RowGarantia("CvePS").ToString().ToEntero() + Dim CveTamaño As Integer = RowGarantia("CveTamaño").ToString().ToEntero() + Dim CveUM As Integer = RowGarantia("CveUnidadMedida").ToString().ToEntero() + Dim PU As Decimal = RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() + Dim Serie As String = RowGarantia("Comprobante").ToString + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, Serie:=Serie, CveVentaDetalle:=RowGarantia("CveVentaDetalle").ToString.ToEntero) Then + OcurrioError = True + Exit For + End If + Next + + If Not OcurrioError Then + If ObjInventario.GetMovimientosDetalle(CveMovimientoGarantia, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then + TotalGarantia = ObjInventario.DtResultados.SUMD("Total").RoundSQL + Else + OcurrioError = True + End If + End If + + If Not OcurrioError Then + Dim CvePrePolizaGarantia As Integer = ObjConta.AddPrePolizas("EA/Gar", 53, 0, 0, 1, FechaMovimiento, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePolizaGarantia > 0 Then + Dim TipoMovto As Boolean = False + If CveConceptoMovimiento = 15 Then + TipoMovto = True + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaGarantia, TipoMovto, TotalGarantia, "MOVIMIENTO DE GARANTIA", 68, "MOVIMIENTO DE GARANTIA", factura.Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoGarantia, Contabilizable:=True, ImporteMX:=TotalGarantia) Then + OcurrioError = True + End If + + If Not OcurrioError AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaGarantia, Not TipoMovto, TotalGarantia, "MOVIMIENTO DE GARANTIA", 331, "MOVIMIENTO DE GARANTIA", factura.Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoGarantia, Contabilizable:=True, ImporteMX:=TotalGarantia) Then + OcurrioError = True + End If + Else + OcurrioError = True + End If + End If + + + End If + Catch ex As Exception + OcurrioError = True + OnError("Ocurrió un error al generar el movimiento de garantía", ex) + End Try + + Return Not OcurrioError + End Function Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable Dim MovDTCuadrados As New DataTable MovDTCuadrados = MovDetalle.Clone @@ -5540,6 +5572,21 @@ Namespace Modelos 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", Now, ObjRemision, ObjAcum, ObjInventario, ObjConta) Then + ErrorCancelar = True + 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 @@ -5629,6 +5676,13 @@ Namespace Modelos End If 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", Now, ObjFactura, ObjAcum, ObjInventario, ObjConta) Then + ErrorCancelar = True + End If + End If + End If 'VERIFICAR MOVIMIENTOS DE APARTADOS @@ -6617,6 +6671,7 @@ Namespace Modelos Public Property SubProyecto As Modelos.SubProyectoModel Public Property DtDetalle As Data.DataTable + Public Property DtMercancias As Data.DataTable Public Property DtDetalleAC As Data.DataTable Public Property DtAjustes As Data.DataTable Public Property DtRecepcionUsados As Data.DataTable @@ -7166,6 +7221,7 @@ Namespace Modelos If Not DtRemisiones Is Nothing Then DtRemisiones.Dispose() : DtRemisiones = Nothing If Not DtRemisionesPS Is Nothing Then DtRemisionesPS.Dispose() : DtRemisionesPS = Nothing If Not DtVentasNC Is Nothing Then DtVentasNC.Dispose() : DtVentasNC = Nothing + If Not DtMercancias Is Nothing Then DtMercancias.Dispose() : DtMercancias = Nothing End If End If Me.disposedValue = True diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 576b25214..914eed43d 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -259,39 +259,39 @@ Public Class E141 : Implements IHttpHandler End Property #End Region -#Region "V A L I D A - D A T O S" - Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario - Dim UsuarioActual As Usuario = Nothing - Dim ObjUsuarios As New ClsSisUsuarios - If ObjUsuarios.GetUsuarios(CveUsuario) Then - If ObjUsuarios.DtResultados.Rows.Count > 0 Then - Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString() - Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString() - UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa) - UsuarioActual.CveEmpresa = CveEmpresa - CreaObjetoEmpresa(UsuarioActual) - End If - End If - ObjUsuarios.Dispose() - Return UsuarioActual - End Function - Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) - - Dim ObjEmpresa As New ClsSisEmpresas() - If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then - If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then - Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados - - Dim EmpresasFuncionalidades As New HybridDictionary - For Each Row As Data.DataRow In dttmp.Rows - EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString) - Next - ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades) - End If - - UsuarioActual.Empresa = ObjEmpresa.Empresa - End If - ObjEmpresa.Dispose() +#Region "V A L I D A - D A T O S" + Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario + Dim UsuarioActual As Usuario = Nothing + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.GetUsuarios(CveUsuario) Then + If ObjUsuarios.DtResultados.Rows.Count > 0 Then + Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString() + Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString() + UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa) + UsuarioActual.CveEmpresa = CveEmpresa + CreaObjetoEmpresa(UsuarioActual) + End If + End If + ObjUsuarios.Dispose() + Return UsuarioActual + End Function + Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) + + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then + Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados + + Dim EmpresasFuncionalidades As New HybridDictionary + For Each Row As Data.DataRow In dttmp.Rows + EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString) + Next + ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades) + End If + + UsuarioActual.Empresa = ObjEmpresa.Empresa + End If + ObjEmpresa.Dispose() End Sub #End Region @@ -766,7 +766,7 @@ Public Class E141 : Implements IHttpHandler End Function -#Region "D E F I N I R - O B J E T O S" +#Region "D E F I N I R - O B J E T O S" Private Function CrearCliente(TipoDocto As String, ObjClientes As ClsClientes, ByRef Resp As Modelos.Factura.MMensajeFactura, JsonRequest As JObject, UsuarioActual As Usuario) As Integer Dim CveCliente As Integer = -1 @@ -892,9 +892,9 @@ Public Class E141 : Implements IHttpHandler End Function - Private Function CreaFactura(ObjInventario As ClsInventarios, ObjClientes As ClsClientes, TipoDocto As String, Resp As Modelos.Factura.MMensajeFactura, JsonRequest As JObject, UsuarioActual As Usuario) As Modelos.Factura + Private Function CreaFactura(ObjInventario As ClsInventarios, ObjClientes As ClsClientes, TipoDocto As String, Resp As Modelos.Factura.MMensajeFactura, JsonRequest As JObject, UsuarioActual As Usuario) As Modelos.Factura Try - Resp.TieneError = False + Resp.TieneError = False Dim Serie As String = "-1" Dim CveMoneda As Integer = 1 @@ -914,52 +914,52 @@ Public Class E141 : Implements IHttpHandler If CveCliente <= 0 Then Return Nothing - End If - - Dim ObjFactura = New Modelos.Factura(UsuarioActual) - ObjFactura.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.TextoLimpio - ObjFactura.Serie = Serie - ObjFactura.Folio = -1 - ObjFactura.Version = "3.3" - ObjFactura.FolioFiscal = "" - ObjFactura.CveUsuario = UsuarioActual.CveUsuario - ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa - ObjFactura.TipoCambio = 1 - ObjFactura.ConvertirPesos = False - ObjFactura.CveMoneda = CveMoneda - ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", String.Format("CveMoneda = {0} ", CveMoneda)) - ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda)) - ObjFactura.TipoDocto = TipoDocto - ObjFactura.RefDocto = "" - ObjFactura.CveMesa = -1 - ObjFactura.Fecha = Now - ObjFactura.CvePrePoliza = -1 - ObjFactura.FechaPago = Now - ObjFactura.MotivoDescuento = "" - ObjFactura.FechaEjecucion = Now - ObjFactura.UsuarioCreo = UsuarioActual.Usuario - ObjFactura.CveCondicionEntrega = -1 - ObjFactura.CondicionEntrega = "" - ObjFactura.NumeroCuenta = "" - ObjFactura.CondicionesPago = 0 - ObjFactura.FormaPago = 0 - ObjFactura.PedidoContrato = "" - ObjFactura.NumeroContrato = "" - ObjFactura.DescripcionContrato = "" - ObjFactura.CveCorte = -1 - ObjFactura.TipoDocumento = ObjFactura.TipodeComprobante - ObjFactura.Alfa1 = "" - ObjFactura.Alfa2 = "" - ObjFactura.Alfa3 = "" - ObjFactura.CveContrato = -1 - ObjFactura.ConvertirPesos = False - ObjFactura.CveSubProyecto = CveSubProyecto - ObjFactura.CveSubProyectoCobranza = CveSubProyecto - ObjFactura.CveSubProyectoEjecucion = CveSubProyecto - ObjFactura.SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveEmpresa:=CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto))) - ObjFactura.SubProyectoMatriz = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1")) - - 'CLIENTE + End If + + Dim ObjFactura = New Modelos.Factura(UsuarioActual) + ObjFactura.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.TextoLimpio + ObjFactura.Serie = Serie + ObjFactura.Folio = -1 + ObjFactura.Version = "3.3" + ObjFactura.FolioFiscal = "" + ObjFactura.CveUsuario = UsuarioActual.CveUsuario + ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa + ObjFactura.TipoCambio = 1 + ObjFactura.ConvertirPesos = False + ObjFactura.CveMoneda = CveMoneda + ObjFactura.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", String.Format("CveMoneda = {0} ", CveMoneda)) + ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda)) + ObjFactura.TipoDocto = TipoDocto + ObjFactura.RefDocto = "" + ObjFactura.CveMesa = -1 + ObjFactura.Fecha = Now + ObjFactura.CvePrePoliza = -1 + ObjFactura.FechaPago = Now + ObjFactura.MotivoDescuento = "" + ObjFactura.FechaEjecucion = Now + ObjFactura.UsuarioCreo = UsuarioActual.Usuario + ObjFactura.CveCondicionEntrega = -1 + ObjFactura.CondicionEntrega = "" + ObjFactura.NumeroCuenta = "" + ObjFactura.CondicionesPago = 0 + ObjFactura.FormaPago = 0 + ObjFactura.PedidoContrato = "" + ObjFactura.NumeroContrato = "" + ObjFactura.DescripcionContrato = "" + ObjFactura.CveCorte = -1 + ObjFactura.TipoDocumento = ObjFactura.TipodeComprobante + ObjFactura.Alfa1 = "" + ObjFactura.Alfa2 = "" + ObjFactura.Alfa3 = "" + ObjFactura.CveContrato = -1 + ObjFactura.ConvertirPesos = False + ObjFactura.CveSubProyecto = CveSubProyecto + ObjFactura.CveSubProyectoCobranza = CveSubProyecto + ObjFactura.CveSubProyectoEjecucion = CveSubProyecto + ObjFactura.SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveEmpresa:=CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto))) + ObjFactura.SubProyectoMatriz = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1")) + + 'CLIENTE ObjFactura.CveCliente = CveCliente ObjFactura.CveClienteSucursal = -1 @@ -1147,24 +1147,24 @@ Public Class E141 : Implements IHttpHandler End If 'IMPORTES - Dim TotalImporte As Decimal = ObjFactura.DtDetalle.SUMD("TotalImporte") - Dim ImporteIVA As Decimal = ObjFactura.DtDetalle.SUMD("ImporteIVA") - Dim ImporteRetIVA As Decimal = ObjFactura.DtDetalle.SUMD("ImporteRetIVA") - Dim ImporteRetISR As Decimal = ObjFactura.DtDetalle.SUMD("ImporteRetISR") - Dim ImporteIEPS As Decimal = ObjFactura.DtDetalle.SUMD("ImporteIEPS") - Dim Descuento As Decimal = ObjFactura.DtDetalle.SUMD("Descuento") - Dim Amortizacion As Decimal = 0 - - Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion) - - ObjFactura.SubTotal = TotalImporte - ObjFactura.Descuento = Descuento - ObjFactura.Amortizacion = Amortizacion - ObjFactura.IVA = ImporteIVA - ObjFactura.RetIVA = ImporteRetIVA - ObjFactura.RetISR = ImporteRetISR - ObjFactura.IEPS = ImporteIEPS - ObjFactura.Total = Total + Dim TotalImporte As Decimal = ObjFactura.DtDetalle.SUMD("TotalImporte") + Dim ImporteIVA As Decimal = ObjFactura.DtDetalle.SUMD("ImporteIVA") + Dim ImporteRetIVA As Decimal = ObjFactura.DtDetalle.SUMD("ImporteRetIVA") + Dim ImporteRetISR As Decimal = ObjFactura.DtDetalle.SUMD("ImporteRetISR") + Dim ImporteIEPS As Decimal = ObjFactura.DtDetalle.SUMD("ImporteIEPS") + Dim Descuento As Decimal = ObjFactura.DtDetalle.SUMD("Descuento") + Dim Amortizacion As Decimal = 0 + + Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion) + + ObjFactura.SubTotal = TotalImporte + ObjFactura.Descuento = Descuento + ObjFactura.Amortizacion = Amortizacion + ObjFactura.IVA = ImporteIVA + ObjFactura.RetIVA = ImporteRetIVA + ObjFactura.RetISR = ImporteRetISR + ObjFactura.IEPS = ImporteIEPS + ObjFactura.Total = Total ObjFactura.TotalOtrosConceptos = 0 'SI HAY DIFERENCIA DE UN CENTAVO AJUSTA @@ -1200,224 +1200,224 @@ Public Class E141 : Implements IHttpHandler ObjFactura.Observaciones = "PEDIDO PROVENIENTE DE ECOMMERCE" ElseIf TipoDocto = "Cot" Then ObjFactura.Observaciones = "COTIZACION PROVENIENTE DE ECOMMERCE" - End If - - ObjFactura.OrdenCompra = "" - ObjFactura.PedidoContrato = "" + End If + + ObjFactura.OrdenCompra = "" + ObjFactura.PedidoContrato = "" ObjFactura.ObservacionesAlmacen = "" - ObjFactura.EnviarCorreo = False - - ObjFactura.Timbre = PreParaTimbre(ObjFactura) - ObjFactura.FemsaFactura = New Modelos.FemsaFactura() With { - .AplicaFEMSA = False, - .FEMSA_Version = 1 - } - Return ObjFactura - Catch ex As Exception - Resp.Mensajes.Add(ex.ToString()) - Return Nothing - End Try - - End Function - - Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre - Dim Timbre As New CFDITimbre - Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) - Timbre.Comprobante.Folio = Obj.Folio.ToString - Timbre.Comprobante.Serie = Obj.Serie - Timbre.Comprobante.Fecha = Obj.FechaCP - Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 - Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 - Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT - Timbre.Comprobante.Subtotal = Obj.SubTotal - Timbre.Comprobante.Descuentos = Obj.Descuento - Timbre.Comprobante.Moneda = Obj.MonedaSAT - Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) - Timbre.Comprobante.Total = Obj.Total - - Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP - Timbre.Comprobante.Confirmacion = "" - - Timbre.Receptor.RFC = Obj.Cliente.RFC - Timbre.Receptor.Nombre = Obj.Cliente.Nombre - Timbre.Receptor.ResidenciaFiscal = "" - Timbre.Receptor.NumeroRegistroTributario = "" - Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI - - - If Obj.CveTipoRelacion > 0 Then - Select Case Obj.CveTipoRelacion - Case 1 - Timbre.CFDIRelacionados.TipoRelacion = "01" - Timbre.CFDIRelacionados.TipoRelacionTexto = "01-Nota de Crédito aplicada a Ingreso" - Case 2 - Timbre.CFDIRelacionados.TipoRelacion = "02" - Timbre.CFDIRelacionados.TipoRelacionTexto = "02-Nota de débito de los documentos relacionados" - Case 3 - Timbre.CFDIRelacionados.TipoRelacion = "03" - Timbre.CFDIRelacionados.TipoRelacionTexto = "03-Devolución aplicada a Ingreso" - Case 4 - Timbre.CFDIRelacionados.TipoRelacion = "04" - Timbre.CFDIRelacionados.TipoRelacionTexto = "04-Refacturación de Ingreso" - Case 7 - Timbre.CFDIRelacionados.TipoRelacion = "07" - Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" - Case 8 - Timbre.CFDIRelacionados.TipoRelacion = "08" - Timbre.CFDIRelacionados.TipoRelacionTexto = "08-Factura generada por pagos en parcialidades " - Case 9 - Timbre.CFDIRelacionados.TipoRelacion = "09" - Timbre.CFDIRelacionados.TipoRelacionTexto = "09-Factura generada por pagos diferidos" - - End Select - - End If - - - Dim totSubTotal As Decimal = Obj.SubTotal - Dim totIVA As Decimal = Obj.IVA - Dim totRetIVA As Decimal = Obj.RetIVA - Dim totRetISR As Decimal = Obj.RetISR - Dim i As Integer = 1 - - 'DETALLES - Dim tPS As String = "" - - For Each drr As DataRow In Obj.DtDetalle.Rows - If drr("PS").ToString.Length = 1 Then - tPS = drr("Obs").ToString - Else - If drr("PS").ToString.Length = 0 Then - tPS = "" - Else - tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) - End If - End If - - 'CONDICIONANTE, ESPECIAL - If Obj.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO - - Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, - .Descripcion = tPS, - .ValorUnitario = drr("PU").ToString.ToDecimal, - .Importe = drr("TotalImporte").ToString.ToDecimal, - .Descuento = drr("Descuento").ToString.ToDecimal, - .Unidad = drr("UM").ToString, - .ClaveUnidad = drr("SATClaveUM").ToString, - .ClaveProdServ = drr("SATClaveProdServ").ToString, - .Noidentificacion = drr("Noidentificacion").ToString, - .CuentaPredial = drr("CuentaPredial").ToString} - 'VERIFICA SUMA SUBTOTALES - If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES - concepto.Importe = totSubTotal - End If - totSubTotal = totSubTotal - concepto.Importe - - 'SIEMPRE ESTAMOS AGREGANDO EL IVA - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) - - If drr("ImporteIEPS").ToString.ToDouble > 0 Then - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) - End If - - If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) - End If - - If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR - concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString.ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) - End If - - Timbre.Conceptos.Add(concepto) - i += 1 - Next - Return Timbre - End Function - Private Function CreaDTDetalle(ByRef ObjInventarios As ClsInventarios, ObjFactura As Modelos.Factura, ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, JsonRequest As JObject) As DataTable - Dim TmpDT = New DataTable - TmpDT.Columns.Add("CveVenta", GetType(Integer)) - TmpDT.Columns.Add("Consec", GetType(Integer)) - TmpDT.Columns.Add("Cantidad", GetType(Decimal)) - TmpDT.Columns.Add("Codigo", GetType(String)) - TmpDT.Columns.Add("CveUM", GetType(Integer)) - TmpDT.Columns.Add("UM", GetType(String)) - TmpDT.Columns.Add("SATClaveUM", GetType(String)) - TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) - TmpDT.Columns.Add("Clasificacion", GetType(String)) - TmpDT.Columns.Add("CvePS", GetType(Integer)) - TmpDT.Columns.Add("PS", GetType(String)) - TmpDT.Columns.Add("CodigoPS", GetType(String)) - TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) - TmpDT.Columns.Add("NoIdentificacion", GetType(String)) - TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) - TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("Serie", GetType(String)) - TmpDT.Columns.Add("CuentaPredial", GetType(String)) - TmpDT.Columns.Add("Obs", GetType(String)) - TmpDT.Columns.Add("TiempoEntrega", GetType(String)) - TmpDT.Columns.Add("PU", GetType(Decimal)) - TmpDT.Columns.Add("IVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) - TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) - TmpDT.Columns.Add("IEPS", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) - TmpDT.Columns.Add("Descuento", GetType(Decimal)) - TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) - TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) - TmpDT.Columns.Add("Total", GetType(Decimal)) - 'Para uso del módulo contable - TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) - TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) - TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) - TmpDT.Columns.Add("CveProyecto", GetType(Integer)) - TmpDT.Columns.Add("Proyecto", GetType(String)) - TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) - TmpDT.Columns.Add("SubProyecto", GetType(String)) - 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto - TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) - TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) - 'Contratos - TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) - 'Remisiones a Facturas - TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) - TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) - TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) - - 'Pedido2 a Facturas - TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) - - TmpDT.Columns.Add("Origen", GetType(Integer)) - 'Ordenes Servicio - TmpDT.Columns.Add("CveOS", GetType(Integer)) - TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) - TmpDT.Columns.Add("SeFacturara", GetType(Integer)) - TmpDT.Columns.Add("Folio", GetType(Integer)) - TmpDT.Columns.Add("Estatus", GetType(String)) - 'Ordenamiento - TmpDT.Columns.Add("Orden", GetType(Integer)) - TmpDT.Columns.Add("TipoDocto", GetType(String)) - 'OC - TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) - TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) - - TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) - TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) - TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) - - TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) - TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) - + ObjFactura.EnviarCorreo = False + + ObjFactura.Timbre = PreParaTimbre(ObjFactura) + ObjFactura.FemsaFactura = New Modelos.FemsaFactura() With { + .AplicaFEMSA = False, + .FEMSA_Version = 1 + } + Return ObjFactura + Catch ex As Exception + Resp.Mensajes.Add(ex.ToString()) + Return Nothing + End Try + + End Function + + Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre + Dim Timbre As New CFDITimbre + Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + Timbre.Comprobante.Folio = Obj.Folio.ToString + Timbre.Comprobante.Serie = Obj.Serie + Timbre.Comprobante.Fecha = Obj.FechaCP + Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 + Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 + Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT + Timbre.Comprobante.Subtotal = Obj.SubTotal + Timbre.Comprobante.Descuentos = Obj.Descuento + Timbre.Comprobante.Moneda = Obj.MonedaSAT + Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) + Timbre.Comprobante.Total = Obj.Total + + Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP + Timbre.Comprobante.Confirmacion = "" + + Timbre.Receptor.RFC = Obj.Cliente.RFC + Timbre.Receptor.Nombre = Obj.Cliente.Nombre + Timbre.Receptor.ResidenciaFiscal = "" + Timbre.Receptor.NumeroRegistroTributario = "" + Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI + + + If Obj.CveTipoRelacion > 0 Then + Select Case Obj.CveTipoRelacion + Case 1 + Timbre.CFDIRelacionados.TipoRelacion = "01" + Timbre.CFDIRelacionados.TipoRelacionTexto = "01-Nota de Crédito aplicada a Ingreso" + Case 2 + Timbre.CFDIRelacionados.TipoRelacion = "02" + Timbre.CFDIRelacionados.TipoRelacionTexto = "02-Nota de débito de los documentos relacionados" + Case 3 + Timbre.CFDIRelacionados.TipoRelacion = "03" + Timbre.CFDIRelacionados.TipoRelacionTexto = "03-Devolución aplicada a Ingreso" + Case 4 + Timbre.CFDIRelacionados.TipoRelacion = "04" + Timbre.CFDIRelacionados.TipoRelacionTexto = "04-Refacturación de Ingreso" + Case 7 + Timbre.CFDIRelacionados.TipoRelacion = "07" + Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" + Case 8 + Timbre.CFDIRelacionados.TipoRelacion = "08" + Timbre.CFDIRelacionados.TipoRelacionTexto = "08-Factura generada por pagos en parcialidades " + Case 9 + Timbre.CFDIRelacionados.TipoRelacion = "09" + Timbre.CFDIRelacionados.TipoRelacionTexto = "09-Factura generada por pagos diferidos" + + End Select + + End If + + + Dim totSubTotal As Decimal = Obj.SubTotal + Dim totIVA As Decimal = Obj.IVA + Dim totRetIVA As Decimal = Obj.RetIVA + Dim totRetISR As Decimal = Obj.RetISR + Dim i As Integer = 1 + + 'DETALLES + Dim tPS As String = "" + + For Each drr As DataRow In Obj.DtDetalle.Rows + If drr("PS").ToString.Length = 1 Then + tPS = drr("Obs").ToString + Else + If drr("PS").ToString.Length = 0 Then + tPS = "" + Else + tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) + End If + End If + + 'CONDICIONANTE, ESPECIAL + If Obj.CveEmpresa = 15 Then drr("UM") = "" 'LES COMENTAN QUE NO DEBE IR LA ETIQUETA DE LA UNIDAD EN EL PRODUCTO + + Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal, + .Descripcion = tPS, + .ValorUnitario = drr("PU").ToString.ToDecimal, + .Importe = drr("TotalImporte").ToString.ToDecimal, + .Descuento = drr("Descuento").ToString.ToDecimal, + .Unidad = drr("UM").ToString, + .ClaveUnidad = drr("SATClaveUM").ToString, + .ClaveProdServ = drr("SATClaveProdServ").ToString, + .Noidentificacion = drr("Noidentificacion").ToString, + .CuentaPredial = drr("CuentaPredial").ToString} + 'VERIFICA SUMA SUBTOTALES + If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'PROCESO DE AJUSTA DE DECIMALES + concepto.Importe = totSubTotal + End If + totSubTotal = totSubTotal - concepto.Importe + + 'SIEMPRE ESTAMOS AGREGANDO EL IVA + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) + + If drr("ImporteIEPS").ToString.ToDouble > 0 Then + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal}) + End If + + If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal}) + End If + + If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeRetISR").ToString.ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal}) + End If + + Timbre.Conceptos.Add(concepto) + i += 1 + Next + Return Timbre + End Function + Private Function CreaDTDetalle(ByRef ObjInventarios As ClsInventarios, ObjFactura As Modelos.Factura, ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, JsonRequest As JObject) As DataTable + Dim TmpDT = New DataTable + TmpDT.Columns.Add("CveVenta", GetType(Integer)) + TmpDT.Columns.Add("Consec", GetType(Integer)) + TmpDT.Columns.Add("Cantidad", GetType(Decimal)) + TmpDT.Columns.Add("Codigo", GetType(String)) + TmpDT.Columns.Add("CveUM", GetType(Integer)) + TmpDT.Columns.Add("UM", GetType(String)) + TmpDT.Columns.Add("SATClaveUM", GetType(String)) + TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) + TmpDT.Columns.Add("Clasificacion", GetType(String)) + TmpDT.Columns.Add("CvePS", GetType(Integer)) + TmpDT.Columns.Add("PS", GetType(String)) + TmpDT.Columns.Add("CodigoPS", GetType(String)) + TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) + TmpDT.Columns.Add("NoIdentificacion", GetType(String)) + TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) + TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) + TmpDT.Columns.Add("Serie", GetType(String)) + TmpDT.Columns.Add("CuentaPredial", GetType(String)) + TmpDT.Columns.Add("Obs", GetType(String)) + TmpDT.Columns.Add("TiempoEntrega", GetType(String)) + TmpDT.Columns.Add("PU", GetType(Decimal)) + TmpDT.Columns.Add("IVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) + TmpDT.Columns.Add("IEPS", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) + TmpDT.Columns.Add("Descuento", GetType(Decimal)) + TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) + TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) + TmpDT.Columns.Add("Total", GetType(Decimal)) + 'Para uso del módulo contable + TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) + TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) + TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) + TmpDT.Columns.Add("CveProyecto", GetType(Integer)) + TmpDT.Columns.Add("Proyecto", GetType(String)) + TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) + TmpDT.Columns.Add("SubProyecto", GetType(String)) + 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto + TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) + TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) + 'Contratos + TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) + 'Remisiones a Facturas + TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) + + 'Pedido2 a Facturas + TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) + + TmpDT.Columns.Add("Origen", GetType(Integer)) + 'Ordenes Servicio + TmpDT.Columns.Add("CveOS", GetType(Integer)) + TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) + TmpDT.Columns.Add("SeFacturara", GetType(Integer)) + TmpDT.Columns.Add("Folio", GetType(Integer)) + TmpDT.Columns.Add("Estatus", GetType(String)) + 'Ordenamiento + TmpDT.Columns.Add("Orden", GetType(Integer)) + TmpDT.Columns.Add("TipoDocto", GetType(String)) + 'OC + TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) + TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) + + TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) + TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) + + TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) + TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) + TmpDT.Columns.Add("CveTamaño", GetType(Integer)) - + Try Dim ListaPS = JArray.Parse(JsonRequest("details").ToString()) Dim DescuentoTotal As Decimal = JsonRequest("discount").ToString().ToDecimal() @@ -1490,142 +1490,142 @@ Public Class E141 : Implements IHttpHandler End If Consec += 1 - Next - + Next + Catch ex As Exception - Retorno.TieneError = True - Retorno.Mensajes.Add(ex.ToString()) + Retorno.TieneError = True + Retorno.Mensajes.Add(ex.ToString()) End Try If Retorno.TieneError = True Then TmpDT.Clear() TmpDT = Nothing - End If - - Return TmpDT - End Function - - Private Function AgregarProductoServicio(ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, TmpDT As DataTable, Consec As Integer, Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, - PU As Decimal, Descuento As Decimal, CveSubProyecto As Integer, - Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, - Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, - Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, - Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, - Optional ClienteRetIVA As Double = 0, Optional ClienteRetISR As Double = 0, Optional ClienteDesglosaIEPS As Boolean = True) As DataRow - - + End If + + Return TmpDT + End Function + + Private Function AgregarProductoServicio(ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, TmpDT As DataTable, Consec As Integer, Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, + PU As Decimal, Descuento As Decimal, CveSubProyecto As Integer, + Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, + Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, + Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, + Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, + Optional ClienteRetIVA As Double = 0, Optional ClienteRetISR As Double = 0, Optional ClienteDesglosaIEPS As Boolean = True) As DataRow + + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - If DrPS Is Nothing Then - Retorno.Mensajes.Add("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.") - Return Nothing - End If - - 'verifica si tiene ventaminima - If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDouble() > 0 Then - 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... - If Cantidad < DrPS("VentaMinima").ToString.ToDouble() Then - Retorno.Mensajes.Add("La cantidad es menor que la venta minima") - Return Nothing - End If - End If - - If (DrPS("SATClaveUnidadMedida").ToString = "" Or DrPS("SATClavePS").ToString = "") Then - 'VALIDA CLAVESAT - If DrPS("SATClavePS").ToString = "" Then - Retorno.Mensajes.Add(String.Format("{0}-{1}: Sin producto SAT
", DrPS("Codigo").ToString, DrPS("PS").ToString)) - Return Nothing - ElseIf DrPS("SATClaveUnidadMedida").ToString = "" Then - Retorno.Mensajes.Add(String.Format("{0}-{1}: Sin Unidad Medida SAT
", DrPS("Codigo").ToString, DrPS("PS").ToString)) - Return Nothing - End If - End If - - If Not ClienteDesglosaIEPS Then - If Not RegeneraIEPS Then - PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) - End If - DrPS("IEPSPorcentaje") = 0 - End If - - Dim Row As DataRow = Nothing - Dim TotalCalculableImpuestos As Decimal = 0 - PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos - Dim DrSubProyecto As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto).Rows(0) - - Row = TmpDT.NewRow() - Row("CveProyecto") = DrSubProyecto("CveProyecto").ToString().ToEntero() - Row("Proyecto") = DrSubProyecto("Proyecto").ToString() - Row("CveSubProyecto") = CveSubProyecto - Row("SubProyecto") = DrSubProyecto("SubProyecto").ToString() - Row("Serie") = Serie - Row("TiempoEntrega") = TiempoEntrega - Row("Orden") = TmpDT.Rows.Count + 1 - Row("Cantidad") = Cantidad - Row("CveUM") = CveUM - Row("UM") = UM - Row("CveClasificacion") = CveClasificacion - Row("Clasificacion") = Clasificacion - Row("CvePS") = CvePS - Row("Obs") = Obs - - TotalCalculableImpuestos = (Cantidad * PU) - Descuento - - Row("PU") = PU - Row("Codigo") = DrPS("Codigo") - Row("NoIdentificacion") = DrPS("Codigo") - Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") - Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") - Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") - Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") - Row("Consec") = Consec - - Row("PS") = DrPS("PS") - Row("CodigoPS") = DrPS("PSCodigo").ToString - Row("CveTipoPS") = DrPS("CveTipoPS") - Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") - Row("CveTamaño") = DrPS("CveTamaño") - - If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") - If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") - - If DrPS("IVA").ToString.Contiene("-1", "") Then - Row("PorcentajeIVA") = DrSubProyecto("IVA") - Else - Row("PorcentajeIVA") = DrPS("IVA") - End If - - Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, 2) - Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, 2) - Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, 2) - Row("PorcentajeRetIVA") = ClienteRetIVA - Row("PorcentajeRetISR") = ClienteRetISR - Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") - Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, 2) - Row("IEPS") = Row("ImporteIEPS") - Row("Descuento") = Math.Round(Descuento, 2) - Row("TipoDescuento") = "2" - - Row("Total") = Cantidad * PU - Row("TotalImporte") = Math.Round(Cantidad * PU, 2) - - Row("SATClaveProdServ") = DrPS("SATClavePS") - Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") - - Row("EntregaDirecta") = EntregaDirecta - 'Contratos - Row("CveContratoDetalle") = CveContratoDetalle - Row("CveVentaDetalle") = CveVentaDetalle - Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido - Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle - Row("CveVentaDetalleRemision") = CveVentaDetalleRemision - Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion - Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 - Row("CuentaPredial") = CuentaPredial - - 'RECARGAR GV - Return Row + If DrPS Is Nothing Then + Retorno.Mensajes.Add("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.") + Return Nothing + End If + + 'verifica si tiene ventaminima + If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDouble() > 0 Then + 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... + If Cantidad < DrPS("VentaMinima").ToString.ToDouble() Then + Retorno.Mensajes.Add("La cantidad es menor que la venta minima") + Return Nothing + End If + End If + + If (DrPS("SATClaveUnidadMedida").ToString = "" Or DrPS("SATClavePS").ToString = "") Then + 'VALIDA CLAVESAT + If DrPS("SATClavePS").ToString = "" Then + Retorno.Mensajes.Add(String.Format("{0}-{1}: Sin producto SAT
", DrPS("Codigo").ToString, DrPS("PS").ToString)) + Return Nothing + ElseIf DrPS("SATClaveUnidadMedida").ToString = "" Then + Retorno.Mensajes.Add(String.Format("{0}-{1}: Sin Unidad Medida SAT
", DrPS("Codigo").ToString, DrPS("PS").ToString)) + Return Nothing + End If + End If + + If Not ClienteDesglosaIEPS Then + If Not RegeneraIEPS Then + PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) + End If + DrPS("IEPSPorcentaje") = 0 + End If + + Dim Row As DataRow = Nothing + Dim TotalCalculableImpuestos As Decimal = 0 + PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos + Dim DrSubProyecto As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto).Rows(0) + + Row = TmpDT.NewRow() + Row("CveProyecto") = DrSubProyecto("CveProyecto").ToString().ToEntero() + Row("Proyecto") = DrSubProyecto("Proyecto").ToString() + Row("CveSubProyecto") = CveSubProyecto + Row("SubProyecto") = DrSubProyecto("SubProyecto").ToString() + Row("Serie") = Serie + Row("TiempoEntrega") = TiempoEntrega + Row("Orden") = TmpDT.Rows.Count + 1 + Row("Cantidad") = Cantidad + Row("CveUM") = CveUM + Row("UM") = UM + Row("CveClasificacion") = CveClasificacion + Row("Clasificacion") = Clasificacion + Row("CvePS") = CvePS + Row("Obs") = Obs + + TotalCalculableImpuestos = (Cantidad * PU) - Descuento + + Row("PU") = PU + Row("Codigo") = DrPS("Codigo") + Row("NoIdentificacion") = DrPS("Codigo") + Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") + Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") + Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") + Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") + Row("Consec") = Consec + + Row("PS") = DrPS("PS") + Row("CodigoPS") = DrPS("PSCodigo").ToString + Row("CveTipoPS") = DrPS("CveTipoPS") + Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") + Row("CveTamaño") = DrPS("CveTamaño") + + If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") + If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") + + If DrPS("IVA").ToString.Contiene("-1", "") Then + Row("PorcentajeIVA") = DrSubProyecto("IVA") + Else + Row("PorcentajeIVA") = DrPS("IVA") + End If + + Row("IVA") = Row("PorcentajeIVA") + Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, 2) + Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, 2) + Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, 2) + Row("PorcentajeRetIVA") = ClienteRetIVA + Row("PorcentajeRetISR") = ClienteRetISR + Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") + Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, 2) + Row("IEPS") = Row("ImporteIEPS") + Row("Descuento") = Math.Round(Descuento, 2) + Row("TipoDescuento") = "2" + + Row("Total") = Cantidad * PU + Row("TotalImporte") = Math.Round(Cantidad * PU, 2) + + Row("SATClaveProdServ") = DrPS("SATClavePS") + Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") + + Row("EntregaDirecta") = EntregaDirecta + 'Contratos + Row("CveContratoDetalle") = CveContratoDetalle + Row("CveVentaDetalle") = CveVentaDetalle + Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido + Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle + Row("CveVentaDetalleRemision") = CveVentaDetalleRemision + Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion + Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 + Row("CuentaPredial") = CuentaPredial + + 'RECARGAR GV + Return Row End Function #End Region @@ -2353,7 +2353,7 @@ Public Class E141 : Implements IHttpHandler #Region "D E S C A R G A - P D F" Private Function DescargarFactura(FilePDF As String) As Byte() - Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?TipoDocto=Ing&File={1}&TipoArchivo=PDF", "http://localhost/", FilePDF)) + Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?TipoDocto=Ing&File={3}&TipoArchivo=PDF", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, FilePDF)) Dim File As Byte() = Nothing Try Using httpClient = New HttpClient() diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index a00b2e162..117e521ea 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -175,9 +175,7 @@
- - - +
diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 31607cfd2..0064d146f 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -38,10 +38,10 @@ Partial Class Bancos_DepositosCaja End Sub Private Sub CargaCuentas() - DdlCuentaDeposito.DataSource = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta <> 1", "", {"CveCuenta", "NumCuentaMoneda"}) + DdlCuentaDeposito.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta <> 1", "", {"CveCuenta", "NumCuentaMoneda"}) DdlCuentaDeposito.DataBind() - DdlCajaChica.DataSource = GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta = 1", "", {"CveCuenta", "NumCuentaMoneda"}) + DdlCajaChica.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta = 1", "", {"CveCuenta", "NumCuentaMoneda"}) DdlCajaChica.DataBind() DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) diff --git a/Bancos/RepCortes.aspx b/Bancos/RepCortes.aspx index 3ccba8aaf..16ad5bcc7 100644 --- a/Bancos/RepCortes.aspx +++ b/Bancos/RepCortes.aspx @@ -231,7 +231,7 @@ - + @@ -240,7 +240,16 @@ - + + + + + + + + + + diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index e47ba73e7..bf069b542 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -8,10 +8,17 @@ Imports System.Collections.Generic Partial Class Bancos_RepCortes Inherits ClsPaginas - Private Shared missing As Object = System.Reflection.Missing.Value - + Private Shared missing As Object = System.Reflection.Missing.Value + #Region "PROPIEDADES" - + Private Property DtCortes As DataTable + Get + Return CType(ViewState("DtCortes"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCortes") = value + End Set + End Property Private Property DtCortesVentasResumen As DataTable Get Return CType(ViewState("DtCortesVentasResumen"), DataTable) @@ -67,16 +74,20 @@ Partial Class Bancos_RepCortes #Region " C A R G A - D A T O S " - Public Sub CargaDatos() - Dim ObjPuntoVenta As New ClsPuntoVenta + Public Sub CargaDatos() + Dim FechaI As Date = If(txtFechaVI.Text <> "", txtFechaVI.Text.ToDate, MinFecha) - Dim FechaF As Date = If(txtFechaVF.Text <> "", txtFechaVF.Text.ToDate, MaxFecha) + Dim FechaF As Date = If(txtFechaVF.Text <> "", txtFechaVF.Text.ToDate, MaxFecha) + + Dim ObjPuntoVenta As New ClsPuntoVenta If ObjPuntoVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaI, FechaF, DdlSubProyectos.SelectedValue.ToEntero) Then - GvDatos.DataSource = ObjPuntoVenta.DtResultados - GvDatos.DataBind() - UPDatos.Update() + DtCortes = ObjPuntoVenta.DtResultados.Copy() End If - ObjPuntoVenta.Dispose() + ObjPuntoVenta.Dispose() + + GvDatos.DataSource = DtCortes + GvDatos.DataBind() + UPDatos.Update() End Sub #End Region @@ -85,6 +96,9 @@ Partial Class Bancos_RepCortes If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CveCorte").ToString = "" Then e.Row.CssClass = "SubTotales2" + If DtCortes IsNot Nothing Then + e.Row.FCLiteral("LtlImporteInicial").Text = DtCortes.SUMD("ImporteInicial").FormatoNumero(2) + End If End If End If End Sub diff --git a/Bancos/RepCxCCliente.aspx b/Bancos/RepCxCCliente.aspx index 2e3cf4dae..283a6e5ba 100644 --- a/Bancos/RepCxCCliente.aspx +++ b/Bancos/RepCxCCliente.aspx @@ -156,7 +156,7 @@ - + @@ -164,8 +164,8 @@ - - + + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 15afe3ed3..6d6681b78 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -15074,7 +15074,10 @@ Partial Class Compras_Compras dr("CveVenta").ToString.ToEntero, dr("CveCompra").ToString.ToEntero, dr("CveSubProyecto").ToString.ToEntero, dr("CveCliente").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, dr("CvePersonal").ToString.ToEntero, If(cvemovimientoentrada > 0, cvemovimientoentrada, dr("CveMovimientoAlmacen").ToString.ToEntero), dr("CveActivoFijo").ToString.ToEntero, -1, -1, dr("CveCreditoDetalle").ToString.ToEntero, - ImporteMX:=dr("Importe").ToString.ToDecimal * -1, ImporteME:=dr("Importe").ToString.ToDecimal * -1, CveTipoGasto:=dr("CveTipoGasto").ToString.ToEntero, CveClasificacion:=dr("CveClasificacion").ToString.ToEntero, CveOCDetalle:=dr("CveOCDetalle").ToString.ToEntero) Then + ImporteMX:=dr("Importe").ToString.ToDecimal * -1, ImporteME:=dr("Importe").ToString.ToDecimal * -1, + CveTipoGasto:=dr("CveTipoGasto").ToString.ToEntero, CveClasificacion:=dr("CveClasificacion").ToString.ToEntero, + PorcentajeImpuesto:=dr("PorcentajeImpuesto").ToString.ToDecimal, + CveOCDetalle:=dr("CveOCDetalle").ToString.ToEntero) Then ErrorCancelar = True Exit For End If diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index d7547cfe2..6f0951149 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -268,7 +268,7 @@ Partial Class PopUpAuxiliar End If If Not TieneError Then - If IdPoliza > 0 Then + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso IdPoliza > 0 Then If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) ObjContPaq.IniciaTransacSQL() @@ -410,8 +410,9 @@ Partial Class PopUpAuxiliar RegistraScript(" $('#DivCancelar').modal('hide'); ") If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then If ObjContabilidad.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - Str.AppendFormat("Ver Poliza", ObjContabilidad.ContaIdPoliza) - + If UsuarioActual.Empresa.TipoContabilidad = 2 Then + Str.AppendFormat("Ver Poliza", ObjContabilidad.ContaIdPoliza) + End If End If End If Alert(Str.ToString) @@ -420,8 +421,6 @@ Partial Class PopUpAuxiliar End If - - ObjContabilidad.Dispose() CargaDatos() diff --git a/GPS/EmbarqueManifiesto.rdlc b/GPS/EmbarqueManifiesto.rdlc index 6a0389c5e..754974f82 100644 --- a/GPS/EmbarqueManifiesto.rdlc +++ b/GPS/EmbarqueManifiesto.rdlc @@ -37,6 +37,14 @@ Envase System.String + + ImpManifiesto + System.String + + + TipoTarima + System.String + Cultivo System.String @@ -68,16 +76,16 @@ - 2.45401cm + 2.59615cm - 2.30818cm + 2.45032cm - 1.99068cm + 2.13282cm - 2.2288cm + 2.37094cm @@ -505,9 +513,9 @@ 0.3175cm - 10.3553cm + 9.78675cm 3cm - 8.98167cm + 9.55023cm @@ -1146,7 +1154,7 @@ - 18.67696cm + 19.44425cm 3.27925cm 1.58833cm 14.27209cm @@ -4568,7 +4576,7 @@ @@ -6845,13 +6853,16 @@ 1.68042cm - 7.32708cm + 5.85895cm - 3.69064cm + 3.10853cm - 4.65604cm + 3.16148cm + + + 3.5448cm @@ -7011,6 +7022,57 @@ + + + + true + true + + + + + Tarima + + 2pt + + + Black + + 2pt + + + Black + + 2pt + + + Black + + 2pt + + + Black + + 2pt + + Silver + 2pt + 2pt + 2pt + 2pt + + + + @@ -7214,6 +7276,38 @@ + + + + true + true + + + + + =IIf(Fields!ImpManifiesto.Value.ToString() ="1",Fields!TipoTarima.Value.ToString() ,"") + + + + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -7287,6 +7381,11 @@ + + + =(MAX(Fields!ImpManifiesto.Value.ToString() )<>"1") + + @@ -7314,10 +7413,10 @@ - 8.07349in + 8.28054in @@ -162,7 +162,7 @@ - + diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb index cc89c411b..35ab16170 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -25,17 +25,13 @@ Partial Class MetasVendedores DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) DdlSubProyectoFiltro.DataBind() - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then - DdlMarcaFiltro.DataSource = ObjPS.DtResultados - End If - ObjPS.Dispose() + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlMarcaFiltro.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) DdlMarcaFiltro.DataBind() DdlMarcaFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso DdlVendedorFiltro.DataBind() DdlVendedorFiltro.Items.Insert(0, New ListItem("Todos", "-1")) @@ -79,9 +75,14 @@ Partial Class MetasVendedores Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCLabel("lblRealMesPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealMesPorcentaje").Text, "%") - e.Row.FCLabel("lblRealAcumuladoPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealAcumuladoPorcentaje").Text, "%") + e.Row.FCLabel("lblRealAcumuladoPorcentaje").Text = String.Format("{0}{1}", e.Row.FCLabel("lblRealAcumuladoPorcentaje").Text, "%") 'e.Row.FCLabel("lblVarVSAAPerc").Text = String.Format("{0}{1}", e.Row.FCLabel("lblVarVSAAPerc").Text, "%") + e.Row.FCHyperLink("HplRealMes").NavigateUrl = String.Format("/Ventas/MetasVendedoresDetalle.aspx?CveSubProyecto={0}&CveCategoria={1}&CveClasificacion={2}&CveCliente={3}&CveVendedor={4}&Fecha={5}&Grupo={6}&CveMarca={7}&EsGarantia={8}&EsDistribuidor={9}&CveClasificacion2={10}", + e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveCategoria"), e.Row.DBCampo("CveClasificacion"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveVendedor"), + e.Row.DBCampo("Fecha"), e.Row.DBCampo("Grupo"), e.Row.DBCampo("CveMarca"), e.Row.DBCampo("EsGarantia"), e.Row.DBCampo("EsDistribuidor"), e.Row.DBCampo("CveClasificacion2")) + + Select Case e.Row.DBCampo("TipoFila") Case "1" e.Row.CssClass = "Totales" diff --git a/Ventas/MetasVendedoresDetalle.aspx b/Ventas/MetasVendedoresDetalle.aspx new file mode 100644 index 000000000..ee904526a --- /dev/null +++ b/Ventas/MetasVendedoresDetalle.aspx @@ -0,0 +1,179 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="MetasVendedoresDetalle.aspx.vb" Inherits="MetasVendedoresDetalle" %> + + + + + + + + + + Scorecard Ventas + + +
  • + PDF +
  • +
  • + Excel +
  • +
    + + + +
    +
    +
    + + "> + +
    +
    +
    +
    Fecha del mes:
    +
    +
    + + + + +
    + + +
    + +
    Sucursal:
    +
    + +
    + +
    + + + + + +
    +
    +
    +
    +
    > +
    + +
    + +
    + + +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    + +
    + + + + + +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + diff --git a/Ventas/MetasVendedoresDetalle.aspx.vb b/Ventas/MetasVendedoresDetalle.aspx.vb new file mode 100644 index 000000000..31e695dc4 --- /dev/null +++ b/Ventas/MetasVendedoresDetalle.aspx.vb @@ -0,0 +1,120 @@ +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class MetasVendedoresDetalle + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaDatosFiltros() + + End If + End Sub + Private Sub CargaDatosFiltros() + + TxtFechaMes.Text = IfNull(Request("Fecha"), "2000/01/01").ToString + + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) + DdlSubProyectoFiltro.DataBind() + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlMarcaFiltro.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) + DdlMarcaFiltro.DataBind() + DdlMarcaFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso + DdlVendedorFiltro.DataBind() + DdlVendedorFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlCategoria.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa) + DdlCategoria.DataBind() + DdlCategoria.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1) + DdlClasificaciones.DataBind() + DdlClasificaciones.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) + DdlClasificacion2.DataBind() + DdlClasificacion2.Items.Insert(0, New ListItem("Todos", "-1")) + + + DdlSubProyectoFiltro.SelectedValueExist(IfNull(Request("CveSubProyecto"), "-1").ToString) + DdlMarcaFiltro.SelectedValueExist(IfNull(Request("CveMarca"), "-1").ToString) + DdlVendedorFiltro.SelectedValueExist(IfNull(Request("CveVendedor"), "-1").ToString) + DdlCategoria.SelectedValueExist(IfNull(Request("CveCategoria"), "-1").ToString) + DdlClasificaciones.SelectedValueExist(IfNull(Request("CveClasificacion"), "-1").ToString) + DdlClasificacion2.SelectedValueExist(IfNull(Request("CveClasificacion2"), "-1").ToString) + CargarDatos() + + End Sub + + Private Sub CargarDatos() + Dim CveCliente As Integer = -1 + If DdlClientes.SelectedValue.ToEntero > 0 Then + CveCliente = DdlClientes.SelectedValue.ToEntero + End If + + Dim ObjVentas As New ClsVentas + If ObjVentas.GetRepMetasVendedoresDetalle(TxtFechaMes.Text, UsuarioActual.CveEmpresa, DdlVendedorFiltro.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero, + DdlClasificaciones.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, DdlMarcaFiltro.SelectedValue.ToEntero, + DdlSubProyectoFiltro.SelectedValue.ToEntero, CveCliente, DdlDistribuidor.SelectedValue.ToEntero, DdlGrupo.SelectedValue.ToEntero) Then + GV.DataSource = ObjVentas.DtResultados + + End If + ObjVentas.Dispose() + GV.DataBind() + End Sub + + Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click + CargarDatos() + UPDatos.Update() + End Sub + + + + 'Protected Sub LnkPDF_RowDataBound(sender As Object, e As EventArgs) Handles LnkPDF.Click + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + ' Dim params As New List(Of ReportParameter) + ' params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + ' If Imagen.Exists Then + ' params.Add(New ReportParameter("pImg", logouri)) + ' Else + ' params.Add(New ReportParameter("pImg", "")) + ' End If + ' params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + ' params.Add(New ReportParameter("FechaImpresion", Today)) + ' params.Add(New ReportParameter("SubProyecto", DdlSubProyectoFiltro.SelectedItem.ToString)) + ' params.Add(New ReportParameter("Agente", DdlVendedorFiltro.SelectedItem.ToString)) + + ' ImprimirPDF("Empresas/Grales/Formatos/MetasVendedores.rdlc", DtDatos, params, "Rep. Metas por vendedores", "PDF", RDSName:="DataSet1") + 'End Sub + + 'Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + ' Dim params As New List(Of ReportParameter) + ' params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + ' If Imagen.Exists Then + ' params.Add(New ReportParameter("pImg", logouri)) + ' Else + ' params.Add(New ReportParameter("pImg", "")) + ' End If + ' params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + ' params.Add(New ReportParameter("FechaImpresion", Today)) + ' params.Add(New ReportParameter("SubProyecto", DdlSubProyectoFiltro.SelectedItem.ToString)) + ' params.Add(New ReportParameter("Agente", DdlVendedorFiltro.SelectedItem.ToString)) + + ' ImprimirPDF("Empresas/Grales/Formatos/MetasVendedores.rdlc", DtDatos, params, "Rep. Metas por vendedores", "Excel", RDSName:="DataSet1") + 'End Sub + + Private Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCategoria.SelectedIndexChanged + DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveCategoria:=DdlCategoria.SelectedValue.ToEntero, UsoClasificacion:=1) + DdlClasificaciones.DataBind() + DdlClasificaciones.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub +End Class diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 6c0c86cb9..9789de574 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -3284,10 +3284,10 @@ Partial Class PV Exit Sub End If - If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ChkServicioDomicilio.Checked AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) <= 0 Then - Alert("Debe tener producto seleccionados para servicio a domicilio.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + 'If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ChkServicioDomicilio.Checked AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) <= 0 Then + ' Alert("Debe tener producto seleccionados para servicio a domicilio.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ChkServicioDomicilio.Checked AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then For Each GvRow As GridViewRow In GvInv.Rows @@ -4393,7 +4393,7 @@ Partial Class PV End If Else If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then - Descuento = PU * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero) + Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)).RoundSQL(2) End If End If diff --git a/Ventas/PopUpBuscarClientes.aspx.vb b/Ventas/PopUpBuscarClientes.aspx.vb index a65d2da95..fa8690108 100644 --- a/Ventas/PopUpBuscarClientes.aspx.vb +++ b/Ventas/PopUpBuscarClientes.aspx.vb @@ -133,7 +133,7 @@ Partial Class PopUpBuscarClientes End If e.Row.FCLiteral("LtlCodigo").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Codigo")) - e.Row.FCLiteral("LtlNombre").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Nombre")) + e.Row.FCLiteral("LtlNombre").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("NombreComercial")) e.Row.FCLiteral("LtlRFC").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("RFC")) e.Row.FCLiteral("LtlDireccion").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Direccion")) e.Row.FCLiteral("LtlCiudad").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Ciudad")) diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index e30f76935..bdc26edb0 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -170,7 +170,7 @@ Partial Class PopUpBuscarFolio e.Row.FCLiteral("LtlTipo").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("TipoDocto")) e.Row.FCLiteral("LtlFolio").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Folio")) e.Row.FCLiteral("LtlFecha").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Fecha").ToDate.ToShortDateString) - e.Row.FCLiteral("LtlNombre").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Nombre")) + e.Row.FCLiteral("LtlNombre").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("NombreComercial")) 'e.Row.FCLiteral("LtlSubTotal").Text = Liga & e.Row.DBCampo("SubTotal").FormatoNumero & " " e.Row.FCLiteral("LtlTotal").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Total").FormatoNumero) e.Row.FCLiteral("LtlMon").Text = String.Format("
    {0}{1}
    ", Liga, e.Row.DBCampo("Abreviatura")) diff --git a/Ventas/RepProductosServicios.aspx.vb b/Ventas/RepProductosServicios.aspx.vb index 15738fd9a..e67546281 100644 --- a/Ventas/RepProductosServicios.aspx.vb +++ b/Ventas/RepProductosServicios.aspx.vb @@ -6,10 +6,10 @@ Imports Microsoft.Reporting.WebForms Imports System.Data Partial Class Ventas_RepProductosServicios - Inherits ClsPaginas - + Inherits ClsPaginas + #Region "PROPIEDADES" - + Private Property DtVentas As DataTable Get Return DirectCast(ViewState("DtVentas"), DataTable) @@ -52,24 +52,24 @@ Partial Class Ventas_RepProductosServicios Set(value As Integer) ViewState("TipoCambio") = 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 If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx") CargarMarcas() - SetValues() - - - + SetValues() + + + End If - End Sub - - + End Sub + + #Region " CARGA DATOS INICIALES " - + Private Sub CargaGrupo() DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) DdlGrupo.Items.Insert(1, New ListItem("Clasificación", "4")) @@ -89,7 +89,7 @@ Partial Class Ventas_RepProductosServicios DdlGrupo.Items.Insert(15, New ListItem("Cliente - PS", "20")) DdlGrupo.Items.Insert(16, New ListItem("Sucursal - PS", "21")) DdlGrupo.Items.Insert(17, New ListItem("Familia - Marca - Tipo", "22")) - DdlGrupo.Items.Insert(18, New ListItem("Tipo Cliente", "23")) + DdlGrupo.Items.Insert(18, New ListItem("Tipo Cliente", "23")) DdlGrupo.Items.Insert(18, New ListItem("Marca", "24")) DdlGrupo.Items.Insert(18, New ListItem("Cliente Sucursal", "26")) @@ -168,24 +168,24 @@ Partial Class Ventas_RepProductosServicios 'Cargo Clasificaciones DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacion.DataBind() - - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - DvLitraje.Visible = True - 'garantia - divgarantia1.Visible = True - divgarantia2.Visible = True - divdistribuidor1.Visible = True - divdistribuidor2.Visible = True - - DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) - DdlClasificacion2.DataBind() - divClasif2texto.Visible = True - divClasif2.Visible = True - - DdlGrupo.Items.Add(New ListItem("Clasificacion2", "25")) - - End If + DdlClasificacion.DataBind() + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DvLitraje.Visible = True + 'garantia + divgarantia1.Visible = True + divgarantia2.Visible = True + divdistribuidor1.Visible = True + divdistribuidor2.Visible = True + + DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) + DdlClasificacion2.DataBind() + divClasif2texto.Visible = True + divClasif2.Visible = True + + DdlGrupo.Items.Add(New ListItem("Clasificacion2", "25")) + + End If @@ -196,7 +196,7 @@ Partial Class Ventas_RepProductosServicios DdlSubProyectoEjecucion.DataBind() 'Vendedor - DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso DdlVendedor.DataBind() 'CargaUsuarios @@ -259,21 +259,28 @@ Partial Class Ventas_RepProductosServicios DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) DdlClientes.DataBind() DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) - End If - + End If + If UsuarioActual.CveVendedor > 0 AndAlso Not UsuarioActual.TienePermisoProceso(263) Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) DdlVendedor.Attributes.Add("disabled", "disabled") DdlVendedor.Enabled = False - End If - + End If + txtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString txtFechaF.Text = Now.ToShortDateString - - End Sub + + If UsuarioActual.TienePermisoProceso(339) Then + GvDatos.Columns(2).Visible = False + GvDatos.Columns(3).Visible = False + GvDatos.Columns(4).Visible = False + GvDatos.Columns(5).Visible = False + End If + + End Sub #End Region - - + + #Region " CARGA DATOS " Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click CargaDatos() @@ -300,7 +307,7 @@ Partial Class Ventas_RepProductosServicios DdlPS.SelectedValue.ToEntero, FechaI, FechaF, FechaIEjec, FechaFEjec, CveCliente, DdlSubProyectoEjecucion.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, "-1", UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:=TipoComprobante, - CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico, CveProveedorCompra:=CveProveedorCompra, + CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico, CveProveedorCompra:=CveProveedorCompra, CveMarca:=DdlMarcaPSDes.SelectedValue.ToEntero, MostrarLitraje:=ChkLitraje.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, EsGarantia:=DdlGarantia.SelectedValue.ToEntero, ModalidadContable:=ModalidadContable, CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero, EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero, CveClasificacion2:=DdlClasificacion2.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjVentas.DtResultados @@ -324,55 +331,55 @@ Partial Class Ventas_RepProductosServicios DivMarca.Visible = True LblMarca.Visible = True - Using ObjMarcas As New ClsProductosServicios - If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then - DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados - DdlMarcaPSDes.DataBind() - End If + Using ObjMarcas As New ClsProductosServicios + If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then + DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados + DdlMarcaPSDes.DataBind() + End If End Using End If DdlMarcaPSDes.Items.Insert(0, New ListItem(" Todos ", "-1")) - End Sub + End Sub #End Region - - + + #Region " GV DATOS - PERSONALIZAR " Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim Css As String = "Texto" Dim CveClasificacionDetalle As String = "-1" Dim cveMarca As String = DdlMarcaPSDes.SelectedValue - If DdlGrupo.SelectedValue.ToEntero = 22 Then - Dim tipo As Integer = If(e.Row.DBCampo("CveClasificacionDetalle").ToEntero() > 0, 4, If(e.Row.DBCampo("CveMarca").ToEntero() > 0, 3, If(e.Row.DBCampo("CveClasificacion").ToEntero() > 0, 2, 1))) - Select Case tipo - Case 4 - CveClasificacionDetalle = e.Row.DBCampo("CveClasificacionDetalle").ToString() ' String.Format("{0}&CveClasificacionDetalle={1}&CveMarca={2}", squery, e.Row.DBCampo("CveClasificacionDetalle").ToEntero(), e.Row.DBCampo("CveMarca").ToEntero()) - cveMarca = e.Row.DBCampo("CveMarca").ToString() - Case 3 - 'squery = String.Format("{0}&CveMarca{1}", squery, e.Row.DBCampo("CveMarca").ToEntero()) - cveMarca = e.Row.DBCampo("CveMarca").ToString() - e.Row.CssClass = "SubTotalesB" - Case 2 - e.Row.CssClass = "SubTotales" - Case 1 - e.Row.CssClass = "Totales" - End Select - - Else - If e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(0).Width = Unit.Pixel(200) - e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(1).Width = Unit.Pixel(60) - e.Row.Cells(2).Width = Unit.Pixel(90) - e.Row.Cells(3).Width = Unit.Pixel(90) - e.Row.Cells(5).Width = Unit.Pixel(80) - e.Row.Cells(8).Width = Unit.Pixel(100) - e.Row.CssClass = "Totales" - Css = "Totales" - ElseIf DdlGrupo.SelectedValue.Contiene("20", "21") And Not e.Row.DBCampo("CvePS").ToEntero > 0 Then - e.Row.CssClass = "SubTotales" - End If + If DdlGrupo.SelectedValue.ToEntero = 22 Then + Dim tipo As Integer = If(e.Row.DBCampo("CveClasificacionDetalle").ToEntero() > 0, 4, If(e.Row.DBCampo("CveMarca").ToEntero() > 0, 3, If(e.Row.DBCampo("CveClasificacion").ToEntero() > 0, 2, 1))) + Select Case tipo + Case 4 + CveClasificacionDetalle = e.Row.DBCampo("CveClasificacionDetalle").ToString() ' String.Format("{0}&CveClasificacionDetalle={1}&CveMarca={2}", squery, e.Row.DBCampo("CveClasificacionDetalle").ToEntero(), e.Row.DBCampo("CveMarca").ToEntero()) + cveMarca = e.Row.DBCampo("CveMarca").ToString() + Case 3 + 'squery = String.Format("{0}&CveMarca{1}", squery, e.Row.DBCampo("CveMarca").ToEntero()) + cveMarca = e.Row.DBCampo("CveMarca").ToString() + e.Row.CssClass = "SubTotalesB" + Case 2 + e.Row.CssClass = "SubTotales" + Case 1 + e.Row.CssClass = "Totales" + End Select + + Else + If e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center + e.Row.Cells(0).Width = Unit.Pixel(200) + e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center + e.Row.Cells(1).Width = Unit.Pixel(60) + e.Row.Cells(2).Width = Unit.Pixel(90) + e.Row.Cells(3).Width = Unit.Pixel(90) + e.Row.Cells(5).Width = Unit.Pixel(80) + e.Row.Cells(8).Width = Unit.Pixel(100) + e.Row.CssClass = "Totales" + Css = "Totales" + ElseIf DdlGrupo.SelectedValue.Contiene("20", "21") And Not e.Row.DBCampo("CvePS").ToEntero > 0 Then + e.Row.CssClass = "SubTotales" + End If End If ' PARA LIGA @@ -382,13 +389,13 @@ Partial Class Ventas_RepProductosServicios FechaIEjec = If(IsDate(TxtFechaIEjec.Text.Trim()), TxtFechaIEjec.Text.Trim(), "-1") FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.Trim(), "-1") - Dim Liga = String.Format("/Ventas/RepProductosServiciosDetalle.aspx?CveProyecto={0}&CveSubProyecto={1}&CveCategoria={2}&CveClasificacion={3}&CvePS={4}&CveCliente={5}&CveSubProyectoEjecucion={6}&CveVendedor={7}&CveUsuario={8}&CveEstatus={9}&Anio={10}&Mes={11}&AnioMes={12}&Fecha={13}&AnioEjec={14}&MesEjec={15}&AnioMesEjec={16}&FechaEjec={17}&FechaI={18}&FechaF={19}&FechaEI={20}&FechaEF={21}&TipoDocto={22}&Grupo={23}&CveMoneda={24}&TipoCambio={25}&TCEspecifico={26}&CveClienteClasificacion={27}&CveProveedorCompra={28}&CveMarca={29}&CveClasificacionDetalle={30}&TipoCliente={31}&ModalidadContable={32}&EsGarantia={33}&CveCondicionesPago={34}&MostrarLitraje={35}&EsDistribuidor={36}&CveClienteSucursal={37}", + Dim Liga = String.Format("/Ventas/RepProductosServiciosDetalle.aspx?CveProyecto={0}&CveSubProyecto={1}&CveCategoria={2}&CveClasificacion={3}&CvePS={4}&CveCliente={5}&CveSubProyectoEjecucion={6}&CveVendedor={7}&CveUsuario={8}&CveEstatus={9}&Anio={10}&Mes={11}&AnioMes={12}&Fecha={13}&AnioEjec={14}&MesEjec={15}&AnioMesEjec={16}&FechaEjec={17}&FechaI={18}&FechaF={19}&FechaEI={20}&FechaEF={21}&TipoDocto={22}&Grupo={23}&CveMoneda={24}&TipoCambio={25}&TCEspecifico={26}&CveClienteClasificacion={27}&CveProveedorCompra={28}&CveMarca={29}&CveClasificacionDetalle={30}&TipoCliente={31}&ModalidadContable={32}&EsGarantia={33}&CveCondicionesPago={34}&MostrarLitraje={35}&EsDistribuidor={36}&CveClienteSucursal={37}&CveClasificacion2={38}", e.Row.DBCampo("CveProyecto"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveCategoria"), e.Row.DBCampo("CveClasificacion"), e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyectoEjecucion"), e.Row.DBCampo("Vendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("AnioEjec"), e.Row.DBCampo("MesEjec"), e.Row.DBCampo("AnioMesEjec"), e.Row.DBCampo("FechaEjec"), - FechaI, FechaF, FechaIEjec, FechaFEjec, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveGpo"), e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveClienteClasificacion"), e.Row.DBCampo("CveProveedorCompra"), cveMarca, + FechaI, FechaF, FechaIEjec, FechaFEjec, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveGpo"), e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveClienteClasificacion"), e.Row.DBCampo("CveProveedorCompra"), cveMarca, CveClasificacionDetalle, If(DdlGrupo.SelectedValue.ToEntero = 23, e.Row.DBCampo("TipoCliente"), DdlTipoCliente.SelectedValue), If(Not ChkLecturaAdmin.Checked, 1, 0), - e.Row.DBCampo("EsGarantia"), e.Row.DBCampo("CveCondicionesPago"), IIf(e.Row.DBCampo("MostrarLitraje") = "True", 1, 0), e.Row.DBCampo("EsDistribuidor"), e.Row.DBCampo("CveClienteSucursal").ToString.ToEntero) + e.Row.DBCampo("EsGarantia"), e.Row.DBCampo("CveCondicionesPago"), IIf(e.Row.DBCampo("MostrarLitraje") = "True", 1, 0), e.Row.DBCampo("EsDistribuidor"), e.Row.DBCampo("CveClienteSucursal").ToString.ToEntero, DdlClasificacion2.SelectedValue) e.Row.FCLiteral("LtlGrupo").Text = String.Format("{2}", Css, Liga, e.Row.DBCampo("Gpo")) @@ -437,10 +444,10 @@ Partial Class Ventas_RepProductosServicios End If UPDatos.Update() - End Sub + End Sub #End Region - - + + #Region " SELECTED INDEX CHANGED" Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) CargaClientes() @@ -492,8 +499,8 @@ Partial Class Ventas_RepProductosServicios If DdlTipoComprobante.SelectedValue <> "-1" Then DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(String.Format("TipoDocto = '{0}'", DdlTipoComprobante.SelectedValue)) Else - DdlEstatus.DataSource = GlobalDTEstatusFactura - + DdlEstatus.DataSource = GlobalDTEstatusFactura + End If DdlEstatus.Items.Add(New ListItem("Todos", "-1")) DdlEstatus.DataBind() @@ -511,10 +518,10 @@ Partial Class Ventas_RepProductosServicios LiEspecifico.Visible = False End If UpBodyTipoCambio.Update() - End Sub + End Sub #End Region - - + + #Region " IMPRIMIR " Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click If GvDatos.Rows.Count > 0 Then @@ -531,21 +538,21 @@ Partial Class Ventas_RepProductosServicios FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) FechaIEjec = If(IsDate(TxtFechaIEjec.Text.Trim()), TxtFechaIEjec.Text.ToDate, MinFecha) - FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.ToDate, MaxFecha) - - Dim Cliente = If(DdlClientes.SelectedText = "", "", $" Cliente: {DdlClientes.SelectedText}") - Dim Proveedor = If(DdlProveedor.SelectedValue = "", "", $" Proveedor: {DdlProveedor.SelectedText}") - Dim FechaInicio = If(txtFechaI.Text = "", "", $" Fecha Inicio: {txtFechaI.Text}") - Dim FechaFin = If(txtFechaF.Text = "", "", $" Fecha Fin: {txtFechaF.Text}") - Dim Grupo = If(DdlGrupo.SelectedValue = "-1", "", $" Agrupado por: {DdlGrupo.SelectedItem.Text}") - Dim Categoria = If(DdlCategoria.SelectedValue = "-1", "", $" Categoria: {DdlCategoria.SelectedItem.Text }") - Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $" Clasificación: {DdlClasificacion.SelectedItem.Text}") - Dim PS = If(DdlPS.SelectedValue = "-1", "", $" P.S.: {DdlPS.SelectedText}") - Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $" Proyecto: {DdlSubProyecto.SelectedItem.Text}") - Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $" Estatus: {DdlEstatus.SelectedItem.Text}") - Dim Usuario = If(DdlUsuario.SelectedValue = "-1", "", $" Usuario: {DdlUsuario.SelectedItem.Text}") - - + FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.ToDate, MaxFecha) + + Dim Cliente = If(DdlClientes.SelectedText = "", "", $" Cliente: {DdlClientes.SelectedText}") + Dim Proveedor = If(DdlProveedor.SelectedValue = "", "", $" Proveedor: {DdlProveedor.SelectedText}") + Dim FechaInicio = If(txtFechaI.Text = "", "", $" Fecha Inicio: {txtFechaI.Text}") + Dim FechaFin = If(txtFechaF.Text = "", "", $" Fecha Fin: {txtFechaF.Text}") + Dim Grupo = If(DdlGrupo.SelectedValue = "-1", "", $" Agrupado por: {DdlGrupo.SelectedItem.Text}") + Dim Categoria = If(DdlCategoria.SelectedValue = "-1", "", $" Categoria: {DdlCategoria.SelectedItem.Text }") + Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $" Clasificación: {DdlClasificacion.SelectedItem.Text}") + Dim PS = If(DdlPS.SelectedValue = "-1", "", $" P.S.: {DdlPS.SelectedText}") + Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $" Proyecto: {DdlSubProyecto.SelectedItem.Text}") + Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $" Estatus: {DdlEstatus.SelectedItem.Text}") + Dim Usuario = If(DdlUsuario.SelectedValue = "-1", "", $" Usuario: {DdlUsuario.SelectedItem.Text}") + + If DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) @@ -555,7 +562,7 @@ Partial Class Ventas_RepProductosServicios params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, ""))) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("Filtros", $"{Grupo}{Cliente}{FechaInicio}{FechaFin}{Categoria}{Clasificacion}{PS}{Proyecto}{Estatus}{Usuario}{Proveedor}")) If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", logouri)) @@ -567,12 +574,12 @@ Partial Class Ventas_RepProductosServicios Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia) End If - End Sub - + End Sub + #End Region - + #Region "GRAFICA" - + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) If Not DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia) @@ -704,9 +711,9 @@ Partial Class Ventas_RepProductosServicios Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs) CambioGrafica() - End Sub - + End Sub + #End Region - - + + End Class diff --git a/Ventas/RepProductosServiciosDetalle.aspx b/Ventas/RepProductosServiciosDetalle.aspx index 4c6e65d4d..2059dceab 100644 --- a/Ventas/RepProductosServiciosDetalle.aspx +++ b/Ventas/RepProductosServiciosDetalle.aspx @@ -364,6 +364,12 @@
    + +
    + + + +
    diff --git a/Ventas/RepProductosServiciosDetalle.aspx.vb b/Ventas/RepProductosServiciosDetalle.aspx.vb index 9d3a6d8d7..9ad955a34 100644 --- a/Ventas/RepProductosServiciosDetalle.aspx.vb +++ b/Ventas/RepProductosServiciosDetalle.aspx.vb @@ -239,8 +239,6 @@ Partial Class Ventas_RepProductosServiciosDetalle DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If - - 'CargaEstatus DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(" CveEstatusFactura NOT IN (1, 4, 5) ") DdlEstatus.DataBind() @@ -256,8 +254,6 @@ Partial Class Ventas_RepProductosServiciosDetalle DdlClienteClasificacion.DataBind() DdlClienteClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) - - If UsuarioActual.CveEmpresa.Contiene(141) Then DivDdlTipo.Visible = True lblDdlTipoPSDes.Visible = True @@ -274,6 +270,14 @@ Partial Class Ventas_RepProductosServiciosDetalle TCEspecifico = 0 TipoCambio = 1 + If UsuarioActual.TienePermisoProceso(339) Then + GvDatos.Columns(10).Visible = False + GvDatos.Columns(11).Visible = False + GvDatos.Columns(12).Visible = False + GvDatos.Columns(13).Visible = False + GvDatos.Columns(14).Visible = False + End If + End Sub Private Sub CargaSucursales(CveCliente As Integer, CveClienteSucursal As Integer) @@ -309,7 +313,7 @@ Partial Class Ventas_RepProductosServiciosDetalle End Sub Private Sub CargaParametrosDetalle() - Dim CveProyecto, CveSubProyecto, CveCategoria, CveClasificacion, CvePS, FechaI, FechaF, FechaIEjec, FechaFEjec, CveSubProyectoEjecucion, CveEstatus, CveUsuario, Anio, Mes, AnioMes, Fecha, AnioEjec, MesEjec, AnioMesEjec, FechaEjec, GPO, TipoDocto, CveClienteClasificacion As String + Dim CveProyecto, CveSubProyecto, CveCategoria, CveClasificacion, CveClasificacion2, CvePS, FechaI, FechaF, FechaIEjec, FechaFEjec, CveSubProyectoEjecucion, CveEstatus, CveUsuario, Anio, Mes, AnioMes, Fecha, AnioEjec, MesEjec, AnioMesEjec, FechaEjec, GPO, TipoDocto, CveClienteClasificacion As String Dim CveCliente As Integer = -1 Dim CveProveedorCompra As Integer = -1 Dim CveVendedor As Integer @@ -325,6 +329,7 @@ Partial Class Ventas_RepProductosServiciosDetalle CveCategoria = If(Request("CveCategoria") IsNot Nothing AndAlso Request("CveCategoria").ToEntero() > 0, Request("CveCategoria").ToEntero(), -1).ToString CveClasificacion = If(Request("CveClasificacion") IsNot Nothing AndAlso Request("CveClasificacion").ToEntero() > 0, Request("CveClasificacion").ToEntero(), -1).ToString CvePS = If(Request("CvePS") IsNot Nothing AndAlso Request("CvePS").ToEntero() > 0, Request("CvePS").ToEntero(), -1).ToString + CveClasificacion2 = If(Request("CveClasificacion2") IsNot Nothing AndAlso Request("CveClasificacion2").ToEntero() > 0, Request("CveClasificacion2").ToEntero(), -1).ToString Anio = If(Request("Anio") IsNot Nothing AndAlso Request("Anio").ToEntero() > 0, Request("Anio").ToEntero(), -1).ToString Mes = If(Request("Mes") IsNot Nothing AndAlso Request("Mes").ToEntero() > 0, Request("Mes").ToEntero(), -1).ToString @@ -436,6 +441,11 @@ Partial Class Ventas_RepProductosServiciosDetalle If UsuarioActual.Empresa.Funcionalidad(531).ToEntero = 1 Then DvLitraje.Visible = True 'garantia + DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) + DdlClasificacion2.DataBind() + divClasif2texto.Visible = True + divClasif2.Visible = True + divgarantia1.Visible = True divgarantia2.Visible = True divdistribuidor1.Visible = True @@ -472,6 +482,8 @@ Partial Class Ventas_RepProductosServiciosDetalle DdlSubProyecto.SelectedValueExist(CveSubProyecto) DdlCategoria.SelectedValueExist(CveCategoria) DdlClasificacion.SelectedValueExist(CveClasificacion) + DdlClasificacion2.SelectedValueExist(CveClasificacion2) + If CvePS.ToEntero > 0 Then DdlPS.SelectedValue = CvePS DdlPS.SelectedText = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS.ToEntero)(0)("PSCodigo").ToString @@ -531,7 +543,7 @@ Partial Class Ventas_RepProductosServiciosDetalle TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, CveProveedorCompra:=CveProveedorCompra, CveMarca:=DdlMarcaPSDes.SelectedValue.ToEntero, CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero(), TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, ModalidadContable:=Not ChkLecturaAdmin.Checked, MostrarLitraje:=ChkLitraje.Checked, EsGarantia:=DdlGarantia.SelectedValue.ToEntero, CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero, CveClienteSucursal:=DdlClienteSucursal.SelectedValue.ToEntero) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero, CveClienteSucursal:=DdlClienteSucursal.SelectedValue.ToEntero, CveClasificacion2:=DdlClasificacion2.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjVentas.DtResultados TmpDT = ObjVentas.DtResultados Else diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 573a49386..8fd0b3cd6 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -2445,244 +2445,73 @@ -
    -
    -
    -
    -
    - - COMERCIO EXTERIOR -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - - -
    -
    - -
    - - <%----%> -
    - -
    - - <%----%> -
    -
    -
    - -
    - - -
    -
    -
    - -
    - -
    - -
    - -
    - <%-- -
    -
    --%> -
    -
    -
    - - -
    - -
    Nombre:
    - -
    - -
    - -
    -
    - -
    Calle:
    - -
    - -
    -
    Núm.
    -
    - -
    -
    CP.
    -
    - -
    -
    -
    -
    Pais:
    - -
    - - -
    - - -
    Estado:
    - -
    - - -
    - -
    -
    -
    Municipio:
    - -
    - - -
    - -
    Colonia:
    - -
    - - -
    - -
    - -
    - -
    - -
    -
    -
    -
    -
    - Convertir a unidad Aduana - - - - - - - - - - - - - - - - - <%-- - - - - - - - - - --%> - - - - - - - - - - - - -
    -
    -
    -
    +
    +
    +
    + + CARTA PORTE +
    +
    +
    -
    -
    -
    -
    -
    - - CARTA PORTE -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - - -
    - -
    - -
    +
    + +
    +
    +
    +
    + + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    + + + + + +
    -
    -
    - -
    - -
    +
    + +
    +
    + + + + + +
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - - - - - - -
    -
    - -
    -
    - - - - - - -
    -
    -
    -
    +
    +
    +
    +
    +
    @@ -2698,7 +2527,8 @@
    -
    +
    +
    @@ -2729,11 +2559,54 @@
    - - +
    +
    +
    +
    +
    +
    +
    +
    + + Mercancias +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    + + + + +   + + + + + + + + + + + +
    +
    +
    +
    +
    + + -
    -
    @@ -2741,79 +2614,140 @@ -
    -
    -
    - - 7Eleven +
    +
    +
    +
    +
    +
    +
    + + FORD -
    -
    -
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + + + + + + + + + + + + + +
    GSDB:   +
    + +
    +
    ASN :   +
    + +
    +   + + +
    + + +
    +
    +
    +
    +
    +
    -
    - -
    -
    +
    +
    +
    + + 7Eleven -
    -
    - - - - - - - - - - - - - - - - - -
    Proveedor:  -
    -
    -
    Folio:  -
    - +
    +
    +
    -
    Tienda:  -
    - -
    - <%----%> -
    Fecha:  -
    - - - - - - - - +
    +
    -
    +
    + +
    +
    + + + + + + + + + + + + + + + + + +
    Proveedor:  +
    + +
    +
    Folio:  +
    + +
    +
    Tienda:  +
    + +
    + <%----%> +
    Fecha:  + +
    + + + + + + + + +
    +
    +
    +
    +
    +
    -
    +
    - FORD - + COMERCIO EXTERIOR
    @@ -2821,40 +2755,161 @@
    - +
    -
    -
    - - - - - - - - - - - - - -
    GSDB:   -
    - +
    + + +
    +
    + +
    + + <%----%>
    -
    ASN :   -
    - + +
    + + <%----%>
    -   - - -
    - - -
    -
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    + +
    + +
    + <%-- +
    +
    --%> +
    +
    +
    + + +
    + +
    Nombre:
    + +
    + +
    + +
    +
    + +
    Calle:
    + +
    + +
    +
    Núm.
    +
    + +
    +
    CP.
    +
    + +
    +
    +
    +
    Pais:
    + +
    + + +
    + + +
    Estado:
    + +
    + + +
    + +
    +
    +
    Municipio:
    + +
    + + +
    + +
    Colonia:
    + +
    + + +
    + +
    + +
    + +
    + +
    +
    +
    +
    +
    + Convertir a unidad Aduana + + + + + + + + + + + + + + + + + <%-- + + + + + + + + + --%> + + + + + + + + + + + + +
    +
    + +
    @@ -5889,6 +5944,43 @@
    <%--FIN MODAL ADD PS --%> + <%--MODAL ADD PS --%> + + <%--FIN MODAL ADD PS --%> +