-- cambios de asignación de cuentas, neuvo esquema

This commit is contained in:
2023-11-22 09:28:50 -07:00
parent 00e6997f94
commit c750a6951b
3 changed files with 114 additions and 56 deletions

View File

@@ -101,7 +101,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cuenta Ingresos">
<asp:TemplateField HeaderText="Cuenta Ingresos" Visible="true">
<ItemTemplate>
<asp:Label ID="LtlCuentaIngresos" runat="server" Text=''></asp:Label>
</ItemTemplate>

View File

@@ -110,7 +110,7 @@
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" ShowHeader="True" DataKeyNames="CveClasificacion,CveSubProyecto" EmptyDataText="No se encontraron Clasificaciones Registradas" ToolTip="Listado de Clasificaciones" CssClass="table table-striped table-hover Widthall" Style="text-align: left;" GridLines="None">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" ShowHeader="True" DataKeyNames="CveClasificacion,CveSubProyecto,CveCuentaAsignacionGasto" EmptyDataText="No se encontraron Clasificaciones Registradas" ToolTip="Listado de Clasificaciones" CssClass="table table-striped table-hover Widthall btn-sm" Style="text-align: left;" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Proyecto">
<ItemTemplate>
@@ -135,11 +135,11 @@
<asp:Literal ID="LtlCuentaGasto" runat="server" Text='<%# Eval("CuentaGasto")%>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="DdlCuentaGasto" DataTextField="CtaCodigo" CssClass="form-control input-sm select2me" DataValueField="Id" runat="server" Width="144px"></asp:DropDownList>
<asp:DropDownList ID="DdlCuentaGasto" DataTextField="CtaCodigo" CssClass="form-control input-sm select2me" DataValueField="CveCuenta" runat="server" Width="100%"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cuenta Costos">
<asp:TemplateField HeaderText="Cuenta Costos" Visible="false">
<ItemTemplate>
<asp:Literal ID="LtlCuentaCostos" runat="server" Text='<%# Eval("CuentaCostos")%>'></asp:Literal>
</ItemTemplate>
@@ -148,7 +148,7 @@
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cuenta Ingresos" HeaderStyle-Width="400px">
<asp:TemplateField HeaderText="Cuenta Ingresos" HeaderStyle-Width="400px" Visible="false">
<ItemTemplate>
<asp:Literal ID="LtlCuentaIngresos" runat="server" Text='<%# Eval("CuentaIngresos")%>'></asp:Literal>
</ItemTemplate>

View File

@@ -40,32 +40,32 @@ Partial Class CatClasificacionesDetalle
If CargaDatos() Then
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
Dim Cuenta As New ClsContPAQi(UsuarioActual.Empresa)
'If UsuarioActual.Empresa.TipoContabilidad = 2 Then
' Dim Cuenta As New ClsContPAQi(UsuarioActual.Empresa)
If Cuenta.GetCuentas(-1, "-1", -1) Then
DtCuentas = Cuenta.DtResultados
End If
Cuenta.Dispose()
Try
DdlCuentaGasto.DataSource = DtCuentas : DdlCuentaGasto.DataBind()
Catch ex As Exception
' If Cuenta.GetCuentas(-1, "-1", -1) Then
' DtCuentas = Cuenta.DtResultados
' End If
' Cuenta.Dispose()
' Try
' DdlCuentaGasto.DataSource = DtCuentas : DdlCuentaGasto.DataBind()
' Catch ex As Exception
End Try
' End Try
Try
DdlCuentaCostos.DataSource = DtCuentas : DdlCuentaCostos.DataBind()
Catch ex As Exception
' Try
' DdlCuentaCostos.DataSource = DtCuentas : DdlCuentaCostos.DataBind()
' Catch ex As Exception
End Try
' End Try
Try
DdlCuentaIngresos.DataSource = DtCuentas : DdlCuentaIngresos.DataBind()
Catch ex As Exception
' Try
' DdlCuentaIngresos.DataSource = DtCuentas : DdlCuentaIngresos.DataBind()
' Catch ex As Exception
End Try
' End Try
End If
'End If
DdlCuentaGasto.Items.Insert(0, New ListItem("-", "-1"))
DdlCuentaCostos.Items.Insert(0, New ListItem("-", "-1"))
DdlCuentaIngresos.Items.Insert(0, New ListItem("-", "-1"))
@@ -103,9 +103,9 @@ Partial Class CatClasificacionesDetalle
If dr IsNot Nothing Then
TxtClasificacion.Text = dr("Clasificacion").ToString
LblClasificacion.Text = dr("Clasificacion").ToString
DdlCuentaGasto.SelectedValue = dr("IdCuentaGasto").ToString
DdlCuentaCostos.SelectedValue = dr("IdCuentaCostos").ToString
DdlCuentaIngresos.SelectedValue = dr("IdCuentaIngresos").ToString
'DdlCuentaGasto.SelectedValue = dr("CveCuentaGasto").ToString
'DdlCuentaCostos.SelectedValue = dr("IdCuentaCostos").ToString
'DdlCuentaIngresos.SelectedValue = dr("IdCuentaIngresos").ToString
DdlCategoria.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa)
DdlCategoria.DataBind()
@@ -117,7 +117,6 @@ Partial Class CatClasificacionesDetalle
If ObjClasificaciones.GetClasificacionesSubProyecto(CveClasificacion, UsuarioActual.CveEmpresa) Then
ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados
Else
Me.GvDatos.DataSource = Nothing
End If
@@ -159,34 +158,34 @@ Partial Class CatClasificacionesDetalle
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.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(150)
e.Row.Cells(1).Width = Unit.Pixel(150)
e.Row.Cells(2).Width = Unit.Pixel(220)
e.Row.Cells(3).Width = Unit.Pixel(220)
'If e.Row.RowIndex = 0 Then
' e.Row.Cells(0).Width = Unit.Pixel(150)
' e.Row.Cells(1).Width = Unit.Pixel(150)
' e.Row.Cells(2).Width = Unit.Pixel(220)
' e.Row.Cells(3).Width = Unit.Pixel(220)
e.Row.Cells(4).Width = Unit.Pixel(60)
e.Row.Cells(5).Width = Unit.Pixel(61)
'e.Row.Cells(7).Width = Unit.Pixel(50)
'e.Row.Cells(8).Width = Unit.Pixel(50)
End If
' e.Row.Cells(4).Width = Unit.Pixel(60)
' e.Row.Cells(5).Width = Unit.Pixel(61)
' 'e.Row.Cells(7).Width = Unit.Pixel(50)
' 'e.Row.Cells(8).Width = Unit.Pixel(50)
'End If
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
e.Row.FCDropDownList("DdlCuentaGasto").DataSource = DtCuentas
e.Row.FCDropDownList("DdlCuentaGasto").DataSource = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa, Afectable:=1)
e.Row.FCDropDownList("DdlCuentaGasto").DataBind()
e.Row.FCDropDownList("DdlCuentaGasto").Items.Insert(0, New ListItem("-", "-1"))
e.Row.FCDropDownList("DdlCuentaGasto").SelectedValue = e.Row.DBCampo("IdCuentaGasto")
e.Row.FCDropDownList("DdlCuentaGasto").SelectedValue = e.Row.DBCampo("CveCuentaGasto")
e.Row.FCDropDownList("DdlCuentaCostos").DataSource = DtCuentas
e.Row.FCDropDownList("DdlCuentaCostos").DataBind()
e.Row.FCDropDownList("DdlCuentaCostos").Items.Insert(0, New ListItem("-", "-1"))
e.Row.FCDropDownList("DdlCuentaCostos").SelectedValue = e.Row.DBCampo("IdCuentaCostos")
'e.Row.FCDropDownList("DdlCuentaCostos").DataSource = DtCuentas
'e.Row.FCDropDownList("DdlCuentaCostos").DataBind()
'e.Row.FCDropDownList("DdlCuentaCostos").Items.Insert(0, New ListItem("-", "-1"))
'e.Row.FCDropDownList("DdlCuentaCostos").SelectedValue = e.Row.DBCampo("IdCuentaCostos")
e.Row.FCDropDownList("DdlCuentaIngresos").DataSource = DtCuentas
e.Row.FCDropDownList("DdlCuentaIngresos").DataBind()
e.Row.FCDropDownList("DdlCuentaIngresos").Items.Insert(0, New ListItem("-", "-1"))
e.Row.FCDropDownList("DdlCuentaIngresos").SelectedValue = e.Row.DBCampo("IdCuentaIngresos")
'e.Row.FCDropDownList("DdlCuentaIngresos").DataSource = DtCuentas
'e.Row.FCDropDownList("DdlCuentaIngresos").DataBind()
'e.Row.FCDropDownList("DdlCuentaIngresos").Items.Insert(0, New ListItem("-", "-1"))
'e.Row.FCDropDownList("DdlCuentaIngresos").SelectedValue = e.Row.DBCampo("IdCuentaIngresos")
'e.Row.FCDropDownList("DdlCuentaInventario").DataSource = DtCuentas
'e.Row.FCDropDownList("DdlCuentaInventario").DataBind()
@@ -210,15 +209,27 @@ Partial Class CatClasificacionesDetalle
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
Dim ObjClasificaciones As New ClsClasificaciones
If ObjClasificaciones.RemoveClasificacion(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
'Dim ObjClasificaciones As New ClsClasificaciones
'If ObjClasificaciones.RemoveClasificacion(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
' GvDatos.EditIndex = -1
' ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
' Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion)
'Else
' Alert("Ocurrió un error al eliminar la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError)
'End If
'CargaGlobal()
'ObjClasificaciones.Dispose()
Dim ObjClasificaciones As New ClsContabilidad
If ObjClasificaciones.RemoveCuentasAsignaciones(GvDatos.Rows(e.RowIndex).DataKey("CveCuentaAsignacionGasto").ToEntero) Then
GvDatos.EditIndex = -1
ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
CargaDatos()
'ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al eliminar la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
CargaGlobal()
ObjClasificaciones.Dispose()
If ViewState("Orden").ToString() <> String.Empty Then
@@ -227,7 +238,6 @@ Partial Class CatClasificacionesDetalle
CargaGrid("")
End If
End Sub
Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
@@ -240,14 +250,14 @@ Partial Class CatClasificacionesDetalle
End Sub
Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
Dim ObjClasificaciones As New ClsClasificaciones
'Dim ObjClasificaciones As New ClsClasificaciones
Dim CveSubProyecto As Integer = e.Keys("CveSubProyecto").ToString.ToEntero
Dim tCveClasificacion As Integer = e.Keys("CveClasificacion").ToString.ToEntero
Dim DdlGasto As DropDownList = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuentaGasto")
Dim DdlCostos As DropDownList = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuentaCostos")
Dim DdlIngresos As DropDownList = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuentaIngresos")
'Dim DdlCostos As DropDownList = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuentaCostos")
'Dim DdlIngresos As DropDownList = GvDatos.Rows(e.RowIndex).FCDropDownList("DdlCuentaIngresos")
'If ObjClasificaciones.UpdateClasificacionSubProyecto(tCveClasificacion, CveSubProyecto, DdlIngresos.SelectedValue.ToEntero, DdlIngresos.SelectedItem.Text) Then
' GvDatos.EditIndex = -1
@@ -256,6 +266,54 @@ Partial Class CatClasificacionesDetalle
'Else
' Alert("Ocurrió un error al actualizar la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError)
'End If
Dim gvr As GridViewRow = GvDatos.Rows(e.RowIndex)
Dim ObjClasificaciones As New ClsContabilidad
If gvr.DataKey("CveCuentaAsignacionGasto").ToEntero = 0 Then
If ObjClasificaciones.AddCuentasAsignaciones(6, UsuarioActual.CveEmpresa,
DdlGasto.SelectedValue.ToEntero,
CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero,
CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero) Then
GvDatos.EditIndex = -1
CargaDatos()
'ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("La Clasificación se registró correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al registró la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
Else
If DdlGasto.SelectedValue.ToEntero > 0 Then
If ObjClasificaciones.UpdateCuentasAsignaciones(gvr.DataKey("CveCuentaAsignacionGasto").ToEntero,
CveConceptoContable:=6,
CveCuenta:=DdlGasto.SelectedValue.ToEntero,
CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero,
CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero) Then
GvDatos.EditIndex = -1
CargaDatos()
'ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("La Clasificación se actualizo correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error se actualizó la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
Else
If ObjClasificaciones.RemoveCuentasAsignaciones(gvr.DataKey("CveCuentaAsignacionGasto").ToEntero) Then
GvDatos.EditIndex = -1
CargaDatos()
'ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error se eliminó la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
End If
End If
ObjClasificaciones.Dispose()