IDEMPIERE-379 Reporting wizard for end users

This commit is contained in:
Juliana Corredor 2012-10-30 21:23:46 -05:00
parent a8a3be8b96
commit a0324420be
14 changed files with 2629 additions and 6 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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;
}

View File

@ -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<MPrintFormatItem> 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

View File

@ -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 {
/**
*
*/

View File

@ -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<Event> {
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);
}
}

View File

@ -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<Event>
{
/**
*
*/
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<RENDER_IN_COLUMNS;i++){
cols[i] = new Column();
cols[i].setWidth(widthChk+"%");
columns.appendChild(cols[i]);
cols[i+1] = new Column();
cols[i+1].setWidth(widthTxt+"%");
columns.appendChild(cols[i+1]);
}
int curCol=0;
Rows rows = grid.newRows();
org.zkoss.zul.Row row = null;
for(int i=0;i<m_pfi.length;i++){
if(curCol==0){
row = new Row();
rows.appendChild(row);
}
m_chkboxes[i] = new Checkbox();
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
m_chkboxes[i].addEventListener(Events.ON_CHECK,this);
row.appendChild(m_chkboxes[i]);
m_textBoxes[i] = new Textbox();
String strValue = m_pfi[i].getPrintName();
if(strValue ==null || strValue.length()==0){
strValue = m_pfi[i].getName();
}
m_oldLabel[i] = strValue;
m_textBoxes[i].setText(strValue);
m_textBoxes[i].setWidth("90%");
row.appendChild(m_textBoxes[i]);
curCol++;
curCol = curCol%RENDER_IN_COLUMNS;
}
}
public void save(){
for(int i=0;i<m_pfi.length;i++){
m_pfi[i].setIsActive(m_chkboxes[i].isChecked());
m_pfi[i].setPrintName(m_textBoxes[i].getText());
m_pfi[i].saveEx();
}
}
public KeyNamePair[] getChecked(){
KeyNamePair [] listcheck=new KeyNamePair[m_pfi.length];
for(int i=0;i<m_chkboxes.length;i++){
if(m_chkboxes[i].isChecked()){
int ID=m_pfi[i].get_ID();
String name=m_pfi[i].getName();
KeyNamePair pair=new KeyNamePair(ID, name);
listcheck[i]=pair;
}
}
return listcheck;
}
@Override
public void refresh() {
for (int i=0 ; i< m_pfi.length ; i++){
m_chkboxes[i].setChecked(m_pfi[i].isPrinted());
}
}
@Override
public void updatePFI() {
for (int i=0 ;i < m_chkboxes.length ;i++){
if(m_chkboxes[i].isChecked()){
m_pfi[i].setIsPrinted(true);
}
else{
m_pfi[i].setIsPrinted(false);
}
String printname = m_textBoxes[i].getValue();
if (!Util.isEmpty(printname))
if (! printname.equals(m_pfi[i].getPrintName()))
m_pfi[i].setPrintName(m_textBoxes[i].getValue());
}
}
public void updatePrinted(boolean value){
for(int j=0 ; j< m_pfi.length ; j++){
m_pfi[j].setIsPrinted(value);
m_chkboxes[j].setChecked(value);
}
}
@Override
public void onEvent(Event event) throws Exception {
if (Events.ON_CHECK.equals(event.getName())) {
wc.setIsChanged(true);
}
}
}

View File

@ -0,0 +1,423 @@
/******************************************************************************
* 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 org.adempiere.webui.component.Button;
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.adempiere.webui.component.Window;
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 WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Event> {
/**
*
*/
private static final long serialVersionUID = -7732332384947376101L;
/**
*
*/
private Listbox sortList;
private Button bUp = new Button();
private Button bDown = new Button();
private ArrayList<MPrintFormatItem> listColumns=new ArrayList<MPrintFormatItem>();
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<MPrintFormatItem>();
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 <m_pfi.length ;j++){
if(m_pfi[j].get_ID() == targetElement.getKey()){
targetPFI = m_pfi[j];
firstposition=j;
}
if(m_pfi[j].get_ID() == draggedElement.getKey()){
draggedPFI = m_pfi[j];
secondposition=j;
}
}
draggedPFI.setSeqNo(targetPFI.getSeqNo()-5);
MPrintFormatItem fi=m_pfi[firstposition];
m_pfi[firstposition]=m_pfi[secondposition];
m_pfi[secondposition]=fi;
sortModel.removeElement(draggedElement);
targetIndex = sortModel.indexOf(targetElement);
sortModel.add(targetIndex, draggedElement);
wc.setIsChanged(true);
refresh();
sortList.setSelectedIndex(targetIndex);
if ( sortList.getSelectedItem() != null)
{
AuFocus focus = new AuFocus(sortList.getSelectedItem());
Clients.response(focus);
}
}
}
}
};
sortList.addOnDropListener(sortListMouseMotionListener);
ListHead listHead = new ListHead();
listHead.setParent(sortList);
ListHeader header=new ListHeader();
header.setParent(listHead);
hlayout.appendChild(sortList);
EventListener actionListener = new EventListener()
{
public void onEvent(Event event) throws Exception {
migrateValueWithinSortList(event);
}
};
bUp.setImage("images/Parent24.png");
bUp.addEventListener(Events.ON_CLICK, actionListener);
bDown.setImage("images/Detail24.png");
bDown.addEventListener(Events.ON_CLICK, actionListener);
Vbox vbox = new Vbox();
vbox.appendChild(bUp);
vbox.appendChild(bDown);
vbox.setWidth("50px");
//vbox.setParent(wind);
hlayout.appendChild(vbox);
this.appendChild(hlayout);
}
@Override
public void onEvent(Event event) throws Exception {
}
@Override
public void refresh() {
sortList.removeAllItems();
this.setListColumns();
Collections.sort(listColumns, new Comparator<MPrintFormatItem>() {
@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<listColumns.size(); i++) {
MPrintFormatItem pfi = listColumns.get(i);
if (pfi != null) {
pfi.setSeqNo(seq);
for(int j=0 ;j<m_pfi.length;j++){
if(m_pfi[j].get_ID()== pfi.get_ID()){
m_pfi[j].setSeqNo(seq);
}
}
seq = seq + 10;
int ID = pfi.get_ID();
String name=pfi.getPrintName();
if(name == null)
name=pfi.getName();
ListElement element =new ListElement(ID, name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
sortModel.addElement(element);
KeyNamePair pair=new KeyNamePair(ID, name);
sortList.addItem(pair);
}
}
}
}
@Override
public void updatePFI() {
// TODO Auto-generated method stub
}
public void updateSortModel(){
sortList.removeAllItems();
// SortList=SortModel;
}
/**
* Move within Yes List
* @param event event
*/
void migrateValueWithinSortList (Event event)
{
Object[] selObjects = sortList.getSelectedItems().toArray();
if (selObjects == null)
return;
int length = selObjects.length;
if (length == 0)
return;
//
int[] indices = sortList.getSelectedIndices();
int firstposition=0, secondposition=0;
boolean change = false;
//
Object source = event.getTarget();
if (source == bUp)
{
for (int i = 0; i < length; i++) {
int index = indices[i];
if (index == 0)
break;
ListElement selObject = (ListElement) sortModel.getElementAt(index);
ListElement newObject = (ListElement)sortModel.getElementAt(index - 1);
sortModel.setElementAt(newObject, index);
sortModel.setElementAt(selObject, index - 1);
for(int j=0 ;j <m_pfi.length ;j++){
if(m_pfi[j].get_ID() == selObject.getKey()){
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
firstposition=j;
}
if(m_pfi[j].get_ID() == newObject.getKey()){
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
secondposition=j;
}
}
indices[i] = index - 1;
change = true;
MPrintFormatItem fi=m_pfi[firstposition];
m_pfi[firstposition]=m_pfi[secondposition];
m_pfi[secondposition]=fi;
}
} // up
else if (source == bDown)
{
for (int i = length - 1; 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 <m_pfi.length ;j++){
if(m_pfi[j].get_ID() == selObject.getKey()){
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()+10);
firstposition=j;
}
if(m_pfi[j].get_ID() == newObject.getKey()){
m_pfi[j].setSeqNo(m_pfi[j].getSeqNo()-10);
secondposition=j;
}
}
indices[i] = index + 1;
change = true;
MPrintFormatItem fi=m_pfi[firstposition];
m_pfi[firstposition]=m_pfi[secondposition];
m_pfi[secondposition]=fi;
}
} // down
//
if (change) {
sortList.setSelectedIndices(indices);
int idx = sortList.getSelectedIndex();
refresh();
wc.setIsChanged(true);
sortList.setSelectedIndex(idx);
if ( sortList.getSelectedItem() != null)
{
AuFocus focus = new AuFocus(sortList.getSelectedItem());
Clients.response(focus);
}
}
} // migrateValueWithinSortList
/**
* List Item
*/
public class ListElement extends NamePair {
/**
*
*/
private static final long serialVersionUID = -5645910649588308798L;
private int m_key;
private int m_AD_Client_ID;
private int m_AD_Org_ID;
/** Initial seq number */
private int m_sortNo;
public ListElement(int key, String name, int sortNo, int AD_Client_ID, int AD_Org_ID) {
super(name);
this.m_key = key;
this.m_AD_Client_ID = AD_Client_ID;
this.m_AD_Org_ID = AD_Org_ID;
this.m_sortNo = sortNo;
}
public int getKey() {
return m_key;
}
public void setSortNo(int sortNo) {
m_sortNo = sortNo;
}
public int getSortNo() {
return m_sortNo;
}
public int getAD_Client_ID() {
return m_AD_Client_ID;
}
public int getAD_Org_ID() {
return m_AD_Org_ID;
}
@Override
public String getID() {
return m_key != -1 ? String.valueOf(m_key) : null;
}
@Override
public int hashCode() {
return m_key;
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof ListElement)
{
ListElement li = (ListElement)obj;
return
li.getKey() == m_key
&& li.getName() != null
&& li.getName().equals(getName())
&& li.getAD_Client_ID() == m_AD_Client_ID
&& li.getAD_Org_ID() == m_AD_Org_ID;
}
return false;
} // equals
@Override
public String toString() {
String s = super.toString();
if (s == null || s.trim().length() == 0)
s = "<" + getKey() + ">";
return s;
}
}
}

View File

@ -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<Event>
{
/**
*
*/
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<MPrintFormatItem> yesItems=new ArrayList<MPrintFormatItem>();
public ArrayList<MPrintFormatItem> noItems=new ArrayList<MPrintFormatItem>();
//
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 <m_pfi.length ;j++){
if(m_pfi[j].get_ID() == endElement.getKey()){
targetPFI = m_pfi[j];
firstposition=j;
}
if(m_pfi[j].get_ID() == startElement.getKey()){
draggedPFI = m_pfi[j];
secondposition=j;
}
}
draggedPFI.setSeqNo(targetPFI.getSeqNo()-5);
wc.setIsChanged(true);
updateYesList();
MPrintFormatItem fi=m_pfi[firstposition];
m_pfi[firstposition]=m_pfi[secondposition];
m_pfi[secondposition]=fi;
if ( yesList.getSelectedItem() != null)
{
AuFocus focus = new AuFocus(yesList.getSelectedItem());
Clients.response(focus);
}
//setIsChanged(true);
}
}
}
};
yesList.addOnDropListener(yesListMouseMotionListener);
ListHead listHead = new ListHead();
listHead.setParent(yesList);
ListHeader listHeader = new ListHeader();
listHeader.appendChild(yesLabel);
listHeader.setParent(listHead);
listHead = new ListHead();
listHead.setParent(noList);
listHeader = new ListHeader();
listHeader.appendChild(noLabel);
listHeader.setParent(listHead);
Hlayout hlayout = new Hlayout();
hlayout.setVflex("true");
hlayout.setHflex("true");
hlayout.setStyle("width:80%;height:80%;border:none;margin:none;padding:none");
noList.setHflex("1");
noList.setVflex(true);
hlayout.appendChild(noList);
Vbox vbox = new Vbox();
vbox.appendChild(bAdd);
vbox.appendChild(bRemove);
vbox.setWidth("50px");
hlayout.appendChild(vbox);
yesList.setVflex(true);
yesList.setHflex("1");
hlayout.appendChild(yesList);
EventListener actionListener2 = new EventListener()
{
public void onEvent(Event event) throws Exception {
migrateValueWithinYesList(event);
}
};
bUp.setImage("images/Parent24.png");
bUp.addEventListener(Events.ON_CLICK, actionListener2);
bDown.setImage("images/Detail24.png");
bDown.addEventListener(Events.ON_CLICK, actionListener2);
vbox = new Vbox();
vbox.appendChild(bUp);
vbox.appendChild(bDown);
vbox.setWidth("46px");
hlayout.appendChild(vbox);
this.appendChild(hlayout);
}
@Override
public void onEvent(Event event) throws Exception {
// TODO Auto-generated method stub
}
@Override
public void refresh() {
yesItems =new ArrayList<MPrintFormatItem>();
noItems =new ArrayList<MPrintFormatItem>();
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<MPrintFormatItem>() {
@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<ListElement> selObjects = new ArrayList<ListElement>();
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<m_pfi.length ; j++) {
if (m_pfi[j].get_ID() == selObject.m_key) {
if (listFrom.equals(noList)) {
m_pfi[j].setIsOrderBy(true);
} else {
m_pfi[j].setIsOrderBy(false);
}
}
}
wc.setIsChanged(true);
}
refresh();
if ( listTo.getSelectedItem() != null)
{
AuFocus focus = new AuFocus(listTo.getSelectedItem());
Clients.response(focus);
}
} // migrateValueAcrossLists
/**
* Move within Yes List
* @param event event
*/
void migrateValueWithinYesList (Event event)
{
Object[] selObjects = yesList.getSelectedItems().toArray();
if (selObjects == null)
return;
int length = selObjects.length;
if (length == 0)
return;
//
int[] indices = yesList.getSelectedIndices();
//
boolean change = false;
//
Object source = event.getTarget();
if (source == bUp)
{
for (int i = 0; i < length; i++) {
int index = indices[i];
if (index == 0)
break;
ListElement selObject = (ListElement) yesModel.getElementAt(index);
ListElement newObject = (ListElement)yesModel.getElementAt(index - 1);
yesModel.setElementAt(newObject, index);
yesModel.setElementAt(selObject, index - 1);
indices[i] = index - 1;
change = true;
}
} // up
else if (source == bDown)
{
for (int i = length - 1; i >= 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<yesModel.getSize();i++){
ListElement obj=(ListElement) yesModel.getElementAt(i);
for(int j=0;j<m_pfi.length;j++){
if(m_pfi[j].get_ID() == obj.getKey()){
String name=obj.getName();
int ID=obj.getKey();
KeyNamePair pair=new KeyNamePair(ID, name);
yesList.addItem(pair);
m_pfi[j].setSortNo(sortNo);
sortNo=sortNo+10;
}
}
}
}
/**
* List Item
*/
public class ListElement extends NamePair {
/**
*
*/
private static final long serialVersionUID = -5645910649588308798L;
private int m_key;
private int m_AD_Client_ID;
private int m_AD_Org_ID;
/** Initial seq number */
private int m_sortNo;
/** Initial selection flag */
private boolean m_isYes;
public ListElement(int key, String name, int sortNo, boolean isYes, int AD_Client_ID, int AD_Org_ID) {
super(name);
this.m_key = key;
this.m_AD_Client_ID = AD_Client_ID;
this.m_AD_Org_ID = AD_Org_ID;
this.m_sortNo = sortNo;
this.m_isYes = isYes;
}
public int getKey() {
return m_key;
}
public void setSortNo(int sortNo) {
m_sortNo = sortNo;
}
public int getSortNo() {
return m_sortNo;
}
public void setIsYes(boolean value) {
m_isYes = value;
}
public boolean isYes() {
return m_isYes;
}
public int getAD_Client_ID() {
return m_AD_Client_ID;
}
public int getAD_Org_ID() {
return m_AD_Org_ID;
}
@Override
public String getID() {
return m_key != -1 ? String.valueOf(m_key) : null;
}
@Override
public int hashCode() {
return m_key;
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof ListElement)
{
ListElement li = (ListElement)obj;
return
li.getKey() == m_key
&& li.getName() != null
&& li.getName().equals(getName())
&& li.getAD_Client_ID() == m_AD_Client_ID
&& li.getAD_Org_ID() == m_AD_Org_ID;
}
return false;
} // equals
@Override
public String toString() {
String s = super.toString();
if (s == null || s.trim().length() == 0)
s = "<" + getKey() + ">";
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<m_pfi.length ; j++) {
if (m_pfi[j].get_ID() == element.m_key) {
m_pfi[j].setIsOrderBy(true);
m_pfi[j].setSortNo(endIndex*10);
}
}
wc.setIsChanged(true);
}
refresh();
//
noList.clearSelection();
yesList.clearSelection();
yesList.setSelectedIndex(endIndex);
}
}
}

View File

@ -0,0 +1,156 @@
/******************************************************************************
* 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 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.Window;
import org.compiere.print.MPrintFormat;
import org.compiere.print.MPrintFormatItem;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListener<Event> {
/**
*
*/
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<MPrintFormatItem> orderfield=new ArrayList<MPrintFormatItem>();
Grid grid = new Grid();
public WRC4GroupingCriteriaPanel() {
super();
}
@Override
public void refresh() {
orderfield = new ArrayList<MPrintFormatItem>();
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<orderfield.size() ; i++){
for(int j=0 ;j<m_pfi.length ; j++){
if(orderfield.get(i).get_ID() == m_pfi[j].get_ID()){
m_pfi[j].setIsGroupBy(m_chkboxes[i].isChecked());
}
}
}
}
@Override
public void onEvent(Event event) throws Exception {
if (Events.ON_CHECK.equals(event.getName())) {
wc.setIsChanged(true);
}
}
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();
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<RENDER_IN_COLUMNS;i++){
cols[i] = new Column();
cols[i].setWidth(widthChk+"%");
columns.appendChild(cols[i]);
cols[i+1] = new Column();
cols[i+1].setWidth(widthTxt+"%");
columns.appendChild(cols[i+1]);
}
grid.appendChild(columns);
this.appendChild(wind);
wind.appendChild(grid);
}
public void dynamicInit()
{
if (grid.getRows() != null)
grid.removeChild(grid.getRows());
m_chkboxes = new Checkbox[orderfield.size()];
m_oldLabel = new String[orderfield.size()];
int curCol=0;
Rows rows = grid.newRows();
org.zkoss.zul.Row row = null;
for(int i=0;i<orderfield.size();i++){
if(curCol==0){
row = new Row();
rows.appendChild(row);
}
m_chkboxes[i] = new Checkbox();
m_chkboxes[i].setChecked(orderfield.get(i).isGroupBy());
m_chkboxes[i].addEventListener(Events.ON_CHECK, this);
String strValue = orderfield.get(i).getPrintName();
if(strValue ==null || strValue.length()==0){
strValue = orderfield.get(i).getName();
}
m_chkboxes[i].setLabel(strValue);
row.appendChild(m_chkboxes[i]);
curCol++;
curCol = curCol%RENDER_IN_COLUMNS;
}
grid.appendChild(rows);
}
}

View File

@ -0,0 +1,215 @@
/******************************************************************************
* 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 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.Label;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window;
import org.compiere.print.MPrintFormat;
import org.compiere.print.MPrintFormatItem;
import org.compiere.util.Env;
import org.compiere.util.Msg;
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;
import org.zkoss.zul.Row;
public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener<Event> {
/**
*
*/
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<MPrintFormatItem> DisplayItems=new ArrayList<MPrintFormatItem>();
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<RENDER_IN_COLUMNS;i++){
cols[i] = new Column();
cols[i].setWidth(width+"%");
columns.appendChild(cols[i]);
}
}
@Override
public void refresh() {
DisplayItems = new ArrayList<MPrintFormatItem>();
for(int i=0 ; i<m_pfi.length ; i ++){
if(m_pfi[i] != null && m_pfi[i].isPrinted()){
DisplayItems.add(m_pfi[i]);
}
}
dynamicInit();
}
@Override
public void updatePFI() {
for(int i=0 ;i<DisplayItems.size() ; i++){
for(int j=0 ; j<m_pfi.length ; j++){
if(DisplayItems.get(i).get_ID() == m_pfi[j].get_ID()){
m_pfi[j].setIsSummarized(m_chkSum[i].isChecked());
m_pfi[j].setIsCounted(m_chkCount[i].isChecked());
m_pfi[j].setIsMinCalc(m_chkMin[i].isChecked());
m_pfi[j].setIsMaxCalc(m_chkMax[i].isChecked());
m_pfi[j].setIsAveraged(m_chkMean[i].isChecked());
m_pfi[j].setIsVarianceCalc(m_chkVariance[i].isChecked());
m_pfi[j].setIsDeviationCalc(m_chkDesviation[i].isChecked());
}
}
}
}
@Override
public void onEvent(Event event) throws Exception {
if (Events.ON_CHECK.equals(event.getName())) {
wc.setIsChanged(true);
}
}
public void dynamicInit(){
if (grid.getRows() != null)
grid.removeChild(grid.getRows());
Rows rows = grid.newRows();
org.zkoss.zul.Row row = null;
row=new Row();
Label name=new Label(Msg.getMsg(Env.getCtx(), "Field"));
row.appendChild(name);
Label sum=new Label(Msg.getMsg(Env.getCtx(), "Sum"));
row.appendChild(sum);
Label count=new Label(Msg.getMsg(Env.getCtx(), "Count"));
row.appendChild(count);
Label Min=new Label(Msg.getMsg(Env.getCtx(), "Min"));
row.appendChild(Min);
Label Max =new Label(Msg.getMsg(Env.getCtx(), "Max"));
row.appendChild(Max);
Label Mean=new Label(Msg.getMsg(Env.getCtx(), "Mean"));
row.appendChild(Mean);
Label Variance =new Label(Msg.getMsg(Env.getCtx(), "Variance"));
row.appendChild(Variance);
Label Deviation=new Label(Msg.getMsg(Env.getCtx(), "Deviation"));
row.appendChild(Deviation);
rows.appendChild(row);
m_chkSum =new Checkbox[DisplayItems.size()];
m_chkCount=new Checkbox[DisplayItems.size()];
m_chkMin=new Checkbox[DisplayItems.size()];
m_chkMax=new Checkbox[DisplayItems.size()];
m_chkMean=new Checkbox[DisplayItems.size()];
m_chkVariance=new Checkbox[DisplayItems.size()];
m_chkDesviation=new Checkbox[DisplayItems.size()];
for(int i=0 ;i<DisplayItems.size(); i++){
row=new Row();
String strValue = DisplayItems.get(i).getPrintName();
if(strValue ==null || strValue.length()==0){
strValue = DisplayItems.get(i).getName();
}
Label field=new Label(strValue);
row.appendChild(field);
m_chkSum[i]=new Checkbox();
m_chkSum[i].setChecked(DisplayItems.get(i).isSummarized());
m_chkSum[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkSum[i]);
m_chkCount[i]=new Checkbox();
m_chkCount[i].setChecked(DisplayItems.get(i).isCounted());
m_chkCount[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkCount[i]);
m_chkMin[i]=new Checkbox();
m_chkMin[i].setChecked(DisplayItems.get(i).isMinCalc());
m_chkMin[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkMin[i]);
m_chkMax[i]=new Checkbox();
m_chkMax[i].setChecked(DisplayItems.get(i).isMaxCalc());
m_chkMax[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkMax[i]);
m_chkMean[i]=new Checkbox();
m_chkMean[i].setChecked(DisplayItems.get(i).isAveraged());
m_chkMean[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkMean[i]);
m_chkVariance[i]=new Checkbox();
m_chkVariance[i].setChecked(DisplayItems.get(i).isVarianceCalc());
m_chkVariance[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkVariance[i]);
m_chkDesviation[i]=new Checkbox();
m_chkDesviation[i].setChecked(DisplayItems.get(i).isDeviationCalc());
m_chkDesviation[i].addEventListener(Events.ON_CHECK, this);
row.appendChild(m_chkDesviation[i]);
rows.appendChild(row);
}
grid.appendChild(rows);
}
}

View File

@ -0,0 +1,48 @@
/******************************************************************************
* 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.apps.form.WReportCustomization;
import org.adempiere.webui.component.Tabpanel;
import org.compiere.print.MPrintFormat;
import org.compiere.print.MPrintFormatItem;
public abstract class WRCTabPanel extends Tabpanel {
/**
*
*/
private static final long serialVersionUID = -6858669581232541371L;
public MPrintFormatItem[] m_pfi;
public MPrintFormat m_pf;
public WReportCustomization wc;
public abstract void refresh();
public abstract void updatePFI();
public void setMPrintFormat(MPrintFormat pf) {
m_pf=pf;
}
public void setPrintFormatItems(MPrintFormatItem[] pfis) {
m_pfi = pfis;
}
public void setWReportCustomization(WReportCustomization parent){
wc=parent;
}
}

View File

@ -35,6 +35,7 @@ import org.adempiere.pdf.Document;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.WReport;
import org.adempiere.webui.apps.form.WReportCustomization;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label;
@ -48,6 +49,7 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.DrillEvent;
import org.adempiere.webui.event.ZoomEvent;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.ITabOnCloseHandler;
import org.adempiere.webui.panel.StatusBarPanel;
import org.adempiere.webui.report.HTMLExtension;
@ -61,6 +63,7 @@ import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
import org.compiere.model.MToolBarButtonRestrict;
import org.compiere.model.MUser;
import org.compiere.model.SystemIDs;
import org.compiere.model.X_AD_ToolBarButton;
import org.compiere.print.ArchiveEngine;
import org.compiere.print.MPrintFormat;
@ -151,6 +154,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, 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<Event>, 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<Event>, 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<Event>, 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<Event>, 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();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB