Merge with 00b953b36d4c79d2bfb5c613bff3f60b4d7b7b78

This commit is contained in:
Heng Sin Low 2012-11-08 13:28:37 +08:00
commit fbede0b32c
4 changed files with 275 additions and 11 deletions

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
-- just for oracle
SELECT register_migration_script('201211070846_IDEMPIERE-422.sql') FROM dual
;