--asignación de cuentas

This commit is contained in:
2023-11-24 11:54:41 -07:00
parent 687fdabab5
commit 07753cbf02
2 changed files with 134 additions and 21 deletions

View File

@@ -868,11 +868,17 @@
<div id="divCuentas" runat="server" visible="false">
<div class="col-md-6">
<asp:Button ID="BtnVincularCuenta" runat="server" CssClass="btn btn-primary btn-sm" Text="+ Cuenta" Visible="false" />
<asp:Button ID="BtnCuentaDesglose" runat="server" CssClass="btn btn-primary btn-sm" Text="+ Crear Cuenta Proveedores" Visible="false" CommandArgument="Proveedores" OnClick="BtnCuentaDesglose_Click" />
<asp:GridView ID="GvCta" runat="server" DataKeyNames="ConceptoContable,NombreCuenta" AutoGenerateColumns="False" EmptyDataText="" ToolTip="Listado de Historial de Ventas" CssClass="table table-striped table-advance table-hover" Style=" width: 100%;" GridLines="None">
<asp:GridView ID="GvCta" runat="server" DataKeyNames="CveConceptoContable,CveCuentaAsignacion,CveCuenta" AutoGenerateColumns="False" EmptyDataText="" ToolTip="Listado de Historial de Ventas" CssClass="table table-striped table-advance table-hover" Style=" width: 100%;" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Concepto Contable" DataField="ConceptoContable" />
<asp:BoundField HeaderText="Nombre Cuenta" DataField="NombreCuenta" />
<asp:TemplateField ItemStyle-Width="49px">
<ItemTemplate>
<asp:LinkButton ID="ImgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="ActualizaContaCuenta" CssClass="btn btn-circle btn-xs green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
@@ -4164,6 +4170,46 @@
</div>
</div>
<div id="ModalContaCuenta" 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">Cuenta</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UPPCta" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div>
<asp:HiddenField ID="HdnCveCuentaAsignacion" runat="server" />
<asp:HiddenField ID="HdnCveConceptoContable" runat="server" />
<asp:DropDownList ID="DdlConceptosContables" CssClass="form-control input-sm input-small select2me" runat="server" Width="80%" DataTextField="ConceptoContable" DataValueField="CveConceptoContable">
<asp:ListItem Selected="True" Text="Seleccione" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DdlContaCuenta" CssClass="form-control input-sm input-small select2me" runat="server" Width="80%" DataTextField="CtaCodigo" DataValueField="CveCuenta">
<asp:ListItem Selected="True" Text="Seleccione" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button2" runat="server" CssClass="btn btn-primary btn-sm" Text="+" Visible="False" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnCuentaAsociar" Text="Vincular Cuenta" runat="server" ClientIDMode="Static" OnClick="BtnCuentaAsociar_Click" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
<iframe id="my_iframe" style="display: none;"></iframe>
</asp:Content>

View File

@@ -1032,13 +1032,18 @@ Partial Class Compras_Proveedores
End Sub
Private Sub CargaCuentasConceptos()
If UsuarioActual.TienePermisoProceso(88) OrElse UsuarioActual.TienePermisoProceso(87) Then
BtnVincularCuenta.Visible = True
If UsuarioActual.CveEmpresa = 13 Then BtnCuentaDesglose.Visible = True
End If
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentasConceptos(1, UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor) Then
If ObjConta.GetCuentasConceptos(-1, UsuarioActual.CveEmpresa, CveProveedor:=CveProveedor) Then
GvCta.DataSource = ObjConta.DtResultados
If ObjConta.DtResultados.Rows.Count = 0 Then BtnCuentaDesglose.Visible = True
If ObjConta.DtResultados.Rows.Count = 0 Then BtnCuentaDesglose.Visible = True Else BtnCuentaDesglose.Visible = False
End If
ObjConta.Dispose()
GvCta.DataBind()
UPPContable.Update()
End Sub
@@ -5184,11 +5189,11 @@ Partial Class Compras_Proveedores
Dim Row As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CargaEvaluacion(Row)
Dim Fecha = TxtFechaE.Text.ToDateTime()
Dim Mes = Fecha.ToString("MMMM", New CultureInfo("es-MX"))
Dim Obs = TxtObsE.Text.Trim()
Dim Calificacion = TxtCalificacion.Text.ToEntero()
Dim Firma = TxtFirma.Text
Dim Fecha As DateTime = TxtFechaE.Text.ToDateTime()
Dim Mes As String = Fecha.ToString("MMMM", New CultureInfo("es-MX"))
Dim Obs As String = TxtObsE.Text.Trim()
Dim Calificacion As Integer = TxtCalificacion.Text.ToEntero()
Dim Firma As String = TxtFirma.Text
Dim Resultado As String = ""
@@ -5206,12 +5211,12 @@ Partial Class Compras_Proveedores
Dim Row As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CargaEvaluacion(Row)
Dim Fecha = TxtFechaE.Text.ToDateTime()
Dim Fecha As DateTime = TxtFechaE.Text.ToDateTime()
Dim Mes = Fecha.ToString("MMMM", New CultureInfo("es-MX"))
Dim Obs = TxtObsE.Text.Trim()
Dim Calificacion = TxtCalificacion.Text.ToEntero()
Dim Firma = TxtFirma.Text
Dim Mes As String = Fecha.ToString("MMMM", New CultureInfo("es-MX"))
Dim Obs As String = TxtObsE.Text.Trim()
Dim Calificacion As Integer = TxtCalificacion.Text.ToEntero()
Dim Firma As String = TxtFirma.Text
Dim Resultado As String = ""
@@ -5232,9 +5237,9 @@ Partial Class Compras_Proveedores
e.Row.FCRadioButtonList("RblRespuesta").Visible = False
End If
If e.Row.DBCampo("TipoDato") = "2" Then
Dim CvePregunta = e.Row.DBCampo("CvePreguntaEvaluacion").ToEntero()
Dim CvePregunta As Integer = e.Row.DBCampo("CvePreguntaEvaluacion").ToEntero()
If CvePregunta > 0 AndAlso DtRespuestasEvaluacion IsNot Nothing Then
Dim Respuesta = DtRespuestasEvaluacion.FiltroPrimeroValor("RespuestaBit", $"CvePreguntaEvaluacion={CvePregunta}")
Dim Respuesta As String = DtRespuestasEvaluacion.FiltroPrimeroValor("RespuestaBit", $"CvePreguntaEvaluacion={CvePregunta}")
e.Row.FCRadioButtonList("RblRespuesta").SelectedValue = Respuesta
End If
End If
@@ -5244,8 +5249,8 @@ Partial Class Compras_Proveedores
Private Sub CargaEvaluacion(Row As GridViewRow)
LimpiarDatosEvaluacion()
Dim CveEvaluacionProveedor = Row.DataKey("CveEvaluacionProveedor").ToEntero()
Dim CveCompra = Row.DataKey("CveCompra").ToEntero()
Dim CveEvaluacionProveedor As Integer = Row.DataKey("CveEvaluacionProveedor").ToEntero()
Dim CveCompra As Integer = Row.DataKey("CveCompra").ToEntero()
TxtRS.Text = Row.DataKey("RazonSocial")
TxtCodigoE.Text = Row.DataKey("Codigo")
@@ -5314,7 +5319,7 @@ Partial Class Compras_Proveedores
End Sub
Protected Function GetTagsCartaEvaluacion(Proveedor As String, Dia As String, Mes As String, Calificacion As String, Resultado As String) As List(Of TagsDocumentos)
Dim ListaTagsDocumentost = New List(Of TagsDocumentos)
Dim ListaTagsDocumentost As New List(Of TagsDocumentos)
ListaTagsDocumentost.Add(New TagsDocumentos("{{Proveedor}}", Proveedor))
ListaTagsDocumentost.Add(New TagsDocumentos("{{Dia}}", Dia))
ListaTagsDocumentost.Add(New TagsDocumentos("{{Mes}}", Mes))
@@ -5345,7 +5350,7 @@ Partial Class Compras_Proveedores
Return ListaTagsDocumentost
End Function
Protected Function GetTagsFormatoEvaluacion() As List(Of TagsDocumentos)
Dim ListaTagsDocumentos = New List(Of TagsDocumentos)
Dim ListaTagsDocumentos As New List(Of TagsDocumentos)
ListaTagsDocumentos.Add(New TagsDocumentos("{{Proveedor}}", TxtRS.Text.Trim()))
ListaTagsDocumentos.Add(New TagsDocumentos("{{Codigo}}", TxtCodigoE.Text.Trim()))
ListaTagsDocumentos.Add(New TagsDocumentos("{{Fecha}}", TxtFechaE.Text))
@@ -5630,7 +5635,7 @@ Partial Class Compras_Proveedores
Private Sub BtnSendMail_Click(sender As Object, e As EventArgs) Handles BtnSendMail.Click
'NotificacionPago(HdnCveIE.Value.ToEntero, Txt)
Dim ObjMail As New ClsSisMail()
Dim Body = GeneraCorreo(HdnCveIE.Value.ToEntero)
Dim Body As String = GeneraCorreo(HdnCveIE.Value.ToEntero)
Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail)
@@ -5827,6 +5832,9 @@ Partial Class Compras_Proveedores
ObjBancos.Dispose()
End Sub
#Region "Asignación-Cuentas"
Protected Sub BtnCuentaDesglose_Click(sender As Object, e As EventArgs)
Dim tCveConcepto As Integer = 5
Dim tError As Boolean = False
@@ -5837,6 +5845,8 @@ Partial Class Compras_Proveedores
Dim CveCuentaGlobal As Integer = -2
If UsuarioActual.CveEmpresa = 13 Then
CveCuentaGlobal = 84157
Else
End If
'If ObjConta.GetCuentasGlobales(UsuarioActual.CveEmpresa, tCveConcepto) Then
Dim Cve As Integer = ObjConta.GeneraCuentaDesglose(tCveConcepto, 1, CveCuentaGlobal, CveProveedor, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
@@ -5860,6 +5870,10 @@ Partial Class Compras_Proveedores
tError = True
End If
End If
If Not tError AndAlso UsuarioActual.CveEmpresa.Contiene(13) Then
'para EMD, vincular la de anticipos
ObjConta.AddCuentasAsignaciones(10, UsuarioActual.CveEmpresa, Cve, CveProveedor:=CveProveedor)
End If
End If
End If
Else
@@ -5872,14 +5886,67 @@ Partial Class Compras_Proveedores
Alert("Cuenta Generada correctamente.<br>" & Msg)
ObjConta.Commit()
If ObjContai IsNot Nothing Then ObjContai.Commit()
CargaCuentasConceptos()
Else
ObjConta.RollBack()
If ObjContai IsNot Nothing Then ObjContai.RollBack()
ObjConta.Dispose()
End If
ObjConta.Dispose()
CargaCuentasContables()
End Sub
Private Sub BtnVincularCuenta_Click(sender As Object, e As EventArgs) Handles BtnVincularCuenta.Click
RegistraScript("$('#ModalContaCuenta').modal('show');")
DdlContaCuenta.DataSource = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa, Afectable:=1)
DdlContaCuenta.DataBind()
DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1).FiltraParametros(" CveConceptoContable in (5,305,10,311)")
DdlConceptosContables.DataBind()
UPPCta.Update()
End Sub
Protected Sub BtnCuentaAsociar_Click(sender As Object, e As EventArgs)
Dim ObjConta As New ClsContabilidad
ObjConta.IniciaTransacSQL()
Dim ErrorString As String = ""
If HdnCveCuentaAsignacion.Value.ToEntero <= 0 Then
If Not ObjConta.AddCuentasAsignaciones(DdlConceptosContables.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlContaCuenta.SelectedValue.ToEntero, CveProveedor:=CveProveedor) Then
ErrorString = "Error al agregar"
End If
ElseIf HdnCveCuentaAsignacion.Value.ToEntero > 0 Then
If Not ObjConta.UpdateCuentasAsignaciones(HdnCveCuentaAsignacion.Value.ToEntero, DdlConceptosContables.SelectedValue.ToEntero, CveCuenta:=DdlContaCuenta.SelectedValue.ToEntero, CveProveedor:=CveProveedor) Then
ErrorString = "Error al actualizar"
End If
End If
If ErrorString.Length > 0 Then
ObjConta.RollBack()
Else
ObjConta.Commit()
RegistraScript("$('#ModalContaCuenta').modal('hide');")
Alert("Agregado correctamente")
End If
ObjConta.Dispose()
End Sub
Protected Sub ActualizaContaCuenta(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveConceptoContable As Integer = GvRow.DataKey("CveConceptoContable").ToString.ToEntero
HdnCveCuentaAsignacion.Value = GvRow.DataKey("CveCuentaAsignacion").ToString
HdnCveConceptoContable.Value = GvRow.DataKey("CveConceptoContable").ToString
DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1).FiltraParametros(" CveConceptoContable in (5,305,10,311)")
DdlConceptosContables.DataBind()
DdlContaCuenta.DataSource = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa, Afectable:=1)
DdlContaCuenta.DataBind()
DdlContaCuenta.SelectedValue = GvRow.DataKey("CveCuenta").ToString
DdlConceptosContables.SelectedValueExist(GvRow.DataKey("CveConceptoContable"))
RegistraScript("$('#ModalContaCuenta').modal('show');")
UPPCta.Update()
End Sub
#End Region
End Class