-
Notifications
You must be signed in to change notification settings - Fork 1
/
expence1.php
73 lines (67 loc) · 1.59 KB
/
expence1.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
include("expence.php");
$query82 = "SELECT * from data2 WHERE tname3 = 'Expence on cash' or tname3 ='Expence on due' ";
$result882 = mysqli_query($con,$query82);
while($row = mysqli_fetch_array($result882)){
$dno = $row["dno"];
$date = $row["date"];
$balance = $row["balance"];
$t1 = $row["t1"];
$t2 = $row["t2"];
$tt1 = $row["tt1"];
$tt2 = $row["tt2"];
$tname2 = $row["tname2"];
$tname3 = $row["tname3"];
$tname1 = $row["tname1"];
$arr = array('','','','','','','');
$arr[$t1-1] = $balance * $tt1;
$arr[$t2-1] = $balance * $tt2;
if($arr[6]<0){$dc11=$arr[6];$dc22=" ";}
else{$dc11=" ";$dc22=$arr[6];}
$query83 = "insert into expence(dno,date,particular5,debit5,credit5,balance) values ('$dno','$date','($tname3)$tname2','$dc11','$dc22','$dc11 $dc22')";
mysqli_query($con,$query83);
}
$query84 = "select * from expence";
$result884 = mysqli_query($con,$query84);
$sum9=0;
while($row = mysqli_fetch_array($result884)){
$date = $row["date"];
$particular5 = $row["particular5"];
$debit5 = $row["debit5"];
$credit5 = $row["credit5"];
$balance = $row["balance"];
$sum9 = tggg7($date,$particular5,$debit5,$credit5,$balance,$sum9);
}
tggg7_sum($sum9);
function tggg7($date,$particular5,$debit5,$credit5,$balance,$sum9){
$sum9=$sum9 +$balance;
$debit5*=-1;
echo "
<tr>
<td>$date</td>
<td> $particular5 </td>
<td>=</td>
<td>$debit5</td>
<td>$credit5</td>
<td>$sum9</td>
</tr>";
return $sum9;
}
function tggg7_sum($sum9){
$sum9=$sum9*-1;
$dc=0;
if($sum9<0)
$dc='Cr';
else
$dc='Dr';
echo "
<tr>
<td>Total</td>
<td> </td>
<td>=</td>
<td> </td>
<td> </td>
<td> $sum9 $dc</td>
</tr>";
}
?>