This commit is contained in:
2023-02-18 13:41:10 -07:00
3 changed files with 35 additions and 42 deletions

View File

@@ -179,16 +179,20 @@
<div class="portlet-body formnombottom">
<asp:GridView ID="GvCompProductores" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="True">
AutoGenerateColumns="False" AllowPaging="False">
<Columns>
<asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" />
<asp:BoundField DataField="GPO" HeaderText="Prod/Serv" />
<asp:BoundField DataFormatString="{0:n}" DataField="Cantidad" ItemStyle-CssClass="margenbound" HeaderText="Cantidad(kg)" />
<asp:BoundField DataFormatString="{0:c}" DataField="SubTotal" ItemStyle-CssClass="margenbound" HeaderText="Importe" />
<asp:BoundField DataFormatString="{0:c}" DataField="PUPromedioKG" ItemStyle-CssClass="margenbound" HeaderText="Promedio/kg" />
<asp:BoundField DataFormatString="{0:c}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
<asp:BoundField DataFormatString="{0:c}" DataField="Abonado" ItemStyle-CssClass="margenbound" HeaderText="Abonado" />
<%--TODO: Esto se puede meter en el stored procedured, pero me da cosa moverle :S--%>
<asp:TemplateField ItemStyle-CssClass="margenbound" HeaderText="P. Promedio">
<ItemTemplate>
<%--TODO: Esto puede tronar si el valor es DBNull --%>
<%# If(Convert.ToDecimal(Eval("Cantidad")) = 0, 0.ToString("C"), (Convert.ToDecimal(Eval("SubTotal")) / Convert.ToInt32(Eval("Cantidad"))).ToString("C")) %>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:BoundField DataFormatString="{0:c}" DataField="PUPromedioKG" ItemStyle-CssClass="margenbound" HeaderText="Promedio/kg" />--%>
</Columns>
<FooterStyle CssClass="Totales"/>
</asp:GridView>
</div>
</ContentTemplate>
@@ -342,7 +346,8 @@
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns>
<asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" />
<asp:BoundField DataFormatString="{0:c}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
<asp:BoundField DataFormatString="{0:c}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
<asp:BoundField DataFormatString="{0:c}" DataField="Abonado" ItemStyle-CssClass="margenbound" HeaderText="Abonado" />
</Columns>
</asp:GridView>
</div>

View File

@@ -32,7 +32,6 @@ Partial Class General_RepIndicadorResumen
Dim ObjVentas As New ClsVentas
Dim ObjCompras As New ClsCompras
Dim ObjMovtos As New ClsMovimientos
Dim ObjCitrus As New ClsCGame
Dim Grupo As Integer = 28 'Clasificación - PS
@@ -41,9 +40,14 @@ Partial Class General_RepIndicadorResumen
GvVxP.DataSource = ObjVentas.DtResultados
End If
If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1,
UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveProveedorClasificacion:=192) Then
GvCompProductores.DataSource = ObjCompras.DtResultados.FiltraParametros("", "Cantidad DESC")
End If
If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text, UsuarioActual.CveUsuario, DdlSubProyecto.SelectedValue.ToEntero) Then
'Compras Productores
GvCompProductores.DataSource = ObjCitrus.DTSetResultados.Tables(0).FiltraParametros("", "RazonSocial ASC")
'GvCompProductores.DataSource = ObjCitrus.DTSetResultados.Tables(0).FiltraParametros("", "RazonSocial ASC")
'CxP Productores
GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(1).FiltraParametros("", "CveMoneda,Saldo DESC")
'CxP NO productores
@@ -55,6 +59,7 @@ Partial Class General_RepIndicadorResumen
End If
ObjVentas.Dispose()
ObjCompras.Dispose()
ObjCitrus.Dispose()
GvVxP.DataBind()
@@ -167,28 +172,11 @@ Partial Class General_RepIndicadorResumen
End Sub
Dim CompProductoresTotales As Decimal() = New Decimal(5 - 1) {}
Protected Sub GvCompProductores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompProductores.RowDataBound
'Esto tambien se podría meter en el Stored Procedure
If e.Row.RowType = DataControlRowType.DataRow Then
CompProductoresTotales(0) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Cantidad"), 0))
CompProductoresTotales(1) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "SubTotal"), 0))
CompProductoresTotales(2) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "PUPromedioKG"), 0))
CompProductoresTotales(3) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Saldo"), 0))
CompProductoresTotales(4) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Abonado"), 0))
ElseIf e.Row.RowType = DataControlRowType.Footer Then
'Movemos el pie a la primera fila de la tabla
Dim footerRow As GridViewRow = e.Row
GvCompProductores.Controls(0).Controls.Remove(footerRow)
GvCompProductores.Controls(0).Controls.AddAt(1, footerRow)
'Ahora se registran los datos
e.Row.Cells(0).Text = "Totales"
e.Row.Cells(1).Text = CompProductoresTotales(0).ToString("N")
e.Row.Cells(2).Text = CompProductoresTotales(1).ToString("C")
e.Row.Cells(3).Text = (CompProductoresTotales(2) / GvCompProductores.Rows.Count).ToString("C") 'Promedio
e.Row.Cells(4).Text = CompProductoresTotales(3).ToString("C")
e.Row.Cells(5).Text = CompProductoresTotales(4).ToString("C")
For i As Integer = 1 To e.Row.Cells.Count - 1
e.Row.Cells(i).CssClass = "margenbound"
Next
If e.Row.DBCampo("Orden") = "00ND" Then
e.Row.CssClass = "Totales"
e.Row.Cells(0).Text = "Total " + e.Row.DBCampo("Moneda")
End If
End If
End Sub
Protected Sub GvComprasAcreed_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompAcreed.RowDataBound
@@ -257,13 +245,15 @@ Partial Class General_RepIndicadorResumen
DtCompProductores.Columns.Add("UnidadC")
DtCompProductores.Columns.Add("UnidadI")
For Each Dr As DataRow In GvCompProductores.DataSource.Rows
Dim Row = DtCompProductores.NewRow()
Row("Texto") = Dr("RazonSocial").ToString
Row("Cantidad") = Dr("Cantidad").ToString.FormatoNumero
Row("Importe") = Dr("SubTotal").ToString.FormatoNumero
Row("UnidadC") = "Kg"
Row("UnidadI") = "MXN"
DtCompProductores.Rows.Add(Row)
If Not Dr("Orden").ToString = "00ND" Then
Dim Row = DtCompProductores.NewRow()
Row("Texto") = Dr("GPO").ToString
Row("Cantidad") = Dr("Cantidad").ToString.FormatoNumero
Row("Importe") = Dr("SubTotal").ToString.FormatoNumero
Row("UnidadC") = "Kg"
Row("UnidadI") = "MXN"
DtCompProductores.Rows.Add(Row)
End If
Next
Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()}
Dim group_comp_productores = comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {

View File

@@ -274,18 +274,16 @@
<asp:UpdatePanel ID="UpBusqueda" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" style="padding-bottom: 13px;">
<div class="col-md-3" runat="server">
</div>
<div class="row" style="display:flex; justify-content:flex-end; padding-bottom: 12px; padding-right: 15px;">
<asp:UpdatePanel class="col-md-4" ID="UPPIndicador" UpdateMode="Conditional" runat="server">
<asp:UpdatePanel class="col-md-4" style="min-width: 450px;" ID="UPPIndicador" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div id="DivIndicadores" align="Right" runat="server" visible="false">
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="col-md-4">
<div style="display:flex; align-items:flex-end;">
<div id="DivPorAtender" runat="server" visible="false">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvPorAtender.ClientID) %>" style="display: inline-block; width: 200px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvPorAtender.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>