Module Purchases
Informations
Module name | Purchases |
Editor / Editeur | BIMEX.TECH |
Download or buy page / Page achat ou téléchargement | Dolistore |
Status / Statut / Estado | Stable |
Prerequisites / Prérequis | Dolibarr min version 5.x Dolibarr max verion 6.x |
Last update date / Date mise à jour fiche / Fecha última actualización | 2017-12-6 |
Note / Nota | Last version 1.4 |
Features
Interface translated to these languages: English / French / Catalan / Castillian (spanish) / Polish
This Purchases module has been developed as an assistant that allows us to quickly and easily make the purchase of X products:
- Being able to compare prices from several suppliers, even in different currencies.
- Being able to send by mail with a single click invitations to our selected suppliers to visit a link with which they access a simple multi-language form in which they can capture the prices for us, decline or confirm the sale of any of the requested products, and add some extra comment about delivery and/or payment conditions.
- Being able to modify / add / remove prices from any supplier to any product from that same price table, with just two clicks.
- Being able to create the corresponding orders also with two clicks, filling automatically with all the information of each supplier and the products.
In short, an interface easier and more agile to use, that allows you to do the same thing that you can already do with the native Dolibarr interface but in a much more comfortable way. Well, in Dolibarr it would be very difficult to compare the prices of each product for each supplier and then assemble the different orders. And obviously there is no way to suppliers capture the prices you need.
Note: given that Dolibarr has an incomplete treatment and in some points incongrant handling different currencies (EUR, USD, MXN, MAD, etc ...) for the prices of the products, there has been no choice but to implement a small patching of Dolibarr . At the end of this guide we explain how to do it (it is a simple copy and paste of no more than 20 lines of code in a single PHP file on Dolibarr core). But it is necessary that before you continue reading you know that if you want this Purchases module to work well in a multi-currency environment you will have to do that patching of Dolibarr.
Install
To install a module in Dolibar is as simple as:
- Download the archive file of module (.zip file) from web site DoliStore.com
- Create the directory: /htdocs/purchases into the root of Dolibarr.
- Put the content of the ZIP file into that directory
- On your Dolibarr panel enable the module: Setup -> Modules
Once you have done it, it will appear in the configuration of the modules, in the Dolibarr panel. In the case of this module, you will see it in the Supplier Relationship Management (SRM) group, with the name Purchases.
Usage
Accessing the module
Once activated, we will reach it in two possible ways:
- Visiting the Commercial section, and then in the left side menu we will see the two options for this module: New purchase / List
- Or, from the Dashboard, where we will have a box with the Last 5 purchases.
Purchase list
There is not much to say about the list of purchase processes. The most interesting thing is to explain the possible values for the Status column:
- Draft: when we only have a list of products to buy
- Quoting: when we have prices of one or more suppliers for some of the products to buy
- Buying: when at least one price has already been selected for some of the products and the corresponding purchase order has been created
- Completed: when purchase orders have already been created for all products
Editing a purchase
The card of a not-completed purchase would look like the one shown below (click to open in another tab of the browser and see the detail):
- At the top of the form there is a brief form with only the minimum descriptive information, of which it is worth noting that we can link the purchase to a project that we have created in Dolibarr, if we have activated the Projects module.
- Below of that short form, there is an action button bar, to change record changes in that form, to send quotation requests by mail to the selected suppliers, to create orders or to eliminate the purchase:
- Under these buttons we have the list of products: a table where each row will contain a product to buy and a table comparing prices of one or more suppliers. In the first line we have the status of this product: 1) without prices, 2) with prices but without order, 3) created an order.
Also, until we place an order, we can change the amount we need to buy. The buttons at the end of the line allow us to: remove the product from this purchase process, save changes (if we modify any value in any of the text boxes in this row of the table), access the product stock management page in Dolibarr just for this product and supplier. Note: It is important to understand that we can change the values of the text boxes of this price table, that is, change the quantity of the product, the unit price or the minimum number of units that the supplier requires us to buy, and the page will automatically recalculate in real time the final price in the last column, in the currency of our company, but these changes will not be saved in the server (!!). So if we want to save the changes we have to click the button to save changes .
- Let's look in detail at the price comparison table:
- Colors: the text boxes will appear green if the supplier in question responded to the quote request (below we will see how to make that request) and confirmed having that product in stock. Instead, they will appear in orange if the request was already sent to that provider but the provider has not yet responded. Finally, it will appear in red when the supplier has responded and indicated that this product can not be supplied. In the latter case, the circular control for Create Order (last column of the price table) will be disabled and an icon will appear in its place that will show the comment left by the supplier.
- Multi-currency: it is important to understand that this module takes the prices of the different suppliers in the currency of each supplier. Beware, at this moment (versions of Dolibarr previous or equal to 6.X) IT IS NOT THAT way on Dolibarr!! On Dolibarr, at this moment, the prices introduced in the system ALWAYS are in the currency that we have defined in the system for our company, not the supplier currency !!!! For that reason it is necessary and convenient that you do the patching of Dolibarr that we suggest at the end of this guide. It will simply affect how the price of a product is added to an order.
- Calculations: having said that, with this module Purchases and the suggested Dolibarr patch we can handle "normally" supplier prices in their own currencies (first column) and at the same time be able to compare the Final price (penultimate column) in our own currency (MXN in my case). Keep in mind that to calculate the Final Price the Unit Price is multiplied by the Minimum quantity or by the number of Units (whichever is greater than these two values). For example, in the case of the second supplier of the image (the orange one) we are required to buy a minimum of 5 units, so we multiply the unit price by 5 to obtain the final price. While for the other suppliers we multiply by 4, which is the number of units we need.
- Currency exchange rates: currency exchange rates (ie, how many MXN are a USD) the Purchases module takes them in real time from the International Monetary Fund website (www.imf.org/external/np/fin/data/rms_rep.aspx). In fact, because we don't want to call too many times to that external website and not to slow down the loading of this quotation page, a query of the IMF page is made only every 12 hours. In short, we can be quite sure that the calculation between currencies is sufficiently adjusted to reality, and works completely automatically and in the background. By the way, you should also know that once we place an order for a product, the Purchases module registers the currency changes at that moment, and in the future, when you go back to consult the card of this purchase, it will show you the table comparison of prices according to currency exchange rates at the time of placing the order. As long as there is not a created order, the exchange rates will be updated, so today you can see a price of $11USD in Mexican pesos different from the one you saw yesterday in the same table, obviously because every day the currency exchange rates fluctuate.
- Delete button: when clicked, it will show us a dialog box asking if we want to only remove this price from this comparison, or if we also want to eliminate the price of this supplier for this Dolibarr system product. If you are sure that the supplier is never going to sell you that product or simply has never given you a price, it is advisable that you choose the second option.
- Edit price button: will open in a new tab of the browser the usual Dolibarr form for editing the price of this supplier for this product. What is useful for us? Well, because there we have more editing options than in our comparison table. For example, there we can edit the VAT to apply for this product.
- Email button: is a link of the type "mailto" and therefore will open our mailing program that we have configured on our machine, by filling in the recipient's box with the email address of the supplier in question. For this reason, this button does not appear when in Dolibarr we have not filled in the email field for the supplier in question.
Create order: finally, when we already have the prices that we were expecting from the different suppliers, or when we need to make an order, we will mark the circular box in the last column Create order. Actually, the way of working is like this: for each of the products that we have included in this purchase we will mark the offers of the suppliers that seem most appropriate. And without having to make that choice for all products, click on the button Create orders that are on top of the product table, and the page will display a new table with the orders to be created for each supplier, if there were several suppliers selected, and the products to ask each one:
If we press the Create Orders button again, the dialog box will hide, and if we do it again it will be displayed again but updated. That is, if between both clicks we have changed our supplier selection for a product, this list of orders / suppliers will be updated.
When we press any of the buttons Create order in the Action column, the Purchases module will create the corresponding order in draft mode, filling in the information of the supplier, of the exchange rate of currency (if it was in a currency different from that of our company) and the list of products and quantities that we need to buy. The new order will open in a new browser tab.
Once an order has been created in this way, by refreshing this page of the purchase, we will see that the comparative table of prices of the ordered products has been disabled and a button appears that gives us access to the card of that order:
Request quotations to suppliers
The first thing to note is that this Purchases module does not use the native functionality of Request for quotations from suppliers that Dolibarr brings natively. It has chosen to build our own solution to avoid problems in Dolibarr related to the multi-currency. So, you will see below that the system we have built is highly functional, multi-currency and multi-language, but does not create any record in Dolibarr for supplier quotes.
Having said that, we must proceed in this way:
- once in our purchase we have built the list of products to buy
- the system will automatically have added the prices of the suppliers that already exist in our system for those products
- optionally, we can add more suppliers to a specific product (you can indicate as price "0" if you still do not have the price of these products)
- then pressing the button Send emails requesting quotation will display a dialog box, from where with a single click on the new button Send emails requesting quotation these emails will be sent, at least to the suppliers for whom we have defined an email address. In the case of the picture below, only the first one.
- In that email that the suppliers will receive they are specified IN THEIR LANGUAGE (while the Purchases module is translated in that language) the list of products that we are interested to be quoted to and they are invited to visit a web form where they can capture the prices themselves and terms.
- We can visit this quotation web form by clicking on the Form buttons in the previous dialog box. Each form is unique for each purchase and supplier, and the parameters of the URL are encrypted to prevent them from manipulating the URL and accessing the prices of other suppliers.
It is recommended that if the provider in question does not have email or send us their prices by other channels (phone, whatsapp, mail, etc ...) we should use the corresponding capture web form to enter the prices of this supplier for this purchase. In this way, we will see them marked in green (or in red, in case you do not have a product) in the price comparison table of this module.
- This is how the web form for capturing prices for the provider looks:
It does not need many comments, because it has been intended to be self-explanatory so that providers feel as comfortable as possible. If we click on the Extra information button, the supplier has the option of adding a general comment on this "possible order", and can also provide us with more complete contact information. But it is an optional step:
Note: At the moment that we place an order that includes any of these products, either for this supplier or for another of our list, the introduction of prices will be blocked in the corresponding rows of this price table, if the supplier is late, or enter later to visit this form.
After the supplier clicks on the Submit button of that quote form the system will send an email to the Dolibarr user who created that purchase in the system, with the prices and with the comments of the supplier. Information that on the other hand is shown in the comparative price table of the module. These prices also change the prices we have stored in Dolibarr for those products and that supplier.
Patching of Dolibarr (5.X to 6.X)
This small patching of Dolibarr is necessary if in your Dolibarr you have activated the "multi-currency" module, that is, if you are going to have suppliers or clients that handle different currencies to your company:
In this case, you must edit the following file of your Dolibarr:
/htdocs/fourn/class/fournisseur.commande.class.php
locate line #1467:
$tabprice = calcul_price_total($qty, $pu, ... ... ... );
and on top of that line you must paste these others:
// == reverse prices if the supplier currency don't match the order currency // == get the supplier currency $supplier_currency = ''; $sql = "SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pr " ." LEFT JOIN ".MAIN_DB_PREFIX."societe as supp " ." ON pr.fk_soc = supp.rowid" ." WHERE pr.rowid=".$fk_prod_fourn_price; $resql = $this->db->query($sql); if ($resql) { while($row = $resql->fetch_assoc()) $supplier_currency = $row['multicurrency_code']; } // == decide if to invert prices if ($supplier_currency != $conf->currency){ $pu_ht_devise = $pu; $pu = round($pu_ht_devise / $this->multicurrency_tx , 4); }
Explanation: the supplier's currency is found, and if it does not match the system's (our company's) currency, then we exchange the values of the price in the currency supposedly of the supplier and the currency of the system, to "deceive" Dolibarr. Keep in mind that with this patch we are hacking the native Dolibarr function that adds a product to an order, but believe me, it is the best solution at this time when this issue of the multi-currency is being re-programmed by the official team of Dolibarr. Now just 2 months ago they changed this behavior in versions 5.X and 6.X but they did not do it completed: it is pending to finalize its full implementation. For that reason we are "forced" to make this patch. Try it, you will see that now the prices of the products in other currencies add well to the orders to suppliers. You must remember only that now the prices of the suppliers you are going to introduce them in the currency of the supplier !! (Come on, which is the most logical!).
Development
Module developed by Sergi Rodrigues for BIMEX.tech on 2017.