Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Current »

Comment ajouter un total reporté dans les formulaires DevExpress

Ajouter le sous-total

Ajouter un premier champ en bas de page avec la fonction “Running summary”

  • Ajouter un nouveau label dans le bas de page

  • Ouvrir les propriétés “Summary”

  • Dans le “Summary editor définir

    • Summary running → Report

    • Summary function → Running Summary

    • Argument expression → [VeTeteDocum.ChildVE_LIGNE_DOCUM.Total ligne HT]

  • Définir le nom du champ avec “SousTotalFinDePage“ dans les propriétés

Ajouter le total reporté

  • Ajouter un nouveau label pour le titre du total reporté dans le haut de page

  • Lui donner un text et le nom “TotalReporteTitre“ dans les propriétés

  • Ajouter un nouveau label pour le total reporté

  • Lui donner le nom “TotalReporte“ dans les propriétés

Ajouter le script

Ajouter le script suivant dans la section “Script” du rapport

using System.Linq;
using DevExpress.XtraPrinting;


private void XtraReport_AfterPrint(object sender, System.EventArgs e) {
    
           var TotalReporteBricks = BrickSelector.GetBricksByXRControl(this.PrintingSystem.Document, TotalReporte).ToList();
           var TotalReporteTitreBricks = BrickSelector.GetBricksByXRControl(this.PrintingSystem.Document, TotalReporteTitre).ToList();
           var SousTotalFinPageBricks = BrickSelector.GetBricksByXRControl(this.PrintingSystem.Document, SousTotalFinDePage).ToList();

           for (int i = 0; i < TotalReporteBricks.Count; i++)
           {
               
             if (i > 0 && SousTotalFinPageBricks.Count() > i-1 )
             {
                 TotalReporteBricks[i].Text = SousTotalFinPageBricks[i -1].Text;
             }
             else
             {
                 TotalReporteTitreBricks[i].IsVisible = false; 
                 TotalReporteBricks[i].IsVisible = false; 
             }
           }
}


  • No labels