Loading
Uniconta
  • Search
  • Uniconta
    • Functions
      • General ledger
      • Orders & Purchase
      • Inventory & Logistics
      • Project
      • Production
      • Dashboard
      • Business Rules
      • ODATA ikonCustomisation
      • See all →
    • Apps
      • Invoice App Create Invoices
      • Upload App Submit reciepts & expenses
      • Assistant App Project Management
      • Work App Time Tracking
      • Authenticator App Two-Factor Authentication
    • Integrations
      • Add-on Store
    • Download & Login
      • Download Uniconta
      • Web Login
  • Developers
    • Build & Integrate
      • Get API Key
      • Download for Developers
      • Documentation
    • Resources & Code
      • Samples
      • Add-on solutions and users
    • Partner Ecosystem
      • Become an integration partner
      • Partner Portal
  • Insights
    • News
      • Latest News
      • Release Notes
      • Customer Stories
    • Get started
      • Try Uniconta
      • Book a Demo
  • Contact
  • Get Uniconta
  • Contact us
  • Find a reseller
Free trial signup

Unipedia

  • Get started
  • Chart of accounts
  • Customer
  • Vendor
  • Tools
  • Project
  • Purchase
  • General
  • CRM
  • Inventory
  • Company
  • Reports Reports under Project
  • Tools
  • Report generator
  • User-defined fields User-defined fields under Tools
  • User-defined tables User-defined tables under Tools
  • WebPortal
  • Data accesses
  • UC Menu – Addon store

Report generator – Different scripts

2,092 views 17 October 2019 15 July 2026 3 minutes
Print Friendly, PDF & Email

Learn more about:

  • Layouts - global
  • Filter/Clear Filter
  • Templates
  • How to search in Uniconta
  • Attaching documents and notes
July 15th, 2026

Different scripts in the report generator

On this page you will find various useful scripts that can be used in the report generator.

 

How do I hide the % sign in the header if there is no discount?

Remember that the script must be selected on the “PageHeader” ribbon in Properties/Behavior (the cogs)/Scripts, in the “Before print” field.

private void PageHeader_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
  var colSource = GetCurrentColumnValue("DebtorInfo") as Uniconta.ClientTools.DataModel.DebtorClient;
  bool discountPctExist = false;
  if (colSource !=null)
  {
  var invLines = colSource.InventoryTransInvoice as
  Uniconta.ClientTools.DataModel.InvTransInvoice[];
  foreach(var invLine in invLines)
  {
  if(invLine.DiscountPct !=null || invLine.DiscountPct  >0)
  {
  discountPctExist = true;
  break;
  }
  }
  }
  if(discountPctExist)
  {
  //Label name you want to show
  xrLabelDiscountPct.Visible = true;
  }
  else
  {
  //Label name you want to hide
  xrLabelDiscountPct.Visible = false;
  }
}

 

How do I hide the % sign in the header if there is neither a % discount nor an amount discount?

Remember that the script must be selected on the “PageHeader” ribbon in Properties/Behavior (the cogs)/Scripts, in the “Before print” field.

private void PageHeader_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {

var colSource = GetCurrentColumnValue("DebtorInfo") as Uniconta.ClientTools.DataModel.DebtorClient;
  bool discountPctExist = false;
  //xrLabelDiscountPct.Visible = false;
  if (colSource !=null)
  {
  var invLines = colSource.InventoryTransInvoice as Uniconta.ClientTools.DataModel.InvTransInvoice[];
  foreach(var invLine in invLines)
  {
  if(invLine.DiscountPct !=null || invLine.DiscountPct  >0 || invLine.Discount !=null || invLine.Discount  >0)
  {
  discountPctExist = true;
  break;
  }
  }
  }

if(discountPctExist)
  {
  //Label name you want to show
  xrLabelDiscountPct.Visible = true;
  }
else
  {
  //Label name you want to hide
  xrLabelDiscountPct.Visible = false;
  }
}

 

How do I hide a label for an empty field?

When you use a data field that is not always filled in, e.g. requisition number, you can hide your label by making a small entry in “Scripts”
which you find in the generator’s menu, top right.

private void xrReqLable_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {  
  // Example of how to get hold of the object xrReqLable, via "sender" in the function call, which can then be manipulated with all sorts of properties   
  XRLabel label = (XRLabel)sender;  
  // Example of how you can fill in a label via code...   
  // Example of an if statement...   
  // Asks whether label xrReqValue is empty! If empty, the associated label xrReqLable should not be shown, otherwise it should be shown.   
  if (xrReqValue.Text == "") {  
  label.Visible = false; }  
  else {  
  label.Visible = true;  
  //label.ForeColor = Color.Black;  
  //label.BackColor = Color.White;  
  }  
}

 

 

How do I get decimals on my vat amount?

If your fields do not show decimals as expected, you can make a small entry in “Scripts” which you find in the generator’s menu, top right.

Select the label in question, e.g. as below the vat field, xrDetailInvoiceFieldSum, and click Scripts in the menu. Then select
BeforePrint in the right drop-down menu at the top, and the function below will be shown.

Insert the XRLabel…. code as shown in the function below in italic.

private void xrDetailInvoiceFieldSum_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {  
  XRLabel label = (XRLabel)sender;  
  // Formats the selected label to have two decimals (N2)  
  if(!string.IsNullOrEmpty(label.Text)) label.Text = Convert.ToDouble(label.Text).ToString("N2");  
}

 

 

How do you hide a label for a default DateTime value? (“01-01-0001 00:00:00” or “01-01-0001”)

When you have a DateTime field filled with default value, you can hide its label by making a small print in “Scripts” that you can find in the generators’ menu at the top right

private void xrReqLable_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
  var xrLabel = sender as XRLabel;
  if(xrLabel != null && !string.IsNullOrEmpty(xrLabel.Text))
  {
  DateTime dateTime;
  if(DateTime.TryParse(xrLabel.Text, out dateTime) && dateTime == DateTime.MinValue)
  xrLabel.Text = string.Empty;
  }
}

 

How to use before print event for localizing labels in user reports?

Copy the below code and set it to the required XRLABEL’s before print event

private void xrLabel_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
  var xrLable = sender as XRLabel;
  var text = xrLable.Text;
  xrLable.Text = Uniconta.ClientTools.Util.UtilFunctions.LocalizePrompt(text);
}

 

 

  • Was this Helpful ?
  • YesNo
Categories: Report generator, Tools, Unipedia
Home » Unipedia » Report generator – Different scripts

Get in touch with us

Uniconta

  • Uniconta
  • Modules
  • Downloads
  • Free trial signup
  • Subscription Terms
  • Privacy Policy
  • System Status

PARTNER

  • Resellers
  • For Developers
  • Uniconta API key application
  • Uniconta Partner info

Info

  • News
  • Updates
  • Customer cases
  • Video
  • IT Security
  • Backup procedure – global
  • About us

Support

  • Unipedia
  • API information
  • Contacts
© Uniconta  2026

facebook linkedin youtube

  • Visit a Country Site
    • Dansk
    • Uniconta GermanyDeutsch
    • Eesti
    • Uniconta GermanyÍslenska
    • Lietuva
    • Uniconta NetherlandsNederlands
    • Norsk
    • English