Claude Assisted.

Version: FrontAccounting 2.4.19 and 2.4.20 (same code in both)

Summary
When an advance payment allocated to a Purchase Order is transferred to the
supplier invoice on invoice entry, the exchange difference between the payment
rate and the invoice rate is never posted. The supplier sub-ledger shows the
invoice fully settled, but GL Accounts Payable keeps the FX difference as a
residual balance. Normal allocations (Allocate Supplier Payments) post the FX
correctly; only the PO-prepayment path is affected.

Steps to reproduce (home currency CAD, supplier in USD)
1. Purchase Order Entry: USD supplier, date 11/01, 1,000.00 USD.
2. Supplier payment dated 11/01, 1,000.00 USD at rate 1.30; allocate it to the PO
   (the PO is only offered for allocation before it is received).
3. Receive the PO on 11/02.
4. Enter the supplier invoice for that delivery dated 11/03 at rate 1.40.

Expected
The invoice GL shows an exchange variation pair for the advance:
  Dr Accounts Payable 100.00 / Cr Exchange Variances 100.00
  (1,000 x (1.40 - 1.30)), and GL AP for the supplier nets to zero.

Actual
No exchange variation is posted. The invoice is fully allocated in the
sub-ledger, but GL AP for the supplier is left at Cr 100.00.

Cause
add_supp_invoice() (purchasing/includes/db/invoice_db.inc) moves the PO
allocations with get_po_prepayments() -> reallocate_payments() ->
allocate_payment(). allocate_payment() only rewrites supp_allocations and the
alloc totals; it never calls exchange_variation(), unlike
allocation_cart::write().

Suggested fix
After reallocate_payments() in add_supp_invoice(), for supplier invoices, call
exchange_variation() for each allocation now pointing at the new invoice,
using the payment's own date (as allocation_cart::write() does):

  if ($trans_type == ST_SUPPINVOICE && empty($GLOBALS['no_exchange_variations'])) {
      $res = db_query("SELECT a.trans_type_from, a.trans_no_from, a.amt, t.tran_date
          FROM ".TB_PREF."supp_allocations a
          JOIN ".TB_PREF."supp_trans t ON t.type=a.trans_type_from
               AND t.trans_no=a.trans_no_from AND t.supplier_id=a.person_id
          WHERE a.trans_type_to=".ST_SUPPINVOICE." AND a.trans_no_to=".db_escape($invoice_id)."
            AND a.person_id=".db_escape($supp_trans->supplier_id));
      while ($a = db_fetch($res))
          if ($a['trans_type_from'] != ST_JOURNAL)
              exchange_variation($a['trans_type_from'], $a['trans_no_from'],
                  ST_SUPPINVOICE, $invoice_id, sql2date($a['tran_date']),
                  $a['amt'], PT_SUPPLIER);
  }

Note for invoice re-entry (edit): the invoice gets a new number and existing
allocations are moved the same way. FX previously booked on the payment side
(memo "Supplier Invoice <old no>") is not removed by void_transaction(), so a
complete fix should remove the old pair's FX before re-posting. Related: the
allocation re-save duplicate FX issue below makes this worse.

Files modified:

includes/ui/allocation_cart.inc — write() now removes the previous FX before re-posting

Reproduction steps

Setup. Home currency CAD. Create a test supplier in USD.

Exchange rates. In Banking and General Ledger → Exchange Rates, set USD to 1.30 on 11/01/2026 and 1.40 on 11/02/2026.
Invoice. Enter a supplier invoice dated 11/01/2026 for 1,000.00 USD. This books AP at 1,300 CAD.
Payment. Enter a supplier payment dated 11/02/2026 for 1,000.00 USD and allocate the full amount to the invoice on the payment screen. The payment debits AP at 1,400 CAD.
Check. Open the payment’s GL view. You should see one FX pair of 100.00 between AP and Foreign Exchange Gain/(Loss), memo “Supplier Invoice N”. That pair is correct.
Trigger. Go to Purchases → Allocate Supplier Payments or Credit Notes and tick Show Settled Items. Click Allocate on the payment. It shows 1,000 already allocated. Click Process without changing anything.
Result. Open the payment’s GL view again. There are now two identical 100.00 FX pairs, and each extra Process adds another. Supplier Inquiry still shows everything settled, but GL AP for that supplier is now off by 100 for each extra pair.

Files modified:

includes/banking.inc — new remove_exchange_variation() helper
includes/ui/allocation_cart.inc — write() now removes the previous FX before re-posting

Thank you Joe. Upgraded to 2.4.11

FA 2.4.10

I have come across 2 issues on Tax Inquiry and 1 issue on Tax Report:

1. Input Taxes are treated as Output Taxes:

Purchases/Supplier Invoice

Line:
Shipping Expenses $90 
GST / TPS 5% Paid $4.50
QST / TVQ 9.975% Paid $8.98


Banking and General Ledger/Inquiries and Reports/Tax Inquiry
GST / TPS 5%    Charged on sales (Output Tax):    4.50    90.00
GST / TPS 5%    Paid on purchases (Input Tax):    0.00    0.00

QST / TVQ 9.975%    Charged on sales (Output Tax):    8.98    90.03
QST / TVQ 9.975%    Paid on purchases (Input Tax):    0.00    0.00

Expected outcome:
GST / TPS 5%    Charged on sales (Output Tax):    0.00    0.00
GST / TPS 5%    Paid on purchases (Input Tax):    -4.50 -90.00

QST / TVQ 9.975%    Charged on sales (Output Tax):    0.00    0.00
QST / TVQ 9.975%    Paid on purchases (Input Tax):    -8.98 -90.00

2. Tax base amounts ae being calculated instead of reflecting the actual invoice amount. Tax base in the above example is $90 but the tax base for 9.975 was calculated as 8.98/0.09975 resulting in 90.03. The same result on Tax reports.  This creates a discrepancy in our tax filings where we need to report the tax bases as well.

I think you are on earlier version of FA. These are not editable on 2.4.10

It didn't fix the issue.  These fields are still not editable:

This quotation had not yet been converted to sales order so it should still be editable.

Hi Joe

Thank you for looking. I think I was able to trace the issue.

Tax report captures credit note taxes when they are calculated. They are ignored when entered manually.

https://u.cubeupload.com/andijani/CreditNote.jpg


https://u.cubeupload.com/andijani/creditnotetaxesclacu.jpg

FA2.4.10
Tax Report is not showing the tax details of credit notes. Not tried it with Supplier credit notes.

Current printout:
Customer Credit Note  C210090 11/18/2021 Daniel Customer -169.50 0.00 0.00

Expected printout:
Customer Credit Note  C210090 11/18/2021 Daniel Customer -150.00 13.00 -19.50


https://u.cubeupload.com/andijani/GLTranscationfromCre.jpg
https://u.cubeupload.com/andijani/TaxReportCreditNoteT.jpg

Here are the screenshots:
https://u.cubeupload.com/andijani/FA2326QuoteModify.jpg
https://u.cubeupload.com/andijani/FA2410QuoteModify.jpg

Also notice the branch selection filed is missing on FA 2.4.10

FrontAccounting 2.4.10
Sales Quotation Modification  Header fields are not editable: Customer, Payment, Price List, Quotation Date

They are editable in FrontAccounting 2.3.26

I confirm the same result as mugao-em. The posting is not correct.  The balance of USD account in home currency should increase on the date of valuation. 

Chequing USD  (exchnage rate 1.32 CAD/USD)
Customer Payment     1     001/2018     11/21/2018           DR:      27,874.84

Revaluation Run (exchnage rate 1.33 CAD/USD)
Journal Entry     1     001/2018     11/22/2018                                      CR: 475.16     27,399.68     Exchange Variance

I have come across this inconsistency in the customer and supplier contact names on the
0_crm_persons table.  Customer contact names are populated in "name" and "name2" but supplier contact names are combined in "name" column only.

name             name2
John              Doe
John Doe

I have uploaded Git Master code. Sales Order Items are not available on Sales Order to be able to reproduce the above problem.

Delivery of prepaid order is not calculating the amount of Deferred Income correctly when Foreign Currency is involved in FA 2.4.4.

Opening Balance - 05/01/2018                                           0.00            
Sales Invoice     1     001/2018     11/19/2018           4,665.49     -4,665.49        
Sales Invoice     2     002/2018     11/19/2018           1,166.37     -5,831.86        
Delivery Note     1     001/2018     11/19/2018 17,371.24         11,539.38        
Sales Invoice     3     003/2018     11/19/2018           7,348.14     4,191.24        
Ending Balance - 11/19/2018                                     4,191.24

I saw that post before and it's not related to my finding. The Supplier Invoice has GL items with Dimension drop-down field. One would assume the transaction would be posted to selected Dimension as a result but it's not. Some supplier invoices are not worth creating a Purchase Order with Item type of charges. It's easier to create a Supplier Invoice with Expense type of accounts from GL.

Fresh Install FA 2.4.4

Supplier Invoice or Credit Note with GL Items is not posting to selected Dimension.

Tested with Bank Payments/Deposits  Direct Sales/Purchase without issues.

I gave it a try and found one issue.  Received two batches from supplier. Batch-A 10 PC and Batch-B 10 pcs.
Sales order for 20 pcs. When creating a delivery against sales order there is no option to select a second line to add additional batch. Entered 20 from Batch A and it went through even though Batch A had 10 pcs. Basically oversold Batch A.
Is this module available to download to test locally?

FA 2.4.4 Fresh Install.

Had some amount in Foreign Currency Bank Account on Day 1.
Ran Revaluation of Currency Account on Day 2. The amount on the blank doubled. With each running of evaluation the blance keeps doubling.

I am testing a fresh install of FA 2.4.4 with default US Chart of Accounts.

Sales Tax s not accounted for foreign exchnage variances.  You can see the sequence of entries and this imbalance was resulted.
Default currency is CAD and invoice currency is USD.

https://drive.google.com/file/d/1mqwY8mVn1kQIP-Zin2A8oKI6KvqMiF8Q/view?usp=sharing

So Payment Advice does not print a cheque. I am wondering if Check Printing extension by Tom Hallman, USA can be integrated to print payroll cheques as well. Currently it can print only Supplier Payments or Bank payments made to Suppliers as cheques.

I noticed the Payment Advice calculates the Wages Payable based on days or hours worked instead of taking this amount directly  from the Payment Slip. Suppose I adjusted the Wages Payable on the Payment Slip window. I would expect the same adjusted amount on Payment Advice instead of calculating it again based on the actual work days or hours.

Hi Phuong

Great extension!
Does Payment Advice prints a cheque? It's throwing this error.
TCPDF error: Could not include font definition file: dejavu.php

Thank you
Jack

I am getting this redundant journal entries when performing Bank Payments and Deposits with the foreign currency account.

Here are the results for the same entries in both FA 2.3.22 and FA 2.4.3

Bank Payment     1015     BP0391     03/29/2018         165.90     TST Inspection     (this is USD)

Accounting entries (All numbers are in CAD):

FA 2.3.22
Bank Payment     1015     03/29/2018           TST Inspection               217.33    
Journal Entry     173             03/29/2018           TST Inspection     344.20              Exchange Variance


FA 2.4.3
Bank Payment     1016     03/29/2018                                                  217.33         
Journal Entry     87             03/29/2018                               171,300.56                     Exchange Variance


The balances in foreign currency accounts are way off especially in FA 2.4.3 and in each case the Bank Payment or Deposit were involved.