From 9b4476902a8b46dbcdcac28e6680b7372f1aa9eb Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Wed, 22 Feb 2023 10:28:34 -0700 Subject: [PATCH] Correciones saldos inicales,Compras documentos relacionados --- App_Code/ClsCompras.vb | 5 ++++- Compras/Compras.aspx.vb | 6 ++---- General/SaldosIniciales.aspx.vb | 11 ++++++----- Inventarios/EntregaAlmacen.aspx.vb | 12 +++++++++++- Ventas/ProductosServicios.aspx.vb | 6 ++++++ 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 912ad3e9f..bf49cb75f 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -197,7 +197,7 @@ Public Class ClsCompras Optional CveOC As Integer = -1, Optional CveCajaChica As Integer = -1, Optional CvePersonal As Integer = -1, Optional NumeroReembolso As String = "-1", Optional CveProveedorSucursal As Integer = -1, Optional AplicoPromocion As Boolean = False, Optional PorcentajeIVA As Double = 0, Optional CveMetodoPago As Integer = -1, Optional CveRetIVAConcepto As Integer = -1, Optional CveConceptoContableAlmacen As Integer = -1, Optional CveRetISRConcepto As Integer = -1, Optional NoDeducible As Boolean = False, Optional CveTipoCompra As Integer = -1, Optional TotalOriginal As Double = 0, Optional CveTipoConcepto As Integer = 1, Optional CveFactura As Integer = -1, - Optional CveContrato As Integer = -1, Optional EsImportacion As Boolean = False, Optional CveSubProyecto As Integer = -1) As Boolean + Optional CveContrato As Integer = -1, Optional EsImportacion As Boolean = False, Optional CveSubProyecto As Integer = -1, Optional DoctosRelacionados As String = "-1") As Boolean Dim Retorno As Boolean = False @@ -251,6 +251,9 @@ Public Class ClsCompras .Add("@CveContrato", SqlDbType.Int).Value = CveContrato .Add("@EsImportacion", SqlDbType.Bit).Value = EsImportacion .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@DoctosRelacionados", SqlDbType.VarChar).Value = DoctosRelacionados + + End With diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index b4fcf4384..a77b0da03 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4919,9 +4919,7 @@ Partial Class Compras_Compras End If Next - - - 'Compra + Dim DoctosRelacionados As String = If(UUIDSList.Count > 0, String.Join(",", UUIDSList.ToArray()), "-1") If ObjCompras.AddCompra(DdlTipoComprobante.SelectedValue, TxtDescripcion.Text.Trim, TxtSerie.Text.Trim, TxtFolio.Text.Trim, TxtFolioSecundario.Text.Trim, CveProveedor, TxtSubTotal.Text.ToDouble, TxtDescuento.Text.ToDouble, LblAmortizacion.Text.ToDouble, TxtIVA.Text.ToDouble, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtIEPS.Text.ToDouble, TxtOtrosImpuestos.Text.ToDouble, @@ -4929,7 +4927,7 @@ Partial Class Compras_Compras CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, IdPoliza, CveCajaChica:=CveCajaChica, CvePersonal:=CvePersonal, NumeroReembolso:=NumeroReembolso, CveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, AplicoPromocion:=ChkOCPromocion.Checked, PorcentajeIVA:=PorcentajeIVA, CveMetodoPago:=CveMetodoPago, CveRetIVAConcepto:=If(DdlRetIVAConcepto.Items.Count > 0, DdlRetIVAConcepto.SelectedValue.ToEntero, -1), CveConceptoContableAlmacen:=CveConceptoContableAlmacen, CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto, - EsImportacion:=EsImportacion, CveFactura:=CveFactura, CveSubProyecto:=CveSubProyectoPrincipal) Then + EsImportacion:=EsImportacion, CveFactura:=CveFactura, CveSubProyecto:=CveSubProyectoPrincipal, DoctosRelacionados:=DoctosRelacionados) Then ViewState("CveCompra") = ObjCompras.CveCompra If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 67d851a82..d8d50d128 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1821,7 +1821,7 @@ Partial Class General_SaldosIniciales Dim Codigo As String = Row("Código").ToString() Dim Descripcion As String = Row("Descripción").ToString() - Dim CuentaContable As String = Row("CuentaContable").ToString().Trim.Replace("-", "").Replace(" ", "") + Dim CuentaContable As String = Row("Cuenta Contable").ToString().Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() @@ -1833,8 +1833,8 @@ Partial Class General_SaldosIniciales ErrorAF = True End If End If - CuentaContable = Row("Cuenta Depreciación").ToString().Trim.Replace("-", "").Replace(" ", "") + CuentaContable = Row("Cuenta Depreciación").ToString().Trim.Replace("-", "").Replace(" ", "") If CuentaContable.Length > 0 Then Dim CveCuentaContable As Integer = DTCuentasContables.FiltroPrimeroValor("CveCuenta", $"Codigo ='{CuentaContable}'").ToEntero() @@ -1845,6 +1845,7 @@ Partial Class General_SaldosIniciales ErrorAF = True End If End If + Next If Not ErrorAF Then @@ -1869,8 +1870,8 @@ Partial Class General_SaldosIniciales Dim Descripcion As String = Row("Descripción").ToString() Dim TipoAF As String = Row("Tipo").ToString().Trim Dim SubTipo As String = Row("SubTipo").ToString().Trim - Dim Valor As Decimal = Row("Valor de compra").ToString().ToDecimal - Dim FechaAF As Date = Row("Fecha de compra").ToString().ToDate + Dim Valor As Decimal = Row("Valor").ToString().ToDecimal + Dim FechaAF As Date = Row("Fecha").ToString().ToDate Dim NumeroSerie As String = Row("No. Serie").ToString() Dim Año As Integer = Row("Año").ToString().ToEntero() Dim CuentaContable As String = Row("Cuenta Contable").ToString() @@ -1889,7 +1890,7 @@ Partial Class General_SaldosIniciales Dim CveEstadoActivoFijo As Integer = GlobalDTEstadoActivoFijo().FiltroPrimeroValor("CveEstadoActivoFijo", $"EstadoActivoFijo = '{Estado}'").ToString().ToEntero() Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"Nombre = '{Cliente}'").ToString().ToEntero() Dim CveCuentaContable As Integer = Row("CveCuentaContable").ToString().ToEntero() - Dim CveCuentaContableDepreciacion As Integer = Row("CveCuentaContable").ToString().ToEntero() + Dim CveCuentaContableDepreciacion As Integer = Row("CveCuentaContableDepreciacion").ToString().ToEntero() 'VALIDACIONES If Not CveSubTipoAF > 0 Then Alert($"No se encontró el SubTipo: {TipoAF} Descripcion: {Descripcion} Renglón: {NumRow}: ", TipoMensaje.MsgAdvertencia) : ErrorAF = True : Exit For diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index f0ffeda0b..70504f3c5 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -3135,7 +3135,17 @@ Partial Class Inventarios_EntregaAlmacen ErrorMovInv = True End If - 'AutoConta - El movimiento 1 es el de Venta + + + If Not ErrorMovInv AndAlso ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Compras/Compras-Guardar | Error{ObjConta.MensajePolizaDescuadre} Diferencia{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + ErrorMovInv = True + End If + End If + + + Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" If AutoConta And Not ErrorMovInv Then diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 41e4fcd44..71a1f4cda 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1316,6 +1316,12 @@ Partial Class ProductosyServicios End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click + + If DdlFraccionArancelaria.SelectedValue.ToEntero > 0 AndAlso TxtCodigo.Text.Trim.Length = 0 Then + Alert("El campo Numero de Parte / Código es requerido (al seleccionar una Fracción Arancelaria el campo Numero de Parte / Código se vuelve requerido).", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + If DdlSATPS.txtValue.Value.ToEntero > 0 Then If UsuarioActual.Empresa.Funcionalidad(161) = "1" Then ' si tiene activada la carta porte