diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 1445de74b..38d16dc57 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1488,7 +1488,7 @@ Public Class ClsBancos Optional CveCuentaDeposito As Integer = -1, Optional PagoElectronico As String = "-1", Optional CveEstatusIE As Integer = 1, Optional CveCuentaTarjeta As Integer = -1, Optional Referencia As String = "-1", Optional CveCorte As Integer = -1, Optional CveProveedorIntermediario As Integer = -1, Optional FueConciliado As Boolean = False, Optional MesesSinIntereses As Integer = -1, Optional Modulo As String = "", Optional ConceptoCIE As String = "", Optional CveOCAnticipo As Integer = -1, Optional ImporteDeduccionesPago As Decimal = -1, - Optional AnticipoPuntual As Boolean = False, Optional FechaEmision As Date = MinFecha, Optional CveAutorizacion As String = "") As Integer + Optional AnticipoPuntual As Boolean = False, Optional FechaEmision As Date = MinFecha, Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Banc_IEAdd") @@ -1532,6 +1532,7 @@ Public Class ClsBancos .Add("@AnticipoPuntual", SqlDbType.Bit).Value = AnticipoPuntual .Add("@FechaEmision", SqlDbType.Date).Value = FechaEmision .Add("@CveAutorizacion", SqlDbType.VarChar).Value = CveAutorizacion + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With Try diff --git a/Sistemas/CatContrasenia.aspx.vb b/Sistemas/CatContrasenia.aspx.vb index de2680b37..ee406238c 100644 --- a/Sistemas/CatContrasenia.aspx.vb +++ b/Sistemas/CatContrasenia.aspx.vb @@ -13,6 +13,10 @@ Partial Class CatContrasenia End Sub Public Sub GuardaDatos() + If TxtContrasenia1.Text.Length < 7 Then + Alert("La contraseña debe ser de al menos 8 caracteres.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If Dim Usuario As New ClsSisUsuarios Usuario.IniciaTransacSQL() @@ -41,9 +45,9 @@ Partial Class CatContrasenia Usuario.Dispose() - End Sub - - + End Sub + + Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click GuardaDatos() diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 8cbfdf484..c5d7eb897 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -111,7 +111,13 @@ Partial Class Ventas_PVCobranza 'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon)) DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon)) - DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon)) + + If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(195, 197) Then + DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(CveMon <= 0, 1, CveMon))) + Else + DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(CveMon <= 0, 1, CveMon))) + End If + 'DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon)) DtCC.Dispose() @@ -387,16 +393,8 @@ Partial Class Ventas_PVCobranza End If If LtlSaldo.Text.ToDecimal() > Pagado Then - If UsuarioActual.CveEmpresa = 189 Then - If (LtlSaldo.Text.ToDecimal() - Pagado) > 6 Then - Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - Else - Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - + Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia) + Exit Sub End If Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal @@ -486,13 +484,13 @@ Partial Class Ventas_PVCobranza If CvePrePoliza > 0 Then If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then - MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte) + MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) SaldoPendiente -= TxtImporteCredito.Text.ToDecimal PagoAplicado += TxtImporteCredito.Text.ToDecimal End If If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then - MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte) + MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) SaldoPendiente -= TxtImporteDebito.Text.ToDecimal PagoAplicado += TxtImporteDebito.Text.ToDecimal End If @@ -503,13 +501,13 @@ Partial Class Ventas_PVCobranza Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}" End If - MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim()) + MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto) SaldoPendiente -= TxtImporteCheque.Text.ToDecimal PagoAplicado += TxtImporteCheque.Text.ToDecimal End If If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then - MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte) + MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) SaldoPendiente -= TxtImporteTransferencia.Text.ToDecimal PagoAplicado += TxtImporteTransferencia.Text.ToDecimal End If @@ -522,18 +520,12 @@ Partial Class Ventas_PVCobranza TxtCambio.Text = (PagoAplicado - SaldoTotalInicial).FormatoNumero PagoEfectivo = SaldoPendiente End If - MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte) + MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto) SaldoPendiente -= PagoEfectivo End If If SaldoPendiente > 0 Then - If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then - If SaldoPendiente > 6 Then - MsgError = "Tiene saldo pendiente por aplicar" - End If - Else - MsgError = "Tiene saldo pendiente por aplicar" - End If + MsgError = "Tiene saldo pendiente por aplicar" End If If MsgError = "" AndAlso Not ObjVentas2.UpdateVentaCorte(CveVenta, UsuarioActual.CveEmpresa, tCveCorte) Then @@ -745,14 +737,14 @@ Partial Class Ventas_PVCobranza Return Retorno End Function - Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "") As String + Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String Dim Retorno As String = "" Dim CveIEPago As Integer = 0 Dim ErrorConta As Boolean If String.IsNullOrEmpty(Obs) Then Obs = VentaActual.SerieFolio End If - CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImportePago, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion) + CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImportePago, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto) If CveIEPago > 0 Then Dim Pago As New VentaPago Pago.ImportePagoVenta = ImportePago diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 10579e4c9..36d7c9404 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3734,27 +3734,32 @@ Partial Class Ventas Private Sub CargaListasPreciosSubProyectos(CvePS As Integer) If UsuarioActual.CveEmpresa = 189 Then - DivPrecioLista.Visible = True + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") Then + DivPrecioLista.Visible = True - Using ObjVta As New ClsVentas - If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), CvePS, UsuarioActual.CveEmpresa) Then - Dim Dt As DataTable = Nothing + Using ObjVta As New ClsVentas + If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), CvePS, UsuarioActual.CveEmpresa) Then + Dim Dt As DataTable = Nothing + + If UsuarioActual.TienePermisoProceso(384) Then + Dt = ObjVta.DtResultados.Copy() + Else + Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'") + End If + + DdlPrecioLista.DataSource = Dt + If Dt IsNot Nothing Then + DdlPrecioLista.SelectedValueExist(Dt.FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'")) + End If - If UsuarioActual.TienePermisoProceso(384) Then - Dt = ObjVta.DtResultados.Copy() - Else - Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'") End If + End Using - DdlPrecioLista.DataSource = Dt - If Dt IsNot Nothing Then - DdlPrecioLista.SelectedValueExist(Dt.FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'")) - End If + DdlPrecioLista.DataBind() + Else + DivPrecioLista.Visible = False + End If - End If - End Using - - DdlPrecioLista.DataBind() UpPS.Update() End If End Sub @@ -15758,7 +15763,7 @@ Partial Class Ventas ' DrPago("Importe") = DrPago("Importe").ToString().ToDecimal - TxtCambio.Text.ToDecimal 'End If - CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero(), Fecha, FolioIE.ToString(), String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString().ToDouble, DdlMoneda.SelectedValue.ToEntero(), tipoCambio, DrPago("Observaciones").ToString(), "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString().ToEntero(), Modulo:="Ventas/Guardar") + CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero(), Fecha, FolioIE.ToString(), String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString().ToDouble, DdlMoneda.SelectedValue.ToEntero(), tipoCambio, DrPago("Observaciones").ToString(), "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString().ToEntero(), Modulo:="Ventas/Guardar", CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero()) If CveIEPago > 0 Then importeMovimiento = DrPago("Importe").ToString().ToDecimal * ValorMultiplicador @@ -17945,19 +17950,28 @@ Partial Class Ventas DdlPrecioLista.SelectedValueExist(ObjPrecioSugerido.CvePrecioLista) If UsuarioActual.CveEmpresa = 189 Then - If DirectCast(DdlPrecioLista.DataSource, DataTable) IsNot Nothing Then - Dim dt = DirectCast(DdlPrecioLista.DataSource, DataTable) - If dt IsNot Nothing Then - If dt.Rows.Count > 0 Then - 'CHECA SI EL PRECIO SUGERIDO ESTA EN LA LISTA DE PRECIOS PERMITIDAS - If dt.FiltroPrimeroValor("CvePrecioLista", $"CvePrecioLista = {ObjPrecioSugerido.CvePrecioLista}").ToEntero() <= 0 Then - If ObjPrecioSugerido.CvePrecioLista = Me.CvePrecioListaCliente Then - Alert("La lista de precios del cliente no esta permitido en la sucursal actual", TipoMensaje.MsgAdvertencia) + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") Then + If DirectCast(DdlPrecioLista.DataSource, DataTable) IsNot Nothing Then + Dim dt = DirectCast(DdlPrecioLista.DataSource, DataTable) + If dt IsNot Nothing Then + If dt.Rows.Count > 0 Then + 'CHECA SI EL PRECIO SUGERIDO ESTA EN LA LISTA DE PRECIOS PERMITIDAS + If dt.FiltroPrimeroValor("CvePrecioLista", $"CvePrecioLista = {ObjPrecioSugerido.CvePrecioLista}").ToEntero() <= 0 Then + If ObjPrecioSugerido.CvePrecioLista = Me.CvePrecioListaCliente Then + Alert("La lista de precios del cliente no esta permitido en la sucursal actual", TipoMensaje.MsgAdvertencia) + End If + ObjPrecioSugerido.CvePrecioLista = -1 + ObjPrecioSugerido.PrecioSugerido = 0 + tPrecioSugerido = 0 + PrecioSugerido = 0 End If + Else ObjPrecioSugerido.CvePrecioLista = -1 ObjPrecioSugerido.PrecioSugerido = 0 tPrecioSugerido = 0 PrecioSugerido = 0 + + Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) End If Else ObjPrecioSugerido.CvePrecioLista = -1 @@ -17965,22 +17979,29 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) + Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) End If - Else - ObjPrecioSugerido.CvePrecioLista = -1 - ObjPrecioSugerido.PrecioSugerido = 0 - tPrecioSugerido = 0 - PrecioSugerido = 0 - Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) End If - End If + End If End If + If UsuarioActual.CveEmpresa = 189 Then + If DdlTipoComprobante.SelectedValue.Contiene("Ant") Then + + DdlPrecioLista.SelectedValueExistInsert("-1", "Sin lista") + Me.CvePrecioLista = -1 + + ObjPrecioSugerido.CvePrecioLista = -1 + ObjPrecioSugerido.PrecioSugerido = 0 + tPrecioSugerido = 0 + PrecioSugerido = 0 + End If + End If + If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere @@ -17996,6 +18017,7 @@ Partial Class Ventas HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString() HdnIVARetAPS.Value = drPS("RetIVA").ToString() HdnCodigo.Value = drPS("Codigo").ToString() + If DdlClasificacion.SelectedIndex = 0 Then If drPS("CveClasificacion").ToString() IsNot Nothing Then DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString()) @@ -18028,7 +18050,7 @@ Partial Class Ventas End If - If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ant") Then AgregarPS() End If @@ -18490,6 +18512,18 @@ Partial Class Ventas TrTipoContable.Visible = True End If + CargaListasPreciosSubProyectos(If(DdlPS.SelectedValue.ToEntero() <= 0, -1, DdlPS.SelectedValue.ToEntero())) + + If UsuarioActual.CveEmpresa = 189 Then + Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:="84111506").FiltroPrimero("") + If DatarowPS IsNot Nothing Then + DdlPS.SelectedValue = DatarowPS("CvePS").ToString() + DdlPS.SelectedText = DatarowPS("CodigoPS").ToString() + + DdlPS_SelectedIndexChanged(Nothing, Nothing) + End If + End If + Updatetabs.Update() UPCondicionesPago.Update() UpCliente.Update()