mejoras en carga contable
This commit is contained in:
@@ -223,7 +223,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
Beneficiario = "-1"
|
Beneficiario = "-1"
|
||||||
Actualizar = False
|
Actualizar = False
|
||||||
IdPoliza = -1
|
IdPoliza = -1
|
||||||
|
CargaCtaContableE()
|
||||||
|
|
||||||
If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then
|
If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then
|
||||||
DivTipoGasto.Visible = True
|
DivTipoGasto.Visible = True
|
||||||
@@ -452,6 +452,11 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
LnkComplementoPago.Visible = True
|
LnkComplementoPago.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 119 Then
|
||||||
|
BtnContabilizar.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.TipoContabilizacion = 1 Then
|
If UsuarioActual.Empresa.TipoContabilizacion = 1 Then
|
||||||
If dr("FolioPoliza").ToString.ToEntero > 0 Then
|
If dr("FolioPoliza").ToString.ToEntero > 0 Then
|
||||||
divContabilizada.Visible = True
|
divContabilizada.Visible = True
|
||||||
@@ -636,8 +641,20 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0"))
|
DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0"))
|
||||||
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 Function CargaCuentasContpaq(CveCuenta As Integer) As Integer
|
||||||
|
Dim Retorno As Integer = -1
|
||||||
|
If CveCuenta > 0 Then
|
||||||
|
Dim ObjConta As New ClsContabilidad
|
||||||
|
If ObjConta.GetCuentas(CveCuenta, "-1", 1, UsuarioActual.CveEmpresa) Then
|
||||||
|
Retorno = ObjConta.DtResultados.Rows(0)("IdCompaq").ToString.ToEntero
|
||||||
|
End If
|
||||||
|
ObjConta.Dispose()
|
||||||
|
End If
|
||||||
|
Return Retorno
|
||||||
|
|
||||||
|
End Function
|
||||||
Private Sub CargaTiposGasto()
|
Private Sub CargaTiposGasto()
|
||||||
DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
|
DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
|
||||||
DdlTipoGasto.DataBind()
|
DdlTipoGasto.DataBind()
|
||||||
@@ -1039,17 +1056,22 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub ActualizarPrePoliza()
|
Private Sub ActualizarPrePoliza()
|
||||||
|
Dim contador As Integer = 0
|
||||||
Dim OcurrioError As Boolean = False
|
Dim OcurrioError As Boolean = False
|
||||||
Dim ObjContabilidad As New ClsContabilidad
|
Dim ObjContabilidad As New ClsContabilidad
|
||||||
ObjContabilidad.IniciaTransacSQL()
|
ObjContabilidad.IniciaTransacSQL()
|
||||||
|
|
||||||
ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario)
|
ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario)
|
||||||
|
|
||||||
|
If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
For Each row As GridViewRow In GvPrePoliza.Rows
|
For Each row As GridViewRow In GvPrePoliza.Rows
|
||||||
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
|
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
|
||||||
If row.FCCheckBox("chkModificado").Checked Then
|
If row.FCCheckBox("chkModificado").Checked Then
|
||||||
|
contador = contador + 1
|
||||||
If Not ObjContabilidad.UpdatePrePolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero,
|
If Not ObjContabilidad.UpdatePrePolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero,
|
||||||
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
|
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
|
||||||
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
|
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
|
||||||
@@ -1061,6 +1083,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
|
contador = contador + 1
|
||||||
If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
|
If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
|
||||||
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString,
|
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString,
|
||||||
row.DataKey("CveConceptoContable").ToEntero, row.FCLiteral("TxtConcepto").Text, Now,
|
row.DataKey("CveConceptoContable").ToEntero, row.FCLiteral("TxtConcepto").Text, Now,
|
||||||
@@ -1087,6 +1110,13 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
|
|
||||||
ObjContabilidad.Dispose()
|
ObjContabilidad.Dispose()
|
||||||
CargaPrePoliza()
|
CargaPrePoliza()
|
||||||
|
|
||||||
|
If Not OcurrioError Then
|
||||||
|
If IdPoliza > 0 AndAlso contador Then
|
||||||
|
BtnContabilizar_Click(Nothing, Nothing)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub LnkAddConcepto_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkAddConcepto_Click(sender As Object, e As EventArgs)
|
||||||
RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto"))
|
RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto"))
|
||||||
@@ -1096,10 +1126,8 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
|
|
||||||
CargaConceptosContablesE()
|
CargaConceptosContablesE()
|
||||||
CargaSubProyectoE()
|
CargaSubProyectoE()
|
||||||
CargaTipoGastoE()
|
CargaTipoGastoE()
|
||||||
CargaCtaContableE()
|
|
||||||
|
|
||||||
|
|
||||||
UpdatePanel1.Update()
|
UpdatePanel1.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub GvPrePoliza_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvPrePoliza.RowUpdating
|
Protected Sub GvPrePoliza_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvPrePoliza.RowUpdating
|
||||||
@@ -1135,9 +1163,12 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
|
|
||||||
DdlPersonalE.SelectedValueExist(CvePersonal)
|
DdlPersonalE.SelectedValueExist(CvePersonal)
|
||||||
|
|
||||||
DdlClientesE.SelectedValue = CveCliente
|
If CveCliente > 0 Then
|
||||||
DdlClientesE.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("NombreComercial", $"CveCliente={CveCliente}")
|
DdlClientesE.SelectedValue = CveCliente
|
||||||
DdlClientesE_SelectedIndexChanged(DdlClientesE, e)
|
DdlClientesE.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("NombreComercial", $"CveCliente={CveCliente}")
|
||||||
|
DdlClientesE_SelectedIndexChanged(DdlClientesE, e)
|
||||||
|
|
||||||
|
End If
|
||||||
DdlVentasE.SelectedValueExist(CveVenta)
|
DdlVentasE.SelectedValueExist(CveVenta)
|
||||||
|
|
||||||
TxtConceptoE.Text = Concepto
|
TxtConceptoE.Text = Concepto
|
||||||
@@ -1146,8 +1177,8 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
CargaSubProyectoE()
|
CargaSubProyectoE()
|
||||||
DdlSubProyectoE.SelectedValueExist(CveSubProyecto)
|
DdlSubProyectoE.SelectedValueExist(CveSubProyecto)
|
||||||
CargaTipoGastoE()
|
CargaTipoGastoE()
|
||||||
DdlTipoGastoE.SelectedValueExist(CveTipoGasto)
|
DdlTipoGastoE.SelectedValueExist(CveTipoGasto)
|
||||||
CargaCtaContableE()
|
|
||||||
DdlCuentaContableE.SelectedValueExist(CveCuenta)
|
DdlCuentaContableE.SelectedValueExist(CveCuenta)
|
||||||
|
|
||||||
If Cargo <> 0 Then
|
If Cargo <> 0 Then
|
||||||
@@ -1293,9 +1324,10 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
|
|
||||||
If IndiceGrid = -1 Then
|
If IndiceGrid = -1 Then
|
||||||
If DtMovimientos Is Nothing Then CreaDT()
|
If DtMovimientos Is Nothing Then CreaDT()
|
||||||
If CvePrePoliza > 0 Then
|
If CvePrePoliza > 0 Then
|
||||||
|
Dim IdCtaContable As Integer = CargaCuentasContpaq(DdlCuentaContableE.SelectedValue.ToEntero)
|
||||||
Dim dr As DataRow = DtMovimientos.NewRow
|
Dim dr As DataRow = DtMovimientos.NewRow
|
||||||
dr("IdCtaContable") = DdlCuentaContableE.SelectedValue
|
dr("IdCtaContable") = IdCtaContable
|
||||||
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
||||||
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
||||||
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
|
dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue
|
||||||
@@ -1385,8 +1417,9 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
Dim Rows As DataRow() = DtMovimientos.Select("CvePrePolizaDetalle = " & CvePrePolizaDetalle)
|
Dim Rows As DataRow() = DtMovimientos.Select("CvePrePolizaDetalle = " & CvePrePolizaDetalle)
|
||||||
|
|
||||||
If Rows.Count > 0 Then
|
If Rows.Count > 0 Then
|
||||||
Dim dr As DataRow = Rows(0)
|
Dim dr As DataRow = Rows(0)
|
||||||
dr("IdCtaContable") = DdlCuentaContableE.SelectedValue
|
Dim IdCtaContable As Integer = CargaCuentasContpaq(DdlCuentaContableE.SelectedValue.ToEntero)
|
||||||
|
dr("IdCtaContable") = IdCtaContable
|
||||||
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
dr("CveCuenta") = DdlCuentaContableE.SelectedValue
|
||||||
dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text
|
dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text
|
||||||
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text
|
||||||
@@ -1442,12 +1475,13 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
UpTotalCargo.Update()
|
UpTotalCargo.Update()
|
||||||
UpTotalAbono.Update()
|
UpTotalAbono.Update()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
UpPrePoliza.Update()
|
UpPrePoliza.Update()
|
||||||
RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal")
|
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting
|
Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting
|
||||||
|
|
||||||
@@ -1831,25 +1865,10 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
TxtObservaciones.Text = ""
|
TxtObservaciones.Text = ""
|
||||||
Actualizar = False
|
Actualizar = False
|
||||||
LbAgregar.Text = "Agregar"
|
LbAgregar.Text = "Agregar"
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub BtnContabilizar_Click(sender As Object, e As EventArgs) Handles BtnContabilizar.Click
|
|
||||||
|
|
||||||
Dim ObjConta As New ClsContabilidad
|
|
||||||
|
|
||||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
|
||||||
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio:<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
|
||||||
Else
|
|
||||||
|
|
||||||
Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
|
||||||
|
|
||||||
ObjConta.Dispose()
|
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Region "COMPLEMENTO DE PAGO"
|
#Region "COMPLEMENTO DE PAGO"
|
||||||
|
|
||||||
Private Sub GeneraTimbre(CvePrePoliza As Integer)
|
Private Sub GeneraTimbre(CvePrePoliza As Integer)
|
||||||
@@ -2247,7 +2266,29 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
End Function
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
Private Sub BtnContabilizar_Click(sender As Object, e As EventArgs) Handles BtnContabilizar.Click
|
||||||
|
|
||||||
|
Contabilizar()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Contabilizar()
|
||||||
|
|
||||||
|
Dim ObjConta As New ClsContabilidad
|
||||||
|
|
||||||
|
If IdPoliza > 0 Then 'si está bloqueada, lo desbloqueaprimero
|
||||||
|
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime()) Then
|
||||||
|
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio:<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
||||||
|
Else
|
||||||
|
|
||||||
|
Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjConta.Dispose()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
#Region "Paquete Egresos"
|
#Region "Paquete Egresos"
|
||||||
|
|||||||
Reference in New Issue
Block a user