Ignore:
Timestamp:
Oct 23, 2012, 12:31:20 PM (10 years ago)
Author:
olle
Message:

Fixes #420. The sample count report is updated to rename column "Grand total" to "Sum", and add a new column "Total" to the right of the latter with data regardless od creation date.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/samplereportgenerator.jsp

    r1728 r1729  
    179179    if (unknownCreation == null) unknownCreation = 0;
    180180    summaryList.appendChild(getListElement(unknownSite + ' specimens registered to unknown sites.'));
    181     summaryList.appendChild(getListElement(unknownCreation + ' specimens without creation date.'));
     181    summaryList.appendChild(getListElement(unknownCreation + ' specimens without creation date. These are included in the \'Total\' column.'));
    182182    cellElement.appendChild(summaryList);
    183183    Main.show('gorestart');   
     
    310310      headerText += latestDate.getDate();
    311311    }   
    312     headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+3)));
     312    headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+4)));
    313313   
    314314    // Sub headers
     
    333333   
    334334   
    335     columnHeaderRow.appendChild(getTableCellElement('Grand\ntotal', 'reportsubheader'));
     335    columnHeaderRow.appendChild(getTableCellElement('Sum', 'reportsubheader'));
     336    columnHeaderRow.appendChild(getTableCellElement('Total', 'reportsubheader'));
    336337
    337338    // Build table     
     
    347348    sitesCombinedRow.appendChild(getTableCellElement('Sites combined', 'colsummary'));
    348349    sitesCombinedRow.appendChild(getTableCellElement('', 'colsummary'));
    349     var gt = 0;
    350350    for (key in sitesCombined)
    351351    {
     352      // Add entry with sample sum for site for selected time period
    352353      sitesCombinedRow.appendChild(getTableCellElement(sitesCombined[key],'colsummary'));
    353       if (sitesCombined[key] != '') gt += sitesCombined[key];
    354     }
    355     sitesCombinedRow.appendChild(getTableCellElement(gt, 'colsummary'));
     354    }
     355    // Get total number of samples for site for the selected time period
     356    var statistics = report.statistics;
     357    var sum = statistics.sumKey;
     358    // Add entry with total number of samples for site for the selected time period
     359    sitesCombinedRow.appendChild(getTableCellElement(sum, 'colsummary'));
     360    // Get total number of samples for all sites, regardless of creation date
     361    var total = statistics.totalKey;
     362    // Add entry with total number of samples for all sites, regardless of creation date
     363    sitesCombinedRow.appendChild(getTableCellElement(total, 'colsummary'));
    356364    reportTable.appendChild(sitesCombinedRow); 
    357365
     
    526534      tableRow.appendChild(tableCol);
    527535      tableRow.appendChild(getTableCellElement(year+'-'+(month)+'-'+date, 'reportdata'));
    528       var grandTotal = 0;
    529536      var currentDate = new Date(periodStartDate.getFullYear(), periodStartDate.getMonth(), periodStartDate.getDate());     
    530537      var columnCounter = 0;
     
    542549            if (siteData[keyIndex] != null) data = siteData[keyIndex];
    543550          }
    544           grandTotal += data;         
    545551          if ( (currentDate.getFullYear() < siteStartDate.getFullYear()))
    546552          {
     
    561567            if (siteData[keyIndex] != null) data = siteData[keyIndex];           
    562568          }         
    563           grandTotal += data;
    564569          if ( (currentDate.getFullYear() <= siteStartDate.getFullYear()) && qIndex<startQuarter)
    565570          {
     
    580585            if (siteData[keyIndex] != null) data = siteData[keyIndex];
    581586          }
    582           grandTotal += data;         
    583587          if (currentDate.getFullYear() <= siteStartDate.getFullYear() && (monthIndex-1) < siteStartDate.getMonth())
    584588          {
     
    600604            if (siteData[keyIndex] != null) data = siteData[keyIndex];
    601605          }
    602           grandTotal += data;         
    603606          if (currentDate.getFullYear() <= siteStartDate.getFullYear() && getISOWeekNumber(currentDate) < getISOWeekNumber(siteStartDate))
    604607          {
     
    614617        columnCounter++;       
    615618      } while (columnCounter < numCols)
    616       tableRow.appendChild(getTableCellElement(grandTotal, 'rowsummary'));
     619      // Add column with sample sum for site for the selected time period
     620      var siteSum = 0;
     621      if (siteData != null)
     622      {
     623        var sumSiteKey = 'sumSiteKey';
     624        if (siteData[sumSiteKey] != null)
     625        {
     626          siteSum = siteData[sumSiteKey];
     627        }
     628      }
     629      tableRow.appendChild(getTableCellElement(siteSum, 'rowsummary'));
     630      // Add column with total number of samples for site, regardless of creation date
     631      var siteTotal = 0;
     632      if (siteData != null)
     633      {
     634        var totalSiteKey = 'totalSiteKey';
     635        if (siteData[totalSiteKey] != null)
     636        {
     637          siteTotal = siteData[totalSiteKey];
     638        }
     639      }
     640      tableRow.appendChild(getTableCellElement(siteTotal, 'rowsummary'));
    617641      reportTable.appendChild(tableRow);
    618642    }
Note: See TracChangeset for help on using the changeset viewer.