diff --git a/Ashx/TareasProgramadas.ashx b/Ashx/TareasProgramadas.ashx index 76932ef83..e7168ab56 100644 --- a/Ashx/TareasProgramadas.ashx +++ b/Ashx/TareasProgramadas.ashx @@ -41,8 +41,8 @@ Public Class TareasProgramadas : Implements IHttpHandler retorno = "" context.Response.Write(retorno) Case "EstadosCuenta" - 'CargaEstadosCuenta(context, 119, 227736) - CargaEstadosCuenta(context, -1, -1) + 'CargaEstadosCuenta(context, 119, 227774) + CargaEstadosCuenta(context, 119, -1) End Select Catch ex As Exception ex.GuardaLog(ex.ToString()) @@ -341,7 +341,7 @@ Public Class TareasProgramadas : Implements IHttpHandler End If End Using - If DTClientes IsNot Nothing Then + If DTClientes IsNot Nothing Then For Each RowCliente As DataRow In DTClientes.Rows Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero() Dim Correo As String = RowCliente("CobranzaCorreo").ToString() @@ -435,9 +435,6 @@ Public Class TareasProgramadas : Implements IHttpHandler drr("CveMoneda") = drt("CveMoneda") DtCxCFact.Rows.Add(drr) Next - Else - Retorno = False - Return Retorno End If If DtCxCFact IsNot Nothing Then @@ -470,6 +467,11 @@ Public Class TareasProgramadas : Implements IHttpHandler TotalIng = SaldoIngPesos + SaldoIngDolaresPesos TotalAnt = SaldoAntPesos + SaldoAntDolaresPesos + If TotalIng.RoundSQL(2) = 0 AndAlso TotalAnt.RoundSQL(2) = 0 Then + Retorno = False + Return Retorno + End If + Dim DtCxCFact2 As DataTable = DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})") 'INGRESOS diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index af899849b..30ad1dc8b 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -3910,7 +3910,7 @@ Partial Class Clientes Gracias por la atención brindada al presente.
Reciba un cordial saludo.

ESTE CORREO SE GENERO EN FORMA AUTOMATICA.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) - Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo2(File, TxtCobranzaCorreo.Text, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo)) + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreoEstadoCuenta(File, TxtCobranzaCorreo.Text, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo, GuardarBitacora:=True)) Hilo.Start() Alert("El correo se envió con éxito", TipoMensaje.MsgInformacion) Catch ex As Exception @@ -3977,7 +3977,7 @@ Partial Class Clientes End If End If End Sub - Private Sub MandaCorreo2(File As Byte(), Para As String, Asunto As String, Body As String) + Private Sub MandaCorreoEstadoCuenta(File As Byte(), Para As String, Asunto As String, Body As String, Optional GuardarBitacora As Boolean = False) Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) 'a.GuardaLog() @@ -3986,11 +3986,17 @@ Partial Class Clientes Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoDeCuenta.pdf"}) - Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=LSRutasMail) + Dim Envio As Boolean = Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=LSRutasMail) + + If Envio AndAlso GuardarBitacora Then + Using ObjBitacora As New ClsOIEventos + ObjBitacora.AddEventoBitacora("Se envió correo con el estado de cuenta del cliente", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=Me.CveCliente) + End Using + End If - End Sub + End Sub #End Region - + #Region "E N V I O C O R R E O" Private Sub EnviaCorreo(Liga As String, LigaActivar As String) @@ -5731,7 +5737,8 @@ Partial Class Clientes Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) a.GuardaLog() Dim Mail As New ClsSisMail() - Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + Dim Envio As Boolean = Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + End Sub Protected Sub BtnCobranzaSMS_Click(sender As Object, e As EventArgs) Dim Telefono = CobranzaTelefono diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 70c15930b..87e46c545 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6739,11 +6739,11 @@ Partial Class Ventas End If End If 'ENVIAR POLIZA VIRTUAL - 'If ErrorList.Count = 0 Then - ' If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then - ' GeneraPolizaVentaWS(ObjFactura) - ' End If - 'End If + If ErrorList.Count = 0 Then + If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then + GeneraPolizaVentaWS(ObjFactura) + End If + End If If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 Then @@ -23752,48 +23752,52 @@ Partial Class Ventas DtUsados = ObjAcum.DtResultados.Copy() End If ObjAcum.Dispose() + Try + For Each Row As DataRow In DtUsados.Rows + Dim obj As New Modelos.MPolizaVentaWS + 'DATOS DEL CLIENTE + obj.customer_name = ObjFactura.Cliente.Nombre + obj.customer_last_name1 = "" + obj.customer_last_name2 = "" + obj.customer_birthday = Nothing + obj.customer_phone = ObjFactura.Cliente.Telefono + obj.customer_email = ObjFactura.Cliente.Mail + obj.customer_gender = "03" 'OTRO GENERO + obj.customer_advertising = False + obj.customer_car_brand = "00" + obj.customer_car_model = "00" + obj.customer_car_year = ObjFactura.Fecha.Year - For Each Row As DataRow In DtUsados.Rows - Dim obj As New Modelos.MPolizaVentaWS - 'DATOS DEL CLIENTE - obj.customer_name = ObjFactura.Cliente.Nombre - obj.customer_last_name1 = "" - obj.customer_last_name2 = "" - obj.customer_birthday = Nothing - obj.customer_phone = ObjFactura.Cliente.Telefono - obj.customer_email = ObjFactura.Cliente.Mail - obj.customer_gender = "03" 'OTRO GENERO - obj.customer_advertising = False - obj.customer_car_brand = "00" - obj.customer_car_model = "00" - obj.customer_car_year = ObjFactura.Fecha.Year + 'DATOS DE VENTA + obj.sale_date = ObjFactura.Fecha + obj.sale_paidby = "01" + obj.sale_type = "01" 'PISO + obj.sale_type_service = "02" 'COMERCIAL + obj.sale_total = ObjFactura.Total + obj.sale_discount = ObjFactura.Descuento + obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta) - 'DATOS DE VENTA - obj.sale_date = ObjFactura.Fecha - obj.sale_paidby = "01" - obj.sale_type = "01" 'PISO - obj.sale_type_service = "02" 'COMERCIAL - obj.sale_total = ObjFactura.Total - obj.sale_discount = ObjFactura.Descuento - obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta) + 'DATOS DEL PRODUCTO + obj.product_code = Row("Code17").ToString() + obj.product_unique_code = "" 'se indique el código único de la batería. + obj.product_sale_type = "01 " 'VENTA - 'DATOS DEL PRODUCTO - obj.product_code = Row("Code17").ToString() - obj.product_unique_code = "" 'se indique el código único de la batería. - obj.product_sale_type = "01 " 'VENTA + Dim FechaUsado As DateTime = Row("FechaAjuste").ToString().ToDateTime() - Dim FechaUsado As DateTime = Row("FechaAjuste").ToString().ToDateTime() + 'DATOS DE USADO + obj.used_product = True + obj.used_brand = Row("IdModelo").ToString() 'MARCAR DEL USADO + obj.used_bci = Row("CveBCIUsado").ToString() 'VALOR DEL BCI + obj.used_month = FechaUsado.Month + obj.used_year = FechaUsado.Year + obj.used_sale_date = FechaUsado - 'DATOS DE USADO - obj.used_product = True - obj.used_brand = Row("IdModelo").ToString() 'MARCAR DEL USADO - obj.used_bci = Row("CveBCIUsado").ToString() 'VALOR DEL BCI - obj.used_month = FechaUsado.Month - obj.used_year = FechaUsado.Year - obj.used_sale_date = FechaUsado + EnviarPolizaVentaWS(obj) + Next + Catch ex As Exception + OnError("Ocurrió un error al generar la poliza virtual", ex) + End Try - EnviarPolizaVentaWS(obj) - Next End Sub