HOW TO UPDATE AUTONUMBER IN OPTIMUM

Created by Ka Chun, Modified on Fri, 25 Feb, 2022 at 12:06 PM by Ka Chun

Scenario 

 

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

 

Solution 

 

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.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article