CatTipo de gasto terminado
This commit is contained in:
@@ -2263,6 +2263,69 @@ Public Class ClsCompras
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddTipoGasto(TipoGasto As String, Estatus As Boolean, FechaIng As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Comp_TiposGastosAdd")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@TipoGasto", SqlDbType.NVarChar).Value = TipoGasto
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar el tipo de gasto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateTipoGasto(CveTipoGasto As Integer, TipoGasto As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Comp_TiposGastosUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveTipoGasto", SqlDbType.Int).Value = CveTipoGasto
|
||||
.Add("@TipoGasto", SqlDbType.NVarChar).Value = TipoGasto
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar el tipo de gasto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveTipoGasto(CveTipoGasto As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Comp_TiposGastosRemove")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveTipoGasto", SqlDbType.Int).Value = CveTipoGasto
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar el tipo de gasto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "VINCULAR PAGO"
|
||||
|
||||
@@ -32,13 +32,13 @@ public partial class Compras_CatTipoGasto : ClsPaginas
|
||||
|
||||
private void CargaDatos()
|
||||
{
|
||||
ClsAC ObjAC = new ClsAC();
|
||||
if (ObjAC.GetTipoGasto())
|
||||
ClsCompras ObjCompras = new ClsCompras();
|
||||
if (ObjCompras.GetTipoGasto(-1,UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvDatos.DataSource = ObjAC.DtResultados;
|
||||
GvDatos.DataSource = ObjCompras.DtResultados;
|
||||
GvDatos.DataBind();
|
||||
}
|
||||
ObjAC.Dispose();
|
||||
ObjCompras.Dispose();
|
||||
}
|
||||
|
||||
protected void BtnAgregarTipoGastoD_Click(object sender, EventArgs e)
|
||||
@@ -46,7 +46,6 @@ public partial class Compras_CatTipoGasto : ClsPaginas
|
||||
BtnAgregarTipoGasto.Text = "Agregar";
|
||||
TxtTipoGasto.Text = "";
|
||||
ChkEstatus.Checked = true;
|
||||
ChkEstatus.Enabled = false;
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
||||
}
|
||||
@@ -66,23 +65,23 @@ public partial class Compras_CatTipoGasto : ClsPaginas
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CveTipoGasto = GvRow.DataKey("CveTipoGasto").ToEntero();
|
||||
ClsAC ObjAC = new ClsAC();
|
||||
if (ObjAC.RemoveTipoGasto(CveTipoGasto))
|
||||
ClsCompras ObjCompras = new ClsCompras();
|
||||
if (ObjCompras.RemoveTipoGasto(CveTipoGasto))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"));
|
||||
Alert("Se eliminó el Tipo de Gasto correctamente");
|
||||
}
|
||||
ObjAC.Dispose();
|
||||
ObjCompras.Dispose();
|
||||
}
|
||||
|
||||
protected void BtnAgregarTipoGasto_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClsAC ObjAC = new ClsAC();
|
||||
ClsCompras ObjCompras = new ClsCompras();
|
||||
if (BtnAgregarTipoGasto.Text == "Agregar")
|
||||
{
|
||||
if (ObjAC.AddTipoGasto(TxtTipoGasto.Text,UsuarioActual.CveUsuario))
|
||||
if (ObjCompras.AddTipoGasto(TxtTipoGasto.Text,ChkEstatus.Checked,DateTime.Now.ToString(),UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
@@ -91,7 +90,7 @@ public partial class Compras_CatTipoGasto : ClsPaginas
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (ObjAC.UpdateTipoGasto(TxtTipoGasto.Text,ChkEstatus.Checked,CveTipoGasto))
|
||||
if (ObjCompras.UpdateTipoGasto(CveTipoGasto,TxtTipoGasto.Text,ChkEstatus.Checked,-1,-1))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
@@ -99,6 +98,6 @@ public partial class Compras_CatTipoGasto : ClsPaginas
|
||||
Alert("Se actualizó el Tipo de Gasto correctamente");
|
||||
}
|
||||
}
|
||||
ObjAC.Dispose();
|
||||
ObjCompras.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user