Auto printing of invoices

Please Help!
I am currently on iMIS 15.x

Problem: In order for a invoice to be generated, you have to print the invoice. This is a manual process. I am specifically refering to Events invoices. These registrations are done via the WEB.

Question: Is there a way that I can automate the printing of invoices?

Regards

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi Jaco I've got the exact

Hi Jaco

I've got the exact same issue. Have you found a solution?

Aaron

Auto printing of invoices - solution

Aaron
Unfortunetely not

I also logged a call at ASI, but no help at all

Sorry

You'll need a stored procedure and/or TaskCentre

To mass process all these invoice crreations, you'll need a stored procedure to generate all the new invoices.

A different tack would be to use a trigger to generate the invoices as the order is posted in

Either solution could be automated using TaskCentre.

-K

Kevin Blouin - enSYNC Corp.

Hi Kevin, I'm interested in

Hi Kevin,

I'm interested in the stored procedures approach. I've got no problem with writing code but don't know what logic I should be following in order to (correctly) create the invoices for orders and billing modules. Do you know where I could find out which logic I should be following?

Aaron

I agree, any help on the

I agree, any help on the logic for such a stored proc would be wonderfull.

My problem is that we are generating loads of invoices, some days more than 500, and we now need a person to full time just print the invoices so that it generates invoice numbers! Not a very efficient way of doing things.

Thanx for the help in advance

Jaco

No iBprocess?

Is there not an iBO process that can do it.

 

Perhaps we could call that from a stored Procedure in a cursor..

Just a thought..

As far as I can tell, there

As far as I can tell, there is no iBO process to do this.  I'm using the iBO's but still need to manually "print the invoice".  The only way around this that I can think of would be to reverse engineer the sql processes that occur when printing an invoice (ie use SQL profiler).  However this would be against ASI's terms and conditions.

Invoice Automation

Hi!

If you have any updates on issue. How to generate invoice use API as part of subcrption dues payment.

Auto printing of invoices

We actually found a way, we put a SQL trace on and see what happened when an invoice is printed.

Then we created a sql trigger to do the same. Since then we did not had to print any invoice! Here is the trigger (just test it on your system first)

 

 

 

 

 

 

 

USE

[iMIS]

/****** Object: Trigger [dbo].[Inv_Num] Script Date: 05/17/2011 06:52:01 ******/

SET

ANSI_NULLS ON

GO

SET

QUOTED_IDENTIFIER ON

GO

 

-- =============================================

-- Author: Jaco Venter

-- Description: Insert Invoice Number

-- =============================================

ALTER

 

 

TRIGGER [dbo].[Inv_Num]ON [dbo].[Invoice]AFTER INSERT -- This is very important, you do not want the trigger on CHANGES to the table

AS

DECLARE

@Counter

int,

@Order_number

float,

@INV_ref_ins

int,

@Source_system

varchar(50),

@Invoice_num

int,

@UserID_Date

varchar(50),

@Type

varchar(50),

@Invoice_date

datetime,

@countRPT

 

select

int @Source_system = SOURCE_SYSTEM from INSERTED

select

@Invoice_num = INVOICE_NUM from INSERTED

select

@INV_ref_ins = REFERENCE_NUM from INSERTED

set

@Order_number = (select Top 1 ORDER_NUMBER from dbo.Orders where INVOICE_REFERENCE_NUM = @INV_ref_ins)

set

@countRPT = (select INVOICE_NUMBER from dbo.orders where ORDER_NUMBER = @Order_number)

if

 

@countRPT = 0begin

 

set @counter = ((select LAST_VALUE + 1 from dbo.Counter where COUNTER_NAME = 'Invoice'))

 

set @type = 'counter'

 

if

 

end @countRPT > 0begin

 

set @counter = (select INVOICE_NUMBER from dbo.orders where ORDER_NUMBER = @Order_number)

 

set @type = 'RPTTable'

 

if

 

end @Source_system = 'Meeting' and @INVOICE_NUM = 0begin

 

set @Invoice_date = (select invoice_date from invoice where REFERENCE_NUM = @INV_ref_ins)

 

if @Invoice_date is null

 

begin

 

set @Invoice_date = getdate()

 

end

 

if @type = 'counter'

 

begin

 

update counter set LAST_VALUE = @counter where COUNTER_NAME = 'Invoice'

 

 

update orders set INVOICE_NUMBER = @counter, invoice_date = @Invoice_date where INVOICE_REFERENCE_NUM = @INV_ref_insend

 

set @Invoice_date = (select invoice_date from invoice where REFERENCE_NUM = @INV_ref_ins)

 

if @Invoice_date is null

 

begin

 

set @Invoice_date = getdate()

 

end

 

 

 

 

 

 

 

 

update Invoice set INVOICE_NUM = @counter where REFERENCE_NUM = @INV_ref_insend

GO

wow, ok. But subscription

wow, ok. But subscription doesn't hit with order(s) tables.

That is diferent flow.

But any way thank you for response.

Any other ideas guys?

Great work!!

Exellent thanks, heaps you have save me having to do this. Am putting it into a test environment for now and will see how it goes. .. .

 FYI We are using iMIS 10

After Putting the code into test it does not run. Seems that when it was pasted somethings got out of place. I have adjusted it so that it works.

 

USE

[iMIS]

/****** Object: Trigger [dbo].[Inv_Num] Script Date: 05/17/2011 06:52:01 ******/

SET

ANSI_NULLS ON

GO

SET

QUOTED_IDENTIFIER ON

GO

 

-- =============================================

-- Author: Jaco Venter

-- Description: Insert Invoice Number

-- =============================================

CREATE

 

TRIGGER [dbo].[Inv_Num]ON [dbo].[Invoice]AFTER INSERT -- This is very important, you do not want the trigger on CHANGES to the table

AS

DECLARE

@Counter int,

@Order_number float,

@INV_ref_ins int,

@Source_system varchar(50),

@Invoice_num int,

@UserID_Date varchar(50),

@Type varchar(50),

@Invoice_date datetime,

@countRPT int
 

select  @Source_system = SOURCE_SYSTEM from INSERTED

select @Invoice_num = INVOICE_NUM from INSERTED

select @INV_ref_ins = REFERENCE_NUM from INSERTED

set @Order_number = (select Top 1 ORDER_NUMBER from dbo.Orders where INVOICE_REFERENCE_NUM = @INV_ref_ins)

set @countRPT = (select INVOICE_NUMBER from dbo.orders where ORDER_NUMBER = @Order_number)

if @countRPT = 0
  begin
    set @counter = ((select LAST_VALUE + 1 from dbo.Counter where COUNTER_NAME = 'Invoice'))
    set @type = 'counter'
  end

if @countRPT > 0
  begin
    set @counter = (select INVOICE_NUMBER from dbo.orders where ORDER_NUMBER = @Order_number)
    set @type = 'RPTTable'

  end

if @Source_system = 'Meeting' and @INVOICE_NUM = 0
begin
  set @Invoice_date = (select invoice_date from invoice where REFERENCE_NUM = @INV_ref_ins)

 

  if @Invoice_date is null
    begin
      set @Invoice_date = getdate()
    end

 

  if @type = 'counter'
    begin
      update counter set LAST_VALUE = @counter where COUNTER_NAME = 'Invoice'
      update orders set INVOICE_NUMBER = @counter, invoice_date = @Invoice_date where INVOICE_REFERENCE_NUM = @INV_ref_ins
    end

 
  set @Invoice_date = (select invoice_date from invoice where REFERENCE_NUM = @INV_ref_ins)
 
 

  if @Invoice_date is null
    begin
      set @Invoice_date = getdate()
    end

  update Invoice set INVOICE_NUM = @counter where REFERENCE_NUM = @INV_ref_ins
end

GO