src-db/database/model/functions/M_INOUT_POST.xml
changeset 19200 18970d099fa0
parent 19198 552342cfa929
child 19201 6eaa790b7470
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Mon Dec 31 11:05:17 2012 +0100
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Wed Jan 02 18:30:33 2013 +0100
@@ -533,12 +533,7 @@
                 	-- v_Qty := Cur_SLines.QtyOrdered;
                 	--END IF;
 
-								IF (v_count <> 0) THEN                
-								  SELECT max(M_MATCHPO_ID)
-								  INTO v_MatchPO_ID
-                  FROM M_MATCHPO
-								  WHERE C_ORDERLINE_ID = Cur_SLines.C_OrderLine_ID
-								    AND M_INOUTLINE_ID = Cur_SLines.M_InOutLine_ID; 
+								IF (v_count = 0) THEN                
                   
                 	Ad_Sequence_Next('M_MatchPO', Cur_SLines.AD_Org_ID, v_MatchPO_ID) ;
                 	-- The min qty. Modified by Ismael Ciordia
@@ -560,6 +555,12 @@
                   	)
                   	;
                  ELSE
+                       SELECT max(M_MATCHPO_ID)
+                       INTO v_MatchPO_ID
+                       FROM M_MATCHPO
+                       WHERE C_ORDERLINE_ID = Cur_SLines.C_OrderLine_ID
+                            AND M_INOUTLINE_ID = Cur_SLines.M_InOutLine_ID;
+                            
                 	v_ResultStr:='UpdateMatchPO ' || v_MatchPO_ID;
                 	UPDATE M_MATCHPO
                 	SET DateTrx = now(), Qty =v_Qty, Processing = 'N', Processed = 'Y', Posted='N'