diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 434b07f56..7adfcb333 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -2737,11 +2737,6 @@ Partial Class Bancos_ProveedoresAbonar End If End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, gr.DataKey("SerieFolio").ToString, 78, ConceptoPartida, Now, IdCtaContable:=UsuarioActual.Empresa.IdCuentaOtrosIngresos, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, Saldo, Saldo * TCPago), TipoCambio:=TCCompra, TipoCambioPago:=TCPago, CveCuenta:=-1) Then - MsgError = "Ocurrio un error al saldar el movimiento" - End If - Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("Original").ToDecimal If gr.DataKey("IVA").ToDecimal > 0 Then @@ -2758,11 +2753,10 @@ Partial Class Bancos_ProveedoresAbonar If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, gr.DataKey("SerieFolio").ToString, 14, ConceptoPartida, Now, IdCtaContable:=IdCtaIVAXAcreditar, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, IVA, IVA * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "Ocurrio un error al saldar el movimiento" - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, gr.DataKey("SerieFolio").ToString, 19, ConceptoPartida, Now, IdCtaContable:=IdCtaIVAAcreditable, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, IVA, IVA * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto) Then - MsgError = "Ocurrio un error al saldar el movimiento" - End If + End If + + Saldo = Saldo - IVA + End If If gr.DataKey("IEPS").ToDecimal > 0 Then @@ -2771,13 +2765,19 @@ Partial Class Bancos_ProveedoresAbonar If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, gr.DataKey("SerieFolio").ToString, 25, ConceptoPartida, Now, IdCtaContable:=CtaProveedor, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, IEPS, IEPS * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), CveCuenta:=CveCuenta) Then MsgError = "Ocurrio un error al saldar el movimiento" - End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IEPS, gr.DataKey("SerieFolio").ToString, 26, ConceptoPartida, Now, IdCtaContable:=CtaProveedor, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, IEPS, IEPS * If(FuncionalidadFluctuacionImpuestos, TCPago, TCCompra)), CveCuenta:=CveCuenta) Then - MsgError = "Ocurrio un error al saldar el movimiento" - End If + End If + + Saldo = Saldo - IEPS + End If + ' se manda al ot ingresos, los impuestos por acreditar + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, gr.DataKey("SerieFolio").ToString, 78, ConceptoPartida, Now, IdCtaContable:=UsuarioActual.Empresa.IdCuentaOtrosIngresos, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, Saldo, Saldo * TCPago), TipoCambio:=TCCompra, TipoCambioPago:=TCPago, CveCuenta:=-1) Then + MsgError = "Ocurrio un error al saldar el movimiento" + End If + + + If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then If ObjConta.ValorPolizaDescuadre > 0 Then MsgError = ObjConta.MensajePolizaDescuadre + " " + ObjConta.ValorDiferencia diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index 21c126261..f1c3f6634 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -618,7 +618,7 @@ - + <%-- diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index f9e3bbb22..3c99c3ae1 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -168,6 +168,14 @@ Partial Class Inventarios_TraspasoAlmacen ViewState("TipoSeccionAlmacen") = value End Set End Property + Private Property FolioBusqueda As Integer + Get + Return CType(ViewState("FolioBusqueda"), Integer) + End Get + Set(value As Integer) + ViewState("FolioBusqueda") = value + End Set + End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -1289,14 +1297,16 @@ Partial Class Inventarios_TraspasoAlmacen Dim ObjInventarios As New ClsInventarios Dim Dtt As DataTable = Nothing - If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero), UsuarioActual.CveEmpresa) Then + FolioBusqueda = If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero) + + If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4")) If TxtFolioRecepcion.Text.Trim <> "" Then CveMovimientoSalida = ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimiento", "").ToEntero End If - 'CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero - 'CveAlmacenTransitorio = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero + CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero + CveAlmacenTransitorio = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero 'CveUsuarioResponsable = DdlResponsableRecepcion.SelectedValue.ToEntero Else Alert("Ocurrió un error al consultar los movimientos transitorios. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -1435,7 +1445,14 @@ Partial Class Inventarios_TraspasoAlmacen Protected Sub BtnRecibir_Click(sender As Object, e As EventArgs) If GvDatosRecepcion.Rows.Count > 0 Then + Dim ObjInventarios As New ClsInventarios + Dim Dtt As DataTable = Nothing + If ObjInventarios.GetMovimientosTransitorios(CveAlmacenDestino, -1, CveAlmacenTransitorio, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then + Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"), "", {"Codigo", "Cantidad"}) + End If + + ObjInventarios.Dispose() 'Valida Movimientos Dim ValidaMovtos = 0.0 For Each gvr As GridViewRow In GvDatosRecepcion.Rows @@ -1480,7 +1497,18 @@ Partial Class Inventarios_TraspasoAlmacen Dim CveMovimientoDetalleEntrada As Integer = 0 Dim Cont As Integer = 0 For Each gvr As GridViewRow In GvDatosRecepcion.Rows - If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then + Dim dataRowAux As DataRow = Dtt.FiltroPrimero(String.Format("Codigo = '{0}'", If(gvr.DataKey("Codigo").ToString = "", "0", gvr.DataKey("Codigo").ToString))) + Dim cantidadDisponibleValidacion As Decimal = 0 + + If gvr.DataKey("Codigo").ToString IsNot "" Then + If dataRowAux IsNot Nothing Then + cantidadDisponibleValidacion = dataRowAux.Item("Cantidad").ToString.ToDecimal - gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal + Else + cantidadDisponibleValidacion = -1 + End If + End If + + If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 AndAlso cantidadDisponibleValidacion >= 0 Then CveMovimientoDetalleEntrada = gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero If CveMovimientoDetalleEntrada <= 0 Then @@ -1504,7 +1532,9 @@ Partial Class Inventarios_TraspasoAlmacen Next End If End If - + ElseIf cantidadDisponibleValidacion < 0 Then + TextoError = String.Format("Se exceden la cantidad disponibles para {0}", gvr.DataKey("PS").ToString) + ErrorMovInv = True End If Cont += 1 Next diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 722910bf3..13029ef05 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -258,7 +258,7 @@
  • - +
  • diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index f98ff44c9..97cb8d25a 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -5133,7 +5133,10 @@ Partial Class PV Private Sub CalculaMesesUso() Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1) Dim FechaF As Date = Now - Dim FechaT As Date = String.Format("{0}/{1}/{2}", FechaI.Day, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual + Dim Dia As Integer = FechaI.Day + 'validación adicional, para saber si el mes tiene 31 días y el actua es menor. + If FechaI.Day > Today.LastDayOfMonth.Day Then Dia = Today.LastDayOfMonth.Day + Dim FechaT As Date = String.Format("{0}/{1}/{2}", Dia, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 0abb602fd..4d76f7aa3 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -250,7 +250,7 @@ Partial Class Ventas_Promociones Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text Dr("Promocion") = TxtPromocionConcepto.Text - If DdlTipoPromocion.SelectedValue.ToEntero = 1 Then + If DdlTipoPromocion.SelectedValue.ToEntero.Contiene(1, 3) Then Dr("PUPromocion") = TxtPromocionConcepto.Text.ToDecimal Else Dr("PUPromocion") = LbPUActual.Text.ToDecimal - (LbPUActual.Text.ToDecimal * TxtPromocionConcepto.Text.ToDecimal / 100) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 48ec29b22..a1b16c5ae 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -13716,6 +13716,31 @@ Partial Class Ventas Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal End If + + 'Agrega Promocion en el Descuento + Dim TipoPromo As Integer = 0 + Dim TotalPromocion As Decimal = 0 + Dim PromocionPorcentaje As Decimal = 0 + Dim CantMinima As Integer = 0 + + If DtPromociones.Rows.Count > 0 And DtPromociones IsNot Nothing Then + Dim dr As DataRow = DtPromociones.FiltroPrimero($"CvePS = {CvePS}") + TipoPromo = dr("TipoPromocion").ToString.ToEntero + TotalPromocion = dr("PUPromocion").ToString.ToDecimal * TxtCantidad.Text.ToDecimal + PromocionPorcentaje = dr("Promocion").ToString.ToDecimal + CantMinima = dr("CantidadMinima").ToString.ToEntero + End If + + If TipoPromo = 1 Then 'Promocion por Importe $ + Descuento = Descuento + TotalPromocion + ElseIf TipoPromo = 2 Then 'Promocion por % + Descuento = Descuento + ((TxtPrecio.Text.Trim.ToDecimal * PromocionPorcentaje / 100) * TxtCantidad.Text.ToDecimal) + ElseIf TipoPromo = 3 Then 'Promocion por Cantidad + If TxtCantidad.Text.ToDecimal >= CantMinima Then + Descuento = Descuento + TotalPromocion + End If + End If + AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento, DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text,