我正在尝试做一些会计程序,但是我被困在某个地方。我正在尝试计算。我的数据没有问题。如果短计算类型为0,则减法运算类型1将进行汇总。
<?php
$hesapsor=$db->prepare("SELECT * FROM islemler JOIN musteriler ON islemler.musteri_id = musteriler.musteri_id");
$hesapsor->execute();
$say = 0;
$rr=$hesapsor->fetchAll(PDO::FETCH_ASSOC);
$rr=json_encode($rr);
?>
<script type="text/javascript">
var data = <? echo $rr; ?>;
for(i=0;i<data.length;i++) {
Object.keys(data[i]).map(function(el){
data[i][el] = +data[i][el] || data[i][el];
})
}
console.log(data)
function newData() {
var result = []
for(i=0;i<data.length;i++) {
result.push({
sirano: i+1,
adi: data[i].musteri_adi,
soyadi: data[i].musteri_soyadi,
tl: data[i].musteri_soyadi,
t24a: data[i].islem_24a,
t22a: data[i].islem_22a,
ceye: data[i].islem_ceye,
ceyy: data[i].islem_ceyy,
dolar: data[i].islem_dolar,
euro: data[i].islem_euro,
yare: data[i].islem_yare,
yary: data[i].islem_yary,
ziye: data[i].islem_ziye,
ziyy: data[i].islem_ziyy,
islemtipi: data[i].islem_tipi,
musteriID: data[i].musteri_id
})
}
return result
}
console.log(newData())
function createTrtd(val) {
for(i=0;i<data.length;i++) {
document.write("<tr>");
Object.keys(data[i]).map(function(el){
data[i][el] = +data[i][el] || data[i][el];
document.write("<td>"+data[i][el]+"</td>");
})
document.write("</tr>");
}
}
</script>