You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.9 KiB
JavaScript
96 lines
2.9 KiB
JavaScript
$(document).ready(function() {
|
|
$('#fshasil').invisibleEl();
|
|
|
|
/* dialog */
|
|
$('#dialogcaripelanggan').jqm({
|
|
modal: true,
|
|
trigger: '#btncarinama',
|
|
overlay: 30,
|
|
overlayClass: 'whiteOverlay',
|
|
onShow : function(hash){
|
|
hash.w.fadeIn(50);
|
|
},
|
|
onHide : function(hash){
|
|
hash.w.fadeOut(50, function(){if(hash.o) hash.o.remove();});
|
|
$('input[name="txtcari"]').val('');
|
|
$('#hasil').empty();
|
|
}
|
|
});
|
|
|
|
// Close Button Highlighting. IE doesn't support :hover. Surprise?
|
|
$('input.jqmdX')
|
|
.hover(
|
|
function(){ $(this).addClass('jqmdXFocus'); },
|
|
function(){ $(this).removeClass('jqmdXFocus'); })
|
|
.focus(
|
|
function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); })
|
|
.blur(
|
|
function(){ $(this).removeClass('jqmdXFocus'); });
|
|
|
|
$('input[name="tgllahir"]').datepicker({
|
|
dateFormat: 'dd-mm-yy',
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
yearRange: '1900:2009',
|
|
});
|
|
|
|
// ambil data
|
|
$('form[name="fcaripelanggan"]').submit(function(){
|
|
var postvars = {
|
|
txtcari: $("input[name='txtcari']").val(),
|
|
operation: "caripelanggan",
|
|
status: "ok"
|
|
};
|
|
$.post('ajaxpelanggan.php', postvars, function(data) {
|
|
var pelanggan = eval('('+data+')');
|
|
var hasil;//[pelanggan.length];
|
|
var tabel = "<table width=100% border='0'>";
|
|
tabel += "<tr style='font-weight:bold; text-align:center'><td>Kode</td><td>Nama</td><td>Alamat</td><td>Batas Bon</td><td>Nilai Bon</td></tr>";
|
|
for(i in pelanggan) {
|
|
tabel += "<tr><td><a href=\"javascript:setNilai('"+pelanggan[i].kd_customer+"')\">"+pelanggan[i].kd_customer+"</a></td>";
|
|
tabel += "<td>" + pelanggan[i].nama + "</td><td>" + pelanggan[i].alamat + "</td>";
|
|
tabel += "<td>" + pelanggan[i].bts_bon + "</td><td>" + pelanggan[i].nilai_bon + "</td></tr>";
|
|
}
|
|
tabel += "</table>";
|
|
$("#hasil").html(tabel);
|
|
$('#fshasil').visibleEl();
|
|
});
|
|
return false;
|
|
});
|
|
|
|
// simpan plafon
|
|
$('form[name="fplafon"]').submit(function(){
|
|
var postvars = {
|
|
kodepelanggan: $("input[name='kodepelanggan']").val(),
|
|
plafon: $("input[name='batasbon']").val(),
|
|
operation: "simpanPlafon",
|
|
status: "ok"
|
|
};
|
|
$.post('ajaxplafon.php', postvars, function(data) {
|
|
var hasil = eval('('+data+')');
|
|
if(hasil[0] == 1){
|
|
alert("Berhasil");
|
|
$('form[name="fplafon"]').resetForm();
|
|
} else {
|
|
alert("Gagal")
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
});
|
|
|
|
function setNilai(pelanggan) {
|
|
var postvars = {id_pelanggan: pelanggan,
|
|
operation: 'ambilpelanggan',
|
|
status: 'ok'
|
|
};
|
|
$.post('ajaxpelanggan.php', postvars, function(data){
|
|
var pelanggan = eval('('+data+')');
|
|
$('input[name="kodepelanggan"]').val(pelanggan[0].kd_customer);
|
|
$('input[name="nama"]').val(pelanggan[0].nama);
|
|
$('input[name="upline"]').val(pelanggan[0].upline);
|
|
$('input[name="nilaibon"]').val(pelanggan[0].nilai_bon);
|
|
$('input[name="batasbon"]').val(pelanggan[0].bts_bon);
|
|
$('#dialogcaripelanggan').jqmHide();
|
|
});
|
|
} |