cambios en recepcion de usados
This commit is contained in:
@@ -808,7 +808,7 @@
|
||||
<asp:GridView ID="GvM" runat="server" GridLines="none" Width="70%"
|
||||
CssClass="table table-hover ADScroller btn-xs" ShowHeader="True"
|
||||
EmptyDataText="Aún no hay registros." DataKeyNames="No,CveMovimientoDetalle,CvePS,PU,Cantidad,CveTamaño,CodigoPS"
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="True" ShowHeaderWhenEmpty="True">
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="True" ShowHeaderWhenEmpty="True" OnRowDataBound="GvM_RowDataBound" >
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="" ItemStyle-Font-Size="6pt">
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -32,14 +32,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ViewState("DtMovimientos") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property ConsecutivoVenta As Integer
|
||||
Get
|
||||
Return ViewState("ConsecutivoVenta").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("ConsecutivoVenta") = value
|
||||
End Set
|
||||
End Property
|
||||
Public Property DtTamaños() As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtTamaños"), DataTable)
|
||||
@@ -365,7 +357,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End Sub
|
||||
|
||||
Private Sub CargaInicial()
|
||||
ConsecutivoVenta = 0
|
||||
CveMovimiento = -1
|
||||
CveMovimientoRelacionado = -1
|
||||
TieneRelacionado = -1
|
||||
@@ -1069,11 +1060,32 @@ Partial Class Inventarios_RecepcionUsados
|
||||
txtCantidad.Focus()
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub AddNew(CvePS As Integer, PS As String, CveUM As Integer, UM As String, Cantidad As Double, PU As Double, Serie As String, CodigoAF As String, Codigo As String,
|
||||
''' <summary>
|
||||
''' Regeresa el id temporal del registro en el tmpdt
|
||||
''' </summary>
|
||||
''' <param name="CvePS"></param>
|
||||
''' <param name="PS"></param>
|
||||
''' <param name="CveUM"></param>
|
||||
''' <param name="UM"></param>
|
||||
''' <param name="Cantidad"></param>
|
||||
''' <param name="PU"></param>
|
||||
''' <param name="Serie"></param>
|
||||
''' <param name="CodigoAF"></param>
|
||||
''' <param name="Codigo"></param>
|
||||
''' <param name="CveAF"></param>
|
||||
''' <param name="Observaciones"></param>
|
||||
''' <param name="Lote"></param>
|
||||
''' <param name="CveSeccionAlmacen"></param>
|
||||
''' <param name="SeccionAlmacen"></param>
|
||||
''' <param name="Tamaño"></param>
|
||||
''' <param name="CveTamaño"></param>
|
||||
''' <param name="CveVentaDetalle"></param>
|
||||
''' <returns></returns>
|
||||
Protected Function AddNew(CvePS As Integer, PS As String, CveUM As Integer, UM As String, Cantidad As Double, PU As Double, Serie As String, CodigoAF As String, Codigo As String,
|
||||
CveAF As String, Observaciones As String, Lote As String, CveSeccionAlmacen As Integer, SeccionAlmacen As String, Tamaño As String, CveTamaño As Integer,
|
||||
Optional CveVentaDetalle As Integer = -1)
|
||||
Optional CveVentaDetalle As Integer = -1) As Integer
|
||||
|
||||
Dim Retorno As Integer = -1
|
||||
'If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlProducto2.SelectedText = "" : Exit Sub
|
||||
|
||||
Dim Valido As Boolean = True
|
||||
@@ -1100,7 +1112,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
If Cantidad > CantidadPermitida Then
|
||||
Alert($"La cantidad es mayor a la permitida", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
Return -1
|
||||
End If
|
||||
|
||||
'Else
|
||||
@@ -1112,7 +1124,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
'VALIDA QUE LA SERIE NO SEA IGUAL AL CODIGO O CODIGOBARRAS
|
||||
If Serie <> "" And (Serie.ToUpper = dr("Codigo").ToString.ToUpper Or Serie.ToUpper = dr("CodigoBarras").ToString.ToUpper) Then
|
||||
Alert($"La serie indicada <b>{Serie}</b> coincide con el codigo o codigo de barras del producto. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
Return -1
|
||||
End If
|
||||
|
||||
Dim registro As DataRow = DtMovimientos.NewRow
|
||||
@@ -1150,8 +1162,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
If Not ChkSeguirAgregando.Checked Then
|
||||
RegistraScript("$('#DivModalAgregar').modal('hide')", "hidemodal")
|
||||
End If
|
||||
Else
|
||||
|
||||
Retorno = DtMovimientos.FiltroPrimeroValor("No", Orderby:="No DESC").ToEntero()
|
||||
|
||||
Else
|
||||
|
||||
DtMovimientos.Rows(IndexDTUsado)("Cantidad") = Cantidad
|
||||
DtMovimientos.Rows(IndexDTUsado)("CveUM") = CveUM
|
||||
@@ -1181,6 +1195,8 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
DtMovimientos.AcceptChanges()
|
||||
|
||||
Retorno = DtMovimientos.Rows(IndexDTUsado)("No").ToString().ToEntero()
|
||||
|
||||
CargaGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' "))
|
||||
|
||||
If Not ChkSeguirAgregando.Checked Then
|
||||
@@ -1188,7 +1204,8 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||
If DdlClientes.SelectedValue.ToEntero <= 0 Then
|
||||
@@ -1678,10 +1695,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
TxtTotal.Text = Total.FormatoNumero(2)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub GvM_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
|
||||
|
||||
End Sub
|
||||
Protected Sub GvM_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvM.RowEditing
|
||||
GvM.EditIndex = e.NewEditIndex
|
||||
@@ -1736,6 +1749,14 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
End If
|
||||
DtMovimientos.AcceptChanges()
|
||||
|
||||
If TmpDTAjustes IsNot Nothing Then
|
||||
Dim DrAjustes As DataRow() = TmpDTAjustes.Select(String.Format("ConsecutivoVenta = {0}", i))
|
||||
If DrAjustes.Count > 0 Then
|
||||
DrAjustes(0).Delete()
|
||||
End If
|
||||
TmpDTAjustes.AcceptChanges()
|
||||
End If
|
||||
End If
|
||||
|
||||
GvM.EditIndex = -1
|
||||
@@ -2833,7 +2854,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
If AddPSRNC(ObjRemisionNC.DtDetalle, 1, CveUnidadMedida, "", CveClasificacion, "", CvePS, "", Obs, PU, 0, -1, "",
|
||||
ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA) Then
|
||||
ConsecutivoVenta += 1
|
||||
End If
|
||||
|
||||
Else
|
||||
@@ -3263,16 +3283,23 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
UpAjuste.Update()
|
||||
End Sub
|
||||
Private Sub GuardaAjuste()
|
||||
Private Sub GuardaAjuste(ConsecutivoVenta As Integer)
|
||||
|
||||
Dim CargoAnterior As Double = 0
|
||||
Dim CargoActual As Double = 0
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
Dim EsNuevo As Boolean = true
|
||||
|
||||
ConsecutivoVenta += 1
|
||||
Dim RowsAjustes = TmpDTAjustes.Select($"ConsecutivoVenta = {ConsecutivoVenta}")
|
||||
|
||||
If RowsAjustes IsNot Nothing AndAlso RowsAjustes.Length > 0 Then
|
||||
Row = RowsAjustes(0)
|
||||
EsNuevo = False
|
||||
Else
|
||||
Row = TmpDTAjustes.NewRow
|
||||
End If
|
||||
|
||||
Row = TmpDTAjustes.NewRow
|
||||
Row("CveFolioGarantia") = DdlFolioGarantia.SelectedValue.ToEntero
|
||||
Row("CveTipoUso") = DdlTipoUso.SelectedValue.ToEntero
|
||||
Row("CveTipoDefecto") = DdlTipoDefecto.SelectedValue.ToEntero
|
||||
@@ -3308,8 +3335,12 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Row("CveClienteDistribuidor") = -1
|
||||
Row("CveModeloAuto") = -1
|
||||
Row("Año") = ""
|
||||
TmpDTAjustes.Rows.Add(Row)
|
||||
|
||||
If EsNuevo Then
|
||||
TmpDTAjustes.Rows.Add(Row)
|
||||
Else
|
||||
TmpDTAjustes.AcceptChanges()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
|
||||
@@ -3355,7 +3386,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Alert("Ya existe un consecutivo vigente en este folio", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim IdConsecutivo As Integer = -1
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
Try
|
||||
Dim CveTamaño As Integer = -1
|
||||
@@ -3367,6 +3398,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Dim Importe As Decimal = 0
|
||||
Dim drTamañoPS As DataRow = Nothing
|
||||
|
||||
TmpDTAjustes.Rows.Clear()
|
||||
DtMovimientos.Rows.Clear()
|
||||
|
||||
' USADOS
|
||||
@@ -3388,7 +3420,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
If ObjPS.GetPS(CvePS, -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,
|
||||
IdConsecutivo = 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
|
||||
Else
|
||||
@@ -3403,7 +3435,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ObjPS.Dispose()
|
||||
|
||||
If Not ErrorAjuste Then
|
||||
GuardaAjuste()
|
||||
GuardaAjuste(IdConsecutivo)
|
||||
End If
|
||||
|
||||
|
||||
@@ -3717,4 +3749,12 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
Protected Sub GvM_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
'SI ES GARANTIA, NO DEBE PERMTIR ELIMINAR
|
||||
If RblUsadosAjuste.SelectedValue = "1" Then
|
||||
e.Row.FCLinkButton("LnkActuallizarUsado").Visible = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user