/* HA Plus 9.10, 9.11,9.20,9.21,9.30 */
/* Version Oracle                    */


CREATE OR REPLACE TRIGGER MAJ_BR_FROM_FAC
BEFORE INSERT OR UPDATE ON DOCUMENTS
REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
DECLARE

BEGIN
    UPDATE BR
	SET 	:NEW.DOC_NUMERO_FAC=DOC_NUMERO_FAC,
		:NEW.DOC_NUMERO_LIGNE_FAC=DOC_NUMERO_LIGNE_FAC,
		:NEW.DOC_QUANTITE_LIGNE_FAC=DOC_QUANTITE_LIGNE_FAC,
		:NEW.DOC_MONTANT_LIGNE_FAC = DOC_MONTANT_LIGNE_FAC,
    		:NEW.DOC_DATE_FACTURE_FOURNISSEUR = DOC_DATE_FACTURE_FOURNISSEUR
	WHERE	:NEW.DOC_NUMERO_BR = BR.DOC_NUMERO_BR
	AND 	:NEW.DOC_NUMERO_LIGNE_BR=BR.DOC_NUMERO_LIGNE_BR;
END;

