|
|
|
|
@@ -69,6 +69,14 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
ViewState("DtIngresos") = value
|
|
|
|
|
End Set
|
|
|
|
|
End Property
|
|
|
|
|
Private Property DtPrestamos As DataTable
|
|
|
|
|
Get
|
|
|
|
|
Return CType(ViewState("DtPrestamos"), DataTable)
|
|
|
|
|
End Get
|
|
|
|
|
Set(value As DataTable)
|
|
|
|
|
ViewState("DtPrestamos") = value
|
|
|
|
|
End Set
|
|
|
|
|
End Property
|
|
|
|
|
|
|
|
|
|
Private Property IdCuentaBancaria As Integer
|
|
|
|
|
Get
|
|
|
|
|
@@ -164,15 +172,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
End Set
|
|
|
|
|
End Property
|
|
|
|
|
|
|
|
|
|
'Private Property CveIESustitucion As Integer
|
|
|
|
|
' Get
|
|
|
|
|
' Return ViewState("CveIESustitucion").ToString.ToEntero
|
|
|
|
|
' End Get
|
|
|
|
|
' Set(value As Integer)
|
|
|
|
|
' ViewState("CveIESustitucion") = value
|
|
|
|
|
' End Set
|
|
|
|
|
'End Property
|
|
|
|
|
|
|
|
|
|
Private Property CFDIRelacionadoSustitucion As String
|
|
|
|
|
Get
|
|
|
|
|
If ViewState("CFDIRelacionadoSustitucion") Is Nothing Then
|
|
|
|
|
@@ -248,16 +247,11 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
ViewState("IdCtaContMonedaExtranjeraAnticipo") = 0
|
|
|
|
|
ViewState("IdCtaContMonedaComplementariaAnticipo") = 0
|
|
|
|
|
|
|
|
|
|
ViewState("CveIESustitucion") = IfNull(Request("CveIESustitucion"), "-1").ToString.ToEntero
|
|
|
|
|
DdlProveedorIntermediario.setEsWebService(True)
|
|
|
|
|
DdlProveedorIntermediario.Attributes.Add("data-metodo", "getproveedores")
|
|
|
|
|
|
|
|
|
|
FechaCorteIE = DateTime.Now
|
|
|
|
|
|
|
|
|
|
'If CveIESustitucion > 0 Then
|
|
|
|
|
' CargaIESustituir()
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
Dim dia As Integer = If(UsuarioActual.CveEmpresa = 13, Now.Day - 1, Now.Day)
|
|
|
|
|
Fecha = (dia.ToString + "/" + Now.Month.ToString + "/" + Now.Year.ToString).ToDate
|
|
|
|
|
|
|
|
|
|
@@ -355,7 +349,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
CargaCuentas()
|
|
|
|
|
CargaTipoTransaccion()
|
|
|
|
|
|
|
|
|
|
'TxtFechaDocumento.Text = IIf(CveIESustitucion > 0, FechaCorteIE.ToShortDateString, Now.ToShortDateString).ToString
|
|
|
|
|
TxtFechaDocumento.Text = Now.ToShortDateString.ToString
|
|
|
|
|
|
|
|
|
|
TxtAboneA.Enabled = False
|
|
|
|
|
@@ -390,6 +383,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
'Dim CveClasificacionCol6 As Integer = 21572
|
|
|
|
|
'Dim CveClasificacionCol7 As Integer = 21571
|
|
|
|
|
divAnticipo.Visible = True
|
|
|
|
|
divPrestamo.Visible = True
|
|
|
|
|
|
|
|
|
|
GvCxC.Columns(17).HeaderText = "Comisión<br/>Venta" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol1).FiltroPrimeroValor("Clasificacion").Substring(0, 10)
|
|
|
|
|
GvCxC.Columns(18).HeaderText = "Gastos<br/>Manejo" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol2).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
|
|
|
|
|
@@ -406,6 +400,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
DvLiquidacion2.Visible = True
|
|
|
|
|
|
|
|
|
|
DtIngresos = CargaIngresos(2)
|
|
|
|
|
DtPrestamos = CargaPrestamos(1)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
CargaDatos(tCveMoneda)
|
|
|
|
|
@@ -422,18 +417,15 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Dim FechaI As String = IfNull(Request("FechaI"), "-1")
|
|
|
|
|
Dim FechaF As String = IfNull(Request("FechaF"), "-1")
|
|
|
|
|
|
|
|
|
|
'Dim FechaCorte As Date = IIf(CveIESustitucion > 0, (FechaCorteIE.ToDate).ToShortDateString, DateTime.Now.AddYears(1).ToShortDateString).ToString.ToDate
|
|
|
|
|
Dim FechaCorte As Date = DateTime.Now.AddYears(1).ToShortDateString.ToString.ToDate
|
|
|
|
|
|
|
|
|
|
Dim SumDescuentoProntoPago As Double = 0.0
|
|
|
|
|
'If Mov.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, FechaI, FechaF, pCveMoneda, CveSubProyecto, UsuarioActual.CveEmpresa, CveClienteSucursal, FechaCorte:=FechaCorte, CveIESustitucion:=CveIESustitucion) Then
|
|
|
|
|
If Mov.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, FechaI, FechaF, pCveMoneda, CveSubProyecto, UsuarioActual.CveEmpresa, CveClienteSucursal, FechaCorte:=FechaCorte) Then
|
|
|
|
|
Dim TmpCxCAux As DataTable
|
|
|
|
|
TmpCxCAux = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio")
|
|
|
|
|
SumDescuentoProntoPago = TmpCxCAux.SUM("DescuentoProntoPago")
|
|
|
|
|
|
|
|
|
|
GvCxC.DataSource = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio")
|
|
|
|
|
|
|
|
|
|
CveMoneda = pCveMoneda
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
@@ -799,12 +791,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
'02-05-2018 MANDAMOS CANCELAR EL COMPLEMENTO A SUSTITUIR
|
|
|
|
|
Dim ErrorCancelarIE As Boolean = False
|
|
|
|
|
|
|
|
|
|
'If CveIESustitucion > 0 Then
|
|
|
|
|
' ErrorCancelarIE = CancelarIE()
|
|
|
|
|
' If ErrorCancelarIE Then
|
|
|
|
|
' Exit Sub
|
|
|
|
|
' End If
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
Dim ObjIE As New ClsBancos()
|
|
|
|
|
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
|
|
|
|
|
@@ -856,11 +842,8 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Dim CveProvIntermediario As Integer
|
|
|
|
|
If ChkProveedorIntermediario.Checked Then
|
|
|
|
|
CveProvIntermediario = If(DdlProveedorIntermediario.SelectedValue.ToEntero <= 0, -1, DdlProveedorIntermediario.SelectedValue.ToEntero)
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveIESustitucion:=CveIESustitucion, CveProveedorIntermediario:=CveProvIntermediario)
|
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveIESustitucion:=-1, CveProveedorIntermediario:=CveProvIntermediario)
|
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text.Trim, TxtImporte.Text.ToDecimal, GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", "CveCuenta = " & DdlCuenta.SelectedValue).ToEntero, TipoCambio, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaDeposito:=CveCuentaDeposito, CveProveedorIntermediario:=CveProvIntermediario)
|
|
|
|
|
Else
|
|
|
|
|
If RblTipoPago.SelectedValue.Contiene("3") Then
|
|
|
|
|
CveIE = DdlIngreso.SelectedValue.ToEntero
|
|
|
|
|
@@ -878,7 +861,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
filemove.FilesMove(CveIE.ToString, String.Format("{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'inserto los movimientos de la conta para abonar al saldo
|
|
|
|
|
If CvePrePoliza > 0 Then
|
|
|
|
|
|
|
|
|
|
@@ -895,7 +877,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Dim CveSubProyectoContabilizar As Integer = -1
|
|
|
|
|
Dim CveSubProyectoMaximo As Integer = -1
|
|
|
|
|
Dim CuentasContablesInvalidas As New StringBuilder
|
|
|
|
|
Dim CuentasContablesInvalidasSIG As New StringBuilder
|
|
|
|
|
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
|
|
|
|
|
Dim TipoCambioFluctuacion As Decimal = 1
|
|
|
|
|
Dim FechaUltimaFluctuacion As Date = MinFecha
|
|
|
|
|
@@ -903,15 +884,41 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Dim tFecha As Date = TxtFechaDocumento.Text.ToDate
|
|
|
|
|
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
|
|
|
|
|
|
|
|
|
Dim ImportePrestamo As Decimal = 0
|
|
|
|
|
Dim TCPrestamo As Decimal = 0
|
|
|
|
|
If TxtPrestamoImporte.Text.ToDecimal <> 0 Then 'amortización del préstamo
|
|
|
|
|
ImportePrestamo = TxtPrestamoImporte.Text.ToDecimal
|
|
|
|
|
Dim tCveProv As Integer = DtPrestamos.FiltroPrimeroValor("CveProveedor", "CveIE=" & DdlPrestamo.SelectedValue)
|
|
|
|
|
Dim tFechaIE As Date = DtPrestamos.FiltroPrimeroValor("FechaDocumento", "CveIE=" & DdlPrestamo.SelectedValue).ToDate
|
|
|
|
|
TCPrestamo = DtPrestamos.FiltroPrimeroValor("TipoCambio", "CveIE=" & DdlPrestamo.SelectedValue).ToDecimal
|
|
|
|
|
If CveMoneda = 1 Then
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImportePrestamo, ImportePrestamo, 57, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=tipoCambioPago, CveProveedor:=tCveProv) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
|
|
|
|
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then
|
|
|
|
|
If tFechaIE <= UltimaFluctuacion.FechaFluctuacion Then
|
|
|
|
|
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
|
|
|
|
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
|
|
|
|
TCPrestamo = UltimaFluctuacion.TCFluctuacion
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImportePrestamo, ImportePrestamo, 349, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=TCPrestamo, ImporteME:=ImportePrestamo, CveProveedor:=tCveProv) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImportePrestamo, ((ImportePrestamo * TCPrestamo) - ImportePrestamo).RoundSQL, 350, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=TCPrestamo, ImporteME:=ImportePrestamo, CveProveedor:=tCveProv) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If TxtPrestamoIntereses.Text.ToDecimal <> 0 AndAlso MsgError = "" Then
|
|
|
|
|
Dim ImporteIntereses As Decimal = (TxtPrestamoIntereses.Text.ToDecimal * tipoCambioPago).RoundSQL
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteIntereses, ImporteIntereses, 6, TxtFolio.Text, TxtObservaciones.Text, 0, CveIE:=DdlPrestamo.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto, TipoCambio:=tipoCambioPago, CveClasificacion:=21927) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
|
|
|
|
dtConceptos = ObjMov.DtResultados
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'inserto las ventas que voy a pagar
|
|
|
|
|
@@ -920,11 +927,52 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
If gvr.FCCheckBox("Chk").Checked Then
|
|
|
|
|
|
|
|
|
|
Dim ObjFactura As Modelos.Factura = Nothing
|
|
|
|
|
Dim EsAnticipoEspecial As Boolean = False
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
|
|
|
|
ObjFactura = New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim VentaActual As New Venta
|
|
|
|
|
VentaActual.CveVenta = gvr.DataKey("CveVenta").ToEntero
|
|
|
|
|
VentaActual.Fecha = gvr.DataKey("Fecha").ToDate
|
|
|
|
|
VentaActual.CveCliente = gvr.DataKey("CveCliente").ToEntero
|
|
|
|
|
VentaActual.CveMoneda = gvr.DataKey("CveMoneda").ToEntero
|
|
|
|
|
VentaActual.SerieFolio = gvr.DataKey("SerieFolio")
|
|
|
|
|
VentaActual.ClienteNombre = NombreComercial
|
|
|
|
|
VentaActual.TC = gvr.DataKey("TipoCambio").ToDecimal
|
|
|
|
|
VentaActual.Total = gvr.DataKey("Original").ToDecimal
|
|
|
|
|
VentaActual.IVA = gvr.DataKey("IVA").ToDecimal
|
|
|
|
|
VentaActual.IEPS = gvr.DataKey("IEPS").ToDecimal
|
|
|
|
|
VentaActual.RetIVA = gvr.DataKey("RetIVA").ToDecimal
|
|
|
|
|
VentaActual.RetISR = gvr.DataKey("RetISR").ToDecimal
|
|
|
|
|
|
|
|
|
|
VentaActual.PorcentajeIVA = gvr.DataKey("PorcentajeIVA").ToDecimal
|
|
|
|
|
VentaActual.UsuarioActual = UsuarioActual
|
|
|
|
|
VentaActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
|
|
|
|
|
|
|
|
|
|
'Importe de pago
|
|
|
|
|
Dim Pago As New VentaPago
|
|
|
|
|
Pago.Fecha = TxtFechaDocumento.Text.ToDate
|
|
|
|
|
Pago.CveIE = CveIE
|
|
|
|
|
Pago.CveMonedaPago = CveMoneda
|
|
|
|
|
Pago.ImportePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
|
|
|
Pago.ImportePagoVenta = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
|
|
|
|
Pago.Referencia = TxtFolio.Text
|
|
|
|
|
|
|
|
|
|
If RblTipoPago.SelectedValue = "3" Then Pago.TipoPago = "I"
|
|
|
|
|
|
|
|
|
|
'Tipos de cambio
|
|
|
|
|
If Pago.CveMonedaPago = 1 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos
|
|
|
|
|
Pago.TCPago = TxtTC.Text.ToDecimal
|
|
|
|
|
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
|
|
|
|
|
Pago.TCPago = IIf(TxtTCDolaresDolares.Visible, TxtTCDolaresDolares.Text.ToDecimal, TxtTCDolares.Text.ToDecimal)
|
|
|
|
|
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
|
|
|
|
|
Pago.TCPago = TxtTCDolares.Text.ToDecimal
|
|
|
|
|
End If
|
|
|
|
|
tipoCambioPago = Pago.TCPago
|
|
|
|
|
|
|
|
|
|
If gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
|
|
|
|
|
|
|
|
|
|
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
|
|
|
|
tipoCambioPago = 1
|
|
|
|
|
@@ -946,61 +994,14 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'PARA EMITIR COMPLEMENTO PAGO
|
|
|
|
|
CveVentasPago.Add(gvr.DataKey("CveVenta").ToEntero)
|
|
|
|
|
SeriesPago.Add(gvr.DataKey("SerieFolio"))
|
|
|
|
|
If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then
|
|
|
|
|
EsAnticipoEspecial = True
|
|
|
|
|
Pago.AplicaTraslado = False
|
|
|
|
|
Dim IdCtaContable As Integer = If(EsAnticipoEspecial, IdCtaAnticipo, IdCuentaCliente)
|
|
|
|
|
If VentaActual.CveMoneda = 2 Then IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaExtranjeraAnticipo, IdCtaContMonedaExtranjera)
|
|
|
|
|
|
|
|
|
|
Dim tipoCambioVentaDiferenciaCambiaria As Double = 1
|
|
|
|
|
Dim EsAnticipoEspecial As Boolean = False
|
|
|
|
|
|
|
|
|
|
If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then EsAnticipoEspecial = True
|
|
|
|
|
Dim FluctuacionAnticipo As Decimal = 0
|
|
|
|
|
|
|
|
|
|
If dtConceptos IsNot Nothing Then
|
|
|
|
|
FluctuacionAnticipo = 0 ' se limpia la fluctuación por cada factura.
|
|
|
|
|
For Each Row As DataRow In dtConceptos.Rows
|
|
|
|
|
|
|
|
|
|
Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero
|
|
|
|
|
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False)
|
|
|
|
|
Dim ImporteMovimiento As Decimal = 0
|
|
|
|
|
Dim ImporteMN As Decimal
|
|
|
|
|
Dim FechaMovimiento As Date = TxtFechaDocumento.Text
|
|
|
|
|
Dim IdCtaContable As Integer = 0
|
|
|
|
|
Dim ConceptoMovimiento As String = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreComercial, gvr.DataKey("SerieFolio").ToString, TxtFolio.Text.Trim)
|
|
|
|
|
Dim Referencia As String = gvr.DataKey("SerieFolio").ToString
|
|
|
|
|
Dim CveSubProyecto As Integer = gvr.DataKey("CveSubProyecto").ToEntero
|
|
|
|
|
CveSubProyectoContabilizar = -1
|
|
|
|
|
Dim PorcentajeImpuesto As Decimal = 0
|
|
|
|
|
If CveSubProyecto > 0 Then CveSubProyectoMaximo = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
Select Case ConceptoContable
|
|
|
|
|
Case 2 'Pago Cliente
|
|
|
|
|
If gvr.DataKey("CveMoneda").ToEntero > 1 Then ConceptoContable = 292
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal).RoundSQL
|
|
|
|
|
ImporteMN = ImporteMovimiento '(ImporteMovimiento * tipoCambioVentaValuacion).RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioVentaValuacion
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
|
|
|
|
IdCtaContable = If(EsAnticipoEspecial, IdCtaAnticipo, IdCuentaCliente)
|
|
|
|
|
ConceptoContable = If(EsAnticipoEspecial, 3, ConceptoContable)
|
|
|
|
|
Else
|
|
|
|
|
ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria)
|
|
|
|
|
If ImporteMovimiento <> 0 Then
|
|
|
|
|
ImporteMN = ImporteMovimiento
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaExtranjeraAnticipo, IdCtaContMonedaExtranjera)
|
|
|
|
|
ConceptoContable = If(EsAnticipoEspecial, 3, ConceptoContable)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If EsAnticipoEspecial Then
|
|
|
|
|
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Referencia, 2, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMN, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Referencia, 95, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMN, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=False) Then
|
|
|
|
|
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, VentaActual.SerieFolio, 3, VentaActual.SerieFolio, IdCtaContable, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveSubProyecto:=CveSubProyectoContabilizar, CveCliente:=ViewState("CveCliente").ToString.ToEntero, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, Contabilizable:=False) Then
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, VentaActual.SerieFolio, 95, VentaActual.SerieFolio, IdCtaContable, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveSubProyecto:=CveSubProyectoContabilizar, CveCliente:=ViewState("CveCliente").ToString.ToEntero, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, Contabilizable:=False) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
@@ -1009,7 +1010,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola
|
|
|
|
|
|
|
|
|
|
Dim FluctuacionAnticipo As Decimal = 0
|
|
|
|
|
Dim ImporteLiq1 As Decimal = gvr.FCTextBox("TxtLiqCol1").Text.ToDecimal
|
|
|
|
|
Dim ImporteLiq2 As Decimal = gvr.FCTextBox("TxtLiqCol2").Text.ToDecimal
|
|
|
|
|
Dim ImporteLiq3 As Decimal = gvr.FCTextBox("TxtLiqCol3").Text.ToDecimal
|
|
|
|
|
@@ -1077,20 +1078,18 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If ImporteLiq8 <> 0 Then
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
Exit For
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza" : Exit For
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If ImporteLiq9 <> 0 Then
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq9, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq9 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol9, ImporteME:=If(CveMoneda > 1, ImporteLiq9, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
Exit For
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq9, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq9 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol9, ImporteME:=If(CveMoneda > 1, ImporteLiq9, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza" : Exit For
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then
|
|
|
|
|
If MsgError = "" AndAlso gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then
|
|
|
|
|
Dim TCP As Decimal = 0
|
|
|
|
|
Dim FolioPago As String = " "
|
|
|
|
|
If DtIngresos IsNot Nothing Then
|
|
|
|
|
@@ -1106,11 +1105,11 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo
|
|
|
|
|
FluctuacionAnticipo = ((TCP - tipoCambioVentaValuacion) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL
|
|
|
|
|
FluctuacionAnticipo = ((TCP - tipoCambioPago) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL
|
|
|
|
|
MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero > 0 Then
|
|
|
|
|
If MsgError = "" AndAlso gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero > 0 Then
|
|
|
|
|
Dim TCP As Decimal = 0
|
|
|
|
|
Dim FolioPago As String = " "
|
|
|
|
|
If DtIngresos IsNot Nothing Then
|
|
|
|
|
@@ -1127,351 +1126,42 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo
|
|
|
|
|
FluctuacionAnticipo += ((TCP - tipoCambioVentaValuacion) * gvr.FCTextBox("TxtAmort2").Text.ToDecimal).RoundSQL
|
|
|
|
|
FluctuacionAnticipo += ((TCP - tipoCambioPago) * gvr.FCTextBox("TxtAmort2").Text.ToDecimal).RoundSQL
|
|
|
|
|
MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti2").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort2").Text.ToDecimal, TCP, tipoCambioVentaValuacion, gvr.DataKey("CveVenta").ToEntero, gvr.DataKey("SerieFolio").ToString, FolioPago)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Case 8 'Ret IVA x Trasladar
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
|
|
|
|
|
Exit Select
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioVenta
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
If IdCtaContRetIVA <> 0 Then
|
|
|
|
|
IdCtaContable = IdCtaContRetIVA
|
|
|
|
|
Else
|
|
|
|
|
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
If ImportePrestamo <> 0 Then
|
|
|
|
|
If TCPrestamo > 0 Then
|
|
|
|
|
FluctuacionAnticipo += ((TCPrestamo - tipoCambioPago) * ImportePrestamo).RoundSQL
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
Pago.ImporteFluctuacionAdicional = FluctuacionAnticipo
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Case 313 'Ret Iva Servicios
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioVenta
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
'OBTENER CUENTAS
|
|
|
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
If MsgError = "" AndAlso AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Case 9 'Ret ISR x Trasladar
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioVenta
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
If IdCtaContRetISR <> 0 Then
|
|
|
|
|
IdCtaContable = IdCtaContRetISR
|
|
|
|
|
Else
|
|
|
|
|
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Case 13 'Iva por Trasladar
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioVenta
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
|
|
|
|
|
Dim IdCtaIVAXTrasladar As Integer = 0
|
|
|
|
|
|
|
|
|
|
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
|
|
|
|
IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
|
|
|
|
|
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
Case 62 'Ret IVA Trasladado
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
|
|
|
|
|
Exit Select
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
|
|
|
|
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
If IdCtaContRetIVA <> 0 Then
|
|
|
|
|
IdCtaContable = IdCtaContRetIVA
|
|
|
|
|
Else
|
|
|
|
|
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Case 314 'Ret Iva Servicios Traslado
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
|
|
|
|
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
'OBTENER CUENTAS
|
|
|
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Case 63 'Ret ISR Trasladado
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
|
|
|
|
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
If IdCtaContRetISR <> 0 Then
|
|
|
|
|
IdCtaContable = IdCtaContRetISR
|
|
|
|
|
Else
|
|
|
|
|
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
If ObjMov.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Case 61 'Iva Trasladado
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
|
|
|
|
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
|
|
|
|
|
Dim IdCtaIVATrasladado As Integer = 0
|
|
|
|
|
|
|
|
|
|
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
|
|
|
|
IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
|
|
|
|
|
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
Case 38 'IEPS por trasladar
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioVenta
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
|
|
|
|
|
Case 39 'IEPS Trasladado
|
|
|
|
|
If EsAnticipoEspecial Then Exit Select
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL
|
|
|
|
|
ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL
|
|
|
|
|
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
|
|
|
|
|
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado
|
|
|
|
|
Case 64 'Ganancia
|
|
|
|
|
If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
|
|
|
|
|
|
|
|
|
|
Dim CveMonedaVenta As Integer = gvr.DataKey("CveMoneda").ToEntero
|
|
|
|
|
Dim tImporteVenta, tImportePago As Decimal
|
|
|
|
|
Dim Diferencia As Decimal = 0
|
|
|
|
|
ImporteMovimiento = 0
|
|
|
|
|
Dim ImportePago As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then
|
|
|
|
|
ImportePago = ImportePago - gvr.FCTextBox("TxtAmort").Text.ToDecimal - gvr.FCTextBox("TxtAmort2").Text.ToDecimal
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal)
|
|
|
|
|
|
|
|
|
|
If CveMonedaVenta = 1 And CveMoneda <> 1 Then
|
|
|
|
|
'factura pesos, pago en dolares
|
|
|
|
|
tImporteVenta = ImportePago
|
|
|
|
|
tImportePago = ((ImportePago * tipoCambioVenta / tipoCambioPago).RoundSQL * tipoCambioPago).RoundSQL
|
|
|
|
|
ElseIf CveMonedaVenta <> 1 And CveMoneda <> 1 Then
|
|
|
|
|
'factura dolares, pago en dolares
|
|
|
|
|
tImporteVenta = (ImportePago * tipoCambioVentaValuacion).RoundSQL
|
|
|
|
|
tImportePago = (ImportePago * tipoCambioPago).RoundSQL
|
|
|
|
|
ElseIf CveMonedaVenta <> 1 And CveMoneda = 1 Then
|
|
|
|
|
'factura dolares, pago en pesos
|
|
|
|
|
tImporteVenta = (ImportePago * tipoCambioVentaValuacion).RoundSQL
|
|
|
|
|
tImportePago = (ImportePago * tipoCambioPago).RoundSQL
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'If FluctuacionAnticipo <> 0 Then
|
|
|
|
|
' tImportePago += FluctuacionAnticipo
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
If tImporteVenta <> tImportePago Then
|
|
|
|
|
If tImporteVenta < tImportePago Then
|
|
|
|
|
ConceptoContable = 64
|
|
|
|
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
|
|
|
|
TipoMovimiento = True
|
|
|
|
|
'CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
|
|
|
|
|
Else
|
|
|
|
|
ConceptoContable = 65
|
|
|
|
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
|
|
|
|
TipoMovimiento = False
|
|
|
|
|
' CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
|
|
|
|
|
End If
|
|
|
|
|
Diferencia = tImporteVenta - tImportePago
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
' si tiene funcionalidad para que tome el TC de pago, que solo afecta a los impuestos
|
|
|
|
|
If FuncionalidadFluctuacionImpuestos Then
|
|
|
|
|
Dim TCImpuestos As Decimal = tipoCambioPago
|
|
|
|
|
|
|
|
|
|
Diferencia -= (((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IVA
|
|
|
|
|
Diferencia -= (((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetIVA
|
|
|
|
|
Diferencia -= (((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el RetISR
|
|
|
|
|
Diferencia -= (((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaValuacion) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos)) 'Añadimos la diferencia de ganancia en el IEPS
|
|
|
|
|
Diferencia = Diferencia.RoundSQL
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = Math.Abs(Diferencia)
|
|
|
|
|
ImporteMN = ImporteMovimiento
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
Else
|
|
|
|
|
ImporteMovimiento = 0
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Case 78 'Otros Ingresos
|
|
|
|
|
If ChkAjusteOI.Checked Then
|
|
|
|
|
ImporteMovimiento = gvr.FCTextBox("TxtComision").Text.ToDecimal
|
|
|
|
|
ImporteMN = ImporteMovimiento * tipoCambioPago.RoundSQL
|
|
|
|
|
|
|
|
|
|
If gvr.FCTextBox("TxtComision").Text.ToDecimal < 0 Then
|
|
|
|
|
TipoMovimiento = False
|
|
|
|
|
ImporteMovimiento = ImporteMovimiento * -1
|
|
|
|
|
ImporteMN = ImporteMN * -1
|
|
|
|
|
Else
|
|
|
|
|
TipoMovimiento = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ImporteMovimiento = ImporteMovimiento.RoundSQL
|
|
|
|
|
ImporteMN = ImporteMN.RoundSQL
|
|
|
|
|
TipoCambioGeneral = tipoCambioPago
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
|
|
|
|
|
IdCtaContable = UsuarioActual.Empresa.IdCuentaOtrosIngresos
|
|
|
|
|
|
|
|
|
|
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Case 134 'Pago Intermediario
|
|
|
|
|
' Case 134 'Pago Intermediario
|
|
|
|
|
If RblTipoPago.SelectedValue = "2" Then
|
|
|
|
|
ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - gvr.FCTextBox("TxtComision").Text.ToDecimal
|
|
|
|
|
ImporteMN = Math.Round(ImporteMovimiento * tipoCambioPago, 2)
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyecto
|
|
|
|
|
Dim ImporteMovimiento As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - gvr.FCTextBox("TxtComision").Text.ToDecimal
|
|
|
|
|
Dim ImporteMN As Decimal = (ImporteMovimiento * tipoCambioPago).RoundSQL
|
|
|
|
|
Dim IdCtaContable As Integer = 0
|
|
|
|
|
|
|
|
|
|
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
|
|
|
|
|
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ConceptoMovimiento, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero, ImporteMX:=ImporteMN) Then
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, VentaActual.SerieFolio, 134, VentaActual.SerieFolio, IdCtaContable, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveSubProyecto:=CveSubProyectoContabilizar, CveProveedor:=DdlProveedorPagoInt.SelectedValue.ToEntero) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
ImporteMovimiento = 0
|
|
|
|
|
Case 30
|
|
|
|
|
ImporteMovimiento = 0
|
|
|
|
|
Case Else
|
|
|
|
|
ImporteMovimiento = 0
|
|
|
|
|
End Select
|
|
|
|
|
|
|
|
|
|
If MsgError <> "" Then
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
'PARA EMITIR COMPLEMENTO PAGO
|
|
|
|
|
CveVentasPago.Add(gvr.DataKey("CveVenta").ToEntero)
|
|
|
|
|
SeriesPago.Add(gvr.DataKey("SerieFolio"))
|
|
|
|
|
|
|
|
|
|
If ImporteMovimiento <> 0 AndAlso MsgError = "" Then
|
|
|
|
|
'Conta ContPAQ
|
|
|
|
|
If (IdCtaContable < 1 Or IdCuentaBancaria < 1) AndAlso UsuarioActual.CveEmpresa <> 119 Then
|
|
|
|
|
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
|
|
|
|
|
idCuentaContabilizacion = 0
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMN, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then
|
|
|
|
|
ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal()
|
|
|
|
|
ListaFacturasGenerarNC.Add(ObjFactura)
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
@@ -1480,7 +1170,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
|
|
|
|
|
CveSubProyectoContabilizar = CveSubProyectoMaximo
|
|
|
|
|
|
|
|
|
|
If tipoCambioPago > 1 AndAlso CveMoneda = 2 Then
|
|
|
|
|
If CveMoneda = 2 Then
|
|
|
|
|
'If IdCuentaBancariaComplementaria > 0 Then
|
|
|
|
|
If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
|
|
|
|
|
tipoCambioPago = TxtTCDolares.Text.ToDecimal
|
|
|
|
|
@@ -1522,11 +1212,8 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If RblTipoPago.SelectedValue = "3" AndAlso MsgError = "" Then
|
|
|
|
|
|
|
|
|
|
MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, CveIE, TxtImporte.Text.ToDecimal, tipoCambioPago, tipoCambioVenta, -1, TxtObservaciones.Text, DdlIngreso.SelectedItem.Text)
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
@@ -1557,7 +1244,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidas))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
MsgError = "No se pudo insertar la póliza"
|
|
|
|
|
End If
|
|
|
|
|
@@ -1572,7 +1258,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
For Each Fac As Modelos.Factura In ListaFacturasGenerarNC
|
|
|
|
|
Dim ListaNC As New List(Of Modelos.Factura)
|
|
|
|
|
ListaNC.Add(Fac)
|
|
|
|
|
|
|
|
|
|
Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC)
|
|
|
|
|
|
|
|
|
|
If Resp IsNot Nothing AndAlso Resp.Respuesta IsNot Nothing AndAlso Resp.Respuesta.CveVenta > 0 Then
|
|
|
|
|
@@ -1667,20 +1352,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
MsgError = "Error al Agregar la Póliza de Armonización Contable"
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'BITACORA
|
|
|
|
|
'If MsgError = "" Then
|
|
|
|
|
|
|
|
|
|
' If CveIESustitucion > 0 And ComplementoSustitucionGenerado Then
|
|
|
|
|
' If Not ObjEvento.AddEventoBitacora($"Complemento de pago Cancelado por sustitución con Folio <a href='/Bancos/IE.aspx?CveIE={CveIE}' target='_blank' class='Texto'>{TxtFolio.Text}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIESustitucion) Then
|
|
|
|
|
' MsgError = "Ocurrió un error al agregar la bitacora"
|
|
|
|
|
' End If
|
|
|
|
|
' If Not ObjEvento.AddEventoBitacora($"Complemento de pago Generado por Sustitución de <a href='/Bancos/IE.aspx?CveIE={CveIESustitucion}' target='_blank' class='Texto'>{FolioIECancelado}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then
|
|
|
|
|
' MsgError = "Ocurrió un error al agregar la bitacora"
|
|
|
|
|
' End If
|
|
|
|
|
' End If
|
|
|
|
|
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
MsgError = "Ocurrió un error al guardar el movimiento"
|
|
|
|
|
OnError("Ocurrió un error al guardar el movimiento", ex)
|
|
|
|
|
@@ -1718,7 +1389,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Else
|
|
|
|
|
If ObjConta IsNot Nothing Then ObjConta.RollBack()
|
|
|
|
|
ObjIE.RollBack()
|
|
|
|
|
Alert(MsgError, TipoMensaje.MsgAdvertencia)
|
|
|
|
|
' Alert(MsgError, TipoMensaje.MsgAdvertencia)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
ObjIE.Dispose()
|
|
|
|
|
@@ -2398,7 +2069,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
DdlCuenta.SelectedValue = "-1"
|
|
|
|
|
DdlTipoTransaccion.SelectedValue = "-1"
|
|
|
|
|
|
|
|
|
|
'CveIESustitucion = "-1"
|
|
|
|
|
CFDIRelacionadoSustitucion = "-1"
|
|
|
|
|
FechaCorteIE = DateTime.Now.ToDate
|
|
|
|
|
IDPoliza = -1
|
|
|
|
|
@@ -2476,7 +2146,21 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
Deudores.Dispose()
|
|
|
|
|
|
|
|
|
|
DdlIngreso.DataBind()
|
|
|
|
|
DdlIngreso.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
|
DdlIngreso.Items.Insert(0, New ListItem("-", "-1"))
|
|
|
|
|
Return dtt
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Private Function CargaPrestamos(tCveMoneda As Integer) As DataTable
|
|
|
|
|
Dim dtt As DataTable = Nothing
|
|
|
|
|
Dim Deudores As New ClsMovimientos
|
|
|
|
|
If Deudores.GetDocumentosxPagarDetalle(CveCliente, tCveMoneda, 2, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
DdlPrestamo.DataSource = Deudores.DtResultados '.FiltraParametros("CveCliente > 0 AND Saldo > 0 AND CveIE > 0")
|
|
|
|
|
dtt = Deudores.DtResultados
|
|
|
|
|
End If
|
|
|
|
|
Deudores.Dispose()
|
|
|
|
|
|
|
|
|
|
DdlPrestamo.DataBind()
|
|
|
|
|
DdlPrestamo.Items.Insert(0, New ListItem("-", "-1"))
|
|
|
|
|
Return dtt
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
@@ -2626,8 +2310,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
'For i = 0 To CveVentas.Count - 1
|
|
|
|
|
Dim ObjBancos As New ClsBancos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'If ObjBancos.GetComplementoPagosRep(-1, Now.AddYears(-2), Now, CveIE, -1, If(CveIESustitucion > 0, 2, 1), UsuarioActual.CveEmpresa, -1) Then
|
|
|
|
|
If ObjBancos.GetComplementoPagosRep(-1, Now.AddYears(-2), Now, CveIE, -1, 1, UsuarioActual.CveEmpresa, -1) Then
|
|
|
|
|
If Not ObjBancos.DtResultados.Rows.Count > 0 Then
|
|
|
|
|
ObjBancos.Dispose()
|
|
|
|
|
@@ -2638,8 +2320,6 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
|
|
|
|
|
ObjBancos.IniciaTransacSQL()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'If ObjBancos.GeneraTimbrePago(CveIE, -1, UsuarioActual, CveCliente, CFDIRelacionado:=CFDIRelacionadoSustitucion, EsRegeneracion:=If(CveIESustitucion > 0, True, False)) Then
|
|
|
|
|
If ObjBancos.GeneraTimbrePago(CveIE, -1, UsuarioActual, CveCliente, CFDIRelacionado:=CFDIRelacionadoSustitucion, EsRegeneracion:=False) Then
|
|
|
|
|
ObjBancos.Commit()
|
|
|
|
|
ComplementoSustitucionGenerado = True
|
|
|
|
|
@@ -3025,7 +2705,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
|
|
|
|
|
Private Sub DdlIngreso_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlIngreso.SelectedIndexChanged
|
|
|
|
|
'saco la moneda de la selección
|
|
|
|
|
hdnIngresoImporte.Value = 0
|
|
|
|
|
HdnIngresoImporte.Value = 0
|
|
|
|
|
If DdlIngreso.SelectedValue.ToEntero > 0 Then
|
|
|
|
|
Dim Banco As New ClsBancos
|
|
|
|
|
|
|
|
|
|
@@ -3033,7 +2713,7 @@ Partial Class Ventas_ClientesAbonar
|
|
|
|
|
CveMonedaPago = Banco.CveMoneda
|
|
|
|
|
Dim Deudores As New ClsMovimientos
|
|
|
|
|
If Deudores.GetIngresosSaldosDetalle(CveCliente, -1, UsuarioActual.CveEmpresa) Then
|
|
|
|
|
hdnIngresoImporte.Value = Deudores.DtResultados.FiltroPrimeroValor("Saldo", String.Format("CveIE = {0}", DdlIngreso.Selectedvalue))
|
|
|
|
|
HdnIngresoImporte.Value = Deudores.DtResultados.FiltroPrimeroValor("Saldo", String.Format("CveIE = {0}", DdlIngreso.SelectedValue))
|
|
|
|
|
End If
|
|
|
|
|
Deudores.Dispose()
|
|
|
|
|
End If
|
|
|
|
|
|