diff --git a/Bancos/FluctuacionCambiaria.aspx b/Bancos/FluctuacionCambiaria.aspx index 42753215c..0c8743599 100644 --- a/Bancos/FluctuacionCambiaria.aspx +++ b/Bancos/FluctuacionCambiaria.aspx @@ -155,8 +155,7 @@ -
-
+ @@ -219,11 +218,8 @@ -
- - -
- +
+
- -
- +

- @@ -266,6 +260,108 @@ <%----%> + + + + +
+
+
+

PÉRDIDA

+
+ +
+ MXN + + + +
+
+
+
+
+
+

GANANCIA

+
+ +
+
+
+ MXN + + + +
+
+
+
+
+
+
+
+

+

+
+ +
+
+
+ MXN + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+ +
+ + + + + +
+ +
+ + +
+
+
+ + + + + + + + + + + + <%----%> +
+
+ @@ -349,7 +445,7 @@ -
+
@@ -376,7 +472,218 @@ - + + + + +
+
+
+

PÉRDIDA

+
+ +
+ MXN + + + +
+
+
+
+
+
+

GANANCIA

+
+ +
+
+
+ MXN + + + +
+
+
+
+
+
+
+
+

+

+ +
+ +
+
+
+ MXN + + + +
+
+
+
+
+
+
+
+
+ + +
+
+ +
+ + + + +
+ +
+ + + + + +
+ +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+ + + + +
+ +
+ + + + + +
+
+ + + +
+ +
+ +
+ + + + + + + + + + + + + +
+
+ + + +
+ +
+ + + + +
+ +
+ + + + + +
+
+ + + +
+ +
+ +
+ + + + + + + + + + + + +
+
+ +
@@ -426,105 +733,7 @@ - - - -
- -
- - - - -
- -
- - - - - -
- -
- -
-
- -
- - - - - - - - - - - - - - -
-
- - - - -
-
- -
- - - - -
- -
- - - - - -
-
- - - -
- -
- -
- - - - - - - - - - - - - -
-
+ @@ -575,6 +784,54 @@ + + + + +
+ +
+ + + + +
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + + + + + + +
+
+ diff --git a/Bancos/FluctuacionCambiaria.aspx.vb b/Bancos/FluctuacionCambiaria.aspx.vb index 56cfe835c..5e6d50ed6 100644 --- a/Bancos/FluctuacionCambiaria.aspx.vb +++ b/Bancos/FluctuacionCambiaria.aspx.vb @@ -28,11 +28,14 @@ Partial Class Bancos_FluctuacionCambiaria Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then CargaFechas() + CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "") + CargarCentrosDeCosto(Nothing, DdlSubProyectoComprasAnt, Nothing, LblSubProyectoComprasAnt, "") + CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "") + CargarCentrosDeCosto(Nothing, DdlsubProyectoVentasAnt, Nothing, LblSubProyectoVentasAnt, "") + CargarCentrosDeCosto(Nothing, DdlSubProyectoAcreedores, Nothing, LblSubProyectoAcreedores, "") + CargarCentrosDeCosto(Nothing, DdlSubProyectoAcreeedoresAnt, Nothing, LblSubProyectoAcreedoresAnt, "") CargarCentrosDeCosto(Nothing, DdlSubproyectoBancos, Nothing, LblSubProyectoBancos, "") - CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "") - CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "") - CargarCentrosDeCosto(Nothing, DdlSubProyectoFiliales, Nothing, LblSubProyectoFiliales, "") - CargarCentrosDeCosto(Nothing, DdlSubProyectoAcreedores, Nothing, LblSubProyectoAcreedores, "") + CargarCentrosDeCosto(Nothing, DdlSubProyectoFiliales, Nothing, LblSubProyectoFiliales, "") CargarCentrosDeCosto(Nothing, DdlSubProyectoDeudores, Nothing, LblSubProyectoDeudores, "") CargaUltimaFluctuacion() @@ -62,14 +65,18 @@ Partial Class Bancos_FluctuacionCambiaria End Sub - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) CargaTipoCambio() - If T.ActiveTabIndex = 0 Then CargaDatosCompra() - If T.ActiveTabIndex = 1 Then CargaDatosVentas() - If T.ActiveTabIndex = 2 Then CargaDatosCuentas() - If T.ActiveTabIndex = 3 Then CargaDatosDeudores() - If T.ActiveTabIndex = 4 Then CargaDatosAcreedores() - If T.ActiveTabIndex = 5 Then CargaDatosFiliales() + If T.ActiveTabIndex = 0 Then CargaDatosProveedores() + If T.ActiveTabIndex = 1 Then CargaDatosProveedoresAnticipos() + If T.ActiveTabIndex = 2 Then CargaDatosClientes() + 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 = 7 Then CargaDatosFiliales() + If T.ActiveTabIndex = 8 Then CargaDatosDeudores() UpTabs.Update() End Sub @@ -84,21 +91,8 @@ Partial Class Bancos_FluctuacionCambiaria ObjGenerales.Dispose() End Sub - Private Sub CargaUltimaFluctuacion() - 'Dim Obj As New ClsBancos - 'If Obj.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then - ' Dim dt As DataTable = Obj.DtResultados.FiltraParametros("TipoFluctuacion = 1", "Fecha DESC") - ' If dt.Rows.Count > 0 Then - ' LtlUltimaFluctuacion.Text = String.Format("Ultima Fluctuación : {0}", dt.Rows(0)("Fecha").ToString.ToDate.ToShortDateString) - ' 'si la ultima fluctuacion es mayor o igual al fin de mes anterior, entonces pon la fecha actual - ' If dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then - ' TxtFecha.Text = Now.ToShortDateString - ' Else - ' TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString() - ' End If - ' End If - 'End If - 'Obj.Dispose() + Private Sub CargaUltimaFluctuacion() + Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(Now) @@ -111,24 +105,23 @@ Partial Class Bancos_FluctuacionCambiaria Else DdlMes.SelectedValueExist(Now.AddMonths(-1).Month) DdlAnio.SelectedValueExist(Now.AddMonths(-1).Year) - 'TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString() End If End If CargaTipoCambio() End Sub - Private Sub CargaDatosCompra() - Dim ObjBancos As New ClsBancos - 'LblTotalCompras.Text = "0.00" + Private Sub CargaDatosProveedores() + Dim ObjBancos As New ClsBancos + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 1, UsuarioActual.CveEmpresa) Then - GvCompras.DataSource = ObjBancos.DtResultados + GvProveedores.DataSource = ObjBancos.DtResultados 'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ") - Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0 ") + Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0 ") + Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ") Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion").Abs - Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion") + Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion").Abs Dim Final As Double = GanaciaAux - PerdidaAux HdnProveedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString @@ -138,6 +131,44 @@ Partial Class Bancos_FluctuacionCambiaria IImagenResultado.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd") + LtIndicador_ExistenciaPerdida.Text = PerdidaAux.ToString.FormatoNumero + LtIndicador_ValorPesosGanancia.Text = GanaciaAux.ToString.FormatoNumero + LtIndicador_CPPesosFinal.Text = Final.Abs.ToString.FormatoNumero + LblComprasPerdidaGanancia.Text = If(Final < 0, "Ganancia", "Pérdida") + + LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + Else + GvProveedores.DataSource = Nothing + Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) + End If + ObjBancos.Dispose() + GvProveedores.DataBind() + UpIndicadores.Visible = True + If GvProveedores.Rows.Count > 0 Then + GvProveedores.Rows(GvProveedores.Rows.Count - 1).CssClass = "SubTotales2" + End If + End Sub + + Private Sub CargaDatosProveedoresAnticipos() + Dim ObjBancos As New ClsBancos + + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 2, UsuarioActual.CveEmpresa) Then + GvProveedoresAnt.DataSource = ObjBancos.DtResultados + 'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ") + Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0 ") + + Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion").Abs + Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion") + + Dim Final As Double = GanaciaAux - PerdidaAux + HdnProveedorAntCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString + HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString + BtnProveedoresAntRemove.Visible = HdnProveedorAntCvePrePoliza.Value.ToEntero > 0 + BtnGeneraComprasAnt.Visible = Not HdnProveedorAntCvePrePoliza.Value.ToEntero > 0 + + IImagenResultado.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd") + LtIndicador_ExistenciaPerdida.Text = PerdidaAux.ToString.FormatoNumero LtIndicador_ValorPesosGanancia.Text = GanaciaAux.ToString.FormatoNumero LtIndicador_CPPesosFinal.Text = Final.Abs.ToString.FormatoNumero @@ -145,28 +176,26 @@ Partial Class Bancos_FluctuacionCambiaria LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero Else - GvCompras.DataSource = Nothing + GvProveedoresAnt.DataSource = Nothing Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) End If ObjBancos.Dispose() - GvCompras.DataBind() - UpIndicadores.Visible = True - If GvCompras.Rows.Count > 0 Then - GvCompras.Rows(GvCompras.Rows.Count - 1).CssClass = "SubTotales2" - End If + GvProveedoresAnt.DataBind() + UpIndicadores.Visible = True + End Sub - Private Sub CargaDatosVentas() + Private Sub CargaDatosClientes() Dim ObjBancos As New ClsBancos LblTotalVentas.Text = "0.00" - If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 2, UsuarioActual.CveEmpresa) Then + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 3, UsuarioActual.CveEmpresa) Then GvVentas.DataSource = ObjBancos.DtResultados - Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0") - Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0") + Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0") + Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0") - Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion < 0").Abs - Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion > 0") + Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion > 0").Abs + Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion < 0").Abs Dim Final As Double = GanaciaAux - PerdidaAux HdnClienteCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString @@ -190,12 +219,84 @@ Partial Class Bancos_FluctuacionCambiaria End If ObjBancos.Dispose() GvVentas.DataBind() + End Sub + + Private Sub CargaDatosClientesAnticipos() + Dim ObjBancos As New ClsBancos + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 4, UsuarioActual.CveEmpresa) Then + GvClientesAnt.DataSource = ObjBancos.DtResultados + + Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0") + Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0") + + Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion < 0").Abs + Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion > 0") + + Dim Final As Double = GanaciaAux - PerdidaAux + HdnClienteAntCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString + HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString + BtnClientesAntRemove.Visible = HdnClienteAntCvePrePoliza.Value.ToEntero > 0 + BtnClientesAnticipos.Visible = Not HdnClienteAntCvePrePoliza.Value.ToEntero > 0 + + 'IImagenFinalVentas.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd") + + 'LtIndicador_PerdidasVentas.Text = PerdidaAux.ToString.FormatoNumero + 'LtIndicador_GanaciaVentas.Text = GanaciaAux.ToString.FormatoNumero + 'LtIndicador_FinalVentas.Text = Final.ToString.FormatoNumero + 'LblVentasPerdidaGanancia.Text = If(Final < 0, "Pérdida", "Ganancia") + + LblTotalVentasAnt.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + + UpIndicadoresVentas.Visible = True + Else + GvClientesAnt.DataSource = Nothing + Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia) + End If + ObjBancos.Dispose() + GvClientesAnt.DataBind() + End Sub + + + Private Sub CargaDatosAcreedores() + Dim ObjBancos As New ClsBancos + + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 5, UsuarioActual.CveEmpresa) Then + + HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString + HdnAcreedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString + BtnAcreedoresRemove.Visible = HdnAcreedorCvePrePoliza.Value.ToEntero > 0 + BtnGeneraAcreedores.Visible = Not HdnAcreedorCvePrePoliza.Value.ToEntero > 0 + GvAcreedores.DataSource = ObjBancos.DtResultados + LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + Else + GvAcreedoresAnt.DataSource = Nothing + Alert("Ocurrio un error al cargar los acreedores", TipoMensaje.MsgAdvertencia) + End If + ObjBancos.Dispose() + GvAcreedores.DataBind() End Sub + Private Sub CargaDatosAcreedoresAnticipos() + Dim ObjBancos As New ClsBancos + + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 6, UsuarioActual.CveEmpresa) Then + HdnAcreedorAntCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString + BtnAcreedoresAntRemove.Visible = HdnAcreedorAntCvePrePoliza.Value.ToEntero > 0 + BtnGeneraAcreedoresAnt.Visible = Not HdnAcreedorAntCvePrePoliza.Value.ToEntero > 0 + GvAcreedoresAnt.DataSource = ObjBancos.DtResultados + LblTotalAcreedoresAnt.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero + Else + GvAcreedoresAnt.DataSource = Nothing + Alert("Ocurrio un error al cargar los acreedores", TipoMensaje.MsgAdvertencia) + End If + ObjBancos.Dispose() + GvAcreedoresAnt.DataBind() + End Sub + Private Sub CargaDatosCuentas() Dim ObjBancos As New ClsBancos LblTotalBancos.Text = "0.00" - If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 4, UsuarioActual.CveEmpresa) Then + If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 7, UsuarioActual.CveEmpresa) Then Dim DtTemp As DataTable = ObjBancos.DtResultados.Copy Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal Dim TotAcumulado As Decimal = 0 @@ -237,7 +338,7 @@ Partial Class Bancos_FluctuacionCambiaria End If ObjBancos.Dispose() GvCuentas.DataBind() - End Sub + End Sub Private Sub CargaDatosDeudores() Dim ObjBancos As New ClsBancos @@ -253,24 +354,6 @@ Partial Class Bancos_FluctuacionCambiaria GvDeudores.DataBind() End Sub - Private Sub CargaDatosAcreedores() - Dim ObjBancos As New ClsBancos - LblTotalAcreedores.Text = "0.00" - If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 6, UsuarioActual.CveEmpresa) Then - GvAcreedores.DataSource = ObjBancos.DtResultados - LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - HdnAcreedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString - HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString - BtnAcreedoresRemove.Visible = HdnAcreedorCvePrePoliza.Value.ToEntero > 0 - BtnGeneraAcreedores.Visible = Not HdnAcreedorCvePrePoliza.Value.ToEntero > 0 - - Else - GvAcreedores.DataSource = Nothing - Alert("Ocurrio un error al cargar los acreedores", TipoMensaje.MsgAdvertencia) - End If - ObjBancos.Dispose() - GvAcreedores.DataBind() - End Sub Private Sub CargaDatosFiliales() Dim ObjBancos As New ClsBancos @@ -315,7 +398,7 @@ Partial Class Bancos_FluctuacionCambiaria Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias Total = LblTotal.ToDecimal - If Total > 0 Then + If Total < 0 Then CveConceptoContable = 64 idCta = IdCtaGanancia TipoMovto = True @@ -327,7 +410,7 @@ Partial Class Bancos_FluctuacionCambiaria Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal() - If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras", CveConceptoContable, "Fluctuación Compras", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Proveedores Anticipos", CveConceptoContable, "Fluctuación Proveedores Anticipos", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then ErrorRegistrar = True End If @@ -338,13 +421,13 @@ Partial Class Bancos_FluctuacionCambiaria If Not ErrorRegistrar Then 'saco las cuentas de pérdida y ganancia - For Each gvr As GridViewRow In GvCompras.Rows + For Each gvr As GridViewRow In GvProveedores.Rows Total = gvr.DataKey("Fluctuacion").ToDecimal 'si es pérdida o ganancia 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, 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 ErrorRegistrar = True Exit For End If @@ -370,6 +453,86 @@ Partial Class Bancos_FluctuacionCambiaria Conta.Dispose() End Sub + + Protected Sub BtnGeneraComprasAnt_Click(sender As Object, e As EventArgs) + Dim Total As Decimal = 0 + Dim Conta As New ClsContabilidad + Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) + Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaC", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoComprasAnt.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + Dim idCta As Integer = 0 + + Dim CveCuentaPerdida, CveCuentaGanancia As Integer + Dim idCtaPerdida, IdCtaGanancia As Integer + + Dim TipoMovto As Boolean = False + Dim CveConceptoContable As Integer = 0 + Dim IdCtaComplementaria As Integer = 0 + + Dim ErrorRegistrar As Boolean = False + + CveCuentaPerdida = 0 '55379 + CveCuentaGanancia = 0 ' 55382 + idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227 + 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 + idCta = IdCtaGanancia + TipoMovto = True + Else + CveConceptoContable = 65 + idCta = idCtaPerdida + TipoMovto = False + End If + + Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal() + + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras Anticipos", CveConceptoContable, "Fluctuación Proveedores Anticipos", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoComprasAnt.SelectedValue.ToEntero) Then + ErrorRegistrar = True + End If + + Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveBitacora <= 0 Then + ErrorRegistrar = True + End If + + If Not ErrorRegistrar Then + 'saco las cuentas de pérdida y ganancia + For Each gvr As GridViewRow In GvProveedoresAnt.Rows + Total = gvr.DataKey("Fluctuacion").ToDecimal + 'si es pérdida o ganancia + 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 + ErrorRegistrar = True + Exit For + End If + + If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then + ErrorRegistrar = True + Exit For + End If + Next + + Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 2, CveBitacora, UsuarioActual.CveEmpresa) + + End If + + If Not ErrorRegistrar Then + Conta.Commit() + BtnGeneraComprasAnt.Visible = False + Alert(String.Format("La Fluctuación se ha generado
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Else + Conta.RollBack() + Alert("Error al generar la fluctuación", TipoMensaje.MsgError) + End If + Conta.Dispose() + End Sub + #End Region #Region "FLUCTUACION VENTAS" @@ -397,7 +560,7 @@ Partial Class Bancos_FluctuacionCambiaria '' Total = LblTotalVentas.Text.ToDecimal - If Total > 0 Then + If Total < 0 Then CveConceptoContable = 64 CveCuenta = CveCuentaGanancia TipoMovto = True @@ -442,7 +605,7 @@ Partial Class Bancos_FluctuacionCambiaria End If 'movimiento de complementaria - If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, 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) Then ErrorRegistrar = True Exit For End If @@ -454,7 +617,7 @@ Partial Class Bancos_FluctuacionCambiaria Next - If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 2, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 3, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then ErrorRegistrar = True End If @@ -470,6 +633,261 @@ Partial Class Bancos_FluctuacionCambiaria Conta.Dispose() End Sub + + + Protected Sub BtnClientesAnticipos_Click(sender As Object, e As EventArgs) + Dim Total As Decimal = 0 + + Dim idCta As Integer = 0 + Dim CveCuenta As Integer = 0 + Dim CveCuentaPerdida, CveCuentaGanancia As Integer + Dim idCtaPerdida, IdCtaGanancia As Integer + Dim TipoMovto As Boolean = False + Dim CveConceptoContable As Integer = 0 + Dim IdCtaComplementaria As Integer = 0 + Dim ErrorRegistrar As Boolean = False + + CveCuentaPerdida = 0 '55379 + CveCuentaGanancia = 0 ' 55382 + idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227 + IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230 + Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias + + Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal() + '' + + Total = LblTotalVentasAnt.Text.ToDecimal + If Total < 0 Then + CveConceptoContable = 64 + CveCuenta = CveCuentaGanancia + TipoMovto = True + idCta = IdCtaGanancia + Else + CveConceptoContable = 65 + CveCuenta = CveCuentaPerdida + idCta = idCtaPerdida + TipoMovto = False + End If + + If Total = 0 Then + Alert("El Importe tiene que ser diferente a cero", TipoMensaje.MsgError) + Exit Sub + End If + + Dim Conta As New ClsContabilidad + Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) + Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoVentasAnt.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Ventas", CveConceptoContable, "Fluctuación Ventas", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlsubProyectoVentasAnt.SelectedValue.ToEntero) Then + ErrorRegistrar = True + End If + + Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 4, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveBitacora <= 0 Then + ErrorRegistrar = True + End If + + Dim CveConconceptoCliente As Integer = 203 + + 'saco las cuentas de pérdida y ganancia + For Each gvr As GridViewRow In GvClientesAnt.Rows + Total = gvr.DataKey("Fluctuacion").ToDecimal + + IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero() + + If (gvr.DataKey("CveIE").ToEntero > 0 AndAlso gvr.DataKey("CveVenta").ToEntero < 0) OrElse (gvr.DataKey("CveVenta").ToEntero > 0 AndAlso gvr.DataKey("TipoDocto") = "Ant") Then + CveConconceptoCliente = 226 + Else + CveConconceptoCliente = 203 + End If + + 'movimiento de complementaria + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, 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 + ErrorRegistrar = True + Exit For + End If + + If Not Conta.UpdateTCValuacion(gvr.DataKey("CveVenta").ToEntero, -1, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then + ErrorRegistrar = True + Exit For + End If + + Next + + If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 4, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + ErrorRegistrar = True + End If + + If Not ErrorRegistrar Then + Conta.Commit() + BtnClientesAnticipos.Visible = False + Alert(String.Format("La Fluctuación se ha generado
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) + + Else + Conta.RollBack() + Alert("Error al generar la fluctuación", TipoMensaje.MsgError) + End If + Conta.Dispose() + End Sub + +#End Region + + +#Region "FLUCTUACION ACREEDORES" + + Protected Sub BtnGeneraAcreedores_Click(sender As Object, e As EventArgs) + RegistraFluctuacionAcreedores() + End Sub + + Private Sub RegistraFluctuacionAcreedores(Optional Anticipos As Boolean = False) + Dim Total As Decimal = 0 + Dim Conta As New ClsContabilidad + Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) + Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim idCta As Integer = 0 + Dim CveCuentaPerdida, CveCuentaGanancia As Integer + Dim idCtaPerdida, IdCtaGanancia As Integer + Dim TipoMovto As Boolean = False + Dim CveConceptoContable As Integer = 0 + Dim CveCuentaComplementaria As Integer = 55206 + Dim IdCtaComplementaria As Integer = 1081 + Dim ErrorRegistrar As Boolean = False + + CveCuentaPerdida = 0 '55379 + CveCuentaGanancia = 0 ' 55382 + idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227 + IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230 + Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias + + Total = LblTotalAcreedores.Text.ToDecimal + If Total < 0 Then + CveConceptoContable = 64 + idCta = IdCtaGanancia + TipoMovto = True + Else + CveConceptoContable = 65 + idCta = idCtaPerdida + TipoMovto = False + End If + + Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal() + + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Acreedores", CveConceptoContable, "Fluctuación Acreedores", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoAcreedores.SelectedValue.ToEntero) Then + ErrorRegistrar = True + End If + + Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 5, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveBitacora <= 0 Then + ErrorRegistrar = True + End If + + 'saco las cuentas de pérdida y ganancia + For Each gvr As GridViewRow In GvAcreedores.Rows + Total = gvr.DataKey("Fluctuacion").ToDecimal + 'si es pérdida o ganancia + 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 + ErrorRegistrar = True + Exit For + End If + + If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then + ErrorRegistrar = True + Exit For + End If + Next + + Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 5, CveBitacora, UsuarioActual.CveEmpresa) + + If Not ErrorRegistrar Then + Conta.Commit() + BtnGeneraAcreedores.Visible = False + Alert(String.Format("La Fluctuación se ha generado
Ver Póliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Else + Conta.RollBack() + Alert("Error al generar la fluctuación", TipoMensaje.MsgError) + End If + Conta.Dispose() + Banco.Dispose() + End Sub + + + Protected Sub BtnGeneraAcreedoresAnt_Click(sender As Object, e As EventArgs) + Dim Total As Decimal = 0 + Dim Conta As New ClsContabilidad + Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) + Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedoresAnt.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim idCta As Integer = 0 + Dim CveCuentaPerdida, CveCuentaGanancia As Integer + Dim idCtaPerdida, IdCtaGanancia As Integer + Dim TipoMovto As Boolean = False + Dim CveConceptoContable As Integer = 0 + Dim CveCuentaComplementaria As Integer = 55206 + Dim IdCtaComplementaria As Integer = 1081 + Dim ErrorRegistrar As Boolean = False + + CveCuentaPerdida = 0 '55379 + CveCuentaGanancia = 0 ' 55382 + idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227 + IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230 + Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias + + Total = LblTotalAcreedoresAnt.Text.ToDecimal + If Total > 0 Then + CveConceptoContable = 64 + idCta = IdCtaGanancia + TipoMovto = True + Else + CveConceptoContable = 65 + idCta = idCtaPerdida + TipoMovto = False + End If + + Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal() + + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Acreedores", CveConceptoContable, "Fluctuación Acreedores Anticipos ", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoAcreeedoresAnt.SelectedValue.ToEntero) Then + ErrorRegistrar = True + End If + + Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 6, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveBitacora <= 0 Then + ErrorRegistrar = True + End If + + 'saco las cuentas de pérdida y ganancia + For Each gvr As GridViewRow In GvAcreedoresAnt.Rows + Total = gvr.DataKey("Fluctuacion").ToDecimal + 'si es pérdida o ganancia + IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero() + + 'movimiento de complementaria + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, 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 + ErrorRegistrar = True + Exit For + End If + + If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then + ErrorRegistrar = True + Exit For + End If + Next + + Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 6, CveBitacora, UsuarioActual.CveEmpresa) + + If Not ErrorRegistrar Then + Conta.Commit() + BtnGeneraAcreedoresAnt.Visible = False + Alert(String.Format("La Fluctuación se ha generado
Ver Póliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Else + Conta.RollBack() + Alert("Error al generar la fluctuación", TipoMensaje.MsgError) + End If + Conta.Dispose() + Banco.Dispose() + End Sub + #End Region #Region "FLUCTUACION BANCOS" @@ -493,7 +911,6 @@ Partial Class Bancos_FluctuacionCambiaria Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaB", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoBancos.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - CveCuentaPerdida = 0 ' 55379 CveCuentaGanancia = 0 ' 55382 idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227 @@ -733,116 +1150,9 @@ Partial Class Bancos_FluctuacionCambiaria #End Region -#Region "FLUCTUACION ACREEDORES" - - Protected Sub BtnGeneraAcreedores_Click(sender As Object, e As EventArgs) - - Dim Total As Decimal = 0 - Dim Conta As New ClsContabilidad - Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) - Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - Dim idCta As Integer = 0 - Dim CveCuentaPerdida, CveCuentaGanancia As Integer - Dim idCtaPerdida, IdCtaGanancia As Integer - Dim TipoMovto As Boolean = False - Dim CveConceptoContable As Integer = 0 - Dim CveCuentaComplementaria As Integer = 55206 - Dim IdCtaComplementaria As Integer = 1081 - Dim ErrorRegistrar As Boolean = False - - CveCuentaPerdida = 0 '55379 - CveCuentaGanancia = 0 ' 55382 - idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227 - IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230 - Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias - - - Total = LblTotalAcreedores.Text.ToDecimal - If Total > 0 Then - CveConceptoContable = 64 - idCta = IdCtaGanancia - TipoMovto = True - Else - CveConceptoContable = 65 - idCta = idCtaPerdida - TipoMovto = False - End If - - Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal() - - If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Acreedores", CveConceptoContable, "Fluctuación Acreedores", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoAcreedores.SelectedValue.ToEntero) Then - ErrorRegistrar = True - End If - - Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 6, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CveBitacora <= 0 Then - ErrorRegistrar = True - End If - - 'saco las cuentas de pérdida y ganancia - For Each gvr As GridViewRow In GvAcreedores.Rows - Total = gvr.DataKey("Fluctuacion").ToDecimal - 'si es pérdida o ganancia - IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero() - - 'movimiento de complementaria - If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, 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 - ErrorRegistrar = True - Exit For - End If - - If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then - ErrorRegistrar = True - Exit For - End If - Next - - Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 6, CveBitacora, UsuarioActual.CveEmpresa) - - If Not ErrorRegistrar Then - Conta.Commit() - BtnGeneraAcreedores.Visible = False - Alert(String.Format("La Fluctuación se ha generado
Ver Póliza", CvePrePoliza), TipoMensaje.MsgInformacion) - Else - Conta.RollBack() - Alert("Error al generar la fluctuación", TipoMensaje.MsgError) - End If - Conta.Dispose() - Banco.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 - '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.FormatoNumero, "No aplica") - 'If e.Row.FCLabel("LbFluctuacion").Text = "No aplica" Then - ' e.Row.BackColor = Drawing.Color.LightSalmon - 'ElseIf e.Row.FCLabel("LbFluctuacion").Text.ToDouble < 0 Then - ' e.Row.BackColor = Drawing.Color.LightGoldenrodYellow - 'End If - - 'e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor").ToString.ToEntero) - - 'If Not e.Row.DBCampo("IdCtaContProveedores").ToString.ToEntero > 0 Then - ' e.Row.FCHyperLink("HLProveedor").ForeColor = Drawing.Color.Red - 'End If - - - 'If e.Row.DBCampo("Fluctuacion").ToString.ToDouble < 0 Then - ' e.Row.BackColor = Drawing.Color.LightGoldenrodYellow - 'End If - 'If e.Row.DBCampo("SinTipoCambio").ToString.ToEntero > 0 Then - ' e.Row.BackColor = Drawing.Color.LightSalmon - '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 @@ -885,6 +1195,7 @@ Partial Class Bancos_FluctuacionCambiaria If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnProveedorCvePrePoliza.Value.ToEntero, 1, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then Banco.Commit() + BtnProveedoresRemove.visible = False Alert("Flucturación eliminada.") Else Banco.RollBack() @@ -893,12 +1204,41 @@ Partial Class Bancos_FluctuacionCambiaria End Sub + Protected Sub BtnProveedoresAntRemove_Click(sender As Object, e As EventArgs) + Dim Banco As New ClsBancos + Banco.IniciaTransacSQL() + + If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnProveedorAntCvePrePoliza.Value.ToEntero, 2, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + Banco.Commit() + BtnProveedoresAntRemove.Visible = False + Alert("Flucturación eliminada.") + Else + Banco.RollBack() + End If + Banco.Dispose() + End Sub + Protected Sub BtnClientesRemove_Click(sender As Object, e As EventArgs) Dim Banco As New ClsBancos Banco.IniciaTransacSQL() - If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnClienteCvePrePoliza.Value.ToEntero, 2, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnClienteCvePrePoliza.Value.ToEntero, 3, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then Banco.Commit() + BtnClientesRemove.Visible = False + Alert("Flucturación eliminada.") + Else + Banco.RollBack() + End If + Banco.Dispose() + End Sub + + Protected Sub BtnClientesAntRemove_Click(sender As Object, e As EventArgs) + Dim Banco As New ClsBancos + Banco.IniciaTransacSQL() + + If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnClienteAntCvePrePoliza.Value.ToEntero, 4, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + Banco.Commit() + BtnClientesAntRemove.Visible = False Alert("Flucturación eliminada.") Else Banco.RollBack() @@ -910,12 +1250,30 @@ Partial Class Bancos_FluctuacionCambiaria Dim Banco As New ClsBancos Banco.IniciaTransacSQL() - If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnAcreedorCvePrePoliza.Value.ToEntero, 6, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnAcreedorCvePrePoliza.Value.ToEntero, 5, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then Banco.Commit() + BtnAcreedoresRemove.Visible = False Alert("Flucturación eliminada.") Else Banco.RollBack() End If Banco.Dispose() End Sub + + + Protected Sub BtnAcreedoresAntRemove_Click(sender As Object, e As EventArgs) + Dim Banco As New ClsBancos + Banco.IniciaTransacSQL() + + If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnAcreedorAntCvePrePoliza.Value.ToEntero, 6, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + Banco.Commit() + BtnAcreedoresAntRemove.Visible = False + Alert("Flucturación eliminada.") + Else + Banco.RollBack() + End If + Banco.Dispose() + End Sub + + End Class