+
diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb
index adaaba76a..84517bdd1 100644
--- a/OS/OrdenesServicios.aspx.vb
+++ b/OS/OrdenesServicios.aspx.vb
@@ -4,6 +4,7 @@ Option Strict On
Imports Extensiones
Imports System.IO
Imports System.Data
+Imports System.Data.SqlClient
Partial Class OS_OrdenesServicios
Inherits ClsPaginas
@@ -1608,21 +1609,7 @@ Partial Class OS_OrdenesServicios
End If
Return Mostrar
End Function
- Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
- Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
- Dim Archivo As New System.IO.FileInfo(filePath)
- HttpContext.Current.Response.Clear()
- HttpContext.Current.Response.ClearContent()
- HttpContext.Current.Response.ContentType = "application/octet-stream"
- HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath))
- HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
- HttpContext.Current.Response.TransmitFile(filePath)
- HttpContext.Current.Response.Flush()
- HttpContext.Current.Response.End()
-
- Archivo = Nothing
- End Sub
Protected Sub BtnPSEspecificaciones_Click(sender As Object, e As EventArgs) Handles BtnPSEspecificaciones.Click
Dim Especificaciones As String = ""
Dim Mostrar As String = ""
@@ -1817,17 +1804,17 @@ Partial Class OS_OrdenesServicios
#End Region
#Region "E V E N T O - B I T A C O R A"
- Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
- If e.Row.RowType = DataControlRowType.DataRow Then
- If e.Row.RowIndex = 0 Then
- e.Row.Cells(0).Width = 200
- e.Row.Cells(1).Width = 200
- e.Row.Cells(2).Width = 100
- e.Row.Cells(3).Width = 500
- End If
- e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
- End If
- End Sub
+ 'Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
+ ' If e.Row.RowType = DataControlRowType.DataRow Then
+ ' If e.Row.RowIndex = 0 Then
+ ' e.Row.Cells(0).Width = 200
+ ' e.Row.Cells(1).Width = 200
+ ' e.Row.Cells(2).Width = 100
+ ' e.Row.Cells(3).Width = 500
+ ' End If
+ ' e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
+ ' End If
+ 'End Sub
Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click
Dim ObjEventoBitacora As New ClsOIEventos
@@ -3068,6 +3055,8 @@ Partial Class OS_OrdenesServicios
Protected Sub LnkModalMaterialUtilizado_Click(sender As Object, e As EventArgs)
+ Dim ProcesoOK As Boolean = True
+
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
If TxtPacienteModal.Text.Trim.Length = 0 Then
Alert("Debe de proporcionar el paciente.", TipoMensaje.MsgAdvertencia)
@@ -3104,7 +3093,7 @@ Partial Class OS_OrdenesServicios
End If
End If
- Dim ProcesoOK As Boolean = True
+
Dim ObjV As New ClsVentas
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
@@ -3308,6 +3297,10 @@ Partial Class OS_OrdenesServicios
End If
End If
+ If ProcesoOK Then
+ ProcesoOK = GuardarArchivoConfirmacion(ObjV.IniciaTransacSQL, CveOS)
+ End If
+
If ProcesoOK Then
ObjV.Commit()
@@ -3323,6 +3316,7 @@ Partial Class OS_OrdenesServicios
End If
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
+ CargaEventoBitacora()
Else
ObjV.RollBack()
Alert("Se presento un error al guardar el material", TipoMensaje.MsgAdvertencia)
@@ -3332,6 +3326,48 @@ Partial Class OS_OrdenesServicios
End Sub
+
+ Private Function GuardarArchivoConfirmacion(ByRef transaccion As SqlTransaction, CveOSActual As Integer) As Boolean
+ Dim respuesta As Boolean = False
+
+
+ Dim ObjEventoBitacora As New ClsOIEventos(transaccion)
+
+ Dim FileExtension As String = "-1"
+ Dim Filesgral As List(Of Archivo) = AnexoManerialUtilizado.getfiles().Archivos
+ Dim Filename As String = ""
+
+ For Each fileItem As Archivo In Filesgral
+ FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
+ Filename = fileItem.filename
+ Next
+
+
+ If Filename = String.Empty Then
+ respuesta = True
+ Else
+ If ObjEventoBitacora.AddEventoBitacora("Documento de Confirmación", String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveOS:=CveOSActual) Then
+ If Filename <> "" Then
+
+ Try
+ Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
+ respuesta = True
+ Catch ex As Exception
+ Alert("Error al mover archivo de confirmación", TipoMensaje.MsgAdvertencia)
+ respuesta = False
+ End Try
+
+
+ End If
+ AnexoManerialUtilizado.Text = "[]"
+ End If
+ End If
+
+
+ Return respuesta
+
+ End Function
+
Private Function GeneraRemision(CveVentaPedido As Integer, ByRef TransaccionSQL As SqlClient.SqlTransaction) As RespuestaFacturacion
Dim Respuesta As New RespuestaFacturacion()
@@ -3428,4 +3464,40 @@ Partial Class OS_OrdenesServicios
ObjOs.Dispose()
End Sub
+
+ Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ 'If e.Row.RowIndex = 0 Then
+ ' e.Row.Cells(0).Width = Unit.Pixel(200)
+ ' e.Row.Cells(1).Width = Unit.Pixel(200)
+ ' e.Row.Cells(2).Width = Unit.Pixel(100)
+ ' e.Row.Cells(3).Width = Unit.Pixel(500)
+ 'End If
+
+ If e.Row.DBCampo("Archivo").ToString <> "" Then
+ e.Row.FCLinkButton("LinkArchivo").Visible = True
+ e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString)
+ ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione
+ End If
+
+ e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
+
+ End If
+ End Sub
+
+ Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
+ Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
+ Dim Archivo As New System.IO.FileInfo(filePath)
+
+ HttpContext.Current.Response.Clear()
+ HttpContext.Current.Response.ClearContent()
+ HttpContext.Current.Response.ContentType = "application/octet-stream"
+ HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath))
+ HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
+ HttpContext.Current.Response.TransmitFile(filePath)
+ HttpContext.Current.Response.Flush()
+ HttpContext.Current.Response.End()
+
+ Archivo = Nothing
+ End Sub
End Class
\ No newline at end of file
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 8edc71bf2..94c375811 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -10772,7 +10772,7 @@ Partial Class Ventas
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, EsHilo:=True, Contexto:=capturedContext))
+ Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST, UsarDescargaDesdePopUpVerFactura:=True))
Hilo.Start()
End If
Catch ex As Exception
@@ -10905,10 +10905,6 @@ Partial Class Ventas
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
End If
- ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
- If UsuarioActual.CveEmpresa.Contiene(81, 109) Then
- EnviaPDFRemision(ChkEnviarFactura.Checked)
- End If
End If
'ENVIA CORREO CON DETALLE DEL CONTRATO
@@ -16310,13 +16306,7 @@ Partial Class Ventas
'''
'''
'''
- 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
+ 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)
'GUARDA PDF
Dim LocalSerieFolio As String = String.Empty
@@ -16368,7 +16358,7 @@ Partial Class Ventas
End If
If ErrorCorreo Then
- Dim ObjVentas As New ClsVentas
+ Dim ObjVentas As New ClsVentas(UsuarioActual:=UsuarioActual)
If EnviaCorreo Then
ObjVentas.UpdateVentaMail(3, CveVenta)
Else
@@ -16428,8 +16418,7 @@ Partial Class Ventas
Try
' BytesPdfCotizacion(CveVenta)
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))
+ Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF, ArchivoAdjunto, CorreoContactoCRM:=CorreoContactoCRM))
Hilo.Start()
Catch ex As Exception
OnError("Ocurrió error al mandar Mail", ex)
@@ -16444,55 +16433,6 @@ Partial Class Ventas
End If
End Sub
- Private Sub EnviaPDFRemision(EnviaCorreo As Boolean)
- 'MANDA CORREO
- If EnviaCorreo Then
-
- 'GUARDA PDF
- Dim pdf As Byte() = Nothing
- Dim LocalSerieFolio As String = String.Empty
- Dim LocalTipoDocto As String = String.Empty
-
- 'TIMBRADO NUEVO
- Try
- pdf = PdfFactura(ObjFactura, AplicaPagare:="1")
- Catch ex As Exception
- Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
- End Try
-
- If CveVenta > 0 Then
- ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
- End If
-
- LocalSerieFolio = ObjFactura.SerieFolio
- LocalTipoDocto = ObjFactura.TipoDocto
- Dim ArchivoAdjunto As String = ""
-
- Dim ArchivoXML As String = String.Format("{0}XML\{1}\{2}.xml", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio)
- Dim ArchivoPDF As String = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, LocalTipoDocto, LocalSerieFolio)
- If Adjunto <> "" Then
- ArchivoAdjunto = String.Format("{0}Ventas\{1}", UsuarioActual.Empresa.Ruta, Adjunto)
- End If
-
- Try
- ' BytesPdfCotizacion(CveVenta)
- 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)
- Dim ObjVentas As New ClsVentas
- If ChkEnviarFactura.Checked Then
- ObjVentas.UpdateVentaMail(3, CveVenta)
- Else
- ObjVentas.UpdateVentaMail(0, CveVenta)
- End If
- ObjVentas.Dispose()
- End Try
- End If
- End Sub
-
#End Region
#Region " ANTICIPOS "
@@ -17118,7 +17058,7 @@ Partial Class Ventas
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(12, 66, 277) Then
- Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal ' - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
+ Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
End If
Next
@@ -17313,7 +17253,7 @@ Partial Class Ventas
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, EsHilo:=True, Contexto:=capturedContext))
+ Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST, UsarDescargaDesdePopUpVerFactura:=True))
Hilo.Start()
Catch ex As Exception
OnError("Ocurrió un error al enviar el PDF", ex)
@@ -21927,13 +21867,7 @@ 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 = "",
- Optional EsHilo As Boolean = False, Optional Contexto As HttpContext = Nothing)
-
- If EsHilo Then
- HttpContext.Current = Contexto
- HttpContext.Current.Session("UsuarioSIG") = UsuarioActual
- End If
+ 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 = "")
Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0
@@ -22066,7 +22000,7 @@ Partial Class Ventas
OnError("Ocurrió error al mandar el Mail", ex)
ResultadoMail = 3
Finally
- Dim ObjVentas As New ClsVentas
+ Dim ObjVentas As New ClsVentas(UsuarioActual:=UsuarioActual)
ObjVentas.UpdateVentaMail(ResultadoMail, CveVenta)
ObjVentas.Dispose()
End Try