From 2c4d8cca9af740d386575566834ccfc342d1973b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 9 Feb 2024 14:58:12 -0700 Subject: [PATCH] =?UTF-8?q?--FERRETERA.=20crear=20la=20impresi=C3=B3n=20de?= =?UTF-8?q?=20etiquetas=20de=20productos=20y=20precios,=20campo=20nuevo.?= =?UTF-8?q?=20en=20PS=20(producto=20de=20exhibici=C3=B3n)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsProductosServicios.vb | 26 +++++++++++++-- Compras/PopUpVerFactura.aspx.vb | 28 +++++++++++++++- Ventas/ActualizarPrecios.aspx | 2 +- Ventas/ActualizarPrecios.aspx.vb | 55 ++++++++++++++++++++----------- Ventas/ProductosServicios.aspx | 4 +++ Ventas/ProductosServicios.aspx.vb | 9 +++-- 6 files changed, 97 insertions(+), 27 deletions(-) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index f5a3d51af..cadf04a74 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -413,7 +413,7 @@ Public Class ClsProductosServicios Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0, Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1, Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "", Optional ActivoEcommerce As Boolean = False, Optional EcommercePrecio As Decimal = 0, - Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1") As Integer + Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1", Optional ProductoExhibicion As Boolean = False) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_ProductosServiciosAdd") @@ -521,7 +521,7 @@ Public Class ClsProductosServicios .Add("@CodigoAlterno", SqlDbType.VarChar).Value = CodigoAlterno .Add("@PSAlterno", SqlDbType.VarChar).Value = PSAlterno - + .Add("@ProductoExhibicion", SqlDbType.Bit).Value = ProductoExhibicion End With @@ -658,7 +658,7 @@ Public Class ClsProductosServicios Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0, Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1, Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "", Optional ActivoEcommerce As Boolean = False, Optional EcommercePrecio As Decimal = 0, - Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1") As Boolean + Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1", Optional ProductoExhibicion As Boolean = False) As Boolean Dim Retorno As Boolean = False @@ -765,6 +765,7 @@ Public Class ClsProductosServicios .Add("@EcommerceCantidad", SqlDbType.SmallMoney).Value = EcommerceCantidad .Add("@CodigoAlterno", SqlDbType.VarChar).Value = CodigoAlterno .Add("@PSAlterno", SqlDbType.VarChar).Value = PSAlterno + .Add("@ProductoExhibicion", SqlDbType.Bit).Value = ProductoExhibicion End With Try @@ -2332,6 +2333,25 @@ Public Class ClsProductosServicios Return Retorno End Function + Public Function GetPSPrecios(CvePrecioLista As Integer, Productos As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProductosPreciosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@Productos", SqlDbType.VarChar).Value = Productos + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los precios de los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #Region " P S C O M P L E M E N T O S" diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 328071a34..a2f5a8316 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1301,13 +1301,20 @@ Partial Class PopUpVerFactura End If End If - 'IMPRIME VALE + 'IMPRIME ACUSE If UrlParametros("OP").ToString = "CAN" Then If UrlParametros("CVEVTA") IsNot Nothing AndAlso UrlParametros("CVEVTA").ToString.ToEntero > 0 Then ImprimeCancelacion(UrlParametros("CVEVTA").ToString.ToEntero) End If End If + 'IMPRIME ETIQUETA + If UrlParametros("OP").ToString = "ETIQUETA" Then + If UrlParametros("PRODUCTOS") IsNot Nothing AndAlso UrlParametros("CVEPRECIOLISTA").ToString.ToEntero > 0 Then + ImprimeEtiqueta(UrlParametros("PRODUCTOS").ToString, UrlParametros("CVEPRECIOLISTA").ToString.ToEntero) + End If + End If + 'IMPRIME AFR If UrlParametros("OP").ToString = "AFR" Then If UrlParametros("CVEAFR") IsNot Nothing AndAlso UrlParametros("CVEAFR").ToString.ToEntero > 0 Then @@ -6020,6 +6027,25 @@ Partial Class PopUpVerFactura End Sub #End Region +#Region "OP = 'E T I Q U E T A'" + Public Sub ImprimeEtiqueta(CvesProductos As String, CvePrecioLista As Integer) + Dim DtPrecios As DataTable = Nothing + + Dim ObjVentas As New ClsProductosServicios + If ObjVentas.GetPSPrecios(CvePrecioLista, CvesProductos) AndAlso ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + DtPrecios = ObjVentas.DtResultados.Copy() + End If + ObjVentas.Dispose() + + If DtPrecios IsNot Nothing Then + Dim DirectorioArchivo As String = "Empresas/Grales/Formatos/Etiqueta.mrt" + Dim params As New List(Of ReportParameter) + + ImprimirPDFStimul(DirectorioArchivo, DtPrecios, params, "Precios") + End If + + End Sub +#End Region #Region "IMPRESION POLIZAS" diff --git a/Ventas/ActualizarPrecios.aspx b/Ventas/ActualizarPrecios.aspx index dea6d8d1e..5eb90535c 100644 --- a/Ventas/ActualizarPrecios.aspx +++ b/Ventas/ActualizarPrecios.aspx @@ -207,7 +207,7 @@ " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> - diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index f692f952a..0222be5d3 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -296,34 +296,49 @@ Partial Class Ventas_ActualizarPrecios Alert("Se debe de especificar un porcentaje.", TipoMensaje.MsgAdvertencia) Exit Sub End If - Dim Correcto As Boolean = False + Dim TieneError As Boolean = False 'Dim Importe As Decimal = If(TxtImporte.Text = "", -1, TxtImporte.Text.ToDecimal) Dim Porcentaje As Decimal = If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) - + Dim MensajeAlert As New StringBuilder + Dim sbProductos As New StringBuilder + Dim ObjPS As New ClsProductosServicios ObjPS.IniciaTransacSQL() - - For Each row As GridViewRow In GVPrecios.Rows - - If row.FCCheckBox("chkPS").Checked Then - Correcto = ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) - - If Correcto Then - TieneError = ActualizarPreciosFranquicia(ObjPS, row.DataKey("Codigo"), row.DataKey("PS"), row.FCTextBox("TxtPrecio").Text.ToDecimal, row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal, DdlPrecioLista.SelectedItem.Text) - Else - Exit Sub - End If - End If - - Next - - If Correcto AndAlso Not TieneError Then - Alert("Los Precios de lista de los Productos/Servicios se actualizaron correctamente") - End If + Try + For Each row As GridViewRow In GVPrecios.Rows + If row.FCCheckBox("chkPS").Checked Then + TieneError = Not ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) + If CBool(row.DataKey("ProductoExhibicion")) Then + sbProductos.AppendFormat("{0},", row.DataKey("CvePS").ToEntero) + End If + + + If Not TieneError Then + TieneError = ActualizarPreciosFranquicia(ObjPS, row.DataKey("Codigo"), row.DataKey("PS"), row.FCTextBox("TxtPrecio").Text.ToDecimal, row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal, DdlPrecioLista.SelectedItem.Text) + Else + Exit For + End If + End If + Next + + If Not TieneError Then + If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso sbProductos.Length > 0 Then + MensajeAlert.AppendFormat("Los precios de lista de los productos/servicios se actualizaron correctamente.
Descargar Etiquetas", Encripta(String.Format("OP=ETIQUETA&CVEPRECIOLISTA={0}&PRODUCTOS={1}", DdlPrecioLista.SelectedValue.ToEntero, sbProductos.ToString()))) + Else + MensajeAlert.Append("Los precios de lista de los productos/servicios se actualizaron correctamente.") + End If + + Alert(MensajeAlert.ToString()) + End If + Catch ex As Exception + TieneError = True + GuardaLog(ex.ToString()) + End Try If TieneError Then ObjPS.RollBack() + Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError) Else ObjPS.Commit() End If diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index 9739df374..596dacc42 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -246,6 +246,10 @@ +
+ + +
<%----%> diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 6737c583f..4e568ad27 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1113,6 +1113,11 @@ Partial Class ProductosyServicios DVCodigoPSAlterno.Visible = True End If + + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + DivPSExhibicion.Visible = True + ChkPSExhibicion.Checked = CBool(ObjProductosServicios.DtResultados.Rows(0)("ProductoExhibicion").ToString) + End If Else Alert("El Producto o Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) RegistraScript("$('#C_Tab_TabPaquetes_tab').css('display' , 'none')") @@ -1509,7 +1514,7 @@ Partial Class ProductosyServicios CveMaterialPeligroso:=DdlMaterialPeligroso.SelectedValue.ToEntero, CveEmbalaje:=DdlEmbalaje.SelectedValue.ToEntero, PesoKg:=TxtPesoKg.Text.ToDecimal, Dimensiones:=TxtDimensiones.Text.Trim, CveObjetoImpuesto:=DdlObjetoImpuesto.SelectedValue.ToEntero, Litraje:=TxtLitraje.Text.ToDecimal, RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked, NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim, EcommerceEtiquetas:=TxtEcommerceEtiquetas.Text.Trim.Replace(".", ""), EcommercePrecio:=TxtEcommercePrecio.Text.Trim.ToDecimal, - CveClasificacionEcommerce:=DdlEcommerceClasificacion.SelectedValue.ToEntero, EcommerceCantidad:=TxtEcommerceCantidad.Text.Trim.ToDecimal, CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim) > 0 Then + CveClasificacionEcommerce:=DdlEcommerceClasificacion.SelectedValue.ToEntero, EcommerceCantidad:=TxtEcommerceCantidad.Text.Trim.ToDecimal, CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim, ProductoExhibicion:=ChkPSExhibicion.Checked) > 0 Then ViewState("CvePS") = ObjProductosServicios.CvePS For Each GVR As GridViewRow In GvImpuestosLocales.Rows If GVR.FCCheckBox("ChkDeduccion").Checked Then @@ -1583,7 +1588,7 @@ Partial Class ProductosyServicios RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked, NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim, EcommerceEtiquetas:=TxtEcommerceEtiquetas.Text.Trim.Replace(".", ""), ActivoEcommerce:=ChkActivoEcommerce.Checked, EcommercePrecio:=TxtEcommercePrecio.Text.Trim.ToDecimal, CveClasificacionEcommerce:=DdlEcommerceClasificacion.SelectedValue.ToEntero, EcommerceCantidad:=TxtEcommerceCantidad.Text.Trim.ToDecimal, - CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim) Then + CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim, ProductoExhibicion:=ChkPSExhibicion.Checked) Then If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then TieneError = True