Merge with c7817574afdfe577790aaa5144f192cf953dcda4
This commit is contained in:
commit
ad5d338dfd
|
@ -1,12 +1,12 @@
|
|||
CREATE OR REPLACE PROCEDURE C_Order_DrillDown
|
||||
CREATE OR REPLACE PROCEDURE C_ORDER_DRILLDOWN
|
||||
(
|
||||
PInstance_ID IN NUMBER
|
||||
)
|
||||
/******************************************************************************
|
||||
* ** Adempiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA
|
||||
* ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA
|
||||
* Open Source Software Provided "AS IS" without warranty or liability
|
||||
* When you use any parts (changed or unchanged), add "Powered by Adempiere" to
|
||||
* your product name; See license details http://www.adempiere.org/license.html
|
||||
* When you use any parts (changed or unchanged), add "Powered by Compiere" to
|
||||
* your product name; See license details http://www.compiere.org/license.html
|
||||
******************************************************************************
|
||||
* List Orders with their Shipments and Invoices
|
||||
* Spool to T_Spool
|
||||
|
@ -58,7 +58,7 @@ BEGIN
|
|||
-- Order Info
|
||||
FOR o IN Cur_Order LOOP
|
||||
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, T_Spool_Seq.NextVal,
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
o.Name || ' ' || o.DocumentNo || ': @DocStatus@=' || o.DocStatus
|
||||
|| ', @DocAction@=' || o.DocAction || ', @Processed@=' || o.Processed);
|
||||
|
||||
|
@ -71,7 +71,7 @@ BEGIN
|
|||
ORDER BY Line;
|
||||
BEGIN
|
||||
FOR ol IN Cur_OrderLine LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, T_Spool_Seq.NextVal,
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
' @QtyOrdered@=' || ol.QtyOrdered || ', @QtyReserved@=' || ol.QtyReserved
|
||||
|| ', @QtyDelivered@=' || ol.QtyDelivered || ', @QtyInvoiced@=' || ol.QtyInvoiced
|
||||
|| ' - Wh=' || ol.M_Warehouse_ID
|
||||
|
@ -88,7 +88,7 @@ BEGIN
|
|||
AND s.C_DocType_ID=d.C_DocType_ID;
|
||||
BEGIN
|
||||
FOR s IN Cur_InOut LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, T_Spool_Seq.NextVal,
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
'> ' || s.Name || ' ' || s.DocumentNo || ': @DocStatus@=' || s.DocStatus
|
||||
|| ', @Processed@=' || s.Processed || ', Wh=' || s.M_Warehouse_ID);
|
||||
|
||||
|
@ -101,7 +101,7 @@ BEGIN
|
|||
ORDER BY Line;
|
||||
BEGIN
|
||||
FOR sl IN Cur_InOutLine LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, T_Spool_Seq.NextVal,
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
' @QtyDelivered@=' || sl.MovementQty || ', Prd=' || sl.M_Product_ID);
|
||||
END LOOP;
|
||||
END; -- Shipment Lines
|
||||
|
@ -121,7 +121,7 @@ BEGIN
|
|||
BEGIN
|
||||
FOR i IN Cur_Invoice LOOP
|
||||
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, T_Spool_Seq.NextVal,
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
'> ' || i.Name || ' ' || i.DocumentNo || ': @DocStatus@=' || i.DocStatus
|
||||
|| ', @Processed@=' || i.Processed);
|
||||
|
||||
|
@ -134,7 +134,7 @@ BEGIN
|
|||
ORDER BY Line;
|
||||
BEGIN
|
||||
FOR il IN Cur_InvoiceLine LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, T_Spool_Seq.NextVal,
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
' @QtyInvoiced@=' || il.QtyInvoiced || ', Prd=' || il.M_Product_ID);
|
||||
END LOOP;
|
||||
END; -- Invoice Lines
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Oct 22, 2012 3:47:39 PM SGT
|
||||
-- IDEMPIERE-462 Ticket #1001503: Credit Cards Online
|
||||
INSERT INTO AD_Table (IsSecurityEnabled,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsView,IsChangeLog,EntityType,ReplicationType,AD_Table_UU,IsCentrallyMaintained,IsDeleteable,TableName,Description,Name,AD_Client_ID,IsActive,AD_Org_ID,Updated,CreatedBy,UpdatedBy,Created) VALUES ('N','1',105,200031,'N','N','N','D','L','32bb4613-d058-44fb-9e5c-01f060281cc9','Y','Y','C_PaymentTransaction','Payment Transaction','Payment Transaction',0,'Y',0,TO_DATE('2012-10-22 15:47:37','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2012-10-22 15:47:37','YYYY-MM-DD HH24:MI:SS'))
|
||||
|
@ -1287,7 +1290,86 @@ UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2012-10-22 15:56:20','YYYY-
|
|||
|
||||
-- Oct 22, 2012 3:56:35 PM SGT
|
||||
-- IDEMPIERE-462 Ticket #1001503: Credit Cards Online
|
||||
CREATE TABLE C_PaymentTransaction (A_City NVARCHAR2(60) DEFAULT NULL , A_Country NVARCHAR2(40) DEFAULT NULL , A_EMail NVARCHAR2(60) DEFAULT NULL , A_Ident_DL NVARCHAR2(20) DEFAULT NULL , A_Ident_SSN NVARCHAR2(20) DEFAULT NULL , A_Name NVARCHAR2(60) DEFAULT NULL , A_State NVARCHAR2(40) DEFAULT NULL , A_Street NVARCHAR2(60) DEFAULT NULL , A_Zip NVARCHAR2(20) DEFAULT NULL , AccountNo NVARCHAR2(20) DEFAULT NULL , AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, AD_OrgTrx_ID NUMBER(10) DEFAULT NULL , C_Activity_ID NUMBER(10) DEFAULT NULL , C_BankAccount_ID NUMBER(10) DEFAULT NULL , C_BP_BankAccount_ID NUMBER(10) DEFAULT NULL , C_BPartner_ID NUMBER(10) NOT NULL, C_Campaign_ID NUMBER(10) DEFAULT NULL , C_CashBook_ID NUMBER(10) DEFAULT NULL , C_Charge_ID NUMBER(10) DEFAULT NULL , C_ConversionType_ID NUMBER(10) DEFAULT NULL , C_Currency_ID NUMBER(10) NOT NULL, C_DocType_ID NUMBER(10) NOT NULL, C_Invoice_ID NUMBER(10) DEFAULT NULL , C_Order_ID NUMBER(10) DEFAULT NULL , C_Payment_ID NUMBER(10) DEFAULT NULL , C_PaymentBatch_ID NUMBER(10) DEFAULT NULL , C_PaymentProcessor_ID NUMBER(10) DEFAULT NULL , C_PaymentTransaction_ID NUMBER(10) NOT NULL, C_PaymentTransaction_UU NVARCHAR2(36) DEFAULT NULL , C_POSTenderType_ID NUMBER(10) DEFAULT NULL , C_Project_ID NUMBER(10) DEFAULT NULL , CheckNo NVARCHAR2(20) DEFAULT NULL , Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, CreditCardExpMM NUMBER(10) DEFAULT 1, CreditCardExpYY NUMBER(10) DEFAULT 03, CreditCardNumber NVARCHAR2(20) DEFAULT NULL , CreditCardType CHAR(1) DEFAULT 'M', CreditCardVV NVARCHAR2(4) DEFAULT NULL , CustomerAddressID NVARCHAR2(60) DEFAULT NULL , CustomerPaymentProfileID NVARCHAR2(60) DEFAULT NULL , CustomerProfileID NVARCHAR2(60) DEFAULT NULL , DateTrx DATE NOT NULL, Description NVARCHAR2(255) DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, IsApproved CHAR(1) DEFAULT 'N' CHECK (IsApproved IN ('Y','N')) NOT NULL, IsDelayedCapture CHAR(1) CHECK (IsDelayedCapture IN ('Y','N')) NOT NULL, IsOnline CHAR(1) CHECK (IsOnline IN ('Y','N')) NOT NULL, IsReceipt CHAR(1) CHECK (IsReceipt IN ('Y','N')) NOT NULL, IsSelfService CHAR(1) CHECK (IsSelfService IN ('Y','N')) NOT NULL, IsVoided CHAR(1) DEFAULT 'N' CHECK (IsVoided IN ('Y','N')) NOT NULL, Micr NVARCHAR2(20) DEFAULT NULL , Orig_TrxID NVARCHAR2(20) DEFAULT NULL , PayAmt NUMBER DEFAULT 0 NOT NULL, PONum NVARCHAR2(60) DEFAULT NULL , R_AuthCode NVARCHAR2(20) DEFAULT NULL , R_AvsAddr CHAR(1) DEFAULT NULL , R_AvsZip CHAR(1) DEFAULT NULL , R_CVV2Match CHAR(1) DEFAULT NULL CHECK (R_CVV2Match IN ('Y','N')), R_Info NVARCHAR2(2000) DEFAULT NULL , R_PnRef NVARCHAR2(20) DEFAULT NULL , R_RespMsg NVARCHAR2(60) DEFAULT NULL , R_Result NVARCHAR2(20) DEFAULT NULL , R_VoidMsg NVARCHAR2(255) DEFAULT NULL , Ref_PaymentTransaction_ID NUMBER(10) DEFAULT NULL , RoutingNo NVARCHAR2(20) DEFAULT NULL , TaxAmt NUMBER DEFAULT NULL , TenderType CHAR(1) DEFAULT 'K' NOT NULL, TrxType CHAR(1) DEFAULT 'S' NOT NULL, Updated DATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, User1_ID NUMBER(10) DEFAULT NULL , User2_ID NUMBER(10) DEFAULT NULL , VoiceAuthCode NVARCHAR2(20) DEFAULT NULL , VoidIt CHAR(1) DEFAULT NULL , CONSTRAINT C_PaymentTransaction_Key PRIMARY KEY (C_PaymentTransaction_ID))
|
||||
CREATE TABLE c_paymenttransaction
|
||||
(
|
||||
a_city NVARCHAR2(60) DEFAULT NULL,
|
||||
a_country NVARCHAR2(40) DEFAULT NULL,
|
||||
a_email NVARCHAR2(60) DEFAULT NULL,
|
||||
a_ident_dl NVARCHAR2(20) DEFAULT NULL,
|
||||
a_ident_ssn NVARCHAR2(20) DEFAULT NULL,
|
||||
a_name NVARCHAR2(60) DEFAULT NULL,
|
||||
a_state NVARCHAR2(40) DEFAULT NULL,
|
||||
a_street NVARCHAR2(60) DEFAULT NULL,
|
||||
a_zip NVARCHAR2(20) DEFAULT NULL,
|
||||
accountno NVARCHAR2(20) DEFAULT NULL,
|
||||
ad_client_id NUMBER(10) NOT NULL,
|
||||
ad_org_id NUMBER(10) NOT NULL,
|
||||
ad_orgtrx_id NUMBER(10) DEFAULT NULL,
|
||||
c_activity_id NUMBER(10) DEFAULT NULL,
|
||||
c_bankaccount_id NUMBER(10) DEFAULT NULL,
|
||||
c_bp_bankaccount_id NUMBER(10) DEFAULT NULL,
|
||||
c_bpartner_id NUMBER(10) NOT NULL,
|
||||
c_campaign_id NUMBER(10) DEFAULT NULL,
|
||||
c_cashbook_id NUMBER(10) DEFAULT NULL,
|
||||
c_charge_id NUMBER(10) DEFAULT NULL,
|
||||
c_conversiontype_id NUMBER(10) DEFAULT NULL,
|
||||
c_currency_id NUMBER(10) NOT NULL,
|
||||
c_doctype_id NUMBER(10) NOT NULL,
|
||||
c_invoice_id NUMBER(10) DEFAULT NULL,
|
||||
c_order_id NUMBER(10) DEFAULT NULL,
|
||||
c_payment_id NUMBER(10) DEFAULT NULL,
|
||||
c_paymentbatch_id NUMBER(10) DEFAULT NULL,
|
||||
c_paymentprocessor_id NUMBER(10) DEFAULT NULL,
|
||||
c_paymenttransaction_id NUMBER(10) NOT NULL,
|
||||
c_paymenttransaction_uu NVARCHAR2(36) DEFAULT NULL,
|
||||
c_postendertype_id NUMBER(10) DEFAULT NULL,
|
||||
c_project_id NUMBER(10) DEFAULT NULL,
|
||||
checkno NVARCHAR2(20) DEFAULT NULL,
|
||||
created DATE NOT NULL,
|
||||
createdby NUMBER(10) NOT NULL,
|
||||
creditcardexpmm NUMBER(10) DEFAULT 1,
|
||||
creditcardexpyy NUMBER(10) DEFAULT 03,
|
||||
creditcardnumber NVARCHAR2(20) DEFAULT NULL,
|
||||
creditcardtype CHAR(1) DEFAULT 'M',
|
||||
creditcardvv NVARCHAR2(4) DEFAULT NULL,
|
||||
customeraddressid NVARCHAR2(60) DEFAULT NULL,
|
||||
customerpaymentprofileid NVARCHAR2(60) DEFAULT NULL,
|
||||
customerprofileid NVARCHAR2(60) DEFAULT NULL,
|
||||
datetrx DATE NOT NULL,
|
||||
description NVARCHAR2(255) DEFAULT NULL,
|
||||
isactive CHAR(1) DEFAULT 'Y' CHECK (isactive IN ('Y', 'N')) NOT NULL,
|
||||
isapproved CHAR(1) DEFAULT 'N' CHECK (isapproved IN ('Y', 'N')) NOT NULL,
|
||||
isdelayedcapture CHAR(1) CHECK (isdelayedcapture IN ('Y', 'N')) NOT NULL,
|
||||
isonline CHAR(1) CHECK (isonline IN ('Y', 'N')) NOT NULL,
|
||||
isreceipt CHAR(1) CHECK (isreceipt IN ('Y', 'N')) NOT NULL,
|
||||
isselfservice CHAR(1) CHECK (isselfservice IN ('Y', 'N')) NOT NULL,
|
||||
isvoided CHAR(1) DEFAULT 'N' CHECK (isvoided IN ('Y', 'N')) NOT NULL,
|
||||
micr NVARCHAR2(20) DEFAULT NULL,
|
||||
orig_trxid NVARCHAR2(20) DEFAULT NULL,
|
||||
payamt NUMBER DEFAULT 0 NOT NULL,
|
||||
ponum NVARCHAR2(60) DEFAULT NULL,
|
||||
r_authcode NVARCHAR2(20) DEFAULT NULL,
|
||||
r_avsaddr CHAR(1) DEFAULT NULL,
|
||||
r_avszip CHAR(1) DEFAULT NULL,
|
||||
r_cvv2match CHAR(1) DEFAULT NULL CHECK (r_cvv2match IN ('Y', 'N')),
|
||||
r_info NVARCHAR2(2000) DEFAULT NULL,
|
||||
r_pnref NVARCHAR2(20) DEFAULT NULL,
|
||||
r_respmsg NVARCHAR2(60) DEFAULT NULL,
|
||||
r_result NVARCHAR2(20) DEFAULT NULL,
|
||||
r_voidmsg NVARCHAR2(255) DEFAULT NULL,
|
||||
ref_paymenttransaction_id NUMBER(10) DEFAULT NULL,
|
||||
routingno NVARCHAR2(20) DEFAULT NULL,
|
||||
taxamt NUMBER DEFAULT NULL,
|
||||
tendertype CHAR(1) DEFAULT 'K' NOT NULL,
|
||||
trxtype CHAR(1) DEFAULT 'S' NOT NULL,
|
||||
updated DATE NOT NULL,
|
||||
updatedby NUMBER(10) NOT NULL,
|
||||
user1_id NUMBER(10) DEFAULT NULL,
|
||||
user2_id NUMBER(10) DEFAULT NULL,
|
||||
voiceauthcode NVARCHAR2(20) DEFAULT NULL,
|
||||
voidit CHAR(1) DEFAULT NULL,
|
||||
CONSTRAINT c_paymenttransaction_key PRIMARY KEY (c_paymenttransaction_id)
|
||||
)
|
||||
;
|
||||
|
||||
-- Oct 22, 2012 3:57:37 PM SGT
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
CREATE OR REPLACE PROCEDURE C_ORDER_DRILLDOWN
|
||||
(
|
||||
PInstance_ID IN NUMBER
|
||||
)
|
||||
/******************************************************************************
|
||||
* ** Compiere Product ** Copyright (c) 1999-2001 Accorto, Inc. USA
|
||||
* Open Source Software Provided "AS IS" without warranty or liability
|
||||
* When you use any parts (changed or unchanged), add "Powered by Compiere" to
|
||||
* your product name; See license details http://www.compiere.org/license.html
|
||||
******************************************************************************
|
||||
* List Orders with their Shipments and Invoices
|
||||
* Spool to T_Spool
|
||||
*/
|
||||
AS
|
||||
ResultStr VARCHAR2(2000);
|
||||
Message VARCHAR2(2000);
|
||||
Record_ID NUMBER;
|
||||
CURSOR Cur_Parameter (PInstance NUMBER) IS
|
||||
SELECT i.Record_ID, p.ParameterName, p.P_String, p.P_Number, p.P_Date
|
||||
FROM AD_PInstance i, AD_PInstance_Para p
|
||||
WHERE i.AD_PInstance_ID=PInstance
|
||||
AND i.AD_PInstance_ID=p.AD_PInstance_ID(+)
|
||||
ORDER BY p.SeqNo;
|
||||
-- Parameter
|
||||
C_Order_ID NUMBER;
|
||||
--
|
||||
CURSOR Cur_Order IS
|
||||
SELECT o.C_Order_ID, d.Name, o.DocumentNo, o.DocStatus, o.DocAction, o.Processed
|
||||
FROM C_Order o, C_DocType d
|
||||
WHERE o.C_Order_ID=C_Order_ID
|
||||
AND o.C_DocType_ID=d.C_DocType_ID
|
||||
ORDER BY o.DocumentNo DESC;
|
||||
|
||||
BEGIN
|
||||
-- No locking or Updating
|
||||
|
||||
-- Get Parameters
|
||||
ResultStr := 'ReadingParameters';
|
||||
FOR p IN Cur_Parameter (PInstance_ID) LOOP
|
||||
Record_ID := p.Record_ID;
|
||||
IF (p.ParameterName = 'C_Order_ID') THEN
|
||||
C_Order_ID := p.P_Number;
|
||||
DBMS_OUTPUT.PUT_LINE(' C_Order_ID=' || C_Order_ID);
|
||||
ELSE
|
||||
DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || p.ParameterName);
|
||||
END IF;
|
||||
END LOOP; -- Get Parameter
|
||||
DBMS_OUTPUT.PUT_LINE(' Record_ID=' || Record_ID);
|
||||
|
||||
IF (C_Order_ID IS NULL) THEN
|
||||
C_Order_ID := Record_ID;
|
||||
END IF;
|
||||
|
||||
-- Should be nothing there
|
||||
DELETE T_Spool
|
||||
WHERE AD_PInstance_ID=PInstance_ID;
|
||||
|
||||
-- Order Info
|
||||
FOR o IN Cur_Order LOOP
|
||||
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
o.Name || ' ' || o.DocumentNo || ': @DocStatus@=' || o.DocStatus
|
||||
|| ', @DocAction@=' || o.DocAction || ', @Processed@=' || o.Processed);
|
||||
|
||||
-- Order Lines
|
||||
DECLARE
|
||||
CURSOR Cur_OrderLine IS
|
||||
SELECT *
|
||||
FROM C_OrderLine
|
||||
WHERE C_Order_ID=o.C_Order_ID
|
||||
ORDER BY Line;
|
||||
BEGIN
|
||||
FOR ol IN Cur_OrderLine LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
' @QtyOrdered@=' || ol.QtyOrdered || ', @QtyReserved@=' || ol.QtyReserved
|
||||
|| ', @QtyDelivered@=' || ol.QtyDelivered || ', @QtyInvoiced@=' || ol.QtyInvoiced
|
||||
|| ' - Wh=' || ol.M_Warehouse_ID
|
||||
|| ', Prd=' || ol.M_Product_ID);
|
||||
END LOOP;
|
||||
END;
|
||||
|
||||
-- Shipment
|
||||
DECLARE
|
||||
CURSOR Cur_InOut IS
|
||||
SELECT s.M_InOut_ID, d.Name, s.DocumentNo, s.DocStatus, s.Processed, s.M_Warehouse_ID
|
||||
FROM M_InOut s, C_DocType d
|
||||
WHERE s.C_Order_ID = o.C_Order_ID
|
||||
AND s.C_DocType_ID=d.C_DocType_ID;
|
||||
BEGIN
|
||||
FOR s IN Cur_InOut LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
'> ' || s.Name || ' ' || s.DocumentNo || ': @DocStatus@=' || s.DocStatus
|
||||
|| ', @Processed@=' || s.Processed || ', Wh=' || s.M_Warehouse_ID);
|
||||
|
||||
-- Shipment Lines
|
||||
DECLARE
|
||||
CURSOR Cur_InOutLine IS
|
||||
SELECT *
|
||||
FROM M_InOutLine
|
||||
WHERE M_InOut_ID=s.M_InOut_ID
|
||||
ORDER BY Line;
|
||||
BEGIN
|
||||
FOR sl IN Cur_InOutLine LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
' @QtyDelivered@=' || sl.MovementQty || ', Prd=' || sl.M_Product_ID);
|
||||
END LOOP;
|
||||
END; -- Shipment Lines
|
||||
END LOOP; -- Shipments
|
||||
END; -- Shipment
|
||||
|
||||
-- Invoice
|
||||
DECLARE
|
||||
CURSOR Cur_Invoice IS
|
||||
SELECT i.C_Invoice_ID, d.Name, i.DocumentNo, i.DocStatus, i.Processed
|
||||
FROM C_Invoice i, C_DocType d
|
||||
WHERE i.C_DocType_ID=d.C_DocType_ID
|
||||
AND EXISTS (SELECT * FROM C_InvoiceLine l, C_OrderLine ol
|
||||
WHERE i.C_Invoice_ID = l.C_Invoice_ID
|
||||
AND l.C_OrderLine_ID = ol.C_OrderLine_ID
|
||||
AND ol.C_Order_ID=o.C_Order_ID);
|
||||
BEGIN
|
||||
FOR i IN Cur_Invoice LOOP
|
||||
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
'> ' || i.Name || ' ' || i.DocumentNo || ': @DocStatus@=' || i.DocStatus
|
||||
|| ', @Processed@=' || i.Processed);
|
||||
|
||||
-- Invoice Lines
|
||||
DECLARE
|
||||
CURSOR Cur_InvoiceLine IS
|
||||
SELECT *
|
||||
FROM C_InvoiceLine
|
||||
WHERE C_Invoice_ID=i.C_Invoice_ID
|
||||
ORDER BY Line;
|
||||
BEGIN
|
||||
FOR il IN Cur_InvoiceLine LOOP
|
||||
INSERT INTO T_Spool (AD_PInstance_ID, SeqNo, MsgText) VALUES (PInstance_ID, nextidfunc(1173, 'N'),
|
||||
' @QtyInvoiced@=' || il.QtyInvoiced || ', Prd=' || il.M_Product_ID);
|
||||
END LOOP;
|
||||
END; -- Invoice Lines
|
||||
END LOOP; -- Invoices
|
||||
END; -- Invoice
|
||||
|
||||
END LOOP; -- Order
|
||||
|
||||
|
||||
<<FINISH_PROCESS>>
|
||||
-- Update AD_PInstance
|
||||
DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || Message);
|
||||
UPDATE AD_PInstance
|
||||
SET Updated = SysDate,
|
||||
IsProcessing = 'N',
|
||||
Result = 1, -- success
|
||||
ErrorMsg = Message
|
||||
WHERE AD_PInstance_ID=PInstance_ID;
|
||||
COMMIT;
|
||||
RETURN;
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
ResultStr := ResultStr || ': ' || SQLERRM || ' - ' || Message;
|
||||
DBMS_OUTPUT.PUT_LINE(ResultStr);
|
||||
UPDATE AD_PInstance
|
||||
SET Updated = SysDate,
|
||||
IsProcessing = 'N',
|
||||
Result = 0, -- failure
|
||||
ErrorMsg = ResultStr
|
||||
WHERE AD_PInstance_ID=PInstance_ID;
|
||||
COMMIT;
|
||||
RETURN;
|
||||
|
||||
END C_Order_DrillDown;
|
||||
/
|
||||
|
||||
SELECT register_migration_script('201211070846_IDEMPIERE-422.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
-- just for oracle
|
||||
|
||||
SELECT register_migration_script('201211070846_IDEMPIERE-422.sql') FROM dual
|
||||
;
|
||||
|
|
@ -289,6 +289,6 @@ Import-Package: com.sun.mail.auth;version="1.4.5",
|
|||
Eclipse-BuddyPolicy: registered
|
||||
Eclipse-ExtensibleAPI: true
|
||||
Bundle-Activator: org.adempiere.base.BaseActivator
|
||||
Service-Component: OSGI-INF/eventmanager.xml, OSGI-INF/dslocator.xml, OSGI-INF/extensionlocator.xml, OSGI-INF/serverbean.xml, OSGI-INF/statusbean.xml
|
||||
Service-Component: OSGI-INF/eventmanager.xml, OSGI-INF/dslocator.xml, OSGI-INF/extensionlocator.xml, OSGI-INF/serverbean.xml, OSGI-INF/statusbean.xml, OSGI-INF/defaultmodelfactory.xml, OSGI-INF/defaultdocfactory.xml
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Require-Bundle: org.eclipse.equinox.app;bundle-version="1.3.1"
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.doc.factory">
|
||||
<implementation class="org.adempiere.base.DefaultDocumentFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IDocFactory"/>
|
||||
</service>
|
||||
<property name="gaap" type="String" value="*"/>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.model.factory">
|
||||
<implementation class="org.adempiere.base.DefaultModelFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IModelFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -20,7 +20,9 @@ bin.includes = META-INF/,\
|
|||
OSGI-INF/dslocator.xml,\
|
||||
OSGI-INF/extensionlocator.xml,\
|
||||
OSGI-INF/serverbean.xml,\
|
||||
OSGI-INF/statusbean.xml
|
||||
OSGI-INF/statusbean.xml,\
|
||||
OSGI-INF/defaultmodelfactory.xml,\
|
||||
OSGI-INF/defaultdocfactory.xml
|
||||
output.base.jar = build/
|
||||
src.includes = schema/
|
||||
source.base.jar = src/
|
||||
|
|
|
@ -15,25 +15,6 @@
|
|||
<extension-point id="org.adempiere.base.IGridTabImporter" name="Grid data import extension" schema="schema/org.adempiere.base.IGridTabImporter.exsd"/>
|
||||
<extension-point id="org.compiere.model.PaymentProcessor" name="Payment Processor" schema="schema/org.compiere.model.PaymentProcessor.exsd"/>
|
||||
<extension-point id="org.compiere.model.Callout" name="Callout" schema="schema/org.compiere.model.Callout.exsd"/>
|
||||
<extension
|
||||
id="org.adempiere.base.DefaultModelFactory"
|
||||
name="Default model factory"
|
||||
point="org.adempiere.base.IModelFactory">
|
||||
<factory
|
||||
class="org.adempiere.base.DefaultModelFactory"
|
||||
priority="0">
|
||||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.base.DefaultDocFactory"
|
||||
name="Default Document Factory"
|
||||
point="org.adempiere.base.IDocFactory">
|
||||
<factory
|
||||
class="org.adempiere.base.DefaultDocumentFactory"
|
||||
gaap="*"
|
||||
priority="0">
|
||||
</factory>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.impexp.GridTabXlsExporter"
|
||||
name="Grid data excel exporter"
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.util.List;
|
|||
import org.adempiere.base.Service;
|
||||
import org.adempiere.base.ServiceQuery;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* General Database Constants and Utilities
|
||||
|
@ -67,14 +65,11 @@ public class Database
|
|||
public static String[] getDatabaseNames()
|
||||
{
|
||||
List<String> names = new ArrayList<String>();
|
||||
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(AdempiereDatabase.class.getName());
|
||||
for(IConfigurationElement element : elements)
|
||||
{
|
||||
String type = element.getAttribute("id");
|
||||
names.add(type);
|
||||
List<AdempiereDatabase> services = Service.locator().list(AdempiereDatabase.class).getServices();
|
||||
for (AdempiereDatabase db : services) {
|
||||
names.add(db.getName());
|
||||
}
|
||||
String[] nameArray = names.toArray(new String[0]);
|
||||
return nameArray;
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1773,6 +1773,32 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
{
|
||||
MInvoiceLine line = lines[i];
|
||||
|
||||
// Matching - Inv-Shipment
|
||||
if (!isSOTrx()
|
||||
&& line.getM_InOutLine_ID() != 0
|
||||
&& line.getM_Product_ID() != 0
|
||||
&& !isReversal())
|
||||
{
|
||||
MInOutLine receiptLine = new MInOutLine (getCtx(),line.getM_InOutLine_ID(), get_TrxName());
|
||||
BigDecimal matchQty = line.getQtyInvoiced();
|
||||
|
||||
if (receiptLine.getMovementQty().compareTo(matchQty) < 0)
|
||||
matchQty = receiptLine.getMovementQty();
|
||||
|
||||
MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty);
|
||||
boolean isNewMatchInv = false;
|
||||
if (inv.get_ID() == 0)
|
||||
isNewMatchInv = true;
|
||||
if (!inv.save(get_TrxName()))
|
||||
{
|
||||
m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching");
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
matchInv++;
|
||||
if (isNewMatchInv)
|
||||
addDocsPostProcess(inv);
|
||||
}
|
||||
|
||||
// Update Order Line
|
||||
MOrderLine ol = null;
|
||||
if (line.getC_OrderLine_ID() != 0)
|
||||
|
@ -1826,33 +1852,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
// Matching - Inv-Shipment
|
||||
if (!isSOTrx()
|
||||
&& line.getM_InOutLine_ID() != 0
|
||||
&& line.getM_Product_ID() != 0
|
||||
&& !isReversal())
|
||||
{
|
||||
MInOutLine receiptLine = new MInOutLine (getCtx(),line.getM_InOutLine_ID(), get_TrxName());
|
||||
BigDecimal matchQty = line.getQtyInvoiced();
|
||||
|
||||
if (receiptLine.getMovementQty().compareTo(matchQty) < 0)
|
||||
matchQty = receiptLine.getMovementQty();
|
||||
|
||||
MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty);
|
||||
boolean isNewMatchInv = false;
|
||||
if (inv.get_ID() == 0)
|
||||
isNewMatchInv = true;
|
||||
if (!inv.save(get_TrxName()))
|
||||
{
|
||||
m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching");
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
matchInv++;
|
||||
if (isNewMatchInv)
|
||||
addDocsPostProcess(inv);
|
||||
}
|
||||
//
|
||||
} // for all lines
|
||||
if (matchInv > 0)
|
||||
info.append(" @M_MatchInv_ID@#").append(matchInv).append(" ");
|
||||
|
|
|
@ -536,6 +536,7 @@ public class Trx implements VetoableChangeListener
|
|||
*
|
||||
* @param trxName transaction name (if null, a new transaction will be created)
|
||||
* @param r runnable object
|
||||
* @throws RuntimeException or {@link AdempiereException}
|
||||
*/
|
||||
public static void run(String trxName, TrxRunnable r)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
|
|
|
@ -9,3 +9,4 @@ Require-Bundle: org.adempiere.server;bundle-version="1.0.0",
|
|||
org.adempiere.base;bundle-version="1.0.0"
|
||||
Import-Package: javax.jms;version="1.1.0",
|
||||
org.apache.activemq
|
||||
Service-Component: OSGI-INF/serverfactory.xml
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.replication.server.factory">
|
||||
<implementation class="org.adempiere.server.rpl.imp.ReplicationServerFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -1,5 +1,6 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
plugin.xml,\
|
||||
OSGI-INF/serverfactory.xml
|
||||
source.. = src/
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.adempiere.server.IServerFactory">
|
||||
<factory
|
||||
class="org.adempiere.server.rpl.imp.ReplicationServerFactory">
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -13,59 +13,21 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.ui.zk.example.action;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.adempiere.base.IGridTabExporter;
|
||||
import org.adempiere.base.Service;
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.webui.action.IAction;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.adwindow.AbstractADWindowContent;
|
||||
import org.adempiere.webui.adwindow.IADTabbox;
|
||||
import org.adempiere.webui.adwindow.IADTabpanel;
|
||||
import org.adempiere.webui.adwindow.ADWindowContent;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListItem;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Filedownload;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class ExportAction implements IAction, EventListener<Event> {
|
||||
public class ExportAction implements IAction {
|
||||
|
||||
private AbstractADWindowContent panel;
|
||||
|
||||
private Map<String, IGridTabExporter> exporterMap = null;
|
||||
private Map<String, String> extensionMap = null;
|
||||
|
||||
private Window winExportFile = null;
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private Listbox cboType = new Listbox();
|
||||
private Checkbox chkCurrentRow = new Checkbox();
|
||||
/**
|
||||
*
|
||||
* default constructor
|
||||
*/
|
||||
public ExportAction() {
|
||||
}
|
||||
|
@ -76,143 +38,20 @@ public class ExportAction implements IAction, EventListener<Event> {
|
|||
@Override
|
||||
public void execute(Object target) {
|
||||
ADWindow adwindow = (ADWindow) target;
|
||||
panel = adwindow.getADWindowContent();
|
||||
ADWindowContent panel = adwindow.getADWindowContent();
|
||||
|
||||
if (!MRole.getDefault().isCanExport()) {
|
||||
FDialog.error(panel.getWindowNo(), "AccessTableNoView");
|
||||
return;
|
||||
}
|
||||
|
||||
doExport();
|
||||
doExport(panel);
|
||||
}
|
||||
|
||||
private void doExport() {
|
||||
exporterMap = new HashMap<String, IGridTabExporter>();
|
||||
extensionMap = new HashMap<String, String>();
|
||||
List<IGridTabExporter> exporterList = Service.locator().list(IGridTabExporter.class).getServices();
|
||||
for(IGridTabExporter exporter : exporterList)
|
||||
{
|
||||
String extension = exporter.getFileExtension();
|
||||
if (!extensionMap.containsKey(extension))
|
||||
{
|
||||
extensionMap.put(extension, exporter.getFileExtensionLabel());
|
||||
exporterMap.put(extension, exporter);
|
||||
}
|
||||
}
|
||||
|
||||
if(winExportFile == null)
|
||||
{
|
||||
winExportFile = new Window();
|
||||
winExportFile.setTitle(Msg.getMsg(Env.getCtx(), "Export") + ": " + panel.getActiveGridTab().getName());
|
||||
winExportFile.setWidth("450px");
|
||||
winExportFile.setClosable(true);
|
||||
winExportFile.setBorder("normal");
|
||||
winExportFile.setStyle("position:absolute");
|
||||
|
||||
cboType.setMold("select");
|
||||
|
||||
cboType.getItems().clear();
|
||||
for(Map.Entry<String, String> entry : extensionMap.entrySet())
|
||||
{
|
||||
cboType.appendItem(entry.getKey() + " - " + entry.getValue(), entry.getKey());
|
||||
}
|
||||
|
||||
cboType.setSelectedIndex(0);
|
||||
|
||||
Vbox vb = new Vbox();
|
||||
vb.setWidth("100%");
|
||||
winExportFile.appendChild(vb);
|
||||
|
||||
Hbox hb = new Hbox();
|
||||
Div div = new Div();
|
||||
div.setAlign("right");
|
||||
div.appendChild(new Label("Files of Type: "));
|
||||
hb.appendChild(div);
|
||||
hb.appendChild(cboType);
|
||||
cboType.setWidth("100%");
|
||||
vb.appendChild(hb);
|
||||
|
||||
hb = new Hbox();
|
||||
chkCurrentRow.setLabel(Msg.getMsg(Env.getCtx(), "ExportCurrentRowOnly"));
|
||||
chkCurrentRow.setSelected(true);
|
||||
hb.appendChild(chkCurrentRow);
|
||||
vb.appendChild(hb);
|
||||
|
||||
vb.appendChild(confirmPanel);
|
||||
confirmPanel.addActionListener(this);
|
||||
}
|
||||
|
||||
winExportFile.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||
AEnv.showWindow(winExportFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||
winExportFile.onClose();
|
||||
else if(event.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||
exportFile();
|
||||
}
|
||||
|
||||
private void exportFile() {
|
||||
try {
|
||||
ListItem li = cboType.getSelectedItem();
|
||||
if(li == null || li.getValue() == null)
|
||||
{
|
||||
FDialog.error(0, winExportFile, "FileInvalidExtension");
|
||||
return;
|
||||
}
|
||||
|
||||
String ext = li.getValue().toString();
|
||||
IGridTabExporter exporter = exporterMap.get(ext);
|
||||
if (exporter == null)
|
||||
{
|
||||
FDialog.error(0, winExportFile, "FileInvalidExtension");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean currentRowOnly = chkCurrentRow.isSelected();
|
||||
File file = File.createTempFile("Export", "."+ext);
|
||||
IADTabbox adTab = panel.getADTab();
|
||||
int selected = adTab.getSelectedIndex();
|
||||
int tabLevel = panel.getActiveGridTab().getTabLevel();
|
||||
Set<String> tables = new HashSet<String>();
|
||||
List<GridTab> childs = new ArrayList<GridTab>();
|
||||
List<GridTab> includedList = panel.getActiveGridTab().getIncludedTabs();
|
||||
for(GridTab included : includedList)
|
||||
{
|
||||
String tableName = included.getTableName();
|
||||
if (tables.contains(tableName))
|
||||
continue;
|
||||
tables.add(tableName);
|
||||
childs.add(included);
|
||||
}
|
||||
for(int i = selected+1; i < adTab.getTabCount(); i++)
|
||||
{
|
||||
IADTabpanel adTabPanel = adTab.getADTabpanel(i);
|
||||
if (adTabPanel.getGridTab().isSortTab())
|
||||
continue;
|
||||
if (adTabPanel.getGridTab().getTabLevel() <= tabLevel)
|
||||
break;
|
||||
String tableName = adTabPanel.getGridTab().getTableName();
|
||||
if (tables.contains(tableName))
|
||||
continue;
|
||||
tables.add(tableName);
|
||||
childs.add(adTabPanel.getGridTab());
|
||||
}
|
||||
|
||||
exporter.export(panel.getActiveGridTab(), childs, currentRowOnly, file);
|
||||
|
||||
winExportFile.onClose();
|
||||
winExportFile = null;
|
||||
AMedia media = null;
|
||||
media = new AMedia(panel.getActiveGridTab().getName() + "." + ext, null, exporter.getContentType(), file, true);
|
||||
Filedownload.save(media, panel.getActiveGridTab().getName() + "." + ext);
|
||||
} catch (Exception e) {
|
||||
throw new AdempiereException(e);
|
||||
} finally {
|
||||
if (winExportFile != null)
|
||||
winExportFile.onClose();
|
||||
}
|
||||
}
|
||||
private void doExport(ADWindowContent panel) {
|
||||
ExportWindow window = new ExportWindow();
|
||||
window.init(panel);
|
||||
|
||||
AEnv.showWindow(window);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.adempiere.ui.zk.example.action;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.adempiere.base.IGridTabExporter;
|
||||
import org.adempiere.base.Service;
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.webui.adwindow.ADWindowContent;
|
||||
import org.adempiere.webui.adwindow.IADTabbox;
|
||||
import org.adempiere.webui.adwindow.IADTabpanel;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListItem;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Filedownload;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class ExportWindow extends Window implements EventListener<Event> {
|
||||
|
||||
/**
|
||||
* generated serial id
|
||||
*/
|
||||
private static final long serialVersionUID = -4465587396361021680L;
|
||||
|
||||
private Map<String, IGridTabExporter> exporterMap = null;
|
||||
private Map<String, String> extensionMap = null;
|
||||
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private Listbox cboType = new Listbox();
|
||||
private Checkbox chkCurrentRow = new Checkbox();
|
||||
private ADWindowContent panel;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ExportWindow() {
|
||||
}
|
||||
|
||||
public void init(ADWindowContent panel) {
|
||||
this.panel = panel;
|
||||
|
||||
exporterMap = new HashMap<String, IGridTabExporter>();
|
||||
extensionMap = new HashMap<String, String>();
|
||||
List<IGridTabExporter> exporterList = Service.locator().list(IGridTabExporter.class).getServices();
|
||||
for(IGridTabExporter exporter : exporterList)
|
||||
{
|
||||
String extension = exporter.getFileExtension();
|
||||
if (!extensionMap.containsKey(extension))
|
||||
{
|
||||
extensionMap.put(extension, exporter.getFileExtensionLabel());
|
||||
exporterMap.put(extension, exporter);
|
||||
}
|
||||
}
|
||||
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "Export") + ": " + panel.getActiveGridTab().getName());
|
||||
setWidth("450px");
|
||||
setClosable(true);
|
||||
setBorder("normal");
|
||||
setStyle("position:absolute");
|
||||
|
||||
cboType.setMold("select");
|
||||
|
||||
cboType.getItems().clear();
|
||||
for(Map.Entry<String, String> entry : extensionMap.entrySet())
|
||||
{
|
||||
cboType.appendItem(entry.getKey() + " - " + entry.getValue(), entry.getKey());
|
||||
}
|
||||
|
||||
cboType.setSelectedIndex(0);
|
||||
|
||||
Vbox vb = new Vbox();
|
||||
vb.setWidth("100%");
|
||||
appendChild(vb);
|
||||
|
||||
Hbox hb = new Hbox();
|
||||
Div div = new Div();
|
||||
div.setStyle("float: right");
|
||||
div.appendChild(new Label("Files of Type: "));
|
||||
hb.appendChild(div);
|
||||
hb.appendChild(cboType);
|
||||
cboType.setWidth("100%");
|
||||
vb.appendChild(hb);
|
||||
|
||||
hb = new Hbox();
|
||||
chkCurrentRow.setLabel(Msg.getMsg(Env.getCtx(), "ExportCurrentRowOnly"));
|
||||
chkCurrentRow.setSelected(true);
|
||||
hb.appendChild(chkCurrentRow);
|
||||
vb.appendChild(hb);
|
||||
|
||||
vb.appendChild(confirmPanel);
|
||||
confirmPanel.addActionListener(this);
|
||||
|
||||
setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||
onClose();
|
||||
else if(event.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||
exportFile();
|
||||
|
||||
}
|
||||
|
||||
private void exportFile() {
|
||||
try {
|
||||
ListItem li = cboType.getSelectedItem();
|
||||
if(li == null || li.getValue() == null)
|
||||
{
|
||||
FDialog.error(0, this, "FileInvalidExtension");
|
||||
return;
|
||||
}
|
||||
|
||||
String ext = li.getValue().toString();
|
||||
IGridTabExporter exporter = exporterMap.get(ext);
|
||||
if (exporter == null)
|
||||
{
|
||||
FDialog.error(0, this, "FileInvalidExtension");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean currentRowOnly = chkCurrentRow.isSelected();
|
||||
File file = File.createTempFile("Export", "."+ext);
|
||||
IADTabbox adTab = panel.getADTab();
|
||||
int selected = adTab.getSelectedIndex();
|
||||
int tabLevel = panel.getActiveGridTab().getTabLevel();
|
||||
Set<String> tables = new HashSet<String>();
|
||||
List<GridTab> childs = new ArrayList<GridTab>();
|
||||
List<GridTab> includedList = panel.getActiveGridTab().getIncludedTabs();
|
||||
for(GridTab included : includedList)
|
||||
{
|
||||
String tableName = included.getTableName();
|
||||
if (tables.contains(tableName))
|
||||
continue;
|
||||
tables.add(tableName);
|
||||
childs.add(included);
|
||||
}
|
||||
for(int i = selected+1; i < adTab.getTabCount(); i++)
|
||||
{
|
||||
IADTabpanel adTabPanel = adTab.getADTabpanel(i);
|
||||
if (adTabPanel.getGridTab().isSortTab())
|
||||
continue;
|
||||
if (adTabPanel.getGridTab().getTabLevel() <= tabLevel)
|
||||
break;
|
||||
String tableName = adTabPanel.getGridTab().getTableName();
|
||||
if (tables.contains(tableName))
|
||||
continue;
|
||||
tables.add(tableName);
|
||||
childs.add(adTabPanel.getGridTab());
|
||||
}
|
||||
|
||||
exporter.export(panel.getActiveGridTab(), childs, currentRowOnly, file);
|
||||
|
||||
onClose();
|
||||
AMedia media = null;
|
||||
media = new AMedia(panel.getActiveGridTab().getName() + "." + ext, null, exporter.getContentType(), file, true);
|
||||
Filedownload.save(media, panel.getActiveGridTab().getName() + "." + ext);
|
||||
} catch (Exception e) {
|
||||
throw new AdempiereException(e);
|
||||
} finally {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,9 +14,14 @@
|
|||
package org.adempiere.webui.action;
|
||||
|
||||
/**
|
||||
* Custom UI action provided through OSGi service. Implementation must be thread safe.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IAction {
|
||||
/**
|
||||
*
|
||||
* @param target
|
||||
*/
|
||||
public void execute(Object target);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import org.adempiere.webui.apps.form.WCreateFromFactory;
|
|||
import org.adempiere.webui.apps.form.WCreateFromWindow;
|
||||
import org.adempiere.webui.apps.form.WPayment;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.IProcessButton;
|
||||
import org.adempiere.webui.editor.WButtonEditor;
|
||||
|
@ -107,6 +106,7 @@ import org.zkoss.zul.Hbox;
|
|||
import org.zkoss.zul.Listitem;
|
||||
import org.zkoss.zul.Menuitem;
|
||||
import org.zkoss.zul.Menupopup;
|
||||
import org.zkoss.zul.Window.Mode;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -948,7 +948,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
{
|
||||
ProcessModalDialog dialog = (ProcessModalDialog) event.getTarget();
|
||||
onModalClose(dialog.getProcessInfo());
|
||||
String s = breadCrumb.getStatusLine();
|
||||
onRefresh(true, false);
|
||||
breadCrumb.setStatusLine(s);
|
||||
}
|
||||
else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName()))
|
||||
{
|
||||
|
@ -1617,7 +1619,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
onRefresh(false, false);
|
||||
onRefresh(true, false);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -2273,7 +2275,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
onRefresh(false, false);
|
||||
onRefresh(true, false);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -2331,7 +2333,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if (!window.isCancel()) {
|
||||
adtabPanel.getGridTab().dataRefresh();
|
||||
onRefresh(true, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2403,7 +2405,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
if (error != null)
|
||||
breadCrumb.setStatusLine(error, true);
|
||||
|
||||
onRefresh(false, false);
|
||||
onRefresh(true, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2468,10 +2470,18 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
pi.setAD_Client_ID (Env.getAD_Client_ID(ctx));
|
||||
ADForm form = ADForm.openForm(adFormID);
|
||||
form.setProcessInfo(pi);
|
||||
Mode mode = form.getWindowMode();
|
||||
form.setAttribute(Window.MODE_KEY, form.getWindowMode());
|
||||
form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||
if (mode == Mode.HIGHLIGHTED || mode == Mode.MODAL) {
|
||||
form.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
onRefresh(true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
SessionManager.getAppDesktop().showWindow(form);
|
||||
onRefresh(false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2487,7 +2497,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
}
|
||||
else
|
||||
{
|
||||
onRefresh(false, false);
|
||||
onRefresh(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,9 +52,8 @@ 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.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Space;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
|
||||
public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener<Event>, ValueChangeListener
|
||||
{
|
||||
|
@ -152,29 +151,26 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
|
|||
sameWarehouseCb.setTooltiptext(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", false));
|
||||
upcLabel.setText(Msg.getElement(Env.getCtx(), "UPC", false));
|
||||
|
||||
Borderlayout parameterLayout = new Borderlayout();
|
||||
parameterLayout.setHeight("110px");
|
||||
parameterLayout.setWidth("100%");
|
||||
Vlayout vlayout = new Vlayout();
|
||||
vlayout.setVflex("1");
|
||||
vlayout.setWidth("100%");
|
||||
Panel parameterPanel = window.getParameterPanel();
|
||||
parameterPanel.appendChild(parameterLayout);
|
||||
parameterPanel.appendChild(vlayout);
|
||||
|
||||
Grid parameterStdLayout = GridFactory.newGridLayout();
|
||||
Panel parameterStdPanel = new Panel();
|
||||
parameterStdPanel.appendChild(parameterStdLayout);
|
||||
|
||||
Center center = new Center();
|
||||
parameterLayout.appendChild(center);
|
||||
center.appendChild(parameterStdPanel);
|
||||
vlayout.appendChild(parameterStdLayout);
|
||||
|
||||
parameterStdPanel.appendChild(parameterStdLayout);
|
||||
Rows rows = (Rows) parameterStdLayout.newRows();
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(bPartnerLabel.rightAlign());
|
||||
if (bPartnerField != null)
|
||||
if (bPartnerField != null) {
|
||||
row.appendChild(bPartnerField.getComponent());
|
||||
bPartnerField.fillHorizontal();
|
||||
}
|
||||
if (! isRMAWindow) {
|
||||
row.appendChild(orderLabel.rightAlign());
|
||||
row.appendChild(orderField);
|
||||
orderField.setHflex("1");
|
||||
}
|
||||
|
||||
row = rows.newRow();
|
||||
|
@ -182,7 +178,8 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
|
|||
row.appendChild(locatorField.getComponent());
|
||||
if (! isRMAWindow) {
|
||||
row.appendChild(invoiceLabel.rightAlign());
|
||||
row.appendChild(invoiceField);
|
||||
row.appendChild(invoiceField);
|
||||
invoiceField.setHflex("1");
|
||||
}
|
||||
|
||||
row = rows.newRow();
|
||||
|
@ -196,6 +193,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
|
|||
// Add RMA document selection to panel
|
||||
row.appendChild(rmaLabel.rightAlign());
|
||||
row.appendChild(rmaField);
|
||||
rmaField.setHflex("1");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.compiere.util.Trx;
|
|||
import org.compiere.util.TrxRunnable;
|
||||
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.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.North;
|
||||
|
@ -125,12 +124,10 @@ public class WCreateFromWindow extends Window implements EventListener<Event>, W
|
|||
{
|
||||
public void run(String trxName)
|
||||
{
|
||||
if (save(trxName))
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
save(trxName);
|
||||
}
|
||||
});
|
||||
dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -415,7 +415,7 @@ public class WMatch extends Match
|
|||
else if (e.getTarget() == bProcess)
|
||||
{
|
||||
//cmd_process();
|
||||
cmd_process(xMatchedTable, xMatchedToTable, matchMode.getSelectedIndex(), matchFrom.getSelectedIndex(), matchTo.getSelectedItem(), m_xMatched);
|
||||
cmd_process(xMatchedTable, xMatchedToTable, matchMode.getSelectedIndex(), matchFrom.getSelectedIndex(), matchTo.getSelectedItem().getLabel(), m_xMatched);
|
||||
xMatchedTable = (WListbox) cmd_search(xMatchedTable, matchFrom.getSelectedIndex(), (String)matchTo.getSelectedItem().getLabel(), product, vendor, from, to, matchMode.getSelectedIndex() == MODE_MATCHED);
|
||||
xMatched.setValue(Env.ZERO);
|
||||
// Status Info
|
||||
|
|
|
@ -659,10 +659,9 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
}
|
||||
// Set locator
|
||||
iol.setM_Locator_ID(M_Locator_ID);
|
||||
if (!iol.save())
|
||||
log.log(Level.SEVERE, "Line NOT created #" + i);
|
||||
iol.saveEx();
|
||||
// Create Invoice Line Link
|
||||
else if (il != null)
|
||||
if (il != null)
|
||||
{
|
||||
il.setM_InOutLine_ID(iol.getM_InOutLine_ID());
|
||||
il.saveEx();
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
|
|
|
@ -13,4 +13,5 @@ Bundle-ClassPath: .,
|
|||
Import-Package: org.osgi.framework
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: org.adempiere.db.oracle.OracleBundleActivator
|
||||
Service-Component: OSGI-INF/oracleprovider.xml
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.db.oracle.provider">
|
||||
<implementation class="org.compiere.db.DB_Oracle"/>
|
||||
<service>
|
||||
<provide interface="org.compiere.db.AdempiereDatabase"/>
|
||||
</service>
|
||||
<property name="id" type="String" value="Oracle"/>
|
||||
</scr:component>
|
|
@ -1,9 +1,9 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
ojdbc6.jar,\
|
||||
c3p0-0.9.1.2.jar,\
|
||||
c3p0-oracle-thin-extras-0.9.1.2.jar
|
||||
c3p0-oracle-thin-extras-0.9.1.2.jar,\
|
||||
OSGI-INF/oracleprovider.xml
|
||||
source.. = src/
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.compiere.db.AdempiereDatabase">
|
||||
<database
|
||||
class="org.compiere.db.DB_Oracle"
|
||||
id="Oracle">
|
||||
</database>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.db.config.ConfigOracle"
|
||||
name="Oracle Database Configuration"
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
|
|
|
@ -14,3 +14,4 @@ Import-Package: junit.framework;version="3.8.2",
|
|||
org.osgi.framework
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: org.adempiere.db.postgresql.PostgreSQLBundleActivator
|
||||
Service-Component: OSGI-INF/pgprovider.xml
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.db.postgresql.provider">
|
||||
<implementation class="org.compiere.db.DB_PostgreSQL"/>
|
||||
<service>
|
||||
<provide interface="org.compiere.db.AdempiereDatabase"/>
|
||||
</service>
|
||||
<property name="id" type="String" value="PostgreSQL"/>
|
||||
</scr:component>
|
|
@ -1,8 +1,8 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
postgresql.jar,\
|
||||
plugin.xml,\
|
||||
c3p0-0.9.1.2.jar
|
||||
c3p0-0.9.1.2.jar,\
|
||||
OSGI-INF/pgprovider.xml
|
||||
source.. = src/
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.compiere.db.AdempiereDatabase">
|
||||
<database
|
||||
class="org.compiere.db.DB_PostgreSQL"
|
||||
id="PostgreSQL">
|
||||
</database>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.db.postgresql.config.ConfigPostgreSQL"
|
||||
name="PostgreSQL Database Configuration"
|
||||
|
|
Loading…
Reference in New Issue