From 5191dcbae0d781bd19b0f541f17157bea1f83a2b Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 13 May 2024 08:57:57 -0700 Subject: [PATCH 01/11] -- manejo caracter especial --- Compras/Compras.aspx.vb | 738 ++++++++++++++++++++-------------------- 1 file changed, 373 insertions(+), 365 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index d9e795b6f..ab37f5341 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1855,7 +1855,8 @@ Partial Class Compras_Compras If Validada And Not EnListadoEFOS Then Try - XMLDoc.LoadXml(File.ReadAllText(Archivo).Replace("<br>", "").Replace("<", "").Replace("o;?", "")) + ' &HFEFF, es el código ZERO WIDTH NO-BREAK SPACE + XMLDoc.LoadXml(File.ReadAllText(Archivo).Replace("<br>", "").Replace("<", "").Replace("o;?", "").Replace(ChrW(&HFEFF), "")) Catch ex As Exception Try Dim oReader As New StreamReader(Archivo, Encoding.GetEncoding("ISO-8859-1")) @@ -1865,411 +1866,416 @@ Partial Class Compras_Compras GuardaLog("Error al intentar leer el XML del SAT. Error:" & ex2.ToString()) End Try End Try + + If XMLDoc.InnerXml = "" Then + Alert("No se pudo procesar el archivo xml.", TipoMensaje.MsgError) + Return "" + End If + CreaDTConceptos() CargaComprobanteXML(XMLDoc) - If NuevaValidacionXML = 1 OrElse (Version = "3.3" OrElse Version = "4.0") Then - Dim Xml As String - Dim nodo As XmlNode = XMLDoc.DocumentElement - Dim Version As String = ValorXML(nodo, "version") - Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) - Dim cfdVer As String = "" - Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) + Dim Xml As String + Dim nodo As XmlNode = XMLDoc.DocumentElement + Dim Version As String = ValorXML(nodo, "version") + Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) + Dim cfdVer As String = "" + Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) - If Version = "3.2" Then - Prefijo = "cfd" - cfdVer = "http://www.sat.gob.mx/cfd/2" - ElseIf Version = "3.3" Then - cfdVer = "http://www.sat.gob.mx/cfd/3" - Else ' se considera que es la version 4.0 - cfdVer = "http://www.sat.gob.mx/cfd/4" + If Version = "3.2" Then + Prefijo = "cfd" + cfdVer = "http://www.sat.gob.mx/cfd/2" + ElseIf Version = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" + End If + + 'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" + + namespaces.AddNamespace(Prefijo, cfdVer) + namespaces.AddNamespace("aerolineas", "http://www.sat.gob.mx/aerolineas") + namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") + namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") + namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") + + Dim nodeconceptos As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Conceptos", Prefijo), namespaces) + Xml = Replace(nodeconceptos.OuterXml, "", "") 'salto de linea html + Xml = Xml.Replace("<br>", "") + Xml = Xml.Replace("<", "") + Xml = Xml.Replace("&", "") 'adicional, si hay otros + + If ObjeFacturas.GetFacturasComparacionXML(Version, Xml, UsuarioActual.CveEmpresa) Then + TmpDT = ObjeFacturas.DtResultados + TmpDT.Columns.Add("CveSATPSActualizado") + SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL + + If Not TmpDT.Columns.Contains("Amortizacion") Then + TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) + End If + + AddPS2(False) + + 'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101 + Dim ProductosCodigoSATNoPermitidos As New StringBuilder("") + For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows + ProductosCodigoSATNoPermitidos.AppendFormat("{0}
", drr("PS")) + Next + + If TmpDT.MAX("RetISRPorcentaje").ToDecimal = 0.0125 Then RetISRResico = True + If TmpDT.MAX("RetIVAPorcentaje").ToDecimal = 0.04 Then RetIVAFlete = True + + If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then + Dim mensajeAdvertencia As String = String.Format("El XML que intenta registrar contiene partidas o artículos con código SAT ‘01010101’ el cual no es aceptado, hable con su proveedor para cancelar y/o refacturar un XML válido.
Partidas o artículos con código ‘01010101’:

{0}", ProductosCodigoSATNoPermitidos.ToString) + Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia) + If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso Not UsuarioActual.CveUsuario.Contiene(1719, 1721) Then BtnGuardar.Enabled = False '' solo se activa para el usuario Sara.JAM + BtnGuardar.ToolTip = "No se permite registrar facturas con conceptos con código '01010101'. Solicite al proveedor un nuevo comprobante." + End If + + End If + + + + Dim SbValRet As New StringBuilder + For Each concepto As XmlNode In nodeconceptos + ' Obtener la descripción del concepto + Dim descripcion As String = ValorXML(concepto, "Descripcion") + Dim importeValue As Decimal = Decimal.Parse(ValorXML(concepto, "Importe")) + + ' Seleccionar el nodo de Impuestos dentro de Concepto, si existe + Dim impuestosNode As XmlNode = concepto.SelectSingleNode("cfdi:Impuestos", namespaces) + + If Not impuestosNode Is Nothing Then + ' Seleccionar los nodos de Retencion dentro de Impuestos + Dim retenciones As XmlNodeList = impuestosNode.SelectNodes("cfdi:Retenciones/cfdi:Retencion", namespaces) + For Each retencion As XmlNode In retenciones + ' Obtener los valores de los atributos Base e Importe + Dim baseValue As Decimal = Decimal.Parse(ValorXML(retencion, "Base")) + Dim impuesto As String = ValorXML(retencion, "Impuesto") + + If impuesto = "001" Then + impuesto = "Retención ISR" + ElseIf impuesto = "002" Then + impuesto = "Retención IVA" + ElseIf impuesto = "003" Then + impuesto = "IEPS" + End If + + + ' Validar si Base coincide con Importe + If baseValue <> importeValue Then + 'SbValRet.Append($"La base e importe de la retención del impuesto {impuesto} no coinciden para {descripcion}. Base: {baseValue.ToString()}, Importe: {importeValue.ToString()}
") + SbValRet.Append($"Producto: {descripcion} La base e importe del impuesto {impuesto} no coincide Base: {baseValue.ToString()}, Importe Producto: {importeValue.ToString()}
") + End If + Next + End If + Next + + If SbValRet.ToString.Trim.Length > 0 Then + Alert(SbValRet.ToString, TipoMensaje.MsgAdvertencia) + End If + + + + Else + CargaConceptosXML(XMLDoc) End If - 'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2" + Select Case TipoComprobante + Case "ingreso" : DdlTipoComprobante.SelectedValue = "Fac" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) + Case "egreso" : DdlTipoComprobante.SelectedValue = "NC" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) : ChkAplicaNotaCredito.Enabled = False + Case "I" + DdlTipoComprobante.SelectedValue = "Fac" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) + DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("6")) + DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("11")) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlTipoCompra.Items.Add(New ListItem("Recolección", "14")) + Case "E" + DdlTipoComprobante.SelectedValue = "NC" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + ChkAplicaNotaCredito.Enabled = False - namespaces.AddNamespace(Prefijo, cfdVer) - namespaces.AddNamespace("aerolineas", "http://www.sat.gob.mx/aerolineas") - namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") - namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") - namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") + DdlTipoCompra.Items.Clear() + DdlTipoCompra.Items.Add(New ListItem("Seleccione", "-1")) + DdlTipoCompra.Items.Add(New ListItem("NC Con Productos", "6")) + DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) + DdlTipoCompra.Items.Add(New ListItem("NC Por Devolución", "11")) + DdlTipoCompra.Items.Add(New ListItem("Garantía", "12")) + Case "T" + DdlTipoCompra.Items.Clear() + DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) + DdlTipoComprobante.SelectedValue = "Fac" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) - Dim nodeconceptos As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Conceptos", Prefijo), namespaces) - Xml = Replace(nodeconceptos.OuterXml, "", "") 'salto de linea html - Xml = Xml.Replace("<br>", "") - Xml = Xml.Replace("<", "") - Xml = Xml.Replace("&", "") 'adicional, si hay otros + End Select - If ObjeFacturas.GetFacturasComparacionXML(Version, Xml, UsuarioActual.CveEmpresa) Then - TmpDT = ObjeFacturas.DtResultados - TmpDT.Columns.Add("CveSATPSActualizado") - SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL + 'DIV ALIAS + CargaPSAlias() + + RFC = dr("RFCDe").ToString + RFCProveedor = RFC + TxtFecha.Text = dr("FechaFactura").ToString.ToDate.ToShortDateString + TxtSerie.Text = dr("Serie").ToString + TxtFolio.Text = dr("Folio").ToString + DdlValidadaSAT.SelectedValue = If(dr("FueValidado").ToString.Contiene("Si", "1"), "Si", "No") + DdlValidadaSAT.Enabled = False + LblTipoFact.Text = dr("TipoFactura").ToString + SerieVieja = dr("Serie").ToString + LblMetodoPago.Text = MetodoPago + + Dim SubTotal2, IVA, IEPS As Decimal + IVA = TrasladoIVA + + If Not UsuarioActual.TienePermisoProceso(130) Then + TxtFolio.Enabled = False + TxtSerie.Enabled = False + End If + + 'PERMISO PARA MODIFICACIÓN DE FECHA AUN CON FACTURA + TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + CEFecha.Enabled = UsuarioActual.TienePermisoProceso(216) + + TxtSubTotal.Enabled = False + TxtDescuento.Enabled = False + TxtSubTotal2.Enabled = False + TxtIVA.Enabled = False + TxtTotal.Enabled = False + DdlProveedor.Enabled = False + + If TxtFolio.Text.Trim = "" Then TxtFolio.Enabled = True : TxtSerie.Enabled = True + + If UsuarioActual.TienePermisoProceso(112) Then + PermisoEdicionManual = True + TxtSubTotal.Enabled = True + TxtDescuento.Enabled = True + TxtSubTotal2.Enabled = True + TxtIVA.Enabled = True + TxtTotal.Enabled = True + End If + + If UsuarioActual.Empresa.Funcionalidad(118) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Fac" Then + VerVales.Visible = True + End If + + If TieneAnticiposXML Then 'si tiene anticipos, limpia los descuentos + 'LblAmortizacion.Text = ImporteAnticipo.FormatoNumero + TxtDescuento.Text = "0.00" + LblAmortizacion.Text = Descuentos.FormatoNumero + 'limpia los descuentos + For Each drr As DataRow In TmpDT.Rows + 'drr("Total") = drr("Total").ToString.ToDecimal + drr("Descuento").ToString.ToDecimal + drr("Amortizacion") = drr("Descuento") 'pasamos el importe de descuento a amortizacion + drr("Descuento") = 0.00 + Next + Amortizaciones = Descuentos + Descuentos = 0 + End If + + Dim Msg As String = "" + If Version = "3.3" Or Version = "4.0" Then If Not TmpDT.Columns.Contains("Amortizacion") Then TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) End If + TmpDT.AcceptChanges() + ValidacionesTotalesXml() + Else + 'PRUEBA + 'http://rm/Compras/Compras.aspx?CveFactura=122518 Emp: 48 - AddPS2(False) + 'tTotal = Math.Round(SubTotal2 + IVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos, 2) + HdnCompraSaldo.Value = Total.ToString + CompraSaldo = Total + Dim AjustaUltimoConcepto As Boolean = False - 'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101 - Dim ProductosCodigoSATNoPermitidos As New StringBuilder("") - For Each drr As DataRow In TmpDT.FiltraParametros("ClaveProdServ = '01010101'").Rows - ProductosCodigoSATNoPermitidos.AppendFormat("{0}
", drr("PS")) - Next - - If TmpDT.MAX("RetISRPorcentaje").ToDecimal = 0.0125 Then RetISRResico = True - If TmpDT.MAX("RetIVAPorcentaje").ToDecimal = 0.04 Then RetIVAFlete = True - - If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then - Dim mensajeAdvertencia As String = String.Format("El XML que intenta registrar contiene partidas o artículos con código SAT ‘01010101’ el cual no es aceptado, hable con su proveedor para cancelar y/o refacturar un XML válido.
Partidas o artículos con código ‘01010101’:

{0}", ProductosCodigoSATNoPermitidos.ToString) - Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia) - If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso Not UsuarioActual.CveUsuario.Contiene(1719, 1721) Then BtnGuardar.Enabled = False '' solo se activa para el usuario Sara.JAM - BtnGuardar.ToolTip = "No se permite registrar facturas con conceptos con código '01010101'. Solicite al proveedor un nuevo comprobante." + 'AGREGA IEPS COMO CONCEPTO + If TrasladoIEPS > 0 And UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero > 0 Then + AgregarConceptoIEPS(TrasladoIEPS, UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero) + ' TrasladoIEPS = 0 + End If + 'en otro impuesto lo esta registrando en ajuste en automatico + If OtrosImpuestos > 0 Then + AjustaUltimoConcepto = True End If - End If - - - - Dim SbValRet As New StringBuilder - For Each concepto As XmlNode In nodeconceptos - ' Obtener la descripción del concepto - Dim descripcion As String = ValorXML(concepto, "Descripcion") - Dim importeValue As Decimal = Decimal.Parse(ValorXML(concepto, "Importe")) - - ' Seleccionar el nodo de Impuestos dentro de Concepto, si existe - Dim impuestosNode As XmlNode = concepto.SelectSingleNode("cfdi:Impuestos", namespaces) - - If Not impuestosNode Is Nothing Then - ' Seleccionar los nodos de Retencion dentro de Impuestos - Dim retenciones As XmlNodeList = impuestosNode.SelectNodes("cfdi:Retenciones/cfdi:Retencion", namespaces) - For Each retencion As XmlNode In retenciones - ' Obtener los valores de los atributos Base e Importe - Dim baseValue As Decimal = Decimal.Parse(ValorXML(retencion, "Base")) - Dim impuesto As String = ValorXML(retencion, "Impuesto") - - If impuesto = "001" Then - impuesto = "Retención ISR" - ElseIf impuesto = "002" Then - impuesto = "Retención IVA" - ElseIf impuesto = "003" Then - impuesto = "IEPS" - End If - - - ' Validar si Base coincide con Importe - If baseValue <> importeValue Then - 'SbValRet.Append($"La base e importe de la retención del impuesto {impuesto} no coinciden para {descripcion}. Base: {baseValue.ToString()}, Importe: {importeValue.ToString()}
") - SbValRet.Append($"Producto: {descripcion} La base e importe del impuesto {impuesto} no coincide Base: {baseValue.ToString()}, Importe Producto: {importeValue.ToString()}
") - End If - Next + If RFC = "CFE370814QI0" Then ' RFC de CFE, se hace un ajuste por diferencia para sacar el DAP + 'OtrosImpuestos = Total - (SubTotal2 + IVA) + 'este importe lo vamos a meter al gasto + 'AjustaImporteUltimoConcepto(OtrosImpuestos) + OtrosImpuestos = 1 + AjustaUltimoConcepto = True + 'SubTotal2 = SubTotal End If - Next - If SbValRet.ToString.Trim.Length > 0 Then - Alert(SbValRet.ToString, TipoMensaje.MsgAdvertencia) - End If + Dim SubTotalReal As Decimal = 0 + SubTotalReal = Math.Round(Total + RetencionISR + RetencionIVA - IVA + Descuentos - TrasladoIEPS, 2) ' NO se incluye otros impuestos para ajustar esa cifra + Dim DiferenciaTotales As Decimal = SubTotalReal - Math.Round(SubTotalConceptos, 2) + If DiferenciaTotales <> 0 Then + 'Verificamos IEPS y Otros Impuestos + 'restricccion general, que si el subtotal de los conceptos no cuadra con Total + RetISR + RetIVA - IVA <> SubTotalConeptos, ajuste al final + If TrasladoIEPS > 0 OrElse OtrosImpuestos > 0 OrElse Math.Abs(DiferenciaTotales) < 1 Then + 'Condicion necesaria cuando hay IVA pero no hay diferencia + If DiferenciaTotales <> 0 Then - Else - CargaConceptosXML(XMLDoc) - End If + If DiferenciaTotales < 50 OrElse AjustaUltimoConcepto = True Then + Dim IA As Decimal = Total + RetencionISR + RetencionIVA - IVA - SubTotalConceptos - TrasladoIEPS + Descuentos + AjustaImporteUltimoConcepto(IA, True) - Select Case TipoComprobante - Case "ingreso" : DdlTipoComprobante.SelectedValue = "Fac" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) - Case "egreso" : DdlTipoComprobante.SelectedValue = "NC" : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) : DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) : ChkAplicaNotaCredito.Enabled = False - Case "I" - DdlTipoComprobante.SelectedValue = "Fac" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) - DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("6")) - DdlTipoCompra.Items.Remove(DdlTipoCompra.Items.FindByValue("11")) - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlTipoCompra.Items.Add(New ListItem("Recolección", "14")) - Case "E" - DdlTipoComprobante.SelectedValue = "NC" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Fac")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) - ChkAplicaNotaCredito.Enabled = False + ElseIf DiferenciaTotales > 50 Then + PnlAjusteProductos.Visible = True + Dim Porcentaje As Double = Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2) + TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero + Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
") + ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - DdlTipoCompra.Items.Clear() - DdlTipoCompra.Items.Add(New ListItem("Seleccione", "-1")) - DdlTipoCompra.Items.Add(New ListItem("NC Con Productos", "6")) - DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) - DdlTipoCompra.Items.Add(New ListItem("NC Por Devolución", "11")) - DdlTipoCompra.Items.Add(New ListItem("Garantía", "12")) - Case "T" - DdlTipoCompra.Items.Clear() - DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) - DdlTipoComprobante.SelectedValue = "Fac" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("NC")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("DEV")) - - End Select - - 'DIV ALIAS - CargaPSAlias() - - RFC = dr("RFCDe").ToString - RFCProveedor = RFC - TxtFecha.Text = dr("FechaFactura").ToString.ToDate.ToShortDateString - TxtSerie.Text = dr("Serie").ToString - TxtFolio.Text = dr("Folio").ToString - DdlValidadaSAT.SelectedValue = If(dr("FueValidado").ToString.Contiene("Si", "1"), "Si", "No") - DdlValidadaSAT.Enabled = False - LblTipoFact.Text = dr("TipoFactura").ToString - SerieVieja = dr("Serie").ToString - LblMetodoPago.Text = MetodoPago - - Dim SubTotal2, IVA, IEPS As Decimal - IVA = TrasladoIVA - - If Not UsuarioActual.TienePermisoProceso(130) Then - TxtFolio.Enabled = False - TxtSerie.Enabled = False - End If - - 'PERMISO PARA MODIFICACIÓN DE FECHA AUN CON FACTURA - TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216) - ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216) - CEFecha.Enabled = UsuarioActual.TienePermisoProceso(216) - - TxtSubTotal.Enabled = False - TxtDescuento.Enabled = False - TxtSubTotal2.Enabled = False - TxtIVA.Enabled = False - TxtTotal.Enabled = False - DdlProveedor.Enabled = False - - If TxtFolio.Text.Trim = "" Then TxtFolio.Enabled = True : TxtSerie.Enabled = True - - If UsuarioActual.TienePermisoProceso(112) Then - PermisoEdicionManual = True - TxtSubTotal.Enabled = True - TxtDescuento.Enabled = True - TxtSubTotal2.Enabled = True - TxtIVA.Enabled = True - TxtTotal.Enabled = True - End If - - If UsuarioActual.Empresa.Funcionalidad(118) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Fac" Then - VerVales.Visible = True - End If - - If TieneAnticiposXML Then 'si tiene anticipos, limpia los descuentos - 'LblAmortizacion.Text = ImporteAnticipo.FormatoNumero - TxtDescuento.Text = "0.00" - LblAmortizacion.Text = Descuentos.FormatoNumero - 'limpia los descuentos - For Each drr As DataRow In TmpDT.Rows - 'drr("Total") = drr("Total").ToString.ToDecimal + drr("Descuento").ToString.ToDecimal - drr("Amortizacion") = drr("Descuento") 'pasamos el importe de descuento a amortizacion - drr("Descuento") = 0.00 - Next - Amortizaciones = Descuentos - Descuentos = 0 - End If - - Dim Msg As String = "" - If Version = "3.3" Or Version = "4.0" Then - - If Not TmpDT.Columns.Contains("Amortizacion") Then - TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) - End If - TmpDT.AcceptChanges() - ValidacionesTotalesXml() - Else - 'PRUEBA - 'http://rm/Compras/Compras.aspx?CveFactura=122518 Emp: 48 - - 'tTotal = Math.Round(SubTotal2 + IVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos, 2) - HdnCompraSaldo.Value = Total.ToString - CompraSaldo = Total - Dim AjustaUltimoConcepto As Boolean = False - - 'AGREGA IEPS COMO CONCEPTO - If TrasladoIEPS > 0 And UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero > 0 Then - AgregarConceptoIEPS(TrasladoIEPS, UsuarioActual.Empresa.Funcionalidad(112).ToString.ToEntero) - ' TrasladoIEPS = 0 - End If - 'en otro impuesto lo esta registrando en ajuste en automatico - If OtrosImpuestos > 0 Then - AjustaUltimoConcepto = True - End If - - If RFC = "CFE370814QI0" Then ' RFC de CFE, se hace un ajuste por diferencia para sacar el DAP - 'OtrosImpuestos = Total - (SubTotal2 + IVA) - 'este importe lo vamos a meter al gasto - 'AjustaImporteUltimoConcepto(OtrosImpuestos) - OtrosImpuestos = 1 - AjustaUltimoConcepto = True - 'SubTotal2 = SubTotal - End If - - Dim SubTotalReal As Decimal = 0 - SubTotalReal = Math.Round(Total + RetencionISR + RetencionIVA - IVA + Descuentos - TrasladoIEPS, 2) ' NO se incluye otros impuestos para ajustar esa cifra - Dim DiferenciaTotales As Decimal = SubTotalReal - Math.Round(SubTotalConceptos, 2) - - If DiferenciaTotales <> 0 Then - 'Verificamos IEPS y Otros Impuestos - 'restricccion general, que si el subtotal de los conceptos no cuadra con Total + RetISR + RetIVA - IVA <> SubTotalConeptos, ajuste al final - If TrasladoIEPS > 0 OrElse OtrosImpuestos > 0 OrElse Math.Abs(DiferenciaTotales) < 1 Then - - 'Condicion necesaria cuando hay IVA pero no hay diferencia - If DiferenciaTotales <> 0 Then - - If DiferenciaTotales < 50 OrElse AjustaUltimoConcepto = True Then - Dim IA As Decimal = Total + RetencionISR + RetencionIVA - IVA - SubTotalConceptos - TrasladoIEPS + Descuentos - AjustaImporteUltimoConcepto(IA, True) - - ElseIf DiferenciaTotales > 50 Then - PnlAjusteProductos.Visible = True - Dim Porcentaje As Double = Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2) - TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero - Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
") - ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - - 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias - For Each Row As GridViewRow In GvPS.Rows - Row.FCLinkButton("imgE").Visible = False - Row.FCLinkButton("imgD").Visible = False - Next + 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias + For Each Row As GridViewRow In GvPS.Rows + Row.FCLinkButton("imgE").Visible = False + Row.FCLinkButton("imgD").Visible = False + Next + End If End If + TrasladoIEPS = 0 : OtrosImpuestos = 0 : SubTotal2 = SubTotal + Else + PnlAjusteProductos.Visible = True + Dim Porcentaje As Double = If(SubTotalConceptos > 0, Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2), 0) + TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero + Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
") + ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False + + 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias + For Each Row As GridViewRow In GvPS.Rows + Row.FCLinkButton("imgE").Visible = False + Row.FCLinkButton("imgD").Visible = False + Next End If - TrasladoIEPS = 0 : OtrosImpuestos = 0 : SubTotal2 = SubTotal - Else - PnlAjusteProductos.Visible = True - Dim Porcentaje As Double = If(SubTotalConceptos > 0, Math.Round((SubTotalConceptos - SubTotalReal) / SubTotalConceptos * 100, 2), 0) - TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero - Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
") - ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - - 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias - For Each Row As GridViewRow In GvPS.Rows - Row.FCLinkButton("imgE").Visible = False - Row.FCLinkButton("imgD").Visible = False - Next End If - End If - 'Si no hay diferencias pero tenemos descuento, se ofrece la opcion para ajustar el gasto - If Descuentos > 0 Then + 'Si no hay diferencias pero tenemos descuento, se ofrece la opcion para ajustar el gasto + If Descuentos > 0 Then - '[IPP] PARCHE: Factura TELMEX para APH 12/ENERO/2018 - If CveFactura = 286290 Then + '[IPP] PARCHE: Factura TELMEX para APH 12/ENERO/2018 + If CveFactura = 286290 Then - Else - PnlAjusteProductos.Visible = True - Dim Porcentaje As Double = Math.Round((Descuentos) / (SubTotalConceptos) * 100, 4) - TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero(4) - Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
") - ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False + Else + PnlAjusteProductos.Visible = True + Dim Porcentaje As Double = Math.Round((Descuentos) / (SubTotalConceptos) * 100, 4) + TxtAjustePorcentaje.Text = Porcentaje.FormatoNumero(4) + Msg &= String.Format("La Factura presenta anomalias en los importes mostrados, estas anomalias impiden que se editen las partidas. Por favor realice el ajuste correspondiente
") + ImgBtnBuscarOC.Visible = False : TxtOC.Enabled = False - 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias - For Each Row As GridViewRow In GvPS.Rows - Row.FCLinkButton("imgE").Visible = False - Row.FCLinkButton("imgD").Visible = False - Next + 'Ocultamos la opcion de Editar y Eliminar hasta que se arreglen las anomalias + For Each Row As GridViewRow In GvPS.Rows + Row.FCLinkButton("imgE").Visible = False + Row.FCLinkButton("imgD").Visible = False + Next + End If End If + + SubTotal2 = SubTotalReal - Descuentos + + If Descuentos > 0 Then + TrDescuento.Visible = True + End If + + If Msg <> "" Then + Alert(Msg, TipoMensaje.MsgAdvertencia) + BtnGuardar.Enabled = False + End If + 'AJUSTAMOS SUBTOTAL EN CASO DE SER DIFERENTE AL SUBTOTAL2 DEL XML (TOTAL - IVA) + If SubTotal2 <> SubTotal Then + SubTotal = SubTotalConceptos + End If + + TxtSubTotal.Text = SubTotal.FormatoNumero + TxtDescuento.Text = Descuentos.FormatoNumero + TxtSubTotal2.Text = SubTotal2.FormatoNumero + TxtIVA.Text = IVA.FormatoNumero + TxtTotal.Text = Total.ToString.FormatoNumero + + HfTotalCompra.Value = Total.ToString + CompraSaldo = Total + + CalculaTotalPorDevengar() + TxtDocumentoImporteFE.Text = Total.ToString + RVDocumentoImporte.MaximumValue = Math.Round(Total, 2).ToString + RVDocumentoImporteFE.MaximumValue = RVDocumentoImporte.MaximumValue + RVDocumentoImporteCaja.MaximumValue = RVDocumentoImporte.MaximumValue + TxtDocumentoImporte.Text = Total.FormatoNumero + TxtDocumentoImporteCaja.Text = Total.FormatoNumero + TxtRetIVA.Text = RetencionIVA.FormatoNumero + TxtRetISR.Text = RetencionISR.FormatoNumero + TxtIEPS.Text = IEPS.FormatoNumero + If IEPS > 0 Then TrIEPS.Visible = True + If RetencionIVA > 0 Then TrRetIVA.Visible = True + If RetencionISR > 0 Then TrRetISR.Visible = True + TxtOtrosImpuestos.Text = OtrosImpuestos.FormatoNumero + If OtrosImpuestos > 0 Then TrOtrosImpuestos.Visible = True + + HFDiferenciaCompra.Value = TxtTotal.Text + 'ASIGNA VALORES ORIGINALES PARA GUARDAR + AsignaValoresOriginales(SubTotal, SubTotal2, IVA, RetencionIVA, RetencionISR, Total) + End If + TxtFechaPago.Text = (TxtFecha.Text.ToDate.AddDays(LblDiasCredito.Text.ToEntero)).ToShortDateString - SubTotal2 = SubTotalReal - Descuentos - - If Descuentos > 0 Then - TrDescuento.Visible = True - End If - - If Msg <> "" Then - Alert(Msg, TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - End If - 'AJUSTAMOS SUBTOTAL EN CASO DE SER DIFERENTE AL SUBTOTAL2 DEL XML (TOTAL - IVA) - If SubTotal2 <> SubTotal Then - SubTotal = SubTotalConceptos - End If - - TxtSubTotal.Text = SubTotal.FormatoNumero - TxtDescuento.Text = Descuentos.FormatoNumero - TxtSubTotal2.Text = SubTotal2.FormatoNumero - TxtIVA.Text = IVA.FormatoNumero - TxtTotal.Text = Total.ToString.FormatoNumero - - HfTotalCompra.Value = Total.ToString - CompraSaldo = Total - - CalculaTotalPorDevengar() - TxtDocumentoImporteFE.Text = Total.ToString - RVDocumentoImporte.MaximumValue = Math.Round(Total, 2).ToString - RVDocumentoImporteFE.MaximumValue = RVDocumentoImporte.MaximumValue - RVDocumentoImporteCaja.MaximumValue = RVDocumentoImporte.MaximumValue - TxtDocumentoImporte.Text = Total.FormatoNumero - TxtDocumentoImporteCaja.Text = Total.FormatoNumero - TxtRetIVA.Text = RetencionIVA.FormatoNumero - TxtRetISR.Text = RetencionISR.FormatoNumero - TxtIEPS.Text = IEPS.FormatoNumero - If IEPS > 0 Then TrIEPS.Visible = True - If RetencionIVA > 0 Then TrRetIVA.Visible = True - If RetencionISR > 0 Then TrRetISR.Visible = True - TxtOtrosImpuestos.Text = OtrosImpuestos.FormatoNumero - If OtrosImpuestos > 0 Then TrOtrosImpuestos.Visible = True - - HFDiferenciaCompra.Value = TxtTotal.Text - 'ASIGNA VALORES ORIGINALES PARA GUARDAR - AsignaValoresOriginales(SubTotal, SubTotal2, IVA, RetencionIVA, RetencionISR, Total) - - End If - TxtFechaPago.Text = (TxtFecha.Text.ToDate.AddDays(LblDiasCredito.Text.ToEntero)).ToShortDateString - - Dim drMon As DataRow = GlobalDTMonedas.FiltroPrimero(String.Format(" (Abreviatura LIKE '%{0}%' OR Moneda LIKE '%{0}%' )", Moneda)) - - If drMon IsNot Nothing Then - DdlMoneda.SelectedValue = drMon("CveMoneda").ToString - CveMoneda = drMon("CveMoneda").ToString.ToEntero - Else - 'sino busco en la tabla de alias - drMon = GlobalDTMonedasAlias.FiltroPrimero(String.Format("MonedaAlias LIKE '%{0}%' ", Moneda)) + Dim drMon As DataRow = GlobalDTMonedas.FiltroPrimero(String.Format(" (Abreviatura LIKE '%{0}%' OR Moneda LIKE '%{0}%' )", Moneda)) If drMon IsNot Nothing Then DdlMoneda.SelectedValue = drMon("CveMoneda").ToString CveMoneda = drMon("CveMoneda").ToString.ToEntero Else - LblMoneda.Text = Moneda - LblMoneda.ForeColor = Drawing.Color.Red - End If - End If + 'sino busco en la tabla de alias + drMon = GlobalDTMonedasAlias.FiltroPrimero(String.Format("MonedaAlias LIKE '%{0}%' ", Moneda)) - If DdlMoneda.SelectedValue.ToEntero > 1 Then - If TipoCambio <= 10 Then - TipoCambio = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + If drMon IsNot Nothing Then + DdlMoneda.SelectedValue = drMon("CveMoneda").ToString + CveMoneda = drMon("CveMoneda").ToString.ToEntero + Else + LblMoneda.Text = Moneda + LblMoneda.ForeColor = Drawing.Color.Red + End If End If - TxtFecha.Attributes.Remove("onblur") - If UsuarioActual.Empresa.UsaAC Then - TxtFecha.Attributes.Add("onblur", "CambiaFecha();CambiaFechaTC();") - Else - TxtFecha.Attributes.Add("onblur", "CambiaFechaTC();") + If DdlMoneda.SelectedValue.ToEntero > 1 Then + If TipoCambio <= 10 Then + TipoCambio = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + End If + + TxtFecha.Attributes.Remove("onblur") + If UsuarioActual.Empresa.UsaAC Then + TxtFecha.Attributes.Add("onblur", "CambiaFecha();CambiaFechaTC();") + Else + TxtFecha.Attributes.Add("onblur", "CambiaFechaTC();") + End If + End If + + If TipoCambio > 0 And DdlMoneda.SelectedValue.ToEntero > 1 Then LblTC.Text = String.Format("TC: {0}", TipoCambio.ToString("N4")) + + 'DF - 10-04-17 + If UsuarioActual.TienePermisoProceso(187) Then + TxtSerie.Enabled = True + End If + + If LblMetodoPago.Text = "" AndAlso TipoComprobante <> "T" Then + Alert("El xml no contiene la etiqueta 'método de pago', favor de verificar la emisión con el proveedor.", TipoMensaje.MsgAdvertencia) + BtnGuardar.Visible = False End If End If - - If TipoCambio > 0 And DdlMoneda.SelectedValue.ToEntero > 1 Then LblTC.Text = String.Format("TC: {0}", TipoCambio.ToString("N4")) - - 'DF - 10-04-17 - If UsuarioActual.TienePermisoProceso(187) Then - TxtSerie.Enabled = True - End If - - If LblMetodoPago.Text = "" AndAlso TipoComprobante <> "T" Then - Alert("El xml no contiene la etiqueta 'método de pago', favor de verificar la emisión con el proveedor.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Visible = False - End If - End If - Else + Else Alert("No se Encontró la Factura", TipoMensaje.MsgAdvertencia) BtnGuardar.Visible = False End If @@ -9265,7 +9271,7 @@ Partial Class Compras_Compras Dim CveProveedorConcepto As Integer = 0, CveIE As Integer = 0, CveCreditoDetalle As Integer = 0 Dim ConceptoPersonal As String = "", Concepto As String = "" Dim tUsaInventarios As Boolean = UsuarioActual.Empresa.UsaInventarios - If (UsuarioActual.CveEmpresa.Contiene(13, 83)) Then tUsaInventarios = False + If (UsuarioActual.CveEmpresa.Contiene(13, 83, 7, 11, 12, 122, 145)) Then tUsaInventarios = False If Not ObjConta.GetPrePolizasDetalleCompra(CveCompra, UsuarioActual.CveEmpresa) Then ErrorPrepoliza = True @@ -18533,7 +18539,9 @@ Partial Class Compras_Compras If ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 49, CveCompra, 1) Then If ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 68, CveCompra, 1) Then If ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 6, CveCompra, 1) Then - TieneError = False + If ObjConta.RemovePrePolizasDetalle(CvePrePoliza, 205, CveCompra, 1) Then + TieneError = False + End If End If End If End If From 7d4dfefe7c79bee5706b6bacb4c2c2feb3c7df6b Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 14 May 2024 07:59:01 -0700 Subject: [PATCH 02/11] =?UTF-8?q?-=20formato=20factor=20integraci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Nomina/Nomina.aspx.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index c57915175..0d1a67388 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -3927,7 +3927,7 @@ public partial class Nomina_Nomina2 : ClsPaginas if (frow != null) { - TxtInfoValor.Text = String.Format("{0:###,###.##}", frow["Importe"]); + TxtInfoValor.Text = String.Format("{0:###,###.####}", frow["Importe"]); DdlInfoTipoAplicacion.SelectedValueExist(frow["TipoAplicacion"].ToString()); TxtInfoDescripcion.Text = String.Format("{0}", frow["Descripcion02"]); From e3b36be44414d3a1909155ce454d6d22812b1505 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 14 May 2024 07:59:19 -0700 Subject: [PATCH 03/11] -- contabilizar = false, si el almacen es de solo existencia --- Inventarios/EntradasSalidas.aspx.vb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index d89dcfd47..74b6c7b74 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -3946,7 +3946,9 @@ Partial Class Inventarios_EntradasSalidas Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim DTOCs As DataTable = DtCostos.FiltraParametros("", "", {"CveOrdenCompraDetalle"}) Dim ConceptoPoliza As String = String.Format("{0}-{1}", DdlConcepto.SelectedItem.Text, If(DdlConcepto.SelectedValue.ToEntero.Contiene(3), HplVenta.Text, TxtFolio.Text)) - Dim Contabilizable As Boolean = True + Dim CveModalidad As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero).FiltroPrimeroValor("CveModalidad").ToEntero() + + Dim Contabilizable As Boolean = (CveModalidad = 1) If tmpCostos.Rows.Count > 0 Then Dim Concepto As String = If(TxtObservaciones.Text = "", ConceptoPoliza, $" {TxtObservaciones.Text}") @@ -3955,7 +3957,7 @@ Partial Class Inventarios_EntradasSalidas If HplCompra.Visible AndAlso HplCompra.Text <> "" Then ValorInventario = DtCostos.SUMD("Total") - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ValorInventario, ValorInventario, 205, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteME:=ValorInventario, CveCompra:=HdnCveCompra.Value.ToEntero, TipoCambio:=LbTipoCambio.Text.ToDecimal) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ValorInventario, ValorInventario, 205, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimiento, ImporteME:=ValorInventario, CveCompra:=HdnCveCompra.Value.ToEntero, TipoCambio:=LbTipoCambio.Text.ToDecimal, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If ' ValorInventario = ValorInventario - ValorInventarioME From e3ce9b7adc843d5b2584cc7bf13acaa5fa8f4877 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 14 May 2024 08:00:23 -0700 Subject: [PATCH 04/11] =?UTF-8?q?-=20mejora=20en=20validaci=C3=B3n=20de=20?= =?UTF-8?q?EMD=20presupuesto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Compras/Compras.aspx.vb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index ab37f5341..7d5dc99d7 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4187,20 +4187,17 @@ Partial Class Compras_Compras Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click - - If Not ValidaPresupuesto(2) Then Exit Sub End If '------------------ INICIA VALIDACIONES ------------------ - If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 Then + If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 AndAlso LblSaldoFactura.Text.ToDecimal > 0 Then Alert("La orden de compra se definió de contado, favor de especificar la compra de contado.", TipoMensaje.MsgAdvertencia) Exit Sub End If - Dim CveSubProyectoPrincipal As Integer = AsignarSubProyectoPrincipal() If Not CveSubProyectoPrincipal > 0 Then @@ -4208,7 +4205,7 @@ Partial Class Compras_Compras End If If Not ValidaVinculacionNotaFactura() Then - Alert("Se requiere que la nota este aplciada a las facturas", TipoMensaje.MsgAdvertencia) + Alert("Se requiere que la nota este aplicada a las facturas", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -8615,7 +8612,6 @@ Partial Class Compras_Compras 'PORCENTAJE IVA Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal - Dim TmpCveRetIVAConcepto As Integer = If(CveRetIVAConceptoOriginal <> DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetIVAConcepto.SelectedValue.ToEntero, -1) Dim TmpCveRetISRConcepto As Integer = If(CveRetISRConceptoOriginal <> DdlRetISRConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, -1) Dim tNoDeducible As Integer = If(ChkEsNoDeducible.Checked, 1, 0) From 916f14a06670ec16aee7d65d8747d472ef2b617b Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 14 May 2024 23:36:54 -0700 Subject: [PATCH 05/11] Comprometido detalle desglose OC en RepPresupuestosDetalleCompras --- App_Code/ClsContratos.vb | 3 +- .../RepPresupuestosDetalleCompras.aspx.vb | 60 +++++++++++++------ 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index a5899031b..3c0f7b656 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -3246,7 +3246,7 @@ Public Class ClsContratos Return Retorno End Function - Public Function GetPresupuestosRepDetalleCompras(CveProyecto As Integer, CveSubProyecto As Integer, CveAgrupador As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveUsuario As Integer) As Boolean + Public Function GetPresupuestosRepDetalleCompras(CveProyecto As Integer, CveSubProyecto As Integer, CveAgrupador As Integer, CveTipoGasto As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CveUsuario As Integer, Optional Comprometido As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_PresupuestosRepDetalleCompra") @@ -3259,6 +3259,7 @@ Public Class ClsContratos .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuario + .Add("@Comprometido", SqlDbType.Bit).Value = Comprometido End With Try diff --git a/Contratos/RepPresupuestosDetalleCompras.aspx.vb b/Contratos/RepPresupuestosDetalleCompras.aspx.vb index 08d386d3f..f1dafa0e4 100644 --- a/Contratos/RepPresupuestosDetalleCompras.aspx.vb +++ b/Contratos/RepPresupuestosDetalleCompras.aspx.vb @@ -2,11 +2,14 @@ Option Strict On Imports System.Data Imports Extensiones +Imports Org.BouncyCastle.Asn1.Ocsp Partial Class Contratos_RepPresupuestosDetalleCompras - Inherits ClsPaginas - + Inherits ClsPaginas + + + #Region "P R O P I E D A D E S" - + Public Property Gpo() As Integer Get Return DirectCast(ViewState("Gpo"), Integer) @@ -14,8 +17,20 @@ Partial Class Contratos_RepPresupuestosDetalleCompras Set(ByVal value As Integer) ViewState("Gpo") = value End Set - End Property - + End Property + + Public Property Comprometido As Boolean + Get + If ViewState("Comprometido") Is Nothing Then + ViewState("Comprometido") = False + End If + Return Boolean.Parse(ViewState("Comprometido").ToString) + End Get + Set(value As Boolean) + ViewState("Comprometido") = value + End Set + End Property + #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -25,8 +40,8 @@ Partial Class Contratos_RepPresupuestosDetalleCompras CargaDatos() End If - End Sub - + End Sub + #Region " INICIALIZA VALORES " Private Sub InicializaValores() @@ -71,7 +86,11 @@ Partial Class Contratos_RepPresupuestosDetalleCompras Dim CveProyecto = IfNull(Request("CveProyecto"), -1).ToString.ToEntero Dim CveSubProyecto = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero Dim CveTipoGasto = IfNull(Request("CveTipoGasto"), -1).ToString.ToEntero - Dim Agrupador = IfNull(Request("Agrupador"), -1).ToString.ToEntero + Dim Agrupador = IfNull(Request("Agrupador"), -1).ToString.ToEntero + + Comprometido = If(Request("Comprometido") IsNot Nothing AndAlso Request("Comprometido").ToEntero = 1, True, False) + + Gpo = IfNull(Request("CveAgrupador"), -1).ToString.ToEntero Dim EsProyecto = CBool(IfNull(Request("EsProyecto"), False)) If Agrupador = 1 Then Agrupador = 2 Else Agrupador = 1 @@ -106,7 +125,8 @@ Partial Class Contratos_RepPresupuestosDetalleCompras End Sub Private Sub CargaDatos() Dim ObjPresupuestos As New ClsContratos - If ObjPresupuestos.GetPresupuestosRepDetalleCompras(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlTipoGasto.SelectedValue.ToEntero, TxtFiltrosFechaInicio.Text.ToDate, TxtFiltrosFechaFin.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then + If ObjPresupuestos.GetPresupuestosRepDetalleCompras(DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlTipoGasto.SelectedValue.ToEntero, TxtFiltrosFechaInicio.Text.ToDate, + TxtFiltrosFechaFin.Text.ToDate, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Comprometido:=Comprometido) Then GvDatos.DataSource = ObjPresupuestos.DtResultados End If ObjPresupuestos.Dispose() @@ -131,15 +151,21 @@ Partial Class Contratos_RepPresupuestosDetalleCompras Dim Liga = "" Dim Css = "Texto" - Dim TipoAgrupador As Integer = e.Row.DBCampo("TipoAgrupador").ToEntero() - Select Case TipoAgrupador - Case 1 - Liga = $"/Compras/Compras.aspx?&CveCompra={e.Row.DBCampo("CveCompra")}" - Case 2 - Liga = $"/Contabilidad/RegPrePoliza.aspx?&CvePrePoliza={e.Row.DBCampo("CveCompra")}" - Case Else + + If Comprometido Then + Liga = $"/OC/OC.aspx?OC={e.Row.DBCampo("CveOrdenCompra")}" + Else + Dim TipoAgrupador As Integer = e.Row.DBCampo("TipoAgrupador").ToEntero() + Select Case TipoAgrupador + Case 1 + Liga = $"/Compras/Compras.aspx?&CveCompra={e.Row.DBCampo("CveCompra")}" + Case 2 + Liga = $"/Contabilidad/RegPrePoliza.aspx?&CvePrePoliza={e.Row.DBCampo("CveCompra")}" + Case Else + + End Select + End If - End Select e.Row.Cells(0).Text = "" + e.Row.Cells(0).Text + "" End If End If From 683f05caf6918d6769b892fc0c0e903f39960095 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 15 May 2024 10:02:34 -0700 Subject: [PATCH 06/11] Reportes presupuestos acentos --- Contratos/RepPresupuestos.aspx | 10 +++++----- Contratos/RepPresupuestosDetalle.aspx | 10 +++++----- Contratos/RepPresupuestosDetalleCompras.aspx | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Contratos/RepPresupuestos.aspx b/Contratos/RepPresupuestos.aspx index ebe5ac5bd..62963dcf3 100644 --- a/Contratos/RepPresupuestos.aspx +++ b/Contratos/RepPresupuestos.aspx @@ -208,7 +208,7 @@
Agrupador:
- +
@@ -231,7 +231,7 @@ -
Clasificacion:
+
Clasificación:
@@ -341,9 +341,9 @@ <%-- - + - + @@ -383,7 +383,7 @@ - + diff --git a/Contratos/RepPresupuestosDetalle.aspx b/Contratos/RepPresupuestosDetalle.aspx index b30af087b..799be4123 100644 --- a/Contratos/RepPresupuestosDetalle.aspx +++ b/Contratos/RepPresupuestosDetalle.aspx @@ -201,7 +201,7 @@
Agrupador:
- +
@@ -224,7 +224,7 @@
-
Clasificacion:
+
Clasificación:
@@ -259,9 +259,9 @@ <%-- - + - + @@ -299,7 +299,7 @@ - + diff --git a/Contratos/RepPresupuestosDetalleCompras.aspx b/Contratos/RepPresupuestosDetalleCompras.aspx index a6f50fb94..f251ca390 100644 --- a/Contratos/RepPresupuestosDetalleCompras.aspx +++ b/Contratos/RepPresupuestosDetalleCompras.aspx @@ -219,7 +219,7 @@ + +