This commit is contained in:
HECTOR RODRIGUEZ
2021-03-17 11:07:43 -07:00
10 changed files with 408 additions and 215 deletions

View File

@@ -583,8 +583,15 @@ Partial Class Inventarios_EntregaAlmacen
HLFolio.Text = DtDatos.Rows(0)("SerieFolio").ToString()
If UsuarioActual.TienePermisoProceso(201) Then
HLFolio.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={CveVenta}"
End If
End If
'filtra los Almacenes de domicilio
If DtDatos.Rows(0)("ServicioDomicilio").ToString() = "True" Then
StrAlmacenes = String.Format("{0} AND Almacen like '%Domicilio%' ", StrAlmacenes)
Else
StrAlmacenes = String.Format("{0} AND NOT (Almacen like '%Domicilio%') ", StrAlmacenes)
End If
LbObservaciones.Text = DtDatos.Rows(0)("Observaciones").ToString()
LbObservacionesAlmacen.Text = DtDatos.Rows(0)("ObservacionesAlmacen").ToString()
CveVentaSurtir = CveVenta
@@ -3064,8 +3071,7 @@ Partial Class Inventarios_EntregaAlmacen
Dim CveMovimientoEntrada As Integer
Dim FolioEntrada As Integer
Dim ErrorMovInv As Boolean
Dim DtDetalle As New DataTable
Dim DtDetalleLote As New DataTable
Dim DtDetalle As New DataTable
Dim TextoError = ""
'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH
@@ -3175,7 +3181,7 @@ Partial Class Inventarios_EntregaAlmacen
CveSeccionAlmacen = If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1)
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec")))
DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec")))
'DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec")))
If DtDetalle.Rows.Count > 0 Then 'SI FUE POR SERIE
For Each Dr1 As DataRow In DtDetalle.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, Serie:=Dr1("Serie").ToString(), Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then
@@ -3183,17 +3189,17 @@ Partial Class Inventarios_EntregaAlmacen
TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
Exit For
End If
Next
ElseIf DtDetalleLote.Rows.Count > 0 Then 'SI FUE POR LOTE BATCH
For Each Dr1 As DataRow In DtDetalleLote.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr1("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, Serie:="", Lote:=Dr1("Lote").ToString(), FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
Exit For
End If
Next
Next
'ElseIf DtDetalleLote.Rows.Count > 0 Then 'SI FUE POR LOTE BATCH
' For Each Dr1 As DataRow In DtDetalleLote.Rows
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr1("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, Serie:="", Lote:=Dr1("Lote").ToString(), FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then
' ErrorMovInv = True
' TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
' Exit For
' End If
' Next
Else 'NORMAL
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("CantidadGV").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, -1, FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("CantidadGV").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, -1, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then
ErrorMovInv = True
TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
Exit For
@@ -3219,12 +3225,8 @@ Partial Class Inventarios_EntregaAlmacen
If CveMovimientoEntrada > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim CveSeccionAlmacen As Integer = -1
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
'If CBool(Dr("AplicaSeccion")) Then
' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, Almacen2, Dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero()
'Else
' CveSeccionAlmacen = -1
'End If
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then

View File

@@ -126,7 +126,7 @@
<asp:UpdatePanel runat="server" ID="UppEntrega" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvD" DataKeyNames="CveUM,CvePS,CveSeccionAlmacen,Serie,Lote,FechaCaducidad,CveMovimientoDetalle,CveMovimiento, AplicaLote, AplicaCaducidad" runat="server" AutoGenerateColumns="False" EmptyDataText="No hay movimientos pendientes" CssClass="table table-hover Widthall" GridLines="None">
<asp:GridView ID="GvD" DataKeyNames="CveUM,CvePS,CveSeccionAlmacen,Serie,Lote,FechaCaducidad,CveMovimientoDetalle,CveMovimiento, AplicaLote, AplicaCaducidad,PS" runat="server" AutoGenerateColumns="False" EmptyDataText="No hay movimientos pendientes" CssClass="table table-hover Widthall" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center">
<%--<HeaderTemplate>
@@ -138,7 +138,7 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" Visible="false" Width="60px" runat="server" Text="0" Enabled="false"></asp:TextBox>
<asp:TextBox ID="TxtCantidad" Visible="false" Width="60px" runat="server" Text="0" Enabled="false" Style="text-align:right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros2" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
</ItemTemplate>
</asp:TemplateField>

View File

@@ -69,8 +69,8 @@ Partial Class Inventarios_PrestamosdeProveedor
End If
GvD.Columns(6).Visible = ObjInv.DtResultados.MAX("Serie") <> ""
GvD.Columns(7).Visible = ObjInv.DtResultados.MAX("Lote") <> ""
GvD.Columns(8).Visible = ObjInv.DtResultados.MAX("FechaCaducidad").ToDate > MinFecha
GvD.Columns(7).Visible = ObjInv.DtResultados.MAX("AplicaLote") = "True" 'MAX("Lote") <> ""
GvD.Columns(8).Visible = ObjInv.DtResultados.MAX("AplicaCaducidad") = "True" 'MAX("FechaCaducidad").ToDate > MinFecha
GvD.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
ObjInv.Dispose()
@@ -141,10 +141,11 @@ Partial Class Inventarios_PrestamosdeProveedor
Dim Lote As String = "-1"
Dim FechaCaducidad As Date = MinFecha
If gvr.DataKey("Serie") <> "" Then Serie = gvr.DataKey("Serie")
If gvr.DataKey("Lote") <> "" Then Lote = gvr.DataKey("Lote")
If gvr.DataKey("FechaCaducidad").ToDate > MinFecha Then FechaCaducidad = gvr.DataKey("FechaCaducidad")
If gvr.DataKey("AplicaLote") = "True" Then Lote = gvr.FCTextBox("TxtLote").Text ' gvr.DataKey("Lote")
If gvr.DataKey("AplicaCaducidad") = "True" Then FechaCaducidad = gvr.FCTextBox("TxtFechaCaducidad").Text.todate ' gvr.DataKey("Lote")
'If gvr.DataKey("FechaCaducidad").ToDate > MinFecha Then FechaCaducidad = gvr.DataKey("FechaCaducidad")
Dim Valido = ValidaExistencia(gvr.FCTextBox("TxtCantidad").Text.ToDecimal, gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad)
Dim Valido = ValidaExistencia(gvr.FCTextBox("TxtCantidad").Text.ToDecimal, gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie, Lote, FechaCaducidad, gvr.DataKey("PS"))
If Not Valido Then
Alert("No hay existencia del producto a devolver.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -273,7 +274,7 @@ Partial Class Inventarios_PrestamosdeProveedor
End If
End Sub
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, FechaCaducidad As Date) As Boolean
Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, CveSeccionAlmacen As Integer, Serie As String, Lote As String, FechaCaducidad As Date, PS As String) As Boolean
Dim Retorno = True
Dim Inv As New ClsInventarios
@@ -283,9 +284,9 @@ Partial Class Inventarios_PrestamosdeProveedor
If Existencia - Cantidad < 0 Then
If Existencia < 0 Then
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
Alert(String.Format("No hay existencia del producto: ", PS), TipoMensaje.MsgAdvertencia)
Else
Alert(String.Format("Solo hay en existencia: {0}", Existencia), TipoMensaje.MsgAdvertencia)
Alert(String.Format("Solo hay en existencia: {0} en el producto: {1}", Existencia, PS), TipoMensaje.MsgAdvertencia)
End If
Retorno = False
End If

View File

@@ -326,6 +326,7 @@ Partial Class Inventarios_RecepcionUsados
End Sub
Private Sub CargaInicial()
ConsecutivoVenta = 0
CveMovimiento = -1
CveMovimientoRelacionado = -1
TieneRelacionado = -1
@@ -2255,7 +2256,7 @@ Partial Class Inventarios_RecepcionUsados
'VALIDA PROMOCIONES Y EXISTENCIAS
Dim ObjVentas As New ClsVentas
If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, Me.ObjRemisionNC.CveCliente, Me.ObjRemisionNC.CveVendedor, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, Me.ObjRemisionNC.CveCliente, Me.ObjRemisionNC.CveVendedor, 1, UsuarioActual.CveEmpresa) Then
Me.ObjRemisionNC.DtPromociones = ObjVentas.DtResultados.Copy()
End If
ObjVentas.Dispose()
@@ -2573,8 +2574,11 @@ Partial Class Inventarios_RecepcionUsados
Dim Obs As String = SbBCI.ToString()
AddPSRNC(ObjRemisionNC.DtDetalle, 1, CveUnidadMedida, "", CveClasificacion, "", CvePS, "", Obs, PU, 0, -1, "",
ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA)
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
End If
@@ -2966,6 +2970,9 @@ Partial Class Inventarios_RecepcionUsados
Dim CargoActual As Double = 0
Dim Row As DataRow = Nothing
ConsecutivoVenta += 1
Row = TmpDTAjustes.NewRow
Row("CveFolioGarantia") = DdlFolioGarantia.SelectedValue.ToEntero
Row("CveTipoUso") = DdlTipoUso.SelectedValue.ToEntero
@@ -2981,7 +2988,7 @@ Partial Class Inventarios_RecepcionUsados
Row("TipoComprobante") = 1
Row("Comprobante") = TxtPoliza.Text
Row("Importe") = TxtImporteAjuste.Text.ToDouble
Row("ConsecutivoVenta") = TxtConsecutivoAjuste.Text.ToEntero()
Row("ConsecutivoVenta") = ConsecutivoVenta
Row("CvePS") = DdlPSAjuste.SelectedValue
Row("PS") = DdlPSAjuste.SelectedText
Row("CveVenta") = -1