Learning EspoCRM and Design
Collapse
X
-
Code:accountingCalculation = string\concatenate( 'Credit: ', $credit, '\n', 'Debit: ', $debit, '\n', 'Balance is: ', $credit-$debit, '\n', 'Calculate: ', '$',number\format($credit,0), ' - $', number\format($credit,0), ' = $', number\format($credit-$debit,0) );
You can add decimal place by changing this:
number\format($credit-$debit,2)
For example:
$1,300.00 -
Hi all, more learning. I finally played with sumRelated formula. And since there is no hope of having a "invoice" like adding for Accounting I created my own Accounting entity instead.
Here is some photo for your reference. And here is a formula I create to do calculation. I link it to Case entity as a Many to Many.
At the end of the day you want it to balance to $0.
I also played with "variable" as well for the first time using formula. Rather than creating many field, I create a single field call, "accountingCalculation" to do all my calculation. I added \n so it appear in a new line instead of altogether.
Code://Calculate AccountingCase $credit = entity\sumRelated('accountings', 'credit'); $debit = entity\sumRelated('accountings', 'debit'); accountingCalculation = string\concatenate( 'Credit: ', $credit, '\n', 'Debit: ', $debit, '\n', 'Balance is: ', $credit-$debit );
Leave a comment:
-
Was looking for OpenSource & Self Host new thing I can give it a try and came across quite a few EspoCRM on Reddit.
Saw someone create a 'sub-category' here if anyone into Reddit. Look like the very first post is a Tutorial/Guide:
Leave a comment:
-
Hi all,
FORMULA info
This is probably not hard for most people but in case people who having trouble or want to copy/paste the code. I recently create this code to calculate 2 'fee' structure (tax). Initially I used 'ifThenElse' but it got messy and I keep getting syntax error and can't figure out where the error is! So I went with a simpler version of, "if between this number then calculate"
Please update it to your correct field name and calculation.
Code://Calculate Tax ifThen(salePrice > 10000, Tax = (100+(0.5*(salePrice-10000)))); ifThen(salePrice > 9000 && salePrice <= 10000, Tax= 0.055*salePrice); ifThen(salePrice > 2000 && salePrice <= 9000, Tax= (500+(0.10*(salePrice-2000)))); ifThen(salePrice > 0 && salePrice <= 2000, Tax= 0.020*salePrice); //Calculate Admin Fee AdminFee = number\ceil(50.50+(2.5*number\round(salePrice/1000, 0)));
Sale Price = price selling/buying at
Tax is field I create to calculate these.
> greater than
&& I want a range check not just 1
<= less than or equal to, if I don't use && it won't work
number\ceil - I want to down it up because the tax man want it round. They don't like cents. ($0.10 for example, they want $1.00)
round(salePrice/1000), because they also want to do round here as well.
I have to have these because each $ range got different tax bracket. Not sure if you country is the same or it might be linear and you don't need to worry about this at all.
Hopefully this help with someone.
See Documents here: https://docs.espocrm.com/administration/formula/Leave a comment:
-
Thank shalmaxb, the documents said it will break the system if I try to do that. And the name will be on another row wouldn't it?
It be like this instead.
[photo1] [photo2] [photo3]
[photo4] [photo5] [photo6]
[Name1] [name2] [name3]
[Name4] [name5] [name6]
From: https://docs.espocrm.com/user-guide/printing-to-pdf/
"Note: Using <tr> and <td> tags along with {{#each}} helper is not recommended, since it breaks a layout of a contenteditable element." -
Look like I found a hidden update and feature that wasn't announce, or I have overlook or forgotten about it!
The image field, now we can drag and drop image into the field from a photo online/URL! No longer do I have to save the file and upload it. The downside is I become lazy, I don't save a backup image offline, and don't rename it. It mean I will totally be relying on EspoCRM and need to ensure I make backup often.
---
Another feature I recently discover, which probably in the system for years now. With the Knowledge Base, there is an option, "Send to Email", which will directly copy what you write into the email! I never tried this till yesterday when I wanted to print out the PDF of it. PDF Printing made all my image look weird, but if I use the Send to Email, it look the same as what I see in the Knowledge Base. If only Print to PDF "default" {body} tag can do this!Leave a comment:
-
So, today I want to create a PDF Template that list all the people face and their name and came up with this formula after a while, feel free to use.
nameAlt is a custom field, I use this field as the nickname or main name. Sometime legal name is not the wanted name so we create this field. There is also special characters as well.
As for photoIDid - this is an image field, I use this field to upload people face.
the "#unless" tag is basically like this, "if nameAlt is blank" then show First Name, if there is a nameAlt, then it show the Name Alternative.
Code:{{#each contacts}} {{#ifMultipleOf @key 3}} {{/ifMultipleOf}}{{imageTag photoIDId width=100 height=100}} {{#unless nameAlt}} {{firstName}}{{else}} {{nameAlt}} {{/unless}} {{/each}}
Data:
Template Result:
The first guy, Test no Photo.
----
One thing I want to do is like this but I haven't figure out how to do it with the code yet.
[photo] [photo] [photo]
Name [name] [name]Leave a comment:
-
Incase people missing in the update of v7 (not sure exact version), where Hotkey shortcut was introduced. But now we can "Shift" Click on checkbox to multiple select, this made editing Email much easier!
A well loved feature if anyone didn't about it.Leave a comment:
Leave a comment: