This commit is contained in:
@@ -152,6 +152,11 @@
|
||||
<asp:Label ID="LtMarca" CssClass="truncate2" runat="server" Text='<%# Eval("Marca")%>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="30%" HeaderText="Almacen">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LtAlmacen" CssClass="truncate2" runat="server" Text='<%# Eval("Almacen")%>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="10%" HeaderText="Existencia" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtExistencia" runat="server" Text='<%# If(Eval("Existencia").ToString() = "0" Or Eval("Existencia").ToString() = "", "-", (Eval("Existencia", "{0:#,##0.##}"))) %>'></asp:Literal>
|
||||
@@ -397,7 +402,7 @@
|
||||
</div>
|
||||
<div class="portlet-body rowpadding " style="display: none;">
|
||||
|
||||
<asp:TextBox ID="TxtArchivoSua" CssClass="ADSdropzone hidden" runat="server"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtArchivoMaxMin" CssClass="ADSdropzone hidden" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ Partial Class Inventarios_RepMaximoMinimo
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
|
||||
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlAlmacen.DataBind()
|
||||
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
@@ -358,14 +357,81 @@ Partial Class Inventarios_RepMaximoMinimo
|
||||
#End Region
|
||||
|
||||
Protected Sub LnkUpFile_Click(sender As Object, e As EventArgs)
|
||||
RegistraScript("$('#DmodalCargarMaximosMinimos').modal('hide');")
|
||||
Dim Filesgral As List(Of Archivo) = TxtArchivoMaxMin.getfiles().Archivos
|
||||
Dim continuar As Boolean = Filesgral.Count > 0
|
||||
Dim stringError As String = ""
|
||||
Dim fileItem As Archivo = If(continuar, Filesgral(0), Nothing)
|
||||
|
||||
If continuar Then
|
||||
Dim FileExtension As String = fileItem.Extencion.ToUpper()
|
||||
|
||||
If FileExtension = "XLS" Or FileExtension = "XLSX" Or FileExtension = "CSV" Then
|
||||
Else
|
||||
continuar = False
|
||||
stringError = "No se inserto un archivo de tipo Excel"
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim DTEXcel As DataTable = New DataTable()
|
||||
If continuar Then
|
||||
DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, True)
|
||||
DTEXcel.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DTEXcel.Columns.Add(New DataColumn("CveAlmacen", GetType(Integer)))
|
||||
Dim dtAlmacen As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1)
|
||||
For Each drow As DataRow In DTEXcel.Rows
|
||||
Dim Drps As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa, -1, "-1", -1, -1, drow("Codigo").ToString())
|
||||
Dim dralmacen As DataRow = dtAlmacen.FiltroPrimero(String.Format("Almacen='{0}'", drow("Almacen")))
|
||||
If Drps.Rows.Count > 0 Then
|
||||
drow("CvePS") = Drps.Rows(0)("CvePS")
|
||||
End If
|
||||
If Not IsNothing(dralmacen) Then
|
||||
drow("CveAlmacen") = dralmacen("CveAlmacen")
|
||||
End If
|
||||
DTEXcel.AcceptChanges()
|
||||
Next
|
||||
continuar = True
|
||||
End If
|
||||
If continuar Then
|
||||
|
||||
Using ObjMaxMin As New ClsInventarios
|
||||
ObjMaxMin.IniciaTransacSQL()
|
||||
Dim DtResultados As New DataTable
|
||||
If ObjMaxMin.RepMaximoMinimo(-1, -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
DtResultados = ObjMaxMin.DtResultados
|
||||
End If
|
||||
For Each drow As DataRow In DTEXcel.Select("CvePS>0 AND CveAlmacen >0")
|
||||
If continuar Then
|
||||
If IsNothing(DtResultados.FiltroPrimero(String.Format("CveAlmacen={0} AND CvePS={1}", drow("CveAlmacen").ToString().ToEntero(), drow("CvePS").ToString().ToEntero()))) Then
|
||||
continuar = ObjMaxMin.AddAlmacenMaximoMinimo(drow("CveAlmacen").ToString().ToEntero(), drow("CvePS").ToString().ToEntero(), drow("Maximo").ToString().ToDouble(), drow("Minimo").ToString().ToDouble(), UsuarioActual.CveUsuario)
|
||||
Else
|
||||
continuar = ObjMaxMin.UpdateAlmacenMaximoMinimo(drow("CveAlmacen").ToString().ToEntero(), drow("CvePS").ToString().ToEntero(), drow("Maximo").ToString().ToDouble(), drow("Minimo").ToString().ToDouble(), UsuarioActual.CveUsuario)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If continuar Then
|
||||
ObjMaxMin.Commit()
|
||||
Else
|
||||
ObjMaxMin.RollBack()
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
If continuar Then
|
||||
CargaGrid()
|
||||
Alert("los cambios se han guardado satisfactoriamente")
|
||||
RegistraScript("$('#DmodalCargarMaximosMinimos').modal('hide');")
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub LnkCargarMaximosMinimos_Click(sender As Object, e As EventArgs)
|
||||
|
||||
TxtArchivoMaxMin.Text = ""
|
||||
RegistraScript("$('#DmodalCargarMaximosMinimos').modal();")
|
||||
Upcargamasiva.Update()
|
||||
End Sub
|
||||
Protected Sub LnkDescargarFormato_Click(sender As Object, e As EventArgs)
|
||||
Using ObjMaxMin As New ClsInventarios
|
||||
If ObjMaxMin.RepMaximoMinimo(-1, -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
ObjMaxMin.DtResultados.FiltraParametros("", "", New String() {"Codigo", "Almacen", "Maximo", "Minimo"}).ExportToExcel(String.Format("MaximosyMinimos{0:dd-MM-yyyy}", DateTime.Now))
|
||||
End If
|
||||
|
||||
End Using
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user