diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb
index 8ed9302c9..60795a215 100644
--- a/App_Code/ClsContratos.vb
+++ b/App_Code/ClsContratos.vb
@@ -3201,7 +3201,7 @@ Public Class ClsContratos
End Function
- Public Function GetPresupuestosResumen(CveEmpresa As Integer, CveSubProyecto As Integer, Optional Opcion As Integer = 1) As Boolean
+ Public Function GetPresupuestosResumen(CveEmpresa As Integer, CveSubProyecto As Integer, Opcion As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Con_PresupuestosResumenGet")
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index b433d440c..c19234354 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -10770,6 +10770,9 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/CatProcedimientoDetalle.aspx".ToUpper(), 1344)
PaginaDict.Add("/Ventas/CatEspecialidadesSubEspecialidades.aspx".ToUpper(), 1346)
PaginaDict.Add("/Ventas/FacturacionGlobal.aspx".ToUpper(), 546)
+ PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347)
+
+
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 90d5cbe6e..a89fb0dbc 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -6314,9 +6314,6 @@ Public Class ClsVentas
#End Region
-
-
-
#Region "S U B E S P E C I A L I D A D E S"
Public Function GetMedicosSubEspecialidades(CveMedicoSubEspecialidad As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean
@@ -6740,6 +6737,80 @@ Public Class ClsVentas
#End Region
+#Region "VENTAS MEDICAS COMISIONES"
+
+ Public Function GetComisionesMedicas(CveEmpresa As Integer) As Boolean
+
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Vta_ComisionesMedicasGet")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener las comisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+
+ End Function
+
+ Public Function AddUpdateComisionesMedicas(CvePS As Integer, CveEmpresa As Integer, ComisionMedico As Decimal, ComisionVendedor As Decimal, ComisionTecnico As Decimal) As Boolean
+
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Vta_ComisionesMedicasAddUpdate")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CvePS", SqlDbType.Int).Value = CvePS
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@ComisionMedico", SqlDbType.Money).Value = ComisionMedico
+ .Add("@ComisionVendedor", SqlDbType.Money).Value = ComisionVendedor
+ .Add("@ComisionTecnico", SqlDbType.Money).Value = ComisionTecnico
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al actualizar las comisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+
+ End Function
+
+ Public Function GetComisionesMedicasRep(FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CveSubProyecto As Integer, CveProcedimiento As Integer, CveMedico As Integer, CveVendedor As Integer, CveUsuario As Integer) As Boolean
+
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Vta_ComisionesMedicasRepGet")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
+ .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
+ .Add("@CveMedico", SqlDbType.Int).Value = CveMedico
+ .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento
+ .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el reporte comisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+
+ End Function
+
+#End Region
#Region "DEVOLUICON"
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 246200467..70ccf97f9 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -20281,13 +20281,13 @@ Partial Class Compras_Compras
Dim Autorizado As Double = 0
Dim Ejercido As Double = 0
- If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1) Then
+ If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, 1) Then
Dim FechaCompra As Date = TxtFecha.Text.ToDate
Dim resultadosFiltrados = From row In ObjCon.DtResultados.AsEnumerable()
Where FechaCompra >= row.Field(Of Date)("FechaInicio") AndAlso
- FechaCompra <= row.Field(Of Date)("FechaFin")
+ FechaCompra <= row.Field(Of Date)("FechaFin")
Select row
@@ -20315,54 +20315,68 @@ Partial Class Compras_Compras
If Opcion = 1 Then
- Dim saldoTotal As Decimal = (From row In resultadosFiltrados
- Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
- row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion AndAlso
- row.Field(Of Integer)("CveTipoGasto") = ValCveTipoGasto
- Select row.Field(Of Decimal)("Saldo")).Sum()
- If saldoTotal > 0 Then
- Dim TotalAcumuladoTabla As Decimal = (TmpDT.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} AND CveTipoGasto = {ValCveTipoGasto} "))
- Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
-
- If (Diferencia) < 0 Then
- Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}, Tipo de gasto {ValTipoGasto}. Se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia)
- respuesta = False
-
- Else
- respuesta = True
- End If
-
- Else
- Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}, Tipo de gasto {ValTipoGasto} ", TipoMensaje.MsgAdvertencia)
- respuesta = False
- End If
-
- Else
- For Each item In EnumAgrupado
+ Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = ValCveSubProyecto)
+ If tieneRegistrosConCveSubProyecto Then
Dim saldoTotal As Decimal = (From row In resultadosFiltrados
- Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso
- row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
+ Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
+ row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion AndAlso
+ row.Field(Of Integer)("CveTipoGasto") = ValCveTipoGasto
Select row.Field(Of Decimal)("Saldo")).Sum()
If saldoTotal > 0 Then
- Dim Diferencia As Decimal = saldoTotal - item.TotalSum
+ Dim TotalAcumuladoTabla As Decimal = (TmpDT.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} AND CveTipoGasto = {ValCveTipoGasto} "))
+ Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
If (Diferencia) < 0 Then
- Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}, Tipo de gasto {item.TipoGasto}. Se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia)
+ Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}, Tipo de gasto {ValTipoGasto}. Se excede por {Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia)
respuesta = False
- Exit For
+
Else
respuesta = True
End If
Else
- Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}, Tipo de gasto {item.TipoGasto}", TipoMensaje.MsgAdvertencia)
+ Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}, Tipo de gasto {ValTipoGasto} ", TipoMensaje.MsgAdvertencia)
respuesta = False
- Exit For
End If
+ Else
+ respuesta = True
+ End If
+
+ Else
+ For Each item In EnumAgrupado
+
+
+ Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto)
+
+ If tieneRegistrosConCveSubProyecto Then
+ Dim saldoTotal As Decimal = (From row In resultadosFiltrados
+ Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso
+ row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
+ Select row.Field(Of Decimal)("Saldo")).Sum()
+ If saldoTotal > 0 Then
+
+ Dim Diferencia As Decimal = saldoTotal - item.TotalSum
+
+ If (Diferencia) < 0 Then
+ Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}, Tipo de gasto {item.TipoGasto}. Se excede por {Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia)
+ respuesta = False
+ Exit For
+ Else
+ respuesta = True
+ End If
+
+ Else
+ Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}, Tipo de gasto {item.TipoGasto}", TipoMensaje.MsgAdvertencia)
+ respuesta = False
+ Exit For
+ End If
+ Else
+ respuesta = True
+ End If
Next
End If
@@ -20370,10 +20384,14 @@ Partial Class Compras_Compras
Else
- Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ 'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ respuesta = True
End If
+
+
Else
- Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ 'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ respuesta = False
End If
ObjCon.Dispose()
diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx
index 6f6a0f7e4..061e4ba57 100644
--- a/Compras/eFacturas.aspx
+++ b/Compras/eFacturas.aspx
@@ -1473,6 +1473,13 @@
+
+<%--
+
+ --%>
+
+
@@ -1487,6 +1494,12 @@
+
+
+
+
+
diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb
index 99bdde358..18e77b18d 100644
--- a/Compras/eFacturas.aspx.vb
+++ b/Compras/eFacturas.aspx.vb
@@ -2652,6 +2652,9 @@ Partial Class Compras_eFacturas
'End Sub
Protected Sub LnkSolicitarSat_Click(ByVal sender As Object, ByVal e As EventArgs)
+
+ Exit Sub
+
Dim sbResultado As StringBuilder = New StringBuilder()
Dim idSolicitudCFDI As Integer = 0
Dim idSolicitudMetadata As Integer = 0
diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb
index 414cb1a3f..15bdaa1e6 100644
--- a/OC/OC.aspx.vb
+++ b/OC/OC.aspx.vb
@@ -9019,64 +9019,75 @@ Partial Class OC_OC
If Opcion = 1 Then
- Dim saldoTotal As Decimal = (From row In resultadosFiltrados
- Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
- row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion
- Select row.Field(Of Decimal)("Saldo")).Sum()
- If saldoTotal > 0 Then
- Dim TotalAcumuladoTabla As Decimal = (DtDetalle.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} "))
- Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
-
- If (Diferencia) < 0 Then
- Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}. Se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia)
- respuesta = False
-
- Else
- respuesta = True
- End If
-
- Else
- Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}.", TipoMensaje.MsgAdvertencia)
- respuesta = False
- End If
-
- Else
- For Each item In EnumAgrupado
+ Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = ValCveSubProyecto)
+ If tieneRegistrosConCveSubProyecto Then
Dim saldoTotal As Decimal = (From row In resultadosFiltrados
- Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso
- row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
+ Where row.Field(Of Integer)("CveSubProyecto") = ValCveSubProyecto AndAlso
+ row.Field(Of Integer)("CveClasificacion") = ValCveClasificacion
Select row.Field(Of Decimal)("Saldo")).Sum()
If saldoTotal > 0 Then
- Dim Diferencia As Decimal = saldoTotal - item.TotalSum
+ Dim TotalAcumuladoTabla As Decimal = (DtDetalle.SUM("Total", $" CveSubProyecto = {ValCveSubProyecto} AND CveClasificacion = {ValCveClasificacion} "))
+ Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
If (Diferencia) < 0 Then
- Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}. Se excede por {Diferencia.FormatoNumero}", TipoMensaje.MsgAdvertencia)
+ Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}. Se excede por { Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia)
respuesta = False
- Exit For
+
Else
respuesta = True
End If
Else
- Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}.", TipoMensaje.MsgAdvertencia)
+ Alert($"No hay presupuesto disponible en el subproyecto {ValSubProyecto} con la clasificación {ValClasificacion}.", TipoMensaje.MsgAdvertencia)
respuesta = False
- Exit For
End If
+ Else
+ respuesta = True
+ End If
+ Else
+ For Each item In EnumAgrupado
+
+ Dim tieneRegistrosConCveSubProyecto As Boolean = resultadosFiltrados.Any(Function(row) CType(row("CveSubProyecto"), Integer) = item.CveSubProyecto)
+ If tieneRegistrosConCveSubProyecto Then
+
+ Dim saldoTotal As Decimal = (From row In resultadosFiltrados
+ Where row.Field(Of Integer)("CveSubProyecto") = item.CveSubProyecto AndAlso
+ row.Field(Of Integer)("CveClasificacion") = item.CveClasificacion
+ Select row.Field(Of Decimal)("Saldo")).Sum()
+ If saldoTotal > 0 Then
+
+ Dim Diferencia As Decimal = saldoTotal - item.TotalSum
+
+ If (Diferencia) < 0 Then
+ Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}. Se excede por {Math.Abs(Diferencia).FormatoNumero}", TipoMensaje.MsgAdvertencia)
+ respuesta = False
+ Exit For
+ Else
+ respuesta = True
+ End If
+
+ Else
+ Alert($"No hay presupuesto disponible en el subproyecto {item.SubProyecto} con la clasificación {item.Clasificacion}.", TipoMensaje.MsgAdvertencia)
+ respuesta = False
+ Exit For
+ End If
+ Else
+ respuesta = True
+ End If
Next
End If
-
-
-
Else
- Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ ' Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ respuesta = True
End If
Else
- Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ 'Alert("No hay presupuestos.", TipoMensaje.MsgAdvertencia)
+ respuesta = False
End If
ObjCon.Dispose()
diff --git a/Ventas/RepComisionesSMS.aspx b/Ventas/RepComisionesSMS.aspx
new file mode 100644
index 000000000..9c6818456
--- /dev/null
+++ b/Ventas/RepComisionesSMS.aspx
@@ -0,0 +1,300 @@
+<%@ Page Title="Reporte de Comisiones" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepComisionesSMS.aspx.vb" Inherits="Ventas_RepComisionesSMS" %>
+<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
+<%@ Register Src="~/UserControl/AddMedico.ascx" TagPrefix="UserControl" TagName="AddMedico" %>
+
+
+
+
+
+ Reporte de Comisiones
+
+
+
+
+ Reporte de Comisiones
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ventas/RepComisionesSMS.aspx.vb b/Ventas/RepComisionesSMS.aspx.vb
new file mode 100644
index 000000000..65fecc541
--- /dev/null
+++ b/Ventas/RepComisionesSMS.aspx.vb
@@ -0,0 +1,135 @@
+Option Explicit On
+Option Strict On
+
+Imports Extensiones
+Imports Microsoft.Extensions.Primitives
+
+Partial Class Ventas_RepComisionesSMS
+ Inherits ClsPaginas
+
+
+ Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
+
+ If Not Page.IsPostBack Then
+ CargaDatos()
+ End If
+
+ End Sub
+
+
+ Public Sub CargaDatos()
+
+
+ 'Dim ObjVentas As New ClsVentas
+
+ 'If ObjVentas.GetMedicos(-1, UsuarioActual.CveEmpresa, -1) Then
+ ' GvDatos.DataSource = ObjVentas.DtResultados
+ 'Else
+ ' GvDatos.DataSource = Nothing
+ 'End If
+
+ 'ObjVentas.Dispose()
+
+ 'GvDatos.DataBind()
+
+
+
+ 'UpDatos.Update()
+
+
+
+ End Sub
+
+ Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
+ CargaDatos()
+ End Sub
+
+#Region "EXCEL"
+
+ Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
+
+ GvDatos.Columns(10).Visible = False
+ Dim SbFiltros As New StringBuilder()
+ SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|")
+ GvDatos.ExportToExcelGembox("CatMedicos", UsuarioActual, "Catálogo de Médicos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
+ GvDatos.Columns(10).Visible = True
+
+
+
+ End Sub
+
+ Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
+ End Sub
+
+#End Region
+
+
+ Protected Sub LnkComisiones_Click(sender As Object, e As EventArgs)
+ CargaComisiones()
+ RegistraScript("$('#DvModalComisiones').modal('show');")
+ End Sub
+
+ Private Sub CargaComisiones()
+
+ GvComisiones.DataSource = Nothing
+
+ Dim objVentas As New ClsVentas
+
+ If objVentas.GetComisionesMedicas(UsuarioActual.CveEmpresa) Then
+ GvComisiones.DataSource = objVentas.DtResultados
+ End If
+
+ objVentas.Dispose()
+
+ GvComisiones.DataBind()
+
+ UpDvModalComisiones.Update()
+
+ End Sub
+
+
+
+ Protected Sub BtnGuardarComisiones_Click(sender As Object, e As EventArgs)
+
+ Dim objVentas As New ClsVentas
+ objVentas.IniciaTransacSQL()
+
+ Dim TieneError As Boolean = False
+
+ For Each GvRow As GridViewRow In GvComisiones.Rows
+
+ If Not objVentas.AddUpdateComisionesMedicas(GvRow.DataKey("CvePS").ToEntero, UsuarioActual.CveEmpresa, GvRow.FCTextBox("TxtComisionMedico").Text.ToDecimal, GvRow.FCTextBox("TxtComisionVendedor").Text.ToDecimal, GvRow.FCTextBox("TxtComisionTecnico").Text.ToDecimal) Then
+ TieneError = True
+ End If
+
+ Next
+
+ If TieneError Then
+ objVentas.RollBack()
+ Else
+ objVentas.Commit()
+ Alert("Comisiones Actualizadas correctamente")
+ End If
+
+ objVentas.Dispose()
+
+ End Sub
+
+ Protected Sub GvComisiones_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+
+ If e.Row.RowType = DataControlRowType.DataRow Then
+
+ If e.Row.FCTextBox("TxtComisionMedico").Text.ToDecimal = 0 Then
+ e.Row.FCTextBox("TxtComisionMedico").Text = ""
+ End If
+ If e.Row.FCTextBox("TxtComisionVendedor").Text.ToDecimal = 0 Then
+ e.Row.FCTextBox("TxtComisionVendedor").Text = ""
+ End If
+ If e.Row.FCTextBox("TxtComisionTecnico").Text.ToDecimal = 0 Then
+ e.Row.FCTextBox("TxtComisionTecnico").Text = ""
+ End If
+
+ End If
+
+ End Sub
+End Class