Cambios en lineas adicionales en ventas

This commit is contained in:
2022-09-30 18:40:17 -07:00
parent 8dff320a82
commit 6acac06ed7
3 changed files with 62 additions and 39 deletions

View File

@@ -5603,7 +5603,7 @@ Public Class ClsVentas
End Function End Function
Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1) As Boolean Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_LineasAdicionalesSaldoGet") DataAdapter("PA_Vta_LineasAdicionalesSaldoGet")
@@ -5615,6 +5615,7 @@ Public Class ClsVentas
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo .Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo
.Add("@FechaVencimientoConsulta", SqlDbType.Date).Value = FechaVencimientoConsulta
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -713,6 +713,17 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</td> </td>
</tr> </tr>
<tr id="TrLineaAdicional" runat="server" visible="false">
<td align="left">Linea Adicional:</td>
<td align="left">
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="200px" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
<td align="left">
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateLineaAdicional" OnClick="LnkUpdateLineaAdicional_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la linea adicional de crédito de la factura?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Linea adicional" />
</td>
</tr>
<tr align="left" id="TrAlmacenOrigen" runat="server" visible="False"> <tr align="left" id="TrAlmacenOrigen" runat="server" visible="False">
<td> <td>
<asp:Label runat="server" ToolTip="Almacen Asignado" Font-Bold="true" Text="Almacen O:"></asp:Label> <asp:Label runat="server" ToolTip="Almacen Asignado" Font-Bold="true" Text="Almacen O:"></asp:Label>
@@ -2406,7 +2417,8 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;"> <div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
@@ -2417,12 +2429,12 @@
</div> </div>
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
</div> </div>
</div> </div>
<div class="tools"> <div class="tools">
Emitir <asp:CheckBox ID="ChkEmitirComercioExterior" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkEmitirComercioExterior_CheckedChanged" AutoPostBack="true" /> Emitir
<asp:CheckBox ID="ChkEmitirComercioExterior" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkEmitirComercioExterior_CheckedChanged" AutoPostBack="true" />
<a href="javascript:;" onclick="CargaComercioExterior()" class="expand"></a> <a href="javascript:;" onclick="CargaComercioExterior()" class="expand"></a>
</div> </div>
</div> </div>
@@ -2432,7 +2444,7 @@
<div class="form-body"> <div class="form-body">
<%-- <div class="row rowpadding"> <%-- <div class="row rowpadding">
<label class="col-md-2">Emitir:</label> <label class="col-md-2">Emitir:</label>
<div class="col-md-10"> <div class="col-md-10">
@@ -3443,17 +3455,7 @@
</div> </div>
<div class="portlet-body formnombottom"> <div class="portlet-body formnombottom">
<table border="0" width="100%"> <table border="0" width="100%">
<tr id="TrLineaAdicional" runat="server" visible="false">
<td align="left">Linea Adicional:</td>
<td align="left">
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="200px" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
<td align="left">
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateLineaAdicional" OnClick="LnkUpdateLineaAdicional_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la linea adicional de crédito de la factura?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Linea adicional" />
</td>
</tr>
<tr id="TrFormaEntrega" runat="server" visible="false"> <tr id="TrFormaEntrega" runat="server" visible="false">
<td align="left">Forma de entrega:</td> <td align="left">Forma de entrega:</td>
<td align="left"> <td align="left">
@@ -7825,7 +7827,7 @@
</div> </div>
</div> </div>
<div class="tools"> <div class="tools">
<%-- <a href="javascript:;" class="collapse"></a>--%> <%-- <a href="javascript:;" class="collapse"></a>--%>
</div> </div>
</div> </div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom"> <div class="portlet-body form-horizontal form-row-sepe formnombottom">

View File

@@ -2249,12 +2249,12 @@ Partial Class Ventas
End Set End Set
End Property End Property
Private Property CveClasificacionLineaAdicional As Integer Private Property CveCategoriaLineaAdicional As Integer
Get Get
Return IfNull(ViewState("CveClasificacionLineaAdicional"), "-1", ViewState("CveClasificacionLineaAdicional")).ToString().ToEntero() Return IfNull(ViewState("CveCategoriaLineaAdicional"), "-1", ViewState("CveCategoriaLineaAdicional")).ToString().ToEntero()
End Get End Get
Set(value As Integer) Set(value As Integer)
ViewState("CveClasificacionLineaAdicional") = value ViewState("CveCategoriaLineaAdicional") = value
End Set End Set
End Property End Property
@@ -8844,11 +8844,21 @@ Partial Class Ventas
'VALIDAR LINEAS ADICIONALES 'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CLASIFICACION DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL 'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then If TmpDT IsNot Nothing AndAlso Me.CveCategoriaLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion"}).Rows
If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
If RowClasificacion IsNot Nothing Then
Dim CveCategoria As Integer = Row("CveCategoria").ToString().ToEntero()
Dim Categoria As String = Row("Categoria").ToString()
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert($"No se encontro la clasificación.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
Next Next
@@ -14683,12 +14693,12 @@ Partial Class Ventas
End If End If
'Factura 'Factura
If Not ObjEventos.AddEventoBitacora($"Remisión facturada : <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then If Not ObjEventos.AddEventoBitacora($"Venta facturada de Remisión: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
'Remision 'Remision
If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then If Not ObjEventos.AddEventoBitacora($"Remisión facturada en Venta: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
Next Next
@@ -18079,11 +18089,11 @@ Partial Class Ventas
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1) Then If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"Saldo > 0 OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}") DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= {Now.ToString("dd/MM/yyyy")}) OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}")
End If End If
End If End If
Else Else
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1) Then If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados DdlLineaAdicional.DataSource = ObjVentas.DtResultados
@@ -18104,7 +18114,7 @@ Partial Class Ventas
End If End If
UPCondicionesPago.Update() UpParametros.Update()
End Sub End Sub
@@ -35302,26 +35312,36 @@ Partial Class Ventas
If ObjVentas.DtResultados.Rows.Count > 0 Then If ObjVentas.DtResultados.Rows.Count > 0 Then
TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal() Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal()
Me.CveClasificacionLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveClasificacionPS").ToString().ToEntero() Me.CveCategoriaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveCategoria").ToString().ToEntero()
Me.CveMonedaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveMoneda").ToString().ToEntero() Me.CveMonedaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveMoneda").ToString().ToEntero()
End If End If
End If End If
End Using End Using
Else Else
Me.SaldoLineaAdicional = 0 Me.SaldoLineaAdicional = 0
Me.CveClasificacionLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0
End If End If
UPCondicionesPago.Update() UpParametros.Update()
End Sub End Sub
Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs) Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs)
'VALIDAR LINEAS ADICIONALES 'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CLASIFICACION DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL 'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then If TmpDT IsNot Nothing AndAlso Me.CveCategoriaLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion"}).Rows
If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
If RowClasificacion IsNot Nothing Then
Dim CveCategoria As Integer = Row("CveCategoria").ToString().ToEntero()
Dim Categoria As String = Row("Categoria").ToString()
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert($"No se encontro la clasificación.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
Next Next