function mtel(tel){
if (tel.length==10) {tel = tel.replace( /(\d{3})(\d{3})(\d{4})/, '0($1) $2 $3' ) }
else {tel = tel.replace( /(\d{3})(\d{4})/, '0(212) $1 $2' )}
return tel}
function siparis(ads){
var ids = sql.Query("SELECT TOP (1) Tickets.Id FROM TicketEntities INNER JOIN Tickets ON TicketEntities.Ticket_Id = Tickets.Id WHERE EntityName in ('"+ads+"') AND Tickets.IsClosed = 1 ORDER BY TicketEntities.Ticket_Id DESC").First;
return sql.Query("SELECT CONCAT('<block 1 transparent left 300>','<block 1 transparent left 30>',CONCAT(FORMAT(Quantity,'#.##'),'x'),'</block><block 1 trasparent left 200>',CONCAT(MenuItemName,CASE WHEN PortionName = 'Normal' THEN NULL Else CONCAT('.',PortionName) END),'</block><block 1 transparent right 70>',Format(Price,'#.00##','TR-tr'),'</block></block>') FROM Orders WHERE TicketId = "+ids+"").Join('<br/>')
}
function toplam(ads){
var ids = sql.Query("SELECT TOP (1) Tickets.Id FROM TicketEntities INNER JOIN Tickets ON TicketEntities.Ticket_Id = Tickets.Id WHERE EntityName in ('"+ads+"') AND Tickets.IsClosed = 1 ORDER BY TicketEntities.Ticket_Id DESC").First;
return sql.Query("SELECT FORMAT(TotalAmount,'#.00##','TR-tr') FROM Tickets WHERE IsClosed = 1 AND Id = "+ids+"").First}
function count(ads){return sql.Query("SELECT DISTINCT COUNT(Ticket_Id) FROM TicketEntities WHERE EntityName in ('"+ads+"')").First; }
function grand(ads){
var ids = sql.Query("SELECT DISTINCT Ticket_Id FROM TicketEntities WHERE EntityName in ('"+ads+"')").Join(',');
return sql.Query("SET LANGUAGE Turkish SELECT FORMAT(SUM(TotalAmount) , 'C') AS 'Currency Format' FROM Tickets WHERE IsClosed = 1 AND Id IN ("+ids+")").First}
function gun(ads){
var ids = sql.Query("SELECT TOP (1) Tickets.Id FROM TicketEntities INNER JOIN Tickets ON TicketEntities.Ticket_Id = Tickets.Id WHERE EntityName in ('"+ads+"') AND Tickets.IsClosed = 1 ORDER BY TicketEntities.Ticket_Id DESC").First;
var gun = sql.Query("SELECT DATEDIFF(day,Date,GETDATE()) FROM Tickets WHERE IsClosed = 1 AND Id = "+ids+"").First
if(gun==null){var gun = '0'} else {var gun = gun}
return gun}
function tarih(ads){
var ids = sql.Query("SELECT TOP (1) Tickets.Id FROM TicketEntities INNER JOIN Tickets ON TicketEntities.Ticket_Id = Tickets.Id WHERE EntityName in ('"+ads+"') AND Tickets.IsClosed = 1 ORDER BY TicketEntities.Ticket_Id DESC").First;
return sql.Query("SELECT Date FROM Tickets WHERE IsClosed = 1 AND Id = "+ids+"").First}
Müşteri arama bölümünde uygulama olarak çok güzel. Peki caller id ile gelen telefon aramasında direk paket servis bölümüne müşteri seçimi geliyor. Burada benzer bir uygulama yapılabilirmi?