private void populateData(CTable data) { String refundStatus = data.GetFieldValue("REFUND_STATUS"); MMasterRef mr = (MMasterRef)refundHash[refundStatus]; String refundDesc = CLanguage.getValue("NotSelected"); if (mr != null) { refundDesc = mr.Description; } data.SetFieldValue("REFUND_STATUS_DESC", refundDesc); String paymentType = data.GetFieldValue("PAYMENT_TYPE"); String paymentDesc = ((MMasterRef)paymentTypeHash[paymentType]).Description; data.SetFieldValue("PAYMENT_TYPE_DESC", paymentDesc); }
public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row) { String tmpPrevKey = prevKeyId; int rowcount = rows.Count; CReportDataProcessingProperty rpp = new CReportDataProcessingProperty(); ArrayList keepTotal1 = copyTotalArray(entitySums); ArrayList keepTotal2 = copyTotalArray(sums); CRow r = (CRow)rowdef["DATA_LEVEL1"]; CRow nr = r.Clone(); double newh = AvailableSpace - nr.GetHeight(); double h = 0.00; if (newh > 0) { String keyId = o.GetFieldValue("EMPLOYEE_CODE"); if (row == 0) { prevKeyId = keyId; } h = addNewDataRow(rowdef, rpp, "DATA_LEVEL1", "L1", row, o); //newh = newh - h; ArrayList temps = getColumnDataTexts("L1", row, o); nr.FillColumnsText(temps); sums = sumDataTexts("L1", sums, temps); entitySums = sumDataTexts("L1", entitySums, temps); if (row == rowcount - 1) { h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", sums); newh = newh - h; } } if (newh < 1) { rpp.IsNewPageRequired = true; //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว entitySums = keepTotal1; sums = keepTotal2; prevKeyId = tmpPrevKey; } else { AvailableSpace = newh; } return(rpp); }
private void GetObjectInfo(String code) { CLookupConfig cfg = (CLookupConfig)lookupTypeConfigs[Lookup]; ArrayList arr = null; CTable tb = new CTable(""); tb.SetFieldValue(cfg.CodeFieldName, code); tb.SetFieldValue("!EXT_EQUAL_STRING_COMPARE_FIELDS", cfg.TableAlias + cfg.CodeFieldName); if (!cfg.ExtraFieldValue.Equals("")) { tb.SetFieldValue(cfg.ExtraFieldName, cfg.ExtraFieldValue); } if (!cfg.ExtraFieldValue2.Equals("")) { tb.SetFieldValue(cfg.ExtraFieldName2, cfg.ExtraFieldValue2); } CUtil.EnableForm(false, this); arr = cfg.ListFunction(tb); if ((arr == null) || (arr.Count <= 0)) { SelectedObject = null; isEmpty = true; } else { CTable o = (CTable)arr[0]; MBaseModel instance = (MBaseModel)Activator.CreateInstance(cfg.ModelType, new object[] { o }); SelectedObject = instance; txtCode.Text = o.GetFieldValue(cfg.CodeFieldName); txtName.Text = o.GetFieldValue(cfg.NameFieldName); isEmpty = false; } CUtil.EnableForm(true, this); }
public void XmlToObjectInvalidContentTest(string content) { CRoot root = deserialize(content); CTable param = root.Param; string errCode = param.GetFieldValue("ERROR_CODE"); Assert.AreNotEqual("0", errCode, "Shoud return error because XML is invalid!!!"); }
private void filterDrCrAmount(CTable o) { double whAmt = CUtil.StringToDouble(o.GetFieldValue("WH_TAX_AMT")); double amt = CUtil.StringToDouble(o.GetFieldValue("REVENUE_EXPENSE_AMT")); double arap = CUtil.StringToDouble(o.GetFieldValue("AR_AP_AMT")); int factor = 1; String refDt = o.GetFieldValue("REF_DOCUMENT_TYPE"); if (refDt.Equals("")) { //ซื้อสด refDt = o.GetFieldValue("DOCUMENT_TYPE"); } else { //จ่ายชำระหนี้ //Do nothing } AccountDocumentType dt = (AccountDocumentType)CUtil.StringToInt(refDt); if ((dt == AccountDocumentType.AcctDocDrNote) || (dt == AccountDocumentType.AcctDocDrNotePurchase)) { factor = 1; } else if ((dt == AccountDocumentType.AcctDocCrNotePurchase) || (dt == AccountDocumentType.AcctDocCrNote)) { factor = -1; } whAmt = factor * Math.Abs(whAmt); amt = factor * Math.Abs(amt); arap = factor * Math.Abs(arap); double total = arap - whAmt; //ยอดหลังหัก o.SetFieldValue("WH_TAX_AMT", whAmt.ToString()); o.SetFieldValue("REVENUE_EXPENSE_AMT", amt.ToString()); o.SetFieldValue("AR_AP_AMT", arap.ToString()); o.SetFieldValue("REMAIN_AMT", total.ToString()); }
private void configReport() { String column1 = "customer_name"; String column2 = "po_no"; if (extParam.GetFieldValue("CATEGORY").Equals("2")) { column1 = "supplier_name"; column2 = "invoice_no"; } addConfig("L1", 5, "number", HorizontalAlignment.Center, HorizontalAlignment.Center, HorizontalAlignment.Center, "", "RN", false); addConfig("L1", 8, "date", HorizontalAlignment.Center, HorizontalAlignment.Center, HorizontalAlignment.Center, "REF_WH_DOC_NO", "S", false); addConfig("L1", 15, "inventory_doc_no", HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Center, "DOCUMENT_DATE", "DT", false); addConfig("L1", 11, column2, HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Left, "DOCUMENT_NO", "S", false); addConfig("L1", 26, column1, HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Left, "REF_DOCUMENT_NO", "S", false); addConfig("L1", 15, "bank_name", HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Left, "TEMP_ITEM_DESC", "S", false); addConfig("L1", 10, "cheque_no", HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Center, "WH_TAX_PCT", "S", false); addConfig("L1", 10, "amount", HorizontalAlignment.Center, HorizontalAlignment.Right, HorizontalAlignment.Right, "REVENUE_EXPENSE_AMT", "D", true); }
private void LoadDocTypeCombo(ComboBox cbo, String id) { if (extParam.GetFieldValue("CATEGORY").Equals("2")) { CUtil.LoadComboFromCollection(cbo, true, id, CMasterReference.Instance.PurchaseExpenseDocTypes); } else { CUtil.LoadComboFromCollection(cbo, true, id, CMasterReference.Instance.SaleRevenueDocTypes); } }
private void manipulateRow(CTable o) { string code = ""; string name = ""; string typeName = ""; string selectType = o.GetFieldValue("SELECTION_TYPE"); if (selectType.Equals("2")) { code = o.GetFieldValue("ITEM_CODE"); name = o.GetFieldValue("ITEM_NAME_THAI"); typeName = CLanguage.getValue("item"); } else if (selectType.Equals("1")) { code = o.GetFieldValue("SERVICE_CODE"); name = o.GetFieldValue("SERVICE_NAME"); typeName = CLanguage.getValue("service"); } else { code = CLanguage.getValue("free_text"); name = o.GetFieldValue("FREE_TEXT"); typeName = code; } o.SetFieldValue("SELECTION_TYPE_NAME", typeName); o.SetFieldValue("DISPLAY_CODE", code); o.SetFieldValue("DISPLAY_NAME", name); }
private void manipulateRow(CTable o) { String payeeName = o.GetFieldValue("CHEQUE_ENTITY_NAME"); String entityName = o.GetFieldValue("ENTITY_NAME"); Boolean balanceFlag = o.GetFieldValue("BALANCE_FLAG").Equals("Y"); int status = CUtil.StringToInt(o.GetFieldValue("DOCUMENT_STATUS")); String statusDesc = CUtil.InvDocStatusToString((InventoryDocumentStatus)status); o.SetFieldValue("DOCUMENT_STATUS_DESC", statusDesc); o.SetFieldValue("DESCRIPTION", payeeName); if (payeeName.Equals("")) { o.SetFieldValue("DESCRIPTION", entityName); } if (balanceFlag) { o.SetFieldValue("DOCUMENT_NO", CLanguage.getValue("balance_forward")); } }
public override ArrayList GetReportInputEntries() { CEntry entry = null; ArrayList entries = new ArrayList(); CTable extParam = GetExtraParam(); String category = extParam.GetFieldValue("CATEGORY"); String code = "customer_code"; String name = "customer_name"; if (category.Equals("2")) { code = "supplier_code"; name = "supplier_name"; } entry = new CEntry("from_date", EntryType.ENTRY_DATE_MIN, 200, true, "FROM_DOCUMENT_DATE"); entries.Add(entry); entry = new CEntry("to_date", EntryType.ENTRY_DATE_MAX, 200, true, "TO_DOCUMENT_DATE"); entries.Add(entry); entry = new CEntry("inventory_doc_status", EntryType.ENTRY_COMBO_BOX, 200, true, "DOCUMENT_STATUS"); entry.SetComboLoadAndInit(LoadCombo, InitCombo, ObjectToIndex); entries.Add(entry); entry = new CEntry("document_type", EntryType.ENTRY_COMBO_BOX, 200, true, "DOCUMENT_TYPE"); entry.SetComboLoadAndInit(LoadDocTypeCombo, InitCombo, ObjectToIndex); entries.Add(entry); entry = new CEntry("tax_revenue_type", EntryType.ENTRY_COMBO_BOX, 200, true, "RV_TAX_TYPE"); entry.SetComboLoadAndInit(LoadRevenueTypeCombo, InitCombo, ObjectToIndex); entries.Add(entry); if (category.Equals("2")) { entry = new CEntry("report_type", EntryType.ENTRY_COMBO_BOX, 200, true, "REPORT_TYPE"); entry.SetComboLoadAndInit(LoadReportTypeCombo, InitCombo, ObjectToIndex); entries.Add(entry); } entry = new CEntry(code, EntryType.ENTRY_TEXT_BOX, 200, true, "ENTITY_CODE"); entries.Add(entry); entry = new CEntry(name, EntryType.ENTRY_TEXT_BOX, 350, true, "ENTITY_NAME"); entries.Add(entry); return(entries); }
private double getSumArray(CTable o, string[] arr) { double sum = 0.00; foreach (String field in arr) { String tmp = o.GetFieldValue(field); double amt = CUtil.StringToDouble(tmp); sum = sum + amt; } return(sum); }
private void LoadDocTypeCombo(ComboBox cbo, String id) { CTable extParam = GetExtraParam(); String category = extParam.GetFieldValue("CATEGORY"); if (category.Equals("2")) { CUtil.LoadComboFromCollection(cbo, true, id, CMasterReference.Instance.PurchaseWhDocTypes); } else { CUtil.LoadComboFromCollection(cbo, true, id, CMasterReference.Instance.SaleRevenueDocTypes); } }
private void filterRecord(CTable o) { String docType = o.GetFieldValue("DOCUMENT_TYPE"); o.SetFieldValue("DOC_TYPE_DESC", docTypeMapping(docType)); if ("p001,m_001,m_002,r_tot,e_tot".Contains(docType)) { o.SetFieldValue("ROW_TYPE", "FOOTER_LEVEL1"); } else { o.SetFieldValue("ROW_TYPE", "DATA_LEVEL1"); } }
private void applyCellStyle(CTable col, Range r1) { String text = col.GetFieldValue("TEXT"); String dt = col.GetFieldValue("TYPE"); String bold = col.GetFieldValue("IS_BOLD"); Boolean isBold = bold.Equals("True"); String align = col.GetFieldValue("TEXT_ALIGN"); r1.HorizontalAlignment = getHorizontalAlignment(align); r1.Font.Bold = isBold; r1.Font.Name = "Angsana New"; r1.Font.Size = 16; r1.NumberFormat = getNumberFormat(dt); if (dt.Equals("D")) { r1.Value = text.Replace(",", ""); } else { r1.Value = text; } }
private void query(CTable tb) { CUtil.EnableForm(false, this); Tuple <CTable, ObservableCollection <MBaseModel> > tuple = criteria.QueryData(); CUtil.EnableForm(true, this); itemSources = tuple.Item2; lastObjectReturned = tuple.Item1; lsvMovement.ItemsSource = itemSources; rowCount = CUtil.StringToInt(lastObjectReturned.GetFieldValue("EXT_RECORD_COUNT")); lblTotal.Content = CUtil.FormatInt(rowCount.ToString()); CUtil.LoadChunkNavigateCombo(cboNavigate, lastObjectReturned, tb.GetFieldValue("EXT_CHUNK_NO")); }
public static String GetComboSelectedValue(ComboBox cbo, String fldName) { String result = ""; MBaseModel v = (MBaseModel)cbo.SelectedItem; if (v != null) { CTable o = v.GetDbObject(); if (o != null) { result = o.GetFieldValue(fldName); } } return(result); }
public static CTable CreateUserVariables(CTable u) { ArrayList original = u.GetChildArray("USER_VARIABLE_ITEM"); Hashtable hs = CUtil.CTableArrayToHash(original, "VARIABLE_NAME"); CTable t = new CTable("USER"); ArrayList arr = new ArrayList(); t.SetFieldValue("USER_ID", OnixWebServiceAPI.UserID().ToString()); foreach (String key in variables.Keys) { CTable orig = null; String value = (String)variables[key]; //if (key.Contains("REPORT_CASH_IN-TO_ACCOUNT_NO")) //{ // String s = key; //} if (hs.ContainsKey(key)) { orig = (CTable)hs[key]; String orgValue = orig.GetFieldValue("VARIABLE_VALUE"); if (!value.Equals(orgValue)) { orig.SetFieldValue("EXT_FLAG", "E"); } } else { orig = new CTable(""); orig.SetFieldValue("EXT_FLAG", "A"); } orig.SetFieldValue("VARIABLE_NAME", key); orig.SetFieldValue("VARIABLE_VALUE", value); arr.Add(orig); } t.AddChildArray("USER_VARIABLE_ITEM", arr); return(t); }
public void XmlToObjectWithArrayTest(string apiName, string fieldName, string fieldValue, string expectedValue, int index) { string xml = @"<?xml version='1.0' encoding='UTF-8'?> <API> <OBJECT name='PARAM'> <FIELD name='FUNCTION_NAME'>{0}</FIELD> </OBJECT> <OBJECT name=''> <FIELD name='DUMMY_FIELD'>DUMMY_VALUE</FIELD> <ITEMS name='ADDRESS_ITEM'> <OBJECT name=''> <FIELD name='{1}'>{2}_1</FIELD> <FIELD name='SORT_ORDER'>1</FIELD> </OBJECT> <OBJECT name=''> <FIELD name='{1}'>{2}_2</FIELD> <FIELD name='SORT_ORDER'>2</FIELD> </OBJECT> </ITEMS> </OBJECT> </API>"; CRoot root = deserialize(string.Format(xml, apiName, fieldName, fieldValue)); CTableToXml serializer = new CTableToXml(root); string outXml = serializer.Serialize(); CRoot xmlObj = deserialize(outXml); CTable param = xmlObj.Param; CTable dat = xmlObj.Data; string funcName = param.GetFieldValue("FUNCTION_NAME"); Assert.AreEqual(apiName, funcName, "Serialize logic is wrong for param object!!!"); ArrayList arr = dat.GetChildArray("ADDRESS_ITEM"); CTable item = (CTable)arr[index]; string value = item.GetFieldValue(fieldName); Assert.AreEqual(expectedValue, value, "Serialize logic is wrong for data object!!!"); }
public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row) { int rowcount = rows.Count; CReportDataProcessingProperty rpp = new CReportDataProcessingProperty(); //ArrayList keepTotal1 = copyTotalArray(groupSums); //ArrayList keepTotal2 = copyTotalArray(sums); filterRecord(o); String rowType = o.GetFieldValue("ROW_TYPE"); CRow r = (CRow)rowdef[rowType]; CRow nr = r.Clone(); double newh = AvailableSpace - nr.GetHeight(); if (newh > 0) { ArrayList temps = getColumnDataTexts("L1", row + 1, o); nr.FillColumnsText(temps); rpp.AddReportRow(nr); } if (newh < 1) { rpp.IsNewPageRequired = true; //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว //groupSums = keepTotal1; //sums = keepTotal2; } else { AvailableSpace = newh; } return(rpp); }
public void SumItem(MVPayrollDocumentItem accum, MVPayrollDocumentItem tx) { CTable a = accum.GetDbObject(); CTable t = tx.GetDbObject(); ArrayList fields = t.GetTableFields(); foreach (CField field in fields) { String fname = field.getName(); if (!isAccumField(fname)) { continue; } double txValue = CUtil.StringToDouble(t.GetFieldValue(fname)); double acValue = CUtil.StringToDouble(a.GetFieldValue(fname)); double sum = txValue + acValue; SetFieldValue(fname, sum.ToString()); } }
public override ArrayList GetReportInputEntries() { extParam = GetExtraParam(); String category = extParam.GetFieldValue("CATEGORY"); CEntry entry = null; ArrayList entries = new ArrayList(); entry = new CEntry("from_date", EntryType.ENTRY_DATE_MIN, 200, true, "FROM_DOCUMENT_DATE"); entries.Add(entry); entry = new CEntry("to_date", EntryType.ENTRY_DATE_MAX, 200, true, "TO_DOCUMENT_DATE"); entries.Add(entry); entry = new CEntry("inventory_doc_status", EntryType.ENTRY_COMBO_BOX, 200, true, "DOCUMENT_STATUS"); entry.SetComboLoadAndInit(LoadCombo, InitCombo, ObjectToIndex); entries.Add(entry); entry = new CEntry("document_type", EntryType.ENTRY_COMBO_BOX, 200, true, "DOCUMENT_TYPE"); entry.SetComboLoadAndInit(LoadDocTypeCombo, InitCombo, ObjectToIndex); entries.Add(entry); if (category.Equals("2")) { entry = new CEntry("report_type", EntryType.ENTRY_COMBO_BOX, 200, true, "REPORT_CATEGORY"); entry.SetComboLoadAndInit(LoadReportTypeCombo, InitCombo, ObjectToIndex); entries.Add(entry); } entry = new CEntry("project_code", EntryType.ENTRY_TEXT_BOX, 300, true, "PROJECT_CODE"); entries.Add(entry); entry = new CEntry("project_group_code", EntryType.ENTRY_TEXT_BOX, 300, true, "PROJECT_GROUP_CODE"); entries.Add(entry); return(entries); }
public override ArrayList GetReportInputEntries() { CEntry entry = null; ArrayList entries = new ArrayList(); CTable extParam = GetExtraParam(); String category = extParam.GetFieldValue("CATEGORY"); String code = "customer_code"; String name = "customer_name"; if (category.Equals("2")) { code = "supplier_code"; name = "supplier_name"; } entry = new CEntry("from_date", EntryType.ENTRY_DATE_MIN, 200, true, "FROM_DOCUMENT_DATE"); entries.Add(entry); entry = new CEntry("to_date", EntryType.ENTRY_DATE_MAX, 200, true, "TO_DOCUMENT_DATE"); entries.Add(entry); entry = new CEntry("from_duedate", EntryType.ENTRY_DATE_MIN, 200, true, "FROM_DUE_DATE"); entries.Add(entry); entry = new CEntry("to_duedate", EntryType.ENTRY_DATE_MAX, 200, true, "TO_DUE_DATE"); entries.Add(entry); entry = new CEntry(code, EntryType.ENTRY_TEXT_BOX, 200, true, "ENTITY_CODE"); entries.Add(entry); entry = new CEntry(name, EntryType.ENTRY_TEXT_BOX, 350, true, "ENTITY_NAME"); entries.Add(entry); return(entries); }
private void configReport() { CTable extParam = GetExtraParam(); String category = extParam.GetFieldValue("CATEGORY"); String rt = Parameter.GetFieldValue("REPORT_TYPE"); String desc = "revenue"; String name = "customer_name"; if (category.Equals("2")) { desc = "expense"; name = "supplier_name"; } String docDateField = "DOCUMENT_DATE"; String docDateColumn = "date"; if (rt.Equals("1")) { docDateColumn = "invoice_date"; docDateField = "REF_DOCUMENT_DATE"; } addConfig("L1", 5, "number", HorizontalAlignment.Center, HorizontalAlignment.Center, HorizontalAlignment.Center, "", "RN", false); addConfig("L1", 12, "wh_doc_no_short", HorizontalAlignment.Center, HorizontalAlignment.Center, HorizontalAlignment.Center, "REF_WH_DOC_NO", "S", false); addConfig("L1", 9, docDateColumn, HorizontalAlignment.Center, HorizontalAlignment.Center, HorizontalAlignment.Center, docDateField, "DT", false); addConfig("L1", 12, "inventory_doc_no", HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Left, "DOCUMENT_NO", "S", false); addConfig("L1", 11, "invoice_no", HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Left, "REF_DOCUMENT_NO", "S", false); addConfig("L1", 19, name, HorizontalAlignment.Center, HorizontalAlignment.Left, HorizontalAlignment.Left, "ENTITY_NAME", "S", false); addConfig("L1", 4, "%", HorizontalAlignment.Center, HorizontalAlignment.Center, HorizontalAlignment.Center, "WH_TAX_PCT", "S", false); addConfig("L1", 9, desc, HorizontalAlignment.Center, HorizontalAlignment.Right, HorizontalAlignment.Right, "REVENUE_EXPENSE_AMT", "D", true); addConfig("L1", 9, "total_vat", HorizontalAlignment.Center, HorizontalAlignment.Right, HorizontalAlignment.Right, "AR_AP_AMT", "D", true); addConfig("L1", 9, "wh_eligible", HorizontalAlignment.Center, HorizontalAlignment.Right, HorizontalAlignment.Right, "WH_TAX_AMT", "D", true); addConfig("L1", 9, "total", HorizontalAlignment.Center, HorizontalAlignment.Right, HorizontalAlignment.Right, "REMAIN_AMT", "D", true); }
private void filterDrCrAmount(CTable o) { double vatAmt = CUtil.StringToDouble(o.GetFieldValue("VAT_TAX_AMT")); double whAmt = CUtil.StringToDouble(o.GetFieldValue("WH_TAX_AMT")); double amt = CUtil.StringToDouble(o.GetFieldValue("REVENUE_EXPENSE_AMT")); String receipNo = o.GetFieldValue("RECEIPT_NO"); String docNO = o.GetFieldValue("DOCUMENT_NO"); int factor = 1; AccountDocumentType dt = (AccountDocumentType)CUtil.StringToInt(o.GetFieldValue("DOCUMENT_TYPE")); if ((dt == AccountDocumentType.AcctDocDrNote) || (dt == AccountDocumentType.AcctDocDrNotePurchase)) { factor = 1; } else if ((dt == AccountDocumentType.AcctDocCrNotePurchase) || (dt == AccountDocumentType.AcctDocCrNote)) { factor = -1; } vatAmt = factor * Math.Abs(vatAmt); whAmt = factor * Math.Abs(whAmt); amt = factor * Math.Abs(amt); o.SetFieldValue("VAT_TAX_AMT", vatAmt.ToString()); o.SetFieldValue("WH_TAX_AMT", whAmt.ToString()); o.SetFieldValue("REVENUE_EXPENSE_AMT", amt.ToString()); if (receipNo.Equals("") && ((dt == AccountDocumentType.AcctDocCashSale) || (dt == AccountDocumentType.AcctDocCashPurchase) || (dt == AccountDocumentType.AcctDocMiscExpense) || (dt == AccountDocumentType.AcctDocMiscRevenue))) { o.SetFieldValue("RECEIPT_NO", docNO); } }
private Boolean isSkipRow(CTable o) { double whAmt = CUtil.StringToDouble(o.GetFieldValue("WH_TAX_AMT")); return(whAmt <= 0); }
public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row) { String tmpPrevKey = prevProject; int rowcount = rows.Count; CReportDataProcessingProperty rpp = new CReportDataProcessingProperty(); ArrayList keepTotal1 = copyTotalArray(projSums); ArrayList keepTotal2 = copyTotalArray(sums); CRow r = (CRow)rowdef["DATA_LEVEL1"]; CRow nr = r.Clone(); double newh = AvailableSpace - nr.GetHeight(); if (newh > 0) { filterDrCrAmount(o); populatePaymentIndex(o); String projCd = o.GetFieldValue(getGroupKey()); if (row == 0) { prevProject = projCd; } String rptType = Parameter.GetFieldValue("REPORT_TYPE"); if (!projCd.Equals(prevProject)) { prevProject = projCd; CRow ft = (CRow)rowdef["FOOTER_LEVEL1"]; CRow ftr = ft.Clone(); ArrayList projTotals = displayTotalTexts("L1", projSums, 1, "total"); ftr.FillColumnsText(projTotals); if (rptType.Equals("2") || rptType.Equals("3")) { //Only by project report rpp.AddReportRow(ftr); newh = newh - ftr.GetHeight(); } //Reset projSums = new ArrayList(); } ArrayList temps = getColumnDataTexts("L1", row + 1, o); nr.FillColumnsText(temps); rpp.AddReportRow(nr); sums = sumDataTexts("L1", sums, temps); projSums = sumDataTexts("L1", projSums, temps); if (row == rowcount - 1) { //=== Project CRow ft0 = (CRow)rowdef["FOOTER_LEVEL1"]; CRow ftr0 = ft0.Clone(); ArrayList projTotals = displayTotalTexts("L1", projSums, 1, "total"); ftr0.FillColumnsText(projTotals); if (rptType.Equals("2") || rptType.Equals("3")) { //Only by project report rpp.AddReportRow(ftr0); newh = newh - ftr0.GetHeight(); } //=== End row CRow ft1 = (CRow)rowdef["FOOTER_LEVEL1"]; CRow ftr1 = ft1.Clone(); ArrayList totals = displayTotalTexts("L1", sums, 1, "total"); ftr1.FillColumnsText(totals); rpp.AddReportRow(ftr1); newh = newh - ftr1.GetHeight(); } } if (newh < 1) { rpp.IsNewPageRequired = true; //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว projSums = keepTotal1; sums = keepTotal2; prevProject = tmpPrevKey; } else { AvailableSpace = newh; } return(rpp); }
private String getGroupKey(CTable o) { return(o.GetFieldValue("DOCUMENT_NO")); }
protected ArrayList getColumnDataTexts(String group, int rowNum, CTable data) { ArrayList arr = (ArrayList)reportConfigHash[group]; ArrayList temps = new ArrayList(); foreach (CReportColConfig rc in arr) { if (rc.DataType.Equals("RN")) { temps.Add(rowNum.ToString()); } else if (rc.DataType.Equals("S")) { temps.Add(data.GetFieldValue(rc.FieldName)); } else if (rc.DataType.Equals("DT")) { String dateStr = data.GetFieldValue(rc.FieldName).Trim(); String dt = ""; if (!dateStr.Equals("")) { dt = CUtil.DateTimeToDateString(CUtil.InternalDateToDate(dateStr)); } temps.Add(dt); } else if (rc.DataType.Equals("D")) { String amt = CUtil.FormatNumber(data.GetFieldValue(rc.FieldName)); temps.Add(amt); } else if (rc.DataType.Equals("DE")) { //Display empty if zero String amt = CUtil.FormatNumber(data.GetFieldValue(rc.FieldName)); if (amt.Equals("0.00")) { amt = ""; } temps.Add(amt); } else if (rc.DataType.Equals("DD")) { //Display dash if zero String amt = CUtil.FormatNumber(data.GetFieldValue(rc.FieldName)); if (amt.Equals("0.00")) { amt = "-"; } temps.Add(amt); } else { temps.Add(data.GetFieldValue(rc.FieldName)); } } return(temps); }
public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row) { String tmpPrevKey = prevGroupId; int rowcount = rows.Count; CReportDataProcessingProperty rpp = new CReportDataProcessingProperty(); ArrayList keepTotal1 = copyTotalArray(groupSums); ArrayList keepTotal2 = copyTotalArray(sums); CRow r = (CRow)rowdef["DATA_LEVEL1"]; CRow nr = r.Clone(); double newh = AvailableSpace - nr.GetHeight(); filterDrCrAmount(o); if (newh > 0) { String groupId = o.GetFieldValue(getGroupKey()); if (row == 0) { prevGroupId = groupId; } if (!groupId.Equals(prevGroupId)) { double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", getTotalKeyword(prevGroupId), groupSums); newh = newh - h; prevGroupId = groupId; groupSum1 = groupSums; //Reset groupSums = new ArrayList(); } ArrayList temps = getColumnDataTexts("L1", row + 1, o); nr.FillColumnsText(temps); rpp.AddReportRow(nr); sums = sumDataTexts("L1", sums, temps); groupSums = sumDataTexts("L1", groupSums, temps); if (row == rowcount - 1) { double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", getTotalKeyword(prevGroupId), groupSums); newh = newh - h; ArrayList profitSums = sumDataTexts("L1", groupSum1, groupSums, -1); h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "gain_loss", profitSums); newh = newh - h; } } if (newh < 1) { rpp.IsNewPageRequired = true; //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว groupSums = keepTotal1; sums = keepTotal2; prevGroupId = tmpPrevKey; } else { AvailableSpace = newh; } return(rpp); }
public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row) { int rowcount = rows.Count; CReportDataProcessingProperty rpp = new CReportDataProcessingProperty(); if (isSkipRow(o)) { //In case the last record is skipped if (row == rowcount - 1) { addTotalRow(rpp, sums); } //Do Nothing return(rpp); } ArrayList keepTotal2 = copyTotalArray(sums); rowProcess++; CRow r = (CRow)rowdef["DATA_LEVEL1"]; CRow nr = r.Clone(); double newh = AvailableSpace - nr.GetHeight(); if (newh > 0) { filterDrCrAmount(o); String refDocNo = o.GetFieldValue("REF_DOCUMENT_NO"); if (refDocNo.Equals("")) { refDocNo = o.GetFieldValue("ACTUAL_INVOICE_NO"); } o.SetFieldValue("REF_DOCUMENT_NO", refDocNo); String refDocDate = o.GetFieldValue("REF_DOCUMENT_DATE"); if (refDocDate.Equals("")) { refDocDate = o.GetFieldValue("ACTUAL_INVOICE_DATE"); } o.SetFieldValue("REF_DOCUMENT_DATE", refDocDate); ArrayList temps = getColumnDataTexts("L1", rowProcess, o); nr.FillColumnsText(temps); rpp.AddReportRow(nr); sums = sumDataTexts("L1", sums, temps); if (row == rowcount - 1) { addTotalRow(rpp, sums); } } if (newh < 1) { rpp.IsNewPageRequired = true; sums = keepTotal2; } else { AvailableSpace = newh; } return(rpp); }