diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 5c98d9754..ce6cb92d0 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1899,7 +1899,8 @@ Public Class ClsVentas End Function #Region " PROMOCIONES " - Public Function GetPromociones(CvePromocion As Integer, Fecha As String, CveVendedor As Integer, CveCliente As Integer, Estatus As Integer, CveEmpresa As Integer, CveSubProyecto As Integer) As Boolean + Public Function GetPromociones(CvePromocion As Integer, Fecha As String, CveVendedor As Integer, CveCliente As Integer, Estatus As Integer, CveEmpresa As Integer, + CveSubProyecto As Integer, Optional CveMarca As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesGet") @@ -1911,6 +1912,7 @@ Public Class ClsVentas .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try @@ -1922,7 +1924,9 @@ Public Class ClsVentas Return Retorno End Function - Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String) As Integer + Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, + CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String, + Optional CveMarca As Integer = -1) As Integer Dim Retorno = -1 DataAdapter("PA_Vta_PromocionesAdd") @@ -1939,6 +1943,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@TipoAplicacion", SqlDbType.VarChar).Value = TipoAplicacion + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@CvePromocion", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -1951,7 +1956,8 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdatePromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CvePromocion As Integer, CveSubProyecto As Integer) As Boolean + Public Function UpdatePromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, + CveMoneda As Integer, CveUsuario As Integer, CvePromocion As Integer, CveSubProyecto As Integer, Optional CveMarca As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesUpdate") @@ -1967,6 +1973,7 @@ Public Class ClsVentas .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CvePromocion", SqlDbType.Float).Value = CvePromocion .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try @@ -2043,7 +2050,7 @@ Public Class ClsVentas Public Function AddPromocionesDetalle(CvePromocion As Integer, CvePS As Integer, TipoPromocion As Integer, Promocion As Double, PUAnterior As Double, PUPromocion As Double, AplicaRestriccion As Boolean, AplicaLunes As Boolean, AplicaMartes As Boolean, AplicaMiercoles As Boolean, AplicaJueves As Boolean, AplicaViernes As Boolean, AplicaSabado As Boolean, AplicaDomingo As Boolean, HoraInicio As DateTime, HoraFin As DateTime, Optional CantidadMinima As Integer = 1, - Optional CveClasificacion As Integer = -1) As Boolean + Optional CveClasificacion As Integer = -1, Optional CveRinTamaño As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesDetalleAdd") @@ -2067,6 +2074,7 @@ Public Class ClsVentas .Add("@HoraFin", SqlDbType.DateTime).Value = HoraFin .Add("@CantidadMinima", SqlDbType.Int).Value = CantidadMinima .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveRinTamaño", SqlDbType.Int).Value = CveRinTamaño End With Try @@ -2081,7 +2089,7 @@ Public Class ClsVentas Public Function UpdatePromocionesDetalle(CvePromocionDetalle As Integer, CvePromocion As Integer, CvePS As Integer, TipoPromocion As Integer, Promocion As Double, PUAnterior As Double, PUPromocion As Double, AplicaRestriccion As Boolean, AplicaLunes As Boolean, AplicaMartes As Boolean, AplicaMiercoles As Boolean, AplicaJueves As Boolean, AplicaViernes As Boolean, AplicaSabado As Boolean, AplicaDomingo As Boolean, HoraInicio As DateTime, HoraFin As DateTime, - Optional CantidadMinima As Integer = 1, Optional CveClasificacion As Integer = -1) As Boolean + Optional CantidadMinima As Integer = 1, Optional CveClasificacion As Integer = -1, Optional CveRinTamaño As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PromocionesDetalleUpdate") @@ -2106,6 +2114,7 @@ Public Class ClsVentas .Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle .Add("@CantidadMinima", SqlDbType.Int).Value = CantidadMinima .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveRinTamaño", SqlDbType.Int).Value = CveRinTamaño End With Try @@ -4290,7 +4299,7 @@ Public Class ClsVentas End Try Return retorno End Function - Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer) As Boolean + Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer, CveClasificacionSup As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresAdd", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters @@ -4300,6 +4309,7 @@ Public Class ClsVentas .Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad .Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup End With Try SqlAdapter.Fill(Data) @@ -4338,7 +4348,7 @@ Public Class ClsVentas Return retorno End Function Public Function UpdateMetasVendedores(CveMeta As Integer, CveVendedor As Integer, MesAño As String, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, - CveClasificacion As Integer) As Boolean + CveClasificacion As Integer, CveClasificacionSup As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresUpdate", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters @@ -4349,6 +4359,7 @@ Public Class ClsVentas .Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad .Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup End With Try SqlAdapter.Fill(Data) diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index be1ff3fcd..720b39b81 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -33,8 +33,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState If Not GetEventos(CveUsuario, CveEmpresa, FI, FF) Then 'Convierte el objeto de Eventos en JSON - Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer - Dim sJSON As String = oSerializer.Serialize(events) + 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer + Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) context.Response.Write(sJSON) End If diff --git a/Ashx/SIGGPS.ashx b/Ashx/SIGGPS.ashx index 600e75669..f8a206eed 100644 --- a/Ashx/SIGGPS.ashx +++ b/Ashx/SIGGPS.ashx @@ -363,7 +363,7 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState strBody.Append("") End If strBody.Append("") - strBody.Append("") + strBody.AppendFormat("", Row("Liga")) strBody.Append("") strBody.Append("") strBody.Append("") diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb index c611b6e05..8a36b2419 100644 --- a/Inventarios/RecepcionEntrega.aspx.vb +++ b/Inventarios/RecepcionEntrega.aspx.vb @@ -1884,114 +1884,117 @@ Partial Class Inventarios_RecepcionEntrega 'DEVOLUCION REMISION If TipoMovimiento = 2 And TipoDocto = "Rem" Then - ConceptoMovimiento = 8 - Almacen1 = CveAlmacenTraspasoDestino - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero - End If + ConceptoMovimiento = 8 + Almacen1 = CveAlmacenTraspasoDestino + CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero + End If - 'CANCELACION DE DEVOLUCION - If TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1 Then - ConceptoMovimiento = 3 - Almacen1 = DdlAlmacen.SelectedValue.ToEntero - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero - End If + 'CANCELACION DE DEVOLUCION + If TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1 Then + ConceptoMovimiento = 3 + Almacen1 = DdlAlmacen.SelectedValue.ToEntero + CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero + End If - CveMovimiento = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, - CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Modulo:="RE/G7") - Folio = ObjInventario.Folio + CveMovimiento = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, + CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Modulo:="RE/G7") + Folio = ObjInventario.Folio - 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) - 'If Not (CveContrato > 0 And CveAlmacenTraspasoDestino > 0) Then - If CveMovimiento > 0 Then + 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) + 'If Not (CveContrato > 0 And CveAlmacenTraspasoDestino > 0) Then + If CveMovimiento > 0 Then - 'SACA LO DE TRASPASOS - APARTADO - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoEntrada").ToString.ToEntero - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count = 0 Then + 'SACA LO DE TRASPASOS - APARTADO + For Each Dr1 As DataRow In DtTraspasos.Rows + CveMovimientoSalida = Dr1("CveMovimientoEntrada").ToString.ToEntero + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + If ObjInventario.DtResultados.Rows.Count = 0 Then + ErrorMovInv = True + TextoError = "Ocurrió un error, no se tienen registros que ingresar" + Exit Sub + End If + + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then ErrorMovInv = True - TextoError = "Ocurrió un error, no se tienen registros que ingresar" - Exit Sub + TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." + Exit For + End If + Next + Else + ErrorMovInv = True + TextoError = "Ocurrió un error al obtener los registros" + End If + If ErrorMovInv Then Exit For + Next + + 'ES EL MOVIMIENTO PRINCIPAL + CantidadPendiente = 0 + Dim Cont As Integer = 0 + For Each Dr As DataRow In DtDatos.Rows + CantidadPendiente = Dr("CantidadGV").ToString.ToDecimal - Dr("CantidadTraspaso").ToString.ToDecimal + If CantidadPendiente > 0 Then + Dim PU As Decimal = 0 + + 'SI FUE POR SERIELOTE + DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) + DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) + If DtDetalle.Rows.Count > 0 Then + For Each Dr1 As DataRow In DtDetalle.Rows + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." + Exit For + End If + Next + ElseIf DtDetalleLote.Rows.Count > 0 Then + For Each Dr1 As DataRow In DtDetalleLote.Rows + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." + Exit For + End If + Next + Else + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal End If - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." + Exit For + End If + End If + If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then + For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont}").Rows + If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." + TextoError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." Exit For End If Next End If - If ErrorMovInv Then Exit For - Next - - 'ES EL MOVIMIENTO PRINCIPAL - CantidadPendiente = 0 - Dim Cont As Integer = 0 - For Each Dr As DataRow In DtDatos.Rows - CantidadPendiente = Dr("CantidadGV").ToString.ToDecimal - Dr("CantidadTraspaso").ToString.ToDecimal - If CantidadPendiente > 0 Then - Dim PU As Decimal = 0 - - 'SI FUE POR SERIELOTE - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - If DtDetalle.Rows.Count > 0 Then - For Each Dr1 As DataRow In DtDetalle.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - ElseIf DtDetalleLote.Rows.Count > 0 Then - For Each Dr1 As DataRow In DtDetalleLote.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - Else - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." - Exit For - End If - End If - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont}").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If - Cont += 1 - End If - Next - Else - ErrorMovInv = True - End If + Cont += 1 + End If + Next + Else + ErrorMovInv = True End If - 'End If + End If + 'End If - 'ENTRADA POR TRASPASO CUANDO ES REMISION - If Not ErrorMovInv Then + 'ENTRADA POR TRASPASO CUANDO ES REMISION + If Not ErrorMovInv Then If CveAlmacenTraspasoDestino > 0 AndAlso Not (TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1) Then ' TRASPASO CUANDO ES REMISION CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestino, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, Modulo:="RE/G8") @@ -2001,7 +2004,7 @@ Partial Class Inventarios_RecepcionEntrega TextoError = "No se pudo generar el movimiento de entrada correctamente" ErrorMovInv = True Else - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then ErrorMovInv = True @@ -2009,6 +2012,9 @@ Partial Class Inventarios_RecepcionEntrega Exit For End If Next + Else + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" End If End If diff --git a/Ventas/CatMetasVendedores.aspx b/Ventas/CatMetasVendedores.aspx index cdc2accf6..366e385c0 100644 --- a/Ventas/CatMetasVendedores.aspx +++ b/Ventas/CatMetasVendedores.aspx @@ -22,7 +22,7 @@ - + @@ -34,14 +34,14 @@ - + - + - - - + + + @@ -54,6 +54,16 @@ + + + + + + + + + + @@ -120,6 +130,11 @@ +
+ + + +
diff --git a/Ventas/CatMetasVendedores.aspx.vb b/Ventas/CatMetasVendedores.aspx.vb index dcc77690f..0f1e9f8f5 100644 --- a/Ventas/CatMetasVendedores.aspx.vb +++ b/Ventas/CatMetasVendedores.aspx.vb @@ -45,6 +45,10 @@ Partial Class CatMetasVendedores DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) DdlClasificacion.DataBind() DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlClasificacionSup.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionSup.DataBind() + DdlClasificacionSup.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Protected Sub LnkAgregar_Click() Handles LnkAgregar.Click @@ -53,24 +57,26 @@ Partial Class CatMetasVendedores Protected Sub BtnAgregarMetaVendedor_Click(sender As Object, e As EventArgs) Handles BtnAgregarMetaVendedor.Click - If DdlVendedores.SelectedValue.ToEntero > 0 AndAlso TxtFechaI.Text <> "" AndAlso DdlMarcas.SelectedValue.ToEntero > 0 Then + If DdlVendedores.SelectedValue.ToEntero > 0 AndAlso TxtFechaI.Text <> "" AndAlso DdlMarcas.SelectedValue.ToEntero > 0 AndAlso DdlClasificacionSup.SelectedValue.ToEntero > 0 Then + Dim ObjVentas As New ClsVentas If BtnAgregarMetaVendedor.Text = "Agregar" Then If ObjVentas.AddMetasVendedores(DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero, - TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero) Then + TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacionSup.SelectedValue.ToEntero) Then Alert("Se agregó la meta al vendedor") Else Alert("No se pudo agregar la meta al vendedor", TipoMensaje.MsgError) End If ElseIf BtnAgregarMetaVendedor.Text = "Actualizar" Then If ObjVentas.UpdateMetasVendedores(CveMetaVendedor, DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero, - TxtMetaCantidad.TextMode.ToEntero, TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero) Then + TxtMetaCantidad.Text.ToEntero, TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero, + DdlClasificacionSup.SelectedValue.ToEntero) Then Alert("Se actualizó la información de la meta del vendedor") Else Alert("No se pudo actualizar la meta del vendedor", TipoMensaje.MsgError) End If End If - Else + Else Alert(String.Format("Falta Seleccionar {0}{1}{2}", If(DdlVendedores.SelectedValue.ToEntero > 0, "", "Vendedor, "), If(DdlMarcas.SelectedValue.ToEntero > 0, "", "Marca, "), If(TxtFechaI.Text <> "", "", "Fecha, "))) End If RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")) @@ -94,6 +100,7 @@ Partial Class CatMetasVendedores CveMetaVendedor = GvRow.DataKey("CveMeta").ToEntero DdlVendedores.SelectedValue = GvRow.DataKey("CveVendedor") TxtFechaI.Text = GvRow.DataKey("MesAño") + DdlClasificacionSup.SelectedValue = GvRow.DataKey("CveClasificacionSup") DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion") DdlMarcas.SelectedValue = GvRow.DataKey("CveMarca") TxtMetaCantidad.Text = GvRow.DataKey("MetaCantidad") diff --git a/Ventas/MetasVendedores.aspx b/Ventas/MetasVendedores.aspx index b8b459039..efb1b7674 100644 --- a/Ventas/MetasVendedores.aspx +++ b/Ventas/MetasVendedores.aspx @@ -37,14 +37,16 @@ padding-right: 4px !important; padding-left: 4px !important; } - .GrupoSuperior{ - background-color:#000077; - color:white; - font-weight:bold; - } - .GrupoSuperior:hover{ - background-color:#000077; + + .GrupoSuperior { + background-color: #000077; + color: white; + font-weight: bold; } + + .GrupoSuperior:hover { + background-color: #000077; + } @@ -63,16 +65,15 @@ -
-
+
+
- "> + ">
-
Fecha del mes:
@@ -83,44 +84,12 @@
-
Sucursal:
- -
- -
-
-
- - -
- -
- - -
- -
- -
- -
-
-
- - -
- -
- -
- -
@@ -130,13 +99,37 @@
-
>
+ +
+ +
+ + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
@@ -148,7 +141,7 @@ diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb index a00223aec..41c71e9c0 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -80,16 +80,16 @@ Partial Class MetasVendedores Select Case e.Row.DataKey("Etiqueta") Case "GrupoSuperior" e.Row.CssClass = "GrupoSuperior" - e.Row.FCLabel("lblRealMes").Text = "" - e.Row.FCLabel("lblVtaMesAA").Text = "" - e.Row.FCLabel("lblObjMes").Text = "" - e.Row.FCLabel("lblRealAcumulado").Text = "" - e.Row.FCLabel("lblRealMesPorcentaje").Text = "" - e.Row.FCLabel("lblAAntAcumulado").Text = "" - e.Row.FCLabel("lblObjAcumulado").Text = "" - e.Row.FCLabel("lblVarVSAAPerc").Text = "" - e.Row.FCLabel("lblVarVSAA").Text = "" - e.Row.FCLabel("lblVarVSObjAcum").Text = "" + ' e.Row.FCLabel("lblRealMes").Text = "" + ' e.Row.FCLabel("lblVtaMesAA").Text = "" + ' e.Row.FCLabel("lblObjMes").Text = "" + ' e.Row.FCLabel("lblRealAcumulado").Text = "" + ' e.Row.FCLabel("lblRealMesPorcentaje").Text = "" + ' e.Row.FCLabel("lblAAntAcumulado").Text = "" + ' e.Row.FCLabel("lblObjAcumulado").Text = "" + ' e.Row.FCLabel("lblVarVSAAPerc").Text = "" + ' e.Row.FCLabel("lblVarVSAA").Text = "" + ' e.Row.FCLabel("lblVarVSObjAcum").Text = "" Case "Categoria" e.Row.CssClass = "Totales" Case "Clasificacion" diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index 71004d7e2..239c1c1d6 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -3017,7 +3017,7 @@ return; //AUTOMOTRIZ-ACUMULADORES } else { - let regex = new RegExp("^[1X]|^[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$"); + let regex = new RegExp("^[1X]|^[0-9][A-HJ-M][0-3][0-9][A-Z][ACEN][2-5]$"); arguments.IsValid = regex.test(arguments.Value); return; } diff --git a/Ventas/RepIngresos.aspx.vb b/Ventas/RepIngresos.aspx.vb index 467609afe..e82b64b60 100644 --- a/Ventas/RepIngresos.aspx.vb +++ b/Ventas/RepIngresos.aspx.vb @@ -144,10 +144,10 @@ Partial Class Ventas_RepIngresos 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 FI As String = If(TxtFechaInicio.Text = "", "", $" Fecha Inicio: {TxtFechaInicio.Text}") - Dim FF As String = If(TxtFechaFin.Text = "", "", $" Fecha Fin: {TxtFechaFin.Text}") - Dim Tipo As String = If(DdlTipoDocto.SelectedValue = "-1", "", $" Tipo Docto.: {DdlTipoDocto.SelectedItem.Text}") - Dim subProy As String = If(DdlSubProyecto.SelectedValue = "-1", "", $" SubProyecto: {DdlSubProyecto.SelectedItem.Text}") + Dim FI As String = If(TxtFechaInicio.Text = "", "", $"Fecha Inicio: {TxtFechaInicio.Text} ") + Dim FF As String = If(TxtFechaFin.Text = "", "", $"Fecha Fin: {TxtFechaFin.Text} ") + Dim Tipo As String = If(DdlTipoDocto.SelectedValue = "", "", $"Tipo Docto: {DdlTipoDocto.GetSelectedText} ") + Dim subProy As String = If(DdlSubProyecto.SelectedValue = "", "", $"SubProyecto: {DdlSubProyecto.GetSelectedText} ") If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then @@ -156,7 +156,7 @@ Partial Class Ventas_RepIngresos params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("AgrupadoPor", $"{FI}{FF}{Tipo}{subProy}")) - + params.Add(New ReportParameter("FechaImpresion", DateAndTime.Now)) If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", logouri)) Else diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index c691aaab8..9d6b88538 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1599,7 +1599,7 @@
- Salida Almacen +
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 0fae9f162..62b4161d8 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6245,7 +6245,7 @@ Partial Class Ventas End If - If CveVenta > 0 And DdlTipoComprobante.SelectedValue <> "Cot" Then + If (CveVenta > 0 And DdlTipoComprobante.SelectedValue <> "Cot") AndAlso Not AplicaDevolucion Then If e.Row.DBCampo("CveConcepto").ToEntero = 3 Then CveAlmacenDevolucion = e.Row.DBCampo("CveAlmacen").ToEntero e.Row.FCCheckBox("cbInv").Visible = False End If @@ -10997,9 +10997,9 @@ Partial Class Ventas Dim OcurrioError As Boolean = False Try - If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then + If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem", "Dev") Then - If RemisionesLista.Count > 0 Then + If RemisionesLista.Count > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then For Each CveRemision As Integer In RemisionesLista 'El almacen general es el Primer Almacen de Material en la Sucursal If Not TraspasoAlmacen(ObjInventario, CveRemision, ObjConta, True, 9) Then @@ -11011,8 +11011,28 @@ Partial Class Ventas If GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then + Dim Filtro As String = "" + Select Case factura.TipoDocto + Case "Ing", "Ped" + Filtro = "CveConcepto IN (3,40)" + Case "Dev" + Filtro = "CveConcepto IN (3,40)" + Case Else + Filtro = "CveConcepto = 9" + End Select + + Dim DtExistencias As DataTable = Nothing + If ObjInventario.GetInv_Mov(Me.CveVentaDevolucion, UsuarioActual.CveEmpresa) Then + DtExistencias = ObjInventario.DtResultados.FiltraParametros($"CvePS Is Not NULL AND {Filtro}") + End If + + Dim CveConceptoAlmacen As Integer = 3 + If factura.TipoDocto = "Dev" Then + CveConceptoAlmacen = 18 + End If + Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero - Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, 3, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E1") + Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, CveConceptoAlmacen, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E1") If CveMovimientoInventario <= 0 Then OcurrioError = True @@ -11024,8 +11044,7 @@ Partial Class Ventas Dim CveUnidad As Integer Dim CveProducto As Integer Dim Existencia As Double - 'Dim Pu As Double - 'DtInv.Clone() + Dim PU As Decimal = 0 Dim DtEquivalencias As DataTable @@ -11042,7 +11061,7 @@ Partial Class Ventas Exit For End If - If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString.ToEntero < 1 Then + If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString.ToEntero < 1 Then Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) If Existencia < Cantidad Then OcurrioError = True @@ -11066,7 +11085,17 @@ Partial Class Ventas End If If CveProducto > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + 'SI ES ENTRADA DEBE TENER EL COSTO DE LA SALIDA + If CveConceptoAlmacen.Contiene(18) Then + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal + If PU <= 0 Then + ErrorList.Add("Ocurrió un error al obtener el costo.
") + OcurrioError = True + Exit For + End If + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then OcurrioError = True ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.
") Exit For @@ -11078,6 +11107,7 @@ Partial Class Ventas End If End If + PU = 0 i = i + 1 Next @@ -11086,6 +11116,15 @@ Partial Class Ventas Dim DtCostos As DataTable = Nothing Dim ValorInventario As Decimal = 0 Dim TotalCosto As Decimal = 0 + + Dim TipoMovto68 As Boolean = True + Dim TipoMovto69 As Boolean = False + + If CveConceptoAlmacen.Contiene(18) Then + TipoMovto68 = False + TipoMovto69 = True + End If + If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) Then DtCostos = ObjInventario.DtResultados TotalCosto = DtCostos.SUMD("Total").RoundSQL @@ -11110,7 +11149,7 @@ Partial Class Ventas CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, False, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then OcurrioError = True End If End If @@ -11120,15 +11159,16 @@ Partial Class Ventas IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero If TotalCosto <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, True, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then OcurrioError = True End If End If - factura.Inv_CveMovimiento = CveMovimientoInventario - factura.Inv_ValorInventario = ValorInventario + End If + factura.Inv_CveMovimiento = CveMovimientoInventario + factura.Inv_ValorInventario = ValorInventario End If End If @@ -17651,17 +17691,17 @@ Partial Class Ventas End Sub Private Function ValidaPagosContado() As Boolean Dim Retorno = False + Dim Total As Decimal = TxtTotal.Text.ToDecimal() 'SI LA VENTA ES NUEVA VALIDAR TAMBIEN LOS PAGOS DE CONTADO If UsuarioActual.CveEmpresa = 141 AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then - If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then + If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) AndAlso Total > 0 Then Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) Retorno = True Return Retorno End If - If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then - Dim Total As Decimal = TxtTotal.Text.ToDecimal() + If Not PermiteCredito AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0) AndAlso Total > 0 Then Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() If TotalPago < Total Then @@ -17682,8 +17722,8 @@ Partial Class Ventas If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then - If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then - Dim Total As Decimal = TxtTotal.Text.ToDecimal() + If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 AndAlso Total > 0 Then + Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() If TotalPago < Total Then @@ -22200,47 +22240,34 @@ Partial Class Ventas 'AGREGAR LOS USADOS EN LA DEVOLUCION CalculaUsados(DtUsados) - 'If DtUsados IsNot Nothing AndAlso DtUsados.Rows.Count > 0 Then - ' Dim DtPSVenta As DataTable = TmpDT.Copy() - ' For Each Row As DataRow In DtPSVenta.Rows - ' Dim RowCargo As DataRow = DTTamanios.FiltroPrimero($"CveTamaño = { Row("CveTamaño").ToString.ToEntero } ") - ' If RowCargo IsNot Nothing Then - ' Dim CvePSCargo As Integer = RowCargo("CvePSCargo").ToString.ToEntero - - ' For Each RowUsado As DataRow In DtUsados.FiltraParametros($"CvePS = {CvePSCargo}").Rows - ' 'If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then - ' 'End If - ' Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() - ' Dim Descuento As Decimal = Cantidad * RowUsado("Descuento").ToString.ToDecimal / RowUsado("Cantidad").ToString.ToDecimal - ' Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal() - ' Dim Total As Decimal = (Cantidad * PU) - ' Dim TotalImpuestos As Decimal = (Cantidad * PU) - Descuento - ' Dim ImporteIVA As Decimal = TotalImpuestos * RowUsado("PorcentajeIVA").ToString.ToDecimal - ' Dim ImporteRetIVA As Decimal = TotalImpuestos * RowUsado("PorcentajeRetIVA").ToString.ToDecimal - ' Dim ImporteRetISR As Decimal = TotalImpuestos * RowUsado("PorcentajeRetISR").ToString.ToDecimal - ' Dim ImporteIEPS As Decimal = TotalImpuestos * RowUsado("PorcentajeIEPS").ToString.ToDecimal - - ' AgregaTempDT(TmpDT, RowUsado("CvePS").ToString.ToEntero, RowUsado("PS").ToString, RowUsado("Codigo").ToString, RowUsado("CodigoPS").ToString, - ' RowUsado("CveTipoPS").ToString.ToEntero, RowUsado("CveTipoInvPS").ToString.ToEntero, - ' RowUsado("CveUM").ToString.ToEntero, RowUsado("UM").ToString, RowUsado("CveClasificacion").ToString.ToEntero, - ' RowUsado("Clasificacion").ToString, RowUsado("CveProyecto").ToString.ToEntero, RowUsado("Proyecto").ToString, - ' RowUsado("CveSubProyecto").ToString.ToEntero, RowUsado("SubProyecto").ToString, - ' RowUsado("Obs").ToString, Cantidad, PU, RowUsado("PorcentajeIVA").ToString.ToDecimal, ImporteIVA, - ' RowUsado("PorcentajeRetIVA").ToString.ToDecimal, ImporteRetIVA, - ' RowUsado("PorcentajeRetISR").ToString.ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString.ToDecimal, - ' ImporteIEPS, -1, Descuento, Total, "", "", -1, -1, - ' RowUsado("SATClaveProdServ").ToString, RowUsado("SATClaveUM").ToString, -1, RowUsado("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1) - ' Next - ' End If - - ' Next - 'End If TrTipoRelacion.Visible = True DdlTiposRelacion.SelectedValueExist("3") LimpiaDocumentoDEV() + If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then + DivAlmacen.Visible = True + LltSalidaAlmacen.Text = "Devolución Almacen" + + Dim DTAlmacen As DataTable + ddlAlmacen.Items.Clear() + DTAlmacen = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}") + ddlAlmacen.DataSource = DTAlmacen + If DTAlmacen Is Nothing Or DTAlmacen.Rows.Count = 0 Then + ddlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) + ddlAlmacen.SelectedValue = "-1" + End If + ddlAlmacen.DataBind() + If GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero}").Rows.Count > 0 Then + ddlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) + End If + GvInv.Columns(0).Visible = True + DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2") + CargaGVInv(DtInv) + + End If + CambiaTipoDocto() CargaNC(CveVenta) CalculaTotalesVenta() @@ -24243,15 +24270,15 @@ Partial Class Ventas Dim Retorno As Boolean = True If UsuarioActual.CveEmpresa = 141 Then - If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then + Dim Total As Decimal = TxtTotal.Text.ToDecimal() + + If Not PermiteCredito AndAlso ((DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) AndAlso Total > 0) Then Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) Retorno = False Return Retorno End If - If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then - - Dim Total As Decimal = TxtTotal.Text.ToDecimal() + If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 AndAlso Total > 0 Then Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() If TotalPago < Total Then