From a0324420be5709edfd44aa6fce599609fcaeb9fd Mon Sep 17 00:00:00 2001 From: Juliana Corredor Date: Tue, 30 Oct 2012 21:23:46 -0500 Subject: [PATCH] IDEMPIERE-379 Reporting wizard for end users --- .../oracle/923_IDEMPIERE_379.sql | 145 ++++ .../postgresql/923_IDEMPIERE_379.sql | 146 ++++ .../src/org/compiere/model/SystemIDs.java | 2 + .../src/org/compiere/print/MPrintFormat.java | 45 +- .../adempiere/webui/adwindow/ADSortTab.java | 2 +- .../webui/apps/form/WReportCustomization.java | 631 ++++++++++++++++++ .../webui/panel/WRC1DisplayFieldsPanel.java | 193 ++++++ .../webui/panel/WRC2FieldOrderPanel.java | 423 ++++++++++++ .../webui/panel/WRC3SortCriteriaPanel.java | 595 +++++++++++++++++ .../panel/WRC4GroupingCriteriaPanel.java | 156 +++++ .../webui/panel/WRC5SummaryFieldsPanel.java | 215 ++++++ .../adempiere/webui/panel/WRCTabPanel.java | 48 ++ .../webui/window/ZkReportViewer.java | 34 +- org.adempiere.ui.zk/images/Wizard24.png | Bin 0 -> 1111 bytes 14 files changed, 2629 insertions(+), 6 deletions(-) create mode 100644 migration/360lts-release/oracle/923_IDEMPIERE_379.sql create mode 100644 migration/360lts-release/postgresql/923_IDEMPIERE_379.sql create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC1DisplayFieldsPanel.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC2FieldOrderPanel.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC3SortCriteriaPanel.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC4GroupingCriteriaPanel.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC5SummaryFieldsPanel.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRCTabPanel.java create mode 100644 org.adempiere.ui.zk/images/Wizard24.png diff --git a/migration/360lts-release/oracle/923_IDEMPIERE_379.sql b/migration/360lts-release/oracle/923_IDEMPIERE_379.sql new file mode 100644 index 0000000000..3c71740d34 --- /dev/null +++ b/migration/360lts-release/oracle/923_IDEMPIERE_379.sql @@ -0,0 +1,145 @@ +-- Oct 2, 2012 12:23:41 PM COT +-- IDEMPIERE-379 +INSERT INTO AD_Form (AccessLevel,Classname,AD_Form_ID,IsBetaFunctionality,EntityType,AD_Form_UU,Description,Name,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('3','org.adempiere.webui.apps.form.WReportCustomization',200002,'N','D','df3440d4-deb8-4e09-8426-4e16c426a6d4','Report Wizard','Report Wizard',0,100,100,TO_DATE('2012-10-02 12:23:40','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-02 12:23:40','YYYY-MM-DD HH24:MI:SS'),0,'Y') +; + +-- Oct 2, 2012 12:23:41 PM COT +-- IDEMPIERE-379 +INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200002 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID) +; + +-- Oct 29, 2012 11:41:16 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Wizard Reports',200090,'D','63eb4702-952c-45b0-a1d4-f1f24da0ab8f','PrintWizard','Y',TO_DATE('2012-10-29 11:41:14','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:41:14','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:41:16 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200090 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:43:10 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','DisplayFields of the Report',200091,'D','41e9c752-85f6-4b33-aa65-6eb12485aff4','DisplayFields','Y',TO_DATE('2012-10-29 11:43:09','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:43:09','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:43:10 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200091 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:43:35 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Order Fields',200092,'D','ae9db55f-5598-4ca5-a27e-29312287676e','FieldOrder','Y',TO_DATE('2012-10-29 11:43:35','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:43:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:43:35 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200092 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:43:55 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Sort Criteria',200093,'D','065b283c-eff9-41c2-836d-545357084bf1','SortCriteria','Y',TO_DATE('2012-10-29 11:43:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:43:55','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:43:55 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200093 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:44:14 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Grouping Criteria',200094,'D','05606939-e721-47cc-8ecf-669545b13927','GroupingCriteria','Y',TO_DATE('2012-10-29 11:44:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:44:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:44:14 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200094 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:44:32 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Summary Fields',200095,'D','24658bb4-e167-422e-8be8-d8abf34fd2bd','SummaryFields','Y',TO_DATE('2012-10-29 11:44:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:44:31','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:44:32 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200095 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:46:22 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New Print Format',200096,'D','f2fef925-de44-43f6-ae53-63b3db453056','CreatePrintFormat','Y',TO_DATE('2012-10-29 11:46:21','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:46:21','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:46:22 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200096 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + + +-- Oct 29, 2012 11:48:28 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Un select all fields',200099,'D','f3ad42fd-b1aa-494e-ad24-22e96fb15733','DeSelectAll','Y',TO_DATE('2012-10-29 11:48:27','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-29 11:48:27','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:48:28 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200099 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:56:10 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_ToolBarButton (Name,ComponentName,IsCustomization,KeyStroke_KeyCode,KeyStroke_Modifiers,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,IsActive,AD_ToolBarButton_UU,Action) VALUES ('Zk-ReportWizard','org.idempiere.ui.report','N',0,0,0,0,TO_DATE('2012-10-29 11:56:09','YYYY-MM-DD HH24:MI:SS'),100,200066,TO_DATE('2012-10-29 11:56:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','6009b32b-e28e-4c13-87fc-4df00c5730c9','R') +; + +-- Oct 30, 2012 10:00:40 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_ToolBarButton SET Name='ReportWizard', ComponentName='Wizard',Updated=TO_DATE('2012-10-30 10:00:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200066 +; + +-- Oct 30, 2012 10:08:19 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message SET MsgText='Copy Print Format',Updated=TO_DATE('2012-10-30 10:08:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200096 +; + +-- Oct 30, 2012 10:08:19 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200096 +; + +-- Oct 30, 2012 10:08:56 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message SET MsgText='Deselect All',Updated=TO_DATE('2012-10-30 10:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200099 +; + +-- Oct 30, 2012 10:08:56 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200099 +; + +-- Oct 30, 2012 10:11:45 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message SET MsgText='Fields Displayed',Updated=TO_DATE('2012-10-30 10:11:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200091 +; + +-- Oct 30, 2012 10:11:45 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200091 +; + +-- Oct 30, 2012 5:34:18 PM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Run Report',200100,'D','5638ff96-ff60-49f0-9871-004f7fa2420e','Run','Y',TO_DATE('2012-10-30 17:34:15','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-30 17:34:15','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 30, 2012 5:34:18 PM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200100 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + + +SELECT register_migration_script('923_IDEMPIERE_379.sql') FROM dual +; + diff --git a/migration/360lts-release/postgresql/923_IDEMPIERE_379.sql b/migration/360lts-release/postgresql/923_IDEMPIERE_379.sql new file mode 100644 index 0000000000..bf31a65b00 --- /dev/null +++ b/migration/360lts-release/postgresql/923_IDEMPIERE_379.sql @@ -0,0 +1,146 @@ +-- Oct 2, 2012 12:23:41 PM COT +-- IDEMPIERE-379 +INSERT INTO AD_Form (AccessLevel,Classname,AD_Form_ID,IsBetaFunctionality,EntityType,AD_Form_UU,Description,Name,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('3','org.adempiere.webui.apps.form.WReportCustomization',200002,'N','D','df3440d4-deb8-4e09-8426-4e16c426a6d4','Report Wizard','Report Wizard',0,100,100,TO_TIMESTAMP('2012-10-02 12:23:40','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-02 12:23:40','YYYY-MM-DD HH24:MI:SS'),0,'Y') +; + +-- Oct 2, 2012 12:23:41 PM COT +-- IDEMPIERE-379 +INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200002 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID) +; + +-- Oct 29, 2012 11:41:16 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Wizard Reports',200090,'D','63eb4702-952c-45b0-a1d4-f1f24da0ab8f','PrintWizard','Y',TO_TIMESTAMP('2012-10-29 11:41:14','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:41:14','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:41:16 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200090 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:43:10 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','DisplayFields of the Report',200091,'D','41e9c752-85f6-4b33-aa65-6eb12485aff4','DisplayFields','Y',TO_TIMESTAMP('2012-10-29 11:43:09','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:43:09','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:43:10 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200091 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:43:35 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Order Fields',200092,'D','ae9db55f-5598-4ca5-a27e-29312287676e','FieldOrder','Y',TO_TIMESTAMP('2012-10-29 11:43:35','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:43:35','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:43:35 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200092 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:43:55 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Sort Criteria',200093,'D','065b283c-eff9-41c2-836d-545357084bf1','SortCriteria','Y',TO_TIMESTAMP('2012-10-29 11:43:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:43:55','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:43:55 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200093 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:44:14 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Grouping Criteria',200094,'D','05606939-e721-47cc-8ecf-669545b13927','GroupingCriteria','Y',TO_TIMESTAMP('2012-10-29 11:44:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:44:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:44:14 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200094 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:44:32 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Summary Fields',200095,'D','24658bb4-e167-422e-8be8-d8abf34fd2bd','SummaryFields','Y',TO_TIMESTAMP('2012-10-29 11:44:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:44:31','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:44:32 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200095 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:46:22 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New Print Format',200096,'D','f2fef925-de44-43f6-ae53-63b3db453056','CreatePrintFormat','Y',TO_TIMESTAMP('2012-10-29 11:46:21','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:46:21','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:46:22 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200096 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + + +-- Oct 29, 2012 11:48:28 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Un select all fields',200099,'D','f3ad42fd-b1aa-494e-ad24-22e96fb15733','DeSelectAll','Y',TO_TIMESTAMP('2012-10-29 11:48:27','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-29 11:48:27','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 29, 2012 11:48:28 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200099 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Oct 29, 2012 11:56:10 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_ToolBarButton (Name,ComponentName,IsCustomization,KeyStroke_KeyCode,KeyStroke_Modifiers,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,IsActive,AD_ToolBarButton_UU,"action") VALUES ('Zk-ReportWizard','org.idempiere.ui.report','N',0,0,0,0,TO_TIMESTAMP('2012-10-29 11:56:09','YYYY-MM-DD HH24:MI:SS'),100,200066,TO_TIMESTAMP('2012-10-29 11:56:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','6009b32b-e28e-4c13-87fc-4df00c5730c9','R') +; + + +-- Oct 30, 2012 10:00:40 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_ToolBarButton SET Name='ReportWizard', ComponentName='Wizard',Updated=TO_TIMESTAMP('2012-10-30 10:00:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ToolBarButton_ID=200066 +; + +-- Oct 30, 2012 10:08:19 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message SET MsgText='Copy Print Format',Updated=TO_TIMESTAMP('2012-10-30 10:08:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200096 +; + +-- Oct 30, 2012 10:08:19 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200096 +; + +-- Oct 30, 2012 10:08:56 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message SET MsgText='Deselect All',Updated=TO_TIMESTAMP('2012-10-30 10:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200099 +; + +-- Oct 30, 2012 10:08:56 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200099 +; + +-- Oct 30, 2012 10:11:45 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message SET MsgText='Fields Displayed',Updated=TO_TIMESTAMP('2012-10-30 10:11:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200091 +; + +-- Oct 30, 2012 10:11:45 AM COT +-- IDEMPIERE-379 Reporting wizard for end users +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200091 +; + + +-- Oct 30, 2012 5:34:18 PM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Run Report',200100,'D','5638ff96-ff60-49f0-9871-004f7fa2420e','Run','Y',TO_TIMESTAMP('2012-10-30 17:34:15','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-30 17:34:15','YYYY-MM-DD HH24:MI:SS')) +; + +-- Oct 30, 2012 5:34:18 PM COT +-- IDEMPIERE-379 Reporting wizard for end users +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200100 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +SELECT register_migration_script('923_IDEMPIERE_379.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index 6c2207bb4b..02cff20255 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -153,5 +153,7 @@ public class SystemIDs public final static int SCHEDULE_10_MINUTES = 200002; public final static int SCHEDULE_15_MINUTES = 200003; + + public final static int WIZARD_REPORT_FORM=200002; } diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java index 553ef95208..68956a5776 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java @@ -36,6 +36,7 @@ import org.compiere.model.GridTab; import org.compiere.model.GridTable; import org.compiere.model.MQuery; import org.compiere.model.MRole; +import org.compiere.model.Query; import org.compiere.model.X_AD_PrintFormat; import org.compiere.util.CCache; import org.compiere.util.CLogger; @@ -56,9 +57,9 @@ import org.compiere.util.Util; public class MPrintFormat extends X_AD_PrintFormat { /** - * + * */ - private static final long serialVersionUID = 3626220385155526700L; + private static final long serialVersionUID = 1246145881920021984L; /** * Public Constructor. @@ -231,7 +232,43 @@ public class MPrintFormat extends X_AD_PrintFormat } // getItems /** - * Get active Items + * Get All Items + * @return items + */ + public MPrintFormatItem[] getAllItems() { + return getAllItems("SeqNo"); + } + + /** + * Get All Items + * @param orderBy + * @return items + */ + public MPrintFormatItem[] getAllItems(String orderBy) + { + String whereClause = "AD_PrintFormatItem.AD_PrintFormat_ID=? " + // Display restrictions - Passwords, etc. + + " AND NOT EXISTS (SELECT * FROM AD_Field f " + + "WHERE AD_PrintFormatItem.AD_Column_ID=f.AD_Column_ID" + + " AND (f.IsEncrypted='Y' OR f.ObscureType IS NOT NULL))"; + List list = new Query(getCtx(), MPrintFormatItem.Table_Name, whereClause, get_TrxName()) + .setParameters(get_ID()) + .setOnlyActiveRecords(true) + .setOrderBy(orderBy) + .list(); + + MRole role = MRole.getDefault(getCtx(), false); + for (MPrintFormatItem pfi : list) { + if (! role.isColumnAccess(getAD_Table_ID(), pfi.getAD_Column_ID(), true)) + list.remove(pfi); + } + MPrintFormatItem[] retValue = new MPrintFormatItem[list.size()]; + list.toArray(retValue); + return retValue; + } // getAllItems + + /** + * Get Items Not in A Print Format * @return items */ private MPrintFormatItem[] getItemsNotIn(int AD_PrintFormat_ID) @@ -273,7 +310,7 @@ public class MPrintFormat extends X_AD_PrintFormat MPrintFormatItem[] retValue = new MPrintFormatItem[list.size()]; list.toArray(retValue); return retValue; - } // getItems + } // getItemsNotIn /** * Get Item Count diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java index 14348e73b1..4d6e5b45ab 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java @@ -704,7 +704,7 @@ public class ADSortTab extends Panel implements IADTabpanel * List Item * @author Teo Sarca */ - private class ListElement extends NamePair { + public class ListElement extends NamePair { /** * */ diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java new file mode 100644 index 0000000000..7505a85fb3 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java @@ -0,0 +1,631 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.apps.form; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.StringWriter; +import java.util.Properties; +import java.util.logging.Level; + +import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.apps.WReport; +import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.ConfirmPanel; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.ListItem; +import org.adempiere.webui.component.Listbox; +import org.adempiere.webui.component.Tab; +import org.adempiere.webui.component.Tabbox; +import org.adempiere.webui.component.Tabpanels; +import org.adempiere.webui.component.Tabs; +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.panel.ADForm; +import org.adempiere.webui.panel.CustomForm; +import org.adempiere.webui.panel.IFormController; +import org.adempiere.webui.panel.WRC1DisplayFieldsPanel; +import org.adempiere.webui.panel.WRC2FieldOrderPanel; +import org.adempiere.webui.panel.WRC3SortCriteriaPanel; +import org.adempiere.webui.panel.WRC4GroupingCriteriaPanel; +import org.adempiere.webui.panel.WRC5SummaryFieldsPanel; +import org.adempiere.webui.panel.WRCTabPanel; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.FDialog; +import org.adempiere.webui.window.ZkReportViewer; +import org.adempiere.webui.window.ZkReportViewerProvider; +import org.compiere.model.MRole; +import org.compiere.model.SystemIDs; +import org.compiere.print.MPrintFormat; +import org.compiere.print.MPrintFormatItem; +import org.compiere.print.ReportEngine; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; +import org.zkoss.util.media.AMedia; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Auxhead; +import org.zkoss.zul.Auxheader; +import org.zkoss.zul.Div; +import org.zkoss.zul.Filedownload; +import org.zkoss.zul.Foot; +import org.zkoss.zul.Footer; +import org.zkoss.zul.Hbox; +import org.zkoss.zul.Iframe; +import org.zkoss.zul.Separator; +import org.zkoss.zul.Toolbarbutton; +import org.zkoss.zul.Vbox; + + +public class WReportCustomization implements IFormController,EventListener { + + private CustomForm form = new CustomForm(); + + + /** Window No */ + private int m_WindowNo = -1; + + int curStep = 0; + /** Print Context */ + private Properties m_ctx; + + private boolean m_isCanExport; + + private ReportEngine m_reportEngine=null; + public MPrintFormatItem[] pfi ; + + private Auxheader headerPanel=new Auxheader(); + private Listbox comboReport = new Listbox(); + private Button newPrintFormat; + private Label selectAll; + private Label deselectAll; + private Label pipeSeparator; + private ToolBarButton bExport = new ToolBarButton(); + private Button bnext ; + private Button bcancel; + private Button bRun; + private ToolBarButton btnSave; + private Tabbox tabbox = new Tabbox(); + private Tabs tabs = new Tabs(); + private Tabpanels tabpanels = new Tabpanels(); + private Window winExportFile = null; + private Listbox cboType = new Listbox(); + private ConfirmPanel confirmPanel = new ConfirmPanel(true); + public static boolean IsChange=false; + public ZkReportViewer viewer; + MPrintFormat fm; + + + Tab tabdf1=new Tab(Msg.getMsg(Env.getCtx(), "DisplayFields")); + Tab tabfo2=new Tab(Msg.getMsg(Env.getCtx(), "FieldOrder")); + Tab tabsc3=new Tab(Msg.getMsg(Env.getCtx(), "SortCriteria")); + Tab tabgc4=new Tab(Msg.getMsg(Env.getCtx(), "GroupingCriteria")); + Tab tabsf5=new Tab(Msg.getMsg(Env.getCtx(), "SummaryFields")); + + WRC1DisplayFieldsPanel tpdf1 = new WRC1DisplayFieldsPanel(); + WRC2FieldOrderPanel tpfo2 =new WRC2FieldOrderPanel(); + WRC3SortCriteriaPanel tpsc3=new WRC3SortCriteriaPanel(); + WRC4GroupingCriteriaPanel tpgc4=new WRC4GroupingCriteriaPanel(); + WRC5SummaryFieldsPanel tpsf5=new WRC5SummaryFieldsPanel(); + + private Iframe iframe = new Iframe(); + + private int oldtabidx = 0; + + /** Logger */ + private static CLogger log = CLogger.getCLogger(WReportCustomization.class); + + /** + * Static Layout + * @throws Exception + */ + public WReportCustomization() { + super(); + + m_WindowNo = SessionManager.getAppDesktop().registerWindow(this); + + //dynInit(); + } + + + + /** + * Static Layout + * @throws Exception + */ + public void setReportEngine(ReportEngine re) { + + m_reportEngine = re; + m_isCanExport=MRole.getDefault().isCanExport(); + pfi= m_reportEngine.getPrintFormat().getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name"); + try + { + m_ctx = m_reportEngine.getCtx(); + init(); + //dynInit(); + } + catch(Exception e) + { + log.log(Level.SEVERE, "", e); + FDialog.error(m_WindowNo, "LoadError", e.getLocalizedMessage()); + } + } + + public void setViewer(ZkReportViewer parent){ + viewer=parent; + } + + private void init() + { + + form.setStyle("width: 90%; height: 90%; position: absolute; border:none; padding:none; margin:none;"); + + headerPanel.setHeight("40px"); + headerPanel.setWidth("100%"); + + headerPanel.appendChild(new Separator("vertical")); + + comboReport.setMold("select"); + fm =m_reportEngine.getPrintFormat(); + comboReport.setTooltiptext(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID")); + comboReport.appendItem(fm.getName(), fm.get_ID()); + headerPanel.appendChild(comboReport); + headerPanel.appendChild(new Separator("vertical")); + + newPrintFormat=new Button(); + newPrintFormat.setName("NewPrintFormat"); + newPrintFormat.setLabel(Msg.getMsg(Env.getCtx(), "CreatePrintFormat")); + newPrintFormat.addActionListener(this); + + headerPanel.appendChild(newPrintFormat); + Separator tor =new Separator("vertical"); + tor.setSpacing("500px"); + headerPanel.appendChild(tor); + + selectAll = new Label(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "SelectAll"))); + deselectAll= new Label(Msg.getMsg(Env.getCtx(), "DeSelectAll")); + pipeSeparator = new Label("|"); + selectAll.setAttribute("name", "SelectAll"); + deselectAll.setAttribute("name", "DeselectAll"); + selectAll.addEventListener(Events.ON_CLICK, this); + deselectAll.addEventListener(Events.ON_CLICK, this); + headerPanel.appendChild(new Separator("vertical")); + headerPanel.appendChild(selectAll); + headerPanel.appendChild(new Separator("vertical")); + headerPanel.appendChild(pipeSeparator); + headerPanel.appendChild(new Separator("vertical")); + headerPanel.appendChild(deselectAll); + + headerPanel.appendChild(new Separator("vertical")); + + Auxhead head=new Auxhead(); + head.appendChild(headerPanel); + form.appendChild(head); + + headerPanel.appendChild(new Separator("horizontal")); + + tabbox.setWidth("100%"); + tabbox.setHeight("80%"); + tabfo2.addEventListener(Events.ON_CLICK, this); + tabsc3.addEventListener(Events.ON_CLICK, this); + tabgc4.addEventListener(Events.ON_CLICK, this); + tabsf5.addEventListener(Events.ON_CLICK, this); + tabs.appendChild(tabdf1); + tabs.appendChild(tabfo2); + tabs.appendChild(tabsc3); + tabs.appendChild(tabgc4); + tabs.appendChild(tabsf5); + + tpdf1.setMPrintFormat(fm); + tpdf1.setPrintFormatItems(pfi); + tpdf1.setWReportCustomization(this); + tpdf1.init(); + tabpanels.appendChild(tpdf1); + + tpfo2.setReportEngine(m_reportEngine); + tpfo2.setMPrintFormat(fm); + tpfo2.setPrintFormatItems(pfi); + tpfo2.setListColumns(); + tpfo2.init(); + tpfo2.refresh(); + tpfo2.setWReportCustomization(this); + tabpanels.appendChild(tpfo2); + + tpsc3.setMPrintFormat(fm); + tpsc3.setPrintFormatItems(pfi); + tpsc3.init(); + tpsc3.refresh(); + tpsc3.setWReportCustomization(this); + tabpanels.appendChild(tpsc3); + + tpgc4.setMPrintFormat(fm); + tpgc4.setPrintFormatItems(pfi); + tpgc4.init(); + tpgc4.refresh(); + tpgc4.setWReportCustomization(this); + tabpanels.appendChild(tpgc4); + + tpsf5.setMPrintFormat(fm); + tpsf5.setPrintFormatItems(pfi); + tpsf5.init(); + tpsf5.refresh(); + tpsf5.setWReportCustomization(this); + tabpanels.appendChild(tpsf5); + + tabbox.appendChild(tabs); + tabbox.appendChild(tabpanels); + tabbox.addEventListener(Events.ON_SELECT, this); + + form.appendChild(tabbox); + + Footer foot =new Footer(); + Foot f=new Foot(); + + Grid grid=new Grid(); + btnSave = new ToolBarButton(); + btnSave.setAttribute("name","btnSave"); + btnSave.setImage("/images/Save24.png"); + if(fm.getAD_Client_ID()== 0 || !IsChange) + { + btnSave.setVisible(false); + } + btnSave.addEventListener(Events.ON_CLICK, this); + + foot.appendChild(btnSave); + foot.appendChild(new Separator("vertical")); + + if (m_isCanExport) + { + bExport.setImage("/images/ExportX24.png"); + bExport.setAttribute("name","btnExport"); + bExport.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Export"))); + bExport.addEventListener(Events.ON_CLICK, this); + + foot.appendChild(bExport); + foot.appendChild(new Separator("vertical")); + + } + + bRun=new Button(); + bRun.setLabel(Msg.getMsg(Env.getCtx(), "Run")); + bRun.setName("bRun"); + bRun.addEventListener(Events.ON_CLICK, this); + + foot.appendChild(bRun); + Separator se =new Separator("vertical"); + se.setSpacing("800px"); + foot.appendChild(se); + bnext=new Button(); + bnext.setLabel(Msg.getMsg(Env.getCtx(), "NextPage")); + bnext.setName("Next"); + bnext.addEventListener(Events.ON_CLICK, this); + foot.appendChild(bnext); + foot.appendChild(new Separator("vertical")); + bcancel=new Button(); + bcancel.setName("Cancel"); + bcancel.addEventListener(Events.ON_CLICK, this); + bcancel.setLabel("Cancel"); + + foot.appendChild(bcancel); + + f.appendChild(foot); + grid.appendChild(f); + form.appendChild(grid); + form.setBorder("normal"); + + //renderStep(); + } + + + +/*private void renderStep(){ + switch (curStep){ + case 0: + renderSelectStep(); + } + } + private void renderSelectStep() + { + if(stepPanels[0]==null){ + stepPanels[0] = new SelectColumnpanel(m_reportEngine.getPrintFormat()); + centerPanel.appendChild(stepPanels[0]); + }else{ + stepPanels[0].setVisible(true); + } + }*/ + + + private void cleanUp() { + if (m_WindowNo >= 0) + { + SessionManager.getAppDesktop().unregisterWindow(m_WindowNo); + m_ctx = null; + m_WindowNo = -1; + } + } + + @Override + public void onEvent(Event event) throws Exception { + if (Events.ON_CLICK.equals(event.getName())) { + if (event.getTarget() instanceof ToolBarButton) { + ((WRCTabPanel) tabbox.getSelectedTabpanel()).updatePFI(); + ToolBarButton button = (ToolBarButton)event.getTarget(); + if ("btnSave".equals(button.getAttribute("name").toString())) { + onSave(); + } + if ("btnExport".equals(button.getAttribute("name").toString())) { + cmd_export(); + } + } else if (event.getTarget() instanceof Label) { + if (tabbox.getSelectedIndex() == 0) { + Label lb = (Label)event.getTarget(); + if ("SelectAll".equals(lb.getAttribute("name").toString())) { + tpdf1.updatePrinted(true); + } else if ("DeselectAll".equals(lb.getAttribute("name").toString())) { + tpdf1.updatePrinted(false); + } + } + } else if (event.getTarget() instanceof Button) { + Button bt = (Button)event.getTarget(); + if ("Next".equals(bt.getName())) { + ((WRCTabPanel) tabbox.getTabpanel(oldtabidx)).updatePFI(); + oldtabidx++; + if (oldtabidx > 4) + oldtabidx = 0; + ((WRCTabPanel) tabbox.getTabpanel(oldtabidx)).refresh(); + tabbox.setSelectedIndex(oldtabidx); + } + else{ + if("Cancel".equals(bt.getName())){ + close(); + } + if("NewPrintFormat".equals(bt.getName())){ + copyFormat(); + } + if("bRun".equals(bt.getName())){ + runReport(); + } + } + } + } else { + if (Events.ON_SELECT.equals(event.getName())) { + // Save previous tab and refresh the new + ((WRCTabPanel) tabbox.getTabpanel(oldtabidx)).updatePFI(); + int tabidx = tabbox.getSelectedIndex(); + ((WRCTabPanel) tabbox.getTabpanel(tabidx )).refresh(); + oldtabidx = tabidx; + } + } + + if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) + winExportFile.onClose(); + else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) + exportFile(); + + selectAll.setVisible(oldtabidx == 0); + deselectAll.setVisible(oldtabidx == 0); + pipeSeparator.setVisible(oldtabidx == 0); + } + + private void onSave() { + for (int i=0; i < pfi.length ;i++){ + pfi[i].saveEx(); + } + setIsChanged(false); + } + + @Override + public ADForm getForm() { + return form; + } + + /** + * Export + */ + private void cmd_export() + { + log.config(""); + if (!m_isCanExport) + { + FDialog.error(m_WindowNo, "AccessCannotExport","Export"); + return; + } + + if (winExportFile == null) + { + winExportFile = new Window(); + winExportFile.setTitle(Msg.getMsg(Env.getCtx(), "Export")); + winExportFile.setWidth("450px"); + winExportFile.setHeight("300px"); + winExportFile.setClosable(true); + winExportFile.setBorder("normal"); + winExportFile.setStyle("position:absolute"); + + cboType.setMold("select"); + + cboType.getItems().clear(); + cboType.appendItem("ps" + " - " + Msg.getMsg(Env.getCtx(), "FilePS"), "ps"); + cboType.appendItem("xml" + " - " + Msg.getMsg(Env.getCtx(), "FileXML"), "xml"); + ListItem li = cboType.appendItem("pdf" + " - " + Msg.getMsg(Env.getCtx(), "FilePDF"), "pdf"); + cboType.appendItem("html" + " - " + Msg.getMsg(Env.getCtx(), "FileHTML"), "html"); + cboType.appendItem("txt" + " - " + Msg.getMsg(Env.getCtx(), "FileTXT"), "txt"); + cboType.appendItem("ssv" + " - " + Msg.getMsg(Env.getCtx(), "FileSSV"), "ssv"); + cboType.appendItem("csv" + " - " + Msg.getMsg(Env.getCtx(), "FileCSV"), "csv"); + cboType.appendItem("xls" + " - " + Msg.getMsg(Env.getCtx(), "FileXLS"), "xls"); + cboType.setSelectedItem(li); + + Hbox hb = new Hbox(); + Div div = new Div(); + div.setAlign("right"); + div.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType"))); + hb.appendChild(div); + hb.appendChild(cboType); + cboType.setWidth("100%"); + hb.setVflex("1"); + hb.setStyle("margin-top: 10px"); + + Vbox vb = new Vbox(); + vb.setVflex("1"); + vb.setWidth("100%"); + winExportFile.appendChild(vb); + vb.appendChild(hb); + vb.appendChild(confirmPanel); + confirmPanel.addActionListener(this); + confirmPanel.setVflex("0"); + } + + winExportFile.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); + AEnv.showWindow(winExportFile); + } // cmd_export + + private void exportFile() + { + try + { + ListItem li = cboType.getSelectedItem(); + if(li == null || li.getValue() == null) + { + FDialog.error(m_WindowNo, winExportFile, "FileInvalidExtension"); + return; + } + + String ext = li.getValue().toString(); + + byte[] data = null; + File inputFile = null; + + if (ext.equals("pdf")) + { + data = m_reportEngine.createPDFData(); + } + else if (ext.equals("ps")) + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + m_reportEngine.createPS(baos); + data = baos.toByteArray(); + } + else if (ext.equals("xml")) + { + StringWriter sw = new StringWriter(); + m_reportEngine.createXML(sw); + data = sw.getBuffer().toString().getBytes(); + } + else if (ext.equals("csv") || ext.equals("ssv")) + { + StringWriter sw = new StringWriter(); + m_reportEngine.createCSV(sw, ',', m_reportEngine.getPrintFormat().getLanguage()); + data = sw.getBuffer().toString().getBytes(); + } + else if (ext.equals("txt")) + { + StringWriter sw = new StringWriter(); + m_reportEngine.createCSV(sw, '\t', m_reportEngine.getPrintFormat().getLanguage()); + data = sw.getBuffer().toString().getBytes(); + } + else if (ext.equals("html") || ext.equals("htm")) + { + StringWriter sw = new StringWriter(); + m_reportEngine.createHTML(sw, false, m_reportEngine.getPrintFormat().getLanguage()); + data = sw.getBuffer().toString().getBytes(); + } + else if (ext.equals("xls")) + { + inputFile = File.createTempFile("Export", ".xls"); + m_reportEngine.createXLS(inputFile, m_reportEngine.getPrintFormat().getLanguage()); + } + else + { + FDialog.error(m_WindowNo, winExportFile, "FileInvalidExtension"); + return; + } + + winExportFile.onClose(); + AMedia media = null; + if (data != null) + media = new AMedia(m_reportEngine.getPrintFormat().getName() + "." + ext, null, "application/octet-stream", data); + else + media = new AMedia(m_reportEngine.getPrintFormat().getName() + "." + ext, null, "application/octet-stream", inputFile, true); + Filedownload.save(media, m_reportEngine.getPrintFormat().getName() + "." + ext); + } + catch (Exception e) + { + log.log(Level.SEVERE, "Failed to export content.", e); + } + } + + + public void close() + { + SessionManager.getAppDesktop().closeActiveWindow(); + } + + + public void copyFormat(){ + MPrintFormat newpf=MPrintFormat.copyToClient(m_ctx, m_reportEngine.getPrintFormat().get_ID() ,Env.getAD_Client_ID(m_ctx)); + pfi=newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name"); + + tpdf1.setMPrintFormat(newpf); + tpdf1.setPrintFormatItems(pfi); + tpdf1.refresh(); + + //tpfo2.setReportEngine(m_reportEngine); + tpfo2.setMPrintFormat(newpf); + tpfo2.setPrintFormatItems(pfi); + tpfo2.setListColumns(); + tpfo2.refresh(); + + tpsc3.setMPrintFormat(newpf); + tpsc3.setPrintFormatItems(pfi); + tpsc3.refresh(); + + + tpgc4.setMPrintFormat(newpf); + tpgc4.setPrintFormatItems(pfi); + + + tpsf5.setMPrintFormat(newpf); + tpsf5.setPrintFormatItems(pfi); + tpsf5.refresh(); + setIsChanged(true); + + comboReport.removeAllItems(); + comboReport.appendItem(newpf.getName(), newpf.get_ID()); + m_reportEngine.setPrintFormat(newpf); + } + + public void setIsChanged(boolean change){ + IsChange=change; + + if(IsChange){ + btnSave.setVisible(true); + bExport.setVisible(false); + bRun.setVisible(false); + newPrintFormat.setVisible(false); + } + else{ + btnSave.setVisible(false); + bExport.setVisible(true); + bRun.setVisible(true); + newPrintFormat.setVisible(true); + } + } + + public void runReport(){ + new ZkReportViewerProvider().openViewer(m_reportEngine); + } +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC1DisplayFieldsPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC1DisplayFieldsPanel.java new file mode 100644 index 0000000000..0e1a498f56 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC1DisplayFieldsPanel.java @@ -0,0 +1,193 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ + +package org.adempiere.webui.panel; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.component.Checkbox; +import org.adempiere.webui.component.Column; +import org.adempiere.webui.component.Columns; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.Row; +import org.adempiere.webui.component.Rows; +import org.adempiere.webui.component.Textbox; +import org.adempiere.webui.component.Window; +import org.compiere.print.MPrintFormat; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Util; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Div; + + +public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener +{ + /** + * + */ + private static final long serialVersionUID = -2097631726230470398L; + + private static final int RENDER_IN_COLUMNS=4; + private MPrintFormat m_printFormat; + Checkbox m_chkboxes[]=null; + Textbox m_textBoxes[]=null; + String m_oldLabel[]=null; + + public WRC1DisplayFieldsPanel() { + super(); + } + + public WRC1DisplayFieldsPanel(MPrintFormat pf){ + super(); + m_printFormat=pf; + } + + public MPrintFormat getM_printFormat() { + return m_printFormat; + } + + public void init() { + + m_chkboxes = new Checkbox[m_pfi.length]; + m_textBoxes = new Textbox[m_pfi.length]; + m_oldLabel = new String[m_pfi.length]; + + Window wind=new Window(); + wind.setWidth("90%"); + wind.setHeight("100%"); + wind.setHflex("1"); + + Grid grid = new Grid(); + //have problem moving the following out as css class + grid.setHflex("1"); + grid.setHeight("90%"); + grid.setVflex(true); + grid.setStyle("margin:0; padding:0; position: absolute"); + grid.makeNoStrip(); + + Div div = new Div(); + div.setStyle("width:90%;height:100%;border:none;margin:none;padding:none"); + div.appendChild(grid); + wind.appendChild(div); + this.appendChild(wind); + + if (AEnv.isTablet()) + { + LayoutUtils.addSclass("tablet-scrolling", div); + } + + Columns columns = new Columns(); + grid.appendChild(columns); + Column cols[] = new Column[2*RENDER_IN_COLUMNS]; + int width = 100/RENDER_IN_COLUMNS; + int widthChk = width/5; + int widthTxt = widthChk*4; + for(int i=0;i { + /** + * + */ + private static final long serialVersionUID = -7732332384947376101L; + + /** + * + */ + private Listbox sortList; + private Button bUp = new Button(); + private Button bDown = new Button(); + + private ArrayList listColumns=new ArrayList(); + Window wind=new Window(); + SimpleListModel sortModel; + private ReportEngine m_reportEngine=null; + + private static CLogger log = CLogger.getCLogger(WRC2FieldOrderPanel.class); + + public WRC2FieldOrderPanel() { + super(); + + } + + public Window getWind() { + return wind; + } + + + public void setWind(Window wind) { + this.wind = wind; + } + + + /** + * Static Layout + * @throws Exception + */ + public void setReportEngine(ReportEngine re) { + m_reportEngine = re; + + } + + public void setListColumns() { + listColumns = new ArrayList(); + if (m_pfi != null && m_pfi.length > 0) { + for (int i = 0; i < m_pfi.length; i++) { + if (m_pfi[i] != null && m_pfi[i].isPrinted()) { + listColumns.add(m_pfi[i]); + } + } + } + + } + + public void init() + { + + Hlayout hlayout = new Hlayout(); + hlayout.setVflex("true"); + hlayout.setHflex("true"); + hlayout.setStyle("width:80%;height:80%;border:none;margin:none;padding:none"); + + sortList = new Listbox(); + sortModel =new SimpleListModel(); + sortList.setHeight("100%"); + sortList.setWidth("40%"); + sortList.setVflex(true); + sortList.addDoubleClickListener(this); + sortList.setSeltype("multiple"); + sortList.addOnDropListener(this); + sortList.setItemDraggable(true); + sortList.setDroppable("true"); + sortList.setVisible(true); + sortList.setMultiple(true); + + EventListener sortListMouseMotionListener = new EventListener() + { + public void onEvent(Event event) throws Exception { + if (event instanceof DropEvent) + { + DropEvent me = (DropEvent) event; + ListItem draggedItem = (ListItem) me.getDragged(); + ListItem targetItem = (ListItem) me.getTarget(); + if (draggedItem.getListbox() == targetItem.getListbox() && draggedItem.getListbox() == sortList) + { + int draggedIndex = sortList.getIndexOfItem(draggedItem); + int targetIndex = sortList.getIndexOfItem(targetItem); + ListElement targetElement = (ListElement) sortModel.getElementAt(targetIndex); + ListElement draggedElement = (ListElement) sortModel.getElementAt(draggedIndex); + + int firstposition=0, secondposition=0; + MPrintFormatItem targetPFI = null; + MPrintFormatItem draggedPFI = null; + for(int j=0 ;j () { + @Override + public int compare(MPrintFormatItem o1, MPrintFormatItem o2) { + return o1.getSeqNo()-o2.getSeqNo(); + } + }); + + if (listColumns.size() > 0 && listColumns != null) { + int seq = 10; + sortModel.removeAllElements(); + for (int i=0; i= 0; i--) { + int index = indices[i]; + if (index >= sortModel.getSize() - 1) + break; + ListElement selObject = (ListElement) sortModel.getElementAt(index); + ListElement newObject = (ListElement)sortModel.getElementAt(index + 1); + /*if (!selObject.isUpdateable() || !newObject.isUpdateable()) + break;*/ + sortModel.setElementAt(newObject, index); + sortModel.setElementAt(selObject, index + 1); + sortList.setSelectedIndex(index + 1); + for(int j=0 ;j "; + return s; + } + } + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC3SortCriteriaPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC3SortCriteriaPanel.java new file mode 100644 index 0000000000..655675d293 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WRC3SortCriteriaPanel.java @@ -0,0 +1,595 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ + +package org.adempiere.webui.panel; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Set; + +import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.ListHead; +import org.adempiere.webui.component.ListHeader; +import org.adempiere.webui.component.ListItem; +import org.adempiere.webui.component.Listbox; +import org.adempiere.webui.component.SimpleListModel; +import org.compiere.print.MPrintFormatItem; +import org.compiere.print.ReportEngine; +import org.compiere.util.CLogger; +import org.compiere.util.KeyNamePair; +import org.compiere.util.NamePair; +import org.zkoss.zk.au.out.AuFocus; +import org.zkoss.zk.ui.event.DropEvent; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zul.Hlayout; +import org.zkoss.zul.Vbox; + +public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener +{ + /** + * + */ + private static final long serialVersionUID = -2798618953887598651L; + + private ReportEngine m_reportEngine; + private static CLogger log = CLogger.getCLogger(WRC3SortCriteriaPanel.class); + + + // UI variables + private Label noLabel = new Label(); + private Label yesLabel = new Label(); + private Button bAdd = new Button(); + private Button bRemove = new Button(); + private Button bUp = new Button(); + private Button bDown = new Button(); + //private AbstractADWindowContent adWindowPanel = null; + + public ArrayList yesItems=new ArrayList(); + public ArrayList noItems=new ArrayList(); + + // + SimpleListModel noModel = new SimpleListModel(); + SimpleListModel yesModel = new SimpleListModel(); + Listbox noList = new Listbox(); + Listbox yesList = new Listbox(); + + public WRC3SortCriteriaPanel() { + super(); + //m_WindowNo = SessionManager.getAppDesktop().registerWindow(this); + } + + /** + * Static Layout + * @throws Exception + */ + public void setReportEngine(ReportEngine re) { + + m_reportEngine = re; + } + + public void init() + { + // + noLabel.setValue("Available"); + yesLabel.setValue("Order By"); + + yesList.setVflex(true); + noList.setVflex(true); + + EventListener mouseListener = new EventListener() + { + + public void onEvent(Event event) throws Exception + { + if (Events.ON_DOUBLE_CLICK.equals(event.getName())) + { + migrateValueAcrossLists(event); + } + } + }; + yesList.addDoubleClickListener(mouseListener); + noList.addDoubleClickListener(mouseListener); + // + EventListener actionListener = new EventListener() + { + public void onEvent(Event event) throws Exception { + migrateValueAcrossLists(event); + } + }; + yesList.setSeltype("multiple"); + noList.setSeltype("multiple"); + + bAdd.setImage("images/Next24.png"); + bAdd.addEventListener(Events.ON_CLICK, actionListener); + + bRemove.setImage("images/Previous24.png"); + bRemove.addEventListener(Events.ON_CLICK, actionListener); + + EventListener crossListMouseListener = new DragListener(); + yesList.addOnDropListener(crossListMouseListener); + noList.addOnDropListener(crossListMouseListener); + yesList.setItemDraggable(true); + noList.setItemDraggable(true); + + + EventListener yesListMouseMotionListener = new EventListener() + { + public void onEvent(Event event) throws Exception { + if (event instanceof DropEvent) + { + DropEvent me = (DropEvent) event; + ListItem startItem = (ListItem) me.getDragged(); + ListItem endItem = (ListItem) me.getTarget(); + if (startItem.getListbox() == endItem.getListbox() && startItem.getListbox() == yesList) + { + int startIndex = yesList.getIndexOfItem(startItem); + int endIndex = yesList.getIndexOfItem(endItem); + ListElement endElement = (ListElement) yesModel.getElementAt(endIndex); + ListElement startElement = (ListElement) yesModel.getElementAt(startIndex); + yesModel.removeElement(startElement); + endIndex = yesModel.indexOf(endElement); + yesModel.add(endIndex, startElement); + yesList.setSelectedIndex(endIndex); + + int firstposition=0, secondposition=0; + MPrintFormatItem targetPFI = null; + MPrintFormatItem draggedPFI = null; + for(int j=0 ;j (); + noItems =new ArrayList(); + if (m_pfi.length > 0 && m_pfi != null ) { + int seq = 10; + for(int i=0 ; i < m_pfi.length ; i++ ){ + if (m_pfi[i].isPrinted() && m_pfi[i] != null) { + if (m_pfi[i].isOrderBy()) { + m_pfi[i].setSortNo(seq); + seq=seq+10; + yesItems.add(m_pfi[i]); + } else{ + noItems.add(m_pfi[i]); + } + } + } + } + + Collections.sort(yesItems, new Comparator() { + @Override + public int compare(MPrintFormatItem o1, MPrintFormatItem o2) { + return o1.getSortNo()-o2.getSortNo(); + } + }); + + yesList.removeAllItems(); + noList.removeAllItems(); + + if (yesItems.size() > 0 && yesItems != null) { + yesModel.removeAllElements(); + for (int i=0 ; i < yesItems.size() ; i++) { + MPrintFormatItem pfi = yesItems.get(i); + if (pfi != null) { + int ID= pfi.get_ID(); + String name =pfi.getPrintName(); + if(name == null) + name=pfi.getName(); + KeyNamePair pair =new KeyNamePair(ID, name); + yesList.addItem(pair); + ListElement element =new ListElement(pfi.get_ID(), pfi.getName(), pfi.getSortNo(), true, pfi.getAD_Client_ID(), pfi.getAD_Org_ID()); + yesModel.addElement(element); + } + } + } + + if (noItems.size() > 0 && noItems != null) { + noModel.removeAllElements(); + for (int i=0 ; i < noItems.size() ; i++) { + MPrintFormatItem pfi = noItems.get(i); + if (pfi != null) { + int ID= pfi.get_ID(); + pfi.setSortNo(0); + pfi.setIsOrderBy(false); + String name =pfi.getPrintName(); + if(name == null) + name=pfi.getName(); + KeyNamePair pair =new KeyNamePair(ID, name); + noList.addItem(pair); + ListElement element =new ListElement(pfi.get_ID(), pfi.getName(), pfi.getSortNo(), false, pfi.getAD_Client_ID(), pfi.getAD_Org_ID()); + noModel.add(i,element); + } + } + } + } + + + + @Override + public void updatePFI() { + // pfi is being updated on every refresh + + } + + /** + * @param event + */ + void migrateValueAcrossLists (Event event) + { + Object source = event.getTarget(); + if (source instanceof ListItem) { + source = ((ListItem)source).getListbox(); + } + Listbox listFrom = (source == bAdd || source == noList) ? noList : yesList; + Listbox listTo = (source == bAdd || source == noList) ? yesList : noList; + SimpleListModel lmFrom = (source == bAdd || source == noList) ? + noModel : yesModel; + SimpleListModel lmTo = (lmFrom == yesModel) ? noModel : yesModel; + Set selectedItems = listFrom.getSelectedItems(); + List selObjects = new ArrayList(); + for (Object obj : selectedItems) { + ListItem listItem = (ListItem) obj; + int index = listFrom.getIndexOfItem(listItem); + ListElement selObject = (ListElement)lmFrom.getElementAt(index); + selObjects.add(selObject); + } + for (ListElement selObject : selObjects) + { + if (selObject == null) + continue; + + lmFrom.removeElement(selObject); + lmTo.addElement(selObject); + + for (int j=0 ; j= 0; i--) { + int index = indices[i]; + if (index >= yesModel.getSize() - 1) + break; + ListElement selObject = (ListElement) yesModel.getElementAt(index); + ListElement newObject = (ListElement)yesModel.getElementAt(index + 1); + + yesModel.setElementAt(newObject, index); + yesModel.setElementAt(selObject, index + 1); + yesList.setSelectedIndex(index + 1); + indices[i] = index + 1; + change = true; + } + } // down + + // + if (change) { + yesList.setSelectedIndices(indices); + updateYesList(); + if ( yesList.getSelectedItem() != null) + { + AuFocus focus = new AuFocus(yesList.getSelectedItem()); + Clients.response(focus); + } + } + } // migrateValueWithinYesList + + + public void updateYesList(){ + yesList.removeAllItems(); + wc.setIsChanged(true); + int sortNo=10; + for(int i=0;i"; + return s; + } + } + + /** + * @author eslatis + * + */ + private class DragListener implements EventListener + { + + /** + * Creates a ADSortTab.DragListener. + */ + public DragListener() + { + } + + public void onEvent(Event event) throws Exception { + int endIndex=0; + if (event instanceof DropEvent) + { + DropEvent me = (DropEvent) event; + + ListItem endItem = (ListItem) me.getTarget(); + if (!(endItem.getListbox() == yesList)) + { + return; // move within noList + } + + ListItem startItem = (ListItem) me.getDragged(); + if (startItem.getListbox() == endItem.getListbox()) + { + return; //move within same list + } + int startIndex = noList.getIndexOfItem(startItem); + ListElement element = (ListElement) noModel.getElementAt(startIndex); + noModel.removeElement(element); + endIndex = yesList.getIndexOfItem(endItem); + yesModel.add(endIndex, element); + + for (int j=0 ; j { + /** + * + */ + private static final long serialVersionUID = -3142169077710161360L; + + private static final int RENDER_IN_COLUMNS=2; + private MPrintFormat m_printFormat; + Checkbox m_chkboxes[]=null; + String m_oldLabel[]=null; + ArrayList orderfield=new ArrayList(); + Grid grid = new Grid(); + + public WRC4GroupingCriteriaPanel() { + super(); + } + + + @Override + public void refresh() { + orderfield = new ArrayList(); + for(int i=0 ; i < m_pfi.length ; i++){ + if(m_pfi[i] != null && m_pfi[i].isOrderBy() && m_pfi[i].isPrinted()){ + orderfield.add(m_pfi[i]); + } + } + dynamicInit(); + } + + @Override + public void updatePFI() { + + for(int i=0 ; i { + /** + * + */ + private static final long serialVersionUID = -2231369601903381581L; + + private static final int RENDER_IN_COLUMNS=10; + private MPrintFormat m_printFormat; + Checkbox m_chkSum[]=null; + Checkbox m_chkCount[]=null; + Checkbox m_chkMin[]=null; + Checkbox m_chkMax[]=null; + Checkbox m_chkMean[]=null; + Checkbox m_chkVariance[]=null; + Checkbox m_chkDesviation[]=null; + private ArrayList DisplayItems=new ArrayList(); + Grid grid = new Grid(); + + public WRC5SummaryFieldsPanel() { + super(); + } + + + public void init(){ + Window wind=new Window(); + wind.setWidth("90%"); + wind.setHeight("100%"); + wind.setHflex("1"); + + + grid.setHflex("1"); + grid.setHeight("90%"); + grid.setVflex(true); + grid.setStyle("margin:0; padding:0; position: absolute"); + grid.makeNoStrip(); + + Div div = new Div(); + div.setStyle("width:90%;height:100%;border:none;margin:none;padding:none"); + div.appendChild(grid); + wind.appendChild(div); + this.appendChild(wind); + + + if (AEnv.isTablet()) + { + LayoutUtils.addSclass("tablet-scrolling", div); + } + + Columns columns = new Columns(); + grid.appendChild(columns); + Column cols[] = new Column[RENDER_IN_COLUMNS]; + int width = 100/RENDER_IN_COLUMNS; + int widthChk = width/5; + for(int i=0;i(); + for(int i=0 ; i, ITab private ToolBarButton bCustomize = new ToolBarButton(); private ToolBarButton bFind = new ToolBarButton(); private ToolBarButton bExport = new ToolBarButton(); + private ToolBarButton bWizard = new ToolBarButton(); private Listbox comboReport = new Listbox(); private Label labelDrill = new Label(); private Listbox comboDrill = new Listbox(); @@ -304,6 +308,12 @@ public class ZkReportViewer extends Window implements EventListener, ITab bRefresh.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh"))); toolBar.appendChild(bRefresh); bRefresh.addEventListener(Events.ON_CLICK, this); + + bWizard.setImage("/images/Wizard24.png"); + bWizard.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "PrintWizard"))); + toolBar.appendChild(bWizard); + bWizard.addEventListener(Events.ON_CLICK, this); + North north = new North(); layout.appendChild(north); @@ -682,6 +692,8 @@ public class ZkReportViewer extends Window implements EventListener, ITab cmd_archive(); else if (e.getTarget() == bCustomize) cmd_customize(); + else if (e.getTarget() == bWizard) + cmd_Wizard(); else if (e.getTarget() == bRefresh) cmd_report(); // @@ -911,7 +923,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab /** * Report Combo - Start other Report or create new one */ - private void cmd_report() + public void cmd_report() { ListItem li = comboReport.getSelectedItem(); if(li == null || li.getValue() == null) return; @@ -1089,6 +1101,26 @@ public class ZkReportViewer extends Window implements EventListener, ITab AEnv.zoom(AD_Window_ID, MQuery.getEqualQuery("AD_PrintFormat_ID", AD_PrintFormat_ID)); } // cmd_customize + /*IDEMPIERE -379*/ + private void cmd_Wizard() + { + int AD_Window_ID = WINDOW_PRINTFORMAT; // hardcoded + int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID(); + + Env.setContext(m_ctx, "AD_PrintFormat_ID", AD_PrintFormat_ID); + + ADForm form = ADForm.openForm(SystemIDs.WIZARD_REPORT_FORM); + WReportCustomization av = (WReportCustomization) form.getICustomForm(); + av.setReportEngine(m_reportEngine); + + form.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); + SessionManager.getAppDesktop().showWindow(form); + + //ZkReportCustomization zkCustomization = new ZkReportCustomization(m_reportEngine); + //zkCustomization.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); + //zkCustomization.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT); + //SessionManager.getAppDesktop().showWindow(zkCustomization); + } // cmd_customize //-- ComponentCtrl --// public Object getExtraCtrl() { return new ExtraCtrl(); diff --git a/org.adempiere.ui.zk/images/Wizard24.png b/org.adempiere.ui.zk/images/Wizard24.png new file mode 100644 index 0000000000000000000000000000000000000000..f0eef6cc4b11d7d666f14879f96a257f8e28029c GIT binary patch literal 1111 zcmV-d1gQIoP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyu4 z4=55dQvS&R00Y-aL_t(Y$K{o6OqFFA$A33k$;&yu@v8Ecop7y1Z^EpJ&6SN!m%6oO zDwze*s6OQCgITQ?*K(~sv^EngHbrPT3>ZsIvt;v-Mv!X;o|JO}f%C%QaDW4x^E}Vh zhXY3#r6=uM&-U!zeeJpa|L6K&|NFY(fBzV-Ck@4Ru4P{~pN^p`C00At&-00lNWUW?8HKLe<5CHCvt?cZGiU43} zQ~F%s7?6)l%Q|hU?pihY*m=mBziZ=zXaBJWuEG=m z7S#2M7SumBG-)z4Vd9NNP~ImB_~M7K8g;K*4`(lkd&D0YHCirqbGgsG7MNavb4}80 zAU@@|docN1C$7hn^MMi3#U_XbR0E#^9|5t+M_o{#L*?m2Zq<-hw)%R%PlGGEP?y28b9XUR0ndSBt)564Dn|qWN zTetl5yIpzxqg$+dimF!aJUG1qLz4j@8F&*gCT!dTFcthv>jfUV?=J4h&Nz~ml9;P$ zny3*kEgcT!9~m#O?kQ?2c%zCRcW(|?;8-z_OskLXmGjNOQDDUs-d>)6G((qj zqSW1!NiDzq(VDS1)jS>y;dFbr?C4hgUSCP^=Jn;D9ju>bmWV|5d~<>rvI)2ZWJ{Rb z1-wO!`bM9h;sYPeZSAhKl*FWvris(t&t*rq8Xg`gDBZfDsiLNV=bu_P(~^$-xzqP~ zrb2t3N$h#1O2-3nYKkmgXTRTY^!6KP&vzJKH=Z)~9;kixUkx@#z8Qed<>t3Lmz&pK zmBsdJkJ~4c;57{=W$%I7?Ew3$8=@z$=b0zhn2s&0W=%FU4DN}5S5()p1gNO4zb4*w zXHj!oyFWX9QNq|nLmgc`s^9A?Dc!oEJenW=+fi}mmkSYDG8U(r#)2Vr)hz?hm2TZo zUQyFvXBfL-e1>5*d0PKd-*`3Ex{=v-a0C dWC7eL_+RCV6$In{9$x?e002ovPDHLkV1k|+56b`m literal 0 HcmV?d00001