create balance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stayfi
    Member
    • Jul 2021
    • 60

    create balance

    Hello,

    i've 2 currency fields, total sum, and payed sum
    any way to create a third field with balance of them.

    thanks.
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Begin first by read documentation of espocrm




    and search on doc readOnly field type
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • stayfi
      Member
      • Jul 2021
      • 60

      #3
      thanks, can you help with the syntax?
      Last edited by stayfi; 12-05-2021, 12:46 PM.

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #4
        Originally posted by stayfi
        Hello,

        i've 2 currency fields, total sum, and payed sum
        any way to create a third field with balance of them.

        thanks.
        you can do something like this, create a another currency field (unpaidAmount) and make sure it is readonly and then use formula like this:

        unpaidAmount = payedSum - totalSum;

        that is it

        hope this helps

        Cheers
        Rabii
        Web Dev

        Comment

        • stayfi
          Member
          • Jul 2021
          • 60

          #5
          Originally posted by rabii

          hope this helps
          Thanks mate, it works, i sure will try other formulas.

          Can. I create a field to total all sums, also for, payed ones, and do a major balance then?

          This because i insert each time an item, with payed and totals.

          Or is there any easy way? Thanks again.
          Last edited by stayfi; 12-06-2021, 02:12 PM.

          Comment

          • rabii
            Active Community Member
            • Jun 2016
            • 1250

            #6
            Yeah sure you can apply any logic using formula. I assume you have two entities (parent and child), if you do, then you can add a totalSum, PayedSum and unpaidSum on parent entity and then you can use formula as below to calculate all total sums etc of child entities, e.g crm by default have an account has many opportunities, we could add total opportunities sum like below:

            totalSum = entity\sumRelated('opportunities', 'amountConverted');

            have a look at this section in documentation https://docs.espocrm.com/administrat...titysumrelated

            Cheers
            Rabii
            Web Dev

            Comment

            • stayfi
              Member
              • Jul 2021
              • 60

              #7
              hi rabii
              no i have only fields for balance, and totals, and payed amount

              Comment


              • rabii
                rabii commented
                Editing a comment
                Can you provide more info on what you want to achieve and how many entities are involved and i will be happy to help mate. Just share more information and we will sort it out.

                Cheers
            • stayfi
              Member
              • Jul 2021
              • 60

              #8
              For example,

              I have 1 entity (for every Contact) named "cleaning",

              with 2 fields, amount, and payed amount. I want to create a total sum of these 2 fields' each one separately, then make 1 one field for the balance of all payed-amount.

              Each visit of a contact a "cleaning" related with amount and payed fields is registered.
              Last edited by stayfi; 12-08-2021, 09:14 AM.

              Comment

              Working...