--Validaciones de recepcion de usados
This commit is contained in:
@@ -751,6 +751,8 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
End Sub
|
End Sub
|
||||||
Private Sub LimpiarMovimiento()
|
Private Sub LimpiarMovimiento()
|
||||||
CveMovimiento = -1
|
CveMovimiento = -1
|
||||||
|
CveRemisionRecibida = -1
|
||||||
|
CargoRemisionDesdeURL = False
|
||||||
|
|
||||||
If ObjFactura IsNot Nothing Then
|
If ObjFactura IsNot Nothing Then
|
||||||
ObjFactura.Dispose()
|
ObjFactura.Dispose()
|
||||||
@@ -771,7 +773,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
RblUsadosAjuste.Enabled = True
|
RblUsadosAjuste.Enabled = True
|
||||||
RblUsadosAjuste.SelectedValue = "0"
|
RblUsadosAjuste.SelectedValue = "0"
|
||||||
|
|
||||||
CveRemisionRecibida = -1
|
|
||||||
EsDistribuidor = False
|
EsDistribuidor = False
|
||||||
InicializaClientes(True)
|
InicializaClientes(True)
|
||||||
DdlClientes.Enabled = True
|
DdlClientes.Enabled = True
|
||||||
@@ -831,6 +833,14 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
|
|
||||||
'CargaInicial()
|
'CargaInicial()
|
||||||
|
|
||||||
|
|
||||||
|
If Me.ObjRemisionNC IsNot Nothing Then
|
||||||
|
Me.ObjRemisionNC.Dispose()
|
||||||
|
Me.ObjRemisionNC = Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
|
DtMovimientos.Rows.Clear()
|
||||||
|
|
||||||
UpGenerales.Update()
|
UpGenerales.Update()
|
||||||
UpRegistroTipoCambio.Update()
|
UpRegistroTipoCambio.Update()
|
||||||
UPDatos.Update()
|
UPDatos.Update()
|
||||||
@@ -1234,12 +1244,14 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub BtnGenerarRNC_Click(sender As Object, e As EventArgs) Handles BtnGenerarRNC.Click
|
Private Sub BtnGenerarRNC_Click(sender As Object, e As EventArgs) Handles BtnGenerarRNC.Click
|
||||||
Guardar(True)
|
Guardar(True, RecargarPagina:=True)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub Guardar(Optional GenerarRNC As Boolean = False, Optional RecargarPagina As Boolean = False)
|
Protected Sub Guardar(Optional GenerarRNC As Boolean = False, Optional RecargarPagina As Boolean = False)
|
||||||
If GvM.Rows.Count > 0 Then
|
If GvM.Rows.Count > 0 Then
|
||||||
Dim Msg As New StringBuilder()
|
Dim MsgError As New StringBuilder()
|
||||||
|
Dim Msg As New StringBuilder
|
||||||
|
|
||||||
Dim Resp As Modelos.Factura.MMensajeFactura = Nothing
|
Dim Resp As Modelos.Factura.MMensajeFactura = Nothing
|
||||||
Dim ObjInventario As New ClsInventarios
|
Dim ObjInventario As New ClsInventarios
|
||||||
Dim ObjAcum As New ClsAcumuladores(ObjInventario.IniciaTransacSQL())
|
Dim ObjAcum As New ClsAcumuladores(ObjInventario.IniciaTransacSQL())
|
||||||
@@ -1255,9 +1267,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
Dim CveSubProyecto As Integer = -1
|
Dim CveSubProyecto As Integer = -1
|
||||||
Dim ActivoFijo As Integer = -1
|
Dim ActivoFijo As Integer = -1
|
||||||
|
|
||||||
If CveMovimiento > 0 Then
|
If Not CveMovimiento > 0 Then
|
||||||
Else
|
|
||||||
|
|
||||||
Dim Fecha As Date = String.Format("{0}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd")).ToDate
|
Dim Fecha As Date = String.Format("{0}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd")).ToDate
|
||||||
Dim CveCliente As Integer = CInt(IIf((DdlClientes.SelectedValue.ToEntero <= 0), -1, DdlClientes.SelectedValue.ToEntero))
|
Dim CveCliente As Integer = CInt(IIf((DdlClientes.SelectedValue.ToEntero <= 0), -1, DdlClientes.SelectedValue.ToEntero))
|
||||||
Dim CveClienteSucursal As Integer = CInt(IIf((DdlClientesSucursales.SelectedValue.ToEntero <= 0), -1, DdlClientesSucursales.SelectedValue.ToEntero))
|
Dim CveClienteSucursal As Integer = CInt(IIf((DdlClientesSucursales.SelectedValue.ToEntero <= 0), -1, DdlClientesSucursales.SelectedValue.ToEntero))
|
||||||
@@ -1281,22 +1291,23 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
CargaDTDetalleRNC()
|
CargaDTDetalleRNC()
|
||||||
|
|
||||||
Resp = ObjRemisionNC.EmitirFactura(False, ObjInventario.IniciaTransacSQL)
|
Resp = ObjRemisionNC.EmitirFactura(False, ObjInventario.IniciaTransacSQL)
|
||||||
'For Each mensaje2 As String In Resp.Mensajes
|
|
||||||
' Msg.AppendFormat("<br>{0}", mensaje2)
|
|
||||||
'Next
|
|
||||||
If Resp.TieneError Then ErrorMovInv = True
|
|
||||||
'Alert(Msg.ToString, If(Resp.CveVenta > 0, TipoMensaje.MsgInformacion, TipoMensaje.MsgAdvertencia))
|
|
||||||
CveVenta = Resp.CveVenta
|
|
||||||
|
|
||||||
If Resp.CveMovimientoUsado <= 0 Then
|
If Resp.TieneError Then ErrorMovInv = True
|
||||||
Msg.Append("Error al guardar los movimientos de usados")
|
|
||||||
|
If Resp.CveVenta > 0 Then
|
||||||
|
CveVenta = Resp.CveVenta
|
||||||
|
Else
|
||||||
|
MsgError.Append("Error al generar la remisión de nota de crédito")
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Resp.CveMovimientoUsado <= 0 Then
|
||||||
|
MsgError.Append("Error al guardar los movimientos de usados")
|
||||||
|
ErrorMovInv = True
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim Mensaje As String = ""
|
|
||||||
Dim FolioInv As String = ""
|
Dim FolioInv As String = ""
|
||||||
|
|
||||||
If GenerarRNC Then
|
If GenerarRNC Then
|
||||||
@@ -1314,7 +1325,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text,
|
Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text,
|
||||||
PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="RU/G")
|
PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="RU/G")
|
||||||
If CveMovimiento <= 0 Then
|
If CveMovimiento <= 0 Then
|
||||||
Mensaje = "Error al guardar los movimientos"
|
MsgError.Append("Error al guardar los movimientos")
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
Else
|
Else
|
||||||
FolioInv = ObjInventario.Folio.ToString()
|
FolioInv = ObjInventario.Folio.ToString()
|
||||||
@@ -1322,14 +1333,14 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
For Each Dr As DataRow In DtMovimientos.Rows
|
For Each Dr As DataRow In DtMovimientos.Rows
|
||||||
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||||
Mensaje = "Error al guardar los movimientos"
|
MsgError.Append("Error al guardar los movimientos")
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then
|
If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then
|
||||||
Mensaje = "Error al actualizar el recibo de los usados"
|
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
|
MsgError.Append("Error al actualizar el recibo de los usados")
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -1346,7 +1357,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
|
|
||||||
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
|
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
|
||||||
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, NowADS(), CveMovimiento:=CveMovimiento) Then
|
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, NowADS(), CveMovimiento:=CveMovimiento) Then
|
||||||
Mensaje = "Error al guardar Movimientos de distribuidor"
|
MsgError.Append("Error al guardar Movimientos de distribuidor")
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@@ -1354,24 +1365,10 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
'ACTUALIZA LA POLIZA VIRTUAL DEL LA REMISION
|
If Not ErrorMovInv AndAlso ObjFactura.CveCliente <> CveCliente Then
|
||||||
'If Not ErrorMovInv AndAlso ObjFactura.TipoDocto = "Rem" Then
|
ErrorMovInv = True
|
||||||
' If ObjAcum.GetPolizasVirtuales(ObjFactura.CveVenta) Then
|
MsgError.Append("Error al asignar el cliente")
|
||||||
' Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
|
End If
|
||||||
' For Each RowPoliza As DataRow In DtPoliza.Rows
|
|
||||||
' If Not ObjAcum.UpdatePolizaVirtual(RowPoliza("CvePolizaVirtual").ToString().ToEntero, DdlMarcaRem.SelectedValue.ToEntero(), TxtFechaVigencia.Text.ToDateTime()) Then
|
|
||||||
' Mensaje = "Error al guardar la póliza virtual"
|
|
||||||
' ErrorMovInv = True
|
|
||||||
' Exit For
|
|
||||||
' End If
|
|
||||||
' Next
|
|
||||||
|
|
||||||
' DtPoliza.Dispose()
|
|
||||||
' Else
|
|
||||||
' Mensaje = "Error al obtener la póliza virtual"
|
|
||||||
' ErrorMovInv = True
|
|
||||||
' End If
|
|
||||||
'End If
|
|
||||||
|
|
||||||
''GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC
|
''GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC
|
||||||
If Not ErrorMovInv Then
|
If Not ErrorMovInv Then
|
||||||
@@ -1384,14 +1381,12 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
|
|
||||||
|
|
||||||
If Not ErrorMovInv Then
|
If Not ErrorMovInv Then
|
||||||
|
|
||||||
If Resp IsNot Nothing Then
|
If Resp IsNot Nothing Then
|
||||||
For Each mensaje2 As String In Resp.Mensajes
|
For Each mensaje2 As String In Resp.Mensajes
|
||||||
Msg.AppendFormat("<br>{0}", mensaje2)
|
Msg.AppendFormat("<br>{0}", mensaje2)
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ErrorMovInv Then
|
|
||||||
|
|
||||||
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b><a href='/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}' target='_blank'>{0}</a></b>", FolioInv, CveMovimiento)
|
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b><a href='/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}' target='_blank'>{0}</a></b>", FolioInv, 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)))
|
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)))
|
||||||
@@ -1399,27 +1394,17 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
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")
|
|
||||||
End If
|
|
||||||
|
|
||||||
' EnvioCorreo()
|
|
||||||
|
|
||||||
CargaPendientesRecibir()
|
|
||||||
UPDatos.Update()
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ObjInventario.RollBack() 'deshace lo insertado
|
ObjInventario.RollBack() 'deshace lo insertado
|
||||||
CveMovimiento = 0
|
CveMovimiento = 0
|
||||||
Alert("ocurrió un Error al registrar los movimientos", TipoMensaje.MsgError)
|
MsgError.Append("Ocurrió un error al registrar.")
|
||||||
|
Alert(MsgError.ToString(), TipoMensaje.MsgError)
|
||||||
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
|
||||||
Alert("Ocurrió un Error inesperado en el registro" & ex.Message, TipoMensaje.MsgError)
|
Alert("Ocurrió un error inesperado en el registro" & ex.Message, TipoMensaje.MsgError)
|
||||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@@ -1435,15 +1420,19 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Alert(Msg.ToString, TipoMensaje.MsgInformacion, JSBtnAceptar:=Liga, ShowCloseButton:=False)
|
Alert(Msg.ToString, TipoMensaje.MsgInformacion, JSBtnAceptar:=Liga, ShowCloseButton:=False)
|
||||||
End If
|
|
||||||
|
|
||||||
|
If CveRemisionRecibida > 0 Then
|
||||||
|
CargaRemisionesPendientes()
|
||||||
|
UPDatos.Update()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgError)
|
Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgError)
|
||||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
LimpiarMovimiento()
|
LimpiarMovimiento()
|
||||||
CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
|
CargaGVM(DtMovimientos)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -1655,7 +1644,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " GVM "
|
#Region " GVM "
|
||||||
Private Sub CargaGVM(DtTemp As DataTable)
|
Private Sub CargaGVM(ByRef DtTemp As DataTable)
|
||||||
GvM.DataSource = DtTemp
|
GvM.DataSource = DtTemp
|
||||||
GvM.DataBind()
|
GvM.DataBind()
|
||||||
|
|
||||||
@@ -2243,10 +2232,10 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub BtnConsultarPendientes_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnConsultarPendientes_Click(sender As Object, e As EventArgs)
|
||||||
CargaPendientesRecibir()
|
CargaRemisionesPendientes()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaPendientesRecibir()
|
Private Sub CargaRemisionesPendientes()
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
If ObjVentas.GetVentasUsados(-1, DdlSubProyectos.SelectedValue.ToEntero(), TxtFechaPendientes.Text.ToDateTime(), UsuarioActual.CveEmpresa, ServicioDomicilio:=ChkServicioDomicilio.Checked) Then
|
If ObjVentas.GetVentasUsados(-1, DdlSubProyectos.SelectedValue.ToEntero(), TxtFechaPendientes.Text.ToDateTime(), UsuarioActual.CveEmpresa, ServicioDomicilio:=ChkServicioDomicilio.Checked) Then
|
||||||
GVPendientes.DataSource = ObjVentas.DtResultados
|
GVPendientes.DataSource = ObjVentas.DtResultados
|
||||||
@@ -2365,8 +2354,7 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If DtUsados IsNot Nothing Then
|
If DtUsados IsNot Nothing Then
|
||||||
|
AgregarUsado = True
|
||||||
'DivRecepcionApartado.Visible = True
|
|
||||||
|
|
||||||
For Each RowUsado As DataRow In DtUsados.Rows
|
For Each RowUsado As DataRow In DtUsados.Rows
|
||||||
Dim CvePS As Integer = RowUsado("CvePS").ToString().ToEntero()
|
Dim CvePS As Integer = RowUsado("CvePS").ToString().ToEntero()
|
||||||
@@ -2382,8 +2370,9 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
Dim CveVentaDetalle As Integer = RowUsado("CveVentaDetalle").ToString().ToEntero()
|
Dim CveVentaDetalle As Integer = RowUsado("CveVentaDetalle").ToString().ToEntero()
|
||||||
|
|
||||||
AddNew(CvePS, PS, CveUM, UM, Cantidad, PU, "", "-1", "-1", "-1", "", "", DdlAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedItem.Text, "", CveTamaño, CveVentaDetalle:=CveVentaDetalle)
|
AddNew(CvePS, PS, CveUM, UM, Cantidad, PU, "", "-1", "-1", "-1", "", "", DdlAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedItem.Text, "", CveTamaño, CveVentaDetalle:=CveVentaDetalle)
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
AgregarUsado = False
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Alert("No se pudo recibir la remisión", TipoMensaje.MsgAdvertencia)
|
Alert("No se pudo recibir la remisión", TipoMensaje.MsgAdvertencia)
|
||||||
|
|||||||
Reference in New Issue
Block a user