[Proposal] Purchase Cycle for Imported Goods paid using Letter of Credit

Definition and Differences from normal Purchase Cycle

According to Investopedia

A letter of credit is a letter from a bank guaranteeing that a buyer’s payment to a seller will be received on time and for the correct amount. In the event that the buyer is unable to make payment on the purchase, the bank will be required to cover the full or remaining amount of the purchase. Due to the nature of international dealings, including factors such as distance, differing laws in each country, and difficulty in knowing each party personally, the use of letters of credit has become a very important aspect of international trade.

The Letter of Credit based Purchase has some differences that need require some modifications in ERPNext

  • Supplier is not billed, your Bank, or more specifically the Letter of Credit, is billed
  • A lot of advance payments are made, even for Taxes and Charges
  • The bank credits your account automatically
  • Taxes and Charges are distributed unevenly and the customs authority may provide the breakup of taxes and charges at a later date
  • The customs authority may reject your declared value of goods and reassess the value of goods themselves

Summary of Changes

  • Prerequisite Pull Requests:
  • New Account: Letter of Credit Payable
  • New Party Type: Letter of Credit
  • New DocType: Letter of Credit (Party)
  • Modified Purchase Receipt: Ability to select Letter of Credit (for reference)
  • Modified Purchase Invoice: Ability to select Letter of Credit (for billing the Letter of Credit rather than the supplier)
  • Modified Journal Entry: Ability to select Reference Expense Account for future costing purposes (explained below)
  • Landed Cost Voucher:
    • Ability to bill either a Supplier or Letter of Credit
    • Ability to select advance payments
    • Ability to distribute charges by Weight
    • Ability to distribute charges manually for each item and each row in Taxes and Charges
    • Ability to distribute charges based on Item Tax Rates (WIP)

Current Status

I had to change a large amount of code to allow billing of Letter of Credit rather than Supplier. Therefore it is not very well tested, has some bugs that I have in my todo list and have some missing features that I’m still working on.

Proposed Process:

Purchase Order:

  • Your Company places an order with the foreign Supplier and the agreement is made for an advance payment or maybe even a Letter of Credit through the Bank
  • You do not know what the taxes and charges will be at the time of order, you can only know about the Sales Tax, but even that may be subjected to Additional Sales Tax and Income Tax and Additional Income Tax.

Opening a Letter of Credit

  • Your Company requests its Bank to open a Letter of Credit, the Bank takes the responsibility of paying the supplier and creates a liability to pay them back
  • The user will create a New Letter of Credit Document (which acts as a Party of Party Type Letter of Credit)

Advance Payments

  • There might be different kinds of agreement: partially paying for the amount of goods before receiving it, paying in full before receiving it, paying for taxes and charges later on, making a complete payment at the end of the whole process and so on.
  • Your Bank will charge your account and update your Bank Statement
  • The user will record it in either Journal Entry (preferred method) or Payment Entry
  • In this example your Company and the Bank agree to paying 50% advance to the Bank

Taxes and Charges (either before or after receiving goods)

  • The Bank may charge your account for any taxes and charges even before your Company receives the goods and the Bank may credit your account automatically
  • In this example, the Bank charges your Company “Bank Charges” and you want to include these in the valuation of goods, but there is no Purchase Receipt yet
  • You create a Journal Entry and select the Reference Expense Account (for future costing purposes as you’ll see below)

  • Note: I selected the Bank Charges in Valuation account as a reference expense account which will be used as remarks and for future costing purposes
  • There will be more expenses such as Customs Duty, Freight/Shipping Charges, Port Yard Charges, Demurrages, Custom Clearing Charges

Receiving Goods

  • The Bank may even negotiate the exchange rate of the foreign currency: the Bank may fix the rate or may hold you liable for any increase in the exchange rate in the future. The Bank may even offer you a discounted exchange rate (at least these things happen in Pakistan)
  • The user will create a Purchase Receipt with whatever the agreed exchange rate is
  • The user may (and should) select the Letter of Credit for reference while making the Purchase Receipt

  • Note: I still haven’t selected any taxes and charges in Purchase Receipt!
  • The accounting and stock ledger entries would be the same as usual at this stage

Billing the Letter of Credit for Goods Received

  • After your Company knows about all the applicable Taxes (of type Total-only, not included in Valuation) the user should create the Purchase InvoiceTotal-only for example Sales Tax and Income Tax

  • Letter of Credit will automatically be mapped from Purchase Receipt to Purchase Invoice

  • Select Taxes

  • Select Advance Payments you want to reconcile with Invoice (don’t select payments for Expenses included in Valuation, that will be selected in Landed Cost Voucher)

  • Instead of crediting the Supplier, the invoice will credit the Letter of Credit Payable account with the party as LC #123456

Updating the Expenses Included in Valuation and Billing the Letter of Credit for those Expenses

  • When the user wants to update the Landed Costs of the goods received i.e include the cost of the expenses like Customs Duty, Bank Charges and so on, create a Landed Cost Voucher

  • The Letter of Credit will be mapped from the Purchase Receipt
  • The Landed Cost Voucher has the option to select Payable To and Party Type (either Supplier or Letter of Credit)

  • Instead of manually entering the taxes and charges table again, the user can click the button “Get Expenses Referenced In Journal Entries” and it will pick up all the advance payments made with Reference Expense Account set as in the previous screenshots

  • All Journal Entries against LC #123456 and that has Reference Expense Account set will be fetched automatically

  • You can chose to distribute charges based on Amount, Qty, Weight or Manually
  • Or even using Tax Rates defined in the Item Masters (not implemented yet)
  • The manual distrubution template will show all Taxes and Charges as Columns distrubuted as Manual and all Items as rows (in this example there is only one Taxes and Charges as Manual and only one Item so it shows only one Tax column and one Item column)

  • Applicable Charges will be updated on client-side validate()

  • You can select all the Advance Payments and it should essentially make the outstanding amount 0!

  • Once you submit the Landed Cost Voucher, it will post the necessary GL Entries

Finishing Up

  • Lets pay off the remaining balance in the Purchase Invoice

  • The Purchase is Complete and and Letter of Credit Balance is 0


I would greatly appreciate any criticism to improve this process. However, simply :heart:ing my post is also an approval that is appreciated :slight_smile:

1 Like

Doesn’t it make sense to reference the bank as a supplier in this context? The LOC-as-Supplier concept is really clever, but ultimately the LOC isn’t actually a party (in a legal entity sense) so it makes sense to at least associate it with a supplier (which is a bank or less commonly an import/export agent, rendering services for a fee). I am not aware of any bank that will write a credit agreement without an expiration date and there has been some case law casting “evergreen” LOCs into a dubious legal state (who is liable if one party or the other goes out of business but LOC has not expired? It’s mostly a poorly written contract but they exist…) To that same point, there should be a validation check against an expired LOC. The “disabled” checkbox doesn’t really match the way they’re usually written.

Also you might want to include routing numbers here for reference? Often (but not always) an LOC will have it’s own account number just like a bank account number or a loan number.

How are you showing the LOC on the balance sheet?

LOC in a domestic context works pretty differently but that’s really a terminology problem and I think this use case should supersede anyway. Also, very happy to see the LCV getting some love; it’s one of the under-used and under-rated features of ERPNext. Nice work @saifi0102

1 Like

Yes it does and I will definitely include it as a field in the Letter of Credit DocType. Maybe there could be 2 additional fields: one for Bank Account and other for Supplier?
Anyways, it is a common practice to create a current asset Letter of Credit account in the accounting books for each L/C.

Can you elaborate how the expiry date of an L/C has or should have a role in an ERP? I’m guessing if the goods are shipped by the supplier later than the expiry date then the issuing bank does not have to pay the supplier/advising bank. I can’t get my head around what the validation should do.

What do you suggest how the disabled checkbox should be written? I’ve included this checkbox so that once an L/C is closed (goods received and payments made in full) the user can check it. Or for whatever reason the user may disable the L/C. This is mainly so that the disabled L/Cs don’t show up in the Letter of Credit Link field search drop-down and that the users do not mistakenly select a closed/disabled L/C in any transaction.

That is what the Letter of Credit Number field is for. The bank will issue a Letter of Credit number, and the user will enter it there. Am I missing something?

The “Letter of Credit Payable” account head will be somewhere under the Current Asset account group . The account type will be “Payable”. The Letter of Credit account head will function similar to how Creditors work where the individual parties are separated internally. Individual Letter of Credit’s balances can be seen in the Trial Balance for Party report or General Ledger as in the last screenshot. I am considering renaming the account to simply “Letter of Credits”.

I have developed this feature with very limited exposure to how the import process works. I have only consulted people from my own country, Pakistan. This is the point of me posting this proposal so that if this use case is not very well generalized, then I will welcome suggestions to improve and generalize it further so that this feature can be used in any country.

Thank you, I really appreciate that, and yes I did feel the LCV has been a neglected but an essential feature in ERPNext.

Just want to explore the opposite case, which I think should appear only as a liability for the current value. When I was doing loan analysis, it was common for us to have to adjust an LOC to its fully drawn amount; it’s essentially the same as giving somebody else your credit card - they can spend up to the limit at any time before it expires.

Regarding the expiration date discussion:

You should not be able to make an invoice on an LOC after the expiration date. I would use the invoice date for validation, not the posting date. After the LOC is expired, it functionally enters a “disabled” state anyway. I don’t see this as a big mismatch from your current design, more of a tweak. I think it might make more sense to use a select and series of statuses: “Open”, “Closed”, “Expired” …

No, you’re not. I was thinking of it from the lender perspective again. A single loan/ LOC number is all that’s required.

Or should it be “Letters of Credit”? I find this plural form kind of comical, but it seems to be correct.

This design seems pretty well generalized to me, but I know Alain @Tropicalrambler does some international business but he may not use an LOC. Maybe @max_morais_dmm, @dominik or @vrms have run into this?

@saifi0102 even though we are doing international business we are in the lucky position not to be doing any L/C business.

The one time we actually did it we have been fucked over by the client (which L/C is a perfect tool for)

Over telecom, international business represent an important amount of the assets purchased.

Here in South America, and also in Central America, this process start with the understanding of:

The Incoterms are used to define the agreements between the parts and the resposability for the goods, while it’s being in transit.

Here is an important detail about the incoterms Defining Incoterms and Their Impact on Total Landed Cost

Incoterms define who is reposible for each incurred cost into the buying/selling process, also, the rules for valuation and ensurance from both parts involved into the transacion.

Each incoterm will affect directly in what cost can and should be booked for each side.

Also, I think that the Bank Guarantee in V11 fully replace the Letter Of Credit

The process described above dont cover all particularities involved in the real world.

What maybe should occur is that may ERPNext should follow Incoterms to define the valuation.

1 Like

Haha yeah, Letter of Credits just sounds silly now :stuck_out_tongue:

Can you elaborate how the incoterms can define the calculation of taxes and charges in an ERP?

I don’t see how the Incoterms can directly influence the amount of taxes and charges in ERPNext. I know that in reality the incoterms determine which taxes and charges apply to the buyer, but in the case of an ERP, I feel the Incoterms can only be included as a Data field or Select field for reference rather than for calculation.

I just saw the updated version of Bank Guarantee DocType and I guess the Letter of Credit DocType should include similar DocFields. But does Bank Guarantee in ERPNext have anything to do with the calculation of stock valuation? I’m not exactly sure if Bank Guarantee can generalize to include the features of Letter of Credit I’m proposing since Letter of Credit acts as a Party for the Account Head “Letter of Credit Payable”.

Please tell me which missing particularities should this feature also consider

So what happened here @saifi0102

The feature is in my fork. Can’t include it in core because of prerequisite pull requests weren’t merged

I would like to suggest the use of “Project” Accounting dimension in any “Expense” or “Purchase” transaction related to the “Purchase” of a specific order. Once the order is in our company, we filter all expenses labeled with that project, and close all of them in one account for the landed cost voucher submitting.