Архив

Публикации с меткой ‘Заказчики’

OEBS API: Деактивация счета заказчика

1 Октябрь 2014 Нет комментариев

Пример использования API для перевода счета заказчика в статус «Неактивно» — деактивация счета заказчика.

declare
  l_cust_account_rec hz_cust_account_v2pub.cust_account_rec_type;
  l_object_version_number number;
  --
  x_return_status varchar2(1);
  x_msg_data      varchar2(4000);
  x_msg_count     number;
begin
  l_cust_account_rec := null;
  l_cust_account_rec.cust_account_id := 9787987;
  l_cust_account_rec.status := 'I';
  
  select ca.object_version_number into l_object_version_number 
  from hz_cust_accounts ca 
  where cust_account_id = l_cust_account_rec.cust_account_id;
  -- Call the procedure
  hz_cust_account_v2pub.update_cust_account(p_init_msg_list         => 'T',
                                            p_cust_account_rec      => l_cust_account_rec,
                                            p_object_version_number => l_object_version_number,
                                            x_return_status         => x_return_status,
                                            x_msg_count             => x_msg_count,
                                            x_msg_data              => x_msg_data);
                                            
  dbms_output.put_line('x_return_status='||x_return_status);   
  commit;                                         
end;

Информация о расчетных счетах — поставщик или заказчик

oebs_supplier_customer

Запрос для определения типа расчетного счета:

(поставщик или заказчик)

SELECT account.bank_account_num
      ,account.ext_bank_account_id -- Link to Bank and Branch Information
      ,acc_instr.instrument_id
      ,case when ext_payer.ext_payer_id is not null then 'CUSTOMER'
            when ext_iep.ext_payee_id is not null   then 'SUPPLIER'
       end type_account
      ,case when ext_payer.ext_payer_id is not null then 
         (select ac.CUSTOMER_ID || ' - ' || ac.CUSTOMER_NAME 
          from ar_customers ac where ac.CUSTOMER_ID = ext_payer.cust_account_id)
            when ext_iep.ext_payee_id is not null then
         (select ap.vendor_id || ' - ' || ap.vendor_name 
          from ap_suppliers ap where ap.party_id = ext_iep.payee_party_id) 
       end owner_account_name
  FROM iby_ext_bank_accounts   account
      ,iby_pmt_instr_uses_all  acc_instr
      ,iby_external_payers_all ext_payer
      ,iby_external_payees_all ext_iep
 WHERE 1 = 1
   AND account.ext_bank_account_id = acc_instr.instrument_id
   AND acc_instr.ext_pmt_party_id = ext_payer.ext_payer_id(+)
   AND acc_instr.ext_pmt_party_id = ext_iep.ext_payee_id(+)
--   AND account.bank_account_num in ('','')

Список расчетных счетов для заказчиков

Для просмотра списка расчетных счетов заказчиков (покупателей, контрагентов) используем следующий запрос:

SELECT ac.CUSTOMER_id
   , cust.party_name customer_name
   , cust_acct.account_number
   , cust_acct.cust_account_id
   , cust_uses.site_use_code
   , cust_loc.address1
   , cust_loc.address2
   , cust_loc.address3
   , cust_loc.address4
   , cust_loc.city
   , cust_loc.postal_code
   , bank.party_name                   bank_name
   , bank_prof.home_country
   , branch.party_name                 branch_name
   , branch_prof.bank_or_branch_number branch_number
   , account.bank_account_num
   , account.bank_account_name
   , acc_instr.order_of_preference
   , cust_uses.primary_flag
FROM hz_parties               bank
   , hz_relationships         rel
   , hz_parties               branch
   , hz_organization_profiles bank_prof
   , hz_organization_profiles branch_prof
   , iby_ext_bank_accounts    account
   , iby_external_payers_all  ext_payer
   , iby_pmt_instr_uses_all   acc_instr
   , hz_parties               cust
   , hz_cust_accounts         cust_acct
   , hz_cust_acct_sites_all   cust_site
   , hz_cust_site_uses_all    cust_uses
   , hz_party_sites           party_site
   , hz_locations             cust_loc
   , ar_customers             ac
WHERE 1=1
AND bank.party_id                    = rel.object_id
and bank.party_type                  = rel.object_type
AND rel.object_table_name            = 'HZ_PARTIES'
AND rel.relationship_code            = 'BRANCH_OF'
AND rel.subject_id                   = branch.party_id
AND rel.subject_type                 = branch.party_type
AND rel.subject_table_name           = 'HZ_PARTIES'
AND bank.party_id                    = bank_prof.party_id
AND branch.party_id                  = branch_prof.party_id
AND cust_acct.cust_account_id        = cust_site.cust_account_id
AND cust_site.cust_acct_site_id      = cust_uses.cust_acct_site_id
and cust_uses.status                 = 'A'
AND party_site.party_id              = cust.party_id
AND party_site.party_site_id         = cust_site.party_site_id
AND party_site.location_id           = cust_loc.location_id
AND cust.party_id                    = cust_acct.party_id
AND bank.party_id                    = account.bank_id
AND branch.party_id                  = account.branch_id
AND account.ext_bank_account_id      = acc_instr.instrument_id
AND acc_instr.ext_pmt_party_id       = ext_payer.ext_payer_id
AND ext_payer.cust_account_id        = cust_acct.cust_account_id
AND cust_uses.site_use_id            = ext_payer.acct_site_use_id
and ext_payer.cust_account_id        = ac.CUSTOMER_id

R12: таблицы HZ (Заказчики)

14 Декабрь 2011 Нет комментариев

Рассмотрим назначение основных HZ таблиц и связи между ними.



HZ_PARTIES

Содержит основную информацию о сущностях (сторонах). Разные сущности могу иметь одинаковое имя.

Типы сущностей

  1. Person — лицо
  2. Organization — организация
  3. Group — группа
  4. Relationship — отношение
Поле Описание
PARTY_ID (PK) ID сущности
PARTY_NUMBER (PK) Номер  сущности
PARTY_NAME Имя  сущности
PARTY_TYPE Тип  сущности

Читать дальше про “R12: таблицы HZ (Заказчики)” »