--pantalla de facturacion global
This commit is contained in:
287
Ventas/FacturacionGlobal.aspx
Normal file
287
Ventas/FacturacionGlobal.aspx
Normal file
@@ -0,0 +1,287 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="FacturacionGlobal.aspx.vb" Inherits="Ventas_FacturacionGlobal" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
.v-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.Widthall {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollHeadInner {
|
||||
width: 100% !important;
|
||||
background-color: #dddddd;
|
||||
padding-left: 0px !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollFoot {
|
||||
display: none;
|
||||
position: static;
|
||||
}
|
||||
|
||||
.table-scrollable {
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
.dataTables_scroll {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.table.dataTable {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollBody table th {
|
||||
padding: 0px !important;
|
||||
padding-right: 4px !important;
|
||||
padding-left: 4px !important;
|
||||
}
|
||||
|
||||
.sinlink td a {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
color: black;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.white a {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.select2 .select2-selection__rendered {
|
||||
line-height: 1;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.select2 .select2-selection--multiple {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
min-height: 20px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.select2-selection__rendered {
|
||||
margin-top: 0px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.select2-selection {
|
||||
margin-top: 0px;
|
||||
height: 31px;
|
||||
}
|
||||
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border: none;
|
||||
outline: 0;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Facturación global
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter" style="">
|
||||
<div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px; position: relative;">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" OnClick="BtnConsultar_Click" ValidationGroup="Valida" />
|
||||
<a href="javascript:;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a>
|
||||
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row v-center">
|
||||
<label class="col-md-1">Sucursal: </label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlSubProyecto" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server"></asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Fecha Inicial:</label>
|
||||
<div class="col-md-1">
|
||||
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 140px !important; padding: 0px;">
|
||||
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Width="100px"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Fecha Final:</label>
|
||||
<div class="col-md-1">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 140px !important; padding: 0px;">
|
||||
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Width="100px"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Cliente:</label>
|
||||
<div class="col-md-2">
|
||||
PUBLICO GENERAL
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<div class="portlet light xspadding traspasorow bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<span class="caption-subject bold uppercase" style="line-height: 1;">Remisiones por facturar</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
<div class="row" style="margin-left: 0px; text-align: right" align="left">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ninguna remisión pendiente por facturar" DataKeyNames="CveVenta"
|
||||
ToolTip="Remisiones sin Facturar"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
|
||||
data-sort="true" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="center" HeaderText="" ItemStyle-Width="10%">
|
||||
<HeaderTemplate>
|
||||
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClick" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox runat="server" ID="chkDis" Visible="false" CssClass="ChkAllEvt" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField HeaderText="Folio" ItemStyle-Width="100px" DataTextField="Folio" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" Target="_blank" />
|
||||
<asp:HyperLinkField HeaderText="Fecha" ItemStyle-Width="100px" DataTextField="Fecha" DataTextFormatString="{0:d}" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" />
|
||||
<asp:BoundField DataField="SubTotal" HeaderText="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="Descuento" HeaderText="Descuento" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="IVA" HeaderText="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="10%">
|
||||
<HeaderTemplate>
|
||||
<asp:Label Text="Total" runat="server" CausesValidation="false"> </asp:Label>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") & " " & Eval("Abreviatura").ToString %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
<RowStyle CssClass="Texto" />
|
||||
<AlternatingRowStyle CssClass="TextoAlterno" />
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-bottom: 15px; display: flex; align-items: flex-end; justify-content: flex-end;">
|
||||
<asp:UpdatePanel ID="UpFacturar" runat="server" class="portlet light xspadding bordered " style="min-width: 100%;" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Facturación </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<div class="row v-center">
|
||||
<label class="col-md-3">Periodo: </label>
|
||||
<div class="col-md-9">
|
||||
<asp:DropDownList ID="DdlPeriodo" DataTextField="Descripcion" DataValueField="CveSATPeriodicidad" CssClass="ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlPeriodo_SelectedIndexChanged"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVPeriodo" runat="server" InitialValue="-1" ControlToValidate="DdlPeriodo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Periodo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpEmitir"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPerido" runat="server" HighlightCssClass="vco" TargetControlID="RFVPeriodo" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row v-center">
|
||||
<label class="col-md-3">Mes: </label>
|
||||
<div class="col-md-9">
|
||||
<asp:DropDownList ID="DdlMes" DataTextField="Descripcion" DataValueField="CveSATMes" CssClass="ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVMes" runat="server" InitialValue="-1" ControlToValidate="DdlMes" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Mes''</b> es necesario, por favor ingréselo." ValidationGroup="GrpEmitir"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEMes" runat="server" HighlightCssClass="vco" TargetControlID="RFVMes" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row v-center">
|
||||
<label class="col-md-3 ">Año:</label>
|
||||
<div class="col-md-9">
|
||||
<asp:DropDownList ID="DdlAnio" CssClass="ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVAnio" runat="server" InitialValue="-1" ControlToValidate="DdlAnio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Mes''</b> es necesario, por favor ingréselo." ValidationGroup="GrpEmitir"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEAnio" runat="server" HighlightCssClass="vco" TargetControlID="RFVAnio" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table border="0" class="Widthall" style="padding-top: 20px;">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<asp:UpdatePanel ID="UpGuardar" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnGuardar" runat="server" CssClass="btn btn-primary" Text="Emitir e Imprimir" ValidationGroup="GrpEmitir" OnClick="BtnGuardar_Click" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script>
|
||||
$('body').on('click', '.ChkAllClick input', function () { $(".ChkAllEvt input").not(this).prop('checked', $('.ChkAllClick input').is(':checked')); });
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
227
Ventas/FacturacionGlobal.aspx.vb
Normal file
227
Ventas/FacturacionGlobal.aspx.vb
Normal file
@@ -0,0 +1,227 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Partial Class Ventas_FacturacionGlobal
|
||||
Inherits ClsPaginas
|
||||
Private Property CveSubProyecto As Integer
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CveSubProyecto")), -1, ViewState("CveSubProyecto").ToString().ToEntero())
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveSubProyecto") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtRemisiones As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtRemisiones")), Nothing, CType(ViewState("DtRemisiones"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtRemisiones") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaCombos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region " C A R G A - D A T O S "
|
||||
|
||||
Public Sub CargaCombos()
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
DdlPeriodo.DataSource = GlobalDTGralSATPeriodicidad()
|
||||
DdlPeriodo.DataBind()
|
||||
DdlPeriodo.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
DdlMes.DataSource = GlobalDTGralSATMeses().FiltraParametros("ISNULL(CveSATPeriodicidad,0) <> 5")
|
||||
DdlMes.DataBind()
|
||||
DdlMes.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
Dim Anio As Integer = Now.Year
|
||||
Dim AnioAnterior As Integer = Now.Year - 1
|
||||
|
||||
DdlAnio.Items.Add(New ListItem(Anio.ToString(), Anio.ToString()))
|
||||
DdlAnio.Items.Add(New ListItem(AnioAnterior.ToString(), AnioAnterior.ToString()))
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlPeriodo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
If DdlPeriodo.SelectedValue = "5" Then
|
||||
DdlMes.DataSource = GlobalDTGralSATMeses().FiltraParametros("ISNULL(CveSATPeriodicidad,0) = 5")
|
||||
Else
|
||||
DdlMes.DataSource = GlobalDTGralSATMeses().FiltraParametros("ISNULL(CveSATPeriodicidad,0) <> 5")
|
||||
End If
|
||||
DdlMes.DataBind()
|
||||
|
||||
UPFiltros.Update()
|
||||
End Sub
|
||||
|
||||
'Private Function CalculaFechas() As MFiltroPeriodicidad
|
||||
' Dim Retorno As New MFiltroPeriodicidad()
|
||||
' Dim Mes As String = GlobalDTGralSATMeses().FiltroPrimeroValor("Mes", $"CveSATMes = {DdlMes.SelectedValue}")
|
||||
|
||||
' Select Case DdlPeriodo.SelectedValue
|
||||
' Case "1"
|
||||
' Retorno.FechaI = DateTime.Now.AddDays(-1).Day.ToString() + "/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Retorno.FechaF = Retorno.FechaI.ToDate().AddDays(1).ToString("dd/MM/yyyy")
|
||||
' Case "2"
|
||||
' Retorno.FechaI = DateTime.Now.AddDays(-7).Day.ToString() + "/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Retorno.FechaF = Retorno.FechaI.ToDate().AddDays(7).ToString("dd/MM/yyyy")
|
||||
' Case "3"
|
||||
' If DateTime.Now.Day < 16 Then
|
||||
' Retorno.FechaI = "01/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Retorno.FechaF = "15/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Else
|
||||
' Dim LastDayOfMonth = DateTime.DaysInMonth(DdlAnio.SelectedValue.ToEntero(), DdlMes.SelectedValue.ToEntero())
|
||||
' Retorno.FechaI = "16/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Retorno.FechaF = LastDayOfMonth.ToString() + "/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' End If
|
||||
' Case "4"
|
||||
' Dim LastDayOfMonth = DateTime.DaysInMonth(DdlAnio.SelectedValue.ToEntero(), DdlMes.SelectedValue.ToEntero())
|
||||
' Retorno.FechaI = "01/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Retorno.FechaF = LastDayOfMonth.ToString() + "/" + Mes + "/" + DdlAnio.SelectedValue
|
||||
' Case "5"
|
||||
' Dim LastDayOfMonth = DateTime.DaysInMonth(DdlAnio.SelectedValue.ToEntero(), DdlMes.SelectedValue.ToEntero())
|
||||
' Dim PrimerMes = GlobalDTGralSATMeses().FiltroPrimeroValor("PrimerMes", $"CveSATMes = {DdlMes.SelectedValue}")
|
||||
' Dim SegundoMes = GlobalDTGralSATMeses().FiltroPrimeroValor("SegundoMes", $"CveSATMes = {DdlMes.SelectedValue}")
|
||||
|
||||
' Retorno.FechaI = "01/" + PrimerMes + "/" + DdlAnio.SelectedValue
|
||||
' Retorno.FechaF = LastDayOfMonth.ToString() + "/" + SegundoMes + "/" + DdlAnio.SelectedValue
|
||||
' End Select
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Me.CveSubProyecto = -1
|
||||
|
||||
Dim CveCliente As Integer = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()
|
||||
Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
||||
Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetRepRemisionesSinFacturar(FechaI, FechaF, "-1", DdlSubProyecto.SelectedValue, CveCliente, -1, "-1", UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, ConsultaInventario:=False) Then
|
||||
DtRemisiones = ObjVentas.DtResultados.FiltraParametros("CveVenta > 0 OR Folio IN ('Total Pesos')")
|
||||
Me.CveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero()
|
||||
Else
|
||||
DtRemisiones = Nothing
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
GvDatos.DataSource = DtRemisiones
|
||||
GvDatos.DataBind()
|
||||
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveVenta").ToEntero() > 0 Then
|
||||
e.Row.FCCheckBox("chkDis").Visible = True
|
||||
Else
|
||||
e.Row.CssClass = "Totales"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||
Dim CveCliente As Integer = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()
|
||||
Dim CveMoneda As Integer = -1
|
||||
|
||||
Dim SbRemisiones As New StringBuilder()
|
||||
Dim RemisionesLista As New List(Of Integer)
|
||||
|
||||
For Each RowRem As GridViewRow In GvDatos.Rows
|
||||
If RowRem.RowType = DataControlRowType.DataRow Then
|
||||
If RowRem.FCCheckBox("chkDis").Checked Then
|
||||
SbRemisiones.AppendFormat("{0},", RowRem.DataKey("CveVenta"))
|
||||
RemisionesLista.Add(RowRem.DataKey("CveVenta").ToEntero())
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If RemisionesLista.Count = 0 Then
|
||||
Alert("Debe seleccionar al menos una remisión", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
SbRemisiones.Remove(SbRemisiones.Length - 1, 1)
|
||||
|
||||
Dim DtRemisionesPS As New DataTable()
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.GetVentasRemisionesTotales(CveCliente, SbRemisiones.ToString(), 1) Then
|
||||
DtRemisionesPS = ObjClientes.DtResultados.Copy()
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, Me.CveSubProyecto, CveCliente, CveMoneda, "Ing")
|
||||
ObjFactura.EsFacturaGlobal = True
|
||||
ObjFactura.CveSATPeriodicidad = DdlPeriodo.SelectedValue.ToEntero()
|
||||
ObjFactura.CveSATMes = DdlMes.SelectedValue.ToEntero()
|
||||
ObjFactura.SATAnio = DdlAnio.SelectedValue.ToEntero()
|
||||
ObjFactura.RemisionesLista = RemisionesLista
|
||||
ObjFactura.DtRemisionesPS = DtRemisionesPS
|
||||
ObjFactura.DtRemisiones = DtRemisiones.FiltraParametros($"CveVenta IN ({SbRemisiones.ToString()})")
|
||||
|
||||
For Each Dr As DataRow In DtRemisionesPS.Rows
|
||||
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),
|
||||
CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero())
|
||||
Next
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
ObjFactura.PreparaTimbre()
|
||||
'ObjFactura.DtInventario = ObjFactura.DtDetalle.FiltraParametros("CveTipoPs = 2")
|
||||
|
||||
Dim SbAlert As New StringBuilder()
|
||||
Dim urlFactura As String = ""
|
||||
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Try
|
||||
Retorno = ObjFactura.EmitirFactura(True)
|
||||
|
||||
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
|
||||
SbAlert.AppendFormat("{0}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
||||
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
|
||||
|
||||
urlFactura = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta))}"
|
||||
Else
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
SbAlert.Append("Ocurrió un error al generar el documento")
|
||||
GuardaLog(ex.ToString())
|
||||
End Try
|
||||
|
||||
|
||||
If Retorno IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
|
||||
End If
|
||||
|
||||
If Retorno IsNot Nothing AndAlso Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", "document.location.href=""/Ventas/FacturacionGlobal.aspx"";"), ShowCloseButton:=False)
|
||||
Next
|
||||
Else
|
||||
If SbAlert.Length = 0 Then
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
Alert(SbAlert.ToString(), TipoMensaje.MsgError, ShowCloseButton:=False)
|
||||
End If
|
||||
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user