diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index ba2fb34e6..72c01ec75 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -5462,6 +5462,11 @@ Public Class ClsPaginas
Vta = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.Factura)
PathArchivo = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)
+
+ If EsTicket Then
+ PathArchivo = String.Format("{0}PDF\{1}\{2}_Ticket.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)
+ End If
+
Dim Archivo As New System.IO.FileInfo(PathArchivo)
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
@@ -7443,25 +7448,31 @@ Public Class ClsPaginas
params.Add(New ReportParameter("RegimenFiscalEmpresa", String.Format("{0} - {1}", UsuarioActual.Empresa.CodigoRegimenFiscal, UsuarioActual.Empresa.RegimenFiscal)))
End If
End If
+
+ Dim RutaPDF As String = String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)
+ If EsTicket Then
+ RutaPDF = String.Format("{0}PDF\{1}\{2}_Ticket.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)
+ End If
+
If Not UsarStimul Then
Dim Archivo As New System.IO.FileInfo(RutaFormato)
If Archivo.Exists Then
retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData)
- Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio))
+ Dim ArchivoPDF As New System.IO.FileInfo(RutaPDF)
If Guardar Then
If Not ArchivoPDF.Exists Then
Try
DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta))
DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto))
- File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno)
+ File.WriteAllBytes(RutaPDF, retorno)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
Else
Try
ArchivoPDF.Delete()
- File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno)
+ File.WriteAllBytes(RutaPDF, retorno)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
@@ -7480,20 +7491,20 @@ Public Class ClsPaginas
retorno = StreamBytesStimul("Facturas", RutaFormato, lrds, params, NombreArchivo:=NombreArchivo, Formato:="PDF")
If UsuarioActual.Empresa.Funcionalidad(707) = "1" Then
- Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio))
+ Dim ArchivoPDF As New System.IO.FileInfo(RutaPDF)
If Guardar Then
If Not ArchivoPDF.Exists Then
Try
DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta))
DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto))
- File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno)
+ File.WriteAllBytes(RutaPDF, retorno)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
Else
Try
ArchivoPDF.Delete()
- File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno)
+ File.WriteAllBytes(RutaPDF, retorno)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb
index 4f6cc4926..453eaa541 100644
--- a/Ventas/PVCobranza.aspx.vb
+++ b/Ventas/PVCobranza.aspx.vb
@@ -576,8 +576,12 @@ Partial Class Ventas_PVCobranza
Dim ObjFactura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
Dim ExistePDF As Boolean = False
- Dim ArchivoPDF As String = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
-
+ Dim ArchivoPDF As String = ""
+ If ObjFactura.TipoDocto = "Ing" Then
+ ArchivoPDF = String.Format("{0}/PDF/{1}/{2}_Ticket.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
+ Else
+ ArchivoPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
+ End If
If File.Exists(ArchivoPDF) AndAlso ObjFactura.TipoDocto = "Rem" Then
ExistePDF = True
Else
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index c9b0d5a36..7192e1e97 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -4569,6 +4569,13 @@
+
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 73d67b5a5..83fec084d 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -5599,6 +5599,11 @@ Partial Class Ventas
DdlVendedor.Enabled = False
End If
+ 'PERMITIR EDITAR EL VENDEDOR ANTES DE FACTURAR
+ If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso TmpDT IsNot Nothing AndAlso TmpDT.SUM("CantidadFacturadaCot") = 0) Then
+ DdlVendedor.Enabled = True
+ End If
+
If CveVentaPadre > 0 Then
If IsNothing(Request("CveDevolucion")) AndAlso IsNumeric(Request("CveDevolucion")) Then
DdlNCFactura.Visible = True
@@ -5802,6 +5807,10 @@ Partial Class Ventas
'DdlSucursalEjecucion.Enabled = False
'DdlSucursalCobranza.Enabled = False
DdlVendedor.Enabled = False
+ 'PERMITIR EDITAR EL VENDEDOR ANTES DE FACTURAR
+ If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso TmpDT IsNot Nothing AndAlso TmpDT.SUM("CantidadFacturadaCot") = 0) Then
+ DdlVendedor.Enabled = True
+ End If
DdlSucursalCliente.Enabled = False
TxtTiempoEntrega.Enabled = False
TxtAlfa1.ReadOnly = True
@@ -7195,8 +7204,13 @@ Partial Class Ventas
HabilitarRemisionesPublicoGeneral()
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
- If Not String.IsNullOrEmpty(UsuarioActual.CveTipoDocumento) Then
- DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
+ If Opcion = "Cot" Then
+ DdlTipoComprobante.SelectedValueExist("Cot")
+ Else
+ If Not String.IsNullOrEmpty(UsuarioActual.CveTipoDocumento) Then
+ DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
+ DdlTipoComprobante_SelectedIndexChanged(DdlTipoComprobante, Nothing)
+ End If
End If
End If
End If
@@ -7207,8 +7221,6 @@ Partial Class Ventas
End If
-
-
'If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
' Using ObjVentas As New ClsVentas
' If ObjVentas.GetLineasAdicionales(-1, CveCliente, -1, -1, DdlMoneda.SelectedValue.ToEntero(), MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa) Then
@@ -7771,44 +7783,52 @@ Partial Class Ventas
'VERIFICAR RESTRICCIONES DEL CLIENTE
If Not UsuarioActual.Empresa.Funcionalidad(702).ToEntero() > 0 Then
If (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2") Then
- Dim Vta As New ClsVentas
- Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
- Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
- Vta.Dispose()
+ Dim Valida As Boolean = True
+ If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (Me.CveCliente = UsuarioActual.Empresa.Funcionalidad(714).ToEntero() OrElse Me.PermiteCredito) Then
+ Valida = False
+ End If
- If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
- Dim Autorizacion As Integer = 0
+ If Valida Then
+ Dim Vta As New ClsVentas
+ Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
+ Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:
{0}", Vta.SerieVenta)
+ Vta.Dispose()
- Dim ObjVentas As New ClsVentas
- If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
- Dim RowAutorizacion As DataRow = Nothing
- 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
- If TieneDiasVencidos Then
- RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
- Else
- RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
+ Dim Autorizacion As Integer = 0
+
+ Dim ObjVentas As New ClsVentas
+ If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
+ Dim RowAutorizacion As DataRow = Nothing
+ 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
+ If TieneDiasVencidos Then
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ Else
+ RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
+ End If
+
+ If RowAutorizacion IsNot Nothing Then
+ Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
+ End If
+ End If
+ ObjVentas.Dispose()
+
+ 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
+ If Opcion > 0 AndAlso Autorizacion <= 0 Then
+ Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
End If
- If RowAutorizacion IsNot Nothing Then
- Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
+ Else
+ If Opcion > 0 Then
+ Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
+ BtnsFacturar.Visible = False
+ BtnGenerarRemision.Visible = False
End If
End If
- ObjVentas.Dispose()
-
- 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
- If Opcion > 0 AndAlso Autorizacion <= 0 Then
- Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
- BtnsFacturar.Visible = False
- BtnGenerarRemision.Visible = False
- End If
-
- Else
- If Opcion > 0 Then
- Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
- BtnsFacturar.Visible = False
- BtnGenerarRemision.Visible = False
- End If
End If
+
End If
End If
@@ -15567,7 +15587,13 @@ Partial Class Ventas
'TRASPASO DE PAGOS DE REMISIONES A FACTURA GLOBAL
If ObjFactura.DtPagosFacturaGlobal IsNot Nothing Then
-
+ If ObjFactura.UsuarioActual Is Nothing Then
+ ObjFactura.UsuarioActual = UsuarioActual
+ Else
+ If ObjFactura.UsuarioActual.Empresa Is Nothing Then
+ ObjFactura.UsuarioActual.Empresa = UsuarioActual.Empresa
+ End If
+ End If
Dim VentaActual As New ClsPaginas.Venta(ObjFactura, UsuarioActual)
For Each DrPago As DataRow In ObjFactura.DtPagosFacturaGlobal.Rows
@@ -18305,6 +18331,11 @@ Partial Class Ventas
DdlVendedor.Enabled = True
End If
+ 'PERMITIR EDITAR EL VENDEDOR ANTES DE FACTURAR
+ If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso TmpDT IsNot Nothing AndAlso TmpDT.SUM("CantidadFacturadaCot") = 0) Then
+ DdlVendedor.Enabled = True
+ End If
+
UPPVentas.Update()
'TxtCorreoNotificaciones.Text = GlobalDTUsuarios(UsuarioActual.CveUsuario).FiltroPrimeroValor("Correo")
End Sub
@@ -18427,7 +18458,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Or UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
'VALIDA EXISTENCIA
- If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186}) Then
+ If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190}) Then
If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, TxtCantidad.Text.ToDouble)) Then
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
@@ -37673,22 +37704,7 @@ Partial Class Ventas
End If
If ExistePDF Then
- Dim pdf64 As String = ""
- 'DUPLICA EL PDF
- Using ms As New MemoryStream
- Using pdfdoc As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfWriter(ms))
- pdfdoc.InitializeOutlines()
- Dim reporteByte As New MemoryStream(System.IO.File.ReadAllBytes(ArchivoPDF))
-
- Dim docPDF As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfReader(reporteByte))
- docPDF.CopyPagesTo(1, docPDF.GetNumberOfPages(), pdfdoc)
- docPDF.CopyPagesTo(1, docPDF.GetNumberOfPages(), pdfdoc)
- docPDF.Close()
-
- pdfdoc.Close()
- End Using
- pdf64 = Convert.ToBase64String(ms.ToArray())
- End Using
+ Dim pdf64 = Convert.ToBase64String(System.IO.File.ReadAllBytes(ArchivoPDF))
RegistraScript($"impresionBase64('{pdf64}');", "Imprimir")
Else