This commit is contained in:
Rakcsle Supertramp
2020-01-25 11:30:33 -07:00
35 changed files with 2374 additions and 1778 deletions

View File

@@ -1894,22 +1894,22 @@ Partial Class Clientes
Protected Sub BtnVerMasBancos_Click(sender As Object, e As EventArgs)
If BtnVerMasBancos.Text = "Ver Más" Then
CargaBancos(-1)
CargaBancos(1000000)
BtnVerMasBancos.Text = "Ver Menos"
Else
CargaBancos(11)
CargaBancos(51)
BtnVerMasBancos.Text = "Ver Más"
End If
End Sub
End Sub
#End Region
#Region "B A N C O S"
'CuentasxCobrar Activas (Pagos Recibidos)
Private Sub CargaBancos(Optional SelectTop As Integer = 11, Optional CveClienteSucursal As Integer = -1)
'CuentasxCobrar Activas (Pagos Recibidos)
Private Sub CargaBancos(Optional SelectTop As Integer = 51, Optional CveClienteSucursal As Integer = -1)
Dim ObjMovtos As New ClsMovimientos()
'CxC Activas
If ObjMovtos.GetClienteAbonos(CveCliente, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) AndAlso ObjMovtos.DtResultados.Rows.Count > 0 Then
If ObjMovtos.GetClienteAbonos(CveCliente, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, SelectTop:=SelectTop) AndAlso ObjMovtos.DtResultados.Rows.Count > 0 Then
GvBancos.DataSource = ObjMovtos.DtResultados
DTCobrosRealizados = ObjMovtos.DtResultados
DTCobrosRealizados.Rows.Remove(DTCobrosRealizados.Rows(0))
@@ -9201,7 +9201,7 @@ Partial Class Clientes
Dim Serie As String = ""
If FolioNotaCredito(Tipo) Then
Folio = -1
Folio = FolioNotaAcumulador
Serie = SerieNotaAcumulador
End If
@@ -9220,8 +9220,8 @@ Partial Class Clientes
ObjFactura.TipoDocto = "RNC"
ObjFactura.Folio = Folio
ObjFactura.Serie = Serie
ObjFactura.Fecha = Now
ObjFactura.CvePrePoliza = -1
ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero

View File

@@ -3,9 +3,9 @@ Imports System.Data
Imports System.Linq
Partial Class Ventas_ClientesAbonar
Inherits ClsPaginas
Inherits ClsPaginas
#Region "Propiedades"
Private ReadOnly Property CveCliente As Integer
Get
@@ -273,9 +273,9 @@ Partial Class Ventas_ClientesAbonar
Set(value As Date)
ViewState("Fecha") = value
End Set
End Property
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CveMonedaPago = -1
@@ -641,8 +641,10 @@ Partial Class Ventas_ClientesAbonar
e.Row.FCRangeValidator("RVComision").MaximumValue = e.Row.DBCampo("Saldo")
End If
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() >= 0 Then
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
e.Row.FCCheckBox("ChkGenerarNC").Visible = True
e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda))
End If
Else
@@ -1876,12 +1878,12 @@ Partial Class Ventas_ClientesAbonar
Dim DtVentasNC = InicializaDTVentasNC()
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("TotalImporte").ToDecimal()
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA").ToDecimal()
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR").ToDecimal()
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS").ToDecimal()
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("Descuento").ToDecimal()
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("TotalImporte")
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIVA")
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetIVA")
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetISR")
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIEPS")
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("Descuento")
Dim Amortizacion As Decimal = 0
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
@@ -1908,7 +1910,7 @@ Partial Class Ventas_ClientesAbonar
DtVentasNC.AcceptChanges()
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
ObjFacturaDevolucion.GenerarPDFFactura = True
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Trasac:=Trasac, ObjContPaqTransac:=ObjConta)
Return Resp
@@ -2056,21 +2058,25 @@ Partial Class Ventas_ClientesAbonar
Dim ImporteReferencia As Decimal = Total
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = ""
Dim ImporteTotalConcepto As Decimal = 0
For Each Dr As DataRow In DtImpuestosLocal.Rows
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
Dr("ImporteTotal") = Math.Round(Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr)), 2)
ImporteTotalConcepto = Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))
Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
Dr("ImportePU") = ImporteTotalConcepto.RoundSQL(6)
Dr("ImporteTotal") = ImporteTotalConcepto.RoundSQL(2)
Dr("ImporteIVA") = (ImporteTotalConcepto * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetIVA") = (ImporteTotalConcepto * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (ImporteTotalConcepto * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIEPS") = (ImporteTotalConcepto * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2)
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
'(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Next
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
@@ -2308,8 +2314,8 @@ Partial Class Ventas_ClientesAbonar
UpDatos.Update()
UPVentas.Update()
End Sub
End Sub
#Region " PAGAR CON PESOS "
Protected Sub ChkPagarPesos_CheckedChanged(sender As Object, e As EventArgs)
If ChkPagarPesos.Checked Then
@@ -2330,9 +2336,9 @@ Partial Class Ventas_ClientesAbonar
CargaDatos(2)
RegistraScript("CambiaPesosDolares();")
End Sub
End Sub
#End Region
#Region "PAGAR CON DOLARES"
Protected Sub ChkPagarDolares_CheckedChanged(sender As Object, e As EventArgs)
If ChkPagarDolares.Checked Then
@@ -2353,9 +2359,9 @@ Partial Class Ventas_ClientesAbonar
CargaDatos(1)
RegistraScript("CambiaDolaresPesos();")
End Sub
End Sub
#End Region
#Region " CUENTAS DEPOSITOS"
Private Sub CargaCuentasDepositos()
DdlCuentaDeposito.Items.Clear()
@@ -2422,9 +2428,9 @@ Partial Class Ventas_ClientesAbonar
End If
Dep.Dispose()
UpCuentaDeposito.Update()
End Sub
End Sub
#End Region
#Region " COMPLEMENTOS PAGO "
Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String
If Not ChkComplementoPago.Checked Then
@@ -2476,14 +2482,14 @@ Partial Class Ventas_ClientesAbonar
' Next
Return Retorno.ToString
End Function
End Function
#End Region
#Region "SALDAR CUENTAS"
Private Sub BtnSaldarCuentasIncobrables_Click(sender As Object, e As EventArgs) Handles BtnSaldarCuentasIncobrables.Click
Dim ObjConta As New ClsContabilidad
ObjConta.IniciaTransacSQL()
@@ -2507,7 +2513,10 @@ Partial Class Ventas_ClientesAbonar
End If
End If
ObjIE.Dispose()
ObjIE.Dispose()
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ClientesAbonar/SaldarI", 47, 0, 0, 1, TxtFechaIncobrable.Text.ToDate, TxtObsSaldarIncobrable.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
For Each gr As GridViewRow In GvCxC.Rows
If gr.FCCheckBox("Chk").Checked Then
@@ -2540,6 +2549,7 @@ Partial Class Ventas_ClientesAbonar
Dim ImpuestosMovto As Boolean = False
Dim IdCuentaContableNoDeducible As Integer = 0
Dim CveSubProyecto As Integer = gr.DataKey("CveSubProyecto").ToEntero
Dim ConceptoPartida As String = TxtObsSaldarIncobrable.Text.Trim & " " & gr.DataKey("SerieFolio").ToString
If CveConceptoDeduccion = 255 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
If CveConceptoDeduccion = 211 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero
@@ -2561,9 +2571,8 @@ Partial Class Ventas_ClientesAbonar
UsaComplementaria = True
End If
If MsgError = "" Then
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/ClientesAbonar/SaldarI", 47, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, TxtFechaIncobrable.Text.ToDate, TxtObsSaldarIncobrable.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If MsgError = "" Then
If tCveMoneda = 2 Then
IdCtaContable = IdCtaContMonedaExtranjera
Else
@@ -2572,16 +2581,16 @@ Partial Class Ventas_ClientesAbonar
If UsaComplementaria AndAlso tCveMoneda = 2 Then
'normal
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
'complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo), ImporteME:=Saldo, CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo), ImporteME:=Saldo, CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
@@ -2592,11 +2601,11 @@ Partial Class Ventas_ClientesAbonar
Dim ImporteFluctuacion As Decimal = 0
ImporteFluctuacion = Saldo * (TCPago - TCVenta)
If TCPago > TCVenta Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
End If
@@ -2620,18 +2629,18 @@ Partial Class Ventas_ClientesAbonar
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar)
If IVA > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If IVA > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar
If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
'al gasto,Subtotal
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, SubtotalMovto, SubTotal, gr.DataKey("SerieFolio").ToString, CveConceptoDeduccion, TxtObsSaldarIncobrable.Text.Trim, TxtFechaIncobrable.Text.ToDate, IdCuentaContableNoDeducible, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=SubTotal, CveCuenta:=-1, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, SubtotalMovto, SubTotal, gr.DataKey("SerieFolio").ToString, CveConceptoDeduccion, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCuentaContableNoDeducible, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=SubTotal, CveCuenta:=-1, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
@@ -2772,10 +2781,10 @@ Partial Class Ventas_ClientesAbonar
UpGuardar.Update()
End Sub
End Sub
#End Region
#Region "COMPLEMENTO DE PAGO - ELIMINAR POR SUSTITUCION"
Protected Sub CargaIESustituir()
Dim ObjIE As New ClsBancos()
@@ -2952,10 +2961,10 @@ Partial Class Ventas_ClientesAbonar
Private Sub BtnVincularIntermediario_Click(sender As Object, e As EventArgs) Handles BtnVincularIntermediario.Click
RegistraScript("$('#ModalVincularIntermediario').modal('hide')", "hidemodal")
End Sub
End Sub
#End Region
Protected Sub BtnCambiaTipoMoneda_Click(sender As Object, e As EventArgs)
CambiaTipoMoneda()
End Sub

View File

@@ -2664,12 +2664,30 @@
<div id="DivRecepcionUsados" runat="server">
<div class="row">
<div class="col-md-5">
<div class="col-md-6">
<label>Modelo:</label>
<br />
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
</asp:DropDownList>
</div>
<div class="col-md-6">
<label>Año:</label>
<br />
<asp:TextBox ID="TxtAnioVehiculo" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true" MaxLength="500"></asp:TextBox>
</div>
</div>
<div class ="row">
<div class="col-md-6">
<label>Tipo Servicio:</label>
<br />
<asp:DropDownList ID="DdlTipoServicio" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Particular" Value="1"></asp:ListItem>
<asp:ListItem Text="Comercial" Value="2"></asp:ListItem>
<asp:ListItem Text="Taxi" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-6"></div>
</div>
<br />

View File

@@ -859,6 +859,14 @@ Partial Class PV
ViewState("TmpDTRecepcionUsados") = value
End Set
End Property
Private Property TmpDTPolizaVirtual As DataTable
Get
Return If(IsNothing(ViewState("TmpDTPolizaVirtual")), Nothing, CType(ViewState("TmpDTPolizaVirtual"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTPolizaVirtual") = value
End Set
End Property
Private Property TmpDTImpuestos As DataTable
Get
Return If(IsNothing(ViewState("TmpDTImpuestos")), Nothing, CType(ViewState("TmpDTImpuestos"), DataTable))
@@ -2547,6 +2555,8 @@ Partial Class PV
ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados
ObjFactura.DtPolizasVirtuales = TmpDTPolizaVirtual
ObjFactura.GenerarPDFFactura = False
Dim CveTipoAlmacen As Integer = If(TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0, 6, 22)
@@ -3734,13 +3744,14 @@ Partial Class PV
ChkAgregar.Checked = False
divagregrarotrops.Visible = False
Ajuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
UpVenta.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
End Sub
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
If AgregarPS() Then
If ChkAjuste.Checked Then GuardaAjuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
CalculaTotalesVenta()
If ChkAgregar.Checked = True And Modalidad = "A" Then
@@ -5053,6 +5064,7 @@ Partial Class PV
CreaDTmpDTAjustes()
CreaDTmpDTRecepcionUsados()
CreaDTmpDTPolizaVirtual()
CargaBCIAjuste()
DdlDistribuidor.setEsWebService(True)
DivChkAjuste.Visible = True
@@ -5478,6 +5490,101 @@ Partial Class PV
#End Region
#Region "P O L I Z A - V I R T U A L"
Private Sub CreaDTmpDTPolizaVirtual()
TmpDTPolizaVirtual = New DataTable
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("Descuento", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("Total", GetType(Decimal))
TmpDTPolizaVirtual.Columns.Add("CveVentaDetalle", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("TipoServicio", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("TipoPoliza", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveModeloAuto", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("AnioVehiculo", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("TieneUsado", GetType(Boolean))
TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime))
TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
End Sub
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
Dim Retorno As Boolean = False
'Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero()
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal()
Dim PU As Decimal = TxtPrecio.Text.ToDecimal()
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal()
Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2)
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
Dim Elimino As Boolean = False
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
RowPoliza.Delete()
Elimino = True
End If
Next
If Elimino Then
TmpDTRecepcionUsados.AcceptChanges()
End If
End If
End If
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
Dim FechaUsado As DateTime = TxtFechaAjuste.Text.ToDateTime()
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
Dim TipoPoliza As Integer = 1
If ChkAjuste.Checked Then
If Total = ImporteAjuste Then
TipoPoliza = 3
Else
TipoPoliza = 2
End If
End If
Dim TieneUsado As Boolean = GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0)
Dim CvePSUsado As Integer = -1
Dim CveBCIUsado As Integer = -1
If TieneUsado Then
For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
CvePS = GvRow.DataKey("CvePSCargo").ToEntero()
CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
Exit For
End If
End If
Next
End If
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
Row("CvePS") = CvePS
Row("Cantidad") = Cantidad
Row("PU") = PU
Row("Descuento") = Descuento
Row("Total") = Total
Row("CveVentaDetalle") = -1
Row("TipoServicio") = TipoServicio
Row("TipoPoliza") = TipoPoliza
Row("CveModeloAuto") = CveModeloAuto
Row("AnioVehiculo") = AnioVehiculo
Row("TieneUsado") = TieneUsado
Row("FechaUsado") = FechaUsado
Row("CvePSUsado") = CvePSUsado
Row("CveBCIUsado") = CveBCIUsado
TmpDTPolizaVirtual.Rows.Add(Row)
Return Retorno
End Function
#End Region
#Region "U S A D O S"
Private Sub CreaDTmpDTRecepcionUsados()
@@ -5492,6 +5599,7 @@ Partial Class PV
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
End Sub
Protected Sub BtnRecepcionUsados_Click(sender As Object, e As EventArgs)
'CalculaRecepcionUsados(GvRecepcionUsadosModal)

View File

@@ -356,6 +356,9 @@
<li>
<asp:LinkButton runat="server" ID="LnkImprimirFormatoCicovisa" Visible="false" OnClick="LnkImprimirFormatoCicovisa_Click">Imprimir Formato Cicovisa</asp:LinkButton>
</li>
<li>
<asp:LinkButton runat="server" ID="LnkEnviarPolizaVirtual" Visible="false" OnClick="LnkEnviarPolizaVirtual_Click">Enviar Poliza Virtual</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
@@ -1301,7 +1304,7 @@
<ContentTemplate>
<div class="col-md-12">
<asp:GridView ID="GvCodigosUnicos" runat="server" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False"
DataKeyNames="SerieLote,IdProductoPolizaVirtual,FechaAjuste,IdModelo,IdBCI" ClientIDMode="Static" EmptyDataText="" GridLines="None">
DataKeyNames="CvePolizaVirtual,SerieLote,IdProductoPolizaVirtual,Total,Descuento,AnioVehiculo,FechaUsado,IdModeloAuto,IdMarcaAuto,IdBCI,TipoServicio,TipoPoliza,TieneUsado" ClientIDMode="Static" EmptyDataText="" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Código Único">
<ItemTemplate>

View File

@@ -4174,7 +4174,10 @@ Partial Class Ventas
End If
If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev", "Ant") Then
If ObjVentas.GetVentasAntNC(-1, CveVenta) Then
Dim AplicaAmortizacion As Boolean = False
If DdlTipoComprobante.SelectedValue.Contiene("Ant") Then AplicaAmortizacion = True
If ObjVentas.GetVentasAntNC(-1, CveVenta, AplicaAmortizacion) Then
GvNC.DataSource = ObjVentas.DtResultados
TmpDTNCVinculadas = ObjVentas.DtResultados
GvNC.Caption = " <table width='100%'><tr><td style='text-align:center'>Ventas Aplicadas</td></tr></table>"
@@ -4187,7 +4190,7 @@ Partial Class Ventas
Next
End If
End If
End If
End If
If GvNC.Rows.Count > 0 Then
ImgAntiPend.Visible = False
@@ -5742,8 +5745,8 @@ Partial Class Ventas
Dim Cantidad, PU, Descuento, CantidadInventario As Decimal
Dim CuentaPredial As String
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
PU = Math.Round(GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal, 6)
Descuento = Math.Round(GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal, NumeroDecimales)
PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6)
Descuento = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales)
CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
@@ -14125,7 +14128,7 @@ Partial Class Ventas
Dim Row As DataRow = Nothing
Dim TotalCalculableImpuestos As Decimal = 0
Dim TotalCalculableImpuestosIVA As Decimal = 0
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
Row = TmpDT.NewRow()
Row("CveProyecto") = CveProyecto
@@ -23935,11 +23938,20 @@ Partial Class Ventas
#Region "P O L I Z A - V I R T U A L"
Private Sub CargaCodigoUnico()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasPolizaVirtual(Me.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
GvCodigosUnicos.DataSource = ObjAcum.DtResultados
DivCodigosUnicos.Visible = True
If ObjAcum.GetPolizasVirtuales(Me.CveVenta) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
Dim RowPoliza As DataRow = ObjAcum.DtResultados.Rows(0)
If DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
GvCodigosUnicos.DataSource = ObjAcum.DtResultados
DivCodigosUnicos.Visible = True
End If
If Not CBool(RowPoliza("Enviada").ToString()) Then
LnkEnviarPolizaVirtual.Visible = True
End If
End If
ObjAcum.Dispose()
GvCodigosUnicos.DataBind()
@@ -23947,47 +23959,56 @@ Partial Class Ventas
End Sub
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
Try
'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía
Dim TipoPoliza As Integer = 0
For Each Row As GridViewRow In GvCodigosUnicos.Rows
If Row.RowType = DataControlRowType.DataRow Then
Dim CvePolizaVirtual As Integer = Row.DataKey("CvePolizaVirtual").ToEntero()
Dim obj As New Modelos.MPolizaVentaWS
'DATOS DEL CLIENTE
obj.customer_name = ObjFactura.Cliente.Nombre
obj.customer_last_name1 = ""
obj.customer_last_name1 = "."
obj.customer_last_name2 = ""
obj.customer_birthday = Nothing
obj.customer_phone = ObjFactura.Cliente.Telefono
obj.customer_email = ObjFactura.Cliente.Mail
obj.customer_gender = "03" 'OTRO GENERO
obj.customer_advertising = False
obj.customer_car_brand = "00"
obj.customer_car_model = "00"
obj.customer_car_year = ObjFactura.Fecha.Year
obj.customer_car_brand = Row.DataKey("IdMarcaAuto").ToString().Trim()
obj.customer_car_model = Row.DataKey("IdModeloAuto").ToString().Trim()
obj.customer_car_year = Row.DataKey("AnioVehiculo").ToString().ToEntero()
'DATOS DE VENTA
obj.sale_date = ObjFactura.Fecha
obj.sale_paidby = "01"
obj.sale_type = "01" 'PISO
obj.sale_type_service = "02" 'COMERCIAL
obj.sale_total = ObjFactura.Total
obj.sale_discount = ObjFactura.Descuento
obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta)
obj.sale_type_service = "0" & Row.DataKey("TipoServicio").ToString().Trim()
obj.sale_total = Row.DataKey("Total").ToString().ToDecimal()
obj.sale_discount = Row.DataKey("Descuento").ToString().ToDecimal()
obj.sale_id = ObjFactura.CveVenta.ToString
'DATOS DEL PRODUCTO
obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString()
obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text 'se indique el código único de la batería. (SERIE LOTE)
obj.product_sale_type = "01 " 'VENTA
Dim FechaUsado As DateTime = Row.DataKey("FechaAjuste").ToString().ToDateTime()
obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString().Trim()
obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text.Trim() 'se indique el código único de la batería. (SERIE LOTE)
obj.product_sale_type = "0" & Row.DataKey("TipoPoliza").ToString().Trim()
'DATOS DE USADO
obj.used_product = True
obj.used_brand = Row.DataKey("IdModelo").ToString() 'MARCAR DEL USADO
obj.used_bci = Row.DataKey("IdBCI").ToString() 'VALOR DEL BCI
obj.used_month = FechaUsado.Month
obj.used_year = FechaUsado.Year
obj.used_sale_date = FechaUsado
obj.used_product = CBool(Row.DataKey("TieneUsado").ToString())
If obj.used_product Then
Dim FechaUsado As DateTime = Row.DataKey("FechaUsado").ToString().ToDateTime()
obj.used_brand = Row.DataKey("IdModelo").ToString().Trim() 'MARCAR DEL USADO
obj.used_bci = Row.DataKey("IdBCI").ToString().Trim() 'VALOR DEL BCI
obj.used_month = FechaUsado.Month
obj.used_year = FechaUsado.Year
obj.used_sale_date = FechaUsado
End If
EnviarPolizaVentaWS(obj, CvePolizaVirtual)
EnviarPolizaVentaWS(obj)
End If
Next
Catch ex As Exception
@@ -23997,11 +24018,11 @@ Partial Class Ventas
End Sub
Protected Function EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS) As Boolean
Protected Function EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS, CvePolizaVirtual As Integer) As Boolean
Dim Retorno As Boolean = False
Dim Respuesta As String = "[]"
Dim User As String = "cslth.2809@jcilink.com"
Dim User As String = "cslth.7777@lth.com"
Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076"
Try
@@ -24048,13 +24069,22 @@ Partial Class Ventas
Dim resp = JArray.Parse(Respuesta)
If resp.Count > 0 Then
Dim Msg = resp(0)("Descripcion").ToString()
Dim Msg As New StringBuilder()
Msg.AppendFormat("Mensaje Poliza Virtual: {0}", resp(0)("Descripcion").ToString())
If resp(0)("Codigo").ToString().Contiene("500", "501", "502", "503", "504", "505", "506", "507", "508") Then
Alert(Msg, TipoMensaje.MsgInformacion)
Retorno = True
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, True, Now) Then
Alert(Msg.ToString(), TipoMensaje.MsgInformacion)
End If
ObjAcum.Dispose()
Else
Alert(Msg, TipoMensaje.MsgAdvertencia)
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, False, Now) Then
Alert(Msg.ToString(), TipoMensaje.MsgAdvertencia)
End If
ObjAcum.Dispose()
End If
Else
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
@@ -24068,6 +24098,13 @@ Partial Class Ventas
Return Retorno
End Function
Protected Sub LnkEnviarPolizaVirtual_Click(sender As Object, e As EventArgs)
If UsuarioActual.Empresa.Funcionalidad(576) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contains("Rem") Then
CreaObjetosVenta()
GeneraPolizaVentaWS(ObjFactura)
End If
End Sub
#End Region
Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -24112,4 +24149,5 @@ Partial Class Ventas
End Sub
End Class