2013年2月24日 星期日

Build Payments 出現 ORA-06502

使用者在作大批付款 Payment Process Request,當執行到 Build Payments出現錯誤
view log 如下

Exception occured when building payments. Payment creation will be aborted and no payments will be committed for payment request 146440
SQLCODE: -6502
SQLERRM: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Build program error: Exception occured when attempting to create payments from the documents payable of the provided payment service request.

可能是 bug所造成的,但這一次不是
我的作法如下
1.啟用 FND Log机制
2.請使用者再作一次 Payment Process Request
3.檢示 FND Log 出現 ORA-06502的地方,找出 party id,再利用 party id找出是那一個 supplier
4.至 supplier維護畫面,看看 bank detail是否有些問題

最後被我找到是使用者把 bank account number和 bank account name的值相反了,而 account number太長了,所以造成錯誤。  請使用者把資料改成正確即可。



2013年2月19日 星期二

Oracle EBS R12 主帳本(Primary ledger) reversed 的Journal是否會自動拋至次帳本(Secondary Ledger)

如果是使用版本 12.1.3的話,應該預設就會有這個功能,如果是之前的版本的話,就要根據參考文件,更新 patch

更新完之後,請至 Accounting Setup Manager內,找出主帳本的 Setup
將 Synchronize Reversals between Primary and Secondary Ledger(s) 打勾即可。



參考文件
R12: Posting Reversal Journal in Primary Ledger not Creating the Reversal Journal in Secondary Ledger [ID 428196.1]

2013年1月27日 星期日

Voided 的 Payment 是否會拋至 NM

Voided 的 Payment 是否會拋至 NM ?

這要看 void前是否已經拋至 NM,如果使用者在一筆 Payment還沒作 void時已經拋至 NM的話,那之後再作 void,則 NM就會相對應產生一筆負數的資料。

如果使用者先 void一筆 Payment後再作 NM拋轉的動作,則這一筆就不會拋至 NM。

2012年12月26日 星期三

ASP.NET Forms Authentication Role-based Security

參考網址 http://www.codeproject.com/Articles/2905/Role-based-Security-with-Forms-Authentication


標準的asp.net 和 MVC都適用

驗證密碼後所要作的事,把資料寫入 cookie中

 FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Ticket version
Username.Value, // Username associated with ticket
DateTime.Now, // Date/time issued
DateTime.Now.AddMinutes(30), // Date/time to expire
true, // "true" for a persistent user cookie
reader.GetString(0), // User-data, in this case the roles
FormsAuthentication.FormsCookiePath);// Path cookie valid for

// Encrypt the cookie using the machine key for secure transport
string hash = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash); 
     // Set the cookie's expiration time to the tickets expiration time
if (ticket.IsPersistent) cookie.Expires = ticket.Expiration;

// Add the cookie to the list for outgoing response
Response.Cookies.Add(cookie);


最重要的是要在 Global.asax 加上這些程式碼

protected void Application_AuthenticateRequest(Object sender,
EventArgs e)
{
if (HttpContext.Current.User != null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
FormsIdentity id =
(FormsIdentity)HttpContext.Current.User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;

// Get our roles from user Data
string userData = ticket.UserData;
string[] roles = userData.Split(',');
HttpContext.Current.User = new GenericPrincipal(id, roles);
}
}
}
}

2012年12月24日 星期一

.Net 的基本技巧


建構子constructor 的相互呼叫 
建構子後面會加上 :this 的方式來呼叫另一個建構子,如下一個沒有參數的建構子會帶一個參數給另一個有帶參數的建構子
public Constructor1(): this(string1)
  {
  }
 
  public Constructor1(String string1)
  {
      ....          
  }




Constraints on Type Parameters

在新增 generic class 時可以限制其類別為何, 如下

public class Repository1 where TEntity : class


http://msdn.microsoft.com/en-us/library/d5x73970.aspx




Dynamic Entity Framework Queries with Predicate Builder


http://www.jaltiere.com/index.php/2012/02/15/dynamic-entity-framework-queries-with-predicate-builder/




Dynamically Composing Expression Predicates - Using PredicateBuilder

http://www.albahari.com/nutshell/predicatebuilder.aspx

2012年12月20日 星期四

javascript window.print 列印時不顯示列印按鈕


列印時不顯示列印按鈕等元件的話,可以試試下列的程式碼


// var v = document.getElementsByName('button1');
// v[0].style.display='none';
  document.getElementById('button1').style.display='none';
window.print();
var v = document.getElementsByName('button1');
v[0].style.display='inline'

2012年12月16日 星期日

SQL 供應商銀行帳號資料


要看這個銀行帳號沒有被任何 supplier使用的話,可以用 Bank Account ID來查詢
iby.iby_pmt_instr_uses_all,看看有沒有資料存在

SELECT SUPP.VENDOR_NAME,
       supp.segment1 verndor_number,
       ssite.vendor_site_code,
       bank.bank_number,
       bank.bank_name,
       branch.branch_number,
       branch.bank_branch_name,
       acct.foreign_payment_use_flag,
       acct.bank_account_num,
       acct.bank_account_name,
       ssite.org_id,
   
       uses.last_update_date
       ,fu.user_name  created_by
  FROM iby.iby_ext_bank_accounts   acct,
       apps.iby_ext_bank_branches_v branch,
       apps.iby_ext_banks_v         bank,
       iby.iby_pmt_instr_uses_all  uses,
       iby.iby_external_payees_all payee,
       ap.ap_suppliers            supp,
       ap.ap_supplier_sites_all   ssite
       ,APPLSYS.fnd_user                fu
 WHERE acct.branch_id = branch.branch_party_id(+)
   AND acct.bank_id = bank.bank_party_id(+)
   AND acct.ext_bank_account_id = uses.instrument_id
   AND uses.instrument_type = 'BANKACCOUNT'
   AND uses.ext_pmt_party_id = payee.ext_payee_id
   AND payee.supplier_site_id = ssite.vendor_site_id
   AND ssite.vendor_id = supp.vendor_id
     AND uses.created_by = fu.user_id


或者


SELECT SUPP.VENDOR_NAME,
       supp.segment1 verndor_number,
       ssite.vendor_site_code,
       bank.bank_number,
       bank.bank_name,
       branch.branch_number,
       branch.bank_branch_name,
       acct.foreign_payment_use_flag,
       acct.bank_account_num,
       acct.bank_account_name,
       ssite.org_id,
 
       uses.last_update_date
       ,fu.user_name  created_by
  FROM iby.iby_ext_bank_accounts   acct,
       apps.iby_ext_bank_branches_v branch,
       apps.iby_ext_banks_v         bank,
       iby.iby_pmt_instr_uses_all  uses,
       iby.iby_external_payees_all payee,
       ap.ap_suppliers            supp,
       ap.ap_supplier_sites_all   ssite
       ,APPLSYS.fnd_user                fu
 WHERE acct.branch_id = branch.branch_party_id(+)
   AND acct.bank_id = bank.bank_party_id(+)
   AND acct.ext_bank_account_id = uses.instrument_id
   AND uses.instrument_type = 'BANKACCOUNT'
   AND uses.ext_pmt_party_id = payee.ext_payee_id
   AND payee.supplier_site_id = ssite.vendor_site_id(+)
   AND supp.party_id = payee.payee_party_id
   AND uses.created_by = fu.user_id