From 402d0e2e88230ab723fd6048a71426285ff452d2 Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Mon, 31 May 2021 17:22:04 -0700 Subject: [PATCH 1/3] Transaccionalidad para la creacion de nuevas cuentas --- Contabilidad2/CatCuentas.aspx.vb | 91 ++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb index 298a03af3..261c1bd8a 100644 --- a/Contabilidad2/CatCuentas.aspx.vb +++ b/Contabilidad2/CatCuentas.aspx.vb @@ -402,7 +402,7 @@ Partial Class Contabilidad2_CatCuentas 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContabilidad Dim CuentaEfectivo As Integer = 0 - Dim Afectable As Integer = 1 'If(DcuentaMayor.SelectedValue <> 2, 0, 1) ' cuando sea tipo 2, va a ser afectable + 'Dim Afectable As Integer = 1 'If(DcuentaMayor.SelectedValue <> 2, 0, 1) ' cuando sea tipo 2, va a ser afectable Tcuenta.Text.Replace("-", "") Dim idnew As Integer = 0 @@ -426,6 +426,7 @@ Partial Class Contabilidad2_CatCuentas Dim DigAgrup As Integer Dim CveAgrupadorSat As Integer Dim NomIdioma As String + Dim TieneError As Boolean = False If DdlAgrupadorSAT.SelectedValue.ToEntero > 0 Then If CveConceptoContable > 0 Then @@ -437,7 +438,7 @@ Partial Class Contabilidad2_CatCuentas PorcentajeIVA = TxtPorcentaje.ToEntero / 100 End If End If - + ObjConta.IniciaTransacSQL() If Afectable Then If ObjConta.GetCuentas(IDSelected, "-1", -1, UsuarioActual.CveEmpresa) Then drt = ObjConta.DtResultados.FiltroPrimero(String.Format("CveCuenta={0}", IDSelected)) @@ -456,13 +457,12 @@ Partial Class Contabilidad2_CatCuentas DigAgrup = IIf(drt("DigAgrup").ToString.ToEntero = -1, -1, drt("DigAgrup").ToString.ToEntero) CveAgrupadorSat = IIf(drt("CveAgrupadorSAT").ToString.ToEntero = 0, -1, drt("CveAgrupadorSAT").ToString.ToEntero) NomIdioma = IIf(drt("NomIdioma").ToString = "", "", drt("NomIdioma").ToString.ToEntero) - idnew = ObjConta.AddCuenta(CvePadre, TxtCuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, DdlAgrupadorSAT.SelectedValue.ToEntero, TxtNomIngles.Text.ToString, CveConceptoAdmin:=CveConceptoAdmin, CveProveedor:=CveProveedor, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, PorcentajeImpuesto:=PorcentajeImpuesto, CveBancoCuenta:=CveBancoCuenta) If idnew > 0 Then If Not ObjConta.UpdateTraspasoPrepoliza(UsuarioActual.CveEmpresa, IDSelected, idnew) Then - If ObjConta.UpdateCuenta(IDSelected.ToEntero, NombreCuenta, TipoCuenta, CuentaMayor, CveMoneda, + If Not ObjConta.UpdateCuenta(IDSelected.ToEntero, NombreCuenta, TipoCuenta, CuentaMayor, CveMoneda, DigAgrup, CveAgrupadorSat, NomIdioma) Then ObjConta.RollBack() ObjConta.Dispose() @@ -496,7 +496,7 @@ Partial Class Contabilidad2_CatCuentas codigoPadre = DtDatos.FiltroPrimeroValor("Codigo", $"CveCuenta={IDSelected}") 'Tsubcuenta.Text If UsuarioActual.Empresa.TipoContabilidad = 2 Then ObjConta2 = New ClsContPAQi(UsuarioActual.Empresa) - + ObjConta2.IniciaTransacSQL() If ObjConta2.GetCuentas(-1, "-1", -1) Then IdPadre = ObjConta2.DtResultados.FiltroPrimeroValor("Id", $"Codigo='{codigoPadre}'").ToEntero If ObjConta2.GetAgrupadoresSAT() Then @@ -507,53 +507,66 @@ Partial Class Contabilidad2_CatCuentas Dim idnew2 As Integer = ObjConta2.AddCuenta(TxtCuenta.Text.Replace("-", ""), Tnombre.Text, DTcuenta.SelectedValue.ToString, DcuentaMayor.SelectedValue.ToString.ToEntero, CuentaEfectivo, DdlMoneda.SelectedValue.ToEntero, TxtDigAgrup.Text.ToEntero, TxtNomIngles.Text.Trim, Afectable, IdPadre, IdAgrupador) If idnew2 > 0 Then - If ObjConta.UpdateCuentaCompaq(idnew, idnew2, UsuarioActual.CveEmpresa) Then + If Not ObjConta.UpdateCuentaCompaq(idnew, idnew2, UsuarioActual.CveEmpresa) Then + TieneError = True + ObjConta2.RollBack() + ObjConta.RollBack() + Alert("Ocurrio un error al vincultar la cuenta con SIG y Compaq", TipoMensaje.MsgError) End If + Else + TieneError = True + ObjConta2.RollBack() + Alert("Ocurrio un error al crear la cuenta en Compaq", TipoMensaje.MsgError) End If - End If End If ObjConta2.Dispose() End If - - Dim dr As DataRow = DtDatos.NewRow - dr("CveCuenta") = idnew - dr("CuentaFormato") = TxtCuenta.Text - 'dr("CuentaFormato") = Tcuenta.Text - dr("Nombre") = Tnombre.Text - dr("CtaCodigo") = String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text) - 'dr("CtaCodigo") = String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text) - dr("Tipo") = DTcuenta.SelectedValue.ToString - dr("CtaMayor") = DcuentaMayor.SelectedValue.ToString - dr("CvePadre") = IDSelected - dr("Codigo") = Tnombre.Text - dr("CveMoneda") = DdlMoneda.SelectedValue.ToEntero - dr("DigAgrup") = TxtDigAgrup.Text.Trim.ToEntero - dr("NomIdioma") = TxtNomIngles.Text.Trim - DtDatos.Rows.Add(dr) - ArbolCuentas.DataSource = DtDatos - '.Attributes.Add("data-hijos","0"); - Dim item As ADServerControl.DragableItem = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", IDSelected)), ADServerControl.DragableItem) - item.Attributes.Item("data-hijos") = item.Attributes.Item("data-hijos").ToEntero + 1 - Dim objul As ADServerControl.DragableUL = DirectCast(ArbolCuentas.FindControl(String.Format("ul{0}", IDSelected)), ADServerControl.DragableUL) - If (IsNothing(objul)) Then - objul = New ADServerControl.DragableUL - objul.ID = String.Format("ul{0}", item.Cve) - item.Controls.Add(objul) + If Not TieneError Then + Dim dr As DataRow = DtDatos.NewRow + dr("CveCuenta") = idnew + dr("CuentaFormato") = TxtCuenta.Text + 'dr("CuentaFormato") = Tcuenta.Text + dr("Nombre") = Tnombre.Text + dr("CtaCodigo") = String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text) + 'dr("CtaCodigo") = String.Format("{0} - {1}", Tcuenta.Text, Tnombre.Text) + dr("Tipo") = DTcuenta.SelectedValue.ToString + dr("CtaMayor") = DcuentaMayor.SelectedValue.ToString + dr("CvePadre") = IDSelected + dr("Codigo") = Tnombre.Text + dr("CveMoneda") = DdlMoneda.SelectedValue.ToEntero + dr("DigAgrup") = TxtDigAgrup.Text.Trim.ToEntero + dr("NomIdioma") = TxtNomIngles.Text.Trim + DtDatos.Rows.Add(dr) + ArbolCuentas.DataSource = DtDatos + '.Attributes.Add("data-hijos","0"); + Dim item As ADServerControl.DragableItem = DirectCast(ArbolCuentas.FindControl(String.Format("{0}", IDSelected)), ADServerControl.DragableItem) + item.Attributes.Item("data-hijos") = item.Attributes.Item("data-hijos").ToEntero + 1 + Dim objul As ADServerControl.DragableUL = DirectCast(ArbolCuentas.FindControl(String.Format("ul{0}", IDSelected)), ADServerControl.DragableUL) + If (IsNothing(objul)) Then + objul = New ADServerControl.DragableUL + objul.ID = String.Format("ul{0}", item.Cve) + item.Controls.Add(objul) + End If + ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text)) + CargaDatos() End If - ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text)) - - - CargaDatos() - End If If ObjConta2 IsNot Nothing Then ObjConta2.Dispose() End If + + Else + TieneError = True + ObjConta.RollBack() + Alert("Ocurrio un error al crear la cuenta", TipoMensaje.MsgError) + End If + + If Not TieneError Then + ObjConta.Commit() LimpiarCampos() updatos.Update() - Alert("La cuenta se guardo correctamente") - + Alert("La cuenta se guardo correctamente", TipoMensaje.MsgInformacion) End If ObjConta.Dispose() From c617de9216807b753ac38c65c14e0e1f62b473ad Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Mon, 31 May 2021 17:22:34 -0700 Subject: [PATCH 2/3] Nuevo parametros y reacomodo de estos --- Ventas/RepRecuperacion.aspx | 23 +++++++++++++---------- Ventas/RepRecuperacion.aspx.vb | 2 +- Ventas/RepRecuperacionDetalle.aspx | 27 ++++++++++++++------------- Ventas/RepRecuperacionDetalle.aspx.vb | 19 +++++++++++++------ 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/Ventas/RepRecuperacion.aspx b/Ventas/RepRecuperacion.aspx index fd77085ef..93c5824ac 100644 --- a/Ventas/RepRecuperacion.aspx +++ b/Ventas/RepRecuperacion.aspx @@ -170,17 +170,10 @@ - -
- - - - - -
+
F. Conciliado inicio:
-
+
@@ -209,8 +202,18 @@
+
+
+ +
+ + + + + +
F. Registro IE inicio:
-
+
diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index c47103ad0..517c491bc 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -167,7 +167,7 @@ Partial Class Ventas_RepRecuperacion FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") FechaAplicadoI = If(IsDate(TxtFechaAplicadoI.Text.Trim()), TxtFechaAplicadoI.Text.Trim(), MinFecha.ToShortDateString.ToString) FechaAplicadoF = If(IsDate(TxtFechaAplicadoF.Text.Trim()), TxtFechaAplicadoF.Text.Trim(), MaxFecha.ToShortDateString.ToString) - FechaRegistroIEI = If(IsDate(TxtFechaRegistroIEI.Text.Trim()), TxtFechaRegistroIEI.Text.Trim(), MaxFecha.ToShortDateString.ToString) + FechaRegistroIEI = If(IsDate(TxtFechaRegistroIEI.Text.Trim()), TxtFechaRegistroIEI.Text.Trim(), MinFecha.ToShortDateString.ToString) FechaRegistroIEF = If(IsDate(TxtFechaRegistroIEF.Text.Trim()), TxtFechaRegistroIEF.Text.Trim(), MaxFecha.ToShortDateString.ToString) If e.Row.DBCampo("Orden") = "" Then e.Row.CssClass = "Totales" diff --git a/Ventas/RepRecuperacionDetalle.aspx b/Ventas/RepRecuperacionDetalle.aspx index 36f8d1fac..02842ef9f 100644 --- a/Ventas/RepRecuperacionDetalle.aspx +++ b/Ventas/RepRecuperacionDetalle.aspx @@ -178,16 +178,9 @@
- -
- - - - - -
-
Fecha Aplicado Inicio:
-
+ +
Fecha Aplicado Inicio:
+
@@ -218,9 +211,17 @@
+ +
+ + + + + +
F. Registro IE inicio:
-
-
+
+
@@ -234,7 +235,7 @@
F. Registro IE Fin:
-
+
diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index fb8bbe4e1..a9d1e44b0 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -146,11 +146,11 @@ Partial Class Ventas_RepRecuperacionDetalle txtFechaI.Text = FechaI End If - FechaAplicadoI = If(Request("FechaAplicadoI") IsNot Nothing, Request("FechaAplicadoI").ToString, "-1").ToString - FechaAplicadoF = If(Request("FechaAplicadoF") IsNot Nothing, Request("FechaAplicadoF").ToString, "-1").ToString + FechaAplicadoI = If(Request("FechaAplicadoI") IsNot Nothing And Request("FechaAplicadoI").ToString <> "01/01/1900", Request("FechaAplicadoI").ToString, "-1").ToString + FechaAplicadoF = If(Request("FechaAplicadoF") IsNot Nothing And Request("FechaAplicadoF").ToString <> "01/01/9999", Request("FechaAplicadoF").ToString, "-1").ToString - FechaRegistroIEI = If(Request("FechaRegistroIEI") IsNot Nothing, Request("FechaRegistroIEI").ToString, "-1").ToString - FechaRegistroIEF = If(Request("FechaRegistroIEF") IsNot Nothing, Request("FechaRegistroIEF").ToString, "-1").ToString + FechaRegistroIEI = If(Request("FechaRegistroIEI") IsNot Nothing And Request("FechaRegistroIEI").ToString <> "01/01/1900", Request("FechaRegistroIEI").ToString, "-1").ToString + FechaRegistroIEF = If(Request("FechaRegistroIEF") IsNot Nothing And Request("FechaRegistroIEF").ToString <> "01/01/9999", Request("FechaRegistroIEF").ToString, "-1").ToString If FechaAplicadoF <> "-1" Then TxtFechaAplicadoF.Text = FechaAplicadoF @@ -242,14 +242,21 @@ Partial Class Ventas_RepRecuperacionDetalle TCEspecifico = TxtEspecifico.Text.ToDecimal Else TCEspecifico = -1 - End If + End If + + Dim FechaAplicadoI As Date = If(IsDate(TxtFechaAplicadoI.Text), TxtFechaAplicadoI.Text.ToDate, MinFecha) + Dim FechaAplicadoF As Date = If(IsDate(TxtFechaAplicadoF.Text), TxtFechaAplicadoF.Text.ToDate, MaxFecha) + + Dim FechaRegistroIEI As Date = If(IsDate(TxtFechaRegistroIEI.Text), TxtFechaRegistroIEI.Text.ToDate, MinFecha) + Dim FechaRegistroIEF As Date = If(IsDate(TxtFechaRegistroIEF.Text), TxtFechaRegistroIEF.Text.ToDate, MaxFecha) + Dim ObjMovtos As New ClsMovimientos() If ObjMovtos.GetRepRecuperacionDetalle(txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlClientes.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, DdlClienteSucursal.SelectedValue.ToEntero, -1, Iva.ToString, DdlGrupo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlResponsable.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveBanco:=DdlBanco.SelectedValue.ToEntero, CveCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero, Grupo:=Grupo, TipoCambio:=RblTipoCambio.SelectedValue.ToEntero, TCEspecifico:=TCEspecifico, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, Tipo:=Tipo, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=TxtFechaAplicadoI.Text.ToDate, FechaAplicadoF:=TxtFechaAplicadoF.Text.ToDate, FechaRegistroIEI:=TxtFechaRegistroIEI.Text.ToDate, FechaRegistroIEF:=TxtFechaRegistroIEF.Text.ToDate) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=FechaAplicadoI, FechaAplicadoF:=FechaAplicadoF, FechaRegistroIEI:=FechaRegistroIEI, FechaRegistroIEF:=FechaRegistroIEF) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados From 5a177595f5dc4d3723c7b7605e2b68fcc83ea6af Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Mon, 31 May 2021 17:57:57 -0700 Subject: [PATCH 3/3] commit a conta --- Bancos/DepositosCaja.aspx | 1 - 1 file changed, 1 deletion(-) diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index d763e8925..3fd17f4ff 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -511,7 +511,6 @@ function txtSumaDescuento(txt) { var comision2 = ToDouble($('#C_TxtDescuento').val()); - var comisionNegativa = 0; if (comision2 > ValorTotalSeleccionado) { $('#C_TxtDescuento').val(descuento) alert("No es posible poner un IVA superior a lo seleccionado")