diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 93fb38a06..46f49aa46 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4433,13 +4433,14 @@ Public Class ClsVentas Return retorno End Function - Public Function GetRepTopClientesVentas(CveEmpresa As Integer, Mes As Integer, Año As Integer, Optional CveSubProyecto As Integer = -1) As Boolean + Public Function GetRepTopClientesVentas(CveEmpresa As Integer, Mes As Integer, Año As Integer, Optional Top As Integer = 20, Optional CveSubProyecto As Integer = -1) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_Top20ClientesMasVendidos", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Mes", SqlDbType.Int).Value = Mes .Add("@Año", SqlDbType.Int).Value = Año + .Add("@Top", SqlDbType.Int).Value = Top .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With Try diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index ba138a872..8d4ebb2f7 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3997,9 +3997,24 @@ Namespace Modelos Dim CancelarRemisiones As Boolean = ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Dim TieneAlmacen As Boolean = False + Dim AplicaRefacturacionConPagos As Boolean = False + + '1 NORMAL, 2 CON PAGOS + Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero() + + If ModalidadRefacturacion <= 0 Then + Retorno.Mensaje = "La factura no se puede refacturar debido a que la empresa no tiene asignada una modalidad de refacturación." + Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia + + Return Retorno + End If + + If EsRefacturacion AndAlso ModalidadRefacturacion = 2 Then + AplicaRefacturacionConPagos = True + End If 'VALIDA QUE LA FACTURA NO TENGA PAGOS - If Not EsRefacturacion AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then + If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia @@ -4023,7 +4038,7 @@ Namespace Modelos End If 'LA VALIDACION DE SALDOS CUANDO ES REFACTURACION SE HACE ANTES ASI QUE SI ES REFACTURACION IGNORAMOS ESTA CONDICION, SI ES ANTICIPO VERIFICA QUE NO ESTÉ APLICADO - If Not EsRefacturacion AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then + If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia @@ -4283,7 +4298,7 @@ Namespace Modelos End If 'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO - If Not EsRefacturacion AndAlso ((((ObjFactura.Saldo > 0 AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20)) OrElse (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing"))) AndAlso CveEstatus.Contiene(4, 5)) OrElse (CvePlantillaPoliza = 7 AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20))) Then + If Not AplicaRefacturacionConPagos AndAlso ((((ObjFactura.Saldo > 0 AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20)) OrElse (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing"))) AndAlso CveEstatus.Contiene(4, 5)) OrElse (CvePlantillaPoliza = 7 AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20))) Then 'CUANDO SE CANCELA, LA PÓLIZA DEBE DE SER DE DIARIO CvePrePoliza = ObjConta.AddPrePolizas("Modelos/CancelarDocumento", CvePlantillaPoliza, ObjFactura.Total, ObjFactura.Total, ObjFactura.CveMoneda, Now, ObjFactura.Cliente.Nombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) @@ -4294,16 +4309,8 @@ Namespace Modelos MensajeError = "Ocurrió un error al generar la prepoliza de cancelación." End If - ''CANCELAR PAGOS - 'If EsRefacturacion AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant") AndAlso ObjFactura.Pagado > 0 Then - ' If Not ObjVentas.CancelarPagos(ObjFactura.CveVenta, CvePrePoliza) Then - ' ErrorCancelar = True - ' MensajeError = "Ocurrió un error al generar la cancelación de pagos." - ' End If - 'End If - 'CANCELAR PAGOS - If Not EsRefacturacion AndAlso ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then + If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then If Not ErrorCancelar Then If Not ObjConta.PrePolizasCancelarPagos(ObjFactura.CveDevolucion, CvePrePoliza) Then ErrorCancelar = True @@ -4312,7 +4319,6 @@ Namespace Modelos End If End If - 'CANCELA PREPOLIZA If Not ErrorCancelar Then ErrorCancelar = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, -1, ObjBancos, ObjVentas, ObjEventos, DtRemisionesRelacionadas:=DtRemisionesRelacionadas, SeCancelaRemisionProceso:=SeCancelaRemisionProceso, diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 4fe2b853f..ab137548c 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -99,7 +99,7 @@ Namespace Extensiones ' strLineaTMP = Chr(13) & Chr(10) & Day(Now) & "/" & Month(Now) & "/" & Year(Now) & " " & Hour(Now) & ":" & Minuto & ". " & Str & Chr(13) & Chr(10) strLineaTMP = String.Format("{0}{1}Log: {5}{2}{3}:{4}", Chr(13), Chr(10), Str, DateTime.Now.ToShortDateString, DateTime.Now.ToShortTimeString, Urlstring) Try - ArchivoW = New StreamWriter(String.Format("{0}\Log.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) + ArchivoW = New StreamWriter(String.Format("{0}\Log\Log.txt", AppDomain.CurrentDomain.BaseDirectory), True, System.Text.Encoding.UTF8) Catch ex As UnauthorizedAccessException 'Alert("No hay permisos para guardar en el Log.", Extensiones.TipoMensaje.MsgError) Exit Sub diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index a971cf96e..7ed2ecc68 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -565,17 +565,51 @@ Partial Class Bancos_ProveedoresAbonar If e.Row.DBCampo("CveCompra").ToEntero > 0 Then Dim FiltroInv As String = "" - If UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0 Then - Dim PorcentajeSaldo = e.Row.DBCampo("ImporteAlmacenPorcentaje").ToString.ToDouble + e.Row.DBCampo("ImporteServiciosPorcentaje").ToString.ToDouble + e.Row.DBCampo("ImporteDevolucionPorcentaje").ToString.ToDouble - Dim SaldoInv = (e.Row.DBCampo("Saldo").ToString.ToDouble * (PorcentajeSaldo / 100)) + + If UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0 Then ' valores 1 - permite pago proporcional, valor 2. paga solo si se recibio el 100% + 'se bloquean las opciones + e.Row.FCCheckBox("Chk").Enabled = False + e.Row.FCTextBox("TxtAbonar").Enabled = False + + Dim Str As New StringBuilder + Str.AppendFormat("Importe Almacen: ${0} ({1}%)
", e.Row.DBCampo("ImporteAlmacen").FormatoNumero, e.Row.DBCampo("ImporteAlmacenPorcentaje")) + If e.Row.DBCampo("ImporteServicios").ToDouble > 0 Then Str.AppendFormat("Importe Servicios: ${0} ({1}%)
", e.Row.DBCampo("ImporteServicios").FormatoNumero, e.Row.DBCampo("ImporteServiciosPorcentaje")) + If e.Row.DBCampo("ImporteDevolucion").ToDouble > 0 Then Str.AppendFormat("Importe Devuelto: ${0} ({1}%)
", e.Row.DBCampo("ImporteDevolucion").FormatoNumero, e.Row.DBCampo("ImporteDevolucionPorcentaje")) + Str.AppendFormat(" Importes SIN IVA") + e.Row.FCLabel("LbEstatusInv").Attributes.Add("title", Str.ToString) + + Dim PorcentajeAlmacen As Decimal = e.Row.DBCampo("ImporteAlmacenPorcentaje").ToString.ToDecimal + e.Row.DBCampo("ImporteServiciosPorcentaje").ToString.ToDecimal + e.Row.DBCampo("ImporteDevolucionPorcentaje").ToString.ToDecimal + Dim SaldoInv As Decimal = (e.Row.DBCampo("Saldo").ToString.ToDecimal * (PorcentajeAlmacen / 100)) If UsuarioActual.Empresa.Funcionalidad(134) = "1" Then 'cuando es proporcional FiltroInv = $"FnCambia({e.Row.FCCheckBox("Chk").ClientID},this,{SaldoInv},1,'{"El importe no debe exceder lo recibido en almacén"}',1);" ElseIf UsuarioActual.Empresa.Funcionalidad(134) = "2" Then FiltroInv = "" 'queno considera lo proporcional End If + + If PorcentajeAlmacen = 0 Then ' sin recibir + e.Row.FCLabel("LbEstatusInv").Text = "" + e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red + + ElseIf PorcentajeAlmacen > 99.0 OrElse e.Row.DBCampo("ImporteAlmacen").ToDecimal >= e.Row.DBCampo("Saldo").ToString.ToDecimal Then 'recibido completo ' si tiene un porcentaje mayor ingresado, que este halla sido por OC, debe de permitirlo + ' NOTA. si la factura tiene devoluciones, debera comparar el saldo de la factura con lo recibido en el almacen + e.Row.FCLabel("LbEstatusInv").Text = "" + e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Green + e.Row.FCCheckBox("Chk").Enabled = True + e.Row.FCTextBox("TxtAbonar").Enabled = True + Else ' parcial + + e.Row.FCLabel("LbEstatusInv").Text = "" + e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.DarkOrange + If UsuarioActual.Empresa.Funcionalidad(134).ToEntero = 1 Then ' si es la opcion ,de pagar lo proporcional + e.Row.FCCheckBox("Chk").Enabled = True + e.Row.FCTextBox("TxtAbonar").Enabled = True + End If + End If + End If + e.Row.FCLiteral("LtlAux").Text = String.Format("Ir", e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveCompra")) e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',1);{3}", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", FiltroInv)) @@ -605,61 +639,18 @@ Partial Class Bancos_ProveedoresAbonar End If - If UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 Or UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0 Then - Dim Str As New StringBuilder - Str.AppendFormat("Importe Almacen: ${0} ({1}%)
", e.Row.DBCampo("ImporteAlmacen").FormatoNumero, e.Row.DBCampo("ImporteAlmacenPorcentaje")) - If e.Row.DBCampo("ImporteServicios").ToDouble > 0 Then Str.AppendFormat("Importe Servicios: ${0} ({1}%)
", e.Row.DBCampo("ImporteServicios").FormatoNumero, e.Row.DBCampo("ImporteServiciosPorcentaje")) - If e.Row.DBCampo("ImporteDevolucion").ToDouble > 0 Then Str.AppendFormat("Importe Devuelto: ${0} ({1}%)
", e.Row.DBCampo("ImporteDevolucion").FormatoNumero, e.Row.DBCampo("ImporteDevolucionPorcentaje")) - Str.AppendFormat(" Importes SIN IVA") - e.Row.FCLabel("LbEstatusInv").Attributes.Add("title", Str.ToString) - Select Case e.Row.DBCampo("EstatusInventario").ToEntero - Case 1 - e.Row.FCLabel("LbEstatusInv").Text = "" - e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red - If UsuarioActual.Empresa.Funcionalidad(134).ToEntero.Contiene(1, 2) Then ' si se recibió mercancía se paga lo proporcional - If UsuarioActual.CveEmpresa = 72 Then - If e.Row.DBCampo("Fecha").ToDate > "12/02/2017".ToDate Then - e.Row.FCCheckBox("Chk").Enabled = False - e.Row.FCTextBox("TxtAbonar").Enabled = False - End If - Else - e.Row.FCCheckBox("Chk").Enabled = False - e.Row.FCTextBox("TxtAbonar").Enabled = False - End If - End If - Case 2 - e.Row.FCLabel("LbEstatusInv").Text = "" - e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.DarkOrange - 'condición que bloquea que se pueda pagar sin aun es parcial la recepción, - If UsuarioActual.Empresa.Funcionalidad(134).ToEntero = 2 Then - - e.Row.FCCheckBox("Chk").Enabled = False - e.Row.FCTextBox("TxtAbonar").Enabled = False - - ' si tiene un porcentaje mayor ingresado, que este halla sido por OC, debe de permitirlo - If e.Row.DBCampo("ImporteAlmacenPorcentaje").ToDecimal >= 99.0 Then 'si ya se recibió el 100% - e.Row.FCCheckBox("Chk").Enabled = True - e.Row.FCTextBox("TxtAbonar").Enabled = True - End If - - End If - Case 3 - e.Row.FCLabel("LbEstatusInv").Text = "" - e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Green - Case Else - End Select - 'si está bloqueada y es refacturación, debe de permitirlo, sin importar lo que se halla ingresado - If e.Row.DBCampo("CveCompraRefacturacion").ToEntero > 0 AndAlso Not e.Row.FCCheckBox("Chk").Enabled Then - e.Row.FCCheckBox("Chk").Enabled = True - e.Row.FCTextBox("TxtAbonar").Enabled = True - End If + 'si está bloqueada y es refacturación, debe de permitirlo, sin importar lo que se halla ingresado + If e.Row.DBCampo("CveCompraRefacturacion").ToEntero > 0 AndAlso Not e.Row.FCCheckBox("Chk").Enabled Then + e.Row.FCCheckBox("Chk").Enabled = True + e.Row.FCTextBox("TxtAbonar").Enabled = True + End If + If UsuarioActual.Empresa.Funcionalidad(306) = "1" And e.Row.DBCampo("AplicaNotaCredito").ToString = "True" Then + e.Row.FCCheckBox("Chk").Enabled = False End If End If - If UsuarioActual.Empresa.Funcionalidad(306) = "1" And e.Row.DBCampo("AplicaNotaCredito").ToString = "True" Then - e.Row.FCCheckBox("Chk").Enabled = False - End If + End If End Sub @@ -2017,7 +2008,7 @@ Partial Class Bancos_ProveedoresAbonar End If End If - If MsgError <> "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then + If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then If ObjMov.ValorPolizaDescuadre > 0 Then MsgError = ObjMov.MensajePolizaDescuadre + " " + ObjMov.ValorDiferencia GuardaLogAD($"Bancos/ProveedoresAbonar | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") @@ -2957,6 +2948,7 @@ Partial Class Bancos_ProveedoresAbonar Dim TCPago As Decimal = GlobalTipoCambio(TxtFechaIncobrable.Text.ToDate).ToDecimal Dim CveMoneda As Integer = gr.DataKey("CveMoneda").ToEntero Dim FechaCompra As Date = gr.DataKey("Fecha").ToDate + Dim CveSubProyecto As Integer = gr.DataKey("CveSubProyecto").ToEntero Dim CveConceptoContablePago As Integer = 17 If gr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContablePago = 308 'cuando es acreedor @@ -3004,7 +2996,7 @@ Partial Class Bancos_ProveedoresAbonar Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("Original").ToDecimal - If gr.DataKey("IVA").ToDecimal > 0 Then + If MsgError = "" AndAlso gr.DataKey("IVA").ToDecimal > 0 Then Dim PorcentajeImpuesto As Decimal = gr.DataKey("PorcentajeIVA").ToDecimal Dim IdCtaIVAXAcreditar As Integer = 0 Dim IdCtaIVAAcreditable As Integer = 0 @@ -3024,7 +3016,7 @@ Partial Class Bancos_ProveedoresAbonar End If - If gr.DataKey("IEPS").ToDecimal > 0 Then + If MsgError = "" AndAlso gr.DataKey("IEPS").ToDecimal > 0 Then Dim IEPS As Decimal = PorcentajePago * gr.DataKey("IEPS").ToDecimal If ObjConta.GetRetCuenta(25, UsuarioActual.CveEmpresa) Then @@ -3043,7 +3035,7 @@ Partial Class Bancos_ProveedoresAbonar End If ' se manda al ot ingresos, los impuestos por acreditar - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, gr.DataKey("SerieFolio").ToString, 78, ConceptoPartida, Now, IdCtaContable:=UsuarioActual.Empresa.IdCuentaOtrosIngresos, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, Saldo, Saldo * TCPago), TipoCambio:=TCCompra, TipoCambioPago:=TCPago, CveCuenta:=-1) Then + If MsgError = "" AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Saldo, gr.DataKey("SerieFolio").ToString, 78, ConceptoPartida, Now, IdCtaContable:=UsuarioActual.Empresa.IdCuentaOtrosIngresos, CveIE:=-1, IdSegmentoNegocio:=-1, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CveCompra:=gr.DataKey("CveCompra").ToEntero, ImporteMX:=If(CveMoneda = 1, Saldo, Saldo * TCPago), TipoCambio:=TCCompra, TipoCambioPago:=TCPago, CveCuenta:=-1, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If @@ -3064,7 +3056,7 @@ Partial Class Bancos_ProveedoresAbonar - If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then + If MsgError = "" AndAlso ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then If ObjConta.ValorPolizaDescuadre > 0 Then MsgError = ObjConta.MensajePolizaDescuadre + " " + ObjConta.ValorDiferencia GuardaLogAD($"Bancos/ProveedoresAbonar | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") diff --git a/CRM/CatEmpresasCRM.aspx b/CRM/CatEmpresasCRM.aspx index ea133cd46..7095cee60 100644 --- a/CRM/CatEmpresasCRM.aspx +++ b/CRM/CatEmpresasCRM.aspx @@ -5,13 +5,13 @@ - Catálogo de Empresas CRM + Catálogo de Prospectos
  • - Agregar Empresa + Agregar Prospecto
  • @@ -48,7 +48,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/CRM/PopUpBuscarAcercamiento.aspx b/CRM/PopUpBuscarAcercamiento.aspx index 548741b9f..ec39a8719 100644 --- a/CRM/PopUpBuscarAcercamiento.aspx +++ b/CRM/PopUpBuscarAcercamiento.aspx @@ -28,7 +28,7 @@ - Empresa CRM: + Prospecto: diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 5278e8d44..6256ef9c2 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -3108,21 +3108,31 @@ - -
    + +
    + + +
    + +
    @@ -67,17 +127,81 @@ - + - - + + +
    + + + + + + + + + + diff --git a/Ventas/RepTopClientesVentas.aspx.vb b/Ventas/RepTopClientesVentas.aspx.vb index aafccc8f1..69bfc29ed 100644 --- a/Ventas/RepTopClientesVentas.aspx.vb +++ b/Ventas/RepTopClientesVentas.aspx.vb @@ -9,6 +9,15 @@ Imports Microsoft.Reporting.WebForms Partial Class Ventas_RepTopClientesVentas Inherits ClsPaginas + Private Property DtClientes As DataTable + Get + Return DirectCast(ViewState("DtClientes"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtClientes") = value + End Set + End Property + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then CargarFiltros() @@ -47,12 +56,16 @@ Partial Class Ventas_RepTopClientesVentas DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) DdlSubProyecto.DataBind() DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) + + TxtTop.Text = "20" End Sub Private Sub CargaDatos() Dim ObjVentas As New ClsVentas - If ObjVentas.GetRepTopClientesVentas(UsuarioActual.CveEmpresa, DdlMes.SelectedValue.ToEntero, DdlAño.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero) Then + If ObjVentas.GetRepTopClientesVentas(UsuarioActual.CveEmpresa, DdlMes.SelectedValue.ToEntero, DdlAño.SelectedValue.ToEntero, TxtTop.Text.ToEntero, + DdlSubProyecto.SelectedValue.ToEntero) Then GvM.DataSource = ObjVentas.DtResultados + DtClientes = ObjVentas.DtResultados End If ObjVentas.Dispose() GvM.DataBind() @@ -62,4 +75,50 @@ Partial Class Ventas_RepTopClientesVentas CargaDatos() UppGrid.Update() End Sub + + Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString)) + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + If Imagen.Exists Then + params.Add(New ReportParameter("pImg", logouri)) + Else + params.Add(New ReportParameter("pImg", "")) + End If + ImprimirPDF("Empresas/Grales/Formatos/TopClientes.rdlc", DtClientes, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:="PDF") + End Sub + + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) + If Not DtClientes IsNot Nothing AndAlso DtClientes.Rows.Count > 0 Then + Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + LblTituloGrafica.Text = $"Agrupado por: Clientes" + RegistraScript("$('#DivModalGrafica').modal('show')") + CambioGrafica() + End Sub + + Private Sub CambioGrafica() + Dim Dt As New DataTable() + Dt.Columns.Add("Cliente") + Dt.Columns.Add("Importe") + For Each Dr As DataRow In DtClientes.Rows + Dim Row As DataRow = Nothing + Row = Dt.NewRow() + Row("Cliente") = Dr("NombreComercial").ToString + Row("Importe") = Dr("ImporteAcumulado").ToString.FormatoNumero + Dt.Rows.Add(Row) + Next + + Dim query = From s In Dt.AsEnumerable() Select New With {.Cliente = s("Cliente").ToString(), .Importe = s("Importe").ToString().ToDouble()} + Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(query) + RegistraScript($"CargaGraficaBarras({json})", "22") + UPModalProd.Update() + End Sub End Class diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 9d6b88538..33970e2d8 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6207,6 +6207,11 @@ +
    +
    + +
    +
    @@ -6228,7 +6233,7 @@
    - +
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index fc9564082..b495f0e2e 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10930,8 +10930,10 @@ Partial Class Ventas End If - 'TRASPASA PAGADO (ObjFacturaNC.Pagado > 0) AndAlso - If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso ObjFactura.NuevaFactura = 1 Then + Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero() + + 'REFACTURACION CON PAGOS, DEBE CANCELAR SALDOS DEL DOCUMENTO ANTERIOR Y TRASPASAR PAGOS AL NUEVO + If ModalidadRefacturacion = 2 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso ObjFactura.NuevaFactura = 1 Then If Not ObjConta.TraspasarSaldosPrePolizasRefacturacion(ObjFacturaNC.CveVenta, ObjFactura.CveVenta, ObjFactura.CvePrePoliza, CvePlantilaPoliza, UsuarioActual.CveEmpresa) Then ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.") End If @@ -16829,7 +16831,6 @@ Partial Class Ventas Private Sub BtnNuevaFactura_Click(sender As Object, e As EventArgs) Handles LkRefacturacion.Click 'Nos vamos a la nueva factura Dim script As String = "" - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then Dim sb As New StringBuilder() @@ -18983,6 +18984,24 @@ Partial Class Ventas End If End Sub + Private Sub MostrarCondicionesCancelacion() + Dim SbCondiciones As New StringBuilder() + + If VentaSaldoAlmacen < 0 AndAlso ChkDevAlm.Checked Then + SbCondiciones.Append("*Se realizará una devolución en automatico al realizar la cancelación.") + End If + + If GvRemisiones.Rows.Count > 0 AndAlso Not DivCanRem.Visible AndAlso Not AplicaCancelarRemision Then + SbCondiciones.Append("

    *No se puede cancelar las remisiones ligadas a la factura, esto puede deberse por los siguientes motivo:") + SbCondiciones.Append("
         -La remisión no está facturada al 100%.") + SbCondiciones.Append("
         -La remisión está relacionada con otra factura.") + End If + + LbCancelarDescripcion.Text = SbCondiciones.ToString() + + UpCancelarDocumento.Update() + End Sub + Private Sub LbCancelarDocumento_Click(sender As Object, e As EventArgs) Handles LbCancelarDocumento.Click 'If VentaSaldoAlmacen <> 0 Then @@ -19020,6 +19039,7 @@ Partial Class Ventas sb.Append("Está seguro de cancelar el documento?.") LblCancelarDocumento.Text = sb.ToString() + MostrarCondicionesCancelacion() RegistraScript("$('#ModalCancelarDocumento').modal();") UpCancelarDocumento.Update() @@ -19029,6 +19049,9 @@ Partial Class Ventas End If End Sub + Protected Sub ChkDevAlm_CheckedChanged(sender As Object, e As EventArgs) + MostrarCondicionesCancelacion() + End Sub Protected Sub BtnCancelarDocumento_Click(sender As Object, e As EventArgs) CancelarDocumento() RegistraScript("$('#ModalCancelarDocumento').modal('hide');") @@ -23427,7 +23450,7 @@ Partial Class Ventas Else DivGvCancelarRemision.Visible = False End If - UpCancelarDocumento.Update() + MostrarCondicionesCancelacion() End Sub Private Sub LnkRemisiones_Click(sender As Object, e As EventArgs) Handles LnkRemisiones.Click Dim ObjContratos As New ClsContratos @@ -24532,7 +24555,7 @@ Partial Class Ventas Dim CveEstatusAutorizacion As Integer = RowVenta("CveEstatusFactura").ToString().ToEntero() 'SI LA AUTORIZACION ESTA REMISIONADA NO DEBE REMISIONAR DE NUEVO If CveEstatusAutorizacion = 18 Then - Alert("La autorización ya esta remisionada") + Alert("La autorización ya está remisionada") Exit Sub End If Else @@ -25284,4 +25307,5 @@ Partial Class Ventas Public PU As Decimal = 0 Public EsPUModificado As Boolean = False End Class + End Class \ No newline at end of file diff --git a/vwd.webinfo b/vwd.webinfo index 728e9d258..c9e193dc4 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -48,6 +48,8 @@ + +