-- solo cargar cuentas al editar o agregar

This commit is contained in:
2023-10-07 11:53:43 -07:00
parent 60da5e5527
commit a36649a8c4

View File

@@ -261,6 +261,7 @@ Partial Class ContabilidadC_RegPrePolizaS
CveMoneda = 1 CveMoneda = 1
ViewState("CvePrePoliza") = 0 ViewState("CvePrePoliza") = 0
ViewState("CvePeriodo") = "0" ViewState("CvePeriodo") = "0"
ViewState("CvePeriodo") = "0"
CveTipoTransaccion = -1 CveTipoTransaccion = -1
CveCuenta = -1 CveCuenta = -1
@@ -270,7 +271,6 @@ Partial Class ContabilidadC_RegPrePolizaS
Beneficiario = "-1" Beneficiario = "-1"
Actualizar = False Actualizar = False
IdPoliza = -1 IdPoliza = -1
CargaCtaContableE()
CargaConceptosContablesE() CargaConceptosContablesE()
CargaModalConceptoCuentas() CargaModalConceptoCuentas()
@@ -319,7 +319,6 @@ Partial Class ContabilidadC_RegPrePolizaS
ElseIf Request("CvePrePolizaOrigen") IsNot Nothing AndAlso IsNumeric(Request("CvePrePolizaOrigen")) AndAlso Request("CvePrePolizaOrigen").ToEntero > 0 Then ElseIf Request("CvePrePolizaOrigen") IsNot Nothing AndAlso IsNumeric(Request("CvePrePolizaOrigen")) AndAlso Request("CvePrePolizaOrigen").ToEntero > 0 Then
CvePrePolizaOrigen = Request("CvePrePolizaOrigen").ToEntero CvePrePolizaOrigen = Request("CvePrePolizaOrigen").ToEntero
CreaDT() CreaDT()
CargaPrePolizaOrigen() CargaPrePolizaOrigen()
@@ -342,7 +341,6 @@ Partial Class ContabilidadC_RegPrePolizaS
End If End If
TipoPlantilla = -1 TipoPlantilla = -1
If IfNull(Request("Tipo"), "").ToString = "Ing" Then If IfNull(Request("Tipo"), "").ToString = "Ing" Then
TipoPlantilla = 1 TipoPlantilla = 1
@@ -355,13 +353,10 @@ Partial Class ContabilidadC_RegPrePolizaS
CargaConceptos() CargaConceptos()
CargaSubProyectos() CargaSubProyectos()
CargaCuentasContables() CargaCuentasBancos()
'crea tabla temporal 'crea tabla temporal
ArregloMovs = New ArrayList ArregloMovs = New ArrayList
CargaCuentas()
If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
GvPrePoliza.Columns(5).Visible = False GvPrePoliza.Columns(5).Visible = False
GvMov.Columns(5).Visible = False GvMov.Columns(5).Visible = False
@@ -663,17 +658,20 @@ Partial Class ContabilidadC_RegPrePolizaS
End Sub End Sub
Private Sub CargaCuentasContables() Private Sub CargaCuentasContables()
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then If DdlCuentaContable.Items.Count = 0 Then
DdlCuentaContableE.DataSource = ObjConta.DtResultados Dim ObjConta As New ClsContabilidad
DdlCuentaContable.DataSource = ObjConta.DtResultados If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
DtCuentasContables = ObjConta.DtResultados DdlCuentaContableE.DataSource = ObjConta.DtResultados
DdlCuentaContable.DataSource = ObjConta.DtResultados
DtCuentasContables = ObjConta.DtResultados
End If
ObjConta.Dispose()
DdlCuentaContable.DataBind()
DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0"))
DdlCuentaContableE.DataBind()
DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
End If End If
ObjConta.Dispose()
DdlCuentaContable.DataBind()
DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0"))
DdlCuentaContableE.DataBind()
DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
End Sub End Sub
Private Sub CargaTiposGasto() Private Sub CargaTiposGasto()
@@ -1170,7 +1168,9 @@ Partial Class ContabilidadC_RegPrePolizaS
CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero, CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero,
CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero,
CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveCuenta:=row.DataKey("CveCuenta").ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveIE:=CveIEAgregado) Then CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text,
TipoCambio:=row.DataKey("TC").ToDecimal,
CveCuenta:=row.DataKey("CveCuenta").ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveIE:=CveIEAgregado) Then
OcurrioError = True OcurrioError = True
Exit For Exit For
End If End If
@@ -1218,6 +1218,14 @@ Partial Class ContabilidadC_RegPrePolizaS
OnError("Ocurrío un error al actualizar la PrePoliza", ex) OnError("Ocurrío un error al actualizar la PrePoliza", ex)
End Try End Try
If ObjContabilidad.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then
If ObjContabilidad.ValorPolizaDescuadre > 0 Then
OcurrioError = True
Alert("Error en validacion de prepoliza cuadre", TipoMensaje.MsgAdvertencia)
GuardaLogAD($"Compras/Compras-Actualizar | Error:{ObjContabilidad.MensajePolizaDescuadre} Diferencia:{ObjContabilidad.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If
End If
If Not OcurrioError Then If Not OcurrioError Then
ObjContabilidad.Commit() ObjContabilidad.Commit()
Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:=$"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={Me.CvePrePoliza}""", ShowCloseButton:=False) Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:=$"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={Me.CvePrePoliza}""", ShowCloseButton:=False)
@@ -1241,6 +1249,7 @@ Partial Class ContabilidadC_RegPrePolizaS
LtlTitulo.Text = "Agregar Concepto" LtlTitulo.Text = "Agregar Concepto"
BtnAceptar.Text = "Agregar" BtnAceptar.Text = "Agregar"
LimpiaCampos() LimpiaCampos()
CargaCuentasContables()
'CargaConceptosContablesE() 'CargaConceptosContablesE()
CargaSubProyectoE() CargaSubProyectoE()
@@ -1282,7 +1291,6 @@ Partial Class ContabilidadC_RegPrePolizaS
DdlConceptosContablesE.SelectedValueExist(CveConceptoContable) DdlConceptosContablesE.SelectedValueExist(CveConceptoContable)
DdlConceptosContablesE_SelectedIndexChanged(DdlConceptosContablesE, e) DdlConceptosContablesE_SelectedIndexChanged(DdlConceptosContablesE, e)
TxtTipoCambio.Text = GvPrePoliza.Rows(IndiceGrid).DataKey("TC").ToString.ToDecimal.ToString("###,###,###.####") TxtTipoCambio.Text = GvPrePoliza.Rows(IndiceGrid).DataKey("TC").ToString.ToDecimal.ToString("###,###,###.####")
TxtME.Text = GvPrePoliza.Rows(IndiceGrid).DataKey("ImporteME").ToDecimal.FormatoNumero TxtME.Text = GvPrePoliza.Rows(IndiceGrid).DataKey("ImporteME").ToDecimal.FormatoNumero
@@ -1318,7 +1326,7 @@ Partial Class ContabilidadC_RegPrePolizaS
DdlSubProyectoE.SelectedValueExist(CveSubProyecto) DdlSubProyectoE.SelectedValueExist(CveSubProyecto)
CargaTipoGastoE() CargaTipoGastoE()
DdlTipoGastoE.SelectedValueExist(CveTipoGasto) DdlTipoGastoE.SelectedValueExist(CveTipoGasto)
CargaCuentasContables()
DdlCuentaContableE.SelectedValueExist(CveCuenta) DdlCuentaContableE.SelectedValueExist(CveCuenta)
If Cargo <> 0 Then TxtCargoE.Text = Cargo.FormatoNumero If Cargo <> 0 Then TxtCargoE.Text = Cargo.FormatoNumero
@@ -1339,7 +1347,6 @@ Partial Class ContabilidadC_RegPrePolizaS
End If End If
If DdlConceptosContablesE.SelectedValue.ToEntero = 30 AndAlso CvePrePoliza > 0 Then If DdlConceptosContablesE.SelectedValue.ToEntero = 30 AndAlso CvePrePoliza > 0 Then
DdlConceptosContablesE.Enabled = False DdlConceptosContablesE.Enabled = False
Else Else
@@ -1371,16 +1378,16 @@ Partial Class ContabilidadC_RegPrePolizaS
DdlTipoGastoE.DataBind() DdlTipoGastoE.DataBind()
DdlTipoGastoE.Items.Insert(0, New ListItem("Sin Asignar", "0")) DdlTipoGastoE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
End Sub End Sub
Private Sub CargaCtaContableE() 'Private Sub CargaCtaContableE()
Dim ObjConta As New ClsContabilidad ' Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then ' If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
DdlCuentaContableE.DataSource = ObjConta.DtResultados ' DdlCuentaContableE.DataSource = ObjConta.DtResultados
End If ' End If
ObjConta.Dispose() ' ObjConta.Dispose()
DdlCuentaContableE.DataBind() ' DdlCuentaContableE.DataBind()
DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) ' DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0"))
End Sub 'End Sub
Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged
@@ -1982,7 +1989,7 @@ Partial Class ContabilidadC_RegPrePolizaS
DdlTipoTransaccion.DataBind() DdlTipoTransaccion.DataBind()
DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
End Sub End Sub
Private Sub CargaCuentas() Private Sub CargaCuentasBancos()
DdlCuenta.Items.Clear() DdlCuenta.Items.Clear()
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue)) DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue))
DdlCuenta.DataBind() DdlCuenta.DataBind()
@@ -2102,11 +2109,11 @@ Partial Class ContabilidadC_RegPrePolizaS
Actualizar = True Actualizar = True
GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero
Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero
Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex) Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex)
If DrM IsNot Nothing Then If DrM IsNot Nothing Then
HdnCve.Value = idMov.ToString HdnCve.Value = idMov.ToString
CargaCuentasContables()
DdlCuentaContable.SelectedValueExist(DrM("CveCuenta").ToString) DdlCuentaContable.SelectedValueExist(DrM("CveCuenta").ToString)
TxtReferencia.Text = DrM("Referencia").ToString TxtReferencia.Text = DrM("Referencia").ToString