This commit is contained in:
2024-05-15 11:44:04 -07:00
13 changed files with 420 additions and 208 deletions

View File

@@ -3246,7 +3246,7 @@ Public Class ClsContratos
Return Retorno
End Function
Public Function GetPresupuestosRepDetalleCompras(CveProyecto As Integer, CveSubProyecto As Integer, CveAgrupador As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean
Public Function GetPresupuestosRepDetalleCompras(CveProyecto As Integer, CveSubProyecto As Integer, CveAgrupador As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveUsuario As Integer, Optional Comprometido As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Con_PresupuestosRepDetalleCompra")
@@ -3259,6 +3259,7 @@ Public Class ClsContratos
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuario
.Add("@Comprometido", SqlDbType.Bit).Value = Comprometido
End With
Try

View File

@@ -208,7 +208,7 @@
<div class="col-md-1" style="max-width: 80px">Agrupador:</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlAgrupador" Width="150px" runat="server" CssClass="form-control input-sm select2me">
<asp:ListItem Text="Clasificacion" Value="1" />
<asp:ListItem Text="Clasificación" Value="1" />
<asp:ListItem Text="Centro de Costo" Value="2" Selected="True" />
</asp:DropDownList>
</div>
@@ -231,7 +231,7 @@
<asp:DropDownList ID="DdlSubProyecto" DataTextField="SubProyecto" AppendDataBoundItems="true" DataValueField="CveSubProyecto" Width="200px" runat="server" CssClass="form-control input-sm select2me">
</asp:DropDownList>
</div>
<div class="col-md-1" style="max-width: 120px">Clasificacion:</div>
<div class="col-md-1" style="max-width: 120px">Clasificación:</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlClasificacion" DataTextField="Agrupador" DataValueField="CveAgrupador" Width="200px" runat="server" CssClass="form-control input-sm select2me">
</asp:DropDownList>
@@ -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>
@@ -340,8 +341,9 @@
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="Sin resultados" ShowHeaderWhenEmpty="true" CssClass="table table-striped table-hover Widthall ScrollAD" GridLines="None" data-sort="true">
<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="Descripción" DataField="Agrupador" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Importe" DataField="Autorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Importe" 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="Descripción" 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

@@ -201,7 +201,7 @@
<div class="col-md-1" style="max-width: 80px">Agrupador:</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlAgrupador" Width="150px" runat="server" CssClass="form-control input-sm select2me">
<asp:ListItem Text="Clasificacion" Value="1" />
<asp:ListItem Text="Clasificación" Value="1" />
<asp:ListItem Text="Centro de Costo" Value="2" Selected="True" />
</asp:DropDownList>
</div>
@@ -224,7 +224,7 @@
<asp:DropDownList ID="DdlSubProyecto" DataTextField="SubProyecto" AppendDataBoundItems="true" DataValueField="CveSubProyecto" Width="200px" runat="server" CssClass="form-control input-sm select2me">
</asp:DropDownList>
</div>
<div class="col-md-1" style="max-width: 120px">Clasificacion:</div>
<div class="col-md-1" style="max-width: 120px">Clasificación:</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlClasificacion" DataTextField="Agrupador" DataValueField="CveAgrupador" Width="200px" runat="server" CssClass="form-control input-sm select2me">
</asp:DropDownList>
@@ -247,7 +247,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>
@@ -258,8 +259,9 @@
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="Sin resultados" ShowHeaderWhenEmpty="true" CssClass="table table-striped table-hover Widthall ScrollAD" GridLines="None" data-sort="true">
<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="Descripción" DataField="Agrupador" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Importe" DataField="Autorizado" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Importe" 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%" />
@@ -297,7 +299,7 @@
</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="Descripción" 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" />

View File

@@ -87,14 +87,15 @@ Partial Class Contratos_RepPresupuestosDetalle
Gpo = IfNull(Request("CveAgrupador"), -1).ToString.ToEntero
Dim Mensual = CBool(IfNull(Request("Mensual"), False))
Dim EsProyecto = CBool(IfNull(Request("EsProyecto"), False))
If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1
'If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1
DdlAgrupador.SelectedValueExist(Agrupador)
DdlClasificacion.SelectedValueExist(CveClasificacion)
If DdlAgrupador.SelectedValue.ToEntero = 2 Then
DdlClasificacion.SelectedValueExist(CveClasificacion)
If DdlAgrupador.SelectedValue.ToEntero = 1 Then
DdlClasificacion.SelectedValueExist(Gpo)
DdlProyecto.SelectedValueExist(CveProyecto)
DdlSubProyecto.SelectedValueExist(CveSubProyecto)
ElseIf DdlAgrupador.SelectedValue.ToEntero = 1 Then
ElseIf DdlAgrupador.SelectedValue.ToEntero = 2 Then
If Not EsProyecto Then
Dim Dr As DataRow = GlobalDTSubProyectos(-1, Gpo)(0)
DdlProyecto.SelectedValueExist(Dr("CveProyecto"))
@@ -158,20 +159,20 @@ Partial Class Contratos_RepPresupuestosDetalle
e.Row.Cells(1).Text = "-"
End If
If e.Row.DBCampo("Ejercido").ToDecimal = 0 Then
e.Row.Cells(2).Text = "-"
End If
If e.Row.DBCampo("EjercidoPorcentaje").ToDecimal = 0 Then
e.Row.Cells(3).Text = "-"
End If
If e.Row.DBCampo("PorEjercer").ToDecimal = 0 Then
If e.Row.DBCampo("EjercidoPorcentaje").ToDecimal = 0 Then
e.Row.Cells(4).Text = "-"
End If
If e.Row.DBCampo("PorEjercerPorcentaje").ToDecimal = 0 Then
If e.Row.DBCampo("PorEjercer").ToDecimal = 0 Then
e.Row.Cells(5).Text = "-"
End If
If e.Row.DBCampo("Pagado").ToDecimal = 0 Then
If e.Row.DBCampo("PorEjercerPorcentaje").ToDecimal = 0 Then
e.Row.Cells(6).Text = "-"
End If
If e.Row.DBCampo("Pagado").ToDecimal = 0 Then
e.Row.Cells(7).Text = "-"
End If
If e.Row.RowIndex > 0 Then
Dim CveAgrupador = e.Row.DBCampo("CveAgrupador").ToEntero
Dim EsProyecto = False
@@ -185,9 +186,13 @@ Partial Class Contratos_RepPresupuestosDetalle
End If
EsProyecto = True
End If
Dim Css = "Texto"
Dim Css = "Texto"
Dim Liga = $"/Contratos/RepPresupuestosDetalleCompras.aspx?&CveAgrupador={CveAgrupador}&CveClasificacion={e.Row.DBCampo("CveClasificacionFiltro")}&CveConceptoContableNom={e.Row.DBCampo("CveConceptoContableNomFiltro")}&CveProyecto={e.Row.DBCampo("CveProyectoFiltro")}&CveSubProyecto={e.Row.DBCampo("CveSubProyectoFiltro")}&CveTipoGasto={e.Row.DBCampo("CveTipoGastoFiltro")}&Agrupador={e.Row.DBCampo("AgrupadorFiltro")}&Mensual={False}&EsProyecto={EsProyecto}&FechaFin={FechaFin}&FechaInicio={FechaInicio}"
e.Row.Cells(0).Text = "<a class=" + "" + Css + "" + " href=" + "" + Liga + "" + ">" + e.Row.Cells(0).Text + "</a>"
Dim LigaComprometido = $"/Contratos/RepPresupuestosDetalleCompras.aspx?&CveAgrupador={CveAgrupador}&CveClasificacion={e.Row.DBCampo("CveClasificacionFiltro")}&CveConceptoContableNom={e.Row.DBCampo("CveConceptoContableNomFiltro")}&CveProyecto={e.Row.DBCampo("CveProyectoFiltro")}&CveSubProyecto={e.Row.DBCampo("CveSubProyectoFiltro")}&CveTipoGasto={e.Row.DBCampo("CveTipoGastoFiltro")}&Agrupador={e.Row.DBCampo("AgrupadorFiltro")}&Mensual={False}&EsProyecto={EsProyecto}&FechaFin={FechaFin}&FechaInicio={FechaInicio}&Comprometido=1"
e.Row.Cells(2).Text = "<a class=" + "" + Css + "" + " href=" + "" + LigaComprometido + "" + ">" + e.Row.Cells(2).Text + "</a>"
End If
End If
End Sub

View File

@@ -219,7 +219,7 @@
<div class="portlet-body" style="display: none;" id="idnecesaria2">
<div class="row">
<div class="col-md-1" style="max-width: 120px">Clasificacion:</div>
<div class="col-md-1" style="max-width: 120px">Clasificación:</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlClasificacion" DataTextField="Agrupador" AppendDataBoundItems="true" DataValueField="CveAgrupador" Width="200px" runat="server" CssClass="form-control input-sm select2me">
</asp:DropDownList>

View File

@@ -2,11 +2,14 @@
Option Strict On
Imports System.Data
Imports Extensiones
Imports Org.BouncyCastle.Asn1.Ocsp
Partial Class Contratos_RepPresupuestosDetalleCompras
Inherits ClsPaginas
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Public Property Gpo() As Integer
Get
Return DirectCast(ViewState("Gpo"), Integer)
@@ -14,8 +17,20 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
Set(ByVal value As Integer)
ViewState("Gpo") = value
End Set
End Property
End Property
Public Property Comprometido As Boolean
Get
If ViewState("Comprometido") Is Nothing Then
ViewState("Comprometido") = False
End If
Return Boolean.Parse(ViewState("Comprometido").ToString)
End Get
Set(value As Boolean)
ViewState("Comprometido") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
@@ -25,8 +40,8 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
CargaDatos()
End If
End Sub
End Sub
#Region " INICIALIZA VALORES "
Private Sub InicializaValores()
@@ -71,7 +86,11 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
Dim CveProyecto = IfNull(Request("CveProyecto"), -1).ToString.ToEntero
Dim CveSubProyecto = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero
Dim CveTipoGasto = IfNull(Request("CveTipoGasto"), -1).ToString.ToEntero
Dim Agrupador = IfNull(Request("Agrupador"), -1).ToString.ToEntero
Dim Agrupador = IfNull(Request("Agrupador"), -1).ToString.ToEntero
Comprometido = If(Request("Comprometido") IsNot Nothing AndAlso Request("Comprometido").ToEntero = 1, True, False)
Gpo = IfNull(Request("CveAgrupador"), -1).ToString.ToEntero
Dim EsProyecto = CBool(IfNull(Request("EsProyecto"), False))
If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1
@@ -106,7 +125,8 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
End Sub
Private Sub CargaDatos()
Dim ObjPresupuestos As New ClsContratos
If ObjPresupuestos.GetPresupuestosRepDetalleCompras(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlTipoGasto.SelectedValue.ToEntero, TxtFiltrosFechaInicio.Text.ToDate, TxtFiltrosFechaFin.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
If ObjPresupuestos.GetPresupuestosRepDetalleCompras(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlTipoGasto.SelectedValue.ToEntero, TxtFiltrosFechaInicio.Text.ToDate,
TxtFiltrosFechaFin.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Comprometido:=Comprometido) Then
GvDatos.DataSource = ObjPresupuestos.DtResultados
End If
ObjPresupuestos.Dispose()
@@ -131,15 +151,21 @@ Partial Class Contratos_RepPresupuestosDetalleCompras
Dim Liga = ""
Dim Css = "Texto"
Dim TipoAgrupador As Integer = e.Row.DBCampo("TipoAgrupador").ToEntero()
Select Case TipoAgrupador
Case 1
Liga = $"/Compras/Compras.aspx?&CveCompra={e.Row.DBCampo("CveCompra")}"
Case 2
Liga = $"/Contabilidad/RegPrePoliza.aspx?&CvePrePoliza={e.Row.DBCampo("CveCompra")}"
Case Else
If Comprometido Then
Liga = $"/OC/OC.aspx?OC={e.Row.DBCampo("CveOrdenCompra")}"
Else
Dim TipoAgrupador As Integer = e.Row.DBCampo("TipoAgrupador").ToEntero()
Select Case TipoAgrupador
Case 1
Liga = $"/Compras/Compras.aspx?&CveCompra={e.Row.DBCampo("CveCompra")}"
Case 2
Liga = $"/Contabilidad/RegPrePoliza.aspx?&CvePrePoliza={e.Row.DBCampo("CveCompra")}"
Case Else
End Select
End If
End Select
e.Row.Cells(0).Text = "<a target=""_blank"" class=" + "" + Css + "" + " href=" + "" + Liga + "" + ">" + e.Row.Cells(0).Text + "</a>"
End If
End If

View File

@@ -2239,7 +2239,7 @@
<div class="row">
<label class="col-md-2">Solicitar a:</label>
<div class="col-md-9">
<asp:DropDownList ID="DdlSAUsuario" CssClass="form-control input-sm select2me" DataTextField="Nombre" DataValueField="CveUsuario" runat="server" Width="100%"></asp:DropDownList>
<asp:DropDownList ID="DdlSAUsuario" CssClass="form-control input-sm select2me" DataTextField="Nombre" DataValueField="CveUsuario" runat="server" Width="100%" CausesValidation="true"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVSAUsuario" runat="server" InitialValue="-1" ControlToValidate="DdlSAUsuario" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Usuario''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalSolicitarAnticipo"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCESAUsuario" runat="server" HighlightCssClass="vco" TargetControlID="RFVSAUsuario" Width="300px"></ajax:ValidatorCalloutExtender>
</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
@@ -5438,28 +5464,46 @@ Partial Class OC_OC
End If
End Sub
Private Sub EnviaCorreoSolicitudAnticipo(CveEvento As Integer, Optional ImporteAnticipo As Decimal = 0)
Dim Param As New List(Of String)
Dim DtPara As DataTable = GlobalDTUsuarios(DdlSAUsuario.SelectedValue.ToString.ToEntero, CveEmpresaActual)
If DdlMetodoPago.SelectedValue.ToEntero = 0 Then
DtPara = GlobalDTUsuarios(DdlSAUsuarioContado.SelectedValue.ToString.ToEntero, CveEmpresaActual)
If DtPara Is Nothing Then
DtPara = GlobalDTUsuarios(DdlSAUsuario.SelectedValue.ToString.ToEntero, CveEmpresaActual)
End If
End If
Param.Add(DtPara.Rows(0)("Correo").ToString()) 'Para
Param.Add("Solicitud de anticipo de Orden de Compra") 'Asunto
Try
If DtPara IsNot Nothing AndAlso DtPara.Rows.Count > 0 Then
Param.Add(DtPara.Rows(0)("Correo").ToString()) 'Para
Param.Add("Solicitud de anticipo de Orden de Compra") 'Asunto
If ImporteAnticipo = 0 Then
ImporteAnticipo = TxtSAImporte.Text.ToDecimal
End If
If ImporteAnticipo = 0 Then
ImporteAnticipo = TxtSAImporte.Text.ToDecimal
End If
Param.Add(GeneraCorreoAnticipo(lblFolio.Text, DtPara.Rows(0)("Nombre").ToString(), String.Format("http://sig.adssistemas.mx/OI/EventoDetalle.aspx?CveTipoEvento=1&CveEvento={0}", CveEvento), ImporteAnticipo.ToString, DdlProveedores.SelectedText))
Param.Add(String.Format("{0}PDF\OC-{1}.pdf", UsuarioActual.Empresa.Ruta, CveOrdenCompra))
Dim Hilo As New Threading.Thread(AddressOf MandaCorreoAnticipo)
Hilo.Start(Param)
Param.Add(GeneraCorreoAnticipo(lblFolio.Text, DtPara.Rows(0)("Nombre").ToString(), String.Format("http://sig.adssistemas.mx/OI/EventoDetalle.aspx?CveTipoEvento=1&CveEvento={0}", CveEvento), ImporteAnticipo.ToString, DdlProveedores.SelectedText))
Param.Add(String.Format("{0}PDF\OC-{1}.pdf", UsuarioActual.Empresa.Ruta, CveOrdenCompra))
Dim Hilo As New Threading.Thread(AddressOf MandaCorreoAnticipo)
Hilo.Start(Param)
End If
Catch ex As Exception
End Try
End Sub
Private Sub EnviaCorreoSolicitudAnticipoCancelado()
'If Not CveIEAnticipo > 0 Then 'SI NO SE HA REALIZADO EL ANTICIPO NOTIFICA QUE SE HA CANCELADO
Dim ObjOC As New ClsOC
@@ -9008,7 +9052,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 +9072,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 +9104,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 +9150,7 @@ Partial Class OC_OC
respuesta = True
End If
Next
End If
Else
@@ -9130,6 +9176,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

@@ -566,7 +566,13 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
else
{
//SI REGISTRA SALIDA DE ALMACÉN EN AUTOMÁTICO Y ES DEVOLUCION QUE REALIZE EL MOVMIENTO DE SALIDA DE ALMACEN
if (UsuarioActual.Empresa.Funcionalidad(567) == "1" && factura.TipoDocto == "Dev" && factura.SaldoAlmacen != 0)
{
factura.RealizarDevolucionAlmacen = true;
}
retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
}
return retorno;

View File

@@ -7529,7 +7529,7 @@ Partial Class Ventas
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
If (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1", "2")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
If (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
@@ -7664,7 +7664,9 @@ Partial Class Ventas
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
If Bloqueo Then
BtnEmitirImprimir.Visible = False
If DdlTipoComprobante.SelectedValue <> "Cot" Then
BtnEmitirImprimir.Visible = False
End If
BtnsFacturar.Visible = False
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
@@ -7952,7 +7954,9 @@ Partial Class Ventas
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
BtnEmitirImprimir.Visible = False
If DdlTipoComprobante.SelectedValue <> "Cot" Then
BtnEmitirImprimir.Visible = False
End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
TieneBloqueoPorCreditoVencimiento = 1
@@ -7977,11 +7981,40 @@ Partial Class Ventas
End If
End If
End If
UPPCreditoDisponible.Update()
'SOLO VERIFICA VENCIMIENTOS
If UsuarioActual.Empresa.Funcionalidad(702).Contiene("2") Then
Dim ValidaCliente As Boolean = False
If (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") AndAlso (Me.CveVenta <= 0 OrElse EsCreaApartirDe)) OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso (Me.CveVenta > 0 AndAlso Not EsCreaApartirDe))) Then
ValidaCliente = True
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (Me.CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()) Then
ValidaCliente = False
End If
'SI ES FACTURA, REMISION o FACTURACION DE COTIZACIONES
If ValidaCliente Then
Dim Vta As New ClsVentas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2)
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
Vta.Dispose()
If Opcion = 2 Then
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
TieneBloqueoPorCreditoVencimiento = 1
End If
End If
End If
'Puede hacer pedido
If CveVenta <= 0 Then
If Not UsuarioActual.TienePermisoProceso(177) And Not EsVentaMedica Then
@@ -9626,7 +9659,7 @@ Partial Class Ventas
Me.CveAutorizacion = -1
'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs") AndAlso RBLPago.SelectedValue = "1" Then
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") AndAlso RBLPago.SelectedValue = "1" Then
Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
@@ -9634,13 +9667,13 @@ Partial Class Ventas
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas
Try
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, DdlTipoDocto.SelectedValue, CveEstatus:=1) Then
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC")
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
@@ -9660,11 +9693,11 @@ Partial Class Ventas
If TipoDocumentoAutorizacion = "Ing" Then
If TipoAutorizacion = 1 Then
If TieneDiasVencidos Then
CveAutorizacion = -1
Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If TieneDiasVencidos Then
' CveAutorizacion = -1
' Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
Dim BloquearCredito As Boolean = True
@@ -9714,79 +9747,23 @@ Partial Class Ventas
End If
End If
If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
CveAutorizacion = -1
Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
' CveAutorizacion = -1
' Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If TipoDocumentoAutorizacion = "Egs" Then
If TipoAutorizacion = 1 Then
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
CveAutorizacion = -1
Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
'If TipoDocumentoAutorizacion = "Egs" Then
' If TipoAutorizacion = 1 Then
' If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
' CveAutorizacion = -1
' Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
' End If
'End If
End If
'SI TIENE LINEA ADICIONAL NO VERIFICAR LIMITE DE CREDITO
'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA
'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
'If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
' 'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
' If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
' Dim ObjVentas As New ClsVentas
' If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then
' If ObjVentas.DtResultados.Rows.Count > 0 Then
' If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
' If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
' ObjVentas.Dispose()
' Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion)
' Exit Sub
' End If
' Else
' If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
' ObjVentas.Dispose()
' Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion)
' Exit Sub
' End If
' End If
' Else
' ObjVentas.Dispose()
' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
' Exit Sub
' End If
' Else
' ObjVentas.Dispose()
' Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
' Exit Sub
' End If
' ObjVentas.Dispose()
' 'VERIFICA SI TIENE BLOQUEO POR DIAS VENCIDOS
' If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
' Dim Vta As New ClsVentas
' Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2)
' Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
' Vta.Dispose()
' If Opcion = 2 Then
' Alert(OpcionMsg, TipoMensaje.MsgError)
' Exit Sub
' End If
' End If
' End If
' 'End If
'End If
'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
@@ -18188,8 +18165,8 @@ Partial Class Ventas
'VALIDA ESTATUS CLIENTE - SOLO SE PUEDE USAR EL CLIENTE PARA COTIZAR EN CASO DE ESTAR INACTIVO
If EsCreaApartirDe OrElse ModalidadEdicion OrElse CveVenta <= 0 Then
If DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") Or TipoContrato >= 0 Then 'SI VIENE DE PEDIDO DE AF DESDE CONTRATO NO BLOQUEA CUANDO EL CLIENTE ESTA INACTIVO
BtnEmitirImprimir.Visible = TieneBloqueoPorCreditoVencimiento = 0
TrVistaPrevia.Visible = TieneBloqueoPorCreditoVencimiento = 0
BtnEmitirImprimir.Visible = True
TrVistaPrevia.Visible = True
Else
If LblCliente.Text <> "Cliente" And Not EstatusCliente Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)