pfc_updateprep


demopfc.pbl   >   w_sheet_sales_order   >   dw_master   >   pfc_updateprep   

Full name w_sheet_sales_order.dw_master.pfc_updateprep
Access public
Extend of
Return value
Prototype event pfc_updateprep()

Name Datatype
No Data

Name Datatype
i long
i_max int
i_nb_lignes int
i_rtn int
ii int
ll_counter long
ll_nb long

event pfc_updateprep;call super::pfc_updateprep;//////////////////////////////////////////////////////////////////////////////
//
//	Function		:	pfc_updateprep
//
//	Arguments	:	
//
//	Returns		:	integer
//
//	Description	:	MAJ the Master \ Detail !!!!!!
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision 	History			Author:	Novalys
//
//	Date			Version
//
//	06/07/2000		1.0   	Initial version
//
//////////////////////////////////////////////////////////////////////////////

long ll_counter , ll_nb, i
int i_nb_lignes,ii,i_max, i_rtn

Choose Case ib_new
		
	Case True

	  UPDATE "counter"  
     SET "cpt" = cpt + 1  
   	WHERE "counter"."table_cpt" = 'sales_order'   
           ;
			  
  SELECT "counter"."cpt"  
    INTO :ll_counter
    FROM "counter"  
   	WHERE "counter"."table_cpt" = 'sales_order'   ;
	
	
	This.object.sales_order_id [1] = ll_counter + 1
	
	ib_new = false
	
	ll_nb = dw_detail.rowcount ()
	
	For i = 1 to ll_nb
		
		dw_detail.object.sales_order_items_id [i] = This.object.sales_order_id [1]
		dw_detail.object.sales_order_items_line_id [i] = i
		
	Next	
	
Case Else

		i_nb_lignes = dw_detail.rowcount()
		i_max = i_nb_lignes + 1
		
		FOR ii = 1 to i_nb_lignes

			IF dw_detail.getitemstatus(ii,0,PRIMARY!) =  new! OR &
			   dw_detail.getitemstatus(ii,0,PRIMARY!) =  newmodified! THEN
				
				dw_detail.object.sales_order_items_id [ii] = This.object.sales_order_id [1]
				dw_detail.object.sales_order_items_line_id [ii] = i_max

				i_max ++

			END IF
			
		NEXT
	
End Choose


Return SUCCESS

end event

     
Name Owner
No Data

     
Name Owner
datawindow.getitemstatus datawindow
datawindow.rowcount datawindow
pfc_u_dw.pfc_updateprep pfc_u_dw

     
Full name
w_sheet_sales_order

     
Name Scope
No Data