Correciones Presupuestos, comisiones modal de comisiones

This commit is contained in:
rakcsle
2024-03-14 19:29:41 -07:00
parent e196a0776c
commit 17cda912eb
9 changed files with 628 additions and 74 deletions

View File

@@ -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