Question

Restrict printing invoice

  • 16 August 2023
  • 5 replies
  • 107 views

Userlevel 1
Badge +8

Hello everyone , 

 

I have a request to restrict the access to print or send an invoice if a condition on the price is not matched . Is there any setup or an existing event that I can use to do that ? 

 

Thank you in advance.

Hanane


5 replies

Userlevel 4
Badge +8

Hi @Hanane 

Please review the version of IFS you are using and if Report Rule Engine is available under Solution Manager.

If yes, this is meant for such purposes to automate the order reports in IFS ( Email, check conditions, set printers etc ).  Check out the technical documentation . You can define conditions for the data within the report and set actions against the data . 

See more here : https://docs.ifs.com/techdocs/Foundation1/040_administration/250_operational_reporting/070_report_rules/default.htm

 

At a high level, if you do not want the invoice printed, you need to set an action , that will either induce an error, or point to a logical printer by default, and thus not allow the user from printing on the actual printer. Just an option.  Once you learn about the report rule engine actions and possibilities, 

 

Note: it is possible to technically modify the report ( REP) to check for the condition and then stop the report from executing, however the report rule engine is the better way as it makes it a configuration, rather than a  modification.

 

Userlevel 1
Badge +8

Thank you VIBHIN for your reply .

I’ve tried to set up a rule in report rules , but I can’t find a proper action type that will induce an error when the conditions are met . 

Do you have pls an idea ? 

 

Hanane

Userlevel 4
Badge +8

Hi @Hanane 

I assume the condition part did get satisfied, so that's 50% progress. Here are some thoughts :

A. Try defining a non existent printer ID, for Ex: "NoPrinter" . 

B. Setting predefined property such as No of Copies to ZERO

C. Setting result key to Zero

D. If the condition is not satisfied, then ensuring the printed Invoice is Invalid, by changing a key value such as Invoice number, invoice date to "Xxxxxx"

The above prevents the report from being printed. 

Another way to induce error is through a custom field. 

Add a custom field to the report. Set it to Not Null value, but in the query condition ( which fetches true if condition is met and null if condition is not met) 

Add this custom field to the report, thus creating a simulated error. 

 

Just thinking out loud on how to achieve this without a mod to the report. 

 

Userlevel 1
Badge +8

Thank you for the reply , I used this action : 

 

I have a question about my condition expression :

here is my two expressions : 

expr 1 :  [&select (invoiced_qty * sale_unit_price * (1-(discount/100)) )
  from CUSTOMER_ORDER_INV_ITEM_UIV
  where INVOICE_ID =CUSTOMER_ORDER_INV_HEAD_API.Get_Invoice_Id_By_No
('25','[@CUSTOMER_ORDER_IVC_REP/INVOICE_NO]', 'CD') 
and LINE_NO = '[@CUSTOMER_ORDER_IVC_REP/INVOICE_BASE_CURRS/INVOICE_BASE_CURR/BASE_CURR_LINES/BASE_CURR_LINE/LINE_NO]']

 

expr 2 :  [&select invoiced_qty * ROUND(sale_unit_price * (1-(discount/100)) , 2) 
  from CUSTOMER_ORDER_INV_ITEM_UIV
  where INVOICE_ID =CUSTOMER_ORDER_INV_HEAD_API.Get_Invoice_Id_By_No
('25','[@CUSTOMER_ORDER_IVC_REP/INVOICE_NO]', 'CD') 
and LINE_NO = '[@CUSTOMER_ORDER_IVC_REP/INVOICE_BASE_CURRS/INVOICE_BASE_CURR/BASE_CURR_LINES/BASE_CURR_LINE/LINE_NO]']

 

as a result , it disable the possibility to print for all my customer orders , I guess there is something wrong in my syntax , Can you please check it out ?

 

Thank you 

Userlevel 4
Badge +8

Dear @Hanane 

Unable to determine the expression results or the issue with the same . The only assumption I can do are 

  1. The condition set is EXpr1 = Expr2 
  2. Expression 1 has no ROUND OFF, while expr 2 has round off...so it is possible that the result of Expr1 will never be equal to Expr 2, thus resulting in inequal values in each Customer order invoice case.

Recommend if you can run this is PLSQL , for all your CUSTOMER_ORDER_INV_ITEM_UIV  records,  

Ex:  Select <Expression1>, <Expression2> , A.* from CUSTOMER_ORDER_INV_ITEM_UIV A    . Replace the expression with your above queries.  Resolve the outcome here, and check where it will print , and where it will not, based on Expression 1 = Expression 2

 

Reply