This commit is contained in:
rrene
2020-11-11 14:51:23 -07:00
10 changed files with 498 additions and 122 deletions

View File

@@ -10,18 +10,25 @@ Imports System.IO
Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
If context.Request("metodo").ToString() = "GetTokenAngular" Then
If context.Request("metodo") IsNot Nothing AndAlso context.Request("metodo").ToString() = "GetTokenAngular" Then
'context.Response.ContentType = "application/json; charset=utf-8"
context.Response.ContentType = "text/json"
Dim origin As String = context.Request.UrlReferrer.ToString()
context.Response.AddHeader("Access-Control-Allow-Origin", origin.Substring(0, origin.Length - 1))
If context.Request IsNot Nothing AndAlso context.Request.UrlReferrer IsNot Nothing Then
Dim origin As String = context.Request.UrlReferrer.ToString()
context.Response.AddHeader("Access-Control-Allow-Origin", origin.Substring(0, origin.Length - 1))
End If
'context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200")
'context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST")
context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept")
context.Response.AddHeader("Access-Control-Allow-Credentials", "true")
context.Response.StatusCode = 200
Dim key As String = GetTokenAngular(context)
Dim key As String = ""
Try
key = GetTokenAngular(context)
Catch ex As Exception
GuardaLog(ex.ToString())
End Try
Dim json As String = JsonConvert.SerializeObject(key)
context.Response.Write(json)
context.Response.Flush()

View File

@@ -658,7 +658,7 @@
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnGuardarFaturas" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" />
<asp:Button ID="BtnGuardarFaturas" runat="server" ClientIDMode="Static" Text="Aceptar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>

View File

@@ -1208,7 +1208,7 @@ Partial Class Compras_eFacturas
DtNoRecibidas.ReadXml(Ruta)
Dim conta As Integer = 1
Str.Append("Se encontraron las siguientes facturas con problema:<br/> <table width='900px'><tr class='Titulos'><td>Serie</td><td>Folio</td><td>Fecha</td><td>Proveedor</td><td>Importe</td><td>Motivo</td><td>Correo</td><td>F. Recepción</td></tr>")
Str.Append("Se procesó la información con la siguiente información:<br/> <table width='900px'><tr class='Titulos'><td>Serie</td><td>Folio</td><td>Fecha</td><td>Proveedor</td><td>Importe</td><td>Motivo</td><td>Correo</td><td>F. Recepción</td></tr>")
For Each dr As DataRow In DtNoRecibidas.FiltraParametros("", "Fecha DESC").Rows
@@ -2809,7 +2809,12 @@ Partial Class Compras_eFacturas
dRow2("CveFactura") = drow("CveFactura").ToString.ToEntero
dRow2("CveMetodoPago") = drow("CveMetodoPago").ToString.ToEntero
dRow2("SerieFolioCompra") = drow("SerieFolioCompra").ToString
dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString
Try
dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString
Catch ex As Exception
dRow2("CvePrePolizaDetalle") = 0
End Try
If drow("CveIE").ToString.ToEntero > 0 Then

View File

@@ -1275,7 +1275,7 @@ Partial Class Contratos_Default
PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero, TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero,
CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero,
Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=DdlClienteDireccionEnvio.SelectedValue.ToEntero, AplicaImpuestosLocales:=ChkImpuestosLocales.Checked, CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(),
FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=DdlDiaFact.SelectedValue.ToEntero())
FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=If(DdlDiaFact.SelectedValue.ToEntero() < 0, 0, DdlDiaFact.SelectedValue.ToEntero()))
TieneError = Not GuardaFianzas(ObjContratos)
@@ -1364,7 +1364,7 @@ Partial Class Contratos_Default
CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero,
TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero,
CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=DdlClienteDireccionEnvio.SelectedValue.ToEntero, AplicaImpuestosLocales:=ChkImpuestosLocales.Checked,
CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=DdlDiaFact.SelectedValue.ToEntero(), CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero()) Then
CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=If(DdlDiaFact.SelectedValue.ToEntero() < 0, 0, DdlDiaFact.SelectedValue.ToEntero()), CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero()) Then
TieneError = Not GuardaFianzas(ObjContratos)

View File

@@ -257,7 +257,7 @@
<label class="col-md-1 truncate">Contrato:</label>
<div class="col-md-6 col-lg-4">
<div class="ddls">
<asp:DropDownList ID="DDlContratosEstimaciones" runat="server" AutoPostBack="true" DataTextField="ContratoCompleto" DataValueField="CveContrato" Class=" form-control input-inline select2me" Width="100%">
<asp:DropDownList ID="DDlContratosEstimaciones" runat="server" AutoPostBack="true" DataTextField="NumeroContrato" DataValueField="CveContrato" Class=" form-control input-inline select2me" Width="100%">
</asp:DropDownList>
</div>
</div>
@@ -303,59 +303,7 @@
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" Text="" CssClass="txtcant" onkeyup="ValidateCant(this)" type="number" step="any" data-cantidad='<%# Eval("CantidadMax")%>' data-pu='<%# Eval("PU")%>' data-cve='<%# Eval("CveContratoDetalle") %>' Width="90" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Importe">
<ItemTemplate>
<asp:TextBox ID="TxtImporte" Text="" data-cve='<%# Eval("CveContratoDetalle") %>' CssClass="txtimporte" type="number" step="any" Width="90" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText=" ">
<ItemTemplate>
<asp:LinkButton ID="LnkAnexo" runat="server" OnClick="GetAnexos" AlternateText="Agregar Anexo" CssClass="btn btn-circle btn-sm btn-success anexo" Text="<i class='fa fa-folder'></i>" />
<asp:LinkButton runat="server" CssClass="btn btn-circle btn-sm btn-success" ID="LnkModalDropzone" Visible="false"> <i class='fa fa-plus'></i></asp:LinkButton>
<div runat="server" id="ModalAnexoEvidencia" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Cargar Evidencia</h4>
</div>
<div class="modal-body">
<div style="text-align:left">
<asp:TextBox ID="TXTAnexo" CssClass="ADSdropzone hidden" data-maxFile="10" Text="" runat="server"></asp:TextBox>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>--%>
</Columns>
@@ -370,12 +318,16 @@
<div class="text-center">
<asp:Button id="BtnGuardarEstimacion" CssClass="btn btn-primary" runat="server" Text="Generar Estimacion" Visible="false"/>
<asp:Button id="BtnDescargarGenerado" CssClass="btn btn-primary" runat="server" Text="Descarga Generador" Visible="false"/>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnDescargarGenerado" />
</Triggers>
</asp:UpdatePanel>

View File

@@ -5,9 +5,10 @@ Imports Extensiones
Imports System.IO
Imports System.Data
Imports Newtonsoft.Json
Imports ClosedXML.Excel
Partial Class Contratos_ContratoAvance
Inherits ClsPaginas
Inherits ClsPaginas
#Region "Propiedades"
Private Property DtDatos As DataTable
Get
@@ -63,6 +64,34 @@ Partial Class Contratos_ContratoAvance
End Set
End Property
Property CveEstimacionNueva As Integer
Get
If ViewState("CveEstimacionNueva") Is Nothing Then
Return -1
Else
Return ViewState("CveEstimacionNueva").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("CveEstimacionNueva") = value
End Set
End Property
Property NuemeroEstimacionNuevo As Integer
Get
If ViewState("NuemeroEstimacionNuevo") Is Nothing Then
Return -1
Else
Return ViewState("NuemeroEstimacionNuevo").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("NuemeroEstimacionNuevo") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -74,15 +103,15 @@ Partial Class Contratos_ContratoAvance
End If
End Sub
End Sub
#Region "Filtros"
Private Sub CargaContrato()
DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (4,30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
DdlContratos.DataBind()
DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (4,30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
DDlContratosEstimaciones.DataBind()
@@ -96,21 +125,21 @@ Partial Class Contratos_ContratoAvance
DdlAvances.Items.Clear()
Dim ObjContratos As New ClsContratos()
If ObjContratos.GetContratosAvanceFecha(DdlContratos.SelectedValue.ToEntero, 2) Then
DdlAvances.DataSource = ObjContratos.DtResultados
DdlAvances.DataSource = ObjContratos.DtResultados
End If
ObjContratos.Dispose()
DdlAvances.DataBind()
DdlAvances.Items.Insert(0, New ListItem(" ---- ", "-1"))
End Sub
End Sub
#End Region
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CveContrato = DdlContratos.SelectedValue.ToEntero
CargaDatosAvance()
End Sub
Private Sub CargaDatosAvance()
GvAnexos.Visible = False
GvAnexos.Visible = False
Dim ObjContratos As New ClsContratos()
If DdlAvances.SelectedValue = "-1" Then
If ObjContratos.GetContratosAvanceTodos(CveContrato, 2) Then
@@ -121,7 +150,7 @@ Partial Class Contratos_ContratoAvance
btnanexogral.Visible = True
End If
End If
Else
Else
If ObjContratos.GetContratosAvanceHistoricos(CveContrato, 2, DdlAvances.SelectedValue) Then
fecha = DdlAvances.SelectedValue
DtDatos = ObjContratos.DtResultados
@@ -131,8 +160,8 @@ Partial Class Contratos_ContratoAvance
End If
ObjContratos.Dispose()
CargaGrid()
End Sub
End Sub
#Region "GV"
Private Sub CargaGrid()
If DtDatos IsNot Nothing Then
@@ -380,16 +409,19 @@ Partial Class Contratos_ContratoAvance
Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click
CveEstimacionNueva = -1
NuemeroEstimacionNuevo = -1
Dim ObjContratos As New ClsContratos()
Dim ErrorProceso As Boolean = False
Dim NuemeroEstimacion As Integer = -1
ObjContratos.IniciaTransacSQL()
If ObjContratos.AddContratosAvanceEstimacion(CveContratoEstimacion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
NuemeroEstimacion = ObjContratos.NumeroEstimacionNueva
CveEstimacionNueva = ObjContratos.CveEstimacionNueva
NuemeroEstimacionNuevo = ObjContratos.NumeroEstimacionNueva
For Each GvRow As GridViewRow In GvEstimaciones.Rows
@@ -412,15 +444,303 @@ Partial Class Contratos_ContratoAvance
If Not ErrorProceso Then
ObjContratos.Commit()
Alert($"Estimación {NuemeroEstimacion} agregada correctamente.")
Alert($"Estimación {NuemeroEstimacionNuevo} agregada correctamente.")
BtnGuardarEstimacion.Visible = False
BtnDescargarGenerado.Visible = True
Else
ObjContratos.RollBack()
End If
ObjContratos.Dispose()
UpEstimaciones.Update()
End Sub
Private Sub BtnDescargarGenerado_Click(sender As Object, e As EventArgs) Handles BtnDescargarGenerado.Click
GeneraAnexo(CveEstimacionNueva, NuemeroEstimacionNuevo, Now, DDlContratosEstimaciones.SelectedItem.Text)
End Sub
Private Sub GeneraAnexo(CveEstimacion As Integer, NumeroEstimacion As Integer, FechaEstimacion As Date, NumeroContrato As String)
Dim PlantillaAnexo As String = $"{UsuarioActual.Empresa.Ruta}\Formatos\Anexo.xlsx"
If Not System.IO.File.Exists(PlantillaAnexo) Then
Alert("No se encuentra la platilla de anexos.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim DtControl As New DataTable
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratosObraAvancesControlAcumulativo(CveContrato, CveEstimacion, UsuarioActual.CveEmpresa) Then
DtControl = ObjContratos.DtResultados
End If
ObjContratos.Dispose()
If DtControl.Rows.Count > 0 Then
Dim WBAnexo = New ClosedXML.Excel.XLWorkbook(PlantillaAnexo)
Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook
Dim WSControl = WBAnexo.Worksheet(1)
Dim WSDetalle = WBAnexo.Worksheet(2)
Dim CuerrentRow As Integer = 28
WSControl.Cell(17, 2).Value = NumeroEstimacion 'Estimacion
WSControl.Cell(20, 9).Value = FechaEstimacion.ToString("dd/MM/yyyy") 'Fecha estimacion
WSControl.Cell(19, 8).Value = "$ " & DtControl.SUM("Importe").ToString("###,###,###.00") 'Total
WSControl.Cell(19, 8).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSControl.Cell(20, 6).Value = NumeroContrato
WSControl.Cell(18, 2).Value = "" 'Lugar
WSControl.Cell(17, 6).Value = "" 'Periodo Fecha Inicial
WSControl.Cell(17, 7).Value = "" 'Periuodo Fecha Final
WSControl.Cell(20, 2).Value = "" 'Obra
WSControl.Cell(22, 7).Value = "" 'Presupuesto segun contrato
WSControl.Cell(19, 5).Value = "" 'Contrtatista
Dim RowCountControl As Integer = 1
For Each Drow As DataRow In DtControl.Rows
WSControl.Cell(CuerrentRow, 1).Value = Drow("Codigo").ToString
WSControl.Cell(CuerrentRow, 2).Value = Drow("PS").ToString
WSControl.Cell(CuerrentRow, 3).Value = Drow("Abreviatura").ToString
WSControl.Cell(CuerrentRow, 4).Value = Drow("Cantidad").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 5).Value = Drow("AcumuladoTotal").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 6).Value = Drow("AcumuladoAnterior").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 7).Value = Drow("CantidadActual").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 8).Value = Drow("PU").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 9).Value = Drow("Total").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 9).Style.NumberFormat.Format = "$ ###,###,###.00"
WSControl.Cell(CuerrentRow, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 7).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 8).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 9).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 1).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 2).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 3).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 4).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 5).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 7).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 8).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 9).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'ultimo Row
If DtControl.Rows.Count = RowCountControl Then
WSControl.Cell(CuerrentRow + 1, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 7).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 8).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 9).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 1).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 2).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 3).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 4).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 5).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 7).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 8).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 9).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSControl.Cell(CuerrentRow + 1, 8).Value = "Total:"
WSControl.Cell(CuerrentRow + 1, 8).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSControl.Cell(CuerrentRow + 1, 8).Style.Font.Bold = True
WSControl.Cell(CuerrentRow + 1, 9).Value = DtControl.SUM("Total")
WSControl.Cell(CuerrentRow + 1, 9).Style.Font.Bold = True
WSControl.Cell(CuerrentRow + 1, 9).Style.NumberFormat.Format = "$ ###,###,###.00"
Dim range = WSControl.Range($"A{CuerrentRow + 3}:D{CuerrentRow + 3}")
range.Merge()
range.Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range = WSControl.Range($"E{CuerrentRow + 3}:I{CuerrentRow + 3}")
range.Merge()
range.Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range = WSControl.Range($"A{CuerrentRow + 4}:D{CuerrentRow + 4}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "ING. WALTER ROBERTO VILLEGAS LARES"
range = WSControl.Range($"E{CuerrentRow + 4}:I{CuerrentRow + 4}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "C. SALVADOR SUAREZ"
range = WSControl.Range($"A{CuerrentRow + 5}:D{CuerrentRow + 5}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "SERVICIOS ELECTRICOS Y CONTROL DE HERMOSILLO S.A. DE C.V."
range.Style.Font.Bold = True
range = WSControl.Range($"E{CuerrentRow + 5}:I{CuerrentRow + 5}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "GASERVICIO MATAMOROS SA DE CV"
range.Style.Font.Bold = True
End If
CuerrentRow = CuerrentRow + 1
RowCountControl = RowCountControl + 1
Next
WBAnexo.Worksheet(1).CopyTo(WBAnexoSalvar, "CONTROL")
For Each Drow As DataRow In DtControl.Rows
If Drow("CantidadActual").ToString.ToDecimal > 0 Then
WSDetalle.Cell(3, 6).Value = NumeroContrato
WSDetalle.Cell(4, 9).Value = "" 'Fecha de
WSDetalle.Cell(4, 10).Value = "" 'Fecha a
WSDetalle.Cell(4, 11).Value = NumeroEstimacion
'WSDetalle.Picture("Logo").Name = $"Logo{Drow("CveContratoDetalle").ToString}"
'WSDetalle.Picture("Firma").Name = $"Firma{Drow("CveContratoDetalle").ToString}"
WSDetalle.Cell(14, 2).Value = Drow("Codigo").ToString
WSDetalle.Cell(14, 3).Value = Drow("PS").ToString
WSDetalle.Cell(14, 4).Value = Drow("Abreviatura").ToString
WSDetalle.Cell(12, 3).Value = "" 'Concepto
WSDetalle.Cell(14, 10).Value = Drow("CantidadActual").ToString.ToDecimal
WSDetalle.Cell(14, 11).Value = Drow("CantidadActual").ToString.ToDecimal
'WSDetalle.Cell(61, 6).Value = "" 'Empresario
WSDetalle.Cell(61, 9).Value = Drow("Nombre").ToString 'Cliente
Dim objContrato As New ClsContratos
Dim DTArchivos As New DataTable
If objContrato.GetContratosAvanceAnexos(Drow("CveContratoDetalle").ToString.ToEntero, Drow("Fecha").ToString, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then
DTArchivos = objContrato.DtResultados
End If
objContrato.Dispose()
Dim Imagenes As New List(Of ClosedXML.Excel.Drawings.IXLPicture)
Dim CurrectRowImg As Integer = 19 'Row 19 primera imggen
Dim RowH As Double = WSDetalle.Row(19).Height
For Each drowArchivos As DataRow In DTArchivos.Rows
Dim Archivo As String = ""
Archivo = drowArchivos("Archivo").ToString
Dim RutaArchivo As String = $"{UsuarioActual.Empresa.Ruta}\Contrato\{CveContrato}\Anexos\{Archivo}"
If File.Exists(RutaArchivo) Then
Dim Imagen = WSDetalle.AddPicture(RutaArchivo).MoveTo(WSDetalle.Cell(CurrectRowImg, 3))
Imagen.Scale(WSDetalle.Column(3).Width / (Imagen.OriginalWidth * 0.145D))
Dim ImgWidth As Double = Imagen.Height
Dim nRowmas As Integer = (ImgWidth / RowH).ToEntero
CurrectRowImg = CurrectRowImg + nRowmas
Imagenes.Add(Imagen)
End If
Next
WBAnexo.Worksheet(2).CopyTo(WBAnexoSalvar, If(Drow("Codigo").ToString.Trim.Length > 0, Drow("Codigo").ToString, Drow("CvePS").ToString))
For Each img As ClosedXML.Excel.Drawings.IXLPicture In Imagenes
img.Delete()
Next
End If
Next
Dim msB = New MemoryStream()
WBAnexoSalvar.SaveAs(msB)
Dim BB As Byte() = msB.ToArray
msB.Dispose()
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=Anexo_Estimacion" & NumeroEstimacion & ".xlsx")
Response.ContentType = "application/vnd.ms-excel"
Response.BinaryWrite(BB)
Response.End()
Else
Alert("No se encontraron datos des control", TipoMensaje.MsgAdvertencia)
End If
End Sub
#End Region

View File

@@ -1,6 +1,7 @@
Imports Extensiones
Imports System.Data
Imports System.IO
Imports ClosedXML.Excel
Partial Class RepContratosObraAvancesDetalle
Inherits ClsPaginas
@@ -152,7 +153,8 @@ Partial Class RepContratosObraAvancesDetalle
WSControl.Cell(17, 2).Value = NumeroEstimacion 'Estimacion
WSControl.Cell(20, 9).Value = FechaEstimacion.ToString("dd/MM/yyyy") 'Fecha estimacion
WSControl.Cell(19, 8).Value = "$ " & DtControl.SUM("Total").ToString("###,###,###.00") 'Total
WSControl.Cell(19, 8).Value = "$ " & DtControl.SUM("Importe").ToString("###,###,###.00") 'Total
WSControl.Cell(19, 8).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSControl.Cell(20, 6).Value = NumeroContrato
@@ -163,7 +165,7 @@ Partial Class RepContratosObraAvancesDetalle
WSControl.Cell(22, 7).Value = "" 'Presupuesto segun contrato
WSControl.Cell(19, 5).Value = "" 'Contrtatista
Dim RowCountControl As Integer = 1
For Each Drow As DataRow In DtControl.Rows
@@ -177,7 +179,121 @@ Partial Class RepContratosObraAvancesDetalle
WSControl.Cell(CuerrentRow, 8).Value = Drow("PU").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 9).Value = Drow("Total").ToString.ToDecimal
WSControl.Cell(CuerrentRow, 9).Style.NumberFormat.Format = "$ ###,###,###.00"
WSControl.Cell(CuerrentRow, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 7).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 8).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 9).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 1).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 2).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 3).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 4).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 5).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 7).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 8).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow, 9).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
'ultimo Row
If DtControl.Rows.Count = RowCountControl Then
WSControl.Cell(CuerrentRow + 1, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 7).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 8).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 9).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 1).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 2).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 3).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 4).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 5).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 7).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 8).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
WSControl.Cell(CuerrentRow + 1, 9).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSControl.Cell(CuerrentRow + 1, 8).Value = "Total:"
WSControl.Cell(CuerrentRow + 1, 8).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSControl.Cell(CuerrentRow + 1, 8).Style.Font.Bold = True
WSControl.Cell(CuerrentRow + 1, 9).Value = DtControl.SUM("Total")
WSControl.Cell(CuerrentRow + 1, 9).Style.Font.Bold = True
WSControl.Cell(CuerrentRow + 1, 9).Style.NumberFormat.Format = "$ ###,###,###.00"
Dim range = WSControl.Range($"A{CuerrentRow + 3}:D{CuerrentRow + 3}")
range.Merge()
range.Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range = WSControl.Range($"E{CuerrentRow + 3}:I{CuerrentRow + 3}")
range.Merge()
range.Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range = WSControl.Range($"A{CuerrentRow + 4}:D{CuerrentRow + 4}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "ING. WALTER ROBERTO VILLEGAS LARES"
range = WSControl.Range($"E{CuerrentRow + 4}:I{CuerrentRow + 4}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "C. SALVADOR SUAREZ"
range = WSControl.Range($"A{CuerrentRow + 5}:D{CuerrentRow + 5}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "SERVICIOS ELECTRICOS Y CONTROL DE HERMOSILLO S.A. DE C.V."
range.Style.Font.Bold = True
range = WSControl.Range($"E{CuerrentRow + 5}:I{CuerrentRow + 5}")
range.Merge()
range.Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Thin
range.Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
range.Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
range.Value = "GASERVICIO MATAMOROS SA DE CV"
range.Style.Font.Bold = True
End If
CuerrentRow = CuerrentRow + 1
RowCountControl = RowCountControl + 1
Next
WBAnexo.Worksheet(1).CopyTo(WBAnexoSalvar, "CONTROL")
@@ -280,13 +396,13 @@ Partial Class RepContratosObraAvancesDetalle
End Sub
Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream
'Public Function GetStream(excelWorkbook As ClosedXML.Excel.XLWorkbook) As Stream
Dim fs = New MemoryStream()
excelWorkbook.SaveAs(fs)
fs.Position = 0
Return fs
' Dim fs = New MemoryStream()
' excelWorkbook.SaveAs(fs)
' fs.Position = 0
' Return fs
End Function
'End Function
End Class

View File

@@ -134,6 +134,12 @@
<a target="_blank" class="ayuda" href="../Documentacion/DocumentacionInventarios.aspx#Kardex">&nbsp;</a>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ImgImprimir" />
<asp:PostBackTrigger ControlID="LnkExportar" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">

View File

@@ -131,18 +131,7 @@
<script type="text/javascript" src="/Metronic/assets/global/scripts/JSNoCustom"></script>
<%--<script type="text/javascript" src="/Scripts/Notificaciones.js"></script>--%>
<script>
function opennewlocation(returnurl,token) {
//let fram = $('#framexd');
//let Pagina =
// "http://localhost:2536/auth/login?authtoken=" + token;
// Metronic.blockUI();
//fram.unbind("load");
//fram.load(function () {
// setTimeout(function () { document.location = returnurl; },1500)
// Metronic.unblockUI();
//});
//fram.prop('src', Pagina);
function opennewlocation(returnurl,token) {
document.location = returnurl;
}
// aqui debe de llammarse siganalr, para desconectar

View File

@@ -250,26 +250,7 @@ Partial Class LogIn
Dim cookie = FormsAuthentication.GetAuthCookie(Usuario.CveUsuario, False)
Response.Cookies.Add(cookie)
'RegistraScript(String.Format("iniciaSesion('{0}')", ReturnUrl.Replace("'", "\'")))
'Public Property CveUsuario As Integer
'Public Property Mail As String
'Public Property Nombre As String
'Public Property Contraseña As String
'Public Property CvePerfil As Integer
'Public Property CveUsuarioModifico As Integer
'Public Property CveEmpresa As Integer
'Public Property CveUsuarioRegistro As Integer
Dim userm As New UserModel()
userm.CveUsuario = Usuario.CveUsuario
userm.Mail = Usuario.Usuario
userm.Nombre = Usuario.Nombre
userm.Contraseña = Usuario.Contraseña
userm.CvePerfil = Usuario.CveRol
userm.CveEmpresa = 119 'Usuario.CveEmpresa
userm.CveUsuarioModifico = Usuario.CveEmpresa
userm.CveUsuarioRegistro = Usuario.CveEmpresa
RegistraScript(String.Format("opennewlocation('{0}','{1}')", ReturnUrl, GenerateJSONWebToken(userm)))
RegistraScript(String.Format("opennewlocation('{0}','{1}')", ReturnUrl, ""))
'Response.Redirect(ReturnUrl, True)
Else
Alert("El usuario no esta autorizado en este equipo, favor de contactar al administrador de usuarios.", TipoMensaje.MsgAdvertencia)