Puntos GDiaz:
-- Inv. Fisico, exportar productos con diferencias --Ajustes de Inv Físico, permitir la importación de productos de diferencia.(IF).
This commit is contained in:
@@ -176,7 +176,6 @@
|
||||
<ajax:ValidatorCalloutExtender ID="VCOFecha3" runat="server" HighlightCssClass="vco" TargetControlID="RVFecha" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
</div>--%>
|
||||
|
||||
</div>
|
||||
|
||||
<%-- <label class="col-md-1 truncate" style="display: none">Hora:</label>
|
||||
@@ -188,7 +187,7 @@
|
||||
|
||||
<label class="col-md-1 truncate" style="width: 110px" id="DivFolio1" runat="server">Folio:</label>
|
||||
<div class="col-md-4" id="DivFolio2" runat="server">
|
||||
<asp:TextBox ID="TxtFolio" runat="server" style="text-align:left;" CssClass="TextBoxAsLabel" Font-Bold="true" Width="110px"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtFolio" runat="server" Style="text-align: left;" CssClass="TextBoxAsLabel" Font-Bold="true" Width="110px"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="SoloNumerosFolio" runat="server" TargetControlID="TxtFolio" FilterType="Numbers" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -615,7 +614,6 @@
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<%--CARTA PORTE FIN--%>
|
||||
|
||||
</div>
|
||||
|
||||
<asp:UpdatePanel runat="server">
|
||||
@@ -742,7 +740,8 @@
|
||||
<asp:Literal ID="LtCI" runat="server" Text='<%# Eval("CostoIndirecto", "{0:N2}")%>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
<b><asp:Literal ID="LtTotCI" runat="server" Text=""></asp:Literal></b>
|
||||
<b>
|
||||
<asp:Literal ID="LtTotCI" runat="server" Text=""></asp:Literal></b>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--<asp:BoundField DataField="CostoIndirecto" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" Visible="false" ItemStyle-Width="63px"/>--%>
|
||||
@@ -858,7 +857,8 @@
|
||||
<div class="btn-group">
|
||||
<asp:HyperLink Visible="false" ID="ImgAddObs" CssClass="caption-subject bold font-green" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green' ></i><span class='caption-subject bold'>Agregar</span>" Style="font-weight: 700 !important; cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br />
|
||||
<asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold font-green" runat="server" Text=" <i class='fa fa-calendar-plus-o font-green' ></i>Agendar" Visible="false" Style="font-weight: 700 !important; cursor: pointer;" ToolTip="Agendar"></asp:HyperLink>
|
||||
<br /><asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal>
|
||||
<br />
|
||||
<asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal>
|
||||
<UserControl:TareaNueva runat="server" ID="TareaNueva" />
|
||||
<script>
|
||||
function OnAddedTareaNueva() {
|
||||
@@ -1146,27 +1146,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate" style="width: 120px">Fecha:</label>
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-3">
|
||||
<div style="display: inline-block; vertical-align: text-bottom;">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; text-align: center">
|
||||
<asp:TextBox ID="TxtFechaInvFisico" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 118px" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="ImgFechaInvFisico" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<asp:RequiredFieldValidator ID="RFVTxtFechaInvFisico" runat="server" ControlToValidate="TxtFechaInvFisico" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="InvFisico"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="CERFVTxtFechaInvFisico" runat="server" HighlightCssClass="vco" TargetControlID="RFVTxtFechaInvFisico" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
|
||||
|
||||
<ajax:MaskedEditExtender ID="MEFechaInv" runat="server" TargetControlID="TxtFechaInvFisico" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CalEFehcInv" TargetControlID="TxtFechaInvFisico" PopupButtonID="ImgFechaInvFisico" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:CompareValidator ID="CvFechaInv" runat="server" ControlToValidate="TxtFechaInvFisico" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="InvFisico"></asp:CompareValidator>
|
||||
@@ -1174,14 +1166,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6" style="text-align: center;">
|
||||
<asp:Button ID="BtnModalExcelAjuste" runat="server" Visible="false" CssClass="btn btn-primary" data-toggle="modal" data-target="#DivCargaAjuste" Text="Cargar Excel Ajuste" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate" style="width: 120px">Descripción:</label>
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-11">
|
||||
<asp:TextBox ID="TxtIFDescripcion" runat="server" Width="100%" CssClass="form-control input-sm"></asp:TextBox>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1759,7 +1756,8 @@
|
||||
<div class="form-group form-md-line-input input-iconright date date-picker date date-picker" style="min-width: 135px; margin-top: -10px !important;">
|
||||
<label for="<%= TxtnFechaCaducidad.ClientID.ToString()%>" style="color: #888888;">Fecha Caducidad: </label>
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-top: -5px !important;">
|
||||
<asp:TextBox ID="TxtnFechaCaducidad" CssClass="form-control" MaxLength="10" runat="server" Width="100px" Height="28px"></asp:TextBox> <span class="input-group-btn ">
|
||||
<asp:TextBox ID="TxtnFechaCaducidad" CssClass="form-control" MaxLength="10" runat="server" Width="100px" Height="28px"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="LnkFechaCaducidad" class="btn default" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
@@ -1873,6 +1871,41 @@
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
<%--CARGA EXCEL--%>
|
||||
<div id="DivCargaAjuste" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<asp:UpdatePanel class="modal-content" runat="server" ID="UpModalAjuste" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Agregar Excel</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Arraste o haga click para subir el archivo Excel</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px;">
|
||||
<asp:TextBox ID="TxtExcelAjuste" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="row">
|
||||
<div class="col-md-10" style="text-align: right">
|
||||
<asp:Button ID="BtnCargaExcelAjuste" runat="server" CssClass="btn btn-success" Text="Aceptar" OnClick="BtnCargaExcelAjuste_Click"></asp:Button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -4,6 +4,7 @@ Option Strict On
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class Inventarios_EntradasSalidas
|
||||
Inherits ClsPaginas
|
||||
@@ -421,6 +422,9 @@ Partial Class Inventarios_EntradasSalidas
|
||||
'ImgFecha.Visible = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
BtnModalExcelAjuste.Visible = True
|
||||
End If
|
||||
|
||||
CantidadTotal = 0
|
||||
IndexSeccionAlmacen = 0
|
||||
@@ -4128,8 +4132,11 @@ Partial Class Inventarios_EntradasSalidas
|
||||
AddPSEntrada(DdlPS.SelectedValue.ToEntero, TxtCantidadInvFisico.Text.ToDouble, TxtCostoPromedio.Text.ToDecimal)
|
||||
End Sub
|
||||
|
||||
Protected Sub AddPSEntrada(CvePS As Integer, Cantidad As Double, CostoPromedio As Double)
|
||||
Protected Sub AddPSEntrada(CvePS As Integer, Cantidad As Double, CostoPromedio As Double, Optional Sonido As Boolean = True, Optional CargaGV As Boolean = True)
|
||||
|
||||
If Sonido Then
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPS.SelectedText = "" : Exit Sub
|
||||
End If
|
||||
|
||||
Dim Valido As Boolean = True
|
||||
|
||||
@@ -4168,9 +4175,16 @@ Partial Class Inventarios_EntradasSalidas
|
||||
registro.Item("FechaCaducidad") = Caducidad
|
||||
|
||||
DtMovimientosEntradaInvFisico.Rows.Add(registro)
|
||||
|
||||
If CargaGV Then
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
End If
|
||||
|
||||
If Sonido Then
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGvEntradas(DtTemp As DataTable)
|
||||
@@ -4266,8 +4280,10 @@ Partial Class Inventarios_EntradasSalidas
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub AddPSSalida(CvePS As Integer, Cantidad As Double)
|
||||
Protected Sub AddPSSalida(CvePS As Integer, Cantidad As Double, Optional Sonido As Boolean = True, Optional CargaGV As Boolean = True)
|
||||
If Sonido Then
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPSSalida.SelectedText = "" : Exit Sub
|
||||
End If
|
||||
|
||||
Dim Valido As Boolean = True
|
||||
|
||||
@@ -4306,9 +4322,16 @@ Partial Class Inventarios_EntradasSalidas
|
||||
registro.Item("FechaCaducidad") = Caducidad
|
||||
|
||||
DtMovimientosSalidaInvFisico.Rows.Add(registro)
|
||||
|
||||
If CargaGV Then
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
End If
|
||||
|
||||
If Sonido Then
|
||||
RegistraScript("playsonidito('beep-07.wav')")
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGvSalidas(DtTemp As DataTable)
|
||||
@@ -6053,8 +6076,87 @@ Partial Class Inventarios_EntradasSalidas
|
||||
Public Property TieneError As Boolean
|
||||
End Class
|
||||
|
||||
Protected Sub BtnCargaExcelAjuste_Click(sender As Object, e As EventArgs)
|
||||
If TxtExcelAjuste.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcelAjuste.getfiles().Archivos(0)
|
||||
Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path
|
||||
CargarArchivo(Directorio, file.filename)
|
||||
Else
|
||||
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String)
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim Tipo As String = "EXCEL"
|
||||
Dim dt As DataTable = Nothing
|
||||
Dim ErrorArchivo As Boolean = False
|
||||
|
||||
Try
|
||||
dt = ReadExcelFile(Ruta + FileName, True)
|
||||
Catch ex As Exception
|
||||
ErrorArchivo = True
|
||||
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
|
||||
End Try
|
||||
|
||||
If Not ErrorArchivo AndAlso dt IsNot Nothing Then
|
||||
|
||||
dt.TableName = "Datos"
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
If DdlAlmacenInventarioFisico.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPS.SelectedText = "" : Exit Sub
|
||||
|
||||
For Each row As DataRow In dt.Rows
|
||||
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, Codigo:=row("Codigo").ToString(), Estatus:=-1).FiltroPrimero("")
|
||||
Dim CvePS As Integer = DrPS("CvePS").ToString().ToEntero()
|
||||
|
||||
If row("EntradaSalida").ToString() = "1" Then
|
||||
AddPSEntrada(CvePS, row("Diferencia").ToString().ToDecimal(), row("Costo").ToString().ToDecimal(), Sonido:=False, CargaGV:=False)
|
||||
Else
|
||||
AddPSSalida(CvePS, row("Diferencia").ToString().ToDecimal(), Sonido:=False, CargaGV:=False)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al cargar los precios.", ex)
|
||||
Finally
|
||||
|
||||
If TieneError Then
|
||||
If DtMovimientosEntradaInvFisico IsNot Nothing Then
|
||||
DtMovimientosEntradaInvFisico.Clear()
|
||||
End If
|
||||
If DtMovimientosSalidaInvFisico IsNot Nothing Then
|
||||
DtMovimientosSalidaInvFisico.Clear()
|
||||
End If
|
||||
|
||||
CargaGvSalidas(DtMovimientosSalidaInvFisico)
|
||||
CargaGvEntradas(DtMovimientosEntradaInvFisico)
|
||||
|
||||
Alert("Ocurrió un error al cargar los datos", TipoMensaje.MsgError)
|
||||
Else
|
||||
If DtMovimientosEntradaInvFisico.Rows.Count <> dt.FiltraParametros("EntradaSalida = 1").Rows.Count Then
|
||||
Alert("No se cargaron todas las entradas.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
If DtMovimientosSalidaInvFisico.Rows.Count <> dt.FiltraParametros("EntradaSalida = 0").Rows.Count Then
|
||||
Alert("No se cargaron todas las salidas.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Alert("Los datos se cargaron correctamente.")
|
||||
End If
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivCargaAjuste').modal('hide')")
|
||||
End If
|
||||
|
||||
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
UpModalAjuste.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
|
||||
|
||||
<asp:UpdatePanel runat="server" id="UPAcciones" UpdateMode="Conditional">
|
||||
<asp:UpdatePanel runat="server" ID="UPAcciones" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
|
||||
@@ -95,6 +95,16 @@
|
||||
<li>
|
||||
<asp:LinkButton ID="ImgExcelProdcutosCoinciden" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel Productos Coincidentes</asp:LinkButton>
|
||||
</li>
|
||||
<asp:UpdatePanel ID="UpExportarExcel" runat="server">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportarFormatoAjuste" runat="server" Visible="false"><i class="fa fa-ad-excel"></i> Generar formato para ajuste</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkExportarFormatoAjuste" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkDescarExcelGrupos" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel </asp:LinkButton>
|
||||
</li>
|
||||
@@ -258,7 +268,7 @@
|
||||
</div>
|
||||
<asp:GridView ID="GvF" data-sort="true" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD" Style="text-align: center;"
|
||||
GridLines="None" DataKeyNames="CvePS">
|
||||
GridLines="None" DataKeyNames="CvePS,Codigo,PS,Diferencia,Abreviatura,Costo">
|
||||
<Columns>
|
||||
<asp:TemplateField Visible="false">
|
||||
<HeaderTemplate>
|
||||
@@ -316,7 +326,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvS" data-sort="true" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD" Style="text-align: center;" GridLines="None" DataKeyNames="CvePS">
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD" Style="text-align: center;" GridLines="None" DataKeyNames="CvePS,Codigo,PS,Diferencia,Abreviatura,Costo">
|
||||
<Columns>
|
||||
<asp:TemplateField Visible="false">
|
||||
<HeaderTemplate>
|
||||
@@ -512,7 +522,9 @@
|
||||
<ItemStyle HorizontalAlign="Left" />
|
||||
</asp:BoundField>
|
||||
<asp:TemplateField HeaderText="">
|
||||
<HeaderTemplate>Conteo <br /> Anterior</HeaderTemplate>
|
||||
<HeaderTemplate>Conteo
|
||||
<br />
|
||||
Anterior</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="Label3" runat="server" Text='<%# Eval("CantidadPrevio", "{0:#,###.##}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
@@ -529,14 +541,16 @@
|
||||
<ItemStyle HorizontalAlign="Right" />
|
||||
</asp:BoundField>
|
||||
<asp:TemplateField HeaderText="">
|
||||
<HeaderTemplate>ME.<br/>Vendible</HeaderTemplate>
|
||||
<HeaderTemplate>ME.<br />
|
||||
Vendible</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="Label1" runat="server" Text='<%# Eval("MalEstado", "{0:#,###.##}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Right" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="">
|
||||
<HeaderTemplate>ME.<br/>No vendible</HeaderTemplate>
|
||||
<HeaderTemplate>ME.<br />
|
||||
No vendible</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="Label2" runat="server" Text='<%# Eval("NoVendible", "{0:#,###.##}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Stimulsoft.Base.StiDbType
|
||||
|
||||
Partial Class Inventarios_RepAnomalias
|
||||
Inherits ClsPaginas
|
||||
@@ -99,6 +100,9 @@ Partial Class Inventarios_RepAnomalias
|
||||
Dim Inventario As New ClsInventarios
|
||||
Dim dt As DataTable = Nothing
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
LnkExportarFormatoAjuste.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119, 158) Then
|
||||
GvF.Columns(2).Visible = True 'clasificación
|
||||
@@ -1094,6 +1098,58 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LnkExportarFormatoAjuste_Click(sender As Object, e As EventArgs) Handles LnkExportarFormatoAjuste.Click
|
||||
|
||||
Dim DtFaltantes As DataTable = (From row As GridViewRow In GvF.Rows.Cast(Of GridViewRow)
|
||||
Where row.RowType = DataControlRowType.DataRow
|
||||
Select New With
|
||||
{
|
||||
.Codigo = row.DataKey("Codigo"),
|
||||
.Producto = row.DataKey("PS"),
|
||||
.Unidad = row.DataKey("Abreviatura"),
|
||||
.Diferencia = row.DataKey("Diferencia").ToDecimal() * -1,
|
||||
.Costo = row.DataKey("Costo").ToDecimal(),
|
||||
.EntradaSalida = 1 'ENTRADA
|
||||
}).QueryToDataTable(True)
|
||||
|
||||
Dim DtSobrantes As DataTable = (From row As GridViewRow In GvS.Rows.Cast(Of GridViewRow)
|
||||
Where row.RowType = DataControlRowType.DataRow
|
||||
Select New With
|
||||
{
|
||||
.Codigo = row.DataKey("Codigo"),
|
||||
.Producto = row.DataKey("PS"),
|
||||
.Unidad = row.DataKey("Abreviatura"),
|
||||
.Diferencia = row.DataKey("Diferencia").ToDecimal(),
|
||||
.Costo = row.DataKey("Costo").ToDecimal(),
|
||||
.EntradaSalida = 0 'SALIDA
|
||||
}).QueryToDataTable(True)
|
||||
|
||||
Dim DtExcel As DataTable = DtFaltantes.AsEnumerable().Union(DtSobrantes.AsEnumerable()).OrderBy(Function(x) x.Field(Of Integer)("EntradaSalida") = 1).CopyToDataTable()
|
||||
DtExcel.TableName = "Existencias"
|
||||
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim FileExcel As New ExcelFile()
|
||||
|
||||
Dim worksheet As ExcelWorksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
|
||||
worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
|
||||
|
||||
Dim columnCount As Integer = worksheet.CalculateMaxUsedColumns()
|
||||
For i As Integer = 0 To columnCount
|
||||
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
|
||||
Next
|
||||
|
||||
FileExcel.Save(Response, "FormatoAjusteInventario.xlsx", SaveOptions.XlsxDefault)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user