-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
example.php
99 lines (86 loc) · 2.57 KB
/
example.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
<?php
// (A) LOAD QUOTR
require "quolib/quotr.php";
// (B) SET QUOTATION DATA
// (B1) COMPANY INFORMATION
/* RECOMMENDED TO JUST PERMANENTLY CODE INTO QUOLIB/QUOTR.PHP > (C1)
$quotr->set("company", [
"http://localhost/code-boxx-logo.png",
"D:/http/code-boxx-logo.png",
"Code Boxx",
"Street Address, City, State, Zip",
"Phone: xxx-xxx-xxx | Fax: xxx-xxx-xxx",
"https://code-boxx.com",
"doge@code-boxx.com"
]); */
// (B2) QUOTATION HEADER
$quotr->set("head", [
["QUOTATION #", "CB-123-456"],
["Valid From", "2011-11-11"],
["Valid Till", "2011-12-12"]
]);
// (B3) CUSTOMER
$quotr->set("customer", [
"Customer Name",
"Street Address",
"City, State, Zip",
"Tel, Email"
]);
// (B4) ITEMS - ADD ONE-BY-ONE
$items = [
["Rubber Hose", "5m long rubber hose", 3, "$5.50", "$16.50"],
["Rubber Duck", "Good bathtub companion", 8, "$4.20", "$33.60"],
["Rubber Band", "", 10, "$0.10", "$1.00"],
["Rubber Stamp", "", 3, "$12.30", "$36.90"],
["Rubber Shoe", "For slipping, not for running", 1, "$20.00", "$20.00"]
];
// foreach ($items as $i) { $quotr->add("items", $i); }
// (B5) ITEMS - OR SET ALL AT ONCE
$quotr->set("items", $items);
// (B6) TOTALS
$quotr->set("totals", [
["SUB-TOTAL", "$108.00"],
["TAX 10%", "$10.80"],
["GRAND TOTAL", "$118.80"]
]);
// (B7) NOTES, IF ANY
$quotr->set("notes", [
"This quotation is not an invoice and it is non-contractual.",
"YOUR TERMS AND CONDITIONS HERE."
]);
// (B8) INCLUDE SIGN-OFF ACCEPTANCE
$quotr->set("accept", true);
// (C) OUTPUT
// (C1) CHOOSE A TEMPLATE
$quotr->template("apple");
// $quotr->template("banana");
// $quotr->template("blueberry");
// $quotr->template("lime");
// $quotr->template("simple");
// $quotr->template("strawberry");
// (C2) OUTPUT IN HTML
// 1 : DISPLAY IN BROWSER (DEFAULT)
// 2 : FORCE DOWNLOAD
// 3 : SAVE ON SERVER
// 4 : DISPLAY IN BROWSER & SAVE AS PNG
$quotr->outputHTML();
// $quotr->outputHTML(1);
// $quotr->outputHTML(2, "QUOTATION.html");
// $quotr->outputHTML(3, __DIR__ . DIRECTORY_SEPARATOR . "QUOTATION.html");
// $quotr->outputHTML(4, "QUOTATION.png");
// (C3) OUTPUT IN PDF
// 1 : DISPLAY IN BROWSER (DEFAULT)
// 2 : FORCE DOWNLOAD
// 3 : SAVE ON SERVER
// $quotr->outputPDF();
// $quotr->outputPDF(1);
// $quotr->outputPDF(2, "QUOTATION.pdf");
// $quotr->outputPDF(3, __DIR__ . DIRECTORY_SEPARATOR . "QUOTATION.pdf");
// (C4) OUTPUT IN DOCX
// 1 : FORCE DOWNLOAD (DEFAULT)
// 2 : SAVE ON SERVER
// $quotr->outputDOCX();
// $quotr->outputDOCX(1, "QUOTATION.docx");
// $quotr->outputDOCX(2, __DIR__ . DIRECTORY_SEPARATOR . "QUOTATION.docx");
// (D) USE RESET() IF YOU WANT TO CREATE ANOTHER ONE AFFTER THIS
// $quotr->reset();