diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 5de754c67..bf49e1ed5 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -7750,6 +7750,17 @@ Public Class ClsPaginas
params.Add(New ReportParameter("FirmaAutorizo", If(FirmaAut.Exists, ImageToBase64(Drawing.Image.FromFile(FirmaAut.FullName), Drawing.Imaging.ImageFormat.Png), "")))
+ If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.CveEmpresa = 197 Then
+
+ Dim ObjProveedor As New ClsCompProveedores
+ If ObjProveedor.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, ObjOC.CveProveedor, "-1", "-1", "-1", "-1", "-1", "-1", "-1", -1, EmpresaActual.CveEmpresa) Then
+ If ObjProveedor.DtResultados.Rows.Count > 0 Then
+ params.Add(New ReportParameter("PlazoPago", ObjProveedor.PlazoPago.ToString))
+ End If
+ End If
+
+ End If
+
If Archivo.Exists Then
bytes = StreamPDF(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta), DtDetalle, params, $"OC_{ObjOC.Folio.ToString}", RDSName:="DsOC", MR:=MR)
Else
@@ -10065,6 +10076,7 @@ Public Class ClsPaginas
PaginaDict.Add("/General/CatSatListado69B.aspx".ToUpper, 1038)
PaginaDict.Add("/General/CatMedidaEquivalencia.aspx".ToUpper(), 773)
PaginaDict.Add("/General/RepIndicadorResumen.aspx".ToUpper(), 110)
+ PaginaDict.Add("/General/SaldosMenores.aspx".ToUpper(), -1)
#End Region
#Region "GPS"
PaginaDict.Add("/GPS/RepTemperatura.aspx".ToUpper(), 681)
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index bcddd23b2..a79bf4f32 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -4450,7 +4450,8 @@ Public Class ClsVentas
Return Retorno
End Function
- Public Function GetRepAnticiposNCIXCDetalle(CveCliente As Integer, CveSubProyecto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, ConSaldo As Integer, Tipo As Integer, CveMoneda As Integer, FechaICorte As Date, FechaFCorte As Date, TipoCambio As Integer, TCEspecifico As Double, Optional CveVendedor As Integer = -1) As Boolean
+ Public Function GetRepAnticiposNCIXCDetalle(CveCliente As Integer, CveSubProyecto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, ConSaldo As Integer, Tipo As Integer, CveMoneda As Integer, FechaICorte As Date, FechaFCorte As Date, TipoCambio As Integer, TCEspecifico As Double, Optional CveVendedor As Integer = -1,
+ Optional SaldoMayorA As Decimal = -999999999999, Optional SaldoMenorA As Decimal = 999999999999) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_RepAnt-NC-IXCDetalle")
With SqlAdapter.SelectCommand.Parameters
@@ -4467,6 +4468,8 @@ Public Class ClsVentas
.Add("@TipoCambio", SqlDbType.Int).Value = TipoCambio
.Add("@TCEspecifico", SqlDbType.Float).Value = TCEspecifico
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
+ .Add("@SaldoMayorA", SqlDbType.Money).Value = SaldoMayorA
+ .Add("@SaldoMenorA", SqlDbType.Money).Value = SaldoMenorA
End With
Try
SqlAdapter.Fill(Data)
diff --git a/General/SaldosMenores.aspx b/General/SaldosMenores.aspx
new file mode 100644
index 000000000..c3a4abe04
--- /dev/null
+++ b/General/SaldosMenores.aspx
@@ -0,0 +1,298 @@
+<%@ Page Title="Saldos Menores" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="SaldosMenores.aspx.vb" Inherits="General_SaldosMenores" %>
+
+
+
+
+
+
+ Saldos Menores
+
+
+
+
+
+
+
+
+
+
+
diff --git a/General/SaldosMenores.aspx.vb b/General/SaldosMenores.aspx.vb
new file mode 100644
index 000000000..e7e0e5987
--- /dev/null
+++ b/General/SaldosMenores.aspx.vb
@@ -0,0 +1,459 @@
+Imports System
+Imports System.Collections.Generic
+Imports System.Data
+Imports System.Web.UI.WebControls
+Imports Extensiones
+Imports Microsoft.Reporting.WebForms
+
+Partial Public Class General_SaldosMenores
+ Inherits ClsPaginas
+
+#Region "PROPIEDADES"
+ Private Property DtDatos As DataTable
+ Get
+ Return DirectCast(ViewState("DtDatos"), DataTable)
+ End Get
+ Set(value As DataTable)
+ ViewState("DtDatos") = value
+ End Set
+ End Property
+
+ Private Property Tipo As Integer
+ Get
+ Return DirectCast(ViewState("Tipo"), Integer)
+ End Get
+ Set(value As Integer)
+ ViewState("Tipo") = value
+ End Set
+ End Property
+
+ Private Property CveMoneda As Integer
+ Get
+ Return DirectCast(ViewState("CveMoneda"), Integer)
+ End Get
+ Set(value As Integer)
+ ViewState("CveMoneda") = value
+ End Set
+ End Property
+
+ Private Property TCEspecifico As Double
+ Get
+ Return DirectCast(ViewState("TCEspecifico"), Double)
+ End Get
+ Set(value As Double)
+ ViewState("TCEspecifico") = value
+ End Set
+ End Property
+
+ Private Property TipoCambio As Integer
+ Get
+ Return DirectCast(ViewState("TipoCambio"), Integer)
+ End Get
+ Set(value As Integer)
+ ViewState("TipoCambio") = value
+ End Set
+ End Property
+#End Region
+
+ Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
+ If Not IsPostBack Then
+ InicializaDatos()
+ End If
+ End Sub
+
+
+
+#Region "I X C"
+ Protected Sub InicializaDatos()
+ txtFechaI.Text = $"01/01/{Now.Year}"
+ txtFechaF.Text = DateTime.Today.ToString()
+ TxtFecha.Text = DateTime.Today.ToString()
+
+ TxtSaldoMayorA.Text = "0"
+ TxtSaldoMenorA.Text = "1000"
+
+ CargaSucursales()
+
+ Dim CveCliente As Integer = If(Request("CveCliente") Is Nothing, -1, Request("CveCliente").ToString().ToEntero())
+
+
+ CveMoneda = If(Request("CveMoneda") Is Nothing, -1, Request("CveMoneda").ToString().ToEntero())
+ txtFechaI.Text = If(Request("FechaI") Is Nothing, NowADS().ToString(), Request("FechaI").ToString())
+ txtFechaF.Text = If(Request("FechaF") Is Nothing, NowADS().ToString(), Request("FechaF").ToString())
+ TipoCambio = If(Request("TipoCambio") Is Nothing, 1, Request("TipoCambio").ToString().ToEntero())
+ TCEspecifico = If(Request("TCEspecifico") Is Nothing, -1, Request("TCEspecifico").ToString().ToDouble())
+ RblTipoCambio.SelectedValue = TipoCambio.ToString()
+ LiEspecifico.InnerText = TCEspecifico.FormatoNumero()
+
+ Dim FechaICorte As DateTime
+ FechaICorte = If(Request("FechaICorte") Is Nothing, DateTime.MinValue, Request("FechaICorte").ToString().ToDate())
+ CargaDatos()
+ End Sub
+
+ Protected Sub CargaSucursales()
+ 'DdlSucursal.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
+ 'DdlSucursal.DataBind()
+ 'DdlSucursal.Items.Insert(0, New ListItem("Todos", "-1"))
+ 'DdlSucursal.SelectedValue = "-1"
+ DdlSubProyectoSaldar.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
+ DdlSubProyectoSaldar.DataBind()
+ End Sub
+
+
+
+ 'Protected Sub CargaVendedores()
+ ' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
+ ' DdlVendedor.DataBind()
+ ' DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1"))
+ 'End Sub
+
+ Protected Sub CargaDatos()
+ If TipoCambio = 3 AndAlso TxtEspecifico.Text <> "" Then
+ TCEspecifico = TxtEspecifico.Text.ToDouble()
+ Else
+ TCEspecifico = -1
+ End If
+
+ If TipoCambio <> 1 Then
+ CveMoneda = -1
+ End If
+
+ Dim FechaICorte As DateTime = MinFecha
+ 'If TxtFechaICorte.Text <> "" Then
+ ' FechaICorte = TxtFechaICorte.Text.ToDate()
+ 'Else
+ ' FechaICorte = DateTime.MinValue
+ 'End If
+
+ Dim FechaFCorte As DateTime = MaxFecha
+ 'If TxtFechaFCorte.Text <> "" Then
+ ' FechaFCorte = TxtFechaFCorte.Text.ToDate()
+ 'Else
+ ' FechaFCorte = DateTime.MaxValue
+ 'End If
+
+ Dim ObjVenta As New ClsVentas()
+ Dim CveCliente As Integer = -1
+
+
+
+ If ObjVenta.GetRepAnticiposNCIXCDetalle(CveCliente, -1, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, 1, -1, CveMoneda, FechaICorte, FechaFCorte, TipoCambio, TCEspecifico,
+ SaldoMayorA:=TxtSaldoMayorA.Text.ToDecimal, SaldoMenorA:=TxtSaldoMenorA.Text.ToDecimal) Then
+ GvDatosIXC.DataSource = ObjVenta.DtResultados
+ DtDatos = ObjVenta.DtResultados
+ End If
+
+ ObjVenta.Dispose()
+ GvDatosIXC.DataBind()
+ UpDatos.Update()
+
+ 'If TxtFechaFCorte.Text <> NowADS().ToShortDateString() AndAlso txtFechaI.Text <> "" Then
+ ' LnkHabilitarSaldar.Visible = False
+ ' LnkSaldar.Visible = False
+ 'Else
+ 'LnkHabilitarSaldar.Visible = True
+ ''End If
+
+ 'If LnkSaldar.Visible Then
+ ' HabilitarCheckbox()
+ 'End If
+
+ Tipo = -1
+ End Sub
+
+ Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
+ CargaDatos()
+ End Sub
+
+ Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
+ 'GenerarPDF("EXCEL")
+ End Sub
+
+ Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
+ 'GenerarPDF("PDF")
+ End Sub
+
+ 'Protected Sub GenerarPDF(Opcion As String)
+ ' Dim FechaI As String
+ ' If txtFechaI.Text = "" OrElse txtFechaI.Text = "__/__/____" Then
+ ' FechaI = "-1"
+ ' Else
+ ' FechaI = $" Fecha Inicial: {txtFechaI.Text}"
+ ' End If
+
+ ' Dim FechaF As String
+ ' If txtFechaF.Text = "" OrElse txtFechaF.Text = "__/__/____" Then
+ ' FechaF = "-1"
+ ' Else
+ ' FechaF = $" Fecha Final: {txtFechaF.Text}"
+ ' End If
+
+ ' Dim FechaICorte As String
+ ' If TxtFechaICorte.Text = "" OrElse TxtFechaICorte.Text = "__/__/____" Then
+ ' FechaICorte = ""
+ ' Else
+ ' FechaICorte = $" Fecha Inicial Corte: {TxtFechaICorte.Text}"
+ ' End If
+
+ ' Dim FechaFCorte As String
+ ' If TxtFechaFCorte.Text = "" OrElse TxtFechaFCorte.Text = "__/__/____" Then
+ ' FechaFCorte = ""
+ ' Else
+ ' FechaFCorte = $" Fecha Final Corte: {TxtFechaFCorte.Text}"
+ ' End If
+
+ ' Dim Sucursal As String
+ ' If DdlSucursal.SelectedValue <> "-1" Then
+ ' Sucursal = $" Sucursal: {DdlSucursal.SelectedItem.Text}"
+ ' Else
+ ' Sucursal = ""
+ ' End If
+
+ ' Dim Cliente As String = ""
+
+ ' Dim ConSaldo As String
+ ' If DdlConSaldo.SelectedValue <> "-1" Then
+ ' ConSaldo = $" Con Saldo: {DdlConSaldo.SelectedItem.Text}"
+ ' Else
+ ' ConSaldo = ""
+ ' End If
+
+ ' Dim Tipo2 As String
+ ' If DdlTipo.SelectedValue <> "-1" Then
+ ' Tipo2 = $" Tipo: {DdlTipo.SelectedItem.Text}"
+ ' Else
+ ' Tipo2 = ""
+ ' End If
+
+ ' If DtDatos.Rows.Count > 0 Then
+ ' Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
+ ' Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
+ ' Dim para As New List(Of ReportParameter) From {
+ ' New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
+ ' New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre),
+ ' New ReportParameter("FechaImpresion", NowADS().ToString()),
+ ' New ReportParameter("Tipo", Tipo.ToString()),
+ ' New ReportParameter("AgrupadoPor", $"Agrupado Por: {Cliente}{Sucursal}{ConSaldo}{Tipo2}{FechaI}{FechaF}{FechaICorte}{FechaFCorte}")
+ ' }
+
+ ' If Imagen.Exists Then
+ ' para.Add(New ReportParameter("LogoPath", logouri))
+ ' Else
+ ' para.Add(New ReportParameter("LogoPath", ""))
+ ' End If
+
+ ' ImprimirPDF("Empresas/Grales/Formatos/RepAnt-NC-IXCDetalle.rdlc", DtDatos, para, "Reporte de Anticipos - NCXAplicar - IXC Detalle", Opcion)
+ ' Else
+ ' Alert("No hay datos consultados", ModExtensiones.TipoMensaje.MsgAdvertencia)
+ ' End If
+ 'End Sub
+
+ Protected Sub GvDatosIXC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosIXC.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ Dim Css As String = "Texto"
+ Dim Liga As String = ""
+
+ If e.Row.DataKey("Tipo").ToEntero() < 1 Then
+ e.Row.CssClass = "SubTotales3"
+ e.Row.Cells(2).Text = e.Row.DBCampo("Moneda").ToString()
+ ElseIf e.Row.DataKey("CveCliente").ToEntero() < 1 Then
+ e.Row.CssClass = "SubTotales2"
+ Select Case e.Row.DataKey("Tipo").ToEntero()
+ Case 1
+ e.Row.Cells(2).Text = "Anticipos"
+ Case 2
+ e.Row.Cells(2).Text = "NC X Aplicar"
+ Case 3
+ e.Row.Cells(2).Text = "Ingresos X Comprobar"
+ End Select
+ ElseIf e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1 AndAlso e.Row.DataKey("CveVenta").ToEntero() < 1 AndAlso e.Row.DataKey("CveIE").ToEntero() < 1 Then
+ e.Row.CssClass = "Totales"
+ e.Row.Cells(2).Text = e.Row.DataKey("NombreComercial")
+ e.Row.Cells(7).Text = ""
+ ElseIf e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1 AndAlso e.Row.DataKey("CveVenta").ToEntero() > 0 Then
+ e.Row.CssClass = "SubTotales"
+ e.Row.Cells(2).Text = e.Row.DataKey("SerieFolio")
+ e.Row.Cells(3).Text = e.Row.DataKey("Fecha").ToDate().ToShortDateString()
+
+ 'If DdlTipo.SelectedValue.ToEntero() = 1 Then
+ ' e.Row.Cells(4).Text = "$" & e.Row.DataKey("SubTotal").FormatoNumero()
+ 'ElseIf DdlTipo.SelectedValue.ToEntero() = 2 Then
+ ' e.Row.Cells(4).Text = "$" & e.Row.DataKey("Total").FormatoNumero()
+ 'End If
+
+ Liga = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DataKey("CveVenta")}"
+ e.Row.Cells(2).Text = $"{e.Row.Cells(2).Text}"
+ ElseIf e.Row.DataKey("CveIE").ToEntero() > 0 AndAlso e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1 Then
+ e.Row.CssClass = "SubTotales"
+ e.Row.Cells(2).Text = e.Row.DataKey("SerieFolio")
+ e.Row.Cells(3).Text = e.Row.DataKey("Fecha").ToDate().ToShortDateString()
+ e.Row.Cells(4).Text = "$" & e.Row.DataKey("Total").FormatoNumero()
+ Liga = $"/Bancos/IE.aspx?&CveIE={e.Row.DataKey("CveIE")}"
+ e.Row.Cells(2).Text = $"{e.Row.Cells(2).Text}"
+ Else
+ e.Row.Cells(2).Text = e.Row.DataKey("SerieFolioAmortizacion")
+ e.Row.Cells(3).Text = e.Row.DataKey("FechaAmortizacion").ToDate().ToShortDateString()
+ e.Row.Cells(4).Text = "$" & e.Row.DataKey("ImporteAmortizacion").FormatoNumero()
+ e.Row.Cells(5).Text = "$" & e.Row.DataKey("ImporteAmortizacion").FormatoNumero()
+ e.Row.Cells(6).Text = "$" & e.Row.DataKey("SaldoAcumulativo").FormatoNumero()
+ Liga = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DataKey("CveVentaAmortizacion")}"
+ e.Row.Cells(2).Text = $"{e.Row.Cells(2).Text}"
+ End If
+
+
+ If (e.Row.DataKey("CveVenta").ToEntero() > 0 OrElse e.Row.DataKey("CveIE").ToEntero() > 0) AndAlso (e.Row.DataKey("CveVentaAmortizacion").ToEntero() < 1) Then
+ e.Row.FCCheckBox("Chk").Visible = True
+ End If
+
+ End If
+ End Sub
+
+#Region "SALDAR"
+
+ 'Private Sub HabilitarCheckbox()
+ ' For Each Gv As GridViewRow In GvDatosIXC.Rows
+ ' If (Gv.DataKey("CveVenta").ToEntero() > 0 OrElse Gv.DataKey("CveIE").ToEntero() > 0) AndAlso (Gv.DataKey("CveVentaAmortizacion").ToEntero() < 1) Then
+ ' Gv.FCCheckBox("Chk").Visible = True
+ ' End If
+ ' Next
+ 'End Sub
+
+ 'Protected Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click
+ ' HabilitarCheckbox()
+ ' LnkSaldar.Visible = True
+ ' LnkHabilitarSaldar.Visible = False
+ ' UpLnkAgregar.Update()
+ ' UpDatos.Update()
+ 'End Sub
+
+ Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) 'Handles LnkSaldar.Click
+ If Tipo = 1 Then
+ TxtConcepto.Text = "Cancelación de Anticipos"
+ ElseIf Tipo = 2 Then
+ TxtConcepto.Text = "Cancelación de Saldo de Nota de crédito"
+ ElseIf Tipo = 3 Then
+ TxtConcepto.Text = "Cancelación de Ingresos por Comprobar"
+ End If
+ Upsaldar.Update()
+ RegistraScript("$('#DivModalSaldar').modal();")
+ End Sub
+
+ Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) Handles BtnSaldar.Click
+ Dim ObjConta As New ClsContabilidad()
+ ObjConta.IniciaTransacSQL()
+ Dim CvePrePoliza As Integer = 0, CveVenta As Integer = -1, CveIE As Integer = -1
+ Dim Saldo As Decimal = 0
+ Dim SaldoAdmin As Decimal = 0
+ Dim ImporteTotalGasto As Decimal = 0
+ Dim MsgError As String = ""
+
+ CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepNCXAplicar", 6, 0, 0, 1, TxtFecha.Text.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 3)
+ Dim tMovto As Boolean = True
+ Dim tConceptoSaldar As Integer = 78
+
+ If CvePrePoliza > 0 Then
+ For Each Gv As GridViewRow In GvDatosIXC.Rows
+ Dim ConPreP As New ConceptosTipoSaldo()
+
+ If Gv.FCCheckBox("Chk").Checked Then
+ If Tipo = 2 Then
+ ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(6, Gv.DataKey("CveMoneda").ToEntero(), False, 2)
+ ElseIf Tipo = 1 Then
+ ConPreP.CveConcepto = 3
+ End If
+
+ 'If Tipo = 1 OrElse Tipo = 2 Then
+ If Gv.DataKey("CveVenta").ToEntero() > 0 Then
+ CveVenta = Gv.DataKey("CveVenta").ToEntero()
+ Saldo = -Gv.DataKey("Saldo").ToDecimal()
+ SaldoAdmin = Saldo
+
+ ElseIf Gv.DataKey("CveIE").ToEntero() > 0 Then
+ 'ElseIf Tipo = 3 Then
+ ConPreP = ClsPaginas.ObtenerCveConceptoPrePoliza(18, Gv.DataKey("CveMoneda").ToEntero(), True, 2)
+ CveIE = Gv.DataKey("CveIE").ToEntero()
+ Saldo = Gv.DataKey("Saldo").ToDecimal()
+ SaldoAdmin = Saldo
+ End If
+
+ Saldo = -Saldo ' invertimos el saldo para que se haga negativo para que sea Abono
+
+ ImporteTotalGasto += Saldo
+
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, SaldoAdmin, Saldo, ConPreP.CveConcepto, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero()) Then
+ MsgError = "Ocurrio un error al saldar el movimiento"
+ Exit For
+ End If
+
+ If Gv.DataKey("CveMoneda").ToEntero() > 1 Then
+ Dim ImporteMN As Decimal = (Saldo * Gv.DataKey("TipoCambio").ToDecimal() - Saldo).RoundSQL()
+ ImporteTotalGasto += ImporteMN
+
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, Saldo, ImporteMN, ConPreP.CveConceptoComplementario, Gv.DataKey("SerieFolio").ToString(), TxtConcepto.Text, CveIE, CveVenta, CveCliente:=Gv.DataKey("CveCliente").ToEntero(), ImporteME:=Saldo, TipoCambio:=Gv.DataKey("TipoCambio").ToDecimal()) Then
+ MsgError = "Ocurrio un error al saldar el movimiento"
+ Exit For
+ End If
+ End If
+ End If
+ Next
+
+ If ImporteTotalGasto <> 0 Then
+ ImporteTotalGasto *= -1 ' se invierte el valor, para cuadre de prepoliza
+
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tMovto, ImporteTotalGasto, ImporteTotalGasto, tConceptoSaldar, "", TxtConcepto.Text, CveIE, CveVenta, CveSubProyecto:=DdlSubProyectoSaldar.SelectedValue.ToEntero()) Then
+ MsgError = "Ocurrio un error al saldar el movimiento"
+ End If
+ Else
+ MsgError = "Poliza no insertada"
+ End If
+ End If
+
+ If MsgError = "" Then
+ ObjConta.Commit()
+ Dim Msg As String = "Los movimientos se saldaron correctamente."
+ Msg &= $"
Ver Póliza "
+ Alert(Msg)
+ Else
+ ObjConta.RollBack()
+ Alert(MsgError, ModExtensiones.TipoMensaje.MsgError)
+ End If
+
+ 'LnkSaldar.Visible = False
+ 'LnkHabilitarSaldar.Visible = True
+ CargaDatos()
+ 'UpLnkAgregar.Update()
+ ObjConta.Dispose()
+ 'RegistraScript("$('#DivModalSaldar').modal('hide');")
+ TxtFecha.Text = DateTime.Today.ToString()
+ Upsaldar.Update()
+ End Sub
+
+#End Region
+
+#Region "TIPO DE CAMBIO"
+
+ Protected Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click
+ CargaDatos()
+ RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"))
+ End Sub
+
+ Protected Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
+ TipoCambio = RblTipoCambio.SelectedValue.ToEntero()
+
+ If TipoCambio = 3 Then
+ LiEspecifico.Visible = True
+ TCEspecifico = GlobalTipoCambio(NowADS()).ToString().ToDouble()
+ TxtEspecifico.Text = TCEspecifico.ToString()
+ Else
+ LiEspecifico.Visible = False
+ End If
+
+ UpBodyTipoCambio.Update()
+ End Sub
+
+#End Region
+
+
+#End Region
+
+End Class
diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx
index ce4071fea..8711161f6 100644
--- a/Ventas/ProductosServicios.aspx
+++ b/Ventas/ProductosServicios.aspx
@@ -2350,7 +2350,7 @@
');
}
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 8e3a9c230..ecce18717 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -23919,7 +23919,7 @@ Partial Class Ventas
Dim TienePagos As Boolean = ((Not (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0)) AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0)) OrElse AmortizacionNC > 0
'SI LA VENTA ES NUEVA VALIDAR TAMBIEN LOS PAGOS DE CONTADO
- If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ((CveVenta <= 0 OrElse EsCreaApartirDe OrElse TipoDoctoViejo = "Cot") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant")) Then
+ If (UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.CveEmpresa = 197) AndAlso ((CveVenta <= 0 OrElse EsCreaApartirDe OrElse TipoDoctoViejo = "Cot") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant")) Then
If Not PermiteCredito AndAlso Not TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
If MostrarAlertas Then
@@ -33653,18 +33653,47 @@ Partial Class Ventas
Private Sub BtnCargarPSAdicionales_Click(sender As Object, e As EventArgs) Handles BtnCargarPSAdicionales.Click
Dim CvePS = HdnCvePSComparar.Value.ToEntero()
If CvePS > 0 Then
+ Dim DtPSAdicionales As DataTable = Nothing
+
Dim ObjProductosServicios As New ClsProductosServicios()
If ObjProductosServicios.GetPSAdicionales(CvePS, UsuarioActual.CveEmpresa) Then
- GvPSAdicionales.DataSource = ObjProductosServicios.DtResultados.FiltraParametros($"Tipo={HdnTipoPSComparar.Value}")
+ DtPSAdicionales = ObjProductosServicios.DtResultados.FiltraParametros($"Tipo={HdnTipoPSComparar.Value}")
End If
ObjProductosServicios.Dispose()
- If HdnTipoPSComparar.Value = "1" Then
- LtlNombreModalPS.Text = "Productos y/o servicios complementarios"
- ElseIf HdnTipoPSComparar.Value = "2" Then
- LtlNombreModalPS.Text = "Productos y/o servicios similares"
+ If DtPSAdicionales IsNot Nothing Then
+ DtPSAdicionales.Columns.Add(New DataColumn("Precio", GetType(String)))
+
+ For Each Row As DataRow In DtPSAdicionales.Rows
+ Dim DrPSAdicional As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=Row("CvePSAdicional").ToString().ToEntero()).FiltroPrimero("")
+ If DrPSAdicional IsNot Nothing Then
+ 'SUGIERE PRECIO
+ Dim PrecioSugerido As Decimal = 0
+ Dim tPrecioSugerido As Decimal = 0
+ tPrecioSugerido = DrPSAdicional("Precio").ToString().ToDecimal
+ Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(Row("CvePSAdicional").ToString().ToEntero(), DrPSAdicional("CveClasificacion").ToString().ToEntero())
+
+ PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
+
+ If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
+
+ Row("Precio") = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
+ End If
+ Next
End If
+ GvPSAdicionales.DataSource = DtPSAdicionales
+
+ Dim DrPSPadre = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
+ If DrPSPadre IsNot Nothing Then
+ If HdnTipoPSComparar.Value = "1" Then
+ LtlNombreModalPS.Text = $"Productos y/o servicios adicionales. PS:{DrPSPadre("CodigoPS")}"
+ ElseIf HdnTipoPSComparar.Value = "2" Then
+ LtlNombreModalPS.Text = $"Productos y/o servicios similares PS:{DrPSPadre("CodigoPS")}"
+ End If
+ End If
+
+
GvPSAdicionales.DataBind()
UpSimilares.Update()
RegistraScript("$('#DivSimilares').modal({backdrop: 'static', keyboard: false });")
@@ -33696,13 +33725,21 @@ Partial Class Ventas
For Each Row As GridViewRow In GvPSAdicionales.Rows
If Row.RowType = DataControlRowType.DataRow Then
If Row.FCCheckBox("chkPSAdicional").Checked Then
- Dim CvePS As Integer = Row.DataKey("CvePS").ToEntero()
+ 'LIMPIAR LAS VARIABLES
+ TxtCantidad.Text = ""
+ TxtPrecio.Text = ""
+ HdnPS.Value = "-1"
+ DdlPS.SelectedValue = "-1"
+ DdlPS.SelectedText = "-"
+
+ Dim CvePS As Integer = Row.DataKey("CvePSAdicional").ToEntero()
HdnPS.Value = CvePS.ToString()
DdlPS.SelectedValue = CvePS.ToString()
DdlPS.SelectedText = Row.DataKey("CodigoPS")
TxtCantidad.Text = Row.FCTextBox("TxtCantidad").Text
+ TxtPrecio.Text = Row.DataKey("Precio")
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS IsNot Nothing Then
@@ -33720,6 +33757,13 @@ Partial Class Ventas
HdnTipoPSComparar.Value = "-1"
HdnCvePSComparar.Value = "-1"
+ TxtCantidad.Text = ""
+ TxtPrecio.Text = ""
+ HdnPS.Value = "-1"
+ DdlPS.SelectedValue = "-1"
+ DdlPS.SelectedText = "-"
+
+ RegistraScript("$('#DivSimilares').modal('hide');abrirDdlPS();", "A2")
End Sub
#Region "U S A D O S"