-- mejora
This commit is contained in:
@@ -59,9 +59,46 @@
|
||||
<asp:ListItem Text="Facturado y Timbrado" Value="3"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>--%>
|
||||
|
||||
<div class="col-md-1 truncate">
|
||||
Fecha Inicio:
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1" style="min-width: 115px">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></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>
|
||||
</div>
|
||||
<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 class="col-md-1 truncate">
|
||||
Fecha Fin:
|
||||
|
||||
</div>
|
||||
<div class="col-md-1" style="min-width: 115px">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></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>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display: none;">
|
||||
<div class="row">
|
||||
</div>
|
||||
@@ -97,10 +134,10 @@
|
||||
<Columns>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="20px" HeaderStyle-Width="20px" ItemStyle-CssClass="NoClick">
|
||||
<HeaderTemplate>
|
||||
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClick" />
|
||||
<asp:CheckBox runat="server" ID="chkSelectAll" Visible="false" CssClass="ChkAllClick" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox runat="server" ID="chk" CssClass="ChkAllEvt" />
|
||||
<asp:CheckBox runat="server" ID="chk" CssClass="ChkAllEvt" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="Servicio" DataField="Servicio" />
|
||||
|
||||
@@ -5,16 +5,19 @@ Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.IO.Compression
|
||||
Imports System.Net.Http
|
||||
Imports System.Windows.Forms
|
||||
Imports ADSTimbrado
|
||||
Imports DocumentFormat.OpenXml.Spreadsheet
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Imports iText.Barcodes.Dmcode
|
||||
|
||||
Partial Class Ventas_FacturacionAcarreos
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
txtFechaI.Text = NowADS.FirstDayOfMonth().ToShortDateString
|
||||
CargaDatos()
|
||||
End If
|
||||
If IfNull(Request("OP"), "").ToString = "File" Then
|
||||
@@ -30,7 +33,7 @@ Partial Class Ventas_FacturacionAcarreos
|
||||
CveCliente = DdlClientes.SelectedValue.ToEntero()
|
||||
End If
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetFacturacionAcarreos(-1, CveCliente, -1, DdlEstatus.SelectedValue.ToEntero(), NowADS(), UsuarioActual.CveEmpresa) Then
|
||||
If ObjVentas.GetFacturacionAcarreos(-1, CveCliente, -1, DdlEstatus.SelectedValue.ToEntero(), txtFechaI.Text.ToDate, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados
|
||||
End If
|
||||
End Using
|
||||
@@ -133,7 +136,7 @@ Partial Class Ventas_FacturacionAcarreos
|
||||
FechaLlegada = row("FechaLlegada").ToString().ToDateTime().AddHours(14)
|
||||
End If
|
||||
|
||||
Dim Chofer, Configuracion, Remolque1, Remolque2 As String
|
||||
Dim Folio, FolioAdicional, Remolque1, Remolque2 As String
|
||||
Dim dtu As DataRow = GlobalDTInvCamiones(UsuarioActual.CveEmpresa).FiltroPrimero($"Placa = '{row("Unidad")}'")
|
||||
If dtu IsNot Nothing Then
|
||||
'Chofer = dtu("Chofer").ToString
|
||||
@@ -141,15 +144,15 @@ Partial Class Ventas_FacturacionAcarreos
|
||||
Remolque1 = dtu("Remolque1").ToString
|
||||
Remolque2 = dtu("Remolque2").ToString
|
||||
Else
|
||||
Chofer = "" : Configuracion = "" : Remolque1 = "" : Remolque2 = ""
|
||||
Folio = "" : FolioAdicional = "" : Remolque1 = "" : Remolque2 = ""
|
||||
End If
|
||||
|
||||
'temporal
|
||||
Chofer = row("Folio").ToString
|
||||
Configuracion = row("HojaServicio").ToString
|
||||
Folio = row("Folio").ToString
|
||||
FolioAdicional = row("HojaServicio").ToString
|
||||
|
||||
Dim msg As String = ObjVentas.AddFacturacionAcarreos(row("Sucursal").ToString(), row("RFC").ToString(), row("Cantidad").ToString().ToDecimal(), row("ProductoGeneral").ToString(), row("Origen").ToString(),
|
||||
row("Destino").ToString(), FechaSalida, FechaLlegada, row("Unidad").ToString(), Chofer, Configuracion,
|
||||
row("Destino").ToString(), FechaSalida, FechaLlegada, row("Unidad").ToString(), Folio, FolioAdicional,
|
||||
Remolque1, Remolque2, row("Distancia").ToString().ToDecimal(), UsuarioActual.CveEmpresa)
|
||||
If msg = "Correcto" Then
|
||||
RowsCargados += 1
|
||||
@@ -216,6 +219,11 @@ Partial Class Ventas_FacturacionAcarreos
|
||||
Dim ArchivoDestino As String = String.Format("{0}Temp/{1}", UsuarioActual.Empresa.Ruta, NombreArchivo)
|
||||
Dim HuboInexistentes As Boolean = False
|
||||
Dim archiveZip As ZipArchive = ZipFile.Open(ArchivoDestino, ZipArchiveMode.Create)
|
||||
Dim dtt As New DataTable
|
||||
dtt.Columns.Add("Cantidad", GetType(String))
|
||||
dtt.Columns.Add("Boleta", GetType(String))
|
||||
dtt.Columns.Add("HojaServicio", GetType(String))
|
||||
dtt.Columns.Add("SerieFolio", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
@@ -252,6 +260,13 @@ Partial Class Ventas_FacturacionAcarreos
|
||||
If Not resp.TieneError Then
|
||||
If resp.SerieFolio <> String.Empty Then
|
||||
msgDescarga.AppendFormat("{0},", resp.SerieFolio)
|
||||
Dim drr As DataRow = dtt.NewRow
|
||||
drr("Cantidad") = GvRow.DataKey("Cantidad")
|
||||
drr("Boleta") = GvRow.DataKey("Folio")
|
||||
drr("HojaServicio") = GvRow.DataKey("FolioAdicional")
|
||||
drr("SerieFolio") = resp.SerieFolio
|
||||
dtt.Rows.Add(drr)
|
||||
|
||||
DescargarFactura(resp.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)
|
||||
Archivo = String.Format("{0}PDF/ING/{1}.pdf", UsuarioActual.Empresa.Ruta.Replace("\", "/"), resp.SerieFolio)
|
||||
If File.Exists(Archivo) Then
|
||||
@@ -276,9 +291,18 @@ Partial Class Ventas_FacturacionAcarreos
|
||||
archiveZip.Dispose()
|
||||
If NumFacturasGeneradas > 0 Then
|
||||
Dim stt As String = $"Se generaron {NumFacturasGeneradas} y se timbraron {NumFacturasTimbradas} facturas. <br/>"
|
||||
Dim nombreexcel As String = "AcarreosListado.xlsx"
|
||||
Dim rutaexcel As String = UsuarioActual.Empresa.Ruta & "\Temp\" & nombreexcel
|
||||
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim workbook As New ExcelFile()
|
||||
Dim worksheet As ExcelWorksheet = workbook.Worksheets.Add("Acarreos")
|
||||
worksheet.InsertDataTable(dtt, New InsertDataTableOptions() With {.ColumnHeaders = True})
|
||||
workbook.Save(rutaexcel)
|
||||
|
||||
If msgDescarga.Length > 0 Then
|
||||
stt += String.Format("<a target='_blank' class='Texto' href='/Ventas/FacturacionAcarreos.aspx?OP=File&File={0}'>Descarga zip</a>", NombreArchivo)
|
||||
stt += String.Format("<a target='_blank' class='Texto' href='/Ventas/FacturacionAcarreos.aspx?OP=File&File={0}'>Descarga xml/pdf</a>", NombreArchivo)
|
||||
End If
|
||||
stt += String.Format("<br/><a target='_blank' class='Texto' href='/Ventas/FacturacionAcarreos.aspx?OP=File&File={0}'>Descarga excel</a>", nombreexcel)
|
||||
Alert(stt, TipoMensaje.MsgInformacion)
|
||||
|
||||
Else
|
||||
|
||||
Reference in New Issue
Block a user