{CALL:status.masa('$1')}
Denetimci : status
function masa(masa){
var masaid = sql.Query("SELECT Id FROM Entities WHERE Name IN ('"+masa+"')").First;
var sure = JSON.parse(sql.Query("SELECT EntityStates FROM EntityStateValues WHERE EntityId = "+masaid+"").First.split('~'));
for(var i = 0; i < sure.length; i++) {if (sure[i].SN == 'Status') var r = sure[i].D;}
var sure = r.replace('/Date(','').replace(')/','')
var sure = sql.Query("SELECT DATEDIFF(MINUTE,DATEADD(S, CONVERT(int,LEFT("+sure+", 10)), '1970-01-01 03:00:00'),GETDATE())").First;
var tutar = sql.Query("SELECT FORMAT(TotalAmount, 'C','tr-TR') FROM Tickets INNER JOIN TicketEntities ON Tickets.Id = TicketEntities.Ticket_Id WHERE IsClosed = 0 AND EntityName IN ('"+masa+"')").First;
var user = sql.Query("SELECT Tickets.LastModifiedUserName FROM Tickets INNER JOIN TicketEntities ON Tickets.Id = TicketEntities.Ticket_Id WHERE IsClosed = 0 AND EntityName IN ('"+masa+"')").First;
var no = sql.Query("SELECT Tickets.TicketNumber FROM Tickets INNER JOIN TicketEntities ON Tickets.Id = TicketEntities.Ticket_Id WHERE IsClosed = 0 AND EntityName IN ('"+masa+"')").First;
var kisi = sql.Query("SELECT TicketTags FROM Tickets INNER JOIN TicketEntities ON Tickets.Id = TicketEntities.Ticket_Id WHERE IsClosed = 0 AND EntityName IN ('"+masa+"')").First;
if(kisi==''){var kisi = ''} else {var kisi = JSON.parse(kisi.split('~'))}
for(var i = 0; i < kisi.length; i++) {if (kisi[i].TN == 'Kişi Sayısı') var kisi = kisi[i].TV;}
var baslik = "<size 100><b>"+masa+"</b></size>";
if(kisi>>'0') {var kisi = " - 👪 "+kisi+"";} else {var kisi = ''}
var zaman = "🕒 "+sure+"";
var toplam = "<color navy>"+tutar+"</color>";
var garson = "🤵 "+user+"";
var br = "<br/>";
var t = " - "
return baslik + kisi + br + zaman + t + toplam + br + garson
}