} // end OutputUnitSubtotal private void UpdateOverallTotal() { // R602 foreach (RegionalReports us in unitSubtotal) { // does product already exist in totalToOutput int nthRow = totalToOutput.FindIndex( delegate(ReportSubtotal rs) { return(rs.Value1 == us.value6); }); if (nthRow >= 0) { // update total net totalToOutput[nthRow].Value3 += us.value8; } else if (nthRow < 0) { // add a new row ReportSubtotal rs = new ReportSubtotal(); rs.Value1 = us.value6; rs.Value3 = us.value8; totalToOutput.Add(rs); } // endif } // end foreach on unitSubtotal return; } // end UpdateOverallTotal
} // end UpdateUnitTotal private void UpdateStrataTotal(string currRPT) { // Works for UC reports // subtotals not prorated as the values are prorated when each line is printed if (strataSubtotal.Count > 0) { strataSubtotal[0].Value3 += numTrees; strataSubtotal[0].Value4 += currTipwood; } else { ReportSubtotal rs = new ReportSubtotal(); rs.Value3 += numTrees; rs.Value4 += currTipwood; strataSubtotal.Add(rs); } // endif // updates grand total as well if (grandTotal.Count > 0) { grandTotal[0].Value3 += numTrees; grandTotal[0].Value4 += currTipwood; } else { ReportSubtotal rs = new ReportSubtotal(); rs.Value3 += numTrees; rs.Value4 += currTipwood; grandTotal.Add(rs); } // endif return; } // end UpdateStrataTotal
} // end CreateEX6 private void updateSubtotal(List <ReportSubtotal> totalToUpdate, string currCode) { if (totalToUpdate.Count == 0) { ReportSubtotal rs = new ReportSubtotal(); rs.Value1 = currCode; rs.Value3 = exToOutput.Sum(ex => ex.export11); rs.Value4 = exToOutput.Sum(ex => ex.export12); rs.Value5 = exToOutput.Sum(ex => ex.export13); rs.Value6 = exToOutput.Sum(ex => ex.export14); rs.Value7 = exToOutput.Sum(ex => ex.export15); rs.Value8 = exToOutput.Sum(ex => ex.export16); rs.Value9 = exToOutput.Sum(ex => ex.export17); totalToUpdate.Add(rs); } else { totalToUpdate[0].Value3 += exToOutput.Sum(ex => ex.export11); totalToUpdate[0].Value4 += exToOutput.Sum(ex => ex.export12); totalToUpdate[0].Value5 += exToOutput.Sum(ex => ex.export13); totalToUpdate[0].Value6 += exToOutput.Sum(ex => ex.export14); totalToUpdate[0].Value7 += exToOutput.Sum(ex => ex.export15); totalToUpdate[0].Value8 += exToOutput.Sum(ex => ex.export16); totalToUpdate[0].Value9 += exToOutput.Sum(ex => ex.export17); } // endif return; } // end updateSubtotal
} // end WriteCurrentGroup private void updateTotalLine() { // R301 if (totalToOutput.Count > 0) { totalToOutput[0].Value7 = listToOutput.Sum(l => l.value7); totalToOutput[0].Value8 = listToOutput.Sum(l => l.value8); totalToOutput[0].Value9 = listToOutput.Sum(l => l.value9); totalToOutput[0].Value10 = listToOutput.Sum(l => l.value10); totalToOutput[0].Value11 = listToOutput.Sum(l => l.value11); totalToOutput[0].Value12 = listToOutput.Sum(l => l.value12); totalToOutput[0].Value13 = listToOutput.Sum(l => l.value12); } else if (totalToOutput.Count == 0) { ReportSubtotal r = new ReportSubtotal(); r.Value1 = listToOutput[0].value3; r.Value7 = listToOutput.Sum(l => l.value7); r.Value8 = listToOutput.Sum(l => l.value8); r.Value9 = listToOutput.Sum(l => l.value9); r.Value10 = listToOutput.Sum(l => l.value10); r.Value11 = listToOutput.Sum(l => l.value11); r.Value12 = listToOutput.Sum(l => l.value12); r.Value13 = listToOutput.Sum(l => l.value13); totalToOutput.Add(r); } // endif } // end updateTotalLine
} // end WriteCurrentGroup private void updateTotal() { if (totalToOutput.Count > 0) { foreach (RegionalReports lto in listToOutput) { totalToOutput[0].Value7 += lto.value7; totalToOutput[0].Value8 += lto.value8; totalToOutput[0].Value9 += lto.value9; totalToOutput[0].Value10 += lto.value10; totalToOutput[0].Value11 += lto.value11; totalToOutput[0].Value12 += lto.value12; totalToOutput[0].Value13 += lto.value13; } // end foreach loop } else if (totalToOutput.Count == 0) { foreach (RegionalReports lto in listToOutput) { ReportSubtotal r = new ReportSubtotal(); r.Value7 = lto.value7; r.Value8 = lto.value8; r.Value9 = lto.value9; r.Value10 = lto.value10; r.Value11 = lto.value11; r.Value12 = lto.value12; r.Value13 = lto.value13; totalToOutput.Add(r); } // end foreach loop } // endif return; } // end updateTotal
} // end WriteCurrentGroup private void updateTotals() { ReportSubtotal r = new ReportSubtotal(); r.Value8 = listToOutput.Sum(l => l.value8); r.Value9 = listToOutput.Sum(l => l.value9); r.Value10 = listToOutput.Sum(l => l.value10); r.Value11 = listToOutput.Sum(l => l.value11); r.Value12 = listToOutput.Sum(l => l.value12); totalToOutput.Add(r); return; } // end updateTotals
} // end fillOneInchClass private void sortGrandTotal(List <ReportSubtotal> totalToOutput) { // R602 List <ReportSubtotal> sortedList = new List <ReportSubtotal>(); // Product 01 first foreach (ReportSubtotal tto in totalToOutput) { if (tto.Value1 == "01") { ReportSubtotal r = new ReportSubtotal(); r.Value1 = tto.Value1; r.Value3 = tto.Value3; sortedList.Add(r); } // endif } // end foreach loop // Product 08 foreach (ReportSubtotal tto in totalToOutput) { if (tto.Value1 == "08") { ReportSubtotal r = new ReportSubtotal(); r.Value1 = tto.Value1; r.Value3 = tto.Value3; sortedList.Add(r); } // endif } // end foreach loop // and Product 20 foreach (ReportSubtotal tto in totalToOutput) { if (tto.Value1 == "20") { ReportSubtotal r = new ReportSubtotal(); r.Value1 = tto.Value1; r.Value3 = tto.Value3; sortedList.Add(r); } // endif } // end foreach loop // reset totalToOutput totalToOutput.Clear(); foreach (ReportSubtotal sl in sortedList) { ReportSubtotal r = new ReportSubtotal(); r.Value1 = sl.Value1; r.Value3 = sl.Value3; totalToOutput.Add(r); } // end foreach loop return; } // end sortGrandTotal
} // end WriteCurrentGroup private void UpdateTotals(List <ReportSubtotal> eachLine, List <ReportSubtotal> listToUpdate, int whichTotal) { // update appropriate total switch (whichTotal) { case 1: // product total // is product already recorded in a list if (listToUpdate.Count == 0) { ReportSubtotal rs = new ReportSubtotal(); rs.Value1 = eachLine[0].Value1; rs.Value2 = "TOTAL"; listToUpdate.Add(rs); } // endif break; case 2: // sale total // is sale total already setup? if (listToUpdate.Count == 0) { ReportSubtotal rs = new ReportSubtotal(); rs.Value1 = " "; rs.Value2 = "TOTAL "; listToUpdate.Add(rs); } // endif break; } // end switch foreach (ReportSubtotal rs in eachLine) { listToUpdate[0].Value3 += rs.Value3; listToUpdate[0].Value4 += rs.Value4; listToUpdate[0].Value5 += rs.Value5; listToUpdate[0].Value6 += rs.Value6; listToUpdate[0].Value7 += rs.Value7; listToUpdate[0].Value8 += rs.Value8; listToUpdate[0].Value9 += rs.Value9; listToUpdate[0].Value10 += rs.Value10; listToUpdate[0].Value11 += rs.Value11; listToUpdate[0].Value12 += rs.Value12; listToUpdate[0].Value13 += rs.Value13; listToUpdate[0].Value14 += rs.Value14; } // end foreach loop return; } // end UpdateTotals
} // end UpdateStrataTotal // ///////////////////////////////////////////////////////////////////////////////// private void UpdateSubtotalSummary(string currSP, List <ReportSubtotal> summaryList) { // used by UC5-UC6 only for summary at end of report // see if current species is in the list int nthRow = summaryList.FindIndex( delegate(ReportSubtotal rs) { return(rs.Value1 == currSP); }); if (nthRow >= 0) { summaryList[nthRow].Value3 += numTrees; summaryList[nthRow].Value4 += currTipwood; //summaryList[nthRow].Value13 += estTrees; } else // species not in list so add it { ReportSubtotal rs = new ReportSubtotal(); rs.Value1 = currSP; rs.Value3 += numTrees; rs.Value4 += currTipwood; //rs.Value13 += estTrees; summaryList.Add(rs); } // endif // updates grand total as well if (grandTotal.Count > 0) { grandTotal[0].Value3 += numTrees; grandTotal[0].Value4 += currTipwood; //grandTotal[0].Value13 += estTrees; } else { ReportSubtotal rs = new ReportSubtotal(); rs.Value3 += numTrees; rs.Value4 += currTipwood; //rs.Value13 += estTrees; grandTotal.Add(rs); } // endif return; } // end UpdateSubtotalSummary
} // end LoadAndPrintProrated private void UpdateUnitTotal(string currRPT) { // Works for UC reports // subtotals are not prorated as the values are prorated when each line is printed if (unitSubtotal.Count > 0) { unitSubtotal[0].Value3 += numTrees; unitSubtotal[0].Value4 += currTipwood; // unitSubtotal[0].Value13 += estTrees; } else { ReportSubtotal rs = new ReportSubtotal(); rs.Value3 += numTrees; rs.Value4 += currTipwood; // rs.Value13 += estTrees; unitSubtotal.Add(rs); } // endif return; } // end UpdateUnitTotal
} // end LoadExtraHeading private void loadDIBclasses(List <LogStockDO> justCutLogs, List <ReportSubtotal> listToLoad) { // loads classes into specified list to load int maxDBH = Convert.ToInt16(justCutLogs.Max(j => j.SmallEndDiameter)); if (maxDBH > 48) { maxDBH = 48; } int numClasses = Convert.ToInt16(Math.Floor((maxDBH - 3) + 0.5)); // load classes into list to load if (numClasses < 0) { ReportSubtotal rs = new ReportSubtotal(); numClasses = 0; rs.Value1 = "0"; listToLoad.Add(rs); } else { // otherwise load list up to number of classes for (int k = 4; k <= maxDBH; k++) { ReportSubtotal rs = new ReportSubtotal(); if (k == 4) { ReportSubtotal r = new ReportSubtotal(); r.Value1 = "1-3"; listToLoad.Add(r); } // endif rs.Value1 = k.ToString(); listToLoad.Add(rs); } // end for k loop } // endif return; } // end loadDIBclasses
} // end CreateTreeGradeReports private void LoadEachLine(string volType, ref int firstLine, LCDDO lcd, int whichPage) { ReportSubtotal ea = new ReportSubtotal(); int nthRow = 0; // is this the first line? if (firstLine == 1) { ea.Value1 = lcd.PrimaryProduct; ea.Value2 = lcd.Species; eachLine.Add(ea); nthRow = 0; firstLine = 0; } else { // is this species in the list? nthRow = eachLine.FindIndex( delegate(ReportSubtotal rs) { return(rs.Value2 == lcd.Species); }); if (nthRow == -1) { // not there; add it if (firstLine == 0) { ea.Value1 = ""; } ea.Value2 = lcd.Species; if (eachLine.Count == 0) { nthRow = 0; } else { nthRow = eachLine.Count + 1; } eachLine.Add(ea); } // endif nthRow } // endif firstLine // update tree grade fields with appropriate volume double currentValue = 0; if (whichPage == 1) { currentValue = lcd.SumExpanFactor; } else if (volType == "BDFT") { currentValue = lcd.SumNBDFT; } else if (volType == "CUFT") { currentValue = lcd.SumNCUFT; } // also need strata acres to expand volume List <StratumDO> sList = bslyr.getStratum(); long currStrCN = StratumMethods.GetStratumCN(lcd.Stratum, sList); double currAcres = Utilities.ReturnCorrectAcres(lcd.Stratum, bslyr, currStrCN); switch (lcd.TreeGrade) { case "0": eachLine[nthRow].Value3 += currentValue * currAcres; break; case "1": eachLine[nthRow].Value4 += currentValue * currAcres; break; case "2": eachLine[nthRow].Value5 += currentValue * currAcres; break; case "3": eachLine[nthRow].Value6 += currentValue * currAcres; break; case "4": eachLine[nthRow].Value7 += currentValue * currAcres; break; case "5": eachLine[nthRow].Value8 += currentValue * currAcres; break; case "6": eachLine[nthRow].Value9 += currentValue * currAcres; break; case "7": eachLine[nthRow].Value10 += currentValue * currAcres; break; case "8": eachLine[nthRow].Value11 += currentValue * currAcres; break; case "9": eachLine[nthRow].Value12 += currentValue * currAcres; break; case " ": case "": case null: eachLine[nthRow].Value13 += currentValue * currAcres; break; } // end switch // Add volume to line total eachLine[nthRow].Value14 += currentValue * currAcres; return; } // end LoadEachLine
} // end OutputData private void UpdateSubtotal(double ETS, double GTS, double NTS, string currProd, string currUnit, string LDtype, List <ReportSubtotal> totalToUpdate) { // updates subtotal if (totalToUpdate.Count == 0) { ReportSubtotal rs = new ReportSubtotal(); rs.Value1 = currProd; rs.Value2 = currUnit; switch (LDtype) { case "L": rs.Value3 = ETS; rs.Value4 = GTS; rs.Value5 = NTS; break; case "D": rs.Value6 = ETS; rs.Value7 = GTS; rs.Value8 = NTS; break; case "O": rs.Value9 = ETS; rs.Value10 = GTS; rs.Value11 = NTS; break; case "T": rs.Value12 = ETS; rs.Value13 = GTS; rs.Value14 = NTS; break; } // end switch totalToUpdate.Add(rs); } else if (totalToUpdate.Count > 0) { // record already exists -- update appropriately switch (LDtype) { case "L": totalToUpdate[0].Value3 += ETS; totalToUpdate[0].Value4 += GTS; totalToUpdate[0].Value5 += NTS; break; case "D": totalToUpdate[0].Value6 += ETS; totalToUpdate[0].Value7 += GTS; totalToUpdate[0].Value8 += NTS; break; case "O": totalToUpdate[0].Value9 += ETS; totalToUpdate[0].Value10 += GTS; totalToUpdate[0].Value11 += NTS; break; case "T": totalToUpdate[0].Value12 += ETS; totalToUpdate[0].Value13 += GTS; totalToUpdate[0].Value14 += NTS; break; } // end switch } // endif return; } // end UpdateSubtotal