Announcement

Collapse
No announcement yet.

Learning EspoCRM and Design

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • shalmaxb
    commented on 's reply
    I use hundreds of formulas in one app and do not perceive any slow down.

  • espcrm
    commented on 's reply
    Now that I'm adding more and more formula... I wonder how much it will slow down EspoCRM

  • espcrm
    replied
    Originally posted by espcrm View Post

    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
    );​
    Restyle to have the $ sign:

    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)
    );​
    Click image for larger version  Name:	image.png Views:	0 Size:	9.3 KB ID:	86389

    You can add decimal place by changing this:

    number\format($credit-$debit,2)

    For example:
    $1,300.00

    Leave a comment:


  • espcrm
    replied
    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
        );​
    Screenshot time:
    Click image for larger version

Name:	image.png
Views:	475
Size:	7.1 KB
ID:	86384
    Click image for larger version

Name:	image.png
Views:	393
Size:	16.1 KB
ID:	86385
    Click image for larger version

Name:	image.png
Views:	397
Size:	36.0 KB
ID:	86386

    Leave a comment:


  • espcrm
    replied
    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:


  • Kharg
    commented on 's reply
    You will have to extract it and Zip the extension again, remove the Readme.md file.
    I will make a proper release when I have the time
    Last edited by Kharg; 11-15-2022, 07:58 AM.

  • espcrm
    commented on 's reply
    Thank Kharg, your was updated recently. telecastg haven't update his since 2 years ago from the look of github history.

    With your version, do I just download all, ZIP it and install?

  • Kharg
    commented on 's reply
    Dynamic Checklist is working for me on 7.2.7
    You could try my updated version which adds Espo Alert UI for errors.
    EspoCRM extension that adds a custom type field which allows to dynamically create a checklist inside any EspoCRM entity - Kharg/dynamic-checklist-for-espocrm

  • espcrm
    replied
    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)));​
    Now to explain:

    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:


  • espcrm
    commented on 's reply
    Perhaps this feature is a long time already, I was trying this on Firefox and realize it doesn't work! It look like it browser by browser?

    I know Chrome and Edge work but this seem to be the weakness of Firefox.

  • espcrm
    commented on 's reply
    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."

  • espcrm
    replied
    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:


  • shalmaxb
    commented on 's reply
    to have a layout in three columns per row, you will have to create a HTML-table, the caption would be another row.
    I will test your PDF-formula with one of my entities later.

  • espcrm
    replied
    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}}
    Here is a sample.

    Data: Click image for larger version

Name:	image.png
Views:	502
Size:	25.4 KB
ID:	84983

    Template Result: Click image for larger version

Name:	image.png
Views:	427
Size:	47.6 KB
ID:	84984

    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:


  • espcrm
    replied
    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:

Working...
X