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="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="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="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="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" />
|
<asp:BoundField HeaderText="Total al Dia" DataField="PendienteXDia" ItemStyle-Width="15%" DataFormatString="{0:###,###,##0.00}" ItemStyle-HorizontalAlign="Right" />
|
||||||
</Columns>
|
</Columns>
|
||||||
@@ -191,11 +192,12 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<asp:UpdatePanel ID="UpPorcentajeComisiones" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UpPorcentajeComisiones" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="row">
|
<%-- <div class="row">
|
||||||
<label class="col-md-2 truncate">Vendedor:</label>
|
<label class="col-md-2 truncate">Vendedor:</label>
|
||||||
<div class="col-md-5">
|
<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 Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||||
|
<asp:ListItem Text="Todos" Value="-2"></asp:ListItem>
|
||||||
</asp:DropDownList>
|
</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>
|
<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>
|
<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>
|
<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>
|
<ajax:ValidatorCalloutExtender ID="VCEPorcentajeComision" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentajeComision" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>--%>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label class="col-md-2 truncate">Mes:</label>
|
<label class="col-md-2 truncate">Mes:</label>
|
||||||
<div class="col-md-5">
|
<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="Enero" Value="1"></asp:ListItem>
|
||||||
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
|
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
|
||||||
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem>
|
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem>
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ Partial Class Ventas_RepComisiones
|
|||||||
DdlVendedorAjuste.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
DdlVendedorAjuste.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||||
DdlVendedorAjuste.DataBind()
|
DdlVendedorAjuste.DataBind()
|
||||||
|
|
||||||
DdlVendedorPorcentaje.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
'DdlVendedorPorcentaje.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||||
DdlVendedorPorcentaje.DataBind()
|
'DdlVendedorPorcentaje.DataBind()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -205,65 +205,59 @@ Partial Class Ventas_RepComisiones
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Protected Sub BtnGuardarPorcentajeComision_Click(sender As Object, e As EventArgs)
|
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 RowCierre As DataRow = Nothing
|
||||||
|
Dim TieneError As Boolean = False
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
Try
|
Try
|
||||||
If ObjVentas.GetCierreComisionVendedor(CveVendedor, Mes, Anio, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
ObjVentas.IniciaTransacSQL()
|
||||||
RowCierre = ObjVentas.DtResultados.Rows(0)
|
Dim Mes As Integer = DdlMes.SelectedValue.ToEntero()
|
||||||
End If
|
Dim Anio As Integer = TxtAnio.Text.ToEntero()
|
||||||
|
|
||||||
If RowCierre IsNot Nothing Then
|
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||||
If ObjVentas.UpdateCierreComisionVendedor(CveVendedor, Mes, Anio, Porcentaje) Then
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||||
Alert("El porcentaje de comisiones se guardo correctamente.", TipoMensaje.MsgInformacion)
|
|
||||||
Else
|
If GvRow.DataKey("CveVendedor").ToEntero() > 0 Then
|
||||||
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
|
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
|
End If
|
||||||
Else
|
Next
|
||||||
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
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
TieneError = True
|
||||||
OnError("Ocurrió un error al asginar el porcentaje de la comisión", ex)
|
OnError("Ocurrió un error al asginar el porcentaje de la comisión", ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
ObjVentas.Dispose()
|
If TieneError Then
|
||||||
|
ObjVentas.RollBack()
|
||||||
UpPorcentajeComisiones.Update()
|
Alert("Ocurrió un error al guardar el porcentaje de comisiones.", TipoMensaje.MsgError)
|
||||||
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)
|
|
||||||
Else
|
Else
|
||||||
TxtPorcentajeComision.Text = "0"
|
ObjVentas.Commit()
|
||||||
|
Alert("El porcentaje de comisiones se guardó correctamente.", TipoMensaje.MsgInformacion)
|
||||||
End If
|
End If
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
|
CargaDatos()
|
||||||
|
UPDatos.Update()
|
||||||
UpPorcentajeComisiones.Update()
|
UpPorcentajeComisiones.Update()
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -126,6 +126,9 @@
|
|||||||
<asp:HyperLink ID="HLGanancia" Target="_blank" Text='<%# Eval("ComisionGanancia", "{0:N2}") %>' runat="server" />
|
<asp:HyperLink ID="HLGanancia" Target="_blank" Text='<%# Eval("ComisionGanancia", "{0:N2}") %>' runat="server" />
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</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" />--%>
|
<%--<asp:BoundField HeaderText="Comision Ganancia" DataField="ComisionGanancia" DataFormatString="{0:N2}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />--%>
|
||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
|
|||||||
Reference in New Issue
Block a user