Merge with 5e54c110a158ebf88b6be595bec24a1fa54a4fdb (iDempiere Head)

This commit is contained in:
Heng Sin Low 2012-04-10 15:49:44 +08:00
commit be51b1321e
70 changed files with 6129 additions and 2406 deletions

View File

@ -1,38 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="default" defaultIdMethod="none">
<table name="M_PRODUCT_COSTING">
<column name="M_PRODUCT_ID" primaryKey="true" required="true" type="ID" size="10" autoIncrement="false"/>
<column name="C_ACCTSCHEMA_ID" primaryKey="true" required="true" type="ID" size="10" autoIncrement="false"/>
<column name="AD_CLIENT_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
<column name="AD_ORG_ID" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
<column name="ISACTIVE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
<column name="CREATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="CURRENT_TIMESTAMP" autoIncrement="false"/>
<column name="CREATEDBY" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
<column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="CURRENT_TIMESTAMP" autoIncrement="false"/>
<column name="UPDATEDBY" primaryKey="false" required="true" type="ID" size="10" autoIncrement="false"/>
<column name="CURRENTCOSTPRICE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="FUTURECOSTPRICE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTSTANDARD" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTSTANDARDPOQTY" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTSTANDARDPOAMT" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTSTANDARDCUMQTY" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTSTANDARDCUMAMT" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTAVERAGE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTAVERAGECUMQTY" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="COSTAVERAGECUMAMT" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="PRICELASTPO" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="PRICELASTINV" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="TOTALINVQTY" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<column name="TOTALINVAMT" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
<foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_MPRODUCTCOSTING" onDelete="cascade">
<reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
</foreign-key>
<foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MPRODUCTCOSTING" onDelete="cascade">
<reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
</foreign-key>
<check>
<rule><![CDATA[IsActive in ('Y','N')]]></rule>
</check>
</table>
</database>

View File

@ -1,29 +0,0 @@
CREATE OR REPLACE VIEW RV_PRODUCT_COSTING
(M_PRODUCT_ID, C_ACCTSCHEMA_ID, VALUE, NAME, M_PRODUCT_CATEGORY_ID,
AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
UPDATED, UPDATEDBY, CURRENTCOSTPRICE, FUTURECOSTPRICE, COSTSTANDARD,
COSTSTANDARDPOQTY, COSTSTANDARDPOAMT, COSTSTANDARDPODIFF, COSTSTANDARDCUMQTY, COSTSTANDARDCUMAMT,
COSTSTANDARDINVDIFF, COSTAVERAGE, COSTAVERAGECUMQTY, COSTAVERAGECUMAMT, TOTALINVQTY,
TOTALINVAMT, TOTALINVCOST, PRICELASTPO, PRICELASTINV)
AS
SELECT pc.M_Product_ID, pc.C_AcctSchema_ID, p.Value, p.Name, p.M_Product_Category_ID,
pc.AD_Client_ID, pc.AD_Org_ID, pc.IsActive, pc.Created,pc.CreatedBy,pc.Updated,pc.UpdatedBy,
pc.CurrentCostPrice,
-- Standard Costing
pc.FutureCostPrice, pc.CostStandard,
pc.CostStandardPOQty, pc.CostStandardPOAmt,
CASE WHEN pc.CostStandardPOQty=0 THEN 0 ELSE pc.CostStandardPOAmt/pc.CostStandardPOQty END AS CostStandardPODiff,
pc.CostStandardCumQty, pc.CostStandardCumAmt,
CASE WHEN pc.CostStandardCumQty=0 THEN 0 ELSE pc.CostStandardCumAmt/pc.CostStandardCumQty END AS CostStandardInvDiff,
-- Average Costing
pc.CostAverage,
pc.CostAverageCumQty, pc.CostAverageCumAmt,
pc.TotalInvQty, pc.TotalInvAmt,
CASE WHEN pc.TotalInvQty=0 THEN 0 ELSE pc.TotalInvAmt/pc.TotalInvQty END AS TotalInvCost,
-- LastPrice
pc.PriceLastPO, pc.PriceLastInv
FROM M_Product_Costing pc
INNER JOIN M_Product p ON (pc.M_Product_ID=p.M_Product_ID);

View File

@ -1,29 +0,0 @@
CREATE OR REPLACE VIEW RV_PRODUCT_COSTING
(M_PRODUCT_ID, C_ACCTSCHEMA_ID, VALUE, NAME, M_PRODUCT_CATEGORY_ID,
AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
UPDATED, UPDATEDBY, CURRENTCOSTPRICE, FUTURECOSTPRICE, COSTSTANDARD,
COSTSTANDARDPOQTY, COSTSTANDARDPOAMT, COSTSTANDARDPODIFF, COSTSTANDARDCUMQTY, COSTSTANDARDCUMAMT,
COSTSTANDARDINVDIFF, COSTAVERAGE, COSTAVERAGECUMQTY, COSTAVERAGECUMAMT, TOTALINVQTY,
TOTALINVAMT, TOTALINVCOST, PRICELASTPO, PRICELASTINV)
AS
SELECT pc.M_Product_ID, pc.C_AcctSchema_ID, p.Value, p.Name, p.M_Product_Category_ID,
pc.AD_Client_ID, pc.AD_Org_ID, pc.IsActive, pc.Created,pc.CreatedBy,pc.Updated,pc.UpdatedBy,
pc.CurrentCostPrice,
-- Standard Costing
pc.FutureCostPrice, pc.CostStandard,
pc.CostStandardPOQty, pc.CostStandardPOAmt,
CASE WHEN pc.CostStandardPOQty=0 THEN 0 ELSE pc.CostStandardPOAmt/pc.CostStandardPOQty END AS CostStandardPODiff,
pc.CostStandardCumQty, pc.CostStandardCumAmt,
CASE WHEN pc.CostStandardCumQty=0 THEN 0 ELSE pc.CostStandardCumAmt/pc.CostStandardCumQty END AS CostStandardInvDiff,
-- Average Costing
pc.CostAverage,
pc.CostAverageCumQty, pc.CostAverageCumAmt,
pc.TotalInvQty, pc.TotalInvAmt,
CASE WHEN pc.TotalInvQty=0 THEN 0 ELSE pc.TotalInvAmt/pc.TotalInvQty END AS TotalInvCost,
-- LastPrice
pc.PriceLastPO, pc.PriceLastInv
FROM M_Product_Costing pc
INNER JOIN M_Product p ON (pc.M_Product_ID=p.M_Product_ID);

View File

@ -0,0 +1,205 @@
-- required to fill UU columns for installations coming from transition version
UPDATE AD_Table SET AD_Table_UU='8c8d6676-6538-44f1-abf8-e480da7250b2' WHERE AD_Table_ID=200001;
UPDATE AD_Column SET AD_Column_UU='1bbcd29a-4935-4908-bea6-4f8dc313d501' WHERE AD_Column_ID=200020;
UPDATE AD_Column SET AD_Column_UU='45063c04-4fb3-46a6-b1e1-828ac5ce614c' WHERE AD_Column_ID=200021;
UPDATE AD_Column SET AD_Column_UU='e32147f8-ad0d-41a9-afc6-ad70da9ddd5f' WHERE AD_Column_ID=200022;
UPDATE AD_Column SET AD_Column_UU='6ff59e2a-33cd-4e8a-b9cd-8a377978f53c' WHERE AD_Column_ID=200023;
UPDATE AD_Column SET AD_Column_UU='2e7271de-7b31-4b10-8ffc-983789141192' WHERE AD_Column_ID=200024;
UPDATE AD_Column SET AD_Column_UU='4af1df12-baec-453a-bec9-bec84e71617e' WHERE AD_Column_ID=200025;
UPDATE AD_Column SET AD_Column_UU='1232b0fb-6166-4ecf-a172-02dde4c7256a' WHERE AD_Column_ID=200026;
UPDATE AD_Column SET AD_Column_UU='b9ea7299-e3d8-4ab1-9ff4-332e8ed562d6' WHERE AD_Column_ID=200027;
UPDATE AD_Element SET AD_Element_UU='58eb631b-8cb1-4bab-93d0-bf9f51accd2e' WHERE AD_Element_ID=200005;
UPDATE AD_Column SET AD_Column_UU='30905aed-94c4-4e8c-b2ce-de9aa41b1586' WHERE AD_Column_ID=200028;
UPDATE AD_Element SET AD_Element_UU='c6a0fa10-0414-4257-9990-5fcb38a91ef3' WHERE AD_Element_ID=200006;
UPDATE AD_Column SET AD_Column_UU='f2d3a898-4321-4a39-a8f6-f29f9daed67b' WHERE AD_Column_ID=200029;
UPDATE AD_Element SET AD_Element_UU='069a7d89-cfe4-4f89-9f32-919b7caef225' WHERE AD_Element_ID=200007;
UPDATE AD_Column SET AD_Column_UU='03a9f86d-8d7f-424b-ac2d-06b0390263e5' WHERE AD_Column_ID=200030;
UPDATE AD_Column SET AD_Column_UU='453e63fd-79ec-4453-be2a-61a90cd3847d' WHERE AD_Column_ID=200031;
UPDATE AD_Element SET AD_Element_UU='f0219a4d-ea25-473c-896a-1fe5dc6c25b8' WHERE AD_Element_ID=200008;
UPDATE AD_Column SET AD_Column_UU='8440b8a0-7a07-48cd-92f2-8a72cd8afd50' WHERE AD_Column_ID=200032;
UPDATE AD_Element SET AD_Element_UU='f2bfdcd4-9015-4135-b738-189f96469f03' WHERE AD_Element_ID=200009;
UPDATE AD_Column SET AD_Column_UU='1b12534a-0973-4a1e-97e2-58bcc4478a10' WHERE AD_Column_ID=200033;
UPDATE AD_Element SET AD_Element_UU='8f1543e0-6597-48bc-b0b0-1817bac20415' WHERE AD_Element_ID=200010;
UPDATE AD_Column SET AD_Column_UU='58ee58db-f841-4965-8af5-13ff54068f4e' WHERE AD_Column_ID=200034;
UPDATE AD_Element SET AD_Element_UU='de1b3615-148c-4cb1-9897-7fd0b5188320' WHERE AD_Element_ID=200011;
UPDATE AD_Column SET AD_Column_UU='9129c55a-0a13-4db7-b64d-bdc9fc740a4b' WHERE AD_Column_ID=200035;
UPDATE AD_Element SET AD_Element_UU='13f4a559-a32b-4118-a89b-b61d826bec35' WHERE AD_Element_ID=200012;
UPDATE AD_Column SET AD_Column_UU='56e4fd27-9418-4104-823c-7c7ebd7d0e91' WHERE AD_Column_ID=200036;
UPDATE AD_Element SET AD_Element_UU='c556911d-90fa-4e52-a569-92588720cc6c' WHERE AD_Element_ID=200013;
UPDATE AD_Column SET AD_Column_UU='a6ff1e46-b660-4ca5-8b55-f831e2633b94' WHERE AD_Column_ID=200037;
UPDATE AD_Element SET AD_Element_UU='ddc61868-2b75-49d8-a117-4d7460c09647' WHERE AD_Element_ID=200014;
UPDATE AD_Column SET AD_Column_UU='a4bf053d-8778-4f9a-a9ed-3063d27e729b' WHERE AD_Column_ID=200038;
UPDATE AD_Column SET AD_Column_UU='f44e0d81-fb24-414e-8f8b-b818a9fbb408' WHERE AD_Column_ID=200039;
UPDATE AD_Column SET AD_Column_UU='717ff97a-bdbf-4cd0-9499-33446a8e17fd' WHERE AD_Column_ID=200040;
UPDATE AD_Table SET AD_Table_UU='0ec6736e-94ff-4ff4-ae56-c3be505e1e00' WHERE AD_Table_ID=200002;
UPDATE AD_Sequence SET AD_Sequence_UU='9e99f812-6480-4053-94d9-d987b2f28665' WHERE AD_Sequence_ID=200001;
UPDATE AD_Column SET AD_Column_UU='6997dbc7-f6c2-4575-8fe6-c560c881c1ee' WHERE AD_Column_ID=200041;
UPDATE AD_Column SET AD_Column_UU='06443f4d-f34c-40ed-91f1-f68f2099d770' WHERE AD_Column_ID=200042;
UPDATE AD_Column SET AD_Column_UU='fc5b5b47-8f8c-4c72-b2d7-ec0da9186030' WHERE AD_Column_ID=200043;
UPDATE AD_Column SET AD_Column_UU='7522bd43-da4f-40d7-bdd0-1d9ef2b37d4b' WHERE AD_Column_ID=200044;
UPDATE AD_Column SET AD_Column_UU='7874a621-6c70-476c-96e8-abba949270e2' WHERE AD_Column_ID=200045;
UPDATE AD_Column SET AD_Column_UU='9718d2ad-1e01-49b7-b7c7-0ddf78925b67' WHERE AD_Column_ID=200046;
UPDATE AD_Column SET AD_Column_UU='c29855c1-dcc7-403c-86f6-30efb29e54a5' WHERE AD_Column_ID=200047;
UPDATE AD_Column SET AD_Column_UU='1e1dd8bc-358c-4b4c-b6b6-b6c496cd7d9e' WHERE AD_Column_ID=200048;
UPDATE AD_Column SET AD_Column_UU='0a26379d-e54f-434e-a570-38cd58176542' WHERE AD_Column_ID=200049;
UPDATE AD_Column SET AD_Column_UU='33f411f6-b519-410d-a2c5-cfdad5a0520c' WHERE AD_Column_ID=200050;
UPDATE AD_Column SET AD_Column_UU='77b74eff-9785-4985-9d6a-0c2e02e4c41a' WHERE AD_Column_ID=200051;
UPDATE AD_Column SET AD_Column_UU='02aeafef-79ef-43af-b76c-02cb5d92aea7' WHERE AD_Column_ID=200052;
UPDATE AD_Column SET AD_Column_UU='707ef80f-74d9-42ab-a507-ea0b9b87ef24' WHERE AD_Column_ID=200053;
UPDATE AD_Column SET AD_Column_UU='3f6af769-b634-43a5-9889-20ff0480f371' WHERE AD_Column_ID=200054;
UPDATE AD_Column SET AD_Column_UU='c28a3f40-c3a8-446e-83eb-9b461c458236' WHERE AD_Column_ID=200055;
UPDATE AD_Column SET AD_Column_UU='7c0e70c0-32a6-49c4-bf9c-f1a0746c8b02' WHERE AD_Column_ID=200056;
UPDATE AD_Column SET AD_Column_UU='f76c1c40-dbe9-42ee-9edd-9430d6b70fae' WHERE AD_Column_ID=200057;
UPDATE AD_Column SET AD_Column_UU='419e470f-e2ee-4ce8-8460-1500140d71cc' WHERE AD_Column_ID=200058;
UPDATE AD_Column SET AD_Column_UU='159d2c37-c8ca-46bd-8cdb-e1c3abf3008e' WHERE AD_Column_ID=200059;
UPDATE AD_Column SET AD_Column_UU='aeaf777e-3671-4498-aaec-4dbc37163906' WHERE AD_Column_ID=200060;
UPDATE AD_Column SET AD_Column_UU='992335c0-322b-4c02-b749-135e28931bfd' WHERE AD_Column_ID=200061;
UPDATE AD_Column SET AD_Column_UU='c06c3c93-eaa1-4564-a778-42b10f5539c1' WHERE AD_Column_ID=200062;
UPDATE AD_Column SET AD_Column_UU='7fbdb857-e16e-4d2d-836b-0251d935723b' WHERE AD_Column_ID=200063;
UPDATE AD_Column SET AD_Column_UU='62a08e0b-de59-4e0f-8324-ff590b150536' WHERE AD_Column_ID=200064;
UPDATE AD_Column SET AD_Column_UU='03ef993c-e33c-4f88-b9ba-431fc0c1449c' WHERE AD_Column_ID=200065;
UPDATE AD_Column SET AD_Column_UU='72698e67-0526-41cd-990a-dcfebf24d73e' WHERE AD_Column_ID=200066;
UPDATE AD_Column SET AD_Column_UU='a8e3de0a-07e2-493a-a7ac-429a41a47bb3' WHERE AD_Column_ID=200067;
UPDATE AD_Column SET AD_Column_UU='c1026223-a57e-4e18-9dd4-bcaa5c283649' WHERE AD_Column_ID=200068;
UPDATE AD_Column SET AD_Column_UU='b94aa816-9576-476e-99b9-258e40883b28' WHERE AD_Column_ID=200069;
UPDATE AD_Column SET AD_Column_UU='2795cb3f-08f5-416a-a413-cac3cc614b9a' WHERE AD_Column_ID=200070;
UPDATE AD_Column SET AD_Column_UU='68702b21-9a7f-42d1-8d00-430c3c42a335' WHERE AD_Column_ID=200071;
UPDATE AD_Column SET AD_Column_UU='9923bd35-b9e1-493e-9b85-7812447c65f3' WHERE AD_Column_ID=200072;
UPDATE AD_Column SET AD_Column_UU='bb6bf453-b9b7-4145-b9e2-5e0b2c3fb058' WHERE AD_Column_ID=200073;
UPDATE AD_Column SET AD_Column_UU='21e576f8-bcef-4acf-8668-198189e3d8ad' WHERE AD_Column_ID=200074;
UPDATE AD_Tab SET AD_Tab_UU='834474e3-50d5-41d4-a707-ca6363f19427' WHERE AD_Tab_ID=200000;
UPDATE AD_Field SET AD_Field_UU='8b6b26dc-1c4b-4db8-b09e-a756d8128dd6' WHERE AD_Field_ID=200005;
UPDATE AD_Field SET AD_Field_UU='73f9fbe4-fe30-48b3-b790-6581a4e61370' WHERE AD_Field_ID=200006;
UPDATE AD_Field SET AD_Field_UU='d7e2508d-3eeb-43b7-bbee-234fed237065' WHERE AD_Field_ID=200007;
UPDATE AD_Field SET AD_Field_UU='66f09047-e4cb-4b09-bcc0-6cdc109a60d6' WHERE AD_Field_ID=200008;
UPDATE AD_Field SET AD_Field_UU='65399c71-c4b2-4cab-90e0-7d61204e98da' WHERE AD_Field_ID=200009;
UPDATE AD_Field SET AD_Field_UU='65779cfa-bc31-413a-8e0c-4ef258a1b0f8' WHERE AD_Field_ID=200010;
UPDATE AD_Field SET AD_Field_UU='39f40544-5bb5-4bdb-ba4a-85b64905ad51' WHERE AD_Field_ID=200012;
UPDATE AD_Field SET AD_Field_UU='8bcb338d-e86f-488d-aaf5-98d8e2c9dca2' WHERE AD_Field_ID=200011;
UPDATE AD_Field SET AD_Field_UU='8bf1fec8-10b3-46ab-93d2-73e688fe5296' WHERE AD_Field_ID=200013;
UPDATE AD_Field SET AD_Field_UU='a7e2ad58-1b58-486f-8f49-38ca9bb28208' WHERE AD_Field_ID=200014;
UPDATE AD_Field SET AD_Field_UU='f7b15a16-dc17-486e-b19e-f9045e1be9af' WHERE AD_Field_ID=200015;
UPDATE AD_Field SET AD_Field_UU='6597ecd8-91a1-4b3a-acaa-4bb2fc3d0122' WHERE AD_Field_ID=200016;
UPDATE AD_Field SET AD_Field_UU='5223bee9-051a-4811-904d-58ddad14eac2' WHERE AD_Field_ID=200017;
UPDATE AD_Field SET AD_Field_UU='32104954-503b-455d-bdf6-f0bd8b1168a1' WHERE AD_Field_ID=200018;
UPDATE AD_Field SET AD_Field_UU='78928c1f-21bd-4fc1-bdc8-4a5145a445e0' WHERE AD_Field_ID=200019;
UPDATE AD_Field SET AD_Field_UU='86dcee6e-9d39-473b-8580-847c4fc8b37f' WHERE AD_Field_ID=200020;
UPDATE AD_Field SET AD_Field_UU='b8569191-fc3c-4c49-a95d-d0f36b02ae34' WHERE AD_Field_ID=200021;
UPDATE AD_Field SET AD_Field_UU='0f1102a0-ef80-4fb5-b68b-34103fdf5f64' WHERE AD_Field_ID=200023;
UPDATE AD_Field SET AD_Field_UU='3464b90f-85cc-4d1a-bad2-00a16ac0597d' WHERE AD_Field_ID=200022;
UPDATE AD_Field SET AD_Field_UU='d13f478d-3408-43e5-851b-396c060f5278' WHERE AD_Field_ID=200024;
UPDATE AD_Field SET AD_Field_UU='31c9b27e-53d7-47d2-95f0-f2fe497ad44c' WHERE AD_Field_ID=200025;
UPDATE AD_Field SET AD_Field_UU='a9e57492-bda2-463d-8081-d76255673b56' WHERE AD_Field_ID=200026;
UPDATE AD_Field SET AD_Field_UU='0d987f31-d5df-4efc-8cb6-d70a7dc3d433' WHERE AD_Field_ID=200027;
UPDATE AD_Field SET AD_Field_UU='faf7306c-9429-4840-a5df-9de9748ec660' WHERE AD_Field_ID=200028;
UPDATE AD_Field SET AD_Field_UU='cd3d0301-7559-4cb9-8883-aa7f2c9184b9' WHERE AD_Field_ID=200029;
UPDATE AD_Field SET AD_Field_UU='c1fe07ef-477e-4370-9583-2a24aa086316' WHERE AD_Field_ID=200030;
UPDATE AD_Field SET AD_Field_UU='3022e456-5a80-448d-81ce-837ccd8a7488' WHERE AD_Field_ID=200031;
UPDATE AD_Field SET AD_Field_UU='f67d0bc4-3239-49bd-a00e-47125316dc54' WHERE AD_Field_ID=200032;
UPDATE AD_Field SET AD_Field_UU='99e6a7fa-b939-481d-942c-0ea8fc936630' WHERE AD_Field_ID=200033;
UPDATE AD_Field SET AD_Field_UU='945e92e7-d23f-407d-88e2-741216b30bb1' WHERE AD_Field_ID=200034;
UPDATE AD_System
SET LastMigrationScriptApplied='824z_UpdateUU.sql'
WHERE LastMigrationScriptApplied<'824z_UpdateUU.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,10 @@
-- Apr 3, 2012 11:17:51 AM COT
-- IDEMPIERE-117 Add cost history table and cost movement view
INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,CreatedBy,IsActive) VALUES (1,'N',100,'Y',1000000,1000000,'N','Y',200005,'Table M_CostHistory','M_CostHistory',0,0,TO_DATE('2012-04-03 11:17:50','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-04-03 11:17:50','YYYY-MM-DD HH24:MI:SS'),100,'Y')
;
UPDATE AD_System
SET LastMigrationScriptApplied='829_IDEMPIERE-117.sql'
WHERE LastMigrationScriptApplied<'829_IDEMPIERE-117.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,195 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Aug 9, 2010 8:47:17 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2010-08-09 20:47:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13424
;
-- Aug 9, 2010 8:48:24 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''Y''',Updated=TO_DATE('2010-08-09 20:48:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6349
;
-- Aug 9, 2010 8:48:38 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''N''',Updated=TO_DATE('2010-08-09 20:48:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6352
;
-- Aug 9, 2010 8:48:42 PM CEST
-- Default comment for updating dictionary
ALTER TABLE AD_UserDef_Field MODIFY IsReadOnly CHAR(1) DEFAULT 'N'
;
-- Aug 9, 2010 8:48:43 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET IsReadOnly='N' WHERE IsReadOnly IS NULL
;
-- Aug 9, 2010 8:49:01 PM CEST
-- Default comment for updating dictionary
ALTER TABLE AD_UserDef_Field MODIFY IsDisplayed CHAR(1) DEFAULT 'Y'
;
-- Aug 9, 2010 8:49:01 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET IsDisplayed='Y' WHERE IsDisplayed IS NULL
;
-- Aug 9, 2010 8:49:19 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''N''',Updated=TO_DATE('2010-08-09 20:49:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6356
;
-- Aug 9, 2010 8:49:23 PM CEST
-- Default comment for updating dictionary
ALTER TABLE AD_UserDef_Field MODIFY IsSameLine CHAR(1) DEFAULT 'N'
;
-- Aug 9, 2010 8:49:23 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET IsSameLine='N' WHERE IsSameLine IS NULL
;
-- Aug 9, 2010 8:49:47 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='0',Updated=TO_DATE('2010-08-09 20:49:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6355
;
-- Aug 9, 2010 8:49:51 PM CEST
-- Default comment for updating dictionary
ALTER TABLE AD_UserDef_Field MODIFY SeqNo NUMBER(10) DEFAULT 0
;
-- Aug 9, 2010 8:49:51 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET SeqNo=0 WHERE SeqNo IS NULL
;
-- Aug 9, 2010 8:52:43 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''''',Updated=TO_DATE('2010-08-09 20:52:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6351
;
-- Aug 9, 2010 8:52:50 PM CEST
-- Default comment for updating dictionary
ALTER TABLE AD_UserDef_Field MODIFY DisplayLogic NVARCHAR2(2000) DEFAULT ''
;
-- Aug 9, 2010 8:55:45 PM CEST
-- Default comment for updating dictionary
ALTER TABLE AD_UserDef_Field MODIFY DefaultValue NVARCHAR2(2000) DEFAULT ''
;
-- Mar 5, 2012 2:16:34 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET Callout='org.compiere.model.CalloutWindowCustomization.window',Updated=TO_DATE('2012-03-05 14:16:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6395
;
-- Mar 5, 2012 2:35:54 PM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,200000,'AD_Window.AD_Window_ID IN (SELECT AD_Window_Access.AD_Window_ID FROM AD_Window_Access WHERE AD_Window_Access.AD_Role_ID=@#AD_Role_ID@)',TO_DATE('2012-03-05 14:35:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_Window of Role','S',TO_DATE('2012-03-05 14:35:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Mar 5, 2012 2:36:34 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET AD_Val_Rule_ID=200000,Updated=TO_DATE('2012-03-05 14:36:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6395
;
-- Mar 5, 2012 2:48:07 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET AD_Val_Rule_ID=163,Updated=TO_DATE('2012-03-05 14:48:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6380
;
-- Mar 5, 2012 3:41:45 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET Callout='org.compiere.model.CalloutWindowCustomization.tab',Updated=TO_DATE('2012-03-05 15:41:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6380
;
-- Mar 5, 2012 3:51:23 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET AD_Val_Rule_ID=52005,Updated=TO_DATE('2012-03-05 15:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6345
;
-- Mar 5, 2012 3:53:30 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET Callout='org.compiere.model.CalloutWindowCustomization.field',Updated=TO_DATE('2012-03-05 15:53:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6345
;
-- Mar 7, 2012 11:02:11 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200018,1663,0,10,466,'ReadOnlyLogic',TO_DATE('2012-03-07 11:02:09','YYYY-MM-DD HH24:MI:SS'),100,'Logic to determine if field is read only (applies only when field is read-write)','D',2000,'format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
'||'@AD_Table_ID@=14 | @Language@!GERGER <br>
'||'@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
'||'@Name@>J<br>
Strings may be in single quotes (optional)','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Read Only Logic',0,TO_DATE('2012-03-07 11:02:09','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Mar 7, 2012 11:02:11 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200018 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Mar 7, 2012 11:02:19 AM CET
-- IDEMPIERE-177 Window Customization
ALTER TABLE AD_UserDef_Tab ADD ReadOnlyLogic NVARCHAR2(2000) DEFAULT NULL
;
-- Mar 7, 2012 11:02:34 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,200018,200003,0,394,TO_DATE('2012-03-07 11:02:33','YYYY-MM-DD HH24:MI:SS'),100,'Logic to determine if field is read only (applies only when field is read-write)',2000,'D','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
'||'@AD_Table_ID@=14 | @Language@!GERGER <br>
'||'@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
'||'@Name@>J<br>
Strings may be in single quotes (optional)','Y','Y','Y','N','N','N','N','N','Read Only Logic',TO_DATE('2012-03-07 11:02:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Mar 7, 2012 11:02:34 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200003 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Mar 7, 2012 11:02:41 AM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=200003
;
-- Apr 3, 2012 3:11:59 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2012-04-03 15:11:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6396
;
-- Apr 3, 2012 3:13:25 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2012-04-03 15:13:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6399
;
-- Apr 3, 2012 3:15:11 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2012-04-03 15:15:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6381
;
-- Apr 3, 2012 3:16:32 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2012-04-03 15:16:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6346
;
UPDATE AD_System
SET LastMigrationScriptApplied='830_IDEMPIERE-177_Window_Customization.sql'
WHERE LastMigrationScriptApplied<'830_IDEMPIERE-177_Window_Customization.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,90 @@
-- Apr 4, 2012 10:13:06 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='N',Updated=TO_DATE('2012-04-04 10:13:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6396
;
-- Apr 4, 2012 10:13:09 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Win MODIFY Name NVARCHAR2(60) DEFAULT NULL
;
-- Apr 4, 2012 10:13:10 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Win MODIFY Name NULL
;
-- Apr 4, 2012 10:13:27 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_DATE('2012-04-04 10:13:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6395
;
-- Apr 4, 2012 10:18:27 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='N',Updated=TO_DATE('2012-04-04 10:18:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6381
;
-- Apr 4, 2012 10:18:29 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Tab MODIFY Name NVARCHAR2(60) DEFAULT NULL
;
-- Apr 4, 2012 10:18:30 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Tab MODIFY Name NULL
;
-- Apr 4, 2012 10:18:47 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_DATE('2012-04-04 10:18:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6380
;
-- Apr 4, 2012 10:26:05 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET AD_Val_Rule_ID=158,Updated=TO_DATE('2012-04-04 10:26:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13425
;
-- Apr 4, 2012 10:26:36 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Field MODIFY DisplayLogic NVARCHAR2(2000) DEFAULT NULL
;
-- Apr 4, 2012 10:26:36 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Field MODIFY DisplayLogic NULL
;
-- Apr 4, 2012 10:29:08 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET DefaultValue=NULL,Updated=TO_DATE('2012-04-04 10:29:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6351
;
-- Apr 4, 2012 10:29:11 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Field MODIFY DisplayLogic NVARCHAR2(2000) DEFAULT NULL
;
-- Apr 4, 2012 10:44:18 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='N',Updated=TO_DATE('2012-04-04 10:44:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6346
;
-- Apr 4, 2012 10:44:21 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Field MODIFY Name NVARCHAR2(60) DEFAULT NULL
;
-- Apr 4, 2012 10:44:21 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
ALTER TABLE AD_UserDef_Field MODIFY Name NULL
;
-- Apr 4, 2012 10:44:36 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_DATE('2012-04-04 10:44:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6345
;
UPDATE AD_System
SET LastMigrationScriptApplied='831_IDEMPIERE-177_Window_Customization.sql'
WHERE LastMigrationScriptApplied<'831_IDEMPIERE-177_Window_Customization.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,82 @@
-- Apr 4, 2012 10:57:20 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Tab_Trl WHERE AD_Tab_ID=254
;
-- Apr 4, 2012 10:57:20 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Tab WHERE AD_Tab_ID=254
;
-- Apr 4, 2012 10:58:04 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table_Trl WHERE AD_Table_ID=327
;
-- Apr 4, 2012 10:58:04 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table WHERE AD_Table_ID=327
;
-- Apr 4, 2012 11:00:31 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_ReportView WHERE AD_ReportView_ID=125
;
-- Apr 4, 2012 11:04:34 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Menu_Trl WHERE AD_Menu_ID=314
;
-- Apr 4, 2012 11:04:34 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Menu WHERE AD_Menu_ID=314
;
-- Apr 4, 2012 11:04:34 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_TreeNodeMM n WHERE Node_ID=314 AND EXISTS (SELECT * FROM AD_Tree t WHERE t.AD_Tree_ID=n.AD_Tree_ID AND t.TreeType='MM')
;
-- Apr 4, 2012 11:04:48 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Process_Trl WHERE AD_Process_ID=183
;
-- Apr 4, 2012 11:04:48 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Process WHERE AD_Process_ID=183
;
-- Apr 4, 2012 11:04:55 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_ReportView WHERE AD_ReportView_ID=125
;
-- Apr 4, 2012 11:05:21 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table_Trl WHERE AD_Table_ID=479
;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table WHERE AD_Table_ID=479
;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DROP VIEW RV_Product_Costing;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DROP TABLE M_Product_Costing;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
UPDATE AD_System
SET LastMigrationScriptApplied='832_IDEMPIERE-215.sql'
WHERE LastMigrationScriptApplied<'832_IDEMPIERE-215.sql'
OR LastMigrationScriptApplied IS NULL
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
-- Apr 6, 2012 4:08:25 PM CEST
-- IDEMPIERE-113 Volume and Weight are not imported in Product importer
UPDATE AD_Column SET AD_Reference_ID=12,Updated=TO_DATE('2012-04-06 16:08:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7839
;
-- Apr 6, 2012 4:10:02 PM CEST
UPDATE AD_Column SET AD_Reference_ID=12,Updated=TO_DATE('2012-04-06 16:10:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7832
;

View File

@ -0,0 +1,205 @@
-- required to fill UU columns for installations coming from transition version
UPDATE AD_Table SET AD_Table_UU='8c8d6676-6538-44f1-abf8-e480da7250b2' WHERE AD_Table_ID=200001;
UPDATE AD_Column SET AD_Column_UU='1bbcd29a-4935-4908-bea6-4f8dc313d501' WHERE AD_Column_ID=200020;
UPDATE AD_Column SET AD_Column_UU='45063c04-4fb3-46a6-b1e1-828ac5ce614c' WHERE AD_Column_ID=200021;
UPDATE AD_Column SET AD_Column_UU='e32147f8-ad0d-41a9-afc6-ad70da9ddd5f' WHERE AD_Column_ID=200022;
UPDATE AD_Column SET AD_Column_UU='6ff59e2a-33cd-4e8a-b9cd-8a377978f53c' WHERE AD_Column_ID=200023;
UPDATE AD_Column SET AD_Column_UU='2e7271de-7b31-4b10-8ffc-983789141192' WHERE AD_Column_ID=200024;
UPDATE AD_Column SET AD_Column_UU='4af1df12-baec-453a-bec9-bec84e71617e' WHERE AD_Column_ID=200025;
UPDATE AD_Column SET AD_Column_UU='1232b0fb-6166-4ecf-a172-02dde4c7256a' WHERE AD_Column_ID=200026;
UPDATE AD_Column SET AD_Column_UU='b9ea7299-e3d8-4ab1-9ff4-332e8ed562d6' WHERE AD_Column_ID=200027;
UPDATE AD_Element SET AD_Element_UU='58eb631b-8cb1-4bab-93d0-bf9f51accd2e' WHERE AD_Element_ID=200005;
UPDATE AD_Column SET AD_Column_UU='30905aed-94c4-4e8c-b2ce-de9aa41b1586' WHERE AD_Column_ID=200028;
UPDATE AD_Element SET AD_Element_UU='c6a0fa10-0414-4257-9990-5fcb38a91ef3' WHERE AD_Element_ID=200006;
UPDATE AD_Column SET AD_Column_UU='f2d3a898-4321-4a39-a8f6-f29f9daed67b' WHERE AD_Column_ID=200029;
UPDATE AD_Element SET AD_Element_UU='069a7d89-cfe4-4f89-9f32-919b7caef225' WHERE AD_Element_ID=200007;
UPDATE AD_Column SET AD_Column_UU='03a9f86d-8d7f-424b-ac2d-06b0390263e5' WHERE AD_Column_ID=200030;
UPDATE AD_Column SET AD_Column_UU='453e63fd-79ec-4453-be2a-61a90cd3847d' WHERE AD_Column_ID=200031;
UPDATE AD_Element SET AD_Element_UU='f0219a4d-ea25-473c-896a-1fe5dc6c25b8' WHERE AD_Element_ID=200008;
UPDATE AD_Column SET AD_Column_UU='8440b8a0-7a07-48cd-92f2-8a72cd8afd50' WHERE AD_Column_ID=200032;
UPDATE AD_Element SET AD_Element_UU='f2bfdcd4-9015-4135-b738-189f96469f03' WHERE AD_Element_ID=200009;
UPDATE AD_Column SET AD_Column_UU='1b12534a-0973-4a1e-97e2-58bcc4478a10' WHERE AD_Column_ID=200033;
UPDATE AD_Element SET AD_Element_UU='8f1543e0-6597-48bc-b0b0-1817bac20415' WHERE AD_Element_ID=200010;
UPDATE AD_Column SET AD_Column_UU='58ee58db-f841-4965-8af5-13ff54068f4e' WHERE AD_Column_ID=200034;
UPDATE AD_Element SET AD_Element_UU='de1b3615-148c-4cb1-9897-7fd0b5188320' WHERE AD_Element_ID=200011;
UPDATE AD_Column SET AD_Column_UU='9129c55a-0a13-4db7-b64d-bdc9fc740a4b' WHERE AD_Column_ID=200035;
UPDATE AD_Element SET AD_Element_UU='13f4a559-a32b-4118-a89b-b61d826bec35' WHERE AD_Element_ID=200012;
UPDATE AD_Column SET AD_Column_UU='56e4fd27-9418-4104-823c-7c7ebd7d0e91' WHERE AD_Column_ID=200036;
UPDATE AD_Element SET AD_Element_UU='c556911d-90fa-4e52-a569-92588720cc6c' WHERE AD_Element_ID=200013;
UPDATE AD_Column SET AD_Column_UU='a6ff1e46-b660-4ca5-8b55-f831e2633b94' WHERE AD_Column_ID=200037;
UPDATE AD_Element SET AD_Element_UU='ddc61868-2b75-49d8-a117-4d7460c09647' WHERE AD_Element_ID=200014;
UPDATE AD_Column SET AD_Column_UU='a4bf053d-8778-4f9a-a9ed-3063d27e729b' WHERE AD_Column_ID=200038;
UPDATE AD_Column SET AD_Column_UU='f44e0d81-fb24-414e-8f8b-b818a9fbb408' WHERE AD_Column_ID=200039;
UPDATE AD_Column SET AD_Column_UU='717ff97a-bdbf-4cd0-9499-33446a8e17fd' WHERE AD_Column_ID=200040;
UPDATE AD_Table SET AD_Table_UU='0ec6736e-94ff-4ff4-ae56-c3be505e1e00' WHERE AD_Table_ID=200002;
UPDATE AD_Sequence SET AD_Sequence_UU='9e99f812-6480-4053-94d9-d987b2f28665' WHERE AD_Sequence_ID=200001;
UPDATE AD_Column SET AD_Column_UU='6997dbc7-f6c2-4575-8fe6-c560c881c1ee' WHERE AD_Column_ID=200041;
UPDATE AD_Column SET AD_Column_UU='06443f4d-f34c-40ed-91f1-f68f2099d770' WHERE AD_Column_ID=200042;
UPDATE AD_Column SET AD_Column_UU='fc5b5b47-8f8c-4c72-b2d7-ec0da9186030' WHERE AD_Column_ID=200043;
UPDATE AD_Column SET AD_Column_UU='7522bd43-da4f-40d7-bdd0-1d9ef2b37d4b' WHERE AD_Column_ID=200044;
UPDATE AD_Column SET AD_Column_UU='7874a621-6c70-476c-96e8-abba949270e2' WHERE AD_Column_ID=200045;
UPDATE AD_Column SET AD_Column_UU='9718d2ad-1e01-49b7-b7c7-0ddf78925b67' WHERE AD_Column_ID=200046;
UPDATE AD_Column SET AD_Column_UU='c29855c1-dcc7-403c-86f6-30efb29e54a5' WHERE AD_Column_ID=200047;
UPDATE AD_Column SET AD_Column_UU='1e1dd8bc-358c-4b4c-b6b6-b6c496cd7d9e' WHERE AD_Column_ID=200048;
UPDATE AD_Column SET AD_Column_UU='0a26379d-e54f-434e-a570-38cd58176542' WHERE AD_Column_ID=200049;
UPDATE AD_Column SET AD_Column_UU='33f411f6-b519-410d-a2c5-cfdad5a0520c' WHERE AD_Column_ID=200050;
UPDATE AD_Column SET AD_Column_UU='77b74eff-9785-4985-9d6a-0c2e02e4c41a' WHERE AD_Column_ID=200051;
UPDATE AD_Column SET AD_Column_UU='02aeafef-79ef-43af-b76c-02cb5d92aea7' WHERE AD_Column_ID=200052;
UPDATE AD_Column SET AD_Column_UU='707ef80f-74d9-42ab-a507-ea0b9b87ef24' WHERE AD_Column_ID=200053;
UPDATE AD_Column SET AD_Column_UU='3f6af769-b634-43a5-9889-20ff0480f371' WHERE AD_Column_ID=200054;
UPDATE AD_Column SET AD_Column_UU='c28a3f40-c3a8-446e-83eb-9b461c458236' WHERE AD_Column_ID=200055;
UPDATE AD_Column SET AD_Column_UU='7c0e70c0-32a6-49c4-bf9c-f1a0746c8b02' WHERE AD_Column_ID=200056;
UPDATE AD_Column SET AD_Column_UU='f76c1c40-dbe9-42ee-9edd-9430d6b70fae' WHERE AD_Column_ID=200057;
UPDATE AD_Column SET AD_Column_UU='419e470f-e2ee-4ce8-8460-1500140d71cc' WHERE AD_Column_ID=200058;
UPDATE AD_Column SET AD_Column_UU='159d2c37-c8ca-46bd-8cdb-e1c3abf3008e' WHERE AD_Column_ID=200059;
UPDATE AD_Column SET AD_Column_UU='aeaf777e-3671-4498-aaec-4dbc37163906' WHERE AD_Column_ID=200060;
UPDATE AD_Column SET AD_Column_UU='992335c0-322b-4c02-b749-135e28931bfd' WHERE AD_Column_ID=200061;
UPDATE AD_Column SET AD_Column_UU='c06c3c93-eaa1-4564-a778-42b10f5539c1' WHERE AD_Column_ID=200062;
UPDATE AD_Column SET AD_Column_UU='7fbdb857-e16e-4d2d-836b-0251d935723b' WHERE AD_Column_ID=200063;
UPDATE AD_Column SET AD_Column_UU='62a08e0b-de59-4e0f-8324-ff590b150536' WHERE AD_Column_ID=200064;
UPDATE AD_Column SET AD_Column_UU='03ef993c-e33c-4f88-b9ba-431fc0c1449c' WHERE AD_Column_ID=200065;
UPDATE AD_Column SET AD_Column_UU='72698e67-0526-41cd-990a-dcfebf24d73e' WHERE AD_Column_ID=200066;
UPDATE AD_Column SET AD_Column_UU='a8e3de0a-07e2-493a-a7ac-429a41a47bb3' WHERE AD_Column_ID=200067;
UPDATE AD_Column SET AD_Column_UU='c1026223-a57e-4e18-9dd4-bcaa5c283649' WHERE AD_Column_ID=200068;
UPDATE AD_Column SET AD_Column_UU='b94aa816-9576-476e-99b9-258e40883b28' WHERE AD_Column_ID=200069;
UPDATE AD_Column SET AD_Column_UU='2795cb3f-08f5-416a-a413-cac3cc614b9a' WHERE AD_Column_ID=200070;
UPDATE AD_Column SET AD_Column_UU='68702b21-9a7f-42d1-8d00-430c3c42a335' WHERE AD_Column_ID=200071;
UPDATE AD_Column SET AD_Column_UU='9923bd35-b9e1-493e-9b85-7812447c65f3' WHERE AD_Column_ID=200072;
UPDATE AD_Column SET AD_Column_UU='bb6bf453-b9b7-4145-b9e2-5e0b2c3fb058' WHERE AD_Column_ID=200073;
UPDATE AD_Column SET AD_Column_UU='21e576f8-bcef-4acf-8668-198189e3d8ad' WHERE AD_Column_ID=200074;
UPDATE AD_Tab SET AD_Tab_UU='834474e3-50d5-41d4-a707-ca6363f19427' WHERE AD_Tab_ID=200000;
UPDATE AD_Field SET AD_Field_UU='8b6b26dc-1c4b-4db8-b09e-a756d8128dd6' WHERE AD_Field_ID=200005;
UPDATE AD_Field SET AD_Field_UU='73f9fbe4-fe30-48b3-b790-6581a4e61370' WHERE AD_Field_ID=200006;
UPDATE AD_Field SET AD_Field_UU='d7e2508d-3eeb-43b7-bbee-234fed237065' WHERE AD_Field_ID=200007;
UPDATE AD_Field SET AD_Field_UU='66f09047-e4cb-4b09-bcc0-6cdc109a60d6' WHERE AD_Field_ID=200008;
UPDATE AD_Field SET AD_Field_UU='65399c71-c4b2-4cab-90e0-7d61204e98da' WHERE AD_Field_ID=200009;
UPDATE AD_Field SET AD_Field_UU='65779cfa-bc31-413a-8e0c-4ef258a1b0f8' WHERE AD_Field_ID=200010;
UPDATE AD_Field SET AD_Field_UU='39f40544-5bb5-4bdb-ba4a-85b64905ad51' WHERE AD_Field_ID=200012;
UPDATE AD_Field SET AD_Field_UU='8bcb338d-e86f-488d-aaf5-98d8e2c9dca2' WHERE AD_Field_ID=200011;
UPDATE AD_Field SET AD_Field_UU='8bf1fec8-10b3-46ab-93d2-73e688fe5296' WHERE AD_Field_ID=200013;
UPDATE AD_Field SET AD_Field_UU='a7e2ad58-1b58-486f-8f49-38ca9bb28208' WHERE AD_Field_ID=200014;
UPDATE AD_Field SET AD_Field_UU='f7b15a16-dc17-486e-b19e-f9045e1be9af' WHERE AD_Field_ID=200015;
UPDATE AD_Field SET AD_Field_UU='6597ecd8-91a1-4b3a-acaa-4bb2fc3d0122' WHERE AD_Field_ID=200016;
UPDATE AD_Field SET AD_Field_UU='5223bee9-051a-4811-904d-58ddad14eac2' WHERE AD_Field_ID=200017;
UPDATE AD_Field SET AD_Field_UU='32104954-503b-455d-bdf6-f0bd8b1168a1' WHERE AD_Field_ID=200018;
UPDATE AD_Field SET AD_Field_UU='78928c1f-21bd-4fc1-bdc8-4a5145a445e0' WHERE AD_Field_ID=200019;
UPDATE AD_Field SET AD_Field_UU='86dcee6e-9d39-473b-8580-847c4fc8b37f' WHERE AD_Field_ID=200020;
UPDATE AD_Field SET AD_Field_UU='b8569191-fc3c-4c49-a95d-d0f36b02ae34' WHERE AD_Field_ID=200021;
UPDATE AD_Field SET AD_Field_UU='0f1102a0-ef80-4fb5-b68b-34103fdf5f64' WHERE AD_Field_ID=200023;
UPDATE AD_Field SET AD_Field_UU='3464b90f-85cc-4d1a-bad2-00a16ac0597d' WHERE AD_Field_ID=200022;
UPDATE AD_Field SET AD_Field_UU='d13f478d-3408-43e5-851b-396c060f5278' WHERE AD_Field_ID=200024;
UPDATE AD_Field SET AD_Field_UU='31c9b27e-53d7-47d2-95f0-f2fe497ad44c' WHERE AD_Field_ID=200025;
UPDATE AD_Field SET AD_Field_UU='a9e57492-bda2-463d-8081-d76255673b56' WHERE AD_Field_ID=200026;
UPDATE AD_Field SET AD_Field_UU='0d987f31-d5df-4efc-8cb6-d70a7dc3d433' WHERE AD_Field_ID=200027;
UPDATE AD_Field SET AD_Field_UU='faf7306c-9429-4840-a5df-9de9748ec660' WHERE AD_Field_ID=200028;
UPDATE AD_Field SET AD_Field_UU='cd3d0301-7559-4cb9-8883-aa7f2c9184b9' WHERE AD_Field_ID=200029;
UPDATE AD_Field SET AD_Field_UU='c1fe07ef-477e-4370-9583-2a24aa086316' WHERE AD_Field_ID=200030;
UPDATE AD_Field SET AD_Field_UU='3022e456-5a80-448d-81ce-837ccd8a7488' WHERE AD_Field_ID=200031;
UPDATE AD_Field SET AD_Field_UU='f67d0bc4-3239-49bd-a00e-47125316dc54' WHERE AD_Field_ID=200032;
UPDATE AD_Field SET AD_Field_UU='99e6a7fa-b939-481d-942c-0ea8fc936630' WHERE AD_Field_ID=200033;
UPDATE AD_Field SET AD_Field_UU='945e92e7-d23f-407d-88e2-741216b30bb1' WHERE AD_Field_ID=200034;
UPDATE AD_System
SET LastMigrationScriptApplied='824z_UpdateUU.sql'
WHERE LastMigrationScriptApplied<'824z_UpdateUU.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,10 @@
-- Apr 3, 2012 11:17:51 AM COT
-- IDEMPIERE-117 Add cost history table and cost movement view
INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,CreatedBy,IsActive) VALUES (1,'N',100,'Y',1000000,1000000,'N','Y',200005,'Table M_CostHistory','M_CostHistory',0,0,TO_TIMESTAMP('2012-04-03 11:17:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-04-03 11:17:50','YYYY-MM-DD HH24:MI:SS'),100,'Y')
;
UPDATE AD_System
SET LastMigrationScriptApplied='829_IDEMPIERE-117.sql'
WHERE LastMigrationScriptApplied<'829_IDEMPIERE-117.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,192 @@
-- Aug 9, 2010 8:47:17 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2010-08-09 20:47:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13424
;
-- Aug 9, 2010 8:48:24 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''Y''',Updated=TO_TIMESTAMP('2010-08-09 20:48:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6349
;
-- Aug 9, 2010 8:48:38 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''N''',Updated=TO_TIMESTAMP('2010-08-09 20:48:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6352
;
-- Aug 9, 2010 8:48:42 PM CEST
-- Default comment for updating dictionary
insert into t_alter_column values('ad_userdef_field','IsReadOnly','CHAR(1)',null,'N')
;
-- Aug 9, 2010 8:48:43 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET IsReadOnly='N' WHERE IsReadOnly IS NULL
;
-- Aug 9, 2010 8:49:01 PM CEST
-- Default comment for updating dictionary
insert into t_alter_column values('ad_userdef_field','IsDisplayed','CHAR(1)',null,'Y')
;
-- Aug 9, 2010 8:49:01 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET IsDisplayed='Y' WHERE IsDisplayed IS NULL
;
-- Aug 9, 2010 8:49:19 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''N''',Updated=TO_TIMESTAMP('2010-08-09 20:49:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6356
;
-- Aug 9, 2010 8:49:23 PM CEST
-- Default comment for updating dictionary
insert into t_alter_column values('ad_userdef_field','IsSameLine','CHAR(1)',null,'N')
;
-- Aug 9, 2010 8:49:23 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET IsSameLine='N' WHERE IsSameLine IS NULL
;
-- Aug 9, 2010 8:49:47 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='0',Updated=TO_TIMESTAMP('2010-08-09 20:49:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6355
;
-- Aug 9, 2010 8:49:51 PM CEST
-- Default comment for updating dictionary
insert into t_alter_column values('ad_userdef_field','SeqNo','NUMERIC(10)',null,'0')
;
-- Aug 9, 2010 8:49:51 PM CEST
-- Default comment for updating dictionary
UPDATE AD_UserDef_Field SET SeqNo=0 WHERE SeqNo IS NULL
;
-- Aug 9, 2010 8:52:43 PM CEST
-- Default comment for updating dictionary
UPDATE AD_Column SET DefaultValue='''''',Updated=TO_TIMESTAMP('2010-08-09 20:52:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6351
;
-- Aug 9, 2010 8:52:50 PM CEST
-- Default comment for updating dictionary
insert into t_alter_column values('ad_userdef_field','DisplayLogic','VARCHAR(2000)',null,'')
;
-- Aug 9, 2010 8:55:45 PM CEST
-- Default comment for updating dictionary
insert into t_alter_column values('ad_userdef_field','DefaultValue','VARCHAR(2000)',null,'')
;
-- Mar 5, 2012 2:16:34 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET Callout='org.compiere.model.CalloutWindowCustomization.window',Updated=TO_TIMESTAMP('2012-03-05 14:16:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6395
;
-- Mar 5, 2012 2:35:54 PM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,200000,'AD_Window.AD_Window_ID IN (SELECT AD_Window_Access.AD_Window_ID FROM AD_Window_Access WHERE AD_Window_Access.AD_Role_ID=@#AD_Role_ID@)',TO_TIMESTAMP('2012-03-05 14:35:52','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_Window of Role','S',TO_TIMESTAMP('2012-03-05 14:35:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Mar 5, 2012 2:36:34 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET AD_Val_Rule_ID=200000,Updated=TO_TIMESTAMP('2012-03-05 14:36:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6395
;
-- Mar 5, 2012 2:48:07 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET AD_Val_Rule_ID=163,Updated=TO_TIMESTAMP('2012-03-05 14:48:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6380
;
-- Mar 5, 2012 3:41:45 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET Callout='org.compiere.model.CalloutWindowCustomization.tab',Updated=TO_TIMESTAMP('2012-03-05 15:41:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6380
;
-- Mar 5, 2012 3:51:23 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET AD_Val_Rule_ID=52005,Updated=TO_TIMESTAMP('2012-03-05 15:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6345
;
-- Mar 5, 2012 3:53:30 PM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET Callout='org.compiere.model.CalloutWindowCustomization.field',Updated=TO_TIMESTAMP('2012-03-05 15:53:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6345
;
-- Mar 7, 2012 11:02:11 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200018,1663,0,10,466,'ReadOnlyLogic',TO_TIMESTAMP('2012-03-07 11:02:09','YYYY-MM-DD HH24:MI:SS'),100,'Logic to determine if field is read only (applies only when field is read-write)','D',2000,'format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
@AD_Table_ID@=14 | @Language@!GERGER <br>
@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
@Name@>J<br>
Strings may be in single quotes (optional)','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Read Only Logic',0,TO_TIMESTAMP('2012-03-07 11:02:09','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Mar 7, 2012 11:02:11 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200018 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Mar 7, 2012 11:02:19 AM CET
-- IDEMPIERE-177 Window Customization
ALTER TABLE AD_UserDef_Tab ADD COLUMN ReadOnlyLogic VARCHAR(2000) DEFAULT NULL
;
-- Mar 7, 2012 11:02:34 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,200018,200003,0,394,TO_TIMESTAMP('2012-03-07 11:02:33','YYYY-MM-DD HH24:MI:SS'),100,'Logic to determine if field is read only (applies only when field is read-write)',2000,'D','format := {expression} [{logic} {expression}]<br>
expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
logic := {|}|{&}<br>
context := any global or window context <br>
value := strings or numbers<br>
logic operators := AND or OR with the previous result from left to right <br>
operand := eq{=}, gt{&gt;}, le{&lt;}, not{~^!} <br>
Examples: <br>
@AD_Table_ID@=14 | @Language@!GERGER <br>
@PriceLimit@>10 | @PriceList@>@PriceActual@<br>
@Name@>J<br>
Strings may be in single quotes (optional)','Y','Y','Y','N','N','N','N','N','Read Only Logic',TO_TIMESTAMP('2012-03-07 11:02:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Mar 7, 2012 11:02:34 AM CET
-- IDEMPIERE-177 Window Customization
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200003 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Mar 7, 2012 11:02:41 AM CET
-- IDEMPIERE-177 Window Customization
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=200003
;
-- Apr 3, 2012 3:11:59 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2012-04-03 15:11:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6396
;
-- Apr 3, 2012 3:13:25 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2012-04-03 15:13:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6399
;
-- Apr 3, 2012 3:15:11 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2012-04-03 15:15:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6381
;
-- Apr 3, 2012 3:16:32 PM CEST
-- IDEMPIERE-177 Window Customization
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2012-04-03 15:16:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6346
;
UPDATE AD_System
SET LastMigrationScriptApplied='830_IDEMPIERE-177_Window_Customization.sql'
WHERE LastMigrationScriptApplied<'830_IDEMPIERE-177_Window_Customization.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,75 @@
-- Apr 4, 2012 10:13:06 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='N',Updated=TO_TIMESTAMP('2012-04-04 10:13:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6396
;
-- Apr 4, 2012 10:13:09 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_win','Name','VARCHAR(60)',null,'NULL')
;
-- Apr 4, 2012 10:13:10 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_win','Name',null,'NULL',null)
;
-- Apr 4, 2012 10:13:27 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_TIMESTAMP('2012-04-04 10:13:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6395
;
-- Apr 4, 2012 10:18:27 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='N',Updated=TO_TIMESTAMP('2012-04-04 10:18:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6381
;
-- Apr 4, 2012 10:18:29 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_tab','Name','VARCHAR(60)',null,'NULL')
;
-- Apr 4, 2012 10:18:30 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_tab','Name',null,'NULL',null)
;
-- Apr 4, 2012 10:18:47 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_TIMESTAMP('2012-04-04 10:18:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6380
;
-- Apr 4, 2012 10:29:08 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET DefaultValue=NULL,Updated=TO_TIMESTAMP('2012-04-04 10:29:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6351
;
-- Apr 4, 2012 10:29:11 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_field','DisplayLogic','VARCHAR(2000)',null,'NULL')
;
-- Apr 4, 2012 10:44:18 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='N',Updated=TO_TIMESTAMP('2012-04-04 10:44:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6346
;
-- Apr 4, 2012 10:44:21 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_field','Name','VARCHAR(60)',null,'NULL')
;
-- Apr 4, 2012 10:44:21 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
INSERT INTO t_alter_column values('ad_userdef_field','Name',null,'NULL',null)
;
-- Apr 4, 2012 10:44:36 AM COT
-- IDEMPIERE-177 Complete Window Customization functionality
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=1,Updated=TO_TIMESTAMP('2012-04-04 10:44:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6345
;
UPDATE AD_System
SET LastMigrationScriptApplied='831_IDEMPIERE-177_Window_Customization.sql'
WHERE LastMigrationScriptApplied<'831_IDEMPIERE-177_Window_Customization.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,76 @@
-- Apr 4, 2012 10:57:20 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Tab_Trl WHERE AD_Tab_ID=254
;
-- Apr 4, 2012 10:57:20 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Tab WHERE AD_Tab_ID=254
;
-- Apr 4, 2012 10:58:04 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table_Trl WHERE AD_Table_ID=327
;
-- Apr 4, 2012 10:58:04 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table WHERE AD_Table_ID=327
;
-- Apr 4, 2012 11:04:34 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Menu_Trl WHERE AD_Menu_ID=314
;
-- Apr 4, 2012 11:04:34 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Menu WHERE AD_Menu_ID=314
;
-- Apr 4, 2012 11:04:34 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_TreeNodeMM WHERE Node_ID=314 AND EXISTS (SELECT * FROM AD_Tree t WHERE t.AD_Tree_ID=AD_TreeNodeMM.AD_Tree_ID AND t.TreeType='MM')
;
-- Apr 4, 2012 11:04:48 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Process_Trl WHERE AD_Process_ID=183
;
-- Apr 4, 2012 11:04:48 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Process WHERE AD_Process_ID=183
;
-- Apr 4, 2012 11:04:55 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_ReportView WHERE AD_ReportView_ID=125
;
-- Apr 4, 2012 11:05:21 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table_Trl WHERE AD_Table_ID=479
;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DELETE FROM AD_Table WHERE AD_Table_ID=479
;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DROP VIEW RV_Product_Costing;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
DROP TABLE M_Product_Costing;
-- Apr 4, 2012 11:05:22 AM MYT
-- IDEMPIERE-215 Costing: Remove M_Product_Costing
UPDATE AD_System
SET LastMigrationScriptApplied='832_IDEMPIERE-215.sql'
WHERE LastMigrationScriptApplied<'832_IDEMPIERE-215.sql'
OR LastMigrationScriptApplied IS NULL
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
-- Apr 6, 2012 4:08:25 PM CEST
-- IDEMPIERE-113 Volume and Weight are not imported in Product importer
UPDATE AD_Column SET AD_Reference_ID=12,Updated=TO_TIMESTAMP('2012-04-06 16:08:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7839
;
-- Apr 6, 2012 4:10:02 PM CEST
UPDATE AD_Column SET AD_Reference_ID=12,Updated=TO_TIMESTAMP('2012-04-06 16:10:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7832
;

View File

@ -0,0 +1,137 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2012 Dirk Niemeyer *
* Copyright (C) 2012 action 42 GmbH *
* 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.compiere.model;
import java.util.Properties;
import org.adempiere.model.GridTabWrapper;
import org.compiere.util.Env;
/**
* Window Customization Callout
*
* @author Dirk Niemeyer, action42 GmbH
*/
public class CalloutWindowCustomization extends CalloutEngine
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Set fields to current values from DB for selected window.
* @param ctx context
* @param WindowNo window no
* @param mTab tab
* @param mField field
* @param value value
* @return null or error message
*/
public String window (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer AD_Window_ID = (Integer)value;
if (AD_Window_ID == null || AD_Window_ID.intValue() == 0)
return "";
I_AD_UserDef_Win ud_win = GridTabWrapper.create(mTab, I_AD_UserDef_Win.class);
MWindow window = new MWindow(Env.getCtx(),AD_Window_ID, null);
String lang = (String)mTab.getValue("AD_Language");
ud_win.setName(window.get_Translation("Name", lang));
ud_win.setDescription(window.get_Translation("Description", lang));
ud_win.setHelp(window.get_Translation("Help", lang));
// XXX what for?
ud_win.setIsDefault(window.isDefault());
// default from menu, actual from role
// XXX Read Only
// XXX User updateable
return NO_ERROR;
} // storeAttachmentOnFilesystem
/**
* Set fields to current values from DB for selected Tab
* @param ctx context
* @param WindowNo window no
* @param mTab tab
* @param mField field
* @param value value
* @return null or error message
*/
public String tab (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer p_AD_Tab_ID = (Integer)value;
if (p_AD_Tab_ID == null || p_AD_Tab_ID.intValue() == 0)
return "";
I_AD_UserDef_Tab ud_tab = GridTabWrapper.create(mTab, I_AD_UserDef_Tab.class);
MTab tab = new MTab(Env.getCtx(),p_AD_Tab_ID, null);
String lang = Env.getContext(ctx, WindowNo, "AD_Language");
ud_tab.setName(tab.get_Translation("Name", lang));
ud_tab.setDescription(tab.get_Translation("Description", lang));
ud_tab.setHelp(tab.get_Translation("Help", lang));
ud_tab.setIsSingleRow(tab.isSingleRow());
ud_tab.setIsReadOnly(tab.isReadOnly());
return NO_ERROR;
} // storeArchiveOnFileSystem
/**
* Set fields to current values from DB for selected Tab
* @param ctx context
* @param WindowNo window no
* @param mTab tab
* @param mField field
* @param value value
* @return null or error message
*/
public String field (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer p_AD_Field_ID = (Integer)value;
if (p_AD_Field_ID == null || p_AD_Field_ID.intValue() == 0)
return "";
I_AD_UserDef_Field ud_field = GridTabWrapper.create(mTab, I_AD_UserDef_Field.class);
MField field = new MField(Env.getCtx(),p_AD_Field_ID, null);
String lang = Env.getContext(ctx, WindowNo, "AD_Language");
ud_field.setName(field.get_Translation("Name", lang));
ud_field.setDescription(field.get_Translation("Description", lang));
ud_field.setHelp(field.get_Translation("Help", lang));
ud_field.setIsDisplayed(field.isDisplayed());
ud_field.setDisplayLength(field.getDisplayLength());
ud_field.setDisplayLogic(field.getDisplayLogic());
ud_field.setIsReadOnly(field.isReadOnly());
// XXX from column? set to true for starters
ud_field.setIsUpdateable(true);
ud_field.setSeqNo(field.getSeqNo());
ud_field.setIsSameLine(field.isSameLine());
ud_field.setSortNo(field.getSortNo().intValue());
return NO_ERROR;
} // storeArchiveOnFileSystem
} // CalloutClient

View File

@ -60,7 +60,6 @@ public class CostUpdate extends SvrProcess
private static final String TO_FutureStandardCost = "f";
private static final String TO_LastInvoicePrice = "i";
private static final String TO_LastPOPrice = "p";
private static final String TO_OldStandardCost = "x";
/** Standard Cost Element */
private MCostElement m_ce = null;
@ -464,10 +463,6 @@ public class CostUpdate extends SvrProcess
retValue = xCost.getCurrentCostPrice();
}
// Old Std Costs
else if (to.equals(TO_OldStandardCost))
retValue = getOldCurrentCostPrice(cost);
// Price List
else if (to.equals(TO_PriceListLimit))
retValue = getPrice(cost);
@ -496,51 +491,6 @@ public class CostUpdate extends SvrProcess
return ce;
} // getCostElement
/**
* Get Old Current Cost Price
* @param cost costs
* @return price if found
*/
private BigDecimal getOldCurrentCostPrice(MCost cost)
{
BigDecimal retValue = null;
String sql = "SELECT CostStandard, CurrentCostPrice "
+ "FROM M_Product_Costing "
+ "WHERE M_Product_ID=? AND C_AcctSchema_ID=?";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, cost.getM_Product_ID());
pstmt.setInt (2, cost.getC_AcctSchema_ID());
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
{
retValue = rs.getBigDecimal(1);
if (retValue == null || retValue.signum() == 0)
retValue = rs.getBigDecimal(2);
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return retValue;
} // getOldCurrentCostPrice
/**
* Get Price from Price List
* @param cost cost record

View File

@ -44,6 +44,7 @@ import org.compiere.util.DB;
import org.compiere.util.TimeUtil;
import org.eevolution.model.X_DD_Order;
import org.eevolution.model.X_HR_Process;
import org.eevolution.model.X_PP_Cost_Collector;
import org.eevolution.model.X_PP_Order;
/**
@ -243,6 +244,8 @@ public class FactAcctReset extends SvrProcess
docBaseType = "= '" + MPeriodControl.DOCBASETYPE_DistributionOrder+ "'";
else if (AD_Table_ID == X_HR_Process.Table_ID)
docBaseType = "= '" + MPeriodControl.DOCBASETYPE_Payroll+ "'";
else if (AD_Table_ID == X_PP_Cost_Collector.Table_ID)
docBaseType = "= '" + MPeriodControl.DOCBASETYPE_ManufacturingCostCollector+ "'";
//
if (docBaseType == null)
{

View File

@ -1,293 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
* Portions created by Carlos Ruiz are Copyright (C) 2005 QSS Ltda.
* Contributor(s): Carlos Ruiz (globalqss)
*****************************************************************************/
package org.compiere.process;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import org.compiere.util.AdempiereUserError;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.ValueNamePair;
/**
* Title: Create the (new) costing information
* Description:
* - (optionally) update FutureCostPrice according to Parameter
* - (optionally) set CostStandard to FutureCostPrice
* - set CurrentCostPrice to cost depending on primary AcctSchema
*
* @author Carlos Ruiz (globalqss)
* @version $Id: M_Product_CostingUpdate.java,v 1.0 2005/09/26 22:28:00 globalqss Exp $
*/
public class M_Product_CostingUpdate extends SvrProcess
{
/** The Record */
private int p_Record_ID = 0;
private int p_AD_Client_ID = -1;
private int p_M_Product_Category_ID = -1;
private String p_SetFutureCostTo;
private int p_M_PriceList_Version_ID = -1;
private String p_SetStandardCost;
private String v_CostingMethod;
/**
* Prepare - e.g., get Parameters.
*/
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter() == null)
;
else if (name.equals("AD_Client_ID"))
p_AD_Client_ID = para[i].getParameterAsInt();
else if (name.equals("M_Product_Category_ID"))
p_M_Product_Category_ID = para[i].getParameterAsInt();
else if (name.equals("SetFutureCostTo"))
p_SetFutureCostTo = (String) para[i].getParameter();
else if (name.equals("M_PriceList_Version_ID"))
p_M_PriceList_Version_ID = para[i].getParameterAsInt();
else if (name.equals("SetStandardCost"))
p_SetStandardCost = (String) para[i].getParameter();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
}
p_Record_ID = getRecord_ID();
} // prepare
/**
* Process
* @return message
* @throws Exception
*/
protected String doIt() throws Exception
{
StringBuffer sql = null;
int no = 0;
int no1 = 0;
int no2 = 0;
log.info("Create the (new) costing information");
// ========== (1) Set Future Cost To ==========
if (p_SetFutureCostTo.equals("S")) {
// S - Standard Cost
log.info("Set to Standard Cost");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = CostStandard " +
"WHERE AD_Client_ID=" + p_AD_Client_ID + " AND " +
"("+ p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID= " + p_M_Product_Category_ID + " " +
"AND p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to Standard Cost:ERROR", sql.toString());
} else if (p_SetFutureCostTo.equals("DP")) {
// DP - Difference PO
log.info("Set to Difference PO");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = CostStandard + (CostStandardPOAmt/CostStandardPOQty) " +
"WHERE CostStandardPOQty <> 0 AND " +
"CostStandardPOAmt <> 0 AND " +
"AD_Client_ID="+p_AD_Client_ID+" AND " +
"("+ p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
"p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to Difference PO:ERROR", sql.toString());
} else if (p_SetFutureCostTo.equals("DI")) {
// DI - Difference Invoice
log.info("Set to Difference Inv");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = CostStandard + (CostStandardCumAmt/CostStandardCumQty) " +
"WHERE CostStandardCumQty <> 0 AND " +
"CostStandardCumAmt <> 0 AND " +
"AD_Client_ID="+p_AD_Client_ID+" AND " +
"("+ p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
"p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to Difference Inv:ERROR", sql.toString());
} else if (p_SetFutureCostTo.equals("P")) {
// P - Last PO Price
log.info("Set to PO Price");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = PriceLastPO " +
"WHERE PriceLastPO <> 0 AND " +
"AD_Client_ID="+p_AD_Client_ID+" AND " +
"("+ p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
"p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to PO Price:ERROR", sql.toString());
} else if (p_SetFutureCostTo.equals("I")) {
// L - Last Inv Price
log.info("Set to Inv Price");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = PriceLastInv " +
"WHERE PriceLastInv <> 0 AND " +
"AD_Client_ID="+p_AD_Client_ID+" AND " +
"("+ p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
"p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to Inv Price:ERROR", sql.toString());
} else if (p_SetFutureCostTo.equals("A")) {
// A - Average Cost
log.info("Set to Average Cost");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = CostAverage " +
"WHERE CostAverage <> 0 AND " +
"AD_Client_ID="+p_AD_Client_ID+" AND " +
"("+ p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" AND " +
"p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to Average Cost:ERROR", sql.toString());
} else if (p_SetFutureCostTo.equals("LL") && p_M_PriceList_Version_ID > 0) {
// A - Average Cost
log.info("Set to PriceList " + p_M_PriceList_Version_ID);
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET FutureCostPrice = " +
"(SELECT pp.PriceLimit " +
"FROM M_ProductPrice pp " +
"WHERE pp.M_PriceList_Version_ID="+p_M_PriceList_Version_ID+" AND " +
"pp.M_Product_ID=M_Product_Costing.M_Product_ID)" +
/** SET FutureCostPrice = C_Currency_Convert (
-- Amount
(SELECT pp.PriceLimit FROM M_ProductPrice pp
WHERE pp.M_PriceList_Version_ID=11
AND pp.M_Product_ID=M_Product_Costing.M_Product_ID),
-- Cur From
(SELECT C_Currency_ID FROM M_PriceList pl, M_PriceList_Version pv
WHERE pv.M_PriceList_ID=pl.M_PriceList_ID
AND pv.M_PriceList_Version_ID=11),
-- Cur To
(SELECT a.C_Currency_ID FROM C_AcctSchema a WHERE a.C_AcctSchema_ID=M_Product_Costing.C_AcctSchema_ID))
**/
"WHERE AD_Client_ID="+p_AD_Client_ID+ " " +
// we have a price
"AND EXISTS (SELECT * FROM M_ProductPrice pp " +
"WHERE pp.M_PriceList_Version_ID="+p_M_PriceList_Version_ID+" " +
"AND pp.M_Product_ID=M_Product_Costing.M_Product_ID) " +
// and the same currency
"AND EXISTS (SELECT * FROM C_AcctSchema a, M_PriceList pl, M_PriceList_Version pv " +
"WHERE a.C_AcctSchema_ID=M_Product_CostingUpdate.C_AcctSchema_ID " +
"AND pv.M_PriceList_Version_ID="+p_M_PriceList_Version_ID+" " +
"AND pv.M_PriceList_ID=pl.M_PriceList_ID " +
"AND pl.C_Currency_ID=a.C_Currency_ID) " +
"AND ("+p_M_Product_Category_ID+" = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+" " +
"AND p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) raiseError("Set to Average Cost:ERROR", sql.toString());
} else {
log.info("SetFutureCostTo=" + p_SetFutureCostTo + " ?");
}
log.info(" - Updated: " + no);
// ========== (2) SetStandardCost ==========
if (p_SetStandardCost.equals("Y")) {
// A - Average Cost
log.info("Set Standard Cost");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET CostStandard = FutureCostPrice " +
"WHERE AD_Client_ID="+ p_AD_Client_ID + " AND " +
"(" + p_M_Product_Category_ID + " = -1 OR " +
"EXISTS (SELECT * FROM M_Product p " +
"WHERE p.M_Product_Category_ID="+p_M_Product_Category_ID+ " AND " +
"p.M_Product_ID=M_Product_Costing.M_Product_ID))");
no1 = DB.executeUpdate(sql.toString(), get_TrxName());
if (no1 == -1) raiseError("Set Standard Cost", sql.toString());
}
// ========== (3) Update CurrentCostPrice depending on Costing Method ==========
try
{
PreparedStatement pstmt = DB.prepareStatement
("SELECT a.CostingMethod " +
"FROM C_AcctSchema a, AD_ClientInfo ci " +
"WHERE a.C_AcctSchema_ID=ci.C_AcctSchema1_ID AND " +
"ci.AD_Client_ID="+p_AD_Client_ID, get_TrxName());
ResultSet rs = pstmt.executeQuery();
if (rs.next())
v_CostingMethod = rs.getString(1);
rs.close();
pstmt.close();
}
catch (SQLException e)
{
throw new Exception ("select CostingMethod", e);
}
// (A)verage (S)tandard
log.info("Update Current Cost " + v_CostingMethod);
log.info("Set Standard Cost");
sql = new StringBuffer(
"UPDATE M_Product_Costing " +
"SET CurrentCostPrice = " +
"DECODE ('"+ v_CostingMethod + "', 'A', CostAverage, CostStandard) " +
"WHERE AD_Client_ID="+p_AD_Client_ID);
no2 = DB.executeUpdate(sql.toString(), get_TrxName());
if (no2 == -1) raiseError("Set Standard Cost", sql.toString());
log.info(" - Updated: " + no2);
return "@Updated@: " + no + "/" + no1;
} // doIt
private void raiseError(String string, String sql) throws Exception {
DB.rollback(false, get_TrxName());
String msg = string;
ValueNamePair pp = CLogger.retrieveError();
if (pp != null)
msg = pp.getName() + " - ";
msg += sql;
throw new AdempiereUserError (msg);
}
} // M_Product_CostingUpdate

View File

@ -284,12 +284,6 @@ public class OrgOwnership extends SvrProcess
if (no != 0)
log.fine("generalOwnership - C_BP_Withholding=" + no);
// Costing
sql = "UPDATE M_Product_Costing " + set;
no = DB.executeUpdate(sql, get_TrxName());
if (no != 0)
log.fine("generalOwnership - M_Product_Costing=" + no);
// Replenish
sql = "UPDATE M_Replenish " + set;
no = DB.executeUpdate(sql, get_TrxName());

View File

@ -189,9 +189,11 @@ public class T_InventoryValue_Create extends SvrProcess
+ "AND plv.M_PriceList_ID=pl.M_PriceList_ID), "
+ "CostStandard = "
+ "(SELECT currencyConvert(pc.CurrentCostPrice,acs.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue, null, T_InventoryValue.AD_Client_ID, T_InventoryValue.AD_Org_ID) "
+ "FROM AD_ClientInfo ci, C_AcctSchema acs, M_Product_Costing pc "
+ "FROM AD_ClientInfo ci, C_AcctSchema acs, M_Cost pc, M_CostElement ce "
+ "WHERE T_InventoryValue.AD_Client_ID=ci.AD_Client_ID AND ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID "
+ "AND acs.C_AcctSchema_ID=pc.C_AcctSchema_ID "
+ "AND acs.C_AcctSchema_ID=pc.C_AcctSchema_ID "
+ "AND pc.M_CostElement_ID=ce.M_CostElement_ID "
+ "AND ce.CostingMethod='S'"
+ "AND T_InventoryValue.M_Product_ID=pc.M_Product_ID) "
+ "WHERE T_InventoryValue.M_Warehouse_ID = " + p_M_Warehouse_ID;
cntu = DB.executeUpdate(sqlupd, get_TrxName());

View File

@ -163,23 +163,34 @@ public class Doc_InOut extends Doc
{
for (int i = 0; i < p_lines.length; i++)
{
DocLine line = p_lines[i];
// MZ Goodwill
// if Shipment CostDetail exist then get Cost from Cost Detail
BigDecimal costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
// end MZ
if (costs == null || costs.signum() == 0) // zero costs OK
DocLine line = p_lines[i];
BigDecimal costs = null;
if (!isReversal(line))
{
MProduct product = line.getProduct();
if (product.isStocked())
// MZ Goodwill
// if Shipment CostDetail exist then get Cost from Cost Detail
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
// end MZ
if (costs == null || costs.signum() == 0) // zero costs OK
{
p_Error = "No Costs for " + line.getProduct().getName();
log.log(Level.WARNING, p_Error);
return null;
MProduct product = line.getProduct();
if (product.isStocked())
{
p_Error = "No Costs for " + line.getProduct().getName();
log.log(Level.WARNING, p_Error);
return null;
}
else // ignore service
continue;
}
else // ignore service
continue;
}
else
{
//temp to avoid NPE
costs = BigDecimal.ZERO;
}
// CoGS DR
dr = fact.createLine(line,
line.getAccount(ProductCost.ACCTTYPE_P_Cogs, as),
@ -195,8 +206,8 @@ public class Doc_InOut extends Doc
dr.setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
dr.setAD_Org_ID(line.getOrder_Org_ID()); // Revenue X-Org
dr.setQty(line.getQty().negate());
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed)
&& m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctDr from Original Shipment/Receipt
if (!dr.updateReverseLine (MInOut.Table_ID,
@ -220,8 +231,8 @@ public class Doc_InOut extends Doc
cr.setM_Locator_ID(line.getM_Locator_ID());
cr.setLocationFromLocator(line.getM_Locator_ID(), true); // from Loc
cr.setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed)
&& m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctCr from Original Shipment/Receipt
if (!cr.updateReverseLine (MInOut.Table_ID,
@ -235,14 +246,17 @@ public class Doc_InOut extends Doc
//
if (line.getM_Product_ID() != 0)
{
MCostDetail.createShipment(as, line.getAD_Org_ID(),
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(),
line.getDescription(), true, getTrxName());
line.getDescription(), true, getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
} // for all lines
updateProductInfo(as.getC_AcctSchema_ID()); // only for SO!
/** Commitment release ****/
if (as.isAccrual() && as.isCreateSOCommitment())
@ -264,22 +278,30 @@ public class Doc_InOut extends Doc
for (int i = 0; i < p_lines.length; i++)
{
DocLine line = p_lines[i];
// MZ Goodwill
// if Shipment CostDetail exist then get Cost from Cost Detail
BigDecimal costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
// end MZ
if (costs == null || costs.signum() == 0) // zero costs OK
BigDecimal costs = null;
if (!isReversal(line))
{
MProduct product = line.getProduct();
if (product.isStocked())
// MZ Goodwill
// if Shipment CostDetail exist then get Cost from Cost Detail
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
// end MZ
if (costs == null || costs.signum() == 0) // zero costs OK
{
p_Error = "No Costs for " + line.getProduct().getName();
log.log(Level.WARNING, p_Error);
return null;
MProduct product = line.getProduct();
if (product.isStocked())
{
p_Error = "No Costs for " + line.getProduct().getName();
log.log(Level.WARNING, p_Error);
return null;
}
else // ignore service
continue;
}
else // ignore service
continue;
}
else
{
costs = BigDecimal.ZERO;
}
// Inventory DR
dr = fact.createLine(line,
@ -294,8 +316,7 @@ public class Doc_InOut extends Doc
dr.setM_Locator_ID(line.getM_Locator_ID());
dr.setLocationFromLocator(line.getM_Locator_ID(), true); // from Loc
dr.setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed)
&& m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctDr from Original Shipment/Receipt
if (!dr.updateReverseLine (MInOut.Table_ID,
@ -309,11 +330,15 @@ public class Doc_InOut extends Doc
//
if (line.getM_Product_ID() != 0)
{
MCostDetail.createShipment(as, line.getAD_Org_ID(),
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(),
line.getDescription(), true, getTrxName());
line.getDescription(), true, getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
// CoGS CR
@ -331,8 +356,7 @@ public class Doc_InOut extends Doc
cr.setLocationFromBPartner(getC_BPartner_Location_ID(), false); // to Loc
cr.setAD_Org_ID(line.getOrder_Org_ID()); // Revenue X-Org
cr.setQty(line.getQty().negate());
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed)
&& m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctCr from Original Shipment/Receipt
if (!cr.updateReverseLine (MInOut.Table_ID,
@ -343,7 +367,6 @@ public class Doc_InOut extends Doc
}
}
} // for all lines
updateProductInfo(as.getC_AcctSchema_ID()); // only for SO!
} // Sales Return
// *** Purchasing - Receipt
@ -357,55 +380,67 @@ public class Doc_InOut extends Doc
DocLine line = p_lines[i];
BigDecimal costs = null;
MProduct product = line.getProduct();
//get costing method for product
String costingMethod = product.getCostingMethod(as);
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) )
if (!isReversal(line))
{
int C_OrderLine_ID = line.getC_OrderLine_ID();
// Low - check if c_orderline_id is valid
if (C_OrderLine_ID > 0)
//get costing method for product
String costingMethod = product.getCostingMethod(as);
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) )
{
MOrderLine orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName());
// Elaine 2008/06/26
C_Currency_ID = orderLine.getC_Currency_ID();
//
costs = orderLine.getPriceCost();
if (costs == null || costs.signum() == 0)
{
costs = orderLine.getPriceActual();
// Goodwill: Correct included Tax
int C_Tax_ID = orderLine.getC_Tax_ID();
if (orderLine.isTaxIncluded() && C_Tax_ID != 0)
{
MTax tax = MTax.get(getCtx(), C_Tax_ID);
if (!tax.isZeroTax())
int C_OrderLine_ID = line.getC_OrderLine_ID();
// Low - check if c_orderline_id is valid
if (C_OrderLine_ID > 0)
{
MOrderLine orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName());
// Elaine 2008/06/26
C_Currency_ID = orderLine.getC_Currency_ID();
//
costs = orderLine.getPriceCost();
if (costs == null || costs.signum() == 0)
{
costs = orderLine.getPriceActual();
// Goodwill: Correct included Tax
int C_Tax_ID = orderLine.getC_Tax_ID();
if (orderLine.isTaxIncluded() && C_Tax_ID != 0)
{
int stdPrecision = MCurrency.getStdPrecision(getCtx(), C_Currency_ID);
BigDecimal costTax = tax.calculateTax(costs, true, stdPrecision);
log.fine("Costs=" + costs + " - Tax=" + costTax);
costs = costs.subtract(costTax);
}
} // correct included Tax
}
costs = costs.multiply(line.getQty());
}
else
{
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
}
//
}
MTax tax = MTax.get(getCtx(), C_Tax_ID);
if (!tax.isZeroTax())
{
int stdPrecision = MCurrency.getStdPrecision(getCtx(), C_Currency_ID);
BigDecimal costTax = tax.calculateTax(costs, true, stdPrecision);
log.fine("Costs=" + costs + " - Tax=" + costTax);
costs = costs.subtract(costTax);
}
} // correct included Tax
}
costs = costs.multiply(line.getQty());
}
else
{
p_Error = "Resubmit - No Costs for " + product.getName();
log.log(Level.WARNING, p_Error);
return null;
}
//
}
else
{
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
}
if (costs == null || costs.signum() == 0)
{
p_Error = "Resubmit - No Costs for " + product.getName();
log.log(Level.WARNING, p_Error);
return null;
}
}
else
{
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
}
if (costs == null || costs.signum() == 0)
{
p_Error = "Resubmit - No Costs for " + product.getName();
log.log(Level.WARNING, p_Error);
return null;
costs = BigDecimal.ZERO;
}
// Inventory/Asset DR
MAccount assets = line.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
if (product.isService())
@ -434,7 +469,7 @@ public class Doc_InOut extends Doc
dr.setM_Locator_ID(line.getM_Locator_ID());
dr.setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
dr.setLocationFromLocator(line.getM_Locator_ID(), false); // to Loc
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctDr from Original Shipment/Receipt
if (!dr.updateReverseLine (MInOut.Table_ID,
@ -464,7 +499,7 @@ public class Doc_InOut extends Doc
cr.setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
cr.setLocationFromLocator(line.getM_Locator_ID(), false); // to Loc
cr.setQty(line.getQty().negate());
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctCr from Original Shipment/Receipt
if (!cr.updateReverseLine (MInOut.Table_ID,
@ -487,34 +522,19 @@ public class Doc_InOut extends Doc
DocLine line = p_lines[i];
BigDecimal costs = null;
MProduct product = line.getProduct();
/*
* BF: [ 2048984 ] Purchase Return costing logic
//get costing method for product
String costingMethod = product.getCostingMethod(as);
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) )
if (!isReversal(line))
{
int C_OrderLine_ID = line.getC_OrderLine_ID();
MOrderLine orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName());
costs = orderLine.getPriceCost();
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
if (costs == null || costs.signum() == 0)
costs = orderLine.getPriceActual();
costs = costs.multiply(line.getQty());
// Elaine 2008/06/26
C_Currency_ID = orderLine.getC_Currency_ID();
//
{
p_Error = "Resubmit - No Costs for " + product.getName();
log.log(Level.WARNING, p_Error);
return null;
}
}
else
{
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
}
*/
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
if (costs == null || costs.signum() == 0)
{
p_Error = "Resubmit - No Costs for " + product.getName();
log.log(Level.WARNING, p_Error);
return null;
costs = BigDecimal.ZERO;
}
// NotInvoicedReceipt DR
// Elaine 2008/06/26
@ -535,7 +555,7 @@ public class Doc_InOut extends Doc
dr.setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
dr.setLocationFromLocator(line.getM_Locator_ID(), false); // to Loc
dr.setQty(line.getQty().negate());
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctDr from Original Shipment/Receipt
if (!dr.updateReverseLine (MInOut.Table_ID,
@ -565,7 +585,7 @@ public class Doc_InOut extends Doc
cr.setM_Locator_ID(line.getM_Locator_ID());
cr.setLocationFromBPartner(getC_BPartner_Location_ID(), true); // from Loc
cr.setLocationFromLocator(line.getM_Locator_ID(), false); // to Loc
if (m_DocStatus.equals(MInOut.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctCr from Original Shipment/Receipt
if (!cr.updateReverseLine (MInOut.Table_ID,
@ -588,35 +608,9 @@ public class Doc_InOut extends Doc
return facts;
} // createFact
/**
* Update Sales Order Costing Product Info (old).
* Purchase side handled in Invoice Matching.
* <br>
* decrease average cumulatives
* @param C_AcctSchema_ID accounting schema
* @deprecated old costing
*/
private void updateProductInfo (int C_AcctSchema_ID)
{
log.fine("M_InOut_ID=" + get_ID());
// Old Model
StringBuffer sql = new StringBuffer(
//FYRACLE add pc. everywhere
"UPDATE M_Product_Costing pc "
+ "SET (CostAverageCumQty, CostAverageCumAmt)="
+ "(SELECT pc.CostAverageCumQty - SUM(il.MovementQty),"
+ " pc.CostAverageCumAmt - SUM(il.MovementQty*pc.CurrentCostPrice) "
+ "FROM M_InOutLine il "
+ "WHERE pc.M_Product_ID=il.M_Product_ID"
+ " AND il.M_InOut_ID=").append(get_ID()).append(") ")
.append("WHERE EXISTS (SELECT * "
+ "FROM M_InOutLine il "
+ "WHERE pc.M_Product_ID=il.M_Product_ID"
+ " AND il.M_InOut_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - Updated=" + no);
//
} // updateProductInfo
private boolean isReversal(DocLine line) {
return m_DocStatus.equals(MInOut.DOCSTATUS_Reversed)
&& m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
}
} // Doc_InOut

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MCostDetail;
import org.compiere.model.MInventory;
import org.compiere.model.MInventoryLine;
import org.compiere.model.ProductCost;
@ -147,14 +148,22 @@ public class Doc_Inventory extends Doc
for (int i = 0; i < p_lines.length; i++)
{
DocLine line = p_lines[i];
// MZ Goodwill
// if Physical Inventory CostDetail is exist then get Cost from Cost Detail
BigDecimal costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InventoryLine_ID=?");
// end MZ
if (costs == null || costs.signum() == 0)
BigDecimal costs = null;
if (!isReversal(line))
{
p_Error = "No Costs for " + line.getProduct().getName();
return null;
// MZ Goodwill
// if Physical Inventory CostDetail is exist then get Cost from Cost Detail
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InventoryLine_ID=?");
// end MZ
if (costs == null || costs.signum() == 0)
{
p_Error = "No Costs for " + line.getProduct().getName();
return null;
}
}
else
{
costs = BigDecimal.ZERO;
}
// Inventory DR CR
dr = fact.createLine(line,
@ -164,7 +173,7 @@ public class Doc_Inventory extends Doc
if (dr == null)
continue;
dr.setM_Locator_ID(line.getM_Locator_ID());
if (m_DocStatus.equals(MInventory.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctDr from Original Phys.Inventory
if (!dr.updateReverseLine (MInventory.Table_ID,
@ -178,9 +187,7 @@ public class Doc_Inventory extends Doc
// InventoryDiff DR CR
// or Charge
MAccount invDiff = null;
if (m_DocStatus.equals(MInventory.DOCSTATUS_Reversed)
&& m_Reversal_ID != 0
&& line.getReversalLine_ID() != 0
if (isReversal(line)
&& line.getC_Charge_ID() != 0) {
invDiff = line.getChargeAccount(as, costs);
} else {
@ -198,7 +205,7 @@ public class Doc_Inventory extends Doc
if (line.getC_Charge_ID() != 0) // explicit overwrite for charge
cr.setAD_Org_ID(line.getAD_Org_ID());
if (m_DocStatus.equals(MInventory.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctCr from Original Phys.Inventory
if (!cr.updateReverseLine (MInventory.Table_ID,
@ -211,12 +218,15 @@ public class Doc_Inventory extends Doc
}
// Cost Detail
/* Source move to MInventory.createCostDetail()
MCostDetail.createInventory(as, line.getAD_Org_ID(),
if (!MCostDetail.createInventory(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(),
line.getDescription(), getTrxName());*/
line.getDescription(), getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
//
ArrayList<Fact> facts = new ArrayList<Fact>();
@ -224,4 +234,8 @@ public class Doc_Inventory extends Doc
return facts;
} // createFact
private boolean isReversal(DocLine line) {
return m_DocStatus.equals(MInventory.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
}
} // Doc_Inventory

View File

@ -580,7 +580,6 @@ public class Doc_Invoice extends Doc
getC_Currency_ID(), null, serviceAmt);
//
updateProductPO(as); // Only API
updateProductInfo (as.getC_AcctSchema_ID()); // only API
}
// APC
else if (getDocumentType().equals(DOCTYPE_APCredit))
@ -918,72 +917,4 @@ public class Doc_Invoice extends Doc
log.fine("Updated=" + no);
} // updateProductPO
/**
* Update Product Info (old).
* - Costing (PriceLastInv)
* - PO (PriceLastInv)
* @param C_AcctSchema_ID accounting schema
* @deprecated old costing
*/
private void updateProductInfo (int C_AcctSchema_ID)
{
log.fine("C_Invoice_ID=" + get_ID());
/** @todo Last.. would need to compare document/last updated date
* would need to maintain LastPriceUpdateDate on _PO and _Costing */
// update Product Costing
// requires existence of currency conversion !!
// if there are multiple lines of the same product last price uses first
// -> TotalInvAmt is sometimes NULL !! -> error
// begin globalqss 2005-10-19
// postgresql doesn't support LIMIT on UPDATE or DELETE statements
/*
StringBuffer sql = new StringBuffer (
"UPDATE M_Product_Costing pc "
+ "SET (PriceLastInv, TotalInvAmt,TotalInvQty) = "
// select
+ "(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),"
+ " currencyConvert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),il.QtyInvoiced "
+ "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND ROWNUM=1"
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
.append(get_ID()).append(") ")
// update
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
.append(get_ID()).append(")");
*/
// the next command is equivalent and works in postgresql and oracle
StringBuffer sql = new StringBuffer (
"UPDATE M_Product_Costing pc "
+ "SET (PriceLastInv, TotalInvAmt,TotalInvQty) = "
// select
+ "(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),"
+ " currencyConvert(il.LineNetAmt,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),il.QtyInvoiced "
+ "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND il.c_invoiceline_id = (SELECT MIN(C_InvoiceLine_ID) FROM C_InvoiceLine il2" +
" WHERE il2.M_PRODUCT_ID=il.M_PRODUCT_ID AND C_Invoice_ID=")
.append(get_ID()).append(")"
+ " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
.append(get_ID()).append(") ")
// update
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Invoice i, C_InvoiceLine il, C_AcctSchema a "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND pc.M_Product_ID=il.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND i.C_Invoice_ID=")
.append(get_ID()).append(")");
// end globalqss 2005-10-19
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - Updated=" + no);
} // updateProductInfo
} // Doc_Invoice

View File

@ -24,13 +24,13 @@ import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MConversionRate;
import org.compiere.model.MCostDetail;
import org.compiere.model.MInOut;
import org.compiere.model.MInOutLine;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MMatchInv;
import org.compiere.model.ProductCost;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
@ -305,58 +305,12 @@ public class Doc_MatchInv extends Doc
}
log.fine("IPV=" + ipv + "; Balance=" + fact.getSourceBalance());
// Elaine 2008/6/20
/* Source move to MInvoice.createMatchInvCostDetail()
// Cost Detail Record - data from Expense/IncClearing (CR) record
// MZ Goodwill
// Create Cost Detail Matched Invoice using Total Amount and Total Qty based on InvoiceLine
MMatchInv[] mInv = MMatchInv.getInvoiceLine(getCtx(), m_invoiceLine.getC_InvoiceLine_ID(), getTrxName());
BigDecimal tQty = Env.ZERO;
BigDecimal tAmt = Env.ZERO;
for (int i = 0 ; i < mInv.length ; i++)
String error = createMatchInvCostDetail(as);
if (error != null && error.trim().length() > 0)
{
if (mInv[i].isPosted() && mInv[i].getM_MatchInv_ID() != get_ID())
{
tQty = tQty.add(mInv[i].getQty());
multiplier = mInv[i].getQty()
.divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP).abs();
tAmt = tAmt.add(m_invoiceLine.getLineNetAmt().multiply(multiplier));
}
p_Error = error;
return null;
}
tAmt = tAmt.add(cr.getAcctBalance().negate()); //Invoice Price
// Different currency
MInvoice invoice = m_invoiceLine.getParent();
if (as.getC_Currency_ID() != invoice.getC_Currency_ID())
{
tAmt = MConversionRate.convert(getCtx(), tAmt,
invoice.getC_Currency_ID(), as.getC_Currency_ID(),
invoice.getDateAcct(), invoice.getC_ConversionType_ID(),
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
if (tAmt == null)
{
p_Error = "AP Invoice not convertible - " + as.getName();
return null;
}
}
// set Qty to negative value when MovementType is Vendor Returns
MInOut receipt = m_receiptLine.getParent();
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
tQty = tQty.add(getQty().negate()); // Qty is set to negative value
else
tQty = tQty.add(getQty());
// Set Total Amount and Total Quantity from Matched Invoice
MCostDetail.createInvoice(as, getAD_Org_ID(),
getM_Product_ID(), matchInv.getM_AttributeSetInstance_ID(),
m_invoiceLine.getC_InvoiceLine_ID(), 0, // No cost element
tAmt, tQty, getDescription(), getTrxName());
// end MZ
*/
// Update Costing
updateProductInfo(as.getC_AcctSchema_ID(),
MAcctSchema.COSTINGMETHOD_StandardCosting.equals(as.getCostingMethod()));
//
facts.add(fact);
@ -390,64 +344,72 @@ public class Doc_MatchInv extends Doc
return false;
}
/**
* Update Product Info (old).
* - Costing (CostStandardCumQty, CostStandardCumAmt, CostAverageCumQty, CostAverageCumAmt)
* @param C_AcctSchema_ID accounting schema
* @param standardCosting true if std costing
* @return true if updated
* @deprecated old costing
*/
private boolean updateProductInfo (int C_AcctSchema_ID, boolean standardCosting)
// Elaine 2008/6/20
private String createMatchInvCostDetail(MAcctSchema as)
{
log.fine("M_MatchInv_ID=" + get_ID());
// update Product Costing Qty/Amt
// requires existence of currency conversion !!
StringBuffer sql = new StringBuffer (
"UPDATE M_Product_Costing pc "
+ "SET (CostStandardCumQty,CostStandardCumAmt, CostAverageCumQty,CostAverageCumAmt) = "
+ "(SELECT pc.CostStandardCumQty + m.Qty,"
+ "pc.CostStandardCumAmt + currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)*m.Qty, "
+ "pc.CostAverageCumQty + m.Qty,"
+ "pc.CostAverageCumAmt + currencyConvert(il.PriceActual,i.C_Currency_ID,a.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)*m.Qty "
+ "FROM M_MatchInv m"
+ " INNER JOIN C_InvoiceLine il ON (m.C_InvoiceLine_ID=il.C_InvoiceLine_ID)"
+ " INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID),"
+ " C_AcctSchema a "
+ "WHERE pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND pc.M_Product_ID=m.M_Product_ID"
+ " AND m.M_MatchInv_ID=").append(get_ID()).append(")"
//
+ "WHERE pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(
" AND EXISTS (SELECT * FROM M_MatchInv m "
+ "WHERE pc.M_Product_ID=m.M_Product_ID"
+ " AND m.M_MatchInv_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - Qty/Amt Updated #=" + no);
// Update Average Cost
sql = new StringBuffer (
"UPDATE M_Product_Costing "
+ "SET CostAverage = CostAverageCumAmt/DECODE(CostAverageCumQty, 0,1, CostAverageCumQty) "
+ "WHERE C_AcctSchema_ID=").append(C_AcctSchema_ID)
.append(" AND M_Product_ID=").append(getM_Product_ID());
no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - AvgCost Updated #=" + no);
// Update Current Cost
if (!standardCosting)
if (m_invoiceLine != null && m_invoiceLine.get_ID() > 0
&& m_receiptLine != null && m_receiptLine.get_ID() > 0)
{
sql = new StringBuffer (
"UPDATE M_Product_Costing "
+ "SET CurrentCostPrice = CostAverage "
+ "WHERE C_AcctSchema_ID=").append(C_AcctSchema_ID)
.append(" AND M_Product_ID=").append(getM_Product_ID());
no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - CurrentCost Updated=" + no);
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
BigDecimal multiplier = getQty()
.divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP)
.abs();
if (multiplier.compareTo(Env.ONE) != 0)
LineNetAmt = LineNetAmt.multiply(multiplier);
// Source from Doc_MatchInv.createFacts(MAcctSchema)
// Cost Detail Record - data from Expense/IncClearing (CR) record
// MZ Goodwill
// Create Cost Detail Matched Invoice using Total Amount and Total Qty based on InvoiceLine
MMatchInv[] mInv = MMatchInv.getInvoiceLine(getCtx(), m_invoiceLine.getC_InvoiceLine_ID(), getTrxName());
BigDecimal tQty = Env.ZERO;
BigDecimal tAmt = Env.ZERO;
for (int i = 0 ; i < mInv.length ; i++)
{
if (mInv[i].isPosted() && mInv[i].getM_MatchInv_ID() != get_ID())
{
tQty = tQty.add(mInv[i].getQty());
multiplier = mInv[i].getQty()
.divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP).abs();
tAmt = tAmt.add(m_invoiceLine.getLineNetAmt().multiply(multiplier));
}
}
tAmt = tAmt.add(LineNetAmt); //Invoice Price
// Different currency
MInvoice invoice = m_invoiceLine.getParent();
if (as.getC_Currency_ID() != invoice.getC_Currency_ID())
{
tAmt = MConversionRate.convert(getCtx(), tAmt,
invoice.getC_Currency_ID(), as.getC_Currency_ID(),
invoice.getDateAcct(), invoice.getC_ConversionType_ID(),
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
if (tAmt == null)
{
return "AP Invoice not convertible - " + as.getName();
}
}
// set Qty to negative value when MovementType is Vendor Returns
MInOut receipt = m_receiptLine.getParent();
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
tQty = tQty.add(getQty().negate()); // Qty is set to negative value
else
tQty = tQty.add(getQty());
MMatchInv matchInv = (MMatchInv)getPO();
// Set Total Amount and Total Quantity from Matched Invoice
if (!MCostDetail.createInvoice(as, getAD_Org_ID(),
getM_Product_ID(), matchInv.getM_AttributeSetInstance_ID(),
m_invoiceLine.getC_InvoiceLine_ID(), 0, // No cost element
tAmt, tQty, getDescription(), getTrxName()))
{
return "Failed to create cost detail record";
}
// end MZ
}
return true;
} // updateProductInfo
return "";
}
} // Doc_MatchInv

View File

@ -26,15 +26,17 @@ import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MConversionRate;
import org.compiere.model.MCostDetail;
import org.compiere.model.MCurrency;
import org.compiere.model.MInOut;
import org.compiere.model.MInOutLine;
import org.compiere.model.MMatchPO;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
import org.compiere.model.MProduct;
import org.compiere.model.MTax;
import org.compiere.model.ProductCost;
import org.compiere.model.X_M_InOut;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
@ -64,6 +66,7 @@ public class Doc_MatchPO extends Doc
//
private int m_M_InOutLine_ID = 0;
private MInOutLine m_ioLine = null;
@SuppressWarnings("unused")
private int m_C_InvoiceLine_ID = 0;
private ProductCost m_pc;
@ -167,6 +170,13 @@ public class Doc_MatchPO extends Doc
poCost = poCost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
}
String costingError = createMatchPOCostDetail(as);
if (costingError != null && costingError.trim().length() > 0)
{
p_Error = costingError;
return null;
}
// Calculate PPV for standard costing
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
String costingMethod = product.getCostingMethod(as);
@ -278,32 +288,99 @@ public class Doc_MatchPO extends Doc
return false;
}
/**
* Update Product Info (old).
* - Costing (CostStandardPOQty, CostStandardPOAmt)
* @param C_AcctSchema_ID accounting schema
* @deprecated old costing
*/
private void updateProductInfo (int C_AcctSchema_ID)
// Elaine 2008/6/20
private String createMatchPOCostDetail(MAcctSchema as)
{
log.fine("M_MatchPO_ID=" + get_ID());
if (m_ioLine != null && m_ioLine.getM_InOutLine_ID() > 0 &&
m_oLine != null && m_oLine.getC_OrderLine_ID() > 0)
{
MMatchPO mMatchPO = (MMatchPO) getPO();
// Purchase Order Line
BigDecimal poCost = m_oLine.getPriceCost();
if (poCost == null || poCost.signum() == 0)
{
poCost = m_oLine.getPriceActual();
// Goodwill: Correct included Tax
int C_Tax_ID = m_oLine.getC_Tax_ID();
if (m_oLine.isTaxIncluded() && C_Tax_ID != 0)
{
MTax tax = MTax.get(getCtx(), C_Tax_ID);
if (!tax.isZeroTax())
{
int stdPrecision = MCurrency.getStdPrecision(getCtx(), m_oLine.getC_Currency_ID());
BigDecimal costTax = tax.calculateTax(poCost, true, stdPrecision);
log.fine("Costs=" + poCost + " - Tax=" + costTax);
poCost = poCost.subtract(costTax);
}
} // correct included Tax
}
// Source from Doc_MatchPO.createFacts(MAcctSchema)
MInOut inOut = m_ioLine.getParent();
boolean isReturnTrx = inOut.getMovementType().equals(X_M_InOut.MOVEMENTTYPE_VendorReturns);
// update Product Costing
// requires existence of currency conversion !!
StringBuffer sql = new StringBuffer (
"UPDATE M_Product_Costing pc "
+ "SET (CostStandardPOQty,CostStandardPOAmt) = "
+ "(SELECT CostStandardPOQty + m.Qty,"
+ " CostStandardPOAmt + currencyConvert(ol.PriceActual,ol.C_Currency_ID,a.C_Currency_ID,ol.DateOrdered,null,ol.AD_Client_ID,ol.AD_Org_ID)*m.Qty "
+ "FROM M_MatchPO m, C_OrderLine ol, C_AcctSchema a "
+ "WHERE m.C_OrderLine_ID=ol.C_OrderLine_ID"
+ " AND pc.M_Product_ID=ol.M_Product_ID"
+ " AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND m.M_MatchPO_ID=").append(get_ID()).append(") ")
.append("WHERE pc.C_AcctSchema_ID=").append(C_AcctSchema_ID)
.append(" AND pc.M_Product_ID=").append(getM_Product_ID());
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - Updated=" + no);
} // updateProductInfo
// Create PO Cost Detail Record first
// MZ Goodwill
// Create Cost Detail Matched PO using Total Amount and Total Qty based on OrderLine
MMatchPO[] mPO = MMatchPO.getOrderLine(getCtx(), m_oLine.getC_OrderLine_ID(), getTrxName());
BigDecimal tQty = Env.ZERO;
BigDecimal tAmt = Env.ZERO;
for (int i = 0 ; i < mPO.length ; i++)
{
if (mPO[i].getM_AttributeSetInstance_ID() == mMatchPO.getM_AttributeSetInstance_ID()
&& mPO[i].getM_MatchPO_ID() != mMatchPO.getM_MatchPO_ID())
{
BigDecimal qty = (isReturnTrx ? mPO[i].getQty().negate() : mPO[i].getQty());
tQty = tQty.add(qty);
tAmt = tAmt.add(poCost.multiply(qty));
}
}
poCost = poCost.multiply(getQty()); // Delivered so far
tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost);
tQty = tQty.add(isReturnTrx ? getQty().negate() : getQty());
// Different currency
if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID())
{
MOrder order = m_oLine.getParent();
Timestamp dateAcct = order.getDateAcct();
//get costing method for product
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
String costingMethod = product.getCostingMethod(as);
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) )
dateAcct = inOut.getDateAcct(); //Movement Date
//
BigDecimal rate = MConversionRate.getRate(
order.getC_Currency_ID(), as.getC_Currency_ID(),
dateAcct, order.getC_ConversionType_ID(),
m_oLine.getAD_Client_ID(), m_oLine.getAD_Org_ID());
if (rate == null)
{
return "Purchase Order not convertible - " + as.getName();
}
poCost = poCost.multiply(rate);
if (poCost.scale() > as.getCostingPrecision())
poCost = poCost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
tAmt = tAmt.multiply(rate);
if (tAmt.scale() > as.getCostingPrecision())
tAmt = tAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
}
// Set Total Amount and Total Quantity from Matched PO
if (!MCostDetail.createOrder(as, m_oLine.getAD_Org_ID(),
getM_Product_ID(), mMatchPO.getM_AttributeSetInstance_ID(),
m_oLine.getC_OrderLine_ID(), 0, // no cost element
tAmt, tQty, // Delivered
m_oLine.getDescription(), getTrxName()))
{
return "SaveError";
}
// end MZ
}
return "";
}
} // Doc_MatchPO

View File

@ -131,10 +131,19 @@ public class Doc_Movement extends Doc
for (int i = 0; i < p_lines.length; i++)
{
DocLine line = p_lines[i];
// MZ Goodwill
// if Inventory Move CostDetail exist then get Cost from Cost Detail
BigDecimal costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
// end MZ
BigDecimal costs = null;
if (!isReversal(line))
{
// MZ Goodwill
// if Inventory Move CostDetail exist then get Cost from Cost Detail
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
// end MZ
}
else
{
costs = BigDecimal.ZERO;
}
// ** Inventory DR CR
dr = fact.createLine(line,
@ -144,7 +153,7 @@ public class Doc_Movement extends Doc
continue;
dr.setM_Locator_ID(line.getM_Locator_ID());
dr.setQty(line.getQty().negate()); // outgoing
if (m_DocStatus.equals(MMovement.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctDr from Original Movement
if (!dr.updateReverseLine (MMovement.Table_ID,
@ -163,7 +172,7 @@ public class Doc_Movement extends Doc
continue;
cr.setM_Locator_ID(line.getM_LocatorTo_ID());
cr.setQty(line.getQty());
if (m_DocStatus.equals(MMovement.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
if (isReversal(line))
{
// Set AmtAcctCr from Original Movement
if (!cr.updateReverseLine (MMovement.Table_ID,
@ -186,17 +195,25 @@ public class Doc_Movement extends Doc
if (description == null)
description = "";
// Cost Detail From
MCostDetail.createMovement(as, dr.getAD_Org_ID(), // locator org
if (!MCostDetail.createMovement(as, dr.getAD_Org_ID(), // locator org
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs.negate(), line.getQty().negate(), true,
description + "(|->)", getTrxName());
description + "(|->)", getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
// Cost Detail To
MCostDetail.createMovement(as, cr.getAD_Org_ID(), // locator org
if (!MCostDetail.createMovement(as, cr.getAD_Org_ID(), // locator org
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(), false,
description + "(|<-)", getTrxName());
description + "(|<-)", getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
}
@ -206,4 +223,8 @@ public class Doc_Movement extends Doc
return facts;
} // createFact
private boolean isReversal(DocLine line) {
return m_DocStatus.equals(MMovement.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
}
} // Doc_Movement

View File

@ -343,7 +343,6 @@ public class Doc_Order extends Doc
if (getDocumentType().equals(DOCTYPE_POrder))
{
updateProductPO(as);
updateProductInfo(as.getC_AcctSchema_ID());
BigDecimal grossAmt = getAmount(Doc.AMTTYPE_Gross);
@ -773,52 +772,5 @@ public class Doc_Order extends Doc
fact.createLine (null, offset,
C_Currency_ID, null, total);
return fact;
} // getCommitmentSalesRelease
/**************************************************************************
* Update Product Info (old)
* - Costing (PriceLastPO)
* - PO (PriceLastPO)
* @param C_AcctSchema_ID accounting schema
* @deprecated old costing
*/
private void updateProductInfo (int C_AcctSchema_ID)
{
log.fine("C_Order_ID=" + get_ID());
/** @todo Last.. would need to compare document/last updated date
* would need to maintain LastPriceUpdateDate on _PO and _Costing */
// update Product Costing
// requires existence of currency conversion !!
// if there are multiple lines of the same product last price uses first
StringBuffer sql = new StringBuffer (
"UPDATE M_Product_Costing pc "
+ "SET PriceLastPO = "
+ "(SELECT currencyConvert(ol.PriceActual,ol.C_Currency_ID,a.C_Currency_ID,o.DateOrdered,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) "
+ "FROM C_Order o, C_OrderLine ol, C_AcctSchema a "
+ "WHERE o.C_Order_ID=ol.C_Order_ID"
+ " AND pc.M_Product_ID=ol.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID ");
if (DB.isOracle()) //jz
{
sql.append(" AND ROWNUM=1 ");
}
else
sql.append(" AND ol.C_OrderLine_ID = (SELECT MIN(ol1.C_OrderLine_ID) "
+ "FROM C_Order o1, C_OrderLine ol1 "
+ "WHERE o1.C_Order_ID=ol1.C_Order_ID"
+ " AND pc.M_Product_ID=ol1.M_Product_ID ")
.append(" AND o1.C_Order_ID=").append(get_ID()).append(") ");
sql.append(" AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND o.C_Order_ID=")
.append(get_ID()).append(") ")
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Order o, C_OrderLine ol, C_AcctSchema a "
+ "WHERE o.C_Order_ID=ol.C_Order_ID"
+ " AND pc.M_Product_ID=ol.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND o.C_Order_ID=")
.append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("M_Product_Costing - Updated=" + no);
} // updateProductInfo
} // getCommitmentSalesRelease
} // Doc_Order

View File

@ -228,11 +228,15 @@ public class Doc_Production extends Doc
description = "";
if (line.isProductionBOM())
description += "(*)";
MCostDetail.createProduction(as, line.getAD_Org_ID(),
if (!MCostDetail.createProduction(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(),
description, getTrxName());
description, getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
//
ArrayList<Fact> facts = new ArrayList<Fact>();

View File

@ -228,70 +228,6 @@ public class ProductInfo
return m_qty;
} // getQty
/**
* Update/Create initial Cost Record.
* Check first for Purchase Price List,
* then Product Purchase Costs
* and then Price List
* @param as accounting schema
* @param create create record
* @return costs
*/
private BigDecimal updateCosts (MAcctSchema as, boolean create)
{
// Create Zero Record
if (create)
{
StringBuffer sql = new StringBuffer ("INSERT INTO M_Product_Costing "
+ "(M_Product_ID,C_AcctSchema_ID,"
+ " AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
+ " CurrentCostPrice,CostStandard,FutureCostPrice,"
+ " CostStandardPOQty,CostStandardPOAmt,CostStandardCumQty,CostStandardCumAmt,"
+ " CostAverage,CostAverageCumQty,CostAverageCumAmt,"
+ " PriceLastPO,PriceLastInv, TotalInvQty,TotalInvAmt) "
+ "VALUES (");
sql.append(m_M_Product_ID).append(",").append(as.getC_AcctSchema_ID()).append(",")
.append(m_AD_Client_ID).append(",").append(m_AD_Org_ID).append(",")
.append("'Y',SysDate,0,SysDate,0, 0,0,0, 0,0,0,0, 0,0,0, 0,0, 0,0)");
int no = DB.executeUpdate(sql.toString(), m_trxName);
if (no == 1)
log.fine("CostingCreated");
}
// Try to find non ZERO Price
String costSource = "PriceList-PO";
BigDecimal costs = getPriceList (as, true);
if (costs == null || costs.compareTo(Env.ZERO)==0)
{
costSource = "PO Cost";
costs = getPOCost(as);
}
if (costs == null || costs.compareTo(Env.ZERO)==0)
{
costSource = "PriceList";
costs = getPriceList (as, false);
}
// if not found use $1 (to be able to do material transactions)
if (costs == null || costs.compareTo(Env.ZERO)==0)
{
costSource = "Not Found";
costs = new BigDecimal("1");
}
// update current costs
StringBuffer sql = new StringBuffer ("UPDATE M_Product_Costing ");
sql.append("SET CurrentCostPrice=").append(costs)
.append(" WHERE M_Product_ID=").append(m_M_Product_ID)
.append(" AND C_AcctSchema_ID=").append(as.getC_AcctSchema_ID());
int no = DB.executeUpdate(sql.toString(), m_trxName);
if (no == 1)
log.fine(costSource + " - " + costs);
return costs;
} // createCosts
/**
* Get PO Price from PriceList - and convert it to AcctSchema Currency
* @param as accounting schema

View File

@ -203,6 +203,36 @@ public class GridFieldVO implements Serializable
if (! client.isDisplayField(AD_Field_ID))
vo.IsDisplayed = false;
}
// FR IDEMPIERE-177
// Field Customization
if (vo.IsDisplayed) {
MUserDefField userDef = null;
userDef = MUserDefField.get(vo.ctx,AD_Field_ID, AD_Tab_ID, AD_Window_ID);
if (userDef != null)
{
vo.IsDisplayed = userDef.isDisplayed();
if (userDef.getName() != null)
vo.Header = userDef.getName();
if (userDef.getDescription() != null)
vo.Description = userDef.getDescription();
if (userDef.getHelp() != null)
vo.Help = userDef.getHelp();
vo.IsReadOnly = userDef.isReadOnly();
vo.IsSameLine = userDef.isSameLine();
vo.IsUpdateable = userDef.isUpdateable();
if (userDef.getDisplayLength() > 0)
vo.DisplayLength = userDef.getDisplayLength();
if (userDef.getDisplayLogic() != null)
vo.DisplayLogic = userDef.getDisplayLogic();
if (userDef.getDefaultValue() != null)
vo.DefaultValue = userDef.getDefaultValue();
if (userDef.getSortNo() > 0)
vo.SortNo = userDef.getSortNo();
// ToDo SeqNo
//if (userDef.getSeqNo() > 0)
// vo.SeqNo = userDef.getSeqNo();
}
}
//
vo.initFinish();
return vo;

View File

@ -101,7 +101,11 @@ public class GridTabVO implements Evaluatee, Serializable
{
vo.AD_Tab_ID = rs.getInt("AD_Tab_ID");
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_AD_Tab_ID, String.valueOf(vo.AD_Tab_ID));
// FR IDEMPIERE-177
MUserDefTab userDef = MUserDefTab.get(vo.ctx, vo.AD_Tab_ID, vo.AD_Window_ID);
vo.Name = rs.getString("Name");
if (userDef != null && userDef.getName() != null)
vo.Name = userDef.getName();
Env.setContext(vo.ctx, vo.WindowNo, vo.TabNo, GridTab.CTX_Name, vo.Name);
// Translation Tab **
@ -159,7 +163,12 @@ public class GridTabVO implements Evaluatee, Serializable
}
if (rs.getString("IsReadOnly").equals("Y"))
vo.IsReadOnly = true;
if (userDef != null && userDef.get_ValueAsString("ReadOnlyLogic") != null)
vo.IsReadOnly = userDef.isReadOnly();
vo.ReadOnlyLogic = rs.getString("ReadOnlyLogic");
if (userDef != null)
vo.ReadOnlyLogic = userDef.get_ValueAsString("ReadOnlyLogic");
if (rs.getString("IsInsertRecord").equals("N"))
vo.IsInsertRecord = false;
@ -167,12 +176,20 @@ public class GridTabVO implements Evaluatee, Serializable
vo.Description = rs.getString("Description");
if (vo.Description == null)
vo.Description = "";
if (userDef != null && userDef.getDescription() != null)
vo.Description = userDef.getDescription();
vo.Help = rs.getString("Help");
if (vo.Help == null)
vo.Help = "";
if (userDef != null && userDef.getHelp() != null)
vo.Help = userDef.getHelp();
if (rs.getString("IsSingleRow").equals("Y"))
vo.IsSingleRow = true;
if (userDef != null)
vo.IsSingleRow = userDef.isSingleRow();
if (rs.getString("HasTree").equals("Y"))
vo.HasTree = true;

View File

@ -351,7 +351,7 @@ public class GridTable extends AbstractTableModel
// WHERE
if (m_whereClause.length() > 0)
{
where.append(" WHERE ");
where.append(" WHERE (");
if (m_whereClause.indexOf('@') == -1)
where.append(m_whereClause);
else // replace variables
@ -367,6 +367,7 @@ public class GridTable extends AbstractTableModel
where.append(" 1 = 2 ");
}
}
where.append(")");
}
if (m_onlyCurrentRows && m_TabNo == 0)
{
@ -2847,7 +2848,7 @@ public class GridTable extends AbstractTableModel
String whereClause = m_whereClause;
if (m_whereClause != null && m_whereClause.trim().length() > 0)
{
m_whereClause = "(" + m_whereClause + ") OR (" + retainedWhere + ") ";
m_whereClause = "((" + m_whereClause + ") OR (" + retainedWhere + ")) ";
}
open(m_maxRows);
m_whereClause = whereClause;

View File

@ -183,6 +183,20 @@ public class GridWindowVO implements Serializable
return null;
}
// FR IDEMPIERE-177
// User Customization
MUserDefWin userDef = MUserDefWin.getBestMatch(ctx, AD_Window_ID);
if (userDef != null)
{
if (userDef.getName() != null)
vo.Name = userDef.getName();
if (userDef.getDescription() != null)
vo.Description = userDef.getDescription();
if (userDef.getHelp() != null)
vo.Help = userDef.getHelp();
// ToDo userDef.isDefault, userDef.isReadOnly, userDef.isUserUpdateable
}
// Create Tabs
createTabs (vo);
if (vo.Tabs == null || vo.Tabs.size() == 0)

View File

@ -0,0 +1,219 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_ToolBarButton
* @author Adempiere (generated)
* @version 360LTS.015
*/
public interface I_AD_ToolBarButton
{
/** TableName=AD_ToolBarButton */
public static final String Table_Name = "AD_ToolBarButton";
/** AD_Table_ID=200003 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name ActionClassName */
public static final String COLUMNNAME_ActionClassName = "ActionClassName";
/** Set Action Class Name.
* The class name that implements the interface for toolbar actions
*/
public void setActionClassName (String ActionClassName);
/** Get Action Class Name.
* The class name that implements the interface for toolbar actions
*/
public String getActionClassName();
/** Column name ActionName */
public static final String COLUMNNAME_ActionName = "ActionName";
/** Set Action Name.
* Action name on the toolbar
*/
public void setActionName (String ActionName);
/** Get Action Name.
* Action name on the toolbar
*/
public String getActionName();
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_ToolBarButton_ID */
public static final String COLUMNNAME_AD_ToolBarButton_ID = "AD_ToolBarButton_ID";
/** Set ToolBar Button */
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID);
/** Get ToolBar Button */
public int getAD_ToolBarButton_ID();
/** Column name Classname */
public static final String COLUMNNAME_Classname = "Classname";
/** Set Classname.
* Java Classname
*/
public void setClassname (String Classname);
/** Get Classname.
* Java Classname
*/
public String getClassname();
/** Column name ComponentName */
public static final String COLUMNNAME_ComponentName = "ComponentName";
/** Set Component Name */
public void setComponentName (String ComponentName);
/** Get Component Name */
public String getComponentName();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsCustomization */
public static final String COLUMNNAME_IsCustomization = "IsCustomization";
/** Set Customization.
* The change is a customization of the data dictionary and can be applied after Migration
*/
public void setIsCustomization (boolean IsCustomization);
/** Get Customization.
* The change is a customization of the data dictionary and can be applied after Migration
*/
public boolean isCustomization();
/** Column name KeyStroke_KeyCode */
public static final String COLUMNNAME_KeyStroke_KeyCode = "KeyStroke_KeyCode";
/** Set KeyCode.
* KeyCode for shortcuts
*/
public void setKeyStroke_KeyCode (int KeyStroke_KeyCode);
/** Get KeyCode.
* KeyCode for shortcuts
*/
public int getKeyStroke_KeyCode();
/** Column name KeyStroke_Modifiers */
public static final String COLUMNNAME_KeyStroke_Modifiers = "KeyStroke_Modifiers";
/** Set Keystroke Modifiers.
* Keystroke Modifiers for shortcuts
*/
public void setKeyStroke_Modifiers (int KeyStroke_Modifiers);
/** Get Keystroke Modifiers.
* Keystroke Modifiers for shortcuts
*/
public int getKeyStroke_Modifiers();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,173 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_ToolBarButtonRestrict
* @author Adempiere (generated)
* @version 360LTS.015
*/
public interface I_AD_ToolBarButtonRestrict
{
/** TableName=AD_ToolBarButtonRestrict */
public static final String Table_Name = "AD_ToolBarButtonRestrict";
/** AD_Table_ID=200004 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 6 - System - Client
*/
BigDecimal accessLevel = BigDecimal.valueOf(6);
/** Load Meta Data */
/** Column name Action */
public static final String COLUMNNAME_Action = "Action";
/** Set Action.
* Indicates the Action to be performed
*/
public void setAction (String Action);
/** Get Action.
* Indicates the Action to be performed
*/
public String getAction();
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_Role_ID */
public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID";
/** Set Role.
* Responsibility Role
*/
public void setAD_Role_ID (int AD_Role_ID);
/** Get Role.
* Responsibility Role
*/
public int getAD_Role_ID();
public I_AD_Role getAD_Role() throws RuntimeException;
/** Column name AD_ToolBarButton_ID */
public static final String COLUMNNAME_AD_ToolBarButton_ID = "AD_ToolBarButton_ID";
/** Set ToolBar Button */
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID);
/** Get ToolBar Button */
public int getAD_ToolBarButton_ID();
public I_AD_ToolBarButton getAD_ToolBarButton() throws RuntimeException;
/** Column name AD_ToolBarButtonRestrict_ID */
public static final String COLUMNNAME_AD_ToolBarButtonRestrict_ID = "AD_ToolBarButtonRestrict_ID";
/** Set ToolBar Button Restrict */
public void setAD_ToolBarButtonRestrict_ID (int AD_ToolBarButtonRestrict_ID);
/** Get ToolBar Button Restrict */
public int getAD_ToolBarButtonRestrict_ID();
/** Column name AD_Window_ID */
public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID";
/** Set Window.
* Data entry or display window
*/
public void setAD_Window_ID (int AD_Window_ID);
/** Get Window.
* Data entry or display window
*/
public int getAD_Window_ID();
public I_AD_Window getAD_Window() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -31,7 +31,7 @@ public interface I_AD_UserDef_Field
public static final String Table_Name = "AD_UserDef_Field";
/** AD_Table_ID=464 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 464;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -62,7 +62,7 @@ public interface I_AD_UserDef_Field
*/
public int getAD_Field_ID();
public I_AD_Field getAD_Field() throws RuntimeException;
public org.compiere.model.I_AD_Field getAD_Field() throws RuntimeException;
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
@ -86,6 +86,15 @@ public interface I_AD_UserDef_Field
/** Get User defined Field */
public int getAD_UserDef_Field_ID();
/** Column name AD_UserDef_Field_UU */
public static final String COLUMNNAME_AD_UserDef_Field_UU = "AD_UserDef_Field_UU";
/** Set AD_UserDef_Field_UU */
public void setAD_UserDef_Field_UU (String AD_UserDef_Field_UU);
/** Get AD_UserDef_Field_UU */
public String getAD_UserDef_Field_UU();
/** Column name AD_UserDef_Tab_ID */
public static final String COLUMNNAME_AD_UserDef_Tab_ID = "AD_UserDef_Tab_ID";
@ -95,7 +104,7 @@ public interface I_AD_UserDef_Field
/** Get User defined Tab */
public int getAD_UserDef_Tab_ID();
public I_AD_UserDef_Tab getAD_UserDef_Tab() throws RuntimeException;
public org.compiere.model.I_AD_UserDef_Tab getAD_UserDef_Tab() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";

View File

@ -31,7 +31,7 @@ public interface I_AD_UserDef_Tab
public static final String Table_Name = "AD_UserDef_Tab";
/** AD_Table_ID=466 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 466;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -75,7 +75,7 @@ public interface I_AD_UserDef_Tab
*/
public int getAD_Tab_ID();
public I_AD_Tab getAD_Tab() throws RuntimeException;
public org.compiere.model.I_AD_Tab getAD_Tab() throws RuntimeException;
/** Column name AD_UserDef_Tab_ID */
public static final String COLUMNNAME_AD_UserDef_Tab_ID = "AD_UserDef_Tab_ID";
@ -86,6 +86,15 @@ public interface I_AD_UserDef_Tab
/** Get User defined Tab */
public int getAD_UserDef_Tab_ID();
/** Column name AD_UserDef_Tab_UU */
public static final String COLUMNNAME_AD_UserDef_Tab_UU = "AD_UserDef_Tab_UU";
/** Set AD_UserDef_Tab_UU */
public void setAD_UserDef_Tab_UU (String AD_UserDef_Tab_UU);
/** Get AD_UserDef_Tab_UU */
public String getAD_UserDef_Tab_UU();
/** Column name AD_UserDef_Win_ID */
public static final String COLUMNNAME_AD_UserDef_Win_ID = "AD_UserDef_Win_ID";
@ -95,7 +104,7 @@ public interface I_AD_UserDef_Tab
/** Get User defined Window */
public int getAD_UserDef_Win_ID();
public I_AD_UserDef_Win getAD_UserDef_Win() throws RuntimeException;
public org.compiere.model.I_AD_UserDef_Win getAD_UserDef_Win() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -204,6 +213,19 @@ public interface I_AD_UserDef_Tab
*/
public String getName();
/** Column name ReadOnlyLogic */
public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic";
/** Set Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic);
/** Get Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";

View File

@ -31,7 +31,7 @@ public interface I_AD_UserDef_Win
public static final String Table_Name = "AD_UserDef_Win";
/** AD_Table_ID=467 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 467;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -88,7 +88,7 @@ public interface I_AD_UserDef_Win
*/
public int getAD_Role_ID();
public I_AD_Role getAD_Role() throws RuntimeException;
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException;
/** Column name AD_UserDef_Win_ID */
public static final String COLUMNNAME_AD_UserDef_Win_ID = "AD_UserDef_Win_ID";
@ -99,6 +99,15 @@ public interface I_AD_UserDef_Win
/** Get User defined Window */
public int getAD_UserDef_Win_ID();
/** Column name AD_UserDef_Win_UU */
public static final String COLUMNNAME_AD_UserDef_Win_UU = "AD_UserDef_Win_UU";
/** Set AD_UserDef_Win_UU */
public void setAD_UserDef_Win_UU (String AD_UserDef_Win_UU);
/** Get AD_UserDef_Win_UU */
public String getAD_UserDef_Win_UU();
/** Column name AD_User_ID */
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
@ -112,7 +121,7 @@ public interface I_AD_UserDef_Win
*/
public int getAD_User_ID();
public I_AD_User getAD_User() throws RuntimeException;
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException;
/** Column name AD_Window_ID */
public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID";
@ -127,7 +136,7 @@ public interface I_AD_UserDef_Win
*/
public int getAD_Window_ID();
public I_AD_Window getAD_Window() throws RuntimeException;
public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";

View File

@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair;
/** Generated Interface for I_Product
* @author Adempiere (generated)
* @version Release 3.6.0LTS
* @version 360LTS.015
*/
public interface I_I_Product
{
@ -674,12 +674,12 @@ public interface I_I_Product
/** Set Volume.
* Volume of a product
*/
public void setVolume (int Volume);
public void setVolume (BigDecimal Volume);
/** Get Volume.
* Volume of a product
*/
public int getVolume();
public BigDecimal getVolume();
/** Column name Weight */
public static final String COLUMNNAME_Weight = "Weight";
@ -687,12 +687,12 @@ public interface I_I_Product
/** Set Weight.
* Weight of a product
*/
public void setWeight (int Weight);
public void setWeight (BigDecimal Weight);
/** Get Weight.
* Weight of a product
*/
public int getWeight();
public BigDecimal getWeight();
/** Column name X12DE355 */
public static final String COLUMNNAME_X12DE355 = "X12DE355";

View File

@ -14,11 +14,10 @@
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.adempiere.model;
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for M_CostHistory

View File

@ -1,317 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for M_Product_Costing
* @author Adempiere (generated)
* @version Release 3.6.0LTS
*/
public interface I_M_Product_Costing
{
/** TableName=M_Product_Costing */
public static final String Table_Name = "M_Product_Costing";
/** AD_Table_ID=327 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name C_AcctSchema_ID */
public static final String COLUMNNAME_C_AcctSchema_ID = "C_AcctSchema_ID";
/** Set Accounting Schema.
* Rules for accounting
*/
public void setC_AcctSchema_ID (int C_AcctSchema_ID);
/** Get Accounting Schema.
* Rules for accounting
*/
public int getC_AcctSchema_ID();
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
/** Column name CostAverage */
public static final String COLUMNNAME_CostAverage = "CostAverage";
/** Set Average Cost.
* Weighted average costs
*/
public void setCostAverage (BigDecimal CostAverage);
/** Get Average Cost.
* Weighted average costs
*/
public BigDecimal getCostAverage();
/** Column name CostAverageCumAmt */
public static final String COLUMNNAME_CostAverageCumAmt = "CostAverageCumAmt";
/** Set Average Cost Amount Sum.
* Cumulative average cost amounts (internal)
*/
public void setCostAverageCumAmt (BigDecimal CostAverageCumAmt);
/** Get Average Cost Amount Sum.
* Cumulative average cost amounts (internal)
*/
public BigDecimal getCostAverageCumAmt();
/** Column name CostAverageCumQty */
public static final String COLUMNNAME_CostAverageCumQty = "CostAverageCumQty";
/** Set Average Cost Quantity Sum.
* Cumulative average cost quantities (internal)
*/
public void setCostAverageCumQty (BigDecimal CostAverageCumQty);
/** Get Average Cost Quantity Sum.
* Cumulative average cost quantities (internal)
*/
public BigDecimal getCostAverageCumQty();
/** Column name CostStandard */
public static final String COLUMNNAME_CostStandard = "CostStandard";
/** Set Standard Cost.
* Standard Costs
*/
public void setCostStandard (BigDecimal CostStandard);
/** Get Standard Cost.
* Standard Costs
*/
public BigDecimal getCostStandard();
/** Column name CostStandardCumAmt */
public static final String COLUMNNAME_CostStandardCumAmt = "CostStandardCumAmt";
/** Set Std Cost Amount Sum.
* Standard Cost Invoice Amount Sum (internal)
*/
public void setCostStandardCumAmt (BigDecimal CostStandardCumAmt);
/** Get Std Cost Amount Sum.
* Standard Cost Invoice Amount Sum (internal)
*/
public BigDecimal getCostStandardCumAmt();
/** Column name CostStandardCumQty */
public static final String COLUMNNAME_CostStandardCumQty = "CostStandardCumQty";
/** Set Std Cost Quantity Sum.
* Standard Cost Invoice Quantity Sum (internal)
*/
public void setCostStandardCumQty (BigDecimal CostStandardCumQty);
/** Get Std Cost Quantity Sum.
* Standard Cost Invoice Quantity Sum (internal)
*/
public BigDecimal getCostStandardCumQty();
/** Column name CostStandardPOAmt */
public static final String COLUMNNAME_CostStandardPOAmt = "CostStandardPOAmt";
/** Set Std PO Cost Amount Sum.
* Standard Cost Purchase Order Amount Sum (internal)
*/
public void setCostStandardPOAmt (BigDecimal CostStandardPOAmt);
/** Get Std PO Cost Amount Sum.
* Standard Cost Purchase Order Amount Sum (internal)
*/
public BigDecimal getCostStandardPOAmt();
/** Column name CostStandardPOQty */
public static final String COLUMNNAME_CostStandardPOQty = "CostStandardPOQty";
/** Set Std PO Cost Quantity Sum.
* Standard Cost Purchase Order Quantity Sum (internal)
*/
public void setCostStandardPOQty (BigDecimal CostStandardPOQty);
/** Get Std PO Cost Quantity Sum.
* Standard Cost Purchase Order Quantity Sum (internal)
*/
public BigDecimal getCostStandardPOQty();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name CurrentCostPrice */
public static final String COLUMNNAME_CurrentCostPrice = "CurrentCostPrice";
/** Set Current Cost Price.
* The currently used cost price
*/
public void setCurrentCostPrice (BigDecimal CurrentCostPrice);
/** Get Current Cost Price.
* The currently used cost price
*/
public BigDecimal getCurrentCostPrice();
/** Column name FutureCostPrice */
public static final String COLUMNNAME_FutureCostPrice = "FutureCostPrice";
/** Set Future Cost Price */
public void setFutureCostPrice (BigDecimal FutureCostPrice);
/** Get Future Cost Price */
public BigDecimal getFutureCostPrice();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name M_Product_ID */
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
/** Set Product.
* Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID);
/** Get Product.
* Product, Service, Item
*/
public int getM_Product_ID();
public I_M_Product getM_Product() throws RuntimeException;
/** Column name PriceLastInv */
public static final String COLUMNNAME_PriceLastInv = "PriceLastInv";
/** Set Last Invoice Price.
* Price of the last invoice for the product
*/
public void setPriceLastInv (BigDecimal PriceLastInv);
/** Get Last Invoice Price.
* Price of the last invoice for the product
*/
public BigDecimal getPriceLastInv();
/** Column name PriceLastPO */
public static final String COLUMNNAME_PriceLastPO = "PriceLastPO";
/** Set Last PO Price.
* Price of the last purchase order for the product
*/
public void setPriceLastPO (BigDecimal PriceLastPO);
/** Get Last PO Price.
* Price of the last purchase order for the product
*/
public BigDecimal getPriceLastPO();
/** Column name TotalInvAmt */
public static final String COLUMNNAME_TotalInvAmt = "TotalInvAmt";
/** Set Total Invoice Amount.
* Cumulative total lifetime invoice amount
*/
public void setTotalInvAmt (BigDecimal TotalInvAmt);
/** Get Total Invoice Amount.
* Cumulative total lifetime invoice amount
*/
public BigDecimal getTotalInvAmt();
/** Column name TotalInvQty */
public static final String COLUMNNAME_TotalInvQty = "TotalInvQty";
/** Set Total Invoice Quantity.
* Cumulative total lifetime invoice quantity
*/
public void setTotalInvQty (BigDecimal TotalInvQty);
/** Get Total Invoice Quantity.
* Cumulative total lifetime invoice quantity
*/
public BigDecimal getTotalInvQty();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -214,11 +214,7 @@ public class MCost extends X_M_Cost
{
if (zeroCostsOK)
return Env.ZERO;
materialCostEach = getSeedCosts(product, M_ASI_ID,
as, Org_ID, costingMethod, C_OrderLine_ID);
}
if (materialCostEach == null)
return null;
// Material Costs
BigDecimal materialCost = materialCostEach.multiply(qty);
@ -278,13 +274,13 @@ public class MCost extends X_M_Cost
BigDecimal retValue = null;
// Direct Data
if (MCostElement.COSTINGMETHOD_AverageInvoice.equals(costingMethod))
retValue = calculateAverageInv(product, M_ASI_ID, as, Org_ID);
return null;
else if (MCostElement.COSTINGMETHOD_AveragePO.equals(costingMethod))
retValue = calculateAveragePO(product, M_ASI_ID, as, Org_ID);
return null;
else if (MCostElement.COSTINGMETHOD_Fifo.equals(costingMethod))
retValue = calculateFiFo(product, M_ASI_ID, as, Org_ID);
return null;
else if (MCostElement.COSTINGMETHOD_Lifo.equals(costingMethod))
retValue = calculateLiFo(product, M_ASI_ID, as, Org_ID);
return null;
else if (MCostElement.COSTINGMETHOD_LastInvoice.equals(costingMethod))
retValue = getLastInvoicePrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
else if (MCostElement.COSTINGMETHOD_LastPOPrice.equals(costingMethod))
@ -294,19 +290,11 @@ public class MCost extends X_M_Cost
if (retValue == null || retValue.signum() == 0)
retValue = getLastPOPrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
}
else if (MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
// migrate old costs
MProductCosting pc = MProductCosting.get(product.getCtx(), product.getM_Product_ID(),
as.getC_AcctSchema_ID(), null);
if (pc != null)
retValue = pc.getCurrentCostPrice();
}
else if (MCostElement.COSTINGMETHOD_UserDefined.equals(costingMethod))
;
else
throw new IllegalArgumentException("Unknown Costing Method = " + costingMethod);
if (retValue != null && retValue.signum() != 0)
if (retValue != null && retValue.signum() > 0)
{
s_log.fine(product.getName() + ", CostingMethod=" + costingMethod + " - " + retValue);
return retValue;
@ -316,7 +304,7 @@ public class MCost extends X_M_Cost
if (C_OrderLine_ID != 0)
{
retValue = getPOPrice(product, C_OrderLine_ID, as.getC_Currency_ID());
if (retValue != null && retValue.signum() != 0)
if (retValue != null && retValue.signum() > 0)
{
s_log.fine(product.getName() + ", PO - " + retValue);
return retValue;
@ -327,8 +315,8 @@ public class MCost extends X_M_Cost
if (!MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
MCostElement ce = MCostElement.getMaterialCostElement(as, MCostElement.COSTINGMETHOD_StandardCosting);
MCost cost = get(product, M_ASI_ID, as, Org_ID, ce.getM_CostElement_ID());
if (cost != null && cost.getCurrentCostPrice().signum() != 0)
MCost cost = get(product, M_ASI_ID, as, Org_ID, ce.getM_CostElement_ID(), product.get_TrxName());
if (cost != null && cost.getCurrentCostPrice().signum() > 0)
{
s_log.fine(product.getName() + ", Standard - " + cost);
return cost.getCurrentCostPrice();
@ -337,15 +325,14 @@ public class MCost extends X_M_Cost
// We do not have a price
// PO first
if (MCostElement.COSTINGMETHOD_AveragePO.equals(costingMethod)
|| MCostElement.COSTINGMETHOD_LastPOPrice.equals(costingMethod)
if (MCostElement.COSTINGMETHOD_LastPOPrice.equals(costingMethod)
|| MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
// try Last PO
retValue = getLastPOPrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
if (Org_ID != 0 && (retValue == null || retValue.signum() == 0))
retValue = getLastPOPrice(product, M_ASI_ID, 0, as.getC_Currency_ID());
if (retValue != null && retValue.signum() != 0)
if (retValue != null && retValue.signum() > 0)
{
s_log.fine(product.getName() + ", LastPO = " + retValue);
return retValue;
@ -366,15 +353,14 @@ public class MCost extends X_M_Cost
// Still Nothing
// Inv second
if (MCostElement.COSTINGMETHOD_AveragePO.equals(costingMethod)
|| MCostElement.COSTINGMETHOD_LastPOPrice.equals(costingMethod)
if (MCostElement.COSTINGMETHOD_LastPOPrice.equals(costingMethod)
|| MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
// try last Inv
retValue = getLastInvoicePrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
if (Org_ID != 0 && (retValue == null || retValue.signum() == 0))
retValue = getLastInvoicePrice(product, M_ASI_ID, 0, as.getC_Currency_ID());
if (retValue != null && retValue.signum() != 0)
if (retValue != null && retValue.signum() > 0)
{
s_log.fine(product.getName() + ", LastInv = " + retValue);
return retValue;
@ -386,7 +372,7 @@ public class MCost extends X_M_Cost
retValue = getLastPOPrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
if (Org_ID != 0 && (retValue == null || retValue.signum() == 0))
retValue = getLastPOPrice(product, M_ASI_ID, 0, as.getC_Currency_ID());
if (retValue != null && retValue.signum() != 0)
if (retValue != null && retValue.signum() > 0)
{
s_log.fine(product.getName() + ", LastPO = " + retValue);
return retValue;
@ -394,7 +380,7 @@ public class MCost extends X_M_Cost
}
// Still nothing try ProductPO
MProductPO[] pos = MProductPO.getOfProduct(product.getCtx(), product.getM_Product_ID(), null);
MProductPO[] pos = MProductPO.getOfProduct(product.getCtx(), product.getM_Product_ID(), product.get_TrxName());
for (int i = 0; i < pos.length; i++)
{
BigDecimal price = pos[i].getPricePO();
@ -423,13 +409,48 @@ public class MCost extends X_M_Cost
}
// Still nothing try Purchase Price List
// ....
BigDecimal price = getSeedCostFromPriceList(product, as, Org_ID);
if (price != null && price.signum() > 0)
{
retValue = price;
}
s_log.fine(product.getName() + " = " + retValue);
return retValue;
} // getSeedCosts
private static BigDecimal getSeedCostFromPriceList(MProduct product,
MAcctSchema as, int orgID) {
String sql = "SELECT pp.PriceList, pp.PriceStd FROM M_ProductPrice pp" +
" INNER JOIN M_PriceList_Version plv ON (pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID AND plv.ValidFrom <= trunc(sysdate))" +
" INNER JOIN M_PriceList pl ON (plv.M_PriceList_ID = pl.M_PriceList_ID AND pl.IsSOPriceList = 'N')" +
" WHERE pp.AD_Client_ID = ? AND pp.AD_Org_ID IN (0, ?) AND pp.M_Product_ID = ? AND pp.PriceList > 0 AND pp.IsActive = 'Y' " +
" ORDER BY pp.AD_Org_ID Desc, plv.ValidFrom Desc";
PreparedStatement st = null;
ResultSet rs = null;
try {
st = DB.prepareStatement(sql, product.get_TrxName());
st.setInt(1, as.getAD_Client_ID());
st.setInt(2, orgID);
st.setInt(3, product.getM_Product_ID());
rs = st.executeQuery();
if (rs.next()) {
BigDecimal priceList = rs.getBigDecimal(1);
BigDecimal priceStd = rs.getBigDecimal(2);
if (priceStd != null && priceStd.signum() > 0)
return priceStd;
else
return priceList;
}
} catch (SQLException e) {
throw new DBException(e, sql);
} finally {
DB.close(rs, st);
}
return BigDecimal.ZERO;
}
/**
* Get Last Invoice Price in currency
* @param product product

View File

@ -23,7 +23,7 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.model.X_M_CostHistory;
import org.compiere.model.X_M_CostHistory;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -892,6 +892,23 @@ public class MCostDetail extends X_M_CostDetail
cost.add(amt, qty);
log.finer("PO - LastPO - " + cost);
}
else if (ce.isStandardCosting())
{
// Update cost record only if it is zero
if (cost.getCurrentCostPrice().signum() == 0
&& cost.getCurrentCostPriceLL().signum() == 0)
{
cost.setCurrentCostPrice(price);
if (cost.getCurrentCostPrice().signum() == 0)
{
cost.setCurrentCostPrice(MCost.getSeedCosts(product, M_ASI_ID,
as, Org_ID, ce.getCostingMethod(), getC_OrderLine_ID()));
}
log.finest("PO - Standard - CurrentCostPrice(seed)="+cost.getCurrentCostPrice()+", price="+price);
}
cost.add(amt, qty);
log.finer("PO - Standard - " + cost);
}
else if (ce.isUserDefined())
{
// Interface
@ -948,10 +965,8 @@ public class MCostDetail extends X_M_CostDetail
}
else if (ce.isStandardCosting())
{
// Update cost record only if newly created.
// Elsewhere we risk to set the CurrentCostPrice to an undesired price.
if (cost.is_new()
&& cost.getCurrentCostPrice().signum() == 0
// Update cost record only if it is zero
if (cost.getCurrentCostPrice().signum() == 0
&& cost.getCurrentCostPriceLL().signum() == 0)
{
cost.setCurrentCostPrice(price);
@ -962,8 +977,8 @@ public class MCostDetail extends X_M_CostDetail
as, Org_ID, ce.getCostingMethod(), getC_OrderLine_ID()));
log.finest("Inv - Standard - CurrentCostPrice(seed)="+cost.getCurrentCostPrice()+", price="+price);
}
}
cost.add(amt, qty);
cost.add(amt, qty);
}
log.finer("Inv - Standard - " + cost);
}
else if (ce.isUserDefined())

View File

@ -473,14 +473,6 @@ public class MInventory extends X_M_Inventory implements DocAction
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid;
}
if(QtyMA.signum() != 0)
{
String err = createCostDetail(line, ma.getM_AttributeSetInstance_ID() , QtyMA.negate());
if (err != null && err.length() > 0) {
m_processMsg = err;
return DocAction.STATUS_Invalid;
}
}
qtyDiff = QtyNew;
@ -530,16 +522,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid;
}
if(qtyDiff.signum() != 0)
{
String err = createCostDetail(line, line.getM_AttributeSetInstance_ID(), qtyDiff);
if (err != null && err.length() > 0) {
m_processMsg = err;
return DocAction.STATUS_Invalid;
}
}
}
} // Fallback
} // stock movement
@ -941,60 +924,6 @@ public class MInventory extends X_M_Inventory implements DocAction
return m_reversal;
} // isReversal
/**
* Create Cost Detail
* @param line
* @param Qty
* @return an EMPTY String on success otherwise an ERROR message
*/
private String createCostDetail(MInventoryLine line, int M_AttributeSetInstance_ID, BigDecimal qty)
{
// Get Account Schemas to create MCostDetail
MAcctSchema[] acctschemas = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID());
for(int asn = 0; asn < acctschemas.length; asn++)
{
MAcctSchema as = acctschemas[asn];
if (as.isSkipOrg(getAD_Org_ID()) || as.isSkipOrg(line.getAD_Org_ID()))
{
continue;
}
BigDecimal costs = Env.ZERO;
if (isReversal())
{
String sql = "SELECT amt * -1 FROM M_CostDetail WHERE M_InventoryLine_ID=?"; // negate costs
MProduct product = new MProduct(getCtx(), line.getM_Product_ID(), line.get_TrxName());
String CostingLevel = product.getCostingLevel(as);
if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel))
sql = sql + " AND AD_Org_ID=" + getAD_Org_ID();
else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel) && M_AttributeSetInstance_ID != 0)
sql = sql + " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID;
costs = DB.getSQLValueBD(line.get_TrxName(), sql, line.getReversalLine_ID());
}
else
{
ProductCost pc = new ProductCost (getCtx(),
line.getM_Product_ID(), M_AttributeSetInstance_ID, line.get_TrxName());
pc.setQty(qty);
costs = pc.getProductCosts(as, line.getAD_Org_ID(), as.getCostingMethod(), 0,true);
}
if (costs == null)
{
return "No Costs for " + line.getProduct().getName();
}
// Set Total Amount and Total Quantity from Inventory
MCostDetail.createInventory(as, line.getAD_Org_ID(),
line.getM_Product_ID(), M_AttributeSetInstance_ID,
line.getM_InventoryLine_ID(), 0, // no cost element
costs, qty,
line.getDescription(), line.get_TrxName());
}
return "";
}
/**
* Document Status is Complete or Closed
* @return true if CO, CL or RE

View File

@ -136,6 +136,7 @@ public class MMatchInv extends X_M_MatchInv
/** Static Logger */
@SuppressWarnings("unused")
private static CLogger s_log = CLogger.getCLogger (MMatchInv.class);
@ -221,29 +222,6 @@ public class MMatchInv extends X_M_MatchInv
return true;
} // beforeSave
/**
* After Save.
* Set Order Qty Delivered/Invoiced
* @param newRecord new
* @param success success
* @return success
*/
protected boolean afterSave (boolean newRecord, boolean success)
{
if (newRecord && success)
{
// Elaine 2008/6/20
String err = createMatchInvCostDetail();
if(err != null && err.length() > 0)
{
s_log.warning(err);
return false;
}
}
//
return success;
} // afterSave
/**
* Get the later Date Acct from invoice or shipment
* @return date or null
@ -329,81 +307,6 @@ public class MMatchInv extends X_M_MatchInv
return success;
} // afterDelete
// Elaine 2008/6/20
private String createMatchInvCostDetail()
{
MInvoiceLine invoiceLine = new MInvoiceLine (getCtx(), getC_InvoiceLine_ID(), get_TrxName());
// Get Account Schemas to create MCostDetail
MAcctSchema[] acctschemas = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID());
for(int asn = 0; asn < acctschemas.length; asn++)
{
MAcctSchema as = acctschemas[asn];
if (as.isSkipOrg(getAD_Org_ID()))
{
continue;
}
BigDecimal LineNetAmt = invoiceLine.getLineNetAmt();
BigDecimal multiplier = getQty()
.divide(invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP)
.abs();
if (multiplier.compareTo(Env.ONE) != 0)
LineNetAmt = LineNetAmt.multiply(multiplier);
// Source from Doc_MatchInv.createFacts(MAcctSchema)
// Cost Detail Record - data from Expense/IncClearing (CR) record
// MZ Goodwill
// Create Cost Detail Matched Invoice using Total Amount and Total Qty based on InvoiceLine
MMatchInv[] mInv = MMatchInv.getInvoiceLine(getCtx(), invoiceLine.getC_InvoiceLine_ID(), get_TrxName());
BigDecimal tQty = Env.ZERO;
BigDecimal tAmt = Env.ZERO;
for (int i = 0 ; i < mInv.length ; i++)
{
if (mInv[i].isPosted() && mInv[i].getM_MatchInv_ID() != get_ID())
{
tQty = tQty.add(mInv[i].getQty());
multiplier = mInv[i].getQty()
.divide(invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP).abs();
tAmt = tAmt.add(invoiceLine.getLineNetAmt().multiply(multiplier));
}
}
tAmt = tAmt.add(LineNetAmt); //Invoice Price
// Different currency
MInvoice invoice = invoiceLine.getParent();
if (as.getC_Currency_ID() != invoice.getC_Currency_ID())
{
tAmt = MConversionRate.convert(getCtx(), tAmt,
invoice.getC_Currency_ID(), as.getC_Currency_ID(),
invoice.getDateAcct(), invoice.getC_ConversionType_ID(),
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
if (tAmt == null)
{
return "AP Invoice not convertible - " + as.getName();
}
}
// set Qty to negative value when MovementType is Vendor Returns
MInOutLine receiptLine = new MInOutLine (getCtx(),getM_InOutLine_ID(), get_TrxName());
MInOut receipt = receiptLine.getParent();
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
tQty = tQty.add(getQty().negate()); // Qty is set to negative value
else
tQty = tQty.add(getQty());
// Set Total Amount and Total Quantity from Matched Invoice
MCostDetail.createInvoice(as, getAD_Org_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(),
invoiceLine.getC_InvoiceLine_ID(), 0, // No cost element
tAmt, tQty, getDescription(), get_TrxName());
// end MZ
}
return "";
}
//
//AZ Goodwill
private String deleteMatchInvCostDetail()
@ -424,29 +327,36 @@ public class MMatchInv extends X_M_MatchInv
getC_InvoiceLine_ID(), getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), get_TrxName());
if (cd != null)
{
MInOut receipt = (new MInOutLine(getCtx(),getM_InOutLine_ID(),get_TrxName())).getParent();
BigDecimal qty = getQty();
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
qty = getQty().negate();
//
BigDecimal price = null;
if (cd.getQty().compareTo(Env.ZERO) == 0) // avoid division by zero
price = Env.ZERO;
else
price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
cd.setDeltaAmt(price.multiply(qty.negate()));
cd.setDeltaQty(qty.negate());
cd.setProcessed(false);
//
cd.setAmt(price.multiply(cd.getQty().subtract(qty)));
cd.setQty(cd.getQty().subtract(qty));
if (!cd.isProcessed())
{
cd.process();
}
if (cd.getQty().compareTo(Env.ZERO) == 0)
if (cd.isProcessed())
{
MInOut receipt = (new MInOutLine(getCtx(),getM_InOutLine_ID(),get_TrxName())).getParent();
BigDecimal qty = getQty();
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
qty = getQty().negate();
//
BigDecimal price = null;
if (cd.getQty().compareTo(Env.ZERO) == 0) // avoid division by zero
price = Env.ZERO;
else
price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
cd.setDeltaAmt(price.multiply(qty.negate()));
cd.setDeltaQty(qty.negate());
cd.setProcessed(false);
//
cd.setAmt(price.multiply(cd.getQty().subtract(qty)));
cd.setQty(cd.getQty().subtract(qty));
if (!cd.isProcessed())
{
cd.process();
}
if (cd.getQty().compareTo(Env.ZERO) == 0)
{
cd.setProcessed(false);
cd.delete(true);
}
}
else
{
cd.delete(true);
}
}

View File

@ -619,17 +619,6 @@ public class MMatchPO extends X_M_MatchPO
}
}
if (newRecord || m_isInOutLineChange)
{
// Elaine 2008/6/20
String err = createMatchPOCostDetail();
if(err != null && err.length() > 0)
{
s_log.warning(err);
return false;
}
}
return true;
} // beforeSave
@ -853,113 +842,6 @@ public class MMatchPO extends X_M_MatchPO
s_log.info("Success #" + success + " - Error #" + errors);
} // consolidate
// Elaine 2008/6/20
private String createMatchPOCostDetail()
{
if (getM_InOutLine_ID() != 0)
{
MOrderLine oLine = getOrderLine();
// Get Account Schemas to create MCostDetail
MAcctSchema[] acctschemas = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID());
for(int asn = 0; asn < acctschemas.length; asn++)
{
MAcctSchema as = acctschemas[asn];
if (as.isSkipOrg(getAD_Org_ID()))
{
continue;
}
// Purchase Order Line
BigDecimal poCost = oLine.getPriceCost();
if (poCost == null || poCost.signum() == 0)
{
poCost = oLine.getPriceActual();
// Goodwill: Correct included Tax
int C_Tax_ID = oLine.getC_Tax_ID();
if (oLine.isTaxIncluded() && C_Tax_ID != 0)
{
MTax tax = MTax.get(getCtx(), C_Tax_ID);
if (!tax.isZeroTax())
{
int stdPrecision = MCurrency.getStdPrecision(getCtx(), oLine.getC_Currency_ID());
BigDecimal costTax = tax.calculateTax(poCost, true, stdPrecision);
log.fine("Costs=" + poCost + " - Tax=" + costTax);
poCost = poCost.subtract(costTax);
}
} // correct included Tax
}
// Source from Doc_MatchPO.createFacts(MAcctSchema)
MInOutLine receiptLine = new MInOutLine (getCtx(), getM_InOutLine_ID(), get_TrxName());
MInOut inOut = receiptLine.getParent();
boolean isReturnTrx = inOut.getMovementType().equals(X_M_InOut.MOVEMENTTYPE_VendorReturns);
// Create PO Cost Detail Record first
// MZ Goodwill
// Create Cost Detail Matched PO using Total Amount and Total Qty based on OrderLine
MMatchPO[] mPO = MMatchPO.getOrderLine(getCtx(), oLine.getC_OrderLine_ID(), get_TrxName());
BigDecimal tQty = Env.ZERO;
BigDecimal tAmt = Env.ZERO;
for (int i = 0 ; i < mPO.length ; i++)
{
if (mPO[i].getM_AttributeSetInstance_ID() == getM_AttributeSetInstance_ID()
&& mPO[i].getM_MatchPO_ID() != get_ID())
{
BigDecimal qty = (isReturnTrx ? mPO[i].getQty().negate() : mPO[i].getQty());
tQty = tQty.add(qty);
tAmt = tAmt.add(poCost.multiply(qty));
}
}
poCost = poCost.multiply(getQty()); // Delivered so far
tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost);
tQty = tQty.add(isReturnTrx ? getQty().negate() : getQty());
// Different currency
if (oLine.getC_Currency_ID() != as.getC_Currency_ID())
{
MOrder order = oLine.getParent();
Timestamp dateAcct = order.getDateAcct();
//get costing method for product
MProduct product = MProduct.get(getCtx(), getM_Product_ID());
String costingMethod = product.getCostingMethod(as);
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) )
dateAcct = inOut.getDateAcct(); //Movement Date
//
BigDecimal rate = MConversionRate.getRate(
order.getC_Currency_ID(), as.getC_Currency_ID(),
dateAcct, order.getC_ConversionType_ID(),
oLine.getAD_Client_ID(), oLine.getAD_Org_ID());
if (rate == null)
{
return "Purchase Order not convertible - " + as.getName();
}
poCost = poCost.multiply(rate);
if (poCost.scale() > as.getCostingPrecision())
poCost = poCost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
tAmt = tAmt.multiply(rate);
if (tAmt.scale() > as.getCostingPrecision())
tAmt = tAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
}
// Set Total Amount and Total Quantity from Matched PO
if (!MCostDetail.createOrder(as, oLine.getAD_Org_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(),
oLine.getC_OrderLine_ID(), 0, // no cost element
tAmt, tQty, // Delivered
oLine.getDescription(), get_TrxName()))
{
return "SaveError";
}
// end MZ
}
}
return "";
}
//AZ Goodwill
private String deleteMatchPOCostDetail()
{
@ -979,24 +861,31 @@ public class MMatchPO extends X_M_MatchPO
getC_OrderLine_ID(), getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), get_TrxName());
if (cd != null)
{
if (cd.getQty().compareTo(Env.ZERO) > 0)
if (cd.isProcessed())
{
BigDecimal price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
cd.setDeltaAmt(price.multiply(getQty().negate()));
cd.setDeltaQty(getQty().negate());
cd.setProcessed(false);
//
cd.setAmt(price.multiply(cd.getQty().subtract(getQty())));
cd.setQty(cd.getQty().subtract(getQty()));
if (!cd.isProcessed())
if (cd.getQty().compareTo(Env.ZERO) > 0)
{
cd.process();
BigDecimal price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
cd.setDeltaAmt(price.multiply(getQty().negate()));
cd.setDeltaQty(getQty().negate());
cd.setProcessed(false);
//
cd.setAmt(price.multiply(cd.getQty().subtract(getQty())));
cd.setQty(cd.getQty().subtract(getQty()));
if (!cd.isProcessed())
{
cd.process();
}
}
//after process clean-up
if (cd.getQty().compareTo(Env.ZERO) == 0)
{
cd.setProcessed(false);
cd.delete(true);
}
}
//after process clean-up
if (cd.getQty().compareTo(Env.ZERO) == 0)
else
{
cd.setProcessed(false);
cd.delete(true);
}
}

View File

@ -263,6 +263,8 @@ public class MProduct extends X_M_Product
setProductType(impP.getProductType());
setImageURL(impP.getImageURL());
setDescriptionURL(impP.getDescriptionURL());
setVolume(impP.getVolume());
setWeight(impP.getWeight());
} // MProduct
/** Additional Downloads */
@ -689,14 +691,6 @@ public class MProduct extends X_M_Product
insert_Accounting("M_Product_Acct", "M_Product_Category_Acct",
"p.M_Product_Category_ID=" + getM_Product_Category_ID());
insert_Tree(X_AD_Tree.TREETYPE_Product);
//
MAcctSchema[] mass = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID(), get_TrxName());
for (int i = 0; i < mass.length; i++)
{
// Old
MProductCosting pcOld = new MProductCosting(this, mass[i].getC_AcctSchema_ID());
pcOld.saveEx();
}
}
// New Costing
@ -740,11 +734,7 @@ public class MProduct extends X_M_Product
}
}
// delete costing
MProductCosting[] costings = MProductCosting.getOfProduct(getCtx(), get_ID(), get_TrxName());
for (int i = 0; i < costings.length; i++)
costings[i].delete(true, get_TrxName());
// delete costing
MCost.delete(this);
// [ 1674225 ] Delete Product: Costing deletion error

View File

@ -1,133 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
import org.compiere.util.Env;
/**
* Product Costing Model (old).
* deprecated old costing
*
* @author Jorg Janke
* @version $Id: MProductCosting.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
*/
public class MProductCosting extends X_M_Product_Costing
{
/**
*
*/
private static final long serialVersionUID = 5563448335633481151L;
/**
* Get Costing Of Product
* @param ctx context
* @param M_Product_ID product
* @param trxName trx
* @return array of costs
*/
public static MProductCosting[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
{
final String whereClause = "M_Product_ID=?";
List<MProductCosting> costs =new Query(ctx, I_M_Product_Costing.Table_Name,whereClause, trxName )
.setParameters(M_Product_ID)
.list();
return costs.toArray(new MProductCosting[costs.size()]);
} // getOfProduct
/**
* Get Costing
* @param ctx context
* @param M_Product_ID product
* @param C_AcctSchema_ID as
* @param trxName trx
* @return first product cosnting
*/
public static MProductCosting get (Properties ctx, int M_Product_ID,
int C_AcctSchema_ID, String trxName)
{
final String whereClause = "M_Product_ID=? AND C_AcctSchema_ID=?";
return new Query(ctx, I_M_Product_Costing.Table_Name,whereClause, trxName )
.setParameters(M_Product_ID, C_AcctSchema_ID)
.firstOnly();
} // get
/**************************************************************************
* Standard Constructor (odl)
* @param ctx context
* @param ignored (multi key)
* @param trxName transaction
*/
public MProductCosting (Properties ctx, int ignored, String trxName)
{
super (ctx, ignored, trxName);
if (ignored != 0)
throw new IllegalArgumentException("Multi-Key");
else
{
// setM_Product_ID (0);
// setC_AcctSchema_ID (0);
//
setCostAverage (Env.ZERO);
setCostAverageCumAmt (Env.ZERO);
setCostAverageCumQty (Env.ZERO);
setCostStandard (Env.ZERO);
setCostStandardCumAmt (Env.ZERO);
setCostStandardCumQty (Env.ZERO);
setCostStandardPOAmt (Env.ZERO);
setCostStandardPOQty (Env.ZERO);
setCurrentCostPrice (Env.ZERO);
setFutureCostPrice (Env.ZERO);
setPriceLastInv (Env.ZERO);
setPriceLastPO (Env.ZERO);
setTotalInvAmt (Env.ZERO);
setTotalInvQty (Env.ZERO);
}
} // MProductCosting
/**
* Parent Constructor (old)
* @param product parent
* @param C_AcctSchema_ID accounting schema
*/
public MProductCosting (MProduct product, int C_AcctSchema_ID)
{
super (product.getCtx(), 0, product.get_TrxName());
setClientOrg(product);
setM_Product_ID (product.getM_Product_ID());
setC_AcctSchema_ID (C_AcctSchema_ID);
} // MProductCosting
/**
* Load Constructor (old)
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MProductCosting (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MProductCosting
} // MProductCosting

View File

@ -0,0 +1,90 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* ToolBar & Button Restriction
* @author Nicolas Micoud
*/
public class MToolBarButtonRestrict extends X_AD_ToolBarButtonRestrict
{
/**
*
*/
private static final long serialVersionUID = 751989571891306735L;
private static CLogger s_log = CLogger.getCLogger(MToolBarButtonRestrict.class);
/**
* Standard Constructor
* @param ctx context
* @param AD_Note_ID id
* @param trxName transaction
*/
public MToolBarButtonRestrict (Properties ctx, int AD_ToolBarButtonRestrict_ID, String trxName)
{
super (ctx, AD_ToolBarButtonRestrict_ID, trxName);
} // MToolBarButtonRestrict
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MToolBarButtonRestrict(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MToolBarButtonRestrict
/** Returns a list of restrictions to be applied according to the role, the window of the form ... **/
public static int[] getOf (Properties ctx, int AD_Role_ID, String Action, int Action_ID, String className, String trxName)
{
// Action : R-Report, W-Window, X-form
String sql = "SELECT AD_ToolBarButton_ID FROM AD_ToolBarButtonRestrict WHERE IsActive = 'Y'"
+ " AND AD_Client_ID IN (0, ?)"
+ " AND (AD_Role_ID IS NULL OR AD_Role_ID = ?)"
+ " AND (Action IS NULL OR Action=? AND (AD_Window_ID IS NULL OR (Action='W' AND AD_Window_ID=?)))"
+ " AND AD_ToolBarButton_ID IN (SELECT AD_ToolBarButton_ID FROM AD_ToolBarButton WHERE IsActive='Y' AND Classname=?)";
s_log.info("sql="+sql);
int[] ids = DB.getIDsEx(trxName, sql, Env.getAD_Client_ID(ctx), AD_Role_ID, Action, Action_ID, className);
return ids;
} // getOf
/**
* String Representation
* @return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MToolBarButtonRestrict[")
.append(get_ID()).append(",AD_ToolBarButtonRestrict_ID=").append(getAD_ToolBarButtonRestrict_ID())
.append("]");
return sb.toString();
} // toString
} // MToolBarButtonRestrict

View File

@ -509,7 +509,20 @@ public class MTree extends MTree_Base
MRole role = MRole.getDefault(getCtx(), false);
Boolean access = null;
if (X_AD_Menu.ACTION_Window.equals(actionColor))
access = role.getWindowAccess(AD_Window_ID);
{
access = role.getWindowAccess(AD_Window_ID);
// FR XXX
// Get Window Customization
MUserDefWin userDef = null;
userDef = MUserDefWin.getBestMatch(getCtx(), AD_Window_ID);
if (userDef != null)
{
if (userDef.getName() != null)
name = userDef.getName();
if (userDef.getDescription() != null)
description = userDef.getDescription();
}
}
else if (X_AD_Menu.ACTION_Process.equals(actionColor)
|| X_AD_Menu.ACTION_Report.equals(actionColor))
access = role.getProcessAccess(AD_Process_ID);

View File

@ -0,0 +1,120 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2012 Dirk Niemeyer *
* Copyright (C) 2012 action 42 GmbH *
* 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.compiere.model;
import java.sql.*;
import java.util.*;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/**
* User overrides for field model
* @author Dirk Niemeyer, action42 GmbH
* @version $Id$
*/
public class MUserDefField extends X_AD_UserDef_Field
{
/**
*
*/
private static final long serialVersionUID = 20120403114400L;
/**
* Standard constructor.
* You must implement this constructor for Adempiere Persistency
* @param ctx context
* @param ID the primary key ID
* @param trxName transaction
*/
public MUserDefField (Properties ctx, int ID, String trxName)
{
super (ctx, ID, trxName);
} // MyModelExample
/**
* Optional Load Constructor.
* You would use this constructor to load several business objects.
* <code>
* SELECT * FROM MyModelExample WHERE ...
* </code>
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MUserDefField (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
} // MyModelExample
/**
* Get matching MUserDefField related to current field and user definition for window and tab
* @param ctx
* @param AD_Field_ID
* @param AD_Tab_ID
* @param AD_Window_ID
* @return
*/
public static MUserDefField get (Properties ctx, int AD_Field_ID, int AD_Tab_ID, int AD_Window_ID )
{
MUserDefWin userdefWin = MUserDefWin.getBestMatch(ctx, AD_Window_ID);
if (userdefWin == null)
return null;
MUserDefTab userdefTab = MUserDefTab.getMatch(ctx, AD_Tab_ID, userdefWin.getAD_UserDef_Win_ID());
if (userdefTab == null)
return null;
MUserDefField retValue = null;
StringBuffer sql = new StringBuffer("SELECT * "
+ " FROM AD_UserDef_Field f "
+ " WHERE f.AD_Field_ID=? AND f.IsActive='Y' "
+ " AND f.AD_UserDef_Tab_ID=? ");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
// create statement
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, AD_Field_ID);
pstmt.setInt(2, userdefTab.getAD_UserDef_Tab_ID());
// get data
rs = pstmt.executeQuery();
if (rs.next())
{
retValue = new MUserDefField(ctx,rs,null);
}
}
catch (SQLException ex)
{
CLogger.get().log(Level.SEVERE, sql.toString(), ex);
return null;
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return retValue;
}
} // MyModelExample

View File

@ -0,0 +1,129 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2012 Dirk Niemeyer *
* Copyright (C) 2012 action 42 GmbH *
* 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.compiere.model;
import java.sql.*;
import java.util.*;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/**
* User overrides for tab model
* @author Dirk Niemeyer, action 42 GmbH
* @version $Id$
*
*/
public class MUserDefTab extends X_AD_UserDef_Tab
{
/**
*
*/
private static final long serialVersionUID = 20120403111900L;
/**
* Standard constructor.
* You must implement this constructor for Adempiere Persistency
* @param ctx context
* @param ID the primary key ID
* @param trxName transaction
*/
public MUserDefTab (Properties ctx, int ID, String trxName)
{
super (ctx, ID, trxName);
} // MUserDefTab
/**
* Optional Load Constructor.
* You would use this constructor to load several business objects.
* <code>
* SELECT * FROM MyModelExample WHERE ...
* </code>
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MUserDefTab (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
} // MUserDefTab
/**
* Get matching MUserDefTab related to current tab and user definition for window
* @param ctx
* @param AD_Tab_ID
* @param AD_UserDefWin_ID
* @return
*/
public static MUserDefTab getMatch (Properties ctx, int AD_Tab_ID, int AD_UserDefWin_ID )
{
MUserDefTab retValue = null;
StringBuffer sql = new StringBuffer("SELECT * "
+ " FROM AD_UserDef_Tab "
+ " WHERE AD_UserDef_Win_ID=? AND IsActive='Y' "
+ " AND AD_Tab_ID=? ");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
// create statement
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, AD_UserDefWin_ID);
pstmt.setInt(2, AD_Tab_ID);
// get data
rs = pstmt.executeQuery();
if (rs.next())
{
retValue = new MUserDefTab(ctx,rs,null);
}
}
catch (SQLException ex)
{
CLogger.get().log(Level.SEVERE, sql.toString(), ex);
return null;
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
return retValue;
}
/**
* Get matching MUserDefTab related to current tab and window
* @param ctx
* @param AD_Tab_ID
* @param AD_Window_ID
* @return
*/
public static MUserDefTab get (Properties ctx, int AD_Tab_ID, int AD_Window_ID) {
MUserDefWin userdefWin = MUserDefWin.getBestMatch(ctx, AD_Window_ID);
if (userdefWin == null)
return null;
return getMatch(ctx, AD_Tab_ID, userdefWin.getAD_UserDef_Win_ID());
}
} // MUserDefTab

View File

@ -0,0 +1,210 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2012 Dirk Niemeyer *
* Copyright (C) 2012 action 42 GmbH *
* 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.compiere.model;
import java.sql.*;
import java.util.*;
import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* User overrides for window model
* @author Dirk Niemeyer, action42 GmbH
* @version $Id$
*
*/
public class MUserDefWin extends X_AD_UserDef_Win
{
/**
*
*/
private static final long serialVersionUID = 20120403122300L;
/**
* Standard constructor.
* You must implement this constructor for Adempiere Persistency
* @param ctx context
* @param ID the primary key ID
* @param trxName transaction
*/
public MUserDefWin (Properties ctx, int ID, String trxName)
{
super (ctx, ID, trxName);
} // MUserDefWin
/**
* Optional Load Constructor.
* You would use this constructor to load several business objects.
* <code>
* SELECT * FROM MyModelExample WHERE ...
* </code>
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MUserDefWin (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
} // MUserDefWin
/**
* Get all MUserDefWin entries related to window
* @param ctx context
* @param window_ID window
* @return Array of MUserDefWin for window
*/
private static MUserDefWin[] getAll (Properties ctx, int window_ID )
{
List<MUserDefWin> list = new ArrayList<MUserDefWin>();
StringBuffer sql = new StringBuffer("SELECT * "
+ " FROM AD_UserDef_Win w "
+ " WHERE w.AD_Window_ID=? AND w.IsActive='Y' "
// limit to current login language or no specific language
+ " AND (w.AD_Language=? OR w.AD_Language IS NULL)"
+ " AND w.AD_Client_ID=? ");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
// create statement
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, window_ID);
pstmt.setString(2, Env.getAD_Language(ctx));
pstmt.setInt(3, Env.getAD_Client_ID(ctx));
// get data
rs = pstmt.executeQuery();
while (rs.next())
{
MUserDefWin userDef = new MUserDefWin(Env.getCtx(),rs,null);
list.add(userDef);
}
}
catch (SQLException ex)
{
CLogger.get().log(Level.SEVERE, sql.toString(), ex);
return null;
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
if (list.size() == 0)
return null;
return list.toArray(new MUserDefWin[list.size()]);
}
/**
* Get best matching MUserDefWin for current window
* the best match is cached
* @param ctx
* @param window_ID
* @return best matching MUserDefWin
*/
public static MUserDefWin getBestMatch (Properties ctx, int window_ID)
{
// Check Cache
Integer key = new Integer(window_ID);
MUserDefWin retValue = (MUserDefWin)s_cache.get(key);
if (retValue != null)
return retValue;
// parameters
final int AD_Org_ID = Env.getAD_Org_ID(ctx);
//final int anyOrg = 0;
final int AD_Role_ID = Env.getAD_Role_ID(ctx);
//final String anyRole = "NULL";
final int AD_User_ID = Env.getAD_User_ID(ctx);
//final String anyUser = "NULL";
// candidates
MUserDefWin[] candidates = getAll(ctx, window_ID);
if (candidates == null)
return null;
final int size = candidates.length;
int[] weight = new int[size];
// this user + this role + this org => weight = 7
// this user + this role + any org => weight = 6
// this user + any role + this org => weight = 5
// this user + any role + any org => weight = 4
// any user + this role + this org => weight = 3
// any user + this role + any org => weight = 2
// any user + any role + this org => weight = 1
// any user + any role + any org => weight = 0
// other user or other role or other org => weight = -1 and thus ruled out
for (int i=0; i < size; i++)
{
weight[i] = 0;
if (candidates[i].getAD_User_ID() > 0) {
if (candidates[i].getAD_User_ID() == AD_User_ID) {
weight[i] = weight[i] + 4;
} else {
weight[i] = -1;
}
}
if (weight[i] > -1 && candidates[i].getAD_Role_ID() > 0) {
if (candidates[i].getAD_Role_ID() == AD_Role_ID) {
weight[i] = weight[i] + 2;
} else {
weight[i] = -1;
}
}
if (weight[i] > -1 && candidates[i].getAD_Org_ID() > 0) {
if (candidates[i].getAD_Org_ID() == AD_Org_ID) {
weight[i] = weight[i] + 1;
} else {
weight[i] = -1;
}
}
// prefer if related to current login language
if (weight[i] > -1 && Env.getAD_Language(ctx).equalsIgnoreCase(candidates[i].getAD_Language())) {
weight[i] = weight[i] + 8;
}
// others are implicit
}
int maximum = weight[0]; // start with the first value
int maxindex = 0;
for (int j=0; j<weight.length; j++) {
if (weight[j] > maximum) {
maximum = weight[j]; // new maximum
maxindex = j;
}
}
if (weight[maxindex] > -1) {
retValue=candidates[maxindex];
s_cache.put(key, retValue);
return retValue;
} else {
return null;
}
}
/** Cache of selected MUserDefWin entries **/
private static CCache<Integer,MUserDefWin> s_cache = new CCache<Integer,MUserDefWin>("AD_UserDef_Win", 3); // 3 weights
} // MUserDefWin

View File

@ -283,17 +283,6 @@ public class ProductCost
log.fine("No Qty");
return null;
}
/** Old Costing
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (!client.isUseBetaFunctions())
{
BigDecimal itemCost = getProductItemCostOld(as, costingMethod);
BigDecimal cost = m_qty.multiply(itemCost);
cost = cost.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
log.fine("Qty(" + m_qty + ") * Cost(" + itemCost + ") = " + cost);
return cost;
}
**/
// No Product
if (m_product == null)
@ -312,138 +301,6 @@ public class ProductCost
return cost;
} // getProductCosts
/**
* Get Product Costs per UOM for Accounting Schema in Accounting Schema Currency.
* - if costType defined - cost
* - else CurrentCosts
* @param as accounting schema
* @param costType - if null uses Accounting Schema Costs - see AcctSchema.COSTING_*
* @return product costs
*/
private BigDecimal getProductItemCostOld (MAcctSchema as, String costType)
{
BigDecimal current = null;
BigDecimal cost = null;
String cm = as.getCostingMethod();
StringBuffer sql = new StringBuffer("SELECT CurrentCostPrice,"); // 1
//
if ((costType == null && MAcctSchema.COSTINGMETHOD_AveragePO.equals(cm))
|| MAcctSchema.COSTINGMETHOD_AveragePO.equals(costType))
sql.append("COSTAVERAGE"); // 2
// else if (AcctSchema.COSTING_FIFO.equals(cm))
// sql.append("COSTFIFO");
// else if (AcctSchema.COSTING_LIFO.equals(cm))
// sql.append("COSTLIFO");
else if ((costType == null && MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(cm))
|| MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costType))
sql.append("PRICELASTPO");
else // AcctSchema.COSTING_STANDARD
sql.append("COSTSTANDARD");
sql.append(" FROM M_Product_Costing WHERE M_Product_ID=? AND C_AcctSchema_ID=?");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, m_M_Product_ID);
pstmt.setInt(2, as.getC_AcctSchema_ID());
rs = pstmt.executeQuery();
if (rs.next())
{
current = rs.getBigDecimal(1);
cost = rs.getBigDecimal(2);
}
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// Return Costs
if (costType != null && cost != null && cost.compareTo(Env.ZERO)!=0)
{
log.fine("Costs=" + cost);
return cost;
}
else if (current != null && current.compareTo(Env.ZERO)!=0)
{
log.fine("Current=" + current);
return current;
}
// Create/Update Cost Record
boolean create = (cost == null && current == null);
return updateCostsOld (as, create);
} // getProductCostOld
/**
* Update/Create initial Cost Record.
* Check first for Purchase Price List,
* then Product Purchase Costs
* and then Price List
* @param as accounting schema
* @param create create record
* @return costs
*/
private BigDecimal updateCostsOld (MAcctSchema as, boolean create)
{
// Create Zero Record
if (create)
{
StringBuffer sql = new StringBuffer ("INSERT INTO M_Product_Costing "
+ "(M_Product_ID,C_AcctSchema_ID,"
+ " AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
+ " CurrentCostPrice,CostStandard,FutureCostPrice,"
+ " CostStandardPOQty,CostStandardPOAmt,CostStandardCumQty,CostStandardCumAmt,"
+ " CostAverage,CostAverageCumQty,CostAverageCumAmt,"
+ " PriceLastPO,PriceLastInv, TotalInvQty,TotalInvAmt) "
+ "VALUES (");
sql.append(m_M_Product_ID).append(",").append(as.getC_AcctSchema_ID()).append(",")
.append(as.getAD_Client_ID()).append(",").append(as.getAD_Org_ID()).append(",")
.append("'Y',SysDate,0,SysDate,0, 0,0,0, 0,0,0,0, 0,0,0, 0,0, 0,0)");
int no = DB.executeUpdate(sql.toString(), m_trxName);
if (no == 1)
log.fine("CostingCreated");
}
// Try to find non ZERO Price
String costSource = "PriceList-PO";
BigDecimal costs = getPriceList (as, true);
if (costs == null || costs.compareTo(Env.ZERO)==0)
{
costSource = "PO Cost";
costs = getPOCost(as);
}
if (costs == null || costs.compareTo(Env.ZERO)==0)
{
costSource = "PriceList";
costs = getPriceList (as, false);
}
// if not found use $1 (to be able to do material transactions)
if (costs == null || costs.compareTo(Env.ZERO)==0)
{
costSource = "Not Found";
costs = new BigDecimal("1");
}
// update current costs
StringBuffer sql = new StringBuffer ("UPDATE M_Product_Costing ");
sql.append("SET CurrentCostPrice=").append(costs)
.append(" WHERE M_Product_ID=").append(m_M_Product_ID)
.append(" AND C_AcctSchema_ID=").append(as.getC_AcctSchema_ID());
int no = DB.executeUpdate(sql.toString(), m_trxName);
if (no == 1)
log.fine(costSource + " - " + costs);
return costs;
} // createCosts
/**
* Get PO Price from PriceList - and convert it to AcctSchema Currency
* @param as accounting schema

View File

@ -0,0 +1,252 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Model for AD_ToolBarButton
* @author Adempiere (generated)
* @version 360LTS.015 - $Id$ */
public class X_AD_ToolBarButton extends PO implements I_AD_ToolBarButton, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120329L;
/** Standard Constructor */
public X_AD_ToolBarButton (Properties ctx, int AD_ToolBarButton_ID, String trxName)
{
super (ctx, AD_ToolBarButton_ID, trxName);
/** if (AD_ToolBarButton_ID == 0)
{
setAD_ToolBarButton_ID (0);
setClassname (null);
setComponentName (null);
setIsCustomization (false);
// N
setName (null);
} */
}
/** Load Constructor */
public X_AD_ToolBarButton (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 4 - System
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_ToolBarButton[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Action Class Name.
@param ActionClassName
The class name that implements the interface for toolbar actions
*/
public void setActionClassName (String ActionClassName)
{
set_Value (COLUMNNAME_ActionClassName, ActionClassName);
}
/** Get Action Class Name.
@return The class name that implements the interface for toolbar actions
*/
public String getActionClassName ()
{
return (String)get_Value(COLUMNNAME_ActionClassName);
}
/** Set Action Name.
@param ActionName
Action name on the toolbar
*/
public void setActionName (String ActionName)
{
set_Value (COLUMNNAME_ActionName, ActionName);
}
/** Get Action Name.
@return Action name on the toolbar
*/
public String getActionName ()
{
return (String)get_Value(COLUMNNAME_ActionName);
}
/** Set ToolBar Button.
@param AD_ToolBarButton_ID ToolBar Button */
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID)
{
if (AD_ToolBarButton_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButton_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButton_ID, Integer.valueOf(AD_ToolBarButton_ID));
}
/** Get ToolBar Button.
@return ToolBar Button */
public int getAD_ToolBarButton_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ToolBarButton_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Classname.
@param Classname
Java Classname
*/
public void setClassname (String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
/** Get Classname.
@return Java Classname
*/
public String getClassname ()
{
return (String)get_Value(COLUMNNAME_Classname);
}
/** Set Component Name.
@param ComponentName Component Name */
public void setComponentName (String ComponentName)
{
set_Value (COLUMNNAME_ComponentName, ComponentName);
}
/** Get Component Name.
@return Component Name */
public String getComponentName ()
{
return (String)get_Value(COLUMNNAME_ComponentName);
}
/** Set Customization.
@param IsCustomization
The change is a customization of the data dictionary and can be applied after Migration
*/
public void setIsCustomization (boolean IsCustomization)
{
set_Value (COLUMNNAME_IsCustomization, Boolean.valueOf(IsCustomization));
}
/** Get Customization.
@return The change is a customization of the data dictionary and can be applied after Migration
*/
public boolean isCustomization ()
{
Object oo = get_Value(COLUMNNAME_IsCustomization);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set KeyCode.
@param KeyStroke_KeyCode
KeyCode for shortcuts
*/
public void setKeyStroke_KeyCode (int KeyStroke_KeyCode)
{
set_Value (COLUMNNAME_KeyStroke_KeyCode, Integer.valueOf(KeyStroke_KeyCode));
}
/** Get KeyCode.
@return KeyCode for shortcuts
*/
public int getKeyStroke_KeyCode ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_KeyStroke_KeyCode);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Keystroke Modifiers.
@param KeyStroke_Modifiers
Keystroke Modifiers for shortcuts
*/
public void setKeyStroke_Modifiers (int KeyStroke_Modifiers)
{
set_Value (COLUMNNAME_KeyStroke_Modifiers, Integer.valueOf(KeyStroke_Modifiers));
}
/** Get Keystroke Modifiers.
@return Keystroke Modifiers for shortcuts
*/
public int getKeyStroke_Modifiers ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_KeyStroke_Modifiers);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}

View File

@ -0,0 +1,209 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.model.*;
/** Generated Model for AD_ToolBarButtonRestrict
* @author Adempiere (generated)
* @version 360LTS.015 - $Id$ */
public class X_AD_ToolBarButtonRestrict extends PO implements I_AD_ToolBarButtonRestrict, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120329L;
/** Standard Constructor */
public X_AD_ToolBarButtonRestrict (Properties ctx, int AD_ToolBarButtonRestrict_ID, String trxName)
{
super (ctx, AD_ToolBarButtonRestrict_ID, trxName);
/** if (AD_ToolBarButtonRestrict_ID == 0)
{
setAction (null);
setAD_Role_ID (0);
setAD_ToolBarButtonRestrict_ID (0);
} */
}
/** Load Constructor */
public X_AD_ToolBarButtonRestrict (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 6 - System - Client
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_ToolBarButtonRestrict[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Action AD_Reference_ID=104 */
public static final int ACTION_AD_Reference_ID=104;
/** Window = W */
public static final String ACTION_Window = "W";
/** Task = T */
public static final String ACTION_Task = "T";
/** WorkFlow = F */
public static final String ACTION_WorkFlow = "F";
/** Process = P */
public static final String ACTION_Process = "P";
/** Report = R */
public static final String ACTION_Report = "R";
/** Form = X */
public static final String ACTION_Form = "X";
/** Workbench = B */
public static final String ACTION_Workbench = "B";
/** Set Action.
@param Action
Indicates the Action to be performed
*/
public void setAction (String Action)
{
set_Value (COLUMNNAME_Action, Action);
}
/** Get Action.
@return Indicates the Action to be performed
*/
public String getAction ()
{
return (String)get_Value(COLUMNNAME_Action);
}
public I_AD_Role getAD_Role() throws RuntimeException
{
return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name)
.getPO(getAD_Role_ID(), get_TrxName()); }
/** Set Role.
@param AD_Role_ID
Responsibility Role
*/
public void setAD_Role_ID (int AD_Role_ID)
{
if (AD_Role_ID < 0)
set_Value (COLUMNNAME_AD_Role_ID, null);
else
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
}
/** Get Role.
@return Responsibility Role
*/
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_ToolBarButton getAD_ToolBarButton() throws RuntimeException
{
return (I_AD_ToolBarButton)MTable.get(getCtx(), I_AD_ToolBarButton.Table_Name)
.getPO(getAD_ToolBarButton_ID(), get_TrxName()); }
/** Set ToolBar Button.
@param AD_ToolBarButton_ID ToolBar Button */
public void setAD_ToolBarButton_ID (int AD_ToolBarButton_ID)
{
if (AD_ToolBarButton_ID < 1)
set_Value (COLUMNNAME_AD_ToolBarButton_ID, null);
else
set_Value (COLUMNNAME_AD_ToolBarButton_ID, Integer.valueOf(AD_ToolBarButton_ID));
}
/** Get ToolBar Button.
@return ToolBar Button */
public int getAD_ToolBarButton_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ToolBarButton_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set ToolBar Button Restrict.
@param AD_ToolBarButtonRestrict_ID ToolBar Button Restrict */
public void setAD_ToolBarButtonRestrict_ID (int AD_ToolBarButtonRestrict_ID)
{
if (AD_ToolBarButtonRestrict_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButtonRestrict_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ToolBarButtonRestrict_ID, Integer.valueOf(AD_ToolBarButtonRestrict_ID));
}
/** Get ToolBar Button Restrict.
@return ToolBar Button Restrict */
public int getAD_ToolBarButtonRestrict_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ToolBarButtonRestrict_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_Window getAD_Window() throws RuntimeException
{
return (I_AD_Window)MTable.get(getCtx(), I_AD_Window.Table_Name)
.getPO(getAD_Window_ID(), get_TrxName()); }
/** Set Window.
@param AD_Window_ID
Data entry or display window
*/
public void setAD_Window_ID (int AD_Window_ID)
{
if (AD_Window_ID < 1)
set_Value (COLUMNNAME_AD_Window_ID, null);
else
set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID));
}
/** Get Window.
@return Data entry or display window
*/
public int getAD_Window_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -30,7 +30,7 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120404L;
/** Standard Constructor */
public X_AD_UserDef_Field (Properties ctx, int AD_UserDef_Field_ID, String trxName)
@ -41,12 +41,14 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
setAD_Field_ID (0);
setAD_UserDef_Field_ID (0);
setAD_UserDef_Tab_ID (0);
setDefaultValue (null);
setIsDisplayed (false);
setIsDisplayed (true);
// 'Y'
setIsReadOnly (false);
// 'N'
setIsSameLine (false);
setName (null);
// 'N'
setSeqNo (0);
// 0
} */
}
@ -78,9 +80,9 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return sb.toString();
}
public I_AD_Field getAD_Field() throws RuntimeException
public org.compiere.model.I_AD_Field getAD_Field() throws RuntimeException
{
return (I_AD_Field)MTable.get(getCtx(), I_AD_Field.Table_Name)
return (org.compiere.model.I_AD_Field)MTable.get(getCtx(), org.compiere.model.I_AD_Field.Table_Name)
.getPO(getAD_Field_ID(), get_TrxName()); }
/** Set Field.
@ -106,6 +108,14 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_Field_ID()));
}
/** Set User defined Field.
@param AD_UserDef_Field_ID User defined Field */
public void setAD_UserDef_Field_ID (int AD_UserDef_Field_ID)
@ -126,9 +136,23 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return ii.intValue();
}
public I_AD_UserDef_Tab getAD_UserDef_Tab() throws RuntimeException
/** Set AD_UserDef_Field_UU.
@param AD_UserDef_Field_UU AD_UserDef_Field_UU */
public void setAD_UserDef_Field_UU (String AD_UserDef_Field_UU)
{
set_Value (COLUMNNAME_AD_UserDef_Field_UU, AD_UserDef_Field_UU);
}
/** Get AD_UserDef_Field_UU.
@return AD_UserDef_Field_UU */
public String getAD_UserDef_Field_UU ()
{
return (String)get_Value(COLUMNNAME_AD_UserDef_Field_UU);
}
public org.compiere.model.I_AD_UserDef_Tab getAD_UserDef_Tab() throws RuntimeException
{
return (I_AD_UserDef_Tab)MTable.get(getCtx(), I_AD_UserDef_Tab.Table_Name)
return (org.compiere.model.I_AD_UserDef_Tab)MTable.get(getCtx(), org.compiere.model.I_AD_UserDef_Tab.Table_Name)
.getPO(getAD_UserDef_Tab_ID(), get_TrxName()); }
/** Set User defined Tab.
@ -352,14 +376,6 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first

View File

@ -30,7 +30,7 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120404L;
/** Standard Constructor */
public X_AD_UserDef_Tab (Properties ctx, int AD_UserDef_Tab_ID, String trxName)
@ -44,7 +44,6 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
setIsMultiRowOnly (false);
setIsReadOnly (false);
setIsSingleRow (false);
setName (null);
} */
}
@ -76,9 +75,9 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
return sb.toString();
}
public I_AD_Tab getAD_Tab() throws RuntimeException
public org.compiere.model.I_AD_Tab getAD_Tab() throws RuntimeException
{
return (I_AD_Tab)MTable.get(getCtx(), I_AD_Tab.Table_Name)
return (org.compiere.model.I_AD_Tab)MTable.get(getCtx(), org.compiere.model.I_AD_Tab.Table_Name)
.getPO(getAD_Tab_ID(), get_TrxName()); }
/** Set Tab.
@ -104,6 +103,14 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_Tab_ID()));
}
/** Set User defined Tab.
@param AD_UserDef_Tab_ID User defined Tab */
public void setAD_UserDef_Tab_ID (int AD_UserDef_Tab_ID)
@ -124,9 +131,23 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
return ii.intValue();
}
public I_AD_UserDef_Win getAD_UserDef_Win() throws RuntimeException
/** Set AD_UserDef_Tab_UU.
@param AD_UserDef_Tab_UU AD_UserDef_Tab_UU */
public void setAD_UserDef_Tab_UU (String AD_UserDef_Tab_UU)
{
set_Value (COLUMNNAME_AD_UserDef_Tab_UU, AD_UserDef_Tab_UU);
}
/** Get AD_UserDef_Tab_UU.
@return AD_UserDef_Tab_UU */
public String getAD_UserDef_Tab_UU ()
{
return (String)get_Value(COLUMNNAME_AD_UserDef_Tab_UU);
}
public org.compiere.model.I_AD_UserDef_Win getAD_UserDef_Win() throws RuntimeException
{
return (I_AD_UserDef_Win)MTable.get(getCtx(), I_AD_UserDef_Win.Table_Name)
return (org.compiere.model.I_AD_UserDef_Win)MTable.get(getCtx(), org.compiere.model.I_AD_UserDef_Win.Table_Name)
.getPO(getAD_UserDef_Win_ID(), get_TrxName()); }
/** Set User defined Window.
@ -272,11 +293,20 @@ public class X_AD_UserDef_Tab extends PO implements I_AD_UserDef_Tab, I_Persiste
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Read Only Logic.
@param ReadOnlyLogic
Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic)
{
set_Value (COLUMNNAME_ReadOnlyLogic, ReadOnlyLogic);
}
/** Get Read Only Logic.
@return Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic ()
{
return (String)get_Value(COLUMNNAME_ReadOnlyLogic);
}
}

View File

@ -30,7 +30,7 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120404L;
/** Standard Constructor */
public X_AD_UserDef_Win (Properties ctx, int AD_UserDef_Win_ID, String trxName)
@ -38,13 +38,11 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
super (ctx, AD_UserDef_Win_ID, trxName);
/** if (AD_UserDef_Win_ID == 0)
{
setAD_Language (null);
setAD_UserDef_Win_ID (0);
setAD_Window_ID (0);
setIsDefault (false);
setIsReadOnly (false);
setIsUserUpdateable (false);
setName (null);
} */
}
@ -96,9 +94,9 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
return (String)get_Value(COLUMNNAME_AD_Language);
}
public I_AD_Role getAD_Role() throws RuntimeException
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException
{
return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name)
return (org.compiere.model.I_AD_Role)MTable.get(getCtx(), org.compiere.model.I_AD_Role.Table_Name)
.getPO(getAD_Role_ID(), get_TrxName()); }
/** Set Role.
@ -144,9 +142,23 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
return ii.intValue();
}
public I_AD_User getAD_User() throws RuntimeException
/** Set AD_UserDef_Win_UU.
@param AD_UserDef_Win_UU AD_UserDef_Win_UU */
public void setAD_UserDef_Win_UU (String AD_UserDef_Win_UU)
{
set_Value (COLUMNNAME_AD_UserDef_Win_UU, AD_UserDef_Win_UU);
}
/** Get AD_UserDef_Win_UU.
@return AD_UserDef_Win_UU */
public String getAD_UserDef_Win_UU ()
{
return (String)get_Value(COLUMNNAME_AD_UserDef_Win_UU);
}
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@ -172,9 +184,9 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
return ii.intValue();
}
public I_AD_Window getAD_Window() throws RuntimeException
public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException
{
return (I_AD_Window)MTable.get(getCtx(), I_AD_Window.Table_Name)
return (org.compiere.model.I_AD_Window)MTable.get(getCtx(), org.compiere.model.I_AD_Window.Table_Name)
.getPO(getAD_Window_ID(), get_TrxName()); }
/** Set Window.
@ -200,6 +212,14 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_Window_ID()));
}
/** Set Description.
@param Description
Optional short description of the record
@ -322,12 +342,4 @@ public class X_AD_UserDef_Win extends PO implements I_AD_UserDef_Win, I_Persiste
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}

View File

@ -26,14 +26,14 @@ import org.compiere.util.KeyNamePair;
/** Generated Model for I_Product
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
* @version 360LTS.015 - $Id$ */
public class X_I_Product extends PO implements I_I_Product, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120406L;
/** Standard Constructor */
public X_I_Product (Properties ctx, int I_Product_ID, String trxName)
@ -952,40 +952,40 @@ public class X_I_Product extends PO implements I_I_Product, I_Persistent
@param Volume
Volume of a product
*/
public void setVolume (int Volume)
public void setVolume (BigDecimal Volume)
{
set_Value (COLUMNNAME_Volume, Integer.valueOf(Volume));
set_Value (COLUMNNAME_Volume, Volume);
}
/** Get Volume.
@return Volume of a product
*/
public int getVolume ()
public BigDecimal getVolume ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Volume);
if (ii == null)
return 0;
return ii.intValue();
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Volume);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Weight.
@param Weight
Weight of a product
*/
public void setWeight (int Weight)
public void setWeight (BigDecimal Weight)
{
set_Value (COLUMNNAME_Weight, Integer.valueOf(Weight));
set_Value (COLUMNNAME_Weight, Weight);
}
/** Get Weight.
@return Weight of a product
*/
public int getWeight ()
public BigDecimal getWeight ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Weight);
if (ii == null)
return 0;
return ii.intValue();
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Weight);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set UOM Code.

View File

@ -15,12 +15,11 @@
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.adempiere.model;
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.model.*;
import org.compiere.util.Env;
/** Generated Model for M_CostHistory
@ -32,7 +31,7 @@ public class X_M_CostHistory extends PO implements I_M_CostHistory, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20120308L;
private static final long serialVersionUID = 20120402L;
/** Standard Constructor */
public X_M_CostHistory (Properties ctx, int M_CostHistory_ID, String trxName)

View File

@ -1,421 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.Env;
/** Generated Model for M_Product_Costing
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
public class X_M_Product_Costing extends PO implements I_M_Product_Costing, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20100614L;
/** Standard Constructor */
public X_M_Product_Costing (Properties ctx, int M_Product_Costing_ID, String trxName)
{
super (ctx, M_Product_Costing_ID, trxName);
/** if (M_Product_Costing_ID == 0)
{
setC_AcctSchema_ID (0);
setCostAverage (Env.ZERO);
setCostAverageCumAmt (Env.ZERO);
setCostAverageCumQty (Env.ZERO);
setCostStandard (Env.ZERO);
setCostStandardCumAmt (Env.ZERO);
setCostStandardCumQty (Env.ZERO);
setCostStandardPOAmt (Env.ZERO);
setCostStandardPOQty (Env.ZERO);
setCurrentCostPrice (Env.ZERO);
setFutureCostPrice (Env.ZERO);
setM_Product_ID (0);
setPriceLastInv (Env.ZERO);
setPriceLastPO (Env.ZERO);
setTotalInvAmt (Env.ZERO);
setTotalInvQty (Env.ZERO);
} */
}
/** Load Constructor */
public X_M_Product_Costing (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_M_Product_Costing[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException
{
return (I_C_AcctSchema)MTable.get(getCtx(), I_C_AcctSchema.Table_Name)
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
/** Set Accounting Schema.
@param C_AcctSchema_ID
Rules for accounting
*/
public void setC_AcctSchema_ID (int C_AcctSchema_ID)
{
if (C_AcctSchema_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
}
/** Get Accounting Schema.
@return Rules for accounting
*/
public int getC_AcctSchema_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Average Cost.
@param CostAverage
Weighted average costs
*/
public void setCostAverage (BigDecimal CostAverage)
{
set_ValueNoCheck (COLUMNNAME_CostAverage, CostAverage);
}
/** Get Average Cost.
@return Weighted average costs
*/
public BigDecimal getCostAverage ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostAverage);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Average Cost Amount Sum.
@param CostAverageCumAmt
Cumulative average cost amounts (internal)
*/
public void setCostAverageCumAmt (BigDecimal CostAverageCumAmt)
{
set_ValueNoCheck (COLUMNNAME_CostAverageCumAmt, CostAverageCumAmt);
}
/** Get Average Cost Amount Sum.
@return Cumulative average cost amounts (internal)
*/
public BigDecimal getCostAverageCumAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostAverageCumAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Average Cost Quantity Sum.
@param CostAverageCumQty
Cumulative average cost quantities (internal)
*/
public void setCostAverageCumQty (BigDecimal CostAverageCumQty)
{
set_ValueNoCheck (COLUMNNAME_CostAverageCumQty, CostAverageCumQty);
}
/** Get Average Cost Quantity Sum.
@return Cumulative average cost quantities (internal)
*/
public BigDecimal getCostAverageCumQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostAverageCumQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Standard Cost.
@param CostStandard
Standard Costs
*/
public void setCostStandard (BigDecimal CostStandard)
{
set_ValueNoCheck (COLUMNNAME_CostStandard, CostStandard);
}
/** Get Standard Cost.
@return Standard Costs
*/
public BigDecimal getCostStandard ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandard);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Std Cost Amount Sum.
@param CostStandardCumAmt
Standard Cost Invoice Amount Sum (internal)
*/
public void setCostStandardCumAmt (BigDecimal CostStandardCumAmt)
{
set_ValueNoCheck (COLUMNNAME_CostStandardCumAmt, CostStandardCumAmt);
}
/** Get Std Cost Amount Sum.
@return Standard Cost Invoice Amount Sum (internal)
*/
public BigDecimal getCostStandardCumAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardCumAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Std Cost Quantity Sum.
@param CostStandardCumQty
Standard Cost Invoice Quantity Sum (internal)
*/
public void setCostStandardCumQty (BigDecimal CostStandardCumQty)
{
set_ValueNoCheck (COLUMNNAME_CostStandardCumQty, CostStandardCumQty);
}
/** Get Std Cost Quantity Sum.
@return Standard Cost Invoice Quantity Sum (internal)
*/
public BigDecimal getCostStandardCumQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardCumQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Std PO Cost Amount Sum.
@param CostStandardPOAmt
Standard Cost Purchase Order Amount Sum (internal)
*/
public void setCostStandardPOAmt (BigDecimal CostStandardPOAmt)
{
set_ValueNoCheck (COLUMNNAME_CostStandardPOAmt, CostStandardPOAmt);
}
/** Get Std PO Cost Amount Sum.
@return Standard Cost Purchase Order Amount Sum (internal)
*/
public BigDecimal getCostStandardPOAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardPOAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Std PO Cost Quantity Sum.
@param CostStandardPOQty
Standard Cost Purchase Order Quantity Sum (internal)
*/
public void setCostStandardPOQty (BigDecimal CostStandardPOQty)
{
set_ValueNoCheck (COLUMNNAME_CostStandardPOQty, CostStandardPOQty);
}
/** Get Std PO Cost Quantity Sum.
@return Standard Cost Purchase Order Quantity Sum (internal)
*/
public BigDecimal getCostStandardPOQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CostStandardPOQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Current Cost Price.
@param CurrentCostPrice
The currently used cost price
*/
public void setCurrentCostPrice (BigDecimal CurrentCostPrice)
{
set_Value (COLUMNNAME_CurrentCostPrice, CurrentCostPrice);
}
/** Get Current Cost Price.
@return The currently used cost price
*/
public BigDecimal getCurrentCostPrice ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_CurrentCostPrice);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Future Cost Price.
@param FutureCostPrice Future Cost Price */
public void setFutureCostPrice (BigDecimal FutureCostPrice)
{
set_Value (COLUMNNAME_FutureCostPrice, FutureCostPrice);
}
/** Get Future Cost Price.
@return Future Cost Price */
public BigDecimal getFutureCostPrice ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FutureCostPrice);
if (bd == null)
return Env.ZERO;
return bd;
}
public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Last Invoice Price.
@param PriceLastInv
Price of the last invoice for the product
*/
public void setPriceLastInv (BigDecimal PriceLastInv)
{
set_ValueNoCheck (COLUMNNAME_PriceLastInv, PriceLastInv);
}
/** Get Last Invoice Price.
@return Price of the last invoice for the product
*/
public BigDecimal getPriceLastInv ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceLastInv);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Last PO Price.
@param PriceLastPO
Price of the last purchase order for the product
*/
public void setPriceLastPO (BigDecimal PriceLastPO)
{
set_ValueNoCheck (COLUMNNAME_PriceLastPO, PriceLastPO);
}
/** Get Last PO Price.
@return Price of the last purchase order for the product
*/
public BigDecimal getPriceLastPO ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceLastPO);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Total Invoice Amount.
@param TotalInvAmt
Cumulative total lifetime invoice amount
*/
public void setTotalInvAmt (BigDecimal TotalInvAmt)
{
set_ValueNoCheck (COLUMNNAME_TotalInvAmt, TotalInvAmt);
}
/** Get Total Invoice Amount.
@return Cumulative total lifetime invoice amount
*/
public BigDecimal getTotalInvAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalInvAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Total Invoice Quantity.
@param TotalInvQty
Cumulative total lifetime invoice quantity
*/
public void setTotalInvQty (BigDecimal TotalInvQty)
{
set_ValueNoCheck (COLUMNNAME_TotalInvQty, TotalInvQty);
}
/** Get Total Invoice Quantity.
@return Cumulative total lifetime invoice quantity
*/
public BigDecimal getTotalInvQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalInvQty);
if (bd == null)
return Env.ZERO;
return bd;
}
}

View File

@ -87,8 +87,10 @@ import org.compiere.model.MLookupFactory;
import org.compiere.model.MProcess;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.model.MToolBarButtonRestrict;
import org.compiere.model.MUser;
import org.compiere.model.MWindow;
import org.compiere.model.X_AD_ToolBarButton;
import org.compiere.plaf.CompiereColor;
import org.compiere.print.AReport;
import org.compiere.process.DocAction;
@ -144,11 +146,12 @@ public final class APanel extends CPanel
implements DataStatusListener, ChangeListener, ActionListener, IProcessMonitor
{
/**
*
*
*/
private static final long serialVersionUID = 6066778919781303581L;
private static final long serialVersionUID = -253840959387736456L;
private boolean isNested = false;
private boolean ToolBarMenuRestictionLoaded = false;
/**
* Constructs a new instance.
@ -857,6 +860,8 @@ public final class APanel extends CPanel
}
if (gTab.isReadOnly())
tabName.append("</i>");
// Carlos Ruiz - globalqss - IDEMPIERE-38 Tabs from a same window can't be translated the same way
tabName.append("<!--").append(gTab.getAD_Tab_ID()).append("-->");
tabName.append ("</html>");
// Add Tab - sets ALT-<number> and Shift-ALT-<x>
window.addTab (tabName.toString(), gTab, tabElement);
@ -1567,6 +1572,13 @@ public final class APanel extends CPanel
//
m_curWinTab.requestFocusInWindow();
setBusy(false, true);
if (!ToolBarMenuRestictionLoaded)
{
updateToolBarAndMenuWithRestriction();
ToolBarMenuRestictionLoaded = true;
}
log.config( "fini");
} // stateChanged
@ -2903,4 +2915,56 @@ public final class APanel extends CPanel
if (frame instanceof AWindow)
((AWindow)frame).setBusyMessage(message);
}
private void updateToolBarAndMenuWithRestriction()
{
int ToolBarButton_ID = 0;
int[] restrictionList = MToolBarButtonRestrict.getOf(m_ctx, MRole.getDefault().getAD_Role_ID(), "W", m_window.getAD_Window_ID(), this.getClass().getName(), null);
log.info("restrictionList="+restrictionList.toString());
for (int i = 0; i < restrictionList.length; i++)
{
ToolBarButton_ID= restrictionList[i];
X_AD_ToolBarButton tbt = new X_AD_ToolBarButton(m_ctx, ToolBarButton_ID, null);
String restrictName = tbt.getComponentName();
log.config("tbt="+tbt.getAD_ToolBarButton_ID() + " / " + restrictName);
boolean found=false;
// remove from ToolBar
for (int t = 0; t < toolBar.getComponentCount() && !found; t++)
{
if (toolBar.getComponent(t).getName()==null) // separator
continue;
if (toolBar.getComponent(t).getName().equals(restrictName))
{
toolBar.remove(t);
found=true;
}
}
// Remove from Menu
found=false;
for (int m1 = 0; m1 < menuBar.getComponentCount() && !found; m1++)
{
JMenu menu = menuBar.getMenu(m1); // File, Edit, View...
for (int m2 = 0; m2 < menu.getItemCount() && !found; m2++) // New, Copy, Save...
{
if (menu.getItem(m2)==null) // separator
continue;
if (menu.getItem(m2).getActionCommand().equals(restrictName))
{
menu.remove(m2);
found=true;
}
} // menuItems
} // Menu (File, Edit, View, ...)
} // All restrictions
} // updateToolBarAndMenuWithRestriction
} // APanel

View File

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.webui.AdempiereIdGenerator;
@ -30,6 +31,8 @@ import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MRole;
import org.compiere.model.MToolBarButtonRestrict;
import org.compiere.model.X_AD_ToolBarButton;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -51,10 +54,12 @@ import org.zkoss.zul.Space;
*/
public class CWindowToolbar extends FToolbar implements EventListener
{
private static final String BTNPREFIX = "Btn";
/**
*
*/
private static final long serialVersionUID = -762537218475834634L;
private static final long serialVersionUID = 5233006056333191551L;
private static final String TOOLBAR_BUTTON_STYLE = "background-color: transparent; display:inline-block; margin-left: 1px; margin-right: 1px; width: 26px; height: 24px;";
@ -209,7 +214,7 @@ public class CWindowToolbar extends FToolbar implements EventListener
private ToolBarButton createButton(String name, String image, String tooltip)
{
ToolBarButton btn = new ToolBarButton("");
btn.setName("Btn"+name);
btn.setName(BTNPREFIX+name);
if (windowNo > 0)
btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + btn.getName() + "_" + windowNo + (embedded ? "E" : ""));
else
@ -633,4 +638,38 @@ public class CWindowToolbar extends FToolbar implements EventListener
if (btnExport != null)
btnExport.setDisabled(!b);
}
private boolean ToolBarMenuRestictionLoaded = false;
public void updateToolBarAndMenuWithRestriction(int AD_Window_ID) {
if (ToolBarMenuRestictionLoaded)
return;
Properties m_ctx = Env.getCtx();
int ToolBarButton_ID = 0;
int[] restrictionList = MToolBarButtonRestrict.getOf(m_ctx, MRole.getDefault().getAD_Role_ID(), "W", AD_Window_ID, this.getClass().getName(), null);
log.info("restrictionList="+restrictionList.toString());
for (int i = 0; i < restrictionList.length; i++)
{
ToolBarButton_ID= restrictionList[i];
X_AD_ToolBarButton tbt = new X_AD_ToolBarButton(m_ctx, ToolBarButton_ID, null);
String restrictName = BTNPREFIX + tbt.getComponentName();
log.config("tbt="+tbt.getAD_ToolBarButton_ID() + " / " + restrictName);
for (Component p = this.getFirstChild(); p != null; p = p.getNextSibling()) {
if (p instanceof ToolBarButton) {
if ( restrictName.equals(((ToolBarButton)p).getName()) ) {
this.removeChild(p);
break;
}
}
}
} // All restrictions
ToolBarMenuRestictionLoaded = true;
}
}

View File

@ -1332,6 +1332,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
toolbar.enablePrint(curTab.isPrinted());
toolbar.enableReport(true);
toolbar.enableExport(!curTab.isSortTab());
toolbar.updateToolBarAndMenuWithRestriction(gridWindow.getAD_Window_ID());
}
/**

View File

@ -738,7 +738,8 @@ public class Allocation
// Should start WF
if (alloc.get_ID() != 0)
{
alloc.processIt(DocAction.ACTION_Complete);
if (!alloc.processIt(DocAction.ACTION_Complete))
throw new AdempiereException("Cannot complete allocation: " + alloc.getProcessMsg());
alloc.saveEx();
}

View File

@ -59,7 +59,7 @@ public class Merge
/** Tables to delete (not update) for M_Product */
public static String[] s_delete_Product = new String[]
{"M_Product_PO", "M_Replenish", "T_Replenish",
"M_ProductPrice", "M_Product_Costing",
"M_ProductPrice",
"M_Cost", // teo_sarca [ 1704554 ]
"M_Product_Trl", "M_Product_Acct"}; // M_Storage