ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Margin and discount

Dears

Quotation Module has a filed name

margin and discount

there is a filed called Rate With Margine

where it takes margine rate + item price

for example

item price = 50
margine percentage = 10%
margine value =50*0.1=5
Rate With Margine = 50+5=55

i need to add a filed named
margine value which will deduce automatically from the 10% rate

so the margine value filed = 5

lets imagine a scenario like this:

we make a quotation with

Three item

item 1 price =50
margine percenatge=10%
margine value=5

item 2 price = 100
margine percentage= 10%
margine value=10

item 3 price = 200
margine percentage = 10%
margine value=20

So Now the Total margin value of the quotation is

Total Margine = 5+10+20=35

So i need the End of the Quotation To get a filed where it Sum the all margin values

for example there is a Total Filed

i need to add a field named Total Margin

beside this Total filed

where it reflect our margin

so we can get a report later
for instance a quarter report
for that margin and press on show total
To sum the margin values for that quarter quotations
and also can be done against specific sales person
to know how much margin we gain from a specific sales man

thanks a lot .

dears

i need to see the file that make this calculations inside the erpnext

quotation item table doctype

i need to see its configuration
where i can edit or add to this file

just guide me to its location
thanks a lot

@sheno

Check below links


1 Like

Dear rohit_w
thank u i will check the links and feed u back

i added a custom field in Quotation Item Doc

the filed name margine_value as a redaonly

Then i followed your link and added an addition line

item.margine_value = flt(item.price_list_rate) * ( flt(item.margin_rate_or_amount) / 100);

To let the new createted field takes its value from that equoation

But it didnt works

we will note Margine Value is LE0.00

why ?! its suppose to take its value from the equation am i right ?

try using frm.set_value("margin_value", 1.1*2.3).

If you keep generic name for custom field it’ll not let you upgrade if field with same name is added on doctype in core later.

If you think it is useful for many others, send a PR.
PR ensures your field and functionality doesn’t fail upgrade.

1 Like

Dear
revant_one

what is the meaning of ?
1.1
2.3
and where should i add this line ?

frm.set_value(“margin_value”, 1.1*2.3).

do u mean to add this line in quotation custom script?

1 Like

Dears

any body can guide me ?

My guess is the two rates are margin and discount, whose product is margin_value!?

Yes first test this in a custom script.

Then merge that change into the current form and issue a Pull Request.

You can learn and do this - just search the forum and docs for clues and pointers…

1 Like

actually dear
i need to add a custom filed named margine value
in quotation item
its job is to know the profit of that quotation
for example

====
item price = 50
margine percentage = 10%
margine value =50*0.1=5
Rate With Margine = 50+5=55

i need to add a filed named
margine value which will deduce automatically from the 10% rate

so the margine value filed = 5

lets imagine a scenario like this:

we make a quotation with

Three item

item 1 price =50
margine percenatge=10%
margine value=5

item 2 price = 100
margine percentage= 10%
margine value=10

item 3 price = 200
margine percentage = 10%
margine value=20

So Now the Total margin value of the quotation is

Total Margine = 5+10+20=35

So i need the End of the Quotation To get a filed where it Sum the all margin values

margine

So you aim to add that field to Quotation possibly as a core contribution.

You refer to margine - is that is a typo and you mean instead margin?

actually my only aim is a way to calculate the Quotation Profit

dears.

i have a scenario that i want to add a custom filed in the Quotation item table

The filed Name Profit type currency

i need this filed = margine percentage * price * unit number

For example

when we make a quotation we select item table

item code cisco switch
Price List Rate 1000 us
Quantity 5
margine percentage
percentage 10

so
profit=10/100 * 1000 *5=500

how can we do this using scripting?

Best Regards

I want to add a discount on two columns. I’ve added the form filed in the item list. Please tell me how can I calculate the discount. Please See the below image.

Calculation Like this.

4260 Rs - 5% - 6%

4260 Rs - 213 Rs - 242.82 = 3804.18 Rs

PLEASE HELP ME FOR THIS…