Skip to content

Commit

Permalink
Remover colunas vazias
Browse files Browse the repository at this point in the history
  • Loading branch information
dude333 committed Oct 8, 2023
1 parent fc5e43f commit fa9b888
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions cmd/relatorio.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func init() {
rootCmd.AddCommand(relatorioCmd)
}

func menuRelatório(cmd *cobra.Command, args []string) {
func menuRelatório(_ *cobra.Command, _ []string) {
dfp, err := contabil.NovaDemonstraçãoFinanceira(db(), flags.tempDir)
if err != nil {
progress.Fatal(err)
Expand Down Expand Up @@ -227,23 +227,15 @@ func excelReport(x *excel.Excel, itr []rapina.InformeTrimestral, decrescente boo
// Freeze panes
_ = x.FreezePane("C2")

// Trim empty columns
// Remover colunas vazias
hasData := rapina.TrimestresComDados(itr)
if decrescente {
reverseb(hasData)
}
for i := len(hasData) - 1; i >= 0; i-- {
if hasData[i] {
break
if !hasData[i] {
_ = x.RemoveCol(initCol + i)
}
_ = x.RemoveCol(initCol + i)
}
for i := 0; i < len(hasData); i++ {
if hasData[i] {
break
}
_ = x.RemoveCol(initCol)

}
} // excelReport =====

Expand Down Expand Up @@ -515,18 +507,11 @@ func excelSummaryReport(x *excel.Excel, itr []rapina.InformeTrimestral, decresce
// Freeze panes
_ = x.FreezePane("B2")

// Trim empty columns
// Remover colunas vazias
for i := len(sumCols) - 1; i >= 0; i-- {
if sumCols[i] != 0.0 {
break
}
_ = x.RemoveCol(colB + i)
}
for i := 0; i < len(sumCols); i++ {
if sumCols[i] != 0.0 {
break
if sumCols[i] == 0.0 {
_ = x.RemoveCol(colB + i)
}
_ = x.RemoveCol(colB)
}
}

Expand Down Expand Up @@ -641,7 +626,7 @@ func excelSummaryReportVertical(x *excel.Excel, itr []rapina.InformeTrimestral,
// Freeze panes
_ = x.FreezePane("B2")

// Delete empty columns
// Remover colunas vazias
for i := len(sumRows) - 1; i >= 0; i-- {
if sumRows[i] == 0.0 {
_ = x.RemoveRow(row2 + i)
Expand Down

0 comments on commit fa9b888

Please sign in to comment.