-- cambios en fluctuación de Bancos, para que sea esquema SIG

This commit is contained in:
2023-02-24 16:17:24 -07:00
parent 07d161bff3
commit 8b0ea244f4
2 changed files with 66 additions and 65 deletions

View File

@@ -738,8 +738,8 @@
<br />
<asp:GridView ID="GvCuentas" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="IdCtaAfectable,IdCtaContable,IdCtaContableComplementaria,TipoCambio,Fluctuacion,
Banco,NumCuenta,CveCuentaComplementaria,Saldo"
DataKeyNames=" TipoCambio,Fluctuacion,
Banco,NumCuenta,CveCuentaMEComplementaria,SaldoME"
EmptyDataText="No se Encontraron Cuentas Bancarias." ToolTip=""
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
@@ -750,7 +750,7 @@
</asp:TemplateField>
<asp:BoundField HeaderText="Banco" DataField="Banco" ItemStyle-Width="250" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="# Cuenta" DataField="NumCuenta" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Saldo" DataField="Saldo" ItemStyle-Width="100" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo" DataField="SaldoME" ItemStyle-Width="100" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="T.C. último ajuste" DataField="TipoCambio" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
</Columns>

View File

@@ -73,7 +73,7 @@ Partial Class Bancos_FluctuacionCambiaria
If T.ActiveTabIndex = 3 Then CargaDatosClientesAnticipos()
If T.ActiveTabIndex = 4 Then CargaDatosAcreedores()
If T.ActiveTabIndex = 5 Then CargaDatosAcreedoresAnticipos()
If T.ActiveTabIndex = 6 Then CargaDatosCuentas()
If T.ActiveTabIndex = 6 Then CargaDatosBancosCuentas()
If T.ActiveTabIndex = 7 Then CargaDatosFiliales()
If T.ActiveTabIndex = 8 Then CargaDatosDeudores()
@@ -301,42 +301,42 @@ Partial Class Bancos_FluctuacionCambiaria
GvAcreedoresAnt.DataBind()
End Sub
Private Sub CargaDatosCuentas()
Private Sub CargaDatosBancosCuentas()
Dim ObjBancos As New ClsBancos
LblTotalBancos.Text = "0.00"
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 7, UsuarioActual.CveEmpresa) Then
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 77, UsuarioActual.CveEmpresa) Then
Dim DtTemp As DataTable = ObjBancos.DtResultados.Copy
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
Dim TotAcumulado As Decimal = 0
Dim Conta As New ClsContabilidad
For Each Dr As DataRow In DtTemp.Rows
Dim Total As Decimal = 0
Dim CveCuentaExtranjera As Integer = Dr("CveCuentaExtranjera").ToString.ToEntero
If CveCuentaExtranjera > 0 Then
If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaExtranjera, MinFecha, FechaUltimoDiaMes, 2, -1, -1, UsuarioActual.CveEmpresa, "1") Then
If Conta.DtResultados.Rows.Count > 1 Then
Total = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
End If
End If
End If
Dr("Saldo") = Total
Total = Total * TCCierreFluctuacion - Total
Dim SaldoActualContabilidad As Decimal = 0
Dim CveCuentaComplementaria As Integer = Dr("CveCuentaComplementaria").ToString.ToEntero
If CveCuentaComplementaria > 0 Then
If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaComplementaria, MinFecha, FechaUltimoDiaMes, 2, -1, -1, UsuarioActual.CveEmpresa, "1") Then
If Conta.DtResultados.Rows.Count > 1 Then
SaldoActualContabilidad = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
End If
End If
End If
Dim TotAcumulado As Decimal = ObjBancos.DtResultados.SUMD("Fluctuacion")
'Dim Conta As New ClsContabilidad
'For Each Dr As DataRow In DtTemp.Rows
' Dim Total As Decimal = 0
' Dim CveCuentaExtranjera As Integer = Dr("CveCuentaExtranjera").ToString.ToEntero
' If CveCuentaExtranjera > 0 Then
' If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaExtranjera, MinFecha, FechaUltimoDiaMes, 2, -1, -1, UsuarioActual.CveEmpresa, "1") Then
' If Conta.DtResultados.Rows.Count > 1 Then
' Total = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
' End If
' End If
' End If
' Dr("Saldo") = Total
' Total = Total * TCCierreFluctuacion - Total
' Dim SaldoActualContabilidad As Decimal = 0
' Dim CveCuentaComplementaria As Integer = Dr("CveCuentaComplementaria").ToString.ToEntero
' If CveCuentaComplementaria > 0 Then
' If Conta.GetMovimientosAuxiliaresCatalogo(CveCuentaComplementaria, MinFecha, FechaUltimoDiaMes, 2, -1, -1, UsuarioActual.CveEmpresa, "1") Then
' If Conta.DtResultados.Rows.Count > 1 Then
' SaldoActualContabilidad = Conta.DtResultados.Rows(1)("SaldoActual").ToString.ToDecimal
' End If
' End If
' End If
Total = Total - SaldoActualContabilidad
TotAcumulado += Math.Round(Total, 2)
Dr("Fluctuacion") = Total
Next
DtTemp.AcceptChanges()
Conta.Dispose()
' Total = Total - SaldoActualContabilidad
' TotAcumulado += Math.Round(Total, 2)
' Dr("Fluctuacion") = Total
'Next
'DtTemp.AcceptChanges()
'Conta.Dispose()
GvCuentas.DataSource = DtTemp
LblTotalBancos.Text = TotAcumulado.FormatoNumero
@@ -910,8 +910,8 @@ Partial Class Bancos_FluctuacionCambiaria
Dim Total As Decimal = 0
Dim Conta As New ClsContabilidad
Conta.IniciaTransacSQL()
Dim ObjContPaq As New ClsContPAQi(UsuarioActual.Empresa)
ObjContPaq.IniciaTransacSQL()
'Dim ObjContPaq As New ClsContPAQi(UsuarioActual.Empresa)
'ObjContPaq.IniciaTransacSQL()
Dim idCta As Integer = 0
Dim CveCuenta As Integer = 0
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
@@ -937,8 +937,8 @@ Partial Class Bancos_FluctuacionCambiaria
For Each gvr As GridViewRow In GvCuentas.Rows
Dim cb As CheckBox = gvr.FCCheckBox("ChkGenerarBancos")
If cb.Checked Then
Total = gvr.DataKey("Fluctuacion").ToDecimal
Dim IdCtaComplementaria As Integer = gvr.DataKey("IdCtaAfectable").ToEntero
Total = gvr.DataKey("Fluctuacion").ToDecimal
' Dim IdCtaComplementaria As Integer = gvr.DataKey("IdCtaAfectable").ToEntero
Dim ConceptoReferencia As String = String.Format("{0} - {1} {2}", gvr.DataKey("Banco"), gvr.DataKey("NumCuenta"), MesTCtexto)
'MOVIMIENTO DE FLUCTUACION
@@ -952,15 +952,16 @@ Partial Class Bancos_FluctuacionCambiaria
CveCuenta = CveCuentaPerdida
idCta = idCtaPerdida
TipoMovto = False
End If
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovto, Math.Abs(Total), ConceptoReferencia, CveConconceptoBancos, ConceptoReferencia, Now, IdCtaComplementaria, 0, TipoCambio:=TC, ImporteMX:=Math.Abs(Total), ImporteME:=Math.Abs(Total)) Then
End If
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovto, Math.Abs(Total), ConceptoReferencia, CveConconceptoBancos, ConceptoReferencia, Now, 0, 0, TipoCambio:=TC, ImporteMX:=Math.Abs(Total), ImporteME:=Math.Abs(Total), CveCuenta:=gvr.DataKey("CveCuentaMEComplementaria").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), ConceptoReferencia, CveConceptoContable, ConceptoReferencia, Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyectoBancos.SelectedValue.ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), Math.Abs(Total), CveConceptoContable, ConceptoReferencia, ConceptoReferencia, 0, CveSubProyecto:=DdlSubproyectoBancos.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
End If
@@ -970,7 +971,7 @@ Partial Class Bancos_FluctuacionCambiaria
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
If AutoConta Then
If Conta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
If Conta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
SeContabilizo = True
Else
ErrorRegistrar = True
@@ -978,15 +979,15 @@ Partial Class Bancos_FluctuacionCambiaria
End If
End If
If Not ErrorRegistrar And SeContabilizo Then
If Not ErrorRegistrar Then
Conta.Commit()
ObjContPaq.Commit()
Conta.Commit()
' ObjContPaq.Commit()
Alert(String.Format("La Fluctuación se ha generado <br/> <a href='/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}'>Ver PrePóliza</a>", CvePrePoliza), TipoMensaje.MsgInformacion)
CargaDatosCuentas()
CargaDatosBancosCuentas()
Else
Conta.RollBack()
ObjContPaq.Dispose()
Conta.RollBack()
' ObjContPaq.Dispose()
End If
Conta.Dispose()
End Sub
@@ -1165,20 +1166,20 @@ Partial Class Bancos_FluctuacionCambiaria
#Region "GRIDVIEWS"
Protected Sub GvCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCuentas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'TipoCambio = e.Row.DBCampo("TipoCambio").ToString.ToDouble
'e.Row.FCLabel("LbTipoCambioActual").Text = TipoCambioActual.ToString
'e.Row.FCLabel("LbTipoCambio").Text = If(TipoCambio > 0, TipoCambio.ToString, "No hay TipoCambio")
'e.Row.FCLabel("LbFluctuacion").Text = If(TipoCambio > 0, ((TipoCambio - TipoCambioActual) * e.Row.DBCampo("Saldo").ToString.ToDouble).ToString, "No aplica")
If Not e.Row.DBCampo("IdCtaContable").ToString.ToEntero > 0 Then
' e.Row.FCLabel("LabelBanco").ForeColor = Drawing.Color.Red
End If
End If
End Sub
'Protected Sub GvCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCuentas.RowDataBound
' If e.Row.RowType = DataControlRowType.DataRow Then
' 'TipoCambio = e.Row.DBCampo("TipoCambio").ToString.ToDouble
' 'e.Row.FCLabel("LbTipoCambioActual").Text = TipoCambioActual.ToString
' 'e.Row.FCLabel("LbTipoCambio").Text = If(TipoCambio > 0, TipoCambio.ToString, "No hay TipoCambio")
' 'e.Row.FCLabel("LbFluctuacion").Text = If(TipoCambio > 0, ((TipoCambio - TipoCambioActual) * e.Row.DBCampo("Saldo").ToString.ToDouble).ToString, "No aplica")
' 'If Not e.Row.DBCampo("IdCtaContable").ToString.ToEntero > 0 Then
' ' ' e.Row.FCLabel("LabelBanco").ForeColor = Drawing.Color.Red
' 'End If
' End If
'End Sub
Private Sub GvFiliales_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvFiliales.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then