diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index a996d38e7..3da522499 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5986,6 +5986,37 @@ Public Class ClsContabilidad Return Retorno End Function + Public Function GetPrePolizasImpresion(CveEmpresa As Integer, FechaI As String, FechaF As String, Optional CveTipoPoliza As Integer = -1, Optional FolioI As Integer = -1, + Optional FolioF As Integer = -1, Optional CveUsuario As Integer = -1, Optional IdSegNegocio As Integer = -1, + Optional CveCuenta As Integer = -1, Optional CvePlantillaPoliza As Integer = -1, Optional CveProveedor As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Conta_PrePolizasImpresionGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveTipoPoliza", SqlDbType.Int).Value = CveTipoPoliza + .Add("@FolioI", SqlDbType.Int).Value = FolioI + .Add("@FolioF", SqlDbType.Int).Value = FolioF + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@IdSegNegocio", SqlDbType.Int).Value = IdSegNegocio + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@CvePlantillaPoliza", SqlDbType.Int).Value = CvePlantillaPoliza + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el catálogo de Conta Ejercicios", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + #Region " RECONSTRUCCION DE PREPOLIZAS " Public Function ReconstruirPP_PagoCompra(CvePrePoliza As Integer) As Boolean Dim Retorno = False diff --git a/Contabilidad2/CatContaEjercicios.aspx b/Contabilidad2/CatContaEjercicios.aspx index 6f5da5757..a61d0f851 100644 --- a/Contabilidad2/CatContaEjercicios.aspx +++ b/Contabilidad2/CatContaEjercicios.aspx @@ -65,11 +65,6 @@ + diff --git a/Contabilidad2/CatContaEjercicios.aspx.vb b/Contabilidad2/CatContaEjercicios.aspx.vb index 0ca03882f..157cd674d 100644 --- a/Contabilidad2/CatContaEjercicios.aspx.vb +++ b/Contabilidad2/CatContaEjercicios.aspx.vb @@ -13,6 +13,30 @@ Partial Class Contabilidad2_CatContaEjercicios ViewState("CveEjercicio") = Value End Set End Property + Private Property Ejercicio() As Integer + Get + Return If(IsNothing(ViewState("Ejercicio")), -1, CInt(ViewState("Ejercicio"))) + End Get + Set + ViewState("Ejercicio") = Value + End Set + End Property + Private Property PeriodoActualNumero() As Integer + Get + Return If(IsNothing(ViewState("PeriodoActualNumero")), -1, CInt(ViewState("PeriodoActualNumero"))) + End Get + Set + ViewState("PeriodoActualNumero") = Value + End Set + End Property + Private Property Estatus() As Boolean + Get + Return CBool(ViewState("Estatus")) + End Get + Set + ViewState("Estatus") = Value + End Set + End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then @@ -39,6 +63,7 @@ Partial Class Contabilidad2_CatContaEjercicios TxtEjercicio.Text = "" ChkEstatus.Checked = 0 DdlPeriodoActual.SelectedValue = 0 + LbAgregar.Text = "Agregar" UpModalModulos.Update() RegistraScript("$('#ModalCat').modal();") End Sub @@ -48,12 +73,12 @@ Partial Class Contabilidad2_CatContaEjercicios Dim errorString As String = "" If LbAgregar.Text = "Agregar" Then If Not ObjConta.AddContaEjercicio(DateTime.Today, UsuarioActual.CvePersonal, UsuarioActual.CveEmpresa, Ejercicio:=TxtEjercicio.Text, - PeriodoActual:=DdlPeriodoActual.SelectedValue.ToEntero, CveCuentaCierre:=DdlCuentas.SelectedValue.ToEntero, Estatus:=ChkEstatus.Checked) Then + PeriodoActual:=DdlPeriodoActual.SelectedValue.ToEntero, Estatus:=ChkEstatus.Checked) Then errorString = "Error al agregar" End If ElseIf LbAgregar.Text = "Actualizar" Then If Not ObjConta.UpdateContaEjercicio(CveEjercicio, Ejercicio:=TxtEjercicio.Text, PeriodoActual:=DdlPeriodoActual.SelectedValue.ToEntero, - CveCuentaCierre:=DdlCuentas.SelectedValue.ToEntero, Estatus:=ChkEstatus.Checked) Then + Estatus:=ChkEstatus.Checked) Then errorString = "Error al actualizar" End If End If @@ -78,7 +103,6 @@ Partial Class Contabilidad2_CatContaEjercicios TxtEjercicio.Text = GvRow.DataKey("Ejercicio") ChkEstatus.Checked = GvRow.DataKey("Estatus") DdlPeriodoActual.SelectedValue = GvRow.DataKey("PeriodoActualNumero") - DdlCuentas.SelectedValue = GvRow.DataKey("CveCuentaCierre") LbAgregar.Text = "Actualizar" UpModalModulos.Update() RegistraScript("$('#ModalCat').modal();") @@ -97,14 +121,21 @@ Partial Class Contabilidad2_CatContaEjercicios Protected Sub PolizaCierre(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Ejercicio = GvRow.DataKey("Ejercicio").ToEntero + PeriodoActualNumero = GvRow.DataKey("PeriodoActualNumero").ToEntero + + RegistraScript("$('#ModalGenerarPoliza').modal();") + End Sub + + Protected Sub LbGenerarPoliza_Click(sender As Object, e As EventArgs) Handles LbGenerarPoliza.Click Dim ObjConta As New ClsContabilidad Dim FechaI As String = $"01/01/{DateTime.Now.Year}" Dim FechaF As String = $"{DateTime.DaysInMonth(DateTime.Now.Year, 12)}/12/{DateTime.Now.Year}" Dim CvePrePolizaCierre As Integer = -1 - CvePrePolizaCierre = ObjConta.CierreEjercicio(UsuarioActual.CveEmpresa, GvRow.DataKey("Ejercicio").ToEntero, GvRow.DataKey("CveCuentaCierre").ToEntero, FechaI, FechaF, UsuarioActual.CvePersonal) + CvePrePolizaCierre = ObjConta.CierreEjercicio(UsuarioActual.CveEmpresa, Ejercicio, DdlCuentas.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CvePersonal) If CvePrePolizaCierre > 0 Then - If ObjConta.UpdateContaEjercicio(CveEjercicio, Ejercicio:=GvRow.DataKey("Ejercicio").ToEntero, PeriodoActual:=GvRow.DataKey("PeriodoActualNumero").ToEntero, - CveCuentaCierre:=GvRow.DataKey("CveCuentaCierre").ToEntero, CvePrePoliza:=CvePrePolizaCierre, Estatus:=GvRow.DataKey("Estatus")) Then + If ObjConta.UpdateContaEjercicio(CveEjercicio, Ejercicio:=Ejercicio, PeriodoActual:=PeriodoActualNumero, CveCuentaCierre:=DdlCuentas.SelectedValue.ToEntero, + CvePrePoliza:=CvePrePolizaCierre, Estatus:=Estatus) Then Alert("Cierre de ejercicio correcto") End If End If diff --git a/Contabilidad2/PolizasImpresion.aspx b/Contabilidad2/PolizasImpresion.aspx new file mode 100644 index 000000000..f266fa9be --- /dev/null +++ b/Contabilidad2/PolizasImpresion.aspx @@ -0,0 +1,116 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PolizasImpresion.aspx.vb" Inherits="Contabilidad2_PolizasImpresion" %> + + + + + + + + + + + + + +
+
+
+ +
+
+
+ +
+ +
+ + + + + + + + + + +
+
+ +
+ +
+ + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ + + + + + + +
+ + +
+ + + + + +
+ +
+ +
+
+
+ +
+ + + diff --git a/Contabilidad2/PolizasImpresion.aspx.vb b/Contabilidad2/PolizasImpresion.aspx.vb new file mode 100644 index 000000000..72185a306 --- /dev/null +++ b/Contabilidad2/PolizasImpresion.aspx.vb @@ -0,0 +1,115 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports System.Activities.Statements +Imports Microsoft.Reporting.WebForms + +Partial Class Contabilidad2_PolizasImpresion + Inherits ClsPaginas + + + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.LoadComplete + If Not IsPostBack Then + TxtFechaInicio.Text = Now.AddDays(-1).ToShortDateString + TxtFechaFin.Text = Now.ToShortDateString + + DdlUsuarioRegistro.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa) + DdlUsuarioRegistro.DataBind() + cargaddlpolizas() + CargaSegmentoNeg() + CargaCuentas() + End If + End Sub + Private Sub BtnConsultar_click(sender As Object, args As EventArgs) Handles BtnConsultar.Click + Dim foli As Integer = -1 + Dim folf As Integer = -1 + If Not FolioInicio.Text = "" Then + foli = FolioInicio.Text.ToEntero() + End If + If Not FolioFin.Text = "" Then + folf = FolioFin.Text.ToEntero() + End If + + Dim ArchivoReporte As String = "Empresas/Grales/Formatos/Polizas.rdlc" + + 'If IO.File.Exists(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta)) Then + ' ArchivoReporte = String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta) + 'End If + + Dim ObjConta As New ClsContabilidad + If ObjConta.GetPrePolizasImpresion(UsuarioActual.CveEmpresa, TxtFechaInicio.Text, TxtFechaFin.Text, CveTipoPoliza:=ddlTipoPoliza.SelectedValue.ToEntero, FolioI:=foli, + FolioF:=folf, CveUsuario:=DdlUsuarioRegistro.SelectedValue.ToEntero, IdSegNegocio:=DdlSegmentoNeg.SelectedValue.ToEntero, + CveCuenta:=DdlCuenta.SelectedValue.ToEntero, CvePlantillaPoliza:=DdlGrupoPlantilla.SelectedValue.ToEntero, + CveProveedor:=DdlTipoProveedor.SelectedValue.ToEntero) Then + If ObjConta.DtResultados.Rows.Count < 10000 Then + + If ObjConta.DtResultados.Rows.Count > 0 Then + Dim dr As DataRow + dr = ObjConta.DtResultados.Rows(0) + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString)) + params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString)) + params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString)) + params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString)) + 'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString)) + 'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString)) + params.Add(New ReportParameter("Numero", dr("Folio").ToString)) + params.Add(New ReportParameter("Moneda", "")) + params.Add(New ReportParameter("CodigoPostal", "")) + + 'If UsuarioActual.CveEmpresa = 119 Then + ' params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("IdUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre"))) + 'End If + + ImprimirPDF(ArchivoReporte, ObjConta.DtResultados, params) + + Else + Alert("Los Filtros Actuales no contienen datos") + End If + + Else + Alert("Los Filtros Actuales contienen muchos datos") + End If + End If + ObjConta.Dispose() + + End Sub + Private Sub cargaddlpolizas() + Dim objcont As New ClsContabilidad + If objcont.GetTiposPoliza(-1, "-1", UsuarioActual.CveEmpresa) Then + ddlTipoPoliza.DataSource = objcont.DtResultados + ddlTipoPoliza.DataBind() + ddlTipoPoliza.Items.Insert(0, New ListItem("Todos", "-1")) + + End If + objcont.Dispose() + DdlUsuarioRegistro.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Private Sub CargaSegmentoNeg() + Dim objtcont As New ClsContabilidad + If objtcont.GetSegmentosNegocio(-1, "-1") Then + DdlSegmentoNeg.DataSource = objtcont.DtResultados + DdlSegmentoNeg.DataBind() + End If + objtcont.Dispose() + DdlSegmentoNeg.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSegmentoNeg.Items.Insert(1, New ListItem("Sin Asignar", "-2")) + End Sub + + Private Sub CargaCuentas() + + Dim objconta As New ClsContabilidad + If objconta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then + DdlCuenta.DataSource = objconta.DtResultados + End If + objconta.Dispose() + DdlCuenta.DataBind() + + DdlCuenta.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + +End Class