This commit is contained in:
2024-04-02 08:31:02 -07:00
12 changed files with 767 additions and 215 deletions

View File

@@ -154,6 +154,21 @@
</div>
</div>
<div class="row">
<div class="col-md-4 ">
<label class="control-label">Grupo:</label>
</div>
<div class="col-md-6">
<div class="form-group">
<asp:DropDownList ID="DdlGrupo" runat="server" DataValueField="CveGrupo" DataTextField="Grupo" CssClass="form-control input-small select2me">
</asp:DropDownList>
</div>
</div>
<div class="col-md-1">
<asp:Button ID="BtnAgregarGrupo" runat="server" CssClass="btn btn-primary btn-sm" Text="+" Visible="True" />
</div>
<div class="row">
<div class="col-md-4 ">
<label class="control-label">Marca:</label>
@@ -179,20 +194,7 @@
</div>
</div>
<div class="row">
<div class="col-md-4 ">
<label class="control-label">Grupo:</label>
</div>
<div class="col-md-6">
<div class="form-group">
<asp:DropDownList ID="DdlGrupo" runat="server" DataValueField="CveGrupo" DataTextField="Grupo" CssClass="form-control input-small select2me">
</asp:DropDownList>
</div>
</div>
<div class="col-md-1">
<asp:Button ID="BtnAgregarGrupo" runat="server" CssClass="btn btn-primary btn-sm" Text="+" Visible="True" />
</div>
</div>

View File

@@ -209,7 +209,8 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Descripción">
<ItemTemplate>
<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Descripcion")%>'></asp:Literal>
<%--<asp:Literal ID="LtlDescripcion" runat="server" Text='<%# Eval("Descripcion")%>'></asp:Literal>--%>
<asp:HyperLink ID="HplDescripcion" runat="server" Text='<%# Eval("Descripcion") %>' NavigateUrl='<%# Eval("CveActivoFijo", "/AF/AF.aspx?CveActivoFijo={0}")%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tipo Act. Fijo">

View File

@@ -3,10 +3,11 @@ Option Strict On
Imports System.Data
Imports System.Linq
Imports CFDi
Imports Extensiones
Partial Class AF_CatModelos
Inherits ClsPaginas
Inherits ClsPaginas
#Region " PROPIEDADES"
@@ -71,7 +72,13 @@ Partial Class AF_CatModelos
CargaDatos()
ObjAF.Dispose()
UpDatos.Update()
RegarGlobalDT()
End Sub
Private Sub RegarGlobalDT()
GlobalDTModeloActivoFijo(UsuarioActual.CveEmpresa, -1) = Nothing
End Sub
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
HdnModalidad.Value = "U"
@@ -101,6 +108,7 @@ Partial Class AF_CatModelos
End If
ObjAF.Dispose()
UpDatos.Update()
RegarGlobalDT()
End Sub
Private Sub GvModelo_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvModelos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then

View File

@@ -1630,7 +1630,7 @@ Public Class ClsCompras
#Region "N O T A S - C R E D I T O"
Public Function GetNotasCreditoRep(CveProveedor As Integer, Opcion As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer) As Boolean
Public Function GetNotasCreditoRep(CveProveedor As Integer, Opcion As Integer, FechaI As String, FechaF As String, CveEmpresa As Integer, Optional TipoReporte As Integer = 1) As Boolean
Dim Retorno As Boolean = False
@@ -1642,6 +1642,8 @@ Public Class ClsCompras
.Add("@FechaI", SqlDbType.VarChar).Value = FechaI
.Add("@FechaF", SqlDbType.VarChar).Value = FechaF
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@TipoReporte", SqlDbType.Int).Value = TipoReporte
End With
Try
@@ -1656,6 +1658,9 @@ Public Class ClsCompras
#End Region
#Region "F A C T U R A S "
Public Function GetFacturas(CveFactura As Integer, Folio As String, FechaFacturaI As Date, FechaFacturaF As Date, RFC As String, Proveedor As String, FueValidado As Integer, CveResponsable As Integer, CveProveedorClasificacion As Integer, CveTipoProveedor As Integer, TipoComprobante As String, CveEmpresa As Integer, Optional Opcion As Integer = 1) As Boolean

View File

@@ -499,6 +499,7 @@
<asp:ListItem Text="Apoyo Logístico" Value="9"></asp:ListItem>
<asp:ListItem Text="NC Por Devolución" Value="11"></asp:ListItem>
<%--<asp:ListItem Text="Garantía" Value="12"></asp:ListItem>--%>
<%--<asp:ListItem Text="Remision Nota De Crédito" Value="13"></asp:ListItem> Ocuado se carga con funcionalidad 574 --%>
</asp:DropDownList>
</div>
@@ -534,6 +535,19 @@
<asp:Button ID="BtnRecolecciónAplicar" runat="server" Text="Aplicar" CssClass="default" />
</div>
</div>
<div class="form-group proveedoreespes" runat="server" id="DvDdlRemisionNotaCredito" visible="false" >
<span class="whitoutcol proveedoreespes">Remisión Nota de Crédito</span>
<div class="whitoutcol whitoutcol">
<asp:DropDownList ID="DdlRemisionNotaCredito" runat="server" DataTextField="SerieFolio" DataValueField="CveCompra" CssClass="form-control input-sm input-small select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlRemisionNotaCredito_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<%--<asp:Button ID="Button3" runat="server" Text="Resta" CssClass="default" OnClick="BtnFolioGarantiaRestantes_Click" />--%>
</div>
</div>
</div>
</div>
</ContentTemplate>
@@ -5512,6 +5526,43 @@
</div>
<div id="DVModalConfirmaVinculacionProntoPago" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="width: 500px; margin-left: 50px;">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Confirmar Vinculación</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpModalConfirmaVinculacionProntoPago" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:Label runat="server" ID="LblModalConfirmaVinculacionProntoPago" ></asp:Label>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnModalConfirmaVinculacionProntoPago" OnClick="BtnModalConfirmaVinculacionProntoPago_Click" runat="server" Text="Vincular" CssClass="btn btn-primary" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>

View File

@@ -1118,6 +1118,8 @@ Partial Class Compras_Compras
End Set
End Property
#Region "PROPIEDADES PRONTO PAGO"
''' <summary>
''' Descuento por pronto pago proveedor
''' </summary>
@@ -1192,6 +1194,38 @@ Partial Class Compras_Compras
End Set
End Property
Private Property ImporteRNCSaldar As Decimal
Get
If ViewState("ImporteRNCSaldar") Is Nothing Then
ViewState("ImporteRNCSaldar") = 0D
End If
Return ViewState("ImporteRNCSaldar").ToString.ToDecimal
End Get
Set(value As Decimal)
ViewState("ImporteRNCSaldar") = value
End Set
End Property
Private Property DTRemisionesNotaDeCredito As DataTable
Get
If ViewState("DTRemisionesNotaDeCredito") Is Nothing Then
ViewState("DTRemisionesNotaDeCredito") = New DataTable
End If
Return DirectCast(ViewState("DTRemisionesNotaDeCredito"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTRemisionesNotaDeCredito") = value
End Set
End Property
#End Region
@@ -1596,6 +1630,9 @@ Partial Class Compras_Compras
DdlTipoComprobante.SelectedValueExist("DEV")
End If
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then
DdlTipoCompra.Items.Add(New ListItem("Remision Nota De Crédito", "13"))
End If
End If
@@ -6907,6 +6944,37 @@ Partial Class Compras_Compras
End If
Next
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 AndAlso DdlRemisionNotaCredito.SelectedValue.ToEntero > 0 AndAlso ImporteRNCSaldar > 0 Then
'Dim importeMovimientoNC As Decimal = Gvr.FCTextBox("TxtImporte").Text.ToDecimal
Dim Pago As New CompraPago
Pago.ImportePago = ImporteRNCSaldar
Pago.CveMonedaPago = CompraActual.CveMoneda
Pago.CveCompraAmortizacion = CompraActual.CveCompra
Pago.Referencia = CompraActual.SerieFolio
Pago.TCPago = CompraActual.TC
Pago.AplicaAcreditable = False
Pago.TipoPago = "NC"
Pago.Fecha = CompraActual.Fecha 'toma la misma fecha de la provisión en el pago de NC
Dim CompraPago As New Compra
''datos de la compra tipodocto:Fac, para sobreescribirlos
'CompraPago.CveCompra = DdlRemisionNotaCredito.SelectedValue.ToEntero
'CompraPago.CveProveedor = DdlProveedor.SelectedValue.ToEntero
'CompraPago.SerieFolio = Gvr.DataKey("SerieFolio")
'CompraPago.TC = Gvr.DataKey("TipoCambio").ToDecimal
'CompraPago.Fecha = Gvr.DataKey("Fecha").ToDate
'CompraPago.CveMoneda = Gvr.DataKey("CveMoneda").ToEntero
'CompraPago.Total = Gvr.DataKey("Total").ToDecimal
'CompraPago.CveTipoConceptoProveedor = CveTipoConcepto
CompraPago.CveSubProyecto = CompraActual.CveSubProyecto
ErrorPrepoliza = AplicaPrePolizaPagoCompra(CompraPago, Pago, CvePrePoliza, ObjConta)
End If
If ErrorPrepoliza Then
ErrorMovtosCxP = True
Exit Select
@@ -7475,7 +7543,7 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 AndAlso (ImporteRNC > 0 Or ImporteRNCProntoPago > 0) Then
If Not GeneraRemisionsNotadeCredito(ObjCompras.IniciaTransacSQL) Then
If Not GeneraRemisionsNotadeCredito(ObjCompras.IniciaTransacSQL, CveCompra) Then
TieneError = True
End If
End If
@@ -14354,7 +14422,7 @@ Partial Class Compras_Compras
End Sub
Protected Sub BtnVincularOC_Click(sender As Object, e As EventArgs)
VincularOcProntoPago = False
AjusteProntoPagoPorcentajeIVA = 0D
AjusteProntoPagoConIVA = 0D
AjusteProntoPagoSinIVA = 0D
@@ -14435,10 +14503,14 @@ Partial Class Compras_Compras
Next
AjusteProntoPagoPorcentajeIVA = TmpDT.MAX("IVAPorcentaje").ToDecimal
AjusteProntoPagoConIVA = (ImporteCompraConIVA - ImporteOCConIVA) '+ ((ImporteCompraConIVA) * PorcentajeProntoPago)
AjusteProntoPagoSinIVA = (ImporteCompraSinIVA - ImporteOCSinIVA) '+ ((ImporteCompraSinIVA) * PorcentajeProntoPago)
AjusteProntoPagoConIVA = (ImporteCompraConIVA - ImporteOCConIVA)
AjusteProntoPagoSinIVA = (ImporteCompraSinIVA - ImporteOCSinIVA)
If ConfirmaVinculacionOCProntoPago() Then
Vinculacion()
End If
Vinculacion()
Else
LbSubTotalDif.Visible = True
@@ -14453,6 +14525,7 @@ Partial Class Compras_Compras
UpEstatus.Update()
End Sub
Protected Sub BtnVincularOCCompleta_Click(sender As Object, e As EventArgs)
VincularOcProntoPago = False
Vinculacion(True)
End Sub
Private Sub Vinculacion(Optional VinculacionCompleta As Boolean = False)
@@ -15356,6 +15429,9 @@ Partial Class Compras_Compras
Protected Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs)
CargarFacturas()
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then
CargaDdlRemisionNotaCredito()
End If
End Sub
Private Sub CargarFacturas()
@@ -19327,6 +19403,7 @@ Partial Class Compras_Compras
dr("CveMetodoInventario") = 1
Next
CargaGvInv()
End If
ElseIf DdlTipoComprobante.SelectedValue.Contiene("Fac") Then
If DdlTipoCompra.SelectedValue.Contiene("14") Then 'Recolección
@@ -19342,9 +19419,24 @@ Partial Class Compras_Compras
End If
End If
If DdlTipoCompra.SelectedValue = "13" Then 'Remisión de nota de crédito
If DdlTipoComprobante.SelectedValue = "NC" Then
CargaDdlRemisionNotaCredito()
Else
Alert("Para elegir Remisión de Nota de Crédito el tipo de documento debe de ser Nota de Crédito.", TipoMensaje.MsgAdvertencia)
DdlRemisionNotaCredito.SelectedValueExist(-1)
DdlTipoCompra.SelectedValueExist(-1)
End If
End If
End Sub
#End Region
#Region "GARANTÍAS"
@@ -20514,24 +20606,7 @@ Partial Class Compras_Compras
If resultadosFiltrados.Count > 0 Then
Dim EnumAgrupado = (From row In TmpDT.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"),
TipoGasto = row.Field(Of String)("TipoGasto"),
CveTipoGasto = row.Field(Of Integer)("CveTipoGasto")
Into Group
Select New With {
.SubProyecto = SubProyecto,
.CveSubProyecto = CveSubProyecto,
.Clasificacion = Clasificacion,
.CveClasificacion = CveClasificacion,
.CveTipoGasto = CveTipoGasto,
.TipoGasto = TipoGasto,
.TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
}).ToList()
''.TotalSum = Group.Sum(Function(r) r.Field(Of Decimal)("Total"))
If Opcion = 1 Then
@@ -20568,6 +20643,48 @@ Partial Class Compras_Compras
Else
'Dim EnumAgrupado = (From row In TmpDT.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"),
' TipoGasto = row.Field(Of String)("TipoGasto"),
' CveTipoGasto = row.Field(Of Integer)("CveTipoGasto")
' Into Group
' Select New With {
' .SubProyecto = SubProyecto,
' .CveSubProyecto = CveSubProyecto,
' .Clasificacion = Clasificacion,
' .CveClasificacion = CveClasificacion,
' .CveTipoGasto = CveTipoGasto,
' .TipoGasto = TipoGasto,
' .TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
' }).ToList()
Dim EnumAgrupado = (
From row In TmpDT.AsEnumerable()
Group row By
SubProyecto = If(row.IsNull("SubProyecto"), String.Empty, row.Field(Of String)("SubProyecto")),
CveSubProyecto = If(row.IsNull("CveSubProyecto"), -1, row.Field(Of Integer)("CveSubProyecto")),
Clasificacion = If(row.IsNull("Clasificacion"), String.Empty, row.Field(Of String)("Clasificacion")),
CveClasificacion = If(row.IsNull("CveClasificacion"), -1, row.Field(Of Integer)("CveClasificacion")),
TipoGasto = If(row.IsNull("TipoGasto"), String.Empty, row.Field(Of String)("TipoGasto")),
CveTipoGasto = If(row.IsNull("CveTipoGasto"), -1, row.Field(Of Integer)("CveTipoGasto"))
Into Group
Select New With {
.SubProyecto = SubProyecto,
.CveSubProyecto = CveSubProyecto,
.Clasificacion = Clasificacion,
.CveClasificacion = CveClasificacion,
.CveTipoGasto = CveTipoGasto,
.TipoGasto = TipoGasto,
.TotalSum = Group.Sum(Function(r) If(IsDBNull(r("Total")), 0D, Convert.ToDecimal(r("Total"))))
}
).ToList()
For Each item In EnumAgrupado
@@ -20633,7 +20750,7 @@ Partial Class Compras_Compras
#Region "PRONTO PAGO"
Public Function GeneraRemisionsNotadeCredito(ByRef trasaccion As SqlTransaction) As Boolean
Public Function GeneraRemisionsNotadeCredito(ByRef trasaccion As SqlTransaction, CveCompraRegistrada As Integer) As Boolean
Dim respuesta As Boolean = True
Dim CvePS_RNC As Integer = UsuarioActual.Empresa.Funcionalidad(580).ToEntero
@@ -20669,6 +20786,8 @@ Partial Class Compras_Compras
CompraRNC.CveMoneda = DdlMoneda.SelectedValue.ToEntero
CompraRNC.Serie = TxtSerie.Text
CompraRNC.Folio = TxtFolio.Text
CompraRNC.CveCompraAmortizacion = CveCompraRegistrada
@@ -20703,6 +20822,7 @@ Partial Class Compras_Compras
CompraRNCProntoPAgo.CveMoneda = DdlMoneda.SelectedValue.ToEntero
CompraRNCProntoPAgo.Serie = $"{TxtSerie.Text}_P"
CompraRNCProntoPAgo.Folio = $"{TxtFolio.Text}_P"
CompraRNCProntoPAgo.CveCompraAmortizacion = CveCompraRegistrada
CompraRNCProntoPAgo.ConfiguraRegistroRapidoRNC(CvePS_RNC, CveUM, UM, CveClasificacion, Clasificacion, PS, CveSubProyectoPrincipal, SubProyecto, ImporteRNCProntoPago, ImporteRNCProntoPago)
If Not CompraRNCProntoPAgo.AddCompraRNC(trasaccion) Then
@@ -20719,8 +20839,99 @@ Partial Class Compras_Compras
Return respuesta
End Function
Public Property VincularOcProntoPago As Boolean
Get
If ViewState("VincularOcProntoPago") Is Nothing Then
ViewState("VincularOcProntoPago") = False
End If
Return Boolean.Parse(ViewState("VincularOcProntoPago").ToString)
End Get
Set(value As Boolean)
ViewState("VincularOcProntoPago") = value
End Set
End Property
Public Function ConfirmaVinculacionOCProntoPago() As Boolean
If VincularOcProntoPago Then
Return True
Else
If ImporteRNCProntoPago > 0 Then
LblModalConfirmaVinculacionProntoPago.Text = $"Existe una diferencia de ${(ImporteRNC + ImporteRNCProntoPago).ToString("###,###,###.00")} entre la compra y la Orden de Compra, se generararan dos Remisiones de Nota de Crédito una por descuento de ${ImporteRNC.ToString("###,###,###.00")} y otra por pronto pago de ${ImporteRNCProntoPago.ToString("###,###,###.00")}"
Else
LblModalConfirmaVinculacionProntoPago.Text = $"Existe una diferencia de ${(ImporteRNC).ToString("###,###,###.00")} entre la compra y la Orden de Compra, se generara una Remision de Nota de Crédito una por descuento de ${ImporteRNC.ToString("###,###,###.00")}"
End If
RegistraScript("$('#DVModalConfirmaVinculacionProntoPago').modal('show');")
UpModalConfirmaVinculacionProntoPago.Update()
Return False
End If
End Function
Protected Sub BtnModalConfirmaVinculacionProntoPago_Click(sender As Object, e As EventArgs)
RegistraScript("$('#DVModalConfirmaVinculacionProntoPago').modal('hide');")
VincularOcProntoPago = True
BtnVincularOC_Click(Nothing, Nothing)
End Sub
Private Sub CargaDdlRemisionNotaCredito()
DvDdlRemisionNotaCredito.Visible = True
DTRemisionesNotaDeCredito = New DataTable
Dim ObjCompras As New ClsCompras
If ObjCompras.GetNotasCreditoRep(DdlProveedor.SelectedValue.ToEntero, 0, "-1", "-1", UsuarioActual.CveEmpresa, 2) Then
DdlRemisionNotaCredito.DataSource = ObjCompras.DtResultados
DTRemisionesNotaDeCredito = ObjCompras.DtResultados
Else
Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError)
End If
ObjCompras.Dispose()
DdlRemisionNotaCredito.DataBind()
DdlRemisionNotaCredito.Items.Insert(0, New ListItem("-", "-1"))
UpEstatus.Update()
End Sub
Protected Sub DdlRemisionNotaCredito_SelectedIndexChanged(sender As Object, e As EventArgs)
'ImporteRNCSaldar = 0
'If DdlRemisionNotaCredito.SelectedValue.ToEntero > 0 Then
' ImporteRNCSaldar = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal
' SerieFolioProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal
' TipoCambioProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal
' FechaProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal
' CveMonedaProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal
' ProntoPago = DTRemisionesNotaDeCredito.FiltroPrimeroValor("Saldo", $" CveCompra = {DdlRemisionNotaCredito.SelectedValue.ToEntero} ").ToDecimal
'End If
''Alert(ImporteRNCSaldar.ToString)
'CompraPago.SerieFolio = Gvr.DataKey("SerieFolio")
'CompraPago.TC = Gvr.DataKey("TipoCambio").ToDecimal
'CompraPago.Fecha = Gvr.DataKey("Fecha").ToDate
'CompraPago.CveMoneda = Gvr.DataKey("CveMoneda").ToEntero
'CompraPago.Total = Gvr.DataKey("Total").ToDecimal
'CompraPago.CveTipoConceptoProveedor = CveTipoConcepto
End Sub
#End Region
End Class
@@ -22734,14 +22945,14 @@ Public Class ClsCompraManagerCompras
If ES_RNC Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Me.Total, Me.Total, 370, Referencia, Concepto, CveCompra:=CveCompra, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, Me.Total), TipoCambio:=TipoCambio,
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Me.Total, Me.Total, 370, Referencia, Concepto, CveCompra:=CveCompra, CveCompraAmortizacion:=Me.CveCompraAmortizacion, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, Me.Total), TipoCambio:=TipoCambio,
CveClasificacion:=-1, CveSubProyecto:=Me.CveSubProyecto, Contabilizable:=True) Then
respuesta = False
End If
If respuesta Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Me.Total, Me.Total, 372, Referencia, Concepto, CveCompra:=CveCompra, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, Me.Total), TipoCambio:=TipoCambio,
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Me.Total, Me.Total, 372, Referencia, Concepto, CveCompra:=CveCompra, CveCompraAmortizacion:=Me.CveCompraAmortizacion, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, Me.Total), TipoCambio:=TipoCambio,
CveClasificacion:=-1, CveSubProyecto:=Me.CveSubProyecto, Contabilizable:=True) Then
respuesta = False

View File

@@ -104,108 +104,224 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Notas de Crédito" OnRowDataBound="GvDatos_RowDataBound"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None"
DataKeyNames="CveCompra,Saldo,CveIE,CveProveedor,CvePersonal,CveMoneda,CveTipoConcepto,TipoCambio,CveSubProyecto,SerieFolio">
<Columns>
<asp:TemplateField ItemStyle-Width="2%">
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="false" Visible="false" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%-- <asp:LinkButton ID="LbSerieFolio" runat="server" CausesValidation="False" Text="" CommandArgument="SerieFolio" OnClick="LbOrden_Click">--%>
Serie Folio
<%-- <asp:Literal ID="ImgSerieFolio" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%-- </asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HLSerieFolio" runat="server" Text='<%# Eval("SerieFolio")%>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="75" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbFecha" runat="server" CausesValidation="False" Text="" CommandArgument="Fecha" OnClick="LbOrden_Click">--%>
Fecha
<%-- <asp:Literal ID="ImgFecha" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="75" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbRazonSocial" runat="server" CausesValidation="False" Text="" CommandArgument="RazonSocial" OnClick="LbOrden_Click">--%>
Proveedor
<%-- <asp:Literal ID="ImgRazonSocial" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%-- </asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HLRazonSocial" runat="server" Text='<%# Eval("RazonSocial")%>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="350" HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbAbreviatura" runat="server" CausesValidation="False" Text="" CommandArgument="Abreviatura" OnClick="LbOrden_Click">--%>
Moneda
<%--<asp:Literal ID="ImgAbreviatura" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelAbreviatura" runat="server" Text='<%# Eval("Abreviatura")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="45" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbOriginal" runat="server" CausesValidation="False" Text="" CommandArgument="Original" OnClick="LbOrden_Click">--%>
Original
<%--<asp:Literal ID="ImgOriginal" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelOriginal" runat="server" Text='<%# Eval("Original", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%-- <asp:LinkButton ID="LbAbonado" runat="server" CausesValidation="False" Text="" CommandArgument="Abonado" OnClick="LbOrden_Click">--%>
Abonado
<%--<asp:Literal ID="ImgAbonado" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%-- </asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelAbonado" runat="server" Text='<%# Eval("Abonado", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%-- <asp:LinkButton ID="LbSaldo" runat="server" CausesValidation="False" Text="" CommandArgument="Saldo" OnClick="LbOrden_Click">--%>
Saldo
<%--<asp:Literal ID="ImgSaldo" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<ajax:TabContainer ID="Tab" runat="server" ActiveTabIndex="0" Width="100%">
<ajax:TabPanel ID="TabNotasCredito" runat="server" HeaderText="Notas de Crédito" Visible="true">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Notas de Crédito" OnRowDataBound="GvDatos_RowDataBound"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None"
DataKeyNames="CveCompra,Saldo,CveIE,CveProveedor,CvePersonal,CveMoneda,CveTipoConcepto,TipoCambio,CveSubProyecto,SerieFolio">
<Columns>
<asp:TemplateField ItemStyle-Width="2%">
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="false" Visible="false" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%-- <asp:LinkButton ID="LbSerieFolio" runat="server" CausesValidation="False" Text="" CommandArgument="SerieFolio" OnClick="LbOrden_Click">--%>
Serie Folio
<%-- <asp:Literal ID="ImgSerieFolio" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%-- </asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HLSerieFolio" runat="server" Text='<%# Eval("SerieFolio")%>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="75" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbFecha" runat="server" CausesValidation="False" Text="" CommandArgument="Fecha" OnClick="LbOrden_Click">--%>
Fecha
<%-- <asp:Literal ID="ImgFecha" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="75" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbRazonSocial" runat="server" CausesValidation="False" Text="" CommandArgument="RazonSocial" OnClick="LbOrden_Click">--%>
Proveedor
<%-- <asp:Literal ID="ImgRazonSocial" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%-- </asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HLRazonSocial" runat="server" Text='<%# Eval("RazonSocial")%>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="350" HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbAbreviatura" runat="server" CausesValidation="False" Text="" CommandArgument="Abreviatura" OnClick="LbOrden_Click">--%>
Moneda
<%--<asp:Literal ID="ImgAbreviatura" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelAbreviatura" runat="server" Text='<%# Eval("Abreviatura")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="45" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LbOriginal" runat="server" CausesValidation="False" Text="" CommandArgument="Original" OnClick="LbOrden_Click">--%>
Original
<%--<asp:Literal ID="ImgOriginal" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelOriginal" runat="server" Text='<%# Eval("Original", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%-- <asp:LinkButton ID="LbAbonado" runat="server" CausesValidation="False" Text="" CommandArgument="Abonado" OnClick="LbOrden_Click">--%>
Abonado
<%--<asp:Literal ID="ImgAbonado" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%-- </asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelAbonado" runat="server" Text='<%# Eval("Abonado", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<%-- <asp:LinkButton ID="LbSaldo" runat="server" CausesValidation="False" Text="" CommandArgument="Saldo" OnClick="LbOrden_Click">--%>
Saldo
<%--<asp:Literal ID="ImgSaldo" runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>--%>
<%--</asp:LinkButton>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabRemisionesNotasCredito" runat="server" HeaderText="Remisiones Notas de Crédito" Visible="false">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:UpdatePanel ID="UpDatosRemsiones" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:GridView ID="GvRemisiones" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Notas de Crédito" OnRowDataBound="GvRemisiones_RowDataBound"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None"
DataKeyNames="CveCompra,Saldo,CveIE,CveProveedor,CvePersonal,CveMoneda,CveTipoConcepto,TipoCambio,CveSubProyecto,SerieFolio">
<Columns>
<asp:TemplateField ItemStyle-Width="2%">
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="false" Visible="false" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Serie Folio
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HLSerieFolio" runat="server" Text='<%# Eval("SerieFolio")%>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="75" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Fecha
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="75" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Proveedor
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HLRazonSocial" runat="server" Text='<%# Eval("RazonSocial")%>' CssClass="Texto"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="350" HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Moneda
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelAbreviatura" runat="server" Text='<%# Eval("Abreviatura")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="45" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Original
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelOriginal" runat="server" Text='<%# Eval("Original", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Abonado
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelAbonado" runat="server" Text='<%# Eval("Abonado", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Saldo
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LabelSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="80" HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
<div id="DivSaldar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">

View File

@@ -4,6 +4,7 @@ Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports Stimulsoft.Report.Check
Partial Class Compras_RepNotasCredito
Inherits ClsPaginas
@@ -11,15 +12,34 @@ Partial Class Compras_RepNotasCredito
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
DtDatos = CType(ViewState("DtDatos"), DataTable)
If ViewState("DtDatos") Is Nothing Then
ViewState("DtDatos") = New DataTable
End If
Return CType(ViewState("DtDatos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property DtDatosRemisiones As DataTable
Get
If ViewState("DtDatosRemisiones") Is Nothing Then
ViewState("DtDatosRemisiones") = New DataTable
End If
Return CType(ViewState("DtDatosRemisiones"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatosRemisiones") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ConfiguraTabs()
DdlProveedores.setEsWebService(True)
DdlProveedores.Attributes.Add("data-metodo", "getproveedores")
DdlProveedores.SelectedText = "Todos"
@@ -27,10 +47,33 @@ Partial Class Compras_RepNotasCredito
TxtFechaSaldar.Text = NowADS().ToShortDateString
CargaDatos()
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
If Tab.ActiveTabIndex = 0 Then
CargaDatos()
Else
CargaDatosRemisiones()
End If
End Sub
Private Sub ConfiguraTabs()
Tab.ActiveTabIndex = 0
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then
TabRemisionesNotasCredito.Visible = True
End If
End Sub
#Region "NOTAS DE CREDITO"
Private Sub CargaDatos()
DtDatos = New DataTable
Dim ObjCompras As New ClsCompras
Dim FechaI, FechaF As String
@@ -56,12 +99,95 @@ Partial Class Compras_RepNotasCredito
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0)
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal)
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
ViewState("Orden") = Orden
CargaGrid(Orden)
End Sub
Protected Sub CargaGrid(Orden As String)
Dim DV As DataView = Nothing
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
If Orden <> String.Empty Then
GvDatos.DataSource = DV.ToTable()
Else
GvDatos.DataSource = DtDatos
End If
GvDatos.DataBind()
UpDatos.Update()
DV.Dispose()
End Sub
#End Region
#Region "REMISIONES"
Private Sub CargaDatosRemisiones()
DtDatosRemisiones = New DataTable
GvRemisiones.DataSource = Nothing
Dim ObjCompras As New ClsCompras
Dim FechaI, FechaF As String
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa, 2) Then
DtDatosRemisiones = ObjCompras.DtResultados
GvRemisiones.DataSource = DtDatosRemisiones
Else
Alert("Ocurrió un error al obtener las remisiones", Extensiones.TipoMensaje.MsgError)
End If
ObjCompras.Dispose()
GvRemisiones.DataBind()
UpDatosRemsiones.Update()
End Sub
Protected Sub GvRemisiones_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra"))
End If
End Sub
#End Region
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("RepNotasCredito." & NowADS().ToShortDateString)
If Tab.ActiveTabIndex = 0 Then
GvDatos.ExportToExcel("RepNotasCredito." & NowADS().ToShortDateString)
Else
GvRemisiones.ExportToExcel("RepRemisionesNotasCredito." & NowADS().ToShortDateString)
End If
End Sub
@@ -219,44 +345,5 @@ Partial Class Compras_RepNotasCredito
End Sub
#Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = ""
Dim Campo As String = ""
Dim Literal As Literal = Nothing
Const OrdenInicial As String = ""
Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0)
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal)
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
ViewState("Orden") = Orden
CargaGrid(Orden)
End Sub
Protected Sub CargaGrid(Orden As String)
Dim DV As DataView = Nothing
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
If Orden <> String.Empty Then
GvDatos.DataSource = DV.ToTable()
Else
GvDatos.DataSource = DtDatos
End If
GvDatos.DataBind()
UpDatos.Update()
DV.Dispose()
End Sub
#End Region
End Class

View File

@@ -1579,8 +1579,8 @@ Partial Class General_SaldosIniciales
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
Dim Sucursal As String = dtsubp.FiltroPrimeroValor("CveSubProyecto", $"SubProyecto = '{Row("Sucursal").ToString()}'")
RFC = Row("RFC").ToString().Trim
Dim Serie As String = Row("Serie").ToString()
Dim Folio As String = Row("Folio").ToString()
Dim Serie As String = Row("Serie").ToString().Trim
Dim Folio As String = Row("Folio").ToString().Trim
Dim Fecha As Date = Row("Fecha").ToString().ToDate
Dim SubTotal As Decimal = Row("SubTotal").ToString().ToDecimal
Dim IVA As Decimal = Row("IVA").ToString().ToDecimal.RoundSQL

View File

@@ -202,6 +202,7 @@ Partial Class Ventas_FacturacionGlobal
Exit Sub
End If
CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()
If CveCliente <= 0 Then
Alert("No se pudo cargar el cliente", TipoMensaje.MsgError)
Exit Sub

View File

@@ -1005,7 +1005,7 @@
<div class="cbp-item graphic">
<div class="cbp-caption">
<div class="cbp-caption-defaultWrap">
<img runat="server" id="imgImagen" style="max-height:250px !important; max-width:250px !important;">
<img runat="server" id="imgImagen" style="max-height: 250px !important; max-width: 250px !important;">
</div>
</div>
</div>
@@ -1365,15 +1365,24 @@
</div>
</ItemTemplate>
<EditItemTemplate>
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal>
<asp:TextBox ID="TxtPrecio" runat="server" CausesValidation="true" MaxLength="12" Text='<%# Eval("PU", "{0:0.00####}") %>' ValidationGroup="GprGV" Width="78px" Height="24px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<div class="row" id="DivPrecioLista" runat="server" visible="false">
<div class="col-md-12">
<asp:DropDownList ID="DdlPrecioListaEdit" runat="server" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista" OnSelectedIndexChanged="DdlPrecioListaEdit_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal>
<asp:TextBox ID="TxtPrecio" runat="server" CausesValidation="true" MaxLength="12" Text='<%# Eval("PU", "{0:0.00####}") %>' ValidationGroup="GprGV" Width="78px" Height="24px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecioEdit" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprGV"></asp:CustomValidator>
<asp:CustomValidator ID="CVPrecioEdit" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprGV"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecioEdit" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecioEdit" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCEPrecioEdit" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecioEdit" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</EditItemTemplate>
</asp:TemplateField>
<%--10--%>
@@ -7965,15 +7974,15 @@
<div class="col-md-8">
<div class="row">
<asp:Panel ID="PnlRFCCliente" runat="server" DefaultButton="BtnValidarRFC">
<div class="form-group form-md-line-input input-iconright col-xs-9">
<asp:TextBox ID="TxtRFCCliente" Style="text-transform: uppercase;" placeholder="Ingrese el RFC para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="REVRFCCliente" runat="server" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''RFC''</b> es incorrecto, por favor ingréselo." ValidationGroup="GrpGuardarCliente" ControlToValidate="TxtRFCCliente" ValidationExpression="^[a-zñA-ZÑ.)(/\\&-]{3,4}(\d{6})((\D|\d){2})((\D|\d){1})$"></asp:RegularExpressionValidator>
<label for="<%= TxtRFCCliente.ClientID.ToString()%>">RFC:</label>
</div>
<div class="form-group form-md-line-input input-iconright col-xs-3">
<asp:Button ID="BtnValidarRFC" runat="server" CssClass="btn btn-success" Text="Validar" />
</div>
</asp:Panel>
<div class="form-group form-md-line-input input-iconright col-xs-9">
<asp:TextBox ID="TxtRFCCliente" Style="text-transform: uppercase;" placeholder="Ingrese el RFC para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="REVRFCCliente" runat="server" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''RFC''</b> es incorrecto, por favor ingréselo." ValidationGroup="GrpGuardarCliente" ControlToValidate="TxtRFCCliente" ValidationExpression="^[a-zñA-ZÑ.)(/\\&-]{3,4}(\d{6})((\D|\d){2})((\D|\d){1})$"></asp:RegularExpressionValidator>
<label for="<%= TxtRFCCliente.ClientID.ToString()%>">RFC:</label>
</div>
<div class="form-group form-md-line-input input-iconright col-xs-3">
<asp:Button ID="BtnValidarRFC" runat="server" CssClass="btn btn-success" Text="Validar" />
</div>
</asp:Panel>
</div>
</div>
<div class="col-md-4">

View File

@@ -3697,12 +3697,8 @@ Partial Class Ventas
Private Sub CargaListasPrecios()
DivPrecioLista.Visible = True
Using ObjVta As New ClsVentas
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
DdlPrecioLista.DataSource = ObjVta.DtResultados
DdlPrecioLista.SelectedValue = ObjVta.DtResultados.FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'")
End If
End Using
DdlPrecioLista.DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa)
DdlPrecioLista.SelectedValue = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'")
DdlPrecioLista.DataBind()
'DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -8343,6 +8339,14 @@ Partial Class Ventas
End If
End If
If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = True
e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind()
e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista"))
End If
'Si es facturacion de OC o Contrato
If CveContrato > 0 AndAlso Not CveVenta > 0 AndAlso Not CveCicloComercial > 0 Then
e.Row.FCLinkButton("imgClone").Visible = False
@@ -8827,13 +8831,21 @@ Partial Class Ventas
TmpDT.Rows.Remove(TmpDT.Rows(e.RowIndex))
CalculaUsados()
Dim CvePrecioLista As Integer = -1
Dim PrecioLista As String = ""
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
End If
AgregarProductoServicio(Cantidad, DdlUM.SelectedValue.ToEntero(), DdlUM.SelectedItem.Text, DdlCla.SelectedValue.ToEntero(), DdlCla.SelectedItem.Text,
GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedText,
GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim, PU, ObjDescuento.ImporteDescuento,
GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text,
GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedItem.Text,
CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle,
ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos)
ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista)
' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue
' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text
@@ -8918,6 +8930,16 @@ Partial Class Ventas
TmpDT.Rows(e.RowIndex)("Proyecto") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text
End If
Dim CvePrecioLista As Integer = -1
Dim PrecioLista As String = ""
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
TmpDT.Rows(e.RowIndex)("CvePrecioLista") = CvePrecioLista
TmpDT.Rows(e.RowIndex)("PrecioLista") = PrecioLista
End If
If GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").Items.Count = 0 Then
TmpDT.Rows(e.RowIndex)("SubProyecto") = "Sin SubProyecto Asignado"
@@ -17639,10 +17661,18 @@ Partial Class Ventas
End If
'SI ESTA AGREGANDO TOMAR DEL SELECCIONADO
If DivPrecioLista.Visible AndAlso CvePrecioListaSugerido > 0 Then
CvePrecioListaPS = CvePrecioListaSugerido
End If
'SI ES EDICION DE PS
If CvePrecioListaSugerido > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1") Then
If GvPS.EditIndex >= 0 Then
CvePrecioListaPS = CvePrecioListaSugerido
End If
End If
Dim CvePrecioListaPredeterminada = -1
Dim AplicaPredeterminado As Boolean = False
@@ -17721,13 +17751,44 @@ Partial Class Ventas
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
Dim CvePSParametro = ddlPSEdit.SelectedValue.ToEntero()
Dim DdlPrecioListaEdit = GvRow.FCDropDownList("DdlPrecioListaEdit")
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
If DrPS IsNot Nothing Then
'SUGIERE PRECIO
Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = DrPS("Precio").ToString().ToDecimal
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero())
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioListaEdit.SelectedValue.ToEntero())
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
GvRow.FCTextBox("TxtPrecio").Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
End If
End If
End If
End If
End Sub
Protected Sub DdlPrecioListaEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
If GvPS.EditIndex >= 0 Then
Dim DdlPrecioListaEdit = DirectCast(sender, DropDownList)
Dim GvRow = DirectCast(DdlPrecioListaEdit.NamingContainer, GridViewRow)
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
Dim CvePSParametro = GvRow.FCDropDownLost("DdlPS").SelectedValue.ToEntero()
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
If DrPS IsNot Nothing Then
'SUGIERE PRECIO
Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = DrPS("Precio").ToString().ToDecimal
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioListaEdit.SelectedValue.ToEntero())
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido