IDEMPIERE-5059 Import the database view definition into dictionary (#1011)
This commit is contained in:
parent
143ef24a58
commit
744e84ccc5
|
@ -1,16 +0,0 @@
|
|||
CREATE OR REPLACE VIEW AD_CHANGELOG_V
|
||||
(AD_SESSION_ID, AD_CHANGELOG_ID, TABLENAME, RECORD_ID, COLUMNNAME,
|
||||
OLDVALUE, NEWVALUE, NAME, CREATED)
|
||||
AS
|
||||
SELECT l.AD_Session_ID, l.AD_ChangeLog_ID,
|
||||
t.TableName, l.Record_ID, c.ColumnName,
|
||||
l.OldValue, l.NewValue,
|
||||
u.Name, l.Created
|
||||
FROM AD_ChangeLog l
|
||||
INNER JOIN AD_Table t ON (l.AD_Table_ID=t.AD_Table_ID)
|
||||
INNER JOIN AD_Column c ON (l.AD_Column_ID=c.AD_Column_ID)
|
||||
INNER JOIN AD_User u ON (l.CreatedBy=u.AD_User_ID)
|
||||
ORDER BY l.AD_Session_ID, l.AD_ChangeLog_ID, t.TableName, l.Record_ID, c.ColumnName;
|
||||
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
CREATE OR REPLACE VIEW ad_field_v AS
|
||||
SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, COALESCE(f.columnsql, c.columnsql) AS columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, COALESCE(f.isselectioncolumn, c.isselectioncolumn) AS isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml, f.isquickform, COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id, vrf.code AS validationcodeLookup
|
||||
FROM ad_field f
|
||||
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
|
||||
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
|
||||
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
|
||||
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
|
||||
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
|
||||
LEFT JOIN ad_val_rule vrf ON vrf.ad_val_rule_id = COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id)
|
||||
WHERE f.isactive = 'Y' AND c.isactive = 'Y'
|
||||
;
|
|
@ -1,15 +0,0 @@
|
|||
CREATE OR REPLACE VIEW ad_field_vt AS
|
||||
SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, COALESCE(f.columnsql, c.columnsql) AS columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, COALESCE(f.isselectioncolumn, c.isselectioncolumn) AS isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml, f.isquickform, COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id) AS ad_val_rule_Lookup_id, vrf.code AS validationcodeLookup
|
||||
FROM ad_field f
|
||||
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
|
||||
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
|
||||
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
|
||||
LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language = fgt.ad_language
|
||||
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
|
||||
LEFT JOIN ad_column_trl ct ON f.ad_column_id = ct.ad_column_id AND trl.ad_language = ct.ad_language
|
||||
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
|
||||
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
|
||||
LEFT JOIN ad_val_rule vrf ON vrf.ad_val_rule_id = COALESCE(f.ad_val_rule_Lookup_id, c.ad_val_rule_Lookup_id)
|
||||
WHERE f.isactive = 'Y' AND c.isactive = 'Y'
|
||||
;
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
CREATE OR REPLACE VIEW AD_ORG_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION,
|
||||
ISSUMMARY, C_LOCATION_ID, DUNS, TAXID, SUPERVISOR_ID,
|
||||
PARENT_ORG_ID, AD_ORGTYPE_ID, M_WAREHOUSE_ID, C_BPARTNER_ID)
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID,
|
||||
o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
o.Value, o.Name, o.Description, o.IsSummary,
|
||||
i.C_Location_ID, i.DUNS, i.TaxID,
|
||||
i.Supervisor_ID, i.Parent_Org_ID,
|
||||
i.AD_OrgType_ID, i.M_Warehouse_ID,
|
||||
bp.C_BPartner_ID
|
||||
FROM AD_Org o
|
||||
INNER JOIN AD_OrgInfo i ON (o.AD_Org_ID=i.AD_Org_ID)
|
||||
LEFT OUTER JOIN C_BPartner bp ON (o.AD_Org_ID=bp.AD_OrgBP_ID);
|
||||
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
CREATE OR REPLACE VIEW AD_TAB_V
|
||||
(AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, DESCRIPTION,
|
||||
HELP, SEQNO, ISSINGLEROW, HASTREE, ISINFOTAB,
|
||||
REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, ISDELETEABLE,
|
||||
ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, ISREADONLY,
|
||||
AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING,
|
||||
READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB,
|
||||
ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID,
|
||||
INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON,
|
||||
MAXQUERYRECORDS, IsAllowAdvancedLookup, IsLookupOnlySelection, AD_TabType)
|
||||
AS
|
||||
SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description,
|
||||
t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType,
|
||||
tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable,
|
||||
tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility
|
||||
t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel,
|
||||
t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic,
|
||||
t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab,
|
||||
t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID,
|
||||
t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords,
|
||||
t.IsAllowAdvancedLookup, t.IsLookupOnlySelection, t.AD_TabType
|
||||
FROM AD_Tab t
|
||||
INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID)
|
||||
WHERE t.IsActive='Y'
|
||||
AND tbl.IsActive='Y'
|
||||
;
|
|
@ -1,27 +0,0 @@
|
|||
CREATE OR REPLACE VIEW AD_TAB_VT
|
||||
(AD_LANGUAGE, AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME,
|
||||
DESCRIPTION, HELP, SEQNO, ISSINGLEROW, HASTREE,
|
||||
ISINFOTAB, REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED,
|
||||
ISDELETEABLE, ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB,
|
||||
ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE,
|
||||
COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID,
|
||||
ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID,
|
||||
INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON,
|
||||
MAXQUERYRECORDS, IsAllowAdvancedLookup, IsLookupOnlySelection, AD_TabType)
|
||||
AS
|
||||
SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description,
|
||||
trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType,
|
||||
tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable,
|
||||
tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility
|
||||
t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel,
|
||||
t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic,
|
||||
t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab,
|
||||
t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID,
|
||||
t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords,
|
||||
t.IsAllowAdvancedLookup, t.IsLookupOnlySelection, t.AD_TabType
|
||||
FROM AD_Tab t
|
||||
INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID)
|
||||
INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID)
|
||||
WHERE t.IsActive='Y'
|
||||
AND tbl.IsActive='Y'
|
||||
;
|
|
@ -1,10 +0,0 @@
|
|||
CREATE OR REPLACE VIEW AD_USER_ROLES_V
|
||||
(NAME, ROLENAME)
|
||||
AS
|
||||
SELECT u.Name, r.Name AS RoleName
|
||||
FROM AD_User_Roles ur
|
||||
INNER JOIN AD_User u ON (ur.AD_User_ID=u.AD_User_ID)
|
||||
INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID);
|
||||
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
CREATE OR REPLACE VIEW AD_WINDOW_VT
|
||||
(AD_LANGUAGE, AD_WINDOW_ID, NAME, DESCRIPTION, HELP,
|
||||
WINDOWTYPE, AD_COLOR_ID, AD_IMAGE_ID, ISACTIVE, WINWIDTH,
|
||||
WINHEIGHT, ISSOTRX, AD_Window_UU)
|
||||
AS
|
||||
SELECT trl.AD_Language,
|
||||
bt.AD_Window_ID, trl.Name, trl.Description, trl.Help, bt.WindowType,
|
||||
bt.AD_Color_ID, bt.AD_Image_ID, bt.IsActive, bt.WinWidth, bt.WinHeight,
|
||||
bt.IsSOTrx, bt.AD_Window_UU
|
||||
FROM AD_Window bt
|
||||
INNER JOIN AD_Window_Trl trl ON (bt.AD_Window_ID=trl.AD_Window_ID)
|
||||
WHERE bt.IsActive='Y';
|
||||
|
||||
|
||||
|
|
@ -1,321 +0,0 @@
|
|||
DROP VIEW c_dunning_header_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_dunning_header_v
|
||||
AS
|
||||
SELECT dr.ad_client_id,
|
||||
dr.ad_org_id,
|
||||
dr.isactive,
|
||||
dr.created,
|
||||
dr.createdby,
|
||||
dr.updated,
|
||||
dr.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
dr.c_dunningrun_id,
|
||||
dre.c_dunningrunentry_id,
|
||||
dr.dunningdate,
|
||||
dl.printname,
|
||||
dl.note AS documentnote,
|
||||
dre.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
dre.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
bpg.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcg.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
bp.referenceno,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
dre.amt,
|
||||
dre.qty,
|
||||
dre.note,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
dr.c_dunning_id,
|
||||
dr.c_dunninglevel_id AS c_dunningrun_c_dunninglevel_id,
|
||||
dr.description AS c_dunningrun_description,
|
||||
dr.processed,
|
||||
dr.processing,
|
||||
dr.sendit,
|
||||
dre.ad_org_id AS c_dunningrunentry_ad_org_id,
|
||||
dre.ad_user_id,
|
||||
dre.c_bpartner_location_id,
|
||||
dre.c_currency_id,
|
||||
dre.c_dunninglevel_id AS c_dunrunentry_c_dunlevel_id,
|
||||
dre.created AS c_dunningrunentry_created,
|
||||
dre.createdby AS c_dunningrunentry_createdby,
|
||||
dre.isactive AS c_dunningrunentry_isactive,
|
||||
dre.processed AS c_dunningrunentry_processed,
|
||||
dre.updated AS c_dunningrunentry_updated,
|
||||
dre.updatedby AS c_dunningrunentry_updatedby,
|
||||
dl.ad_org_id AS c_dunninglevel_ad_org_id,
|
||||
dl.c_dunning_id AS c_dunninglevel_c_dunning_id,
|
||||
dl.chargefee,
|
||||
dl.chargeinterest,
|
||||
dl.c_paymentterm_id,
|
||||
dl.daysafterdue,
|
||||
dl.daysbetweendunning,
|
||||
dl.description AS c_dunninglevel_description,
|
||||
dl.dunning_printformat_id,
|
||||
dl.feeamt,
|
||||
dl.interestpercent,
|
||||
dl.invoicecollectiontype,
|
||||
dl.isactive AS c_dunninglevel_isactive,
|
||||
dl.issetcreditstop,
|
||||
dl.issetpaymentterm,
|
||||
dl.isshowalldue,
|
||||
dl.isshownotdue,
|
||||
dl.isstatement,
|
||||
dl.name AS c_dunninglevel_name,
|
||||
bp.acqusitioncost AS c_bpartner_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bpartner_actuallifetimevalue,
|
||||
bp.ad_language AS c_bpartner_ad_language,
|
||||
bp.ad_orgbp_id AS c_bpartner_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bpartner_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bpartner_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bpartner_c_bp_group_id,
|
||||
bp.c_greeting_id AS c_bpartner_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bpartner_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bpartner_c_paymentterm_id,
|
||||
bp.created AS c_bpartner_created,
|
||||
bp.createdby AS c_bpartner_createdby,
|
||||
bp.c_taxgroup_id AS c_bpartner_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bpartner_deliveryrule,
|
||||
bp.deliveryviarule AS c_bpartner_deliveryviarule,
|
||||
bp.description AS c_bpartner_description,
|
||||
bp.dunninggrace AS c_bpartner_dunninggrace,
|
||||
bp.firstsale AS c_bpartner_firstsale,
|
||||
bp.flatdiscount AS c_bpartner_flatdiscount,
|
||||
bp.freightcostrule AS c_bpartner_freightcostrule,
|
||||
bp.invoicerule AS c_bpartner_invoicerule,
|
||||
bp.isactive AS c_bpartner_isactive,
|
||||
bp.iscustomer AS c_bpartner_iscustomer,
|
||||
bp.isdiscountprinted AS c_bpartner_isdiscountprinted,
|
||||
bp.isemployee AS c_bpartner_isemployee,
|
||||
bp.ismanufacturer AS c_bpartner_ismanufacturer,
|
||||
bp.isonetime AS c_bpartner_isonetime,
|
||||
bp.ispotaxexempt AS c_bpartner_ispotaxexempt,
|
||||
bp.isprospect AS c_bpartner_isprospect,
|
||||
bp.issalesrep AS c_bpartner_issalesrep,
|
||||
bp.issummary AS c_bpartner_issummary,
|
||||
bp.istaxexempt AS c_bpartner_istaxexempt,
|
||||
bp.isvendor AS c_bpartner_isvendor,
|
||||
bp.logo_id AS c_bpartner_logo_id,
|
||||
bp.m_discountschema_id AS c_bpartner_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bpartner_m_pricelist_id,
|
||||
bp.naics AS c_bpartner_naics,
|
||||
bp.numberemployees AS c_bpartner_numberemployees,
|
||||
bp.paymentrule AS c_bpartner_paymentrule,
|
||||
bp.paymentrulepo AS c_bpartner_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bpartnerpo_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bpartner_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bpartner_po_pricelist_id,
|
||||
bp.poreference AS c_bpartner_poreference,
|
||||
bp.potentiallifetimevalue AS c_bpartner_potentiallifetimev,
|
||||
bp.rating AS c_bpartner_rating,
|
||||
bp.salesrep_id AS c_bpartner_salesrep_id,
|
||||
bp.salesvolume AS c_bpartner_salesvolume,
|
||||
bp.sendemail AS c_bpartner_sendemail,
|
||||
bp.shareofcustomer AS c_bpartner_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bpartner_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bpartner_so_creditlimit,
|
||||
bp.socreditstatus AS c_bpartner_socreditstatus,
|
||||
bp.so_creditused AS c_bpartner_so_creditused,
|
||||
bp.so_description AS c_bpartner_so_description,
|
||||
bp.totalopenbalance AS c_bpartner_totalopenbalance,
|
||||
bp.updated AS c_bpartner_updated,
|
||||
bp.updatedby AS c_bpartner_updatedby,
|
||||
bp.url AS c_bpartner_url,
|
||||
bpg.ad_org_id AS c_bpartner_greeting_ad_org_id,
|
||||
bpg.isactive AS c_bpartner_greeting_isactive,
|
||||
bpg.isfirstnameonly AS c_bpartner_greeting_isfirstna,
|
||||
bpg.name AS c_bpartner_greeting_name,
|
||||
bpl.ad_org_id AS c_bpartner_location_ad_org_id,
|
||||
bpl.created AS c_bpartner_location_created,
|
||||
bpl.createdby AS c_bpartner_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bpartner_location_fax,
|
||||
bpl.isactive AS c_bpartner_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bpartner_location_name,
|
||||
bpl.phone AS c_bpartner_location_phone,
|
||||
bpl.phone2 AS c_bpartner_location_phone2,
|
||||
bpl.updated AS c_bpartner_location_updated,
|
||||
bpl.updatedby AS c_bpartner_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.postal_add,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.name AS ad_user_name,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcg.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcg.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfirstnameon,
|
||||
bpcg.name AS c_user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS salesrep_bpartner_acqusitionc,
|
||||
ubp.actuallifetimevalue AS salesrep_bpartner_actuallifet,
|
||||
ubp.ad_language AS salesrep_bpartner_ad_language,
|
||||
ubp.ad_orgbp_id AS salesrep_bpartner_ad_orgbp_id,
|
||||
ubp.ad_org_id AS salesrep_bpartner_ad_org_id,
|
||||
ubp.bpartner_parent_id AS salesrep_bpartner_bp_parent_id,
|
||||
ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id,
|
||||
ubp.c_greeting_id AS salesrep_bp_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS salesrep_bp_invoiceschedule_id,
|
||||
ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id,
|
||||
ubp.created AS salesrep_bpartner_created,
|
||||
ubp.createdby AS salesrep_bpartner_createdby,
|
||||
ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id,
|
||||
ubp.deliveryrule AS salesrep_bpartner_deliveryrule,
|
||||
ubp.deliveryviarule AS salesrep_bpartner_deliveryvia,
|
||||
ubp.description AS salesrep_bpartner_description,
|
||||
ubp.dunninggrace AS salesrep_bpartner_dunninggrace,
|
||||
ubp.firstsale AS salesrep_bpartner_firstsale,
|
||||
ubp.flatdiscount AS salesrep_bpartner_flatdiscount,
|
||||
ubp.freightcostrule AS salesrep_bpartner_freightcost,
|
||||
ubp.invoicerule AS salesrep_bpartner_invoicerule,
|
||||
ubp.isactive AS salesrep_bpartner_isactive,
|
||||
ubp.iscustomer AS salesrep_bpartner_iscustomer,
|
||||
ubp.isdiscountprinted AS salesrep_bpartner_isdiscountp,
|
||||
ubp.isemployee AS salesrep_bpartner_isemployee,
|
||||
ubp.ismanufacturer AS salesrep_bpartner_ismanufactu,
|
||||
ubp.isonetime AS salesrep_bpartner_isonetime,
|
||||
ubp.ispotaxexempt AS salesrep_bpartner_ispotaxexem,
|
||||
ubp.isprospect AS salesrep_bpartner_isprospect,
|
||||
ubp.issalesrep AS salesrep_bpartner_issalesrep,
|
||||
ubp.issummary AS salesrep_bpartner_issummary,
|
||||
ubp.istaxexempt AS salesrep_bpartner_istaxexempt,
|
||||
ubp.isvendor AS salesrep_bpartner_isvendor,
|
||||
ubp.logo_id AS salesrep_bpartner_logo_id,
|
||||
ubp.m_discountschema_id AS salesrep_bp_mdiscountschema_id,
|
||||
ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id,
|
||||
ubp.naics AS salesrep_bpartner_naics,
|
||||
ubp.numberemployees AS salesrep_bpartner_numberemplo,
|
||||
ubp.paymentrule AS salesrep_bpartner_paymentrule,
|
||||
ubp.paymentrulepo AS salesrep_bpartner_paymentrupo,
|
||||
ubp.po_discountschema_id AS salesrep_bp_po_discountscm_id,
|
||||
ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id,
|
||||
ubp.poreference AS salesrep_bpartner_poreference,
|
||||
ubp.potentiallifetimevalue AS salesrep_bpartner_potentialli,
|
||||
ubp.rating AS salesrep_bpartner_rating,
|
||||
ubp.salesrep_id AS salesrep_bpartner_salesrep_id,
|
||||
ubp.salesvolume AS salesrep_bpartner_salesvolume,
|
||||
ubp.sendemail AS salesrep_bpartner_sendemail,
|
||||
ubp.shareofcustomer AS salesrep_bpartner_shareofcust,
|
||||
ubp.shelflifeminpct AS salesrep_bpartner_shelflifemi,
|
||||
ubp.so_creditlimit AS salesrep_bpartner_so_creditli,
|
||||
ubp.socreditstatus AS salesrep_bpartner_socreditsta,
|
||||
ubp.so_creditused AS salesrep_bpartner_so_creditus,
|
||||
ubp.so_description AS salesrep_bpartner_so_descript,
|
||||
ubp.totalopenbalance AS salesrep_bpartner_totalopenba,
|
||||
ubp.updated AS salesrep_bpartner_updated,
|
||||
ubp.updatedby AS salesrep_bpartner_updatedby,
|
||||
ubp.url AS salesrep_bpartner_url
|
||||
FROM c_dunningrun dr
|
||||
JOIN c_dunningrunentry dre
|
||||
ON dr.c_dunningrun_id = dre.c_dunningrun_id
|
||||
JOIN c_dunninglevel dl
|
||||
ON dre.c_dunninglevel_id = dl.c_dunninglevel_id
|
||||
JOIN c_bpartner bp
|
||||
ON dre.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
JOIN c_bpartner_location bpl
|
||||
ON dre.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON dre.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
JOIN ad_orginfo oi
|
||||
ON dr.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON dr.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_user u
|
||||
ON dre.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
;
|
||||
|
|
@ -1,329 +0,0 @@
|
|||
DROP VIEW c_dunning_header_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_dunning_header_vt
|
||||
AS
|
||||
SELECT dr.ad_client_id,
|
||||
dr.ad_org_id,
|
||||
dr.isactive,
|
||||
dr.created,
|
||||
dr.createdby,
|
||||
dr.updated,
|
||||
dr.updatedby,
|
||||
dlt.ad_language,
|
||||
dr.c_dunningrun_id,
|
||||
dre.c_dunningrunentry_id,
|
||||
dr.dunningdate,
|
||||
dlt.printname,
|
||||
dlt.note AS documentnote,
|
||||
dre.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
dre.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
bpgt.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcgt.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
bp.referenceno,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
dre.amt,
|
||||
dre.qty,
|
||||
dre.note,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
dr.c_dunning_id,
|
||||
dr.c_dunninglevel_id AS c_dunningrun_c_dunninglevel_id,
|
||||
dr.description AS c_dunningrun_description,
|
||||
dr.processed,
|
||||
dr.processing,
|
||||
dr.sendit,
|
||||
dre.ad_org_id AS c_dunningrunentry_ad_org_id,
|
||||
dre.ad_user_id,
|
||||
dre.c_bpartner_location_id,
|
||||
dre.c_currency_id,
|
||||
dre.c_dunninglevel_id AS c_dunrunentry_c_dunlevel_id,
|
||||
dre.created AS c_dunningrunentry_created,
|
||||
dre.createdby AS c_dunningrunentry_createdby,
|
||||
dre.isactive AS c_dunningrunentry_isactive,
|
||||
dre.processed AS c_dunningrunentry_processed,
|
||||
dre.updated AS c_dunningrunentry_updated,
|
||||
dre.updatedby AS c_dunningrunentry_updatedby,
|
||||
dl.ad_org_id AS c_dunninglevel_ad_org_id,
|
||||
dl.c_dunning_id AS c_dunninglevel_c_dunning_id,
|
||||
dl.chargefee,
|
||||
dl.chargeinterest,
|
||||
dl.c_paymentterm_id,
|
||||
dl.daysafterdue,
|
||||
dl.daysbetweendunning,
|
||||
dl.description AS c_dunninglevel_description,
|
||||
dl.dunning_printformat_id,
|
||||
dl.feeamt,
|
||||
dl.interestpercent,
|
||||
dl.invoicecollectiontype,
|
||||
dl.isactive AS c_dunninglevel_isactive,
|
||||
dl.issetcreditstop,
|
||||
dl.issetpaymentterm,
|
||||
dl.isshowalldue,
|
||||
dl.isshownotdue,
|
||||
dl.isstatement,
|
||||
dl.name AS c_dunninglevel_name,
|
||||
bp.acqusitioncost AS c_bpartner_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bpartner_actuallifetimevalue,
|
||||
bp.ad_language AS c_bpartner_ad_language,
|
||||
bp.ad_orgbp_id AS c_bpartner_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bpartner_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bpartner_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bpartner_c_bp_group_id,
|
||||
bp.c_greeting_id AS c_bpartner_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bpartner_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bpartner_c_paymentterm_id,
|
||||
bp.created AS c_bpartner_created,
|
||||
bp.createdby AS c_bpartner_createdby,
|
||||
bp.c_taxgroup_id AS c_bpartner_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bpartner_deliveryrule,
|
||||
bp.deliveryviarule AS c_bpartner_deliveryviarule,
|
||||
bp.description AS c_bpartner_description,
|
||||
bp.dunninggrace AS c_bpartner_dunninggrace,
|
||||
bp.firstsale AS c_bpartner_firstsale,
|
||||
bp.flatdiscount AS c_bpartner_flatdiscount,
|
||||
bp.freightcostrule AS c_bpartner_freightcostrule,
|
||||
bp.invoicerule AS c_bpartner_invoicerule,
|
||||
bp.isactive AS c_bpartner_isactive,
|
||||
bp.iscustomer AS c_bpartner_iscustomer,
|
||||
bp.isdiscountprinted AS c_bpartner_isdiscountprinted,
|
||||
bp.isemployee AS c_bpartner_isemployee,
|
||||
bp.ismanufacturer AS c_bpartner_ismanufacturer,
|
||||
bp.isonetime AS c_bpartner_isonetime,
|
||||
bp.ispotaxexempt AS c_bpartner_ispotaxexempt,
|
||||
bp.isprospect AS c_bpartner_isprospect,
|
||||
bp.issalesrep AS c_bpartner_issalesrep,
|
||||
bp.issummary AS c_bpartner_issummary,
|
||||
bp.istaxexempt AS c_bpartner_istaxexempt,
|
||||
bp.isvendor AS c_bpartner_isvendor,
|
||||
bp.logo_id AS c_bpartner_logo_id,
|
||||
bp.m_discountschema_id AS c_bpartner_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bpartner_m_pricelist_id,
|
||||
bp.naics AS c_bpartner_naics,
|
||||
bp.numberemployees AS c_bpartner_numberemployees,
|
||||
bp.paymentrule AS c_bpartner_paymentrule,
|
||||
bp.paymentrulepo AS c_bpartner_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bpartnerpo_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bpartner_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bpartner_po_pricelist_id,
|
||||
bp.poreference AS c_bpartner_poreference,
|
||||
bp.potentiallifetimevalue AS c_bpartner_potentiallifetimev,
|
||||
bp.rating AS c_bpartner_rating,
|
||||
bp.salesrep_id AS c_bpartner_salesrep_id,
|
||||
bp.salesvolume AS c_bpartner_salesvolume,
|
||||
bp.sendemail AS c_bpartner_sendemail,
|
||||
bp.shareofcustomer AS c_bpartner_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bpartner_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bpartner_so_creditlimit,
|
||||
bp.socreditstatus AS c_bpartner_socreditstatus,
|
||||
bp.so_creditused AS c_bpartner_so_creditused,
|
||||
bp.so_description AS c_bpartner_so_description,
|
||||
bp.totalopenbalance AS c_bpartner_totalopenbalance,
|
||||
bp.updated AS c_bpartner_updated,
|
||||
bp.updatedby AS c_bpartner_updatedby,
|
||||
bp.url AS c_bpartner_url,
|
||||
bpgt.ad_org_id AS c_bpartner_greeting_ad_org_id,
|
||||
bpgt.isactive AS c_bpartner_greeting_isactive,
|
||||
bpg.isfirstnameonly AS c_bpartner_greeting_isfirstna,
|
||||
bpgt.name AS c_bpartner_greeting_name,
|
||||
bpl.ad_org_id AS c_bpartner_location_ad_org_id,
|
||||
bpl.created AS c_bpartner_location_created,
|
||||
bpl.createdby AS c_bpartner_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bpartner_location_fax,
|
||||
bpl.isactive AS c_bpartner_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bpartner_location_name,
|
||||
bpl.phone AS c_bpartner_location_phone,
|
||||
bpl.phone2 AS c_bpartner_location_phone2,
|
||||
bpl.updated AS c_bpartner_location_updated,
|
||||
bpl.updatedby AS c_bpartner_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.postal_add,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.name AS ad_user_name,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcgt.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcgt.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfirstnameon,
|
||||
bpcgt.name AS c_user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS salesrep_bpartner_acqusitionc,
|
||||
ubp.actuallifetimevalue AS salesrep_bpartner_actuallifet,
|
||||
ubp.ad_language AS salesrep_bpartner_ad_language,
|
||||
ubp.ad_orgbp_id AS salesrep_bpartner_ad_orgbp_id,
|
||||
ubp.ad_org_id AS salesrep_bpartner_ad_org_id,
|
||||
ubp.bpartner_parent_id AS salesrep_bpartner_bp_parent_id,
|
||||
ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id,
|
||||
ubp.c_greeting_id AS salesrep_bp_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS salesrep_bp_invoiceschedule_id,
|
||||
ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id,
|
||||
ubp.created AS salesrep_bpartner_created,
|
||||
ubp.createdby AS salesrep_bpartner_createdby,
|
||||
ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id,
|
||||
ubp.deliveryrule AS salesrep_bpartner_deliveryrule,
|
||||
ubp.deliveryviarule AS salesrep_bpartner_deliveryvia,
|
||||
ubp.description AS salesrep_bpartner_description,
|
||||
ubp.dunninggrace AS salesrep_bpartner_dunninggrace,
|
||||
ubp.firstsale AS salesrep_bpartner_firstsale,
|
||||
ubp.flatdiscount AS salesrep_bpartner_flatdiscount,
|
||||
ubp.freightcostrule AS salesrep_bpartner_freightcost,
|
||||
ubp.invoicerule AS salesrep_bpartner_invoicerule,
|
||||
ubp.isactive AS salesrep_bpartner_isactive,
|
||||
ubp.iscustomer AS salesrep_bpartner_iscustomer,
|
||||
ubp.isdiscountprinted AS salesrep_bpartner_isdiscountp,
|
||||
ubp.isemployee AS salesrep_bpartner_isemployee,
|
||||
ubp.ismanufacturer AS salesrep_bpartner_ismanufactu,
|
||||
ubp.isonetime AS salesrep_bpartner_isonetime,
|
||||
ubp.ispotaxexempt AS salesrep_bpartner_ispotaxexem,
|
||||
ubp.isprospect AS salesrep_bpartner_isprospect,
|
||||
ubp.issalesrep AS salesrep_bpartner_issalesrep,
|
||||
ubp.issummary AS salesrep_bpartner_issummary,
|
||||
ubp.istaxexempt AS salesrep_bpartner_istaxexempt,
|
||||
ubp.isvendor AS salesrep_bpartner_isvendor,
|
||||
ubp.logo_id AS salesrep_bpartner_logo_id,
|
||||
ubp.m_discountschema_id AS salesrep_bp_mdiscountschema_id,
|
||||
ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id,
|
||||
ubp.naics AS salesrep_bpartner_naics,
|
||||
ubp.numberemployees AS salesrep_bpartner_numberemplo,
|
||||
ubp.paymentrule AS salesrep_bpartner_paymentrule,
|
||||
ubp.paymentrulepo AS salesrep_bpartner_paymentrupo,
|
||||
ubp.po_discountschema_id AS salesrep_bp_po_discountscm_id,
|
||||
ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id,
|
||||
ubp.poreference AS salesrep_bpartner_poreference,
|
||||
ubp.potentiallifetimevalue AS salesrep_bpartner_potentialli,
|
||||
ubp.rating AS salesrep_bpartner_rating,
|
||||
ubp.salesrep_id AS salesrep_bpartner_salesrep_id,
|
||||
ubp.salesvolume AS salesrep_bpartner_salesvolume,
|
||||
ubp.sendemail AS salesrep_bpartner_sendemail,
|
||||
ubp.shareofcustomer AS salesrep_bpartner_shareofcust,
|
||||
ubp.shelflifeminpct AS salesrep_bpartner_shelflifemi,
|
||||
ubp.so_creditlimit AS salesrep_bpartner_so_creditli,
|
||||
ubp.socreditstatus AS salesrep_bpartner_socreditsta,
|
||||
ubp.so_creditused AS salesrep_bpartner_so_creditus,
|
||||
ubp.so_description AS salesrep_bpartner_so_descript,
|
||||
ubp.totalopenbalance AS salesrep_bpartner_totalopenba,
|
||||
ubp.updated AS salesrep_bpartner_updated,
|
||||
ubp.updatedby AS salesrep_bpartner_updatedby,
|
||||
ubp.url AS salesrep_bpartner_url
|
||||
FROM c_dunningrun dr
|
||||
JOIN c_dunningrunentry dre
|
||||
ON dr.c_dunningrun_id = dre.c_dunningrun_id
|
||||
JOIN c_dunninglevel dl
|
||||
ON dre.c_dunninglevel_id = dl.c_dunninglevel_id
|
||||
JOIN c_dunninglevel_trl dlt
|
||||
ON dl.c_dunninglevel_id = dlt.c_dunninglevel_id
|
||||
JOIN c_bpartner bp
|
||||
ON dre.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpgt
|
||||
ON bp.c_greeting_id = bpgt.c_greeting_id
|
||||
AND dlt.ad_language = bpgt.ad_language
|
||||
JOIN c_bpartner_location bpl
|
||||
ON dre.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON dre.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpcgt
|
||||
ON bpc.c_greeting_id = bpcgt.c_greeting_id
|
||||
AND dlt.ad_language = bpcgt.ad_language
|
||||
JOIN ad_orginfo oi
|
||||
ON dr.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON dr.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_user u
|
||||
ON dre.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
;
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
DROP VIEW c_dunning_line_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_dunning_line_v
|
||||
AS
|
||||
SELECT drl.ad_client_id,
|
||||
drl.ad_org_id,
|
||||
drl.isactive,
|
||||
drl.created,
|
||||
drl.createdby,
|
||||
drl.updated,
|
||||
drl.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
drl.c_dunningrunline_id,
|
||||
drl.c_dunningrunentry_id,
|
||||
drl.amt,
|
||||
drl.convertedamt,
|
||||
drl.daysdue,
|
||||
drl.timesdunned,
|
||||
drl.interestamt,
|
||||
drl.feeamt,
|
||||
drl.totalamt,
|
||||
drl.c_invoice_id,
|
||||
COALESCE(i.issotrx, p.isreceipt) AS issotrx,
|
||||
COALESCE(i.documentno, p.documentno) AS documentno,
|
||||
COALESCE(i.docstatus, p.docstatus) AS docstatus,
|
||||
COALESCE(i.dateinvoiced, p.datetrx) AS datetrx,
|
||||
COALESCE(i.c_doctype_id, p.c_doctype_id) AS c_doctype_id,
|
||||
COALESCE(dt.printname, dtp.printname) AS documenttype,
|
||||
COALESCE(i.description, p.description) AS description,
|
||||
COALESCE(i.c_currency_id, p.c_currency_id) AS c_currency_id,
|
||||
COALESCE(i.c_campaign_id, p.c_campaign_id) AS c_campaign_id,
|
||||
COALESCE(i.c_project_id, p.c_project_id) AS c_project_id,
|
||||
COALESCE(i.c_activity_id, p.c_activity_id) AS c_activity_id,
|
||||
COALESCE(i.user1_id, p.user1_id) AS user1_id,
|
||||
COALESCE(i.user2_id, p.user2_id) AS user2_id,
|
||||
COALESCE(i.dateacct, p.dateacct) AS dateacct,
|
||||
COALESCE(i.c_conversiontype_id, p.c_conversiontype_id) AS c_conversiontype_id,
|
||||
COALESCE(i.ad_orgtrx_id, p.ad_orgtrx_id) AS ad_orgtrx_id,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.dateinvoiced,
|
||||
i.isindispute,
|
||||
pt.name AS paymentterm,
|
||||
i.c_charge_id,
|
||||
i.chargeamt,
|
||||
i.totallines,
|
||||
i.grandtotal,
|
||||
i.grandtotal AS amtinwords,
|
||||
i.m_pricelist_id,
|
||||
i.ispaid,
|
||||
p.isallocated,
|
||||
p.tendertype,
|
||||
p.discountamt,
|
||||
drl.c_invoicepayschedule_id,
|
||||
drl.c_payment_id,
|
||||
drl.isindispute AS c_dunningrunline_isindispute,
|
||||
drl.openamt,
|
||||
drl.processed AS c_dunningrunline_processed,
|
||||
i.ad_org_id AS c_invoice_ad_org_id,
|
||||
i.ad_user_id,
|
||||
i.c_bpartner_id AS c_invoice_c_bpartner_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.c_order_id AS c_invoice_c_order_id,
|
||||
i.c_payment_id AS c_invoice_c_payment_id,
|
||||
i.created AS c_invoice_created,
|
||||
i.createdby AS c_invoice_createdby,
|
||||
i.dateprinted,
|
||||
i.docaction,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isactive AS c_invoice_isactive,
|
||||
i.isapproved AS c_invoice_isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.istaxincluded,
|
||||
i.istransferred,
|
||||
i.m_rma_id,
|
||||
i.paymentrule,
|
||||
i.posted AS c_invoice_posted,
|
||||
i.processedon AS c_invoice_processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id AS c_invoice_reversal_id,
|
||||
i.salesrep_id,
|
||||
i.sendemail,
|
||||
i.updated AS c_invoice_updated,
|
||||
i.updatedby AS c_invoice_updatedby,
|
||||
pt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.c_paymentterm_id,
|
||||
pt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.documentnote,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
pt.isactive AS c_paymentterm_isactive,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS c_paymentterm_value,
|
||||
p.a_city,
|
||||
p.a_country,
|
||||
p.ad_org_id AS c_payment_ad_org_id,
|
||||
p.a_email,
|
||||
p.a_ident_dl,
|
||||
p.a_name,
|
||||
p.a_state,
|
||||
p.a_street,
|
||||
p.a_zip,
|
||||
p.c_bpartner_id AS c_payment_c_bpartner_id,
|
||||
p.c_charge_id AS c_payment_c_charge_id,
|
||||
p.chargeamt AS c_payment_chargeamt,
|
||||
p.checkno,
|
||||
p.c_invoice_id AS c_payment_c_invoice_id,
|
||||
p.c_order_id AS c_payment_c_order_id,
|
||||
p.c_paymentbatch_id,
|
||||
p.created AS c_payment_created,
|
||||
p.createdby AS c_payment_createdby,
|
||||
p.isactive AS c_payment_isactive,
|
||||
p.isapproved,
|
||||
p.isdelayedcapture,
|
||||
p.isonline,
|
||||
p.isoverunderpayment,
|
||||
p.isprepayment,
|
||||
p.isreconciled,
|
||||
p.isselfservice AS c_payment_isselfservice,
|
||||
p.micr,
|
||||
p.orig_trxid,
|
||||
p.overunderamt,
|
||||
p.payamt,
|
||||
p.ponum,
|
||||
p.posted AS c_payment_posted,
|
||||
p.processed AS c_payment_processed,
|
||||
p.processedon AS c_payment_processedon,
|
||||
p.r_authcode,
|
||||
p.r_authcode_dc,
|
||||
p.r_avsaddr,
|
||||
p.r_avszip,
|
||||
p.r_cvv2match,
|
||||
p.ref_payment_id,
|
||||
p.reversal_id AS c_payment_reversal_id,
|
||||
p.r_info,
|
||||
p.routingno,
|
||||
p.r_pnref,
|
||||
p.r_pnref_dc,
|
||||
p.r_respmsg,
|
||||
p.r_result,
|
||||
p.swipe,
|
||||
p.taxamt,
|
||||
p.trxtype,
|
||||
p.updated AS c_payment_updated,
|
||||
p.updatedby AS c_payment_updatedby,
|
||||
p.voiceauthcode,
|
||||
p.writeoffamt
|
||||
FROM c_dunningrunline drl
|
||||
LEFT JOIN c_invoice i
|
||||
ON drl.c_invoice_id = i.c_invoice_id
|
||||
LEFT JOIN c_doctype dt
|
||||
ON i.c_doctype_id = dt.c_doctype_id
|
||||
LEFT JOIN c_paymentterm pt
|
||||
ON i.c_paymentterm_id = pt.c_paymentterm_id
|
||||
LEFT JOIN c_payment p
|
||||
ON drl.c_payment_id = p.c_payment_id
|
||||
LEFT JOIN c_doctype dtp
|
||||
ON p.c_doctype_id = dtp.c_doctype_id
|
||||
;
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
DROP VIEW c_dunning_line_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_dunning_line_vt
|
||||
AS
|
||||
SELECT drl.ad_client_id,
|
||||
drl.ad_org_id,
|
||||
drl.isactive,
|
||||
drl.created,
|
||||
drl.createdby,
|
||||
drl.updated,
|
||||
drl.updatedby,
|
||||
COALESCE(dt.ad_language, dtp.ad_language) AS ad_language,
|
||||
drl.c_dunningrunline_id,
|
||||
drl.c_dunningrunentry_id,
|
||||
drl.amt,
|
||||
drl.convertedamt,
|
||||
drl.daysdue,
|
||||
drl.timesdunned,
|
||||
drl.interestamt,
|
||||
drl.feeamt,
|
||||
drl.totalamt,
|
||||
drl.c_invoice_id,
|
||||
COALESCE(i.issotrx, p.isreceipt) AS issotrx,
|
||||
COALESCE(i.documentno, p.documentno) AS documentno,
|
||||
COALESCE(i.docstatus, p.docstatus) AS docstatus,
|
||||
COALESCE(i.dateinvoiced, p.datetrx) AS datetrx,
|
||||
COALESCE(i.c_doctype_id, p.c_doctype_id) AS c_doctype_id,
|
||||
COALESCE(dt.printname, dtp.printname) AS documenttype,
|
||||
COALESCE(i.description, p.description) AS description,
|
||||
COALESCE(i.c_currency_id, p.c_currency_id) AS c_currency_id,
|
||||
COALESCE(i.c_campaign_id, p.c_campaign_id) AS c_campaign_id,
|
||||
COALESCE(i.c_project_id, p.c_project_id) AS c_project_id,
|
||||
COALESCE(i.c_activity_id, p.c_activity_id) AS c_activity_id,
|
||||
COALESCE(i.user1_id, p.user1_id) AS user1_id,
|
||||
COALESCE(i.user2_id, p.user2_id) AS user2_id,
|
||||
COALESCE(i.dateacct, p.dateacct) AS dateacct,
|
||||
COALESCE(i.c_conversiontype_id, p.c_conversiontype_id) AS c_conversiontype_id,
|
||||
COALESCE(i.ad_orgtrx_id, p.ad_orgtrx_id) AS ad_orgtrx_id,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.dateinvoiced,
|
||||
i.isindispute,
|
||||
ptt.name AS paymentterm,
|
||||
i.c_charge_id,
|
||||
i.chargeamt,
|
||||
i.totallines,
|
||||
i.grandtotal,
|
||||
i.grandtotal AS amtinwords,
|
||||
i.m_pricelist_id,
|
||||
i.ispaid,
|
||||
p.isallocated,
|
||||
p.tendertype,
|
||||
p.discountamt,
|
||||
drl.c_invoicepayschedule_id,
|
||||
drl.c_payment_id,
|
||||
drl.isindispute AS c_dunningrunline_isindispute,
|
||||
drl.openamt,
|
||||
drl.processed AS c_dunningrunline_processed,
|
||||
i.ad_org_id AS c_invoice_ad_org_id,
|
||||
i.ad_user_id,
|
||||
i.c_bpartner_id AS c_invoice_c_bpartner_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.c_order_id AS c_invoice_c_order_id,
|
||||
i.c_payment_id AS c_invoice_c_payment_id,
|
||||
i.created AS c_invoice_created,
|
||||
i.createdby AS c_invoice_createdby,
|
||||
i.dateprinted,
|
||||
i.docaction,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isactive AS c_invoice_isactive,
|
||||
i.isapproved AS c_invoice_isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.istaxincluded,
|
||||
i.istransferred,
|
||||
i.m_rma_id,
|
||||
i.paymentrule,
|
||||
i.posted AS c_invoice_posted,
|
||||
i.processedon AS c_invoice_processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id AS c_invoice_reversal_id,
|
||||
i.salesrep_id,
|
||||
i.sendemail,
|
||||
i.updated AS c_invoice_updated,
|
||||
i.updatedby AS c_invoice_updatedby,
|
||||
ptt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.c_paymentterm_id,
|
||||
ptt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
ptt.documentnote,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
ptt.isactive AS c_paymentterm_isactive,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS c_paymentterm_value,
|
||||
p.a_city,
|
||||
p.a_country,
|
||||
p.ad_org_id AS c_payment_ad_org_id,
|
||||
p.a_email,
|
||||
p.a_ident_dl,
|
||||
p.a_name,
|
||||
p.a_state,
|
||||
p.a_street,
|
||||
p.a_zip,
|
||||
p.c_bpartner_id AS c_payment_c_bpartner_id,
|
||||
p.c_charge_id AS c_payment_c_charge_id,
|
||||
p.chargeamt AS c_payment_chargeamt,
|
||||
p.checkno,
|
||||
p.c_invoice_id AS c_payment_c_invoice_id,
|
||||
p.c_order_id AS c_payment_c_order_id,
|
||||
p.c_paymentbatch_id,
|
||||
p.created AS c_payment_created,
|
||||
p.createdby AS c_payment_createdby,
|
||||
p.isactive AS c_payment_isactive,
|
||||
p.isapproved,
|
||||
p.isdelayedcapture,
|
||||
p.isonline,
|
||||
p.isoverunderpayment,
|
||||
p.isprepayment,
|
||||
p.isreconciled,
|
||||
p.isselfservice AS c_payment_isselfservice,
|
||||
p.micr,
|
||||
p.orig_trxid,
|
||||
p.overunderamt,
|
||||
p.payamt,
|
||||
p.ponum,
|
||||
p.posted AS c_payment_posted,
|
||||
p.processed AS c_payment_processed,
|
||||
p.processedon AS c_payment_processedon,
|
||||
p.r_authcode,
|
||||
p.r_authcode_dc,
|
||||
p.r_avsaddr,
|
||||
p.r_avszip,
|
||||
p.r_cvv2match,
|
||||
p.ref_payment_id,
|
||||
p.reversal_id AS c_payment_reversal_id,
|
||||
p.r_info,
|
||||
p.routingno,
|
||||
p.r_pnref,
|
||||
p.r_pnref_dc,
|
||||
p.r_respmsg,
|
||||
p.r_result,
|
||||
p.swipe,
|
||||
p.taxamt,
|
||||
p.trxtype,
|
||||
p.updated AS c_payment_updated,
|
||||
p.updatedby AS c_payment_updatedby,
|
||||
p.voiceauthcode,
|
||||
p.writeoffamt
|
||||
FROM c_dunningrunline drl
|
||||
LEFT JOIN c_invoice i
|
||||
ON drl.c_invoice_id = i.c_invoice_id
|
||||
LEFT JOIN c_doctype_trl dt
|
||||
ON i.c_doctype_id = dt.c_doctype_id
|
||||
LEFT JOIN c_paymentterm pt
|
||||
ON i.c_paymentterm_id = pt.c_paymentterm_id
|
||||
LEFT JOIN c_paymentterm_trl ptt
|
||||
ON i.c_paymentterm_id = ptt.c_paymentterm_id
|
||||
AND ptt.ad_language = dt.ad_language
|
||||
LEFT JOIN c_payment p
|
||||
ON drl.c_payment_id = p.c_payment_id
|
||||
LEFT JOIN c_doctype_trl dtp
|
||||
ON p.c_doctype_id = dtp.c_doctype_id
|
||||
WHERE COALESCE(dt.ad_language, dtp.ad_language) = COALESCE(dtp.ad_language, dt.ad_language)
|
||||
;
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_INVOICELINE_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, C_INVOICELINE_ID, C_INVOICE_ID, SALESREP_ID,
|
||||
C_BPARTNER_ID, M_PRODUCT_ID, DOCUMENTNO, DATEINVOICED, DATEACCT,
|
||||
ISSOTRX, DOCSTATUS, LINENETAMT, LINELISTAMT, LINELIMITAMT,
|
||||
LINEDISCOUNTAMT, LINEOVERLIMITAMT, QTYINVOICED, QTYENTERED, LINE,
|
||||
C_ORDERLINE_ID, C_UOM_ID, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID,
|
||||
C_PROJECTPHASE_ID, C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID,
|
||||
il.C_InvoiceLine_ID, i.C_Invoice_ID, i.SalesRep_ID,
|
||||
i.C_BPartner_ID, il.M_Product_ID,
|
||||
i.DocumentNo, i.DateInvoiced, i.DateAcct,
|
||||
i.IsSOTrx, i.DocStatus,
|
||||
currencyRound(i.Multiplier*LineNetAmt,i.C_Currency_ID,'N') AS LineNetAmt,
|
||||
currencyRound(i.Multiplier*PriceList*QtyInvoiced,i.C_Currency_ID,'N') AS LineListAmt,
|
||||
CASE WHEN COALESCE(il.PriceLimit, 0)=0 THEN currencyRound(i.Multiplier*LineNetAmt,i.C_Currency_ID,'N') ELSE currencyRound(i.Multiplier*il.PriceLimit*il.QtyInvoiced,i.C_Currency_ID,'N') END AS LineLimitAmt,
|
||||
currencyRound(i.Multiplier*il.PriceList*il.QtyInvoiced-il.LineNetAmt,i.C_Currency_ID,'N') AS LineDiscountAmt,
|
||||
CASE WHEN COALESCE(il.PriceLimit,0)=0 THEN 0 ELSE currencyRound(i.Multiplier*il.LineNetAmt-il.PriceLimit*il.QtyInvoiced,i.C_Currency_ID,'N') END AS LineOverLimitAmt,
|
||||
il.QtyInvoiced, il.QtyEntered,
|
||||
il.Line, il.C_OrderLine_ID, il.C_UOM_ID,
|
||||
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||||
FROM C_Invoice_v i, C_InvoiceLine il
|
||||
WHERE i.C_Invoice_ID=il.C_Invoice_ID;
|
||||
|
||||
--COMMENT ON TABLE C_INVOICELINE_V IS 'Invoice Line Summary for Reporting Views - Corrected for Credit Memos';
|
||||
|
||||
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_INVOICE_CANDIDATE_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_ORDER_ID, DOCUMENTNO,
|
||||
DATEORDERED, C_DOCTYPE_ID, TOTALLINES)
|
||||
AS
|
||||
SELECT
|
||||
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||||
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||||
SUM((l.QtyOrdered-l.QtyInvoiced)*l.PriceActual) AS TotalLines
|
||||
FROM C_Order o
|
||||
INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
|
||||
INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_InvoiceSchedule si ON (bp.C_InvoiceSchedule_ID=si.C_InvoiceSchedule_ID)
|
||||
WHERE o.DocStatus IN ('CO','CL','IP') -- Standard Orders are IP
|
||||
-- not Offers and open Walkin-Receipts
|
||||
AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
|
||||
WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))
|
||||
-- we need to invoice
|
||||
AND l.QtyOrdered <> l.QtyInvoiced
|
||||
--
|
||||
AND (
|
||||
-- Immediate
|
||||
o.InvoiceRule='I'
|
||||
-- Order complete
|
||||
OR (o.InvoiceRule='O' AND NOT EXISTS (SELECT 1 FROM C_OrderLine zz1
|
||||
WHERE zz1.C_Order_ID=o.C_Order_ID AND zz1.QtyOrdered<>zz1.QtyDelivered))
|
||||
-- Delivery
|
||||
OR (o.InvoiceRule='D' AND l.QtyInvoiced<>l.QtyDelivered)
|
||||
-- Order Schedule, but none defined on Business Partner level
|
||||
OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NULL)
|
||||
-- Schedule defined at BP
|
||||
OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NOT NULL AND
|
||||
(
|
||||
-- Daily or none
|
||||
(si.InvoiceFrequency IS NULL OR si.InvoiceFrequency='D')
|
||||
-- Weekly
|
||||
OR (si.InvoiceFrequency='W')
|
||||
-- Bi-Monthly
|
||||
OR (si.InvoiceFrequency='T'
|
||||
AND ((TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1
|
||||
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1)
|
||||
OR (TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff+14
|
||||
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay+14))
|
||||
)
|
||||
-- Monthly
|
||||
OR (si.InvoiceFrequency='M'
|
||||
AND TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1 -- after cutoff
|
||||
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1) -- after invoice day
|
||||
)
|
||||
)
|
||||
)
|
||||
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||||
o.DocumentNo, o.DateOrdered, o.C_DocType_ID;
|
||||
|
||||
|
||||
|
|
@ -1,364 +0,0 @@
|
|||
DROP VIEW c_invoice_header_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_invoice_header_v
|
||||
AS
|
||||
SELECT i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
i.created,
|
||||
i.createdby,
|
||||
i.updated,
|
||||
i.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
i.c_invoice_id,
|
||||
i.issotrx,
|
||||
i.documentno,
|
||||
i.docstatus,
|
||||
i.c_doctype_id,
|
||||
i.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
i.c_order_id,
|
||||
i.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
i.dateinvoiced,
|
||||
bpg.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcg.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
bp.referenceno,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
i.description,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.c_currency_id,
|
||||
pt.name AS paymentterm,
|
||||
pt.documentnote AS paymenttermnote,
|
||||
i.c_charge_id,
|
||||
i.chargeamt,
|
||||
i.totallines,
|
||||
i.grandtotal,
|
||||
i.grandtotal AS amtinwords,
|
||||
i.m_pricelist_id,
|
||||
i.istaxincluded,
|
||||
i.c_campaign_id,
|
||||
i.c_project_id,
|
||||
i.c_activity_id,
|
||||
i.ispaid,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
|
||||
i.ad_user_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_conversiontype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.c_payment_id,
|
||||
i.dateacct,
|
||||
i.dateprinted,
|
||||
i.docaction,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.istransferred,
|
||||
i.m_rma_id,
|
||||
i.paymentrule,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.sendemail,
|
||||
i.user1_id,
|
||||
i.user2_id,
|
||||
pt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.c_paymentterm_id,
|
||||
pt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
pt.isactive AS c_paymentterm_isactive,
|
||||
pt.isdefault,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS c_paymentterm_value,
|
||||
bp.acqusitioncost AS bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS bp_actuallifetimevalue,
|
||||
bp.ad_language AS bp_ad_language,
|
||||
bp.ad_orgbp_id AS bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS bp_c_dunning_id,
|
||||
bp.c_greeting_id AS bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS bp_c_paymentterm_id,
|
||||
bp.created AS bp_created,
|
||||
bp.createdby AS bp_createdby,
|
||||
bp.c_taxgroup_id AS bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS bp_deliveryrule,
|
||||
bp.deliveryviarule AS bp_deliveryviarule,
|
||||
bp.description AS bp_description,
|
||||
bp.dunninggrace AS bp_dunninggrace,
|
||||
bp.firstsale AS bp_firstsale,
|
||||
bp.flatdiscount AS bp_flatdiscount,
|
||||
bp.freightcostrule AS bp_freightcostrule,
|
||||
bp.invoicerule AS bp_invoicerule,
|
||||
bp.isactive AS bp_isactive,
|
||||
bp.iscustomer AS bp_iscustomer,
|
||||
bp.isdiscountprinted AS bp_isdiscountprinted,
|
||||
bp.isemployee AS bp_isemployee,
|
||||
bp.ismanufacturer AS bp_ismanufacturer,
|
||||
bp.isonetime AS bp_isonetime,
|
||||
bp.ispotaxexempt AS bp_ispotaxexempt,
|
||||
bp.isprospect AS bp_isprospect,
|
||||
bp.issalesrep AS bp_issalesrep,
|
||||
bp.issummary AS bp_issummary,
|
||||
bp.istaxexempt AS bp_istaxexempt,
|
||||
bp.isvendor AS bp_isvendor,
|
||||
bp.logo_id AS bp_logo_id,
|
||||
bp.m_discountschema_id AS bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS bp_m_pricelist_id,
|
||||
bp.naics AS bp_naics,
|
||||
bp.numberemployees AS bp_numberemployees,
|
||||
bp.paymentrule AS bp_paymentrule,
|
||||
bp.paymentrulepo AS bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS bp_po_pricelist_id,
|
||||
bp.poreference AS bp_poreference,
|
||||
bp.potentiallifetimevalue AS bp_potentiallifetimevalue,
|
||||
bp.rating AS bp_rating,
|
||||
bp.salesrep_id AS bp_salesrep_id,
|
||||
bp.salesvolume AS bp_salesvolume,
|
||||
bp.sendemail AS bp_sendemail,
|
||||
bp.shareofcustomer AS bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS bp_so_creditlimit,
|
||||
bp.socreditstatus AS bp_socreditstatus,
|
||||
bp.so_creditused AS bp_so_creditused,
|
||||
bp.so_description AS bp_so_description,
|
||||
bp.totalopenbalance AS bp_totalopenbalance,
|
||||
bp.updated AS bp_updated,
|
||||
bp.updatedby AS bp_updatedby,
|
||||
bp.url AS bp_url,
|
||||
bpg.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpg.name AS c_greeting_name,
|
||||
bpl.ad_org_id AS bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS bp_location_c_bpartner_id,
|
||||
bpl.created AS bp_location_created,
|
||||
bpl.createdby AS bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS bp_location_fax,
|
||||
bpl.isactive AS bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS bp_location_name,
|
||||
bpl.phone AS bp_location_phone,
|
||||
bpl.phone2 AS bp_location_phone2,
|
||||
bpl.updated AS bp_location_updated,
|
||||
bpl.updatedby AS bp_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcg.isactive AS user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS user_greeting_isfirstnameonly,
|
||||
bpcg.name AS user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone AS salesrep_phone,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.title AS salesrep_title,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS bpartner_acqusitioncost,
|
||||
ubp.actuallifetimevalue AS bpartner_actuallifetimevalue,
|
||||
ubp.ad_language AS bpartner_ad_language,
|
||||
ubp.ad_orgbp_id AS bpartner_ad_orgbp_id,
|
||||
ubp.ad_org_id AS bpartner_ad_org_id,
|
||||
ubp.bpartner_parent_id AS bpartner_bpartner_parent_id,
|
||||
ubp.c_bp_group_id AS bpartner_c_bp_group_id,
|
||||
ubp.c_dunning_id AS bpartner_c_dunning_id,
|
||||
ubp.c_greeting_id AS bpartner_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS bpartner_c_invoiceschedule_id,
|
||||
ubp.c_paymentterm_id AS bpartner_c_paymentterm_id,
|
||||
ubp.created AS bpartner_created,
|
||||
ubp.createdby AS bpartner_createdby,
|
||||
ubp.c_taxgroup_id AS bpartner_c_taxgroup_id,
|
||||
ubp.deliveryrule AS bpartner_deliveryrule,
|
||||
ubp.deliveryviarule AS bpartner_deliveryviarule,
|
||||
ubp.description AS bpartner_description,
|
||||
ubp.dunninggrace AS bpartner_dunninggrace,
|
||||
ubp.duns AS bpartner_duns,
|
||||
ubp.firstsale AS bpartner_firstsale,
|
||||
ubp.flatdiscount AS bpartner_flatdiscount,
|
||||
ubp.freightcostrule AS bpartner_freightcostrule,
|
||||
ubp.invoicerule AS bpartner_invoicerule,
|
||||
ubp.isactive AS bpartner_isactive,
|
||||
ubp.iscustomer AS bpartner_iscustomer,
|
||||
ubp.isdiscountprinted AS bpartner_isdiscountprinted,
|
||||
ubp.isemployee AS bpartner_isemployee,
|
||||
ubp.ismanufacturer AS bpartner_ismanufacturer,
|
||||
ubp.isonetime AS bpartner_isonetime,
|
||||
ubp.ispotaxexempt AS bpartner_ispotaxexempt,
|
||||
ubp.isprospect AS bpartner_isprospect,
|
||||
ubp.issalesrep AS bpartner_issalesrep,
|
||||
ubp.issummary AS bpartner_issummary,
|
||||
ubp.istaxexempt AS bpartner_istaxexempt,
|
||||
ubp.isvendor AS bpartner_isvendor,
|
||||
ubp.logo_id AS bpartner_logo_id,
|
||||
ubp.m_discountschema_id AS bpartner_m_discountschema_id,
|
||||
ubp.m_pricelist_id AS bpartner_m_pricelist_id,
|
||||
ubp.naics AS bpartner_naics,
|
||||
ubp.name2 AS bpartner_name2,
|
||||
ubp.numberemployees AS bpartner_numberemployees,
|
||||
ubp.paymentrule AS bpartner_paymentrule,
|
||||
ubp.paymentrulepo AS bpartner_paymentrulepo,
|
||||
ubp.po_discountschema_id AS bpartner_po_discountschema_id,
|
||||
ubp.po_paymentterm_id AS bpartner_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS bpartner_po_pricelist_id,
|
||||
ubp.poreference AS bpartner_poreference,
|
||||
ubp.potentiallifetimevalue AS bpartner_potentiallifetimeval,
|
||||
ubp.rating AS bpartner_rating,
|
||||
ubp.referenceno AS bpartner_referenceno,
|
||||
ubp.salesrep_id AS bpartner_salesrep_id,
|
||||
ubp.salesvolume AS bpartner_salesvolume,
|
||||
ubp.sendemail AS bpartner_sendemail,
|
||||
ubp.shareofcustomer AS bpartner_shareofcustomer,
|
||||
ubp.shelflifeminpct AS bpartner_shelflifeminpct,
|
||||
ubp.so_creditlimit AS bpartner_so_creditlimit,
|
||||
ubp.socreditstatus AS bpartner_socreditstatus,
|
||||
ubp.so_creditused AS bpartner_so_creditused,
|
||||
ubp.so_description AS bpartner_so_description,
|
||||
ubp.taxid AS bpartner_taxid,
|
||||
ubp.totalopenbalance AS bpartner_totalopenbalance,
|
||||
ubp.updated AS bpartner_updated,
|
||||
ubp.updatedby AS bpartner_updatedby,
|
||||
ubp.url AS bpartner_url,
|
||||
ubp.value AS bpartner_value,
|
||||
cur.cursymbol,
|
||||
cur.description AS cur_description
|
||||
FROM c_invoice i
|
||||
JOIN c_doctype dt
|
||||
ON i.c_doctype_id = dt.c_doctype_id
|
||||
JOIN c_paymentterm pt
|
||||
ON i.c_paymentterm_id = pt.c_paymentterm_id
|
||||
JOIN c_bpartner bp
|
||||
ON i.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
JOIN c_bpartner_location bpl
|
||||
ON i.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON i.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
JOIN ad_orginfo oi
|
||||
ON i.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON i.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_user u
|
||||
ON i.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
LEFT JOIN c_currency cur
|
||||
ON i.c_currency_id = cur.c_currency_id
|
||||
;
|
||||
|
|
@ -1,374 +0,0 @@
|
|||
DROP VIEW c_invoice_header_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_invoice_header_vt
|
||||
AS
|
||||
SELECT i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
i.created,
|
||||
i.createdby,
|
||||
i.updated,
|
||||
i.updatedby,
|
||||
dt.ad_language,
|
||||
i.c_invoice_id,
|
||||
i.issotrx,
|
||||
i.documentno,
|
||||
i.docstatus,
|
||||
i.c_doctype_id,
|
||||
i.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
i.c_order_id,
|
||||
i.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
i.dateinvoiced,
|
||||
bpgt.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcgt.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
bp.referenceno,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
i.description,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.c_currency_id,
|
||||
ptt.name AS paymentterm,
|
||||
ptt.documentnote AS paymenttermnote,
|
||||
i.c_charge_id,
|
||||
i.chargeamt,
|
||||
i.totallines,
|
||||
i.grandtotal,
|
||||
i.grandtotal AS amtinwords,
|
||||
i.m_pricelist_id,
|
||||
i.istaxincluded,
|
||||
i.c_campaign_id,
|
||||
i.c_project_id,
|
||||
i.c_activity_id,
|
||||
i.ispaid,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
|
||||
i.ad_user_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_conversiontype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.c_payment_id,
|
||||
i.dateacct,
|
||||
i.dateprinted,
|
||||
i.docaction,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.istransferred,
|
||||
i.m_rma_id,
|
||||
i.paymentrule,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.sendemail,
|
||||
i.user1_id,
|
||||
i.user2_id,
|
||||
ptt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.c_paymentterm_id,
|
||||
ptt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
ptt.isactive AS c_paymentterm_isactive,
|
||||
pt.isdefault,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS c_paymentterm_value,
|
||||
bp.acqusitioncost AS bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS bp_actuallifetimevalue,
|
||||
bp.ad_language AS bp_ad_language,
|
||||
bp.ad_orgbp_id AS bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS bp_c_dunning_id,
|
||||
bp.c_greeting_id AS bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS bp_c_paymentterm_id,
|
||||
bp.created AS bp_created,
|
||||
bp.createdby AS bp_createdby,
|
||||
bp.c_taxgroup_id AS bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS bp_deliveryrule,
|
||||
bp.deliveryviarule AS bp_deliveryviarule,
|
||||
bp.description AS bp_description,
|
||||
bp.dunninggrace AS bp_dunninggrace,
|
||||
bp.firstsale AS bp_firstsale,
|
||||
bp.flatdiscount AS bp_flatdiscount,
|
||||
bp.freightcostrule AS bp_freightcostrule,
|
||||
bp.invoicerule AS bp_invoicerule,
|
||||
bp.isactive AS bp_isactive,
|
||||
bp.iscustomer AS bp_iscustomer,
|
||||
bp.isdiscountprinted AS bp_isdiscountprinted,
|
||||
bp.isemployee AS bp_isemployee,
|
||||
bp.ismanufacturer AS bp_ismanufacturer,
|
||||
bp.isonetime AS bp_isonetime,
|
||||
bp.ispotaxexempt AS bp_ispotaxexempt,
|
||||
bp.isprospect AS bp_isprospect,
|
||||
bp.issalesrep AS bp_issalesrep,
|
||||
bp.issummary AS bp_issummary,
|
||||
bp.istaxexempt AS bp_istaxexempt,
|
||||
bp.isvendor AS bp_isvendor,
|
||||
bp.logo_id AS bp_logo_id,
|
||||
bp.m_discountschema_id AS bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS bp_m_pricelist_id,
|
||||
bp.naics AS bp_naics,
|
||||
bp.numberemployees AS bp_numberemployees,
|
||||
bp.paymentrule AS bp_paymentrule,
|
||||
bp.paymentrulepo AS bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS bp_po_pricelist_id,
|
||||
bp.poreference AS bp_poreference,
|
||||
bp.potentiallifetimevalue AS bp_potentiallifetimevalue,
|
||||
bp.rating AS bp_rating,
|
||||
bp.salesrep_id AS bp_salesrep_id,
|
||||
bp.salesvolume AS bp_salesvolume,
|
||||
bp.sendemail AS bp_sendemail,
|
||||
bp.shareofcustomer AS bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS bp_so_creditlimit,
|
||||
bp.socreditstatus AS bp_socreditstatus,
|
||||
bp.so_creditused AS bp_so_creditused,
|
||||
bp.so_description AS bp_so_description,
|
||||
bp.totalopenbalance AS bp_totalopenbalance,
|
||||
bp.updated AS bp_updated,
|
||||
bp.updatedby AS bp_updatedby,
|
||||
bp.url AS bp_url,
|
||||
bpgt.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpgt.name AS c_greeting_name,
|
||||
bpl.ad_org_id AS bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS bp_location_c_bpartner_id,
|
||||
bpl.created AS bp_location_created,
|
||||
bpl.createdby AS bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS bp_location_fax,
|
||||
bpl.isactive AS bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS bp_location_name,
|
||||
bpl.phone AS bp_location_phone,
|
||||
bpl.phone2 AS bp_location_phone2,
|
||||
bpl.updated AS bp_location_updated,
|
||||
bpl.updatedby AS bp_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcgt.isactive AS user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS user_greeting_isfirstnameonly,
|
||||
bpcgt.name AS user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone AS salesrep_phone,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.title AS salesrep_title,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS bpartner_acqusitioncost,
|
||||
ubp.actuallifetimevalue AS bpartner_actuallifetimevalue,
|
||||
ubp.ad_language AS bpartner_ad_language,
|
||||
ubp.ad_orgbp_id AS bpartner_ad_orgbp_id,
|
||||
ubp.ad_org_id AS bpartner_ad_org_id,
|
||||
ubp.bpartner_parent_id AS bpartner_bpartner_parent_id,
|
||||
ubp.c_bp_group_id AS bpartner_c_bp_group_id,
|
||||
ubp.c_dunning_id AS bpartner_c_dunning_id,
|
||||
ubp.c_greeting_id AS bpartner_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS bpartner_c_invoiceschedule_id,
|
||||
ubp.c_paymentterm_id AS bpartner_c_paymentterm_id,
|
||||
ubp.created AS bpartner_created,
|
||||
ubp.createdby AS bpartner_createdby,
|
||||
ubp.c_taxgroup_id AS bpartner_c_taxgroup_id,
|
||||
ubp.deliveryrule AS bpartner_deliveryrule,
|
||||
ubp.deliveryviarule AS bpartner_deliveryviarule,
|
||||
ubp.description AS bpartner_description,
|
||||
ubp.dunninggrace AS bpartner_dunninggrace,
|
||||
ubp.duns AS bpartner_duns,
|
||||
ubp.firstsale AS bpartner_firstsale,
|
||||
ubp.flatdiscount AS bpartner_flatdiscount,
|
||||
ubp.freightcostrule AS bpartner_freightcostrule,
|
||||
ubp.invoicerule AS bpartner_invoicerule,
|
||||
ubp.isactive AS bpartner_isactive,
|
||||
ubp.iscustomer AS bpartner_iscustomer,
|
||||
ubp.isdiscountprinted AS bpartner_isdiscountprinted,
|
||||
ubp.isemployee AS bpartner_isemployee,
|
||||
ubp.ismanufacturer AS bpartner_ismanufacturer,
|
||||
ubp.isonetime AS bpartner_isonetime,
|
||||
ubp.ispotaxexempt AS bpartner_ispotaxexempt,
|
||||
ubp.isprospect AS bpartner_isprospect,
|
||||
ubp.issalesrep AS bpartner_issalesrep,
|
||||
ubp.issummary AS bpartner_issummary,
|
||||
ubp.istaxexempt AS bpartner_istaxexempt,
|
||||
ubp.isvendor AS bpartner_isvendor,
|
||||
ubp.logo_id AS bpartner_logo_id,
|
||||
ubp.m_discountschema_id AS bpartner_m_discountschema_id,
|
||||
ubp.m_pricelist_id AS bpartner_m_pricelist_id,
|
||||
ubp.naics AS bpartner_naics,
|
||||
ubp.name2 AS bpartner_name2,
|
||||
ubp.numberemployees AS bpartner_numberemployees,
|
||||
ubp.paymentrule AS bpartner_paymentrule,
|
||||
ubp.paymentrulepo AS bpartner_paymentrulepo,
|
||||
ubp.po_discountschema_id AS bpartner_po_discountschema_id,
|
||||
ubp.po_paymentterm_id AS bpartner_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS bpartner_po_pricelist_id,
|
||||
ubp.poreference AS bpartner_poreference,
|
||||
ubp.potentiallifetimevalue AS bpartner_potentiallifetimeval,
|
||||
ubp.rating AS bpartner_rating,
|
||||
ubp.referenceno AS bpartner_referenceno,
|
||||
ubp.salesrep_id AS bpartner_salesrep_id,
|
||||
ubp.salesvolume AS bpartner_salesvolume,
|
||||
ubp.sendemail AS bpartner_sendemail,
|
||||
ubp.shareofcustomer AS bpartner_shareofcustomer,
|
||||
ubp.shelflifeminpct AS bpartner_shelflifeminpct,
|
||||
ubp.so_creditlimit AS bpartner_so_creditlimit,
|
||||
ubp.socreditstatus AS bpartner_socreditstatus,
|
||||
ubp.so_creditused AS bpartner_so_creditused,
|
||||
ubp.so_description AS bpartner_so_description,
|
||||
ubp.taxid AS bpartner_taxid,
|
||||
ubp.totalopenbalance AS bpartner_totalopenbalance,
|
||||
ubp.updated AS bpartner_updated,
|
||||
ubp.updatedby AS bpartner_updatedby,
|
||||
ubp.url AS bpartner_url,
|
||||
ubp.value AS bpartner_value,
|
||||
cur.cursymbol,
|
||||
cur.description AS cur_description
|
||||
FROM c_invoice i
|
||||
JOIN c_doctype_trl dt
|
||||
ON i.c_doctype_id = dt.c_doctype_id
|
||||
JOIN c_paymentterm pt
|
||||
ON i.c_paymentterm_id = pt.c_paymentterm_id
|
||||
JOIN c_paymentterm_trl ptt
|
||||
ON i.c_paymentterm_id = ptt.c_paymentterm_id
|
||||
AND dt.ad_language = ptt.ad_language
|
||||
JOIN c_bpartner bp
|
||||
ON i.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpgt
|
||||
ON bp.c_greeting_id = bpgt.c_greeting_id
|
||||
AND dt.ad_language = bpgt.ad_language
|
||||
JOIN c_bpartner_location bpl
|
||||
ON i.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON i.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpcgt
|
||||
ON bpc.c_greeting_id = bpcgt.c_greeting_id
|
||||
AND dt.ad_language = bpcgt.ad_language
|
||||
JOIN ad_orginfo oi
|
||||
ON i.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON i.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_user u
|
||||
ON i.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
LEFT JOIN c_currency_trl cur
|
||||
ON i.c_currency_id = cur.c_currency_id
|
||||
AND dt.ad_language = cur.ad_language
|
||||
;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,158 +0,0 @@
|
|||
CREATE OR REPLACE VIEW c_invoice_v
|
||||
AS
|
||||
SELECT i.c_invoice_id,
|
||||
i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
i.created,
|
||||
i.createdby,
|
||||
i.updated,
|
||||
i.updatedby,
|
||||
i.issotrx,
|
||||
i.documentno,
|
||||
i.docstatus,
|
||||
i.docaction,
|
||||
i.processing,
|
||||
i.processed,
|
||||
i.c_doctype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_order_id,
|
||||
i.description,
|
||||
i.isapproved,
|
||||
i.istransferred,
|
||||
i.salesrep_id,
|
||||
i.dateinvoiced,
|
||||
i.dateprinted,
|
||||
i.dateacct,
|
||||
i.c_bpartner_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.ad_user_id,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.c_currency_id,
|
||||
i.c_conversiontype_id,
|
||||
i.paymentrule,
|
||||
i.c_paymentterm_id,
|
||||
i.c_charge_id,
|
||||
i.m_pricelist_id,
|
||||
i.c_campaign_id,
|
||||
i.c_project_id,
|
||||
i.c_activity_id,
|
||||
i.isprinted,
|
||||
i.isdiscountprinted,
|
||||
i.ispaid,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
NULL AS c_invoicepayschedule_id,
|
||||
i.invoicecollectiontype,
|
||||
i.dunninggrace,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN i.chargeamt * ( -1 )
|
||||
ELSE i.chargeamt
|
||||
END AS chargeamt,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN i.totallines * ( -1 )
|
||||
ELSE i.totallines
|
||||
END AS totallines,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN i.grandtotal * ( -1 )
|
||||
ELSE i.grandtotal
|
||||
END AS grandtotal,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN ( -1.0 )
|
||||
ELSE 1.0
|
||||
END AS multiplier,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 2) = 'P' THEN ( -1.0 )
|
||||
ELSE 1.0
|
||||
END AS multiplierap,
|
||||
d.docbasetype,
|
||||
paymenttermduedate(i.c_paymentterm_id, i.dateinvoiced) AS duedate,
|
||||
i.ad_orgtrx_id,
|
||||
i.c_payment_id,
|
||||
i.isselfservice,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.reversal_id
|
||||
FROM c_invoice i
|
||||
JOIN c_doctype d
|
||||
ON i.c_doctype_id = d.c_doctype_id
|
||||
WHERE i.ispayschedulevalid <> 'Y'
|
||||
UNION
|
||||
SELECT i.c_invoice_id,
|
||||
i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
i.created,
|
||||
i.createdby,
|
||||
i.updated,
|
||||
i.updatedby,
|
||||
i.issotrx,
|
||||
i.documentno,
|
||||
i.docstatus,
|
||||
i.docaction,
|
||||
i.processing,
|
||||
i.processed,
|
||||
i.c_doctype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_order_id,
|
||||
i.description,
|
||||
i.isapproved,
|
||||
i.istransferred,
|
||||
i.salesrep_id,
|
||||
i.dateinvoiced,
|
||||
i.dateprinted,
|
||||
i.dateacct,
|
||||
i.c_bpartner_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.ad_user_id,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.c_currency_id,
|
||||
i.c_conversiontype_id,
|
||||
i.paymentrule,
|
||||
i.c_paymentterm_id,
|
||||
i.c_charge_id,
|
||||
i.m_pricelist_id,
|
||||
i.c_campaign_id,
|
||||
i.c_project_id,
|
||||
i.c_activity_id,
|
||||
i.isprinted,
|
||||
i.isdiscountprinted,
|
||||
i.ispaid,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
ips.c_invoicepayschedule_id,
|
||||
i.invoicecollectiontype,
|
||||
i.dunninggrace,
|
||||
NULL AS chargeamt,
|
||||
NULL AS totallines,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN ips.dueamt * ( -1 )
|
||||
ELSE ips.dueamt
|
||||
END AS grandtotal,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN ( -1 )
|
||||
ELSE 1
|
||||
END AS multiplier,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 2) = 'P' THEN ( -1 )
|
||||
ELSE 1
|
||||
END AS multiplierap,
|
||||
d.docbasetype,
|
||||
ips.duedate,
|
||||
i.ad_orgtrx_id,
|
||||
i.c_payment_id,
|
||||
i.isselfservice,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.reversal_id
|
||||
FROM c_invoice i
|
||||
JOIN c_doctype d
|
||||
ON i.c_doctype_id = d.c_doctype_id
|
||||
JOIN c_invoicepayschedule ips
|
||||
ON i.c_invoice_id = ips.c_invoice_id
|
||||
WHERE i.ispayschedulevalid = 'Y'
|
||||
AND ips.isvalid = 'Y'
|
||||
;
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_INVOICE_V1
|
||||
(C_INVOICE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED,
|
||||
CREATEDBY, UPDATED, UPDATEDBY, ISSOTRX, DOCUMENTNO,
|
||||
DOCSTATUS, DOCACTION, PROCESSING, PROCESSED, C_DOCTYPE_ID,
|
||||
C_DOCTYPETARGET_ID, C_ORDER_ID, DESCRIPTION, ISAPPROVED, ISTRANSFERRED,
|
||||
SALESREP_ID, DATEINVOICED, DATEPRINTED, DATEACCT, C_BPARTNER_ID,
|
||||
C_BPARTNER_LOCATION_ID, AD_USER_ID, POREFERENCE, DATEORDERED, C_CURRENCY_ID,
|
||||
C_CONVERSIONTYPE_ID, PAYMENTRULE, C_PAYMENTTERM_ID, C_CHARGE_ID, M_PRICELIST_ID,
|
||||
C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, ISPRINTED, ISDISCOUNTPRINTED,
|
||||
ISPAID, ISINDISPUTE, ISPAYSCHEDULEVALID, C_INVOICEPAYSCHEDULE_ID, INVOICECOLLECTIONTYPE,
|
||||
CHARGEAMT, TOTALLINES, GRANDTOTAL, MULTIPLIER, MULTIPLIERAP,
|
||||
DOCBASETYPE)
|
||||
AS
|
||||
SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
|
||||
i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID,
|
||||
i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred,
|
||||
i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID,
|
||||
i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule,
|
||||
i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID,
|
||||
i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute,
|
||||
i.IsPayScheduleValid, cast(null as number) AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType,
|
||||
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END AS ChargeAmt,
|
||||
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END AS TotalLines,
|
||||
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END AS GrandTotal,
|
||||
CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier,
|
||||
CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS MultiplierAP,
|
||||
d.DocBaseType
|
||||
FROM C_Invoice i
|
||||
INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID);
|
||||
|
||||
|
||||
|
|
@ -1,515 +0,0 @@
|
|||
DROP VIEW c_order_header_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_order_header_v
|
||||
AS
|
||||
SELECT o.ad_client_id,
|
||||
o.ad_org_id,
|
||||
o.isactive,
|
||||
o.created,
|
||||
o.createdby,
|
||||
o.updated,
|
||||
o.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
o.c_order_id,
|
||||
o.issotrx,
|
||||
o.documentno,
|
||||
o.docstatus,
|
||||
o.c_doctype_id,
|
||||
o.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
o.m_warehouse_id,
|
||||
wh.c_location_id AS warehouse_location_id,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
o.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
o.dateordered,
|
||||
o.datepromised,
|
||||
bpg.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcg.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
bp.referenceno,
|
||||
o.bill_bpartner_id,
|
||||
o.bill_location_id,
|
||||
o.bill_user_id,
|
||||
bbp.value AS bill_bpvalue,
|
||||
bbp.taxid AS bill_bptaxid,
|
||||
bbp.name AS bill_name,
|
||||
bbp.name2 AS bill_name2,
|
||||
bbpc.title AS bill_title,
|
||||
bbpc.phone AS bill_phone,
|
||||
NULLIF(bbpc.name, bbp.name) AS bill_contactname,
|
||||
bbpl.c_location_id AS bill_c_location_id,
|
||||
o.description,
|
||||
o.poreference,
|
||||
o.c_currency_id,
|
||||
pt.name AS paymentterm,
|
||||
pt.documentnote AS paymenttermnote,
|
||||
o.c_charge_id,
|
||||
o.chargeamt,
|
||||
o.totallines,
|
||||
o.grandtotal,
|
||||
o.grandtotal AS amtinwords,
|
||||
o.m_pricelist_id,
|
||||
o.istaxincluded,
|
||||
o.volume,
|
||||
o.weight,
|
||||
o.c_campaign_id,
|
||||
o.c_project_id,
|
||||
o.c_activity_id,
|
||||
o.m_shipper_id,
|
||||
o.deliveryrule,
|
||||
o.deliveryviarule,
|
||||
o.priorityrule,
|
||||
o.invoicerule,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
o.ad_orgtrx_id,
|
||||
o.ad_user_id,
|
||||
o.amountrefunded,
|
||||
o.amounttendered,
|
||||
o.c_bpartner_location_id,
|
||||
o.c_cashline_id,
|
||||
o.c_cashplanline_id,
|
||||
o.c_conversiontype_id,
|
||||
o.c_doctypetarget_id,
|
||||
o.copyfrom,
|
||||
o.c_payment_id,
|
||||
o.c_paymentterm_id,
|
||||
o.c_pos_id,
|
||||
o.dateacct,
|
||||
o.dateprinted,
|
||||
o.docaction,
|
||||
o.dropship_bpartner_id,
|
||||
o.dropship_location_id,
|
||||
o.dropship_user_id,
|
||||
o.freightamt,
|
||||
o.freightcostrule,
|
||||
o.isapproved,
|
||||
o.iscreditapproved,
|
||||
o.isdelivered,
|
||||
o.isdiscountprinted,
|
||||
o.isdropship,
|
||||
o.isinvoiced,
|
||||
o.ispayschedulevalid,
|
||||
o.isprinted,
|
||||
o.isselected,
|
||||
o.isselfservice,
|
||||
o.istransferred,
|
||||
o.link_order_id,
|
||||
o.m_freightcategory_id,
|
||||
o.ordertype,
|
||||
o.pay_bpartner_id,
|
||||
o.pay_location_id,
|
||||
o.paymentrule,
|
||||
o.posted,
|
||||
o.processed,
|
||||
o.processedon,
|
||||
o.promotioncode,
|
||||
o.ref_order_id,
|
||||
o.sendemail,
|
||||
o.user1_id,
|
||||
o.user2_id,
|
||||
wh.ad_org_id AS m_warehouse_ad_org_id,
|
||||
wh.description AS m_warehouse_description,
|
||||
wh.isactive AS m_warehouse_isactive,
|
||||
wh.isdisallownegativeinv,
|
||||
wh.isintransit,
|
||||
wh.m_warehousesource_id,
|
||||
wh.name AS m_warehouse_name,
|
||||
wh.replenishmentclass,
|
||||
wh.separator,
|
||||
wh.value AS m_warehouse_value,
|
||||
pt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
pt.isactive AS c_paymentterm_isactive,
|
||||
pt.isdefault,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS m_paymentterm_value,
|
||||
bp.acqusitioncost AS bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS bp_actuallifetimevalue,
|
||||
bp.ad_language AS bp_ad_language,
|
||||
bp.ad_orgbp_id AS bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS bp_c_dunning_id,
|
||||
bp.c_greeting_id AS bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS bp_c_paymentterm_id,
|
||||
bp.created AS bp_created,
|
||||
bp.createdby AS bp_createdby,
|
||||
bp.c_taxgroup_id AS bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS bp_deliveryrule,
|
||||
bp.deliveryviarule AS bp_deliveryviarule,
|
||||
bp.description AS bp_description,
|
||||
bp.dunninggrace AS bp_dunninggrace,
|
||||
bp.firstsale AS bp_firstsale,
|
||||
bp.flatdiscount AS bp_flatdiscount,
|
||||
bp.freightcostrule AS bp_freightcostrule,
|
||||
bp.invoicerule AS bp_invoicerule,
|
||||
bp.isactive AS bp_isactive,
|
||||
bp.iscustomer AS bp_iscustomer,
|
||||
bp.isdiscountprinted AS bp_isdiscountprinted,
|
||||
bp.isemployee AS bp_isemployee,
|
||||
bp.ismanufacturer AS bp_ismanufacturer,
|
||||
bp.isonetime AS bp_isonetime,
|
||||
bp.ispotaxexempt AS bp_ispotaxexempt,
|
||||
bp.isprospect AS bp_isprospect,
|
||||
bp.issalesrep AS bp_issalesrep,
|
||||
bp.issummary AS bp_issummary,
|
||||
bp.istaxexempt AS bp_istaxexempt,
|
||||
bp.isvendor AS bp_isvendor,
|
||||
bp.logo_id AS bp_logo_id,
|
||||
bp.m_discountschema_id AS bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS bp_m_pricelist_id,
|
||||
bp.numberemployees AS bp_numberemployees,
|
||||
bp.paymentrule AS bp_paymentrule,
|
||||
bp.paymentrulepo AS bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS bp_po_pricelist_id,
|
||||
bp.poreference AS bp_poreference,
|
||||
bp.potentiallifetimevalue AS bp_potentiallifetimevalue,
|
||||
bp.rating AS bp_rating,
|
||||
bp.salesrep_id AS bp_salesrep_id,
|
||||
bp.salesvolume AS bp_salesvolume,
|
||||
bp.sendemail AS bp_sendemail,
|
||||
bp.shareofcustomer AS bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS bp_so_creditlimit,
|
||||
bp.socreditstatus AS bp_socreditstatus,
|
||||
bp.so_creditused AS bp_so_creditused,
|
||||
bp.so_description AS bp_so_description,
|
||||
bp.totalopenbalance AS bp_totalopenbalance,
|
||||
bp.updated AS bp_updated,
|
||||
bp.updatedby AS bp_updatedby,
|
||||
bp.url AS bp_url,
|
||||
bpg.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpg.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpg.name AS c_greeting_name,
|
||||
bpl.ad_org_id AS bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS bp_location_c_bpartner_id,
|
||||
bpl.created AS bp_location_created,
|
||||
bpl.createdby AS bp_location_createdby,
|
||||
bpl.c_salesregion_id AS bp_location_c_salesregion_id,
|
||||
bpl.fax AS bp_location_fax,
|
||||
bpl.isactive AS bp_location_isactive,
|
||||
bpl.isbillto AS bp_location_isbillto,
|
||||
bpl.isdn AS bp_location_isdn,
|
||||
bpl.ispayfrom AS bp_location_ispayfrom,
|
||||
bpl.isremitto AS bp_location_isremitto,
|
||||
bpl.isshipto AS bp_location_isshipto,
|
||||
bpl.name AS bp_location_name,
|
||||
bpl.phone AS bp_location_phone,
|
||||
bpl.phone2 AS bp_location_phone2,
|
||||
bpl.updated AS bp_location_updated,
|
||||
bpl.updatedby AS bp_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcg.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcg.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfnameonly,
|
||||
bpcg.name AS c_user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id AS ad_orginfo_m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone AS salesrep_phone,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.title AS salesrep_title,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS salesrep_bp_acqusitioncost,
|
||||
ubp.actuallifetimevalue AS salesrep_bp_actuallifetimeval,
|
||||
ubp.ad_language AS salesrep_bp_ad_language,
|
||||
ubp.ad_orgbp_id AS salesrep_bp_ad_orgbp_id,
|
||||
ubp.ad_org_id AS salesrep_bp_ad_org_id,
|
||||
ubp.bpartner_parent_id AS salesrep_bp_bpartner_parent_id,
|
||||
ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id,
|
||||
ubp.c_dunning_id AS salesrep_bp_c_dunning_id,
|
||||
ubp.c_greeting_id AS salesrep_bp_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS salesrep_bp_c_invoicesched_id,
|
||||
ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id,
|
||||
ubp.created AS salesrep_bp_created,
|
||||
ubp.createdby AS salesrep_bp_createdby,
|
||||
ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id,
|
||||
ubp.deliveryrule AS salesrep_bp_deliveryrule,
|
||||
ubp.deliveryviarule AS salesrep_bp_deliveryviarule,
|
||||
ubp.description AS salesrep_bp_description,
|
||||
ubp.dunninggrace AS salesrep_bp_dunninggrace,
|
||||
ubp.duns AS salesrep_bp_duns,
|
||||
ubp.firstsale AS salesrep_bp_firstsale,
|
||||
ubp.flatdiscount AS salesrep_bp_flatdiscount,
|
||||
ubp.freightcostrule AS salesrep_bp_freightcostrule,
|
||||
ubp.invoicerule AS salesrep_bp_invoicerule,
|
||||
ubp.isactive AS salesrep_bp_isactive,
|
||||
ubp.iscustomer AS salesrep_bp_iscustomer,
|
||||
ubp.isdiscountprinted AS salesrep_bp_isdiscountprinted,
|
||||
ubp.isemployee AS salesrep_bp_isemployee,
|
||||
ubp.ismanufacturer AS salesrep_bp_ismanufacturer,
|
||||
ubp.isonetime AS salesrep_bp_isonetime,
|
||||
ubp.ispotaxexempt AS salesrep_bp_ispotaxexempt,
|
||||
ubp.isprospect AS salesrep_bp_isprospect,
|
||||
ubp.issalesrep AS salesrep_bp_issalesrep,
|
||||
ubp.issummary AS salesrep_bp_issummary,
|
||||
ubp.istaxexempt AS salesrep_bp_istaxexempt,
|
||||
ubp.isvendor AS salesrep_bp_isvendor,
|
||||
ubp.logo_id AS salesrep_bp_logo_id,
|
||||
ubp.m_discountschema_id AS salesrep_bp_m_discountschm_id,
|
||||
ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id,
|
||||
ubp.naics AS salesrep_bp_naics,
|
||||
ubp.name2 AS salesrep_bp_name2,
|
||||
ubp.numberemployees AS salesrep_bp_numberemployees,
|
||||
ubp.paymentrule AS salesrep_bp_paymentrule,
|
||||
ubp.paymentrulepo AS salesrep_bp_paymentrulepo,
|
||||
ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id,
|
||||
ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id,
|
||||
ubp.poreference AS salesrep_bp_poreference,
|
||||
ubp.potentiallifetimevalue AS salesrep_bp_potentiallifetime,
|
||||
ubp.rating AS salesrep_bp_rating,
|
||||
ubp.referenceno AS salesrep_bp_referenceno,
|
||||
ubp.salesrep_id AS salesrep_bp_salesrep_id,
|
||||
ubp.salesvolume AS salesrep_bp_salesvolume,
|
||||
ubp.sendemail AS salesrep_bp_sendemail,
|
||||
ubp.shareofcustomer AS salesrep_bp_shareofcustomer,
|
||||
ubp.shelflifeminpct AS salesrep_bp_shelflifeminpct,
|
||||
ubp.so_creditlimit AS salesrep_bp_so_creditlimit,
|
||||
ubp.socreditstatus AS salesrep_bp_socreditstatus,
|
||||
ubp.so_creditused AS salesrep_bp_so_creditused,
|
||||
ubp.so_description AS salesrep_bp_so_description,
|
||||
ubp.taxid AS salesrep_bp_taxid,
|
||||
ubp.totalopenbalance AS salesrep_bp_totalopenbalance,
|
||||
ubp.updated AS salesrep_bp_updated,
|
||||
ubp.updatedby AS salesrep_bp_updatedby,
|
||||
ubp.url AS salesrep_bp_url,
|
||||
ubp.value AS salesrep_bp_value,
|
||||
bbp.acqusitioncost AS bill_bp_acqusitioncost,
|
||||
bbp.actuallifetimevalue AS bill_bp_actuallifetimevalue,
|
||||
bbp.ad_language AS bill_bp_ad_language,
|
||||
bbp.ad_orgbp_id AS bill_bp_ad_orgbp_id,
|
||||
bbp.ad_org_id AS bill_bp_ad_org_id,
|
||||
bbp.bpartner_parent_id AS bill_bp_bpartner_parent_id,
|
||||
bbp.c_bp_group_id AS bill_bp_c_bp_group_id,
|
||||
bbp.c_dunning_id AS bill_bp_c_dunning_id,
|
||||
bbp.c_greeting_id AS bill_bp_c_greeting_id,
|
||||
bbp.c_invoiceschedule_id AS bill_bp_c_invoiceschedule_id,
|
||||
bbp.c_paymentterm_id AS bill_bp_c_paymentterm_id,
|
||||
bbp.created AS bill_bp_created,
|
||||
bbp.createdby AS bill_bp_createdby,
|
||||
bbp.c_taxgroup_id AS bill_bp_c_taxgroup_id,
|
||||
bbp.deliveryrule AS bill_bp_deliveryrule,
|
||||
bbp.deliveryviarule AS bill_bp_deliveryviarule,
|
||||
bbp.description AS bill_bp_description,
|
||||
bbp.dunninggrace AS bill_bp_dunninggrace,
|
||||
bbp.duns AS bill_bp_duns,
|
||||
bbp.firstsale AS bill_bp_firstsale,
|
||||
bbp.flatdiscount AS bill_bp_flatdiscount,
|
||||
bbp.freightcostrule AS bill_bp_freightcostrule,
|
||||
bbp.invoicerule AS bill_bp_invoicerule,
|
||||
bbp.isactive AS bill_bp_isactive,
|
||||
bbp.iscustomer AS bill_bp_iscustomer,
|
||||
bbp.isdiscountprinted AS bill_bp_isdiscountprinted,
|
||||
bbp.isemployee AS bill_bp_isemployee,
|
||||
bbp.ismanufacturer AS bill_bp_ismanufacturer,
|
||||
bbp.isonetime AS bill_bp_isonetime,
|
||||
bbp.ispotaxexempt AS bill_bp_ispotaxexempt,
|
||||
bbp.isprospect AS bill_bp_isprospect,
|
||||
bbp.issalesrep AS bill_bp_issalesrep,
|
||||
bbp.issummary AS bill_bp_issummary,
|
||||
bbp.istaxexempt AS bill_bp_istaxexempt,
|
||||
bbp.isvendor AS bill_bp_isvendor,
|
||||
bbp.logo_id AS bill_bp_logo_id,
|
||||
bbp.m_discountschema_id AS bill_bp_m_discountschema_id,
|
||||
bbp.m_pricelist_id AS bill_bp_m_pricelist_id,
|
||||
bbp.naics AS bill_bp_naics,
|
||||
bbp.numberemployees AS bill_bp_numberemployees,
|
||||
bbp.paymentrule AS bill_bp_paymentrule,
|
||||
bbp.paymentrulepo AS bill_bp_paymentrulepo,
|
||||
bbp.po_discountschema_id AS bill_bp_po_discountschema_id,
|
||||
bbp.po_paymentterm_id AS bill_bp_po_paymentterm_id,
|
||||
bbp.po_pricelist_id AS bill_bp_po_pricelist_id,
|
||||
bbp.poreference AS bill_bp_poreference,
|
||||
bbp.potentiallifetimevalue AS bill_bp_potentiallifetimevalue,
|
||||
bbp.rating AS bill_bp_rating,
|
||||
bbp.referenceno AS bill_bp_referenceno,
|
||||
bbp.salesrep_id AS bill_bp_salesrep_id,
|
||||
bbp.salesvolume AS bill_bp_salesvolume,
|
||||
bbp.sendemail AS bill_bp_sendemail,
|
||||
bbp.shareofcustomer AS bill_bp_shareofcustomer,
|
||||
bbp.shelflifeminpct AS bill_bp_shelflifeminpct,
|
||||
bbp.so_creditlimit AS bill_bp_so_creditlimit,
|
||||
bbp.socreditstatus AS bill_bp_socreditstatus,
|
||||
bbp.so_creditused AS bill_bp_so_creditused,
|
||||
bbp.so_description AS bill_bp_so_description,
|
||||
bbp.totalopenbalance AS bill_bp_totalopenbalance,
|
||||
bbp.updated AS bill_bp_updated,
|
||||
bbp.updatedby AS bill_bp_updatedby,
|
||||
bbp.url AS bill_bp_url,
|
||||
bbpl.ad_org_id AS bill_bp_location_ad_org_id,
|
||||
bbpl.c_bpartner_id AS bill_bp_location_c_bpartner_id,
|
||||
bbpl.created AS bill_bp_location_created,
|
||||
bbpl.createdby AS bill_bp_location_createdby,
|
||||
bbpl.c_salesregion_id AS bill_bp_location_c_salesreg_id,
|
||||
bbpl.fax AS bill_bp_location_fax,
|
||||
bbpl.isactive AS bill_bp_location_isactive,
|
||||
bbpl.isbillto AS bill_bp_location_isbillto,
|
||||
bbpl.isdn AS bill_bp_location_isdn,
|
||||
bbpl.ispayfrom AS bill_bp_location_ispayfrom,
|
||||
bbpl.isremitto AS bill_bp_location_isremitto,
|
||||
bbpl.isshipto AS bill_bp_location_isshipto,
|
||||
bbpl.name AS bill_bp_location_name,
|
||||
bbpl.phone AS bill_bp_location_phone,
|
||||
bbpl.phone2 AS bill_bp_location_phone2,
|
||||
bbpl.updated AS bill_bp_location_updated,
|
||||
bbpl.updatedby AS bill_bp_location_updatedby,
|
||||
bbpc.ad_org_id AS bill_user_ad_org_id,
|
||||
bbpc.ad_orgtrx_id AS bill_user_ad_orgtrx_id,
|
||||
bbpc.birthday AS bill_user_ad_birthday,
|
||||
bbpc.c_bpartner_id AS bill_user_c_bpartner_id,
|
||||
bbpc.c_bpartner_location_id AS bill_user_c_bp_location_id,
|
||||
bbpc.c_greeting_id AS bill_user_c_greeting_id,
|
||||
bbpc.comments AS bill_user_comments,
|
||||
bbpc.created AS bill_user_created,
|
||||
bbpc.createdby AS bill_user_createdby,
|
||||
bbpc.description AS bill_user_description,
|
||||
bbpc.email AS bill_user_email,
|
||||
bbpc.fax AS bill_user_fax,
|
||||
bbpc.isactive AS bill_user_isactive,
|
||||
bbpc.lastcontact AS bill_user_lastcontact,
|
||||
bbpc.lastresult AS bill_user_lastresult,
|
||||
bbpc.phone2 AS bill_user_phone2,
|
||||
bbpc.supervisor_id AS bill_user_supervisor_id,
|
||||
bbpc.updated AS bill_user_updated,
|
||||
bbpc.updatedby AS bill_user_updatedby,
|
||||
bbpc.value AS bill_user_value,
|
||||
cur.cursymbol,
|
||||
cur.description AS cur_description
|
||||
FROM c_order o
|
||||
JOIN c_doctype dt
|
||||
ON o.c_doctype_id = dt.c_doctype_id
|
||||
JOIN m_warehouse wh
|
||||
ON o.m_warehouse_id = wh.m_warehouse_id
|
||||
JOIN c_paymentterm pt
|
||||
ON o.c_paymentterm_id = pt.c_paymentterm_id
|
||||
JOIN c_bpartner bp
|
||||
ON o.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
JOIN c_bpartner_location bpl
|
||||
ON o.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON o.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
JOIN ad_orginfo oi
|
||||
ON o.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON o.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_user u
|
||||
ON o.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
JOIN c_bpartner bbp
|
||||
ON o.bill_bpartner_id = bbp.c_bpartner_id
|
||||
JOIN c_bpartner_location bbpl
|
||||
ON o.bill_location_id = bbpl.c_bpartner_location_id
|
||||
LEFT JOIN ad_user bbpc
|
||||
ON o.bill_user_id = bbpc.ad_user_id
|
||||
LEFT JOIN c_currency cur
|
||||
ON o.c_currency_id = cur.c_currency_id
|
||||
;
|
||||
|
|
@ -1,525 +0,0 @@
|
|||
DROP VIEW c_order_header_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_order_header_vt
|
||||
AS
|
||||
SELECT o.ad_client_id,
|
||||
o.ad_org_id,
|
||||
o.isactive,
|
||||
o.created,
|
||||
o.createdby,
|
||||
o.updated,
|
||||
o.updatedby,
|
||||
dt.ad_language,
|
||||
o.c_order_id,
|
||||
o.issotrx,
|
||||
o.documentno,
|
||||
o.docstatus,
|
||||
o.c_doctype_id,
|
||||
o.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
o.m_warehouse_id,
|
||||
wh.c_location_id AS warehouse_location_id,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
o.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
o.dateordered,
|
||||
o.datepromised,
|
||||
bpgt.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcgt.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
bp.referenceno,
|
||||
o.bill_bpartner_id,
|
||||
o.bill_location_id,
|
||||
o.bill_user_id,
|
||||
bbp.value AS bill_bpvalue,
|
||||
bbp.taxid AS bill_bptaxid,
|
||||
bbp.name AS bill_name,
|
||||
bbp.name2 AS bill_name2,
|
||||
bbpc.title AS bill_title,
|
||||
bbpc.phone AS bill_phone,
|
||||
NULLIF(bbpc.name, bbp.name) AS bill_contactname,
|
||||
bbpl.c_location_id AS bill_c_location_id,
|
||||
o.description,
|
||||
o.poreference,
|
||||
o.c_currency_id,
|
||||
ptt.name AS paymentterm,
|
||||
ptt.documentnote AS paymenttermnote,
|
||||
o.c_charge_id,
|
||||
o.chargeamt,
|
||||
o.totallines,
|
||||
o.grandtotal,
|
||||
o.grandtotal AS amtinwords,
|
||||
o.m_pricelist_id,
|
||||
o.istaxincluded,
|
||||
o.volume,
|
||||
o.weight,
|
||||
o.c_campaign_id,
|
||||
o.c_project_id,
|
||||
o.c_activity_id,
|
||||
o.m_shipper_id,
|
||||
o.deliveryrule,
|
||||
o.deliveryviarule,
|
||||
o.priorityrule,
|
||||
o.invoicerule,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
o.ad_orgtrx_id,
|
||||
o.ad_user_id,
|
||||
o.amountrefunded,
|
||||
o.amounttendered,
|
||||
o.c_bpartner_location_id,
|
||||
o.c_cashline_id,
|
||||
o.c_cashplanline_id,
|
||||
o.c_conversiontype_id,
|
||||
o.c_doctypetarget_id,
|
||||
o.copyfrom,
|
||||
o.c_payment_id,
|
||||
o.c_paymentterm_id,
|
||||
o.c_pos_id,
|
||||
o.dateacct,
|
||||
o.dateprinted,
|
||||
o.docaction,
|
||||
o.dropship_bpartner_id,
|
||||
o.dropship_location_id,
|
||||
o.dropship_user_id,
|
||||
o.freightamt,
|
||||
o.freightcostrule,
|
||||
o.isapproved,
|
||||
o.iscreditapproved,
|
||||
o.isdelivered,
|
||||
o.isdiscountprinted,
|
||||
o.isdropship,
|
||||
o.isinvoiced,
|
||||
o.ispayschedulevalid,
|
||||
o.isprinted,
|
||||
o.isselected,
|
||||
o.isselfservice,
|
||||
o.istransferred,
|
||||
o.link_order_id,
|
||||
o.m_freightcategory_id,
|
||||
o.ordertype,
|
||||
o.pay_bpartner_id,
|
||||
o.pay_location_id,
|
||||
o.paymentrule,
|
||||
o.posted,
|
||||
o.processed,
|
||||
o.processedon,
|
||||
o.promotioncode,
|
||||
o.ref_order_id,
|
||||
o.sendemail,
|
||||
o.user1_id,
|
||||
o.user2_id,
|
||||
wh.ad_org_id AS m_warehouse_ad_org_id,
|
||||
wh.description AS m_warehouse_description,
|
||||
wh.isactive AS m_warehouse_isactive,
|
||||
wh.isdisallownegativeinv,
|
||||
wh.isintransit,
|
||||
wh.m_warehousesource_id,
|
||||
wh.name AS m_warehouse_name,
|
||||
wh.replenishmentclass,
|
||||
wh.separator,
|
||||
wh.value AS m_warehouse_value,
|
||||
ptt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
ptt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
ptt.isactive AS c_paymentterm_isactive,
|
||||
pt.isdefault,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS m_paymentterm_value,
|
||||
bp.acqusitioncost AS bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS bp_actuallifetimevalue,
|
||||
bp.ad_language AS bp_ad_language,
|
||||
bp.ad_orgbp_id AS bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS bp_c_dunning_id,
|
||||
bp.c_greeting_id AS bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS bp_c_paymentterm_id,
|
||||
bp.created AS bp_created,
|
||||
bp.createdby AS bp_createdby,
|
||||
bp.c_taxgroup_id AS bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS bp_deliveryrule,
|
||||
bp.deliveryviarule AS bp_deliveryviarule,
|
||||
bp.description AS bp_description,
|
||||
bp.dunninggrace AS bp_dunninggrace,
|
||||
bp.firstsale AS bp_firstsale,
|
||||
bp.flatdiscount AS bp_flatdiscount,
|
||||
bp.freightcostrule AS bp_freightcostrule,
|
||||
bp.invoicerule AS bp_invoicerule,
|
||||
bp.isactive AS bp_isactive,
|
||||
bp.iscustomer AS bp_iscustomer,
|
||||
bp.isdiscountprinted AS bp_isdiscountprinted,
|
||||
bp.isemployee AS bp_isemployee,
|
||||
bp.ismanufacturer AS bp_ismanufacturer,
|
||||
bp.isonetime AS bp_isonetime,
|
||||
bp.ispotaxexempt AS bp_ispotaxexempt,
|
||||
bp.isprospect AS bp_isprospect,
|
||||
bp.issalesrep AS bp_issalesrep,
|
||||
bp.issummary AS bp_issummary,
|
||||
bp.istaxexempt AS bp_istaxexempt,
|
||||
bp.isvendor AS bp_isvendor,
|
||||
bp.logo_id AS bp_logo_id,
|
||||
bp.m_discountschema_id AS bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS bp_m_pricelist_id,
|
||||
bp.numberemployees AS bp_numberemployees,
|
||||
bp.paymentrule AS bp_paymentrule,
|
||||
bp.paymentrulepo AS bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS bp_po_pricelist_id,
|
||||
bp.poreference AS bp_poreference,
|
||||
bp.potentiallifetimevalue AS bp_potentiallifetimevalue,
|
||||
bp.rating AS bp_rating,
|
||||
bp.salesrep_id AS bp_salesrep_id,
|
||||
bp.salesvolume AS bp_salesvolume,
|
||||
bp.sendemail AS bp_sendemail,
|
||||
bp.shareofcustomer AS bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS bp_so_creditlimit,
|
||||
bp.socreditstatus AS bp_socreditstatus,
|
||||
bp.so_creditused AS bp_so_creditused,
|
||||
bp.so_description AS bp_so_description,
|
||||
bp.totalopenbalance AS bp_totalopenbalance,
|
||||
bp.updated AS bp_updated,
|
||||
bp.updatedby AS bp_updatedby,
|
||||
bp.url AS bp_url,
|
||||
bpgt.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpgt.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpgt.name AS c_greeting_name,
|
||||
bpl.ad_org_id AS bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS bp_location_c_bpartner_id,
|
||||
bpl.created AS bp_location_created,
|
||||
bpl.createdby AS bp_location_createdby,
|
||||
bpl.c_salesregion_id AS bp_location_c_salesregion_id,
|
||||
bpl.fax AS bp_location_fax,
|
||||
bpl.isactive AS bp_location_isactive,
|
||||
bpl.isbillto AS bp_location_isbillto,
|
||||
bpl.isdn AS bp_location_isdn,
|
||||
bpl.ispayfrom AS bp_location_ispayfrom,
|
||||
bpl.isremitto AS bp_location_isremitto,
|
||||
bpl.isshipto AS bp_location_isshipto,
|
||||
bpl.name AS bp_location_name,
|
||||
bpl.phone AS bp_location_phone,
|
||||
bpl.phone2 AS bp_location_phone2,
|
||||
bpl.updated AS bp_location_updated,
|
||||
bpl.updatedby AS bp_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcgt.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcgt.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfnameonly,
|
||||
bpcgt.name AS c_user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id AS ad_orginfo_m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone AS salesrep_phone,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.title AS salesrep_title,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS salesrep_bp_acqusitioncost,
|
||||
ubp.actuallifetimevalue AS salesrep_bp_actuallifetimeval,
|
||||
ubp.ad_language AS salesrep_bp_ad_language,
|
||||
ubp.ad_orgbp_id AS salesrep_bp_ad_orgbp_id,
|
||||
ubp.ad_org_id AS salesrep_bp_ad_org_id,
|
||||
ubp.bpartner_parent_id AS salesrep_bp_bpartner_parent_id,
|
||||
ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id,
|
||||
ubp.c_dunning_id AS salesrep_bp_c_dunning_id,
|
||||
ubp.c_greeting_id AS salesrep_bp_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS salesrep_bp_c_invoicesched_id,
|
||||
ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id,
|
||||
ubp.created AS salesrep_bp_created,
|
||||
ubp.createdby AS salesrep_bp_createdby,
|
||||
ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id,
|
||||
ubp.deliveryrule AS salesrep_bp_deliveryrule,
|
||||
ubp.deliveryviarule AS salesrep_bp_deliveryviarule,
|
||||
ubp.description AS salesrep_bp_description,
|
||||
ubp.dunninggrace AS salesrep_bp_dunninggrace,
|
||||
ubp.duns AS salesrep_bp_duns,
|
||||
ubp.firstsale AS salesrep_bp_firstsale,
|
||||
ubp.flatdiscount AS salesrep_bp_flatdiscount,
|
||||
ubp.freightcostrule AS salesrep_bp_freightcostrule,
|
||||
ubp.invoicerule AS salesrep_bp_invoicerule,
|
||||
ubp.isactive AS salesrep_bp_isactive,
|
||||
ubp.iscustomer AS salesrep_bp_iscustomer,
|
||||
ubp.isdiscountprinted AS salesrep_bp_isdiscountprinted,
|
||||
ubp.isemployee AS salesrep_bp_isemployee,
|
||||
ubp.ismanufacturer AS salesrep_bp_ismanufacturer,
|
||||
ubp.isonetime AS salesrep_bp_isonetime,
|
||||
ubp.ispotaxexempt AS salesrep_bp_ispotaxexempt,
|
||||
ubp.isprospect AS salesrep_bp_isprospect,
|
||||
ubp.issalesrep AS salesrep_bp_issalesrep,
|
||||
ubp.issummary AS salesrep_bp_issummary,
|
||||
ubp.istaxexempt AS salesrep_bp_istaxexempt,
|
||||
ubp.isvendor AS salesrep_bp_isvendor,
|
||||
ubp.logo_id AS salesrep_bp_logo_id,
|
||||
ubp.m_discountschema_id AS salesrep_bp_m_discountschm_id,
|
||||
ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id,
|
||||
ubp.naics AS salesrep_bp_naics,
|
||||
ubp.name2 AS salesrep_bp_name2,
|
||||
ubp.numberemployees AS salesrep_bp_numberemployees,
|
||||
ubp.paymentrule AS salesrep_bp_paymentrule,
|
||||
ubp.paymentrulepo AS salesrep_bp_paymentrulepo,
|
||||
ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id,
|
||||
ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id,
|
||||
ubp.poreference AS salesrep_bp_poreference,
|
||||
ubp.potentiallifetimevalue AS salesrep_bp_potentiallifetime,
|
||||
ubp.rating AS salesrep_bp_rating,
|
||||
ubp.referenceno AS salesrep_bp_referenceno,
|
||||
ubp.salesrep_id AS salesrep_bp_salesrep_id,
|
||||
ubp.salesvolume AS salesrep_bp_salesvolume,
|
||||
ubp.sendemail AS salesrep_bp_sendemail,
|
||||
ubp.shareofcustomer AS salesrep_bp_shareofcustomer,
|
||||
ubp.shelflifeminpct AS salesrep_bp_shelflifeminpct,
|
||||
ubp.so_creditlimit AS salesrep_bp_so_creditlimit,
|
||||
ubp.socreditstatus AS salesrep_bp_socreditstatus,
|
||||
ubp.so_creditused AS salesrep_bp_so_creditused,
|
||||
ubp.so_description AS salesrep_bp_so_description,
|
||||
ubp.taxid AS salesrep_bp_taxid,
|
||||
ubp.totalopenbalance AS salesrep_bp_totalopenbalance,
|
||||
ubp.updated AS salesrep_bp_updated,
|
||||
ubp.updatedby AS salesrep_bp_updatedby,
|
||||
ubp.url AS salesrep_bp_url,
|
||||
ubp.value AS salesrep_bp_value,
|
||||
bbp.acqusitioncost AS bill_bp_acqusitioncost,
|
||||
bbp.actuallifetimevalue AS bill_bp_actuallifetimevalue,
|
||||
bbp.ad_language AS bill_bp_ad_language,
|
||||
bbp.ad_orgbp_id AS bill_bp_ad_orgbp_id,
|
||||
bbp.ad_org_id AS bill_bp_ad_org_id,
|
||||
bbp.bpartner_parent_id AS bill_bp_bpartner_parent_id,
|
||||
bbp.c_bp_group_id AS bill_bp_c_bp_group_id,
|
||||
bbp.c_dunning_id AS bill_bp_c_dunning_id,
|
||||
bbp.c_greeting_id AS bill_bp_c_greeting_id,
|
||||
bbp.c_invoiceschedule_id AS bill_bp_c_invoiceschedule_id,
|
||||
bbp.c_paymentterm_id AS bill_bp_c_paymentterm_id,
|
||||
bbp.created AS bill_bp_created,
|
||||
bbp.createdby AS bill_bp_createdby,
|
||||
bbp.c_taxgroup_id AS bill_bp_c_taxgroup_id,
|
||||
bbp.deliveryrule AS bill_bp_deliveryrule,
|
||||
bbp.deliveryviarule AS bill_bp_deliveryviarule,
|
||||
bbp.description AS bill_bp_description,
|
||||
bbp.dunninggrace AS bill_bp_dunninggrace,
|
||||
bbp.duns AS bill_bp_duns,
|
||||
bbp.firstsale AS bill_bp_firstsale,
|
||||
bbp.flatdiscount AS bill_bp_flatdiscount,
|
||||
bbp.freightcostrule AS bill_bp_freightcostrule,
|
||||
bbp.invoicerule AS bill_bp_invoicerule,
|
||||
bbp.isactive AS bill_bp_isactive,
|
||||
bbp.iscustomer AS bill_bp_iscustomer,
|
||||
bbp.isdiscountprinted AS bill_bp_isdiscountprinted,
|
||||
bbp.isemployee AS bill_bp_isemployee,
|
||||
bbp.ismanufacturer AS bill_bp_ismanufacturer,
|
||||
bbp.isonetime AS bill_bp_isonetime,
|
||||
bbp.ispotaxexempt AS bill_bp_ispotaxexempt,
|
||||
bbp.isprospect AS bill_bp_isprospect,
|
||||
bbp.issalesrep AS bill_bp_issalesrep,
|
||||
bbp.issummary AS bill_bp_issummary,
|
||||
bbp.istaxexempt AS bill_bp_istaxexempt,
|
||||
bbp.isvendor AS bill_bp_isvendor,
|
||||
bbp.logo_id AS bill_bp_logo_id,
|
||||
bbp.m_discountschema_id AS bill_bp_m_discountschema_id,
|
||||
bbp.m_pricelist_id AS bill_bp_m_pricelist_id,
|
||||
bbp.naics AS bill_bp_naics,
|
||||
bbp.numberemployees AS bill_bp_numberemployees,
|
||||
bbp.paymentrule AS bill_bp_paymentrule,
|
||||
bbp.paymentrulepo AS bill_bp_paymentrulepo,
|
||||
bbp.po_discountschema_id AS bill_bp_po_discountschema_id,
|
||||
bbp.po_paymentterm_id AS bill_bp_po_paymentterm_id,
|
||||
bbp.po_pricelist_id AS bill_bp_po_pricelist_id,
|
||||
bbp.poreference AS bill_bp_poreference,
|
||||
bbp.potentiallifetimevalue AS bill_bp_potentiallifetimevalue,
|
||||
bbp.rating AS bill_bp_rating,
|
||||
bbp.referenceno AS bill_bp_referenceno,
|
||||
bbp.salesrep_id AS bill_bp_salesrep_id,
|
||||
bbp.salesvolume AS bill_bp_salesvolume,
|
||||
bbp.sendemail AS bill_bp_sendemail,
|
||||
bbp.shareofcustomer AS bill_bp_shareofcustomer,
|
||||
bbp.shelflifeminpct AS bill_bp_shelflifeminpct,
|
||||
bbp.so_creditlimit AS bill_bp_so_creditlimit,
|
||||
bbp.socreditstatus AS bill_bp_socreditstatus,
|
||||
bbp.so_creditused AS bill_bp_so_creditused,
|
||||
bbp.so_description AS bill_bp_so_description,
|
||||
bbp.totalopenbalance AS bill_bp_totalopenbalance,
|
||||
bbp.updated AS bill_bp_updated,
|
||||
bbp.updatedby AS bill_bp_updatedby,
|
||||
bbp.url AS bill_bp_url,
|
||||
bbpl.ad_org_id AS bill_bp_location_ad_org_id,
|
||||
bbpl.c_bpartner_id AS bill_bp_location_c_bpartner_id,
|
||||
bbpl.created AS bill_bp_location_created,
|
||||
bbpl.createdby AS bill_bp_location_createdby,
|
||||
bbpl.c_salesregion_id AS bill_bp_location_c_salesreg_id,
|
||||
bbpl.fax AS bill_bp_location_fax,
|
||||
bbpl.isactive AS bill_bp_location_isactive,
|
||||
bbpl.isbillto AS bill_bp_location_isbillto,
|
||||
bbpl.isdn AS bill_bp_location_isdn,
|
||||
bbpl.ispayfrom AS bill_bp_location_ispayfrom,
|
||||
bbpl.isremitto AS bill_bp_location_isremitto,
|
||||
bbpl.isshipto AS bill_bp_location_isshipto,
|
||||
bbpl.name AS bill_bp_location_name,
|
||||
bbpl.phone AS bill_bp_location_phone,
|
||||
bbpl.phone2 AS bill_bp_location_phone2,
|
||||
bbpl.updated AS bill_bp_location_updated,
|
||||
bbpl.updatedby AS bill_bp_location_updatedby,
|
||||
bbpc.ad_org_id AS bill_user_ad_org_id,
|
||||
bbpc.ad_orgtrx_id AS bill_user_ad_orgtrx_id,
|
||||
bbpc.birthday AS bill_user_ad_birthday,
|
||||
bbpc.c_bpartner_id AS bill_user_c_bpartner_id,
|
||||
bbpc.c_bpartner_location_id AS bill_user_c_bp_location_id,
|
||||
bbpc.c_greeting_id AS bill_user_c_greeting_id,
|
||||
bbpc.comments AS bill_user_comments,
|
||||
bbpc.created AS bill_user_created,
|
||||
bbpc.createdby AS bill_user_createdby,
|
||||
bbpc.description AS bill_user_description,
|
||||
bbpc.email AS bill_user_email,
|
||||
bbpc.fax AS bill_user_fax,
|
||||
bbpc.isactive AS bill_user_isactive,
|
||||
bbpc.lastcontact AS bill_user_lastcontact,
|
||||
bbpc.lastresult AS bill_user_lastresult,
|
||||
bbpc.phone2 AS bill_user_phone2,
|
||||
bbpc.supervisor_id AS bill_user_supervisor_id,
|
||||
bbpc.updated AS bill_user_updated,
|
||||
bbpc.updatedby AS bill_user_updatedby,
|
||||
bbpc.value AS bill_user_value,
|
||||
cur.cursymbol,
|
||||
cur.description AS cur_description
|
||||
FROM c_order o
|
||||
JOIN c_doctype_trl dt
|
||||
ON o.c_doctype_id = dt.c_doctype_id
|
||||
JOIN m_warehouse wh
|
||||
ON o.m_warehouse_id = wh.m_warehouse_id
|
||||
JOIN c_paymentterm pt
|
||||
ON o.c_paymentterm_id = pt.c_paymentterm_id
|
||||
JOIN c_paymentterm_trl ptt
|
||||
ON o.c_paymentterm_id = ptt.c_paymentterm_id
|
||||
AND dt.ad_language = ptt.ad_language
|
||||
JOIN c_bpartner bp
|
||||
ON o.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpgt
|
||||
ON bp.c_greeting_id = bpgt.c_greeting_id
|
||||
AND dt.ad_language = bpgt.ad_language
|
||||
JOIN c_bpartner_location bpl
|
||||
ON o.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON o.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpcgt
|
||||
ON bpc.c_greeting_id = bpcgt.c_greeting_id
|
||||
AND dt.ad_language = bpcgt.ad_language
|
||||
JOIN ad_orginfo oi
|
||||
ON o.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON o.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_user u
|
||||
ON o.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
JOIN c_bpartner bbp
|
||||
ON o.bill_bpartner_id = bbp.c_bpartner_id
|
||||
JOIN c_bpartner_location bbpl
|
||||
ON o.bill_location_id = bbpl.c_bpartner_location_id
|
||||
LEFT JOIN ad_user bbpc
|
||||
ON o.bill_user_id = bbpc.ad_user_id
|
||||
LEFT JOIN c_currency_trl cur
|
||||
ON o.c_currency_id = cur.c_currency_id
|
||||
AND dt.ad_language = cur.ad_language
|
||||
;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,225 +0,0 @@
|
|||
DROP VIEW c_payselection_check_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_payselection_check_v
|
||||
AS
|
||||
SELECT psc.ad_client_id,
|
||||
psc.ad_org_id,
|
||||
'en_US' AS ad_language,
|
||||
psc.c_payselection_id,
|
||||
psc.c_payselectioncheck_id,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
p.c_doctype_id,
|
||||
bp.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
bpg.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpartnerremitlocation(bp.c_bpartner_id) AS c_location_id,
|
||||
bp.referenceno,
|
||||
bp.poreference,
|
||||
ps.paydate,
|
||||
psc.payamt,
|
||||
psc.payamt AS amtinwords,
|
||||
psc.qty,
|
||||
psc.paymentrule,
|
||||
psc.documentno,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
p.description,
|
||||
ba.description AS bankaccountdescription,
|
||||
psc.c_bp_bankaccount_id,
|
||||
psc.c_payment_id,
|
||||
psc.created AS c_payselectioncheck_created,
|
||||
psc.createdby AS c_payselectioncheck_createdby,
|
||||
psc.discountamt AS c_payselectioncheck_discamt,
|
||||
psc.isactive AS c_payselectioncheck_isactive,
|
||||
psc.isgenerateddraft,
|
||||
psc.isprinted,
|
||||
psc.isreceipt,
|
||||
psc.processed,
|
||||
psc.updated AS c_payselectioncheck_updated,
|
||||
psc.updatedby AS c_payselectioncheck_updatedby,
|
||||
ps.ad_org_id AS c_payselection_ad_org_id,
|
||||
ps.c_bankaccount_id AS c_paysel_c_bankaccount_id,
|
||||
ps.created AS c_payselection_created,
|
||||
ps.createdby AS c_payselection_createdby,
|
||||
ps.description AS c_payselection_description,
|
||||
ps.isactive AS c_payselection_isactive,
|
||||
ps.isapproved AS c_payselection_isapproved,
|
||||
ps.name AS c_payselection_name,
|
||||
ps.processed AS c_payselection_processed,
|
||||
ps.totalamt,
|
||||
ps.updated AS c_payselection_updated,
|
||||
ps.updatedby AS c_payselection_updatedby,
|
||||
p.a_city,
|
||||
p.a_country,
|
||||
p.ad_org_id AS c_payment_ad_org_id,
|
||||
p.a_email,
|
||||
p.a_ident_dl,
|
||||
p.a_name,
|
||||
p.a_state,
|
||||
p.a_street,
|
||||
p.a_zip,
|
||||
p.c_activity_id,
|
||||
p.c_bpartner_id AS c_payment_c_bpartner_id,
|
||||
p.c_campaign_id,
|
||||
p.c_charge_id AS c_payment_c_charge_id,
|
||||
p.c_conversiontype_id,
|
||||
p.c_currency_id,
|
||||
p.chargeamt AS c_payment_chargeamt,
|
||||
p.checkno,
|
||||
p.c_invoice_id AS c_payment_c_invoice_id,
|
||||
p.c_order_id AS c_payment_c_order_id,
|
||||
p.c_paymentbatch_id,
|
||||
p.c_project_id,
|
||||
p.created AS c_payment_created,
|
||||
p.createdby AS c_payment_createdby,
|
||||
p.dateacct,
|
||||
p.datetrx,
|
||||
p.discountamt AS c_payment_discountamt,
|
||||
p.docstatus,
|
||||
p.documentno AS c_payment_documentno,
|
||||
p.isactive AS c_payment_isactive,
|
||||
p.isallocated,
|
||||
p.isapproved,
|
||||
p.isdelayedcapture,
|
||||
p.isonline,
|
||||
p.isoverunderpayment,
|
||||
p.isprepayment,
|
||||
p.isreconciled,
|
||||
p.isselfservice AS c_payment_isselfservice,
|
||||
p.micr,
|
||||
p.orig_trxid,
|
||||
p.overunderamt,
|
||||
p.payamt AS c_payment_payamt,
|
||||
p.ponum,
|
||||
p.posted AS c_payment_posted,
|
||||
p.processed AS c_payment_processed,
|
||||
p.processedon AS c_payment_processedon,
|
||||
p.r_authcode,
|
||||
p.r_authcode_dc,
|
||||
p.r_avsaddr,
|
||||
p.r_avszip,
|
||||
p.r_cvv2match,
|
||||
p.ref_payment_id,
|
||||
p.reversal_id AS c_payment_reversal_id,
|
||||
p.r_info,
|
||||
p.routingno,
|
||||
p.r_pnref,
|
||||
p.r_pnref_dc,
|
||||
p.r_respmsg,
|
||||
p.r_result,
|
||||
p.swipe,
|
||||
p.taxamt,
|
||||
p.tendertype,
|
||||
p.trxtype,
|
||||
p.updated AS c_payment_updated,
|
||||
p.updatedby AS c_payment_updatedby,
|
||||
p.user1_id,
|
||||
p.user2_id,
|
||||
p.voiceauthcode,
|
||||
p.writeoffamt,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.istaxexempt AS c_bp_istaxexempt,
|
||||
bp.isvendor AS c_bp_isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.numberemployees AS c_bp_numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
bp.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume AS c_bp_salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer AS c_bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bp_so_creditlimit,
|
||||
bp.socreditstatus AS c_bp_socreditstatus,
|
||||
bp.so_creditused AS c_bp_so_creditused,
|
||||
bp.so_description AS c_bp_so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
bpg.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpg.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpg.name AS c_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby
|
||||
FROM c_payselectioncheck psc
|
||||
JOIN c_payselection ps
|
||||
ON psc.c_payselection_id = ps.c_payselection_id
|
||||
LEFT JOIN c_payment p
|
||||
ON psc.c_payment_id = p.c_payment_id
|
||||
LEFT JOIN c_bankaccount ba
|
||||
ON p.c_bankaccount_id = ba.c_bankaccount_id
|
||||
LEFT JOIN c_doctype dt
|
||||
ON p.c_doctype_id = dt.c_doctype_id
|
||||
JOIN c_bpartner bp
|
||||
ON psc.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
JOIN ad_orginfo oi
|
||||
ON psc.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON psc.ad_client_id = ci.ad_client_id
|
||||
;
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
DROP VIEW c_payselection_check_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_payselection_check_vt
|
||||
AS
|
||||
SELECT psc.ad_client_id,
|
||||
psc.ad_org_id,
|
||||
l.ad_language,
|
||||
psc.c_payselection_id,
|
||||
psc.c_payselectioncheck_id,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
p.c_doctype_id,
|
||||
bp.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
bpgt.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpartnerremitlocation(bp.c_bpartner_id) AS c_location_id,
|
||||
bp.referenceno,
|
||||
bp.poreference,
|
||||
ps.paydate,
|
||||
psc.payamt,
|
||||
psc.payamt AS amtinwords,
|
||||
psc.qty,
|
||||
psc.paymentrule,
|
||||
psc.documentno,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
p.description,
|
||||
ba.description AS bankaccountdescription,
|
||||
psc.c_bp_bankaccount_id,
|
||||
psc.c_payment_id,
|
||||
psc.created AS c_payselectioncheck_created,
|
||||
psc.createdby AS c_payselectioncheck_createdby,
|
||||
psc.discountamt AS c_payselectioncheck_discamt,
|
||||
psc.isactive AS c_payselectioncheck_isactive,
|
||||
psc.isgenerateddraft,
|
||||
psc.isprinted,
|
||||
psc.isreceipt,
|
||||
psc.processed,
|
||||
psc.updated AS c_payselectioncheck_updated,
|
||||
psc.updatedby AS c_payselectioncheck_updatedby,
|
||||
ps.ad_org_id AS c_payselection_ad_org_id,
|
||||
ps.c_bankaccount_id AS c_paysel_c_bankaccount_id,
|
||||
ps.created AS c_payselection_created,
|
||||
ps.createdby AS c_payselection_createdby,
|
||||
ps.description AS c_payselection_description,
|
||||
ps.isactive AS c_payselection_isactive,
|
||||
ps.isapproved AS c_payselection_isapproved,
|
||||
ps.name AS c_payselection_name,
|
||||
ps.processed AS c_payselection_processed,
|
||||
ps.totalamt,
|
||||
ps.updated AS c_payselection_updated,
|
||||
ps.updatedby AS c_payselection_updatedby,
|
||||
p.a_city,
|
||||
p.a_country,
|
||||
p.ad_org_id AS c_payment_ad_org_id,
|
||||
p.a_email,
|
||||
p.a_ident_dl,
|
||||
p.a_name,
|
||||
p.a_state,
|
||||
p.a_street,
|
||||
p.a_zip,
|
||||
p.c_activity_id,
|
||||
p.c_bpartner_id AS c_payment_c_bpartner_id,
|
||||
p.c_campaign_id,
|
||||
p.c_charge_id AS c_payment_c_charge_id,
|
||||
p.c_conversiontype_id,
|
||||
p.c_currency_id,
|
||||
p.chargeamt AS c_payment_chargeamt,
|
||||
p.checkno,
|
||||
p.c_invoice_id AS c_payment_c_invoice_id,
|
||||
p.c_order_id AS c_payment_c_order_id,
|
||||
p.c_paymentbatch_id,
|
||||
p.c_project_id,
|
||||
p.created AS c_payment_created,
|
||||
p.createdby AS c_payment_createdby,
|
||||
p.dateacct,
|
||||
p.datetrx,
|
||||
p.discountamt AS c_payment_discountamt,
|
||||
p.docstatus,
|
||||
p.documentno AS c_payment_documentno,
|
||||
p.isactive AS c_payment_isactive,
|
||||
p.isallocated,
|
||||
p.isapproved,
|
||||
p.isdelayedcapture,
|
||||
p.isonline,
|
||||
p.isoverunderpayment,
|
||||
p.isprepayment,
|
||||
p.isreconciled,
|
||||
p.isselfservice AS c_payment_isselfservice,
|
||||
p.micr,
|
||||
p.orig_trxid,
|
||||
p.overunderamt,
|
||||
p.payamt AS c_payment_payamt,
|
||||
p.ponum,
|
||||
p.posted AS c_payment_posted,
|
||||
p.processed AS c_payment_processed,
|
||||
p.processedon AS c_payment_processedon,
|
||||
p.r_authcode,
|
||||
p.r_authcode_dc,
|
||||
p.r_avsaddr,
|
||||
p.r_avszip,
|
||||
p.r_cvv2match,
|
||||
p.ref_payment_id,
|
||||
p.reversal_id AS c_payment_reversal_id,
|
||||
p.r_info,
|
||||
p.routingno,
|
||||
p.r_pnref,
|
||||
p.r_pnref_dc,
|
||||
p.r_respmsg,
|
||||
p.r_result,
|
||||
p.swipe,
|
||||
p.taxamt,
|
||||
p.tendertype,
|
||||
p.trxtype,
|
||||
p.updated AS c_payment_updated,
|
||||
p.updatedby AS c_payment_updatedby,
|
||||
p.user1_id,
|
||||
p.user2_id,
|
||||
p.voiceauthcode,
|
||||
p.writeoffamt,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.istaxexempt AS c_bp_istaxexempt,
|
||||
bp.isvendor AS c_bp_isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.numberemployees AS c_bp_numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
bp.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume AS c_bp_salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer AS c_bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bp_so_creditlimit,
|
||||
bp.socreditstatus AS c_bp_socreditstatus,
|
||||
bp.so_creditused AS c_bp_so_creditused,
|
||||
bp.so_description AS c_bp_so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
bpgt.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpgt.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpgt.name AS c_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby
|
||||
FROM c_payselectioncheck psc
|
||||
JOIN c_payselection ps
|
||||
ON psc.c_payselection_id = ps.c_payselection_id
|
||||
LEFT JOIN c_payment p
|
||||
ON psc.c_payment_id = p.c_payment_id
|
||||
LEFT JOIN c_bankaccount ba
|
||||
ON p.c_bankaccount_id = ba.c_bankaccount_id
|
||||
LEFT JOIN c_doctype_trl dt
|
||||
ON p.c_doctype_id = dt.c_doctype_id
|
||||
JOIN c_bpartner bp
|
||||
ON psc.c_bpartner_id = bp.c_bpartner_id
|
||||
JOIN ad_orginfo oi
|
||||
ON psc.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON psc.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN ad_language l
|
||||
ON l.issystemlanguage = 'Y'
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpgt
|
||||
ON bp.c_greeting_id = bpgt.c_greeting_id
|
||||
AND bpgt.ad_language = l.ad_language
|
||||
;
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
DROP VIEW c_payselection_remittance_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_payselection_remittance_v
|
||||
AS
|
||||
SELECT psl.ad_client_id,
|
||||
psl.ad_org_id,
|
||||
'en_US' AS ad_language,
|
||||
psl.c_payselection_id,
|
||||
psl.c_payselectionline_id,
|
||||
psl.c_payselectioncheck_id,
|
||||
psl.paymentrule,
|
||||
psl.line,
|
||||
psl.openamt,
|
||||
psl.payamt,
|
||||
psl.discountamt,
|
||||
psl.differenceamt,
|
||||
i.c_bpartner_id,
|
||||
i.documentno,
|
||||
i.dateinvoiced,
|
||||
i.grandtotal,
|
||||
i.grandtotal AS amtinwords,
|
||||
psl.c_invoice_id,
|
||||
psl.created AS c_payselectionline_created,
|
||||
psl.createdby AS c_payselectionline_createdby,
|
||||
psl.description AS c_payselectionline_description,
|
||||
psl.isactive AS c_payselectionline_isactive,
|
||||
psl.ismanual,
|
||||
psl.issotrx AS c_payselectionline_issotrx,
|
||||
psl.processed,
|
||||
psl.updated AS c_payselectionline_updated,
|
||||
psl.updatedby AS c_payselectionline_updatedby,
|
||||
i.ad_org_id AS c_invoice_ad_org_id,
|
||||
i.ad_orgtrx_id,
|
||||
i.ad_user_id,
|
||||
i.c_activity_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_campaign_id,
|
||||
i.c_charge_id,
|
||||
i.c_conversiontype_id,
|
||||
i.c_currency_id,
|
||||
i.c_doctype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.chargeamt,
|
||||
i.c_payment_id,
|
||||
i.c_paymentterm_id,
|
||||
i.c_project_id,
|
||||
i.created AS c_invoice_created,
|
||||
i.createdby AS c_invoice_createdby,
|
||||
i.dateacct,
|
||||
i.dateordered,
|
||||
i.dateprinted,
|
||||
i.description AS c_invoice_description,
|
||||
i.docaction,
|
||||
i.docstatus,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isactive AS c_invoice_isactive,
|
||||
i.isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.issotrx AS c_invoice_issotrx,
|
||||
i.istaxincluded,
|
||||
i.istransferred,
|
||||
i.m_pricelist_id,
|
||||
i.m_rma_id,
|
||||
i.paymentrule AS c_invoice_paymentrule,
|
||||
i.poreference,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.sendemail,
|
||||
i.totallines,
|
||||
i.updated AS c_invoice_updated,
|
||||
i.updatedby AS c_invoice_updatedby,
|
||||
i.user1_id,
|
||||
i.user2_id
|
||||
FROM c_payselectionline psl
|
||||
JOIN c_invoice i
|
||||
ON psl.c_invoice_id = i.c_invoice_id
|
||||
;
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
DROP VIEW c_payselection_remittance_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_payselection_remittance_vt
|
||||
AS
|
||||
SELECT psl.ad_client_id,
|
||||
psl.ad_org_id,
|
||||
l.ad_language,
|
||||
psl.c_payselection_id,
|
||||
psl.c_payselectionline_id,
|
||||
psl.c_payselectioncheck_id,
|
||||
psl.paymentrule,
|
||||
psl.line,
|
||||
psl.openamt,
|
||||
psl.payamt,
|
||||
psl.discountamt,
|
||||
psl.differenceamt,
|
||||
i.c_bpartner_id,
|
||||
i.documentno,
|
||||
i.dateinvoiced,
|
||||
i.grandtotal,
|
||||
i.grandtotal AS amtinwords,
|
||||
psl.c_invoice_id,
|
||||
psl.created AS c_payselectionline_created,
|
||||
psl.createdby AS c_payselectionline_createdby,
|
||||
psl.description AS c_payselectionline_description,
|
||||
psl.isactive AS c_payselectionline_isactive,
|
||||
psl.ismanual,
|
||||
psl.issotrx AS c_payselectionline_issotrx,
|
||||
psl.processed,
|
||||
psl.updated AS c_payselectionline_updated,
|
||||
psl.updatedby AS c_payselectionline_updatedby,
|
||||
i.ad_org_id AS c_invoice_ad_org_id,
|
||||
i.ad_orgtrx_id,
|
||||
i.ad_user_id,
|
||||
i.c_activity_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_campaign_id,
|
||||
i.c_charge_id,
|
||||
i.c_conversiontype_id,
|
||||
i.c_currency_id,
|
||||
i.c_doctype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.chargeamt,
|
||||
i.c_payment_id,
|
||||
i.c_paymentterm_id,
|
||||
i.c_project_id,
|
||||
i.created AS c_invoice_created,
|
||||
i.createdby AS c_invoice_createdby,
|
||||
i.dateacct,
|
||||
i.dateordered,
|
||||
i.dateprinted,
|
||||
i.description AS c_invoice_description,
|
||||
i.docaction,
|
||||
i.docstatus,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isactive AS c_invoice_isactive,
|
||||
i.isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.issotrx AS c_invoice_issotrx,
|
||||
i.istaxincluded,
|
||||
i.istransferred,
|
||||
i.m_pricelist_id,
|
||||
i.m_rma_id,
|
||||
i.paymentrule AS c_invoice_paymentrule,
|
||||
i.poreference,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.sendemail,
|
||||
i.totallines,
|
||||
i.updated AS c_invoice_updated,
|
||||
i.updatedby AS c_invoice_updatedby,
|
||||
i.user1_id,
|
||||
i.user2_id
|
||||
FROM c_payselectionline psl
|
||||
JOIN c_invoice i
|
||||
ON psl.c_invoice_id = i.c_invoice_id
|
||||
JOIN ad_language l
|
||||
ON l.issystemlanguage = 'Y'
|
||||
;
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
DROP VIEW c_project_details_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_project_details_v
|
||||
AS
|
||||
SELECT pl.ad_client_id,
|
||||
pl.ad_org_id,
|
||||
pl.isactive,
|
||||
pl.created,
|
||||
pl.createdby,
|
||||
pl.updated,
|
||||
pl.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
pj.c_project_id,
|
||||
pl.c_projectline_id,
|
||||
pl.line,
|
||||
pl.plannedqty,
|
||||
pl.plannedprice,
|
||||
pl.plannedamt,
|
||||
pl.plannedmarginamt,
|
||||
pl.committedamt,
|
||||
pl.m_product_id,
|
||||
COALESCE(p.name, pl.description) AS name,
|
||||
CASE
|
||||
WHEN p.name IS NOT NULL THEN pl.description
|
||||
ELSE NULL
|
||||
END AS description,
|
||||
p.documentnote,
|
||||
p.upc,
|
||||
p.sku,
|
||||
p.value AS productvalue,
|
||||
pl.m_product_category_id,
|
||||
pl.invoicedamt,
|
||||
pl.invoicedqty,
|
||||
pl.committedqty,
|
||||
pl.c_order_id,
|
||||
pl.c_orderpo_id,
|
||||
pl.c_projectissue_id,
|
||||
pl.c_projectphase_id,
|
||||
pl.c_projecttask_id,
|
||||
pl.dopricing,
|
||||
pl.isprinted,
|
||||
pl.processed AS c_projectline_processed,
|
||||
pj.ad_org_id AS c_project_ad_org_id,
|
||||
pj.ad_user_id,
|
||||
pj.c_bpartner_id,
|
||||
pj.c_bpartner_location_id,
|
||||
pj.c_bpartnersr_id,
|
||||
pj.c_campaign_id,
|
||||
pj.c_currency_id,
|
||||
pj.committedamt AS c_project_committedamt,
|
||||
pj.committedqty AS c_project_committedqty,
|
||||
pj.copyfrom AS c_project_copyfrom,
|
||||
pj.c_paymentterm_id,
|
||||
pj.c_phase_id,
|
||||
pj.c_projecttype_id,
|
||||
pj.created AS c_project_created,
|
||||
pj.createdby AS c_project_createdby,
|
||||
pj.datecontract,
|
||||
pj.datefinish,
|
||||
pj.description AS c_project_description,
|
||||
pj.generateto,
|
||||
pj.invoicedamt AS c_project_invoicedamt,
|
||||
pj.invoicedqty AS c_project_invoicedqty,
|
||||
pj.isactive AS c_project_isactive,
|
||||
pj.iscommitceiling,
|
||||
pj.iscommitment,
|
||||
pj.issummary AS c_project_issummary,
|
||||
pj.m_pricelist_version_id,
|
||||
pj.m_warehouse_id,
|
||||
pj.name AS c_project_name,
|
||||
pj.note AS c_project_note,
|
||||
pj.plannedamt AS c_project_plannedamt,
|
||||
pj.plannedmarginamt AS c_project_plannedmarginamt,
|
||||
pj.plannedqty AS c_project_plannedqty,
|
||||
pj.poreference,
|
||||
pj.processed AS c_project_processed,
|
||||
pj.processing AS c_project_processing,
|
||||
pj.projectbalanceamt,
|
||||
pj.projectcategory,
|
||||
pj.projectlinelevel,
|
||||
pj.projinvoicerule,
|
||||
pj.salesrep_id AS c_project_salesrep_id,
|
||||
pj.updated AS c_project_updated,
|
||||
pj.updatedby AS c_project_updatedby,
|
||||
pj.value AS c_project_value,
|
||||
p.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
p.created AS m_product_created,
|
||||
p.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id,
|
||||
p.c_uom_id,
|
||||
p.description AS m_product_description,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.imageurl,
|
||||
p.isactive AS m_product_isactive,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id,
|
||||
p.m_attributesetinstance_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id,
|
||||
p.m_product_category_id AS m_product_m_prod_category_id,
|
||||
p.m_product_id AS m_product_m_product_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight
|
||||
FROM c_projectline pl
|
||||
JOIN c_project pj
|
||||
ON pl.c_project_id = pj.c_project_id
|
||||
LEFT JOIN m_product p
|
||||
ON pl.m_product_id = p.m_product_id
|
||||
WHERE pl.isprinted = 'Y'
|
||||
;
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
DROP VIEW c_project_details_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_project_details_vt
|
||||
AS
|
||||
SELECT pl.ad_client_id,
|
||||
pl.ad_org_id,
|
||||
pl.isactive,
|
||||
pl.created,
|
||||
pl.createdby,
|
||||
pl.updated,
|
||||
pl.updatedby,
|
||||
l.ad_language,
|
||||
pj.c_project_id,
|
||||
pl.c_projectline_id,
|
||||
pl.line,
|
||||
pl.plannedqty,
|
||||
pl.plannedprice,
|
||||
pl.plannedamt,
|
||||
pl.plannedmarginamt,
|
||||
pl.committedamt,
|
||||
pl.m_product_id,
|
||||
COALESCE(pt.name, pl.description) AS name,
|
||||
CASE
|
||||
WHEN pt.name IS NOT NULL THEN pl.description
|
||||
ELSE NULL
|
||||
END AS description,
|
||||
pt.documentnote,
|
||||
p.upc,
|
||||
p.sku,
|
||||
p.value AS productvalue,
|
||||
pl.m_product_category_id,
|
||||
pl.invoicedamt,
|
||||
pl.invoicedqty,
|
||||
pl.committedqty,
|
||||
pl.c_order_id,
|
||||
pl.c_orderpo_id,
|
||||
pl.c_projectissue_id,
|
||||
pl.c_projectphase_id,
|
||||
pl.c_projecttask_id,
|
||||
pl.dopricing,
|
||||
pl.isprinted,
|
||||
pl.processed AS c_projectline_processed,
|
||||
pj.ad_org_id AS c_project_ad_org_id,
|
||||
pj.ad_user_id,
|
||||
pj.c_bpartner_id,
|
||||
pj.c_bpartner_location_id,
|
||||
pj.c_bpartnersr_id,
|
||||
pj.c_campaign_id,
|
||||
pj.c_currency_id,
|
||||
pj.committedamt AS c_project_committedamt,
|
||||
pj.committedqty AS c_project_committedqty,
|
||||
pj.copyfrom AS c_project_copyfrom,
|
||||
pj.c_paymentterm_id,
|
||||
pj.c_phase_id,
|
||||
pj.c_projecttype_id,
|
||||
pj.created AS c_project_created,
|
||||
pj.createdby AS c_project_createdby,
|
||||
pj.datecontract,
|
||||
pj.datefinish,
|
||||
pj.description AS c_project_description,
|
||||
pj.generateto,
|
||||
pj.invoicedamt AS c_project_invoicedamt,
|
||||
pj.invoicedqty AS c_project_invoicedqty,
|
||||
pj.isactive AS c_project_isactive,
|
||||
pj.iscommitceiling,
|
||||
pj.iscommitment,
|
||||
pj.issummary AS c_project_issummary,
|
||||
pj.m_pricelist_version_id,
|
||||
pj.m_warehouse_id,
|
||||
pj.name AS c_project_name,
|
||||
pj.note AS c_project_note,
|
||||
pj.plannedamt AS c_project_plannedamt,
|
||||
pj.plannedmarginamt AS c_project_plannedmarginamt,
|
||||
pj.plannedqty AS c_project_plannedqty,
|
||||
pj.poreference,
|
||||
pj.processed AS c_project_processed,
|
||||
pj.processing AS c_project_processing,
|
||||
pj.projectbalanceamt,
|
||||
pj.projectcategory,
|
||||
pj.projectlinelevel,
|
||||
pj.projinvoicerule,
|
||||
pj.salesrep_id AS c_project_salesrep_id,
|
||||
pj.updated AS c_project_updated,
|
||||
pj.updatedby AS c_project_updatedby,
|
||||
pj.value AS c_project_value,
|
||||
pt.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
pt.created AS m_product_created,
|
||||
pt.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id,
|
||||
p.c_uom_id,
|
||||
pt.description AS m_product_description,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.imageurl,
|
||||
pt.isactive AS m_product_isactive,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id,
|
||||
p.m_attributesetinstance_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id,
|
||||
p.m_product_category_id AS m_product_m_prod_category_id,
|
||||
p.m_product_id AS m_product_m_product_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight
|
||||
FROM c_projectline pl
|
||||
JOIN c_project pj
|
||||
ON pl.c_project_id = pj.c_project_id
|
||||
LEFT JOIN m_product p
|
||||
ON pl.m_product_id = p.m_product_id
|
||||
LEFT JOIN m_product_trl pt
|
||||
ON pl.m_product_id = pt.m_product_id
|
||||
JOIN ad_language l
|
||||
ON l.issystemlanguage = 'Y'
|
||||
WHERE pl.isprinted = 'Y'
|
||||
;
|
||||
|
|
@ -1,342 +0,0 @@
|
|||
DROP VIEW c_project_header_v;
|
||||
|
||||
CREATE OR REPLACE VIEW c_project_header_v
|
||||
AS
|
||||
SELECT p.ad_client_id,
|
||||
p.ad_org_id,
|
||||
p.isactive,
|
||||
p.created,
|
||||
p.createdby,
|
||||
p.updated,
|
||||
p.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
p.c_project_id,
|
||||
p.value,
|
||||
p.name AS projectname,
|
||||
p.description,
|
||||
p.note,
|
||||
p.issummary,
|
||||
p.projectcategory,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
p.c_projecttype_id,
|
||||
pjt.name AS projecttypename,
|
||||
p.c_phase_id,
|
||||
pjp.name AS projectphasename,
|
||||
p.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
p.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
bpg.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcg.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
bp.referenceno,
|
||||
pt.name AS paymentterm,
|
||||
pt.documentnote AS paymenttermnote,
|
||||
p.poreference,
|
||||
p.c_currency_id,
|
||||
p.m_pricelist_version_id,
|
||||
p.c_campaign_id,
|
||||
p.plannedamt,
|
||||
p.plannedqty,
|
||||
p.plannedmarginamt,
|
||||
p.invoicedamt,
|
||||
p.invoicedqty,
|
||||
p.projectbalanceamt,
|
||||
p.iscommitment,
|
||||
p.committedamt,
|
||||
p.committedqty,
|
||||
p.datecontract,
|
||||
p.datefinish,
|
||||
p.iscommitceiling,
|
||||
p.m_warehouse_id,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
p.ad_user_id,
|
||||
p.c_bpartner_location_id,
|
||||
p.copyfrom,
|
||||
p.c_paymentterm_id AS c_project_c_paymentterm_id,
|
||||
p.generateto,
|
||||
p.processed AS c_project_processed,
|
||||
p.processing AS c_project_processing,
|
||||
p.projectlinelevel,
|
||||
p.projinvoicerule,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.istaxexempt AS c_bp_istaxexempt,
|
||||
bp.isvendor AS c_bp_isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.numberemployees AS c_bp_numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
bp.poreference AS c_bp_poreference,
|
||||
bp.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume AS c_bp_salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer AS c_bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bp_so_creditlimit,
|
||||
bp.socreditstatus AS c_bp_socreditstatus,
|
||||
bp.so_creditused AS c_bp_so_creditused,
|
||||
bp.so_description AS c_bp_so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id AS ad_orginfo_m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
pjt.ad_org_id AS c_projecttype_ad_org_id,
|
||||
pjt.description AS c_projecttype_description,
|
||||
pjt.help AS c_projecttype_help,
|
||||
pjt.isactive AS c_projecttype_isactive,
|
||||
pjt.projectcategory AS c_projecttype_projectcategory,
|
||||
pjp.ad_org_id AS c_phase_ad_org_id,
|
||||
pjp.c_phase_id AS c_phase_c_phase_id,
|
||||
pjp.c_projecttype_id AS c_phase_c_projecttype_id,
|
||||
pjp.description AS c_phase_description,
|
||||
pjp.help AS c_phase_help,
|
||||
pjp.isactive AS c_phase_isactive,
|
||||
pjp.m_product_id AS c_phase_m_product_id,
|
||||
pjp.seqno AS c_phase_seqno,
|
||||
pjp.standardqty,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone AS salesrep_phone,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.title AS salesrep_title,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS salesrep_bp_acqusitioncost,
|
||||
ubp.actuallifetimevalue AS salesrep_bp_actuallifevalue,
|
||||
ubp.ad_language AS salesrep_bp_ad_language,
|
||||
ubp.ad_orgbp_id AS salesrep_bp_ad_orgbp_id,
|
||||
ubp.ad_org_id AS salesrep_bp_ad_org_id,
|
||||
ubp.bpartner_parent_id AS salesrep_bp_bpartner_parent_id,
|
||||
ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id,
|
||||
ubp.c_dunning_id AS salesrep_bp_c_dunning_id,
|
||||
ubp.c_greeting_id AS salesrep_bp_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS salesrep_bp_c_invoicesched_id,
|
||||
ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id,
|
||||
ubp.created AS salesrep_bp_created,
|
||||
ubp.createdby AS salesrep_bp_createdby,
|
||||
ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id,
|
||||
ubp.deliveryrule AS salesrep_bp_deliveryrule,
|
||||
ubp.deliveryviarule AS salesrep_bp_deliveryviarule,
|
||||
ubp.description AS salesrep_bp_description,
|
||||
ubp.dunninggrace AS salesrep_bp_dunninggrace,
|
||||
ubp.duns AS salesrep_bp_duns,
|
||||
ubp.firstsale AS salesrep_bp_firstsale,
|
||||
ubp.flatdiscount AS salesrep_bp_flatdiscount,
|
||||
ubp.freightcostrule AS salesrep_bp_freightcostrule,
|
||||
ubp.invoicerule AS salesrep_bp_invoicerule,
|
||||
ubp.isactive AS salesrep_bp_isactive,
|
||||
ubp.iscustomer AS salesrep_bp_iscustomer,
|
||||
ubp.isdiscountprinted AS salesrep_bp_isdiscountprinted,
|
||||
ubp.isemployee AS salesrep_bp_isemployee,
|
||||
ubp.ismanufacturer AS salesrep_bp_ismanufacturer,
|
||||
ubp.isonetime AS salesrep_bp_isonetime,
|
||||
ubp.ispotaxexempt AS salesrep_bp_ispotaxexempt,
|
||||
ubp.isprospect AS salesrep_bp_isprospect,
|
||||
ubp.issalesrep AS salesrep_bp_issalesrep,
|
||||
ubp.issummary AS salesrep_bp_issummary,
|
||||
ubp.istaxexempt AS salesrep_bp_istaxexempt,
|
||||
ubp.isvendor AS salesrep_bp_isvendor,
|
||||
ubp.logo_id AS salesrep_bp_logo_id,
|
||||
ubp.m_discountschema_id AS salesrep_bp_m_discountschm_id,
|
||||
ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id,
|
||||
ubp.naics AS salesrep_bp_naics,
|
||||
ubp.name2 AS salesrep_bp_name2,
|
||||
ubp.numberemployees AS salesrep_bp_numberemployees,
|
||||
ubp.paymentrule AS salesrep_bp_paymentrule,
|
||||
ubp.paymentrulepo AS salesrep_bp_paymentrulepo,
|
||||
ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id,
|
||||
ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id,
|
||||
ubp.poreference AS salesrep_bp_poreference,
|
||||
ubp.potentiallifetimevalue AS salesrep_bp_potentiallifevalue,
|
||||
ubp.rating AS salesrep_bp_rating,
|
||||
ubp.referenceno AS salesrep_bp_referenceno,
|
||||
ubp.salesrep_id AS salesrep_bp_salesrep_id,
|
||||
ubp.salesvolume AS salesrep_bp_salesvolume,
|
||||
ubp.sendemail AS salesrep_bp_sendemail,
|
||||
ubp.shareofcustomer AS salesrep_bp_shareofcustomer,
|
||||
ubp.shelflifeminpct AS salesrep_bp_shelflifeminpct,
|
||||
ubp.so_creditlimit AS salesrep_bp_so_creditlimit,
|
||||
ubp.socreditstatus AS salesrep_bp_socreditstatus,
|
||||
ubp.so_creditused AS salesrep_bp_so_creditused,
|
||||
ubp.so_description AS salesrep_bp_so_description,
|
||||
ubp.taxid AS salesrep_bp_taxid,
|
||||
ubp.totalopenbalance AS salesrep_bp_totalopenbalance,
|
||||
ubp.updated AS salesrep_bp_updated,
|
||||
ubp.updatedby AS salesrep_bp_updatedby,
|
||||
ubp.url AS salesrep_bp_url,
|
||||
ubp.value AS salesrep_bp_value,
|
||||
bpg.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpg.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpg.name AS c_greeting_name,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcg.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcg.c_greeting_id AS c_user_greeting_c_greeting_id,
|
||||
bpcg.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfnameonly,
|
||||
bpcg.name AS c_user_greeting_name,
|
||||
bpl.ad_org_id AS c_bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS c_bp_location_c_bpartner_id,
|
||||
bpl.created AS c_bp_location_created,
|
||||
bpl.createdby AS c_bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bp_location_fax,
|
||||
bpl.isactive AS c_bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bp_location_name,
|
||||
bpl.phone AS c_bp_location_phone,
|
||||
bpl.phone2 AS c_bp_location_phone2,
|
||||
bpl.updated AS c_bp_location_updated,
|
||||
bpl.updatedby AS c_bp_location_updatedby,
|
||||
pt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.c_paymentterm_id AS c_paymentterm_c_paymentterm_id,
|
||||
pt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
pt.isactive AS c_paymentterm_isactive,
|
||||
pt.isdefault,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS c_paymentterm_value
|
||||
FROM c_project p
|
||||
LEFT JOIN c_bpartner bp
|
||||
ON p.c_bpartner_id = bp.c_bpartner_id
|
||||
JOIN ad_orginfo oi
|
||||
ON p.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON p.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN c_projecttype pjt
|
||||
ON p.c_projecttype_id = pjt.c_projecttype_id
|
||||
LEFT JOIN c_phase pjp
|
||||
ON p.c_phase_id = pjp.c_phase_id
|
||||
LEFT JOIN ad_user u
|
||||
ON p.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON p.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
LEFT JOIN c_bpartner_location bpl
|
||||
ON p.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
LEFT JOIN c_paymentterm pt
|
||||
ON p.c_paymentterm_id = pt.c_paymentterm_id
|
||||
;
|
||||
|
|
@ -1,348 +0,0 @@
|
|||
DROP VIEW c_project_header_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW c_project_header_vt
|
||||
AS
|
||||
SELECT p.ad_client_id,
|
||||
p.ad_org_id,
|
||||
p.isactive,
|
||||
p.created,
|
||||
p.createdby,
|
||||
p.updated,
|
||||
p.updatedby,
|
||||
ptt.ad_language,
|
||||
p.c_project_id,
|
||||
p.value,
|
||||
p.name AS projectname,
|
||||
p.description,
|
||||
p.note,
|
||||
p.issummary,
|
||||
p.projectcategory,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
p.c_projecttype_id,
|
||||
pjt.name AS projecttypename,
|
||||
p.c_phase_id,
|
||||
pjp.name AS projectphasename,
|
||||
p.salesrep_id,
|
||||
COALESCE(ubp.name, u.name) AS salesrep_name,
|
||||
p.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
bpgt.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcgt.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
bp.referenceno,
|
||||
ptt.name AS paymentterm,
|
||||
ptt.documentnote AS paymenttermnote,
|
||||
p.poreference,
|
||||
p.c_currency_id,
|
||||
p.m_pricelist_version_id,
|
||||
p.c_campaign_id,
|
||||
p.plannedamt,
|
||||
p.plannedqty,
|
||||
p.plannedmarginamt,
|
||||
p.invoicedamt,
|
||||
p.invoicedqty,
|
||||
p.projectbalanceamt,
|
||||
p.iscommitment,
|
||||
p.committedamt,
|
||||
p.committedqty,
|
||||
p.datecontract,
|
||||
p.datefinish,
|
||||
p.iscommitceiling,
|
||||
p.m_warehouse_id,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
p.ad_user_id,
|
||||
p.c_bpartner_location_id,
|
||||
p.copyfrom,
|
||||
p.c_paymentterm_id AS c_project_c_paymentterm_id,
|
||||
p.generateto,
|
||||
p.processed AS c_project_processed,
|
||||
p.processing AS c_project_processing,
|
||||
p.projectlinelevel,
|
||||
p.projinvoicerule,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.istaxexempt AS c_bp_istaxexempt,
|
||||
bp.isvendor AS c_bp_isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.numberemployees AS c_bp_numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
bp.poreference AS c_bp_poreference,
|
||||
bp.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume AS c_bp_salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer AS c_bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bp_so_creditlimit,
|
||||
bp.socreditstatus AS c_bp_socreditstatus,
|
||||
bp.so_creditused AS c_bp_so_creditused,
|
||||
bp.so_description AS c_bp_so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id AS ad_orginfo_m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
pjt.ad_org_id AS c_projecttype_ad_org_id,
|
||||
pjt.description AS c_projecttype_description,
|
||||
pjt.help AS c_projecttype_help,
|
||||
pjt.isactive AS c_projecttype_isactive,
|
||||
pjt.projectcategory AS c_projecttype_projectcategory,
|
||||
pjp.ad_org_id AS c_phase_ad_org_id,
|
||||
pjp.c_phase_id AS c_phase_c_phase_id,
|
||||
pjp.c_projecttype_id AS c_phase_c_projecttype_id,
|
||||
pjp.description AS c_phase_description,
|
||||
pjp.help AS c_phase_help,
|
||||
pjp.isactive AS c_phase_isactive,
|
||||
pjp.m_product_id AS c_phase_m_product_id,
|
||||
pjp.seqno AS c_phase_seqno,
|
||||
pjp.standardqty,
|
||||
u.ad_org_id AS salesrep_ad_org_id,
|
||||
u.ad_orgtrx_id AS salesrep_ad_orgtrx_id,
|
||||
u.birthday AS salesrep_ad_birthday,
|
||||
u.c_bpartner_id AS salesrep_c_bpartner_id,
|
||||
u.c_bpartner_location_id AS salesrep_c_bp_location_id,
|
||||
u.c_greeting_id AS salesrep_c_greeting_id,
|
||||
u.comments AS salesrep_comments,
|
||||
u.created AS salesrep_created,
|
||||
u.createdby AS salesrep_createdby,
|
||||
u.description AS salesrep_description,
|
||||
u.email AS salesrep_email,
|
||||
u.fax AS salesrep_fax,
|
||||
u.isactive AS salesrep_isactive,
|
||||
u.lastcontact AS salesrep_lastcontact,
|
||||
u.lastresult AS salesrep_lastresult,
|
||||
u.phone AS salesrep_phone,
|
||||
u.phone2 AS salesrep_phone2,
|
||||
u.supervisor_id AS salesrep_supervisor_id,
|
||||
u.title AS salesrep_title,
|
||||
u.updated AS salesrep_updated,
|
||||
u.updatedby AS salesrep_updatedby,
|
||||
u.value AS salesrep_value,
|
||||
ubp.acqusitioncost AS salesrep_bp_acqusitioncost,
|
||||
ubp.actuallifetimevalue AS salesrep_bp_actuallifevalue,
|
||||
ubp.ad_language AS salesrep_bp_ad_language,
|
||||
ubp.ad_orgbp_id AS salesrep_bp_ad_orgbp_id,
|
||||
ubp.ad_org_id AS salesrep_bp_ad_org_id,
|
||||
ubp.bpartner_parent_id AS salesrep_bp_bpartner_parent_id,
|
||||
ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id,
|
||||
ubp.c_dunning_id AS salesrep_bp_c_dunning_id,
|
||||
ubp.c_greeting_id AS salesrep_bp_c_greeting_id,
|
||||
ubp.c_invoiceschedule_id AS salesrep_bp_c_invoicesched_id,
|
||||
ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id,
|
||||
ubp.created AS salesrep_bp_created,
|
||||
ubp.createdby AS salesrep_bp_createdby,
|
||||
ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id,
|
||||
ubp.deliveryrule AS salesrep_bp_deliveryrule,
|
||||
ubp.deliveryviarule AS salesrep_bp_deliveryviarule,
|
||||
ubp.description AS salesrep_bp_description,
|
||||
ubp.dunninggrace AS salesrep_bp_dunninggrace,
|
||||
ubp.duns AS salesrep_bp_duns,
|
||||
ubp.firstsale AS salesrep_bp_firstsale,
|
||||
ubp.flatdiscount AS salesrep_bp_flatdiscount,
|
||||
ubp.freightcostrule AS salesrep_bp_freightcostrule,
|
||||
ubp.invoicerule AS salesrep_bp_invoicerule,
|
||||
ubp.isactive AS salesrep_bp_isactive,
|
||||
ubp.iscustomer AS salesrep_bp_iscustomer,
|
||||
ubp.isdiscountprinted AS salesrep_bp_isdiscountprinted,
|
||||
ubp.isemployee AS salesrep_bp_isemployee,
|
||||
ubp.ismanufacturer AS salesrep_bp_ismanufacturer,
|
||||
ubp.isonetime AS salesrep_bp_isonetime,
|
||||
ubp.ispotaxexempt AS salesrep_bp_ispotaxexempt,
|
||||
ubp.isprospect AS salesrep_bp_isprospect,
|
||||
ubp.issalesrep AS salesrep_bp_issalesrep,
|
||||
ubp.issummary AS salesrep_bp_issummary,
|
||||
ubp.istaxexempt AS salesrep_bp_istaxexempt,
|
||||
ubp.isvendor AS salesrep_bp_isvendor,
|
||||
ubp.logo_id AS salesrep_bp_logo_id,
|
||||
ubp.m_discountschema_id AS salesrep_bp_m_discountschm_id,
|
||||
ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id,
|
||||
ubp.naics AS salesrep_bp_naics,
|
||||
ubp.name2 AS salesrep_bp_name2,
|
||||
ubp.numberemployees AS salesrep_bp_numberemployees,
|
||||
ubp.paymentrule AS salesrep_bp_paymentrule,
|
||||
ubp.paymentrulepo AS salesrep_bp_paymentrulepo,
|
||||
ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id,
|
||||
ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id,
|
||||
ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id,
|
||||
ubp.poreference AS salesrep_bp_poreference,
|
||||
ubp.potentiallifetimevalue AS salesrep_bp_potentiallifevalue,
|
||||
ubp.rating AS salesrep_bp_rating,
|
||||
ubp.referenceno AS salesrep_bp_referenceno,
|
||||
ubp.salesrep_id AS salesrep_bp_salesrep_id,
|
||||
ubp.salesvolume AS salesrep_bp_salesvolume,
|
||||
ubp.sendemail AS salesrep_bp_sendemail,
|
||||
ubp.shareofcustomer AS salesrep_bp_shareofcustomer,
|
||||
ubp.shelflifeminpct AS salesrep_bp_shelflifeminpct,
|
||||
ubp.so_creditlimit AS salesrep_bp_so_creditlimit,
|
||||
ubp.socreditstatus AS salesrep_bp_socreditstatus,
|
||||
ubp.so_creditused AS salesrep_bp_so_creditused,
|
||||
ubp.so_description AS salesrep_bp_so_description,
|
||||
ubp.taxid AS salesrep_bp_taxid,
|
||||
ubp.totalopenbalance AS salesrep_bp_totalopenbalance,
|
||||
ubp.updated AS salesrep_bp_updated,
|
||||
ubp.updatedby AS salesrep_bp_updatedby,
|
||||
ubp.url AS salesrep_bp_url,
|
||||
ubp.value AS salesrep_bp_value,
|
||||
bpgt.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpgt.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpgt.name AS c_greeting_name,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcgt.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcgt.c_greeting_id AS c_user_greeting_c_greeting_id,
|
||||
bpcgt.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfnameonly,
|
||||
bpcgt.name AS c_user_greeting_name,
|
||||
bpl.ad_org_id AS c_bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS c_bp_location_c_bpartner_id,
|
||||
bpl.created AS c_bp_location_created,
|
||||
bpl.createdby AS c_bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bp_location_fax,
|
||||
bpl.isactive AS c_bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bp_location_name,
|
||||
bpl.phone AS c_bp_location_phone,
|
||||
bpl.phone2 AS c_bp_location_phone2,
|
||||
bpl.updated AS c_bp_location_updated,
|
||||
bpl.updatedby AS c_bp_location_updatedby,
|
||||
ptt.ad_org_id AS c_paymentterm_ad_org_id,
|
||||
pt.afterdelivery,
|
||||
pt.c_paymentterm_id AS c_paymentterm_c_paymentterm_id,
|
||||
ptt.description AS c_paymentterm_description,
|
||||
pt.discount,
|
||||
pt.discount2,
|
||||
pt.discountdays,
|
||||
pt.discountdays2,
|
||||
pt.fixmonthcutoff,
|
||||
pt.fixmonthday,
|
||||
pt.fixmonthoffset,
|
||||
pt.gracedays,
|
||||
ptt.isactive AS c_paymentterm_isactive,
|
||||
pt.isdefault,
|
||||
pt.isduefixed,
|
||||
pt.isnextbusinessday,
|
||||
pt.isvalid,
|
||||
pt.netday,
|
||||
pt.netdays,
|
||||
pt.paymenttermusage,
|
||||
pt.value AS c_paymentterm_value
|
||||
FROM c_project p
|
||||
LEFT JOIN c_bpartner bp
|
||||
ON p.c_bpartner_id = bp.c_bpartner_id
|
||||
JOIN ad_orginfo oi
|
||||
ON p.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON p.ad_client_id = ci.ad_client_id
|
||||
LEFT JOIN c_paymentterm pt
|
||||
ON p.c_paymentterm_id = pt.c_paymentterm_id
|
||||
LEFT JOIN c_paymentterm_trl ptt
|
||||
ON p.c_paymentterm_id = ptt.c_paymentterm_id
|
||||
LEFT JOIN c_projecttype pjt
|
||||
ON p.c_projecttype_id = pjt.c_projecttype_id
|
||||
LEFT JOIN c_phase pjp
|
||||
ON p.c_phase_id = pjp.c_phase_id
|
||||
LEFT JOIN ad_user u
|
||||
ON p.salesrep_id = u.ad_user_id
|
||||
LEFT JOIN c_bpartner ubp
|
||||
ON u.c_bpartner_id = ubp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpgt
|
||||
ON bp.c_greeting_id = bpgt.c_greeting_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON p.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpcgt
|
||||
ON bpc.c_greeting_id = bpcgt.c_greeting_id
|
||||
LEFT JOIN c_bpartner_location bpl
|
||||
ON p.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_RFQRESPONSELINEQTY_V
|
||||
(C_RFQRESPONSELINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID, AD_CLIENT_ID, AD_ORG_ID,
|
||||
ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY,
|
||||
AD_LANGUAGE, C_UOM_ID, UOMSYMBOL, QTY, PRICE,
|
||||
DISCOUNT)
|
||||
AS
|
||||
SELECT rq.C_RfQResponseLine_ID, rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID,
|
||||
rq.AD_Client_ID, rq.AD_Org_ID, rq.IsActive, rq.Created, rq.CreatedBy, rq.Updated, rq.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
q.C_UOM_ID, uom.UOMSymbol,
|
||||
q.Qty, rq.Price, rq.Discount
|
||||
FROM C_RfQResponseLineQty rq
|
||||
INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID)
|
||||
INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID)
|
||||
WHERE rq.IsActive='Y' AND q.IsActive='Y';
|
||||
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_RFQRESPONSELINEQTY_VT
|
||||
(C_RFQRESPONSELINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID, AD_CLIENT_ID, AD_ORG_ID,
|
||||
ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY,
|
||||
AD_LANGUAGE, C_UOM_ID, UOMSYMBOL, QTY, PRICE,
|
||||
DISCOUNT)
|
||||
AS
|
||||
SELECT rq.C_RfQResponseLine_ID, rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID,
|
||||
rq.AD_Client_ID, rq.AD_Org_ID, rq.IsActive, rq.Created, rq.CreatedBy, rq.Updated, rq.UpdatedBy,
|
||||
l.AD_Language,
|
||||
q.C_UOM_ID, uom.UOMSymbol,
|
||||
q.Qty, rq.Price, rq.Discount
|
||||
FROM C_RfQResponseLineQty rq
|
||||
INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID)
|
||||
INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID)
|
||||
INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y')
|
||||
WHERE rq.IsActive='Y' AND q.IsActive='Y';
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_RFQRESPONSELINE_V
|
||||
(C_RFQRESPONSE_ID, C_RFQRESPONSELINE_ID, C_RFQLINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID,
|
||||
AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, LINE, M_PRODUCT_ID,
|
||||
M_ATTRIBUTESETINSTANCE_ID, NAME, DESCRIPTION, DOCUMENTNOTE, UPC,
|
||||
SKU, PRODUCTVALUE, HELP, DATEWORKSTART, DELIVERYDAYS,
|
||||
C_UOM_ID, UOMSYMBOL, BENCHMARKPRICE, QTY, PRICE,
|
||||
DISCOUNT)
|
||||
AS
|
||||
SELECT rrl.C_RfQResponse_ID, rrl.C_RfQResponseLine_ID, rrl.C_RfQLine_ID,
|
||||
rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID,
|
||||
rrl.AD_Client_ID, rrl.AD_Org_ID, rrl.IsActive, rrl.Created, rrl.CreatedBy, rrl.Updated, rrl.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
rl.Line,
|
||||
rl.M_Product_ID, rl.M_AttributeSetInstance_ID,
|
||||
COALESCE(p.Name||productAttribute(rl.M_AttributeSetInstance_ID), rl.Description) AS Name, -- main line
|
||||
CASE WHEN p.Name IS NOT NULL THEN rl.Description END AS Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
rl.Help,
|
||||
rl.DateWorkStart, rl.DeliveryDays,
|
||||
q.C_UOM_ID, uom.UOMSymbol, q.BenchmarkPrice,
|
||||
q.Qty, rq.Price, rq.Discount
|
||||
FROM C_RfQResponseLineQty rq
|
||||
INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID)
|
||||
INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID)
|
||||
INNER JOIN C_RfQResponseLine rrl ON (rq.C_RfQResponseLine_ID=rrl.C_RfQResponseLine_ID)
|
||||
INNER JOIN C_RfQLine rl ON (rrl.C_RfQLine_ID=rl.C_RfQLine_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (rl.M_Product_ID=p.M_Product_ID)
|
||||
WHERE rq.IsActive='Y' AND q.IsActive='Y'
|
||||
AND rrl.IsActive='Y' AND rl.IsActive='Y';
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_RFQRESPONSELINE_VT
|
||||
(C_RFQRESPONSE_ID, C_RFQRESPONSELINE_ID, C_RFQLINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID,
|
||||
AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, LINE, M_PRODUCT_ID,
|
||||
M_ATTRIBUTESETINSTANCE_ID, NAME, DESCRIPTION, DOCUMENTNOTE, UPC,
|
||||
SKU, PRODUCTVALUE, HELP, DATEWORKSTART, DELIVERYDAYS,
|
||||
C_UOM_ID, UOMSYMBOL, QTY, PRICE, DISCOUNT)
|
||||
AS
|
||||
SELECT rrl.C_RfQResponse_ID, rrl.C_RfQResponseLine_ID, rrl.C_RfQLine_ID,
|
||||
rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID,
|
||||
rrl.AD_Client_ID, rrl.AD_Org_ID, rrl.IsActive, rrl.Created, rrl.CreatedBy, rrl.Updated, rrl.UpdatedBy,
|
||||
l.AD_Language,
|
||||
rl.Line,
|
||||
rl.M_Product_ID, rl.M_AttributeSetInstance_ID,
|
||||
COALESCE(p.Name||productAttribute(rl.M_AttributeSetInstance_ID), rl.Description) AS Name, -- main line
|
||||
CASE WHEN p.Name IS NOT NULL THEN rl.Description END AS Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
rl.Help,
|
||||
rl.DateWorkStart, rl.DeliveryDays,
|
||||
q.C_UOM_ID, uom.UOMSymbol,
|
||||
q.Qty, rq.Price, rq.Discount
|
||||
FROM C_RfQResponseLineQty rq
|
||||
INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID)
|
||||
INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID)
|
||||
INNER JOIN C_RfQResponseLine rrl ON (rq.C_RfQResponseLine_ID=rrl.C_RfQResponseLine_ID)
|
||||
INNER JOIN C_RfQLine rl ON (rrl.C_RfQLine_ID=rl.C_RfQLine_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (rl.M_Product_ID=p.M_Product_ID)
|
||||
INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y')
|
||||
WHERE rq.IsActive='Y' AND q.IsActive='Y'
|
||||
AND rrl.IsActive='Y' AND rl.IsActive='Y';
|
||||
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_RFQRESPONSE_V
|
||||
(C_RFQRESPONSE_ID, C_RFQ_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
|
||||
CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE,
|
||||
ORG_LOCATION_ID, TAXID, NAME, DESCRIPTION, HELP,
|
||||
C_CURRENCY_ID, ISO_CODE, DATERESPONSE, DATEWORKSTART, DELIVERYDAYS,
|
||||
C_BPARTNER_ID, BPNAME, BPNAME2, C_BPARTNER_LOCATION_ID, C_LOCATION_ID,
|
||||
AD_USER_ID, TITLE, PHONE, CONTACTNAME)
|
||||
AS
|
||||
SELECT rr.C_RfQResponse_ID, rr.C_RfQ_ID,
|
||||
rr.AD_Client_ID, rr.AD_Org_ID, rr.IsActive, rr.Created, rr.CreatedBy, rr.Updated, rr.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
r.Name, r.Description, r.Help,
|
||||
r.C_Currency_ID, c.ISO_Code,
|
||||
r.DateResponse, r.DateWorkStart, r.DeliveryDays,
|
||||
rr.C_BPartner_ID, bp.Name AS BPName, bp.Name2 AS BPName2,
|
||||
rr.C_BPartner_Location_ID, bpl.C_Location_ID,
|
||||
rr.AD_User_ID, bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName
|
||||
FROM C_RfQResponse rr
|
||||
INNER JOIN C_RfQ r ON (rr.C_RfQ_ID=r.C_RfQ_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (rr.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN C_Currency c ON (r.C_Currency_ID=c.C_Currency_ID)
|
||||
INNER JOIN C_BPartner bp ON (rr.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (rr.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (rr.AD_User_ID=bpc.AD_User_ID);
|
||||
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
CREATE OR REPLACE VIEW C_RFQRESPONSE_VT
|
||||
(C_RFQRESPONSE_ID, C_RFQ_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
|
||||
CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE,
|
||||
ORG_LOCATION_ID, TAXID, NAME, DESCRIPTION, HELP,
|
||||
C_CURRENCY_ID, ISO_CODE, DATERESPONSE, DATEWORKSTART, DELIVERYDAYS,
|
||||
C_BPARTNER_ID, BPNAME, BPNAME2, C_BPARTNER_LOCATION_ID, C_LOCATION_ID,
|
||||
AD_USER_ID, TITLE, PHONE, CONTACTNAME)
|
||||
AS
|
||||
SELECT rr.C_RfQResponse_ID, rr.C_RfQ_ID,
|
||||
rr.AD_Client_ID, rr.AD_Org_ID, rr.IsActive, rr.Created, rr.CreatedBy, rr.Updated, rr.UpdatedBy,
|
||||
l.AD_Language,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
r.Name, r.Description, r.Help,
|
||||
r.C_Currency_ID, c.ISO_Code,
|
||||
r.DateResponse, r.DateWorkStart, r.DeliveryDays,
|
||||
rr.C_BPartner_ID, bp.Name AS BPName, bp.Name2 AS BPName2,
|
||||
rr.C_BPartner_Location_ID, bpl.C_Location_ID,
|
||||
rr.AD_User_ID, bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName
|
||||
FROM C_RfQResponse rr
|
||||
INNER JOIN C_RfQ r ON (rr.C_RfQ_ID=r.C_RfQ_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (rr.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN C_Currency c ON (r.C_Currency_ID=c.C_Currency_ID)
|
||||
INNER JOIN C_BPartner bp ON (rr.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (rr.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (rr.AD_User_ID=bpc.AD_User_ID)
|
||||
INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y');
|
||||
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
CREATE OR REPLACE VIEW DD_ORDER_HEADER_V
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID,
|
||||
o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote,
|
||||
o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name,
|
||||
o.DateOrdered, o.DatePromised,
|
||||
bpg.Greeting AS BPGreeting,
|
||||
bp.Name, bp.Name2,
|
||||
bpcg.Greeting AS BPContactGreeting,
|
||||
bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName,
|
||||
bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal,
|
||||
bp.ReferenceNo,
|
||||
o.Description,
|
||||
o.POReference,
|
||||
o.C_Charge_ID, o.ChargeAmt,
|
||||
o.Volume, o.Weight,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID,
|
||||
o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM DD_Order o
|
||||
INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID)
|
||||
LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID);
|
|
@ -1,41 +0,0 @@
|
|||
CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
dt.AD_Language,o.DD_Order_ID,
|
||||
o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID,
|
||||
o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote,
|
||||
o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name,
|
||||
o.DateOrdered, o.DatePromised,
|
||||
bpg.Greeting AS BPGreeting,
|
||||
bp.Name, bp.Name2,
|
||||
bpcg.Greeting AS BPContactGreeting,
|
||||
bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName,
|
||||
bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal,
|
||||
bp.ReferenceNo,
|
||||
o.Description,
|
||||
o.POReference,
|
||||
o.C_Charge_ID, o.ChargeAmt,
|
||||
o.Volume, o.Weight,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID,
|
||||
o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM DD_Order o
|
||||
INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language)
|
||||
INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID)
|
||||
LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID);
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW fact_acct_balance
|
||||
AS
|
||||
SELECT ad_client_id, ad_org_id, c_acctschema_id,
|
||||
TRUNC (dateacct) as dateacct, account_id, postingtype,
|
||||
m_product_id, c_bpartner_id, c_project_id, ad_orgtrx_id,
|
||||
c_salesregion_id, c_activity_id, c_campaign_id, c_locto_id,
|
||||
c_locfrom_id, user1_id, user2_id, gl_budget_id,
|
||||
COALESCE (SUM (amtacctdr), 0) as amtacctdr,
|
||||
COALESCE (SUM (amtacctcr), 0) as amtacctcr,
|
||||
COALESCE (SUM (qty), 0) as qty, MAX (createdby) as createdby,
|
||||
MAX (created) as created, MAX (updatedby) as updatedby,
|
||||
MAX (updated) as updated, MAX (isactive) as isactive,
|
||||
MAX (c_subacct_id) as c_subacct_id, userelement1_id,
|
||||
userelement2_id, MAX (c_projectphase_id) as c_projectphase_id,
|
||||
MAX (c_projecttask_id) as c_projecttask_id
|
||||
FROM fact_acct a
|
||||
GROUP BY ad_client_id, ad_org_id, c_acctschema_id,
|
||||
TRUNC (dateacct), account_id, postingtype,
|
||||
m_product_id, c_bpartner_id, c_project_id, ad_orgtrx_id,
|
||||
c_salesregion_id, c_activity_id, c_campaign_id, c_locto_id,
|
||||
c_locfrom_id, user1_id, user2_id,
|
||||
userelement1_id, userelement2_id,
|
||||
gl_budget_id
|
||||
;
|
|
@ -1,26 +0,0 @@
|
|||
CREATE OR REPLACE VIEW GL_JOURNALLINE_ACCT_V
|
||||
(GL_JOURNALLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED,
|
||||
CREATEDBY, UPDATED, UPDATEDBY, GL_JOURNAL_ID, LINE,
|
||||
ISGENERATED, DESCRIPTION, AMTSOURCEDR, AMTSOURCECR, C_CURRENCY_ID,
|
||||
C_CONVERSIONTYPE_ID, CURRENCYRATE, DATEACCT, AMTACCTDR, AMTACCTCR,
|
||||
C_UOM_ID, QTY, C_VALIDCOMBINATION_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID,
|
||||
M_PRODUCT_ID, C_BPARTNER_ID, AD_ORGTRX_ID, C_LOCFROM_ID, C_LOCTO_ID,
|
||||
C_SALESREGION_ID, C_PROJECT_ID, C_CAMPAIGN_ID, USER1_ID, USER2_ID,
|
||||
ISFULLYQUALIFIED, C_ACTIVITY_ID)
|
||||
AS
|
||||
SELECT
|
||||
gl.GL_JournalLine_ID, gl.AD_Client_ID, gl.AD_Org_ID, gl.IsActive,
|
||||
gl.Created, gl.CreatedBy, gl.Updated, gl.UpdatedBy, gl.GL_Journal_ID,
|
||||
gl.Line, gl.IsGenerated, gl.Description,
|
||||
gl.AmtSourceDr, gl.AmtSourceCr, gl.C_Currency_ID,
|
||||
gl.C_ConversionType_ID, gl.CurrencyRate, gl.DateAcct,
|
||||
gl.AmtAcctDr, gl.AmtAcctCr, gl.C_UOM_ID, gl.Qty, gl.C_ValidCombination_ID,
|
||||
vc.C_AcctSchema_ID, vc.Account_ID, vc.M_Product_ID, vc.C_BPartner_ID,
|
||||
vc.AD_OrgTrx_ID, vc.C_LocFrom_ID, vc.C_LocTo_ID, vc.C_SalesRegion_ID,
|
||||
vc.C_Project_ID, vc.C_Campaign_ID, vc.User1_ID, vc.User2_ID,
|
||||
vc.IsFullyQualified, vc.C_Activity_ID
|
||||
FROM GL_JournalLine gl, C_ValidCombination vc
|
||||
WHERE gl.C_ValidCombination_ID = vc.C_ValidCombination_ID;
|
||||
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
CREATE OR REPLACE VIEW m_costmovement_v AS
|
||||
SELECT a.ad_client_id, a.ad_org_id, b.c_acctschema_id, a.m_costhistory_id, a.m_costtype_id, a.m_costelement_id, a.m_attributesetinstance_id,
|
||||
b.m_product_id, a.oldqty, a.newqty, a.oldcostprice, a.newcostprice, a.oldcqty, a.newcqty, a.oldcamt, a.newcamt, b.qty, b.amt, b.deltaqty,
|
||||
b.deltaamt, b.c_orderline_id, b.m_inoutline_id, b.c_invoiceline_id, b.m_movementline_id, b.m_inventoryline_id, b.m_productionline_id,
|
||||
b.c_projectissue_id, b.m_matchinv_id, a.m_costdetail_id, b.description, a.created, a.createdby, a.updated, a.updatedby, a.isactive
|
||||
FROM m_costhistory a
|
||||
JOIN m_costdetail b ON a.m_costdetail_id = b.m_costdetail_id
|
||||
ORDER BY a.m_costhistory_id
|
||||
;
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUTCONFIRM_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTCONFIRM_ID, DOCUMENTNO,
|
||||
CONFIRMTYPE, ISAPPROVED, ISCANCELLED, DESCRIPTION, M_INOUT_ID,
|
||||
SHIPDESCRIPTION, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, SALESREP_ID,
|
||||
C_DOCTYPE_ID, DOCUMENTTYPE, C_ORDER_ID, DATEORDERED, MOVEMENTDATE,
|
||||
MOVEMENTTYPE, M_WAREHOUSE_ID, POREFERENCE, DELIVERYRULE, FREIGHTCOSTRULE,
|
||||
DELIVERYVIARULE, M_SHIPPER_ID, PRIORITYRULE, PROCESSED)
|
||||
AS
|
||||
SELECT ioc.AD_Client_ID, ioc.AD_Org_ID, ioc.IsActive, ioc.Created, ioc.CreatedBy, ioc.Updated, ioc.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
ioc.M_InOutConfirm_ID,
|
||||
ioc.DocumentNo, ioc.ConfirmType,
|
||||
ioc.IsApproved, ioc.IsCancelled, ioc.Description,
|
||||
--
|
||||
io.M_InOut_ID, io.Description AS ShipDescription,
|
||||
io.C_BPartner_ID, io.C_BPartner_Location_ID, io.AD_User_ID,
|
||||
io.SalesRep_ID, io.C_DocType_ID, dt.PrintName AS DocumentType,
|
||||
io.C_Order_ID, io.DateOrdered, io.MovementDate, io.MovementType,
|
||||
io.M_Warehouse_ID, io.POReference,
|
||||
io.DeliveryRule, io.FreightCostRule,
|
||||
io.DeliveryViaRule, io.M_Shipper_ID, PriorityRule,
|
||||
ioc.Processed
|
||||
FROM M_InOutConfirm ioc
|
||||
INNER JOIN M_InOut io ON (ioc.M_InOut_ID=io.M_InOut_ID)
|
||||
INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID);
|
||||
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUTCONFIRM_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTCONFIRM_ID, DOCUMENTNO,
|
||||
CONFIRMTYPE, ISAPPROVED, ISCANCELLED, DESCRIPTION, M_INOUT_ID,
|
||||
SHIPDESCRIPTION, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, SALESREP_ID,
|
||||
C_DOCTYPE_ID, DOCUMENTTYPE, C_ORDER_ID, DATEORDERED, MOVEMENTDATE,
|
||||
MOVEMENTTYPE, M_WAREHOUSE_ID, POREFERENCE, DELIVERYRULE, FREIGHTCOSTRULE,
|
||||
DELIVERYVIARULE, M_SHIPPER_ID, PRIORITYRULE, PROCESSED)
|
||||
AS
|
||||
SELECT ioc.AD_Client_ID, ioc.AD_Org_ID, ioc.IsActive, ioc.Created, ioc.CreatedBy, ioc.Updated, ioc.UpdatedBy,
|
||||
dt.AD_Language,
|
||||
ioc.M_InOutConfirm_ID,
|
||||
ioc.DocumentNo, ioc.ConfirmType,
|
||||
ioc.IsApproved, ioc.IsCancelled, ioc.Description,
|
||||
--
|
||||
io.M_InOut_ID, io.Description AS ShipDescription,
|
||||
io.C_BPartner_ID, io.C_BPartner_Location_ID, io.AD_User_ID,
|
||||
io.SalesRep_ID, io.C_DocType_ID, dt.PrintName AS DocumentType,
|
||||
io.C_Order_ID, io.DateOrdered, io.MovementDate, io.MovementType,
|
||||
io.M_Warehouse_ID, io.POReference,
|
||||
io.DeliveryRule, io.FreightCostRule,
|
||||
io.DeliveryViaRule, io.M_Shipper_ID, PriorityRule,
|
||||
ioc.Processed
|
||||
FROM M_InOutConfirm ioc
|
||||
INNER JOIN M_InOut io ON (ioc.M_InOut_ID=io.M_InOut_ID)
|
||||
INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID);
|
||||
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUTLINEMA_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, M_INOUT_ID, M_INOUTLINE_ID, LINE,
|
||||
M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID)
|
||||
AS
|
||||
SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy,
|
||||
l.M_InOut_ID, m.M_InOutLine_ID, l.Line, l.M_Product_ID,
|
||||
m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID
|
||||
FROM M_InOutLineMA m INNER JOIN M_InOutLine l ON (m.M_InOutLine_ID=l.M_InOutLine_ID)
|
||||
UNION
|
||||
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||||
M_InOut_ID, M_InOutLine_ID, Line, M_Product_ID,
|
||||
M_AttributeSetInstance_ID, MovementQty, M_Locator_ID
|
||||
FROM M_InOutLine;
|
||||
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUTLINEMA_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, M_INOUT_ID, M_INOUTLINE_ID, LINE,
|
||||
M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID)
|
||||
AS
|
||||
SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy,
|
||||
l.M_InOut_ID, m.M_InOutLine_ID, l.Line, l.M_Product_ID,
|
||||
m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID
|
||||
FROM M_InOutLineMA m INNER JOIN M_InOutLine l ON (m.M_InOutLine_ID=l.M_InOutLine_ID)
|
||||
UNION
|
||||
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||||
M_InOut_ID, M_InOutLine_ID, Line, M_Product_ID,
|
||||
M_AttributeSetInstance_ID, MovementQty, M_Locator_ID
|
||||
FROM M_InOutLine;
|
||||
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUT_CANDIDATE_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_ORDER_ID, DOCUMENTNO,
|
||||
DATEORDERED, C_DOCTYPE_ID, POREFERENCE, DESCRIPTION, SALESREP_ID,
|
||||
M_WAREHOUSE_ID, TOTALLINES)
|
||||
AS
|
||||
SELECT
|
||||
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||||
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||||
o.POReference, o.Description, o.SalesRep_ID,
|
||||
l.M_Warehouse_ID,
|
||||
SUM((l.QtyOrdered-l.QtyDelivered)*l.PriceActual) AS TotalLines
|
||||
FROM C_Order o
|
||||
INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
|
||||
WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL/RE
|
||||
-- not Offers and open Walkin-Receipts
|
||||
AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
|
||||
WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))
|
||||
-- Delivery Rule - not manual
|
||||
AND o.DeliveryRule<>'M'
|
||||
AND (l.M_Product_ID IS NULL OR EXISTS
|
||||
(SELECT * FROM M_Product p
|
||||
WHERE l.M_Product_ID=p.M_Product_ID AND p.IsExcludeAutoDelivery='N'))
|
||||
-- we need to ship
|
||||
AND l.QtyOrdered <> l.QtyDelivered
|
||||
AND (l.M_Product_ID IS NOT NULL OR l.C_Charge_ID IS NOT NULL)
|
||||
-- Not confirmed shipment
|
||||
AND NOT EXISTS (SELECT * FROM M_InOutLine iol
|
||||
INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)
|
||||
WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('DR','IN','IP','WC'))
|
||||
--
|
||||
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||||
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||||
o.POReference, o.Description, o.SalesRep_ID, l.M_Warehouse_ID;
|
||||
|
||||
|
||||
|
|
@ -1,264 +0,0 @@
|
|||
DROP VIEW m_inout_header_v;
|
||||
|
||||
CREATE OR REPLACE VIEW m_inout_header_v
|
||||
AS
|
||||
SELECT io.ad_client_id,
|
||||
io.ad_org_id,
|
||||
io.isactive,
|
||||
io.created,
|
||||
io.createdby,
|
||||
io.updated,
|
||||
io.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
io.m_inout_id,
|
||||
io.issotrx,
|
||||
io.documentno,
|
||||
io.docstatus,
|
||||
io.c_doctype_id,
|
||||
io.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
io.m_warehouse_id,
|
||||
wh.c_location_id AS warehouse_location_id,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
io.c_order_id,
|
||||
io.movementdate,
|
||||
io.movementtype,
|
||||
bpg.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcg.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
bp.referenceno,
|
||||
io.description,
|
||||
io.poreference,
|
||||
io.dateordered,
|
||||
io.volume,
|
||||
io.weight,
|
||||
io.m_shipper_id,
|
||||
io.deliveryrule,
|
||||
io.deliveryviarule,
|
||||
io.priorityrule,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
io.ad_orgtrx_id,
|
||||
io.ad_user_id,
|
||||
io.c_activity_id,
|
||||
io.c_bpartner_location_id,
|
||||
io.c_campaign_id,
|
||||
io.c_charge_id,
|
||||
io.chargeamt,
|
||||
io.c_invoice_id,
|
||||
io.c_project_id,
|
||||
io.createconfirm,
|
||||
io.createfrom,
|
||||
io.createpackage,
|
||||
io.dateacct,
|
||||
io.dateprinted,
|
||||
io.datereceived,
|
||||
io.docaction,
|
||||
io.dropship_bpartner_id,
|
||||
io.dropship_location_id,
|
||||
io.dropship_user_id,
|
||||
io.freightamt,
|
||||
io.freightcostrule,
|
||||
io.generateto,
|
||||
io.isapproved,
|
||||
io.isdropship,
|
||||
io.isindispute,
|
||||
io.isintransit AS m_inout_isintransit,
|
||||
io.isprinted,
|
||||
io.m_rma_id,
|
||||
io.nopackages,
|
||||
io.pickdate,
|
||||
io.posted,
|
||||
io.processed,
|
||||
io.processedon,
|
||||
io.processing,
|
||||
io.ref_inout_id,
|
||||
io.reversal_id,
|
||||
io.salesrep_id AS m_inout_salesrep_id,
|
||||
io.sendemail,
|
||||
io.shipdate,
|
||||
io.trackingno,
|
||||
io.user1_id,
|
||||
io.user2_id,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.istaxexempt AS c_bp_istaxexempt,
|
||||
bp.isvendor AS c_bp_isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.numberemployees AS c_bp_numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
bp.poreference AS c_bp_poreference,
|
||||
bp.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume AS c_bp_salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer AS c_bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bp_so_creditlimit,
|
||||
bp.socreditstatus AS c_bp_socreditstatus,
|
||||
bp.so_creditused AS c_bp_so_creditused,
|
||||
bp.so_description AS c_bp_so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
bpg.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpg.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpg.name AS c_greeting_name,
|
||||
bpl.ad_org_id AS c_bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS c_bp_location_c_bpartner_id,
|
||||
bpl.created AS c_bp_location_created,
|
||||
bpl.createdby AS c_bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bp_location_fax,
|
||||
bpl.isactive AS c_bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bp_location_name,
|
||||
bpl.phone AS c_bp_location_phone,
|
||||
bpl.phone2 AS c_bp_location_phone2,
|
||||
bpl.updated AS c_bp_location_updated,
|
||||
bpl.updatedby AS c_bp_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcg.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcg.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfnameonly,
|
||||
bpcg.name AS c_user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id AS ad_orginfo_m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
wh.ad_org_id AS m_warehouse_ad_org_id,
|
||||
wh.description AS m_warehouse_description,
|
||||
wh.isactive AS m_warehouse__isactive,
|
||||
wh.isdisallownegativeinv,
|
||||
wh.isintransit AS m_warehouse_isintransit,
|
||||
wh.m_warehousesource_id,
|
||||
wh.name AS m_warehouse_name,
|
||||
wh.replenishmentclass,
|
||||
wh.separator,
|
||||
wh.value AS m_warehouse_value
|
||||
FROM m_inout io
|
||||
JOIN c_doctype dt
|
||||
ON io.c_doctype_id = dt.c_doctype_id
|
||||
JOIN c_bpartner bp
|
||||
ON io.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
JOIN c_bpartner_location bpl
|
||||
ON io.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON io.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
JOIN ad_orginfo oi
|
||||
ON io.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON io.ad_client_id = ci.ad_client_id
|
||||
JOIN m_warehouse wh
|
||||
ON io.m_warehouse_id = wh.m_warehouse_id
|
||||
;
|
||||
|
|
@ -1,270 +0,0 @@
|
|||
DROP VIEW m_inout_header_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW m_inout_header_vt
|
||||
AS
|
||||
SELECT io.ad_client_id,
|
||||
io.ad_org_id,
|
||||
io.isactive,
|
||||
io.created,
|
||||
io.createdby,
|
||||
io.updated,
|
||||
io.updatedby,
|
||||
dt.ad_language,
|
||||
io.m_inout_id,
|
||||
io.issotrx,
|
||||
io.documentno,
|
||||
io.docstatus,
|
||||
io.c_doctype_id,
|
||||
io.c_bpartner_id,
|
||||
bp.value AS bpvalue,
|
||||
bp.taxid AS bptaxid,
|
||||
bp.naics,
|
||||
bp.duns,
|
||||
oi.c_location_id AS org_location_id,
|
||||
oi.taxid,
|
||||
io.m_warehouse_id,
|
||||
wh.c_location_id AS warehouse_location_id,
|
||||
dt.printname AS documenttype,
|
||||
dt.documentnote AS documenttypenote,
|
||||
io.c_order_id,
|
||||
io.movementdate,
|
||||
io.movementtype,
|
||||
bpgt.greeting AS bpgreeting,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bpcgt.greeting AS bpcontactgreeting,
|
||||
bpc.title,
|
||||
bpc.phone,
|
||||
NULLIF(bpc.name, bp.name) AS contactname,
|
||||
bpl.c_location_id,
|
||||
l.postal
|
||||
|| l.postal_add AS postal,
|
||||
bp.referenceno,
|
||||
io.description,
|
||||
io.poreference,
|
||||
io.dateordered,
|
||||
io.volume,
|
||||
io.weight,
|
||||
io.m_shipper_id,
|
||||
io.deliveryrule,
|
||||
io.deliveryviarule,
|
||||
io.priorityrule,
|
||||
COALESCE(oi.logo_id, ci.logo_id) AS logo_id,
|
||||
io.ad_orgtrx_id,
|
||||
io.ad_user_id,
|
||||
io.c_activity_id,
|
||||
io.c_bpartner_location_id,
|
||||
io.c_campaign_id,
|
||||
io.c_charge_id,
|
||||
io.chargeamt,
|
||||
io.c_invoice_id,
|
||||
io.c_project_id,
|
||||
io.createconfirm,
|
||||
io.createfrom,
|
||||
io.createpackage,
|
||||
io.dateacct,
|
||||
io.dateprinted,
|
||||
io.datereceived,
|
||||
io.docaction,
|
||||
io.dropship_bpartner_id,
|
||||
io.dropship_location_id,
|
||||
io.dropship_user_id,
|
||||
io.freightamt,
|
||||
io.freightcostrule,
|
||||
io.generateto,
|
||||
io.isapproved,
|
||||
io.isdropship,
|
||||
io.isindispute,
|
||||
io.isintransit AS m_inout_isintransit,
|
||||
io.isprinted,
|
||||
io.m_rma_id,
|
||||
io.nopackages,
|
||||
io.pickdate,
|
||||
io.posted,
|
||||
io.processed,
|
||||
io.processedon,
|
||||
io.processing,
|
||||
io.ref_inout_id,
|
||||
io.reversal_id,
|
||||
io.salesrep_id AS m_inout_salesrep_id,
|
||||
io.sendemail,
|
||||
io.shipdate,
|
||||
io.trackingno,
|
||||
io.user1_id,
|
||||
io.user2_id,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.istaxexempt AS c_bp_istaxexempt,
|
||||
bp.isvendor AS c_bp_isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.numberemployees AS c_bp_numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
bp.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
bp.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
bp.poreference AS c_bp_poreference,
|
||||
bp.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume AS c_bp_salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer AS c_bp_shareofcustomer,
|
||||
bp.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
bp.so_creditlimit AS c_bp_so_creditlimit,
|
||||
bp.socreditstatus AS c_bp_socreditstatus,
|
||||
bp.so_creditused AS c_bp_so_creditused,
|
||||
bp.so_description AS c_bp_so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
bpgt.ad_org_id AS c_greeting_ad_org_id,
|
||||
bpgt.isactive AS c_greeting_isactive,
|
||||
bpg.isfirstnameonly,
|
||||
bpgt.name AS c_greeting_name,
|
||||
bpl.ad_org_id AS c_bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS c_bp_location_c_bpartner_id,
|
||||
bpl.created AS c_bp_location_created,
|
||||
bpl.createdby AS c_bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bp_location_fax,
|
||||
bpl.isactive AS c_bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bp_location_name,
|
||||
bpl.phone AS c_bp_location_phone,
|
||||
bpl.phone2 AS c_bp_location_phone2,
|
||||
bpl.updated AS c_bp_location_updated,
|
||||
bpl.updatedby AS c_bp_location_updatedby,
|
||||
l.address1,
|
||||
l.address2,
|
||||
l.address3,
|
||||
l.address4,
|
||||
l.ad_org_id AS c_location_ad_org_id,
|
||||
l.c_city_id,
|
||||
l.c_country_id,
|
||||
l.city,
|
||||
l.created AS c_location_created,
|
||||
l.createdby AS c_location_createdby,
|
||||
l.c_region_id,
|
||||
l.isactive AS c_location_isactive,
|
||||
l.regionname,
|
||||
l.updated AS c_location_updated,
|
||||
l.updatedby AS c_location_updatedby,
|
||||
bpc.ad_org_id AS ad_user_ad_org_id,
|
||||
bpc.ad_orgtrx_id AS ad_user_ad_ad_orgtrx_id,
|
||||
bpc.birthday AS ad_user_ad_birthday,
|
||||
bpc.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
bpc.c_greeting_id AS ad_user_c_greeting_id,
|
||||
bpc.comments AS ad_user_comments,
|
||||
bpc.created AS ad_user_created,
|
||||
bpc.createdby AS ad_user_createdby,
|
||||
bpc.description AS ad_user_description,
|
||||
bpc.email AS ad_user_email,
|
||||
bpc.fax AS ad_user_fax,
|
||||
bpc.isactive AS ad_user_isactive,
|
||||
bpc.lastcontact AS ad_user_lastcontact,
|
||||
bpc.lastresult AS ad_user_lastresult,
|
||||
bpc.phone2 AS ad_user_phone2,
|
||||
bpc.supervisor_id AS ad_user_supervisor_id,
|
||||
bpc.updated AS ad_user_updated,
|
||||
bpc.updatedby AS ad_user_updatedby,
|
||||
bpc.value AS ad_user_value,
|
||||
bpcgt.ad_org_id AS c_user_greeting_ad_org_id,
|
||||
bpcgt.isactive AS c_user_greeting_isactive,
|
||||
bpcg.isfirstnameonly AS c_user_greeting_isfnameonly,
|
||||
bpcgt.name AS c_user_greeting_name,
|
||||
oi.ad_org_id AS ad_orginfo_ad_org_id,
|
||||
oi.ad_orgtype_id,
|
||||
oi.c_calendar_id,
|
||||
oi.created AS ad_orginfo_created,
|
||||
oi.createdby AS ad_orginfo_createdby,
|
||||
oi.dropship_warehouse_id,
|
||||
oi.duns AS ad_orginfo_duns,
|
||||
oi.email AS ad_orginfo_email,
|
||||
oi.fax AS ad_orginfo_fax,
|
||||
oi.isactive AS ad_orginfo_isactive,
|
||||
oi.m_warehouse_id AS ad_orginfo_m_warehouse_id,
|
||||
oi.parent_org_id,
|
||||
oi.phone AS ad_orginfo_phone,
|
||||
oi.phone2 AS ad_orginfo_phone2,
|
||||
oi.receiptfootermsg,
|
||||
oi.supervisor_id,
|
||||
oi.updated AS ad_orginfo_updated,
|
||||
oi.updatedby AS ad_orginfo_updatedby,
|
||||
wh.ad_org_id AS m_warehouse_ad_org_id,
|
||||
wh.description AS m_warehouse_description,
|
||||
wh.isactive AS m_warehouse__isactive,
|
||||
wh.isdisallownegativeinv,
|
||||
wh.isintransit AS m_warehouse_isintransit,
|
||||
wh.m_warehousesource_id,
|
||||
wh.name AS m_warehouse_name,
|
||||
wh.replenishmentclass,
|
||||
wh.separator,
|
||||
wh.value AS m_warehouse_value
|
||||
FROM m_inout io
|
||||
JOIN c_doctype_trl dt
|
||||
ON io.c_doctype_id = dt.c_doctype_id
|
||||
JOIN c_bpartner bp
|
||||
ON io.c_bpartner_id = bp.c_bpartner_id
|
||||
LEFT JOIN c_greeting bpg
|
||||
ON bp.c_greeting_id = bpg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpgt
|
||||
ON bp.c_greeting_id = bpgt.c_greeting_id
|
||||
AND dt.ad_language = bpgt.ad_language
|
||||
JOIN c_bpartner_location bpl
|
||||
ON io.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location l
|
||||
ON bpl.c_location_id = l.c_location_id
|
||||
LEFT JOIN ad_user bpc
|
||||
ON io.ad_user_id = bpc.ad_user_id
|
||||
LEFT JOIN c_greeting bpcg
|
||||
ON bpc.c_greeting_id = bpcg.c_greeting_id
|
||||
LEFT JOIN c_greeting_trl bpcgt
|
||||
ON bpc.c_greeting_id = bpcgt.c_greeting_id
|
||||
AND dt.ad_language = bpcgt.ad_language
|
||||
JOIN ad_orginfo oi
|
||||
ON io.ad_org_id = oi.ad_org_id
|
||||
JOIN ad_clientinfo ci
|
||||
ON io.ad_client_id = ci.ad_client_id
|
||||
JOIN m_warehouse wh
|
||||
ON io.m_warehouse_id = wh.m_warehouse_id
|
||||
;
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUT_LINECONFIRM_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTLINECONFIRM_ID, M_INOUTCONFIRM_ID,
|
||||
TARGETQTY, CONFIRMEDQTY, DIFFERENCEQTY, SCRAPPEDQTY, DESCRIPTION,
|
||||
PROCESSED, M_INOUT_ID, M_INOUTLINE_ID, LINE, M_PRODUCT_ID,
|
||||
MOVEMENTQTY, UOMSYMBOL, QTYBACKORDERED, NAME, SHIPDESCRIPTION,
|
||||
DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID,
|
||||
M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID,
|
||||
M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE)
|
||||
AS
|
||||
SELECT iolc.AD_Client_ID, iolc.AD_Org_ID, iolc.IsActive, iolc.Created, iolc.CreatedBy, iolc.Updated, iolc.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
iolc.M_InOutLineConfirm_ID, iolc.M_InOutConfirm_ID,
|
||||
iolc.TargetQty, iolc.ConfirmedQty, iolc.DifferenceQty, iolc.ScrappedQty,
|
||||
iolc.Description, iolc.Processed,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line, p.M_Product_ID,
|
||||
iol.MovementQty, uom.UOMSymbol, ol.QtyOrdered-ol.QtyDelivered AS QtyBackOrdered,
|
||||
COALESCE(p.Name, iol.Description) AS Name, -- main line
|
||||
CASE WHEN p.Name IS NOT NULL THEN iol.Description END AS ShipDescription, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate
|
||||
FROM M_InOutLineConfirm iolc
|
||||
INNER JOIN M_InOutLine iol ON (iolc.M_InOutLine_ID=iol.M_InOutLine_ID)
|
||||
INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID)
|
||||
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID);
|
||||
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_INOUT_LINECONFIRM_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTLINECONFIRM_ID, M_INOUTCONFIRM_ID,
|
||||
TARGETQTY, CONFIRMEDQTY, DIFFERENCEQTY, SCRAPPEDQTY, DESCRIPTION,
|
||||
PROCESSED, M_INOUT_ID, M_INOUTLINE_ID, LINE, M_PRODUCT_ID,
|
||||
MOVEMENTQTY, UOMSYMBOL, QTYBACKORDERED, NAME, SHIPDESCRIPTION,
|
||||
DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID,
|
||||
M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID,
|
||||
M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE)
|
||||
AS
|
||||
SELECT iolc.AD_Client_ID, iolc.AD_Org_ID, iolc.IsActive, iolc.Created, iolc.CreatedBy, iolc.Updated, iolc.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
iolc.M_InOutLineConfirm_ID, iolc.M_InOutConfirm_ID,
|
||||
iolc.TargetQty, iolc.ConfirmedQty, iolc.DifferenceQty, iolc.ScrappedQty,
|
||||
iolc.Description, iolc.Processed,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line, p.M_Product_ID,
|
||||
iol.MovementQty, uom.UOMSymbol, ol.QtyOrdered-ol.QtyDelivered AS QtyBackOrdered,
|
||||
COALESCE(COALESCE(pt.Name,p.Name), iol.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(pt.Name,p.Name) IS NOT NULL THEN iol.Description END AS ShipDescription, -- second line
|
||||
COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate
|
||||
FROM M_InOutLineConfirm iolc
|
||||
INNER JOIN M_InOutLine iol ON (iolc.M_InOutLine_ID=iol.M_InOutLine_ID)
|
||||
INNER JOIN C_UOM_Trl uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
|
||||
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID)
|
||||
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID);
|
||||
|
||||
|
||||
|
|
@ -1,447 +0,0 @@
|
|||
DROP VIEW m_inout_line_v;
|
||||
|
||||
CREATE OR REPLACE VIEW m_inout_line_v
|
||||
AS
|
||||
SELECT iol.ad_client_id,
|
||||
iol.ad_org_id,
|
||||
iol.isactive,
|
||||
iol.created,
|
||||
iol.createdby,
|
||||
iol.updated,
|
||||
iol.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
iol.m_inout_id,
|
||||
iol.m_inoutline_id,
|
||||
iol.line,
|
||||
p.m_product_id,
|
||||
CASE
|
||||
WHEN iol.movementqty <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN iol.movementqty
|
||||
ELSE NULL
|
||||
END AS movementqty,
|
||||
CASE
|
||||
WHEN iol.qtyentered <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
|
||||
ELSE NULL
|
||||
END AS qtyentered,
|
||||
CASE
|
||||
WHEN iol.movementqty <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN uom.uomsymbol
|
||||
ELSE NULL
|
||||
END AS uomsymbol,
|
||||
ol.qtyordered,
|
||||
ol.qtydelivered,
|
||||
CASE
|
||||
WHEN iol.movementqty <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
|
||||
ELSE NULL
|
||||
END AS qtybackordered,
|
||||
COALESCE(p.name
|
||||
|| productattribute(iol.m_attributesetinstance_id), c.name, iol.description) AS name,
|
||||
CASE
|
||||
WHEN COALESCE(c.name, p.name) IS NOT NULL THEN iol.description
|
||||
ELSE NULL
|
||||
END AS description,
|
||||
p.documentnote,
|
||||
p.upc,
|
||||
p.sku,
|
||||
p.value AS productvalue,
|
||||
iol.m_locator_id,
|
||||
l.m_warehouse_id,
|
||||
l.x,
|
||||
l.y,
|
||||
l.z,
|
||||
iol.m_attributesetinstance_id,
|
||||
asi.m_attributeset_id,
|
||||
asi.serno,
|
||||
asi.lot,
|
||||
asi.m_lot_id,
|
||||
asi.guaranteedate,
|
||||
p.description AS productdescription,
|
||||
p.imageurl,
|
||||
iol.c_campaign_id,
|
||||
iol.c_project_id,
|
||||
iol.c_activity_id,
|
||||
iol.c_projectphase_id,
|
||||
iol.c_projecttask_id,
|
||||
iol.ad_orgtrx_id,
|
||||
iol.c_charge_id,
|
||||
iol.confirmedqty,
|
||||
iol.c_orderline_id,
|
||||
iol.c_uom_id AS m_inoutline_c_uom_id,
|
||||
iol.isdescription AS m_inoutline_isdescription,
|
||||
iol.isinvoiced,
|
||||
iol.m_rmaline_id,
|
||||
iol.pickedqty,
|
||||
iol.processed AS m_inoutline_processed,
|
||||
iol.ref_inoutline_id,
|
||||
iol.reversalline_id,
|
||||
iol.scrappedqty,
|
||||
iol.targetqty,
|
||||
iol.user1_id AS m_inoutline_user1_id,
|
||||
iol.user2_id AS m_inoutline_user2_id,
|
||||
p.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
p.created AS m_product_created,
|
||||
p.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id AS m_product_c_taxcategory_id,
|
||||
p.c_uom_id AS m_product_c_uom_id,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.isactive AS m_product_isactive,
|
||||
p.isbom,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice AS m_product_isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_attributesetinstance_id AS m_product_m_asi_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id AS m_product_m_locator_id,
|
||||
p.m_product_category_id AS m_product_m_prod_category_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.s_resource_id AS m_product_s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
uom.ad_org_id AS c_uom_ad_org_id,
|
||||
uom.costingprecision,
|
||||
uom.description AS c_uom_description,
|
||||
uom.isactive AS c_uom_isactive,
|
||||
uom.isdefault AS c_uom_isdefault,
|
||||
uom.name AS c_uom_name,
|
||||
uom.stdprecision,
|
||||
uom.uomtype,
|
||||
uom.x12de355,
|
||||
asi.ad_org_id AS m_asi_ad_org_id,
|
||||
asi.created AS m_asi_created,
|
||||
asi.createdby AS m_asi_createdby,
|
||||
asi.description AS m_asi_description,
|
||||
asi.isactive AS m_asi_isactive,
|
||||
asi.updated AS m_asi_updated,
|
||||
asi.updatedby AS m_asi_updatedby,
|
||||
l.ad_org_id AS m_locator_ad_org_id,
|
||||
l.isactive AS m_locator_isactive,
|
||||
l.isdefault,
|
||||
l.priorityno,
|
||||
l.value AS m_locator_value,
|
||||
ol.ad_org_id AS c_orderline_ad_org_id,
|
||||
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
|
||||
ol.c_activity_id AS c_orderline_c_activity_id,
|
||||
ol.c_bpartner_id AS c_orderline_c_bpartner_id,
|
||||
ol.c_bpartner_location_id AS c_orderline_c_bp_location_id,
|
||||
ol.c_charge_id AS c_orderline_c_charge_id,
|
||||
ol.c_currency_id AS c_orderline_c_currency_id,
|
||||
ol.c_order_id,
|
||||
ol.c_project_id AS c_orderline_c_project_id,
|
||||
ol.c_projectphase_id AS c_orderline_c_projectphase_id,
|
||||
ol.c_projecttask_id AS c_orderline_c_projecttask_id,
|
||||
ol.created AS c_orderline_created,
|
||||
ol.createdby AS c_orderline_createdby,
|
||||
ol.c_tax_id AS c_orderline_c_tax_id,
|
||||
ol.c_uom_id AS c_orderline_c_uom_id,
|
||||
ol.datedelivered,
|
||||
ol.dateinvoiced,
|
||||
ol.dateordered,
|
||||
ol.datepromised AS c_orderline_datepromised,
|
||||
ol.description AS c_orderline_description,
|
||||
ol.discount,
|
||||
ol.freightamt AS c_orderline_freightamt,
|
||||
ol.isactive AS c_orderline_isactive,
|
||||
ol.isdescription AS c_orderline_isdescription,
|
||||
ol.line AS c_orderline_line,
|
||||
ol.linenetamt,
|
||||
ol.link_orderline_id,
|
||||
ol.m_attributesetinstance_id AS c_orderline_m_asi_id,
|
||||
ol.m_product_id AS c_orderline_m_product_id,
|
||||
ol.m_promotion_id,
|
||||
ol.m_shipper_id AS c_orderline_m_shipper_id,
|
||||
ol.m_warehouse_id AS c_orderline_warehouse_id,
|
||||
ol.priceactual,
|
||||
ol.pricecost,
|
||||
ol.priceentered,
|
||||
ol.pricelimit,
|
||||
ol.pricelist,
|
||||
ol.processed AS c_orderline_processed,
|
||||
ol.qtyentered AS c_orderline_qtyentered,
|
||||
ol.qtyinvoiced,
|
||||
ol.qtylostsales,
|
||||
ol.qtyreserved,
|
||||
ol.ref_orderline_id,
|
||||
ol.rramt,
|
||||
ol.rrstartdate,
|
||||
ol.s_resourceassignment_id,
|
||||
ol.updated AS c_orderline_updated,
|
||||
ol.updatedby AS c_orderline_updatedby,
|
||||
ol.user1_id AS c_orderline_user1_id,
|
||||
ol.user2_id AS c_orderline_user2_id,
|
||||
c.ad_org_id AS c_charge_c_org_id,
|
||||
c.c_bpartner_id AS c_charge_c_bpartner_id,
|
||||
c.c_chargetype_id,
|
||||
c.chargeamt AS c_charge_chargeamt,
|
||||
c.c_taxcategory_id AS c_charge_c_taxcategory_id,
|
||||
c.description AS c_charge_description,
|
||||
c.isactive AS c_charge_isactive,
|
||||
c.issamecurrency,
|
||||
c.issametax,
|
||||
c.istaxincluded AS c_charge_istaxincluded
|
||||
FROM m_inoutline iol
|
||||
JOIN c_uom uom
|
||||
ON iol.c_uom_id = uom.c_uom_id
|
||||
LEFT JOIN m_product p
|
||||
ON iol.m_product_id = p.m_product_id
|
||||
LEFT JOIN m_attributesetinstance asi
|
||||
ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
|
||||
LEFT JOIN m_locator l
|
||||
ON iol.m_locator_id = l.m_locator_id
|
||||
LEFT JOIN c_orderline ol
|
||||
ON iol.c_orderline_id = ol.c_orderline_id
|
||||
LEFT JOIN c_charge c
|
||||
ON iol.c_charge_id = c.c_charge_id
|
||||
UNION
|
||||
SELECT iol.ad_client_id,
|
||||
iol.ad_org_id,
|
||||
iol.isactive,
|
||||
iol.created,
|
||||
iol.createdby,
|
||||
iol.updated,
|
||||
iol.updatedby,
|
||||
'en_US' AS ad_language,
|
||||
iol.m_inout_id,
|
||||
iol.m_inoutline_id,
|
||||
iol.line + bl.line / 100 AS line,
|
||||
p.m_product_id,
|
||||
CASE
|
||||
WHEN bl.isqtypercentage = 'N' THEN iol.movementqty * bl.qtybom
|
||||
ELSE iol.movementqty * ( bl.qtybatch / 100 )
|
||||
END AS movementqty,
|
||||
CASE
|
||||
WHEN bl.isqtypercentage = 'N' THEN iol.qtyentered * bl.qtybom
|
||||
ELSE iol.qtyentered * ( bl.qtybatch / 100 )
|
||||
END AS qtyentered,
|
||||
uom.uomsymbol,
|
||||
NULL AS qtyordered,
|
||||
NULL AS qtydelivered,
|
||||
NULL AS qtybackordered,
|
||||
p.name,
|
||||
b.description,
|
||||
p.documentnote,
|
||||
p.upc,
|
||||
p.sku,
|
||||
p.value AS productvalue,
|
||||
iol.m_locator_id,
|
||||
l.m_warehouse_id,
|
||||
l.x,
|
||||
l.y,
|
||||
l.z,
|
||||
iol.m_attributesetinstance_id,
|
||||
asi.m_attributeset_id,
|
||||
asi.serno,
|
||||
asi.lot,
|
||||
asi.m_lot_id,
|
||||
asi.guaranteedate,
|
||||
p.description AS productdescription,
|
||||
p.imageurl,
|
||||
iol.c_campaign_id,
|
||||
iol.c_project_id,
|
||||
iol.c_activity_id,
|
||||
iol.c_projectphase_id,
|
||||
iol.c_projecttask_id,
|
||||
iol.ad_orgtrx_id,
|
||||
iol.c_charge_id,
|
||||
iol.confirmedqty,
|
||||
iol.c_orderline_id,
|
||||
iol.c_uom_id AS m_inoutline_c_uom_id,
|
||||
iol.isdescription AS m_inoutline_isdescription,
|
||||
iol.isinvoiced,
|
||||
iol.m_rmaline_id,
|
||||
iol.pickedqty,
|
||||
iol.processed AS m_inoutline_processed,
|
||||
iol.ref_inoutline_id,
|
||||
iol.reversalline_id,
|
||||
iol.scrappedqty,
|
||||
iol.targetqty,
|
||||
iol.user1_id AS m_inoutline_user1_id,
|
||||
iol.user2_id AS m_inoutline_user2_id,
|
||||
p.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
p.created AS m_product_created,
|
||||
p.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id AS m_product_c_taxcategory_id,
|
||||
p.c_uom_id AS m_product_c_uom_id,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.isactive AS m_product_isactive,
|
||||
p.isbom,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice AS m_product_isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_attributesetinstance_id AS m_product_m_asi_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id AS m_product_m_locator_id,
|
||||
p.m_product_category_id AS m_product_m_prod_category_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.s_resource_id AS m_product_s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
uom.ad_org_id AS c_uom_ad_org_id,
|
||||
uom.costingprecision,
|
||||
uom.description AS c_uom_description,
|
||||
uom.isactive AS c_uom_isactive,
|
||||
uom.isdefault AS c_uom_isdefault,
|
||||
uom.name AS c_uom_name,
|
||||
uom.stdprecision,
|
||||
uom.uomtype,
|
||||
uom.x12de355,
|
||||
asi.ad_org_id AS m_asi_ad_org_id,
|
||||
asi.created AS m_asi_created,
|
||||
asi.createdby AS m_asi_createdby,
|
||||
asi.description AS m_asi_description,
|
||||
asi.isactive AS m_asi_isactive,
|
||||
asi.updated AS m_asi_updated,
|
||||
asi.updatedby AS m_asi_updatedby,
|
||||
l.ad_org_id AS m_locator_ad_org_id,
|
||||
l.isactive AS m_locator_isactive,
|
||||
l.isdefault,
|
||||
l.priorityno,
|
||||
l.value AS m_locator_value,
|
||||
NULL AS c_orderline_ad_org_id,
|
||||
NULL AS c_orderline_ad_orgtrx_id,
|
||||
NULL AS c_orderline_c_activity_id,
|
||||
NULL AS c_orderline_c_bpartner_id,
|
||||
NULL AS c_orderline_c_bp_location_id,
|
||||
NULL AS c_orderline_c_charge_id,
|
||||
NULL AS c_orderline_c_currency_id,
|
||||
NULL AS c_order_id,
|
||||
NULL AS c_orderline_c_project_id,
|
||||
NULL AS c_orderline_c_projectphase_id,
|
||||
NULL AS c_orderline_c_projecttask_id,
|
||||
NULL AS c_orderline_created,
|
||||
NULL AS c_orderline_createdby,
|
||||
NULL AS c_orderline_c_tax_id,
|
||||
NULL AS c_orderline_c_uom_id,
|
||||
NULL AS datedelivered,
|
||||
NULL AS dateinvoiced,
|
||||
NULL AS dateordered,
|
||||
NULL AS c_orderline_datepromised,
|
||||
NULL AS c_orderline_description,
|
||||
NULL AS discount,
|
||||
NULL AS c_orderline_freightamt,
|
||||
NULL AS c_orderline_isactive,
|
||||
NULL AS c_orderline_isdescription,
|
||||
NULL AS c_orderline_line,
|
||||
NULL AS linenetamt,
|
||||
NULL AS link_orderline_id,
|
||||
NULL AS c_orderline_m_asi_id,
|
||||
NULL AS c_orderline_m_product_id,
|
||||
NULL AS m_promotion_id,
|
||||
NULL AS c_orderline_m_shipper_id,
|
||||
NULL AS c_orderline_warehouse_id,
|
||||
NULL AS priceactual,
|
||||
NULL AS pricecost,
|
||||
NULL AS priceentered,
|
||||
NULL AS pricelimit,
|
||||
NULL AS pricelist,
|
||||
NULL AS c_orderline_processed,
|
||||
NULL AS c_orderline_qtyentered,
|
||||
NULL AS qtyinvoiced,
|
||||
NULL AS qtylostsales,
|
||||
NULL AS qtyreserved,
|
||||
NULL AS ref_orderline_id,
|
||||
NULL AS rramt,
|
||||
NULL AS rrstartdate,
|
||||
NULL AS s_resourceassignment_id,
|
||||
NULL AS c_orderline_updated,
|
||||
NULL AS c_orderline_updatedby,
|
||||
NULL AS c_orderline_user1_id,
|
||||
NULL AS c_orderline_user2_id,
|
||||
NULL AS c_charge_c_org_id,
|
||||
NULL AS c_charge_c_bpartner_id,
|
||||
NULL AS c_chargetype_id,
|
||||
NULL AS c_charge_chargeamt,
|
||||
NULL AS c_charge_c_taxcategory_id,
|
||||
NULL AS c_charge_description,
|
||||
NULL AS c_charge_isactive,
|
||||
NULL AS issamecurrency,
|
||||
NULL AS issametax,
|
||||
NULL AS c_charge_istaxincluded
|
||||
FROM pp_product_bom b
|
||||
JOIN m_inoutline iol
|
||||
ON b.m_product_id = iol.m_product_id
|
||||
JOIN m_product bp
|
||||
ON bp.m_product_id = iol.m_product_id
|
||||
AND bp.isbom = 'Y'
|
||||
AND bp.isverified = 'Y'
|
||||
AND bp.ispicklistprintdetails = 'Y'
|
||||
JOIN pp_product_bomline bl
|
||||
ON bl.pp_product_bom_id = b.pp_product_bom_id
|
||||
JOIN m_product p
|
||||
ON bl.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom
|
||||
ON p.c_uom_id = uom.c_uom_id
|
||||
LEFT JOIN m_attributesetinstance asi
|
||||
ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
|
||||
LEFT JOIN m_locator l
|
||||
ON iol.m_locator_id = l.m_locator_id
|
||||
;
|
||||
|
||||
|
|
@ -1,459 +0,0 @@
|
|||
DROP VIEW m_inout_line_vt;
|
||||
|
||||
CREATE OR REPLACE VIEW m_inout_line_vt
|
||||
AS
|
||||
SELECT iol.ad_client_id,
|
||||
iol.ad_org_id,
|
||||
iol.isactive,
|
||||
iol.created,
|
||||
iol.createdby,
|
||||
iol.updated,
|
||||
iol.updatedby,
|
||||
uomt.ad_language,
|
||||
iol.m_inout_id,
|
||||
iol.m_inoutline_id,
|
||||
iol.line,
|
||||
pt.m_product_id,
|
||||
CASE
|
||||
WHEN iol.movementqty <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN iol.movementqty
|
||||
ELSE NULL
|
||||
END AS movementqty,
|
||||
CASE
|
||||
WHEN iol.qtyentered <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
|
||||
ELSE NULL
|
||||
END AS qtyentered,
|
||||
CASE
|
||||
WHEN iol.movementqty <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN uomt.uomsymbol
|
||||
ELSE NULL
|
||||
END AS uomsymbol,
|
||||
ol.qtyordered,
|
||||
ol.qtydelivered,
|
||||
CASE
|
||||
WHEN iol.movementqty <> 0
|
||||
OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
|
||||
ELSE NULL
|
||||
END AS qtybackordered,
|
||||
COALESCE(pt.name
|
||||
|| productattribute(iol.m_attributesetinstance_id), ct.name, iol.description) AS name,
|
||||
CASE
|
||||
WHEN COALESCE(ct.name, pt.name) IS NOT NULL THEN iol.description
|
||||
ELSE NULL
|
||||
END AS description,
|
||||
pt.documentnote,
|
||||
p.upc,
|
||||
p.sku,
|
||||
p.value AS productvalue,
|
||||
iol.m_locator_id,
|
||||
l.m_warehouse_id,
|
||||
l.x,
|
||||
l.y,
|
||||
l.z,
|
||||
iol.m_attributesetinstance_id,
|
||||
asi.m_attributeset_id,
|
||||
asi.serno,
|
||||
asi.lot,
|
||||
asi.m_lot_id,
|
||||
asi.guaranteedate,
|
||||
pt.description AS productdescription,
|
||||
p.imageurl,
|
||||
iol.c_campaign_id,
|
||||
iol.c_project_id,
|
||||
iol.c_activity_id,
|
||||
iol.c_projectphase_id,
|
||||
iol.c_projecttask_id,
|
||||
iol.ad_orgtrx_id,
|
||||
iol.c_charge_id,
|
||||
iol.confirmedqty,
|
||||
iol.c_orderline_id,
|
||||
iol.c_uom_id AS m_inoutline_c_uom_id,
|
||||
iol.isdescription AS m_inoutline_isdescription,
|
||||
iol.isinvoiced,
|
||||
iol.m_rmaline_id,
|
||||
iol.pickedqty,
|
||||
iol.processed AS m_inoutline_processed,
|
||||
iol.ref_inoutline_id,
|
||||
iol.reversalline_id,
|
||||
iol.scrappedqty,
|
||||
iol.targetqty,
|
||||
iol.user1_id AS m_inoutline_user1_id,
|
||||
iol.user2_id AS m_inoutline_user2_id,
|
||||
pt.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
pt.created AS m_product_created,
|
||||
pt.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id AS m_product_c_taxcategory_id,
|
||||
p.c_uom_id AS m_product_c_uom_id,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
pt.isactive AS m_product_isactive,
|
||||
p.isbom,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice AS m_product_isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_attributesetinstance_id AS m_product_m_asi_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id AS m_product_m_locator_id,
|
||||
p.m_product_category_id AS m_product_m_prod_category_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.s_resource_id AS m_product_s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
uomt.ad_org_id AS c_uom_ad_org_id,
|
||||
uom.costingprecision,
|
||||
uomt.description AS c_uom_description,
|
||||
uomt.isactive AS c_uom_isactive,
|
||||
uom.isdefault AS c_uom_isdefault,
|
||||
uomt.name AS c_uom_name,
|
||||
uom.stdprecision,
|
||||
uom.uomtype,
|
||||
uom.x12de355,
|
||||
asi.ad_org_id AS m_asi_ad_org_id,
|
||||
asi.created AS m_asi_created,
|
||||
asi.createdby AS m_asi_createdby,
|
||||
asi.description AS m_asi_description,
|
||||
asi.isactive AS m_asi_isactive,
|
||||
asi.updated AS m_asi_updated,
|
||||
asi.updatedby AS m_asi_updatedby,
|
||||
l.ad_org_id AS m_locator_ad_org_id,
|
||||
l.isactive AS m_locator_isactive,
|
||||
l.isdefault,
|
||||
l.priorityno,
|
||||
l.value AS m_locator_value,
|
||||
ol.ad_org_id AS c_orderline_ad_org_id,
|
||||
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
|
||||
ol.c_activity_id AS c_orderline_c_activity_id,
|
||||
ol.c_bpartner_id AS c_orderline_c_bpartner_id,
|
||||
ol.c_bpartner_location_id AS c_orderline_c_bp_location_id,
|
||||
ol.c_charge_id AS c_orderline_c_charge_id,
|
||||
ol.c_currency_id AS c_orderline_c_currency_id,
|
||||
ol.c_order_id,
|
||||
ol.c_project_id AS c_orderline_c_project_id,
|
||||
ol.c_projectphase_id AS c_orderline_c_projectphase_id,
|
||||
ol.c_projecttask_id AS c_orderline_c_projecttask_id,
|
||||
ol.created AS c_orderline_created,
|
||||
ol.createdby AS c_orderline_createdby,
|
||||
ol.c_tax_id AS c_orderline_c_tax_id,
|
||||
ol.c_uom_id AS c_orderline_c_uom_id,
|
||||
ol.datedelivered,
|
||||
ol.dateinvoiced,
|
||||
ol.dateordered,
|
||||
ol.datepromised AS c_orderline_datepromised,
|
||||
ol.description AS c_orderline_description,
|
||||
ol.discount,
|
||||
ol.freightamt AS c_orderline_freightamt,
|
||||
ol.isactive AS c_orderline_isactive,
|
||||
ol.isdescription AS c_orderline_isdescription,
|
||||
ol.line AS c_orderline_line,
|
||||
ol.linenetamt,
|
||||
ol.link_orderline_id,
|
||||
ol.m_attributesetinstance_id AS c_orderline_m_asi_id,
|
||||
ol.m_product_id AS c_orderline_m_product_id,
|
||||
ol.m_promotion_id,
|
||||
ol.m_shipper_id AS c_orderline_m_shipper_id,
|
||||
ol.m_warehouse_id AS c_orderline_warehouse_id,
|
||||
ol.priceactual,
|
||||
ol.pricecost,
|
||||
ol.priceentered,
|
||||
ol.pricelimit,
|
||||
ol.pricelist,
|
||||
ol.processed AS c_orderline_processed,
|
||||
ol.qtyentered AS c_orderline_qtyentered,
|
||||
ol.qtyinvoiced,
|
||||
ol.qtylostsales,
|
||||
ol.qtyreserved,
|
||||
ol.ref_orderline_id,
|
||||
ol.rramt,
|
||||
ol.rrstartdate,
|
||||
ol.s_resourceassignment_id,
|
||||
ol.updated AS c_orderline_updated,
|
||||
ol.updatedby AS c_orderline_updatedby,
|
||||
ol.user1_id AS c_orderline_user1_id,
|
||||
ol.user2_id AS c_orderline_user2_id,
|
||||
ct.ad_org_id AS c_charge_c_org_id,
|
||||
c.c_bpartner_id AS c_charge_c_bpartner_id,
|
||||
c.c_chargetype_id,
|
||||
c.chargeamt AS c_charge_chargeamt,
|
||||
c.c_taxcategory_id AS c_charge_c_taxcategory_id,
|
||||
ct.description AS c_charge_description,
|
||||
ct.isactive AS c_charge_isactive,
|
||||
c.issamecurrency,
|
||||
c.issametax,
|
||||
c.istaxincluded AS c_charge_istaxincluded
|
||||
FROM m_inoutline iol
|
||||
JOIN c_uom uom
|
||||
ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN c_uom_trl uomt
|
||||
ON iol.c_uom_id = uomt.c_uom_id
|
||||
LEFT JOIN m_product p
|
||||
ON iol.m_product_id = p.m_product_id
|
||||
LEFT JOIN m_product_trl pt
|
||||
ON iol.m_product_id = pt.m_product_id
|
||||
AND uomt.ad_language = pt.ad_language
|
||||
LEFT JOIN m_attributesetinstance asi
|
||||
ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
|
||||
LEFT JOIN m_locator l
|
||||
ON iol.m_locator_id = l.m_locator_id
|
||||
LEFT JOIN c_orderline ol
|
||||
ON iol.c_orderline_id = ol.c_orderline_id
|
||||
LEFT JOIN c_charge c
|
||||
ON iol.c_charge_id = c.c_charge_id
|
||||
LEFT JOIN c_charge_trl ct
|
||||
ON iol.c_charge_id = ct.c_charge_id
|
||||
AND uomt.ad_language = ct.ad_language
|
||||
UNION
|
||||
SELECT iol.ad_client_id,
|
||||
iol.ad_org_id,
|
||||
iol.isactive,
|
||||
iol.created,
|
||||
iol.createdby,
|
||||
iol.updated,
|
||||
iol.updatedby,
|
||||
uomt.ad_language,
|
||||
iol.m_inout_id,
|
||||
iol.m_inoutline_id,
|
||||
iol.line + bl.line / 100 AS line,
|
||||
pt.m_product_id,
|
||||
CASE
|
||||
WHEN bl.isqtypercentage = 'N' THEN iol.movementqty * bl.qtybom
|
||||
ELSE iol.movementqty * ( bl.qtybatch / 100 )
|
||||
END AS movementqty,
|
||||
CASE
|
||||
WHEN bl.isqtypercentage = 'N' THEN iol.qtyentered * bl.qtybom
|
||||
ELSE iol.qtyentered * ( bl.qtybatch / 100 )
|
||||
END AS qtyentered,
|
||||
uomt.uomsymbol,
|
||||
NULL AS qtyordered,
|
||||
NULL AS qtydelivered,
|
||||
NULL AS qtybackordered,
|
||||
pt.name,
|
||||
b.description,
|
||||
pt.documentnote,
|
||||
p.upc,
|
||||
p.sku,
|
||||
p.value AS productvalue,
|
||||
iol.m_locator_id,
|
||||
l.m_warehouse_id,
|
||||
l.x,
|
||||
l.y,
|
||||
l.z,
|
||||
iol.m_attributesetinstance_id,
|
||||
asi.m_attributeset_id,
|
||||
asi.serno,
|
||||
asi.lot,
|
||||
asi.m_lot_id,
|
||||
asi.guaranteedate,
|
||||
pt.description AS productdescription,
|
||||
p.imageurl,
|
||||
iol.c_campaign_id,
|
||||
iol.c_project_id,
|
||||
iol.c_activity_id,
|
||||
iol.c_projectphase_id,
|
||||
iol.c_projecttask_id,
|
||||
iol.ad_orgtrx_id,
|
||||
iol.c_charge_id,
|
||||
iol.confirmedqty,
|
||||
iol.c_orderline_id,
|
||||
iol.c_uom_id AS m_inoutline_c_uom_id,
|
||||
iol.isdescription AS m_inoutline_isdescription,
|
||||
iol.isinvoiced,
|
||||
iol.m_rmaline_id,
|
||||
iol.pickedqty,
|
||||
iol.processed AS m_inoutline_processed,
|
||||
iol.ref_inoutline_id,
|
||||
iol.reversalline_id,
|
||||
iol.scrappedqty,
|
||||
iol.targetqty,
|
||||
iol.user1_id AS m_inoutline_user1_id,
|
||||
iol.user2_id AS m_inoutline_user2_id,
|
||||
pt.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
pt.created AS m_product_created,
|
||||
pt.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id AS m_product_c_taxcategory_id,
|
||||
p.c_uom_id AS m_product_c_uom_id,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
pt.isactive AS m_product_isactive,
|
||||
p.isbom,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice AS m_product_isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_attributesetinstance_id AS m_product_m_asi_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id AS m_product_m_locator_id,
|
||||
p.m_product_category_id AS m_product_m_prod_category_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.s_resource_id AS m_product_s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
pt.updated AS m_product_updated,
|
||||
pt.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
uomt.ad_org_id AS c_uom_ad_org_id,
|
||||
uom.costingprecision,
|
||||
uomt.description AS c_uom_description,
|
||||
uomt.isactive AS c_uom_isactive,
|
||||
uom.isdefault AS c_uom_isdefault,
|
||||
uomt.name AS c_uom_name,
|
||||
uom.stdprecision,
|
||||
uom.uomtype,
|
||||
uom.x12de355,
|
||||
asi.ad_org_id AS m_asi_ad_org_id,
|
||||
asi.created AS m_asi_created,
|
||||
asi.createdby AS m_asi_createdby,
|
||||
asi.description AS m_asi_description,
|
||||
asi.isactive AS m_asi_isactive,
|
||||
asi.updated AS m_asi_updated,
|
||||
asi.updatedby AS m_asi_updatedby,
|
||||
l.ad_org_id AS m_locator_ad_org_id,
|
||||
l.isactive AS m_locator_isactive,
|
||||
l.isdefault,
|
||||
l.priorityno,
|
||||
l.value AS m_locator_value,
|
||||
NULL AS c_orderline_ad_org_id,
|
||||
NULL AS c_orderline_ad_orgtrx_id,
|
||||
NULL AS c_orderline_c_activity_id,
|
||||
NULL AS c_orderline_c_bpartner_id,
|
||||
NULL AS c_orderline_c_bp_location_id,
|
||||
NULL AS c_orderline_c_charge_id,
|
||||
NULL AS c_orderline_c_currency_id,
|
||||
NULL AS c_order_id,
|
||||
NULL AS c_orderline_c_project_id,
|
||||
NULL AS c_orderline_c_projectphase_id,
|
||||
NULL AS c_orderline_c_projecttask_id,
|
||||
NULL AS c_orderline_created,
|
||||
NULL AS c_orderline_createdby,
|
||||
NULL AS c_orderline_c_tax_id,
|
||||
NULL AS c_orderline_c_uom_id,
|
||||
NULL AS datedelivered,
|
||||
NULL AS dateinvoiced,
|
||||
NULL AS dateordered,
|
||||
NULL AS c_orderline_datepromised,
|
||||
NULL AS c_orderline_description,
|
||||
NULL AS discount,
|
||||
NULL AS c_orderline_freightamt,
|
||||
NULL AS c_orderline_isactive,
|
||||
NULL AS c_orderline_isdescription,
|
||||
NULL AS c_orderline_line,
|
||||
NULL AS linenetamt,
|
||||
NULL AS link_orderline_id,
|
||||
NULL AS c_orderline_m_asi_id,
|
||||
NULL AS c_orderline_m_product_id,
|
||||
NULL AS m_promotion_id,
|
||||
NULL AS c_orderline_m_shipper_id,
|
||||
NULL AS c_orderline_warehouse_id,
|
||||
NULL AS priceactual,
|
||||
NULL AS pricecost,
|
||||
NULL AS priceentered,
|
||||
NULL AS pricelimit,
|
||||
NULL AS pricelist,
|
||||
NULL AS c_orderline_processed,
|
||||
NULL AS c_orderline_qtyentered,
|
||||
NULL AS qtyinvoiced,
|
||||
NULL AS qtylostsales,
|
||||
NULL AS qtyreserved,
|
||||
NULL AS ref_orderline_id,
|
||||
NULL AS rramt,
|
||||
NULL AS rrstartdate,
|
||||
NULL AS s_resourceassignment_id,
|
||||
NULL AS c_orderline_updated,
|
||||
NULL AS c_orderline_updatedby,
|
||||
NULL AS c_orderline_user1_id,
|
||||
NULL AS c_orderline_user2_id,
|
||||
NULL AS c_charge_c_org_id,
|
||||
NULL AS c_charge_c_bpartner_id,
|
||||
NULL AS c_chargetype_id,
|
||||
NULL AS c_charge_chargeamt,
|
||||
NULL AS c_charge_c_taxcategory_id,
|
||||
NULL AS c_charge_description,
|
||||
NULL AS c_charge_isactive,
|
||||
NULL AS issamecurrency,
|
||||
NULL AS issametax,
|
||||
NULL AS c_charge_istaxincluded
|
||||
FROM pp_product_bom b
|
||||
JOIN m_inoutline iol
|
||||
ON b.m_product_id = iol.m_product_id
|
||||
JOIN m_product bp
|
||||
ON bp.m_product_id = iol.m_product_id
|
||||
AND bp.isbom = 'Y'
|
||||
AND bp.isverified = 'Y'
|
||||
AND bp.ispicklistprintdetails = 'Y'
|
||||
JOIN pp_product_bomline bl
|
||||
ON bl.pp_product_bom_id = b.pp_product_bom_id
|
||||
JOIN m_product p
|
||||
ON bl.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom
|
||||
ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN c_uom_trl uomt
|
||||
ON p.c_uom_id = uomt.c_uom_id
|
||||
JOIN m_product_trl pt
|
||||
ON bl.m_product_id = pt.m_product_id
|
||||
AND uomt.ad_language = pt.ad_language
|
||||
LEFT JOIN m_attributesetinstance asi
|
||||
ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
|
||||
LEFT JOIN m_locator l
|
||||
ON iol.m_locator_id = l.m_locator_id
|
||||
;
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
create view M_InoutLineMA_Returned as
|
||||
SELECT sma.m_inoutline_id,
|
||||
sma.m_attributesetinstance_id,
|
||||
sma.ad_client_id,
|
||||
sma.ad_org_id,
|
||||
sma.isactive,
|
||||
sma.created,
|
||||
sma.createdby,
|
||||
sma.updated,
|
||||
sma.updatedby,
|
||||
sma.movementqty,
|
||||
sma.m_inoutlinema_uu,
|
||||
sma.datematerialpolicy,
|
||||
sma.isautogenerated,
|
||||
sum (crma.movementqty) returnedQty
|
||||
FROM M_InoutLineMA sma inner join M_InoutLine sl on (sma.M_InoutLine_ID =sl.M_InoutLine_ID)
|
||||
inner join M_InOut sio on (sio.M_InOut_ID=sl.M_InOut_ID) left join M_RMALine rl on (rl.M_InOutLine_ID = sl.M_InOutLine_ID )
|
||||
left join M_InoutLine crl on (rl.M_RMALine_ID =crl.M_RMALine_ID)
|
||||
left join M_inout cr on (cr.M_Inout_ID = crl.M_Inout_ID and not cr.docstatus in ('CO','RE'))
|
||||
left join M_InoutLineMA crma on (crma.M_InoutLine_Id = crl.M_InoutLine_ID and sma.M_AttributeSetInstance_ID=crma.M_AttributeSetInstance_ID)
|
||||
group by sma.M_AttributeSetInstance_ID,sma.m_inoutline_id,sma.ad_client_id,sma.ad_org_id,sma.isactive,sma.created,sma.createdby,sma.updated
|
||||
,sma.updatedby,sma.movementqty,sma.m_inoutlinema_uu,sma.datematerialpolicy;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_MOVEMENTLINEMA_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, M_MOVEMENT_ID, M_MOVEMENTLINE_ID, LINE,
|
||||
M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID, M_LOCATORTO_ID)
|
||||
AS
|
||||
SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy,
|
||||
l.M_Movement_ID, m.M_MovementLine_ID, l.Line, l.M_Product_ID,
|
||||
m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID, l.M_LocatorTo_ID
|
||||
FROM M_MovementLineMA m INNER JOIN M_MovementLine l ON (m.M_MovementLine_ID=l.M_MovementLine_ID)
|
||||
UNION
|
||||
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||||
M_Movement_ID, M_MovementLine_ID, Line, M_Product_ID,
|
||||
M_AttributeSetInstance_ID, MovementQty, M_Locator_ID, M_LocatorTo_ID
|
||||
FROM M_MovementLine;
|
||||
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_MOVEMENTLINEMA_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, M_MOVEMENT_ID, M_MOVEMENTLINE_ID, LINE,
|
||||
M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID, M_LOCATORTO_ID)
|
||||
AS
|
||||
SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy,
|
||||
l.M_Movement_ID, m.M_MovementLine_ID, l.Line, l.M_Product_ID,
|
||||
m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID, l.M_LocatorTo_ID
|
||||
FROM M_MovementLineMA m INNER JOIN M_MovementLine l ON (m.M_MovementLine_ID=l.M_MovementLine_ID)
|
||||
UNION
|
||||
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||||
M_Movement_ID, M_MovementLine_ID, Line, M_Product_ID,
|
||||
M_AttributeSetInstance_ID, MovementQty, M_Locator_ID, M_LocatorTo_ID
|
||||
FROM M_MovementLine;
|
||||
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_Movement_Candidate_v AS
|
||||
SELECT
|
||||
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.DD_Order_ID,
|
||||
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||||
o.POReference, o.Description, o.SalesRep_ID,
|
||||
l.M_Locator_ID, l.M_LocatorTo_ID
|
||||
--l.ConfirmedQty
|
||||
--SUM((l.QtyOrdered-l.QtyDelivered)*l.PriceActual) AS TotalLines
|
||||
FROM DD_Order o
|
||||
INNER JOIN DD_OrderLine l ON (o.DD_Order_ID=l.DD_Order_ID)
|
||||
--INNER JOIN M_Locator loc ON (loc.M_Locator_ID=l.M_Locator_ID)
|
||||
WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL/RE
|
||||
-- not Offers and open Walkin-Receipts
|
||||
AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
|
||||
WHERE DocBaseType='DOO')
|
||||
-- Delivery Rule - not manual
|
||||
AND o.DeliveryRule<>'M'
|
||||
AND (l.M_Product_ID IS NULL OR EXISTS
|
||||
(SELECT * FROM M_Product p
|
||||
WHERE l.M_Product_ID=p.M_Product_ID AND p.IsExcludeAutoDelivery='N'))
|
||||
-- we need to ship
|
||||
AND l.QtyOrdered <> l.QtyDelivered AND l.ConfirmedQty > 0
|
||||
AND o.IsDropShip='N'
|
||||
AND (l.M_Product_ID IS NOT NULL OR l.C_Charge_ID IS NOT NULL)
|
||||
-- Not confirmed shipment
|
||||
AND NOT EXISTS (SELECT * FROM M_MovementLine iol
|
||||
INNER JOIN M_Movement io ON (iol.M_Movement_ID=io.M_Movement_ID)
|
||||
WHERE iol.DD_OrderLine_ID=l.DD_OrderLine_ID AND io.DocStatus IN ('IP','WC'))
|
||||
--
|
||||
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.DD_Order_ID,
|
||||
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||||
o.POReference, o.Description, o.SalesRep_ID, l.M_Locator_ID, l.M_LocatorTo_ID;
|
|
@ -1,30 +0,0 @@
|
|||
CREATE OR REPLACE VIEW m_packagelines_avail_v AS
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 ) AS qty, iol.m_product_id, p.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
JOIN ad_clientinfo ci ON ci.ad_client_id = iol.ad_client_id
|
||||
WHERE p.ispicklistprintdetails = 'N' AND iol.m_product_id <> COALESCE(ci.m_productfreight_id, 0 ) AND (iol.qtyentered - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_inoutline_id = iol.m_inoutline_id), 0 )) <> 0
|
||||
UNION
|
||||
SELECT DISTINCT iol.ad_client_id, iol.ad_org_id, iol.m_inout_id, iol.m_inoutline_id, iol.line + pbom.line / 100 AS line, iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 ) AS qty, pbom.m_productbom_id AS m_product_id, p2.name AS productname, uom.name AS uom
|
||||
FROM m_inoutline iol
|
||||
LEFT JOIN m_packageline mpl ON iol.m_inoutline_id = mpl.m_inoutline_id
|
||||
JOIN m_product p ON iol.m_product_id = p.m_product_id
|
||||
JOIN m_product_bom pbom ON p.m_product_id = pbom.m_product_id
|
||||
JOIN m_product p2 ON pbom.m_productbom_id = p2.m_product_id
|
||||
JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
|
||||
WHERE p.isbom = 'Y' AND p.isverified = 'Y' AND p.ispicklistprintdetails = 'Y' AND (iol.qtyentered * pbom.bomqty - COALESCE(( SELECT sum(m_packageline.qty) AS sum
|
||||
FROM m_packageline
|
||||
WHERE m_packageline.m_product_id = p2.m_product_id AND (m_packageline.m_package_id IN ( SELECT m_package.m_package_id
|
||||
FROM m_package
|
||||
WHERE m_package.m_inout_id = iol.m_inout_id))), 0 )) <> 0
|
||||
ORDER BY 1, 2, 3, 5;
|
|
@ -1,16 +0,0 @@
|
|||
--create views
|
||||
CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V
|
||||
AS
|
||||
SELECT
|
||||
ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy,
|
||||
mp.VALUE, mp.help,
|
||||
(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable,
|
||||
ms.qtyonhand,
|
||||
ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id,
|
||||
mw.ad_org_id, mp.documentnote, mp.m_product_id
|
||||
FROM M_STORAGE ms
|
||||
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
||||
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
||||
LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id
|
||||
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||
ORDER BY mw.NAME;
|
|
@ -1,86 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS
|
||||
SELECT s.ad_client_id,
|
||||
s.ad_org_id,
|
||||
s.isactive,
|
||||
s.created,
|
||||
s.createdby,
|
||||
s.updated,
|
||||
s.updatedby,
|
||||
s.m_product_id,
|
||||
s.substitute_id,
|
||||
'S' AS rowtype,
|
||||
mp.name,
|
||||
sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable,
|
||||
sum(ms.qtyonhand) AS qtyonhand,
|
||||
sum(ms.qtyreserved) AS qtyreserved,
|
||||
currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd,
|
||||
mpr.m_pricelist_version_id,
|
||||
mw.m_warehouse_id,
|
||||
org.name AS orgname
|
||||
FROM m_substitute s
|
||||
JOIN m_storage ms ON ms.m_product_id = s.substitute_id
|
||||
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
|
||||
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
|
||||
LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id
|
||||
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
|
||||
JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id
|
||||
JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id
|
||||
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
|
||||
GROUP BY s.ad_client_id,
|
||||
s.ad_org_id,
|
||||
s.isactive,
|
||||
s.created,
|
||||
s.createdby,
|
||||
s.updated,
|
||||
s.updatedby,
|
||||
s.m_product_id,
|
||||
s.substitute_id,
|
||||
mw.m_warehouse_id,
|
||||
mpr.m_pricelist_version_id,
|
||||
org.name,
|
||||
mp.name,
|
||||
mpl.C_Currency_ID
|
||||
UNION
|
||||
SELECT r.ad_client_id,
|
||||
r.ad_org_id,
|
||||
r.isactive,
|
||||
r.created,
|
||||
r.createdby,
|
||||
r.updated,
|
||||
r.updatedby,
|
||||
r.m_product_id,
|
||||
r.relatedproduct_id AS substitute_id,
|
||||
'R' AS rowtype,
|
||||
mp.name,
|
||||
sum(CASE WHEN COALESCE(lt.IsAvailableForReservation,'Y')='Y' THEN ms.qtyonhand ELSE 0 END - ms.qtyreserved) AS qtyavailable,
|
||||
sum(ms.qtyonhand) AS qtyonhand,
|
||||
sum(ms.qtyreserved) AS qtyreserved,
|
||||
currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd,
|
||||
mpr.m_pricelist_version_id,
|
||||
mw.m_warehouse_id,
|
||||
org.name AS orgname
|
||||
FROM m_relatedproduct r
|
||||
JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id
|
||||
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
|
||||
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
|
||||
LEFT JOIN M_LOCATORTYPE lt ON ml.m_locatortype_id = lt.m_locatortype_id
|
||||
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
|
||||
JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id
|
||||
JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id
|
||||
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
|
||||
GROUP BY r.ad_client_id,
|
||||
r.ad_org_id,
|
||||
r.isactive,
|
||||
r.created,
|
||||
r.createdby,
|
||||
r.updated,
|
||||
r.updatedby,
|
||||
r.m_product_id,
|
||||
r.relatedproduct_id,
|
||||
mw.m_warehouse_id,
|
||||
mpr.m_pricelist_version_id,
|
||||
org.name,
|
||||
mp.name,
|
||||
mpl.C_Currency_ID;
|
|
@ -1,62 +0,0 @@
|
|||
CREATE OR REPLACE VIEW m_storage
|
||||
AS
|
||||
SELECT s.m_product_id,
|
||||
s.m_locator_id,
|
||||
s.ad_client_id,
|
||||
s.ad_org_id,
|
||||
s.isactive,
|
||||
s.created,
|
||||
s.createdby,
|
||||
s.updated,
|
||||
s.updatedby,
|
||||
s.qtyonhand,
|
||||
0 AS qtyreserved,
|
||||
0 AS qtyordered,
|
||||
s.datelastinventory,
|
||||
s.m_attributesetinstance_id,
|
||||
s.m_storageonhand_uu AS m_storage_uu,
|
||||
s.datematerialpolicy AS datematerialpolicy
|
||||
FROM m_storageonhand s
|
||||
UNION ALL
|
||||
SELECT sr.m_product_id,
|
||||
w.m_reservelocator_id AS m_locator_id,
|
||||
sr.ad_client_id,
|
||||
sr.ad_org_id,
|
||||
sr.isactive,
|
||||
sr.created,
|
||||
sr.createdby,
|
||||
sr.updated,
|
||||
sr.updatedby,
|
||||
0 AS qtyonhand,
|
||||
sr.qty AS qtyreserved,
|
||||
0 AS qtyordered,
|
||||
sr.datelastinventory,
|
||||
sr.m_attributesetinstance_id,
|
||||
sr.m_storagereservation_uu AS m_storage_uu,
|
||||
null as datematerialpolicy
|
||||
FROM m_storagereservation sr
|
||||
JOIN m_warehouse w
|
||||
ON sr.m_warehouse_id = w.m_warehouse_id
|
||||
WHERE sr.issotrx = 'Y' and sr.qty <> 0
|
||||
UNION ALL
|
||||
SELECT so.m_product_id,
|
||||
w.m_reservelocator_id AS m_locator_id,
|
||||
so.ad_client_id,
|
||||
so.ad_org_id,
|
||||
so.isactive,
|
||||
so.created,
|
||||
so.createdby,
|
||||
so.updated,
|
||||
so.updatedby,
|
||||
0 AS qtyonhand,
|
||||
0 AS qtyreserved,
|
||||
so.qty AS qtyordered,
|
||||
so.datelastinventory,
|
||||
so.m_attributesetinstance_id,
|
||||
so.m_storagereservation_uu AS m_storage_uu,
|
||||
null as datematerialpolicy
|
||||
FROM m_storagereservation so
|
||||
JOIN m_warehouse w
|
||||
ON so.m_warehouse_id = w.m_warehouse_id
|
||||
WHERE so.issotrx = 'N' and so.qty <> 0
|
||||
;
|
|
@ -1,26 +0,0 @@
|
|||
CREATE OR REPLACE VIEW M_TRANSACTION_V
|
||||
(M_TRANSACTION_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED,
|
||||
CREATEDBY, UPDATED, UPDATEDBY, MOVEMENTTYPE, M_LOCATOR_ID,
|
||||
M_PRODUCT_ID, MOVEMENTDATE, MOVEMENTQTY, M_INVENTORYLINE_ID, M_INVENTORY_ID,
|
||||
M_MOVEMENTLINE_ID, M_MOVEMENT_ID, M_INOUTLINE_ID, M_INOUT_ID, M_PRODUCTIONLINE_ID,
|
||||
M_PRODUCTION_ID, C_PROJECTISSUE_ID, C_PROJECT_ID, M_ATTRIBUTESETINSTANCE_ID)
|
||||
AS
|
||||
SELECT M_Transaction_ID,
|
||||
t.AD_Client_ID, t.AD_Org_ID, t.IsActive, t.Created,t.CreatedBy, t.Updated,t.UpdatedBy,
|
||||
t.MovementType, t.M_Locator_ID, t.M_Product_ID, t.MovementDate, t.MovementQty,
|
||||
t.M_InventoryLine_ID, i.M_Inventory_ID,
|
||||
t.M_MovementLine_ID, m.M_Movement_ID,
|
||||
t.M_InOutLine_ID, io.M_InOut_ID,
|
||||
t.M_ProductionLine_ID, pp.M_Production_ID,
|
||||
t.C_ProjectIssue_ID, pi.C_Project_ID,
|
||||
t.M_AttributeSetInstance_ID
|
||||
FROM M_Transaction t
|
||||
LEFT OUTER JOIN M_InOutLine io ON (t.M_InOutLine_ID=io.M_InOutLine_ID AND t.M_AttributeSetInstance_ID=io.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN M_MovementLine m ON (t.M_MovementLine_ID=m.M_MovementLine_ID AND t.M_AttributeSetInstance_ID=m.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN M_InventoryLine i ON (t.M_InventoryLine_ID=i.M_InventoryLine_ID AND t.M_AttributeSetInstance_ID=i.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN C_ProjectIssue pi ON (t.C_ProjectIssue_ID=pi.C_ProjectIssue_ID AND t.M_AttributeSetInstance_ID=pi.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN M_ProductionLine pl ON (t.M_ProductionLine_ID=pl.M_ProductionLine_ID AND t.M_AttributeSetInstance_ID=pl.M_AttributeSetInstance_ID)
|
||||
LEFT OUTER JOIN M_ProductionPlan pp ON (pl.M_ProductionPlan_ID=pp.M_ProductionPlan_ID);
|
||||
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_BOMLine_v
|
||||
AS
|
||||
SELECT obl.AD_Client_ID, obl.AD_Org_ID, obl.IsActive, obl.Created, obl.CreatedBy, obl.Updated, obl.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
obl.Description , feature , obl.M_Product_ID, obl.backflushgroup ,obl.C_UOM_ID, obl.componentType, obl.datedelivered, obl.forecast, obl.help ,
|
||||
obl.iscritical, obl.issuemethod , obl.leadtimeoffset, obl.line, obl.m_attributesetinstance_id , obl.m_changenotice_id, obl.m_locator_id , obl.m_warehouse_id,
|
||||
obl.pp_order_bom_ID,obl.pp_order_bomLine_id,obl.pp_order_id, obl.qtydelivered, obl.qtypost, obl.qtyreject, obl.qtyscrap, obl.scrap , obl.validfrom, obl.validto , obl.assay,
|
||||
obl.ad_user_id,
|
||||
round(obl.qtyrequiered, 4) AS qtyrequiered,
|
||||
round(bomqtyreserved(obl.m_product_id, obl.m_warehouse_id, 0), 4) AS qtyreserved,
|
||||
round(bomqtyavailable(obl.m_product_id, obl.m_warehouse_id, 0), 4) AS qtyavailable,
|
||||
round(bomqtyonhand(obl.m_product_id, obl.m_warehouse_id, 0), 4) AS qtyonhand,
|
||||
round(obl.qtybom, 4) AS qtybom,
|
||||
obl.isqtypercentage,
|
||||
round(obl.qtybatch, 4) AS qtybatch,
|
||||
CASE WHEN o.qtybatchs = 0 THEN 1 ELSE round(obl.qtyrequiered / o.qtybatchs, 4) END AS qtybatchsize
|
||||
FROM PP_Order_BOMLine obl
|
||||
INNER JOIN PP_Order o ON (o.PP_Order_ID=obl.PP_Order_ID);
|
|
@ -1,21 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_BOMLine_vt
|
||||
AS
|
||||
SELECT
|
||||
obl.AD_Client_ID, obl.AD_Org_ID, obl.IsActive, obl.Created, obl.CreatedBy, obl.Updated, obl.UpdatedBy,
|
||||
oblt.AD_Language,
|
||||
oblt.Description , obl.feature , obl.m_Product_ID, obl.backflushgroup ,obl.C_UOM_ID, obl.componentType, obl.datedelivered, obl.forecast, oblt.help ,
|
||||
obl.iscritical, obl.issuemethod , obl.leadtimeoffset, obl.line, obl.m_attributesetinstance_id , obl.m_changenotice_id, obl.m_locator_id , obl.m_warehouse_id,
|
||||
obl.pp_order_bom_ID, obl.pp_order_bomline_ID,obl.pp_order_id, obl.qtydelivered, obl.qtypost, obl.qtyreject, obl.qtyscrap, obl.scrap , obl.validfrom, obl.validto , obl.assay,
|
||||
obl.ad_user_id,o.QtyBatchs,
|
||||
round(obl.qtyrequiered, 4) AS qtyrequiered,
|
||||
round(bomqtyreserved(obl.m_product_id, obl.m_warehouse_id, 0), 4) AS qtyreserved,
|
||||
round(bomqtyavailable(obl.m_product_id, obl.m_warehouse_id, 0), 4) AS qtyavailable,
|
||||
round(bomqtyonhand(obl.m_product_id, obl.m_warehouse_id, 0), 4) AS qtyonhand,
|
||||
round(obl.qtybom, 4) AS qtybom,
|
||||
obl.isqtypercentage,
|
||||
round(obl.qtybatch, 4) AS qtybatch,
|
||||
CASE WHEN o.qtybatchs = 0 THEN 1 ELSE round(obl.qtyrequiered / o.qtybatchs, 4) END AS qtybatchsize
|
||||
FROM PP_Order_BOMLine obl
|
||||
INNER JOIN PP_Order o ON (o.PP_Order_ID=obl.PP_Order_ID)
|
||||
LEFT JOIN PP_Order_BOMLine_Trl oblt ON (oblt.PP_Order_BOMLine_ID=obl.PP_Order_BOMLine_ID);
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_BOM_Header_v
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
d.PrintName AS DocumentType, d.DocumentNote AS DocumentTypeNote,
|
||||
o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo,
|
||||
--o.M_Product_ID,
|
||||
--o.M_AttributeSetInstance_ID,
|
||||
o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule ,
|
||||
o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered,
|
||||
o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield ,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID,
|
||||
--ob.PP_Product_BOM_ID,
|
||||
ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo,
|
||||
COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Order o
|
||||
INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID)
|
||||
INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID);
|
|
@ -1,26 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_BOM_Header_vt
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
obt.AD_Language,
|
||||
o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote,
|
||||
o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo,
|
||||
--o.M_Product_ID,
|
||||
--o.M_AttributeSetInstance_ID,
|
||||
o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule ,
|
||||
o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered,
|
||||
o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield ,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID,
|
||||
--ob.PP_Product_BOM_ID,
|
||||
ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo,
|
||||
COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Order o
|
||||
INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID)
|
||||
INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID)
|
||||
INNER JOIN PP_Order_BOM_Trl obt ON (obt.PP_Order_BOM_ID=ob.PP_Order_BOM_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID);
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_Header_v
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote,
|
||||
o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo,
|
||||
o.Description,
|
||||
o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule ,
|
||||
o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered,
|
||||
o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield ,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType,
|
||||
COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Order o
|
||||
INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID);
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_Header_VT
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
dt.AD_Language,
|
||||
o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote,
|
||||
o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo,
|
||||
o.Description,
|
||||
o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule ,
|
||||
o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered,
|
||||
o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield ,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType,
|
||||
COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Order o
|
||||
INNER JOIN C_DocType_trl dt ON (o.C_DocType_ID=dt.C_DocType_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID);
|
||||
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_Node_v
|
||||
AS
|
||||
SELECT
|
||||
onode.AD_Client_ID, onode.AD_Org_ID, onode.IsActive, onode.Created, onode.CreatedBy, onode.Updated, onode.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
name, c_bpartner_id, cost, datefinish, datefinishschedule, datestart, datestartschedule ,
|
||||
description, docaction, docstatus,duration, durationreal, durationrequiered, help, ismilestone,
|
||||
issubcontracting, movingtime, overlapunits,
|
||||
pp_order_id, pp_order_workflow_id, onode.pp_order_node_id,priority, qtydelivered, qtyrequiered ,
|
||||
qtyscrap , queuingtime , s_resource_id , setuptime ,setuptimereal, unitscycles , validfrom , validto , value , waitingtime , workingtime , yield
|
||||
FROM PP_Order_Node onode;
|
|
@ -1,12 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_Node_vt
|
||||
AS
|
||||
SELECT
|
||||
onode.AD_Client_ID, onode.AD_Org_ID, onode.IsActive, onode.Created, onode.CreatedBy, onode.Updated, onode.UpdatedBy,
|
||||
ont.AD_Language,
|
||||
ont.name, c_bpartner_id, cost, datefinish, datefinishschedule, datestart, datestartschedule ,
|
||||
ont.description, docaction, docstatus, duration, durationreal, durationrequiered, ont.help, ismilestone,
|
||||
issubcontracting, movingtime, overlapunits,
|
||||
pp_order_id, pp_order_workflow_id,onode.pp_order_node_id, priority, qtydelivered, qtyrequiered ,
|
||||
qtyscrap , queuingtime , s_resource_id , setuptime ,setuptimereal, unitscycles , validfrom , validto , value , waitingtime , workingtime , yield
|
||||
FROM PP_Order_Node onode
|
||||
LEFT JOIN PP_Order_Node_Trl ont ON (ont.PP_Order_Node_ID=onode.PP_Order_Node_ID);
|
|
@ -1,30 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_Workflow_Header_v
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
o.PP_Order_ID,
|
||||
--o.DocumentNo,
|
||||
o.DocStatus,
|
||||
o.C_DocType_ID,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
d.PrintName AS DocumentType, d.DocumentNote AS DocumentTypeNote,
|
||||
o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo,
|
||||
--o.M_Product_ID,
|
||||
--o.M_AttributeSetInstance_ID,
|
||||
o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule ,
|
||||
o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered,
|
||||
o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap ,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID,
|
||||
-- Order Workflow Field
|
||||
ow.Name ,ow.Description ,ow.Help,
|
||||
ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit , ow.Version, ow.ValidFrom , ow.ValidTo ,
|
||||
ow.MovingTime, ow.OverlapUnits , ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles,
|
||||
ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Order o
|
||||
INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID)
|
||||
INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID);
|
|
@ -1,30 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Order_Workflow_Header_vt
|
||||
AS
|
||||
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
|
||||
owt.AD_Language,
|
||||
o.PP_Order_ID,
|
||||
--o.DocumentNo,
|
||||
o.DocStatus,
|
||||
o.C_DocType_ID,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID,
|
||||
dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote,
|
||||
o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo,
|
||||
o.C_UOM_ID,o.PP_Product_BOM_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule ,
|
||||
o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered,
|
||||
o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.S_Resource_ID ,
|
||||
o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID,
|
||||
--Trl Field
|
||||
owt.Name , owt.Description, owt.Help,
|
||||
-- Order Workflow Field
|
||||
ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit, ow.Version, ow.ValidFrom , ow.ValidTo ,
|
||||
ow.MovingTime, ow.OverlapUnits, ow.AD_Workflow_ID, ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles,
|
||||
ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Order o
|
||||
INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID)
|
||||
INNER JOIN PP_Order_Workflow_Trl owt ON (owt.PP_Order_Workflow_ID=ow.PP_Order_Workflow_ID)
|
||||
INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)
|
||||
INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID);
|
|
@ -1,35 +0,0 @@
|
|||
CREATE VIEW PP_Product_BOMLine_v AS
|
||||
SELECT
|
||||
feature ,
|
||||
bl.ad_org_id ,
|
||||
assay ,
|
||||
backflushgroup ,
|
||||
c_uom_id,
|
||||
componenttype,
|
||||
bl.created ,
|
||||
bl.createdby,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
blt.description,
|
||||
forecast,
|
||||
blt.help ,
|
||||
bl.isactive ,
|
||||
iscritical ,
|
||||
isqtypercentage,
|
||||
issuemethod ,
|
||||
leadtimeoffset ,
|
||||
line ,
|
||||
m_attributesetinstance_id ,
|
||||
m_changenotice_id ,
|
||||
m_product_id ,
|
||||
bl.pp_product_bomline_id ,
|
||||
pp_product_bom_id ,
|
||||
qtybom ,
|
||||
qtybatch ,
|
||||
scrap ,
|
||||
bl.updated ,
|
||||
bl.updatedby,
|
||||
validfrom ,
|
||||
bl.ad_client_id ,
|
||||
validto
|
||||
FROM PP_Product_BOMLine bl
|
||||
INNER JOIN PP_Product_BOMLine_Trl blt ON (blt.PP_Product_BOMLine_ID=bl.PP_Product_BOMLine_ID);
|
|
@ -1,35 +0,0 @@
|
|||
CREATE VIEW PP_Product_BOMLine_vt AS
|
||||
SELECT
|
||||
feature ,
|
||||
bl.ad_org_id ,
|
||||
assay ,
|
||||
backflushgroup ,
|
||||
c_uom_id,
|
||||
componenttype,
|
||||
bl.created ,
|
||||
bl.createdby,
|
||||
blt.AD_Language,
|
||||
blt.description,
|
||||
forecast,
|
||||
blt.help ,
|
||||
bl.isactive ,
|
||||
iscritical ,
|
||||
isqtypercentage,
|
||||
issuemethod ,
|
||||
leadtimeoffset ,
|
||||
line ,
|
||||
m_attributesetinstance_id ,
|
||||
m_changenotice_id ,
|
||||
m_product_id ,
|
||||
bl.pp_product_bomline_id ,
|
||||
pp_product_bom_id ,
|
||||
qtybom ,
|
||||
qtybatch ,
|
||||
scrap ,
|
||||
bl.updated ,
|
||||
bl.updatedby,
|
||||
validfrom ,
|
||||
bl.ad_client_id ,
|
||||
validto
|
||||
FROM PP_Product_BOMLine bl
|
||||
INNER JOIN PP_Product_BOMLine_Trl blt ON (blt.PP_Product_BOMLine_ID=bl.PP_Product_BOMLine_ID);
|
|
@ -1,11 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Product_BOM_Header_v
|
||||
AS
|
||||
SELECT b.AD_Client_ID, b.AD_Org_ID, b.IsActive, b.Created, b.CreatedBy, b.Updated, b.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language,
|
||||
b.DocumentNo,b.name,b.help,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
b.Description,processing, validfrom, validto, bomtype, bomuse, m_changenotice_id,
|
||||
b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Product_BOM b
|
||||
INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (b.AD_Client_ID=ci.AD_Client_ID);
|
|
@ -1,12 +0,0 @@
|
|||
CREATE OR REPLACE VIEW PP_Product_BOM_Header_vt
|
||||
AS
|
||||
SELECT b.AD_Client_ID, b.AD_Org_ID, b.IsActive, b.Created, b.CreatedBy, b.Updated, b.UpdatedBy,
|
||||
'' AS AD_Language,
|
||||
b.DocumentNo,bt.Name,bt.help,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
bt.Description,processing, validfrom, validto, bomtype, bomuse, m_changenotice_id,
|
||||
b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM PP_Product_BOM b
|
||||
LEFT JOIN PP_Product_BOM_Trl bt ON (bt.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (b.AD_Client_ID=ci.AD_Client_ID);
|
|
@ -1,47 +0,0 @@
|
|||
DROP VIEW rv_allocation;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_allocation
|
||||
AS
|
||||
SELECT h.c_allocationhdr_id,
|
||||
h.ad_client_id,
|
||||
h.ad_org_id,
|
||||
h.isactive,
|
||||
h.created,
|
||||
h.createdby,
|
||||
h.updated,
|
||||
h.updatedby,
|
||||
h.documentno,
|
||||
h.description,
|
||||
h.datetrx,
|
||||
h.dateacct,
|
||||
h.c_currency_id,
|
||||
h.approvalamt,
|
||||
h.ismanual,
|
||||
h.docstatus,
|
||||
h.docaction,
|
||||
h.processed,
|
||||
l.c_allocationline_id,
|
||||
l.c_invoice_id,
|
||||
l.c_bpartner_id,
|
||||
l.c_order_id,
|
||||
l.c_payment_id,
|
||||
l.c_cashline_id,
|
||||
l.amount,
|
||||
l.discountamt,
|
||||
l.writeoffamt,
|
||||
l.overunderamt,
|
||||
h.isapproved,
|
||||
h.posted,
|
||||
l.ad_org_id AS c_allocationline_ad_org_id,
|
||||
l.created AS c_allocationline_created,
|
||||
l.createdby AS c_allocationline_createdby,
|
||||
l.datetrx AS c_allocationline_datetrx,
|
||||
l.isactive AS c_allocationline_isactive,
|
||||
l.ismanual AS c_allocationline_ismanual,
|
||||
l.updated AS c_allocationline_updated,
|
||||
l.updatedby AS c_allocationline_updatedby
|
||||
FROM c_allocationhdr h
|
||||
JOIN c_allocationline l
|
||||
ON h.c_allocationhdr_id = l.c_allocationhdr_id
|
||||
;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_ASSET_CUSTOMER
|
||||
(A_ASSET_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED,
|
||||
CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME,
|
||||
DESCRIPTION, HELP, A_ASSET_GROUP_ID, M_PRODUCT_ID, SERNO,
|
||||
LOT, VERSIONNO, GUARANTEEDATE, ASSETSERVICEDATE, C_BPARTNER_ID,
|
||||
C_BPARTNER_LOCATION_ID, AD_USER_ID, DELIVERYCOUNT)
|
||||
AS
|
||||
SELECT A_Asset_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||||
Value, Name, Description, Help, A_Asset_Group_ID, M_Product_ID, SerNo, Lot, VersionNo,
|
||||
GuaranteeDate, AssetServiceDate,
|
||||
C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID,
|
||||
(SELECT COUNT(*) FROM A_Asset_Delivery ad WHERE a.A_Asset_ID=ad.A_Asset_ID) AS DeliveryCount
|
||||
FROM A_Asset a
|
||||
WHERE C_BPartner_ID IS NOT NULL;
|
||||
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_ASSET_DELIVERY
|
||||
(A_ASSET_DELIVERY_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED,
|
||||
CREATEDBY, UPDATED, UPDATEDBY, A_ASSET_ID, A_ASSET_GROUP_ID,
|
||||
M_PRODUCT_ID, GUARANTEEDATE, ASSETSERVICEDATE, C_BPARTNER_ID, AD_USER_ID,
|
||||
MOVEMENTDATE, SERNO, LOT, VERSIONNO, M_INOUTLINE_ID,
|
||||
EMAIL, MESSAGEID, DELIVERYCONFIRMATION, URL, REMOTE_ADDR,
|
||||
REMOTE_HOST, REFERRER, DESCRIPTION)
|
||||
AS
|
||||
SELECT ad.A_Asset_Delivery_ID, ad.AD_Client_ID, ad.AD_Org_ID, ad.IsActive, ad.Created, ad.CreatedBy, ad.Updated, ad.UpdatedBy,
|
||||
a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID,
|
||||
a.GuaranteeDate, a.AssetServiceDate,
|
||||
a.C_BPartner_ID, ad.AD_User_ID,
|
||||
ad.MovementDate, ad.SerNo, ad.Lot, ad.VersionNo,
|
||||
ad.M_InOutLine_ID,
|
||||
ad.Email, ad.MessageID, ad.DeliveryConfirmation,
|
||||
ad.URL, ad.Remote_Addr, ad.Remote_Host, ad.Referrer,
|
||||
ad.Description
|
||||
FROM A_Asset_Delivery ad
|
||||
INNER JOIN A_Asset a ON (a.A_Asset_ID=ad.A_Asset_ID);
|
||||
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_ASSET_SUMMONTH
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, A_ASSET_ID, A_ASSET_GROUP_ID, M_PRODUCT_ID,
|
||||
VALUE, NAME, DESCRIPTION, HELP, GUARANTEEDATE,
|
||||
ASSETSERVICEDATE, C_BPARTNER_ID, AD_USER_ID, SERNO, LOT,
|
||||
VERSIONNO, MOVEMENTDATE, DELIVERYCOUNT)
|
||||
AS
|
||||
SELECT a.AD_Client_ID, a.AD_Org_ID, a.IsActive, a.Created, a.CreatedBy, a.Updated, a.UpdatedBy,
|
||||
a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID,
|
||||
a.Value, a.Name, a.Description, a.Help,
|
||||
a.GuaranteeDate, a.AssetServiceDate,
|
||||
a.C_BPartner_ID, a.AD_User_ID, a.SerNo, a.Lot, a.VersionNo,
|
||||
firstOf(ad.MovementDate, 'MM') AS MovementDate,
|
||||
COUNT(*) AS DeliveryCount
|
||||
FROM A_Asset a
|
||||
INNER JOIN A_Asset_Delivery ad ON (a.A_Asset_ID=ad.A_Asset_ID)
|
||||
GROUP BY a.AD_Client_ID, a.AD_Org_ID, a.IsActive, a.Created, a.CreatedBy, a.Updated, a.UpdatedBy,
|
||||
a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID,
|
||||
a.Value, a.Name, a.Description, a.Help,
|
||||
a.GuaranteeDate, a.AssetServiceDate,
|
||||
a.C_BPartner_ID, a.AD_User_ID, a.SerNo, a.Lot, a.VersionNo,
|
||||
firstOf(ad.MovementDate, 'MM');
|
||||
|
||||
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
DROP VIEW rv_bpartner;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_bpartner
|
||||
AS
|
||||
SELECT bp.ad_client_id,
|
||||
bp.ad_org_id,
|
||||
bp.isactive,
|
||||
bp.created,
|
||||
bp.createdby,
|
||||
bp.updated,
|
||||
bp.updatedby,
|
||||
bp.c_bpartner_id,
|
||||
bp.value,
|
||||
bp.name,
|
||||
bp.name2,
|
||||
bp.description,
|
||||
bp.issummary,
|
||||
bp.c_bp_group_id,
|
||||
bp.isonetime,
|
||||
bp.isprospect,
|
||||
bp.isvendor,
|
||||
bp.iscustomer,
|
||||
bp.isemployee,
|
||||
bp.issalesrep,
|
||||
bp.referenceno,
|
||||
bp.duns,
|
||||
bp.url,
|
||||
bp.ad_language,
|
||||
bp.taxid,
|
||||
bp.istaxexempt,
|
||||
bp.c_invoiceschedule_id,
|
||||
bp.rating,
|
||||
bp.salesvolume,
|
||||
bp.numberemployees,
|
||||
bp.naics,
|
||||
bp.firstsale,
|
||||
bp.acqusitioncost,
|
||||
bp.potentiallifetimevalue,
|
||||
bp.actuallifetimevalue,
|
||||
bp.shareofcustomer,
|
||||
bp.paymentrule,
|
||||
bp.so_creditlimit,
|
||||
bp.so_creditused,
|
||||
bp.so_creditused - bp.so_creditlimit AS so_creditavailable,
|
||||
bp.c_paymentterm_id,
|
||||
bp.m_pricelist_id,
|
||||
bp.m_discountschema_id,
|
||||
bp.c_dunning_id,
|
||||
bp.isdiscountprinted,
|
||||
bp.so_description,
|
||||
bp.poreference,
|
||||
bp.paymentrulepo,
|
||||
bp.po_pricelist_id,
|
||||
bp.po_discountschema_id,
|
||||
bp.po_paymentterm_id,
|
||||
bp.documentcopies,
|
||||
bp.c_greeting_id,
|
||||
bp.invoicerule,
|
||||
bp.deliveryrule,
|
||||
bp.freightcostrule,
|
||||
bp.deliveryviarule,
|
||||
bp.salesrep_id,
|
||||
bp.sendemail,
|
||||
bp.bpartner_parent_id,
|
||||
bp.invoice_printformat_id,
|
||||
bp.socreditstatus,
|
||||
bp.shelflifeminpct,
|
||||
bp.ad_orgbp_id,
|
||||
bp.flatdiscount,
|
||||
bp.totalopenbalance,
|
||||
c.ad_user_id,
|
||||
c.name AS contactname,
|
||||
c.description AS contactdescription,
|
||||
c.email,
|
||||
c.supervisor_id,
|
||||
c.emailuser,
|
||||
c.c_greeting_id AS bpcontactgreeting,
|
||||
c.title,
|
||||
c.comments,
|
||||
c.phone,
|
||||
c.phone2,
|
||||
c.fax,
|
||||
c.lastcontact,
|
||||
c.lastresult,
|
||||
c.birthday,
|
||||
c.ad_orgtrx_id,
|
||||
c.emailverify,
|
||||
c.ldapuser,
|
||||
c.emailverifydate,
|
||||
c.notificationtype,
|
||||
l.c_bpartner_location_id,
|
||||
a.postal,
|
||||
a.city,
|
||||
a.address1,
|
||||
a.address2,
|
||||
a.address3,
|
||||
a.c_region_id,
|
||||
COALESCE(r.name, a.regionname) AS regionname,
|
||||
a.c_country_id,
|
||||
cc.name AS countryname,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
l.ad_org_id AS c_bp_location_ad_org_id,
|
||||
l.c_bpartner_id AS c_bp_location_c_bpartner_id,
|
||||
l.c_location_id AS c_bp_location_c_location_id,
|
||||
l.created AS c_bp_location_created,
|
||||
l.createdby AS c_bp_location_createdby,
|
||||
l.c_salesregion_id AS c_bp_location_salesregion_id,
|
||||
l.fax AS c_bp_location_fax,
|
||||
l.isactive AS c_bp_location_isactive,
|
||||
l.isbillto AS c_bp_location_isbillto,
|
||||
l.isdn AS c_bp_location_isdn,
|
||||
l.ispayfrom AS c_bp_location_ispayfrom,
|
||||
l.isremitto AS c_bp_location_isremitto,
|
||||
l.isshipto AS c_bp_location_isshipto,
|
||||
l.name AS c_bp_location_name,
|
||||
l.phone AS c_bp_location_phone,
|
||||
l.phone2 AS c_bp_location_phone2,
|
||||
l.updated AS c_bp_location_updated,
|
||||
l.updatedby AS c_bp_location_updatedby,
|
||||
c.ad_org_id AS ad_user_ad_org_id,
|
||||
c.c_bpartner_id AS ad_user_c_bpartner_id,
|
||||
c.c_bpartner_location_id AS ad_user_c_bpartner_location_id,
|
||||
c.created AS ad_user_created,
|
||||
c.createdby AS ad_user_createdby,
|
||||
c.isactive AS ad_user_isactive,
|
||||
c.updated AS ad_user_updated,
|
||||
c.updatedby AS ad_user_updatedby,
|
||||
c.value AS ad_user_value,
|
||||
a.address4,
|
||||
a.ad_org_id AS c_location_ad_org_id,
|
||||
a.c_city_id,
|
||||
a.c_location_id,
|
||||
a.created AS c_location_created,
|
||||
a.createdby AS c_location_createdby,
|
||||
a.isactive AS c_location_isactive,
|
||||
a.postal_add,
|
||||
a.updated AS c_location_updated,
|
||||
a.updatedby AS c_location_updatedby,
|
||||
r.ad_org_id AS c_region_ad_org_id,
|
||||
r.c_country_id AS c_region_c_country_id,
|
||||
r.description AS c_region_description,
|
||||
r.isactive AS c_region_isactive,
|
||||
r.isdefault,
|
||||
cc.ad_language AS c_country_ad_language,
|
||||
cc.c_currency_id AS c_country_c_currency_id,
|
||||
cc.countrycode,
|
||||
cc.description AS c_country_description,
|
||||
cc.isactive AS c_country_isactive
|
||||
FROM c_bpartner bp
|
||||
LEFT JOIN c_bpartner_location l
|
||||
ON bp.c_bpartner_id = l.c_bpartner_id
|
||||
AND l.isactive = 'Y'
|
||||
LEFT JOIN ad_user c
|
||||
ON bp.c_bpartner_id = c.c_bpartner_id
|
||||
AND ( c.c_bpartner_location_id IS NULL
|
||||
OR c.c_bpartner_location_id = l.c_bpartner_location_id )
|
||||
AND c.isactive = 'Y'
|
||||
LEFT JOIN c_location a
|
||||
ON l.c_location_id = a.c_location_id
|
||||
LEFT JOIN c_region r
|
||||
ON a.c_region_id = r.c_region_id
|
||||
JOIN c_country cc
|
||||
ON a.c_country_id = cc.c_country_id
|
||||
;
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
DROP VIEW rv_bpartneropen;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_bpartneropen
|
||||
AS
|
||||
SELECT i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
i.created,
|
||||
i.createdby,
|
||||
i.updated,
|
||||
i.updatedby,
|
||||
i.c_bpartner_id,
|
||||
i.c_currency_id,
|
||||
i.grandtotal * i.multiplierap AS amt,
|
||||
invoiceopen(i.c_invoice_id, i.c_invoicepayschedule_id) * i.multiplierap AS openamt,
|
||||
i.dateinvoiced AS datedoc,
|
||||
COALESCE(daysbetween(getdate(), ips.duedate), paymenttermduedays(i.c_paymentterm_id, i.dateinvoiced, getdate())) AS daysdue,
|
||||
i.c_campaign_id,
|
||||
i.c_project_id,
|
||||
i.c_activity_id,
|
||||
i.ad_orgtrx_id,
|
||||
i.c_charge_id,
|
||||
i.c_conversiontype_id,
|
||||
i.c_doctype_id,
|
||||
i.chargeamt,
|
||||
i.c_invoice_id,
|
||||
i.c_order_id,
|
||||
i.c_payment_id,
|
||||
i.dateacct,
|
||||
i.description,
|
||||
i.docstatus,
|
||||
i.documentno,
|
||||
i.isapproved,
|
||||
i.isselfservice,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.reversal_id
|
||||
FROM c_invoice_v i
|
||||
LEFT JOIN c_invoicepayschedule ips
|
||||
ON i.c_invoicepayschedule_id = ips.c_invoicepayschedule_id
|
||||
WHERE i.ispaid = 'N'
|
||||
AND i.docstatus IN ( 'CO', 'CL' )
|
||||
UNION
|
||||
SELECT p.ad_client_id,
|
||||
p.ad_org_id,
|
||||
p.isactive,
|
||||
p.created,
|
||||
p.createdby,
|
||||
p.updated,
|
||||
p.updatedby,
|
||||
p.c_bpartner_id,
|
||||
p.c_currency_id,
|
||||
p.payamt * p.multiplierap * ( -1 ) AS amt,
|
||||
paymentavailable(p.c_payment_id) * p.multiplierap * ( -1 ) AS openamt,
|
||||
p.datetrx AS datedoc,
|
||||
NULL AS daysdue,
|
||||
p.c_campaign_id,
|
||||
p.c_project_id,
|
||||
p.c_activity_id,
|
||||
p.ad_orgtrx_id,
|
||||
p.c_charge_id,
|
||||
p.c_conversiontype_id,
|
||||
p.c_doctype_id,
|
||||
p.chargeamt,
|
||||
p.c_invoice_id,
|
||||
p.c_order_id,
|
||||
p.c_payment_id,
|
||||
p.dateacct,
|
||||
p.description,
|
||||
p.docstatus,
|
||||
p.documentno,
|
||||
p.isapproved,
|
||||
p.isselfservice,
|
||||
p.posted,
|
||||
p.processedon,
|
||||
p.reversal_id
|
||||
FROM c_payment_v p
|
||||
WHERE p.isallocated = 'N'
|
||||
AND p.c_bpartner_id IS NOT NULL
|
||||
AND p.docstatus IN ( 'CO', 'CL' )
|
||||
;
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_CASH_DETAIL
|
||||
(C_CASH_ID, C_CASHLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
|
||||
CREATED, CREATEDBY, UPDATED, UPDATEDBY, C_CASHBOOK_ID,
|
||||
NAME, STATEMENTDATE, DATEACCT, PROCESSED, POSTED,
|
||||
LINE, DESCRIPTION, CASHTYPE, C_CURRENCY_ID, AMOUNT,
|
||||
CONVERTEDAMT, C_BANKACCOUNT_ID, C_INVOICE_ID, C_CHARGE_ID)
|
||||
AS
|
||||
SELECT cl.C_Cash_ID, cl.C_CashLine_ID,
|
||||
c.AD_Client_ID, c.AD_Org_ID, cl.IsActive, cl.Created, cl.CreatedBy, cl.Updated, cl.UpdatedBy,
|
||||
c.C_CashBook_ID, c.Name, c.StatementDate, c.DateAcct, c.Processed, c.Posted,
|
||||
cl.Line, cl.Description, cl.CashType, cl.C_Currency_ID, cl.Amount,
|
||||
currencyConvert(cl.Amount,cl.C_Currency_ID,cb.C_Currency_ID,c.StatementDate,0, c.AD_Client_ID, c.AD_Org_ID) AS ConvertedAmt,
|
||||
cl.C_BankAccount_ID, cl.C_Invoice_ID, cl.C_Charge_ID
|
||||
FROM C_Cash c
|
||||
INNER JOIN C_CashLine cl ON (c.C_Cash_ID=cl.C_Cash_ID)
|
||||
INNER JOIN C_CashBook cb ON (c.C_CashBook_ID=cb.C_CashBook_ID);
|
||||
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_CLICK_MONTH
|
||||
(AD_CLIENT_ID, AD_ORG_ID, NAME, DESCRIPTION, TARGETURL,
|
||||
C_BPARTNER_ID, CREATED, COUNTER)
|
||||
AS
|
||||
SELECT cc.AD_Client_ID, cc.AD_Org_ID,
|
||||
cc.Name, cc.Description, cc.TargetURL, cc.C_BPartner_ID,
|
||||
firstOf(c.Created,'MM') AS Created,
|
||||
COUNT(*) AS Counter
|
||||
FROM W_ClickCount cc
|
||||
INNER JOIN W_Click c ON (cc.W_ClickCount_ID=c.W_ClickCount_ID)
|
||||
WHERE cc.IsActive='Y'
|
||||
GROUP BY cc.AD_Client_ID, cc.AD_Org_ID,
|
||||
cc.Name, cc.Description, cc.TargetURL, cc.C_BPartner_ID,
|
||||
firstOf(c.Created,'MM');
|
||||
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_CLICK_UNPROCESSED
|
||||
(W_CLICK_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED,
|
||||
CREATEDBY, UPDATED, UPDATEDBY, TARGETURL, REFERRER,
|
||||
REMOTE_HOST, REMOTE_ADDR, USERAGENT, ACCEPTLANGUAGE, PROCESSED,
|
||||
W_CLICKCOUNT_ID, AD_USER_ID, EMAIL)
|
||||
AS
|
||||
SELECT W_CLICK_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,
|
||||
UPDATEDBY,TARGETURL,REFERRER,REMOTE_HOST,REMOTE_ADDR,USERAGENT,ACCEPTLANGUAGE,
|
||||
PROCESSED,W_CLICKCOUNT_ID,AD_USER_ID,EMAIL
|
||||
FROM W_Click
|
||||
WHERE W_ClickCount_ID IS NULL OR Processed='N';
|
||||
|
||||
|
||||
|
|
@ -1,304 +0,0 @@
|
|||
DROP VIEW rv_commissionrundetail;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_commissionrundetail
|
||||
AS
|
||||
SELECT cr.ad_client_id,
|
||||
cr.ad_org_id,
|
||||
cr.isactive,
|
||||
cr.created,
|
||||
cr.createdby,
|
||||
cr.updated,
|
||||
cr.updatedby,
|
||||
cr.c_commissionrun_id,
|
||||
cr.documentno,
|
||||
cr.description,
|
||||
cr.startdate,
|
||||
cr.grandtotal,
|
||||
cr.processed,
|
||||
c.c_commission_id,
|
||||
c.c_bpartner_id AS commission_bpartner_id,
|
||||
ca.c_commissionamt_id,
|
||||
ca.convertedamt AS commissionconvertedamt,
|
||||
ca.actualqty AS commissionqty,
|
||||
ca.commissionamt,
|
||||
cd.c_commissiondetail_id,
|
||||
cd.reference,
|
||||
cd.c_orderline_id,
|
||||
cd.c_invoiceline_id,
|
||||
cd.info,
|
||||
cd.c_currency_id,
|
||||
cd.actualamt,
|
||||
cd.convertedamt,
|
||||
cd.actualqty,
|
||||
i.documentno AS invoicedocumentno,
|
||||
COALESCE(i.dateinvoiced, o.dateordered) AS datedoc,
|
||||
COALESCE(il.m_product_id, ol.m_product_id) AS m_product_id,
|
||||
COALESCE(i.c_bpartner_id, o.c_bpartner_id) AS c_bpartner_id,
|
||||
COALESCE(i.c_bpartner_location_id, o.c_bpartner_location_id) AS c_bpartner_location_id,
|
||||
COALESCE(i.ad_user_id, o.ad_user_id) AS ad_user_id,
|
||||
COALESCE(i.c_doctype_id, o.c_doctype_id) AS c_doctype_id,
|
||||
cr.processing AS c_commisionrun_processing,
|
||||
c.ad_org_id AS c_commission_ad_org_id,
|
||||
c.c_currency_id AS c_commission_c_currency_id,
|
||||
c.created AS c_commission_created,
|
||||
c.createdby AS c_commission_createdby,
|
||||
c.createfrom,
|
||||
c.datelastrun,
|
||||
c.description AS c_commission_description,
|
||||
c.docbasistype,
|
||||
c.frequencytype,
|
||||
c.isactive AS c_commission_isactive,
|
||||
c.listdetails,
|
||||
c.name AS c_commission_name,
|
||||
c.updated AS c_commission_updated,
|
||||
c.updatedby AS c_commission_updatedby,
|
||||
ca.ad_org_id AS c_commissionamt_ad_org_id,
|
||||
ca.c_commissionline_id,
|
||||
ca.created AS c_commmissionamt_created,
|
||||
ca.createdby AS c_commmissionamt_createdby,
|
||||
ca.isactive AS c_commmissionamt_isactive,
|
||||
ca.updated AS c_commmissionamt_updated,
|
||||
ca.updatedby AS c_commssionamt_updatedby,
|
||||
cd.ad_org_id AS c_commissiondetail_ad_org_id,
|
||||
cd.created AS c_commissiondetail_created,
|
||||
cd.createdby AS c_commissiondetail_createdby,
|
||||
cd.isactive AS c_commossiondetail_isactive,
|
||||
cd.updated AS c_commissiondetail_updated,
|
||||
cd.updatedby AS c_commissiondetail_updatedby,
|
||||
ol.ad_org_id AS c_orderline_ad_org_id,
|
||||
ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
|
||||
ol.c_activity_id AS c_orderline_c_activity_id,
|
||||
ol.c_bpartner_id AS c_orderline_c_bpartner_id,
|
||||
ol.c_bpartner_location_id AS c_orderline_c_bp_location_id,
|
||||
ol.c_campaign_id AS c_orderline_c_campaign_id,
|
||||
ol.c_charge_id AS c_orderline_c_charge_id,
|
||||
ol.c_currency_id AS c_orderline_c_currency_id,
|
||||
ol.c_order_id AS c_orderline_c_order_id,
|
||||
ol.c_project_id AS c_orderline_c_project_id,
|
||||
ol.c_projectphase_id AS c_orderline_c_projectphase_id,
|
||||
ol.c_projecttask_id AS c_orderline_c_projecttask_id,
|
||||
ol.created AS c_orderline_created,
|
||||
ol.createdby AS c_orderline_createdby,
|
||||
ol.c_tax_id AS c_orderline_c_tax_id,
|
||||
ol.c_uom_id AS c_orderline_c_uom_id,
|
||||
ol.datedelivered,
|
||||
ol.dateinvoiced,
|
||||
ol.dateordered,
|
||||
ol.datepromised,
|
||||
ol.description AS c_orderline_description,
|
||||
ol.discount,
|
||||
ol.freightamt,
|
||||
ol.isactive AS c_orderline_isactive,
|
||||
ol.isdescription,
|
||||
ol.line AS c_orderline_line,
|
||||
ol.linenetamt AS c_orderline_linenetamt,
|
||||
ol.link_orderline_id,
|
||||
ol.m_attributesetinstance_id AS c_orderline_m_asi_id,
|
||||
ol.m_promotion_id,
|
||||
ol.m_shipper_id AS c_orderline_m_shipper_id,
|
||||
ol.m_warehouse_id AS c_orderline_m_warehouse_id,
|
||||
ol.priceactual AS c_orderline_priceactual,
|
||||
ol.pricecost,
|
||||
ol.priceentered AS c_orderline_priceentered,
|
||||
ol.pricelist AS c_orderline_pricelist,
|
||||
ol.processed AS c_orderline_processed,
|
||||
ol.qtydelivered,
|
||||
ol.qtyentered,
|
||||
ol.qtyinvoiced AS c_orderline_qtyinvoiced,
|
||||
ol.qtylostsales,
|
||||
ol.qtyordered,
|
||||
ol.qtyreserved,
|
||||
ol.ref_orderline_id AS c_orderline_ref_orderline_id,
|
||||
ol.rramt AS c_orderline_rramt,
|
||||
ol.rrstartdate AS c_orderline_rrstartsate,
|
||||
ol.s_resourceassignment_id AS c_orderline_s_rassignment_id,
|
||||
ol.updated AS c_orderline_updated,
|
||||
ol.updatedby AS c_orderline_updatedby,
|
||||
ol.user1_id AS c_orderline_user1_id,
|
||||
ol.user2_id AS c_orderline_user2_id,
|
||||
il.ad_org_id AS c_inviceline_ad_org_id,
|
||||
il.ad_orgtrx_id AS c_invoiceline_ad_orgtrx_id,
|
||||
il.a_processed,
|
||||
il.c_activity_id AS c_invoiceline_c_activity_id,
|
||||
il.c_campaign_id AS c_invoiceline_c_campaign_id,
|
||||
il.c_charge_id AS c_invoiceline_c_charge_id,
|
||||
il.c_invoice_id,
|
||||
il.c_orderline_id AS c_invoiceline_c_orderline_id,
|
||||
il.c_project_id AS c_invoiceline_c_project_id,
|
||||
il.c_projectphase_id AS c_invoiceline_c_projphase_id,
|
||||
il.c_projecttask_id AS c_invoiceline_c_projecttask_id,
|
||||
il.created AS c_invoiceline_created,
|
||||
il.createdby AS c_invoiceline_createdby,
|
||||
il.c_tax_id AS c_invoiceline_c_tax_id,
|
||||
il.c_uom_id AS c_invoiceline_c_uom_id,
|
||||
il.description AS c_invoiceline_description,
|
||||
il.isactive AS c_invoiceline_isactive,
|
||||
il.isdescription AS c_invoiceline_isdescription,
|
||||
il.isprinted,
|
||||
il.line AS c_invoiceline_line,
|
||||
il.linenetamt AS c_invoiceline_linenetamt,
|
||||
il.linetotalamt AS c_invoiceline_linetotalamt,
|
||||
il.m_attributesetinstance_id AS c_invoiceline_m_asi_id,
|
||||
il.m_inoutline_id,
|
||||
il.m_rmaline_id AS c_invoiceline_m_rmaline_id,
|
||||
il.priceactual AS c_invoiceline_priceactual,
|
||||
il.priceentered AS c_invoiceline_priceentered,
|
||||
il.pricelimit AS c_invoiceline_pricelimit,
|
||||
il.pricelist AS c_invoiceline_pricelist,
|
||||
il.processed AS c_invoiceline_processed,
|
||||
il.qtyentered AS c_invoiceline_qtyentered,
|
||||
il.qtyinvoiced AS c_invoiceline_qtyinvoiced,
|
||||
il.ref_invoiceline_id AS c_invoiceline_ref_invline_id,
|
||||
il.rramt AS c_invoiceline_rramt,
|
||||
il.rrstartdate AS c_invoiceline_rrstartdate,
|
||||
il.s_resourceassignment_id AS c_invoiceline_s_rassignment_id,
|
||||
il.taxamt AS c_invoiceline_taxamt,
|
||||
il.updated AS c_invoiceline_updated,
|
||||
il.updatedby AS c_invoiceline_updatedby,
|
||||
il.user1_id AS c_invoiceline_user1_id,
|
||||
il.user2_id AS c_invoiceline_user2_id,
|
||||
o.ad_org_id AS c_order_ad_org_id,
|
||||
o.ad_orgtrx_id AS c_order_ad_orgtrx_id,
|
||||
o.ad_user_id AS c_order_ad_user_id,
|
||||
o.amountrefunded,
|
||||
o.amounttendered,
|
||||
o.bill_bpartner_id,
|
||||
o.bill_location_id,
|
||||
o.bill_user_id,
|
||||
o.c_activity_id,
|
||||
o.c_campaign_id AS c_order_c_campaign_id,
|
||||
o.c_cashline_id,
|
||||
o.c_cashplanline_id,
|
||||
o.c_charge_id,
|
||||
o.c_conversiontype_id,
|
||||
o.c_currency_id AS c_order_c_currency_id,
|
||||
o.c_doctypetarget_id,
|
||||
o.chargeamt AS c_order_chargeamt,
|
||||
o.copyfrom AS c_order_copyfrom,
|
||||
o.c_order_id AS c_order_c_order_id,
|
||||
o.c_payment_id AS c_order_c_payment_id,
|
||||
o.c_paymentterm_id AS c_order_paymentterm_id,
|
||||
o.c_pos_id,
|
||||
o.c_project_id AS c_order_c_project_id,
|
||||
o.created AS c_order_created,
|
||||
o.createdby AS c_order_createdby,
|
||||
o.dateacct AS c_order_dateacct,
|
||||
o.dateprinted AS c_order_dateprinted,
|
||||
o.datepromised AS c_order_datepromised,
|
||||
o.deliveryrule AS c_order_deliveryrule,
|
||||
o.deliveryviarule AS c_order_deliveryviarule,
|
||||
o.description AS c_order_description,
|
||||
o.docaction AS c_order_docaction,
|
||||
o.docstatus AS c_order_docstatus,
|
||||
o.documentno AS c_order_documentno,
|
||||
o.dropship_bpartner_id,
|
||||
o.dropship_location_id,
|
||||
o.dropship_user_id,
|
||||
o.freightamt AS c_order_freightamt,
|
||||
o.freightcostrule AS c_order_freightcostrule,
|
||||
o.grandtotal AS c_order_grandtotal,
|
||||
o.invoicerule,
|
||||
o.isactive AS c_order_isactive,
|
||||
o.isapproved,
|
||||
o.iscreditapproved,
|
||||
o.isdelivered,
|
||||
o.isdiscountprinted,
|
||||
o.isdropship,
|
||||
o.isinvoiced,
|
||||
o.ispayschedulevalid,
|
||||
o.isprinted AS c_order_isprinted,
|
||||
o.isselected AS c_order_isselected,
|
||||
o.isselfservice AS c_order_isselfservice,
|
||||
o.issotrx AS c_order_issotrx,
|
||||
o.istaxincluded AS c_order_istaxincluded,
|
||||
o.istransferred,
|
||||
o.link_order_id,
|
||||
o.m_freightcategory_id,
|
||||
o.m_pricelist_id,
|
||||
o.m_shipper_id AS c_order_m_shipper_id,
|
||||
o.m_warehouse_id AS c_order_m_warehouse_id,
|
||||
o.ordertype,
|
||||
o.pay_bpartner_id,
|
||||
o.pay_location_id,
|
||||
o.paymentrule,
|
||||
o.poreference,
|
||||
o.posted AS c_order_posted,
|
||||
o.priorityrule,
|
||||
o.processed AS c_order_processed,
|
||||
o.processedon AS c_order_processedon,
|
||||
o.promotioncode,
|
||||
o.ref_order_id AS c_order_ref_order_id,
|
||||
o.sendemail AS c_order_sendemail,
|
||||
o.totallines AS c_order_totallines,
|
||||
o.user1_id AS c_order_user1_id,
|
||||
o.user2_id AS c_order_user2_id,
|
||||
i.ad_org_id AS c_invoice_ad_org_id,
|
||||
i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
|
||||
i.c_activity_id AS c_invoice_c_activity_id,
|
||||
i.c_campaign_id AS c_invoice_c_campaign_id,
|
||||
i.c_charge_id AS c_invoice_c_charge_id,
|
||||
i.c_conversiontype_id AS c_invoice_c_conversiontype_id,
|
||||
i.c_currency_id AS c_invoice_c_currency_id,
|
||||
i.c_doctypetarget_id AS c_invoice_c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.chargeamt AS c_invoice_chargeamt,
|
||||
i.c_invoice_id AS c_invoice_c_invoice_id,
|
||||
i.c_order_id AS c_invoice_c_order_id,
|
||||
i.c_payment_id AS c_invoice_c_payment_id,
|
||||
i.c_paymentterm_id AS c_invoice_c_paymentterm_id,
|
||||
i.c_project_id AS c_invoice_c_project_id,
|
||||
i.created AS c_invoice_created,
|
||||
i.createdby AS c_invoice_createdby,
|
||||
i.dateacct AS c_invoice_dateacct,
|
||||
i.dateordered AS c_invoice_dateordered,
|
||||
i.dateprinted AS c_invoice_dateprinted,
|
||||
i.description AS c_invoice_description,
|
||||
i.docaction AS c_invoice_docaction,
|
||||
i.docstatus AS c_invoice_docstatus,
|
||||
i.dunninggrace AS c_invoice_dunninggrace,
|
||||
i.generateto,
|
||||
i.grandtotal AS c_invoice_grandtotal,
|
||||
i.invoicecollectiontype,
|
||||
i.isactive AS c_invoice_isactive,
|
||||
i.isapproved AS c_invoice_isapproved,
|
||||
i.isdiscountprinted AS c_invoice_isdiscountprinted,
|
||||
i.isindispute AS c_invoice_isindispute,
|
||||
i.ispayschedulevalid AS c_invoice_ispayschedulevalid,
|
||||
i.isprinted AS c_invoice_isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.issotrx AS c_invoice_issotrx,
|
||||
i.istaxincluded AS c_invoice_istaxincluded,
|
||||
i.istransferred AS c_invoice_istransferred,
|
||||
i.m_pricelist_id AS c_invoice_m_pricelist_id,
|
||||
i.m_rma_id AS c_invoice_m_rma_id,
|
||||
i.paymentrule AS c_invoice_paymentrule,
|
||||
i.poreference AS c_invoice_poreference,
|
||||
i.posted AS c_invoice_posted,
|
||||
i.processedon AS c_invoice_processedon,
|
||||
i.processing AS c_invoice_processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.salesrep_id AS c_invoice_salesrep_id,
|
||||
i.sendemail AS c_invoice_sendemail,
|
||||
i.totallines AS c_invoice_totallines,
|
||||
i.updated AS c_invoice_updated,
|
||||
i.updatedby AS c_invoice_updatedby,
|
||||
i.user1_id AS c_invoice_user1_id,
|
||||
i.user2_id AS c_invoice_user2_id
|
||||
FROM c_commissionrun cr
|
||||
JOIN c_commission c
|
||||
ON cr.c_commission_id = c.c_commission_id
|
||||
JOIN c_commissionamt ca
|
||||
ON cr.c_commissionrun_id = ca.c_commissionrun_id
|
||||
JOIN c_commissiondetail cd
|
||||
ON ca.c_commissionamt_id = cd.c_commissionamt_id
|
||||
LEFT JOIN c_orderline ol
|
||||
ON cd.c_orderline_id = ol.c_orderline_id
|
||||
LEFT JOIN c_invoiceline il
|
||||
ON cd.c_invoiceline_id = il.c_invoiceline_id
|
||||
LEFT JOIN c_order o
|
||||
ON ol.c_order_id = o.c_order_id
|
||||
LEFT JOIN c_invoice i
|
||||
ON il.c_invoice_id = i.c_invoice_id
|
||||
;
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
DROP VIEW rv_cost;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_cost
|
||||
AS
|
||||
SELECT c.ad_client_id,
|
||||
c.ad_org_id,
|
||||
c.isactive,
|
||||
c.created,
|
||||
c.createdby,
|
||||
c.updated,
|
||||
c.updatedby,
|
||||
p.m_product_id,
|
||||
p.value,
|
||||
p.name,
|
||||
p.upc,
|
||||
p.isbom,
|
||||
p.producttype,
|
||||
p.m_product_category_id,
|
||||
c.m_costtype_id,
|
||||
ce.m_costelement_id,
|
||||
ce.costelementtype,
|
||||
ce.costingmethod,
|
||||
ce.iscalculated,
|
||||
acct.c_acctschema_id,
|
||||
acct.c_currency_id,
|
||||
c.currentcostprice,
|
||||
c.futurecostprice,
|
||||
c.description,
|
||||
c.currentcostpricell,
|
||||
c.futurecostpricell,
|
||||
c.iscostfrozen,
|
||||
c.cumulatedamt,
|
||||
c.cumulatedqty,
|
||||
c.currentqty,
|
||||
c.m_attributesetinstance_id,
|
||||
c.percent,
|
||||
p.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
p.created AS m_product_created,
|
||||
p.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id,
|
||||
p.c_uom_id,
|
||||
p.description AS m_product_description,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.documentnote,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.imageurl,
|
||||
p.isactive AS m_product_isactive,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_attributesetinstance_id AS m_product_m_attributesetinsta,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.sku,
|
||||
p.s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
ce.ad_org_id AS m_costelement_ad_org_id,
|
||||
ce.description AS m_costelement_description,
|
||||
ce.isactive AS m_costelement_isactive,
|
||||
ce.name AS m_costelement_name,
|
||||
acct.ad_org_id AS c_acctschema_ad_org_id,
|
||||
acct.description AS c_acctschema_description,
|
||||
acct.name AS c_acctschema_name
|
||||
FROM m_cost c
|
||||
JOIN m_product p
|
||||
ON c.m_product_id = p.m_product_id
|
||||
JOIN m_costelement ce
|
||||
ON c.m_costelement_id = ce.m_costelement_id
|
||||
JOIN c_acctschema acct
|
||||
ON c.c_acctschema_id = acct.c_acctschema_id
|
||||
;
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
DROP VIEW rv_costdetail;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_costdetail
|
||||
AS
|
||||
SELECT c.ad_client_id,
|
||||
c.ad_org_id,
|
||||
c.isactive,
|
||||
c.created,
|
||||
c.createdby,
|
||||
c.updated,
|
||||
c.updatedby,
|
||||
p.m_product_id,
|
||||
p.value,
|
||||
p.name,
|
||||
p.upc,
|
||||
p.isbom,
|
||||
p.producttype,
|
||||
p.m_product_category_id,
|
||||
c.m_inoutline_id,
|
||||
c.c_invoiceline_id,
|
||||
asi.m_attributesetinstance_id,
|
||||
asi.m_attributeset_id,
|
||||
asi.lot,
|
||||
asi.serno,
|
||||
acct.c_acctschema_id,
|
||||
acct.c_currency_id,
|
||||
c.amt,
|
||||
c.qty,
|
||||
c.description,
|
||||
c.processed,
|
||||
c.c_orderline_id,
|
||||
c.c_projectissue_id,
|
||||
c.cumulatedamt,
|
||||
c.cumulatedqty,
|
||||
c.currentcostprice,
|
||||
c.currentqty,
|
||||
c.deltaamt,
|
||||
c.deltaqty,
|
||||
c.issotrx,
|
||||
c.m_costdetail_id,
|
||||
c.m_costelement_id,
|
||||
c.m_inventoryline_id,
|
||||
c.m_movementline_id,
|
||||
c.m_productionline_id,
|
||||
c.pp_cost_collector_id,
|
||||
p.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
p.created AS m_product_created,
|
||||
p.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id,
|
||||
p.c_uom_id,
|
||||
p.description AS m_product_description,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.documentnote,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.imageurl,
|
||||
p.isactive AS m_product_isactive,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_attributesetinstance_id AS m_product_m_asi_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.sku,
|
||||
p.s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
acct.ad_org_id AS c_acctschema_ad_org_id,
|
||||
acct.description AS c_acctschema_description,
|
||||
acct.name AS c_acctschema_name,
|
||||
asi.ad_org_id AS m_asi_ad_org_id,
|
||||
asi.created AS m_asi_created,
|
||||
asi.createdby AS m_asi_createdby,
|
||||
asi.description AS m_asi_description,
|
||||
asi.guaranteedate,
|
||||
asi.isactive AS m_asi_isactive,
|
||||
asi.m_lot_id,
|
||||
asi.updated AS m_asi_updated,
|
||||
asi.updatedby AS m_asi_updatedby
|
||||
FROM m_costdetail c
|
||||
JOIN m_product p
|
||||
ON c.m_product_id = p.m_product_id
|
||||
JOIN c_acctschema acct
|
||||
ON c.c_acctschema_id = acct.c_acctschema_id
|
||||
JOIN m_attributesetinstance asi
|
||||
ON c.m_attributesetinstance_id = asi.m_attributesetinstance_id
|
||||
;
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_COSTSUMMARY
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATEDBY, CREATED,
|
||||
UPDATEDBY, UPDATED, M_PRODUCT_ID, VALUE, NAME,
|
||||
UPC, ISBOM, PRODUCTTYPE, M_PRODUCT_CATEGORY_ID, M_COSTTYPE_ID,
|
||||
C_ACCTSCHEMA_ID, C_CURRENCY_ID, CURRENTCOSTPRICE, FUTURECOSTPRICE)
|
||||
AS
|
||||
SELECT c.AD_Client_ID, c.AD_Org_ID, c.IsActive, 0 AS CreatedBy,getdate() AS Created,0 AS UpdatedBy,getdate() AS Updated,
|
||||
p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID,
|
||||
c.M_CostType_ID,
|
||||
acct.C_AcctSchema_ID, acct.C_Currency_ID,
|
||||
SUM(c.CurrentCostPrice) AS CurrentCostPrice, SUM(c.FutureCostPrice) AS FutureCostPrice
|
||||
FROM M_Cost c
|
||||
INNER JOIN M_Product p ON (c.M_Product_ID=p.M_Product_ID)
|
||||
INNER JOIN C_AcctSchema acct ON (c.C_AcctSchema_ID=acct.C_AcctSchema_ID)
|
||||
WHERE acct.M_CostType_ID=c.M_CostType_ID
|
||||
GROUP BY c.AD_Client_ID, c.AD_Org_ID, c.IsActive,
|
||||
p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID,
|
||||
c.M_CostType_ID, acct.C_AcctSchema_ID, acct.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
CREATE OR REPLACE VIEW rv_c_invoice
|
||||
AS
|
||||
SELECT i.c_invoice_id,
|
||||
i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
i.created,
|
||||
i.createdby,
|
||||
i.updated,
|
||||
i.updatedby,
|
||||
i.issotrx,
|
||||
i.documentno,
|
||||
i.docstatus,
|
||||
i.docaction,
|
||||
i.isprinted,
|
||||
i.isdiscountprinted,
|
||||
i.processing,
|
||||
i.processed,
|
||||
i.istransferred,
|
||||
i.ispaid,
|
||||
i.c_doctype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_order_id,
|
||||
i.description,
|
||||
i.isapproved,
|
||||
i.salesrep_id,
|
||||
i.dateinvoiced,
|
||||
i.dateprinted,
|
||||
i.dateacct,
|
||||
i.c_bpartner_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.ad_user_id,
|
||||
b.c_bp_group_id,
|
||||
i.poreference,
|
||||
i.dateordered,
|
||||
i.c_currency_id,
|
||||
i.c_conversiontype_id,
|
||||
i.paymentrule,
|
||||
i.c_paymentterm_id,
|
||||
i.m_pricelist_id,
|
||||
i.c_campaign_id,
|
||||
i.c_project_id,
|
||||
i.c_activity_id,
|
||||
i.ispayschedulevalid,
|
||||
i.invoicecollectiontype,
|
||||
loc.c_country_id,
|
||||
loc.c_region_id,
|
||||
loc.postal,
|
||||
loc.city,
|
||||
i.c_charge_id,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN i.chargeamt * ( -1 )
|
||||
ELSE i.chargeamt
|
||||
END AS chargeamt,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN i.totallines * ( -1 )
|
||||
ELSE i.totallines
|
||||
END AS totallines,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN i.grandtotal * ( -1 )
|
||||
ELSE i.grandtotal
|
||||
END AS grandtotal,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN ( -1 )
|
||||
ELSE 1
|
||||
END AS multiplier,
|
||||
i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
|
||||
i.c_conversiontype_id AS c_invoice_c_conversiontype_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.c_payment_id,
|
||||
i.dateordered AS c_invoice_dateordered,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid AS c_invoice_ispayschedulevalid,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.istaxincluded,
|
||||
i.m_rma_id,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.sendemail,
|
||||
i.user1_id,
|
||||
i.user2_id,
|
||||
b.acqusitioncost AS c_bp_acqusitioncost,
|
||||
b.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
b.ad_language AS c_bp_ad_language,
|
||||
b.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
b.ad_org_id AS c_bp_ad_org_id,
|
||||
b.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
b.c_dunning_id AS c_bp_c_dunning_id,
|
||||
b.c_greeting_id AS c_bp_c_greeting_id,
|
||||
b.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
b.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
b.created AS c_bp_created,
|
||||
b.createdby AS c_bp_createdby,
|
||||
b.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
b.deliveryrule AS c_bp_deliveryrule,
|
||||
b.deliveryviarule AS c_bp_deliveryviarule,
|
||||
b.description AS c_bp_description,
|
||||
b.dunninggrace AS c_bp_dunninggrace,
|
||||
b.duns AS c_bp_duns,
|
||||
b.firstsale AS c_bp_firstsale,
|
||||
b.flatdiscount AS c_bp_flatdiscount,
|
||||
b.freightcostrule AS c_bp_freightcostrule,
|
||||
b.invoicerule AS c_bp_invoicerule,
|
||||
b.isactive AS c_bp_isactive,
|
||||
b.iscustomer AS c_bp_iscustomer,
|
||||
b.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
b.isemployee AS c_bp_isemployee,
|
||||
b.ismanufacturer AS c_bp_ismanufacturer,
|
||||
b.isonetime AS c_bp_isonetime,
|
||||
b.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
b.isprospect AS c_bp_isprospect,
|
||||
b.issalesrep AS c_bp_issalesrep,
|
||||
b.issummary AS c_bp_issummary,
|
||||
b.istaxexempt AS c_bp_istaxexempt,
|
||||
b.isvendor AS c_bp_isvendor,
|
||||
b.logo_id AS c_bp_logo_id,
|
||||
b.m_discountschema_id AS c_bp_m_discountschema_id,
|
||||
b.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
b.naics AS c_bp_naics,
|
||||
b.name AS c_bp_name,
|
||||
b.name2 AS c_bp_name2,
|
||||
b.numberemployees AS c_bp_numberemployees,
|
||||
b.paymentrule AS c_bp_paymentrule,
|
||||
b.paymentrulepo AS c_bp_paymentrulepo,
|
||||
b.po_discountschema_id AS c_bp_po_discountschema_id,
|
||||
b.po_paymentterm_id AS c_bp_po_paymentterm_id,
|
||||
b.po_pricelist_id AS c_bp_po_pricelist_id,
|
||||
b.poreference AS c_bp_poreference,
|
||||
b.potentiallifetimevalue AS c_bp_potentiallifetimevalue,
|
||||
b.rating AS c_bp_rating,
|
||||
b.referenceno AS c_bp_referenceno,
|
||||
b.salesrep_id AS c_bp_salesrep_id,
|
||||
b.salesvolume AS c_bp_salesvolume,
|
||||
b.sendemail AS c_bp_sendemail,
|
||||
b.shareofcustomer AS c_bp_shareofcustomer,
|
||||
b.shelflifeminpct AS c_bp_shelflifeminpct,
|
||||
b.so_creditlimit AS c_bp_so_creditlimit,
|
||||
b.socreditstatus AS c_bp_socreditstatus,
|
||||
b.so_creditused AS c_bp_so_creditused,
|
||||
b.so_description AS c_bp_so_description,
|
||||
b.taxid,
|
||||
b.totalopenbalance AS c_bp_totalopenbalance,
|
||||
b.updated AS c_bp_updated,
|
||||
b.updatedby AS c_bp_updatedby,
|
||||
b.url AS c_bp_url,
|
||||
b.value AS c_bp_value,
|
||||
bpl.ad_org_id AS c_bp_location_ad_org_id,
|
||||
bpl.c_bpartner_id AS c_bp_location_c_bpartner_id,
|
||||
bpl.c_location_id AS c_bp_location_c_location_id,
|
||||
bpl.created AS c_bp_location_created,
|
||||
bpl.createdby AS c_bp_location_createdby,
|
||||
bpl.c_salesregion_id,
|
||||
bpl.fax AS c_bp_location_fax,
|
||||
bpl.isactive AS c_bp_location_isactive,
|
||||
bpl.isbillto,
|
||||
bpl.isdn,
|
||||
bpl.ispayfrom,
|
||||
bpl.isremitto,
|
||||
bpl.isshipto,
|
||||
bpl.name AS c_bp_location_name,
|
||||
bpl.phone AS c_bp_location_phone,
|
||||
bpl.phone2 AS c_bp_location_phone2,
|
||||
bpl.updated AS c_bp_location_updated,
|
||||
bpl.updatedby AS c_bp_location_updatedby,
|
||||
loc.address1,
|
||||
loc.address2,
|
||||
loc.address3,
|
||||
loc.address4,
|
||||
loc.ad_org_id AS c_location_ad_org_id,
|
||||
loc.c_city_id,
|
||||
loc.created AS c_location_created,
|
||||
loc.createdby AS c_location_createdby,
|
||||
loc.isactive AS c_location_isactive,
|
||||
loc.postal_add,
|
||||
loc.regionname,
|
||||
loc.updated AS c_location_updated,
|
||||
loc.updatedby AS c_location_updatedby
|
||||
FROM c_invoice i
|
||||
JOIN c_doctype d
|
||||
ON i.c_doctype_id = d.c_doctype_id
|
||||
JOIN c_bpartner b
|
||||
ON i.c_bpartner_id = b.c_bpartner_id
|
||||
JOIN c_bpartner_location bpl
|
||||
ON i.c_bpartner_location_id = bpl.c_bpartner_location_id
|
||||
JOIN c_location loc
|
||||
ON bpl.c_location_id = loc.c_location_id
|
||||
;
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
CREATE OR REPLACE VIEW rv_c_invoiceline AS
|
||||
SELECT il.ad_client_id,
|
||||
il.ad_org_id,
|
||||
il.isactive,
|
||||
il.created,
|
||||
il.createdby,
|
||||
il.updated,
|
||||
il.updatedby,
|
||||
il.c_invoiceline_id,
|
||||
i.c_invoice_id,
|
||||
i.salesrep_id,
|
||||
i.c_bpartner_id,
|
||||
i.c_bp_group_id,
|
||||
il.m_product_id,
|
||||
p.m_product_category_id,
|
||||
i.dateinvoiced,
|
||||
i.dateacct,
|
||||
i.issotrx,
|
||||
i.c_doctype_id,
|
||||
i.docstatus,
|
||||
i.ispaid,
|
||||
il.c_campaign_id,
|
||||
il.c_project_id,
|
||||
il.c_activity_id,
|
||||
il.c_projectphase_id,
|
||||
il.c_projecttask_id,
|
||||
il.qtyinvoiced * i.multiplier AS qtyinvoiced,
|
||||
il.qtyentered * i.multiplier AS qtyentered,
|
||||
il.m_attributesetinstance_id,
|
||||
productattribute(il.m_attributesetinstance_id) AS productattribute,
|
||||
pasi.m_attributeset_id,
|
||||
pasi.m_lot_id,
|
||||
pasi.guaranteedate,
|
||||
pasi.lot,
|
||||
pasi.serno,
|
||||
il.pricelist,
|
||||
il.priceactual,
|
||||
il.pricelimit,
|
||||
il.priceentered,
|
||||
CASE WHEN il.pricelist = 0 THEN 0 ELSE currencyRound((il.pricelist - il.priceactual) / il.pricelist * 100,i.C_Currency_ID,'N') END AS discount,
|
||||
CASE WHEN il.pricelimit = 0 THEN 0 ELSE currencyRound((il.priceactual - il.pricelimit) / il.pricelimit * 100,i.C_Currency_ID,'N') END AS margin,
|
||||
CASE WHEN il.pricelimit = 0 THEN 0 ELSE (il.priceactual - il.pricelimit) * il.qtyinvoiced * i.multiplier END AS marginamt,
|
||||
currencyRound(i.multiplier * il.linenetamt,i.C_Currency_ID,'N') AS linenetamt,
|
||||
currencyRound(i.multiplier * il.pricelist * il.qtyinvoiced,i.C_Currency_ID,'N') AS linelistamt,
|
||||
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN currencyRound(i.multiplier * il.linenetamt,i.C_Currency_ID,'N') ELSE currencyRound(i.multiplier * il.pricelimit * il.qtyinvoiced,i.C_Currency_ID,'N') END
|
||||
AS linelimitamt,
|
||||
currencyRound(i.multiplier * (il.pricelist * il.qtyinvoiced - il.linenetamt),i.C_Currency_ID,'N') AS linediscountamt,
|
||||
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN 0 ELSE currencyRound(i.multiplier * (il.linenetamt - il.pricelimit * il.qtyinvoiced),i.C_Currency_ID,'N') END AS
|
||||
lineoverlimitamt,
|
||||
il.ad_orgtrx_id,
|
||||
il.a_processed,
|
||||
il.c_charge_id,
|
||||
il.c_orderline_id,
|
||||
il.c_tax_id,
|
||||
il.c_uom_id AS c_invoiceline_c_uom_id,
|
||||
il.description AS c_invoiceline_description,
|
||||
il.isdescription,
|
||||
il.isprinted,
|
||||
il.line,
|
||||
il.linenetamt AS c_invoiceline_linenetamt,
|
||||
il.linetotalamt,
|
||||
il.m_inoutline_id,
|
||||
il.m_rmaline_id,
|
||||
il.processed,
|
||||
il.ref_invoiceline_id,
|
||||
il.rramt,
|
||||
il.rrstartdate,
|
||||
il.s_resourceassignment_id,
|
||||
il.taxamt,
|
||||
il.user1_id,
|
||||
il.user2_id,
|
||||
p.ad_org_id AS m_product_ad_org_id,
|
||||
p.classification,
|
||||
p.copyfrom AS m_product_copyfrom,
|
||||
p.created AS m_product_created,
|
||||
p.createdby AS m_product_createdby,
|
||||
p.c_revenuerecognition_id,
|
||||
p.c_subscriptiontype_id,
|
||||
p.c_taxcategory_id,
|
||||
p.c_uom_id AS m_productline_c_uom_id,
|
||||
p.description AS m_product_description,
|
||||
p.descriptionurl,
|
||||
p.discontinued,
|
||||
p.discontinuedat,
|
||||
p.documentnote,
|
||||
p.group1,
|
||||
p.group2,
|
||||
p.guaranteedays,
|
||||
p.guaranteedaysmin,
|
||||
p.help,
|
||||
p.imageurl,
|
||||
p.isactive AS m_product_isactive,
|
||||
p.isdropship,
|
||||
p.isexcludeautodelivery,
|
||||
p.isinvoiceprintdetails,
|
||||
p.ispicklistprintdetails,
|
||||
p.ispurchased,
|
||||
p.isselfservice,
|
||||
p.issold,
|
||||
p.isstocked,
|
||||
p.issummary AS m_product_issummary,
|
||||
p.isverified,
|
||||
p.iswebstorefeatured,
|
||||
p.lowlevel,
|
||||
p.m_attributeset_id AS m_product_m_attributeset_id,
|
||||
p.m_freightcategory_id,
|
||||
p.m_locator_id,
|
||||
p.m_product_id AS m_product_m_product_id,
|
||||
p.processing AS m_product_processing,
|
||||
p.producttype,
|
||||
p.r_mailtext_id,
|
||||
p.salesrep_id AS m_product_salesrep_id,
|
||||
p.s_expensetype_id,
|
||||
p.shelfdepth,
|
||||
p.shelfheight,
|
||||
p.shelfwidth,
|
||||
p.sku,
|
||||
p.s_resource_id,
|
||||
p.unitsperpack,
|
||||
p.unitsperpallet,
|
||||
p.updated AS m_product_updated,
|
||||
p.updatedby AS m_product_updatedby,
|
||||
p.versionno,
|
||||
p.volume,
|
||||
p.weight,
|
||||
pasi.ad_org_id AS m_asi_ad_org_id,
|
||||
pasi.created AS m_attributesetinstance_created,
|
||||
pasi.createdby AS m_asi_createdby,
|
||||
pasi.description AS m_asi_description,
|
||||
pasi.isactive AS m_attributesetinstance_isacti,
|
||||
pasi.serno AS m_attributesetinstance_serno,
|
||||
pasi.updated AS m_attributesetinstance_updated,
|
||||
pasi.updatedby AS m_asi_updatedby,
|
||||
pc.m_product_category_parent_id
|
||||
FROM rv_c_invoice i
|
||||
JOIN c_invoiceline il
|
||||
ON i.c_invoice_id = il.c_invoice_id
|
||||
LEFT JOIN m_product p
|
||||
ON il.m_product_id = p.m_product_id
|
||||
LEFT JOIN m_product_category pc
|
||||
ON p.m_product_category_id = pc.m_product_category_id
|
||||
LEFT JOIN m_attributesetinstance pasi
|
||||
ON il.m_attributesetinstance_id = pasi.m_attributesetinstance_id
|
||||
;
|
|
@ -1,161 +0,0 @@
|
|||
DROP VIEW rv_c_invoicetax;
|
||||
|
||||
CREATE OR REPLACE VIEW rv_c_invoicetax
|
||||
AS
|
||||
SELECT i.ad_client_id,
|
||||
i.ad_org_id,
|
||||
i.isactive,
|
||||
t.created,
|
||||
t.createdby,
|
||||
t.updated,
|
||||
t.updatedby,
|
||||
t.c_tax_id,
|
||||
i.c_invoice_id,
|
||||
i.c_doctype_id,
|
||||
i.c_bpartner_id,
|
||||
bp.taxid,
|
||||
bp.istaxexempt,
|
||||
i.dateacct,
|
||||
i.dateinvoiced,
|
||||
i.issotrx,
|
||||
i.documentno,
|
||||
i.ispaid,
|
||||
i.c_currency_id,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN t.taxbaseamt * ( -1 )
|
||||
ELSE t.taxbaseamt
|
||||
END AS taxbaseamt,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN t.taxamt * ( -1 )
|
||||
ELSE t.taxamt
|
||||
END AS taxamt,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN ( t.taxbaseamt + t.taxamt ) * ( -1 )
|
||||
ELSE t.taxbaseamt + t.taxamt
|
||||
END AS taxlinetotal,
|
||||
CASE
|
||||
WHEN charat(d.docbasetype, 3) = 'C' THEN ( -1 )
|
||||
ELSE 1
|
||||
END AS multiplier,
|
||||
t.ad_org_id AS c_invoicetax_ad_org_id,
|
||||
t.isactive AS c_invoicetax_isactive,
|
||||
t.istaxincluded AS c_invoicetax_istaxincluded,
|
||||
t.processed AS c_invoicetax_processed,
|
||||
i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
|
||||
i.ad_user_id,
|
||||
i.c_bpartner_location_id,
|
||||
i.c_activity_id,
|
||||
i.c_campaign_id,
|
||||
i.c_charge_id,
|
||||
i.c_conversiontype_id,
|
||||
i.c_doctypetarget_id,
|
||||
i.c_dunninglevel_id,
|
||||
i.chargeamt,
|
||||
i.c_order_id,
|
||||
i.c_payment_id,
|
||||
i.c_paymentterm_id AS c_invoice_c_paymentterm_id,
|
||||
i.created AS c_invoice_created,
|
||||
i.createdby AS c_invoice_createdby,
|
||||
i.dateprinted,
|
||||
i.description AS c_invoice_description,
|
||||
i.docaction,
|
||||
i.docstatus,
|
||||
i.dunninggrace,
|
||||
i.generateto,
|
||||
i.invoicecollectiontype,
|
||||
i.isapproved,
|
||||
i.isdiscountprinted,
|
||||
i.isindispute,
|
||||
i.ispayschedulevalid,
|
||||
i.isprinted,
|
||||
i.isselfservice AS c_invoice_isselfservice,
|
||||
i.istaxincluded AS c_invoice_istaxincluded,
|
||||
i.istransferred,
|
||||
i.m_pricelist_id,
|
||||
i.m_rma_id,
|
||||
i.paymentrule,
|
||||
i.poreference AS c_invoice_poreference,
|
||||
i.posted,
|
||||
i.processedon,
|
||||
i.processing,
|
||||
i.ref_invoice_id,
|
||||
i.reversal_id,
|
||||
i.salesrep_id,
|
||||
i.sendemail,
|
||||
i.totallines,
|
||||
i.updated AS c_invoice_updated,
|
||||
i.updatedby AS c_invoice_updatedby,
|
||||
i.user1_id,
|
||||
i.user2_id,
|
||||
bp.acqusitioncost AS c_bp_acqusitioncost,
|
||||
bp.actuallifetimevalue AS c_bp_actuallifetimevalue,
|
||||
bp.ad_language AS c_bp_ad_language,
|
||||
bp.ad_orgbp_id AS c_bp_ad_orgbp_id,
|
||||
bp.ad_org_id AS c_bp_ad_org_id,
|
||||
bp.bpartner_parent_id AS c_bp_bpartner_parent_id,
|
||||
bp.c_bp_group_id AS c_bp_c_bp_group_id,
|
||||
bp.c_dunning_id AS c_bp_c_dunning_id,
|
||||
bp.c_greeting_id AS c_bp_c_greeting_id,
|
||||
bp.c_invoiceschedule_id AS c_bp_c_invoiceschedule_id,
|
||||
bp.c_paymentterm_id AS c_bp_c_paymentterm_id,
|
||||
bp.created AS c_bp_created,
|
||||
bp.createdby AS c_bp_createdby,
|
||||
bp.c_taxgroup_id AS c_bp_c_taxgroup_id,
|
||||
bp.deliveryrule AS c_bp_deliveryrule,
|
||||
bp.deliveryviarule AS c_bp_deliveryviarule,
|
||||
bp.description AS c_bp_description,
|
||||
bp.dunninggrace AS c_bp_dunninggrace,
|
||||
bp.duns,
|
||||
bp.firstsale AS c_bp_firstsale,
|
||||
bp.flatdiscount AS c_bp_flatdiscount,
|
||||
bp.freightcostrule AS c_bp_freightcostrule,
|
||||
bp.invoicerule AS c_bp_invoicerule,
|
||||
bp.isactive AS c_bp_isactive,
|
||||
bp.iscustomer AS c_bp_iscustomer,
|
||||
bp.isdiscountprinted AS c_bp_isdiscountprinted,
|
||||
bp.isemployee AS c_bp_isemployee,
|
||||
bp.ismanufacturer AS c_bp_ismanufacturer,
|
||||
bp.isonetime AS c_bp_isonetime,
|
||||
bp.ispotaxexempt AS c_bp_ispotaxexempt,
|
||||
bp.isprospect AS c_bp_isprospect,
|
||||
bp.issalesrep AS c_bp_issalesrep,
|
||||
bp.issummary AS c_bp_issummary,
|
||||
bp.isvendor,
|
||||
bp.logo_id AS c_bp_logo_id,
|
||||
bp.m_discountschema_id,
|
||||
bp.m_pricelist_id AS c_bp_m_pricelist_id,
|
||||
bp.naics,
|
||||
bp.name AS c_bp_name,
|
||||
bp.name2 AS c_bp_name2,
|
||||
bp.numberemployees,
|
||||
bp.paymentrule AS c_bp_paymentrule,
|
||||
bp.paymentrulepo AS c_bp_paymentrulepo,
|
||||
bp.po_discountschema_id,
|
||||
bp.po_paymentterm_id,
|
||||
bp.po_pricelist_id,
|
||||
bp.poreference AS c_bp_poreference,
|
||||
bp.potentiallifetimevalue,
|
||||
bp.rating AS c_bp_rating,
|
||||
bp.salesrep_id AS c_bp_salesrep_id,
|
||||
bp.salesvolume,
|
||||
bp.sendemail AS c_bp_sendemail,
|
||||
bp.shareofcustomer,
|
||||
bp.shelflifeminpct,
|
||||
bp.so_creditlimit,
|
||||
bp.socreditstatus,
|
||||
bp.so_creditused,
|
||||
bp.so_description,
|
||||
bp.totalopenbalance AS c_bp_totalopenbalance,
|
||||
bp.updated AS c_bp_updated,
|
||||
bp.updatedby AS c_bp_updatedby,
|
||||
bp.url AS c_bp_url,
|
||||
bp.value AS c_bp_value
|
||||
FROM c_invoicetax t
|
||||
JOIN c_invoice i
|
||||
ON t.c_invoice_id = i.c_invoice_id
|
||||
JOIN c_doctype d
|
||||
ON i.c_doctype_id = d.c_doctype_id
|
||||
JOIN c_bpartner bp
|
||||
ON i.c_bpartner_id = bp.c_bpartner_id
|
||||
;
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_CUSTOMERPRODQTR
|
||||
(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED,
|
||||
LINENETAMT, LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT,
|
||||
LINEOVERLIMITAMT, LINEOVERLIMIT, QTYINVOICED, ISSOTRX)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID,
|
||||
il.C_BPartner_ID, il.M_Product_Category_ID,
|
||||
firstOf(il.DateInvoiced, 'Q') AS DateInvoiced, -- DD Day, DY Week, MM Month
|
||||
SUM(LineNetAmt) AS LineNetAmt,
|
||||
SUM(LineListAmt) AS LineListAmt,
|
||||
SUM(LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, il.M_Product_Category_ID,
|
||||
firstOf(il.DateInvoiced, 'Q'), il.IsSOTrx, i.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_CUSTOMERVENDQTR
|
||||
(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, VENDOR_ID, DATEINVOICED,
|
||||
LINENETAMT, LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT,
|
||||
LINEOVERLIMITAMT, LINEOVERLIMIT, QTYINVOICED)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID,
|
||||
il.C_BPartner_ID, po.C_BPartner_ID AS Vendor_ID,
|
||||
firstOf(il.DateInvoiced, 'Q') AS DateInvoiced, -- DD Day, DY Week, MM Month
|
||||
SUM(LineNetAmt) AS LineNetAmt,
|
||||
SUM(LineListAmt) AS LineListAmt,
|
||||
SUM(LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
SUM(QtyInvoiced) AS QtyInvoiced
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
INNER JOIN M_Product_PO po ON (il.M_Product_ID=po.M_Product_ID)
|
||||
WHERE il.IsSOTrx='Y'
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, po.C_BPartner_ID,
|
||||
firstOf(il.DateInvoiced, 'Q'), i.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_DAY
|
||||
(AD_CLIENT_ID, AD_ORG_ID, SALESREP_ID, DATEINVOICED, LINENETAMT,
|
||||
LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT,
|
||||
LINEOVERLIMIT, ISSOTRX)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
|
||||
firstOf(il.DateInvoiced, 'DD') AS DateInvoiced, -- DD Day, DY Week, MM Month
|
||||
SUM(LineNetAmt) AS LineNetAmt,
|
||||
SUM(LineListAmt) AS LineListAmt,
|
||||
SUM(LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
il.IsSOTrx
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
|
||||
firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, i.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_MONTH
|
||||
(AD_CLIENT_ID, AD_ORG_ID, SALESREP_ID, DATEINVOICED, LINENETAMT,
|
||||
LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT,
|
||||
LINEOVERLIMIT, ISSOTRX)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
|
||||
firstOf(il.DateInvoiced, 'MM') AS DateInvoiced, -- DD Day, DY Week, MM Month
|
||||
SUM(LineNetAmt) AS LineNetAmt,
|
||||
SUM(LineListAmt) AS LineListAmt,
|
||||
SUM(LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
il.IsSOTrx
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
|
||||
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_PRODMONTH
|
||||
(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED, LINENETAMT,
|
||||
LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT,
|
||||
LINEOVERLIMIT, QTYINVOICED, ISSOTRX)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
|
||||
firstOf(il.DateInvoiced, 'MM') AS DateInvoiced,
|
||||
SUM(il.LineNetAmt) AS LineNetAmt,
|
||||
SUM(il.LineListAmt) AS LineListAmt,
|
||||
SUM(il.LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
|
||||
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_PRODUCTMONTH
|
||||
(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, DATEINVOICED, LINENETAMT,
|
||||
LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT,
|
||||
LINEOVERLIMIT, QTYINVOICED, ISSOTRX)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||||
firstOf(il.DateInvoiced, 'MM') AS DateInvoiced,
|
||||
SUM(il.LineNetAmt) AS LineNetAmt,
|
||||
SUM(il.LineListAmt) AS LineListAmt,
|
||||
SUM(il.LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||||
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;
|
||||
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
CREATE OR REPLACE VIEW RV_C_INVOICE_PRODUCTQTR
|
||||
(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, DATEINVOICED, LINENETAMT,
|
||||
LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT,
|
||||
LINEOVERLIMIT, QTYINVOICED, ISSOTRX)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||||
firstOf(il.DateInvoiced, 'Q') AS DateInvoiced,
|
||||
SUM(il.LineNetAmt) AS LineNetAmt,
|
||||
SUM(il.LineListAmt) AS LineListAmt,
|
||||
SUM(il.LineLimitAmt) AS LineLimitAmt,
|
||||
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
|
||||
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||||
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') END AS LineDiscount,
|
||||
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||||
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||||
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
|
||||
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
|
||||
FROM RV_C_InvoiceLine il
|
||||
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
|
||||
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||||
firstOf(il.DateInvoiced, 'Q'), il.IsSOTrx, i.C_Currency_ID;
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue