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

@@ -2239,11 +2239,11 @@ Public Class ClsCompras
End Try
Return Retorno
End Function
End Function
#End Region
#Region "TIPOS DE GASTOS"
Public Function GetTipoGasto(CveTipoGasto As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_TiposGastosGet")
@@ -2261,50 +2261,113 @@ Public Class ClsCompras
End Try
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
#Region "VINCULAR PAGO"
'Public Function GetVincularPago(CveProveedor As Integer, CveCompra As Integer, Tipo As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional CveTipoProveedor As Integer = -1) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_Comp_VincularPagoGet")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
' .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
' .Add("@Tipo", SqlDbType.Int).Value = Tipo
' .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
' .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
' .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al obtener los pagos a vincular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
'End Function
'Public Function GetVincularPago(CveProveedor As Integer, Monto As Decimal, XMLPagos As String, CveEmpresa As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_Comp_VincularComplementoPagoGet")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
' .Add("@Monto", SqlDbType.Float).Value = Monto
' .Add("@XMLPagos", SqlDbType.Xml).Value = XMLPagos
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al obtener la vinculación de complemento de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
'End Function
'Public Function GetVincularPago(CveProveedor As Integer, CveCompra As Integer, Tipo As Integer, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Optional CveTipoProveedor As Integer = -1) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_Comp_VincularPagoGet")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
' .Add("@CveCompra", SqlDbType.Int).Value = CveCompra
' .Add("@Tipo", SqlDbType.Int).Value = Tipo
' .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
' .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
' .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al obtener los pagos a vincular.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
'End Function
'Public Function GetVincularPago(CveProveedor As Integer, Monto As Decimal, XMLPagos As String, CveEmpresa As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_Comp_VincularComplementoPagoGet")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
' .Add("@Monto", SqlDbType.Float).Value = Monto
' .Add("@XMLPagos", SqlDbType.Xml).Value = XMLPagos
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al obtener la vinculación de complemento de pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
'End Function
Public Function AddComplementoPago(CveIE As Integer, CveCompra As Integer, Importe As Decimal, CvePrePolizaDetalle As Integer, CveFactura As Integer) As Integer
Dim Retorno As Integer = 0
DataAdapter("PA_Comp_ComplementoPagoAdd")

View File

@@ -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();
}
}