Modulo generar depreciacion
This commit is contained in:
@@ -22,6 +22,76 @@ Partial Class AF_RepDepreciacion
|
||||
If GvDatos.Rows.Count = 0 Then Alert("No se encontraron Registros con los filtros actuales.", TipoMensaje.MsgAdvertencia)
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGenerarDepreciacion_Click(sender As Object, e As System.EventArgs) Handles BtnGenerarDepreciacion.Click
|
||||
|
||||
|
||||
If GvDatos.Rows.Count > 0 Then
|
||||
Dim CveActivoFijo As Integer
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
Dim ConceptoPoliza As String = String.Format("Depreciacion - {0}", txtFechaI.Text)
|
||||
Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero
|
||||
Dim CvePrePoliza = ObjConta.AddPrePolizas("Depreciacion", 74, 0, 0, 1, txtFechaI.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
|
||||
For Each RowsDt As GridViewRow In GvDatos.Rows
|
||||
CveActivoFijo = RowsDt.DataKey("CveActivoFijo").ToEntero
|
||||
If RowsDt.FCLiteral("LtlDepreciacionMensual").Text.ToDouble > 0 And CveActivoFijo <> 0 Then
|
||||
|
||||
Dim MontoDepreciacion As Double = RowsDt.FCLiteral("LtlDepreciacionMensual").Text.ToDouble
|
||||
Dim ConceptoPolizaDetalle As String = String.Format("Depreciacion - {0} - {1}", txtFechaI.Text, RowsDt.FCLiteral("LtlDescripcion").Text)
|
||||
|
||||
If CvePrePoliza > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, MontoDepreciacion.ToDecimal, ConceptoPolizaDetalle, 101, ConceptoPolizaDetalle, txtFechaI.Text.ToDate, 0, -1, CveActivoFijo:=CveActivoFijo, ImporteMX:=MontoDepreciacion.ToDecimal, ImporteME:=MontoDepreciacion.ToDecimal, CveSubProyecto:=CveSubProyecto) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, MontoDepreciacion.ToDecimal, ConceptoPolizaDetalle, 51, ConceptoPolizaDetalle, txtFechaI.Text.ToDate, 0, -1, CveActivoFijo:=CveActivoFijo, ImporteMX:=MontoDepreciacion.ToDecimal, ImporteME:=MontoDepreciacion.ToDecimal, CveSubProyecto:=CveSubProyecto) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If ErrorMovInv = False Then
|
||||
ObjInventario.Commit()
|
||||
ObjInventario.Dispose()
|
||||
ObjConta.Dispose()
|
||||
|
||||
Dim MensajeAlert As New StringBuilder
|
||||
MensajeAlert.Append("Se ha generado la depreciación")
|
||||
MensajeAlert.AppendFormat("<br/><br/><b><a href = ""/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}"" class=""texto"" target=""_blank"" >ver PrePóliza</a></b>", CvePrePoliza)
|
||||
|
||||
Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion)
|
||||
|
||||
Else
|
||||
ObjInventario.RollBack()
|
||||
ObjInventario.Dispose()
|
||||
ObjConta.Dispose()
|
||||
End If
|
||||
|
||||
Else
|
||||
Alert("Debera consultar la informacion previo a la generacion de la depreciación", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnDepreciacion_Click(sender As Object, e As EventArgs) Handles BtnDepreciacion.Click
|
||||
CargaProyecto()
|
||||
UpModalTiposD.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivDepreciacion"))
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged
|
||||
CargaSubProyecto()
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " C A R G A - D A T O S "
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjAF As New ClsAF
|
||||
@@ -50,6 +120,19 @@ Partial Class AF_RepDepreciacion
|
||||
#End Region
|
||||
|
||||
#Region "CARGA COMBOS FILTRO"
|
||||
Private Sub CargaProyecto()
|
||||
DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa).FiltraParametros("", "", {"CveProyecto", "Proyecto"})
|
||||
DdlProyecto.DataBind()
|
||||
CargaSubProyecto()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaSubProyecto()
|
||||
DdlSubProyecto.Items.Clear()
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "DDLS SELECTED INDEX CHANGED"
|
||||
|
||||
Reference in New Issue
Block a user