-
Notifications
You must be signed in to change notification settings - Fork 1
/
dispmatch.php
131 lines (125 loc) · 4.42 KB
/
dispmatch.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
global $prefix;
global $accountstbl, $bankbooktbl, $transactionstbl;
global $correlationtbl,$curuser,$begin,$end,$TranType;
$text='';
$step=(int)GetPoster('step');
$acc=(int)GetPoster('account');
$num=(int)GetPoster('cornum');
/*
function PrintAccountSelect() {
global $accountstbl, $prefix;
$type1 = CUSTOMER;
$type2 = SUPPLIER;
$text='';
$query = "SELECT num,company FROM $accountstbl WHERE type='$type1' AND prefix='$prefix' ORDER BY company ASC";
$result = DoQuery($query, __LINE__);
$text.= "<select id=\"account\" name=\"account\">\n";
$l = _("Select account");
$text.= "<option value=\"0\">-- $l --</option>\n";
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$num = $line['num'];
$name = stripslashes($line['company']);
$text.= "<option value=\"$num\">$name</option>\n";
}
$query = "SELECT num,company FROM $accountstbl WHERE type='$type2' AND prefix='$prefix' ORDER BY company ASC";
$result = DoQuery($query, __LINE__);
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$num = $line['num'];
$name = stripslashes($line['company']);
$text.= "<option value=\"$num\">$name</option>\n";
}
$text.= "</select>\n";
return $text;
}*/
if($step==2){//do action and set step 1
if($num!=0){
if(updateSql(array('prefix'=>$prefix,'num'=>$num), array("status"=>CLOSED), $correlationtbl))
if(updateSql(array('prefix'=>$prefix,'cor_num'=>$num), array("cor_num"=>0), $transactionstbl))
$text.=_("Correlation No.:")." $num "._("was canceld");
}else{
$text.=_("no correlation was selected");
}
$step=1;
}
if($step==1){//account chosen display detiales
if($acc!=0){
$query = "SELECT * FROM $transactionstbl WHERE account='$acc' AND prefix='$prefix' AND cor_num!='0' AND (date>=$begin OR date<=$end)";
$result = DoQuery($query, "Select account");
$cors=array();
$transa=array();
while($trans = mysql_fetch_array($result, MYSQL_ASSOC)) {
$transa[$trans["num"].":".$trans["id"]]=$trans;
if(!isset($cors[$trans["cor_num"]])){
$cor=selectSql(array("prefix"=>$prefix,"num"=>$trans["cor_num"],"status"=>OPEN), $correlationtbl);
$cors[$cor[0]['num']]=$cor[0];
}
}
$text.="<form>";
$text.="<table class=\"tablesorter\"><thead><tr><th >"._("Debit")."</th><th>"._("Credit")."</th><th>"._("Action")."</th></tr></thead>";
$text.="<tfoot><tr><td></td><td></td><td></td></tr><tfoot>";
$text.="<tbody>";
foreach($cors as $cor){
$num=$cor['num'];
$text.="<tr><td>";//Debit
$text.="<table class=\"small\" style=\"width:100%\">";
$debit=explode(',',$cor['hova']);
foreach($debit as $rec){
$text.="<tr>";
if(isset($transa[$rec])){
$text.="<td>".$transa[$rec]["num"]."</td>";
$text.="<td>".$TranType[$transa[$rec]["type"]]."</td>";
$text.="<td>".$transa[$rec]["date"]."</td>";
$text.="<td>".$transa[$rec]["sum"]."</td>";
}else {
print "bad transaction detailes: $rec";
exit;
}
$text.="</tr>";
}
$text.="</table>";
$text.="</td><td>";//Credit
$text.="<table class=\"small\" style=\"width:100%\">";
$credit=explode(',',$cor['zchot']);
foreach($credit as $rec){
$text.="<tr>";
if(isset($transa[$rec])){
$text.="<td>".$transa[$rec]["num"]."</td>";
$text.="<td>".$TranType[$transa[$rec]["type"]]."</td>";
$text.="<td>".$transa[$rec]["date"]."</td>";
$text.="<td>".$transa[$rec]["sum"]."</td>";
}else{
print "bad transaction detailes: $rec";
exit;
}
$text.="</tr>";
}
$text.="</table>";
$text.="</td><td>";//action
$l=_("Cancel Correlation");
$text.="<a href=\"?module=dispmatch&step=2&account=$acc&cornum=$num\" class=\"btnsmall\">$l</a></td></tr>";
}
$text.="</tbody>";
$text.="</table>";
$text.="</form>";
}else{
$step=0;
}
}
if($step==0){//choose account
$text.="<form name=\"dispmatch\" action=\"?module=dispmatch&step=1\" class=\"valform\" id=\"dispm\" method=\"post\">";
$l=_("Please choose an account to match");
$text.="$l<br />";
$text.=PrintAccSelect($acc,'account','A');
$text.="<span id=\"accountname\"></span><br />";
$l=_("From Date:");
$text.="$l<input id=\"begin\" type=\"text\" value=\"$begin\" class=\"date\" name=\"begin\" />";
$l=_("To Date:");
$text.="$l<input id=\"end\" type=\"text\" value=\"$end\" class=\"date\" name=\"end\" />";
$l = _("Execute");
$text.="<input type=\"submit\" value=\"$l\" class=\"btnaction\" />";
$text.="</form>";
}
$haeder=_("Correlation Display");
createForm($text, $haeder,"",750,"","$logo",true,$help);
?>