Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4405 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Helllo,

I have to adjust current printing script. So that, based on country --> a different Invoice layout gets selected by the print invoice script.

This to meet EU vat regulations... Different informations has to be present for costumes/tax authorities = different layouts

my Idea:

Based on companies country input in the records I can have the script make an IF script...

Example:

1. if Companies::Country = "The Netherlands"

= Layout 1

2.if Companies::Country = "Belgium or France or Germany... Or (inside EU) "

= Layout 2

3.if Companies::Country = "other country OR lists"

= Layout 3

4. If... Not recognized = Please adjust country name error message

Please see the current Print Script.. in attachment.

Could someone help me to get the proper if script adjustment.

Thanks in advance

AM10_Invoice Print script.pdf

Posted

It sounds like you've got roughly the right idea already. Looking at your script, I just have some structural suggestions. This script looks to me like it ought to be 2 scripts: one script that handles all the logic about deciding whether or not to print at all and looping over the found set of invoices, and another script that only deals with printing one invoice at a time called as a subscript of the first script. That second script should wind up looking something like this:


If [ /* country group 1 and no line items*/ ...]

Go to Layout [...]

# layout based on Invoice table

Else If [ /* country group 1 and there are line items */ ...]

Go to Related Record [invoiceLineItems using layout ...]

Else If [ /* country group 2 and no line items*/ ...]

Go to Layout [...]

Else If [ /* country group 2 and there are line items */ ...]

Go to Related Record [invoiceLineItems using layout ...]

...

Else

Exit Script [Result:Error]

End If



Print Setup [...]

Perform Script ["Window Control Preview"]



If [layout is based on InvoiceLineItems]

Sort Records [...]

Print [Records being browsed]

Else

# layout is based in Invoice

Print [Current record]

End If



Go to Layout [Original Layout]

Enter Browse Mode

Exit Script []

Identify everything that's common to the process of printing for each situation, and group them together outside If[] blocks as much as possible.

This topic is 4405 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.