Correcion en punto de venta de recepcion de usados

This commit is contained in:
2019-10-03 18:13:38 -07:00
parent 0d246347a1
commit 85f2c7576f
10 changed files with 2020 additions and 1850 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -197,6 +197,14 @@ Partial Class Inventarios_RecepcionUsados
Set(value As Integer)
ViewState("FolioAsignado") = value
End Set
End Property
Private Property CveRemisionRecibida As Integer
Get
Return IfNull(ViewState("CveRemisionRecibida"), -1, CType(ViewState("CveRemisionRecibida"), Integer)).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveRemisionRecibida") = value
End Set
End Property
@@ -270,6 +278,7 @@ Partial Class Inventarios_RecepcionUsados
CreaDT()
CargaCombos()
TxtFecha.Text = Now.ToShortDateString
TxtFechaPendientes.Text = Now.ToShortDateString
RVFecha.MaximumValue = Now.ToShortDateString
InicializaClientes()
@@ -298,6 +307,7 @@ Partial Class Inventarios_RecepcionUsados
End If
End If
CargaSubProyectosUsados()
InicializaBitacoraTemporal()
If UsuarioActual.Empresa.Funcionalidad(132) = "1" Then
@@ -506,9 +516,31 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Private Sub CargaSubProyectos()
DdlSubProyecto.DataSource = If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1))
DdlSubProyecto.DataBind()
DdlSubProyecto.DataBind()
'DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Private Sub CargaSubProyectosUsados()
If UsuarioActual.CveEmpresa = 140 Then
DivRecepcionUsados.Visible = True
If Not UsuarioActual.TienePermisoProceso(190) Then
'CARGA SOLO LAS SUCURSALES DE LOS ALMCENES QUE TIENE ASIGNADO EL USUARIO
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.GetSucursalesAlmacenUsuario(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
DdlSubProyectos.DataSource = ObjInventarios.DtResultados
End If
ObjInventarios.Dispose()
Else
DdlSubProyectos.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
End If
DdlSubProyectos.DataBind()
DdlSubProyectos.SelectedValueExist(UsuarioActual.CveSubProyecto.ToString)
End If
End Sub
Private Sub CargaPersonal()
TrPersonal.Visible = True
Dim dt As DataTable = Nothing
@@ -940,16 +972,12 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
If GvM.Rows.Count > 0 Then
'Dim CveMovimiento As Integer
Dim ObjInventario As New ClsInventarios
Dim ObjAcum As New ClsAcumuladores(ObjInventario.IniciaTransacSQL())
Dim ObjVentas As New ClsVentas(ObjInventario.IniciaTransacSQL())
Dim ErrorMovInv As Boolean = False
Dim ErrorAC As Boolean = False
@@ -978,9 +1006,12 @@ Partial Class Inventarios_RecepcionUsados
End If
Dim tCveProveedor As Integer = -1
If DdlProveedor.SelectedValue.ToEntero > 0 Then tCveProveedor = DdlProveedor.SelectedValue.ToEntero
Dim CveVenta As Integer = -1
If CveRemisionRecibida > 0 Then
CveVenta = CveRemisionRecibida
End If
'Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.ToDate, $" {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1,
CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta,
CveSubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero,
Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text,
PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor)
@@ -1007,6 +1038,12 @@ Partial Class Inventarios_RecepcionUsados
Exit For
End If
If Not ObjVentas.UpdateVentaUsadoRecibido(CveRemisionRecibida, Dr("CvePS").ToString.ToEntero, True) Then
Mensaje = "Error al actualizar el recibo de los usados"
ErrorMovInv = True
Exit For
End If
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2)
@@ -1091,11 +1128,11 @@ Partial Class Inventarios_RecepcionUsados
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')")
End If
End Sub
End Sub
#End Region
#Region " ADD INVENTARIO INICIAL "
Protected Sub BtnCodigoBarras_Click(sender As Object, e As EventArgs)
@@ -1931,6 +1968,47 @@ Partial Class Inventarios_RecepcionUsados
End If
SiguienteFolio()
UpGenerales.Update()
End Sub
End Sub
Protected Sub BtnConsultarPendientes_Click(sender As Object, e As EventArgs)
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVentasUsados(-1, DdlSubProyectos.SelectedValue.ToEntero(), TxtFechaPendientes.Text.ToDateTime(), UsuarioActual.CveEmpresa) Then
GVPendientes.DataSource = ObjVentas.DtResultados
End If
ObjVentas.Dispose()
GVPendientes.DataBind()
UpGenerales.Update()
End Sub
Protected Sub BtnRecibir_Click(sender As Object, e As EventArgs)
Me.CveRemisionRecibida = -1
Me.CveRemisionRecibida = CType(CType(sender, LinkButton).NamingContainer, GridViewRow).DataKey("CveVenta").ToEntero()
Dim DtUsados As DataTable = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then
DtUsados = ObjVentas.DtResultados.Copy()
End If
ObjVentas.Dispose()
If DtUsados IsNot Nothing Then
For Each RowUsado As DataRow In DtUsados.Rows
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
Dim RowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) '.FiltroPrimeroValor("CveTamaño", $"CvePS = { DdlProducto2.SelectedValue.ToEntero }").ToEntero
Dim CveTamaño As Integer = RowPS("CveTamaño").ToString().ToEntero()
Dim PS As String = RowPS("PS").ToString()
Dim CveUM As Integer = RowPS("CveUnidadMedida").ToString().ToEntero()
Dim UM As String = RowPS("UnidadMedida").ToString()
Dim Cantidad As Double = RowUsado("Cantidad").ToString().ToEntero()
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
AddNew(CvePS, PS, CveUM, UM, Cantidad, PU,
"", "-1", "-1", "-1", "", "", "", DdlAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedItem.Text, "", CveTamaño)
Next
End If
End Sub
End Class