This commit is contained in:
Oscar Irigoyen
2023-02-25 08:31:41 -07:00
59 changed files with 1019 additions and 4635 deletions

View File

@@ -368,7 +368,7 @@
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="# Facturas" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataNavigateUrlFields="CveCompra"/>
<asp:HyperLinkField HeaderText="# Folio" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataNavigateUrlFields="CveIE"/>
<asp:BoundField DataField="Fecha" HeaderText="Fecha" DataFormatString="{0:d}" />
<asp:BoundField DataField="TipoDocto" HeaderText="Tipo" />
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
@@ -475,7 +475,7 @@
<br />
<asp:GridView ID="GvVentas" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="TipoCambio,Fluctuacion,CveVenta,SerieFolio,CveIE,IdCtaContComplementaria,TipoDocto" EmptyDataText="No se Encontraron Cuentas Bancarias."
DataKeyNames="TipoCambio,Fluctuacion,CveVenta,SerieFolio,CveIE,IdCtaContComplementaria,TipoDocto,CveCliente" EmptyDataText="No se Encontraron Cuentas Bancarias."
ToolTip="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="Nombre" HeaderText="Cliente" Target="_blank" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataNavigateUrlFields="CveCliente" />
@@ -696,7 +696,7 @@
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="# Facturas" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataNavigateUrlFields="CveCompra"/>
<asp:HyperLinkField HeaderText="# Folio" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataNavigateUrlFields="CveIE"/>
<asp:BoundField DataField="FechaDocumento" HeaderText="Fecha" DataFormatString="{0:d}" />
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo USD" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
@@ -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
@@ -435,7 +435,7 @@ Partial Class Bancos_FluctuacionCambiaria
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString.ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero, CveProveedor:=gvr.DataKey("CveProveedor").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
@@ -515,7 +515,7 @@ Partial Class Bancos_FluctuacionCambiaria
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString.ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero, CveProveedor:=gvr.DataKey("CveProveedor").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
@@ -526,7 +526,11 @@ Partial Class Bancos_FluctuacionCambiaria
End If
Next
Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 2, CveBitacora, UsuarioActual.CveEmpresa)
If Not ErrorRegistrar Then
If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 2, CveBitacora, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
End If
End If
End If
@@ -538,6 +542,7 @@ Partial Class Bancos_FluctuacionCambiaria
Conta.RollBack()
Alert("Error al generar la fluctuación", TipoMensaje.MsgError)
End If
Banco.Dispose()
Conta.Dispose()
End Sub
@@ -613,7 +618,7 @@ Partial Class Bancos_FluctuacionCambiaria
End If
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero, CveCliente:=gvr.DataKey("CveCliente").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
@@ -796,7 +801,7 @@ Partial Class Bancos_FluctuacionCambiaria
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), 202, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), 202, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero, CveProveedor:=gvr.DataKey("CveProveedor").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
@@ -905,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
@@ -932,11 +937,10 @@ 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
If Total > 0 Then
CveConceptoContable = 64
@@ -948,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
@@ -966,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
@@ -974,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
@@ -1161,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
@@ -1268,7 +1273,6 @@ Partial Class Bancos_FluctuacionCambiaria
Banco.Dispose()
End Sub
Protected Sub BtnAcreedoresAntRemove_Click(sender As Object, e As EventArgs)
Dim Banco As New ClsBancos
Banco.IniciaTransacSQL()