This commit is contained in:
Antonio Gonzalez
2020-03-09 11:02:48 -07:00
4 changed files with 155 additions and 21 deletions

View File

@@ -336,7 +336,7 @@ Public Class ClsVentas
Optional ObservacionesAlmacen As String = "", Optional CveSubProyecto As Integer = -1, Optional CveSubProyectoEjecucion As Integer = -1, Optional CveSubProyectoCobranza As Integer = -1,
Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveUsoCFDI As Integer = -1, Optional OrdenCompra As String = "-1", Optional CveCuentaTerminal As Integer = -1, Optional CveTipoRelacion As Integer = -1, Optional ImpuestoLocal As Double = 0,
Optional CveTipoAmortizacionAnticipo As Integer = -1, Optional CveVentaRelacion As Integer = -1, Optional ImporteRelacion As Decimal = -1, Optional CveEmpresaCRM As Integer = -1, Optional EsInterno As Integer = -1, Optional CveAcercamientoCRM As Integer = -1,
Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False) As Boolean
Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False, Optional CveTipoRetencion As Integer = 0) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_VentasAdd")
@@ -424,6 +424,7 @@ Public Class ClsVentas
.Add("@AnticipoEspecial", SqlDbType.Bit).Value = AnticipoEspecial
.Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje
.Add("@EsAmortizacion", SqlDbType.Bit).Value = EsAmortizacion
.Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
End With

View File

@@ -2928,7 +2928,7 @@ Namespace Modelos
End If
Case 8 'Ret IVA por Trasladar
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion <> 4 Then 'SI NO ES RETENCION DE IVA DE SERVICIOS
importeMovimiento = (ObjFactura.RetIVA * ValorMultiplicador)
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
@@ -2956,6 +2956,26 @@ Namespace Modelos
End If
End If
End If
End If
Case 313 'Ret Iva Servicios
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion = 4 Then 'SI TIENE RETENCION DE IVA DE SERVICIOS
importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
CveSubProyectoContabilizar = CveSubProyectoVenta
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
'OBTENER CUENTAS
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
'Conta SIG
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
End If
End If
End If
Case 9 'Ret ISR por Trasladar
@@ -5744,6 +5764,8 @@ Namespace Modelos
Public Property EsNCAmortizacion As Boolean
Public Property Kilometraje As Decimal
Public Property CveTipoRetencion As Integer
#End Region

View File

@@ -815,6 +815,8 @@ Partial Class Ventas_ClientesAbonar
For Each gvr As GridViewRow In GvCxC.Rows
If gvr.FCCheckBox("Chk").Checked Then
Dim ObjFactura As New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
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
tipoCambioVenta = 1
@@ -913,6 +915,9 @@ Partial Class Ventas_ClientesAbonar
Case 8 'Ret IVA x Trasladar
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
Exit Select
End If
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
@@ -956,6 +961,44 @@ Partial Class Ventas_ClientesAbonar
End If
End If
End If
Case 313 'Ret Iva Servicios
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento * tipoCambioVenta
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * tipoCambioVenta
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento * tipoCambioVenta
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
TipoCambioGeneral = tipoCambioVenta
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
'OBTENER CUENTAS
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
'Conta SIG
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
End If
End If
End If
Case 9 'Ret ISR x Trasladar
If EsAnticipoEspecial Then Exit Select
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
@@ -1037,6 +1080,9 @@ Partial Class Ventas_ClientesAbonar
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
Case 62 'Ret IVA Trasladado
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
Exit Select
End If
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
@@ -1081,6 +1127,44 @@ Partial Class Ventas_ClientesAbonar
End If
End If
End If
Case 314 'Ret Iva Servicios Traslado
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * tipoCambioVenta
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
tipoCambioVenta = gvr.DataKey("TipoCambio").ToDecimal
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)
CveSubProyectoContabilizar = CveSubProyecto
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
'OBTENER CUENTAS
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
'Conta SIG
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
End If
End If
End If
Case 63 'Ret ISR Trasladado
If EsAnticipoEspecial Then Exit Select
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
@@ -1401,7 +1485,8 @@ Partial Class Ventas_ClientesAbonar
Next
End If
If gvr.FCCheckBox("ChkGenerarNC").Checked Then
ListaFacturasGenerarNC.Add(New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa) With {.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal()})
ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal()
ListaFacturasGenerarNC.Add(ObjFactura)
End If
End If

View File

@@ -4389,6 +4389,8 @@ Partial Class Ventas
End If
End If
DdlTipoRetencion.SelectedValueExist(DbRowVenta("CveTipoRetencion").ToString)
UpPS.Update()
UpContado.Update()
UpEstatus.Update()
@@ -4807,10 +4809,10 @@ Partial Class Ventas
ViewState("ClienteRetIVA") = ObjCliente.RetIVA / 100
ViewState("ClienteRetISR") = ObjCliente.RetISR / 100
DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString)
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
If CveVenta <= 0 Then
DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString)
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
ViewState("RetIVAFletes") = ObjCliente.RetieneIVAFletes
If ObjCliente.RetieneIVAFletes Then
TrRetIVA.Style.Add("display", "")
@@ -4819,9 +4821,6 @@ Partial Class Ventas
End If
ViewState("Vendedor") = ObjCliente.Vendedor
ViewState("CtaContable") = ObjCliente.CuentaContable
ViewState("IdCtaContClientes") = ObjCliente.IdCtaContClientes
@@ -6070,6 +6069,7 @@ Partial Class Ventas
End If
End If
' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
TrRetIVA.Style.Add("display", "")
DdlTipoRetencion.Visible = True
End If
@@ -8409,6 +8409,9 @@ Partial Class Ventas
End Select
ObjFactura.ComplementoINE = INE
End If
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
ObjFactura.CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero()
End If
End Sub
Private Sub CreaObjetosVentaDevolucion()
@@ -9317,6 +9320,10 @@ Partial Class Ventas
Next
End If
Dim CveTipoRetencion As Integer = -1
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero()
End If
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
@@ -9333,7 +9340,7 @@ Partial Class Ventas
CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)),
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) Then
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=CveTipoRetencion) 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") Or DtVentasNC IsNot Nothing Then
@@ -10581,7 +10588,7 @@ Partial Class Ventas
End If
Case 8 'Ret IVA por Trasladar
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") Then
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion <> 4 Then 'SI NO ES RETENCION DE IVA DE SERVICIOS
importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
@@ -10589,17 +10596,12 @@ Partial Class Ventas
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
'CONTABILIDAD CONTPAQ
'SI LA RETENCION ES AL 6% DEBE USAR ESTA CUENTA
If UsuarioActual.Empresa.Funcionalidad(580).ToEntero() > 0 AndAlso (DdlTipoRetencion.SelectedValue = "4") Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(580).ToEntero()
If IdCtaContRetIVA > 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If IdCtaContRetIVA > 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
@@ -10616,6 +10618,25 @@ Partial Class Ventas
End If
End If
Case 313 'Ret Iva Servicios
If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso ObjFactura.CveTipoRetencion = 4 Then 'SI TIENE RETENCION DE IVA DE SERVICIOS
importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
CveSubProyectoContabilizar = CveSubProyectoVenta
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
'OBTENER CUENTAS
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
'Conta SIG
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
End If
End If
End If
Case 9 'Ret ISR por Trasladar
@@ -14245,6 +14266,7 @@ Partial Class Ventas
CargaGvComercioExterior()
End If
End If
UpPS.Update()
End Sub
@@ -14497,6 +14519,7 @@ Partial Class Ventas
End If
' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
TrRetIVA.Style.Add("display", "")
DdlTipoRetencion.Visible = True
End If
@@ -17088,6 +17111,9 @@ Partial Class Ventas
Else
Alert("El producto no fue encontrado.", TipoMensaje.MsgAdvertencia)
End If
UpPS.Update()
End Sub
Private Sub DdlMoneda_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMoneda.SelectedIndexChanged
CambiaMoneda()