Merge branch 'master' of http://oirigoyen@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFecha" runat="server" TargetControlID="TxtFechaCadNueva" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CEFecha" TargetControlID="TxtFechaCadNueva" PopupButtonID="ImgFecha" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CEFecha" TargetControlID="TxtFechaCadNueva" PopupButtonID="ImgFecha" PopupPosition="BottomLeft" Enabled="True"></ajax:CalendarExtender>
|
||||
<%--<asp:DropDownList ID="DDlS" runat="server" Width="150px" DataValueField="CveSeccionAlmacen" DataTextField="SeccionAlmacen" class="select2me"></asp:DropDownList>--%>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
@@ -270,7 +270,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
InicializaValores()
|
||||
CargaParametrosAD()
|
||||
If UsuarioActual.CveEmpresa.Contiene(72, 80) Then DdlAlmacen.AutoPostBack = True
|
||||
If UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) Then DdlAlmacen.AutoPostBack = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(281).ToEntero() = 1 Then
|
||||
|
||||
@@ -833,7 +833,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
CargaGvDatos()
|
||||
|
||||
End Sub
|
||||
Private Sub CargaGvDatos()
|
||||
Private Sub CargaGvDatos(Optional CveAlmacen As Integer = -1)
|
||||
|
||||
If DtDatos IsNot Nothing Then
|
||||
|
||||
@@ -849,9 +849,12 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
If AplicaSeccion Then GvDatos.Columns(7).Visible = True
|
||||
If AplicaLote Then GvDatos.Columns(8).Visible = True
|
||||
If AplicaCaducidad Then GvDatos.Columns(9).Visible = True
|
||||
GvDatos.Columns(9).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad")
|
||||
GvDatos.Columns(9).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) <> "", UsuarioActual.Empresa.Funcionalidad(147), "")
|
||||
|
||||
SugerirFecha()
|
||||
'SugerirFecha()
|
||||
If DdlAlmacen.SelectedValue.ToEntero > 0 Then
|
||||
SugiereLoteCaducidad(DdlAlmacen.SelectedValue.ToEntero)
|
||||
End If
|
||||
End If
|
||||
GvDatos.DataSource = DtDatos
|
||||
|
||||
@@ -3749,7 +3752,7 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
Protected Sub DdlAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacen.SelectedIndexChanged
|
||||
If DdlAlmacen.SelectedValue <> "-1" Then
|
||||
CargaGvDatos()
|
||||
CargaGvDatos(DdlAlmacen.SelectedValue.ToEntero)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -3822,72 +3825,67 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
#Region "sugerir caducidad"
|
||||
|
||||
Private Sub SugerirFecha()
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios()
|
||||
Dim FechasExcluidas As New List(Of String)
|
||||
|
||||
Private Sub SugiereLoteCaducidad(CveAlmacen As Integer)
|
||||
Dim TempDT As New DataTable
|
||||
Dim DtLotesCaducidad As New DataTable
|
||||
TempDT = DtDatos.Clone
|
||||
Dim DtAux As New DataTable
|
||||
DtAux = DtDatos.Clone
|
||||
Dim CvePSAnterior As Integer = 0
|
||||
Dim ObjInventarios As New ClsInventarios()
|
||||
|
||||
For Each DtRow As DataRow In DtDatos.Rows
|
||||
Dim Row As DataRow = DtAux.NewRow()
|
||||
For Each Column As DataColumn In DtDatos.Columns
|
||||
Row.Item(Column.ColumnName) = DtRow.Item(Column.ColumnName)
|
||||
Next
|
||||
DtAux.Rows.Add(Row)
|
||||
SugerirFechaLote(0, MinFecha, FechasExcluidas, ObjInventarios, DtAux)
|
||||
TempDT.Merge(DtAux)
|
||||
DtAux.Clear()
|
||||
For Each dr As DataRow In DtDatos.Rows
|
||||
If CBool(dr("AplicaLote")) Then
|
||||
If CvePSAnterior <> dr("CvePS").ToString.ToEntero Then
|
||||
CvePSAnterior = dr("CvePS").ToString.ToEntero
|
||||
|
||||
If ObjInventarios.GetExistenciasCaducidad(dr("CvePS").ToString.ToEntero, CveAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
DtLotesCaducidad.Merge(ObjInventarios.DtResultados)
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjInventarios.Dispose()
|
||||
|
||||
DtDatos = TempDT
|
||||
End Sub
|
||||
For Each dr As DataRow In DtDatos.Rows
|
||||
If CBool(dr("AplicaLote")) Then
|
||||
|
||||
Private Sub SugerirFechaLote(contador As Integer, FechaExcluida As Date, FechasExcluidas As List(Of String), ObjInventarios As ClsInventarios, DataTableAux As DataTable)
|
||||
FechasExcluidas.Add(FechaExcluida.ToDate.ToString)
|
||||
Dim dtta As DataTable = DtLotesCaducidad.FiltraParametros(String.Format("CvePS = {0}", dr("CvePS")))
|
||||
|
||||
Dim DtRow As DataRow = DataTableAux.Rows(contador)
|
||||
Dim AplicaCaducidad As Boolean = DtRow.Item("AplicaCaducidad").ToString = "True"
|
||||
Dim AplicaLote As Boolean = DtRow.Item("AplicaLote").ToString = "True"
|
||||
Dim Cantidad As Integer = DtRow.Item("CantidadC").ToString.ToEntero
|
||||
Dim FechasExcluidasFiltro As String = String.Format("FechaCaducidad NOT IN('{0}')", String.Join("','", FechasExcluidas))
|
||||
If AplicaCaducidad Or AplicaLote Then
|
||||
Dim CvePS As Integer = DtRow.Item("CvePS").ToString.ToEntero
|
||||
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim MinimumRow As DataRow = ObjInventarios.DtResultados.FiltroPrimero(FechasExcluidasFiltro, "FechaCaducidad")
|
||||
DtRow.Item("FechaCaducidad") = MinimumRow.Item("FechaCaducidad").ToString
|
||||
DtRow.Item("Lote") = MinimumRow.Item("Lote").ToString
|
||||
Dim CantidadDisponible As Integer = MinimumRow.Item("Cantidad").ToString.ToEntero
|
||||
DtRow.Item("CantidadF") = CantidadDisponible
|
||||
DtRow.Item("CantidadS") = CantidadDisponible
|
||||
If dtta IsNot Nothing AndAlso dtta.Rows.Count > 0 Then
|
||||
|
||||
If Cantidad > CantidadDisponible Then
|
||||
Dim RowFaltante As DataRow = DataTableAux.NewRow()
|
||||
Dim CantidadFaltante As Integer = (Cantidad - CantidadDisponible)
|
||||
RowFaltante.Item("CantidadC") = CantidadFaltante
|
||||
RowFaltante.Item("CantidadF") = CantidadFaltante
|
||||
RowFaltante.Item("CantidadS") = CantidadFaltante
|
||||
DtRow.Item("CantidadC") = CantidadDisponible
|
||||
For Each Column As DataColumn In DataTableAux.Columns
|
||||
If Not Column.ColumnName.Contiene("CantidadC", "CantidadF", "CantidadS") Then
|
||||
RowFaltante.Item(Column.ColumnName) = DtRow.Item(Column.ColumnName)
|
||||
End If
|
||||
Next
|
||||
DataTableAux.Rows.Add(RowFaltante)
|
||||
SugerirFechaLote(contador + 1, MinimumRow.Item("FechaCaducidad").ToString.ToDate, FechasExcluidas, ObjInventarios, DataTableAux)
|
||||
Else
|
||||
DtRow.Item("CantidadF") = Cantidad
|
||||
Exit Sub
|
||||
End If
|
||||
'recorre que cumplan con la cantidad total a llenar
|
||||
Dim CantidadSurtir As Decimal = dr("CantidadF").ToString.ToDecimal
|
||||
For Each drl As DataRow In dtta.Rows
|
||||
If CantidadSurtir < drl("Cantidad").ToString.ToDecimal Then
|
||||
dr("CantidadF") = CantidadSurtir
|
||||
dr("CantidadC") = CantidadSurtir
|
||||
dr("Lote") = drl("Lote")
|
||||
dr("FechaCaducidad") = drl("FechaCaducidad")
|
||||
TempDT.ImportRow(dr)
|
||||
CantidadSurtir = 0
|
||||
Else
|
||||
CantidadSurtir -= drl("Cantidad").ToString.ToDecimal
|
||||
dr("CantidadF") = drl("Cantidad").ToString.ToDecimal
|
||||
dr("CantidadC") = drl("Cantidad").ToString.ToDecimal
|
||||
dr("Lote") = drl("Lote")
|
||||
dr("FechaCaducidad") = drl("FechaCaducidad")
|
||||
TempDT.ImportRow(dr)
|
||||
End If
|
||||
If CantidadSurtir <= 0 Then Exit For
|
||||
Next
|
||||
|
||||
Else
|
||||
'error, no hay lote sugerido
|
||||
End If
|
||||
Else
|
||||
TempDT.ImportRow(dr)
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
DtDatos = TempDT
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Reference in New Issue
Block a user