From 6fde7b5c45b224ce897f29e5e171fc8a654ac435 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 17 Sep 2020 15:10:46 -0700 Subject: [PATCH 1/3] - --- Compras/CatTipoGasto.aspx.cs | 23 +- .../RepMovimientosAuxiliaresCatalogo.rdlc | 223 +++++++++++++----- Ventas/AuxiliarCliente.aspx.vb | 88 +------ 3 files changed, 178 insertions(+), 156 deletions(-) diff --git a/Compras/CatTipoGasto.aspx.cs b/Compras/CatTipoGasto.aspx.cs index 4ffb4c9b7..da4c4276b 100644 --- a/Compras/CatTipoGasto.aspx.cs +++ b/Compras/CatTipoGasto.aspx.cs @@ -41,6 +41,16 @@ public partial class Compras_CatTipoGasto : ClsPaginas ObjCompras.Dispose(); } + private void RecargarGlobal() + { + ClsCompras ObjCompras = new ClsCompras(); + if (ObjCompras.GetTipoGasto(-1, -1)) + { + set_GlobalDTTiposGastos(UsuarioActual.CveEmpresa, ObjCompras.DtResultados); + } + ObjCompras.Dispose(); + } + protected void BtnAgregarTipoGastoD_Click(object sender, EventArgs e) { BtnAgregarTipoGasto.Text = "Agregar"; @@ -74,6 +84,7 @@ public partial class Compras_CatTipoGasto : ClsPaginas Alert("Se eliminó el Tipo de Gasto correctamente"); } ObjCompras.Dispose(); + RecargarGlobal(); } protected void BtnAgregarTipoGasto_Click(object sender, EventArgs e) @@ -82,22 +93,20 @@ public partial class Compras_CatTipoGasto : ClsPaginas if (BtnAgregarTipoGasto.Text == "Agregar") { if (ObjCompras.AddTipoGasto(TxtTipoGasto.Text,ChkEstatus.Checked,DateTime.Now.ToString(),UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa)) - { - CargaDatos(); - UpDatos.Update(); - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); + { Alert("Se agregó el Tipo de Gasto correctamente"); } }else { if (ObjCompras.UpdateTipoGasto(CveTipoGasto,TxtTipoGasto.Text,ChkEstatus.Checked,-1,-1)) { - CargaDatos(); - UpDatos.Update(); - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); Alert("Se actualizó el Tipo de Gasto correctamente"); } } ObjCompras.Dispose(); + CargaDatos(); + RecargarGlobal(); + UpDatos.Update(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); } } \ No newline at end of file diff --git a/Contabilidad/Reportes/RepMovimientosAuxiliaresCatalogo.rdlc b/Contabilidad/Reportes/RepMovimientosAuxiliaresCatalogo.rdlc index 2683f343b..26451702f 100644 --- a/Contabilidad/Reportes/RepMovimientosAuxiliaresCatalogo.rdlc +++ b/Contabilidad/Reportes/RepMovimientosAuxiliaresCatalogo.rdlc @@ -6,28 +6,28 @@ - 1.86091cm + 2.28424cm 1.28292cm - 1.49458cm + 1.5475cm - 7.13431cm + 5.78365cm 1.99729cm - 2.10313cm + 2.10377cm - 2.1825cm + 2.10378cm - 2.31479cm + 3.26728cm @@ -149,11 +149,84 @@ 2pt - 3 - - + + + + true + true + + + + + + + + + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + Black + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + + @@ -605,10 +678,40 @@ 2pt - 2 - + + + + true + true + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -1221,9 +1324,8 @@ External =Parameters!pImg.Value FitProportional - 0.09633cm - 1.5cm - 1.5cm + 2.07257cm + 3.56716cm 1 - 2.0944in + 2.2819in + + + + + + Textbox5 + 0.89958cm + 20.37043cm + + = (Globals.PageNumber=1) + + + + 2pt + 2pt + 2pt + 2pt + + true true @@ -1367,43 +1502,9 @@ Textbox8 0.02088cm - 16.87794cm - 0.57912cm - 3.49249cm - - = (Globals.PageNumber=1) - - - - 2pt - 2pt - - - - true - true - - - - - ="Libro Mayor" & System.Environment.NewLine & "al " &Parameters!pFechaFin.Value - - - - - - - Textbox5 - 2.87447cm - 0.89958cm - 12.68053cm + 14.99937cm + 0.8787cm + 5.37106cm 1 = (Globals.PageNumber=1) @@ -1414,8 +1515,6 @@ 2pt 2pt - 2pt - 2pt @@ -1451,9 +1550,9 @@ Textbox3 0.0703cm - 14.85419cm + 14.99937cm 0.6cm - 5.51625cm + 5.37107cm diff --git a/Ventas/AuxiliarCliente.aspx.vb b/Ventas/AuxiliarCliente.aspx.vb index f942475e2..441481afb 100644 --- a/Ventas/AuxiliarCliente.aspx.vb +++ b/Ventas/AuxiliarCliente.aspx.vb @@ -100,93 +100,7 @@ Partial Class Ventas_AuxiliarCliente Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) End Sub Public Sub ExportToExcelGTest(Gv As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing) - Dim sw As New StringWriter() - Dim htw As New HtmlTextWriter(sw) - Gv.RenderControl(htw) - GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8") - - Dim excel As GemBox.Spreadsheet.ExcelFile - Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault - Using htmlStream = New MemoryStream(options.Encoding.GetBytes(sw.ToString())) - excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream, options) - If Usuario IsNot Nothing Then - Dim worksheet = excel.Worksheets(0) - Dim num As Integer = worksheet.Rows.Count - If num > 128 Then num = 128 - - Dim columnCount = worksheet.CalculateMaxUsedColumns() - 'If columnCount > 1 Then - ' For i As Integer = 1 To columnCount - 1 - ' worksheet.Columns(i).AutoFit(1, worksheet.Rows(1), worksheet.Rows(num - 1)) - ' Next - 'End If - - worksheet.Rows.InsertEmpty(0, 7) - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Usuario.CveEmpresa) - - If Imagen.Exists Then - worksheet.Pictures.Add(logouri.ToString(), "A1", "B4") - End If - - Dim celdasConTexto = worksheet.GetUsedCellRange(True) - celdasConTexto.Style.Font.Name = "Calibri Light" - - Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) - RangoNombreEmpresa.Merged = True - RangoNombreEmpresa.Value = Usuario.Empresa.Empresa - RangoNombreEmpresa.Style.Font.Size = 18 * 20 - RangoNombreEmpresa.Style.Font.Name = "Calibri Light" - RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) - RangoTitulo.Merged = True - RangoTitulo.Value = Titulo - RangoTitulo.Style.Font.Size = 20 * 20 - RangoTitulo.Style.Font.Name = "Calibri Light" - RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - Dim FiltroCliente = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex) - FiltroCliente.Merged = True - FiltroCliente.Value = String.Format("Cliente: {0} Fecha Inicio: {1} Fecha Fin: {2} Opción: {3}", DdlClientes.SelectedText, txtFechaI.Text, txtFechaF.Text, DdlOpcion.SelectedItem.Text) - FiltroCliente.Style.Font.Size = 12 * 20 - FiltroCliente.Style.Font.Name = "Calibri Light" - FiltroCliente.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left - FiltroCliente.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex - worksheet.Rows(7).Cells(i).Style.Font.Size = 12 * 20 - worksheet.Rows(7).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - worksheet.Rows(7).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - worksheet.Rows(7).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(7).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - 'If i > 0 Then - ' Try - ' worksheet.Columns(i).AutoFit(1) - ' Catch ex As Exception - ' End Try - 'End If - Next - - - Dim IndexEndTable As Integer = Gv.Rows.Count + 9 - - worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió:" - worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre - - worksheet.Rows(IndexEndTable).Cells(4).Value = "Fecha Impresión: " - worksheet.Rows(IndexEndTable + 1).Cells(4).Value = DateTime.Now.ToString() - - worksheet.Rows(IndexEndTable).Cells(8).Value = "Impreso en SIG" - End If - - End Using - htw.Dispose() - - excel.Save(HttpContext.Current.Response, NombreArchivoXLSx) + ExportToExcelGembox(Gv, NombreArchivoXLSx, Usuario, txtFechaI.Text, txtFechaF.Text, Titulo, "", 1) End Sub Protected Sub GvAuxCliente_RowDataBound(sender As Object, e As GridViewRowEventArgs) From 7e268f5f1f184303afb64bfa2475873d896389f7 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 17 Sep 2020 17:51:55 -0700 Subject: [PATCH 2/3] agregando nueva columna personalizable --- Compras/RepComprasDetalle.aspx | 14 ++++++++ Compras/RepComprasDetalle.aspx.vb | 58 ++++++------------------------- 2 files changed, 24 insertions(+), 48 deletions(-) diff --git a/Compras/RepComprasDetalle.aspx b/Compras/RepComprasDetalle.aspx index a2cbbff15..6eb03716b 100644 --- a/Compras/RepComprasDetalle.aspx +++ b/Compras/RepComprasDetalle.aspx @@ -401,6 +401,15 @@ + + + Observaciones + + + + + + @@ -464,24 +473,29 @@ + + + + + diff --git a/Compras/RepComprasDetalle.aspx.vb b/Compras/RepComprasDetalle.aspx.vb index d1c57402a..6c9f43f77 100644 --- a/Compras/RepComprasDetalle.aspx.vb +++ b/Compras/RepComprasDetalle.aspx.vb @@ -168,6 +168,7 @@ Partial Class Compras_RepComprasDetalle ChkRazon.Checked = True ChkFolio.Checked = True ChkFecha.Checked = True + ChkObs.Checked = True End Sub @@ -597,54 +598,15 @@ Partial Class Compras_RepComprasDetalle #End Region Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click - If ChkIVA.Checked Then - GvDatos.Columns(4).Visible = True - Else - GvDatos.Columns(4).Visible = False - End If - - If ChkIEPS.Checked Then - GvDatos.Columns(5).Visible = True - Else - GvDatos.Columns(5).Visible = False - End If - - If ChkDesc.Checked Then - GvDatos.Columns(6).Visible = True - Else - GvDatos.Columns(6).Visible = False - End If - - If ChkTotal.Checked Then - GvDatos.Columns(7).Visible = True - Else - GvDatos.Columns(7).Visible = False - End If - - If ChkAbre.Checked Then - GvDatos.Columns(8).Visible = True - Else - GvDatos.Columns(8).Visible = False - End If - - If ChkRazon.Checked Then - GvDatos.Columns(9).Visible = True - Else - GvDatos.Columns(9).Visible = False - End If - - If ChkFolio.Checked Then - GvDatos.Columns(10).Visible = True - Else - GvDatos.Columns(10).Visible = False - End If - - If ChkFecha.Checked Then - GvDatos.Columns(11).Visible = True - Else - GvDatos.Columns(11).Visible = False - End If - + GvDatos.Columns(4).Visible = ChkIVA.Checked + GvDatos.Columns(5).Visible = ChkIEPS.Checked + GvDatos.Columns(6).Visible = ChkDesc.Checked + GvDatos.Columns(7).Visible = ChkTotal.Checked + GvDatos.Columns(8).Visible = ChkAbre.Checked + GvDatos.Columns(9).Visible = ChkRazon.Checked + GvDatos.Columns(10).Visible = ChkFolio.Checked + GvDatos.Columns(11).Visible = ChkFecha.Checked + GvDatos.Columns(12).Visible = ChkObs.Checked UPDatos.Update() End Sub From 92f8d343df1476b9fa7cd4bba392931514ad138f Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Thu, 17 Sep 2020 20:05:27 -0700 Subject: [PATCH 3/3] Correcion Anexo --- App_Code/ClsContabilidad.vb | 2 +- Compras/eFacturas.aspx | 5 +- Compras/eFacturas.aspx.vb | 375 +++++++++++++++++- Contabilidad2/RepAnexoCatalogoCC.aspx | 2 +- Contabilidad2/RepAnexoCatalogoCC.aspx.vb | 2 +- .../RepEstadoResultadosHorizontal.aspx | 2 +- 6 files changed, 365 insertions(+), 23 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index e9188b31e..02e5ca963 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -4198,7 +4198,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function GetAnexoCatalagoCC(CveCuenta As Integer, Ejercicio As Integer, CveSubproyecto As Integer, CveEmpresa As Integer, Divisor As Integer, Periodo As Integer) As Boolean + Public Function GetAnexoCatalagoCC(CveCuenta As Integer, Ejercicio As Integer, CveSubproyecto As Integer, CveEmpresa As Integer, Divisor As Integer, Periodo As Integer, CveUsuario As Integer ) As Boolean Dim Retorno = False DataAdapter("PA_Conta_AnexoCatalogoCCGet") diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index f6675b947..74f71680a 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -66,6 +66,9 @@
  • Bitácora Facturas
  • +
  • + Vinculación Masiva Complementos +
  • @@ -374,7 +377,7 @@
    - +
    diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index f59eed405..64b14396c 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2770,23 +2770,7 @@ Partial Class Compras_eFacturas Next Next - 'ImportePago - 'For Each node As XmlNode In nodePago - ' Dim Nrow As DataRow = DTDocumentosRelacionados.NewRow - - ' Nrow("Serie") = ValorXML(node, "Serie") - ' Nrow("Folio") = ValorXML(node, "Folio").ToEntero - ' Nrow("SerieFolio") = ValorXML(node, "Serie") & "-" & ValorXML(node, "Folio").ToEntero - ' Nrow("IdDocumento") = ValorXML(node, "IdDocumento") - ' Nrow("MonedaDR") = ValorXML(node, "MonedaDR") - ' Nrow("MetodoDePagoDR") = ValorXML(node, "MetodoDePagoDR") - ' Nrow("ImpPagado") = ValorXML(node, "ImpPagado").ToDecimal - ' Nrow("Fecha") = FechaPago - - ' DTDocumentosRelacionados.Rows.Add(Nrow) - ' StrUUID.AppendFormat("'{0}',", ValorXML(node, "IdDocumento").Replace("'", "")) - 'Next Dim ObjCompraFolios As New ClsCompras If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa, OP:=2) Then @@ -3031,12 +3015,10 @@ Partial Class Compras_eFacturas If HdnCveIE.Value.ToEntero > 0 Then - For Each dRow As DataRow In DT_ComprasSinIE.Rows objEventos.AddEventoBitacora($"Complemento { dRow("SerieFolioPago").ToString } vinculado manualmente a compra {dRow("SerieFolioCompra").ToString}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=dRow("CveCompra").ToString.ToEntero) Next - End If @@ -3452,4 +3434,361 @@ Partial Class Compras_eFacturas Alert("no se pudo procesar el archivo xml") End If End Sub + + + Private Sub VinculacionMasivaComplementos() + + Dim CountVinculados As Integer = 0 + Dim ValidadoSAT As Boolean = False + Dim VinculacionValida As Boolean = False + + For Each gvRow As GridViewRow In GvPagos.Rows + + Dim DTDocumentosRelacionados As New DataTable + Dim DTVinculacion As New DataTable + + Dim ObjValidacion As New ClsValidaCFDi(gvRow.DataKey("UUID"), gvRow.DataKey("RFCDe"), gvRow.DataKey("RFCPara"), 0) + + If ObjValidacion.EsValida > 0 Then + + If ObjValidacion.EsValida = 2 Then + ValidadoSAT = False + Else + Dim ObjDatos As New ClsCompras + ValidadoSAT = ObjDatos.UpdateEstatus(ObjValidacion.EsValida, gvRow.DataKey("CveFactura").ToEntero) + ObjDatos.Dispose() + End If + + Else + ValidadoSAT = False + End If + ObjValidacion.Dispose() + + If Not ValidadoSAT Then + Continue For + End If + + Dim sbSinIE As New StringBuilder + + HdnCveIE.Value = "" + MSGComplemento = "" + ViculacionConPUE = False + ListaComprasPUE.Clear() + ComplementoConPUE = "" + + DT_ComprasSinIE = New DataTable + + Dim ListaComprasPUEInterna As New List(Of Integer) + + Dim CveComplementoPagoCompra As Integer = gvRow.DataKey("CveComplementoPagoCompra").ToString.ToEntero + + If CveComplementoPagoCompra > 0 Then + Continue For + End If + + Dim SerieFolioIE As String = "" + Dim UUIDPago As String = "" + 'Dim ImportePago As Decimal = 0 + Dim StrUUID As New StringBuilder + Dim Monto As Decimal = 0 + Dim nodePagos As XmlNode = Nothing + Dim nodePagos2 As XmlNode = Nothing + Dim nodeComp As XmlNode = Nothing + Dim nodeaGral As XmlNode = Nothing + Dim nodeTFD As XmlNode = Nothing + Dim ImporteIES As Double = 0 + Dim DiferenciaImportes As Double = 0 + Dim TextoDiferenciaImporte As String = "" + Dim FechaPago As Date + Dim PagosCantidad As Integer = 0 + + + + Dim XMLDoc As New XmlDocument + Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) + If IO.File.Exists(Archivo) Then + + + Dim SXML As String = File.ReadAllText(Archivo).Replace(vbLf, " ").Replace(vbCrLf, " ") + + SXML = SXML.Trim((Convert.ToChar(0))) + + XMLDoc.LoadXml(SXML) + + Dim Xml As New StringBuilder + Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) + + namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/3") + namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") + namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos") + nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces) + + nodeaGral = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", XMLDoc.DocumentElement.Prefix), namespaces) + + nodeTFD = nodeComp.SelectSingleNode(String.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces) + nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", "pago10"), namespaces) + nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", "pago10"), namespaces) + 'Monto = ValorXML(nodePagos, "Monto").ToDecimal + + Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces) + + SeriePago = ValorXML(nodeaGral, "Serie") + FolioPago = ValorXML(nodeaGral, "Folio") + + UUIDPago = ValorXML(nodeTFD, "UUID") + LblUUID.Text = UUIDPago + + + DTDocumentosRelacionados.Columns.Add("Serie") + DTDocumentosRelacionados.Columns.Add("SerieFolio") + + DTDocumentosRelacionados.Columns.Add("IdDocumento") + DTDocumentosRelacionados.Columns.Add("Folio", GetType(Integer)) + DTDocumentosRelacionados.Columns.Add("MonedaDR") + DTDocumentosRelacionados.Columns.Add("MetodoDePagoDR") + DTDocumentosRelacionados.Columns.Add("ImpPagado", GetType(Decimal)) + + DTDocumentosRelacionados.Columns.Add("CveFactura", GetType(Integer)) + DTDocumentosRelacionados.Columns.Add("CveCompra", GetType(Integer)) + DTDocumentosRelacionados.Columns.Add("CveIE", GetType(Integer)) + DTDocumentosRelacionados.Columns.Add("Fecha", GetType(Date)) + + DTDocumentosRelacionados.Columns.Add("FolioPago") + DTDocumentosRelacionados.Columns.Add("ImportePago", GetType(Decimal)) + DTDocumentosRelacionados.Columns.Add("FechaPago", GetType(Date)) + DTDocumentosRelacionados.Columns.Add("CveMetodoPago", GetType(Integer)) + DTDocumentosRelacionados.Columns.Add("SerieFolioCompra") + + + + Dim nodePagosN As XmlNodeList + nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", "pago10"), namespaces) + + + + For Each NodosPagos As XmlNode In nodePagosN + For Each innernode As XmlNode In NodosPagos + + FechaPago = ValorXML(innernode, "FechaPago").ToDate + PagosCantidad = PagosCantidad + 1 + + For Each node As XmlNode In innernode + + Dim Nrow As DataRow = DTDocumentosRelacionados.NewRow + + Nrow("Serie") = ValorXML(node, "Serie") + Nrow("Folio") = ValorXML(node, "Folio").ToEntero + Nrow("SerieFolio") = ValorXML(node, "Serie") & "-" & ValorXML(node, "Folio").ToEntero + Nrow("IdDocumento") = ValorXML(node, "IdDocumento") + Nrow("MonedaDR") = ValorXML(node, "MonedaDR") + Nrow("MetodoDePagoDR") = ValorXML(node, "MetodoDePagoDR") + + Monto = Monto + ValorXML(node, "ImpPagado").ToDecimal + + Nrow("ImpPagado") = ValorXML(node, "ImpPagado").ToDecimal + Nrow("Fecha") = FechaPago + + DTDocumentosRelacionados.Rows.Add(Nrow) + StrUUID.AppendFormat("'{0}',", ValorXML(node, "IdDocumento").Replace("'", "")) + Next + + Next + Next + + + + Dim ObjCompraFolios As New ClsCompras + If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa, OP:=2) Then + ' + '.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then + If ObjCompraFolios.DtResultados.Rows.Count > 0 Then + For Each drow As DataRow In ObjCompraFolios.DtResultados.Rows + + For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows + + If dRow2("IdDocumento").ToString.ToUpper = drow("IdDocumento").ToString.ToUpper Then + + dRow2("CveCompra") = drow("CveCompra").ToString.ToEntero + dRow2("CveFactura") = drow("CveFactura").ToString.ToEntero + dRow2("CveMetodoPago") = drow("CveMetodoPago").ToString.ToEntero + dRow2("SerieFolioCompra") = drow("SerieFolioCompra").ToString + + + If drow("CveIE").ToString.ToEntero > 0 Then + + dRow2("CveIE") = drow("CveIE").ToString.ToEntero + dRow2("ImportePago") = drow("Importe").ToString.ToDecimal + + + End If + + dRow2("FolioPago") = drow("FolioIE") + dRow2("FechaPago") = drow("FechaDocumento") + + + + + End If + Next + Next + End If + End If + + ObjCompraFolios.Dispose() + + 'GVPDocumentosRelacionadosPagos.DataSource = DTDocumentosRelacionados + 'GVPDocumentosRelacionadosPagos.DataBind() + + + For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows + If dRow2("CveMetodoPago").ToString.ToEntero > 0 Then + If dRow2("CveMetodoPago").ToString.ToEntero = 1 Then + MSGComplemento = MSGComplemento & $" Compra {dRow2("SerieFolioCompra").ToString } bloqueado Tipo ""PUE"". " + + ListaComprasPUEInterna.Add(dRow2("CveCompra").ToString.ToEntero) + + ComplementoConPUE = $"{SeriePago}-{FolioPago}" + + End If + End If + Next + + + DT_ComprasSinIE.Columns.Add("CveCompra", GetType(Integer)) + DT_ComprasSinIE.Columns.Add("CveFactura", GetType(Integer)) + DT_ComprasSinIE.Columns.Add("SerieFolioPago") + DT_ComprasSinIE.Columns.Add("SerieFolioCompra") + + For Each dRow As DataRow In DTDocumentosRelacionados.Rows + Dim nRow As DataRow = DT_ComprasSinIE.NewRow + nRow("CveCompra") = dRow("CveCompra").ToString.ToEntero + ' nRow("CveFactura") = dRow("CveFactura").ToString.ToEntero + nRow("SerieFolioPago") = $"{SeriePago}-{FolioPago}" + nRow("SerieFolioCompra") = dRow("SerieFolioCompra").ToString + + DT_ComprasSinIE.Rows.Add(nRow) + + + Next + + + + Else + VinculacionValida = False + End If + + CveFacturaPago = gvRow.DataKey("CveFactura").ToEntero + CveProveedor = gvRow.DataKey("CveProveedor").ToEntero + Dim ObjCompras As New ClsCompras + + + Dim TieneRegistros As Boolean = False + + If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then + ' GvVincularPago.DataSource = ObjCompras.DtResultados + DTVinculacion = ObjCompras.DtResultados + If ObjCompras.DtResultados.Rows.Count > 0 Then + SerieFolioIE = ObjCompras.DtResultados.Rows(0)("SerieFolio").ToString + 'DivVincularPagoManualmente.Visible = False + VinculacionValida = True + TieneRegistros = True + Else + 'DivVincularPagoManualmente.Visible = True + VinculacionValida = False + End If + 'ImportePago = ObjCompras.DtResultados.SUMD("Monto") + Else + 'DivVincularPagoManualmente.Visible = False + VinculacionValida = False + End If + + + For Each dRow As DataRow In DTDocumentosRelacionados.Rows + + Dim FechaDocumento As Date = dRow("FechaPago").ToString.ToDate + Dim FechaDoRecibo As Date = dRow("Fecha").ToString.ToDate + Dim CveIEDocumento As Integer = dRow("CveIE").ToString.ToEntero + + If CveIEDocumento > 0 And FechaDocumento > New Date(1, 1, 1) Then + + Dim FT1 As Date = FechaDocumento + + If FechaDocumento <> New Date(1, 1, 1) Then + FT1 = FechaDocumento.AddDays(-6) + End If + + Dim FT2 As Date = FechaDocumento.AddDays(7) + + If Not (FechaDoRecibo >= FT1 And FechaDoRecibo < FT2) Then + + VinculacionValida = False + 'MSGComplemento = MSGComplemento & " Existen mas de 3 días de diferencia entre la fecha del documento y la fecha de complemento. " + Exit For + + End If + + End If + + Next + + ObjCompras.Dispose() + + + + If VinculacionValida Then + + Dim TieneError = False + Dim ObjCompra As New ClsCompras + ObjCompra.IniciaTransacSQL() + + + For Each DTRow As DataRow In DTVinculacion.Rows + + If Not ObjCompra.AddComplementoPago(DTRow("CveIE").ToString.ToEntero, DTRow("CveCompra").ToString.ToEntero, DTRow("Monto").ToString.ToDecimal, DTRow("CvePrePolizaDetalle").ToString.ToEntero, CveFacturaPago) > 0 Then + TieneError = True + End If + + + Next + + If Not TieneError AndAlso Not ObjCompra.AddVincularPago(CveFacturaPago) Then + TieneError = True + Else + CountVinculados = CountVinculados + 1 + End If + + + If Not TieneError Then + ObjCompra.Commit() + Else + ObjCompra.RollBack() + End If + + ObjCompra.Dispose() + + + + End If + + + Next + + + If CountVinculados > 0 Then + + Alert($"Se vincularon {CountVinculados} complementos") + CargaDatos() + + End If + + + + End Sub + + + Protected Sub LnkVinculacionMasivaComplementos_Click(sender As Object, e As EventArgs) + VinculacionMasivaComplementos() + End Sub + + End Class \ No newline at end of file diff --git a/Contabilidad2/RepAnexoCatalogoCC.aspx b/Contabilidad2/RepAnexoCatalogoCC.aspx index 3f633936e..03e4cd9ec 100644 --- a/Contabilidad2/RepAnexoCatalogoCC.aspx +++ b/Contabilidad2/RepAnexoCatalogoCC.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepAnexoCatalogoCC.aspx.vb" Inherits="Contabilidad2_RepAnexoCatalogoCC" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepAnexoCatalogoCC.aspx.vb" Inherits="Contabilidad2_RepAnexoCatalogoCC" EnableEventValidation="false" %> diff --git a/Contabilidad2/RepAnexoCatalogoCC.aspx.vb b/Contabilidad2/RepAnexoCatalogoCC.aspx.vb index 2ea0fd95b..a41f8dcde 100644 --- a/Contabilidad2/RepAnexoCatalogoCC.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoCC.aspx.vb @@ -115,7 +115,7 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC Private Sub CargaDatos() Dim Conta As New ClsContabilidad - If Conta.GetAnexoCatalagoCC(CveCuenta, DdlEjercicio.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero) Then + If Conta.GetAnexoCatalagoCC(CveCuenta, DdlEjercicio.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then Dim DtHeaders As DataTable = Conta.DSResultados.Tables(0) GvCC.DataSource = Conta.DSResultados.Tables(1) diff --git a/Contabilidad2/RepEstadoResultadosHorizontal.aspx b/Contabilidad2/RepEstadoResultadosHorizontal.aspx index 06612d679..ef097ec74 100644 --- a/Contabilidad2/RepEstadoResultadosHorizontal.aspx +++ b/Contabilidad2/RepEstadoResultadosHorizontal.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepEstadoResultadosHorizontal.aspx.vb" Inherits="Contabilidad_RepEstadoResultadosHorizontal" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepEstadoResultadosHorizontal.aspx.vb" Inherits="Contabilidad_RepEstadoResultadosHorizontal" EnableEventValidation="false" %>