-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaction.inc
52 lines (43 loc) · 1.81 KB
/
transaction.inc
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
<?php
class transaction extends db_object {
function __construct($loadid = 0) {
$this->table = "transactions";
parent::__construct($loadid);
if (substr($this->obj_id, 0, 2) == "id") {
$this->fields['con'] = $_SESSION['conid'];
}
}
function editor() {
$basename = get_class($this) . '_' . $this->obj_id;
$html = '<div id="' . $basename . '_editor" class="' . get_class($this) . '_editor">';
$html .= '<input type="hidden" name="editobj_' . $basename . '" value="true"></input>' . "\n";
$html .= "<input type=\"hidden\" name=\"{$basename}_ca\" value=\"{$this->fields['ca']}\"></input>\n";
$transtype = '<select name="' . $basename . '_paytype">';
foreach($_SESSION['db_enums']['paytypes'] as $typecode => $typedetails) {
$transtype = $transtype . "<option value=\"$typecode\"";
if (!strcmp($this->fields['paytype'], $typecode)) $transtype .= " selected";
$transtype = $transtype . ">{$typedetails['name']}</option>\n";
}
$transtype .= "</select>\n";
$html .= $this->section("type", "Transaction Type", $transtype);
$html .= $this->section("paidby", "Paid By", $this->textbox('paidby'));
$html .= $this->section("paidto", "Paid To", $this->textbox('paidto'));
$html .= "<span style=\"display: block; padding-top: 0.5em\">";
$html .= $this->section("details", "Details", $this->textbox('details'));
$html .= "   ";
$html .= $this->section("notes", "Notes", $this->textbox('notes'));
$html .= "</span>";
$html .= $this->section("amount", "Amount", "<input type=\"text\" class=\"amount\" name=\"${basename}_amount\" value=\"\${$this->fields['amount']}\"></input>");
$html .= "</div>\n";
return $html;
}
function readvals() {
parent::readvals();
$this->fields['amount'] = ereg_replace("[^0-9.]", "", $this->fields['amount']);
}
function save() {
unset($this->fields['ca']);
parent::save();
}
}
?>