From 3a20ec9e34290749f081390d9b1aebf0bed52f45 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 23 Sep 2021 09:42:28 -0700 Subject: [PATCH] Tipo de cambio en NC Amortizacion, validacion de venta relacionada en refacturacion, no redireccionar a clientes cuando se factura --- Ventas/Ventas.aspx.vb | 45 ++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 22857021f..85eae3ff4 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8757,7 +8757,7 @@ Partial Class Ventas 'MUESTA ALERT OK ' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-. - Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=2"";")) + Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";")) Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga) MensajeAlert.Clear() @@ -9425,6 +9425,10 @@ Partial Class Ventas For Each gvrt As GridViewRow In GVAnticipos.Rows If gvrt.FCCheckBox(String.Format("Chk{0}", gvrt.RowIndex)).Checked Then + 'SI SE VA HACER UNA NC EN DOLARES CON UN ANTICIPO EN PESOS + If gvrt.DataKey("CveMoneda").ToEntero() = 1 AndAlso gvrt.FCTextBox(String.Format("TxtTC{0}", gvrt.RowIndex)).Text.ToDecimal() > 0 AndAlso factura.CveMoneda = 2 Then + factura.TipoCambio = gvrt.FCTextBox(String.Format("TxtTC{0}", gvrt.RowIndex)).Text.ToDecimal() + End If Dim CveSub As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero() Dim dr As DataRow = tmpcon.NewRow @@ -11273,7 +11277,7 @@ Partial Class Ventas FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else - If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Or CveEstatusRefacturacion = 1 Then + If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 Then If DtVentasNC IsNot Nothing Then For Each row As DataRow In DtVentasNC.Rows If Not row("CveVenta").ToString().ToEntero() = -1 Then @@ -11287,6 +11291,12 @@ Partial Class Ventas If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveVenta) Then ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") End If + Else + If CveEstatusRefacturacion > 0 AndAlso CveDevolucion > 0 Then + If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveDevolucion) Then + ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + End If + End If End If End If End If @@ -12060,21 +12070,15 @@ Partial Class Ventas 'SI LA NC ES EN DOLARES Y PERO VIENE DE UN ANTICIPO EN PESOS If (Not UsuarioActual.CveEmpresa.Contiene(72, 80, 146)) AndAlso ObjFactura.CveMoneda = 2 AndAlso row2.DataKey("CveMoneda").ToString().ToEntero() = 1 Then + Dim tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate).ToDecimal - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo * tipoCambio, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambio) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo * tipoCambioAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambioAnticipo, ImporteME:=If(tipoCambioAnticipo = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioAnticipo) Then ErrorPrepoliza = True Exit For End If - 'Dim IdCtaContableComplementariaAntic = IdCtaContableClienteComplementaria Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 292, NombreCliente, Dr("Folio").ToString, FolioIE.ToString()) - 'Dim ImporteComplementaria = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL - 'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Concepto, 227, Concepto, FechaMovimiento, IdCtaContableComplementariaAntic, -1, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar) Then - ' ErrorPrepoliza = True - ' Exit For - 'End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 292, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContMonedaExtranjera, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then ErrorPrepoliza = True Exit For @@ -14201,12 +14205,13 @@ Partial Class Ventas End If - If e.Row.DBCampo("Tipo").ToString() = "NC" And e.Row.DataKey("CveVenta").ToString().ToEntero() > 0 Then - If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 2 Then - tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString().ToDecimal - Else - tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString().ToDate).ToDecimal - End If + If e.Row.DBCampo("Tipo").ToString() = "NC" And e.Row.DataKey("CveVenta").ToString().ToEntero() > 0 OrElse (e.Row.DBCampo("Tipo").ToString() = "Ant" And e.Row.DataKey("CveMoneda").ToString().ToEntero() = 1 AndAlso DdlMoneda.SelectedValue.ToEntero() = 2) Then + 'If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 2 Then + ' tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString().ToDecimal + 'Else + ' tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString().ToDate).ToDecimal + 'End If + tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString().ToDecimal e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Text = tipoCambio.FormatoNumero(4) @@ -14283,7 +14288,7 @@ Partial Class Ventas 'SI UN REGISTRO ES DE DIFERENTE MONEDA AL DOCUMENTO SE MUESTRAN LAS COLUMNAS If e.Row.DBCampo("CveMoneda").ToString().ToEntero() > 0 And e.Row.DBCampo("CveMoneda").ToString().ToEntero() <> DdlMoneda.SelectedValue.ToEntero() Then GVAnticipos.Columns(4).Visible = True - GVAnticipos.Columns(6).Visible = True + GVAnticipos.Columns(7).Visible = True End If @@ -21344,9 +21349,9 @@ Partial Class Ventas ObjInv.Dispose() 'si es la empresa 119, Candado, no permiter refacturar, si no se ha surtido, para que cancele la factura mejor. - If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 Then - LkRefacturacion.Visible = False - End If + 'If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 Then + ' LkRefacturacion.Visible = False + 'End If End Sub Private Sub CargaGVInv(DtTemporal As DataTable)