From fc7dedc60eac4343bb73c43960b27af27298b626 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 28 Jul 2021 20:31:11 -0700 Subject: [PATCH] parametro movto permanente --- App_Code/ClsNominas.vb | 11 +++--- Bancos/Devoluciones.aspx.cs | 67 +++++++++++++++++++++---------------- Nomina/Nomina.aspx.cs | 5 ++- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 71020a7ac..3295fce89 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -2603,8 +2603,8 @@ Public Class ClsNominas End Try Return retorno End Function - Public Function AddMovtoPermanente(cveConcepto As Int32, cvePersonal As Int32, descripcion As String, tipoDescuento As Int32, valor As Double, vecesAplicar As Int32, montoLimite As Decimal, fechaInicioAplicacion As String, estatus As Boolean, CveCuenta As Integer) As Boolean - Dim retorno As Boolean = False + Public Function AddMovtoPermanente(cveConcepto As Int32, cvePersonal As Int32, descripcion As String, tipoDescuento As Int32, valor As Double, vecesAplicar As Int32, montoLimite As Decimal, fechaInicioAplicacion As String, estatus As Boolean, CveCuenta As Integer) As Integer + Dim retorno As Integer = 0 DataAdapter("PA_AddMovtoPermanente", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters @@ -2618,15 +2618,16 @@ Public Class ClsNominas .Add("@fechaInicioAplicacion", SqlDbType.VarChar).Value = (fechaInicioAplicacion) .Add("@estatus", SqlDbType.Bit).Value = (estatus) .Add("@CveCuenta", SqlDbType.Int).Value = (CveCuenta) + .Add("@CveMovtoPermanente", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - retorno = True + retorno = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero Catch sqEx As SqlException - retorno = False + retorno = -1 OnError("Ocurrió un error al agregar los movimientos permanentes.", sqEx, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) Catch ex As Exception - retorno = False + retorno = -1 OnError("Ocurrió un error al agregar los movimientos permanentes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno diff --git a/Bancos/Devoluciones.aspx.cs b/Bancos/Devoluciones.aspx.cs index 017243297..9a4c6db72 100644 --- a/Bancos/Devoluciones.aspx.cs +++ b/Bancos/Devoluciones.aspx.cs @@ -112,8 +112,7 @@ public partial class Bancos_Devoluciones : ClsPaginas } protected void TipoDevolucion_SelectedIndexChanged(object sender, EventArgs e) - { - string tipo = ""; + { switch (TipoDevolucion.SelectedValue) { case "1": @@ -160,7 +159,7 @@ public partial class Bancos_Devoluciones : ClsPaginas } protected void CargaPersonal() { - DdlPersonal.DataSource = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa); + DdlPersonal.DataSource = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("", "NombreCompleto"); DdlPersonal.DataBind(); DdlPersonal.Items.Insert(0, new ListItem("Seleccione", "-1")); } @@ -417,25 +416,7 @@ public partial class Bancos_Devoluciones : ClsPaginas if (OpcionDevolucion.SelectedValue.ToEntero() == 3 && TipoDevolucion.SelectedValue.ToString().ToEntero() == 2) { - foreach (GridViewRow gvr in GvDevoluciones.Rows) - { - if (gvr.FCCheckBox("Chk").Checked) - { - if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovoDevolucion, gvr.FCTextBox("TxtAbonar").Text.ToDecimal(), Ref, CveConceptoContableDevolucion, Conc, DateTime.Now, 0, -1, CveProveedor: cveProveedor, CvePersonal: cvePersonal, ImporteMX: gvr.FCTextBox("TxtAbonar").Text.ToDecimal(), CveIEDevolucion: CveIE)) - { - MsgError = "No se pudo insertar concepto de Devolución"; - break; - } - } - } - //GUARDA PREPOLIZAS DETALLE Bancos - if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, !TipoMovoDevolucion, TxtImporte.Text.ToDecimal(), Ref, 174, Conc, DateTime.Now, 0, -1, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero(), CveCliente: cveCliente, CveProveedor: cveProveedor, CvePersonal: cvePersonal, ImporteMX: TxtImporte.Text.ToDecimal())) - { - MsgError = "No se pudo insertar concepto de Devolución"; - } - - if (MsgError.Equals("")) - { + int cveConcepto = DdlConcepto.SelectedValue.ToEntero(); string descripcion = TxtDescripcion.Text; @@ -448,11 +429,36 @@ public partial class Bancos_Devoluciones : ClsPaginas bool estatus = true; int CveCuenta = -1; - if (!ObjNom.AddMovtoPermanente(cveConcepto, cvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus, CveCuenta)) + if (ObjNom.AddMovtoPermanente(cveConcepto, cvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus, CveCuenta) < 0) { MsgError = "No se pudo insertar movimiento permanente"; } + + + foreach (GridViewRow gvr in GvDevoluciones.Rows) + { + if (gvr.FCCheckBox("Chk").Checked) + { + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovoDevolucion, gvr.FCTextBox("TxtAbonar").Text.ToDecimal(), Ref, CveConceptoContableDevolucion, Conc, DateTime.Now, 0, -1, CveProveedor: cveProveedor, CvePersonal: cvePersonal, ImporteMX: gvr.FCTextBox("TxtAbonar").Text.ToDecimal(), CveIEDevolucion: CveIE)) + { + MsgError = "No se pudo insertar concepto de Devolución"; + break; + } + else + { + //Decimal tTotal = (TxtValor.Text.ToDecimal() * TxtVecesAplicar.Text.ToDecimal()).RoundSQL(); + Decimal tTotal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal(); + //GUARDA PREPOLIZAS DETALLE Via Nómina + if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, !TipoMovoDevolucion, tTotal, Ref, 174, Conc, DateTime.Now, 0, -1, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero(), CveCliente: cveCliente, CveProveedor: cveProveedor, CvePersonal: cvePersonal, ImporteMX: tTotal)) + { + MsgError = "No se pudo insertar concepto de Devolución"; + } + } + } } + + + } else @@ -612,17 +618,20 @@ public partial class Bancos_Devoluciones : ClsPaginas Msg.AppendFormat(@"

Ver Póliza", IDPoliza); } ObjIE.Commit(); + + if (!Msg.ToString().Equals("")) + { + string AccionJS = String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery); + Alert(Msg.ToString(), TipoMensaje.MsgInformacion, String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery)); + } } else { ObjIE.RollBack(); + Msg.Clear(); + Alert(Msg.ToString(), TipoMensaje.MsgError); } - - if (!Msg.ToString().Equals("")) - { - string AccionJS = String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery); - Alert(Msg.ToString(), TipoMensaje.MsgInformacion, String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery)); - } + ObjIE.Dispose(); ObjMov.Dispose(); diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index fc195f656..cf9a412a2 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -1395,7 +1395,7 @@ public partial class Nomina_Nomina2 : ClsPaginas Archivo fileItem = continuar ? Filesgral[0] : null; if (continuar) { - string FileExtension = fileItem.Extencion.ToUpper(); + string FileExtension = fileItem.Extension.ToUpper(); if (FileExtension == "XLS" | FileExtension == "XLSX" | FileExtension == "CSV") { } @@ -4586,8 +4586,7 @@ public partial class Nomina_Nomina2 : ClsPaginas bool Continuar; using (ClsNominas ObjMovt = new ClsNominas()) { - Continuar = ObjMovt.AddMovtoPermanente(cveConcepto, SRCvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus, CveCuenta); - + Continuar = ObjMovt.AddMovtoPermanente(cveConcepto, SRCvePersonal, descripcion, tipoDescuento, valor, vecesAplicar, montoLimite, fechaInicioAplicacion, estatus, CveCuenta) > 0; } if (Continuar) {