Comisione cobradas en reporte de comisiones
This commit is contained in:
@@ -117,6 +117,7 @@
|
||||
<asp:BoundField HeaderText="Utilidad" DataField="Utilidad" DataFormatString="{0:N2}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />--%>
|
||||
<asp:BoundField HeaderText="Comisión $" DataField="ComisionGanancia" DataFormatString="{0:###,###,##0.00}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Importe Cobrado" DataField="Cobrado" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Comisión Cobrada $" DataField="ComisionCobrada" DataFormatString="{0:###,###,##0.00}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Pendiente x Cobrar" DataField="Pendiente" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Total al Dia" DataField="PendienteXDia" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
|
||||
</Columns>
|
||||
@@ -191,11 +192,12 @@
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel ID="UpPorcentajeComisiones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<%-- <div class="row">
|
||||
<label class="col-md-2 truncate">Vendedor:</label>
|
||||
<div class="col-md-5">
|
||||
<asp:DropDownList ID="DdlVendedorPorcentaje" AutoPostBack="true" runat="server" OnSelectedIndexChanged="DdlVendedorPorcentaje_SelectedIndexChanged" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" Width="100%">
|
||||
<asp:DropDownList ID="DdlVendedorPorcentaje" AutoPostBack="true" AppendDataBoundItems="true" runat="server" OnSelectedIndexChanged="DdlVendedorPorcentaje_SelectedIndexChanged" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="select2me" Width="100%">
|
||||
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
<asp:ListItem Text="Todos" Value="-2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVPorcentajeVendedor" runat="server" ControlToValidate="DdlVendedorPorcentaje" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Vendedor''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpPorcentajeComision"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPorcentajeVendedor" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentajeVendedor" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
@@ -208,11 +210,11 @@
|
||||
<asp:RequiredFieldValidator ID="RFVPorcentajeComision" runat="server" ControlToValidate="TxtPorcentajeComision" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Porcentaje''</b> es necesario. Por favor seleccione uno." InitialValue="" ValidationGroup="GrpPorcentajeComision"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPorcentajeComision" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentajeComision" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
</div>--%>
|
||||
<div class="row">
|
||||
<label class="col-md-2 truncate">Mes:</label>
|
||||
<div class="col-md-5">
|
||||
<asp:DropDownList ID="DdlMes" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlMes_SelectedIndexChanged" CssClass="select2me" Width="100%">
|
||||
<asp:DropDownList ID="DdlMes" runat="server" CssClass="select2me" Width="100%">
|
||||
<asp:ListItem Text="Enero" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem>
|
||||
|
||||
@@ -24,8 +24,8 @@ Partial Class Ventas_RepComisiones
|
||||
|
||||
Private Sub InicializaValores()
|
||||
txtFechaI.Text = FirstDayOfMonth(Now).ToShortDateString
|
||||
txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
|
||||
|
||||
txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
|
||||
|
||||
TxtAnio.Text = Now.Year.ToString()
|
||||
DdlMes.SelectedValueExist(Now.Month)
|
||||
|
||||
@@ -35,8 +35,8 @@ Partial Class Ventas_RepComisiones
|
||||
DdlVendedorAjuste.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedorAjuste.DataBind()
|
||||
|
||||
DdlVendedorPorcentaje.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedorPorcentaje.DataBind()
|
||||
'DdlVendedorPorcentaje.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
'DdlVendedorPorcentaje.DataBind()
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -205,65 +205,59 @@ Partial Class Ventas_RepComisiones
|
||||
#End Region
|
||||
|
||||
Protected Sub BtnGuardarPorcentajeComision_Click(sender As Object, e As EventArgs)
|
||||
Dim CveVendedor As Integer = DdlVendedorPorcentaje.SelectedValue.ToEntero()
|
||||
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
|
||||
Dim Anio As Integer = TxtAnio.Text.ToEntero()
|
||||
|
||||
Dim Porcentaje As Decimal = TxtPorcentajeComision.Text.ToDecimal() / 100
|
||||
|
||||
Dim RowCierre As DataRow = Nothing
|
||||
Dim TieneError As Boolean = False
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Try
|
||||
If ObjVentas.GetCierreComisionVendedor(CveVendedor, Mes, Anio, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
RowCierre = ObjVentas.DtResultados.Rows(0)
|
||||
End If
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
|
||||
Dim Anio As Integer = TxtAnio.Text.ToEntero()
|
||||
|
||||
If RowCierre IsNot Nothing Then
|
||||
If ObjVentas.UpdateCierreComisionVendedor(CveVendedor, Mes, Anio, Porcentaje) Then
|
||||
Alert("El porcentaje de comisiones se guardo correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If GvRow.DataKey("CveVendedor").ToEntero() > 0 Then
|
||||
Dim Porcentaje As Decimal = GvRow.DataKey("Comision").ToDecimal() / 100
|
||||
|
||||
If ObjVentas.GetCierreComisionVendedor(GvRow.DataKey("CveVendedor").ToEntero(), Mes, Anio, UsuarioActual.CveEmpresa) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
RowCierre = ObjVentas.DtResultados.Rows(0)
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If RowCierre IsNot Nothing Then
|
||||
TieneError = Not ObjVentas.UpdateCierreComisionVendedor(GvRow.DataKey("CveVendedor").ToEntero(), Mes, Anio, Porcentaje)
|
||||
Else
|
||||
TieneError = Not ObjVentas.AddCierreComisionVendedor(GvRow.DataKey("CveVendedor").ToEntero(), Mes, Anio, Porcentaje)
|
||||
End If
|
||||
|
||||
If TieneError Then
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
RowCierre = Nothing
|
||||
End If
|
||||
Else
|
||||
If ObjVentas.AddCierreComisionVendedor(CveVendedor, Mes, Anio, Porcentaje) Then
|
||||
Alert("El porcentaje de comisiones se guardo correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
OnError("Ocurrió un error al asginar el porcentaje de la comisión", ex)
|
||||
End Try
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
UpPorcentajeComisiones.Update()
|
||||
End Sub
|
||||
Protected Sub DdlVendedorPorcentaje_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaPorcentajeComisiones()
|
||||
End Sub
|
||||
Protected Sub DdlMes_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaPorcentajeComisiones()
|
||||
End Sub
|
||||
Protected Sub CargaPorcentajeComisiones()
|
||||
Dim CveVendedor As Integer = DdlVendedorPorcentaje.SelectedValue.ToEntero()
|
||||
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
|
||||
Dim Anio As Integer = TxtAnio.Text.ToEntero()
|
||||
|
||||
Dim RowCierre As DataRow = Nothing
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetCierreComisionVendedor(CveVendedor, Mes, Anio, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
RowCierre = ObjVentas.DtResultados.Rows(0)
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If RowCierre IsNot Nothing Then
|
||||
TxtPorcentajeComision.Text = (RowCierre("PorcentajeComision").ToString().ToDecimal() * 100).FormatoNumero(0)
|
||||
If TieneError Then
|
||||
ObjVentas.RollBack()
|
||||
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
|
||||
Else
|
||||
TxtPorcentajeComision.Text = "0"
|
||||
ObjVentas.Commit()
|
||||
Alert("El porcentaje de comisiones se guardó correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
CargaDatos()
|
||||
UPDatos.Update()
|
||||
UpPorcentajeComisiones.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -126,6 +126,9 @@
|
||||
<asp:HyperLink ID="HLGanancia" Target="_blank" Text='<%# Eval("ComisionGanancia", "{0:N2}") %>' runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Porcentaje Pagado %" DataField="PorcentajePagado" DataFormatString="{0:N2}%" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Comision Cobrada %" DataField="PorcentajeComision" DataFormatString="{0:N2}%" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Comision Cobrada" DataField="ComisionCobrada" DataFormatString="{0:N2}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
|
||||
<%--<asp:BoundField HeaderText="Comision Ganancia" DataField="ComisionGanancia" DataFormatString="{0:N2}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />--%>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
Reference in New Issue
Block a user