-Ajustes para inicialización de usados
This commit is contained in:
@@ -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("<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
|
||||
|
||||
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("<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/>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)))
|
||||
|
||||
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
|
||||
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("<br>{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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user