Aplicar CveSubProyecto a conceptos 69,177,64,65,211
This commit is contained in:
@@ -19,6 +19,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargarCentrosDeCosto(Nothing, DdlSubproyecto, Nothing, LblSubProyecto)
|
||||
CargaUltimaFluctuacion()
|
||||
End If
|
||||
End Sub
|
||||
@@ -218,13 +219,19 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
End If
|
||||
ObjBancos.Dispose()
|
||||
GvFiliales.DataBind()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION COMPRAS"
|
||||
|
||||
|
||||
Protected Sub BtnGeneraCompras_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If DdlSubproyecto.SelectedValue.ToEntero < 0 Then
|
||||
Alert($"Debe de seleccionar un {LblSubProyecto.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
Conta.IniciaTransacSQL()
|
||||
@@ -245,7 +252,6 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
|
||||
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
|
||||
|
||||
|
||||
Total = LblTotal.ToDecimal
|
||||
If Total > 0 Then
|
||||
CveConceptoContable = 64
|
||||
@@ -257,8 +263,11 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
CveCuenta = CveCuentaPerdida
|
||||
idCta = idCtaPerdida
|
||||
TipoMovto = False
|
||||
End If
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta) Then
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyecto.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
|
||||
@@ -284,13 +293,20 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Conta.RollBack()
|
||||
End If
|
||||
Conta.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION VENTAS"
|
||||
|
||||
|
||||
Protected Sub BtnGeneraVentas_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If DdlSubproyecto.SelectedValue.ToEntero < 0 Then
|
||||
Alert($"Debe de seleccionar un {LblSubProyecto.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
Conta.IniciaTransacSQL()
|
||||
@@ -323,7 +339,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
idCta = idCtaPerdida
|
||||
TipoMovto = False
|
||||
End If
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta) Then
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyecto.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
|
||||
@@ -354,13 +370,20 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Conta.RollBack()
|
||||
End If
|
||||
Conta.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION BANCOS"
|
||||
|
||||
Protected Sub BtnGeneraBancos_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
If DdlSubproyecto.SelectedValue.ToEntero < 0 Then
|
||||
Alert($"Debe de seleccionar un {LblSubProyecto.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Protected Sub BtnGeneraBancos_Click(sender As Object, e As EventArgs)
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
Conta.IniciaTransacSQL()
|
||||
@@ -417,7 +440,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta) Then
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyecto.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
End If
|
||||
@@ -446,13 +469,20 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
ObjContPaq.Dispose()
|
||||
End If
|
||||
Conta.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION DEUDOR"
|
||||
|
||||
Protected Sub BtnGeneraDedudores_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
If DdlSubproyecto.SelectedValue.ToEntero < 0 Then
|
||||
Alert($"Debe de seleccionar un {LblSubProyecto.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Protected Sub BtnGeneraDedudores_Click(sender As Object, e As EventArgs)
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
|
||||
@@ -493,7 +523,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
idCta = idCtaPerdida
|
||||
TipoMovto = False
|
||||
End If
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, ConceptoFluctuacion, Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta) Then
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, ConceptoFluctuacion, Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyecto.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
|
||||
@@ -519,13 +549,18 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
End If
|
||||
Conta.Dispose()
|
||||
Banco.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION FILIALES"
|
||||
|
||||
Protected Sub BtnGeneraFiliales_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Protected Sub BtnGeneraFiliales_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If DdlSubproyecto.SelectedValue.ToEntero < 0 Then
|
||||
Alert($"Debe de seleccionar un {LblSubProyecto.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
@@ -571,7 +606,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
idCta = idCtaPerdida
|
||||
TipoMovto = False
|
||||
End If
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, ConceptoFluctuacion, Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta) Then
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, ConceptoFluctuacion, Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyecto.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
|
||||
@@ -614,13 +649,19 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Conta.Dispose()
|
||||
Banco.Dispose()
|
||||
ObjContPaq.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION ACREEDORES"
|
||||
|
||||
Protected Sub BtnGeneraAcreedores_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Protected Sub BtnGeneraAcreedores_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
If DdlSubproyecto.SelectedValue.ToEntero < 0 Then
|
||||
Alert($"Debe de seleccionar un {LblSubProyecto.Text}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Total As Decimal = 0
|
||||
Dim Conta As New ClsContabilidad
|
||||
@@ -655,7 +696,7 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
idCta = idCtaPerdida
|
||||
TipoMovto = False
|
||||
End If
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta) Then
|
||||
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), " ", CveConceptoContable, "Fluctuación", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlSubproyecto.SelectedValue.ToEntero) Then
|
||||
ErrorRegistrar = True
|
||||
End If
|
||||
|
||||
@@ -680,162 +721,162 @@ Partial Class Bancos_FluctuacionCambiaria
|
||||
Conta.RollBack()
|
||||
End If
|
||||
Conta.Dispose()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "FLUCTUACION GENERAL"
|
||||
|
||||
' Protected Sub BtnGenerar_Click(sender As Object, e As EventArgs)
|
||||
' Dim AcumuladoGananciaCompras = 0.0, AcumuladoPerdidaCompras = 0.0, AcumuladoGananciaBancos = 0.0, AcumuladoPerdidaBancos = 0.0
|
||||
' Dim IDPoliza = -1
|
||||
|
||||
' 'Valida datos de Compras
|
||||
' For Each gvr As GridViewRow In GvCompras.Rows
|
||||
' If gvr.DataKey("SinTipoCambio").ToString.ToEntero > 0 AndAlso Not gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' Alert("No se puede Generar la Fluctuación ya que faltan datos en Compras")
|
||||
' 'Exit Sub
|
||||
' Else
|
||||
' If gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If gvr.DataKey("Fluctuacion").ToString.ToDouble > 0 Then
|
||||
' AcumuladoGananciaCompras += gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' Else
|
||||
' AcumuladoPerdidaCompras += gvr.DataKey("Fluctuacion").ToString.ToDouble * -1
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'Valida datos de Bancos
|
||||
' For Each gvr As GridViewRow In GvCuentas.Rows
|
||||
' If Not gvr.DataKey("TipoCambio").ToString.ToEntero > 0 AndAlso Not gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' Alert("No se puede Generar la Fluctuación ya que faltan datos en Cuentas Bancarias")
|
||||
' 'Exit Sub
|
||||
' Else
|
||||
' If gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If gvr.DataKey("Fluctuacion").ToString.ToDouble > 0 Then
|
||||
' AcumuladoGananciaBancos += gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' Else
|
||||
' AcumuladoPerdidaBancos += gvr.DataKey("Fluctuacion").ToString.ToDouble * -1
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
' ObjConta.IniciaTransacSQL()
|
||||
' Dim ObjBancos As New ClsBancos
|
||||
' ObjBancos.IniciaTransacSQL()
|
||||
' Dim ErrorGenerar = False
|
||||
' Dim Fecha As Date = TxtFecha.Text.ToDate
|
||||
|
||||
' IDPoliza = ObjConta.AddPoliza(3, "Fluctuación Cambiaria", (AcumuladoGananciaCompras + AcumuladoPerdidaCompras) * 2, (AcumuladoGananciaCompras + AcumuladoPerdidaCompras) * 2, UsuarioActual.CveUsuario, Fecha)
|
||||
|
||||
' If IDPoliza > 0 Then
|
||||
|
||||
' 'COMIENZA: AGREGA CUENTAS BANCARIAS
|
||||
' If AcumuladoGananciaBancos > 0 Or AcumuladoPerdidaBancos > 0 Then
|
||||
' 'Agrega movimientos
|
||||
' Dim Fluc As Double
|
||||
' For Each gvr As GridViewRow In GvCuentas.Rows
|
||||
' Fluc = gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' If Math.Abs(Fluc) > 0 AndAlso gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, gvr.DataKey("IdCtaAfectable").ToString.ToEntero, Not Fluc > 0, Math.Abs(Fluc), "", String.Format("{0} Cambiaria de Cuentas Bancarias", If(Fluc > 0, "Ganancia", "Perdida")), 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'Agrega acumulados
|
||||
' If Not ErrorGenerar AndAlso AcumuladoGananciaBancos > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, 2195, AcumuladoGananciaBancos > 0, AcumuladoGananciaBancos, "", "Acumulado Ganancia Cambiaria de Cuentas Bancarias", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' If Not ErrorGenerar AndAlso AcumuladoPerdidaBancos > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, 4695, AcumuladoPerdidaBancos > 0, AcumuladoPerdidaBancos, "", "Acumulado Pérdida Cambiaria de Cuentas Bancarias", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' 'TERMINA: AGREGA CUENTAS BANCARIAS
|
||||
|
||||
|
||||
' 'COMIENZA: AGREGA COMPRAS
|
||||
' If AcumuladoGananciaCompras > 0 Or AcumuladoPerdidaCompras > 0 Then
|
||||
' 'Agrega movimientos
|
||||
' Dim Fluc As Double
|
||||
' For Each gvr As GridViewRow In GvCompras.Rows
|
||||
' Fluc = gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' If Math.Abs(Fluc) > 0 AndAlso gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, gvr.DataKey("IdCtaAfectable").ToString.ToEntero, Not Fluc > 0, Math.Abs(Fluc), "", String.Format("{0} Cambiaria de Compras", If(Fluc > 0, "Ganancia", "Pérdida")), 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'Agrega acumulados
|
||||
' If Not ErrorGenerar AndAlso AcumuladoGananciaCompras > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, Not AcumuladoGananciaCompras > 0, AcumuladoGananciaCompras, "", "Acumulado Ganancia Cambiaria de Compras", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' If Not ErrorGenerar AndAlso AcumuladoPerdidaCompras > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, Not AcumuladoPerdidaCompras > 0, AcumuladoPerdidaCompras, "", "Acumulado Pérdida Cambiaria de Compras", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' 'TERMINA: AGREGA COMPRAS
|
||||
|
||||
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
|
||||
|
||||
' 'Agrega en Bitacoras
|
||||
' If Not ErrorGenerar Then
|
||||
' If ObjBancos.AddFluctuacionesBitacora(IDPoliza, Fecha, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
' If Not ObjBancos.AddFluctuacionesBitacora(IDPoliza, Fecha, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
' If Not ErrorGenerar Then
|
||||
|
||||
' ObjConta.AjustaPoliza(IDPoliza)
|
||||
|
||||
' ObjConta.Commit()
|
||||
' ObjBancos.Commit()
|
||||
' Alert(String.Format("Fluctuación realizada con exito.<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza))
|
||||
' Else
|
||||
' ObjConta.RollBack()
|
||||
' ObjBancos.RollBack()
|
||||
' Alert("Ocurrio un error al generar la poliza", TipoMensaje.MsgAdvertencia)
|
||||
' End If
|
||||
|
||||
' ObjConta.Dispose()
|
||||
' ObjBancos.Dispose()
|
||||
' End Sub
|
||||
|
||||
|
||||
|
||||
' Protected Sub BtnGenerar_Click(sender As Object, e As EventArgs)
|
||||
' Dim AcumuladoGananciaCompras = 0.0, AcumuladoPerdidaCompras = 0.0, AcumuladoGananciaBancos = 0.0, AcumuladoPerdidaBancos = 0.0
|
||||
' Dim IDPoliza = -1
|
||||
|
||||
' 'Valida datos de Compras
|
||||
' For Each gvr As GridViewRow In GvCompras.Rows
|
||||
' If gvr.DataKey("SinTipoCambio").ToString.ToEntero > 0 AndAlso Not gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' Alert("No se puede Generar la Fluctuación ya que faltan datos en Compras")
|
||||
' 'Exit Sub
|
||||
' Else
|
||||
' If gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If gvr.DataKey("Fluctuacion").ToString.ToDouble > 0 Then
|
||||
' AcumuladoGananciaCompras += gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' Else
|
||||
' AcumuladoPerdidaCompras += gvr.DataKey("Fluctuacion").ToString.ToDouble * -1
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'Valida datos de Bancos
|
||||
' For Each gvr As GridViewRow In GvCuentas.Rows
|
||||
' If Not gvr.DataKey("TipoCambio").ToString.ToEntero > 0 AndAlso Not gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' Alert("No se puede Generar la Fluctuación ya que faltan datos en Cuentas Bancarias")
|
||||
' 'Exit Sub
|
||||
' Else
|
||||
' If gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If gvr.DataKey("Fluctuacion").ToString.ToDouble > 0 Then
|
||||
' AcumuladoGananciaBancos += gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' Else
|
||||
' AcumuladoPerdidaBancos += gvr.DataKey("Fluctuacion").ToString.ToDouble * -1
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
' ObjConta.IniciaTransacSQL()
|
||||
' Dim ObjBancos As New ClsBancos
|
||||
' ObjBancos.IniciaTransacSQL()
|
||||
' Dim ErrorGenerar = False
|
||||
' Dim Fecha As Date = TxtFecha.Text.ToDate
|
||||
|
||||
' IDPoliza = ObjConta.AddPoliza(3, "Fluctuación Cambiaria", (AcumuladoGananciaCompras + AcumuladoPerdidaCompras) * 2, (AcumuladoGananciaCompras + AcumuladoPerdidaCompras) * 2, UsuarioActual.CveUsuario, Fecha)
|
||||
|
||||
' If IDPoliza > 0 Then
|
||||
|
||||
' 'COMIENZA: AGREGA CUENTAS BANCARIAS
|
||||
' If AcumuladoGananciaBancos > 0 Or AcumuladoPerdidaBancos > 0 Then
|
||||
' 'Agrega movimientos
|
||||
' Dim Fluc As Double
|
||||
' For Each gvr As GridViewRow In GvCuentas.Rows
|
||||
' Fluc = gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' If Math.Abs(Fluc) > 0 AndAlso gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, gvr.DataKey("IdCtaAfectable").ToString.ToEntero, Not Fluc > 0, Math.Abs(Fluc), "", String.Format("{0} Cambiaria de Cuentas Bancarias", If(Fluc > 0, "Ganancia", "Perdida")), 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'Agrega acumulados
|
||||
' If Not ErrorGenerar AndAlso AcumuladoGananciaBancos > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, 2195, AcumuladoGananciaBancos > 0, AcumuladoGananciaBancos, "", "Acumulado Ganancia Cambiaria de Cuentas Bancarias", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' If Not ErrorGenerar AndAlso AcumuladoPerdidaBancos > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, 4695, AcumuladoPerdidaBancos > 0, AcumuladoPerdidaBancos, "", "Acumulado Pérdida Cambiaria de Cuentas Bancarias", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' 'TERMINA: AGREGA CUENTAS BANCARIAS
|
||||
|
||||
|
||||
' 'COMIENZA: AGREGA COMPRAS
|
||||
' If AcumuladoGananciaCompras > 0 Or AcumuladoPerdidaCompras > 0 Then
|
||||
' 'Agrega movimientos
|
||||
' Dim Fluc As Double
|
||||
' For Each gvr As GridViewRow In GvCompras.Rows
|
||||
' Fluc = gvr.DataKey("Fluctuacion").ToString.ToDouble
|
||||
' If Math.Abs(Fluc) > 0 AndAlso gvr.DataKey("IdCtaAfectable").ToString.ToEntero > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, gvr.DataKey("IdCtaAfectable").ToString.ToEntero, Not Fluc > 0, Math.Abs(Fluc), "", String.Format("{0} Cambiaria de Compras", If(Fluc > 0, "Ganancia", "Pérdida")), 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'Agrega acumulados
|
||||
' If Not ErrorGenerar AndAlso AcumuladoGananciaCompras > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, UsuarioActual.Empresa.IdCuentaGananciaCambiaria, Not AcumuladoGananciaCompras > 0, AcumuladoGananciaCompras, "", "Acumulado Ganancia Cambiaria de Compras", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' If Not ErrorGenerar AndAlso AcumuladoPerdidaCompras > 0 Then
|
||||
' If Not ObjConta.AddMovimiento(IDPoliza, UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, Not AcumuladoPerdidaCompras > 0, AcumuladoPerdidaCompras, "", "Acumulado Pérdida Cambiaria de Compras", 0, Fecha, "") Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' 'TERMINA: AGREGA COMPRAS
|
||||
|
||||
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
|
||||
|
||||
' 'Agrega en Bitacoras
|
||||
' If Not ErrorGenerar Then
|
||||
' If ObjBancos.AddFluctuacionesBitacora(IDPoliza, Fecha, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
' If Not ObjBancos.AddFluctuacionesBitacora(IDPoliza, Fecha, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorGenerar = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
' If Not ErrorGenerar Then
|
||||
|
||||
' ObjConta.AjustaPoliza(IDPoliza)
|
||||
|
||||
' ObjConta.Commit()
|
||||
' ObjBancos.Commit()
|
||||
' Alert(String.Format("Fluctuación realizada con exito.<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza))
|
||||
' Else
|
||||
' ObjConta.RollBack()
|
||||
' ObjBancos.RollBack()
|
||||
' Alert("Ocurrio un error al generar la poliza", TipoMensaje.MsgAdvertencia)
|
||||
' End If
|
||||
|
||||
' ObjConta.Dispose()
|
||||
' ObjBancos.Dispose()
|
||||
' End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "GRIDVIEWS"
|
||||
|
||||
|
||||
Protected Sub GvCompras_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompras.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
'TipoCambio = e.Row.DBCampo("TipoCambio").ToString.ToDouble
|
||||
|
||||
Reference in New Issue
Block a user