-Ajustes para inicialización de usados

This commit is contained in:
rrene
2019-12-02 10:36:09 -07:00
parent 385c0c92a3
commit 0f8ddb797c
4 changed files with 69 additions and 58 deletions

View File

@@ -1052,21 +1052,33 @@ Partial Class Inventarios_RecepcionUsados
Else Else
Dim Mensaje As String = "" 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("<br>{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 For Each Dr As DataRow In DtMovimientos.Rows
If CveConcepto = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then If CveConcepto = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then
ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate) ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate)
Else Else
ImporteConcepto = Dr("PU").ToString.ToDouble ImporteConcepto = Dr("PU").ToString.ToDouble
End If 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 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" Mensaje = "Error al guardar los movimientos"
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If 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" Mensaje = "Error al actualizar el recibo de los usados"
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
@@ -1074,46 +1086,46 @@ Partial Class Inventarios_RecepcionUsados
'si es selectedvalue = 2, es entrada ,3 -salida 'si es selectedvalue = 2, es entrada ,3 -salida
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2) Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2)
If RBLOpcion.SelectedValue.ToEntero = 2 Then If RBLOpcion.SelectedValue.ToEntero = 2 AndAlso EsDistribuidor Then
If EsDistribuidor Then
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, -1, UsuarioActual.CveUsuario, If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, CveVenta, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
Mensaje = "Error al guardar Movimientos de distribuidor" Mensaje = "Error al guardar Movimientos de distribuidor"
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If
End If End If
End If End If
Next Next
If Not ErrorMovInv Then If Not ErrorMovInv Then
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio) Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza) If IDPoliza > 0 Then Msg = Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza)
ObjInventario.Commit() ' aplica los movimientos insertados ObjInventario.Commit() ' aplica los movimientos insertados
'Limpia Valores cuando inserta de campos especiales 'Limpia Valores cuando inserta de campos especiales
If UsuarioActual.CveEmpresa = 66 Then If UsuarioActual.CveEmpresa = 66 Then
DdlSubProyecto.SelectedValueExist("-1") 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 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 End If
End If
Catch ex As Exception Catch ex As Exception
ObjInventario.RollBack() 'deshace lo insertado ObjInventario.RollBack() 'deshace lo insertado
CveMovimiento = 0 CveMovimiento = 0
@@ -1125,17 +1137,7 @@ Partial Class Inventarios_RecepcionUsados
ObjAcum.Dispose() ObjAcum.Dispose()
ObjVentas.Dispose() ObjVentas.Dispose()
If Not ErrorMovInv AndAlso GenerarRNC AndAlso ObjRemisionNC IsNot Nothing Then If Not ErrorMovInv Then
CargaDTDetalleRNC()
Dim Resp = ObjRemisionNC.EmitirFactura(False)
For Each mensaje As String In Resp.Mensajes
Msg.AppendFormat("<br>{0}", mensaje)
Next
Alert(Msg.ToString, If(Resp.CveVenta > 0, TipoMensaje.MsgInformacion, TipoMensaje.MsgAdvertencia))
ElseIf Not ErrorMovInv Then
Alert(Msg.ToString, TipoMensaje.MsgInformacion) Alert(Msg.ToString, TipoMensaje.MsgInformacion)
End If End If

View File

@@ -8899,7 +8899,7 @@ Partial Class Clientes
GvAcum.DataSource = ObjAcum.DtResultados 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 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 ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal
@@ -9928,7 +9928,14 @@ Partial Class Clientes
End Sub End Sub
Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click 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 Sub
#End Region #End Region
End Class End Class

View File

@@ -5995,7 +5995,7 @@
<asp:CheckBox ID="ChkAplicar" runat="server" /> <asp:CheckBox ID="ChkAplicar" runat="server" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" /> <asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right"> <asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>
@@ -6378,7 +6378,7 @@
<asp:CheckBox ID="ChkAplicar" runat="server" /> <asp:CheckBox ID="ChkAplicar" runat="server" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" /> <asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right"> <asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>

View File

@@ -20861,16 +20861,18 @@ Partial Class Ventas
End Sub End Sub
Private Sub CargaRNC() Private Sub CargaRNC()
Dim ObjMovtos As New ClsMovimientos() 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 End If
ObjMovtos.Dispose() ObjMovtos.Dispose()
GvRemisionesNC.DataBind() GvRemisionesNC.DataBind()
End Sub End Sub
Private Sub CargaDescRNC() Private Sub CargaDescRNC()
Dim ObjMovtos As New ClsMovimientos() Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, TipoDocto:="RNC") Then If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then
GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento") GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0", "Moneda,Fecha,Folio")
End If End If
ObjMovtos.Dispose() ObjMovtos.Dispose()
GvDescNC.DataBind() GvDescNC.DataBind()