From 397613503f7824c0a5b5b6d153eec2d18b65da95 Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 12 Apr 2025 17:24:21 -0700 Subject: [PATCH] =?UTF-8?q?--=20edici=C3=B3n=20de=20ed,=20med.=20sms=20--?= =?UTF-8?q?=20parametro=20de=20clsventas=20comisiones=20sms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsVentas.vb | 3 +- Ventas/Ventas.aspx | 33 +++++++++----- Ventas/Ventas.aspx.vb | 102 ++++++++++++++++++++---------------------- 3 files changed, 74 insertions(+), 64 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index f5df7ceeb..cc028f6c9 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1643,7 +1643,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, IEPS As Decimal, PorcentajeIEPS As Decimal, IVA As Decimal, PorcentajeIVA As Decimal, Descuento As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1, Optional CvePromocionDetalle As Integer = -1) As Boolean + Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, IEPS As Decimal, PorcentajeIEPS As Decimal, IVA As Decimal, PorcentajeIVA As Decimal, Descuento As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1, Optional CvePromocionDetalle As Integer = -1, Optional CantidadConversion As Decimal = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasDetalleRemisionUpdate") @@ -1660,6 +1660,7 @@ Public Class ClsVentas .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico .Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle + .Add("@CantidadConversion", SqlDbType.Decimal).Value = CantidadConversion End With Try diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index b76727f61..b060a909e 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1127,6 +1127,8 @@ Predial + Ed. Med + IVA IEPS @@ -1260,6 +1262,8 @@ + + @@ -1472,6 +1476,15 @@ <%--13--%> + + + + + + + + + <%--14--%>
@@ -1479,7 +1492,7 @@
<%----%> - <%--14--%> + <%--15--%>
@@ -1487,17 +1500,17 @@
<%----%> - <%--15--%> - <%--16--%> - + <%--17--%> + + <%--18--%> - <%--18--%> + <%--19--%>
@@ -1511,14 +1524,14 @@ CssClass="btn btn-circle btn-sm green" Text="" /> - <%--19--%> + <%--20--%> - <%--20--%> + <%--21--%> - <%--21--%> + <%--22--%> @@ -1538,13 +1551,13 @@ - <%--22--%> + <%--23--%> - <%--23--%> + <%--24--%> diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index c7fcb1d25..d13f1cad4 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -21,15 +21,16 @@ Partial Class Ventas #Region "Propiedades" Private Const NumeroDecimales As Integer = 2 + Dim ColumnaSubProyecto As Integer = 8 Dim ColumnaDescuento As Integer = 11 Dim ColumnaPredial As Integer = 12 - Dim ColumnaSubProyecto As Integer = 8 - Dim ColumnaIVA As Integer = 13 - Dim ColumnaIEPS As Integer = 14 - Dim ColumnaRetIVA As Integer = 15 - Dim ColumnaRetISR As Integer = 16 - Dim ColumnaEditar As Integer = 18 - Dim ColumnaEliminar As Integer = 19 + Dim ColumnaCantConversion As Integer = 13 + Dim ColumnaIVA As Integer = 14 + Dim ColumnaIEPS As Integer = 15 + Dim ColumnaRetIVA As Integer = 16 + Dim ColumnaRetISR As Integer = 17 + Dim ColumnaEditar As Integer = 19 + Dim ColumnaEliminar As Integer = 20 'Factura de ventas Dim DTConceptos As DataTable @@ -2744,7 +2745,7 @@ Partial Class Ventas End If AC.Dispose() 'columna de Fuente de recaudacion - GvPS.Columns(22).Visible = True + GvPS.Columns(23).Visible = True nomostrar.Visible = True nomostrar2.Visible = True 'GvPS.Width = 1250 @@ -5037,11 +5038,7 @@ Partial Class Ventas CargaNCDT(Dr("CveVenta").ToString().ToEntero(), DbRowVenta("TipoDocto").ToString(), Dr("Importe").ToString().ToDecimal, Dr("FolioFiscal").ToString(), TC:=Dr("TipoCambio").ToString().ToDecimal) End If Next - - If GvNC.Rows.Count > 0 Then - ImgAntiPend.Visible = False - End If - + If GvNC.Rows.Count > 0 Then ImgAntiPend.Visible = False End If End If End If @@ -5066,7 +5063,6 @@ Partial Class Ventas ChkDevAlm.Enabled = False 'LiDevolucionAlmacen.Visible = False End If - End If 'SI ES COTIZACION PUEDE GENERAR UNA OC PARA MODIFICAR LOS IMPORTES @@ -5093,6 +5089,11 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then TxtAlfa1.Text = DbRowVenta("Alfa1").ToString + If DbRowVenta("CveTipoVenta").ToString = "2" Then 'pago directo + GvPS.Columns(ColumnaCantConversion).Visible = True + thCantConversion1.Visible = True + thCantConversion2.Visible = True + End If End If 'CARGAR PS @@ -5895,8 +5896,8 @@ Partial Class Ventas End If 'Ocultamos los botones Clonar y Ordenar - GvPS.Columns(20).Visible = False GvPS.Columns(21).Visible = False + GvPS.Columns(22).Visible = False thOrden.Visible = False GvFirmas.DataSource = DTmpF @@ -6360,7 +6361,7 @@ Partial Class Ventas Dim HabilitarExistencias As Boolean = False If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DbRowVenta("TipoDocto").ToString().Contiene("Rem", "Cot") Then HabilitarExistencias = True - GvPS.Columns(20).Visible = True + GvPS.Columns(21).Visible = True End If If HabilitarExistencias Then @@ -8793,9 +8794,6 @@ Partial Class Ventas Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.Attributes("id") = e.Row.RowIndex.ToString() - If e.Row.RowIndex = 0 Then - End If - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then 'MODO EDICION @@ -8838,9 +8836,7 @@ Partial Class Ventas e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, dr("CveProyecto").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, 1) e.Row.FCDropDownList("DdlSubProyecto").DataBind() e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DBCampo("CveSubProyecto")) - End If - End If If UsuarioActual.TienePermisoProceso(68) OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then @@ -8848,7 +8844,6 @@ Partial Class Ventas e.Row.FCTextBox("TxtDescuento").Enabled = False End If - If Not EsCreaApartirDe Then 'Si es una devolucion If NuevaFactura = 0 Then @@ -8906,7 +8901,6 @@ Partial Class Ventas e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista")) End If - End If 'Si es facturacion de OC o Contrato @@ -8950,7 +8944,6 @@ Partial Class Ventas e.Row.FCTextBox("TxtPrecio").Enabled = False End If - 'PERMISO EDITAR REM If e.Row.DBCampo("TipoDocto") = "Rem" And ModalidadEdicion Then 'LO PERMITIDO MODIFICAR @@ -8983,9 +8976,8 @@ Partial Class Ventas e.Row.FCLabel("LblTurnoEditar").Visible = True e.Row.FCTextBox("TxtNumTurnosEditar").Visible = True End If - 'LA COLUMNA DE ELIMINACION NO DEBE ESTAR VISIBLE EN EL MODO EDICION - If GvPS.Columns(19).Visible Then + If GvPS.Columns(20).Visible Then e.Row.FCLinkButton("imgD").Visible = False End If @@ -9115,7 +9107,6 @@ Partial Class Ventas End If End If - If DdlTipoComprobante.SelectedValue.Contiene("Cot") Then e.Row.FCHyperLink("HLPS").Visible = True e.Row.FCLabel("LblPS").Visible = False @@ -9124,7 +9115,6 @@ Partial Class Ventas e.Row.FCHyperLink("HLPS").Visible = False e.Row.FCLabel("LblPS").Visible = True End If - End If If CveVenta <= 0 Then @@ -9240,7 +9230,7 @@ Partial Class Ventas OrdenarPS() - If GvPS.Columns(21).Visible Then + If GvPS.Columns(22).Visible Then For Each GvRow As GridViewRow In GvPS.Rows If GvRow.RowType = DataControlRowType.Header Then @@ -9266,6 +9256,7 @@ Partial Class Ventas Dim Cantidad, PU As Decimal Dim ObjDescuento As New Modelos.VentaDescuentos Dim CuentaPredial As String + Dim CantidadConversion As Decimal = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidadConversion").Text.Trim.ToDecimal Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6) @@ -9332,11 +9323,9 @@ Partial Class Ventas If ObjPrecioSugerido IsNot Nothing AndAlso ObjPrecioSugerido.PrecioSugerido > 0 Then PU = ObjPrecioSugerido.PrecioSugerido End If - End If End If - If RecalcularPromociones Then ObjDescuento = CalcularDescuentos(CvePSNuevo, Cantidad, PU) @@ -9410,13 +9399,11 @@ Partial Class Ventas If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text End If - End If End If Dim SubProyecto As String = "" Dim CveSubProyecto As Integer = -1 - Dim Proyecto As String = "" Dim CveProyecto As Integer = -1 @@ -9445,7 +9432,7 @@ Partial Class Ventas CveProyecto, Proyecto, CveSubProyecto, SubProyecto, CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle, - ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista, ConsecutivoManual:=ConsecutivoActual, OrdenManual:=OrdenOriginal) + ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista, CantidadConversion:=CantidadConversion, ConsecutivoManual:=ConsecutivoActual, OrdenManual:=OrdenOriginal) ' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue ' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text @@ -9509,6 +9496,7 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("PorcentajeRetIVA") = ClienteRetIVA TmpDT.Rows(e.RowIndex)("PorcentajeRetISR") = ClienteRetISR TmpDT.Rows(e.RowIndex)("CuentaPredial") = CuentaPredial + TmpDT.Rows(e.RowIndex)("CantidadConversion") = CantidadConversion TmpDT.Rows(e.RowIndex)("TotalConImpuestos") = (TmpDT.Rows(e.RowIndex)("Total").ToString().ToDecimal() - TmpDT.Rows(e.RowIndex)("Descuento").ToString().ToDecimal() + TmpDT.Rows(e.RowIndex)("ImporteIVA").ToString().ToDecimal()).RoundSQL(2) @@ -9558,7 +9546,6 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("CveSubProyecto") = DdlSubProyectoDatos.SelectedValue.ToEntero() End If - 'RELACIONAL PS CON EL DESCUENTO If ObjDescuento IsNot Nothing Then ObjDescuento.Consec = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero() @@ -9566,12 +9553,12 @@ Partial Class Ventas 'RECALCULA LA CANTIDAD DE CONVERSION If CantidadOriginal <> Cantidad Then - Dim CantidadConversion As Decimal = TmpDT.Rows(e.RowIndex)("CantidadConversion").ToString().ToDecimal() + If AplicaComercioExterior Then 'SI NO VIENE DE MANIFIESTO UTILIZA EL PESO DEL PRODUCTO If Request("CveManifiesto") Is Nothing Then If DrPS("PesoKg").ToString().ToDecimal() > 0 Then - CantidadConversion = Cantidad * DrPS("PesoKg").ToString().ToDecimal() + CantidadConversion = Cantidad * DrPS("PesoKg").ToString.ToDecimal() Else CantidadConversion = Cantidad End If @@ -9616,7 +9603,7 @@ Partial Class Ventas 'JJMQ 20160506: Se agrego para la validacion de pago de contado. 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") - If GvPS.Columns(21).Visible Then + If GvPS.Columns(22).Visible Then For Each GvRow As GridViewRow In GvPS.Rows If GvRow.RowType = DataControlRowType.Header Then GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True @@ -14885,7 +14872,7 @@ Partial Class Ventas CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), IEPS:=Row("ImporteIEPS").ToString().ToDecimal, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDecimal, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDecimal, PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDecimal, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDecimal, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDecimal, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero(), - CveActivoFijo:=Row("CveActivoFijo").ToString().ToEntero(), NumTurnos:=Row("NumTurnos").ToString().ToDecimal(), EstatusAlmacen:=EsatusAlmacen, CantidadConversion:=Row("CantidadConversion").ToString().ToDecimal()) Then + CveActivoFijo:=Row("CveActivoFijo").ToString().ToEntero(), NumTurnos:=Row("NumTurnos").ToString().ToDecimal(), EstatusAlmacen:=EsatusAlmacen, CantidadConversion:=Row("CantidadConversion").ToString.ToDecimal()) Then ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Exit For Else @@ -21255,7 +21242,7 @@ Partial Class Ventas Row("TieneProntoPago") = "Si" 'SOLO DEBE MOSTRASE SI EL PAGO ES DE CONTADO If RBLPago.SelectedValue = "2" Then - GvPS.Columns(23).Visible = True + GvPS.Columns(24).Visible = True thProntoPago.Visible = True thProntoPago2.Visible = True End If @@ -24551,7 +24538,7 @@ Partial Class Ventas TxtAtencionA.Enabled = True - GvPS.Columns(21).Visible = True + GvPS.Columns(22).Visible = True thOrden.Visible = True Dim HabilitarExistencias As Boolean = False @@ -24716,7 +24703,8 @@ Partial Class Ventas For Each Row As DataRow In TmpDT.Rows Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero() If CveVentaDetalle > 0 Then - If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Descuento").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario, CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero()) Then + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Descuento").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario, + CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), CantidadConversion:=Row("CantidadConversion").ToString.ToDecimal()) Then OcurrioError = True Exit For End If @@ -25217,11 +25205,11 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If RBLPago.SelectedValue = "2" Then - GvPS.Columns(23).Visible = True + GvPS.Columns(24).Visible = True thProntoPago.Visible = True thProntoPago2.Visible = True Else - GvPS.Columns(23).Visible = False + GvPS.Columns(24).Visible = False thProntoPago.Visible = False thProntoPago2.Visible = False End If @@ -28579,9 +28567,9 @@ Partial Class Ventas 'Ocultamos los botones Editar, Clonar y Ordenar - GvPS.Columns(18).Visible = False - GvPS.Columns(20).Visible = False + GvPS.Columns(19).Visible = False GvPS.Columns(21).Visible = False + GvPS.Columns(22).Visible = False thOrden.Visible = False DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString() @@ -33152,10 +33140,10 @@ Partial Class Ventas 'REINICIALIZA GENERALES PS LbAgregar.Visible = False - GvPS.Columns(18).Visible = False GvPS.Columns(19).Visible = False GvPS.Columns(20).Visible = False GvPS.Columns(21).Visible = False + GvPS.Columns(22).Visible = False thOrden.Visible = False DivRemisionesFacturadas.Visible = False @@ -33848,7 +33836,7 @@ Partial Class Ventas End If If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then - GvPS.Columns(20).Visible = True + GvPS.Columns(21).Visible = True End If 'ECONO, SOLO EL CLIENTE SIGI, PUEDE MODIFICAR EL IVA A 16% @@ -33870,14 +33858,14 @@ Partial Class Ventas imgCalendario.Visible = False End If - GvPS.Columns(21).Visible = True + GvPS.Columns(22).Visible = True thOrden.Visible = True Dim HabilitarExistencias As Boolean = False If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then HabilitarExistencias = True - GvPS.Columns(20).Visible = True + GvPS.Columns(21).Visible = True End If For Each GvRow As GridViewRow In GvPS.Rows @@ -35715,8 +35703,8 @@ Partial Class Ventas DdlLineaAdicional_SelectedIndexChanged(DdlLineaAdicional, EventArgs.Empty) 'HABILITA EDITAR Y ELIMINAR DEL GV - GvPS.Columns(18).Visible = True GvPS.Columns(19).Visible = True + GvPS.Columns(20).Visible = True SetPermisos() @@ -37398,7 +37386,7 @@ Partial Class Ventas End If AC.Dispose() 'columna de Fuente de recaudacion - GvPS.Columns(22).Visible = True + GvPS.Columns(23).Visible = True nomostrar.Visible = True nomostrar2.Visible = True 'GvPS.Width = 1250 @@ -40256,6 +40244,13 @@ Partial Class Ventas Alert("Debe de seleccionar un hospital.", TipoMensaje.MsgAdvertencia) Exit Sub End If + 'activa la columna para especificar el precio + + GvPS.Columns(ColumnaCantConversion).Visible = True + thCantConversion1.Visible = True + thCantConversion2.Visible = True + thCantConversion1.InnerText = "Ed. Med" + Else If DdlClienteSucursalCliente() > 0 Then ViewState("CveCliente") = DdlClienteSucursalCliente() @@ -40366,12 +40361,13 @@ Partial Class Ventas Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero Dim EdMedica As Decimal = 0 If RBLTipoVenta.SelectedValue = "2" Then EdMedica = GvRow.FCTextBox("TxtEdMedica").Text.ToDecimal + 'tomamos la columna de predial, para el uso de ed médica If Cantidad > 0 Then If AgregarProductoServicio(Cantidad, CveUnidadMedida, Abreviatura, CveClasificacion, Clasificacion, CvePS, "", TxtObsPS.Text.TrimEnd, PU, 0, DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, - Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=-1, + Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=-1, ImporteProntoPago:=0, ObjDescuento:=Nothing, CvePrecioLista:=-1, PrecioLista:="", NumTurnos:=0, CantidadConversion:=EdMedica) Then CountPsAgregados = CountPsAgregados + 1 Else