From bb1444967824151ec90bacaaf5c070e7e5e2efc4 Mon Sep 17 00:00:00 2001 From: Rene Molina Date: Sat, 18 Jan 2020 14:13:58 -0700 Subject: [PATCH] - cmabios fluctuaci[on - cxc, guarde sesion sucursal --- Bancos/FluctuacionCambiaria.aspx | 12 ++++--- Bancos/FluctuacionCambiaria.aspx.vb | 35 ++++++++++++--------- Bancos/RepCxCCliente.aspx.vb | 2 ++ Inventarios/PopUpExistenciasAlmacen.aspx.vb | 8 ++++- Ventas/ClientesAbonar.aspx.vb | 3 +- 5 files changed, 40 insertions(+), 20 deletions(-) diff --git a/Bancos/FluctuacionCambiaria.aspx b/Bancos/FluctuacionCambiaria.aspx index 91114d43c..47d0375be 100644 --- a/Bancos/FluctuacionCambiaria.aspx +++ b/Bancos/FluctuacionCambiaria.aspx @@ -202,7 +202,7 @@
-

PÉRDIDA O GANANCIA

+

@@ -227,15 +227,16 @@

+ - + <%----%> @@ -313,7 +314,7 @@ - + @@ -364,6 +365,7 @@ + @@ -386,8 +388,10 @@ + + diff --git a/Bancos/FluctuacionCambiaria.aspx.vb b/Bancos/FluctuacionCambiaria.aspx.vb index 33e2ed15a..1855b24b4 100644 --- a/Bancos/FluctuacionCambiaria.aspx.vb +++ b/Bancos/FluctuacionCambiaria.aspx.vb @@ -71,8 +71,8 @@ Partial Class Bancos_FluctuacionCambiaria If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 1, UsuarioActual.CveEmpresa) Then GvCompras.DataSource = ObjBancos.DtResultados 'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero - Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("GananciaPerdida = 'PERDIDA' AND TipoRow = 2") - Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("GananciaPerdida = 'GANANCIA' AND TipoRow = 2") + 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") @@ -84,6 +84,7 @@ Partial Class Bancos_FluctuacionCambiaria 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 @@ -107,8 +108,8 @@ Partial Class Bancos_FluctuacionCambiaria 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 PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion < 0").Abs + Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion > 0") Dim Final As Double = GanaciaAux - PerdidaAux @@ -250,10 +251,12 @@ Partial Class Bancos_FluctuacionCambiaria CveConceptoContable = 64 CveCuenta = CveCuentaGanancia idCta = IdCtaGanancia + TipoMovto = True Else CveConceptoContable = 65 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 ErrorRegistrar = True @@ -267,7 +270,7 @@ Partial Class Bancos_FluctuacionCambiaria 'movimiento de complementaria - If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), 201, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria) Then + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 201, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria) Then ErrorRegistrar = True Exit For End If @@ -275,7 +278,8 @@ Partial Class Bancos_FluctuacionCambiaria If Not ErrorRegistrar Then Conta.Commit() - Alert("La Fluctuación se ha generado", TipoMensaje.MsgInformacion) + Alert(String.Format("La Fluctuación se ha generado
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Else Conta.RollBack() End If @@ -308,7 +312,7 @@ Partial Class Bancos_FluctuacionCambiaria Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias Total = LblTotalVentas.Text.ToDecimal - If Total < 0 Then + If Total > 0 Then CveConceptoContable = 64 CveCuenta = CveCuentaGanancia TipoMovto = True @@ -327,7 +331,7 @@ Partial Class Bancos_FluctuacionCambiaria 'saco las cuentas de pérdida y ganancia For Each gvr As GridViewRow In GvVentas.Rows - Total = gvr.DataKey("Fluctuacion").ToDecimal + Total = -gvr.DataKey("Fluctuacion").ToDecimal If gvr.DataKey("CveIE").ToEntero > 0 AndAlso gvr.DataKey("CveVenta").ToEntero < 0 Then CveConconceptoCliente = 226 @@ -336,7 +340,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, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria, CveIE:=gvr.DataKey("CveIE").ToEntero) Then + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria, CveIE:=gvr.DataKey("CveIE").ToEntero) Then ErrorRegistrar = True Exit For End If @@ -344,7 +348,8 @@ Partial Class Bancos_FluctuacionCambiaria If Not ErrorRegistrar Then Conta.Commit() - Alert("La Fluctuación se ha generado", TipoMensaje.MsgInformacion) + Alert(String.Format("La Fluctuación se ha generado
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Else Conta.RollBack() End If @@ -432,7 +437,7 @@ Partial Class Bancos_FluctuacionCambiaria If Not ErrorRegistrar And SeContabilizo Then Conta.Commit() - Alert(String.Format("La Fluctuación se ha generado
Ver Póliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Alert(String.Format("La Fluctuación se ha generado
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) CargaDatosCuentas() Else Conta.RollBack() @@ -624,8 +629,8 @@ Partial Class Bancos_FluctuacionCambiaria Dim idCtaPerdida, IdCtaGanancia As Integer Dim TipoMovto As Boolean = False Dim CveConceptoContable As Integer = 0 - Dim CveCuentaComplementaria As Integer = 0 - Dim IdCtaComplementaria As Integer = 0 + Dim CveCuentaComplementaria As Integer = 55206 + Dim IdCtaComplementaria As Integer = 1081 Dim ErrorRegistrar As Boolean = False CveCuentaPerdida = 0 '55379 @@ -640,10 +645,12 @@ Partial Class Bancos_FluctuacionCambiaria CveConceptoContable = 64 CveCuenta = CveCuentaGanancia idCta = IdCtaGanancia + TipoMovto = True Else CveConceptoContable = 65 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 ErrorRegistrar = True @@ -657,7 +664,7 @@ Partial Class Bancos_FluctuacionCambiaria '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, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria) Then + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 202, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveCuenta:=CveCuentaComplementaria) Then ErrorRegistrar = True Exit For End If diff --git a/Bancos/RepCxCCliente.aspx.vb b/Bancos/RepCxCCliente.aspx.vb index 7539c52c7..c10e276d1 100644 --- a/Bancos/RepCxCCliente.aspx.vb +++ b/Bancos/RepCxCCliente.aspx.vb @@ -34,6 +34,7 @@ Partial Class Bancos_RepCxCCliente 'DdlSubProyecto.SelectedValueExist(UsuarioActual.CveSucursal.ToString) '[IPP] 8 Enero 2018 - Se quito por que sera reemplazado al cargar solo los subproyectos del usuario 'If UsuarioActual.TienePermisoProceso(152) Then DdlSubProyecto.Enabled = False + If UsuarioActual.Sesion("CobroCliente-Sucursal").ToString <> "" Then DdlSubProyecto.SelectedValueExist(UsuarioActual.Sesion("CobroCliente-Sucursal").ToString.Trim) InicializaPersonalizarColumnas() @@ -57,6 +58,7 @@ Partial Class Bancos_RepCxCCliente If Mov.GetCxCCliente(CveCliente, FechaI, FechaF, DdlMoneda.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then GvCxC.DataSource = Mov.DtResultados End If + UsuarioActual.Sesion("CobroCliente-Sucursal") = DdlSubProyecto.SelectedValue Mov.Dispose() GvCxC.DataBind() diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx.vb b/Inventarios/PopUpExistenciasAlmacen.aspx.vb index c2f15499c..a3b1a02d3 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx.vb +++ b/Inventarios/PopUpExistenciasAlmacen.aspx.vb @@ -89,11 +89,17 @@ Partial Class Inventarios_Default If dr IsNot Nothing Then LtPs.Text = $"Producto: {dr("PSCodigo").ToString}" + Dim CvePrecioLista As Integer = -1 + If Not UsuarioActual.Empresa.Funcionalidad(404).ToString = "1" Then 'sino manneja precios de lista + CvePrecioLista = -2 + End If + Dim ObjVta As New ClsVentas Dim objPS As New ClsProductosServicios If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then If ObjVta.DtResultados.Rows.Count > 0 Then - If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero, -1, DDlPS.SelectedValue.ToEntero) Then + If CvePrecioLista = -1 Then CvePrecioLista = ObjVta.DtResultados.Rows(0)("CvePrecioLista").ToString.ToEntero + If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, -1, DDlPS.SelectedValue.ToEntero) Then If objPS.DtResultados.Rows.Count > 0 Then LtPrecioPS.Text = $"Precio de venta: $: {objPS.DtResultados.Rows(0)("PrecioLista").ToString.FormatoNumero} {dr("Abreviatura").ToString}" End If diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index f32552f6c..500f775dc 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -2152,7 +2152,8 @@ Partial Class Ventas_ClientesAbonar ObjConta.Commit() CargaDatos(CveMonedaFiltro) RegistraScript("$('#ModalSaldarCuentaIncobrable').modal('hide')") - Alert("Los movimientos se saldaron correctamente.") + Alert(String.Format("Los movimientos se saldaron correctamente.
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) + Else ObjConta.RollBack() Alert(MsgError, TipoMensaje.MsgError)