Compras prodcutos servicios agrupador

This commit is contained in:
rakcsle
2021-11-08 10:49:08 -07:00
parent ab2c44d7ca
commit 97e0543c81
8 changed files with 285 additions and 95 deletions

View File

@@ -75,23 +75,29 @@
Reporte de Inventario Fisico
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkPDF" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcel" runat="server"><i class="fa fa-ad-excel"></i> Exportar a Excel Productos que Faltan </asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcel2" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel Productos que Sobran</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcelProdcutosCoinciden" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel Productos Coincidentes</asp:LinkButton>
</li>
<asp:UpdatePanel runat="server" id="UPAcciones" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkPDF" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcel" runat="server"><i class="fa fa-ad-excel"></i> Exportar a Excel Productos que Faltan </asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcel2" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel Productos que Sobran</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="ImgExcelProdcutosCoinciden" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel Productos Coincidentes</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkDescarExcelGrupos" runat="server"><i class="fa fa-ad-excel"></i> Exporta a Excel </asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="btnFin" runat="server" Text="Finalizar Inventario" data-toggle="confirmation" data-popout="true" data-original-title="Finalizar el inventario" data-btn-ok-label="si" />
</li>
@@ -104,6 +110,11 @@
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnFin" />
<asp:PostBackTrigger ControlID="LnkPDF" />
<asp:PostBackTrigger ControlID="ImgExcel" />
<asp:PostBackTrigger ControlID="ImgExcel2" />
<asp:PostBackTrigger ControlID="ImgExcelProdcutosCoinciden" />
<asp:PostBackTrigger ControlID="LnkDescarExcelGrupos" />
</Triggers>
</asp:UpdatePanel>
@@ -125,6 +136,16 @@
<asp:ListItem Text="Cantidad" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 truncate">Vista de Resultados:</div>
<div class="col-md-1">
<asp:DropDownList ID="DdlVista" CssClass="form-control select2me" runat="server" AppendDataBoundItems="true" Width="100%">
<asp:ListItem Text="Ver por Detalle" Value="1"></asp:ListItem>
<asp:ListItem Text="Ver por Grupos" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
@@ -208,7 +229,13 @@
</asp:UpdatePanel>
<br />
<asp:UpdatePanel ID="UPAnomalias" UpdateMode="Conditional" runat="server">
<asp:UpdatePanel runat="server" ID="UpGeneral" UpdateMode="Conditional">
<ContentTemplate>
<div runat="server" id="DVNormal">
<asp:UpdatePanel ID="UPAnomalias" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
@@ -248,8 +275,8 @@
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-HorizontalAlign="Left" DataFormatString="{0:d}" />
<%--<asp:BoundField HeaderText="Existencia" DataField="CantidadAlmacen" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />--%>
<asp:BoundField HeaderText="Existencia" DataField="CantidadReal" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Existencia" DataField="CantidadAlmacen" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
<%--<asp:BoundField HeaderText="Existencia" DataField="CantidadReal" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />--%>
<asp:BoundField HeaderText="Inv. Físico" DataField="CantidadInventarioFisico" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Diferencia" DataField="Diferencia" DataFormatString="{0:#,###.##}" ItemStyle-Font-Bold="true" />
<asp:BoundField HeaderText="Costo" DataField="Costo" DataFormatString="{0:#,##0.00}" ItemStyle-HorizontalAlign="Right" />
@@ -257,8 +284,8 @@
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<br />
<asp:UpdatePanel ID="UpdateGvS" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
@@ -298,7 +325,7 @@
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-HorizontalAlign="Left" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Existencia" DataField="CantidadReal" ItemStyle-HorizontalAlign="Right" />
<%--<asp:BoundField HeaderText="Existencia" DataField="CantidadReal" ItemStyle-HorizontalAlign="Right" />--%>
<asp:BoundField HeaderText="Inv. Físico" DataField="CantidadInventarioFisico" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Diferencia" DataField="Diferencia" DataFormatString="{0:#,###.##}" ItemStyle-Font-Bold="true" />
<asp:BoundField HeaderText="Costo" DataField="Costo" DataFormatString="{0:#,##0.00}" ItemStyle-HorizontalAlign="Right" />
@@ -342,7 +369,7 @@
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-HorizontalAlign="Left" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Existencia" DataField="CantidadReal" ItemStyle-HorizontalAlign="Right" />
<%--<asp:BoundField HeaderText="Existencia" DataField="CantidadReal" ItemStyle-HorizontalAlign="Right" />--%>
<asp:BoundField HeaderText="Inv. Físico" DataField="CantidadInventarioFisico" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Diferencia" DataField="Diferencia" DataFormatString="{0:#,###.##}" ItemStyle-Font-Bold="true" />
<asp:BoundField HeaderText="Costo" DataField="Costo" DataFormatString="{0:#,##0.00}" ItemStyle-HorizontalAlign="Right" />
@@ -384,6 +411,70 @@
</div>
</div>
</div>
</div>
<div runat="server" id="DVGrupos" visible="false" >
<div class="col-md-12">
<div class="row">
<div class="col-md-2" align="left" id="div2" runat="server">
<asp:Label runat="server">Registros Productos que Faltan: <b><asp:Literal ID="LtlGrupos1" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-2" align="left" id="div4" runat="server">
<asp:Label runat="server">Registros Productos que Sobran: <b><asp:Literal ID="LtlGrupos2" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-2" align="left" id="div5" runat="server">
<asp:Label runat="server">Registros Productos Coincidentes: <b><asp:Literal ID="LtlGrupos3" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-6" align="right" id="div3" runat="server">
<input type="text" id="TxtBusqueda4" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda4','{0}')", GvGrupos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda4','{0}')", GvGrupos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
<asp:GridView ID="GvGrupos" data-sort="true" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False"
CssClass="table table-striped table-hover Widthall ScrollAD" Style="text-align: center;"
GridLines="None" DataKeyNames="CvePS,PS,Grupo,Orden">
<Columns>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<asp:CheckBox ID="ChkAllFaltante" runat="server"/>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="ChkPSFaltante" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Código Barras" DataField="CodigoBarras" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Sección Almacén" DataField="SeccionAlmacen"/>
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-HorizontalAlign="Left" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Existencia" DataField="CantidadAlmacen" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Inv. Físico" DataField="CantidadInventarioFisico" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Diferencia" DataField="Diferencia" DataFormatString="{0:#,###.##}" ItemStyle-Font-Bold="true" />
<asp:BoundField HeaderText="Costo" DataField="Costo" DataFormatString="{0:#,##0.00}" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -97,11 +97,11 @@ Partial Class Inventarios_RepAnomalias
End If
If EsAvance Then
If Inventario.GetInventarioFisicoResultadosAvance(CveInventarioFisico, UsuarioActual.CveEmpresa, DdlGPO.SelectedValue.ToString.ToEntero) Then
If Inventario.GetInventarioFisicoResultadosAvance(CveInventarioFisico, UsuarioActual.CveEmpresa, DdlGPO.SelectedValue.ToString.ToEntero, DdlVista.SelectedValue.ToEntero) Then
dt = Inventario.DtResultados
End If
Else
If Inventario.GetInventarioFisicoResultados(CveInventarioFisico, UsuarioActual.CveEmpresa, DdlGPO.SelectedValue.ToString.ToEntero) Then
If Inventario.GetInventarioFisicoResultados(CveInventarioFisico, UsuarioActual.CveEmpresa, DdlGPO.SelectedValue.ToString.ToEntero, DdlVista.SelectedValue.ToEntero) Then
dt = Inventario.DtResultados
End If
End If
@@ -189,61 +189,103 @@ Partial Class Inventarios_RepAnomalias
End If
End If
End If
Inventario.Dispose()
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvS.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvF.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvC.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If DdlVista.SelectedValue.ToEntero = 1 Then
GvS.DataSource = dt.FiltraParametros("Diferencia < 0")
Dim DtS As DataTable = dt.FiltraParametros("Diferencia < 0")
GvS.DataBind()
BanderaSerieLoteCad(GvS, DtS)
DVNormal.Visible = True
DVGrupos.Visible = False
GvF.DataSource = dt.FiltraParametros("Diferencia > 0")
Dim DtF As DataTable = dt.FiltraParametros("Diferencia > 0")
GvF.DataBind()
BanderaSerieLoteCad(GvF, DtF)
LnkPDF.Visible = True
ImgExcel.Visible = True
ImgExcel2.Visible = True
ImgExcelProdcutosCoinciden.Visible = True
LnkDescarExcelGrupos.Visible = False
Dim DtC As DataTable = dt.FiltraParametros("Diferencia = 0")
GvC.DataSource = DtC
GvC.DataBind()
BanderaSerieLoteCad(GvC, DtC)
Dim Script = ""
If (GvF.Rows.Count > 0) Then
GvF.UseAccessibleHeader = True
GvF.HeaderRow.TableSection = TableRowSection.TableHeader
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvS.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvF.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvC.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
GvS.DataSource = dt.FiltraParametros("Diferencia < 0")
Dim DtS As DataTable = dt.FiltraParametros("Diferencia < 0")
GvS.DataBind()
BanderaSerieLoteCad(GvS, DtS)
GvF.DataSource = dt.FiltraParametros("Diferencia > 0")
Dim DtF As DataTable = dt.FiltraParametros("Diferencia > 0")
GvF.DataBind()
BanderaSerieLoteCad(GvF, DtF)
Dim DtC As DataTable = dt.FiltraParametros("Diferencia = 0")
GvC.DataSource = DtC
GvC.DataBind()
BanderaSerieLoteCad(GvC, DtC)
If (GvF.Rows.Count > 0) Then
GvF.UseAccessibleHeader = True
GvF.HeaderRow.TableSection = TableRowSection.TableHeader
divRegistradosFaltan.Visible = True
LtlTotalRegistrosFaltan.Text = GvF.Rows.Count.ToString
End If
If (GvS.Rows.Count > 0) Then
GvS.UseAccessibleHeader = True
GvS.HeaderRow.TableSection = TableRowSection.TableHeader
divRegistradosSobran.Visible = True
LtlTotalRegistrosSobran.Text = GvS.Rows.Count.ToString
End If
If (GvC.Rows.Count > 0) Then
GvC.UseAccessibleHeader = True
GvC.HeaderRow.TableSection = TableRowSection.TableHeader
divRegistradosCoinciden.Visible = True
LtlCoincidentes.Text = GvC.Rows.Count.ToString
End If
PSIguales()
UPAnomalias.Update()
UpdateGvS.Update()
UPDatos.Update()
Else
DVNormal.Visible = False
DVGrupos.Visible = True
LnkPDF.Visible = False
ImgExcel.Visible = False
ImgExcel2.Visible = False
ImgExcelProdcutosCoinciden.Visible = False
LnkDescarExcelGrupos.Visible = True
GvGrupos.DataSource = dt
GvGrupos.DataBind()
LtlGrupos1.Text = dt.FiltraParametros("Orden = 1 and CvePS > 0").Rows.Count.ToString
LtlGrupos2.Text = dt.FiltraParametros("Orden = 2 and CvePS > 0").Rows.Count.ToString
LtlGrupos3.Text = dt.FiltraParametros("Orden = 3 and CvePS > 0").Rows.Count.ToString
PSIguales()
divRegistradosFaltan.Visible = True
LtlTotalRegistrosFaltan.Text = GvF.Rows.Count.ToString
End If
If (GvS.Rows.Count > 0) Then
GvS.UseAccessibleHeader = True
GvS.HeaderRow.TableSection = TableRowSection.TableHeader
divRegistradosSobran.Visible = True
LtlTotalRegistrosSobran.Text = GvS.Rows.Count.ToString
End If
UpGeneral.Update()
UPAcciones.Update()
If (GvC.Rows.Count > 0) Then
GvC.UseAccessibleHeader = True
GvC.HeaderRow.TableSection = TableRowSection.TableHeader
divRegistradosCoinciden.Visible = True
LtlCoincidentes.Text = GvC.Rows.Count.ToString
End If
PSIguales()
RegistraScript(Script)
UPAnomalias.Update()
UpdateGvS.Update()
UPDatos.Update()
End Sub
#End Region
@@ -274,6 +316,7 @@ Partial Class Inventarios_RepAnomalias
Protected Sub GVF_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvF.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Costo") = "-1" Then
e.Row.Cells(8).Text = "0"
@@ -288,10 +331,12 @@ Partial Class Inventarios_RepAnomalias
e.Row.FCCheckBox("ChkAllFaltante").Attributes.Add("onclick", "SeleccionarTodosFaltante(this);")
End If
End If
End Sub
Protected Sub GVS_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvS.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Costo") = "-1" Then
e.Row.Cells(8).Text = "0"
@@ -306,6 +351,7 @@ Partial Class Inventarios_RepAnomalias
e.Row.FCCheckBox("ChkAllSobrante").Attributes.Add("onclick", "SeleccionarTodosSobrante(this);")
End If
End If
End Sub
#Region " IMPRIMIR "
@@ -386,6 +432,11 @@ Partial Class Inventarios_RepAnomalias
GvC.ExportToExcel("Reporte de Inventario Fisico - Productos Coincidentes " & Now.ToShortDateString)
End Sub
Private Sub LnkDescarExcelGrupos_Click(sender As Object, e As EventArgs) Handles LnkDescarExcelGrupos.Click
GvGrupos.ExportToExcel("Reporte de Inventario Fisico" & Now.ToShortDateString)
End Sub
#End Region
Private Sub BanderaSerieLoteCad(Gv As GridView, resultado As DataTable)
@@ -531,20 +582,66 @@ Partial Class Inventarios_RepAnomalias
Private Sub PSIguales()
Dim contadorF As Integer = 0
Dim contadorS As Integer = 0
For Each dtF As GridViewRow In GvF.Rows
contadorS = 0
For Each dtS As GridViewRow In GvS.Rows
If dtS.DataKey("CvePS") = dtF.DataKey("CvePS") Then
GvS.Rows(contadorS).BackColor = Drawing.Color.FromArgb(202, 52, 52)
GvF.Rows(contadorF).BackColor = Drawing.Color.FromArgb(202, 52, 52)
End If
contadorS += 1
If DdlVista.SelectedValue.ToEntero = 1 Then
For Each dtF As GridViewRow In GvF.Rows
contadorS = 0
For Each dtS As GridViewRow In GvS.Rows
If dtS.DataKey("CvePS") = dtF.DataKey("CvePS") Then
GvS.Rows(contadorS).BackColor = Drawing.Color.FromArgb(202, 52, 52)
GvF.Rows(contadorF).BackColor = Drawing.Color.FromArgb(202, 52, 52)
End If
contadorS += 1
Next
contadorF += 1
Next
contadorF += 1
Next
Else
For Each dtF As GridViewRow In GvGrupos.Rows
contadorS = 0
If dtF.DataKey("Orden").ToEntero = 1 And dtF.DataKey("CvePS").ToEntero > 0 Then
For Each dtS As GridViewRow In GvGrupos.Rows
If dtS.DataKey("Orden").ToEntero = 2 Then
If dtS.DataKey("CvePS") = dtF.DataKey("CvePS") Then
GvGrupos.Rows(contadorS).BackColor = Drawing.Color.FromArgb(202, 52, 52)
GvGrupos.Rows(contadorF).BackColor = Drawing.Color.FromArgb(202, 52, 52)
End If
End If
contadorS += 1
Next
End If
contadorF += 1
Next
End If
End Sub
Private Sub GvGrupos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvGrupos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataKey("CvePS").ToString.ToEntero = 0 Then
e.Row.CssClass = "SubTotales"
e.Row.Cells(1).Text = e.Row.DataKey("Grupo").ToString
End If
End If
End Sub
End Class