For QNE Optimum, how to add auto-numbering for other format




1. Go to Task and Design




2. Double click the format you want to customize. E.g SR01 Sales Invoice


3. Go to Field list and drill down Sales Inv -> Sales Invoice Details Collection 



 4.Right click from the field to Add Calculation, remember create 2 new calculation field



5. Copy below  script and paste to the script tab

using QNE.ERP.Reports.Utils;

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

      e.Cancel = ReportHelper.BatchDetailShouldBeHidden(Detail.Report as ReportModel);



int i = 0;

string docCode = string.Empty;

private void AutoNumbering_GetValue(object sender, DevExpress.XtraReports.UI.GetValueEventArgs e) {

  string currentCode = this.GetCurrentColumnValue("SalesInvoiceCode") as string;

  if (docCode != currentCode )


    i = 0;

    docCode = currentCode ;


  bool stock = (bool)DetailReport.GetCurrentColumnValue("IsStock");

  bool isSubItem = (bool)DetailReport.GetCurrentColumnValue("IsSubItem");

  if (stock && !isSubItem)

    e.Value = ++i;  




6. Right click on calculated field and select the Edit Calculated Fields

7 Rename Design name & display name




8. Drill down script and select auto numbering get value




9. Rename design name and add expression below

Iif([Stock.Stock #] == null, False, True)


 10. Once you done can drag the autonumbering to the field you want.