Topic: Manually Enter Invoice Number

We are doing Cargo Pick Up Service. We give pre-numbered Booklet Invoices to Customer.

When I enter in FA Software I need to give same Booklet Invoices number on Software Invoice Number. Is it Possible? I don't need auto generating Invoice number. Just enter manual number for each Invoice.

Can you please guide me how to ?

Re: Manually Enter Invoice Number

Keep changing the next invoice number manually in Setup => Transaction References and then let it auto-populate this manually provided value in the invoice you enter. The responsibility of maintaining non duplicate Invoice Number will then vest with you as the system will simply reject duplicates only after entering the invoice.

Re: Manually Enter Invoice Number

Hi,

Regarding the Auto Increase of Document References in Setup -> Company Setup

This function is always active even if one chooses to disable it. Auto increase is always on.

I think there is a bug somewhere. (FA2.4.7)

Post's attachments

AutoInc_Doc_References.png 40 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Manually Enter Invoice Number

The sys_prefs table by default has ref_no_auto_increase disabled but it still works in AutoInc mode.

The error is in the absence of an "else" for line 294 in sales/includes/cart_class.inc and it's positioning after a blank check. The lines 287 to 301 are reproduced here:

    function write($policy=0) {
        
        global $SysPrefs, $Refs;
        
        begin_transaction(); // prevents partial database changes in case of direct delivery/invoice
        if ($this->reference != 'auto' && $this->trans_no == 0 && !is_new_reference($this->reference, $this->trans_type))
        {
            if (!empty($SysPrefs->prefs['ref_no_auto_increase']))
                $this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today()));
            if (!is_new_reference($this->reference, $this->trans_type))    
            {
                commit_transaction();
                return -1;
            }    
        }
...
...

Re: Manually Enter Invoice Number

@apmuthu,

This is related to bug number 4988 reported on Mantis.
Do you think that this will solve the issue:

         if ($this->reference != 'auto' && $this->trans_no == 0 && !is_new_reference($this->reference, $this->trans_type))
        {
            $increase = !empty($SysPrefs->prefs['ref_no_auto_increase']);
            if ($increase)
                $this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today()));
            if (!$increase || !is_new_reference($this->reference, $this->trans_type))    
            {
                commit_transaction();
                return -1;
            }
        }

/Joe

Re: Manually Enter Invoice Number

This looks okay with the sysprefs variable on a per company basis changeable at will anytime without affecting past and future transactions. Consider the situation where we wish to jump the sequence and move forward a few numbers and later come back to fill in the missing ones. Check if this will mitigate it.

Logic change - replace the line:

if (!$increase || !is_new_reference($this->reference, $this->trans_type)) 

with:

else

since the !is_new_reference($this->reference, $this->trans_type) is already there in the outer if construct.

Re: Manually Enter Invoice Number

Yes you are right, @apmuthu.

Bug 4988 has been fixed and committed to 2.4.7 stable repo. The fixed file can be downloaded here.

/Joe