How to Calculate in vTiger - vtiger

I created a numeric commission field and a numeric total field (value of the product / commission)
How can I do this calculation in the vTiger Builder Module?
Thanks

You can use vitger workflow update field task

Related

summing up the values of a column in django framework

I have a model in my django web app and I have been trying to query the model in such a way that I can sum up values in the quantity column. I already have data in this model so I just need to add up all the values in the quantity column.
class ProductInstance(models.Model):
product=models.ForeignKey(Product,on_delete=models.RESTRICT,related_name='product')
quantity=models.IntegerField()
warehouse=models.ForeignKey(Warehouse,on_delete=models.RESTRICT,related_name='warehouse')
I tried "ProductInstance.objects.sum(quantity)". It didnt work
You can use aggregate functions for this kind of cases.
from django.models import Sum
ProductInstance.objects.all().aggregate(sum=Sum('quantity'))

django - get first record for each day

I have a model Sales with:
Saler
Product sold
Date
I would like to get the first sale for each date and for each saler, how can I do that?
Thanks
Considering the model Posted in the question, the Django ORM query will be:
first_sale = Sales.objects.order_by("Saler", "Date").distinct("Saler")
Not tested, but I would try (I assumed the field for the date of the sale is named sale_date, and is of type Datetime):
first_sale = Sales.objects.filter(saler=the_saler, sale_date__date=datetime.date(2021, 05, 19)).order_by('sale_date').first()
filter will restrict the search to a given saler (the_saler), and to a given day (see the __date expression: https://docs.djangoproject.com/fr/3.1/ref/models/querysets/#date)
order_by and first will give you the first of the day.

How to make a Bangladeshi phone number field in the model of django?

Is there any package or widgets to do so?
Example numbers:
[+880][17][59219191], [+880][16][59219090]
Here [+880] is country code, which is constant,
[14],[16],[17]...etc are service provider numbers
[59219090],[59219191]...etc are third part of mobile numbers in Bangladesh.
You can use django-phonenumber-field and set PHONENUMBER_DEFAULT_REGION for your national.
you can use phone number field as CharField then use widget in ModelForm fields. Take help from this to apply masking of filed link

Opencart - Calculate price by option field value

I looked everywhere.
I have Opencart 2.0.2.0. Some of my products are vegetable. So for them I want to insert 1kg price and give an input field for customers to enter the weight they are after. So 1kg is $29 and if the customer enters "271"g, the price should be "(29/1000)*271 = $7.85. Do you know the easiest way to implement this and pass this dynamic price?
Thanks heaps.
This OpenCart extension should be able to do it.

Unable to display exact price in opencart

I am new to opencart. I am trying to set the price in admin part but It is not showing as I set in dashboard. It is showing something less than(5% less) the what I entered in admin.
I have set the price of two products in dashboard :
But when I see the product as follow on the front end :
I have set display price tax in opencart setting as follow
Check your currencies are correct in System - Localisation - Currencies
you currency should be set as default and with a value of 1.0000