diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index c5f8dd4f9..2819ceb5a 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1325,7 +1325,7 @@ Public Class ClsVentas CvePresupuestoIngreso As Integer, Optional TiempoEntrega As String = "", Optional CveVentaDetallePadre As Integer = -1, Optional CveContratoDetalle As Integer = -1, Optional PorcentajeIVA As Decimal = 0, Optional IEPS As Double = -1, Optional PorcentajeIEPS As Double = 0, Optional CvePromocionDetalle As Integer = -1, Optional CveMovimientoDetallePedido As Integer = -1, Optional ImporteRetIVA As Double = 0, Optional PorcentajeRetIVA As Double = 0, - Optional ImporteRetISR As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional CuentaPredial As String = "") As Boolean + Optional ImporteRetISR As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional CuentaPredial As String = "", Optional CvePrecioLista As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasDetalleAdd") @@ -1355,6 +1355,7 @@ Public Class ClsVentas .Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle .Add("@CveMovimientoDetallePedido", SqlDbType.Int).Value = CveMovimientoDetallePedido .Add("@CuentaPredial", SqlDbType.VarChar).Value = CuentaPredial + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista End With Try diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 05806fca4..f9759cb99 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -301,6 +301,11 @@ Namespace Modelos #Region " OBJETOS Ventas" + + Public Class MPrecioSugerido + Public Property CvePrecioLista As Integer + Public Property PrecioSugerido As Decimal + End Class Public Class VentaDescuentos Public Consec As Integer diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 3b43bc738..10fd4987a 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1066,12 +1066,21 @@ - - - - - - +
+
+ +
+
+
+
+ + + + + + +
+
@@ -1207,7 +1216,16 @@ <%--9--%> - +
+
+ +
+
+
+
+ +
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6fa940342..9b2e0372c 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2734,6 +2734,9 @@ Partial Class Ventas TmpDT.Columns.Add("TieneProntoPago", GetType(String)) TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal)) TmpDT.Columns.Add("CveMarca", GetType(Integer)) + TmpDT.Columns.Add("CvePrecioLista", GetType(Integer)) + TmpDT.Columns.Add("PrecioLista", GetType(String)) + GvPS.DataSource = ObjVentas.DtResultados GvPS.DataBind() @@ -2758,6 +2761,9 @@ Partial Class Ventas TmpDT.Columns.Add("TieneProntoPago", GetType(String)) TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal)) TmpDT.Columns.Add("CveMarca", GetType(Integer)) + TmpDT.Columns.Add("CvePrecioLista", GetType(Integer)) + TmpDT.Columns.Add("PrecioLista", GetType(String)) + GvPS.DataSource = ObjVentas.DtResultados GvPS.DataBind() @@ -3125,6 +3131,11 @@ Partial Class Ventas If Not ExFolioFactura Then SetPermisos() If CveVenta < 1 Then CargaFolios() + + If CveVenta <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(360) = "1" Then + CargaListasPrecios() + End If + 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE 'If UsuarioActual.CveVendedor > 0 Then ' If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) @@ -3475,6 +3486,21 @@ Partial Class Ventas End If End Sub + + Private Sub CargaListasPrecios() + DivPrecioLista.Visible = True + + Using ObjVta As New ClsVentas + If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then + DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy() + End If + End Using + + DdlPrecioLista.DataBind() + DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1")) + + UpPS.Update() + End Sub Private Sub BloqueaClasificaciones() If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then DdlClasificacion.Enabled = False @@ -6076,12 +6102,6 @@ Partial Class Ventas End Sub Private Sub CargaFormaPago(CveMetodoPago As Integer) - 'EN LA VERSION 4.0 NO PERMITE DESBLOEQUEAR RELACION METODO Y FOMA DE PAGO - 'If UsuarioActual.Empresa.Funcionalidad(350) <> "1" Then - ' 'permiso para desbloquear la relación entre Método de pago y forma de pago - ' If UsuarioActual.TienePermisoProceso(282) Then CveMetodoPago = -1 - 'End If - Dim dtt As DataTable = Nothing If CveMetodoPago > 0 Then dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20")) @@ -6117,22 +6137,13 @@ Partial Class Ventas 'End If End Sub Private Sub CargaUsoCFDI() - If UsuarioActual.Empresa.Funcionalidad(350) <> "1" Then - RegimenFiscalCliente = "-1" - End If - DdlUsoCFDI.Items.Clear() DdlSucursalUsoCFDI.Items.Clear() - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - Dim EsPersonaMoral As Boolean = (TipoPersona = True) + Dim EsPersonaMoral As Boolean = (TipoPersona = True) - DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) - DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) - Else - DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) - DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) - End If + DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) + DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) DdlUsoCFDI.DataBind() DdlSucursalUsoCFDI.DataBind() @@ -6463,12 +6474,10 @@ Partial Class Ventas ViewState("CliPais") = ObjCliente.Pais ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString() - RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString() - TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona")) - CargaUsoCFDI() - End If + RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString() + RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString() + TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona")) + CargaUsoCFDI() 'ViewState("NumCtaPago") = ObjCliente.NumCtaPago ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS If Not ClienteDesglosaIEPS Then @@ -6527,7 +6536,7 @@ Partial Class Ventas End If DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI) 'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES - If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then + If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then 'S01 Sin efectos fiscales. DdlUsoCFDI.SelectedValueExist("23") DdlUsoCFDI.Enabled = False @@ -7061,7 +7070,7 @@ Partial Class Ventas Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) 'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO - If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then + If Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then RBLPago.SelectedValue = "2" RBLPago.Items(0).Enabled = False RBLPago_SelectedIndexChanged(Nothing, Nothing) @@ -7459,9 +7468,9 @@ Partial Class Ventas LblEstado.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString() 'TxtNumCtaPago.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString() LblTelefono.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString() - If Not UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString() - End If + 'If Not UsuarioActual.Empresa.Funcionalidad(350) = "1" Then + ' LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString() + 'End If ViewState("CliLocalidad") = ObjCliente.DtResultados.Rows(0)("Localidad").ToString() ViewState("CliPais") = ObjCliente.DtResultados.Rows(0)("Pais").ToString() ViewState("CliNoExt") = ObjCliente.DtResultados.Rows(0)("NoExt").ToString() @@ -7518,7 +7527,7 @@ Partial Class Ventas DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString()) DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString()) 'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES - If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then + If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then 'S01 Sin efectos fiscales. DdlUsoCFDI.SelectedValueExist("23") DdlUsoCFDI.Enabled = False @@ -7560,7 +7569,7 @@ Partial Class Ventas DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33) DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI) 'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES - If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then + If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then 'S01 Sin efectos fiscales. DdlUsoCFDI.SelectedValueExist("23") DdlUsoCFDI.Enabled = False @@ -8038,6 +8047,10 @@ Partial Class Ventas End If + If UsuarioActual.Empresa.Funcionalidad(360) = "1" AndAlso e.Row.DBCampo("CvePrecioLista").ToEntero() > 0 Then + e.Row.FCLiteral("LtlPrecioLista").Visible = True + End If + 'CANTIDAD FACTURADA Select Case e.Row.DBCampo("TipoDocto") Case "Cot" @@ -8748,7 +8761,7 @@ Partial Class Ventas DtOCTmpDT = TmpDT.Copy TmpDTError = TmpDT.Copy - If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Egs", "Dev") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Egs", "Dev") Then If RegimenFiscalCliente.Contiene("-1", "") Then Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -8759,6 +8772,7 @@ Partial Class Ventas Exit Sub End If End If + If ChkEmitirComercioExterior.Checked AndAlso DdlMoneda.SelectedValue.ToEntero() <> 2 Then Alert("La moneda de la factura debe ser dolares cuando aplica comercio exterior.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -8769,7 +8783,7 @@ Partial Class Ventas Exit Sub End If - If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then If LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso RegimenFiscalCliente <> "616" Then Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) @@ -9396,37 +9410,37 @@ Partial Class Ventas End If 'Verifica versión 3.3.() - If (Not UsuarioActual.Empresa.Funcionalidad(350) = "1") AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then - Dim dttsat As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '' OR ISNULL(SATClaveUM,'') = '' ") - If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then - Dim str As New StringBuilder - str.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT

") - For Each drt As DataRow In dttsat.Rows - str.AppendFormat("{0}
", drt("CodigoPS")) - Next - Alert(str.ToString(), TipoMensaje.MsgAdvertencia) - dttsat.Dispose() - str.Clear() - Exit Sub - End If - dttsat.Dispose() + 'If (Not UsuarioActual.Empresa.Funcionalidad(350) = "1") AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then + ' Dim dttsat As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '' OR ISNULL(SATClaveUM,'') = '' ") + ' If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then + ' Dim str As New StringBuilder + ' str.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT

") + ' For Each drt As DataRow In dttsat.Rows + ' str.AppendFormat("{0}
", drt("CodigoPS")) + ' Next + ' Alert(str.ToString(), TipoMensaje.MsgAdvertencia) + ' dttsat.Dispose() + ' str.Clear() + ' Exit Sub + ' End If + ' dttsat.Dispose() - If UsuarioActual.CveEmpresa = 72 Then - Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ") - If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then - Dim StrNoEncontrados As New StringBuilder - StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT

") - For Each drt As DataRow In DtNoEncontrados.Rows - StrNoEncontrados.AppendFormat("{0}
", drt("CodigoPS")) - Next - Alert(StrNoEncontrados.ToString(), TipoMensaje.MsgAdvertencia) - DtNoEncontrados.Dispose() - StrNoEncontrados.Clear() - Exit Sub - End If - DtNoEncontrados.Dispose() - End If - End If + ' If UsuarioActual.CveEmpresa = 72 Then + ' Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ") + ' If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then + ' Dim StrNoEncontrados As New StringBuilder + ' StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT

") + ' For Each drt As DataRow In DtNoEncontrados.Rows + ' StrNoEncontrados.AppendFormat("{0}
", drt("CodigoPS")) + ' Next + ' Alert(StrNoEncontrados.ToString(), TipoMensaje.MsgAdvertencia) + ' DtNoEncontrados.Dispose() + ' StrNoEncontrados.Clear() + ' Exit Sub + ' End If + ' DtNoEncontrados.Dispose() + ' End If + 'End If 'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then @@ -10643,23 +10657,14 @@ Partial Class Ventas ObjFacturaDevolucion.Fecha = Now + ObjFacturaDevolucion.Version = "4.0" - - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ObjFacturaDevolucion.Version = "4.0" - - If ObjFacturaDevolucion.Cliente Is Nothing Then - ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel - End If - - ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal - ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal - Else - ObjFacturaDevolucion.Version = "3.3" + If ObjFacturaDevolucion.Cliente Is Nothing Then + ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel End If - - + ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal + ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal ObjFacturaDevolucion.CveMetodoPago33 = 1 ObjFacturaDevolucion.MetodoPago33 = "Pago en una sola exhibición" @@ -10942,20 +10947,15 @@ Partial Class Ventas End If ObjFacturaBonificacion.Fecha = Now + ObjFacturaBonificacion.Version = "4.0" - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ObjFacturaBonificacion.Version = "4.0" - - If ObjFacturaBonificacion.Cliente Is Nothing Then - ObjFacturaBonificacion.Cliente = New Modelos.ClienteModel - End If - - ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal - ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal - Else - ObjFacturaBonificacion.Version = "3.3" + If ObjFacturaBonificacion.Cliente Is Nothing Then + ObjFacturaBonificacion.Cliente = New Modelos.ClienteModel End If + ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal + ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal + ObjFacturaBonificacion.CveMetodoPago33 = 1 ObjFacturaBonificacion.MetodoPago33 = "Pago en una sola exhibición" ObjFacturaBonificacion.ClaveMetodoPagoSAT = "PUE" @@ -11368,18 +11368,14 @@ Partial Class Ventas ObjFactura = New Modelos.Factura End If - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ObjFactura.Version = "4.0" - If ObjFactura.Cliente Is Nothing Then - ObjFactura.Cliente = New Modelos.ClienteModel - End If - - ObjFactura.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal - ObjFactura.Cliente.RegimenFiscal = ClienteRegimenFiscal - Else - ObjFactura.Version = "3.3" + ObjFactura.Version = "4.0" + If ObjFactura.Cliente Is Nothing Then + ObjFactura.Cliente = New Modelos.ClienteModel End If + ObjFactura.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal + ObjFactura.Cliente.RegimenFiscal = ClienteRegimenFiscal + ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa ObjFactura.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal) @@ -12154,19 +12150,15 @@ Partial Class Ventas ObjFacturaDevolucion.SerieFolioPadre = HdnFolioFiscalNC.Value.ToString() - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ObjFacturaDevolucion.Version = "4.0" + ObjFacturaDevolucion.Version = "4.0" - If ObjFacturaDevolucion.Cliente Is Nothing Then - ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel - End If - - ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal - ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal - Else - ObjFacturaDevolucion.Version = "3.3" + If ObjFacturaDevolucion.Cliente Is Nothing Then + ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel End If + ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal + ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal + ObjFacturaDevolucion.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero() ObjFacturaDevolucion.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "") ObjFacturaDevolucion.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") @@ -12412,7 +12404,7 @@ Partial Class Ventas Dim Timbre As New CFDITimbre - Timbre.Comprobante.Version = If(UsuarioActual.Empresa.Funcionalidad(350) = "1", "4.0", "3.3") + Timbre.Comprobante.Version = "4.0" Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) Timbre.Comprobante.Folio = Obj.Folio.ToString() @@ -12441,11 +12433,7 @@ Partial Class Ventas Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP Else Timbre.Receptor.RFC = Obj.Cliente.RFC - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - Timbre.Receptor.Nombre = Obj.Cliente.Nombre - Else - Timbre.Receptor.Nombre = Obj.Cliente.Nombre + " " + Obj.Cliente.RegimenSociedad - End If + Timbre.Receptor.Nombre = Obj.Cliente.Nombre Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP End If @@ -13346,11 +13334,9 @@ Partial Class Ventas For Each Row As DataRow In TmpDTDetalle.Rows If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(), Row("PU").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6), - Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), - TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), - IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), - ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, - PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString()) Then + Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), + CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, + PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero()) 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 @@ -17615,7 +17601,13 @@ Partial Class Ventas Dim PrecioSugerido As Decimal = 0 Dim tPrecioSugerido As Decimal = 0 tPrecioSugerido = drPS("Precio").ToString().ToDecimal - PrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero()) + Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero()) + + PrecioSugerido = ObjPrecioSugerido.PrecioSugerido + + If ObjPrecioSugerido.CvePrecioLista > 0 AndAlso DivPrecioLista.Visible Then + DdlPrecioLista.SelectedValueExist(ObjPrecioSugerido.CvePrecioLista) + End If If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido @@ -17655,7 +17647,9 @@ Partial Class Ventas End Sub - Private Function CalculaPrecioSugerido(CvePSParametro As Integer, CveClasificacion As Integer) As Decimal + Private Function CalculaPrecioSugerido(CvePSParametro As Integer, CveClasificacion As Integer, Optional CvePrecioListaSugerido As Integer = -1) As Modelos.MPrecioSugerido + Dim Retorno As New Modelos.MPrecioSugerido + Dim PrecioSugerido As Decimal = 0 If UsuarioActual.CveEmpresa.Contiene(1) Then @@ -17698,6 +17692,10 @@ Partial Class Ventas End If + If DivPrecioLista.Visible AndAlso CvePrecioListaSugerido > 0 Then + CvePrecioListaPS = CvePrecioListaSugerido + End If + If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then @@ -17717,7 +17715,8 @@ Partial Class Ventas PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS End If End If - CvePrecioLista = CvePrecioListaPS + Me.CvePrecioLista = CvePrecioListaPS + Retorno.CvePrecioLista = CvePrecioListaPS End If @@ -17729,7 +17728,10 @@ Partial Class Ventas PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1) End If End If - Return PrecioSugerido + + Retorno.PrecioSugerido = PrecioSugerido + + Return Retorno End Function Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS) @@ -18816,11 +18818,29 @@ Partial Class Ventas PU = ObjDescuento.PU End If + Dim CvePrecioListaPS As Integer = -1 + Dim PrecioListaPS As String = "" + + 'VALIDA LA ASIGNACION DE LISTA DE PRECIOS + If DivPrecioLista.Visible Then + If DdlPrecioLista.SelectedValue.ToEntero() > 0 AndAlso DdlPrecioLista.SelectedValue.ToEntero() = Me.CvePrecioLista Then + CvePrecioListaPS = Me.CvePrecioLista + PrecioListaPS = DdlPrecioLista.SelectedItem.Text + Else + Alert("La lista de precios del producto no coincide con la seleccionada", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Else + If Me.CvePrecioLista > 0 Then + CvePrecioListaPS = Me.CvePrecioLista + End If + End If + AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text, CvePS, "", TxtObsPS.Text.TrimEnd, PU, ObjDescuento.ImporteDescuento, 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:=ObjDescuento.CvePromocionDetalle, - ImporteProntoPago:=ObjDescuento.ImporteProntoPago, ObjDescuento:=ObjDescuento) + ImporteProntoPago:=ObjDescuento.ImporteProntoPago, ObjDescuento:=ObjDescuento, CvePrecioLista:=CvePrecioListaPS, PrecioLista:=PrecioListaPS) CalculaUsados() @@ -19011,7 +19031,7 @@ Partial Class Ventas Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False, - Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing) As Boolean + Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing, Optional CvePrecioLista As Integer = -1, Optional PrecioLista As String = "") As Boolean Dim Retorno As Boolean = False Try @@ -19267,6 +19287,9 @@ Partial Class Ventas End If + Row("CvePrecioLista") = CvePrecioLista + Row("PrecioLista") = PrecioLista + If UsuarioActual.CveEmpresa.Contiene(119, 13, 83) Then If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA @@ -19501,6 +19524,9 @@ Partial Class Ventas TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String)) TmpDT.Columns.Add("CveMarca", GetType(Integer)) + TmpDT.Columns.Add("CvePrecioLista", GetType(Integer)) + TmpDT.Columns.Add("PrecioLista", GetType(String)) + TmpDT.Columns("EsOutSourcing").DefaultValue = False TmpDT.Columns("EsCargo").DefaultValue = False @@ -22227,7 +22253,7 @@ Partial Class Ventas Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6), Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString()}").ToEntero(), -1), - ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString()) Then + ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero()) Then OcurrioError = True Exit For Else @@ -23410,7 +23436,7 @@ Partial Class Ventas RFVCiudadC.Visible = False RFVLocalidadC.Visible = False RFVSATPais.Visible = False - divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1" + divRegimenCliente.Visible = True RdTipoPersona.SelectedValue = "0" @@ -23440,7 +23466,7 @@ Partial Class Ventas DivCorreoCuentaCliente.Visible = True DivBotonesAgregarCliente.Visible = True DivFormaCliente.Visible = True - divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1" + divRegimenCliente.Visible = True End If End If ObjCliente.Dispose() @@ -23473,17 +23499,13 @@ Partial Class Ventas Else Dim RegimenFiscalCliente As String = "-1" - If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then + If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {DdlRegimenFiscalCliente.SelectedValue.ToEntero()}") End If DdlUsoCFDICliente.Items.Clear() - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") - DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) - Else - DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) - End If + Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") + DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) DdlUsoCFDICliente.DataBind() DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -23505,44 +23527,41 @@ Partial Class Ventas Dim CveRegimenFiscal As Integer = -1 Dim CveUsoCFDI As Integer = 3 - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero() - CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero() + CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero() + CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero() - Dim RegimenFiscalCliente As String = "-1" + Dim RegimenFiscalCliente As String = "-1" - If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then - RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {CveRegimenFiscal}") - End If + If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then + RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {CveRegimenFiscal}") + End If - If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue <> "11" Then - Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue <> "11" Then + Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If - If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue <> "23" Then - Alert("El uso cfdi del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue <> "23" Then + Alert("El uso cfdi del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If - If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then - Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then + Alert("El Regimen fiscal del cliente no puede ser '616 - Sin obligaciones fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If - If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then - Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then + Alert("El uso cfdi del cliente no puede ser 'S01 - Sin efectos fiscales' si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If - Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") - Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}") - - If DtUsosCFDI.Rows.Count = 0 Then - Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If + Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") + Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}") + If DtUsosCFDI.Rows.Count = 0 Then + Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia) + Exit Sub End If If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then @@ -25604,7 +25623,8 @@ Partial Class Ventas If CvePS > 0 Then If PrecioUnitario <= 0 Then - PrecioUnitario = CalculaPrecioSugerido(CvePS, CveClasificacion) + Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion) + PrecioUnitario = ObjPrecioSugerido.PrecioSugerido End If AgregarProductoServicio(Cantidad, CveUM, UM, -1, "", @@ -32988,6 +33008,10 @@ Partial Class Ventas 'REMOVER EVENTO PARA RECARGAR ALMACEN 'spanAlmacen.Attributes.Remove("onclick") + If UsuarioActual.Empresa.Funcionalidad(360) = "1" Then + CargaListasPrecios() + End If + HdnCargarInventario.Value = "False" UpParametros.Update() @@ -34870,19 +34894,15 @@ Partial Class Ventas ObjFacturaProntoPago.Fecha = Now - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - ObjFacturaProntoPago.Version = "4.0" + ObjFacturaProntoPago.Version = "4.0" - If ObjFacturaProntoPago.Cliente Is Nothing Then - ObjFacturaProntoPago.Cliente = New Modelos.ClienteModel - End If - - ObjFacturaProntoPago.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal - ObjFacturaProntoPago.Cliente.RegimenFiscal = ClienteRegimenFiscal - Else - ObjFacturaProntoPago.Version = "3.3" + If ObjFacturaProntoPago.Cliente Is Nothing Then + ObjFacturaProntoPago.Cliente = New Modelos.ClienteModel End If + ObjFacturaProntoPago.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal + ObjFacturaProntoPago.Cliente.RegimenFiscal = ClienteRegimenFiscal + ObjFacturaProntoPago.CveMetodoPago33 = 1 ObjFacturaProntoPago.MetodoPago33 = "Pago en una sola exhibición" ObjFacturaProntoPago.ClaveMetodoPagoSAT = "PUE" @@ -35286,7 +35306,8 @@ Partial Class Ventas TmpDT.Columns.Add("CveTamaño", GetType(Integer)) TmpDT.Columns.Add("EsCargo", GetType(Boolean)) TmpDT.Columns.Add("CveMarca", GetType(Integer)) - + TmpDT.Columns.Add("CvePrecioLista", GetType(Integer)) + TmpDT.Columns.Add("PrecioLista", GetType(String)) Return TmpDT End Function Private Function InicializaDTVentasNCProntoPago() As DataTable @@ -35585,40 +35606,36 @@ Partial Class Ventas DVRegimenSociedad.Visible = False DivRazonSocial2.Attributes.Add("class", "col-md-12") - If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then + DivRazonSocial2.Attributes.Add("class", "col-md-8") + DVRegimenSociedad.Visible = True - DivRazonSocial2.Attributes.Add("class", "col-md-8") - DVRegimenSociedad.Visible = True + If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then + DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11") + DdlRegimenFiscalCliente.DataBind() + Else + Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal") + Dim Val As String = "" - If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then - DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11") - DdlRegimenFiscalCliente.DataBind() - Else - Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal") - Dim Val As String = "" - - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - 'verifico que sino existe el valor. lo limpie - Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscalCliente.SelectedValue) - If Val = "" Then 'sino encuentra valor, lo limpia - DdlRegimenFiscalCliente.Items.Clear() - DdlRegimenFiscalCliente.SelectedValue = Nothing - End If + If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then + 'verifico que sino existe el valor. lo limpie + Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscalCliente.SelectedValue) + If Val = "" Then 'sino encuentra valor, lo limpia + DdlRegimenFiscalCliente.Items.Clear() + DdlRegimenFiscalCliente.SelectedValue = Nothing End If - - DdlRegimenFiscalCliente.DataSource = dt - DdlRegimenFiscalCliente.DataBind() - DdlRegimenFiscalCliente.SelectedValueExist(Val) - End If - DdlRegimenFiscalCliente.Items.Insert(0, New ListItem("Seleccione", "-1")) - - DdlUsoCFDICliente.Items.Clear() - DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlRegimenFiscalCliente.DataSource = dt + DdlRegimenFiscalCliente.DataBind() + DdlRegimenFiscalCliente.SelectedValueExist(Val) End If + DdlRegimenFiscalCliente.Items.Insert(0, New ListItem("Seleccione", "-1")) + + DdlUsoCFDICliente.Items.Clear() + DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1")) + UpAgregarCliente.Update() End Sub @@ -36398,7 +36415,7 @@ Partial Class Ventas PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS End If End If - CvePrecioLista = CvePrecioListaPS + Me.CvePrecioLista = CvePrecioListaPS End If @@ -36740,5 +36757,20 @@ Partial Class Ventas End If End Sub + + Protected Sub DdlPrecioLista_SelectedIndexChanged(sender As Object, e As EventArgs) + If DivPrecioLista.Visible AndAlso DdlPrecioLista.SelectedValue.ToEntero() > 0 Then + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero()).FiltroPrimero("") + + Dim ObjPrecioSugerido = CalculaPrecioSugerido(drPS("CvePS").ToString().ToEntero(), drPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioLista.SelectedValue.ToEntero()) + + If ObjPrecioSugerido.PrecioSugerido > 0 Then + TxtPrecio.Text = ObjPrecioSugerido.PrecioSugerido.ToString("#,###.####") + Else + Alert("No se encontro un precio para este producto en la lista de precios seleccionada") + End If + + End If + End Sub End Class