This commit is contained in:
2021-06-24 05:59:24 -07:00
19 changed files with 779 additions and 86 deletions

View File

@@ -559,7 +559,7 @@ Partial Class Ventas_ActualizarPrecios
For Each Franquicia In Franquicias
Dim CveFranquicia As Integer = Franquicia.ToEntero
Dim CvePS As Integer = GlobalDTPS(CveFranquicia, Codigo:=Codigo.ToUpper).FiltroPrimeroValor("CvePS", "").ToEntero
Dim CvePS As Integer = GlobalDTPSSimplificado(CveFranquicia, Codigo:=Codigo).FiltroPrimeroValor("CvePS", "").ToEntero
Dim CvePrecioLisa As Integer = GlobalDTPrecioListas(CveFranquicia).FiltroPrimeroValor("CvePrecioLista", String.Format("PrecioLista = '{0}'", PrecioLista)).ToEntero
If CvePS <= 0 Then

View File

@@ -0,0 +1,156 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatAutorizacionLimites.aspx.vb" Inherits="Ventas_CatAutorizacionLimites" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.labelddl {
top: 0;
margin-bottom: 0;
font-size: 13px;
color: #888888;
opacity: 1;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Catálogo de autorizaciones de límite de crédito
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkAgregar" OnClick="LnkAgregar_Click" runat="server"><i class="fa fa-plus"></i>Agregar autorización</asp:LinkButton></li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT smalltitle " style="">
<div class="tools">
<asp:Button ID="BtnConsultar" OnClick="BtnConsultar_Click" runat="server" Text="Consultar" class="btn btn-primary" />
</div>
<div class="titlefiltros caption" style="margin-top: -8px;">
<ul class="list-inline" style="font-size: 12px;">
<li>Estatus:
<asp:DropDownList AppendDataBoundItems="true" ID="DdlEstatus" runat="server" Width="200px" DataTextField="Nombre" DataValueField="CveDispositivosGrupos" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Value="-1" Text="Todos"></asp:ListItem>
<asp:ListItem Value="0" Text="Solicitada"></asp:ListItem>
<asp:ListItem Value="1" Text="Autorizada"></asp:ListItem>
<asp:ListItem Value="2" Text="Aplicada"></asp:ListItem>
<asp:ListItem Value="3" Text="Rechazada"></asp:ListItem>
</asp:DropDownList>
</li>
</ul>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAutorizacion,CveCliente,CveVendedor,Importe"
EmptyDataText="No se encontraron autorizaciones" ToolTip="Listado de autorizaciones"
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="NombreComercial" Target="_blank" HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" />
<asp:BoundField DataField="Vendedor" HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="15%" />
<asp:BoundField DataField="Importe" ItemStyle-Width="15%" HeaderText="Importe" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="LimiteCredito" ItemStyle-Width="15%" HeaderText="Limite Credito" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="Saldo" ItemStyle-Width="15%" HeaderText="Saldo" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="FechaIng" ItemStyle-Width="10%" HeaderText="Fecha de Ingreso" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField DataField="TipoAutorizacionTexto" HeaderText="Tipo" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" />
<asp:BoundField DataField="TipoDocumento" HeaderText="Tipo Documento" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" />
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="LblEstatus" Text='<%# Eval("Estatus") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" HeaderText="Autorizar/Rechazar">
<ItemTemplate>
<asp:LinkButton data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea autorizar el limite?" data-btn-ok-label="si" ID="LnkAutorizar" OnClick="LnkAutorizar_Click" CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-check'></i>"></asp:LinkButton>
<asp:LinkButton data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea rechazar el limite?" data-btn-ok-label="si" ID="LnkRechazar" OnClick="LnkRechazar_Click" CssClass="btn btn-circle btn-sm red" runat="server" Text="<i class='fa fa-times'></i>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" HeaderText="Eliminar">
<ItemTemplate>
<asp:LinkButton ID="LnkEliminar" OnClick="LnkEliminar_Click" runat="server" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el limite?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DModal" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModal" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">
<asp:Literal ID="ltlMotititulo" Text="Medida" runat="server"> </asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<label class="labelddl">Cliente:</label>
</div>
</div>
<div class="row">
<div class="col-md-12">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlCliente" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlVendedor" CssClass="form-control marginFixRow select2me" runat="server" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="100%">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVVendedor" runat="server" ControlToValidate="DdlVendedor" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Vendedor''</b> es necesario, por favor seleccione uno." ValidationGroup="VgmGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEClasificacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVVendedor" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= DdlVendedor.ClientID.ToString()%>">Vendedor:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoDocto_SelectedIndexChanged">
<asp:ListItem Value="Ing" Selected="True" Text="Factura de Ingreso"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Nota de crédito"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
</div>
<div id="DivAutorizacion" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoAutorizacion" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoAutorizacion_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="-1" Text="Seleccione"></asp:ListItem>
<asp:ListItem Value="1" Text="Importe"></asp:ListItem>
<asp:ListItem Value="2" Text="Vencimiento"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label>
</div>
<div id="DivImporte" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecio" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="200px" CssClass="form-control "></asp:TextBox>
<%--<ajax:MaskedEditExtender ID="MEEPrecio" runat="server" TargetControlID="TxtPrecio" ClearMaskOnLostFocus="false" MaskType="Number" Mask="9,999.99" InputDirection="RightToLeft" DisplayMoney="Left"></ajax:MaskedEditExtender>--%>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" 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="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" 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="GrpAddVenta"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtPrecio.ClientID.ToString()%>">Importe:</label>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="BtnGuardar_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardar" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,215 @@

Imports Extensiones
Partial Class Ventas_CatAutorizacionLimites
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property CveAutorizacion() As Integer
Get
Return If(IsNothing(ViewState("CveAutorizacion")), -1, CInt(ViewState("CveAutorizacion")))
End Get
Set
ViewState("CveAutorizacion") = Value
End Set
End Property
Private Property Modalidad() As String
Get
Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString))
End Get
Set
ViewState("Modalidad") = Value
End Set
End Property
#End Region
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaCombos()
CargaDatos()
End If
End Sub
#Region "CARGAS"
Private Sub CargaCombos()
Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
If EsWS Then
DdlCliente.setEsWebService(True)
Else
DdlCliente.setEsWebService(False)
DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlCliente.DataBind()
DdlCliente.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedor.DataBind()
UpModal.Update()
End Sub
Private Sub CargaDatos()
Dim ObjGral As New ClsVentas
If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, -1, -1, CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then
GvDatos.DataSource = ObjGral.DtResultados
End If
ObjGral.Dispose()
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
#End Region
#Region "BOTONES"
Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero()
Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero()
Dim ObjGral As New ClsVentas
If ObjGral.RemoveAutorizacionLimite(CveAutorizacion, CveCliente) Then
Alert("La autorización se elimino correctamente.", TipoMensaje.MsgInformacion)
End If
ObjGral.Dispose()
CargaDatos()
End Sub
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
LimpiaModal()
Modalidad = "A"
BtnGuardar.Text = "Agregar"
ltlMotititulo.Text = "Agregar autorización"
UpModal.Update()
RegistraScript("$('#DModal').modal()")
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
If DdlTipoDocto.SelectedValue = "Ing" AndAlso DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim CveEstatus As Integer = 1
Dim TipoDocto As String = DdlTipoDocto.SelectedValue
Dim CveTipoAutorizacion As Integer = -1
Select Case TipoDocto
Case "Ing"
CveTipoAutorizacion = DdlTipoAutorizacion.SelectedValue.ToEntero()
Case "Egs"
CveTipoAutorizacion = -1
End Select
Dim ObjPS As New ClsVentas
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, DdlCliente.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero(), TxtPrecio.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveAutorizacion, TipoDocto) Then
RegistraScript("$('#DModal').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjPS.Dispose()
CargaDatos()
End Sub
#End Region
#Region "LIMPIAR"
Protected Sub LimpiaModal()
Me.CveAutorizacion = -1
TxtPrecio.Text = ""
DdlCliente.SelectedValue = "-1"
DdlVendedor.SelectedValueExist("-1")
End Sub
#End Region
#Region "GRIDVIEW"
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CveEstatus") = "0" Then
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-secondary"
e.Row.FCLinkButton("LnkAutorizar").Visible = True
e.Row.FCLinkButton("LnkRechazar").Visible = True
ElseIf e.Row.DBCampo("CveEstatus") = "1" Then
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-success"
e.Row.FCLinkButton("LnkAutorizar").Visible = False
e.Row.FCLinkButton("LnkRechazar").Visible = True
ElseIf e.Row.DBCampo("CveEstatus") = "2" Then
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-primary"
e.Row.FCLinkButton("LnkAutorizar").Visible = False
e.Row.FCLinkButton("LnkRechazar").Visible = False
ElseIf e.Row.DBCampo("CveEstatus") = "3" Then
e.Row.FCLabel("LblEstatus").CssClass = "badge badge-danger"
e.Row.FCLinkButton("LnkAutorizar").Visible = False
e.Row.FCLinkButton("LnkRechazar").Visible = False
End If
'If e.Row.DBCampo("Estatus") = "True" Then
' e.Row.Cells(1).ForeColor = Drawing.Color.Green
' e.Row.Cells(1).Font.Bold = True
' e.Row.Cells(1).Text = "Activo"
'Else
' e.Row.Cells(1).Text = "Inactivo"
' e.Row.Cells(1).ForeColor = Drawing.Color.Red
' e.Row.Cells(1).Font.Bold = True
'End If
End If
End Sub
#End Region
Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero()
Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero()
Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero()
Dim Importe = gvRow.DataKey("Importe").ToEntero()
Dim CveEstatusAutorizacion As Integer = 1
Dim ObjVentas As New ClsVentas
If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then
Alert("El límite de crédito fue autorizado.")
End If
ObjVentas.Dispose()
CargaDatos()
End Sub
Protected Sub LnkRechazar_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero()
Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero()
Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero()
Dim Importe = gvRow.DataKey("Importe").ToEntero()
Dim CveEstatusAutorizacion As Integer = 3
Dim ObjVentas As New ClsVentas
If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then
Alert("El límite de crédito fue rechazado.")
End If
ObjVentas.Dispose()
CargaDatos()
End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs)
DivImporte.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
UpModal.Update()
End Sub
Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim CveCliente As Integer = DdlCliente.SelectedValue.ToEntero()
If CveCliente > 0 Then
Using ObjClientes As New ClsClientes
If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then
DdlVendedor.SelectedValueExist(ObjClientes.DtResultados.Rows(0)("CveVendedor"))
End If
End Using
End If
UpModal.Update()

View File

@@ -855,7 +855,7 @@ Partial Class Ventas_ClientesAbonar
Dim tipoCambioVentaDiferenciaCambiaria As Double = 1
Dim EsAnticipoEspecial As Boolean = False
If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then EsAnticipoEspecial = True
If dtConceptos IsNot Nothing Then
For Each Row As DataRow In dtConceptos.Rows
@@ -900,9 +900,9 @@ Partial Class Ventas_ClientesAbonar
Else
ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}"
IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria)
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then
If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
importeMX = ImporteMovimiento
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa = 119, 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
@@ -2631,11 +2631,11 @@ Partial Class Ventas_ClientesAbonar
End If
Dim UsaComplementaria As Boolean = False
Dim UsaComplementaria As Boolean = True
If UsuarioActual.CveEmpresa = 119 Then
UsaComplementaria = True
End If
'If UsuarioActual.CveEmpresa = 119 Then
' UsaComplementaria = True
'End If
If MsgError = "" Then

View File

@@ -4993,13 +4993,13 @@ Partial Class PV
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
Dim ListaPSCargo = CalculaUsados(Consec)
If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(CvePS, ListaPSCargo)
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad)
End If
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
EliminarUsados()
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(CvePS, ListaPSCargo)
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad)
End If
End If
@@ -7091,7 +7091,7 @@ Partial Class PV
EmitirImprimirNew()
End Sub
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer))
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal)
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -7139,14 +7139,14 @@ Partial Class PV
Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then
TotalCargos += 1D * DrTamanio("Cargo").ToString().ToDecimal
TotalCantidad += 1D
TotalCargos += CantidadUsado * DrTamanio("Cargo").ToString().ToDecimal
TotalCantidad += CantidadUsado
StrTamanios.AppendFormat("{0},", DrTamanio("CodigoPS"))
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
Row("CvePS") = DrTamanio("CvePSCargo").ToString().ToEntero
Row("CvePSRelacionado") = CvePS
Row("Cantidad") = 1D
Row("Cantidad") = CantidadUsado
Row("CveUM") = DrTamanio("CveUM").ToString().ToEntero
Row("CveVentaDetalle") = -1
Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
@@ -7176,11 +7176,14 @@ Partial Class PV
' Exit Sub
'End If
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows
Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})")
Dim DivisorUsado = DtUsadosFiltro.Rows.Count.ToString().ToDecimal()
For Each Dr As DataRow In DtUsadosFiltro.Rows
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
'Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
Dim DescuentoCargo As Decimal = (TotalCargos / DivisorUsado)
If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then
DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal())
@@ -7218,20 +7221,23 @@ Partial Class PV
Next
TmpDT.AcceptChanges()
If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows
Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}")
Dim Divisor = DtPSFiltro.Rows.Count.ToString().ToDecimal()
Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
For Each Dr As DataRow In DtPSFiltro.Rows
If DescuentoCargo > (PUAnterior - Dr("Descuento").ToString.ToDecimal()) Then
DescuentoCargo = (PUAnterior - Dr("Descuento").ToString.ToDecimal())
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
Dim DescuentoCargo As Decimal = (TotalCargos / Divisor)
If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then
DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal())
End If
'Dim PUActual As Decimal = PUAnterior - DescuentoCargo
Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal + DescuentoCargo
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (PUAnterior)) - Descuento
TotalCargos += -DescuentoCargo
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal) - Descuento
TotalCargos -= DescuentoCargo
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
Dim drr As DataRow = drt(0)

View File

@@ -2944,7 +2944,10 @@ Partial Class ProductosyServicios
Return True
End If
End If
GlobalDTPSSimplificado(CveEmpresaFranquicia) = Nothing
Next
Return False
End Function

View File

@@ -775,9 +775,9 @@ Partial Class Ventas_RepPS
'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Value = Row("PolizasCantidadAcumulada")
worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Name})"
worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("VentaAnterior")
worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("VentaDia")
'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("VentaAcumulada")
worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("ManoObraCantidadAnterior")
worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("ManoObraCantidadDia")
'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("ManoObraCantidadAcumulada")
worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Name})"
Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas, 0, IdxSucursalesServiciosAmortPolizas, 12).Style

View File

@@ -367,6 +367,9 @@
<li>
<asp:HyperLink ID="HlFacturasRelaciondas" Visible="false" NavigateUrl="#" data-toggle="modal" data-backdrop="static" data-keyboard="false" data-target="#DivFacturasRelaciondas" runat="server"><i class='fa fa-file'></i> Relacionar Facturas</asp:HyperLink>
</li>
<li>
<asp:LinkButton ID="LnkSolicitarCredito" Visible="false" runat="server"><i class="fa fa-plus"></i>Solicitar autorización de crédito</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
@@ -3657,7 +3660,7 @@
</div>
<div class="col-md-4" align="right">
<div class="row">
<div class="row">
<div class="col-md-12" align="right" style="padding-bottom: 15px;">
<asp:UpdatePanel ID="UpFacturar" runat="server" class="portlet light xspadding bordered " style="width: 300px;" align="right" UpdateMode="Conditional">
<Triggers>
@@ -3765,23 +3768,23 @@
<tr runat="server" id="Tr3">
<td align="center" style="" runat="server" id="tdAdjuntar">
<asp:LinkButton ID="BtnAdjuntar" runat="server" Text="Adjuntar" data-toggle="modal" data-target="#ModalAdjuntar" CssClass="btn myventasbutton btn-primary" />
<asp:LinkButton ID="BtnAdjuntar" runat="server" Text="Adjuntar" data-toggle="modal" data-target="#ModalAdjuntar" CssClass="btn myventasbutton btn-primary" />
</td>
<td align="left" style="display: none;" runat="server" id="tdAdjunto">
<div class="col-md-6">
<asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Text="" Font-Size="14px" />
</div>
<div class="col-md-6" style="text-align: right;">
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" Visible="false"/>
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" Visible="false" />
</div>
</td>
</tr>
</table>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnArchivoAdjunto" />
</Triggers>
<Triggers>
<asp:PostBackTrigger ControlID="BtnArchivoAdjunto" />
</Triggers>
</asp:UpdatePanel>
</div>
@@ -6239,7 +6242,7 @@
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Facturas Relacionadas</h4>
</div>
<div class="modal-body" style="width:900px;">
<div class="modal-body" style="width: 900px;">
<div class="row">
<div class="col-md-2">
<label>Relación:</label>
@@ -6267,7 +6270,7 @@
<label>Folio Fiscal:</label>
</div>
<div class="col-md-8">
<asp:TextBox ID="TxtFolioFiscalRelacionar" runat="server" Text="" Width="100%" CssClass="form-control input-sm"></asp:TextBox>
<asp:TextBox ID="TxtFolioFiscalRelacionar" runat="server" Text="" Width="100%" CssClass="form-control input-sm"></asp:TextBox>
</div>
<div class="col-md-2">
<asp:LinkButton ID="LnkAgregarFolioFiscalRelacionada" runat="server" CssClass="btn btn-sm btn-primary" OnClick="LnkAgregarFolioFiscalRelacionada_Click"><i class="fa fa-plus"></i>Agregar Folio</asp:LinkButton>
@@ -6312,8 +6315,9 @@
<asp:UpdatePanel runat="server" ID="UpdatePanel3" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-2"> Folio Fiscal</div>
<div class="col-md-10"> <asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox></div>
<div class="col-md-2">Folio Fiscal</div>
<div class="col-md-10">
<asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
@@ -7539,6 +7543,47 @@
</div>
</div>
<div id="DivModalSolicitarCredito" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalSolicitud" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">Solicitar crédito</h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
<asp:ListItem Value="Ing" Selected="True" Text="Factura de Ingreso"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Nota de crédito"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
</div>
<div id="DivAutorizacion" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoAutorizacion" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
<asp:ListItem Selected="True" Value="-1" Text="Seleccione"></asp:ListItem>
<asp:ListItem Value="1" Text="Importe"></asp:ListItem>
<asp:ListItem Value="2" Text="Vencimiento"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label>
</div>
<div id="DivImporteSolicitud" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtImporteSolicitud" inputmode="numeric" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="VgmGuardarAut" Width="200px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBImporteSolicitud" runat="server" TargetControlID="TxtImporteSolicitud" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVImporteSolicitud" runat="server" ControlToValidate="TxtImporteSolicitud" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="RFVImporteSolicitud" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVImporteSolcitud" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtImporteSolicitud" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="VgmGuardarAut"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEImporteSolicitud" runat="server" HighlightCssClass="vco" TargetControlID="CVImporteSolcitud" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtImporteSolicitud.ClientID.ToString()%>">Importe:</label>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnSolicitarCredito" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardarAut" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
@@ -7672,12 +7717,20 @@
Importe = ToDouble(Importe.toFixed(2));
if (Importe > 0) {
let pu = (ImporteTotal / CantidadPendiente);
if (pu > 0) {
TxtCantidad.value = (Importe / pu).toString();
}
const cantidadSugerida = (Importe / pu);
if (cantidadSugerida > CantidadPendiente) {
TxtCantidad.value = CantidadPendiente.toString();
}else {
TxtCantidad.value = cantidadSugerida.toString();
}
}else {
TxtCantidad.value = "0";
}
}else {
TxtCantidad.value = "0";
@@ -8616,7 +8669,7 @@
}
//Suma Totales
function FnSuma() {
function FnSuma() {
debugger;
$get('TxtSubTotal2').value = FormatoNumero(ToDouble($get('TxtSubTotal').value) - ToDouble($get('LblDescuentos').innerHTML) - ToDouble($get('LblAmortizacion').innerHTML), 2);
var totalVenta = ToDouble($get('TxtSubTotal2').value) + ToDouble($get('TxtIVA').value) + ToDouble($get('TxtIEPS') ? ToDouble($get('TxtIEPS').value) : 0) - ToDouble($get('TxtRetIVA') ? $get('TxtRetIVA').value : 0) - ToDouble($get('TxtRetISR') ? $get('TxtRetISR').value:0);

View File

@@ -1843,6 +1843,14 @@ Partial Class Ventas
ViewState("EsDiasCreditoFijo") = value
End Set
End Property
Private Property TieneDiasVencidos As Boolean
Get
Return CBool(IfNull(ViewState("TieneDiasVencidos"), "False", ViewState("TieneDiasVencidos")))
End Get
Set(value As Boolean)
ViewState("TieneDiasVencidos") = value
End Set
End Property
Private Property VentaSaldoAlmacen As Decimal
Get
Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal
@@ -1948,6 +1956,15 @@ Partial Class Ventas
End Set
End Property
Private Property CveAutorizacion As Integer
Get
Return (IfNull(ViewState("CveAutorizacion"), "-1", ViewState("CveAutorizacion"))).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveAutorizacion") = value
End Set
End Property
#End Region
'#Region "AuxiliarConta"
@@ -2143,6 +2160,10 @@ Partial Class Ventas
DivPenalizacion.Visible = True
End If
If UsuarioActual.CveRol = 1 Then
LnkSolicitarCredito.Visible = True
End If
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True
@@ -4241,6 +4262,11 @@ Partial Class Ventas
LblNCSaldoAnticipo.Visible = True
ChkAplicaNCAnticipo.Visible = True
ChkAplicaNCAnticipo.Checked = True
If SaldoVenta > 0 And UsuarioActual.TienePermisoProceso(100) Then
HLPagar.Visible = True
HLPagar.NavigateUrl = $"/Bancos/PopIEVentas.aspx?CveVenta={CveVenta}&TB_iframe=true&height=500&width=675"
HlCuentaTerminal.Visible = True
End If
Me.SaldoAnticipo = DbRowVenta("SaldoAnticipo").ToString().ToDecimal
If SaldoAnticipo > 0 Then
InicializaDTAnticiposAmortizacion()
@@ -5499,6 +5525,7 @@ Partial Class Ventas
LnkAgregarCliente.Visible = False
ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString())
TieneDiasVencidos = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("TieneDiasVencidos").ToString())
If EstatusCliente = False And Not DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") And (CveVenta <= 0 Or EsCreaApartirDe) Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)
@@ -7813,6 +7840,64 @@ Partial Class Ventas
Exit Sub
End If
Me.CveAutorizacion = -1
'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs") AndAlso RBLPago.SelectedValue = "1" Then
Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas
Try
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="TipoAutorizacion")
If RowAutorizacion IsNot Nothing Then
TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString()
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al obtener las autorizaciones", ex)
End Try
ObjVentas.Dispose()
If TipoDocumentoAutorizacion = "Ing" 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
If TieneDiasVencidos Then
CveAutorizacion = -1
Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'SI NO SE ENCONTRO NINGUA AUTORIZACION
If TipoAutorizacion = 0 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
End If
End If
If 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.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
EmitirImprimirNew(TipoDoctoViejo)
End Sub
@@ -10474,7 +10559,7 @@ Partial Class Ventas
End If
Dim totSubTotal As Decimal = Obj.SubTotal
Dim totSubTotal As Decimal = If(UsuarioActual.Empresa.CvePAC = 3, Obj.DtDetalle.SUMD("Total"), Obj.SubTotal) 'Obj.SubTotal
Dim totIVA As Decimal = Obj.IVA
Dim totRetIVA As Decimal = Obj.RetIVA
Dim totRetISR As Decimal = Obj.RetISR
@@ -11144,6 +11229,12 @@ Partial Class Ventas
factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString()
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso factura.TipoDocto = "Ing" AndAlso Me.CveAutorizacion > 0 Then
If Not ObjVentas.UpdateAutorizacionLimite(Me.CveAutorizacion, factura.CveCliente, factura.CveVenta) Then
ErrorList.Add("Error al guardar los limites de la autorizacion")
End If
End If
If ObjFactura.TipoDocto = "Ing" Then
If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then
ErrorList.Add("Error al guardar usados")
@@ -31518,5 +31609,45 @@ Partial Class Ventas
BtnEliminarAdjunto.Visible = False
UpAdjuntar.Update()
End Sub
Protected Sub LnkSolicitarCredito_Click(sender As Object, e As EventArgs) Handles LnkSolicitarCredito.Click
If CveCliente <= 0 Then
Alert("Debe seleccionar un cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlVendedor.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un vendedor", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
TxtImporteSolicitud.Text = ""
RegistraScript("$('#DivModalSolicitarCredito').modal('show')")
UpModalSolicitud.Update()
End Sub
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click
Dim ObjPS As New ClsVentas
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, DdlTipoAutorizacion.SelectedValue.ToEntero(), TipoDocumento:=DdlTipoDocto.SelectedValue) Then
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjPS.Dispose()
UpModalSolicitud.Update()
End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
UpModalSolicitud.Update()
End Sub
Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
Select Case TipoDocto
Case "Ing"
DivAutorizacion.Visible = True
DivImporteSolicitud.Visible = True
Case "Egs"
DivAutorizacion.Visible = False
DivImporteSolicitud.Visible = False
End Select
UpModalSolicitud.Update()
End Sub
End Class