ORACLE PO采购订单界面



--PO界面头查询SQL
SELECT org_id,
       attribute15,
       segment1,
       revision_num,
       doc_type_name,
       creation_date_disp,
       vendor_name,
       vendor_site_code,
       vendor_contact,
       ship_to_location,
       bill_to_location,
       currency_code,
       agent_name,
       status,
       comments,
       pcard_id,
       global_agreement_flag,
       payment_terms,
       freight_terms_dsp,
       ship_via_lookup_code,
       fob_dsp,
       pay_on_dsp,
       shipping_control,
       confirming_order_flag,
       firm_status_lookup_code,
       acceptance_required_flag,
       acceptance_due_date,
       supply_agreement_flag,
       note_to_vendor,
       note_to_receiver,
       start_date,
       end_date,
       user_hold_flag,
       cancel_flag,
       frozen_flag,
       row_id,
       attribute1,
       attribute2,
       attribute3,
       attribute5,
       attribute7,
       attribute8,
       attribute10,
       attribute11,
       attribute13,
       attribute14,
       amount_limit,
       min_release_amount,
       price_update_tolerance,
       quotation_class_code,
       attribute12,
       approval_required_flag,
       closed_code,
       rate_type,
       rate,
       from_type_lookup_code,
       authorization_status,
       revised_date,
       note_to_authorizer,
       print_count,
       vendor_order_num,
       reply_date,
       last_update_date,
       segment2,
       segment4,
       end_date_active,
       creation_date,
       created_by,
       vendor_id,
       vendor_site_id,
       attribute6,
       attribute9,
       vendor_contact_id,
       ship_to_location_id,
       bill_to_location_id,
       terms_id,
       status_lookup_code,
       rate_date,
       from_header_id,
       blanket_total_amount,
       approved_flag,
       approved_date,
       printed_date,
       reply_method_lookup_code,
       po_header_id,
       agent_id,
       last_updated_by,
       summary_flag,
       enabled_flag,
       segment3,
       segment5,
       start_date_active,
       last_update_login,
       government_context,
       program_application_id,
       program_id,
       program_update_date,
       request_id,
       closed_date,
       firm_date,
       attribute_category,
       attribute4,
       can_preparer_approve_flag,
       security_level_code,
       type_1099,
       vat_code,
       address_line1,
       address_line2,
       address_line3,
       city,
       state,
       zip,
       country,
       phone,
       fax,
       disp_rate_type,
       rfq_close_date,
       quote_type_lookup_code,
       quote_warning_delay_unit,
       quote_warning_delay,
       quote_vendor_quote_number,
       type_lookup_code,
       freight_terms_lookup_code,
       fob_lookup_code,
       pay_on_code,
       global_attribute_category,
       global_attribute1,
       global_attribute2,
       global_attribute3,
       global_attribute4,
       global_attribute5,
       global_attribute6,
       global_attribute7,
       global_attribute8,
       global_attribute9,
       global_attribute10,
       global_attribute11,
       global_attribute12,
       global_attribute13,
       global_attribute14,
       global_attribute15,
       global_attribute16,
       global_attribute17,
       global_attribute18,
       global_attribute19,
       global_attribute20,
       conterms_exist_flag,
       conterms_articles_upd_date,
       conterms_deliv_upd_date,
       encumbrance_required_flag,
       enable_all_sites
  FROM po_headers_v
 WHERE ('' IS NULL OR vendor_name LIKE '')
   AND ('' IS NULL OR agent_name LIKE '')
   AND ('' IS NULL OR rate_type IN (SELECT conversion_type
                                      FROM gl_daily_conversion_types
                                     WHERE user_conversion_type LIKE ''))
   AND ((nvl(consigned_consumption_flag, 'N') != 'Y'))
   AND (type_lookup_code IN ('STANDARD', 'PLANNED', 'BLANKET', 'CONTRACT'))
   AND ((NOT (type_lookup_code IN ('STANDARD', 'PLANNED', 'BLANKET', 'CONTRACT')) OR
       (((po_headers_v.security_level_code = 'PUBLIC') OR
       (po_headers_v.security_level_code = 'PRIVATE' AND 98 = agent_id) OR
       (po_headers_v.security_level_code = 'HIERARCHY' AND
       ((98 = agent_id) OR
       (EXISTS (SELECT 'Y'
                        FROM po_action_history poah2
                       WHERE poah2.employee_id = 98
                         AND poah2.object_type_code = (decode(po_headers_v.type_lookup_code,
                                                              'BLANKET',
                                                              'PA',
                                                              'STANDARD',
                                                              'PO',
                                                              'PLANNED',
                                                              'PO',
                                                              'CONTRACT',
                                                              'PA',
                                                              'RELEASE',
                                                              'RELEASE'))
                         AND poah2.object_id = po_headers_v.po_header_id)) OR
       (98 IN (SELECT h.superior_id
                       FROM po_employee_hierarchies h,
                            po_system_parameters    psp
                      WHERE h.employee_id = po_headers_v.agent_id
                        AND h.position_structure_id = nvl(psp.security_position_structure_id, -1)
                        AND psp.org_id = po_headers_v.org_id)))) OR
       (po_headers_v.security_level_code = 'PURCHASING' AND
       ((98 = agent_id) OR
       (EXISTS (SELECT 'Y'
                        FROM po_action_history poah2
                       WHERE poah2.employee_id = 98
                         AND poah2.object_type_code = (decode(po_headers_v.type_lookup_code,
                                                              'BLANKET',
                                                              'PA',
                                                              'STANDARD',
                                                              'PO',
                                                              'PLANNED',
                                                              'PO',
                                                              'CONTRACT',
                                                              'PA',
                                                              'RELEASE',
                                                              'RELEASE'))
                         AND poah2.object_id = po_headers_v.po_header_id)) OR
       (EXISTS
        (SELECT NULL
                 FROM po_agents
                WHERE agent_id = 98
                  AND SYSDATE BETWEEN nvl(start_date_active, SYSDATE) AND nvl(end_date_active, SYSDATE + 1)))))) AND
       (('MODIFY' = 'VIEW_ONLY') OR ('MODIFY' = 'MODIFY' AND po_headers_v.access_level_code IN ('MODIFY', 'FULL')) OR
       ('MODIFY' = 'FULL' AND po_headers_v.access_level_code = 'FULL') OR (98 = agent_id)))))
   AND ((cancel_flag IS NULL OR cancel_flag != 'Y'))
   AND ((frozen_flag IS NULL OR frozen_flag != 'Y'))
   AND ((closed_code IS NULL OR closed_code != 'FINALLY CLOSED'))
   AND ((authorization_status IS NULL OR authorization_status NOT IN ('IN PROCESS', 'PRE-APPROVED')))
   AND ((nvl(lock_owner_role, 'BUYER') = 'BUYER'))
 ORDER BY po_header_id DESC;

--PO行查询SQL
SELECT unit_price,
       amount,
       job_id,
       purchase_basis,
       line_num,
       line_type,
       item_revision,
       item_description,
       unit_meas_lookup_code,
       attribute1,
       attribute2,
       quantity,
       base_unit_price,
       attribute3,
       vendor_product_num,
       supplier_ref_number,
       base_uom,
       base_qty,
       secondary_uom,
       secondary_qty,
       qc_grade,
       secondary_unit_of_measure,
       secondary_quantity,
       preferred_grade,
       list_price_per_unit,
       market_price,
       price_type,
       allow_price_override_flag,
       not_to_exceed_price,
       negotiated_by_preparer_flag,
       contract_id,
       oke_contract_version_id,
       note_to_vendor,
       un_number,
       hazard_class,
       capital_expense_flag,
       transaction_reason,
       contractor_first_name,
       contractor_last_name,
       start_date,
       quantity_committed,
       committed_amount,
       row_id,
       transaction_reason_code,
       price_type_lookup_code,
       cancel_flag,
       cancel_date,
       expiration_date,
       price_break_lookup_code,
       firm_status_lookup_code,
       po_header_id,
       creation_date,
       hazard_class_id,
       program_id,
       program_update_date,
       request_id,
       closed_by,
       closed_date,
       closed_reason,
       attribute4,
       attribute7,
       attribute9,
       attribute11,
       attribute14,
       category_id,
       qty_rcv_tolerance,
       type_1099,
       attribute_category,
       attribute5,
       attribute6,
       attribute8,
       attribute10,
       reference_num,
       attribute12,
       attribute13,
       attribute15,
       min_release_amount,
       closed_code,
       government_context,
       program_application_id,
       min_order_quantity,
       max_order_quantity,
       over_tolerance_error_flag,
       unordered_flag,
       closed_flag,
       user_hold_flag,
       cancelled_by,
       cancel_reason,
       firm_date,
       po_line_id,
       last_update_date,
       last_updated_by,
       line_type_id,
       last_update_login,
       created_by,
       item_id,
       un_number_id,
       from_header_id,
       from_line_id,
       from_line_location_id,
       order_type_lookup_code,
       matching_basis,
       outside_operation_flag,
       allow_item_desc_update_flag,
       planned_item_flag,
       allowed_units_lookup_code,
       outside_operation_uom_type,
       primary_unit_class,
       global_attribute_category,
       global_attribute1,
       global_attribute2,
       global_attribute3,
       global_attribute4,
       global_attribute5,
       global_attribute6,
       global_attribute7,
       global_attribute8,
       global_attribute9,
       global_attribute10,
       global_attribute11,
       global_attribute12,
       global_attribute13,
       global_attribute14,
       global_attribute15,
       global_attribute16,
       global_attribute17,
       global_attribute18,
       global_attribute19,
       global_attribute20,
       oke_contract_header_id,
       manual_price_change_flag,
       tracking_secondary_default_ind,
       grade_control_flag,
       secondary_uom_code
  FROM po_lines_v
 WHERE nvl(cancel_flag, 'N') = 'N'
   AND nvl(closed_code, 'OPEN') != 'FINALLY CLOSED'
   AND (po_header_id = 1802123)
 ORDER BY line_num


你可能感兴趣的:(ORACLE,EBS,PO)