This commit is contained in:
2022-09-26 10:36:19 -07:00
20 changed files with 1694 additions and 1029 deletions

View File

@@ -2104,6 +2104,7 @@
<asp:BoundField HeaderText="Fecha Venta" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Fecha Vencimiento" DataField="FechaVencimiento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Días Vencidos" DataField="DiasVencidos" DataFormatString="{0}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Linea Adicional" DataField="LineaAdicional" DataFormatString="{0}" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Monto Venta" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="LtlSaldoOriginal" runat="server" Text='<%# Eval("Original", "{0:N2}") %>'></asp:Literal>&nbsp;
@@ -7059,9 +7060,9 @@
$("#C_Tab_TabContratos_tab").click(function () { CargaContratos(); });
}
var isAsyncPostback = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
if (isAsyncPostback) {
tb_init('a.thickbox');
var isAsyncPostback = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
if (isAsyncPostback) {
tb_init('a.thickbox');
}
}

View File

@@ -3443,6 +3443,17 @@
</div>
<div class="portlet-body formnombottom">
<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">
<td align="left">Forma de entrega:</td>
<td align="left">

View File

@@ -2231,6 +2231,32 @@ Partial Class Ventas
ViewState("ClienteRegimenFiscal") = value
End Set
End Property
Private Property CveLineaAdicionalVenta As Integer
Get
Return IfNull(ViewState("CveLineaAdicionalVenta"), "-1", ViewState("CveLineaAdicionalVenta")).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveLineaAdicionalVenta") = value
End Set
End Property
Private Property SaldoLineaAdicional As Decimal
Get
Return (IfNull(ViewState("ImporteLineaAdicional"), "0", ViewState("ImporteLineaAdicional"))).ToString().ToDecimal()
End Get
Set(value As Decimal)
ViewState("ImporteLineaAdicional") = value
End Set
End Property
Private Property CveClasificacionLineaAdicional As Integer
Get
Return IfNull(ViewState("CveClasificacionLineaAdicional"), "-1", ViewState("CveClasificacionLineaAdicional")).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveClasificacionLineaAdicional") = value
End Set
End Property
#End Region
@@ -4583,6 +4609,11 @@ Partial Class Ventas
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
Me.CveLineaAdicionalVenta = DbRowVenta("CveLineaAdicional").ToString().ToEntero()
End If
'CargaEncabezado
If Not (CveRemision > 0 Or CveCotizacion > 0) Then
DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString()
@@ -5637,6 +5668,10 @@ Partial Class Ventas
End If
End If
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso Me.CveLineaAdicionalVenta > 0 Then
CalculaLineasAdicionales()
End If
UpPS.Update()
UpContado.Update()
UpEstatus.Update()
@@ -6645,6 +6680,16 @@ Partial Class Ventas
End If
BloqueaCondiconesPago()
DeshabilitarAplicarNotaDeCredito(LblRFC.Text)
'If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
' Using ObjVentas As New ClsVentas
' If ObjVentas.GetLineasAdicionales(-1, CveCliente, -1, -1, DdlMoneda.SelectedValue.ToEntero(), MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa) Then
' If ObjVentas.DtResultados.Rows.Count > 0 Then
' TrLineaAdicional.Visible = True
' End If
' End If
' End Using
'End If
End Sub
Private Sub CargaRelacionadasPendientes()
@@ -8727,9 +8772,10 @@ Partial Class Ventas
End If
End If
'SI TIENE LINEA ADICIONAL NO VERIFICAR LIMITE DE CREDITO
'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA
'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
If Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
If DdlLineaAdicional.SelectedValue.ToEntero() <= 0 AndAlso Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
@@ -8782,6 +8828,30 @@ Partial Class Ventas
'End If
End If
'VALIDAR LINEAS ADICIONALES
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
If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows
If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then
Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
End If
If Me.SaldoLineaAdicional <= 0 Then
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'VALIDA PRECIO AL AGREGAR A ALMACEN
If Not UsuarioActual.TienePermisoProceso(169) Then
@@ -12559,7 +12629,8 @@ Partial Class Ventas
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text,
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible) Then
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible,
CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero()) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then
@@ -17963,6 +18034,8 @@ Partial Class Ventas
ListaDescuentos.Add(ObjDescuento)
End If
CalculaLineasAdicionales()
CalculaTotalesVenta()
LimpiaAgregar()
@@ -17979,6 +18052,43 @@ Partial Class Ventas
End Sub
Private Sub CalculaLineasAdicionales()
If DdlTipoComprobante.SelectedValue = "Ing" AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
DdlLineaAdicional.DataSource = Nothing
Using ObjVentas As New ClsVentas
If CveVenta > 0 Then
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"Saldo > 0 OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}")
End If
End If
Else
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados
End If
End If
End If
End Using
DdlLineaAdicional.DataBind()
DdlLineaAdicional.Items.Insert(0, New ListItem("Seleccione", "-1"))
If Me.CveLineaAdicionalVenta > 0 Then
DdlLineaAdicional.SelectedValueExist(CveLineaAdicionalVenta.ToString())
DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty)
DdlLineaAdicional.Enabled = False
LnkUpdateLineaAdicional.Visible = True
End If
End If
UPCondicionesPago.Update()
End Sub
Private Sub AgregarPSPYME()
If Modalidad = "A" Then
@@ -18277,8 +18387,12 @@ Partial Class Ventas
End If
LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
TrRetIVA.Style.Add("display", "")
DdlTipoRetencion.Visible = True
If LblRetIVA.Text.ToDecimal() > 0 Then
TrRetIVA.Style.Add("display", "")
DdlTipoRetencion.Visible = True
Else
TrRetIVA.Style.Add("display", "none")
End If
Row("IVA") = Row("PorcentajeIVA")
@@ -33288,13 +33402,15 @@ Partial Class Ventas
TxtPedidoContrato.Enabled = True
TxtObsAlmacen.Enabled = True
RblPaqueteria.Enabled = True
DdlLineaAdicional.Enabled = True
LnkUpdateLineaAdicional.Visible = True
'Acciones
BtnEditar.Text = "Guardar"
UpParametros.Update()
UPObservaciones.Update()
UpFacturar.Update()
UPCondicionesPago.Update()
End Sub
Private Sub GuardarValoresEditados()
@@ -35153,5 +35269,57 @@ Partial Class Ventas
End Sub
Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs)
If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
RBLPago.SelectedValue = "1"
RBLPago.Enabled = False
Using ObjVentas As New ClsVentas
If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal()
Me.CveClasificacionLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveClasificacionPS").ToString().ToEntero()
End If
End If
End Using
Else
Me.SaldoLineaAdicional = 0
Me.CveClasificacionLineaAdicional = 0
End If
UPCondicionesPago.Update()
End Sub
Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs)
'VALIDAR LINEAS ADICIONALES
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
If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows
If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then
Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
End If
If Me.SaldoLineaAdicional <= 0 Then
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then
Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
Using ObjVentas As New ClsVentas
If ObjVentas.UpdateVentaLineaAdicional(DdlLineaAdicional.SelectedValue.ToEntero(), Me.CveVenta, UsuarioActual.CveEmpresa) Then
Alert("Se actualizo la linea adicional de crédito de la venta")
End If
End Using
End Sub
End Class