-- solicitud de anticipos y mejoras GDIaz

This commit is contained in:
2024-12-30 07:38:45 -07:00
parent 9c51273239
commit 481b3b2994
5 changed files with 94 additions and 48 deletions

View File

@@ -213,6 +213,8 @@ Partial Class Ventas_CatAutorizacionLimites
Dim CveCliente As Integer = gvRow.DataKey("CveCliente").ToEntero() Dim CveCliente As Integer = gvRow.DataKey("CveCliente").ToEntero()
Dim CveVendedor As Integer = gvRow.DataKey("CveVendedor").ToEntero() Dim CveVendedor As Integer = gvRow.DataKey("CveVendedor").ToEntero()
Dim CveEstatusAutorizacion As Integer = 1 Dim CveEstatusAutorizacion As Integer = 1
'cuando es la modalidad 3, es autorización directa sobre la venta ya asociada a la solicitud.
If UsuarioActual.Empresa.Funcionalidad(595) = "3" Then CveEstatusAutorizacion = 2
Dim Importe As Decimal = gvRow.DataKey("Importe").ToDecimal().RoundSQL(2) Dim Importe As Decimal = gvRow.DataKey("Importe").ToDecimal().RoundSQL(2)
'AUTORIZACION DE IMPORTE, 'AUTORIZACION DE IMPORTE,

View File

@@ -371,7 +371,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="portlet-body rowpadding"> <div class="portlet-body rowpadding">
<div class="row"> <div class="row">
@@ -399,9 +398,7 @@
<div class="row"> <div class="row">
<div class="note note-success"> <div class="note note-success">
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
&nbsp;
<b>Nombre:</b> <b>Nombre:</b>
</div> </div>
<div class="col-md-4">&nbsp;<label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div> <div class="col-md-4">&nbsp;<label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
@@ -538,7 +535,8 @@
<div class="chequesie1" id="DivAnticipo" runat="server" visible="false"> <div class="chequesie1" id="DivAnticipo" runat="server" visible="false">
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
<label>Anticipos.:</label> <label>Anticipos:</label><asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
</div> </div>
<div class="col-md-4 input-icon"> <div class="col-md-4 input-icon">
<i style="margin: 0px;">$</i> <i style="margin: 0px;">$</i>

View File

@@ -3,12 +3,16 @@ Option Strict On
Imports System.Data Imports System.Data
Imports System.IO Imports System.IO
Imports System.Net.Http
Imports Extensiones Imports Extensiones
Imports Modelos.Factura Imports Modelos.Factura
Partial Class Ventas_PVCobranza Partial Class Ventas_PVCobranza
Inherits ClsPaginas Inherits ClsPaginas
#Region "Propiedades"
Private Property CveCliente As Integer Private Property CveCliente As Integer
Get Get
If ViewState("CveCliente") Is Nothing Then If ViewState("CveCliente") Is Nothing Then
@@ -93,10 +97,29 @@ Partial Class Ventas_PVCobranza
Set(value As DataTable) Set(value As DataTable)
ViewState("DtCortesVentas") = value ViewState("DtCortesVentas") = value
End Set End Set
End Property End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
Dim Arr As New ArrayList
'Arr.Add("autorizada")
'If EnviarNotificacionWhatsApp("526621430964", "solicitud_autorizacion_anticipo_respuesta", Arr) Then
' Alert("bien")
'Else
' Alert("mal", TipoMensaje.MsgAdvertencia)
'End If
'Arr.Add("suc")
'Arr.Add("cliente")
'Arr.Add("10")
'Arr.Add("$ 15.11")
'If EnviarNotificacionWhatsApp("526621430964", "solicitud_autorizacion_anticipo", Arr, "autoriza") Then
' Alert("bien")
'Else
' Alert("mal", TipoMensaje.MsgAdvertencia)
'End If
'Exit Sub
CveCorte = 0 CveCorte = 0
CargaFiltros() CargaFiltros()
CargaDdlPagos() CargaDdlPagos()
@@ -340,8 +363,6 @@ Partial Class Ventas_PVCobranza
End Sub End Sub
Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
@@ -360,8 +381,16 @@ Partial Class Ventas_PVCobranza
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkImprimir")) ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkImprimir"))
End If End If
If e.Row.DBCampo("CondicionesPago") = "1" Then ' remis de crédito If e.Row.DBCampo("CondicionesPago") = "1" Then ' remis de crédito
e.Row.FCLinkButton("BtnPagar").CssClass = "btn btn-xs btn-warning" ' si es de crédito debe de estar autorizado.
e.Row.FCLinkButton("BtnPagar").Text = "Crédito" e.Row.FCLinkButton("BtnPagar").Text = "Crédito"
If e.Row.DBCampo("CveEstatusAutorizacion") = "2" Then ' si es autorizada
e.Row.FCLinkButton("BtnPagar").CssClass = "btn btn-xs btn-warning"
e.Row.FCLinkButton("BtnPagar").Enabled = True
Else
e.Row.FCLinkButton("BtnPagar").CssClass = "btn btn-xs btn-danger"
e.Row.FCLinkButton("BtnPagar").Enabled = False
e.Row.FCLinkButton("BtnPagar").ToolTip = "Solicitud de crédito no autorizada."
End If
End If End If
If e.Row.DBCampo("AplicaImpresionPorAnt") = "1" Then If e.Row.DBCampo("AplicaImpresionPorAnt") = "1" Then
@@ -369,10 +398,10 @@ Partial Class Ventas_PVCobranza
If e.Row.DBCampo("Saldo").ToDecimal() > 0 Then If e.Row.DBCampo("Saldo").ToDecimal() > 0 Then
e.Row.FCLinkButton("BtnPagar").Visible = True e.Row.FCLinkButton("BtnPagar").Visible = True
If Not e.Row.DBCampo("TipoEntrega") = "2" Then If Not e.Row.DBCampo("TipoEntrega") = "2" Then
e.Row.FCLinkButton("LnkImprimir").Visible = False e.Row.FCLinkButton("LnkImprimir").Visible = False
End If End If
Else Else
e.Row.FCLinkButton("BtnPagar").Visible = False e.Row.FCLinkButton("BtnPagar").Visible = False
End If End If
End If End If
@@ -1867,6 +1896,7 @@ Partial Class Ventas_PVCobranza
UpAnticipos.Update() UpAnticipos.Update()
End Sub End Sub
Protected Sub GVAnticipos_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowCreated Protected Sub GVAnticipos_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowCreated
If e.Row.RowType = DataControlRowType.Header Then If e.Row.RowType = DataControlRowType.Header Then
e.Row.ClientIDMode = ClientIDMode.Static e.Row.ClientIDMode = ClientIDMode.Static

View File

@@ -451,7 +451,7 @@
<td width="95px"><b>Nombre:</b>&nbsp;</td> <td width="95px"><b>Nombre:</b>&nbsp;</td>
<td width="200px"> <td width="200px">
<asp:Label ID="LblCliente" runat="server" Text="Cliente"></asp:Label></td> <asp:Label ID="LblCliente" runat="server" Text="Cliente"></asp:Label></td>
<td width="85px" runat="server" id="LblEnviarMail"><b>Enviar Mail:</b></td> <td width="85px" runat="server" id="LblEnviarMail"><b>Envía Mail:</b></td>
<td width="135px"> <td width="135px">
<asp:CheckBox ID="ChkEnviarFactura" runat="server" /></td> <asp:CheckBox ID="ChkEnviarFactura" runat="server" /></td>
</tr> </tr>
@@ -578,6 +578,11 @@
<td colspan="3"> <td colspan="3">
<asp:TextBox ID="TxtDescripcionVenta" runat="server" Rows="2" TextMode="MultiLine" Width="100%" MaxLength="300" CssClass="form-control input-sm" Enabled="false"></asp:TextBox></td> <asp:TextBox ID="TxtDescripcionVenta" runat="server" Rows="2" TextMode="MultiLine" Width="100%" MaxLength="300" CssClass="form-control input-sm" Enabled="false"></asp:TextBox></td>
</tr> </tr>
<tr runat="server" id="TrCredito1" visible="false">
<td colspan="2">
<asp:CheckBox ID="ChkSolicitudAutorizacionCredito" runat="server" Text="Solicitar autorización crédito" />
</td>
</tr>
<tr runat="server" id="TrVentasMedicas1" visible="false"> <tr runat="server" id="TrVentasMedicas1" visible="false">
<td><b>Médico:</b></td> <td><b>Médico:</b></td>
<td> <td>
@@ -1266,7 +1271,7 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%--1--%> <%--1--%>
<asp:TemplateField> <asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>
<div class="row"> <div class="row">
<div class="col-md-3" id="TagPromocion" runat="server" visible='<%# If(CInt(Extensiones.IfNull(Eval("CvePromocionDetalle"), 0)) > 0, "true", "false") %>'> <div class="col-md-3" id="TagPromocion" runat="server" visible='<%# If(CInt(Extensiones.IfNull(Eval("CvePromocionDetalle"), 0)) > 0, "true", "false") %>'>
@@ -1288,7 +1293,7 @@
<asp:Literal ID="LtlCantidad" runat="server" Text='<%# Eval("Cantidad") %>' Visible="false"></asp:Literal> <asp:Literal ID="LtlCantidad" runat="server" Text='<%# Eval("Cantidad") %>' Visible="false"></asp:Literal>
<asp:Literal ID="LtlTipoDescuento" runat="server" Text='<%# Eval("TipoDescuento") %>' Visible="false"></asp:Literal> <asp:Literal ID="LtlTipoDescuento" runat="server" Text='<%# Eval("TipoDescuento") %>' Visible="false"></asp:Literal>
<asp:Literal ID="LtlDescuento" runat="server" Text='<%# Eval("Descuento") %>' Visible="false"></asp:Literal> <asp:Literal ID="LtlDescuento" runat="server" Text='<%# Eval("Descuento") %>' Visible="false"></asp:Literal>
<asp:TextBox ID="TxtCantidad" runat="server" CausesValidation="true" MaxLength="12" Text='<%# Eval("Cantidad", "{0:0.######}") %>' ValidationGroup="GprGV" Width="45px" Height="24px"></asp:TextBox> <asp:TextBox ID="TxtCantidad" runat="server" CausesValidation="true" MaxLength="12" Text='<%# Eval("Cantidad", "{0:0.######}") %>' ValidationGroup="GprGV" Width="75px" Height="24px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVCantidad" runat="server" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GprGV"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVCantidad" runat="server" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GprGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCantidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCOCantidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVCantidadEdit" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprGV"></asp:CustomValidator> <asp:CustomValidator ID="CVCantidadEdit" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprGV"></asp:CustomValidator>
@@ -1472,7 +1477,7 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%--18--%> <%--18--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Editar"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" >
<EditItemTemplate> <EditItemTemplate>
<div style="width: 85px;"> <div style="width: 85px;">
<asp:LinkButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" ValidationGroup="GprGV" /> <asp:LinkButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" ValidationGroup="GprGV" />
@@ -1486,7 +1491,7 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%--19--%> <%--19--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Eliminar"> <asp:TemplateField ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" <asp:LinkButton ID="imgD" 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" /> 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" />
@@ -8824,7 +8829,6 @@
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSolCreditoTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true"> <asp:DropDownList ID="DdlSolCreditoTipoDocto" 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="Ing" Selected="True" Text="Factura de Ingreso"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Nota de crédito"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
<label for="<%= DdlSolCreditoTipoDocto.ClientID.ToString()%>">Tipo Documento:</label> <label for="<%= DdlSolCreditoTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
</div> </div>

View File

@@ -1665,7 +1665,6 @@ Partial Class Ventas
ViewState("CveOC") = value ViewState("CveOC") = value
End Set End Set
End Property End Property
Private Property RegistroxOC As Boolean Private Property RegistroxOC As Boolean
Get Get
Return CBool(IfNull(ViewState("RegistroxOC"), False)) Return CBool(IfNull(ViewState("RegistroxOC"), False))
@@ -1674,8 +1673,6 @@ Partial Class Ventas
ViewState("RegistroxOC") = value ViewState("RegistroxOC") = value
End Set End Set
End Property End Property
Private Property EnviarCorreoCliente As Boolean Private Property EnviarCorreoCliente As Boolean
Get Get
Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False)) Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False))
@@ -2598,10 +2595,6 @@ Partial Class Ventas
CargaGestionCobranza() CargaGestionCobranza()
End If End If
If UsuarioActual.Empresa.Funcionalidad(595) = "2" Then
LnkSolicitarCredito.Visible = True
End If
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat") DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True DivPSSAT.Visible = True
@@ -7709,6 +7702,8 @@ Partial Class Ventas
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1) Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
'solo para bdh, que se generen NC
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlSolCreditoTipoDocto.Items.Add(New ListItem("Nota de crédito", "Egs"))
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO 'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
If Not EsFilial AndAlso (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then If Not EsFilial AndAlso (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
@@ -7750,7 +7745,7 @@ Partial Class Ventas
If Me.PermiteCredito Then If Me.PermiteCredito Then
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then If CreditoDispo > 0 Then
TrCreditoDisponible.Visible = True TrCreditoDisponible.Visible = True
LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo) LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo)
@@ -7778,7 +7773,7 @@ Partial Class Ventas
UPCondicionesPago.Update() UPCondicionesPago.Update()
End If End If
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then If CreditoDispo > 0 Then
TrCreditoDisponible.Visible = True TrCreditoDisponible.Visible = True
@@ -7801,7 +7796,7 @@ Partial Class Ventas
If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
DdlTipoComprobante.SelectedValueExist("Cot") DdlTipoComprobante.SelectedValueExist("Cot")
Else Else
If UsuarioActual.Empresa.Funcionalidad(595) = "1" Then If ValorAutorizacion = "1" Then
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
DdlTipoComprobante.SelectedValue = "PA" DdlTipoComprobante.SelectedValue = "PA"
@@ -7814,7 +7809,7 @@ Partial Class Ventas
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot" If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot"
'quito remisión y factura 'quito remisión y factura
If UsuarioActual.Empresa.Funcionalidad(595) <> "2" Then If ValorAutorizacion = "1" Then
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
If Not UsuarioActual.TienePermisoProceso(325) Then If Not UsuarioActual.TienePermisoProceso(325) Then
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
@@ -7839,7 +7834,6 @@ Partial Class Ventas
If Bloqueo AndAlso ValorAutorizacion = "2" Then If Bloqueo AndAlso ValorAutorizacion = "2" Then
Dim Autorizacion As Integer = 0 Dim Autorizacion As Integer = 0
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing Dim RowAutorizacion As DataRow = Nothing
@@ -7862,6 +7856,13 @@ Partial Class Ventas
TieneBloqueoPorCreditoVencimiento = 0 TieneBloqueoPorCreditoVencimiento = 0
Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion) Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion)
End If End If
LnkSolicitarCredito.Visible = True
DdlTipoAutorizacion.SelectedValueExist("1")
End If
If Bloqueo AndAlso ValorAutorizacion = "3" Then ' autorización con vinculación a una venta registrada
If UsuarioActual.CveRol = 1 Then TrCredito1.Visible = True
ChkSolicitudAutorizacionCredito.Checked = True
End If End If
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA 'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
@@ -7999,16 +8000,7 @@ Partial Class Ventas
End If End If
End If End If
Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones
'RMF. validacion temporal
'verifica si tiene autorizaciones de Nota de crédito autorizadas
'Dim ObjVentas As New ClsVentas
'If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Ing", CveEstatus:=1) Then
' Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion")
' If RowAutorizacion IsNot Nothing Then
' DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
' End If
'End If
'ObjVentas.Dispose()
Dim Vta As New ClsVentas Dim Vta As New ClsVentas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
@@ -8128,7 +8120,7 @@ Partial Class Ventas
'CREDITO NO SUFICIENTE 'CREDITO NO SUFICIENTE
If Opcion = 3 Then If Opcion = 3 Then
'Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) 'Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then 'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then
' BloquearCliente = True ' BloquearCliente = True
'End If 'End If
@@ -8295,7 +8287,7 @@ Partial Class Ventas
Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia) Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia)
Else Else
RBLPago.Items(0).Enabled = True RBLPago.Items(0).Enabled = True
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas) Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas)
TrCreditoDisponible.Visible = True TrCreditoDisponible.Visible = True
LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo) LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo)
@@ -8435,7 +8427,7 @@ Partial Class Ventas
UpCliente.Update() UpCliente.Update()
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub End Sub
Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal Private Function GetSaldoCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal
Dim Retorno As Decimal = 0 Dim Retorno As Decimal = 0
Dim ObjVentasAplciar As ClsVentas = Nothing Dim ObjVentasAplciar As ClsVentas = Nothing
If ObjVentas IsNot Nothing Then If ObjVentas IsNot Nothing Then
@@ -10904,6 +10896,23 @@ Partial Class Ventas
End If End If
End If End If
End If End If
If ErrorList.Count = 0 AndAlso ObjFactura.CveVenta > 0 AndAlso ChkSolicitudAutorizacionCredito.Checked Then
' crea la solicitud de autorización de crédito
Dim tCveTipoAutorizacion As Integer = 1
If ObjVentas.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtTotal.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, tCveTipoAutorizacion, TipoDocumento:=DdlTipoComprobante.SelectedValue, DiasVencidos:=25, CveVenta:=ObjFactura.CveVenta) Then
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
Dim Arr As New ArrayList
Arr.Add(NombreCliente)
Arr.Add($" $ {TxtTotal.Text.ToDecimal}")
Arr.Add(DdlSubProyectoDatos.SelectedItem.Text)
EnviarNotificacionWhatsAppPlantilla("526621430964", "solicitud_autorizacion_credito2", Arr)
' Alert("bien")
'Else
' Alert("mal", TipoMensaje.MsgAdvertencia)
'End If
End If
End If
'Paso CRM actualizar importe de acercamiento y guardar en bitacora 'Paso CRM actualizar importe de acercamiento y guardar en bitacora
If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then
@@ -37340,8 +37349,11 @@ Partial Class Ventas
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue = "1"
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2 DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue = "2"
If Not UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
TxtDiasVencidos.Text = "25"
End If
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub