-
Notifications
You must be signed in to change notification settings - Fork 0
/
genbill_platform_private_crtl.js
59 lines (57 loc) · 2.38 KB
/
genbill_platform_private_crtl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
jsonres = [];
winbill = "";
hashdo = "";
function confirmSaveBill(){
$('#confirmsavebill').hide();
$('#modal1-bdy').html("<img src='img/load.gif' /><br />Validando o seu bilhete...");
var jsonb = JSON.stringify(myBets);
$.post('genbill_platform_validate.php', {'bill':jsonb, 'value':$('#valor-bill').val(), 'name':$('#apostador').val()}, function(data){
jsonres = [];
try {
jsonres = JSON.parse(data);
}
catch(err){}
if(jsonres['state'] == 'SUCCESS'){
$('#modal1-bdy').html("Validado com Sucesso!<br /><button id='print-bill' class='btn btn-default btn-primary btn-lg'>Imprimir Comprovante</button>");
hashd = jsonres['hash'];
$('#print-bill').click(printBill);
winbill = "";
winbill+="<html><head><style>body {font-family: 'monospace'; font-size: 12px;}</style></head><body>";
winbill+="<pre>";
winbill+="--------------------------------<br />";
winbill+=" PALPITE ESPORTIVO <br />";
winbill+=" www.palpiteesportivo.16mb.com <br />";
winbill+=" BANCA: " + $("#user-id").html() + "<br />";
winbill+=" APOSTADOR: " + $("#apostador").val() + "<br />";
winbill+=' DATA: '+jsonres['date'] + "<br /><br />";
winbill+=" "+jsonres['hash'] + " <br />";
winbill+="--------------------------------<br />";
winbill+="<br />";
winbill+=" SUAS APOSTAS <br />";
winbill+="--------------------------------<br />";
for(i in myBets){
winbill+=myBets[i][1] + "<br />";
winbill+=myBets[i][2] + "<br />";
winbill+='PALPITE: ' + myBets[i][3] +' - '+ myBets[i][4] + "<br />";
winbill+="--------------------------------<br />";
}
winbill+="TOTAL DE JOGOS: "+ myBets.length +"<br />";
winbill+="VALOR APOSTADO: R$ "+ $("#valor-bill").val() +"<br />";
winbill+="PREMIACAO: R$ "+ $("#total-bill").val() +"<br />";
winbill+="</pre></body></html>";
$("#valor-bill").val('');
$("#apostador").val('');
myBets = [];
fillMyBets();
}
else {
$('#modal1-bdy').html("<div class='alert alert-danger'>Erro! Tente novamente!</div>");
}
});
}
function printBill(){
var wpri = window.open("genbill_platform_print.php?id="+hashd, "_blank");
//var wpri = window.open("", "_blank");
//wpri.document.write(winbill);
//wpri.print();
}