This commit is contained in:
2024-05-14 09:58:24 -07:00
10 changed files with 923 additions and 82 deletions

View File

@@ -1004,11 +1004,13 @@ Public Class ClsContabilidad
If ex1.Message.Contains("50015;") Then
OnError("No se puede registrar una póliza en un ejercicio Cerrado", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
ElseIf ex1.Message.Contains("50024; La Cuenta no fue detectada") Then
Dim dtt As DataTable = ClsPaginas.GlobalDTContaConceptosContables(CveConceptoContable)
Dim dr As Data.DataRow = ClsPaginas.GlobalDTContaConceptosContables(CveConceptoContable).FiltroPrimero("")
Dim StrMsg As String = ""
If dtt IsNot Nothing Then
If dr IsNot Nothing Then
If CveConceptoContable <> dr("CveConceptoContable").ToString.ToEntero Then 'si el concepto pareja no es principal, lo obtengo
dr = ClsPaginas.GlobalDTContaConceptosContables(dr("CveParejaContable").ToString.ToEntero).FiltroPrimero("")
End If
Dim tCveEmp As Integer = CType(HttpContext.Current.Session("UsuarioSIG"), Usuario).CveEmpresa
Dim dr As Data.DataRow = dtt.FiltroPrimero("")
If dr IsNot Nothing Then
StrMsg = dr("ConceptoContable").ToString
If dr("AplicaClasificacion").ToString = "True" Then

View File

@@ -10670,7 +10670,6 @@ Public Class ClsPaginas
PaginaDict.Add("/Sistemas/CatProcesos.aspx".ToUpper(), 69)
PaginaDict.Add("/Sistemas/CatParametros.aspx".ToUpper(), 143)
PaginaDict.Add("/Sistemas/PopUpCargaCertificados.aspx".ToUpper(), 144)
PaginaDict.Add("/Sistemas/CatNotificaciones.aspx".ToUpper(), 146)
PaginaDict.Add("/Sistemas/EmpresasModulos.aspx".ToUpper(), 346)
PaginaDict.Add("/Sistemas/CatSesiones.aspx".ToUpper(), 374)
PaginaDict.Add("/Sistemas/CatFuncionalidades.aspx".ToUpper(), 568)
@@ -10789,10 +10788,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/CatEspecialidadesSubEspecialidades.aspx".ToUpper(), 1346)
PaginaDict.Add("/Ventas/FacturacionGlobal.aspx".ToUpper(), 546)
PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347)
PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146)

View File

@@ -5983,6 +5983,30 @@ Public Class ClsVentas
End Function
Public Function GetLineasAdicionalesVencimientos(CveCliente As Integer, TipoLinea As Integer, FechaInicio As Date, FechaFin As Date, CveMoneda As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_LineasAdicionalesVencimientosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@TipoLinea", SqlDbType.Int).Value = TipoLinea
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error obtener las lineas de adicionales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function CambioClientesVendedor(CveCliente As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False

View File

@@ -329,7 +329,8 @@
<table class="table Widthall ">
<tr>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 20%; border-right: 3px solid white;">Agrupador</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 15%; border-right: 3px solid white;">Autorizado</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 10%; border-right: 3px solid white;">Autorizado</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 10%; border-right: 3px solid white;">Comprometido</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 25%; border-right: 3px solid white;">Ejercido</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 25%; border-right: 3px solid white;">Por Ejercer</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 15%; border-right: 3px solid white;">Pagado</td>
@@ -341,7 +342,8 @@
<Columns>
<%--<asp:HyperLinkField HeaderText="Descripcion" DataTextField="Agrupador" ItemStyle-Width="20%"--%>
<asp:BoundField HeaderText="Descripcion" DataField="Agrupador" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Importe" DataField="Autorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Importe" DataField="Autorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Comprometido" DataField="Comprometido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Importe" DataField="Ejercido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="%" DataField="EjercidoPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Importe" DataField="PorEjercer" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="15%" />
@@ -377,9 +379,11 @@
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; min-width: 370px; border-right: 3px solid white;">Total</td>
</tr>
</table>
<asp:GridView ID="GvDatosMensual" OnRowDataBound="GvDatosMensual_RowDataBound" runat="server" AutoGenerateColumns="False" Style="min-width: 2000px; overflow-y: hidden" Width="4740px" EmptyDataText="Sin resultados" ShowHeaderWhenEmpty="true" CssClass="table table-striped table-hover" GridLines="None" data-sort="true">
<Columns>
<asp:BoundField HeaderText="Descripcion" DataField="Agrupador" ItemStyle-Width="200px" />
<asp:BoundField HeaderText="Descripcion" DataField="Agrupador" ItemStyle-Width="200px" />
<asp:BoundField HeaderText="Importe" DataField="Autorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="120px" />
<asp:BoundField HeaderText="Autorizado" DataField="EneroAutorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
@@ -459,15 +463,19 @@
<%-- <asp:BoundField HeaderText="Por Ejercer" DataField="NoviembrePorEjercer" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="130px" />
<asp:BoundField HeaderText="%" DataField="NoviembrePorEjercerPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="60px" />--%>
<asp:BoundField HeaderText="Autorizado" DataField="DiciembreAutorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
<asp:BoundField HeaderText="Autorizado" DataField="DiciembreAutorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
<asp:BoundField HeaderText="Ejercido" DataField="DiciembreEjercido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
<asp:BoundField HeaderText="%" DataField="DiciembreEjercidoPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="40px" />
<asp:BoundField HeaderText="Pagado" DataField="DiciembrePagado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="100px" />
<%--<asp:BoundField HeaderText="Por Ejercer" DataField="DiciembrePorEjercer" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="130px" />
<asp:BoundField HeaderText="%" DataField="DiciembrePorEjercerPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="60px" />--%>
<asp:BoundField HeaderText="Ejercido" DataField="TotalEjercido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField HeaderText="Ejercido" DataField="TotalEjercido" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField HeaderText="%" DataField="TotalEjercidoPorcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="40px" />
<asp:BoundField HeaderText="Pagado" DataField="TotalPagado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
</Columns>
</asp:GridView>
</div>

View File

@@ -6,6 +6,7 @@ Imports System.Data.SqlClient
Imports System.IO
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Owin.Security.Provider
Imports Newtonsoft.Json
Partial Class OC_OC
@@ -925,7 +926,13 @@ Partial Class OC_OC
ChkEntregaDirecta.Checked = False
End If
If UsuarioActual.CveEmpresa.Contiene(13, 73) AndAlso CveOrdenCompra > 0 AndAlso Request("Conta") IsNot Nothing AndAlso Request("Conta").ToEntero = 1 Then
If GeneraPrePolizaPresupuesto(CveOrdenCompra, Nothing) Then
Alert("PrePoliza de Presupuesto Generada Correctamente")
Else
Alert("No Se Genero la PrePoliza de Presupuesto Generada Correctamente", TipoMensaje.MsgAdvertencia)
End If
End If
End If
@@ -2852,6 +2859,14 @@ Partial Class OC_OC
End If
If Not TieneError AndAlso TipoOC = "OC" Then
If Not GeneraPrePolizaPresupuesto(CveOrdenCompra, OC.IniciaTransacSQL) Then
TieneError = True
End If
End If
If Not TieneError Then
If Conta IsNot Nothing Then Conta.Commit()
OC.Commit()
@@ -3304,6 +3319,7 @@ Partial Class OC_OC
'TERMINA TODO POR SI OCURRIÓ ALGO RARO
If TieneError Then
If OC IsNot Nothing Then OC.RollBack()
If UsuarioActual.Empresa.UsaAC AndAlso VerificaPresupuesto Then
If Conta IsNot Nothing Then Conta.RollBack()
@@ -3505,6 +3521,16 @@ Partial Class OC_OC
End If
If UsuarioActual.CveEmpresa.Contiene(13, 73) Then
If Not GeneraPrePolizaPresupuesto(objOrdenCompra.CveOrdenCompra, objOrdenCompra.IniciaTransacSQL) Then
HuboError = True
End If
End If
Catch ex As Exception
HuboError = True
End Try
@@ -9008,7 +9034,8 @@ Partial Class OC_OC
Dim respuesta As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
'If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
Dim ObjCon As New ClsContratos
Dim CvePresupuesto As Integer = 0
@@ -9027,22 +9054,6 @@ Partial Class OC_OC
If resultadosFiltrados.Count > 0 Then
Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
Group row By
SubProyecto = row.Field(Of String)("SubProyecto"),
CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"),
Clasificacion = row.Field(Of String)("Clasificacion"),
CveClasificacion = row.Field(Of Integer)("CveClasificacion")
Into Group
Select New With {
.SubProyecto = SubProyecto,
.CveSubProyecto = CveSubProyecto,
.Clasificacion = Clasificacion,
.CveClasificacion = CveClasificacion,
.TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
}).ToList()
If Opcion = 1 Then
@@ -9075,6 +9086,22 @@ Partial Class OC_OC
End If
Else
Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
Group row By
SubProyecto = row.Field(Of String)("SubProyecto"),
CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"),
Clasificacion = row.Field(Of String)("Clasificacion"),
CveClasificacion = row.Field(Of Integer)("CveClasificacion")
Into Group
Select New With {
.SubProyecto = SubProyecto,
.CveSubProyecto = CveSubProyecto,
.Clasificacion = Clasificacion,
.CveClasificacion = CveClasificacion,
.TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
}).ToList()
For Each item In EnumAgrupado
Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto)
@@ -9105,6 +9132,7 @@ Partial Class OC_OC
respuesta = True
End If
Next
End If
Else
@@ -9130,6 +9158,81 @@ Partial Class OC_OC
End Function
Private Function GeneraPrePolizaPresupuesto(CveOrdenCompraPresupuesto As Integer, Optional ByRef transaccion As SqlTransaction = Nothing) As Boolean
Dim Respuesta As Boolean = True
If UsuarioActual.CveEmpresa.Contiene(13, 73) Then
Dim CveMonedaPresupuesto As Integer = DdlMoneda.SelectedValue.ToEntero
Dim TC As Decimal = If(CveMonedaPresupuesto = 1, 1, GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal)
If CveMonedaPresupuesto > 1 AndAlso TC = 0 Then
Alert($"No se genero la prepoliza de presupuesto, no se pudo obtener el Tipo de Cambio de la fecha {TxtFecha.Text}", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim ObjConta As New ClsContabilidad()
If transaccion Is Nothing Then
ObjConta = New ClsContabilidad()
Else
ObjConta = New ClsContabilidad(transaccion)
End If
Dim CvePrePolizaPreSuPuesto = ObjConta.AddPrePolizas("OC/OC-(Presupuesto)", 53, LblTotal.Text.ToDecimal, LblTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlProveedores.SelectedText, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrePolizaPreSuPuesto > 0 Then
Dim EnumAgrupado = (From row In DtDetalle.AsEnumerable()
Group row By
SubProyecto = row.Field(Of String)("SubProyecto"),
CveSubProyecto = row.Field(Of Integer)("CveSubProyecto"),
Clasificacion = row.Field(Of String)("Clasificacion"),
CveClasificacion = row.Field(Of Integer)("CveClasificacion")
Into Group
Select New With {
.SubProyecto = SubProyecto,
.CveSubProyecto = CveSubProyecto,
.Clasificacion = Clasificacion,
.CveClasificacion = CveClasificacion,
.TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))) + If(IsDBNull(r("IVA")), 0D, Convert.ToDecimal(r("IVA"))) + If(IsDBNull(r("IEPSPSIVA")), 0D, Convert.ToDecimal(r("IEPSPSIVA"))) - If(IsDBNull(r("RetIVA")), 0D, Convert.ToDecimal(r("RetIVA"))) - If(IsDBNull(r("RetISR")), 0D, Convert.ToDecimal(r("RetISR"))))
}).ToList()
For Each item In EnumAgrupado
Dim SerieFolio = $"OC: {Folio}, Clasificación: {item.Clasificacion}"
Dim Importe As Decimal = item.TotalSum
Dim ImporteME As Decimal = If(CveMonedaPresupuesto = 1, 0, item.TotalSum)
Dim ImporteMN As Decimal = If(CveMonedaPresupuesto = 1, item.TotalSum, item.TotalSum * TC)
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, False, Importe, ImporteMN, 154, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then
Respuesta = False
Exit For
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaPreSuPuesto, True, Importe, ImporteMN, 152, SerieFolio, SerieFolio, ImporteME:=ImporteME, TipoCambio:=TC, CveProveedor:=DdlProveedores.SelectedValue.ToEntero, CveOC:=CveOrdenCompraPresupuesto, CveClasificacion:=item.CveClasificacion, CveSubProyecto:=item.CveSubProyecto, Contabilizable:=True) Then
Respuesta = False
Exit For
End If
Next
Else
Respuesta = False
End If
End If
Return Respuesta
End Function
#End Region

View File

@@ -41,15 +41,16 @@
<%-- Filtro Visible - Consulta --%>
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button OnClick="Consultar" runat="server" Text="Consultar" class="btn
btn-primary" />
<asp:Button OnClick="Consultar" runat="server" Text="Consultar" class="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row" style="height: 32px;">
<div class="titlefiltros caption row">
<%--<div class="row" style="height: 32px;">--%>
<%-- Fecha Inicial --%>
<label class="col-md-1 truncate">Fecha Inicial</label>
<div class="col-md-1" style="min-width: 115px">
<div class="col-md-1" >
<div class="input-group input-sm input-small date date-picker "
data-date-format="dd/mm/yyyy"
style="width: 100px !important; padding: 0px;">
@@ -69,7 +70,7 @@
</div>
<%-- Fecha Final --%>
<label class="col-md-1 truncate">Fecha Fin</label>
<div class="col-md-1" style="min-width: 115px">
<div class="col-md-1" >
<div class="input-group input-sm input-small date date-picker "
data-date-format="dd/mm/yyyy"
style="width: 100px !important; padding: 0px;">
@@ -100,43 +101,44 @@
<label class="col-md-1 ">Estatus:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlEstatus" data-text="Todos" AppendDataBoundItems="true"
DataTextField="ContratoEstatus" DataValueField="CveContratoEstatus" CssClass="form-control ddlFiltros input-sm select2me
Widthall"
DataTextField="ContratoEstatus" DataValueField="CveContratoEstatus" CssClass="form-control ddlFiltros input-sm select2me"
Style="width: 100%;" runat="server">
</asp:DropDownList>
</div>
</div>
</div>
<%--</div>--%>
</div>
<%-- Filtro Oculto --%>
<div class="portlet-body row" style="display: none">
<%-- Centro de Costos --%>
<label class="col-md-1 truncate ">Centro de Costos</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlCentroCostos" data-text="Todos" AppendDataBoundItems="true"
DataTextField="" DataValueField="" CssClass="form-control ddlFiltros input-sm select2me
Widthall"
Style="width: 100%;" runat="server">
</asp:DropDownList>
</div>
<%-- Tipo de Unidad --%>
<label class="col-md-1 ">Tipo de Unidad</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlTipoUnidad" data-text="Todos" AppendDataBoundItems="true"
DataTextField="TipoActivoFijo" DataValueField="CveTipoActivoFijo" CssClass="form-control ddlFiltros input-sm select2me
Widthall"
Style="width: 100%;" runat="server">
</asp:DropDownList>
</div>
<%-- Chofer --%>
<label class="col-md-1 ">Chofer:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlChofer" data-text="Todos" AppendDataBoundItems="true"
DataTextField="NombreCompleto" DataValueField="CvePersonal" CssClass="form-control ddlFiltros input-sm select2me
Widthall"
Style="width: 100%;" runat="server">
</asp:DropDownList>
<div class="portlet-body" style="display: none">
<div class="row">
<%-- Centro de Costos --%>
<label class="col-md-1 truncate ">Centro de Costos</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlCentroCostos" data-text="Todos" AppendDataBoundItems="true"
DataTextField="" DataValueField="" CssClass="form-control ddlFiltros input-sm select2me"
Style="width: 100%;" runat="server">
</asp:DropDownList>
</div>
<%-- Tipo de Unidad --%>
<label class="col-md-1 ">Tipo de Unidad</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlTipoUnidad" data-text="Todos" AppendDataBoundItems="true"
DataTextField="TipoActivoFijo" DataValueField="CveTipoActivoFijo" CssClass="form-control ddlFiltros input-sm select2me"
Style="width: 100%;" runat="server">
</asp:DropDownList>
</div>
<%-- Chofer --%>
<label class="col-md-1 ">Chofer:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlChofer" data-text="Todos" AppendDataBoundItems="true"
DataTextField="NombreCompleto" DataValueField="CvePersonal" CssClass="form-control ddlFiltros input-sm select2me"
Style="width: 100%;" runat="server">
</asp:DropDownList>
</div>
</div>
</div>
</div>
</ContentTemplate>

View File

@@ -179,8 +179,14 @@
</div>
</div>
<div class="portlet-body">
<div id="calendar">
</div>
<asp:UpdatePanel runat="server" ID="UpCalendario" UpdateMode="Conditional">
<ContentTemplate>
<div id="calendar">
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
@@ -485,7 +491,7 @@
<div style="display: none">
<asp:UpdatePanel ID="UpCommando" runat="server">
<asp:UpdatePanel ID="UpCommando" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button runat="server" ID="BtnModal" OnClick="MostrarModal"></asp:Button>
<asp:HiddenField runat="server" ID="CveContrato" Value="-1" ClientIDMode="Static" />
@@ -494,6 +500,9 @@
</div>
<asp:HiddenField runat="server" ID="HidModClienteNombre" ClientIDMode="Static" />
<asp:HiddenField runat="server" ID="HidModCveCliente" ClientIDMode="Static" />
<asp:HiddenField runat="server" ID="HidCurrentMonth" ClientIDMode="Static" Value="-1" />
<asp:HiddenField runat="server" ID="HidCurrentYear" ClientIDMode="Static" Value="-1" />
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
@@ -682,8 +691,14 @@
var date = null;
function InitCalendar() {
$(document).ready(function () {
Calendario();
$(document).ready(function () {
let mes = parseInt($('#<%=HidCurrentMonth.ClientID%>').val());
let anio = parseInt($('#<%=HidCurrentYear.ClientID%>').val());
Calendario(mes,anio);
});
}
@@ -691,14 +706,14 @@
}
function updateEvent(event, element) {
$('#<%=TxtCantidadPasajeros.ClientID%>').val(event.CantidadPasajeros);
$('#<%=TxtFolio.ClientID%>').val(event.NumeroContrato);
$('#<%=TxtObservaciones.ClientID%>').val(event.title);
$('#<%=TxtDescripcion.ClientID%>').val(event.title);
$('#<%=TxtUbicacion.ClientID%>').val(event.NombreAcercamiento);
<%--$('#<%=TxtFechaSalida.ClientID%>').val(event.start._i);
$('#<%=TxtFechaRegreso.ClientID%>').val(event.end._i);--%>
$('#<%=TxtFechaSalida.ClientID%>').val(formatearFechaISO(event.start._i));
$('#<%=TxtFechaRegreso.ClientID%>').val(formatearFechaISO(event.FechaFinal));
@@ -722,7 +737,8 @@
$('#HidModCveCliente').val(event.CveCliente);
$('#<%=BtnModal.ClientID%>').click();
$('#<%=BtnModal.ClientID%>').click();
}
@@ -792,13 +808,28 @@
updateEventOnDropResize(event);
}
function Calendario() {
function Calendario(mes = -1, anio = -1) {
let fechaActual = new Date();
if (mes === -1) {
mes = fechaActual.getMonth() + 1;
}
if (anio === -1) {
anio = fechaActual.getFullYear();
}
let mesFormateado = ('0' + mes).slice(-2);
let fechaInicio = `${anio}-${mesFormateado}-01`;
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var h = {};
//alert(fechaInicio);
if ($('#calendar').width() <= 400) {
$('#calendar').addClass("mobile");
h = {
@@ -818,6 +849,7 @@
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar({
defaultDate: fechaInicio,
header: h,
monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
@@ -849,10 +881,39 @@
}
},
eventDrop: eventDropped,
eventResize: eventResized
eventResize: eventResized,
viewRender: function(view, element) {
let pointDate = view.intervalStart;
let currentMonth = pointDate.month() + 1;
let currentYear = pointDate.year();
$('#<%=HidCurrentMonth.ClientID%>').val(currentMonth);
$('#<%=HidCurrentYear.ClientID%>').val(currentYear);
}
});
}
function obtenerFechaInicio(mes = -1, anio = -1) {
let fechaActual = new Date();
if (mes === -1) {
mes = fechaActual.getMonth() + 1; // getMonth() es base 0, así que se suma 1
}
if (anio === -1) {
anio = fechaActual.getFullYear();
}
let mesFormateado = ('0' + mes).slice(-2);
let fechaInicio = `${anio}-${mesFormateado}-01`;
return fechaInicio;
}
</script>

View File

@@ -38,7 +38,7 @@ Partial Class RepContratosCalendario
InicializaCalendar()
CargaDatos()
End If
InicializaCalendar()
'InicializaCalendar()
End Sub
Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos
@@ -107,7 +107,8 @@ Partial Class RepContratosCalendario
UPPGantt.Update()
End If
End Sub
Private Sub InicializaCalendar()
Private Sub InicializaCalendar()
RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub
@@ -193,17 +194,19 @@ Partial Class RepContratosCalendario
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
If Contrato.ToEntero <= 0 Then Contrato = CveContrato.Value
Contrato = CveContrato.Value
If ObjContratos.UpdateContratos(Contrato.ToEntero, TxtFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34, CveContratosEstatus:=DdlEstatusContrato.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero) Then
ObjContratos.Commit()
Alert("Actualizado Correctamente.")
Else
ObjContratos.RollBack()
End If
End If
ObjContratos.Dispose()
UpTitulos.Update()
CargaDatos()
InicializaCalendar()
End Sub
Protected Sub UpdateModal(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)

View File

@@ -0,0 +1,233 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepVencimientosCredito.aspx.cs" Inherits="Ventas_RepVencimientosCredito" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
<asp:Literal runat="server" ID="LtlEncabezado" Text="Reporte Lineas Adicionales"></asp:Literal>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkDescargaExcel" OnClick="LnkDescargaExcel_Click" runat="server" Visible="false"><i class="fa fa-file-excel-o"></i> Excel</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkDescargaExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="" id="DivFiltros">
<div class="portlet-title portlet-filterT smalltitle " style="">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" OnClick="BtnConsultar_Click" Text="Consultar" class="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row">
<div class="col-md-1 truncate" runat="server" id="DVProveedor1" visible="false">Comercializador:</div>
<div class="col-md-2" runat="server" id="DVProveedor2" visible="false">
<ADS:Dropdownlost ID="DdlProveedor" SelectedText="-" runat="server" CssStyle="width: 100%; selected2me; " Width="100%" DataTextField="RazonSocial" DataValueField="CveProveedor" CssClass="select2me"></ADS:Dropdownlost>
</div>
<div class="col-md-1 truncate" >Cliente:</div>
<div class="col-md-2 ">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" UsaWebService="true" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
<div class="col-md-1 truncate" >Estatus:</div>
<div class="col-md-1 ">
<asp:DropDownList runat="server" ID="DdlEstatus" CssClass="select2me" Width="100%">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<%--<asp:ListItem Text="Registrado" Value="0" ></asp:ListItem> --%>
<asp:ListItem Text="Pendiente" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Enviado" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 truncate" runat="server" id="DVAgrupador1" visible="false">Agrupador:</div>
<div class="col-md-1 " runat="server" id="DVAgrupador2" visible="false">
<asp:DropDownList runat="server" ID="DdlAgrupador" CssClass="select2me" Width="100%">
<asp:ListItem Text="Comercializador" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Cliente" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="portlet-body" style="display: none;">
<div class="row">
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-12">
<asp:UpdatePanel ID="UpLineasAdicionales" runat="server" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
<div class="row " runat="server" visible ="false" id="DvLinea">
<div class=" col-md-12" style="text-align: right!important">
<input type="text" id="TxtBuscarLineaAdicional" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLineasAdicionales.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLineasAdicionales.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<div class="row " runat="server" visible ="false" id="DvLineaPO">
<div class=" col-md-12" style="text-align: right!important">
<input type="text" id="TxtBuscarLineaAdicionalpo" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLAPO.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLAPO.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<div class="row ">
<div class="col-md-12">
<asp:GridView ID="GvLineasAdicionales" Width="100%" runat="server" GridLines="None" Visible="false"
DataKeyNames="CveLineaAdicional,LineaAdicional,CveCliente,CveProveedor,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveUsuario,CveCategoria,FechaIng,CveLineaAdicionalEstatus,Proveedor,LineaAdicionalComprobante,DiasVencimiento,CveVenta"
CssClass="table table-striped table-advance table-hover ScrollAD input-sm " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns>
<asp:BoundField DataField="LineaAdicional" HeaderText="Linea Adicional" />
<asp:BoundField DataField="NombreCliente" HeaderText="Cliente" />
<asp:BoundField DataField="Proveedor" HeaderText="Comercializador" />
<asp:BoundField DataField="Importe" HeaderText="Importe" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Abreviatura" HeaderText="Moneda" />
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Serie Folio" />
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="DiasVencimiento" HeaderText="Dias de Venc." />
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
</Columns>
</asp:GridView>
<asp:GridView ID="GvLAPO" Width="100%" runat="server" GridLines="None" Visible="false"
DataKeyNames="CveLineaAdicional,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveLineaAdicionalEstatus,LineaAdicionalComprobante,CveVenta,CveCliente,CveProveedor"
CssClass="table table-striped table-advance table-hover ScrollAD input-sm mysmallbtn" ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"
OnRowCommand="GvLAPO_RowCommand"
OnRowDataBound="GvLAPO_RowDataBound">
<Columns>
<asp:BoundField DataField ="Agrupador" HeaderText="Agrupador" />
<asp:BoundField DataField="LineaAdicional" HeaderText="PO" />
<asp:BoundField DataField="Importe" HeaderText="Importe PO" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Abreviatura" HeaderText="Mon" />
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Serie Folio" />
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="DiasVencimiento" HeaderText="D.Plazo" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="DiasTranscurridos" HeaderText="D.Trans" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="FechaVenta" HeaderText="F. Venta" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaVencimientoVenta" HeaderText="F. Venc. Venta" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
<asp:BoundField DataField="FechaEnvio" HeaderText="F. Envío" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Opciones" ItemStyle-Width="75px" HeaderStyle-Width="75px">
<ItemTemplate>
<div class="row" >
<div class="col-md-4" style="max-width:26px!important">
<asp:LinkButton ID="LnkCargarComprobante" Visible="false" runat="server" AlternateText="Editar" CausesValidation="False"
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-upload'></i>" OnClick="LnkCargarComprobante_Click"
ToolTip="Cargar Comprobante" />
<asp:LinkButton ID="LnkDescargaComprobante" Visible="false" runat="server" AlternateText="Descarga" CausesValidation="False"
CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-download'></i>" OnClick="LnkDescargaComprobante_Click"
ToolTip="Descargar Comprobante" />
</div>
<div class="col-md-4" style="max-width:26px!important" title="Cambiar estatus a Enviado">
<asp:LinkButton ID="LnkCambiarEstatus" runat="server" Visible="false" AlternateText="CambiarEstatus"
CommandName="Estatus" CommandArgument='<%# Eval("CveLineaAdicionalEstatus") %>' CausesValidation="False"
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-arrow-right'></i>"
data-toggle="confirmation" data-popout="true" data-original-title="¿Cambiar Estado?" data-btn-ok-label="si"
ToolTip="Cambiar estatus a Enviado" />
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<%-- MODAL COMPROBANTE --%>
<div id="ModalComprobante" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="width: 700px;">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Agregar Comprbante</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpAddComprobancte" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<div>
<asp:TextBox ID="Anexo" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnAddComprobante" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" OnClick="BtnAddComprobante_Click" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
<%-- FIN MODAL COMPROBANTE --%>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

View File

@@ -0,0 +1,409 @@
using System;
using System.Web.UI.WebControls;
using Extensiones;
using System.Data;
using static Extensiones.ModExtensiones;
using System.Collections.Generic;
using System.IO;
using System.Web.UI;
public partial class Ventas_RepVencimientosCredito : ClsPaginas
{
#region PROPIEDADES
private int CveLineaAdicional
{
get { return (ViewState["CveLineaAdicional"] == null) ? 0 : int.Parse(ViewState["CveLineaAdicional"].ToString()); }
set { ViewState["CveLineaAdicional"] = (int)value; }
}
private int CveVenta
{
get { return (ViewState["CveVenta"] == null) ? 0 : int.Parse(ViewState["CveVenta"].ToString()); }
set { ViewState["CveVenta"] =(int) value; }
}
private int TipoLinea
{
get { return (ViewState["TipoLinea"] == null) ? 1: int.Parse(ViewState["TipoLinea"].ToString()); }
set { ViewState["TipoLinea"] = (int)value; }
}
private DataTable DTDatosGvLineasAdicionales
{
get
{
if (ViewState["DTDatosGvLineasAdicionales"] == null)
{
ViewState["DTDatosGvLineasAdicionales"] = new DataTable();
}
return (DataTable)ViewState["DTDatosGvLineasAdicionales"];
}
set { ViewState["DTDatosGvLineasAdicionales"] = (DataTable)value; }
}
private string LineaAdicionalComprobante
{
get {
if(ViewState["LineaAdicionalComprobante"] == null)
{
ViewState["LineaAdicionalComprobante"] = "";
}
return ViewState["LineaAdicionalComprobante"].ToString();
}
set { ViewState["LineaAdicionalComprobante"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InicializaValores();
CargaDatos();
}
}
private void InicializaValores()
{
if (Request["OP"] != null && Request["OP"].ToString() == "PO")
{
DVProveedor1.Visible = true;
DVProveedor2.Visible = true;
TipoLinea = 2;
LtlEncabezado.Text = "Reporte PO";
GvLAPO.Visible = true;
DvLineaPO.Visible = true;
DVAgrupador1.Visible = true;
DVAgrupador2.Visible = true;
}
else
{
DvLinea.Visible = true;
GvLineasAdicionales.Visible = true;
}
if(UsuarioActual.Empresa.Funcionalidad(105) == "1") {
DdlProveedor.setEsWebService(true);
DdlProveedor.Attributes.Add("data-metodo", "getproveedores");
DdlProveedor.SelectedText = "Todos";
DdlProveedor.SelectedValue = "-1";
}else {
DdlProveedor.setEsWebService(false);
DdlProveedor.ddl.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa);
DdlProveedor.ddl.DataBind();
DdlProveedor.ddl.Items.Insert(0, new ListItem("-", "-1"));
}
DdlClientes.setEsWebService(true);
DdlClientes.Attributes.Add("data-metodo", "getcliente");
DdlClientes.SelectedText = "Todos";
DdlClientes.SelectedValue = "-1";
}
protected void BtnConsultar_Click(object sender, EventArgs e)
{
CargaDatos();
}
private void CargaDatos()
{
DTDatosGvLineasAdicionales = new DataTable();
LnkDescargaExcel.Visible = false;
ClsVentas objVentas = new ClsVentas();
int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1;
if(TipoLinea == 1)
{
if (objVentas.RepLineasAdicionales(-1,-1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 1, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
{
GvLineasAdicionales.DataSource = objVentas.DtResultados;
if (objVentas.DtResultados.Rows.Count > 0)
{
DTDatosGvLineasAdicionales = objVentas.DtResultados;
LnkDescargaExcel.Visible = true;
UpAcciones.Update();
}
}
else
{
GvLineasAdicionales.DataSource = null;
}
}
else
{
if (DdlAgrupador.SelectedValue.ToEntero()== 1){
GvLAPO.Columns[0].HeaderText = "Comercializador";
}
else
{
GvLAPO.Columns[0].HeaderText = "Cliente";
}
if (objVentas.RepLineasAdicionales(DdlAgrupador.SelectedValue.ToEntero(), -1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 2, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
{
GvLAPO.DataSource = objVentas.DtResultados;
if (objVentas.DtResultados.Rows.Count > 0)
{
DTDatosGvLineasAdicionales = objVentas.DtResultados;
LnkDescargaExcel.Visible = true;
UpAcciones.Update();
}
}
else
{
GvLAPO.DataSource = null;
}
}
objVentas.Dispose();
GvLineasAdicionales.DataBind();
GvLAPO.DataBind();
UpLineasAdicionales.Update();
}
protected void LnkCargarComprobante_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow) ((LinkButton) sender).NamingContainer;
CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero();
LineaAdicionalComprobante = GvRow.DataKey("LineaAdicionalComprobante").ToString();
RegistraScript("$('#ModalComprobante').modal('show');","");
}
protected void BtnAddComprobante_Click(object sender, EventArgs e)
{
bool errorCargaComprobante = false;
string FileExtension = "-1";
List<Archivo> filesgral = Anexo.getfiles().Archivos;
string filemove = "";
FileInfo fiNuevo;
DirectoryInfo df = new DirectoryInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\");
//Crea directorio si no existe
if (!df.Exists)
{
try
{
Directory.CreateDirectory(df.FullName);
}
catch
{
errorCargaComprobante = true;
}
}
//borrar archivo anterior
if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0)
{
FileInfo fiAnterior = new FileInfo($@"{df.FullName}{LineaAdicionalComprobante}");
if (fiAnterior.Exists)
{
try
{
File.Delete(fiAnterior.FullName);
}
catch
{
errorCargaComprobante = true;
}
}
}
if(!errorCargaComprobante){
string RutaArchivoTemp = "";
foreach (Archivo fileItem in filesgral)
{
FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
filemove = fileItem.filename;
RutaArchivoTemp = $@"{AppDomain.CurrentDomain.BaseDirectory}\Temp\{fileItem.filename}";
break;
}
if((!errorCargaComprobante) && RutaArchivoTemp.Length > 0)
{
fiNuevo = new FileInfo(RutaArchivoTemp);
if (fiNuevo.Exists)
{
try
{
if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"))
{
File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}");
}
File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveVenta}{fiNuevo.Extension}");
errorCargaComprobante = false;
}
catch
{
errorCargaComprobante = true;
}
if (!errorCargaComprobante)
{
ClsVentas objVentas = new ClsVentas();
if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, $@"{CveVenta}{fiNuevo.Extension}", -1, UsuarioActual.CveEmpresa))
{
errorCargaComprobante = true;
}
objVentas.Dispose();
}
}
}
}
if (!errorCargaComprobante)
{
CargaDatos();
Anexo.Text = "[]";
RegistraScript("$('#ModalComprobante').modal('hide');", "");
Alert("Comprobante actualizado correctamente.");
}
UpAddComprobancte.Update();
}
protected void LnkCambiarEstatus_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToEntero();
int CveVenta = GvRow.DataKey("CveVenta").ToEntero();
bool errorCambioEstatus = false;
ClsVentas objVentas = new ClsVentas();
if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, "", 2, UsuarioActual.CveEmpresa))
{
errorCambioEstatus = true;
}
if (!errorCambioEstatus)
{
CargaDatos();
}
objVentas.Dispose();
}
protected void LnkDescargaExcel_Click(object sender, EventArgs e)
{
if(TipoLinea == 1)
{
GridView gvTemp = GvLineasAdicionales;
//gvTemp.ExportToExcelX("RepLineasAdicionales" + NowADS().ToShortDateString());
gvTemp.ExportToExcelGembox("RepLineasAdicionales", UsuarioActual, "Rep Lineas Adicionales", AnchoImagen: 150);
}
else if(TipoLinea == 2)
{
GridView gvTemp = GvLAPO;
gvTemp.Columns[12].Visible = false;
//gvTemp.ExportToExcelX("ReportePO" + NowADS().ToShortDateString());
gvTemp.ExportToExcelGembox( "ReportePO", UsuarioActual, "Reporte PO ", AnchoImagen:150);
}
}
protected void GvLAPO_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton LnkCambiarEstatus = e.Row.FCLinkButton("LnkCambiarEstatus");
LinkButton LnkCargarComprobante = e.Row.FCLinkButton("LnkCargarComprobante");
LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante");
if (e.Row.DataKey("CveLineaAdicional")=="")
{
if (e.Row.DataKey("CveLineaAdicional") == "" && e.Row.DataKey("CveCliente") == "")
{
e.Row.CssClass = "SubTotales2";
if (e.Row.DataKey("CveLineaAdicional") == "" && e.Row.DataKey("CveCliente") == "" && e.Row.DataKey("CveProveedor") != "")
{
e.Row.Cells[0].Text = "<a href='/Compras/Proveedores.aspx?CveProveedor="+ e.Row.DBCampo("CveProveedor") + "' >"+ e.Row.DBCampo("Proveedor") +"</a>";
}
}
else
{
e.Row.CssClass = "SubTotales";
}
LnkCambiarEstatus.Visible = false;
LnkCargarComprobante.Visible = false;
LnkDescargaComprobante.Visible = false;
}
else
{
if (e.Row.DataKey("CveVenta").ToEntero() > 0 && e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 1)
{
if (UsuarioActual.TienePermisoProceso(356)) LnkCambiarEstatus.Visible = true;
LnkCargarComprobante.Visible = true;
}
if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0)
{
FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("LineaAdicionalComprobante")}");
if (fi.Exists)
{
LnkDescargaComprobante.Visible = true;
ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaComprobante);
}
}
}
}
}
protected void LnkDescargaComprobante_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
string Comprobante = GvRow.DataKey("LineaAdicionalComprobante");
FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{Comprobante}");
if (fi.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name);
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.ContentType = "text/octet-stream";
Response.Flush();
Response.TransmitFile(fi.FullName);
Response.End();
}
}
protected void GvLAPO_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Estatus")
{
GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
int CveLineaAdicionalActualizarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
int CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero();
bool errorCambioEstatus = false;
//int cveestatus = e.CommandArgument.ToEntero() + 2; //pasar al siguiente estatus
ClsVentas objVentas = new ClsVentas();
if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicionalActualizarEstatus, CveVenta,"", 2, UsuarioActual.CveEmpresa))
{
errorCambioEstatus = true;
}
objVentas.Dispose();
if (!errorCambioEstatus)
{
CargaDatos();
}