SMS - OS, poder hacer la cancelación de una OS/Pedido. cuando la OS no esté como finalizada.

This commit is contained in:
rakcsle
2024-08-24 13:51:04 -07:00
parent 0fd4a78a8b
commit bbe64521b5
14 changed files with 820 additions and 31 deletions

View File

@@ -0,0 +1,246 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="LibroMayor2.aspx.vb" Inherits="Conta_LibroMayor2" EnableEventValidation="false" %>
<asp:Content ContentPlaceHolderID="Css" runat="server">
<style>
.truncate {
width: 300px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
table {
border: none !important;
}
tr {
border: none !important;
}
td {
border: none !important;
}
</style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="ImgExcel" runat="server"><i class="fa fa-ad-excel"></i> Generar EXCEL</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="Imprimir" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Movimientos Auxiliares del Catálogo
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" CssClass="btn btn-default" OnClick="BtnConsultar_Click" ValidationGroup="Valida" />
<a href="javascript:;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a><%--class="expand"--%>
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
</div>
<div class="titlefiltros caption ">
<div class="row">
<div class="col-md-1">
Cuenta:
</div>
<div class="col-md-3">
<asp:DropDownList ID="DdlCuentas" runat="server" AppendDataBoundItems="true" DataTextField="CuentaFormatoNombre" DataValueField="CveCuenta" CssClass="form-control input-sm select2me" Enabled="false">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDdlCuentas" runat="server" InitialValue="-1" ControlToValidate="DdlCuentas" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cuenta''</b> es necesario, por favor ingréselo." ValidationGroup="GrpConsulta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CERFVDdlCuentas" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlCuentas" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-1">
Fecha Inicio:
</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="GrpConsulta"></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="GrpConsulta"></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">
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: 100% !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="GrpConsulta"></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="GrpConsulta"></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" <%= IIf(chkexpand.Checked = True, "", "style=""display:none;""")%>>
<div class="row">
<div class="col-md-1 truncate">
Tipo Movto
</div>
<div class="col-md-2 truncate">
<asp:DropDownList ID="DdlOpcionCuentas" runat="server" DataTextField="Cuenta" DataValueField="CveCuenta" TabIndex="4" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Con movimientos" Value="1"></asp:ListItem>
<asp:ListItem Text="Saldo actual no igual a cero" Value="2"></asp:ListItem>
<asp:ListItem Text="Con movimientos y saldo no igual a cero" Value="3"></asp:ListItem>
<asp:ListItem Text="Con movimientos o saldo no igual a cero" Value="4"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 truncate" id="tdTipoReporte" visible="false" runat="server">
Tipo
</div>
<div class="col-md-2" id="tdTipoReporte2" visible="false" runat="server">
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server" Width="100%">
<asp:ListItem Text="Contable" Value="1"></asp:ListItem>
<asp:ListItem Text="Contable y Complementario" Value="3"></asp:ListItem>
<asp:ListItem Text="Complementario" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1" id="divProyecto" runat="server">
<asp:Label ID="LblProyecto" runat="server">Proyecto:</asp:Label>
</div>
<div class="col-md-2">
<asp:DropDownList ID="DdlProyecto" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Width="95%">
</asp:DropDownList>
</div>
<asp:Label runat="server" ID="LblSubProyecto" CssClass="col-md-1">SubProyecto:</asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlSubproyecto" CssClass="form-control input-sm select2me" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="95%" AutoPostBack="True">
</asp:DropDownList>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row" style="margin-right: 10px; margin-top: 8px;" align="right">
<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>
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False"
EmptyDataText="No se encontrarios movimientos."
DataKeyNames="" OnRowDataBound="GvDatos_RowDataBound">
<Columns>
<asp:TemplateField ControlStyle-CssClass="Widthall">
<HeaderTemplate>
<table width="100%" style="border: none">
<tr>
<td colspan="3"><font size="2">Cuenta</font></td>
<td colspan="1"><font size="2">Nombre</font></td>
<td colspan="4"></td>
<td><font size="2">Saldo Inicial</font></td>
</tr>
<tr>
<td width="60px" align="center">Fecha</td>
<td width="60px" align="center">Tipo</td>
<td width="60px" align="center">Número</td>
<td width="300px" align="left">Concepto</td>
<td width="100px" align="center">Referencia</td>
<td width="100px" align="center">Referencia Movto</td>
<td width="100px" align="center">SubProyecto</td>
<td width="100px" align="center">Cargos</td>
<td width="100px" align="center">Abonos</td>
<td width="100px" align="center">Saldo</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%" style="border: none">
<tr runat="server" id="tr1">
<td colspan="3" align="left" width="180px">
<asp:Label ID="LbCuenta" runat="server" Text='<%# Eval("Codigo")%>'></asp:Label>
</td>
<td colspan="1" align="left" width="300px">
<asp:Label ID="LbNombre" runat="server" Text='<%# Eval("Nombre")%>'></asp:Label>
</td>
<td colspan="2" width="200px"></td>
<td style="font-weight: normal;" align="right" width="100px">Saldo Inicial:
</td>
<td style="font-weight: normal;" align="right" width="100px">
<asp:Label ID="LbSaldoInicial" runat="server" Text='<%# Eval("SaldoInicial", "{0:N2}")%>'></asp:Label>
</td>
</tr>
<tr runat="server" id="tr2">
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Literal>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbTipo" runat="server" Text='<%# Eval("TipoPoliza")%>'></asp:Literal>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:HyperLink ID="HLPoliza" runat="server" Text='<%# Eval("Folio")%>' CssClass="Texto" Target="_blank"></asp:HyperLink>
</td>
<td width="300px" align="left">
<div class="truncate" style="width: 300px;">
<asp:Label ID="LbConcepto" runat="server" CssClass="truncate" Text='<%# Eval("Concepto")%>' title='<%# Eval("Concepto")%>'></asp:Label>
</div>
</td>
<td width="100px">
<asp:Label ID="LbReferencia" runat="server" Text='<%# Eval("Referencia")%>'></asp:Label>
</td>
<td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LtlRefMovto" runat="server" Text='<%# Eval("ReferenciaAdmin")%>'></asp:Literal>
</td>
<td width="100px">
<asp:Label ID="LblSubProyecto" runat="server" Text='<%# Eval("SubProyecto")%>'></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbCargos" runat="server"></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbAbonos" runat="server"></asp:Label>
</td>
<td width="100px" align="right">
<asp:Label ID="LbSaldo" runat="server"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle />
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
</script>
</asp:Content>

View File

@@ -0,0 +1,456 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Conta_LibroMayor2
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtDatos As DataTable
Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property DtTotales As DataTable
Get
DtTotales = DirectCast(ViewState("DtTotales"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtTotales") = value
End Set
End Property
Private Property FechaInicio As Date
Get
FechaInicio = ViewState("FechaInicio").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaInicio") = value
End Set
End Property
Private Property FechaFin As Date
Get
FechaFin = ViewState("FechaFin").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaFin") = value
End Set
End Property
Private Property TotalPadre As Boolean
Get
TotalPadre = CBool(ViewState("TotalPadre"))
End Get
Set(value As Boolean)
ViewState("TotalPadre") = value
End Set
End Property
Private Property DTCuentas As DataTable
Get
Return CType(ViewState("DTCuentas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTCuentas") = value
End Set
End Property
Private Property TipoReporte As String
Get
TipoReporte = ViewState("TP").ToString
End Get
Set(value As String)
ViewState("TP") = value
End Set
End Property
Private Property Cuenta As String
Get
Return ViewState("Cuenta").ToString
End Get
Set(value As String)
ViewState("Cuenta") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.CveEmpresa <> 119 Then
' Response.Redirect($"/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx")
'End If
Dim ErrorParametros As Boolean = True
CargaTipoCuentas()
'TxtCuenta.Enabled = False
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString
If Request("CveCuenta") IsNot Nothing AndAlso IsNumeric(Request("CveCuenta")) AndAlso Request("CveCuenta").ToEntero > 0 Then
If Request("FF") IsNot Nothing AndAlso Request("FF").ToString.Length = 10 AndAlso Request("FF").ToDate > "01/01/1000".ToDate Then
FechaFin = Request("FF").ToDate
txtFechaF.Text = FechaFin.ToShortDateString
DdlCuentas.SelectedValueExist(Request("CveCuenta").ToEntero)
If Request("FI") IsNot Nothing AndAlso Request("FI").ToString.Length = 10 AndAlso Request("FI").ToDate > "01/01/1000".ToDate Then
FechaInicio = Request("FI").ToDate
txtFechaI.Text = FechaInicio.ToShortDateString
Else
FechaInicio = DateSerial(Year(FechaFin), Month(FechaFin), 1)
TxtFechaF.Text = FechaInicio.ToShortDateString
End If
If Request("CveProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveProyecto")) Then
DdlProyecto.SelectedValueExist(Request("CveProyecto"))
DdlProyecto_SelectedIndexChanged(Nothing, Nothing)
End If
If Request("CveSubProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveSubProyecto")) Then
DdlSubproyecto.SelectedValueExist(Request("CveSubProyecto"))
End If
ErrorParametros = False
If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then
TipoReporte = Request("TP").ToString
' DdlTipoReporte.SelectedValue = TipoReporte.ToString
End If
''If DdlTipoCuentas.Items.FindByValue(IdCuenta.ToString) IsNot Nothing Then
'' DdlTipoCuentas.SelectedValue = IdCuenta.ToString
''Else
'' DdlTipoCuentas.SelectedValue = "-2"
'' TxtCuenta.Enabled = True
'' If DTCuentas.FiltraParametros(String.Format("Cvecuenta = {0}", IdCuenta)).Rows.Count > 0 Then
'' TxtCuenta.Text = DTCuentas.FiltraParametros(String.Format("CveCuenta = {0}", IdCuenta)).Rows(0)("Codigo").ToString
'' End If
''End If
End If
End If
If Not ErrorParametros Then
TotalPadre = True
TipoReporte = "1"
CargaDatos()
End If
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
If DdlCuentas.SelectedValue.ToEntero = -2 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
CargaDatos()
End If
' Imprimir_click(sender, e)
'RegistraScript("Enable();")
End Sub
#Region "C A R G A - D A T O S"
Public Function WSCuentas() As String
Dim Str As New StringBuilder
Dim i As Integer = 0
Dim dt As DataTable = DTCuentas
For Each dr As DataRow In dt.Rows
i += 1
Str.AppendFormat("{{value:""{0}"",label:""{1}""}}{2}", dr("CveCuenta"), dr("Codigo").ToString.Replace("""", ""), If(i < dt.Rows.Count, ",", ""))
Next
Return Str.ToString
End Function
Private Sub CargaTipoCuentas()
Dim ObjTipoCuenta As New ClsContabilidad
DdlCuentas.Enabled = True
If ObjTipoCuenta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
DTCuentas = ObjTipoCuenta.DtResultados
DdlCuentas.DataSource = ObjTipoCuenta.DtResultados.FiltraParametros("Codigo NOT IN ('_ACTIVO', '_PASIVO', '_CAPITAL', '_CUADRE', '_ESTADISTICAS', '_ORDEN', '_RACREEDOR', '_RDEUDOR', '_UTILIDAD')")
End If
ObjTipoCuenta.Dispose()
DdlCuentas.DataBind()
CargarCentrosDeCosto(DdlProyecto, DdlSubproyecto, LblProyecto, LblSubProyecto, divProyecto:=divProyecto)
End Sub
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargarSubProyecto(DdlSubproyecto, DdlProyecto.SelectedValue, "Todos")
End Sub
Private Sub CargaDatos()
Dim CveProyecto As Integer = DdlProyecto.SelectedValue.ToEntero
Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero
TipoReporte = DdlTipoReporte.SelectedValue.ToString
'If TipoReporte = "1" And DdlCuentas.SelectedValue.ToEntero < 0 Then
' Alert("No ha seleccionado cuenta, Favor de especificar una", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
Cuenta = DdlCuentas.SelectedItem.ToString
Dim ObjConta As New ClsContabilidad
If ObjConta.GetMovimientosAuxiliaresCatalogo(DdlCuentas.SelectedValue.ToEntero, FechaInicio, FechaFin, -1, CveProyecto, CveSubProyecto, UsuarioActual.CveEmpresa, TipoReporte, DdlOpcionCuentas.SelectedValue.ToEntero) Then
DtDatos = ObjConta.DtResultados
DtTotales = DtDatos.Clone
CargaGrid()
Else
DtDatos = Nothing
End If
ObjConta.Dispose()
End Sub
#End Region
Private Sub InsertaTotales()
Dim i As Integer = 0
Dim Aumento As Integer = 0
Dim Row As DataRow
Dim Row2 As DataRow
'Llena DtTotales
For Each dr As DataRow In DtDatos.Rows
If dr("Concepto").ToString = "" Then
Row = DtTotales.NewRow
Row("CveCuenta") = -1
Row("CargosMovto") = If("1" = "1", dr("Cargos"), dr("CargosME"))
Row("AbonosMovto") = If("1" = "1", dr("Abonos"), dr("AbonosME"))
Row("Saldo") = dr("SaldoActual")
Row("CtaMayor") = dr("CtaMayor")
Row("Concepto") = String.Format("Total {0}:", dr("Nombre"))
Row("Nombre") = dr("Nombre")
DtTotales.Rows.Add(Row)
Row("Clasificacion") = i
End If
i += 1
Next
'Inserta Totales en DtDatos
For Each dr As DataRow In DtTotales.Rows
i = 0
If dr("CtaMayor").ToString = "1" Then
DtDatos.ImportRow(dr)
End If
If dr("CtaMayor").ToString = "2" Then
For index As Integer = dr("Clasificacion").ToString.ToEntero + Aumento To DtDatos.Rows.Count
If DtDatos.Rows(index)("Nombre").ToString <> dr("Nombre").ToString Then
i = index
Exit For
End If
Next
Row2 = DtDatos.NewRow
Row2.ItemArray = dr.ItemArray
DtDatos.Rows.InsertAt(Row2, i + Aumento)
Aumento += 1
End If
Next
End Sub
#Region "G R I D - GV DATOS"
Private Sub CargaGrid()
GvDatos.DataSource = DtDatos
'GvDatos.Dispose()
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Concepto") = "" Then
e.Row.ControlStyle.Font.Bold = True
e.Row.ControlStyle.Height = 35
'Cuando es Titulo
If e.Row.DBCampo("SaldoActual") = "" Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Visible = False
'Cuando Es Total
Else
CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
'Anterior para TotalPadre
'If e.Row.DBCampo("CtaMayor").ToString = "2" And (e.Row.DBCampo("Nivel3").ToString <> "" Xor e.Row.DBCampo("Orden").ToString.Length = 18) Then
' e.Row.FCLabel("LbReferencia").Text = "Total:"
'Else
' e.Row.FCLabel("LbConcepto").Text = String.Format("Total {0}:", e.Row.DBCampo("Nombre").ToString)
'End If
If TotalPadre Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Width = "1px"
'CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells.Remove(CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3))
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Align = "Right"
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(3).Width = "400px"
If e.Row.RowIndex + 1 = DtDatos.Rows.Count Then
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(4).Attributes.Add("style", "border-top: 1px solid black;")
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(5).Attributes.Add("style", "border-top: 1px solid black;")
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(6).Attributes.Add("style", "border-top: 1px solid black;")
End If
e.Row.FCLabel("LbReferencia").Text = String.Format("Total {0}:", e.Row.DBCampo("Nombre").ToString)
Else
TotalPadre = True
e.Row.FCLabel("LbReferencia").Font.Bold = False
e.Row.FCLabel("LbReferencia").Text = "Total:"
CType(e.Row.FindControl("tr2"), HtmlTableRow).Cells(4).Align = "Right"
End If
'e.Row.FCLabel("LbReferencia").Text = String.Format("Total {0}:", If(e.Row.DBCampo("CtaMayor").ToString = "2", "", e.Row.DBCampo("Nombre").ToString))
e.Row.FCLabel("LbCargos").Text = e.Row.DBCampo("Cargos").ToString.FormatoNumero(If("1" = "1", 2, 4))
e.Row.FCLabel("LbAbonos").Text = e.Row.DBCampo("Abonos").ToString.FormatoNumero(If("1" = "1", 2, 4))
e.Row.FCLabel("LbSaldo").Text = e.Row.DBCampo("SaldoActual").ToString.FormatoNumero(If("1" = "1", 2, 4))
End If
Else
TotalPadre = False
e.Row.ControlStyle.Font.Bold = False
CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
e.Row.FCHyperLink("HLPoliza").NavigateUrl = String.Format("/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}", e.Row.DBCampo("CvePoliza"))
If e.Row.DBCampo("CargosMovto").ToDouble <> 0 Then e.Row.FCLabel("LbCargos").Text = e.Row.DBCampo("CargosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
If e.Row.DBCampo("AbonosMovto").ToDouble <> 0 Then e.Row.FCLabel("LbAbonos").Text = e.Row.DBCampo("AbonosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
If e.Row.DBCampo("Saldo").ToDouble <> 0 Then e.Row.FCLabel("LbSaldo").Text = e.Row.DBCampo("Saldo").ToString.FormatoNumero(If("1" = "1", 2, 4))
End If
'COLOREA NEGATIVOS
If e.Row.FCLabel("LbCargos").Text.ToDouble < 0 Then
e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbAbonos").Text.ToDouble < 0 Then
e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbSaldo").Text.ToDouble < 0 Then
e.Row.FCLabel("LbSaldo").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbSaldo").ForeColor = Drawing.Color.Black
End If
If e.Row.FCLabel("LbSaldoInicial").Text.ToDouble < 0 Then
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Red
Else
e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Black
End If
End If
End Sub
#End Region
Protected Sub Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click
If DdlCuentas.SelectedValue.ToEntero = -1 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else
FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
DtDatos = DtDatos
ImprimirReporte()
End If
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
ImprimirReporte("Excel")
'Dim htmlTabe As New HtmlTable
'Dim RutaLogo As String = $"{UsuarioActual.Empresa.Ruta}Logo.png"
'Dim strinLiteral As String = ""
'Dim EncabezadoLiteral As New LiteralControl
'If System.IO.File.Exists(RutaLogo) Then
' RutaLogo = $"http://{Request.Url.Host }/Empresas/{UsuarioActual.CveEmpresa}/Logo.png"
' strinLiteral = $"<table style='width:{ GvDatos.Width }px'><tr>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'><img width='200px' height='150px' style='max-height:150px!important;max-width:200px!important' src='{RutaLogo}' /> </td>
' <td colspan='3' style='width:70%;height:150px; text-align:center; vertical-align:middle;font-weight: bold; display: block;'><p><span>{UsuarioActual.Empresa.Empresa} </span><br><span> Movimientos Auxiliares del Catálogo<p></td>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'> Fecha:{NowADS().ToString("dd/MM/yyyy")}</td>
' </tr>
' <tr>
' <td style='text-align:left;' colspan='6'>
' <b>Filtros Cuenta:</b> {DdlCuentas.SelectedItem.Text} <b>Fecha inicio: </b>{ TxtFechaDel.Text} <b>Fecha Fin:</b> {TxtFechaAl.Text}
' <td>
' </tr>
' </table>"
'Else
' strinLiteral = $"<table style='width:{ GvDatos.Width }px'><tr>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'> </td>
' <td colspan='3' style='width:70%;height:150px; text-align:center; vertical-align:middle;font-weight: bold; display: block;'><p><span>{UsuarioActual.Empresa.Empresa} </span><br><span> Movimientos Auxiliares del Catálogo<p></td>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'> Fecha:{NowADS().ToString("dd/MM/yyyy")}</td>
' </tr>
' <tr>
' <td style='text-align:left;' colspan='9'>
' <b>Filtros Cuenta:</b> {DdlCuentas.SelectedItem.Text} <b>Fecha inicio: </b>{ TxtFechaDel.Text} <b>Fecha Fin:</b> {TxtFechaAl.Text}
' <td>
' <tr>
' </table>"
'End If
'EncabezadoLiteral.Text = strinLiteral
'GvDatos.ExportToExcel($"MovimientosAuxiliares_{NowADS().ToString("yyyyMMddmmss")}", Encabezado2:=EncabezadoLiteral)
End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("pFechaFin", FechaFin.ToString("dd/MM/yyyy")))
params.Add(New ReportParameter("pFechaInicio", FechaInicio.ToString("dd/MM/yyyy")))
params.Add(New ReportParameter("CveMoneda", "1"))
params.Add(New ReportParameter("Cuenta", Cuenta))
ImprimirPDF("Empresas/Grales/Formatos/RepMovimientosAuxiliaresCatalogo.rdlc", DtDatos, params, "MovimientosAuxiliares", Formato)
End Sub
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
End Sub
End Class