JAM - cargar adjunto de comprobación
This commit is contained in:
@@ -1243,6 +1243,28 @@ Public Class ClsMovimientos
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateReembolsoComprobante(CveComprobacion As Integer, Comprobante As String) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Comp_ReembolosoComprobanteUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveComprobacion", SqlDbType.Int).Value = CveComprobacion
|
||||
.Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar el comprobante.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetAcreedoresSaldosDetalles(CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.v-center {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
@@ -30,7 +35,10 @@
|
||||
<i class="fa fa-print"></i> Imprimir Reembolso
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
<li></li>
|
||||
|
||||
<li>
|
||||
<asp:HyperLink ID="HLAgregarComprobante" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#DivArchivo" runat="server"><i class='fa fa-file-o'></i> Cargar Comprobante</asp:HyperLink>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkImprimir" />
|
||||
@@ -100,7 +108,7 @@
|
||||
<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>
|
||||
<label class="col-md-1" style="margin-top: 10px; margin-left: 5px;">Fecha Fin:</label>
|
||||
<label class="col-md-1" style="margin-top: 10px; margin-left: 5px;">Fecha Fin:</label>
|
||||
<div class="col-md-2" style="margin-top: 10px">
|
||||
<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="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
@@ -123,41 +131,62 @@
|
||||
|
||||
<asp:UpdatePanel ID="UPCompras" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row" runat="server" id="divUnificar" visible="false">
|
||||
<div class="col-md-12" runat="server" style="margin-top: 2px; padding-left: 0px; padding-right: 0px;">
|
||||
|
||||
<label class="col-md-1">Concepto:</label>
|
||||
<div class="col-md-3">
|
||||
<asp:TextBox ID="TxtConcepto" CssClass="form-control input-sm" Width="100%" runat="server" Style="margin-top: 5px;" />
|
||||
</div>
|
||||
|
||||
<label class="col-md-1">Fecha:</label>
|
||||
<div class="col-md-1">
|
||||
<asp:TextBox runat="server" ID="TxtFechaUnificacion" Width="75px"></asp:TextBox>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaUnificacion" runat="server" TargetControlID="TxtFechaUnificacion" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<asp:LinkButton ID="LbkUnificar" runat="server">
|
||||
<i class="fa fa-refresh"></i> Unificar
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
|
||||
<div id="DivVincularEgreso" runat="server">
|
||||
<label class="col-md-1">Egreso x Comprobar:</label>
|
||||
<div class="row" runat="server" id="divUnificar" visible="false" style="margin-top: -5px; padding-left: 0px; padding-right: 0px; margin-bottom: 5px;">
|
||||
<div class="col-md-4">
|
||||
<div class="row v-center">
|
||||
<div class="col-md-2">
|
||||
Concepto:
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<asp:TextBox ID="TxtConcepto" CssClass="form-control input-sm" Width="100%" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="row v-center">
|
||||
<div class="col-md-2">
|
||||
Fecha:
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<asp:TextBox ID="TxtFechaUnificacion" Width="100%" CssClass="form-control input-sm" runat="server"></asp:TextBox>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaUnificacion" runat="server" TargetControlID="TxtFechaUnificacion" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<div class="row v-center">
|
||||
<div class="col-md-12 input-sm">
|
||||
<asp:LinkButton ID="LbkUnificar" runat="server">
|
||||
<i class="fa fa-refresh"></i> Unificar
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-1" id="DivAdjunto" runat="server" visible="false">
|
||||
<div class="row">
|
||||
<div class="col-md-12 input-sm">
|
||||
<asp:LinkButton ID="LnkDescargarAdjunto" runat="server">
|
||||
<i class="fa fa-download"></i> Adjunto
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="DivVincularEgreso" runat="server" class="col-md-4 v-center">
|
||||
<div class="row">
|
||||
<label class="col-md-2">Egreso x Comprobar:</label>
|
||||
<div class="col-md-4">
|
||||
<asp:DropDownList ID="DdlCheque" CssClass="form-control input-sm select2me" Width="100%" AppendDataBoundItems="true" runat="server" DataTextField="FolioFecha" DataValueField="CveIE"></asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="col-md-6">
|
||||
<asp:LinkButton data-toggle="tooltip" data-placement="top" ToolTip="Vincular Egreso" runat="server" ID="BtnVincularEgreso" OnClick="BtnVincularEgreso_Click" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<asp:HiddenField runat="server" ID="HdnFechasComprasVinculadas" Value="-1" ClientIDMode="Static" />
|
||||
<asp:GridView ID="GvCxP" GridLines="None" CssClass="ScrollAD table table-smallpadding Widthall" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Cuentas por Pagar pendientes" DataKeyNames="CveCompra,FechaCompra,Proveedor,SerieFolio,Original,SubTotal,IVA,RetIVA,RetISR,CvePrePoliza">
|
||||
<Columns>
|
||||
@@ -242,13 +271,69 @@
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink ID="HLProv" CssClass="Texto" Text='<%# Eval("CveProveedor")%>' runat="server"></asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField HeaderText="Poliza" DataTextField="FolioPoliza" DataNavigateUrlFields="CvePrePoliza" DataNavigateUrlFormatString="/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={0}" Target="_blank" ItemStyle-HorizontalAlign="Left" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkDescargarAdjunto" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="DivArchivo" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<asp:UpdatePanel ID="UpConcepto" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Cargar Comprobante</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Cargar Comprobante </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<h4>Arrastre o haga click para subir el archivo</h4>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 20px;">
|
||||
<asp:TextBox ID="TxtComprobante" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="row">
|
||||
<div class="col-md-12" style="text-align: right">
|
||||
<asp:Button ID="BtnCargarComprobante" runat="server" CssClass="btn btn-success" Text="Procesar"></asp:Button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
@@ -52,12 +54,31 @@ Partial Class Compras_RepRembolsoComprobaciones
|
||||
ViewState("DtCheques") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property CveComprobacion As Integer
|
||||
Get
|
||||
Return (IfNull(ViewState("CveComprobacion"), "-1", ViewState("CveComprobacion"))).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveComprobacion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Comprobante As String
|
||||
Get
|
||||
Return (IfNull(ViewState("Comprobante"), "", ViewState("Comprobante"))).ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("Comprobante") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
Private Sub Compras_RepRembolsoComprobaciones_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
|
||||
ViewState("CveMoneda") = 1
|
||||
|
||||
CveComprobacion = -1
|
||||
'Cargar Filtros
|
||||
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
dt = dt.FiltraParametros(String.Format("CveTipoCuenta = 1")) 'caja chica = 1
|
||||
@@ -199,6 +220,10 @@ Partial Class Compras_RepRembolsoComprobaciones
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaDatos()
|
||||
|
||||
CveComprobacion = -1
|
||||
Comprobante = ""
|
||||
|
||||
Dim ObjMovtos As New ClsMovimientos
|
||||
|
||||
GvCxP.Visible = True
|
||||
@@ -214,6 +239,11 @@ Partial Class Compras_RepRembolsoComprobaciones
|
||||
DtDatos = ObjMovtos.DtResultados
|
||||
GvCxP.DataSource = DtDatos
|
||||
|
||||
If DtDatos IsNot Nothing Then
|
||||
CveComprobacion = DtDatos.FiltroPrimeroValor("CveComprobacion").ToEntero()
|
||||
Comprobante = DtDatos.FiltroPrimeroValor("Comprobante")
|
||||
End If
|
||||
|
||||
'cargo si tiene cheques pendientes sin amortizar
|
||||
If CvePersonal > 0 Then
|
||||
If DtDatos.Rows.Count > 0 AndAlso TxtNumeroReembolso.Text.Trim <> "" Then
|
||||
@@ -244,8 +274,20 @@ Partial Class Compras_RepRembolsoComprobaciones
|
||||
ObjMovtos.Dispose()
|
||||
GvCxP.DataBind()
|
||||
|
||||
If Not String.IsNullOrEmpty(Comprobante) Then
|
||||
DivAdjunto.Visible = True
|
||||
Else
|
||||
DivAdjunto.Visible = False
|
||||
End If
|
||||
|
||||
LnkImprimir.Visible = True
|
||||
NumeroReembolso = TxtNumeroReembolso.Text
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 AndAlso UsuarioActual.CveRol = 1 Then
|
||||
HLAgregarComprobante.Visible = True
|
||||
End If
|
||||
|
||||
|
||||
If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then
|
||||
If NumeroReembolso <> "" AndAlso CvePersonal > 0 AndAlso DtDatos.MAX("CvePrePolizaComprobacionSinBancos").ToEntero > 0 Then
|
||||
DivVincularEgreso.Visible = True
|
||||
@@ -351,4 +393,86 @@ Partial Class Compras_RepRembolsoComprobaciones
|
||||
ObjIE.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub BtnCargarComprobante_Click(sender As Object, e As System.EventArgs) Handles BtnCargarComprobante.Click
|
||||
GuardarArchivoAdjunto()
|
||||
End Sub
|
||||
|
||||
Private Sub GuardarArchivoAdjunto()
|
||||
If Not TxtComprobante.getfiles().Archivos.Count > 0 Then
|
||||
Alert("Tiene que cargar un archivo.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If TxtNumeroReembolso.Text = "" Then
|
||||
Alert("Debe asignar un numero de reembolso de subir el archivo.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim FileExtension As String = "-1"
|
||||
Dim Filesgral As List(Of Archivo) = TxtComprobante.getfiles().Archivos
|
||||
Dim Filename As String = ""
|
||||
Dim fileItem As Archivo = Filesgral(0)
|
||||
Try
|
||||
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
|
||||
Dim Adjunto = String.Format("{0}-{1}.{2}", CveComprobacion, TxtNumeroReembolso.Text, FileExtension)
|
||||
|
||||
Dim Path As String
|
||||
Path = String.Format("{0}Comprobaciones", UsuarioActual.Empresa.Ruta)
|
||||
If Not Directory.Exists(Path) Then
|
||||
Directory.CreateDirectory(Path)
|
||||
End If
|
||||
Path += $"/{Adjunto}"
|
||||
If File.Exists(Path) Then
|
||||
File.Delete(Path)
|
||||
End If
|
||||
My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
|
||||
|
||||
If File.Exists(Path) Then
|
||||
Using ObjMov As New ClsMovimientos
|
||||
If ObjMov.UpdateReembolsoComprobante(CveComprobacion, Adjunto) Then
|
||||
Alert("Documento cargado")
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Error al cargar archivo", ex)
|
||||
End Try
|
||||
|
||||
RegistraScript("$('#DivArchivo').modal('hide');", "A1")
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkDescargarAdjunto_Click(sender As Object, e As System.EventArgs) Handles LnkDescargarAdjunto.Click
|
||||
Dim ruta As String = HttpContext.Current.Request.ApplicationPath
|
||||
ruta = String.Format("{0}Comprobaciones", UsuarioActual.Empresa.Ruta)
|
||||
ruta += $"/{Comprobante}"
|
||||
|
||||
Dim Archivo As New System.IO.FileInfo(ruta)
|
||||
|
||||
Try
|
||||
If Archivo IsNot Nothing Then
|
||||
If Archivo.Exists Then
|
||||
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = "application/octet-stream"
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(ruta)
|
||||
Response.Flush() ' send it to the client to download
|
||||
HttpContext.Current.Response.SuppressContent = True
|
||||
HttpContext.Current.ApplicationInstance.CompleteRequest()
|
||||
Response.End()
|
||||
|
||||
Else
|
||||
Alert("El archivo no existe", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user