diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index c89ddd1a4..e0200a5c8 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -325,9 +325,17 @@
<%--
Descargar Formato
--%>
-
- Cargar Concepto
-
+
+
+
+ Cargar Concepto
+
+
+ Cargar Excel
+
+
+
+
<%----%>
Saldar
@@ -6452,6 +6460,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Descargar Plantilla
+
+
+
+
+
+
Paso 1 : Descargar Plantilla
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Cargar Plantilla
+
+
+
+
+
+
Paso 2: Cargar Plantilla
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<%--MODAL ADD PS --%>
@@ -7925,7 +8021,7 @@
-
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index c745fccfa..002e09ad6 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -3486,7 +3486,13 @@ Partial Class Ventas
''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ???
If Not CveVenta > 0 Then
'LbDescargarExcel.Visible = True
- HlAgregarExcel.Visible = True
+ If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
+ HLCargaCotizaciones.Visible = True
+ HlAgregarExcel.Visible = False
+ Else
+ HLCargaCotizaciones.Visible = False
+ HlAgregarExcel.Visible = True
+ End If
End If
If DdlTipoComprobante.SelectedValue.Contiene("Rem") AndAlso UsuarioActual.Empresa.Funcionalidad(109) <> "1" Then
@@ -21291,6 +21297,16 @@ Partial Class Ventas
TdOrdenPago.Visible = True
End If
+ If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
+ HLCargaCotizaciones.Visible = True
+ HlAgregarExcel.Visible = False
+ Else
+ HLCargaCotizaciones.Visible = False
+ HlAgregarExcel.Visible = True
+ End If
+
+ UpCargaExceles.Update()
+
UpFacturar.Update()
End Sub
@@ -26426,9 +26442,30 @@ Partial Class Ventas
Response.End()
End If
End Sub
+
+ Public Sub DescargarFormatoCotizaciones()
+ Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoCotizaciones.xlsx"
+
+ Dim Archivo As New IO.FileInfo(Directorio)
+ If Archivo.Exists Then
+ Response.Clear()
+ Response.ClearHeaders()
+ Response.ClearContent()
+ Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name)
+ Response.AddHeader("Content-Length", Archivo.Length.ToString())
+ Response.ContentType = "text/plain"
+ Response.Flush()
+ Response.TransmitFile(Archivo.FullName)
+ Response.End()
+ End If
+ End Sub
Public Sub LbDescargarExcel_Click(sender As Object, e As EventArgs) Handles LbDescargarExcelVentas.Click
DescargarFormato()
End Sub
+
+ Public Sub LbDescargarExcelCotizaciones_Click(sender As Object, e As EventArgs) Handles LbDescargarExcelCotizaciones.Click
+ DescargarFormatoCotizaciones()
+ End Sub
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String, FileUrl As String)
Dim dt As New DataTable
Dim ErrorArchivo As Boolean = False
@@ -26597,6 +26634,141 @@ Partial Class Ventas
End If
dt.Dispose()
End Sub
+
+ Private Sub CargarArchivoCotizacion(Ruta As String, FileName As String, Tipo As String, FileUrl As String)
+ Dim dt As New DataTable
+ Dim ErrorArchivo As Boolean = False
+ Dim n As Integer = 0
+ dt = ReadExcelFile(FileUrl, True)
+ If Not ErrorArchivo Then
+ If Not dt.Columns(0).ColumnName = "Cantidad" Then
+ Alert("El nombre de la primera columna debe ser 'Cantidad'.Favor de corregirlo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+
+ If Not dt.Columns(1).ColumnName = "Código" Then
+ Alert("El nombre de la segunda columna debe ser 'Código'. Favor de corregirlo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+
+ If Not dt.Columns(2).ColumnName = "Codigo Barras" Then
+ Alert("El nombre de la tecera columna debe ser 'Codigo Barras'. Favor de corregirlo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+
+ If Not dt.Columns(3).ColumnName = "Precio Unitario" Then
+ Alert("El nombre de la sexta columna debe ser 'Precio Unitario'. Favor de corregirlo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+
+ If Not dt.Columns(4).ColumnName = "Descuento" Then
+ Alert("El nombre de la sexta columna debe ser 'Descuento'. Favor de corregirlo", TipoMensaje.MsgError)
+ Exit Sub
+ End If
+
+ dt.TableName = "Datos"
+
+ Dim DtSubProyecto As DataTable = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero())
+
+ If Not ErrorArchivo Then
+ NumRow = 1
+ Dim RowNoEncontrados As String = ""
+ Dim NumAgregados As Integer = 0
+ For Each Row As DataRow In dt.Rows
+ NumAgregados = NumAgregados + 1
+
+ Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
+ Dim Codigo As String = Row("Código").ToString().Trim.ToUpper()
+ Dim CodigoBarras As String = Row("Codigo Barras").ToString().Trim.ToUpper()
+ Dim PrecioUnitario As Decimal = Row("Precio Unitario").ToString().ToDecimal()
+ Dim Descuento As Decimal = Row("Descuento").ToString().ToDecimal()
+ Dim Proyecto = ""
+ Dim CvePS As Integer = 0
+ Dim CveClasificacion As Integer = 0
+ Dim CveUM As Integer = 0
+ Dim UM As String = ""
+ Dim PS As String = ""
+ Dim DrProyecto As DataRow = DtSubProyecto.FiltroPrimero("")
+ Dim SubProyecto As String = ""
+ Dim CveProyecto As Integer = 0
+ Dim CveSubProyecto As Integer = 0
+
+ NumRow = NumRow + 1
+
+ If DrProyecto IsNot Nothing Then
+ CveSubProyecto = DrProyecto("CveSubProyecto").ToString().ToEntero()
+ CveProyecto = DrProyecto("CveProyecto").ToString().ToEntero()
+ SubProyecto = DrProyecto("SubProyecto").ToString()
+ Proyecto = DrProyecto("Proyecto").ToString()
+ End If
+
+ 'If CveSubProyecto <= 0 Then
+ ' RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>(NoBD)", Proyecto, NumRow, "Proyecto", RowNoEncontrados)
+ 'End If
+
+ If CveSubProyecto > 0 Then
+ If Codigo <> "" Then
+
+ Using ObjPS As New ClsProductosServicios
+ If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, Codigo:=Codigo) Then
+ If ObjPS.CvePS > 0 Then
+ CvePS = ObjPS.CvePS
+ PS = ObjPS.PS
+ CveUM = ObjPS.CveUnidadMedida
+ CveClasificacion = ObjPS.CveClasificacion
+ Else
+ RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
+ End If
+ Else
+ RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
+ End If
+ End Using
+
+ ElseIf CodigoBarras <> "" Then
+
+ Using ObjPS As New ClsProductosServicios
+ If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, CodigoBarras:=CodigoBarras) Then
+ If ObjPS.CvePS > 0 Then
+ CvePS = ObjPS.CvePS
+ PS = ObjPS.PS
+ CveUM = ObjPS.CveUnidadMedida
+ CveClasificacion = ObjPS.CveClasificacion
+ Else
+ RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
+ End If
+ Else
+ RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
+ End If
+ End Using
+ RowNoEncontrados &= "<\BR> - En la fila " & NumRow & " no se especificó código, código de barras ó descripción."
+ End If
+ End If
+
+
+ If CvePS > 0 Then
+
+ If PrecioUnitario <= 0 Then
+ Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
+ PrecioUnitario = ObjPrecioSugerido.PrecioSugerido
+ End If
+
+ AgregarProductoServicio(Cantidad, CveUM, UM, -1, "",
+ CvePS, PS, "", PrecioUnitario, Descuento,
+ CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+ End If
+ Next
+
+ CalculaTotalesVenta()
+
+ If RowNoEncontrados.Length > 0 Then
+ Alert("Los siguientes productos o servicios no se encontraron en la Base de Datos.<\BR>" & RowNoEncontrados, TipoMensaje.MsgAdvertencia)
+ Else
+ Alert("Se cargaron " & NumAgregados & " productos o servicios correctamente.")
+ End If
+ End If
+ End If
+ dt.Dispose()
+ End Sub
Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
If TxtExcel.getfiles().Archivos.Count > 0 Then
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
@@ -26608,6 +26780,17 @@ Partial Class Ventas
End If
End Sub
+ Private Sub BtnCargarExcelCotizaciones_Click(sender As Object, e As EventArgs) Handles BtnCargarExcelCotizaciones.Click
+ If TxtExcelCotizaciones.getfiles().Archivos.Count > 0 Then
+ Dim file As Archivo = TxtExcelCotizaciones.getfiles().Archivos(0)
+ Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.path
+ Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
+ CargarArchivoCotizacion(Directorio, file.filename, Tipo, file.FileUrl)
+ Else
+ Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
+ End If
+ End Sub
+
'Private dtps As DataTable = Nothing
'Private Function GetPS(Opt As String, Valor As String) As String
@@ -30982,6 +31165,7 @@ Partial Class Ventas
LiDevolucionAlmacen.Visible = False
HLPagar.Visible = False
HlAgregarExcel.Visible = False
+ HLCargaCotizaciones.Visible = False
HplDownXML.Visible = False
HplDownPDF.Visible = False
HLSaldarVenta.Visible = False
@@ -31422,6 +31606,7 @@ Partial Class Ventas
LiDevolucionAlmacen.Visible = False
HLPagar.Visible = False
HlAgregarExcel.Visible = False
+ HLCargaCotizaciones.Visible = False
HplDownXML.Visible = False
HplDownPDF.Visible = False
HLSaldarVenta.Visible = False
@@ -33712,7 +33897,7 @@ Partial Class Ventas
LiDevolucionAlmacen.Visible = False
HLPagar.Visible = False
HlAgregarExcel.Visible = False
-
+ HLCargaCotizaciones.Visible = False
'REINICIALIZA VALORES DE CANTIDAD FACTURADA - SOLO DEBEN MOSTRARSE AL CARGAR UNA REMISION/COTIZACIÓN
GvPS.Columns(6).Visible = False