diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx b/Contabilidad2/CatCuentasAsignaciones.aspx index e27cdb81e..5d785e43e 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx +++ b/Contabilidad2/CatCuentasAsignaciones.aspx @@ -21,29 +21,58 @@ + + +
+
+
+ + +
+
+
+ +
+ + + + + + + + + + + +
+ +
+
+
+ +
+
+
+ - + Style=" width:100%" GridLines="None"> - - - - - - - - - - + + + + + + - + - + - + @@ -67,53 +96,58 @@
- + +
-
+
-
- +
+
-
+

-
- +
+
-
+

- +
-
- +
+
-
- +
+
-
+
- +
-
- +
+
+
+ + +
diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb index 5564dc374..301e181af 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx.vb +++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb @@ -15,10 +15,15 @@ Partial Class Contabilidad2_CatCuentasAsignaciones End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - CargaDatos() + If Not Page.IsPostBack Then + CargaDatosModal() End If + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + CargaDatosSistema() + End Sub Private Sub CargaDatos() @@ -28,8 +33,19 @@ Partial Class Contabilidad2_CatCuentasAsignaciones End If ObjConta.Dispose() GvDatos.DataBind() + End Sub + + Private Sub CargaDatosSistema() + Dim ObjConta As New ClsContabilidad + If ObjConta.GetCuentasAsignacionesSistema(UsuarioActual.CveEmpresa, DdlTipo.selectedvalue.toentero) Then + GvDatos.DataSource = ObjConta.DtResultados + End If + ObjConta.Dispose() + GvDatos.DataBind() + UpDatos.Update() End Sub + Private Sub CargaDatosModal() DdlConceptoNomina.DataSource = GlobalDTNomConceptos(UsuarioActual.CveEmpresa) DdlConceptoNomina.DataBind() @@ -53,7 +69,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa) - + DdlActivoFijo.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa) Dim ObjBancos As New ClsBancos If ObjBancos.GetBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa) Then @@ -79,46 +95,79 @@ Partial Class Contabilidad2_CatCuentasAsignaciones End Sub Protected Sub ActualizaModulo(sender As Object, e As EventArgs) - LimpiarDatos() - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - CveConceptoAsignacion = GvRow.DataKey("CveCuentaAsignacion").ToEntero - DdlCconceptosContables.SelectedValue = GvRow.DataKey("CveConceptoContable").ToEntero - DdlCuenta.SelectedValue = GvRow.DataKey("CveCuenta").ToEntero - DdlConceptoNomina.SelectedValueExist(GvRow.DataKey("CveConceptoNomina").ToEntero) - DdlProveedor.SelectedValue = GvRow.DataKey("CveProveedor").ToEntero - DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion").ToEntero - DdlAlmacen.SelectedValue = GvRow.DataKey("CveAlmacen").ToEntero - TxtIdCuentaContable.Text = GvRow.DataKey("IdCuenta") - TxtPorcentajeIVA.Text = GvRow.DataKey("PorcentajeIVA") - DdlCuentaBancaria.SelectedValueExist(GvRow.DataKey("CveBancoCuenta")) - - Dim CveCliente As Integer = GvRow.DataKey("CveCliente").ToEntero - Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero - - If CveCliente > 0 Then - DdlClientes.setEsWebService(False) - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - DdlClientes.ddl.DataSource = ObjCliente.DtResultados - End If - DdlClientes.ddl.DataBind() - DdlClientes.ddl.SelectedValue = CveCliente - End If - - If CvePersonal > 0 Then - DdlPersonal.setEsWebService(False) - Dim ObjPersonal As New ClsRH - If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then - DdlPersonal.ddl.DataSource = ObjPersonal.DtResultados - End If - DdlPersonal.ddl.DataBind() - DdlPersonal.ddl.SelectedValue = CvePersonal - End If - - LbAgregar.Text = "Actualizar" - UpModalModulos.Update() - RegistraScript("$('#ModalCat').modal();") + LimpiarDatos() + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Dr As DataRow = GlobalDTContaConceptosContables(GvRow.DataKey("CveConceptoContable").ToEntero).FiltroPrimero("") + Dim CveConceptoContable As Integer = GvRow.DataKey("CveConceptoContable").ToString.ToEntero + HdnCveCuentaAsignacion.Value = GvRow.DataKey("CveCuentaAsignacion").ToString + + If Dr IsNot Nothing Then + CveConceptoAsignacion = GvRow.DataKey("CveCuentaAsignacion").ToEntero + DdlCconceptosContables.SelectedValueExist(GvRow.DataKey("CveConceptoContable")) + DdlCuenta.SelectedValueExist(GvRow.DataKey("CveCuenta")) + DdlConceptoNomina.SelectedValueExist(GvRow.DataKey("CveConceptoNomina").ToEntero) + DdlProveedor.SelectedValueExist(GvRow.DataKey("CveProveedor")) + DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion")) + DdlAlmacen.SelectedValueExist(GvRow.DataKey("CveAlmacen")) + TxtIdCuentaContable.Text = GvRow.DataKey("IdCuenta") + TxtPorcentajeIVA.Text = GvRow.DataKey("PorcentajeIVA") + DdlCuentaBancaria.SelectedValueExist(GvRow.DataKey("CveBancoCuenta")) + + Dim CveCliente As Integer = GvRow.DataKey("CveCliente").ToEntero + Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero + + If Dr("AplicaCliente").ToString = "True" Then + divCliente.Visible = True + If CveCliente > 0 Then + DdlClientes.setEsWebService(False) + Dim ObjCliente As New ClsClientes + If ObjCliente.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + DdlClientes.ddl.DataSource = ObjCliente.DtResultados + End If + DdlClientes.ddl.DataBind() + DdlClientes.ddl.SelectedValue = CveCliente + End If + End If + If Dr("AplicaProveedor").ToString = "True" Then + divProveedor.Visible = True + End If + + If Dr("AplicaPersonal").ToString = "True" Then + divPersonal.Visible = True + If CvePersonal > 0 Then + DdlPersonal.setEsWebService(False) + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then + DdlPersonal.ddl.DataSource = ObjPersonal.DtResultados + End If + DdlPersonal.ddl.DataBind() + DdlPersonal.ddl.SelectedValueExist(CvePersonal) + End If + End If + + If Dr("AplicaClasificacion").ToString = "True" Then + divClasificacion.Visible = True + End If + + If Dr("AplicaBancos").ToString = "True" Then + divBancos.Visible = True + End If + + If Dr("AplicaAlmacen").ToString = "True" Then + divAlmacen.Visible = True + End If + + If Dr("AplicaActivoFijo").ToString = "True" Then + divActivoFijo.Visible = True + End If + + + LbAgregar.Text = "Actualizar" + UpModalModulos.Update() + RegistraScript("$('#ModalCat').modal();") + End If + + End Sub Protected Sub EliminarRow(sender As Object, e As EventArgs) @@ -127,7 +176,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones If ObjConta.RemoveCuentasAsignaciones(GvRow.DataKey("CveCuentaAsignacion").ToEntero) Then Alert("se elimino correctamente") End If - CargaDatos() + CargaDatosSistema() UpDatos.Update() ObjConta.Dispose() End Sub @@ -162,13 +211,13 @@ Partial Class Contabilidad2_CatCuentasAsignaciones Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click Dim ObjConta As New ClsContabilidad Dim ErrorString As String = "" - If LbAgregar.Text = "Agregar" Then + If HdnCveCuentaAsignacion.Value.ToEntero <= 0 Then If Not ObjConta.AddCuentasAsignaciones(DdlCconceptosContables.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero, DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero(), CveConceptoNomina:=DdlConceptoNomina.SelectedValue.ToEntero()) Then ErrorString = "Error al agregar" End If - ElseIf LbAgregar.Text = "Actualizar" Then + ElseIf HdnCveCuentaAsignacion.Value.ToEntero > 0 Then If Not ObjConta.UpdateCuentasAsignaciones(CveConceptoAsignacion, DdlCconceptosContables.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero, DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero(), CveConceptoNomina:=DdlConceptoNomina.SelectedValue.ToEntero()) Then @@ -183,7 +232,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones Else Alert("Agregado correctamente") End If - CargaDatos() + CargaDatosSistema() UpDatos.Update() End Sub End Class