private void evalIsNotEqual(cReportFormulaInt fint) { if (fint.getVariables().item(C_ISNOTEQUAL) == null) { fint.getVariables().add(null, C_ISNOTEQUAL); } cReportVariable w_item = fint.getVariables().item(C_ISNOTEQUAL); // the IsNotEqual function is for numbers // String strValue = ""; String strConstValue = ""; strValue = (String)m_report.getValue(fint.getParameters().item(0).getValue(), true); strConstValue = fint.getParameters().item(1).getValue(); w_item.setValue(strValue != strConstValue); }
private void evalMin(cReportFormulaInt fint) { object value = null; if (fint.getVariables().item(C_MIN) == null) { fint.getVariables().add(null, C_MIN); } cReportVariable w_item = fint.getVariables().item(C_MIN); // The Min function is for numbers and strings // value = m_report.getValue(fint.getParameters().item(0).getValue()); if (value.GetType() == typeof(String)) { if (String.Compare(w_item.getValue().ToString(), value.ToString(), StringComparison.CurrentCulture) > 0) { w_item.setValue(value); } } else { if ((double)w_item.getValue() > (double)value) { w_item.setValue(value); } } }
private void evalNumberToString(cReportFormulaInt fint) { if (fint.getVariables().item(C_NUMBERTOSTRING) == null) { fint.getVariables().add(null, C_NUMBERTOSTRING); } cReportVariable w_item = fint.getVariables().item(C_NUMBERTOSTRING); // the NumberToString funciton is for numbres // double iNumber = 0; int iLenguage = 0; iNumber = pGetNumber(m_report.getValue(fint.getParameters().item(0).getValue(), true)); iLenguage = cUtil.valAsInt(fint.getParameters().item(1).getValue()); cNumberToString ntos = new cNumberToString(); switch (iLenguage) { case C_SPANISH: w_item.setValue(ntos.spanishNumberToString(iNumber)); break; case C_ENGLISH: w_item.setValue(ntos.englishNumberToString(iNumber)); break; case C_FRENCH: w_item.setValue(ntos.frenchNumberToString(iNumber)); break; } }
private String resultSumTime(cReportFormulaInt fint) { if (fint.getVariables().count() == 0) { return ""; } cStructTime st = null; st = (cStructTime)fint.getVariables().item(C_SUMTIME).getValue(); if (cUtil.val(fint.getParameters().item(1).getValue()) != 0) { return cReportGlobals.format(st.getHour(), "00") + ":" + cReportGlobals.format(st.getMinute(), "00") + ":" + cReportGlobals.format(st.getSecond(), "00"); } else { return cReportGlobals.format(st.getHour(), "00") + ":" + cReportGlobals.format(st.getMinute(), "00"); } }
private void evalSumTime(cReportFormulaInt fint) { if (fint.getVariables().item(C_SUMTIME) == null) { fint.getVariables().add(null, C_SUMTIME).setValue(new cStructTime()); } cReportVariable w_item = fint.getVariables().item(C_SUMTIME); // the SumTime if for dates // pSumTimes((cStructTime)w_item.getValue(), DateTime.Parse(m_report.getValue(fint.getParameters().item(0).getValue(), true).ToString())); }
private void evalGroupLineNumber(cReportFormulaInt fint) { if (fint.getVariables().item(C_GROUPLINENUMBER) == null) { fint.getVariables().add(null, C_GROUPLINENUMBER); } cReportVariable w_item = fint.getVariables().item(C_GROUPLINENUMBER); // the LineNumber function is for numbers w_item.setValue( m_report.getGroupLineNumber( int.Parse(fint.getParameters().item(cReportGlobals.C_KEYINDEXGROUP).getValue()))); }
private void pEvalFunctionGroup(cReportFormulaInt fint) { double value = 0; double total = 0; if (fint.getVariables().count() > 0) { if (fint.getParameters().item(cReportGlobals.C_KEYINDEXCOL2) == null) { value = 0; } else { int columnIndex = int.Parse(fint.getParameters().item(cReportGlobals.C_KEYINDEXCOL2).getValue()); value = cUtil.val(m_report.getValueFromRs(columnIndex).ToString()); } cReportVariable var = fint.getVariables().item(C_GROUPPERCENTT); total = cUtil.val(var.getValue().ToString()); value = cUtil.divideByZero(value, total); var.setValue(value); } }
private void evalAverage(cReportFormulaInt fint) { if (fint.getVariables().item(C_AVERAGESUM) == null) { fint.getVariables().add(null, C_AVERAGESUM); fint.getVariables().add(null, C_AVERAGECOUNT); } cReportVariable w_item = fint.getVariables().item(C_AVERAGESUM); // the average function is for numbers // w_item.setValue((double)w_item.getValue() + pGetNumber(m_report.getValue(fint.getParameters().item(0).getValue(), true))); w_item = fint.getVariables().item(C_AVERAGECOUNT); // the average function is for numbers // w_item.setValue((double)w_item.getValue() + 1); }
private void evalSum(cReportFormulaInt fint) { if (fint.getVariables().item(C_SUM) == null) { fint.getVariables().add(null, C_SUM).setValue(0); } cReportVariable w_item = fint.getVariables().item(C_SUM); // the sum function is for numbers // w_item.setValue(Convert.ToDouble(w_item.getValue()) + pGetNumber(m_report.getValue(fint.getParameters().item(0).getValue(), true))); }
private int resultLength(cReportFormulaInt fint) { return m_report.getValueString(fint.getParameters().item(0).getValue()).Length; }
private object resultValue(cReportFormulaInt fint) { return m_report.getValue(fint.getParameters().item(0).getValue(), true); }
private double resultCalculo(cReportFormulaInt fint) { String control = ""; double value1 = 0; double value2 = 0; int oper = 0; control = fint.getParameters().item(1).getValue(); value1 = Convert.ToDouble(m_report.getValue(fint.getParameters().item(0).getValue(), true)); if (control != "\"\"") { value2 = Convert.ToDouble(m_report.getValue(control, true)); } else { value2 = double.Parse(fint.getParameters().item(2).getValue()); } oper = int.Parse(fint.getParameters().item(3).getValue()); switch (oper) { // addition case 1: return value1 + value2; // substraction case 2: return value1 - value2; // multiplication case 3: return value1 * value2; // division case 4: return cUtil.divideByZero(value1, value2); // power case 5: return Math.Pow(value1, ((int)value2)); default: return 0; } }
private object resultGetParam(cReportFormulaInt fint) { cParameter param = null; String paramName = ""; paramName = fint.getParameters().item(0).getValue(); for (int _i = 0; _i < m_report.getConnect().getParameters().count(); _i++) { param = m_report.getConnect().getParameters().item(_i); if (param.getName().ToLower() == paramName.ToLower()) { break; } } if (param == null) { throw new ReportArgumentMissingException( C_MODULE, cReportError.errGetDescript( csRptErrors.CSRPTERRMISSINGPARAM, paramName, "_getParameter()")); } return param.getValue(); }
private object resultGetVar(cReportFormulaInt fint) { String varName = ""; varName = fint.getParameters().item(0).getValue(); if (m_variables.item(varName) == null) { throw new ReportArgumentMissingException( C_MODULE, cReportError.errGetDescript( csRptErrors.CSRPTERRMISSINGPARAM, varName, "_getVar()")); } return m_variables.item(varName).getValue(); }
private void evalIsLessThan(cReportFormulaInt fint) { if (fint.getVariables().item(C_ISLESSTHAN) == null) { fint.getVariables().add(null, C_ISLESSTHAN); } cReportVariable w_item = fint.getVariables().item(C_ISLESSTHAN); // the IsLessThan function is for numbers // object value = m_report.getValue(fint.getParameters().item(0).getValue(), true); object constValue = fint.getParameters().item(1).getValue(); if (value.GetType() == typeof(String)) { String strValue = value.ToString(); String strConstValue = constValue.ToString(); if (String.Compare(strValue.ToString(), strConstValue.ToString(), StringComparison.CurrentCulture) < 0) { w_item.setValue(true); } else { w_item.setValue(false); } } else { if ((double)value < (double)constValue) { w_item.setValue(true); } else { w_item.setValue(false); } } }
private void evalDeclareVar(cReportFormulaInt fint) { String varName = ""; varName = fint.getParameters().item(0).getValue(); if (m_variables.item(varName) == null) { m_variables.add(null, varName); } }
private void evalGroupCount(cReportFormulaInt fint) { if (fint.getVariables().item(C_GROUPCOUNT) == null) { fint.getVariables().add(null, C_GROUPCOUNT); } cReportVariable w_item = fint.getVariables().item(C_GROUPCOUNT); // the Count function is for numbers // if param1 doesn't contain an index column is because we haven't // process the formulas yet. It happens because compilereport // is called before the InitColIndex in cReport's Launch function // and the order can not be changed because the function GetData // is executed after the CompileReport function, and we don't want // to change this order because we are afraid of the collateral damage // it could produce :( // // In the future we can analize it and modify the order and if this // doesn't produce any error we will remove this if :) // if (fint.getParameters().item(cReportGlobals.C_KEYINDEXCOL) == null) { w_item.setValue(0); } else { w_item.setValue( m_report.getGroupCount( int.Parse(fint.getParameters().item(cReportGlobals.C_KEYINDEXCOL).getValue()), int.Parse(fint.getParameters().item(cReportGlobals.C_KEYINDEXGROUP).getValue()))); } }
private void evalSetVar(cReportFormulaInt fint) { String varName = ""; varName = fint.getParameters().item(0).getValue(); if (m_variables.item(varName) == null) { throw new ReportArgumentMissingException( C_MODULE, cReportError.errGetDescript( csRptErrors.CSRPTERRMISSINGPARAM, varName, "_setVar")); } cReportVariable w_item = m_variables.item(varName); w_item.setValue(fint.getParameters().item(1).getValue()); }
private void pSetParams(cReportFormulaInt fint, String parameters) { String[] vParams = null; int i = 0; parameters = parameters.Trim(); if (parameters.Length > 2) { parameters = parameters.Substring(1, parameters.Length - 2); parameters = parameters.Trim(); vParams = parameters.Split('|'); for (i = 0; i < vParams.Length; i++) { fint.getParameters().item(i).setValue(vParams[i].Trim()); } } }
private void evalAddToVar(cReportFormulaInt fint) { String varName = ""; varName = fint.getParameters().item(0).getValue(); if (m_variables.item(varName) == null) { throw new ReportArgumentMissingException( C_MODULE, cReportError.errGetDescript( csRptErrors.CSRPTERRMISSINGPARAM, varName, "_evalAddToVar")); } cReportVariable w_item = m_variables.item(varName); // the EvalAddToVar function is for numbers // w_item.setValue((double)w_item.getValue() + pGetNumber(fint.getParameters().item(1).getValue())); }
private void pSetColIndexInGroupFormulaAux( DataTable rs, cReportFormulaInt fint, String colName, String keyParam) { for (int i = 0; i < rs.Columns.Count; i++) { if (colName.ToLower() == rs.Columns[i].ColumnName.ToLower()) { if (fint.getParameters().item(keyParam) == null) { fint.getParameters().add2("", keyParam); } fint.getParameters().item(keyParam).setValue(i.ToString()); break; } } }
private String resultGetString(cReportFormulaInt fint) { String param = ""; param = fint.getParameters().item(0).getValue(); if (param == "\"\"") { return param; } else { if (pIsControl(param)) { return "\"" + m_report.getValueString(param).Replace("\"", "\"\"") + "\""; } else { return "\"" + param.Replace("\"", "\"\"") + "\""; } } }