From 546e8012435deb7526bf0645ade17528441305d9 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 27 Nov 2023 17:58:54 -0700 Subject: [PATCH] -- cambios en pago a tdc --- Bancos/Transferencias.aspx | 6 +- Bancos/Transferencias.aspx.vb | 102 +++++++++++++--------------------- 2 files changed, 41 insertions(+), 67 deletions(-) diff --git a/Bancos/Transferencias.aspx b/Bancos/Transferencias.aspx index 32049484a..02e1234d8 100644 --- a/Bancos/Transferencias.aspx +++ b/Bancos/Transferencias.aspx @@ -53,10 +53,10 @@ - + Cuenta Destino: - + @@ -182,7 +182,7 @@ - + <%-- diff --git a/Bancos/Transferencias.aspx.vb b/Bancos/Transferencias.aspx.vb index c13bd152b..bcfdd3191 100644 --- a/Bancos/Transferencias.aspx.vb +++ b/Bancos/Transferencias.aspx.vb @@ -60,12 +60,13 @@ Partial Class Bancos_Transferencias If Opcion = 1 Then LtlTitulo.Text = "Domicialización de tarjeta" RBLOpcion.Visible = True - TrCuentaOrigen.Visible = False + TrCuentaDestino.Visible = False chkMovimientoTarjeta.Checked = True chkMovimientoTarjeta.Enabled = False + CargaCuenta(-1, DdlCuentaOrigen) chkMovimientoTarjeta_CheckedChanged(Nothing, Nothing) - CargaCuenta(-1, DdlCuentaDestino) - CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) + + 'CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) Else CargaCuenta(-1, DdlCuentaOrigen) CargaCuenta(DdlCuentaOrigen.SelectedValue.ToEntero, DdlCuentaDestino) @@ -89,7 +90,7 @@ Partial Class Bancos_Transferencias End If Ddl.DataBind() - DdlCuentaDestino_SelectedIndexChanged(Nothing, Nothing) + 'DdlCuentaDestino_SelectedIndexChanged(Nothing, Nothing) If CveCuenta > 0 Then VerificaMonedas() @@ -155,43 +156,41 @@ Partial Class Bancos_Transferencias End Sub - Protected Sub DdlCuentaDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaDestino.SelectedIndexChanged + 'Protected Sub DdlCuentaDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaDestino.SelectedIndexChanged - VerificaMonedas() + ' VerificaMonedas() - If Opcion = 1 Then - CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - End If + ' If Opcion = 1 Then + ' CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) + ' End If - If chkMovimientoTarjeta.Checked AndAlso GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCuenta = {0} AND UsaTarjeta = 1", DdlCuentaDestino.SelectedValue.ToEntero)).Rows.Count > 0 Then - CargaGridTarjetas() - Else - GvTC.Visible = False - End If + ' If chkMovimientoTarjeta.Checked AndAlso GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCuenta = {0} AND UsaTarjeta = 1", DdlCuentaDestino.SelectedValue.ToEntero)).Rows.Count > 0 Then + ' CargaGridTarjetas() + ' Else + ' GvTC.Visible = False + ' End If - End Sub + 'End Sub Private Sub CargaGridTarjetas() Dim ObjCreditos As New ClsBancos If ObjCreditos.GetTarjetasCreditos(DdlCuentaOrigen.SelectedValue.ToEntero) Then If ObjCreditos.DtResultados.Rows.Count > 0 Then GvTC.DataSource = ObjCreditos.DtResultados + GvTC.Visible = True End If - - GvTC.DataBind() UpGvTC.Update() - - GvTC.Visible = True End If ObjCreditos.Dispose() + GvTC.DataBind() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click 'VALIDACIONES Dim SumaImportesTarjeta As Decimal = 0D - If GvTC.Visible Then + If GvTC.Visible AndAlso GvTC.Rows.Count > 0 Then For Each row As GridViewRow In GvTC.Rows SumaImportesTarjeta += row.FCTextBox("TxtAbono").Text.ToDecimal Next @@ -202,8 +201,8 @@ Partial Class Bancos_Transferencias End If End If - If DdlCuentaDestino.SelectedValue = "" Then - Alert("Seleccione cuenta destino", TipoMensaje.MsgAdvertencia) + If DdlCuentaOrigen.SelectedValue = "" Then + Alert("Seleccione cuenta origen", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -225,8 +224,7 @@ Partial Class Bancos_Transferencias Dim ObjIE As New ClsBancos() Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) - 'Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) - Dim TipoCambio As Double = If(TxtTipoCambio.Visible, TxtTipoCambio.Text.ToDecimal, 0) + Dim TipoCambio As Double = If(TxtTipoCambio.Visible, TxtTipoCambio.Text.ToDecimal, 1) Dim CveMonedaOrigen, CveMonedaDestino As Integer Dim FolioOrigen As String = TxtFolio.Text.Trim Dim FolioDestino As String = GetFolio(DdlCuentaDestino.SelectedValue.ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3)) @@ -246,15 +244,14 @@ Partial Class Bancos_Transferencias filemove = fileItem.filename Next - - dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaDestino.SelectedValue)) - If dr IsNot Nothing Then CveMonedaDestino = dr("CveMoneda").ToString.ToEntero + dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaOrigen.SelectedValue)) + If dr IsNot Nothing Then CveMonedaOrigen = dr("CveMoneda").ToString.ToEntero If Opcion = -1 Then - dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaOrigen.SelectedValue)) - If dr IsNot Nothing Then CveMonedaOrigen = dr("CveMoneda").ToString.ToEntero + dr = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaDestino.SelectedValue)) + If dr IsNot Nothing Then CveMonedaDestino = dr("CveMoneda").ToString.ToEntero Else - CveMonedaOrigen = CveMonedaDestino + CveMonedaDestino = CveMonedaOrigen End If If CveMonedaOrigen = 1 AndAlso CveMonedaDestino <> 1 Then @@ -275,21 +272,18 @@ Partial Class Bancos_Transferencias If CveMonedaOrigen = 2 AndAlso CveMonedaDestino = 2 Then TipoCambio = TxtTipoCambio.Text.ToDouble 'GlobalTipoCambio(TxtFechaDocumento.Text.ToDate) End If - - Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Bancos/Transferencias", 13, TxtImporte.Text.Trim.ToDouble, TxtImporte.Text.Trim.ToDouble, CveMonedaOrigen, TxtFechaDocumento.Text.ToDate, $"Transferencia entre cuentas {TxtObservaciones.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If UsuarioActual.CveEmpresa = 48 Then CuentaDestino = "Alumbrado publico de Hermosillo S.A de C.V" Observaciones = String.Format("{0} {1}", DdlCuentaDestino.SelectedItem.Text, TxtObservaciones.Text.Trim) Else - CuentaDestino = String.Format("Transferencia Cta: {0}", DdlCuentaDestino.SelectedItem.Text) + CuentaDestino = String.Format("Transferencia Cta: {0}", If(DdlCuentaDestino.SelectedItem IsNot Nothing, DdlCuentaDestino.SelectedItem.Text, "")) Observaciones = TxtObservaciones.Text.Trim End If - If Opcion = 1 Then 'ESTO ES TRANSFERENCIA ENTRE - CveIE = ObjIE.AddBancos_IE(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, CuentaDestino, ImporteMXOrigen, CveMonedaOrigen, TipoCambio, Observaciones, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + CveIE = ObjIE.AddBancos_IE(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, TxtFolio.Text.Trim, CuentaDestino, ImporteMXOrigen, CveMonedaOrigen, TipoCambio, Observaciones, "", False, False, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIEDestino = CveIE Else @@ -325,11 +319,6 @@ Partial Class Bancos_Transferencias If MsgError = "" Then If CvePrePoliza > 0 Then - - Dim alertaContabilizacion As String = "Se envió correctamente la siguiente póliza:

" - Dim CuentasContablesInvalidas As New StringBuilder - Dim RowCuentaOrigen As DataRow = Nothing - Dim TipoMovtoDetalle As Boolean = True If RBLOpcion.SelectedValue = "2" Then TipoMovtoDetalle = False ' cuando sea un reembolso/devolución, es ingreso a bancos Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal @@ -360,7 +349,7 @@ Partial Class Bancos_Transferencias For Each row As GridViewRow In GvTC.Rows If row.FCTextBox("TxtAbono").Text.ToDecimal > 0 Then - FolioDestino = GetFolio(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TransaccioSQL:=ObjIE.IniciaTransacSQL()) + FolioDestino = GetFolio(row.DataKey("CveCuenta").ToEntero, If(DdlTipoMovto.SelectedValue = "2", 8, 3), TransaccionSQL:=ObjIE.IniciaTransacSQL()) If FolioDestino.Trim.Length = 0 Then MsgError = "Ocurrio un error al obtener el folio destino." @@ -414,18 +403,14 @@ Partial Class Bancos_Transferencias End If If MsgError = "" Then - If CveIE > 0 Then AlertaGlobal.AppendFormat("

Movimiento: {1}", CveIE, FolioOrigen) End If If CveIEDestino > 0 AndAlso CveIE <> CveIEDestino Then - If Not chkMovimientoTarjeta.Checked Then AlertaGlobal.AppendFormat("

Recepción: {1}", CveIEDestino, FolioDestino) End If End If - Else - MsgError = "no se pudo insertar el detalle de la póliza2" End If Else MsgError = "no se pudo insertar el detalle de la póliza" @@ -455,10 +440,7 @@ Partial Class Bancos_Transferencias CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) TxtImporte.Text = "" TxtObservaciones.Text = "" - - GeneraChequePDF(CveIEDestino, UsuarioActual.Empresa) - - + 'GeneraChequePDF(CveIEDestino, UsuarioActual.Empresa) Else ObjIE.RollBack() Alert(MsgError) @@ -466,7 +448,7 @@ Partial Class Bancos_Transferencias ObjIE.Dispose() ObjMov.Dispose() - 'If ObjComp IsNot Nothing Then ObjComp.Dispose() + End Sub Private Sub EnviaCorreo(Comprobante As String) @@ -592,24 +574,21 @@ Partial Class Bancos_Transferencias TxtFolio.Text = GetFolio(CveCuenta, CveTipoTransaccion) End Sub - Private Function GetFolio(CveCuenta As Integer, CveTipoTransaccion As Integer, Optional ByRef TransaccioSQL As SqlTransaction = Nothing) As String + Private Function GetFolio(CveCuenta As Integer, CveTipoTransaccion As Integer, Optional ByRef TransaccionSQL As SqlTransaction = Nothing) As String Dim Folio As String Dim Banco As ClsBancos - If TransaccioSQL Is Nothing Then + If TransaccionSQL Is Nothing Then Banco = New ClsBancos Else - Banco = New ClsBancos(TransaccioSQL) + Banco = New ClsBancos(TransaccionSQL) End If - Folio = Banco.GetNextFolio(CveCuenta, CveTipoTransaccion).ToString - If TransaccioSQL Is Nothing Then + If TransaccionSQL Is Nothing Then Banco.Dispose() End If - - Return Folio End Function @@ -629,18 +608,13 @@ Partial Class Bancos_Transferencias Private Sub DdlTipoMovto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoMovto.SelectedIndexChanged RFVTxtPaguese.Visible = False + CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - If Opcion = 1 Then - CargaFolio(DdlCuentaDestino.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - Else - CargaFolio(DdlCuentaOrigen.SelectedValue.ToEntero, DdlTipoMovto.SelectedValue.ToEntero) - + If Not Opcion = 1 Then If DdlTipoMovto.SelectedValue.ToEntero = 1 And Opcion <> 1 Then 'CHEQUE ACTIVA EL REQUIRED DE TxtPaguese RFVTxtPaguese.Visible = True End If - End If - UPPDatos.Update() End Sub