Validacion de autorizaciones, limitar remisiones de nota de credito

This commit is contained in:
2020-10-21 13:07:29 -07:00
parent dd282564d7
commit 897b04e407
3 changed files with 41 additions and 33 deletions

View File

@@ -2021,7 +2021,7 @@ Public Class ClsClientes
Return Retorno Return Retorno
End Function End Function
Public Function UpdateEstatusPedido(CveVenta As Integer, CveEstatusFactura As Integer, Dias As Integer, CveUsuario As Integer) As Boolean Public Function UpdateEstatusPedido(CveVenta As Integer, CveEstatusFactura As Integer, Dias As Integer, CveUsuario As Integer, Optional CveRemision As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ClienteVentasPedidoEstatusUpdate") DataAdapter("PA_Vta_ClienteVentasPedidoEstatusUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
@@ -2029,6 +2029,7 @@ Public Class ClsClientes
.Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura .Add("@CveEstatusFactura", SqlDbType.Int).Value = CveEstatusFactura
.Add("@Dias", SqlDbType.Int).Value = Dias .Add("@Dias", SqlDbType.Int).Value = Dias
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveRemision", SqlDbType.Int).Value = CveRemision
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
@@ -2037,28 +2038,28 @@ Public Class ClsClientes
OnError("Ocurrió un error al actualizar el pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al actualizar el pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
'Public Function UpdateFechaPedido(CveVenta As Integer, DiasCredito As Integer) As Boolean 'Public Function UpdateFechaPedido(CveVenta As Integer, DiasCredito As Integer) As Boolean
' Dim Retorno As Boolean = False ' Dim Retorno As Boolean = False
' DataAdapter("PA_Vta_ClienteVentasPedidoFechaUpdate") ' DataAdapter("PA_Vta_ClienteVentasPedidoFechaUpdate")
' With SqlAdapter.SelectCommand.Parameters ' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta ' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
' .Add("@DiasCredito", SqlDbType.Int).Value = DiasCredito ' .Add("@DiasCredito", SqlDbType.Int).Value = DiasCredito
' End With ' End With
' Try ' Try
' SqlAdapter.Fill(Data) ' SqlAdapter.Fill(Data)
' Retorno = True ' Retorno = True
' Catch ex As Exception ' Catch ex As Exception
' OnError("Ocurrió un error al actualizar la fecha del pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) ' OnError("Ocurrió un error al actualizar la fecha del pedido del cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try ' End Try
' Return Retorno ' Return Retorno
'End Function 'End Function
#End Region #End Region
#Region "A P L I C A C I O N" #Region "A P L I C A C I O N"
Public Function AddClienteApp(Cliente As MCliente) As Boolean Public Function AddClienteApp(Cliente As MCliente) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False

View File

@@ -6235,8 +6235,8 @@
</div> </div>
<div class="col-md-10"> <div class="col-md-10">
<asp:DropDownList ID="DdlVentaUsado" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Folio" DataValueField="CveVenta" Width="100%" CssClass="select2me" OnSelectedIndexChanged="DdlVentaUsado_SelectedIndexChanged"></asp:DropDownList> <asp:DropDownList ID="DdlVentaUsado" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="Folio" DataValueField="CveVenta" Width="100%" CssClass="select2me" OnSelectedIndexChanged="DdlVentaUsado_SelectedIndexChanged"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVVentaUsado" runat="server" InitialValue="-1" ControlToValidate="DdlVentaUsado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Factura''</b> es necesario, por favor ingréselo." ValidationGroup="VGAplicarRNC"></asp:RequiredFieldValidator> <%-- <asp:RequiredFieldValidator ID="RFVVentaUsado" runat="server" InitialValue="-1" ControlToValidate="DdlVentaUsado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Factura''</b> es necesario, por favor ingréselo." ValidationGroup="VGAplicarRNC"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEVentaUsado" runat="server" HighlightCssClass="vco" TargetControlID="RFVVentaUsado" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCEVentaUsado" runat="server" HighlightCssClass="vco" TargetControlID="RFVVentaUsado" Width="350px"></ajax:ValidatorCalloutExtender>--%>
</div> </div>
</div> </div>
</div> </div>
@@ -6293,14 +6293,14 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
<asp:TextBox ID="TxtImporte" CssClass="myvalue" runat="server" Width="75px" /> <asp:TextBox ID="TxtImporte" CssClass="myvalue ImportesRNCCargo" runat="server" Width="75px" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
<div class="row"> <div class="row" id="DivSMU" runat="server" visible="false">
<div class="col-md-12"> <div class="col-md-12">
<table border="0" rules="none" class="well TextTab" style="float: right;" runat="server"> <table border="0" rules="none" class="well TextTab" style="float: right;" runat="server">
<tr align="right"> <tr align="right">

View File

@@ -2160,6 +2160,7 @@ Partial Class Ventas
'Carga Venta 'Carga Venta
If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero() > 0 Then If Request("CveVenta") IsNot Nothing AndAlso IsNumeric(Request("CveVenta")) AndAlso Request("CveVenta").ToEntero() > 0 Then
ViewState("CveVenta") = Request("CveVenta") ViewState("CveVenta") = Request("CveVenta")
If CargaVenta() Then If CargaVenta() Then
'DdlSucursal.Enabled = False 'DdlSucursal.Enabled = False
@@ -2694,7 +2695,7 @@ Partial Class Ventas
TrPedido.Visible = False TrPedido.Visible = False
' TrKilometrajeTxt.Visible = True ' TrKilometrajeTxt.Visible = True
End If End If
LtlTareaNueva.Text = String.Format("<a class=""caption-subject bold font-green"" onclick=""OpenModalNewTareaUserControl(1,-1,{{CveVenta:{0}}});""> <i class=""fa fa-plus""'></i> Tarea</a>", CveVenta) LtlTareaNueva.Text = String.Format("<a class=""caption-subject bold font-green"" onclick=""OpenModalNewTareaUserControl(1,-1,{{CveVenta:{0}}});""> <i class=""fa fa-plus""></i> Tarea</a>", CveVenta)
End If End If
@@ -5415,7 +5416,7 @@ Partial Class Ventas
DdlVentaUsado.DataBind() DdlVentaUsado.DataBind()
DdlVentaUsado.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlVentaUsado.Items.Insert(0, New ListItem("No Aplica", "-1"))
UpModalRemisionesNC.Update() UpModalRemisionesNC.Update()
End If End If
@@ -10190,7 +10191,7 @@ Partial Class Ventas
'PedidoA' 'PedidoA'
If ObjVentas.CveVenta > 0 And CvePedidoA > 0 And DdlTipoComprobante.SelectedValue.Contiene("Rem") Then If ObjVentas.CveVenta > 0 And CvePedidoA > 0 And DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
If Not ObjCliente.UpdateEstatusPedido(CvePedidoA, 18, -1, UsuarioActual.CveUsuario) Then If Not ObjCliente.UpdateEstatusPedido(CvePedidoA, 18, -1, UsuarioActual.CveUsuario, CveRemision:=factura.CveVenta) Then
ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA") ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA")
End If End If
End If End If
@@ -23116,13 +23117,19 @@ Partial Class Ventas
GvRemisionesNCBon.DataBind() GvRemisionesNCBon.DataBind()
If CveVentaUsado > 0 Then If CveVentaUsado > 0 Then
DivSMU.Visible = True
Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa) Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
LtlSMU.Text = String.Format("{0:N2}", FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()) Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados)
Else Else
LtlSMU.Text = String.Format("{0:N2}", 0) DivSMU.Visible = False
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If End If
UpModalRemisionesNC.Update() UpModalRemisionesNC.Update()
UpDescNC.Update()
End Sub End Sub
Private Sub CargaDescRNC() Private Sub CargaDescRNC()
Dim DtNC As DataTable = Nothing Dim DtNC As DataTable = Nothing
@@ -23318,8 +23325,8 @@ Partial Class Ventas
End Sub End Sub
Protected Sub GvRemisionesNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNC.RowDataBound Protected Sub GvRemisionesNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNC.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaTotalRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaCantidadRNCMasivo({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
End If End If
End Sub End Sub