CatTipo de gasto terminado

This commit is contained in:
Antonio Gonzalez
2020-07-15 16:35:15 -07:00
parent 986b7ecb1b
commit 4c8b9e2cb0
2 changed files with 118 additions and 56 deletions

View File

@@ -2263,6 +2263,69 @@ Public Class ClsCompras
Return Retorno Return Retorno
End Function 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 #End Region
#Region "VINCULAR PAGO" #Region "VINCULAR PAGO"

View File

@@ -32,13 +32,13 @@ public partial class Compras_CatTipoGasto : ClsPaginas
private void CargaDatos() private void CargaDatos()
{ {
ClsAC ObjAC = new ClsAC(); ClsCompras ObjCompras = new ClsCompras();
if (ObjAC.GetTipoGasto()) if (ObjCompras.GetTipoGasto(-1,UsuarioActual.CveEmpresa))
{ {
GvDatos.DataSource = ObjAC.DtResultados; GvDatos.DataSource = ObjCompras.DtResultados;
GvDatos.DataBind(); GvDatos.DataBind();
} }
ObjAC.Dispose(); ObjCompras.Dispose();
} }
protected void BtnAgregarTipoGastoD_Click(object sender, EventArgs e) protected void BtnAgregarTipoGastoD_Click(object sender, EventArgs e)
@@ -46,7 +46,6 @@ public partial class Compras_CatTipoGasto : ClsPaginas
BtnAgregarTipoGasto.Text = "Agregar"; BtnAgregarTipoGasto.Text = "Agregar";
TxtTipoGasto.Text = ""; TxtTipoGasto.Text = "";
ChkEstatus.Checked = true; ChkEstatus.Checked = true;
ChkEstatus.Enabled = false;
UpModalTiposD.Update(); UpModalTiposD.Update();
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")); RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
} }
@@ -66,23 +65,23 @@ public partial class Compras_CatTipoGasto : ClsPaginas
{ {
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
CveTipoGasto = GvRow.DataKey("CveTipoGasto").ToEntero(); CveTipoGasto = GvRow.DataKey("CveTipoGasto").ToEntero();
ClsAC ObjAC = new ClsAC(); ClsCompras ObjCompras = new ClsCompras();
if (ObjAC.RemoveTipoGasto(CveTipoGasto)) if (ObjCompras.RemoveTipoGasto(CveTipoGasto))
{ {
CargaDatos(); CargaDatos();
UpDatos.Update(); UpDatos.Update();
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")); RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"));
Alert("Se eliminó el Tipo de Gasto correctamente"); Alert("Se eliminó el Tipo de Gasto correctamente");
} }
ObjAC.Dispose(); ObjCompras.Dispose();
} }
protected void BtnAgregarTipoGasto_Click(object sender, EventArgs e) protected void BtnAgregarTipoGasto_Click(object sender, EventArgs e)
{ {
ClsAC ObjAC = new ClsAC(); ClsCompras ObjCompras = new ClsCompras();
if (BtnAgregarTipoGasto.Text == "Agregar") 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(); CargaDatos();
UpDatos.Update(); UpDatos.Update();
@@ -91,7 +90,7 @@ public partial class Compras_CatTipoGasto : ClsPaginas
} }
}else }else
{ {
if (ObjAC.UpdateTipoGasto(TxtTipoGasto.Text,ChkEstatus.Checked,CveTipoGasto)) if (ObjCompras.UpdateTipoGasto(CveTipoGasto,TxtTipoGasto.Text,ChkEstatus.Checked,-1,-1))
{ {
CargaDatos(); CargaDatos();
UpDatos.Update(); UpDatos.Update();
@@ -99,6 +98,6 @@ public partial class Compras_CatTipoGasto : ClsPaginas
Alert("Se actualizó el Tipo de Gasto correctamente"); Alert("Se actualizó el Tipo de Gasto correctamente");
} }
} }
ObjAC.Dispose(); ObjCompras.Dispose();
} }
} }