ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 客户化PO修改后需要重新审批,但审批人要求为他人

客户化PO修改后需要重新审批,但审批人要求为他人

原创 Linux操作系统 作者:alex_pei 时间:2012-04-06 17:55:39 0 删除 编辑
想通过设置完成的最好死心,这个东西我研究了好一阵子,最后看了代码才明白靠设置不可能完成

再审批逻辑就是下面的这个过程,注释部分是我改的,改了后的逻辑变成:
1 数量减少,或者单价减少 造成的总金额减少 无法自审批
2 取消PO行造成总PO金额减少,无法自审批

标准功能,上面两个必走自审批,和单据类型里的PO属性的设置完全没关系。

======================================================

PO_CHORD_WF6.standard_po_reapproval

PROCEDURE standard_po_reapproval(itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
FUNCMODE IN VARCHAR2,
RESULT OUT NOCOPY VARCHAR2)
IS
x_header_control t_header_control_type;
x_lines_control t_lines_control_type;
x_shipments_control t_shipments_control_type;
x_dist_control t_dist_control_type;
x_tolerance_control t_tolerance_control_type;
x_result VARCHAR2(1);
l_retroactive_change VARCHAR2(1) := 'N'; -- RETROACTIVE FPI
l_autoapprove_retro VARCHAR2(1) := 'N'; -- RETROACTIVE FPI
v_header_id number; --Added by Water,21-Dec-2009
v_cancel_flag varchar2(1); --Added by Water,21-Dec-2009

BEGIN

IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** In Procedure: standard_po_reapproval ***');
END IF;

IF funcmode <> 'RUN' THEN
result := 'COMPLETE';
return;
END IF;

/* RETROACTIVE FPI START.
* Get the value of the attribute CO_H_RETROACTIVE_APPROVAL if
* this approval is initiated due to the retroactive change in
* the release. If this value is N, then we send the document
* through Change Order Workflow.
*/
l_retroactive_change := PO_WF_UTIL_PKG.GetItemAttrText
(itemtype => itemtype,
itemkey => itemkey,
aname => 'CO_R_RETRO_CHANGE');

If (l_retroactive_change = 'Y') then

l_autoapprove_retro := PO_WF_UTIL_PKG.GetItemAttrText
(itemtype => itemtype,
itemkey => itemkey,
aname => 'CO_H_RETROACTIVE_AUTOAPPROVAL');


if (l_autoapprove_retro = 'Y') then

IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'$$$$$$$ Document requires full approval = N $$$$$$');
END IF;

RESULT := 'N';

return;
end if; /*l_autoapprove_retro = 'Y' */

end if; /* l_retroactive_change = 'Y' */

/* RETROACTIVE FPI END */
po_chord_wf1.get_wf_header_control(itemtype, itemkey, x_header_control);
po_chord_wf2.get_wf_lines_control(itemtype, itemkey, x_lines_control);
po_chord_wf3.get_wf_shipments_control(itemtype, itemkey, x_shipments_control);
po_chord_wf4.get_wf_dist_control(itemtype, itemkey, x_dist_control);
po_chord_wf6.get_default_tolerance(itemtype, itemkey, x_tolerance_control);

/***************************************************************
* Check if the modifications to the document header requires
* full reapproval.
*
* Legends:
*
* 'Y' means modified
* 'N' means not modified
* Numbers are in Percentage
*
***************************************************************/

IF x_header_control.agent_id ='Y'
OR x_header_control.vendor_contact_id ='Y'
OR x_header_control.confirming_order_flag ='Y'
OR x_header_control.ship_to_location_id ='Y'
OR x_header_control.bill_to_location_id ='Y'
OR x_header_control.terms_id ='Y'
OR x_header_control.ship_via_lookup_code ='Y'
OR x_header_control.fob_lookup_code ='Y'
OR x_header_control.freight_terms_lookup_code ='Y'
OR x_header_control.note_to_vendor ='Y'
OR x_header_control.acceptance_required_flag ='Y'
OR x_header_control.acceptance_due_date ='Y'
--OR (x_header_control.po_total_change > nvl(x_tolerance_control.h_po_total_t,0))
or x_header_control.po_total_change != 0 --Changed by Water,24-Aug-2009

THEN
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## header_require_reapproval result: Y');
END IF;
x_result:='Y';
ELSE
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## header_require_reapproval result: N');
END IF;
x_result:='N';
END IF;

IF x_result <> 'Y' THEN
IF x_lines_control.line_num ='Y'
OR x_lines_control.item_id ='Y'
OR x_lines_control.item_revision ='Y'
OR x_lines_control.item_description ='Y'
OR x_lines_control.category_id ='Y'
OR x_lines_control.unit_meas_lookup_code ='Y'
OR x_lines_control.from_header_id ='Y'
OR x_lines_control.from_line_id ='Y'
OR x_lines_control.hazard_class_id ='Y'
OR x_lines_control.contract_num ='Y'
OR x_lines_control.vendor_product_num ='Y'
OR x_lines_control.un_number_id ='Y'
OR x_lines_control.price_type_lookup_code ='Y'
OR x_lines_control.note_to_vendor ='Y'
--OR (x_lines_control.quantity_change > nvl(x_tolerance_control.l_quantity_t,0))
--OR (x_lines_control.unit_price_change > nvl(x_tolerance_control.l_unit_price_t,0))
--Changed by Water,24-Aug-2009
or x_lines_control.quantity_change != 0
or x_lines_control.unit_price_change != 0
THEN
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## lines_require_reapproval result: Y');
END IF;
x_result:='Y';
ELSE
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## lines_require_reapproval result: N');
END IF;
x_result:='N';
END IF;
END IF;

IF x_result <> 'Y' THEN
IF x_shipments_control.shipment_num ='Y'
OR x_shipments_control.ship_to_location_id ='Y'
OR x_shipments_control.promised_date ='Y'
OR x_shipments_control.need_by_date ='Y'
OR x_shipments_control.last_accept_date ='Y'
/*OR (x_shipments_control.quantity_change >
nvl(x_tolerance_control.s_quantity_t,0))*/
OR x_shipments_control.quantity_change != 0 --Water
THEN
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## shipments_require_reapproval result: Y');
END IF;
x_result:='Y';
ELSE
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## shipments_require_reapproval result: N');
END IF;
x_result:='N';
END IF;
END IF;

/* Bug 1081717: kagarwal
** Added the Check for change in Charge Account for Distributions
** x_dist_control.code_combination_id = 'Y'
*/
/* Bug 2747157: kagarwal
** Added the Check for change in Gl Date for Distributions
** x_dist_control.gl_encumbered_date = 'Y' .
*/

IF x_result <> 'Y' THEN
IF x_dist_control.distribution_num ='Y'
OR x_dist_control.deliver_to_person_id ='Y'
OR x_dist_control.code_combination_id = 'Y'
OR x_dist_control.gl_encumbered_date = 'Y'
/*OR (x_dist_control.quantity_ordered_change >
nvl(x_tolerance_control.d_quantity_ordered_t,0))*/
OR x_dist_control.quantity_ordered_change != 0 --Water
THEN
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## dist_require_reapproval result: Y');
END IF;
x_result:='Y';
ELSE
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'########## dist_require_reapproval result: N');
END IF;
x_result:='N';
END IF;
END IF;

--
IF x_result <> 'Y' THEN
-- Check if contract terms were changed
x_result := PO_CONTERMS_WF_PVT.contract_terms_changed(
itemtype => itemtype,
itemkey => itemkey);
END IF;
--

--Added by Water,21-Dec-2009,for cancel po
if x_result = 'Y' then
v_header_id := wf_engine.GetItemAttrNumber(itemtype,itemkey,'DOCUMENT_ID');
begin
select a.cancel_flag into v_cancel_flag from po_headers_all a
where a.po_header_id = v_header_id;
if NVL(v_cancel_flag,'N') = 'Y' then
x_result := 'N';
end if;
exception
when others then
NULL;
end;
end if;
--End Water,for cancel po

IF x_result = 'Y' THEN
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'$$$$$$$ Document requires full approval = Y $$$$$$');
END IF;
RESULT := 'Y';
ELSE
IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'$$$$$$$ Document requires full approval = N $$$$$$');
END IF;
RESULT := 'N';
END IF;

IF (g_po_wf_debug = 'Y') THEN
PO_WF_DEBUG_PKG.INSERT_DEBUG(ITEMTYPE, ITEMKEY,
'*** Finish: standard_po_reapproval ***');
END IF;

return;

EXCEPTION

WHEN OTHERS THEN
wf_core.context('POAPPRV', 'po_chord_wf6.stanard_po_reapproval', 'others');
RAISE;

END;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21582648/viewspace-720584/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-05-06

  • 博文量
    11
  • 访问量
    12536