diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index cb53e6f67..14500b57d 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -6230,7 +6230,7 @@ Public Class ClsContabilidad .Add("@Opcion", SqlDbType.Int).Value = Opcion .Add("@Valor", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@MsgSalida", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output - .Add("@MsgPrePolizaSalida", SqlDbType.VarChar, 800).Direction = ParameterDirection.Output + .Add("@MsgPrePolizaSalida", SqlDbType.VarChar, 8000).Direction = ParameterDirection.Output .Add("@Diferencia", SqlDbType.Float).Direction = ParameterDirection.Output End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index f833f851d..d2f18f913 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5266,7 +5266,7 @@ Public Class ClsPaginas End If sw.Stop() - If sw.Elapsed.TotalSeconds > 1 Then + If sw.Elapsed.TotalSeconds > 5 Then GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ") End If diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index bdc8f9635..88e4f9c15 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -1263,8 +1263,8 @@ Public Class Timbrado ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais, ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CP) 'RECEPTOR - cfdi.agregarComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib) - cfdi.agregarComercioExterior11DomicilioReceptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, + cfdi.agregarComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroExterior, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroInterior, ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Colonia, diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 1395d747c..6d65cb6d8 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -2090,54 +2090,82 @@ Partial Class Bancos_PopIEVentas IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria - Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - TimpocambioGeneral = TCImpuestos + Dim tImporteVenta, tImportePago, Diferencia As Decimal + ImporteMovimiento = 0 - Dim Diferencia As Decimal = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVentaValuacion) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta - Diferencia -= ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - Diferencia += ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - Diferencia += ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - Diferencia -= ((MovimientoPagar.IEPS * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - Diferencia = Math.Round(Diferencia, 2) + If CveMonedaVenta = 1 And CveMoneda = 2 Then + 'factura pesos, pago en dolares + tImporteVenta = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVenta).RoundSQL + tImportePago = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVenta / tipoCambioPago).RoundSQL + ElseIf CveMonedaVenta = 2 And CveMoneda = 2 Then + 'factura dolares, pago en dolares + tImporteVenta = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVenta).RoundSQL + tImportePago = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago).RoundSQL + ElseIf CveMonedaVenta = 2 And CveMoneda = 1 Then + 'factura dolares, pago en pesos + tImporteVenta = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVenta).RoundSQL + tImportePago = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago).RoundSQL + End If + + If tImporteVenta <> tImportePago Then + If tImporteVenta < tImportePago Then + CveConcepto = 64 + Else + CveConcepto = 65 + End If + Diferencia = Math.Abs(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 + TimpocambioGeneral = TCImpuestos + + Diferencia -= ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA + Diferencia += ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA + Diferencia += ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR + Diferencia -= ((MovimientoPagar.IEPS * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS + Diferencia = Math.Round(Diferencia, 2) + End If '' se considera, las diferencias, y no el tipo de cambio, por el caso de las fluctuaciones '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa - If Diferencia < 0 AndAlso CveMonedaVenta = 2 Then - ImporteMovimiento = Math.Abs(Diferencia) - ImporteMX = ImporteMovimiento - End If + 'If Diferencia < 0 AndAlso CveMonedaVenta = 2 Then + ' ImporteMovimiento = Math.Abs(Diferencia) + ' ImporteMX = ImporteMovimiento + 'End If Else ImporteMovimiento = 0 End If CveSubProyectoContabilizar = CveSubProyectoVenta - Case 65 'Perdida - If CveMoneda <> 1 OrElse CveMonedaVenta <> 1 Then - IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria + 'Case 65 'Perdida + ' If CveMoneda <> 1 OrElse CveMonedaVenta <> 1 Then + ' IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria + ' CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria - Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) - TimpocambioGeneral = TCImpuestos + ' Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) + ' TimpocambioGeneral = TCImpuestos - Dim Diferencia As Decimal = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVentaValuacion) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta - Diferencia -= ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - Diferencia += ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - Diferencia += ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - Diferencia -= ((MovimientoPagar.IEPS * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - Diferencia = Math.Round(Diferencia, 2) + ' Dim Diferencia As Decimal = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVentaValuacion) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta + ' Diferencia -= ((MovimientoPagar.IVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA + ' Diferencia += ((MovimientoPagar.RetIVA * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA + ' Diferencia += ((MovimientoPagar.RetISR * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR + ' Diferencia -= ((MovimientoPagar.IEPS * PorcentajePago) * tipoCambioVenta) - ((MovimientoPagar.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS + ' Diferencia = Math.Round(Diferencia, 2) - 'si la diferencia es negativa es pérdida, si es positiva es ganancia - If Diferencia > 0 AndAlso CveMonedaVenta = 2 Then - ImporteMovimiento = Math.Abs(Diferencia) - ImporteMX = ImporteMovimiento - End If - Else - ImporteMovimiento = 0 - End If - CveSubProyectoContabilizar = CveSubProyectoVenta + ' 'si la diferencia es negativa es pérdida, si es positiva es ganancia + ' If Diferencia > 0 AndAlso CveMonedaVenta = 2 Then + ' ImporteMovimiento = Math.Abs(Diferencia) + ' ImporteMX = ImporteMovimiento + ' End If + ' Else + ' ImporteMovimiento = 0 + ' End If + ' CveSubProyectoContabilizar = CveSubProyectoVenta Case 30 If RBLContado.SelectedValue = "1" Then diff --git a/Bin/RVCFDI33.dll b/Bin/RVCFDI33.dll index f05471ce4..446d82bd3 100644 Binary files a/Bin/RVCFDI33.dll and b/Bin/RVCFDI33.dll differ diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 25b4c4132..c3321d047 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4335,7 +4335,7 @@ Partial Class Compras_Compras Try Dim FolioFijo As Integer = 0 'cheque - If DdlTipoTransaccion.SelectedValue = "1" Then FolioFijo = TxtFolio.Text.ToEntero + If DdlTipoTransaccion.SelectedValue = "1" AndAlso UsuarioActual.CveEmpresa <> 119 Then FolioFijo = TxtFolio.Text.ToEntero CvePrePoliza = ObjConta.AddPrePolizas("Compras/Registrar", If(EsContado And CvePlantillaPrePoliza = 1, 2, CvePlantillaPrePoliza), ImporteCompra, TxtTotal.Text.ToDouble, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjCompras.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjConta.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa)) @@ -4471,6 +4471,8 @@ Partial Class Compras_Compras 'End If End If + 'si el registro es manual, toma el mismo dato + If CveFactura <= 0 Then TotalOriginal = TxtTotal.Text.ToDecimal 'Compra If ObjCompras.AddCompra(DdlTipoComprobante.SelectedValue, TxtDescripcion.Text.Trim, TxtSerie.Text.Trim, TxtFolio.Text.Trim, TxtFolioSecundario.Text.Trim, CveProveedor, TxtSubTotal.Text.ToDouble, TxtDescuento.Text.ToDouble, @@ -6305,7 +6307,7 @@ Partial Class Compras_Compras Case 6 'Compra Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140, 141) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" - Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" + Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" If RBLPago.SelectedValue.ToEntero = 4 Then Exit Select 'Es credito el concepto 6 se agrega en CASE 17 @@ -6643,18 +6645,22 @@ Partial Class Compras_Compras importeMN = importeMovimiento * tipoCambioActual * Multiplicador '[IPP] EL 6 DEBE SER POSITIVO 27/AGOSTO/2018 'CLASIFICACION - If Row2("CveClasificacion").ToString.ToEntero > 0 Then + If Row2("CveClasificacion").ToString.ToEntero > 0 AndAlso DdlTipoComprobante.SelectedValue = "FAC" Then + If ObjConta.GetRetCuenta(6, Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero) Then If ObjConta.DtResultados.Rows.Count > 0 AndAlso ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaGastoSIG").ToString.ToEntero + ' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaGastoSIG").ToString.ToEntero Else IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero + ' CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero End If End If End If + + + 'SEGMENTO DE NEGOCIO Dim IdSegmentoNegocio As Integer = -1 Dim drT As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero).FiltroPrimero(String.Format("CveSubProyecto = {0} ", Row2("CveSubProyecto").ToString.ToEntero)) @@ -6684,6 +6690,11 @@ Partial Class Compras_Compras If DdlMoneda.SelectedValue = "2" Then tidctacon = ViewState("CtaProveedorAnticiposExtranjera").ToString.ToEntero End If + + ElseIf DdlTipoComprobante.SelectedValue = "NC" Then + tcvecon = 259 + tidctacon = UsuarioActual.Empresa.Funcionalidad(405).ToEntero + End If Dim usacomplementariaProveedor As Boolean = False diff --git a/Contabilidad/ContabilizacionVentas.aspx.cs b/Contabilidad/ContabilizacionVentas.aspx.cs index 73e61b3ac..d73aa8739 100644 --- a/Contabilidad/ContabilizacionVentas.aspx.cs +++ b/Contabilidad/ContabilizacionVentas.aspx.cs @@ -412,6 +412,10 @@ public partial class Contabilidad_ContabilizacionVentas : ClsPaginas if (ObjMov.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa)) { + if (ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza,5))// por default manda la opcion 5, para ajustar a fluctuacion + { + + } Alert("Se ha simplificado la poliza correctamente", ModExtensiones.TipoMensaje.MsgInformacion); } else diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb index a18df471b..7a3a11e57 100644 --- a/Inventarios/RecepcionEntrega.aspx.vb +++ b/Inventarios/RecepcionEntrega.aspx.vb @@ -464,7 +464,7 @@ Partial Class Inventarios_RecepcionEntrega GVPendientes.DataBind() UpPendientes.Update() - DtPendientes.Dispose() + If DtPendientes IsNot Nothing Then DtPendientes.Dispose() End Sub Protected Sub GVPendientes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVPendientes.RowDataBound @@ -632,10 +632,7 @@ Partial Class Inventarios_RecepcionEntrega DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) End If - DtDatos.Columns.Add("AplicaSeccion", GetType(Boolean)) - DtDatos.Columns.Add("AplicaSerie", GetType(Boolean)) - DtDatos.Columns.Add("AplicaLote", GetType(Boolean)) - DtDatos.Columns.Add("AplicaCaducidad", GetType(Boolean)) + If Not DtDatos.Columns.Contains("Lote") Then DtDatos.Columns.Add("Lote", GetType(String)) End If @@ -1749,7 +1746,7 @@ Partial Class Inventarios_RecepcionEntrega For Each Dr As DataRow In DtDatos.Rows If Dr("CantidadGV").ToString.ToDecimal > 0 Then - If CBool(Dr("AplicaSeccion")) Then + If CBool(Dr("AplicaSerieLote")) Then DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) For Each Dr1 As DataRow In DtDetalle.Rows @@ -1882,7 +1879,12 @@ Partial Class Inventarios_RecepcionEntrega CantidadPendiente = If(Dr1("ExistenciaFinal").ToString.ToDecimal > CantidadSaldo, CantidadSaldo, Dr1("ExistenciaFinal").ToString.ToDecimal) - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, + SerieLote:=Dr("SerieLote").ToString, + CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, + FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), + Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), + CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." Exit For @@ -1894,7 +1896,8 @@ Partial Class Inventarios_RecepcionEntrega Next If ErrorMovInv Then Exit For - + Else + ErrorMovInv = True End If End If diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 07a1b7403..c968d4df8 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1038,7 +1038,7 @@ Partial Class Inventarios_RecepcionUsados Dim GenerarRNC As Boolean = False 'SI ES DISTRIBUIDOR Y NO VIENE DE REMISION, GENERA UNA REMISION DE NOTA DE CREDITO - If EsDistribuidor AndAlso Me.CveRemisionRecibida <= 0 Then + If Me.CveRemisionRecibida <= 0 Then 'EsDistribuidor AndAlso , comentado, 2020.04.21 RMF GenerarRNC = True Dim CveCliente As Integer = DdlClientes.SelectedValue.ToEntero() Dim CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue}").ToEntero diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index fdb708148..b794965e5 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -370,10 +370,10 @@