Skip to content

Commit

Permalink
Merge pull request #5 from mauryparra/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
MontiQt authored Jul 2, 2017
2 parents 1f3e5b8 + 006a0dd commit e8f8945
Show file tree
Hide file tree
Showing 32 changed files with 12,545 additions and 626 deletions.
5 changes: 4 additions & 1 deletion SireCu/Clases/Egreso.vb
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ Module Egreso

Dim flag As Boolean = False

cargarTablaEnDataSet("Egresos")

For i = 0 To Principal.dataset.Tables("Egresos").Rows.Count - 1
If (Principal.dataset.Tables("Egresos").Rows.Item(i).Item("nro_comprobante") = nComprobante) And
(Principal.dataset.Tables("Egresos").Rows.Item(i).Item("proveedor_id") = proveedorID) Then
(Principal.dataset.Tables("Egresos").Rows.Item(i).Item("proveedor_id") = proveedorID) And
(Principal.dataset.Tables("Egresos").Rows.Item(i).Item("eliminado") = 0) Then
flag = True
End If
Next
Expand Down
208 changes: 208 additions & 0 deletions SireCu/Clases/Reporte.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
Imports System.Data.SqlServerCe

Module Reporte


'Public Sub CrearRepEgreso(ByVal trimestre As String, ByVal año As Integer, ByVal seccional As Integer, ByVal central As Integer)

' Dim idTrimestre As Integer = obtenerID("Trimestres", "nombre", trimestre)
' Dim idReporteTrimestral = existReporte(año, idTrimestre)
' Dim sqlTotEgresoSec As String = ""
' Dim sqlTotEgresoCen As String = ""

' Select Case trimestre
' Case "Primero"
' sqlTotEgresoSec = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & seccional &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 1 And 3 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 1 And 3 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' sqlTotEgresoCen = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & central &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 1 And 3 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 1 And 3 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' Case "Segundo"
' sqlTotEgresoSec = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & seccional &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 4 And 6 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 4 And 6 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' sqlTotEgresoCen = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & central &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 4 And 6 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 4 And 6 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' Case "Tercero"
' sqlTotEgresoSec = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & seccional &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 7 And 7 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 7 And 9 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' sqlTotEgresoCen = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & central &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 7 And 9 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 7 And 9 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' Case "Cuarto"
' sqlTotEgresoSec = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & seccional &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 10 And 12 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 10 And 12 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' sqlTotEgresoCen = "SELECT SUM(monto) FROM Egresos
' WHERE seccional_id = " & central &
' " AND ((DATEPART(Month, [fecha]) BETWEEN 10 And 12 AND DATEPART(year, [fecha]) = " & año & ")
' OR (DATEPART(Month, [mes_reintegro]) BETWEEN 10 And 12 AND DATEPART(year, [mes_reintegro]) = " & año & "))"
' End Select

' Dim resultadoConsulta = consultarES(sqlTotEgresoSec, Principal.command)
' Dim totalEgresoSec As Double = IIf(IsDBNull(resultadoConsulta), 0, resultadoConsulta)
' resultadoConsulta = consultarES(sqlTotEgresoCen, Principal.command)
' Dim totalEgresoCen As Double = IIf(IsDBNull(resultadoConsulta), 0, resultadoConsulta)

' 'Reporte Egreso Seccional
' Principal.query = "INSERT INTO ReportesEgresos
' (reporte_trimestre_id, seccional_id, total)
' VALUES
' (" & idReporteTrimestral & "," & seccional & "," & totalEgresoSec & ")"
' consultarNQ(Principal.query, Principal.command)
' 'Reporte Egreso Central
' Principal.query = "INSERT INTO ReportesEgresos
' (reporte_trimestre_id, seccional_id, total)
' VALUES
' (" & idReporteTrimestral & "," & central & "," & totalEgresoCen & ")"
' consultarNQ(Principal.query, Principal.command)

'End Sub

#Region "Crear Reportes"

'REPORTE INGRESOS-GASTOS
Public Sub generarRepIngGast(ByVal trimestre As String, ByVal año As Integer)

' 1) Obtener Saldo Inicial
' 2) Obtener total Ingresos
' 3) Obtener total Egresos
' 4) Obtener Saldo Final
' 5) Generar la vista


Dim idSeccional As Integer = obtenerID("Seccionales", "nombre", "UDA Central", True)
Dim idCentral As Integer = obtenerID("Seccionales", "nombre", "UDA Central")
Dim saldoInicial As Decimal = 0.0
Dim saldoFinal As Decimal = 0.0
Dim ingresos As Decimal = 0.0
Dim egresos As Decimal = 0.0

' 1)
Select Case trimestre
Case "Primero"
saldoInicial = SaldoActual("Cuarto", (año - 1))
Case "Segundo"
saldoInicial = SaldoActual("Primero", año)
Case "Tercero"
saldoInicial = SaldoActual("Segundo", año)
Case "Cuarto"
saldoInicial = SaldoActual("Tercero", año)
End Select

' 2)
ingresos = obtenerIngresos(trimestre, año)

' 3)
egresos = obtenerEgresosTotales(trimestre, año, "full")

' 4)
saldoFinal = ingresos - egresos

'5)
Dim nuevo_reporte As New ReporteIngresoGasto
nuevo_reporte.trimestre = trimestre
nuevo_reporte.año = año
nuevo_reporte.cargarGrid(saldoInicial, saldoFinal, ingresos, egresos)
nuevo_reporte.Show()

End Sub
'REPORTE INGRESOS
Public Sub generarRepIngresos(ByVal trimestre As String, ByVal año As Integer)

' 1) Obtener los 3 Ingresos de cada mes del trimestre
' 2) Obtener la coparticipacion (Total egresos tipo gasto "Coparticipacion")
' 3) Generar la vista

' 1)
Dim ingresos As DataTable = obtenerIngresos(trimestre, año, "meses")

' 2)
Dim catID As Integer = obtenerID("CategoriasGastos", "nombre", "Coparticipacion")
Dim seccionalID As Integer = obtenerID("Seccionales", "nombre", "UDA Central", True)
Dim copart As Double() = obtenerEgresosCategorias(trimestre, catID, año, seccionalID)

' 3)
Dim nuevo_reporte As New ReporteIngreso
nuevo_reporte.trimestre = trimestre
nuevo_reporte.año = año
nuevo_reporte.cargarGrid(ingresos, copart)
nuevo_reporte.Show()
End Sub
'REPORTE EGRESOS SECCIONAL
Public Sub generarRepEgreSec(ByVal trimestre As String, ByVal año As Integer)

' 1) Obtener cantidad de Categorias de Gastos
' 2) Generar la vista


' 1)
Dim sql As String = "SELECT id, nombre FROM CategoriasGastos"
Dim dt As DataTable = consultarReader(sql)


' 2)
Dim nuevo_reporte As New ReporteEgresoSec
nuevo_reporte.trimestre = trimestre
nuevo_reporte.año = año
nuevo_reporte.cargarGrid(dt)
nuevo_reporte.Show()

End Sub
'REPORTE EGRESOS CENTRAL
Public Sub generarRepEgreCen(ByVal trimestre As String, ByVal año As Integer)

' 1) Obtener cantidad de Categorias de Gastos
' 2) Generar la vista


' 1)
Dim sql As String = "SELECT id, nombre FROM CategoriasGastos"
Dim dt As DataTable = consultarReader(sql)


' 2)
Dim nuevo_reporte As New ReporteEgresoCen
nuevo_reporte.trimestre = trimestre
nuevo_reporte.año = año
nuevo_reporte.cargarGrid(dt)
nuevo_reporte.Show()

End Sub

#End Region

#Region "Helpers"

Public Sub crearColumna(ByRef dgv As DataGridView, ByVal filtros As List(Of KeyValuePair(Of String, String)))

For Each columna As KeyValuePair(Of String, String) In filtros
If Not dgv.Columns.Contains(columna.Key) Then
Dim column As New DataGridViewTextBoxColumn
With column
.Name = columna.Key
.HeaderText = columna.Value
.DataPropertyName = columna.Value
.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
.DefaultCellStyle.Format = "C2"
.SortMode = DataGridViewColumnSortMode.NotSortable
End With
dgv.Columns.Add(column)
End If
Next

End Sub

#End Region

End Module
45 changes: 0 additions & 45 deletions SireCu/Clases/Reportes/Reporte.vb

This file was deleted.

Loading

0 comments on commit e8f8945

Please sign in to comment.