diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index ee62afd3a..195b4341f 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1052,21 +1052,33 @@ Partial Class Inventarios_RecepcionUsados Else Dim Mensaje As String = "" + If Not ErrorMovInv AndAlso GenerarRNC AndAlso ObjRemisionNC IsNot Nothing Then + + CargaDTDetalleRNC() + + Dim Resp = ObjRemisionNC.EmitirFactura(False) + For Each mensaje2 As String In Resp.Mensajes + Msg.AppendFormat("
{0}", mensaje2) + Next + Alert(Msg.ToString, If(Resp.CveVenta > 0, TipoMensaje.MsgInformacion, TipoMensaje.MsgAdvertencia)) + CveVenta = Resp.CveVenta + End If + For Each Dr As DataRow In DtMovimientos.Rows - If CveConcepto = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate) - Else - ImporteConcepto = Dr("PU").ToString.ToDouble - End If + If CveConcepto = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then + ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate) + Else + ImporteConcepto = Dr("PU").ToString.ToDouble + End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then - Mensaje = "Error al guardar los movimientos" - ErrorMovInv = True - Exit For - End If + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Exit For + End If - If Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True) Then + If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True) Then Mensaje = "Error al actualizar el recibo de los usados" ErrorMovInv = True Exit For @@ -1074,46 +1086,46 @@ Partial Class Inventarios_RecepcionUsados 'si es selectedvalue = 2, es entrada ,3 -salida Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2) - If RBLOpcion.SelectedValue.ToEntero = 2 Then - If EsDistribuidor Then - If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, -1, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, CveVenta, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then - Mensaje = "Error al guardar Movimientos de distribuidor" - ErrorMovInv = True - Exit For - End If + If RBLOpcion.SelectedValue.ToEntero = 2 AndAlso EsDistribuidor Then + + If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then + Mensaje = "Error al guardar Movimientos de distribuidor" + ErrorMovInv = True + Exit For End If + End If - Next + Next - If Not ErrorMovInv Then + If Not ErrorMovInv Then - Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) - Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) + Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) + Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) - If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) + If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) - ObjInventario.Commit() ' aplica los movimientos insertados + ObjInventario.Commit() ' aplica los movimientos insertados - 'Limpia Valores cuando inserta de campos especiales - If UsuarioActual.CveEmpresa = 66 Then - DdlSubProyecto.SelectedValueExist("-1") + 'Limpia Valores cuando inserta de campos especiales + If UsuarioActual.CveEmpresa = 66 Then + DdlSubProyecto.SelectedValueExist("-1") + End If + + EnvioCorreo() + + CargaPendientesRecibir() + UPDatos.Update() + + Else + ObjInventario.RollBack() 'deshace lo insertado + CveMovimiento = 0 + Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError) End If - EnvioCorreo() - - CargaPendientesRecibir() - UPDatos.Update() - - Else - ObjInventario.RollBack() 'deshace lo insertado - CveMovimiento = 0 - Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError) End If - End If - End If Catch ex As Exception ObjInventario.RollBack() 'deshace lo insertado CveMovimiento = 0 @@ -1125,17 +1137,7 @@ Partial Class Inventarios_RecepcionUsados ObjAcum.Dispose() ObjVentas.Dispose() - If Not ErrorMovInv AndAlso GenerarRNC AndAlso ObjRemisionNC IsNot Nothing Then - - CargaDTDetalleRNC() - - Dim Resp = ObjRemisionNC.EmitirFactura(False) - For Each mensaje As String In Resp.Mensajes - Msg.AppendFormat("
{0}", mensaje) - Next - Alert(Msg.ToString, If(Resp.CveVenta > 0, TipoMensaje.MsgInformacion, TipoMensaje.MsgAdvertencia)) - - ElseIf Not ErrorMovInv Then + If Not ErrorMovInv Then Alert(Msg.ToString, TipoMensaje.MsgInformacion) End If diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 25f50e04e..41c5b4908 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -8899,7 +8899,7 @@ Partial Class Clientes GvAcum.DataSource = ObjAcum.DtResultados - LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 1 ")).ToDecimal.FormatoNumero(2) + LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto IN (1,3) ")).ToDecimal.FormatoNumero(2) ImporteCargo = ObjAcum.DtResultados.SUM("ImporteCargo", "(FacturadoCargo = 0 OR FacturadoCargo IS NULL) AND CveConcepto = 1 ").ToDecimal ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal @@ -9928,7 +9928,14 @@ Partial Class Clientes End Sub Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click - Alert("Puntuación Inicializada") + + Dim Acum As New ClsAcumuladores + Dim Puntos As Decimal = -LblUsadosPuntos.Text.ToDecimal + If Acum.DistribuidorMovtosAdd(CveCliente, 1, 1, 3, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Puntos, "Saldo Inicializado") Then + Alert("Puntuación Inicializada") + End If + Acum.Dispose() + End Sub #End Region End Class diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index cedd77a67..806acee32 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -5995,7 +5995,7 @@ - + @@ -6378,7 +6378,7 @@ - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6bddfcbc1..dc988dc51 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -20861,16 +20861,18 @@ Partial Class Ventas End Sub Private Sub CargaRNC() Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, TipoDocto:="RNC") Then - GvRemisionesNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento") + + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + GvRemisionesNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0", "Moneda,Fecha,Folio") End If ObjMovtos.Dispose() GvRemisionesNC.DataBind() End Sub Private Sub CargaDescRNC() + Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, TipoDocto:="RNC") Then - GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento") + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0", "Moneda,Fecha,Folio") End If ObjMovtos.Dispose() GvDescNC.DataBind()