From ed1d52c5f391995e80d4436dded78be6db3b8c47 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 28 Feb 2025 14:08:50 -0700 Subject: [PATCH] Compras error redonde en devolucion --- Ashx/TareasProgramadas.ashx | 111 +++++++++++++++++++++++++++++++++--- Compras/Compras.aspx.vb | 2 +- 2 files changed, 103 insertions(+), 10 deletions(-) diff --git a/Ashx/TareasProgramadas.ashx b/Ashx/TareasProgramadas.ashx index cdf23a0b6..95eba56b4 100644 --- a/Ashx/TareasProgramadas.ashx +++ b/Ashx/TareasProgramadas.ashx @@ -1303,12 +1303,102 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState #End Region #Region "R E P O R T E D I A R I O " + 'Private Function ReporteDiario(ByVal CveEmpresa As Integer, ByVal context As HttpContext) As Boolean + ' Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) + ' Dim objGenerales As ClsGenerales = New ClsGenerales() + ' Dim respuesta As Boolean = True + ' Dim sbTablas As StringBuilder = New StringBuilder() + ' sbTablas.Append($"
Reporte Diario {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}


") + + ' If objGenerales.GetReporteDiario(CveEmpresa) Then + ' Dim TablaActual As Integer = 1 + + ' For Each tabla As DataTable In objGenerales.DSResultados.Tables + ' sbTablas.AppendLine(ConvertDataTableToHtml(tabla)) + ' TablaActual += 1 + ' sbTablas.Append("
") + ' sbTablas.Append("
") + ' Next + ' Else + ' respuesta = False + ' End If + + ' objGenerales.Dispose() + ' 'MandaCorreoDiario + ' Dim Correos As String = "hdiaz@grupodiaz.com.mx;libarra@grupodiaz.com.mx;jguerrero@grupodiaz.com.mx;contabilidad@grupodiaz.com.mx;cnazarit@yahoo.com;julian@adsistemas.mx;rene.molina@adssistemas.mx" + ' ' Dim Correos As String = " rene.molina@adssistemas.mx" + ' MandaCorreoDiario(sbTablas.ToString(), Correos, respuesta) + ' Return respuesta + 'End Function + + 'Private Function ConvertDataTableToHtml(ByVal table As DataTable) As String + ' Dim html As StringBuilder = New StringBuilder() + ' Dim ColumnaTitulo As String = "Titulo" + ' html.Append("") + ' If table.Columns(0).ColumnName = ColumnaTitulo AndAlso table.Rows.Count > 0 Then html.AppendFormat(" ", table.Rows(0)(ColumnaTitulo)) + ' html.Append("") + + ' For Each column As DataColumn In table.Columns + ' If ColumnaTitulo <> column.ColumnName Then html.Append($"") + ' Next + + ' html.Append("") + ' html.Append("") + ' Dim numericValue As Decimal = Nothing + + ' For Each row As DataRow In table.Rows + ' html.Append("") + + ' For Each column As DataColumn In table.Columns + + ' If ColumnaTitulo <> column.ColumnName Then + ' Dim value As Object = row(column) + ' Dim cellValue As String + + ' If column.DataType = GetType(Integer) OrElse column.DataType = GetType(Decimal) OrElse column.DataType = GetType(Double) OrElse column.DataType = GetType(Single) Then + + ' If value IsNot DBNull.Value AndAlso Decimal.TryParse(value.ToString(), numericValue) Then + + ' If numericValue <> 0 Then + ' cellValue = numericValue.ToString("N2") + ' Else + ' cellValue = "" + ' End If + ' Else + ' cellValue = "" + ' End If + + ' html.Append($"") + ' Else + ' cellValue = If(value?.ToString(), String.Empty) + ' html.Append($"") + ' End If + ' End If + ' Next + + ' html.Append("") + ' Next + + ' html.Append("") + ' html.Append("
{0}
{column.ColumnName}
{cellValue}{cellValue}
") + ' Return html.ToString() + 'End Function + Private Function ReporteDiario(ByVal CveEmpresa As Integer, ByVal context As HttpContext) As Boolean Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) Dim objGenerales As ClsGenerales = New ClsGenerales() Dim respuesta As Boolean = True Dim sbTablas As StringBuilder = New StringBuilder() - sbTablas.Append($"
Reporte Diario {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}


") + 'sbTablas.Append($"
Reporte Diario {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}


") + + sbTablas.AppendLine($"
+
+ + + + +

Reporte Diario

+

{DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}

") If objGenerales.GetReporteDiario(CveEmpresa) Then Dim TablaActual As Integer = 1 @@ -1323,10 +1413,13 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState respuesta = False End If + sbTablas.AppendLine("
") + + objGenerales.Dispose() 'MandaCorreoDiario - Dim Correos As String = "hdiaz@grupodiaz.com.mx;libarra@grupodiaz.com.mx;jguerrero@grupodiaz.com.mx;contabilidad@grupodiaz.com.mx;cnazarit@yahoo.com;julian@adsistemas.mx;rene.molina@adssistemas.mx" - 'Dim Correos As String = " rene.molina@adssistemas.mx;japmx95@gmail.com" + 'Dim Correos As String = "hdiaz@grupodiaz.com.mx;libarra@grupodiaz.com.mx;jguerrero@grupodiaz.com.mx;contabilidad@grupodiaz.com.mx;cnazarit@yahoo.com;julian@adsistemas.mx;rene.molina@adssistemas.mx" + Dim Correos As String = " oscar.irigoyen@adssistemas.mx" MandaCorreoDiario(sbTablas.ToString(), Correos, respuesta) Return respuesta End Function @@ -1334,15 +1427,15 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState Private Function ConvertDataTableToHtml(ByVal table As DataTable) As String Dim html As StringBuilder = New StringBuilder() Dim ColumnaTitulo As String = "Titulo" - html.Append("") + html.Append("
") If table.Columns(0).ColumnName = ColumnaTitulo AndAlso table.Rows.Count > 0 Then html.AppendFormat(" ", table.Rows(0)(ColumnaTitulo)) - html.Append("") + html.Append("") For Each column As DataColumn In table.Columns - If ColumnaTitulo <> column.ColumnName Then html.Append($"") + If ColumnaTitulo <> column.ColumnName Then html.Append($"") Next - html.Append("") + html.Append("") html.Append("") Dim numericValue As Decimal = Nothing @@ -1368,10 +1461,10 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState cellValue = "" End If - html.Append($"") + html.Append($"") Else cellValue = If(value?.ToString(), String.Empty) - html.Append($"") + html.Append($"") End If End If Next diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index f7d7eb3a2..61eb5ee6e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -13907,7 +13907,7 @@ Partial Class Compras_Compras Next 'si no esta vinculado a nc simplemente me lo brinco If realizadevolucion Then - + subtotaldevolucion = subtotaldevolucion.RoundSQL(2) 'si el subtotal es igual a la nc lo guardo si no marco error Dim tTolerancia As Decimal = 0 Dim tAjustaUltimo As Boolean = True
{0}
{column.ColumnName}{column.ColumnName}
{cellValue}{cellValue}{cellValue}{cellValue}