Hotel Rooms (Entity?)


#173

Thanyou again JTR Tech i will remind you on sunday,sorry for asking this again


#174

Would really appreciate @JTRTech. :clap:


#176

Hi JTR you said we should remind you on this topic,hope you have something to share,i will really appreciate


#177

Must be a time difference, guessing your in western hemisphere :-p was at desk till 3am scouring CCTV following some thefts - so have been a little preoccupied.
Keep on at me and I will dig out the DB :wink:


#178

So sorry JTRTech for the thugs ,No worries we will wait a little longer .


#179

:stuck_out_tongue: I am also at your neck @JTRTech for this DB.


#180

Its create entity;

image

Booking ID is the entity name, the setup creates an entity per booking and links them to a room entity to allow individual accounts per booking rather than a recuring account for room.
The booking ID it created random and saved into the room booking id fields and then used from there to create a booking entity.


#181

I have this database loaded on my desktop and will leave it there for now, ask your question while its there :wink:


#182

Thanks JTR, at least now the db is with you it’s no longer in your archives :smile: . Let me continue from where I left off I’ll let you know if I hit a snag


#183

I think so long as you understand this bit you will have better picture of whats happening in the automation;


#184

am little bit late on this but i hope i can still catch up,Hope JTRTech hasn’t trashed the DB yet.


#185

@JTRTech, Need your help whenever you are free. On Image #5, I am having challenges finding the Action Type that has the Fields displayed.


#186

It’s a big thread, which action?


#187

Room%20Booking%20System


#188

The Fields Under Booking Cash/Card Payment


#189

It is a ‘Create Account Transaction Document’ action.
You will obviously need corresponding tens document for payments to room entity accounts. If unsure compare to the default customer account payment documents.


#190

Hey @JTRTech, I have added this to my Script but I do not know what to put under the Handler. Please help


#191

What script was that sorry? Dont remember there being a script in this setup but was a while ago…


#192

function accountbalance(accountname)
{
var qry = "
SELECT
sum([Debit])-sum([Credit]) as [Balance]

FROM [dbo].[AccountTransactionValues] tv
LEFT JOIN [Accounts] a ON a.[Id] = tv.[AccountId]
LEFT JOIN [Entities] e ON e.[AccountId] = a.[Id]

WHERE 1=1
AND a.[Name] = ‘"+accountname+"’";

var balance = sql.Query(qry).First;
return balance;
}

function BalanceFromEntityGridBookingNumberSetting()
{
var qry1 = “SELECT [Value] FROM [ProgramSettingValues] WHERE [Name]=’”+‘EntityGridBookingNumber’+"’";
var accountname = sql.Query(qry1).First;
var qry2 = "
SELECT
sum([Debit])-sum([Credit]) as [Balance]
FROM [dbo].[AccountTransactionValues] tv
LEFT JOIN [Accounts] a ON a.[Id] = tv.[AccountId]
LEFT JOIN [Entities] e ON e.[AccountId] = a.[Id]
WHERE 1=1
AND a.[Name] = ‘"+accountname+"’";

var balance = sql.Query(qry2).First;
return balance;
}


#193

Oh, ok.
Handler is irreverent to the script itself so long as the call to the script uses the handler.
Handler is just the name the script is saved under.

{CALL:handler.function(‘variable’)}