se agregó otra tabla para juntar varios costos indirectos en un solo flete

This commit is contained in:
Antonio Gonzalez
2020-09-29 18:42:01 -07:00
parent ede6f99109
commit 1ebf415d92
4 changed files with 88 additions and 32 deletions

View File

@@ -4543,6 +4543,31 @@ Public Class ClsInventarios
Return Retorno
End Function
Public Function GetFletesRep(CveEmpresa As Integer, Optional CveFlete As Integer = -1, Optional Folio As String = "-1", Optional CveProveedor As Integer = -1,
Optional CveOC As Integer = -1, Optional CveCompra As Integer = -1, Optional FechaInicio As Date = MinFecha,
Optional FechaFin As Date = MaxFecha, Optional TipoGasto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_FletesRep")
With SqlAdapter.SelectCommand.Parameters
.Add("@Folio", SqlDbType.VarChar).Value = Folio
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveOC", SqlDbType.Int).Value = CveOC
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveFlete", SqlDbType.Int).Value = CveFlete
.Add("@TipoGasto", SqlDbType.Int).Value = TipoGasto
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el reporte de flete.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function RecepcionAlmacenFleteGet(CveFlete As Integer, CveOrdenCompra As Integer, CveCompra As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_RecepcionAlmacenFleteGet")

View File

@@ -120,7 +120,7 @@
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Compras</span>
<span class="caption-subject bold uppercase">COMPRAS DE PRODUCTOS</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
@@ -133,7 +133,7 @@
<Columns>
<asp:BoundField HeaderText="Proveedor" DataField="RazonSocial" ItemStyle-Width="30%" />
<asp:HyperLinkField HeaderText="Serie-Folio" DataNavigateUrlFields="CveCompra" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataTextField="SerieFolio" ItemStyle-Width="10%" Target="_blank" />
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:n2}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total Productos" DataField="Total" DataFormatString="{0:n2}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Moneda" ItemStyle-HorizontalAlign="Center" DataField="Abreviatura" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="TC" ItemStyle-HorizontalAlign="Center" DataField="TipoCambio" ItemStyle-Width="5%" />
<%--<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" >
@@ -162,7 +162,7 @@
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Compras Gasto</span>
<span class="caption-subject bold uppercase">Costo Indirecto</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
@@ -185,13 +185,13 @@
<asp:BoundField HeaderText="Tipo" DataField="TipoDocto" DataFormatString="{0:d}" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Descripción" DataField="Descripcion" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Importe" DataField="SubTotal" DataFormatString="{0:n2}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total Indirecto" DataField="SubTotal" DataFormatString="{0:n2}" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Moneda" DataField="Abreviatura" ItemStyle-Width="10%" />
<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<%--<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>--%>
</Columns>
</asp:GridView>
</div>

View File

@@ -17,9 +17,9 @@
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
<%--<li>
<asp:LinkButton ID="ImgAdd" PostBackUrl="/Inventarios/Fletes.aspx" CommandArgument="-1" runat="server"><i class="fa fa-plus-circle"></i> Registrar Nuevo Flete</asp:LinkButton>
</li>
</li>--%>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
@@ -42,12 +42,12 @@
<asp:TextBox runat="server" Width="80px" ID="TxtFolio"></asp:TextBox>
</div>
<div class="col-md-1" style="max-width: 100px;">Proveedor:</div>
<div class="col-md-3">
<div class="col-sm-2">
<asp:DropDownList runat="server" ID="DdlProveedor" Width="100%" DataTextField="RazonSocial" DataValueField="CveProveedor" CssClass="select2me"></asp:DropDownList>
</div>
<div class="col-md-1" style="max-width: 90px">Fecha Inicio:</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="margin-bottom: -15px;">
<div class="col-md-1" style="max-width: 120px">Fecha Inicio:</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="padding:unset" >
<asp:TextBox ID="TxtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Onblur="Recalculafechapago();" ValidationGroup="GrpGuardar" Width="80px" ClientIDMode="Static"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="ImgFechaI" class="btn default"> <i class="fa fa-calendar"></i> </asp:LinkButton>
@@ -58,9 +58,9 @@
<ajax:ValidatorCalloutExtender ID="VCOFechaI" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="max-width: 70px">Fecha Fin:</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="margin-bottom: -15px;">
<div class="col-md-1" style="max-width: 120px">Fecha Fin:</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="padding:unset" >
<asp:TextBox ID="TxtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Onblur="Recalculafechapago();" ValidationGroup="GrpGuardar" Width="80px" ClientIDMode="Static"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="ImgFechaF" class="btn default"> <i class="fa fa-calendar"></i> </asp:LinkButton>
@@ -71,6 +71,14 @@
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-1" style="max-width: 70px;">Opción:</div>
<div class="col-sm-2">
<asp:DropDownList runat="server" ID="DdlTipoGasto" Width="100%" CssClass="select2me">
<asp:ListItem Text="Todo" Value="-1" />
<asp:ListItem Text="Costo Indirectos multiples facturas" Value="1" Selected="True" />
<asp:ListItem Text="Costo Indirecto en misma factura" Value="2" />
</asp:DropDownList>
</div>
</div>
</div>
</div>
@@ -81,8 +89,8 @@
<table class="table Widthall ">
<tr>
<td style="font-size: 14px; width: 20%; border-right: 3px solid white;"></td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 35%; border-right: 3px solid white;">Facturas de Costo Indirecto</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 45%; border-right: 3px solid white;">Documento (OC/Compra)</td>
<%--<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 35%; border-right: 3px solid white;">Facturas de Costo Indirecto</td>
<td class="dataTables_scrollHead text-center bold" style="font-size: 14px; width: 45%; border-right: 3px solid white;">Documento (OC/Compra)</td>--%>
</tr>
</table>
<a target="_blank" href="#"></a>
@@ -91,17 +99,33 @@
<div class="col-md-12">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No hay fletes" ToolTip="Fletes" OnRowDataBound="GvDatos_RowDataBound" CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" GridLines="None">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No hay fletes" ToolTip="Fletes" OnRowDataBound="GvDatos_RowDataBound" CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" GridLines="None" DataKeyNames="CveFlete">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" Target="_blank" DataTextField="RazonSocial" ItemStyle-Width="20%" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="Folio" Target="_blank" ItemStyle-HorizontalAlign="Center" DataTextField="Folio" ItemStyle-Width="5%" DataNavigateUrlFormatString="/Inventarios/Fletes.aspx?CveFlete={0}" DataNavigateUrlFields="CveFlete" />
<asp:HyperLinkField HeaderText="Fecha" Target="_blank" DataTextField="Fecha" ItemStyle-HorizontalAlign="Center" DataTextFormatString="{0:d}" ItemStyle-Width="10%" DataNavigateUrlFormatString="/Inventarios/Fletes.aspx?CveFlete={0}" DataNavigateUrlFields="CveFlete" />
<asp:HyperLinkField HeaderText="Descripción" Target="_blank" DataTextField="Descripcion" ItemStyle-Width="20%" DataNavigateUrlFormatString="/Inventarios/Fletes.aspx?CveFlete={0}" DataNavigateUrlFields="CveFlete" />
<asp:BoundField HeaderText="Folio" DataField="FolioDocumento" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:HyperLink ID="HlkFolio" runat="server" Text='<%# Eval("Folio")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
<asp:HyperLink ID="HlkFecha" runat="server" Text='<%# Eval("Fecha", "{0:dd/M/yyyy}")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Descripción">
<ItemTemplate>
<asp:HyperLink ID="HlkDescripcion" runat="server" Text='<%# Eval("Descripcion")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:HyperLinkField HeaderText="Folio" ID="HlkFolio" runat="server" Target="_blank" ItemStyle-HorizontalAlign="Center" DataTextField="Folio" ItemStyle-Width="5%" DataNavigateUrlFormatString="/Inventarios/Fletes.aspx?CveFlete={0}" DataNavigateUrlFields="CveFlete" />
<asp:HyperLinkField HeaderText="Fecha" ID="HlkFecha" runat="server" Target="_blank" DataTextField="Fecha" ItemStyle-HorizontalAlign="Center" DataTextFormatString="{0:d}" ItemStyle-Width="10%" DataNavigateUrlFormatString="/Inventarios/Fletes.aspx?CveFlete={0}" DataNavigateUrlFields="CveFlete" />
<asp:HyperLinkField HeaderText="Descripción" ID="HlkDescripcion" runat="server" Target="_blank" DataTextField="Descripcion" ItemStyle-Width="20%" DataNavigateUrlFormatString="/Inventarios/Fletes.aspx?CveFlete={0}" DataNavigateUrlFields="CveFlete" />--%>
<asp:BoundField HeaderText="Total Productos" DataField="Importe" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total Indirectos" DataField="Costo" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total" DataField="General" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<%--<asp:BoundField HeaderText="Folio" DataField="FolioDocumento" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Fecha" DataField="FechaDocumento" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Descripción" DataField="DescripcionDocumento" ItemStyle-Width="20%" />
<asp:BoundField HeaderText="Importe" DataField="TotalDocumento" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Importe" DataField="TotalDocumento" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" ItemStyle-Width="5%" />--%>
</Columns>
</asp:GridView>
</ContentTemplate>

View File

@@ -40,7 +40,8 @@ Partial Class Compras_RepFletes
Private Sub CargaDatos()
Dim ObjInv As New ClsInventarios
If TxtFolio.Text <> "" Then TxtFechaI.Text = MinFecha.ToShortDateString : TxtFechaF.Text = MaxFecha.ToShortDateString
If ObjInv.GetFletes(UsuarioActual.CveEmpresa, -1, If(TxtFolio.Text = "", "-1", TxtFolio.Text), DdlProveedor.SelectedValue.ToString.ToEntero, -1, -1, TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate) Then
If ObjInv.GetFletesRep(UsuarioActual.CveEmpresa, -1, If(TxtFolio.Text = "", "-1", TxtFolio.Text), DdlProveedor.SelectedValue.ToString.ToEntero, -1, -1,
TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate, TipoGasto:=DdlTipoGasto.SelectedValue.ToEntero()) Then
DtFletes = ObjInv.DtResultados
End If
ObjInv.Dispose()
@@ -55,13 +56,19 @@ Partial Class Compras_RepFletes
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Modalidad = e.Row.DBCampo("Modalidad").ToString.ToEntero
Dim Liga = If(Modalidad = 1, "/OC/OC.aspx?OC", "/Compras/Compras.aspx?CveCompra")
Dim TipoCon As Integer = e.Row.DBCampo("TipoCon").ToString.ToEntero
Dim CveFlete As Integer = e.Row.DBCampo("CveFlete").ToEntero()
Dim Url As String = If(TipoCon = -1, String.Format("/Compras/Compras.aspx?CveCompra={0}", CveFlete), String.Format("/Inventarios/Fletes.aspx?CveFlete={0}", CveFlete))
e.Row.FCHyperLink("HlkFolio").NavigateUrl = Url
e.Row.FCHyperLink("HlkFecha").NavigateUrl = Url
e.Row.FCHyperLink("HlkDescripcion").NavigateUrl = Url
'Dim Modalidad = e.Row.DBCampo("Modalidad").ToString.ToEntero
'Dim Liga = If(Modalidad = 1, "/OC/OC.aspx?OC", "/Compras/Compras.aspx?CveCompra")
e.Row.Cells(4).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{If(Modalidad = 1, "OC: ", "Compra: ")}{e.Row.DBCampo("FolioDocumento")}</a>"
e.Row.Cells(5).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{e.Row.DBCampo("FechaDocumento").ToDate.ToShortDateString}</a>"
e.Row.Cells(6).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{e.Row.DBCampo("DescripcionDocumento")}</a>"
e.Row.Cells(7).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{e.Row.DBCampo("TotalDocumento")}</a>"
'e.Row.Cells(4).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{If(Modalidad = 1, "OC: ", "Compra: ")}{e.Row.DBCampo("FolioDocumento")}</a>"
'e.Row.Cells(5).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{e.Row.DBCampo("FechaDocumento").ToDate.ToShortDateString}</a>"
'e.Row.Cells(6).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{e.Row.DBCampo("DescripcionDocumento")}</a>"
'e.Row.Cells(7).Text = $"<a target='_blank' href='{Liga}={e.Row.DBCampo("CveDocumento")}'>{e.Row.DBCampo("TotalDocumento")}</a>"
End If
End Sub