-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXeroReceipt.php
77 lines (57 loc) · 1.71 KB
/
XeroReceipt.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
<?php
class XeroReceipt {
//ATTRIBUTES
public $_title = 'Receipt';
public $_pk = 'xeroReceiptID'; //our primary key title
protected $_table = 'xeroreceipt'; //MySQL table name
//OUR FIELDS
public $xeroReceiptID = ''; //Our primary Key
public $userID = 0;
//XERO Fields
public $ReceiptID; //Xero's primary key
public $ReceiptNumber;
public $Status;
public $Date;
public $SubTotal;
public $TotalTax;
public $Total;
function __construct($dataarray,$userID)
{
// Intitlize all the variable
// print_r($dataarray);
foreach($dataarray->Receipt as $row)
{
$this->ReceiptID=$row->ReceiptID;
$this->ReceiptNumber=$row->ReceiptNumber;
$this->Status=$row->Status;
$this->Date=$row->Date;
$this->SubTotal=$row->SubTotal;
$this->TotalTax=$row->TotalTax;
$this->Total=$row->Total;
//echo $this->AccountID."<br> sdfsdsd ";
$this->insert();
}
return true;
}
//CRUD
public function insert(){
$insert = sprintf("INSERT INTO ".$this->_table."
(userID, ReceiptID, ReceiptNumber, Status ,Date,SubTotal,TotalTax,Total)
VALUES
('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s');",
mysql_real_escape_string($this->userID),
mysql_real_escape_string($this->ReceiptID),
mysql_real_escape_string($this->ReceiptNumber),
mysql_real_escape_string($this->Status),
mysql_real_escape_string($this->Date),
mysql_real_escape_string($this->SubTotal),
mysql_real_escape_string($this->TotalTax),
mysql_real_escape_string($this->Total)
);
$result = mysql_query($insert);
}
/*
Any other utilities you need here
*/
}
?>