Compras error redonde en devolucion

This commit is contained in:
rakcsle
2025-02-28 14:08:50 -07:00
parent 21f9fb410f
commit ed1d52c5f3
2 changed files with 103 additions and 10 deletions

View File

@@ -1303,12 +1303,102 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState
#End Region #End Region
#Region "R E P O R T E D I A R I O " #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($"<b><center>Reporte Diario {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}</center><b><br><br>")
' 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("<br>")
' sbTablas.Append("<br>")
' 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("<table border='1' style='border-collapse:collapse; width:100%;'>")
' If table.Columns(0).ColumnName = ColumnaTitulo AndAlso table.Rows.Count > 0 Then html.AppendFormat(" <caption style='background-color:#333333;'>{0}</caption>", table.Rows(0)(ColumnaTitulo))
' html.Append("<thead style='background-color:#DDD; padding: 0px;'><tr>")
' For Each column As DataColumn In table.Columns
' If ColumnaTitulo <> column.ColumnName Then html.Append($"<th style='padding:5px; text-align:left;'>{column.ColumnName}</th>")
' Next
' html.Append("</tr></thead>")
' html.Append("<tbody>")
' Dim numericValue As Decimal = Nothing
' For Each row As DataRow In table.Rows
' html.Append("<tr>")
' 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($"<td style='padding:5px; text-align:right;'>{cellValue}</td>")
' Else
' cellValue = If(value?.ToString(), String.Empty)
' html.Append($"<td style='padding:5px; text-align:left;'>{cellValue}</td>")
' End If
' End If
' Next
' html.Append("</tr>")
' Next
' html.Append("</tbody>")
' html.Append("</table>")
' Return html.ToString()
'End Function
Private Function ReporteDiario(ByVal CveEmpresa As Integer, ByVal context As HttpContext) As Boolean Private Function ReporteDiario(ByVal CveEmpresa As Integer, ByVal context As HttpContext) As Boolean
Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa) Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
Dim objGenerales As ClsGenerales = New ClsGenerales() Dim objGenerales As ClsGenerales = New ClsGenerales()
Dim respuesta As Boolean = True Dim respuesta As Boolean = True
Dim sbTablas As StringBuilder = New StringBuilder() Dim sbTablas As StringBuilder = New StringBuilder()
sbTablas.Append($"<b><center>Reporte Diario {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}</center><b><br><br>") 'sbTablas.Append($"<b><center>Reporte Diario {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}</center><b><br><br>")
sbTablas.AppendLine($"<div style='font-family: Arial, sans-serif; margin: 20px; padding: 20px; background-color: #f4f4f4;'>
<div style='width: 90%; margin: auto; background: white; padding: 20px; border-radius: 10px; box-shadow: 0px 0px 10px 0px #aaa; '>
<table style='width:100%'>
<td style='width:33%'><img src='https://sig.adssistemas.mx/imagenes/u248.png' style='width:210px;height:95px'></td>
<td style='width:33%'><h1 style='text-align: center;'>Reporte Diario</h1></td>
<td style='width:33%;text-align:right'><img src='https://sig.adssistemas.mx/imagenes/u8.svg' style='width:56px;height:56px'></td>
</table>
<h2 style='text-align: center;'>{DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}</h2>")
If objGenerales.GetReporteDiario(CveEmpresa) Then If objGenerales.GetReporteDiario(CveEmpresa) Then
Dim TablaActual As Integer = 1 Dim TablaActual As Integer = 1
@@ -1323,10 +1413,13 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState
respuesta = False respuesta = False
End If End If
sbTablas.AppendLine("</div></div>")
objGenerales.Dispose() objGenerales.Dispose()
'MandaCorreoDiario '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 = "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 = " oscar.irigoyen@adssistemas.mx"
MandaCorreoDiario(sbTablas.ToString(), Correos, respuesta) MandaCorreoDiario(sbTablas.ToString(), Correos, respuesta)
Return respuesta Return respuesta
End Function End Function
@@ -1334,15 +1427,15 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState
Private Function ConvertDataTableToHtml(ByVal table As DataTable) As String Private Function ConvertDataTableToHtml(ByVal table As DataTable) As String
Dim html As StringBuilder = New StringBuilder() Dim html As StringBuilder = New StringBuilder()
Dim ColumnaTitulo As String = "Titulo" Dim ColumnaTitulo As String = "Titulo"
html.Append("<table border='1' style='border-collapse:collapse; width:100%;'>") html.Append("<table style='width: 100%; border-collapse: collapse; margin-top: 20px;'>")
If table.Columns(0).ColumnName = ColumnaTitulo AndAlso table.Rows.Count > 0 Then html.AppendFormat(" <caption style='background-color:#333333;'>{0}</caption>", table.Rows(0)(ColumnaTitulo)) If table.Columns(0).ColumnName = ColumnaTitulo AndAlso table.Rows.Count > 0 Then html.AppendFormat(" <caption style='background-color:#333333;'>{0}</caption>", table.Rows(0)(ColumnaTitulo))
html.Append("<thead style='background-color:#DDD; padding: 0px;'><tr>") html.Append("<tr>")
For Each column As DataColumn In table.Columns For Each column As DataColumn In table.Columns
If ColumnaTitulo <> column.ColumnName Then html.Append($"<th style='padding:5px; text-align:left;'>{column.ColumnName}</th>") If ColumnaTitulo <> column.ColumnName Then html.Append($"<th style='border: 1px solid #ddd; padding: 8px; text-align: center; color:#dbb19a; '>{column.ColumnName}</th>")
Next Next
html.Append("</tr></thead>") html.Append("</thead>")
html.Append("<tbody>") html.Append("<tbody>")
Dim numericValue As Decimal = Nothing Dim numericValue As Decimal = Nothing
@@ -1368,10 +1461,10 @@ Public Class TareasProgramadas : Implements IHttpHandler, IReadOnlySessionState
cellValue = "" cellValue = ""
End If End If
html.Append($"<td style='padding:5px; text-align:right;'>{cellValue}</td>") html.Append($"<td style='border: 1px solid #ddd; padding: 8px; text-align: center;'>{cellValue}</td>")
Else Else
cellValue = If(value?.ToString(), String.Empty) cellValue = If(value?.ToString(), String.Empty)
html.Append($"<td style='padding:5px; text-align:left;'>{cellValue}</td>") html.Append($"<td style='border: 1px solid #ddd; padding: 8px; text-align: center;'>{cellValue}</td>")
End If End If
End If End If
Next Next

View File

@@ -13907,7 +13907,7 @@ Partial Class Compras_Compras
Next Next
'si no esta vinculado a nc simplemente me lo brinco 'si no esta vinculado a nc simplemente me lo brinco
If realizadevolucion Then If realizadevolucion Then
subtotaldevolucion = subtotaldevolucion.RoundSQL(2)
'si el subtotal es igual a la nc lo guardo si no marco error 'si el subtotal es igual a la nc lo guardo si no marco error
Dim tTolerancia As Decimal = 0 Dim tTolerancia As Decimal = 0
Dim tAjustaUltimo As Boolean = True Dim tAjustaUltimo As Boolean = True