ADS - Cargar imágenes de productos

This commit is contained in:
2024-03-21 00:22:24 -07:00
parent d9d43f516e
commit ac5b03218d
5 changed files with 2861 additions and 2754 deletions

View File

@@ -647,6 +647,27 @@ Public Class ClsProductosServicios
Return Retorno Return Retorno
End Function End Function
Public Function UpdatePSImagen(CvePS As Integer, Imagen As String) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PSImagenUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@Imagen", SqlDbType.VarChar).Value = Imagen
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al guardar la imagen del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function UpdatePS(CveClasificacion As Integer, CveClasificacionCosto As Integer, CveUnidadMedida As Integer, Codigo As String, NumeroParte As String, CodigoBarras As String, PS As String, Precio As Double, IVA As Double, RetIVA As Double, Inventariable As Boolean, CveProveedorCompra As Integer, Public Function UpdatePS(CveClasificacion As Integer, CveClasificacionCosto As Integer, CveUnidadMedida As Integer, Codigo As String, NumeroParte As String, CodigoBarras As String, PS As String, Precio As Double, IVA As Double, RetIVA As Double, Inventariable As Boolean, CveProveedorCompra As Integer,
AplicaParaConcepto As Boolean, AplicaParaVenta As Boolean, Estado As Boolean, CveUsuario As Integer, CvePS As Integer, CveMetodoInventario As Integer, EsPaquete As Integer, CveSATPS As Integer, CveEmpresa As Integer, Optional CveTipoPS As Integer = -1, Optional TipoServicio As Integer = -1, AplicaParaConcepto As Boolean, AplicaParaVenta As Boolean, Estado As Boolean, CveUsuario As Integer, CvePS As Integer, CveMetodoInventario As Integer, EsPaquete As Integer, CveSATPS As Integer, CveEmpresa As Integer, Optional CveTipoPS As Integer = -1, Optional TipoServicio As Integer = -1,
Optional CveClasificacion2 As Integer = -1, Optional CveMarca As Integer = -1, Optional AlmacenSeccion As String = "", Optional AplicaIEPS As Boolean = False, Optional IEPSPorcentaje As Decimal = -1, Optional CveClasificacion2 As Integer = -1, Optional CveMarca As Integer = -1, Optional AlmacenSeccion As String = "", Optional AplicaIEPS As Boolean = False, Optional IEPSPorcentaje As Decimal = -1,

File diff suppressed because it is too large Load Diff

View File

@@ -132,6 +132,15 @@ Partial Class ProductosyServicios
ViewState("GeneraServicioAF") = value ViewState("GeneraServicioAF") = value
End Set End Set
End Property End Property
Public Property Imagen As String
Get
Return IfNull(ViewState("Imagen"), "", ViewState("Imagen")).ToString()
End Get
Set(value As String)
ViewState("Imagen") = value
End Set
End Property
#End Region #End Region
Private ReadOnly Property PermiteClasificacion2 As Boolean Private ReadOnly Property PermiteClasificacion2 As Boolean
@@ -952,6 +961,17 @@ Partial Class ProductosyServicios
DdlTipoFactor.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveTipoFactor").ToString) DdlTipoFactor.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveTipoFactor").ToString)
Me.Imagen = ObjProductosServicios.DtResultados.Rows(0)("Imagen").ToString
If Not String.IsNullOrEmpty(Me.Imagen) Then
imgImagen.Attributes.Add("src", String.Format("/ashx/SIGWeb.ashx?Metodo=GetImg&r={0}", Extensiones.Encripta(Me.Imagen)))
hplImagen.Attributes.Add("href", String.Format("/ashx/SIGWeb.ashx?Metodo=GetImg&r={0}", Extensiones.Encripta(Me.Imagen)))
End If
DivImagen.Visible = True
upGaleria.Update()
RegistraScript("clickgaleria();", "CG")
If ObjProductosServicios.DtResultados.Rows(0)("CveTipoFactor").ToString.Contiene("1", "2") Then If ObjProductosServicios.DtResultados.Rows(0)("CveTipoFactor").ToString.Contiene("1", "2") Then
LIva.Visible = True LIva.Visible = True
DdlIVA.Visible = True DdlIVA.Visible = True
@@ -2482,83 +2502,83 @@ Partial Class ProductosyServicios
#Region " ECOMMERCE " #Region " ECOMMERCE "
Private Sub InicializaEcommerce() Private Sub InicializaEcommerce()
AplicaEcommerce = False 'AplicaEcommerce = False
If UsuarioActual.Empresa.Funcionalidad(700).ToEntero = 1 And CvePS > 0 Then 'If UsuarioActual.Empresa.Funcionalidad(700).ToEntero = 1 And CvePS > 0 Then
TabEcommerce.Visible = True ' TabEcommerce.Visible = True
LBBitacoraEcommerce.Visible = True ' LBBitacoraEcommerce.Visible = True
'INICIALIZA PRODUCTOS ECOMMERCE ' 'INICIALIZA PRODUCTOS ECOMMERCE
Dim ObjEcommerce As New ClsECommerce ' Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.InsigniasGet(-1, "", UsuarioActual.CveEmpresa) Then ' If ObjEcommerce.InsigniasGet(-1, "", UsuarioActual.CveEmpresa) Then
DdlEcommerceInsignia.DataSource = ObjEcommerce.DtResultados ' DdlEcommerceInsignia.DataSource = ObjEcommerce.DtResultados
End If ' End If
ObjEcommerce.Dispose() ' ObjEcommerce.Dispose()
DdlEcommerceInsignia.DataBind() ' DdlEcommerceInsignia.DataBind()
CargaEcommerce() ' CargaEcommerce()
'INICIALIZA PRODUCTOS INSIGNIAS ' 'INICIALIZA PRODUCTOS INSIGNIAS
CargaPSInsigniasEcommerce() ' CargaPSInsigniasEcommerce()
'INICIALIZA PRODUCTOS IMAGENES ' 'INICIALIZA PRODUCTOS IMAGENES
CargarGaleriaImagenesEcommerce() ' CargarGaleriaImagenesEcommerce()
'INICIALIZA PRODUCTOS RELACIONADOS ' 'INICIALIZA PRODUCTOS RELACIONADOS
DdlEcommercePSRelacionado.setEsWebService(True) ' DdlEcommercePSRelacionado.setEsWebService(True)
CargaPSRelacionadosEcommerce() ' CargaPSRelacionadosEcommerce()
UpEcommerce.Update() ' UpEcommerce.Update()
End If 'End If
End Sub End Sub
#Region " PRODUCTOS ECOMMERCE " #Region " PRODUCTOS ECOMMERCE "
Private Sub CargaEcommerce() Private Sub CargaEcommerce()
Dim DrEcommerce As DataRow = Nothing 'Dim DrEcommerce As DataRow = Nothing
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosGet(CvePS, -1, -1, -1, UsuarioActual.CveEmpresa) Then 'If ObjEcommerce.ProductosGet(CvePS, -1, -1, -1, UsuarioActual.CveEmpresa) Then
DrEcommerce = ObjEcommerce.DtResultados.FiltroPrimero("") ' DrEcommerce = ObjEcommerce.DtResultados.FiltroPrimero("")
End If 'End If
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
If DrEcommerce IsNot Nothing Then 'If DrEcommerce IsNot Nothing Then
AplicaEcommerce = True ' AplicaEcommerce = True
TxtEcommerceDescripcion.Text = DrEcommerce("Descripcion").ToString ' TxtEcommerceDescripcion.Text = DrEcommerce("Descripcion").ToString
TxtEcommercePrecioBase.Text = DrEcommerce("PrecioBase").ToString.FormatoNumero ' TxtEcommercePrecioBase.Text = DrEcommerce("PrecioBase").ToString.FormatoNumero
TxtEcommercePrecioPromocion.Text = DrEcommerce("PrecioPromocion").ToString.FormatoNumero ' TxtEcommercePrecioPromocion.Text = DrEcommerce("PrecioPromocion").ToString.FormatoNumero
ChkEcommerceDisponible.Checked = CBool(DrEcommerce("Disponible").ToString) ' ChkEcommerceDisponible.Checked = CBool(DrEcommerce("Disponible").ToString)
End If 'End If
GvEcommercePSRealacionados.DataBind() 'GvEcommercePSRealacionados.DataBind()
UpEcommercePSRelacionados.Update() 'UpEcommercePSRelacionados.Update()
End Sub End Sub
Private Function GuardaEcommerce() As Boolean Private Function GuardaEcommerce() As Boolean
Dim TieneError As Boolean = False Dim TieneError As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(700) = "1" Then If UsuarioActual.Empresa.Funcionalidad(700) = "1" Then
'SI NO SE HA GUARDADO EN ECOMMERCE Y NO TIENE NINGUN VALOR OMITE ''SI NO SE HA GUARDADO EN ECOMMERCE Y NO TIENE NINGUN VALOR OMITE
If Not AplicaEcommerce And Not ChkEcommerceDisponible.Checked And TxtEcommerceDescripcion.Text.Length = 0 And TxtEcommercePrecioBase.Text.Length = 0 And TxtEcommercePrecioPromocion.Text.Length = 0 Then 'If Not AplicaEcommerce And Not ChkEcommerceDisponible.Checked And TxtEcommerceDescripcion.Text.Length = 0 And TxtEcommercePrecioBase.Text.Length = 0 And TxtEcommercePrecioPromocion.Text.Length = 0 Then
Return False ' Return False
End If 'End If
If ChkEcommerceDisponible.Checked Then 'If ChkEcommerceDisponible.Checked Then
If Not ValidaGuardarEcommerce() Then ' If Not ValidaGuardarEcommerce() Then
Return True ' Return True
End If ' End If
End If 'End If
Dim Descripcion As String = TxtEcommerceDescripcion.Text.Trim 'Dim Descripcion As String = TxtEcommerceDescripcion.Text.Trim
Dim PrecioBase As Double = TxtEcommercePrecioBase.Text.Trim.ToDouble 'Dim PrecioBase As Double = TxtEcommercePrecioBase.Text.Trim.ToDouble
Dim PrecioPromocion As Double = TxtEcommercePrecioPromocion.Text.Trim.ToDouble 'Dim PrecioPromocion As Double = TxtEcommercePrecioPromocion.Text.Trim.ToDouble
Dim Disponible As Boolean = ChkEcommerceDisponible.Checked 'Dim Disponible As Boolean = ChkEcommerceDisponible.Checked
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
If Not ObjEcommerce.ProductosAddUpdate(CvePS, Descripcion, PrecioBase, PrecioPromocion, Disponible, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then 'If Not ObjEcommerce.ProductosAddUpdate(CvePS, Descripcion, PrecioBase, PrecioPromocion, Disponible, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
TieneError = True ' TieneError = True
End If 'End If
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
End If End If
@@ -2569,28 +2589,28 @@ Partial Class ProductosyServicios
Dim Mensaje As New StringBuilder Dim Mensaje As New StringBuilder
'DESCRIPCION 'DESCRIPCION
Dim Descripcion As String = TxtEcommerceDescripcion.Text.Trim 'Dim Descripcion As String = TxtEcommerceDescripcion.Text.Trim
If Descripcion.Length = 0 Then 'If Descripcion.Length = 0 Then
Mensaje.Append("- El campo <b>Descripción</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Descripción</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>")
End If 'End If
If Descripcion.Length > 255 Then 'If Descripcion.Length > 255 Then
Mensaje.Append("- El campo <b>Descripción</b> admite maximo 255 caracteres. Por favor verifique y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Descripción</b> admite maximo 255 caracteres. Por favor verifique y vuelva a intentar. <br>")
End If 'End If
'PRECIO BASE ''PRECIO BASE
Dim PrecioBase As Double = TxtEcommercePrecioBase.Text.Trim.ToDouble 'Dim PrecioBase As Double = TxtEcommercePrecioBase.Text.Trim.ToDouble
If PrecioBase = 0 Then 'If PrecioBase = 0 Then
Mensaje.Append("- El campo <b>Precio</b> es obligatorio. Por favor verifique y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Precio</b> es obligatorio. Por favor verifique y vuelva a intentar. <br>")
End If 'End If
If PrecioBase < 0 Then 'If PrecioBase < 0 Then
Mensaje.Append("- El campo <b>Precio</b> no puede ser negativo. Por favor verifique y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Precio</b> no puede ser negativo. Por favor verifique y vuelva a intentar. <br>")
End If 'End If
'PRECIO FINAL ''PRECIO FINAL
Dim PrecioPromocion As Double = TxtEcommercePrecioPromocion.Text.Trim.ToDouble 'Dim PrecioPromocion As Double = TxtEcommercePrecioPromocion.Text.Trim.ToDouble
If PrecioPromocion < 0 Then 'If PrecioPromocion < 0 Then
Mensaje.Append("- El campo <b>Precio Final</b> no puede ser negativo. Por favor verifique y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Precio Final</b> no puede ser negativo. Por favor verifique y vuelva a intentar. <br>")
End If 'End If
'VALIDACION 'VALIDACION
@@ -2606,225 +2626,225 @@ Partial Class ProductosyServicios
#Region " PRODUCTOS INSIGNIAS " #Region " PRODUCTOS INSIGNIAS "
Private Sub CargaPSInsigniasEcommerce() Private Sub CargaPSInsigniasEcommerce()
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosInsigniasGet(CvePS, -1, UsuarioActual.CveEmpresa) Then 'If ObjEcommerce.ProductosInsigniasGet(CvePS, -1, UsuarioActual.CveEmpresa) Then
GvEcommercePSInsignias.DataSource = ObjEcommerce.DtResultados ' GvEcommercePSInsignias.DataSource = ObjEcommerce.DtResultados
Else 'Else
GvEcommercePSInsignias.DataSource = Nothing ' GvEcommercePSInsignias.DataSource = Nothing
End If 'End If
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
GvEcommercePSInsignias.DataBind() 'GvEcommercePSInsignias.DataBind()
UpEcommerceInsignias.Update() 'UpEcommerceInsignias.Update()
End Sub End Sub
Protected Sub BtnEcommerceInsignias_Click(sender As Object, e As EventArgs) Protected Sub BtnEcommerceInsignias_Click(sender As Object, e As EventArgs)
If Not ValidaAgregarProductosInsigniasEcommerce() Then 'If Not ValidaAgregarProductosInsigniasEcommerce() Then
Exit Sub ' Exit Sub
End If 'End If
Dim TieneError As Boolean = False 'Dim TieneError As Boolean = False
Dim CveInsignia As Integer = DdlEcommerceInsignia.SelectedValue.ToEntero 'Dim CveInsignia As Integer = DdlEcommerceInsignia.SelectedValue.ToEntero
'AGREGAR ''AGREGAR
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosInsigniasAdd(Me.CvePS, CveInsignia, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then 'If ObjEcommerce.ProductosInsigniasAdd(Me.CvePS, CveInsignia, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("La Insignia se agregó correctamente.", TipoMensaje.MsgInformacion) ' Alert("La Insignia se agregó correctamente.", TipoMensaje.MsgInformacion)
Else 'Else
TieneError = True ' TieneError = True
End If 'End If
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
If Not TieneError Then 'If Not TieneError Then
DdlEcommerceInsignia.SelectedValueExist(-1) ' DdlEcommerceInsignia.SelectedValueExist(-1)
CargaPSInsigniasEcommerce() ' CargaPSInsigniasEcommerce()
End If 'End If
End Sub End Sub
Private Function ValidaAgregarProductosInsigniasEcommerce() As Boolean Private Function ValidaAgregarProductosInsigniasEcommerce() As Boolean
Dim Retorno As Boolean = True Dim Retorno As Boolean = True
Dim Mensaje As New StringBuilder 'Dim Mensaje As New StringBuilder
'INSIGNIA ''INSIGNIA
Dim CveInsignia As Integer = DdlEcommerceInsignia.SelectedValue.ToEntero 'Dim CveInsignia As Integer = DdlEcommerceInsignia.SelectedValue.ToEntero
If CveInsignia = 0 Then 'If CveInsignia = 0 Then
Mensaje.Append("- El campo <b>Insignia</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Insignia</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>")
End If 'End If
For Each GvRow As GridViewRow In GvEcommercePSInsignias.Rows 'For Each GvRow As GridViewRow In GvEcommercePSInsignias.Rows
If GvRow.DataKey("CveInsignia").ToString.ToEntero = CveInsignia Then ' If GvRow.DataKey("CveInsignia").ToString.ToEntero = CveInsignia Then
Mensaje.Append($"- La Insignia <b>{DdlEcommerceInsignia.SelectedItem.Text}</b> ya es parte del producto y no se puede duplicar. Por favor verifique y vuelva a intentar. <br>") ' Mensaje.Append($"- La Insignia <b>{DdlEcommerceInsignia.SelectedItem.Text}</b> ya es parte del producto y no se puede duplicar. Por favor verifique y vuelva a intentar. <br>")
Exit For ' Exit For
End If ' End If
Next 'Next
'VALIDACION ''VALIDACION
If Mensaje.ToString.Length > 0 Then 'If Mensaje.ToString.Length > 0 Then
Retorno = False ' Retorno = False
Alert(Mensaje.ToString, TipoMensaje.MsgAdvertencia) ' Alert(Mensaje.ToString, TipoMensaje.MsgAdvertencia)
End If 'End If
Return Retorno Return Retorno
End Function End Function
Protected Sub GvEcommercePSInsignias_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvEcommercePSInsignias.RowDeleting 'Protected Sub GvEcommercePSInsignias_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvEcommercePSInsignias.RowDeleting
Dim TieneError As Boolean = False ' Dim TieneError As Boolean = False
Dim GvRow As GridViewRow = GvEcommercePSInsignias.Rows(e.RowIndex) ' Dim GvRow As GridViewRow = GvEcommercePSInsignias.Rows(e.RowIndex)
Dim ObjEcommerce As New ClsECommerce ' Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosInsigniasRemove(GvRow.DataKey("CvePS").ToString.ToEntero, GvRow.DataKey("CveInsignia").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then ' If ObjEcommerce.ProductosInsigniasRemove(GvRow.DataKey("CvePS").ToString.ToEntero, GvRow.DataKey("CveInsignia").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("La Insignia se eliminó correctamente.", TipoMensaje.MsgInformacion) ' Alert("La Insignia se eliminó correctamente.", TipoMensaje.MsgInformacion)
Else ' Else
TieneError = True ' TieneError = True
End If ' End If
ObjEcommerce.Dispose() ' ObjEcommerce.Dispose()
If Not TieneError Then ' If Not TieneError Then
CargaPSInsigniasEcommerce() ' CargaPSInsigniasEcommerce()
End If ' End If
End Sub 'End Sub
#End Region #End Region
#Region " PRODUCTOS IMAGENES " #Region " PRODUCTOS IMAGENES "
Private Sub CargarGaleriaImagenesEcommerce() 'Private Sub CargarGaleriaImagenesEcommerce()
Dim TmpDT As DataTable = Nothing ' Dim TmpDT As DataTable = Nothing
Dim ObjEcommerce As New ClsECommerce ' Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosImagenesGet(CvePS, UsuarioActual.CveEmpresa) Then ' If ObjEcommerce.ProductosImagenesGet(CvePS, UsuarioActual.CveEmpresa) Then
TmpDT = ObjEcommerce.DtResultados ' TmpDT = ObjEcommerce.DtResultados
Else ' Else
TmpDT = Nothing ' TmpDT = Nothing
End If ' End If
ObjEcommerce.Dispose() ' ObjEcommerce.Dispose()
RptFotos.DataSource = TmpDT ' RptFotos.DataSource = TmpDT
RptFotos.DataBind() ' RptFotos.DataBind()
UpEcommerceGaleriaImagenes.Update() ' UpEcommerceGaleriaImagenes.Update()
End Sub 'End Sub
Protected Sub BtnEcommerceImagenes_Click(sender As Object, e As EventArgs) Protected Sub BtnEcommerceImagenes_Click(sender As Object, e As EventArgs)
Dim FilesGral As List(Of Archivo) = TxtEcommerceImagenes.getfiles().Archivos 'Dim FilesGral As List(Of Archivo) = TxtEcommerceImagenes.getfiles().Archivos
Dim FileMove As String = "" 'Dim FileMove As String = ""
Dim Archivo As String = "" 'Dim Archivo As String = ""
Dim DirectorioTemporal As String = "" 'Dim DirectorioTemporal As String = ""
Dim DirectorioDestino As String = $"{UsuarioActual.Empresa.Ruta}\Ecommerce\Productos\Imagenes\" 'Dim DirectorioDestino As String = $"{UsuarioActual.Empresa.Ruta}\Ecommerce\Productos\Imagenes\"
If Not Directory.Exists(DirectorioDestino) Then 'If Not Directory.Exists(DirectorioDestino) Then
Directory.CreateDirectory(DirectorioDestino) ' Directory.CreateDirectory(DirectorioDestino)
End If 'End If
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
For Each FileItem As Archivo In FilesGral 'For Each FileItem As Archivo In FilesGral
Archivo = NowADS().Ticks.ToString ' Archivo = NowADS().Ticks.ToString
Try ' Try
FileMove = FileItem.filename ' FileMove = FileItem.filename
DirectorioTemporal = $"{AppDomain.CurrentDomain.BaseDirectory}Temp\{FileMove}" ' DirectorioTemporal = $"{AppDomain.CurrentDomain.BaseDirectory}Temp\{FileMove}"
Archivo = $"{Archivo}{IO.Path.GetExtension(DirectorioTemporal)}" ' Archivo = $"{Archivo}{IO.Path.GetExtension(DirectorioTemporal)}"
DirectorioDestino += Archivo ' DirectorioDestino += Archivo
If ObjEcommerce.ProductosImagenesAdd(CvePS, $"Ecommerce\Productos\Imagenes\{Archivo}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then ' If ObjEcommerce.ProductosImagenesAdd(CvePS, $"Ecommerce\Productos\Imagenes\{Archivo}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
CargarGaleriaImagenesEcommerce() ' CargarGaleriaImagenesEcommerce()
My.Computer.FileSystem.MoveFile(DirectorioTemporal, DirectorioDestino) ' My.Computer.FileSystem.MoveFile(DirectorioTemporal, DirectorioDestino)
End If ' End If
Catch ex As Exception ' Catch ex As Exception
End Try ' End Try
Next 'Next
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
RegistraScript("$(""#Modalupfotos"").modal(""hide"");initcarusel();") 'RegistraScript("$(""#Modalupfotos"").modal(""hide"");initcarusel();")
TxtEcommerceImagenes.Text = "[]" 'TxtEcommerceImagenes.Text = "[]"
UpUpFotos.Update() 'UpUpFotos.Update()
End Sub End Sub
Protected Sub BtnEcommerceEliminarImagenes_Click(sender As Object, e As System.EventArgs) Protected Sub BtnEcommerceEliminarImagenes_Click(sender As Object, e As System.EventArgs)
Dim CveImagenActivoFijo As Integer = 0 'Dim CveImagenActivoFijo As Integer = 0
CveImagenActivoFijo = Integer.Parse(DirectCast(sender, Button).CommandArgument) 'CveImagenActivoFijo = Integer.Parse(DirectCast(sender, Button).CommandArgument)
If (CveImagenActivoFijo > 0) Then 'If (CveImagenActivoFijo > 0) Then
Dim ObjEcommerce As New ClsECommerce ' Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosImagenesRemove(CveImagenActivoFijo, UsuarioActual.CveEmpresa) Then ' If ObjEcommerce.ProductosImagenesRemove(CveImagenActivoFijo, UsuarioActual.CveEmpresa) Then
File.Delete(String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjEcommerce.DtResultados.Rows(0)("URL"))) ' File.Delete(String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjEcommerce.DtResultados.Rows(0)("URL")))
CargarGaleriaImagenesEcommerce() ' CargarGaleriaImagenesEcommerce()
RegistraScript("initcarusel();") ' RegistraScript("initcarusel();")
End If ' End If
ObjEcommerce.Dispose() ' ObjEcommerce.Dispose()
End If 'End If
End Sub End Sub
#End Region #End Region
#Region " PRODUCTOS RELACIONADOS " #Region " PRODUCTOS RELACIONADOS "
Private Sub CargaPSRelacionadosEcommerce() Private Sub CargaPSRelacionadosEcommerce()
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosRelacionadosGet(CvePS, UsuarioActual.CveEmpresa) Then 'If ObjEcommerce.ProductosRelacionadosGet(CvePS, UsuarioActual.CveEmpresa) Then
GvEcommercePSRealacionados.DataSource = ObjEcommerce.DtResultados ' GvEcommercePSRealacionados.DataSource = ObjEcommerce.DtResultados
Else 'Else
GvEcommercePSRealacionados.DataSource = Nothing ' GvEcommercePSRealacionados.DataSource = Nothing
End If 'End If
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
GvEcommercePSRealacionados.DataBind() 'GvEcommercePSRealacionados.DataBind()
UpEcommercePSRelacionados.Update() 'UpEcommercePSRelacionados.Update()
End Sub End Sub
Protected Sub BtnEcommercePSRelacionados_Click(sender As Object, e As EventArgs) Protected Sub BtnEcommercePSRelacionados_Click(sender As Object, e As EventArgs)
If Not ValidaAgregarProductosRelacionadosEcommerce() Then 'If Not ValidaAgregarProductosRelacionadosEcommerce() Then
Exit Sub ' Exit Sub
End If 'End If
Dim TieneError As Boolean = False 'Dim TieneError As Boolean = False
Dim CvePS As Integer = DdlEcommercePSRelacionado.SelectedValue.ToEntero 'Dim CvePS As Integer = DdlEcommercePSRelacionado.SelectedValue.ToEntero
'AGREGAR ''AGREGAR
Dim ObjEcommerce As New ClsECommerce 'Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosRelacionadosAdd(Me.CvePS, CvePS, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then 'If ObjEcommerce.ProductosRelacionadosAdd(Me.CvePS, CvePS, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("La relación se agregó correctamente.", TipoMensaje.MsgInformacion) ' Alert("La relación se agregó correctamente.", TipoMensaje.MsgInformacion)
Else 'Else
TieneError = True ' TieneError = True
End If 'End If
ObjEcommerce.Dispose() 'ObjEcommerce.Dispose()
If Not TieneError Then 'If Not TieneError Then
DdlEcommercePSRelacionado.SelectedValue = "-1" ' DdlEcommercePSRelacionado.SelectedValue = "-1"
DdlEcommercePSRelacionado.SelectedText = "" ' DdlEcommercePSRelacionado.SelectedText = ""
CargaPSRelacionadosEcommerce() ' CargaPSRelacionadosEcommerce()
End If 'End If
End Sub End Sub
Private Function ValidaAgregarProductosRelacionadosEcommerce() As Boolean Private Function ValidaAgregarProductosRelacionadosEcommerce() As Boolean
Dim Retorno As Boolean = True 'Dim Retorno As Boolean = True
Dim Mensaje As New StringBuilder 'Dim Mensaje As New StringBuilder
'PS ''PS
Dim CvePS As Integer = DdlEcommercePSRelacionado.SelectedValue.ToEntero 'Dim CvePS As Integer = DdlEcommercePSRelacionado.SelectedValue.ToEntero
If CvePS = 0 Then 'If CvePS = 0 Then
Mensaje.Append("- El campo <b>Producto</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>") ' Mensaje.Append("- El campo <b>Producto</b> es obligatorio. Por favor introduzcalo y vuelva a intentar. <br>")
End If 'End If
For Each GvRow As GridViewRow In GvEcommercePSRealacionados.Rows 'For Each GvRow As GridViewRow In GvEcommercePSRealacionados.Rows
If GvRow.DataKey("CvePS").ToString.ToEntero = CvePS Then ' If GvRow.DataKey("CvePS").ToString.ToEntero = CvePS Then
Mensaje.Append($"- El producto <b>{DdlEcommercePSRelacionado.SelectedText}</b> ya esta relacionado y no se puede duplicar. Por favor verifique y vuelva a intentar. <br>") ' Mensaje.Append($"- El producto <b>{DdlEcommercePSRelacionado.SelectedText}</b> ya esta relacionado y no se puede duplicar. Por favor verifique y vuelva a intentar. <br>")
Exit For ' Exit For
End If ' End If
Next 'Next
'VALIDACION ''VALIDACION
If Mensaje.ToString.Length > 0 Then 'If Mensaje.ToString.Length > 0 Then
Retorno = False ' Retorno = False
Alert(Mensaje.ToString, TipoMensaje.MsgAdvertencia) ' Alert(Mensaje.ToString, TipoMensaje.MsgAdvertencia)
End If 'End If
Return Retorno 'Return Retorno
End Function End Function
Protected Sub GvEcommercePSRealacionados_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvEcommercePSRealacionados.RowDeleting 'Protected Sub GvEcommercePSRealacionados_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvEcommercePSRealacionados.RowDeleting
Dim TieneError As Boolean = False ' 'Dim TieneError As Boolean = False
Dim GvRow As GridViewRow = GvEcommercePSRealacionados.Rows(e.RowIndex) ' 'Dim GvRow As GridViewRow = GvEcommercePSRealacionados.Rows(e.RowIndex)
Dim ObjEcommerce As New ClsECommerce ' 'Dim ObjEcommerce As New ClsECommerce
If ObjEcommerce.ProductosRelacionadosRemove(GvRow.DataKey("CvePS1").ToString.ToEntero, GvRow.DataKey("CvePS2").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then ' 'If ObjEcommerce.ProductosRelacionadosRemove(GvRow.DataKey("CvePS1").ToString.ToEntero, GvRow.DataKey("CvePS2").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
Alert("La relación se eliminó correctamente.", TipoMensaje.MsgInformacion) ' ' Alert("La relación se eliminó correctamente.", TipoMensaje.MsgInformacion)
Else ' 'Else
TieneError = True ' ' TieneError = True
End If ' 'End If
ObjEcommerce.Dispose() ' 'ObjEcommerce.Dispose()
If Not TieneError Then ' 'If Not TieneError Then
CargaPSRelacionadosEcommerce() ' ' CargaPSRelacionadosEcommerce()
End If ' 'End If
End Sub 'End Sub
#End Region #End Region
@@ -3599,4 +3619,64 @@ Partial Class ProductosyServicios
End If End If
End Sub End Sub
Private Sub BtnUpFotos_Click(sender As Object, e As EventArgs) Handles BtnUpFotos.Click
Dim FilesGral As List(Of Archivo) = TxtUpFotos.getfiles().Archivos
Dim FileMove As String = ""
Dim NewName As String
For Each FileItem As Archivo In FilesGral
NewName = NowADS().Ticks.ToString
Dim ObjPS As New ClsProductosServicios
Try
FileMove = FileItem.filename
Dim DirectorioOld As New StringBuilder
Dim DirectorioNew As New StringBuilder
DirectorioOld.AppendFormat("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, FileMove)
DirectorioNew.AppendFormat("{0}PS\", UsuarioActual.Empresa.Ruta)
If Not Directory.Exists(DirectorioNew.ToString) Then
Directory.CreateDirectory(DirectorioNew.ToString)
End If
NewName = String.Format("{0}{1}", NewName, IO.Path.GetExtension(DirectorioOld.ToString()))
DirectorioNew.Append(NewName)
Me.Imagen = String.Format("PS/{0}", NewName)
If ObjPS.UpdatePSImagen(Me.CvePS, Me.Imagen) Then
My.Computer.FileSystem.MoveFile(DirectorioOld.ToString, DirectorioNew.ToString)
End If
imgImagen.Attributes.Add("src", String.Format("/ashx/SIGWeb.ashx?Metodo=GetImg&r={0}", Extensiones.Encripta(Me.Imagen)))
hplImagen.Attributes.Add("href", String.Format("/ashx/SIGWeb.ashx?Metodo=GetImg&r={0}", Extensiones.Encripta(Me.Imagen)))
upGaleria.Update()
Catch ex As Exception
OnError("Ocurrió un error al guardar la imagen", ex)
End Try
ObjPS.Dispose()
RegistraScript("$(""#Modalupfotos"").modal(""hide"");initcarusel();")
TxtUpFotos.Text = "[]"
UpUpFotos.Update()
Next
End Sub
Protected Sub BtnEliminarFoto_Click(sender As Object, e As System.EventArgs)
If (Me.CvePS > 0) Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.UpdatePSImagen(Me.CvePS, "") Then
File.Delete(String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, Me.Imagen))
Me.Imagen = ""
imgImagen.Attributes.Add("src", "")
hplImagen.Attributes.Add("href", "")
RegistraScript("initcarusel();")
End If
ObjPS.Dispose()
upGaleria.Update()
End If
End Sub
End Class End Class

View File

@@ -979,6 +979,41 @@
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel ID="UpImagen" runat="server" UpdateMode="Conditional" class="portlet light xspadding bordered whitoutcol" style="margin-left: auto" Visible="false">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Imagen del producto</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-top: 0px; margin-top: -5px;">
<div class="portfolio-content portfolio-1">
<div id="js-filters-juicy-projects" class="cbp-l-filters-button">
</div>
<div id="js-grid-juicy-projects" class="cbp">
<div class="cbp-item graphic">
<div class="cbp-caption">
<div class="cbp-caption-defaultWrap">
<img runat="server" id="imgImagen" style="max-height:250px !important; max-width:250px !important;">
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div> </div>
<asp:UpdatePanel ID="Updatetabs" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="Updatetabs" runat="server" UpdateMode="Conditional">
@@ -7617,7 +7652,7 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField HeaderText="PU" DataField="PU" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="PU" DataField="PU" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<%-- <asp:TemplateField HeaderText="PU Editado" Visible="false"> <%-- <asp:TemplateField HeaderText="PU Editado" Visible="false">
<ItemTemplate> <ItemTemplate>
<asp:TextBox ID="TxtPrecioEditado" runat="server" Text='<%#Eval("PU").ToString%>' MaxLength="12" Width="50%" Height="24px" CssClass="ImporteDevolucion"></asp:TextBox> <asp:TextBox ID="TxtPrecioEditado" runat="server" Text='<%#Eval("PU").ToString%>' MaxLength="12" Width="50%" Height="24px" CssClass="ImporteDevolucion"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros1Editado" runat="server" TargetControlID="TxtPrecioEditado" FilterType="Custom, Numbers" ValidChars=".," /> <ajax:FilteredTextBoxExtender ID="SoloNumeros1Editado" runat="server" TargetControlID="TxtPrecioEditado" FilterType="Custom, Numbers" ValidChars=".," />
@@ -8806,7 +8841,7 @@
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalAddMedico" UpdateMode="Conditional"> <asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalAddMedico" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="modal-content" style="background-color: rgba(255, 255, 255, 0.0);width: 100vw!important;height: 100vh;" > <div class="modal-content" style="background-color: rgba(255, 255, 255, 0.0); width: 100vw!important; height: 100vh;">
<UserControl:AddMedico runat="server" ID="AddMedicoControl" /> <UserControl:AddMedico runat="server" ID="AddMedicoControl" />
</div> </div>
<asp:Button ID="BtnRecargaMedicos" Style="display: none;" ClientIDMode="Static" runat="server" OnClick="BtnRecargaMedicos_Click" /> <asp:Button ID="BtnRecargaMedicos" Style="display: none;" ClientIDMode="Static" runat="server" OnClick="BtnRecargaMedicos_Click" />
@@ -8820,7 +8855,7 @@
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalAddProcedimiento" UpdateMode="Conditional"> <asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalAddProcedimiento" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="modal-content" style="background-color: rgba(255, 255, 255, 0.0);width: 100vw!important;height: 100vh;" > <div class="modal-content" style="background-color: rgba(255, 255, 255, 0.0); width: 100vw!important; height: 100vh;">
<UserControl:AddProcedimiento runat="server" ID="AddProcedimientoControl" /> <UserControl:AddProcedimiento runat="server" ID="AddProcedimientoControl" />
</div> </div>
<asp:Button ID="BtnRecargaProcedimientos" Style="display: none;" ClientIDMode="Static" runat="server" OnClick="BtnRecargaProcedimientos_Click" /> <asp:Button ID="BtnRecargaProcedimientos" Style="display: none;" ClientIDMode="Static" runat="server" OnClick="BtnRecargaProcedimientos_Click" />
@@ -10825,6 +10860,78 @@
$('#BtnRecargaProcedimientos').click(); $('#BtnRecargaProcedimientos').click();
} }
function clickgaleria() {
initcarusel();
initcarusel2 = function () { };
}
var initcarusel = function () {
'use strict';
if ($('#js-grid-juicy-projects').data('hascube') != '1') {
$('#js-grid-juicy-projects').cubeportfolio({
filters: '#js-filters-juicy-projects',
loadMore: '#js-loadMore-juicy-projects',
loadMoreAction: 'click',
layoutMode: 'grid',
defaultFilter: '*',
animationType: 'quicksand',
gapHorizontal: 35,
gapVertical: 30,
gridAdjustment: 'responsive',
mediaQueries: [{
width: 1500,
cols: 5
}, {
width: 1100,
cols: 4
}, {
width: 800,
cols: 3
}, {
width: 480,
cols: 2
}, {
width: 320,
cols: 1
}],
caption: 'overlayBottomReveal',
displayType: 'sequentially',
displayTypeSpeed: 80,
// lightbox
lightboxDelegate: '.cbp-lightbox',
lightboxGallery: true,
lightboxTitleSrc: 'data-title',
lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',
// singlePage popup
singlePageDelegate: '.cbp-singlePage',
singlePageDeeplinking: true,
singlePageStickyNavigation: true,
singlePageCounter: '<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>',
singlePageCallback: function (url, element) {
// to update singlePage content use the following method: this.updateSinglePage(yourContent)
var t = this;
$.ajax({
url: url,
type: 'GET',
dataType: 'html',
timeout: 10000
})
.done(function (result) {
t.updateSinglePage(result);
})
.fail(function () {
t.updateSinglePage('AJAX Error! Please refresh the page!');
});
},
});
$('#js-grid-juicy-projects').data('hascube', '1')
}
}
var initcarusel2 = initcarusel;
</script> </script>
</asp:Content> </asp:Content>

View File

@@ -3171,6 +3171,11 @@ Partial Class Ventas
DivNumTurnos.Visible = True DivNumTurnos.Visible = True
End If End If
If CveVenta <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(716) = "1" Then
UpImagen.Visible = True
UpImagen.Update()
End If
'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE
'If UsuarioActual.CveVendedor > 0 Then 'If UsuarioActual.CveVendedor > 0 Then
' If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) ' If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
@@ -17347,6 +17352,29 @@ Partial Class Ventas
End If End If
If UsuarioActual.Empresa.Funcionalidad(716) = "1" Then
Dim Imagen = drPS("Imagen").ToString
Dim URLImagen As String = ""
If Not String.IsNullOrEmpty(Imagen) Then
URLImagen = String.Format("/ashx/SIGWeb.ashx?Metodo=GetImg&r={0}", Extensiones.Encripta(Imagen))
End If
If imgImagen.Attributes.Item("src") Is Nothing Then
imgImagen.Attributes.Add("src", URLImagen)
Else
imgImagen.Attributes.Item("src") = URLImagen
End If
UpImagen.Update()
If Not String.IsNullOrEmpty(Imagen) Then
RegistraScript("initcarusel();", "I1")
End If
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
AgregarPS() AgregarPS()
End If End If