{ACCOUNT TOTAL:x} Supports sub { } but {ACCOUNT BALANCE:x} Does Not

Can you just remind me how to do more than but not equal to in an action constraint?
Sure you told me before but for love nor money can I find the post.

Would be something like:

[=TN('Account Balance')] > 0

or …

[=TN('{CALL:db.accountbalance('1111 1111-Celeste')}')] > 0
1 Like

Awesome thanks.

Does {CALL:x} not work in an ask question message?

What message? There is no message in an Automation Command.

Sorry just corrected myself

Yes, CALL:X works in ask question action …

Made script work with Account or Entity Name …

function accountBalance(entityName,accountName) {
  if (typeof accountName =='undefined') {
    accountName = "";
  }
  if (typeof entityName =='undefined') {
    entityName = "";
  }

  var qry = "";
  qry += "SELECT sum([Debit])-sum([Credit]) as [Balance]";
  qry += " FROM [AccountTransactionValues] tv";
  qry += " LEFT JOIN [Accounts] a ON a.[Id] = tv.[AccountId]";
  qry += " LEFT JOIN [Entities] e ON e.[AccountId] = a.[Id]";
  qry += " WHERE 1=1";
  if (accountName != "") {
    qry += " AND a.[Name] = '" + accountName + "'";
  }
  if (entityName != "") {
    qry += " AND e.[Name] = '" + entityName + "'";
  }
  
  var balance = sql.Query(qry).First;

  return balance;
}


Ok, must be my use of sub { };

[=TN({CALL:accountinfo.accountbalance(’{REPORT ENTITY DETAIL:EC.Booking Number:(EN=[:CommandValue)}’)})]

This returns nothing… blank, not 0 or anything.
But works fine in the action constraint for that ask question…

We have {ACCOUNT BALANCE:X} and {ENTITY BALANCE:X} tags. Sorry I didn’t read full thread in detail so I may miss the point but from SQL Script you’re working on I think it does what these tags already does.

2 Likes

{ACCOUNT BALANCE:X} doesn’t seem to support sub {} unlike the other tags
Also {ACCOUNT CREDIT TOTAL:x} doesn’t seem to be behaving.
Third post is the important one.

You are missing something] there …

[=TN({CALL:accountinfo.accountbalance('{REPORT ENTITY DETAIL:EC.Booking Number:(EN=[:CommandValue])}')})]

Hint: [:CommandValue … should be … [:CommandValue]

1 Like

Banging my head on the table… LOL

Sorry…

{ACCOUNT BALANCE} is a printer template tag intended to use in printer templates. There is a chicken-egg problem here. As printer template tags processes before report tags passing a report inside printer tag does not work.

{ACCOUNT TOTAL} gives account transaction amount total in given work period. You can filter by account or transaction type. Credit gives credit total. Debit gives debit total.

Maybe there is no credit transaction in active work period so it returns 0.


We can solve that no problem. As I’ve said before I don’t have much hotel experience but when thinking logically it seems like to me you don’t need to make customer account transactions until customer makes a payment. Why don’t you just operate room account?

Only have the one work period.

Because account statement which will be booking invoice would show previous guests transactions…

So OK. Let me prove it does what it intended to do.

I’ve cleared transactions, started a new work period. Created a new transaction document like that. Receivables account does have both credit and debit transactions.

This is how report looks.

I’ll be glad if you can help me reproducing issue on my side.

Thank you very much for that answer. Why booking invoice is an account statement. Can’t it be a Ticket?

No because its multi day and accounts system was originally the suggested solution :slight_smile:

Jumping in again but relevant to your threads JTRTech:

Can you add a unique booking reference/ID to the Room Account Transactions? THEREFOR when you request over work periods using unique booking ID, even though the account has previous “stays” transactions if you SELECT by unique booking ID you will only get the correct customer transactions.

Might be off the mark but would also handle 2 bookings on the 1 day :smile:

1 Like

Am really struggling with {ACCOUNT} report tags;

In current work period I have;



My report part working on is;

[Banking Details:2, 1]
Till Cash|{REPORT PAYMENT TOTAL:(PT=Cash)}
Rooms Cash|{ACCOUNT TRANSACTION TOTAL:Booking Cash Payment:Cash}
>>Total Cash|[=F({REPORT PAYMENT TOTAL:(PT=Cash)}+{ACCOUNT TRANSACTION TOTAL:Booking Cash Payment:Cash})]
Till Card|{REPORT PAYMENT TOTAL:(PT=Credit Card)}
Rooms Card|{ACCOUNT TRANSACTION TOTAL:Booking Credit Card Payment:Credit Card}
>>Total Card|[=F({REPORT PAYMENT TOTAL:(PT=Credit Card)}+{ACCOUNT TRANSACTION TOTAL:Booking Credit Card Payment:Credit Card})]

But yet the report shows;

What am I missing…
Should {ACCOUNT TRANSACTION TOTAL:Booking Cash Payment:Cash} not = 1.5

@emre any chance of your opinion?

Can you PM me database backup with these transactions and report?

Not sure what it was but backup and restore to other machine seemed to sort it and that report suddenly started working.
If your works it was probably me, done have the exact same report as had to sort machine ready to ship so adjusted the report.

Could really do with some report tags for account balance, qmckays script saved me on that one luckily

:slight_smile: No it didn’t suddenly started working. Custom report tags uses heavy caching and it probably don’t refresh until you leave management and come back. I’ll check it.