Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate list price according to cost and utility values #5140

Closed
wants to merge 1 commit into from

Conversation

davidbqzt
Copy link

@davidbqzt davidbqzt commented Feb 8, 2018

Description

Added a feature on Quotes modues to use or modify the cost of a product or service and specify an ammount or percentage of utility and calculate the value of List Price according to the cost and utility specified.

  1. The procuct/service cost field have been made visible, this one was present but hidden.
  2. Add, fields for utility and utility type (amount or percentage) similar to discount and discount type fields.
  3. Utility type is like Discount type, a html select element to choose between Amount or Percentage, and depending on the type selected the list price will be calculated in two different ways.
  4. Utility is a number, that is expected to represent an amount or a percentage that should be added to the cost in order to obtain the list price.
  5. If Utility Type is amount then the list price will be the cost plus the utility.
  6. If Utility Type is amount and the utility value is negative it's absolute value must not be greater than the cost, calculateLine function will change the value automaticly
  7. If Utility Type is percentage, the list price will be calculated according to this formula:

ListPrice = Cost /(1-(Utility/100))

  • The value of Utility could be negative or positive between -1000 to 90
  • Any value greater than 90 will be changed to 90 when calculateLine is executed
  1. The field list price is now readonly and calculateLine will calculate its value.
  2. All others fields will preserve its function as before.
  3. All fields have been reorganized to fit the new fields.
  4. Also some lines have been changed only to fit SuiteCRM's coding standards.

Motivation and Context

Not all the products and services has a static cost all the times, some change from day to day or according to the provider that the company finds every time. Change constantly the cost of the product is difficult and not useful as it not allows a company to compare utility obtain in every sell.
Calculate the list price in a spreadsheet and copy it to quote module is a double process, calculated by hand (even in a calculator) could lead to errors, so leave this function to SuiteCRM could help to automate the process and reduce mistakes, even later on a company could create a report to calculate how much profit a sell or a group of sales have been earned.

How To Test This

Create a few products, assign a cost and a list price.
Create a new quote
Add some products and services
The value of product's cost should be recovered from DB with all the other product's information as before.
Change the product's cost, assign an utility and choose an utility type, as you leave any of this fields you should see how list price and total price changes.
Change utility type between Percentage and Amount, it should change the amount on list price and all the other fields.
Compare the values to be sure that calculations have been made correctly as explained on point 6 and 7.
Save the quote, open it or edit it again, all values should be stored and recovered as you saved it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

Added a feature on Quotes modues to use or modify the cost of a product or service and specify an ammount or percentage of utility and calculate the value of List Price according to the cost and utility specified.
Add, fields for utility and utility type (amount or percentage) similar to discount and discount type fields.
@horus68
Copy link
Contributor

horus68 commented Feb 8, 2018

I have just one question on how to translate "Utility" as this could be difficult in some languages.
Can you give an example of real usage? Maybe an alternative wording or even some translation for other languages?

@davidbqzt
Copy link
Author

Hi @horus68

Some synonyms for Utility could be profit, revenue or margin.

In spanish, people refer to this as utilidad, margen, ganancia.

The feature comes from a customer who request it, but I have think about it before, as I have see some companies who do it like that, and even I do it in that way.
The formula that I used to calculate the list price when utility price is Percentage was taken from a common formula used in my business and business of partners and customers, . I found two articles that describes it, but are in spanish, I can't found it in english:
https://clickbalance.com/blog/contabilidad-y-administracion/como-definir-el-margen-de-ganancia-de-un-producto/
https://www.administrabien.com/precio-de-productos-costo-mas-utilidad/

Hope that helps.

@horus68
Copy link
Contributor

horus68 commented Feb 8, 2018

Thanks, I understand it now. In portuguese it would be "margem de lucro"

@davidbqzt davidbqzt changed the base branch from master to hotfix-7.9.x March 14, 2018 17:48
@davidbqzt davidbqzt changed the base branch from hotfix-7.9.x to develop March 14, 2018 22:01
@Dillon-Brown Dillon-Brown added the PR:Type:Enhancement Pull requests that provide more functionality. Associated Issues are called suggestions label Apr 23, 2018
@jack7anderson7 jack7anderson7 added the PR:Community Contribution These are contribution made by the community label Dec 3, 2018
@Mac-Rae
Copy link
Contributor

Mac-Rae commented Aug 5, 2019

Please resolve the conflicts on this pull request bringing it up to date.

@Mac-Rae Mac-Rae added the Status:Requires Updates Issues & PRs which requires input or update from the author label Aug 5, 2019
@davidbqzt
Copy link
Author

Hi @Mac-Rae,

I took a look to Codacy, but it's the first time I've work with Codacy, so I'm not sure if I do it right.

I check all the issues on Codacy, made changes on my sources and commit it to my repo.

Let me know if there is something else that must be done.

Regards.

David

@SuiteBot
Copy link

SuiteBot commented Aug 27, 2020

CLA assistant check
All committers have signed the CLA.

@serhiisamko091184 serhiisamko091184 added the Status: Stale For issues & PRs that have had no activity label Mar 14, 2024
@serhiisamko091184
Copy link
Contributor

Hello, @davidbqzt

The PR has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs.
Thanks for your contributions.

Regards,
Serhii

@serhiisamko091184
Copy link
Contributor

Hey @davidbqzt

Closing this PR due to inactivity.
Thank you.

Regards,
Serhii

@serhiisamko091184 serhiisamko091184 removed the Status:Requires Updates Issues & PRs which requires input or update from the author label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR:Community Contribution These are contribution made by the community PR:Type:Enhancement Pull requests that provide more functionality. Associated Issues are called suggestions Status: Stale For issues & PRs that have had no activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants