Sistematika’s Journal

Diberkati untuk memberkati

Studying accounting facts for Adempiere Invoice Price Variance

Posted by: Bayu Cahya P on: November 12, 2008

“Kriing….. Kriing…. Kriing…..” I picked up my phone and starting to have conversation with our student.

“Hello, This is Gloria speaking. May I speak with Bayu?”

“Yes, This is Bayu. What can I do for you, Gloria”

“We have some problem with Adempiere while having different Invoice Price againts our Purchase Order price”

“What kind of problem did you have? Could you explain me more details…”

“While posting our Match Invoice document, it seems that, accounting fact generated by Adempiere was wrong. Especially for Invoice Price Variance”

“Did you still use the same configuration for your environtment?”

Exactly. I was following those standard configuration. It’s means that we have used IDR for purchase price transaction and using USD as our default accounting schema. We use rev 6955 for Adempiere branch/stable”

“Okay. I will take a look, and inform you later”

“Thank you and awaiting your suggestion. Bye”

Well, in our last discussion, I just talk to our student to do some exercises particularly within this Adempiere Invoice Price Variance area.

Ok, let’s try to reproduce this support request with this transaction

1. Create Purchase Order and buy some goods with total qty 5 and set price to IDR 310.000,-. Total value for this document is IDR 1.555.000,-. Complete and post this docs.

2. Create document Invoice (Vendor) for this goods with qty 5 and price is IDR 320.000,-. Total value for this invoice is IDR 1.600.000,-. Complete and post this docs.

3. Create document Material Receipt with total qty 5. Complete this docs.

4. Perform manual matching for Invoice and Receipt.

5. Perform manual matching for Purchase Order and Receipt.

6. Post document Material Receipt.

7. Post document Matched Purchase Orders.

8. Post document Matched Invoices.

And this is our Adempiere Invoice Price variance accounting fact generated.

adempiere invoice price variance

As our understanding, we have conversion rate IDR 10.000,- for USD 1. Accounted transaction for this invoice price variance still make sense to me. Generally speaking, I guess, this calculation comes from this equation

(IDR 1.600.000,- minus IDR 1.550.000,-) divide 10.000,- equals to UDS 5

The main problem with this case was Adempiere trying to book Invoice price variance within accounting schema currency and not transaction currency.

It is time to go through Adempiere source code, and we found the suspect on our Doc_MatchInv.java with method createFacts lines 261-275.

//  Invoice Price Variance      difference
BigDecimal ipv = cr.getAcctBalance().add(dr.getAcctBalance()).negate();
if (ipv.signum() != 0)
{
     FactLine pv = fact.createLine(null,
            m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
            as.getC_Currency_ID(), ipv);
     pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
     pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
     pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
     pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
     pv.setUser1_ID(m_invoiceLine.getUser1_ID());
     pv.setUser2_ID(m_invoiceLine.getUser2_ID());
}

And this is our proposed changes for this codes

//  Invoice Price Variance      difference
//  Bayu, Sistematika
//      Calculate invoice price variance within transactional currency
//  BigDecimal ipv = cr.getAcctBalance().add(dr.getAcctBalance()).negate();
BigDecimal ipv = cr.getSourceBalance().add(dr.getSourceBalance()).negate();
if (ipv.signum() != 0)
{
     MInvoice m_invoice = m_invoiceLine.getParent();
     int C_Currency_ID = m_invoice.getC_Currency_ID();
     FactLine pv = fact.createLine(null,
            m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
            // as.getC_Currency_ID(), ipv);
            C_Currency_ID, ipv);
     pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
     pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
     pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
     pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
     pv.setUser1_ID(m_invoiceLine.getUser1_ID());
     pv.setUser2_ID(m_invoiceLine.getUser2_ID());
}

Recompile this codes as customization and made some test. Delete previously Matched Invoices documents, and try to perform Matching Invoices and Receipt again.

As a result, this is our screen shot regarding this issue (Invoice price higher than Purchase price)

adempiere invoice price variance fix

Just create another IDR Purchase Order, while purchase price higher than invoice price, and this is our screen shot

adempiere invoice price variance more

And how about using the same Purchase Order currency with accounting schema (USD) ?

As requested, this is our result within your criteria, both for Invoice price higher than purchase order and vice versa

adempiere invoice price variance more 1

adempiere invoice price variance more 2

“Hello, Could I speak with Gloria. This is Bayu speaking”

“Yes, Bayu. This is Gloria”

“Gloria, as per our last telecon related with Invoice Price Variance, I have created a patched files for you. Please apply this changes and recheck your issue and confirm back”

….. about 30 minutes later …..

“Okay Bayu, it seems that we have resolved this issue. Noted and thanks for your help”

“Ok. Bye”

6 Responses to "Studying accounting facts for Adempiere Invoice Price Variance"

1 | Redhuan D. Oon

November 13th, 2008 at 7:18 am

Very well illustrated and real life drama too! Keep it up! This is very helpful to me also.

2 | thio Sunaryo

December 2nd, 2008 at 8:48 am

Selamat siang pak Bayu, mau tanya apa pernah ada pengalaman penggunaan adempiere/compiere untuk industri perkebunan ?
bisa di sharing pengalamannya dan cost-nya ?

thanks

thio

3 | Bayu Cahya P

December 2nd, 2008 at 9:40 am

Dear P Thio,

Bisakah anda memberi tahu lebih lanjut tentang kebutuhan spesifik dalam industri perkebunan?

Apakah ada hal yang terkait dengan proses produksi di lingkungan tersebut yang akan di map ke Adempiere?

Jika anda bisa memberikan perspektif bisnis yang berlaku di industri perkebunan dimana anda berada saat ini, saya akan mencoba melakukan mapping bisnis proses anda dalam sistem Adempiere.

Saya membuka diri untuk jasa konsultasi implementasi di tempat anda.

Salam
Bayu

4 | syarifuddin

January 20th, 2009 at 2:14 pm

Selamat Siang,

Perkenalkan kami dari BCS Logistics Cilegon, perusahaan yang bergerak
di bidang Jasa Logistik. Saya tertarik untuk menerapkan adempiere di
perusahaan kami. Bila bapak berkenan bisa membantu dalam penerapan
sistem tsb, untuk lebih memperkenalkan perusahaan kami bapak bisa
kunjungi alamat di http://www.bcs-logistics.col.id

Demikianlah sekiranya kami tunggu info lanjut dari bapak segera.
Terima kasih.

regard,

syarifuddin

5 | Bayu Cahya P

January 20th, 2009 at 2:53 pm

Selamat siang P Syarifuddin

Dengan senang hati kami akan membantu anda dalam proses implementasi ADempiere di perusahaan anda.

Saya telah membalas email anda, dan kami menunggu konfirmasi kembali.

Terima kasih dan salam
Bayu Cahya P

6 | William

September 15th, 2009 at 9:05 pm

Dear Mr. Bayu,

Sebelumnya saya perkenalkan pak, nama saya William, saya lagi coba implementasi sistem adempiere pd salah 1 kenalan perusahaan yg bergerak di bidang ship building, saya memiliki pertanyaan yang dimana saya rasa apakah dpt bapak bantu saya jawab, karena beberapa artikel yg bpk tulis di web sgt membuat saya tertarik..
Dimana pertanyaan saya adalah:
Kebutuhan sistem tsb adalah menggunakan costmethod FIFO, dan berhubung saya kurang mahir dgn kalkulasi FIFO pd adempiere, jd mslah yang saya temukan juga saya jd bingung untuk menyelesaikan:
1. Beli pertama: 1 pieces: Rp. 100
2. Beli kedua: 1 pieces: Rp. 120
3. Isu stok: 2 pieces
Yang shrsnya sistem yang diharapkan untuk berjalan seperti qty pertama dg modal Rp. 100, sdgkan qty kedua dg modal Rp$ 120. Tapi ternyata yang terjadi semuanya menggunakan modal Rp. 100 (yang paling awal dibeli)
Tetapi melainkan jika proses isu saya bagikan menjadi 2x isu dgn qty sesuai qty beli, yaitu isu pertama qty 1, isu kedua juga qty 1, maka costmethod fifo berjln dgn baik.
Apakah bapak mengalami hal sama dgn yang saya tunjukkan dan apakah bapak dpt mberikan pentujuk?
Sebelumnya saya ucapkan terimakasih atas perhatiannya, dan mohon bantuannya pak. Maaf jika deskripsi kasus nya agak membingungkan..

Comment Form

SEO Powered by Platinum SEO from Techblissonline