Преглед на файлове

fixed column and row dimensions in makros. improved Spielliste and Zahlliste XLSX outputs.

Tomislav Cvetic преди 7 години
родител
ревизия
c55eabea60
променени са 3 файла, в които са добавени 45 реда и са изтрити 27 реда
  1. 21 10
      src/App.js
  2. 13 8
      src/macros/SZTM_Spielliste.bas
  3. 11 9
      src/macros/SZTM_Zahlliste.bas

+ 21 - 10
src/App.js

@@ -40,6 +40,17 @@ import PhoneList from './lists/components/PhoneList'
  */
 
 const FILTER_OFF = 'Alle'
+const PLACES = {
+  'LE': 'TC Lerchenberg',
+  'WA': 'TC Waidberg',
+  'VA': 'TC Valsana',
+  'SE': 'TC Seebach',
+  'BU': 'TC Bührle',
+  'HO': 'TC Höngg',
+  'TS': 'Tennis-Sport Club',
+  'HA': 'Städtische Plätze Hardhof',
+  'AU': 'Auswärtig'
+}
 
 /** Main application */
 class App extends React.Component {
@@ -199,7 +210,7 @@ class App extends React.Component {
 
     let placeArray = this.state.match.places
     if (placeArray.length > 1) {
-      placeArray = placeArray.concat([FILTER_OFF])
+      //placeArray = placeArray.concat([FILTER_OFF])
     }
     const date = Object.keys(this.state.match.dates).find((key) =>
       String(this.state.match.dates[key]) === this.matchDate.value
@@ -208,12 +219,12 @@ class App extends React.Component {
     placeArray.forEach(place => {
       let header = [
         ['Stadtzürcher Tennismeisterschaft'],
-        [`Spielplan für den ${date} (${place})`],
+        [`Spielplan für den ${date} (${PLACES[place] || place})`],
         [],
-        ['Ort', 'Zeit', 'Kategorie', 'Spieler 1', '', 'Spieler 2', '', '1. Satz', '2. Satz', '3. Satz', 'WO Grund']
+        ['Platz', 'Zeit', 'Kategorie', 'Spieler 1', '', 'Spieler 2', '', '1. Satz', '2. Satz', '3. Satz', 'WO Grund']
       ]
       let matchListPerPlace = this.state.match.filtered.filter((match) => (match.Ort === place | place === FILTER_OFF)).map((match) =>
-        [match.Ort, time2s(match.Datum), match.Konkurrenz, match.Spieler1, match.Spieler1Klassierung, match.Spieler2, match.Spieler2Klassierung]
+        [null, time2s(match.Datum), match.Konkurrenz, match.Spieler1, match.Spieler1Klassierung, match.Spieler2, match.Spieler2Klassierung]
       )
       console.log('Generated match list per place:', matchListPerPlace)
       worksheets[place] = Excel.SheetFromArray(header.concat(matchListPerPlace))
@@ -221,7 +232,7 @@ class App extends React.Component {
       matchlist.Sheets[place] = worksheets[place]
     })
 
-    Excel.saveAs(matchlist, 'Spielliste.xlsx')
+    Excel.saveAs(matchlist, 'Spielplan.xlsx')
   }
 
   generatePhoneList (event) {
@@ -299,9 +310,9 @@ class App extends React.Component {
         ['Stadtzürcher Tennismeisterschaft'],
         [`Nenngelder für ${date}`],
         [],
-        [`${place}`, null, '50.- oder 30.- (Junioren Jg. 1999 oder jünger)'],
+        [`${PLACES[place] || place}`, null, '50.- oder 30.- (Junioren Jg. 1999 oder jünger)'],
         [],
-        ['bereits bez.', 'Kat.', 'Zeit', 'Name', 'Betrag bez.', 'Quittung abgeben']
+        ['bezahlt', 'Kat.', 'Zeit', 'Name', 'Betrag bez.', 'Quittung']
       ]
 
       // Per place
@@ -325,7 +336,7 @@ class App extends React.Component {
             } else {
               price = player.isJunior ? 30 : 50
             }
-            payListPerPlace.push([ paid, match.Konkurrenz, time2s(match.Datum), `${matchPlayer} (${price}.-)` ])
+            payListPerPlace.push([ paid, match.Konkurrenz, time2s(match.Datum), `(${price}.-) ${matchPlayer}` ])
           }
         })
       })
@@ -342,7 +353,7 @@ class App extends React.Component {
       paylist.Sheets[place] = worksheets[place]
     })
 
-    let payListPerPlace = []
+    /*let payListPerPlace = []
     this.state.match.filtered.forEach((match) => {
       [match.Spieler1, match.Spieler2].forEach((matchPlayer) => {
         if (matchPlayer) {
@@ -363,7 +374,7 @@ class App extends React.Component {
     worksheets[FILTER_OFF] = Excel.SheetFromArray(payListPerPlace)
     paylist.SheetNames.push(FILTER_OFF)
     paylist.Sheets[FILTER_OFF] = worksheets[FILTER_OFF]
-
+    */
     Excel.saveAs(paylist, 'Zahlliste.xlsx')
   }
 

+ 13 - 8
src/macros/SZTM_Spielliste.bas

@@ -1,7 +1,7 @@
 Attribute VB_Name = "Module2"
 Sub SZTM_Spielliste()
 Attribute SZTM_Spielliste.VB_Description = "Formatiert die Spielliste"
-Attribute SZTM_Spielliste.VB_ProcData.VB_Invoke_Func = "X\n14"
+Attribute SZTM_Spielliste.VB_ProcData.VB_Invoke_Func = "S\n14"
 '
 ' SZTM_Spielliste Macro
 ' Formatiert die Spielliste
@@ -15,6 +15,7 @@ Attribute SZTM_Spielliste.VB_ProcData.VB_Invoke_Func = "X\n14"
         With ws
         
             ws.Activate
+            ws.PageSetup.Orientation = xlLandscape
             
             'Select first row, change font size, make bold and merge
             Range("A1:K1").Select
@@ -112,13 +113,17 @@ Attribute SZTM_Spielliste.VB_ProcData.VB_Invoke_Func = "X\n14"
                 .TintAndShade = 0
                 .Weight = xlThin
             End With
-            Selection.RowHeight = 33.75
-            Selection.EntireColumn.AutoFit
-            'Columns("A:A").EntireColumn.AutoFit
-            'Columns("B:B").EntireColumn.AutoFit
-            'Columns("C:C").EntireColumn.AutoFit
-            'Columns("D:D").EntireColumn.AutoFit
-            'Columns("E:E").EntireColumn.AutoFit
+            Selection.RowHeight = 24
+            'Selection.EntireColumn.AutoFit
+            Columns("A:B").ColumnWidth = 5.63
+            Columns("C:C").ColumnWidth = 11.88
+            Columns("D:D").ColumnWidth = 20.63
+            Columns("E:E").ColumnWidth = 7.5
+            Columns("F:F").ColumnWidth = 20.63
+            Columns("G:G").ColumnWidth = 7.5
+            Columns("H:J").ColumnWidth = 6.25
+            Columns("K:K").ColumnWidth = 15
+            Rows(4).RowHeight = 15.75
             
         End With
     Next

+ 11 - 9
src/macros/SZTM_Zahlliste.bas

@@ -13,7 +13,6 @@ Attribute SZTM_Zahlliste.VB_ProcData.VB_Invoke_Func = "Z\n14"
         With ws
         
             ws.Activate
-            ws.PageSetup.Orientation = xlLandscape
             
             'Select first row, change font size, make bold and merge
             Range("A1:F1").Select
@@ -66,6 +65,7 @@ Attribute SZTM_Zahlliste.VB_ProcData.VB_Invoke_Func = "Z\n14"
             
             'Select last cell
             ActiveCell.SpecialCells(xlLastCell).Select
+            Selection.RowHeight = 27.75
             Selection.Offset(0, -2).Select
             Selection.Resize(Selection.Rows.Count + 1, Selection.Columns.Count + 2).Select
             Selection.Merge
@@ -88,7 +88,7 @@ Attribute SZTM_Zahlliste.VB_ProcData.VB_Invoke_Func = "Z\n14"
             Selection.Offset(-1, -4).Select
             Selection.Font.Bold = True
             Selection.Offset(0, 1).Select
-            Selection.Resize(Selection.Rows.Count, Selection.Columns.Count + 1).Select
+            Selection.Resize(Selection.Rows.Count, Selection.Columns.Count + 4).Select
             Selection.Merge
             
             Selection.Offset(0, -1).Select
@@ -186,13 +186,15 @@ Attribute SZTM_Zahlliste.VB_ProcData.VB_Invoke_Func = "Z\n14"
                 .TintAndShade = 0
                 .Weight = xlThin
             End With
-            Selection.RowHeight = 33.75
-            Selection.EntireColumn.AutoFit
-            'Columns("A:A").EntireColumn.AutoFit
-            'Columns("B:B").EntireColumn.AutoFit
-            'Columns("C:C").EntireColumn.AutoFit
-            'Columns("D:D").EntireColumn.AutoFit
-            'Columns("E:E").EntireColumn.AutoFit
+            Selection.RowHeight = 24
+            'Selection.EntireColumn.AutoFit
+            Columns("A:A").ColumnWidth = 11
+            Columns("B:B").ColumnWidth = 11.88
+            Columns("C:C").ColumnWidth = 5.63
+            Columns("D:D").ColumnWidth = 30
+            Columns("E:E").ColumnWidth = 9.38
+            Columns("F:F").ColumnWidth = 8
+            Rows(6).RowHeight = 15.75
             
         End With
     Next