cambios global

- permiso inv fisico
- oc, recarga global ps
- actualiza precio,s que considere funcionalidad de listas de precio
This commit is contained in:
2020-01-03 12:30:08 -07:00
parent b7abe00c84
commit 9dfb2de7df
11 changed files with 158 additions and 94 deletions

View File

@@ -1003,6 +1003,12 @@ Partial Class Inventarios_RecepcionUsados
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
If DdlClientes.SelectedValue.ToEntero <= 0 Then
Alert("No se ha especificado el cliente", TipoMensaje.MsgError)
Exit Sub
End If
'SI ES DISTRIBUIDOR Y NO VIENE DE REMISION, GENERA UNA REMISION DE NOTA DE CREDITO
If EsDistribuidor AndAlso Me.CveRemisionRecibida <= 0 Then
Dim CveCliente As Integer = DdlClientes.SelectedValue.ToEntero()
@@ -1107,7 +1113,7 @@ Partial Class Inventarios_RecepcionUsados
'si es selectedvalue = 42, es entrada ,3 -salida
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2)
If RBLOpcion.SelectedValue.ToEntero = 42 AndAlso EsDistribuidor Then
If RBLOpcion.SelectedValue.ToEntero = 42 AndAlso EsDistribuidor AndAlso Dr("CveTamaño").ToString.ToEntero > 0 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
@@ -2067,6 +2073,8 @@ Partial Class Inventarios_RecepcionUsados
Me.ObjRemisionNC.SetCliente()
Me.ObjRemisionNC.CveAlmacen = -1
Dim ObjCliente As New ClsClientes
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
@@ -2112,7 +2120,11 @@ Partial Class Inventarios_RecepcionUsados
End If
ObjVentas.Dispose()
Me.ObjRemisionNC.Observaciones = ""
If RblUsadosAjuste.SelectedValue = "1" Then
Me.ObjRemisionNC.Observaciones = "Descuento por garantía"
Else
Me.ObjRemisionNC.Observaciones = "Devolución por usado"
End If
Me.ObjRemisionNC.OrdenCompra = ""
Me.ObjRemisionNC.PedidoContrato = ""
Me.ObjRemisionNC.ObservacionesAlmacen = ""
@@ -2125,7 +2137,7 @@ Partial Class Inventarios_RecepcionUsados
Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D) As Boolean
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D, Optional CveTamaño As Integer = 0) As Boolean
Dim Retorno As Boolean = False
If Not CvePS > 0 Then
@@ -2238,8 +2250,9 @@ Partial Class Inventarios_RecepcionUsados
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
Row("CuentaPredial") = CuentaPredial
Row("EsCargo") = EsCargo
'RECARGAR GV
Row("CveTamaño") = CveTamaño
'RECARGAR GV
TmpDT.Rows.Add(Row)
TmpDT.AcceptChanges()
Retorno = True
@@ -2344,6 +2357,7 @@ Partial Class Inventarios_RecepcionUsados
Dim CvePS As Integer = Row.DataKey("CvePS").ToEntero()
Dim Cantidad As Decimal = Row.DataKey("Cantidad").ToDecimal()
Dim PU As Decimal = Row.DataKey("PU").ToDecimal()
Dim CveTamaño As Integer = Row.DataKey("CveTamaño").ToEntero()
Dim SubTotal As Decimal = Cantidad * PU
Dim CveUnidadMedida As Integer = 0
@@ -2368,11 +2382,32 @@ Partial Class Inventarios_RecepcionUsados
End If
End If
AddPSRNC(ObjRemisionNC.DtDetalle, Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Inv/RecepcionUsados", PU, 0, -1, "",
ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA)
AddPSRNC(ObjRemisionNC.DtDetalle, Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "", PU, 0, -1, "",
ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA, CveTamaño:=CveTamaño)
End If
Next
If RblUsadosAjuste.SelectedValue = "1" Then
'agrego un registro extra del importe de ajuste
Dim PU As Decimal = TxtImporteAjuste.Text.ToDecimal
Dim CveSATNC As String = "84111506"
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).FiltroPrimero("")
If Dr IsNot Nothing Then
Dim CveUnidadMedida, CveClasificacion, CvePS As Integer
CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero
CveClasificacion = Dr("CveClasificacion").ToString.ToEntero
CvePS = Dr("CvePS").ToString.ToEntero
Dim PorcentajeIVA As Decimal = 0.16D
Dim Obs As String = "Descuento por garantía"
AddPSRNC(ObjRemisionNC.DtDetalle, 1, CveUnidadMedida, "", CveClasificacion, "", CvePS, "", Obs, PU, 0, -1, "",
ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA)
Else
End If
End If
Dim TotalImporte As Decimal = ObjRemisionNC.DtDetalle.SUM("TotalImporte").ToDecimal()
Dim ImporteIVA As Decimal = ObjRemisionNC.DtDetalle.SUM("ImporteIVA").ToDecimal()
Dim ImporteRetIVA As Decimal = ObjRemisionNC.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
@@ -2405,12 +2440,23 @@ Partial Class Inventarios_RecepcionUsados
#Region "Ajustes"
Public Sub OnRblUsadosAjuste_Change(sender As Object, e As EventArgs)
DdlAlmacen.Items.Clear()
If RblUsadosAjuste.SelectedValue = "1" Then
CargaAjuste()
DivAjuste.Visible = True
'Llenar el dropdownlist de almacén
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 6)
LnkAgregarUsado.Visible = False
UppAcciones.Update()
Else
DivAjuste.Visible = False
'Llenar el dropdownlist de almacén
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 22)
LnkAgregarUsado.Visible = True
UppAcciones.Update()
End If
DdlAlmacen.DataBind()
End Sub
Private Sub CargaAjuste()
@@ -2496,6 +2542,7 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Private Sub CargaBCIAjuste()
DdlBCIAjuste.Items.Clear()
Dim ObjGral As New ClsGenerales
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
DdlBCIAjuste.DataSource = ObjGral.DtResultados
@@ -2506,6 +2553,7 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Private Sub CargaFolioAjuste()
DdlFolioGarantia.Items.Clear()
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.FoliosGarantiaGet(-1, UsuarioActual.CveEmpresa) Then
DdlFolioGarantia.DataSource = ObjAcum.DtResultados
@@ -2519,16 +2567,17 @@ Partial Class Inventarios_RecepcionUsados
Dim ObjAcumuladores As New ClsAcumuladores
If ObjAcumuladores.GetNuevoConsecutivoFolio(DdlFolioGarantia.SelectedValue.ToEntero) Then
Dim resultado As String = ObjAcumuladores.DtResultados.FiltroPrimeroValor("NuevoConsecutivo")
TxtConsecutivoAjuste.Text = resultado
TxtConsecutivoAjuste.Text = (resultado.ToEntero + 1).ToString
UpAjuste.Update()
End If
ObjAcumuladores.Dispose()
End Sub
Protected Sub CargaTipoDeUso()
DdlTipoUso.Items.Clear()
DdlTipoUso.DataSource = GlobalDTAcumTiposUso.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlTipoUso.DataBind
DdlTipoUso.DataBind()
End Sub
Protected Sub DdlTipoUso_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -2637,14 +2686,22 @@ Partial Class Inventarios_RecepcionUsados
If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then
CveTamaño = ObjPS.DtResultados.FiltroPrimeroValor("CveTamaño").ToEntero
End If
Dim Datos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa))
Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa))
Dim TamañoPS As DataRow
If ObjPS.GetPS(Datos.Item("CvePSCargo").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then
TamañoPS = ObjPS.DtResultados.FiltroPrimero("")
If drDatos IsNot Nothing Then
Dim Importe As Decimal = drDatos("Cargo").ToString.ToDecimal
Dim drTamañoPS As DataRow = Nothing
DtMovimientos.Rows.Clear()
If ObjPS.GetPS(drDatos.Item("CvePSCargo").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then
drTamañoPS = ObjPS.DtResultados.FiltroPrimero("")
'CveTamaño = -1 'limpio esta variable para que no se registre dos veces en la clase Modelos
AddNew(drTamañoPS.Item("CvePS").ToString.ToEntero, drTamañoPS.Item("PSCodigo").ToString, drTamañoPS.Item("CveUM").ToString.ToEntero, drTamañoPS.Item("UnidadMedida").ToString, 1.0, Importe,
"", "-1", "-1", "-1", "", "", "", -1, "", "", CveTamaño)
End If
End If
AddNew(TamañoPS.Item("CvePS").ToString.ToEntero, TamañoPS.Item("PSCodigo").ToString, TamañoPS.Item("CveUM").ToString.ToEntero, TamañoPS.Item("UnidadMedida").ToString, 1.0, TxtPUFactura.Text.ToDouble,
"", "-1", "-1", "-1", "", "", "", -1, "", "", -1)
ObjPS.Dispose()
End Sub
#End Region