descarga POG

This commit is contained in:
2022-08-08 19:24:55 -07:00
parent 3eaf1c056a
commit 3a3454130b
2 changed files with 123 additions and 42 deletions

View File

@@ -94,14 +94,15 @@
</li>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton runat="server" ID="LnkProyectado" OnClick="LnkProyectado_Click" Text="Cargar Proyecciones" />
<li>
<asp:LinkButton runat="server" ID="LnkProyectado" OnClick="LnkProyectado_Click" Text="Cargar Proyecciones" />
</li>
</ContentTemplate>
</asp:UpdatePanel>
<li>
<asp:LinkButton runat="server" ID="LnkPOG" OnClick="LnkProyectado_Click" Visible="false"><i class="fa fa-ad-excel"></i> POG</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
@@ -298,6 +299,59 @@
</asp:UpdatePanel>
</div>
</div>
<div id="DivPOG" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpdatePanel2" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal ID="Literal1" runat="server">POG:</asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row" style="width: 100%; text-align: center">
<asp:Label runat="server" ID="Label2" />
<asp:RadioButtonList ID="RBLPOG" runat="server" RepeatDirection="Horizontal" Width="50%" Style="margin: 0 15% 0 15%">
<asp:ListItem Text="Ventas" Value="0" />
<asp:ListItem Text="Existencias" Value="1" Selected="True"/>
</asp:RadioButtonList>
</div>
<div class="row">
<div class="col-md-2 truncate">
Fecha:
</div>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<br />
</div>
<div class="modal-footer">
<asp:Button ID="BtnDescargarPOG" OnClick="BtnDescargarPOG_Click" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpTiposD" />
<button id="Button4" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnDescargarPOG" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -24,6 +24,12 @@ Partial Class Inventarios_KardexAlmacen
DdlMarca.Visible = True
DdlOrden.SelectedValue = 2
End If
If UsuarioActual.CveEmpresa = 119 Then
LnkPOG.Visible = True
txtFechaI.Text = Now.ToShortDateString
End If
If IfNull(Request("CvePS"), "-1").ToString.ToEntero > 0 Then CargarKardex(Request("CvePS").ToString.ToEntero)
ddlProducto2.SelectedValue = If(Request("CvePS") IsNot Nothing, Request("CvePS").ToString, "-1")
End If
@@ -436,57 +442,78 @@ Partial Class Inventarios_KardexAlmacen
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)
'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)
' 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
' For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
If firstRowHasHeaders Then
' 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
' 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
' curRow = 1
' Else
' dataTable.Columns.Add("Column " & (cols + 1))
' End If
Next
' Next
While curRow < worksheet.Rows.Count
' While curRow < worksheet.Rows.Count
columns = New String(cols - 1) {}
' columns = New String(cols - 1) {}
For curCol = 0 To 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
' 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
' Next
dataTable.Rows.Add(columns)
curRow += 1
' dataTable.Rows.Add(columns)
' curRow += 1
End While
' End While
Return dataTable
' Return dataTable
End Function
'End Function
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
End Sub
Private Sub LnkPOG_Click(sender As Object, e As EventArgs) Handles LnkPOG.Click
RegistraScript(String.Format("$('#{0}').modal();", "DivPOG"))
End Sub
Protected Sub BtnDescargarPOG_Click(sender As Object, e As EventArgs)
Dim Fecha As Date = Now
Dim Nombre As String = IIf(RBLPOG.SelectedValue = "0", "Ventas-", "Existencias-")
Using ObjInventario As New ClsInventarios
If ObjInventario.GetJAM_BASF_POG(Fecha) AndAlso ObjInventario.DataSetResultados IsNot Nothing Then
ObjInventario.DataSetResultados.Tables(RBLPOG.SelectedValue.ToEntero).ExportToExcel(Nombre & Fecha.ToShortDateString)
End If
End Using
End Sub
End Class