Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Ventas.aspx.vb" Inherits="Ventas" EnableEventValidation="false" %>
|
||||
<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Ventas.aspx.vb" Inherits="Ventas" EnableEventValidation="false" %>
|
||||
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
|
||||
<%@ Register Src="~/UserControl/AddMedico.ascx" TagPrefix="UserControl" TagName="AddMedico" %>
|
||||
|
||||
@@ -2897,6 +2897,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
TxtFechaOS.Text = NowADS().ToDateTime.ToString("yyyy-MM-dd HH:mm").Replace(" ", "T")
|
||||
|
||||
@@ -3745,7 +3746,7 @@ Partial Class Ventas
|
||||
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||
CveCorte = ObjPVenta.CveCorte
|
||||
Dim FechaICorte As Date = ObjPVenta.FechaInicial.Date '.AddDays(-5)
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso FechaICorte < NowADS().Date Then
|
||||
If (UsuarioActual.Empresa.Funcionalidad(531) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1") AndAlso FechaICorte < NowADS().Date Then
|
||||
DebeCerrarCorte = True
|
||||
LblMotivoBloqueo.Text = $"Existe un corte del día <b>{FechaICorte.ToString("dd/MM/yyyy")}</b>. Favor de cerrarlo para iniciar un nuevo corte."
|
||||
Else
|
||||
@@ -10769,8 +10770,9 @@ Partial Class Ventas
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, "", UsarDescargaDesdePopUpVerFactura:=False)
|
||||
Else
|
||||
Dim capturedContext = HttpContext.Current
|
||||
Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST))
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST, EsHilo:=True, Contexto:=capturedContext))
|
||||
Hilo.Start()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -16308,7 +16310,14 @@ Partial Class Ventas
|
||||
''' <param name="strURLHOST"></param>
|
||||
''' <param name="CorreoCRM"></param>
|
||||
''' <param name="UsarDescargaDesdePopUpVerFactura"></param>
|
||||
Private Sub GeneraPDFFactura(EnviaCorreo As Boolean, Factura As Modelos.Factura, UsuarioActual As Usuario, strURLHOST As String, Optional CorreoCRM As String = "", Optional UsarDescargaDesdePopUpVerFactura As Boolean = True)
|
||||
Private Sub GeneraPDFFactura(EnviaCorreo As Boolean, Factura As Modelos.Factura, UsuarioActual As Usuario, strURLHOST As String, Optional CorreoCRM As String = "", Optional UsarDescargaDesdePopUpVerFactura As Boolean = True,
|
||||
Optional EsHilo As Boolean = False, Optional Contexto As HttpContext = Nothing)
|
||||
|
||||
If EsHilo Then
|
||||
HttpContext.Current = Contexto
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
End If
|
||||
|
||||
'GUARDA PDF
|
||||
Dim LocalSerieFolio As String = String.Empty
|
||||
Dim LocalTipoDocto As String = String.Empty
|
||||
@@ -16369,6 +16378,8 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
Private Sub GeneraPDFCotizacion(EnviaCorreo As Boolean, Optional CorreoContactoCRM As String = "", Optional pdfCRM As Byte() = Nothing,
|
||||
Optional SerieFolioCRM As String = "", Optional TipoDoctoCRM As String = "")
|
||||
@@ -16416,7 +16427,9 @@ Partial Class Ventas
|
||||
|
||||
Try
|
||||
' BytesPdfCotizacion(CveVenta)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF, ArchivoAdjunto, CorreoContactoCRM:=CorreoContactoCRM))
|
||||
Dim capturedContext = HttpContext.Current
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF, ArchivoAdjunto, CorreoContactoCRM:=CorreoContactoCRM,
|
||||
EsHilo:=True, Contexto:=capturedContext))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar Mail", ex)
|
||||
@@ -16463,7 +16476,9 @@ Partial Class Ventas
|
||||
|
||||
Try
|
||||
' BytesPdfCotizacion(CveVenta)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF, ArchivoAdjunto))
|
||||
Dim capturedContext = HttpContext.Current
|
||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF, ArchivoAdjunto,
|
||||
EsHilo:=True, Contexto:=capturedContext))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar Mail", ex)
|
||||
@@ -16502,8 +16517,25 @@ Partial Class Ventas
|
||||
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
|
||||
|
||||
Me.TmpDTAnticiposNCIxCCliente = ObjMovtos.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
'AGREGAR LOS ANTICIPOS, DEV, IxC QUE ESTEN EN PUBLICO GENERAL
|
||||
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso UsuarioActual.CveEmpresa = 190 Then
|
||||
Dim CveClientePublicoGeneral = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()
|
||||
If CveClientePublicoGeneral > 0 Then
|
||||
If CveCliente <> CveClientePublicoGeneral Then
|
||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveClientePublicoGeneral) Then
|
||||
For Each DrGeneral As DataRow In ObjMovtos.DtResultados.Rows
|
||||
Me.TmpDTAnticiposNCIxCCliente.Rows.Add(DrGeneral.ItemArray)
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then
|
||||
Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}")
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then
|
||||
@@ -16517,7 +16549,6 @@ Partial Class Ventas
|
||||
Else
|
||||
GVAnticipos.DataSource = Nothing
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
If CveVenta <= 0 OrElse (EsCreaApartirDe Or CveDevolucion > 0) Then
|
||||
divAmortizacionTipo.Visible = True
|
||||
@@ -17279,9 +17310,10 @@ Partial Class Ventas
|
||||
'IMPRESION
|
||||
Try
|
||||
'MANDA CORREO
|
||||
Dim capturedContext = HttpContext.Current
|
||||
Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST))
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST, EsHilo:=True, Contexto:=capturedContext))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el PDF", ex)
|
||||
@@ -21895,7 +21927,13 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
#Region " MANDA CORREO "
|
||||
Private Sub MandaMails(UsuarioActual As Usuario, CveVenta As Integer, TipoDocto As String, SerieFolio As String, EnviarFactura As Boolean, XML As String, PDF As String, Adjunto As String, Optional CorreoContactoCRM As String = "")
|
||||
Private Sub MandaMails(UsuarioActual As Usuario, CveVenta As Integer, TipoDocto As String, SerieFolio As String, EnviarFactura As Boolean, XML As String, PDF As String, Adjunto As String, Optional CorreoContactoCRM As String = "",
|
||||
Optional EsHilo As Boolean = False, Optional Contexto As HttpContext = Nothing)
|
||||
|
||||
If EsHilo Then
|
||||
HttpContext.Current = Contexto
|
||||
HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
|
||||
End If
|
||||
|
||||
Dim ObjMail As New ClsSisMail()
|
||||
Dim ResultadoMail As Integer = 0
|
||||
@@ -38114,5 +38152,10 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user