Amortizacion con NC,agregar bandera de EsAmortizacion

This commit is contained in:
2020-02-25 17:49:57 -07:00
parent d093ae6575
commit 54fa4598c9
3 changed files with 414 additions and 374 deletions

View File

@@ -317,7 +317,7 @@ Public Class ClsVentas
Optional ObservacionesAlmacen As String = "", Optional CveSubProyecto As Integer = -1, Optional CveSubProyectoEjecucion As Integer = -1, Optional CveSubProyectoCobranza As Integer = -1, 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 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 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) 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) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_VentasAdd") DataAdapter("PA_VentasAdd")
@@ -404,6 +404,7 @@ Public Class ClsVentas
.Add("@EsDiasCreditoFijo", SqlDbType.Bit).Value = EsDiasCreditoFijo .Add("@EsDiasCreditoFijo", SqlDbType.Bit).Value = EsDiasCreditoFijo
.Add("@AnticipoEspecial", SqlDbType.Bit).Value = AnticipoEspecial .Add("@AnticipoEspecial", SqlDbType.Bit).Value = AnticipoEspecial
.Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje .Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje
.Add("@EsAmortizacion", SqlDbType.Bit).Value = EsAmortizacion
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
End With End With

View File

@@ -3541,7 +3541,7 @@
<div style="max-height: 300px; overflow-y: auto;"> <div style="max-height: 300px; overflow-y: auto;">
<asp:GridView ID="GVAnticipos" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontraron Anticipos del Cliente" <asp:GridView ID="GVAnticipos" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontraron Anticipos del Cliente"
ToolTip="Listado de Anticipos" CssClass="GVAnticipos table table-striped table-hover Widthall" data-height="300" Style="text-align: center;" GridLines="None" ToolTip="Listado de Anticipos" CssClass="GVAnticipos table table-striped table-hover Widthall" data-height="300" Style="text-align: center;" GridLines="None"
DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, IdCtaContableNCSIG, TipoCambio, CveMoneda,Fecha,SaldoSubTotal"> DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, IdCtaContableNCSIG, TipoCambio,TipoCambioPago, CveMoneda,Fecha,SaldoSubTotal">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>

View File

@@ -9298,7 +9298,7 @@ Partial Class Ventas
CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)), 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, CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False), DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
Kilometraje:=TxtKilometraje.Text.ToDouble) Then Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico") ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else Else
If factura.TipoDocto.Contiene("Dev") Or DtVentasNC IsNot Nothing Then If factura.TipoDocto.Contiene("Dev") Or DtVentasNC IsNot Nothing Then
@@ -11808,11 +11808,8 @@ Partial Class Ventas
'If FechaMaxima < "01/01/2018".ToDate And UsuarioActual.CveEmpresa = 119 Then 'If FechaMaxima < "01/01/2018".ToDate And UsuarioActual.CveEmpresa = 119 Then
' FechaMaxima = "01/01/2018".ToDate ' FechaMaxima = "01/01/2018".ToDate
'End If 'End If
'Dim Now As DateTime = New DateTime(2020, 2, 19)
Try
CvePrepoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrepoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrepoliza > 0 Then If CvePrepoliza > 0 Then
@@ -11831,6 +11828,8 @@ Partial Class Ventas
Dim CveCuentaIVAXTrasladar As Integer = 0 Dim CveCuentaIVAXTrasladar As Integer = 0
Dim CveCuentaIVATrasladado As Integer = 0 Dim CveCuentaIVATrasladado As Integer = 0
Dim Importe91 As Decimal = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then
Dim Dr As DataRow = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).FiltroPrimero("") Dim Dr As DataRow = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).FiltroPrimero("")
IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString.ToEntero IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString.ToEntero
@@ -11847,7 +11846,7 @@ Partial Class Ventas
Dim TipoCambioFluctuacion As Decimal = 1 Dim TipoCambioFluctuacion As Decimal = 1
If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
If ObjIE.DtResultados.Rows.Count > 0 Then If ObjIE.DtResultados.Rows.Count > 0 Then
Dim tFecha As Date = gvr.DataKey("Fecha").ToDate Dim tFecha As Date = Now 'gvr.DataKey("Fecha").ToDate
Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day) Dim Fecha As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day)
Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC") Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & Fecha & "#", "Fecha DESC")
@@ -11859,25 +11858,25 @@ Partial Class Ventas
End If End If
End If End If
If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS
tipoCambioPago = 1 tipoCambioPago = 1
tipoCambioVenta = 1 tipoCambioVenta = 1
tipoCambioVentaValuacion = 1 tipoCambioVentaValuacion = 1
PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Dolares y se va a pagar en Pesos ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN PESOS
tipoCambioPago = gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal tipoCambioPago = gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
tipoCambioVenta = TxtTipoCambio.Text.ToDecimal tipoCambioVenta = TxtTipoCambio.Text.ToDecimal
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN DOLARES
tipoCambioPago = gvr.DataKey("TipoCambio").ToString.ToDecimal tipoCambioPago = gvr.DataKey("TipoCambio").ToString.ToDecimal
tipoCambioVenta = TxtTipoCambio.Text.ToDecimal tipoCambioVenta = TxtTipoCambio.Text.ToDecimal
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES
tipoCambioPago = gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal tipoCambioPago = gvr.DataKey("TipoCambio").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
tipoCambioVenta = 1 tipoCambioVenta = 1
tipoCambioVentaValuacion = 1 tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
End If End If
@@ -11993,19 +11992,24 @@ Partial Class Ventas
End If End If
importeMovimiento = 0 importeMovimiento = 0
Case 91 'Amortizacion Nota de Credito Case 91 'Amortizacion Nota de Credito
Dim TC As Decimal = 1
If gvr.DataKey("CveConceptoContable").ToString().ToEntero = 12 Then If gvr.DataKey("CveConceptoContable").ToString().ToEntero = 12 Then
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 1 Then If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento importeMX = importeMovimiento
TC = gvr.DataKey("TipoCambio").ToString.ToDecimal
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento * gvr.DataKey("TipoCambio").ToString.ToDecimal importeMX = importeMovimiento * gvr.DataKey("TipoCambio").ToString.ToDecimal
TC = gvr.DataKey("TipoCambio").ToString.ToDecimal
ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal importeMX = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
TC = TipoCambioFluctuacion
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 1 Then ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 1 Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
importeMX = importeMovimiento importeMX = importeMovimiento
TC = gvr.DataKey("TipoCambio").ToString.ToDecimal
End If End If
importeMovimiento = Math.Round(importeMovimiento, 2) importeMovimiento = Math.Round(importeMovimiento, 2)
importeMX = Math.Round(importeMX, 2) importeMX = Math.Round(importeMX, 2)
@@ -12034,8 +12038,8 @@ Partial Class Ventas
IdCtaContable = IdCtaContComplementaria IdCtaContable = IdCtaContComplementaria
CveCuenta = 0 CveCuenta = 0
importeMX = importeMovimiento importeMX = importeMovimiento
ImporteComplementaria = ((importeMovimiento * gvr.DataKey("TipoCambio").ToString.ToDecimal) - importeMovimiento).RoundSQL ImporteComplementaria = ((importeMovimiento * TC) - importeMovimiento).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString.ToDecimal = 1, 0, importeMovimiento), TipoCambio:=gvr.DataKey("TipoCambio").ToString.ToDecimal) Then If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString.ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC) Then
ErrorConta = True ErrorConta = True
Exit For Exit For
End If End If
@@ -12048,7 +12052,7 @@ Partial Class Ventas
CveCuenta = 0 CveCuenta = 0
End If End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=gvr.DataKey("TipoCambio").ToString.ToDecimal) Then If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TC) Then
ErrorConta = True ErrorConta = True
Exit For Exit For
End If End If
@@ -12056,8 +12060,8 @@ Partial Class Ventas
'AMORTIZA NC CONTRA ANTICIPO A CLIENTES 'AMORTIZA NC CONTRA ANTICIPO A CLIENTES
If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal) importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal)
If ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString.ToEntero, ImporteMX:=importeMovimiento * gvr.DataKey("TipoCambio").ToString.ToDecimal, CveCuenta:=CveCuenta) Then If ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString.ToEntero, ImporteMX:=importeMovimiento * TC, CveCuenta:=CveCuenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero, -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * gvr.DataKey("TipoCambio").ToString.ToDecimal, CveCuenta:=gvr.DataKey("IdCtaContableNCSIG").ToEntero) Then If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero, -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToString.ToEntero, CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveCuenta:=gvr.DataKey("IdCtaContableNCSIG").ToEntero) Then
ErrorConta = True ErrorConta = True
Exit For Exit For
End If End If
@@ -12068,6 +12072,7 @@ Partial Class Ventas
End If End If
End If End If
End If End If
Importe91 = importeMovimiento
importeMovimiento = 0 importeMovimiento = 0
Case 92 'Amortizacion Ingreso X Comprobar Case 92 'Amortizacion Ingreso X Comprobar
If gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66 Then If gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66 Then
@@ -12189,6 +12194,18 @@ Partial Class Ventas
If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then
If tipoCambioVentaValuacion > tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
importeMovimiento = Importe91 * (tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento
End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago)
TipoCambioGeneral = TCImpuestos
Else
Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66), tipoCambioVentaValuacion, tipoCambioVenta) Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66), tipoCambioVentaValuacion, tipoCambioVenta)
If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
@@ -12198,6 +12215,8 @@ Partial Class Ventas
End If End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioGanancia, tipoCambioPago) Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioGanancia, tipoCambioPago)
TipoCambioGeneral = TCImpuestos TipoCambioGeneral = TCImpuestos
End If
Else Else
importeMovimiento = 0 importeMovimiento = 0
End If End If
@@ -12205,6 +12224,17 @@ Partial Class Ventas
If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString.ToDecimal = 2 Then
If tipoCambioVentaValuacion < tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
importeMovimiento = Importe91 * Math.Abs(tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento
End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago)
TipoCambioGeneral = TCImpuestos
Else
Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66), tipoCambioVentaValuacion, tipoCambioVenta) Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToString.ToEntero > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero = 66), tipoCambioVentaValuacion, tipoCambioVenta)
If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
@@ -12212,8 +12242,11 @@ Partial Class Ventas
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2)) importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
importeMX = importeMovimiento importeMX = importeMovimiento
End If End If
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPerdida, tipoCambioPago) Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPerdida, tipoCambioPago)
TipoCambioGeneral = TCImpuestos TipoCambioGeneral = TCImpuestos
End If
Else Else
importeMovimiento = 0 importeMovimiento = 0
End If End If
@@ -12251,6 +12284,11 @@ Partial Class Ventas
End If End If
End If End If
Catch ex As Exception
ErrorConta = True
OnError("Ocurrió un error al guardar el anticipo", ex)
End Try
If ErrorConta Then If ErrorConta Then
Alert("Ocurrió un error al amortizar el documento. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError) Alert("Ocurrió un error al amortizar el documento. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
ObjConta.RollBack() ObjConta.RollBack()
@@ -13578,6 +13616,7 @@ Partial Class Ventas
End Sub End Sub
Protected Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged Protected Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged
CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero) CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero)
CargaRestriccionesCreditoCliente(Alertas:=True)
End Sub End Sub
Protected Sub DdlCCEdit_SelectedIndexChanged(sender As Object, e As System.EventArgs) Protected Sub DdlCCEdit_SelectedIndexChanged(sender As Object, e As System.EventArgs)
Dim gvr As GridViewRow = DirectCast(DirectCast(sender, DropDownList).BindingContainer, GridViewRow) Dim gvr As GridViewRow = DirectCast(DirectCast(sender, DropDownList).BindingContainer, GridViewRow)
@@ -21722,11 +21761,11 @@ Partial Class Ventas
#Region " APLICA DEVOLUCION " #Region " APLICA DEVOLUCION "
Private Sub InicializaAplicaDevolucion() Private Sub InicializaAplicaDevolucion()
If Not UsuarioActual.CveUsuario = 100 Then 'If Not UsuarioActual.CveUsuario = 100 Then
If Not UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 140, 141, 146) Then ' If Not UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 140, 141, 146) Then
Exit Sub ' Exit Sub
End If ' End If
End If 'End If
'sino tiene el permiso no puede generar Devolucion 'sino tiene el permiso no puede generar Devolucion
If Not UsuarioActual.TienePermisoProceso(264) Then If Not UsuarioActual.TienePermisoProceso(264) Then