nuevo filtro y mecanica para nueva tabla en kardex horizontal
This commit is contained in:
@@ -92,6 +92,9 @@
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="LnkProyectos" OnClick="LnkProyectos_Click" Text="Proyectos" />
|
||||
</li>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
@@ -188,7 +191,7 @@
|
||||
<div class="row">
|
||||
<label class="col-md-3 truncate">Marca:</label>
|
||||
<div class="col-md-9">
|
||||
<asp:ListBox ID="DdlMarca" runat="server" DataTextField="Marca" DataValueField="CveMarca" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%; height:50px !important;">
|
||||
<asp:ListBox ID="DdlMarca" runat="server" DataTextField="Marca" DataValueField="CveMarca" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%; height: 50px !important;">
|
||||
<asp:ListItem Text="Todas" Value="-1"></asp:ListItem>
|
||||
</asp:ListBox>
|
||||
</div>
|
||||
@@ -250,6 +253,40 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="DivProyeccion" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog" style="width: 450px;">
|
||||
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalTiposD" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LtlTituloModalTiposD" runat="server">Proyección:</asp:Literal></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" style="width: 100%; text-align: center">
|
||||
<asp:Label runat="server" ID="LblProyeccionOpcion"/>
|
||||
<asp:RadioButtonList ID="RblProyeccionOpcion" runat="server" RepeatDirection="Horizontal" Width="50%" style="margin:0 25% 0 25%">
|
||||
<asp:ListItem Text="Entrada" Value="1" Selected="True" />
|
||||
<asp:ListItem Text="Salida" Value="0" />
|
||||
</asp:RadioButtonList>
|
||||
<asp:Button runat="server" ID="BtnDescargarFormato" OnClick="BtnDescargarFormato_Click" Text="Descargar formato" CssClass="btn btn-warning"/>
|
||||
</div>
|
||||
<asp:Label runat="server" ID="Label1" Text="Subir Proyección:" Style="font-size: 15px" />
|
||||
<br />
|
||||
<asp:TextBox ID="TxtProyeccionExcel" CssClass="ADSdropzone hidden" runat="server" Style="height: 100px"></asp:TextBox>
|
||||
<br />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnAgregarProyeccion" OnClick="BtnAgregarProyeccion_Click" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpTiposD" />
|
||||
<button id="Button3" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="BtnDescargarFormato" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -337,6 +337,137 @@ Partial Class Inventarios_KardexAlmacen
|
||||
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkProyectos_Click(sender As Object, e As EventArgs)
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivProyeccion"))
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnDescargarFormato_Click(sender As Object, e As EventArgs)
|
||||
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\KardexProyeccion.xlsx"
|
||||
|
||||
Dim Archivo As New IO.FileInfo(Directorio)
|
||||
If Archivo.Exists Then
|
||||
Response.Clear()
|
||||
Response.ClearHeaders()
|
||||
Response.ClearContent()
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name)
|
||||
Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
Response.Flush()
|
||||
Response.TransmitFile(Archivo.FullName)
|
||||
Response.End()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarProyeccion_Click(sender As Object, e As EventArgs)
|
||||
If TxtProyeccionExcel.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtProyeccionExcel.getfiles().Archivos(0)
|
||||
Dim Directorio As String = Server.MapPath("~") & file.patch
|
||||
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||
CargarArchivo(Directorio, file.filename, Tipo)
|
||||
Else
|
||||
Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
|
||||
Dim dt As New DataTable
|
||||
dt = ReadExcelFile(Ruta + FileName, True)
|
||||
If Not dt.Columns(0).ColumnName = "Código" Then
|
||||
Alert("La primera columna del archivo debe ser 'Código'", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(1).ColumnName = "Cantidad" Then
|
||||
Alert("La primera columna del archivo debe ser 'Cantidad'", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
AgregarProyeccion(dt)
|
||||
End Sub
|
||||
|
||||
Private Sub AgregarProyeccion(dt As DataTable)
|
||||
Dim TieneError As Boolean = False
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
ObjInventarios.IniciaTransacSQL()
|
||||
|
||||
Dim TipoMovot As Integer = If(RblProyeccionOpcion.SelectedValue = "1", 0, 1)
|
||||
|
||||
If ObjInventarios.DeleteMovimientosProyectados(TipoMovot) Then
|
||||
Dim DtProductosEmpresas As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
|
||||
For Each dtRow As DataRow In dt.Rows
|
||||
Dim Codigo As String = dtRow("Código").ToString
|
||||
Dim CvePS As Integer = DtProductosEmpresas.FiltroPrimeroValor("CvePS", String.Format("Codigo = '{0}'", Codigo))
|
||||
Dim Cantidad As Decimal = dtRow("Cantidad").ToString.ToDecimal
|
||||
If Not ObjInventarios.AddMovimientosProyectados(CvePS, Cantidad, RblProyeccionOpcion.SelectedValue.ToEntero()) Then
|
||||
TieneError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If TieneError Then
|
||||
ObjInventarios.RollBack()
|
||||
Else
|
||||
ObjInventarios.Commit()
|
||||
End If
|
||||
ObjInventarios.Dispose()
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivProyeccion"))
|
||||
Alert("Se ha agregado la proyección de productos correctamente")
|
||||
End Sub
|
||||
|
||||
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath)
|
||||
|
||||
Dim unnamed As Integer = 0
|
||||
Dim cols As Integer
|
||||
Dim columns As String()
|
||||
Dim curRow As Integer = 0
|
||||
Dim curCol As Integer = 0
|
||||
Dim dataTable As DataTable = New DataTable()
|
||||
Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0)
|
||||
|
||||
For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
|
||||
|
||||
If firstRowHasHeaders Then
|
||||
|
||||
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
|
||||
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString().Trim)
|
||||
Else
|
||||
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
|
||||
End If
|
||||
|
||||
curRow = 1
|
||||
Else
|
||||
dataTable.Columns.Add("Column " & (cols + 1))
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
While curRow < worksheet.Rows.Count
|
||||
|
||||
columns = New String(cols - 1) {}
|
||||
|
||||
For curCol = 0 To cols - 1
|
||||
|
||||
If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then
|
||||
columns(curCol) = ""
|
||||
Else
|
||||
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
dataTable.Rows.Add(columns)
|
||||
curRow += 1
|
||||
|
||||
End While
|
||||
|
||||
Return dataTable
|
||||
|
||||
End Function
|
||||
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user