2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
14 Document blueprint use following parameters set in doctext.inc:
16 $Addr1, $Addr2 - address info
17 $Payment_Terms - payment terms line
18 $Footer - footer texts
19 $this->company - company info
20 $this->title - report title
21 $this->formData - some other info
24 $this->row = $this->pageHeight - $this->topMargin;
26 $upper = $this->row - 2 * $this->lineHeight;
27 $lower = $this->bottomMargin + 8 * $this->lineHeight;
28 $iline1 = $upper - 7.5 * $this->lineHeight;
29 $iline2 = $iline1 - 8 * $this->lineHeight;
30 $iline3 = $iline2 - 1.5 * $this->lineHeight;
31 $iline4 = $iline3 - 1.5 * $this->lineHeight;
32 $iline5 = $iline4 - 3 * $this->lineHeight;
33 $iline6 = $iline5 - 1.5 * $this->lineHeight;
35 $right = $this->pageWidth - $this->rightMargin;
36 $width = ($right - $this->leftMargin) / 5;
37 $icol = $this->pageWidth / 2;
38 $ccol = $this->cols[0] + 4;
42 $mcol2 = $this->pageWidth - $ccol2;
43 $cols = count($this->cols);
44 $this->SetDrawColor(205, 205, 205);
45 $this->Line($iline1, 3);
46 $this->SetDrawColor(128, 128, 128);
48 $this->rectangle($this->leftMargin, $iline2, $right - $this->leftMargin, $iline2 - $iline3, "F", null, array(222, 231, 236));
52 $this->rectangle($this->leftMargin, $iline5, $right - $this->leftMargin, $iline5 - $iline6, "F", null, array(222, 231, 236));
56 $this->LineTo($this->leftMargin, $iline2 ,$this->leftMargin, $iline4);
57 $col = $this->leftMargin;
58 for ($i = 0; $i < 5; $i++)
60 $this->LineTo($col += $width, $iline2,$col, $iline4);
62 $this->LineTo($this->leftMargin, $iline5 ,$this->leftMargin, $iline7);
63 if ($this->l['a_meta_dir'] == 'rtl') // avoid line overwrite in rtl language
64 $this->LineTo($this->cols[$cols - 2], $iline5 ,$this->cols[$cols - 2], $iline7);
66 $this->LineTo($this->cols[$cols - 2] + 4, $iline5 ,$this->cols[$cols - 2] + 4, $iline7);
67 $this->LineTo($right, $iline5 ,$right, $iline7);
70 $logo = company_path() . "/images/" . $this->company['coy_logo'];
71 if ($this->company['coy_logo'] != '' && file_exists($logo))
74 $this->AddImage($logo, $ccol, $this->row, 0, 40);
79 $this->Text($ccol, $this->company['coy_name'], $icol);
83 $this->SetTextColor(190, 190, 190);
84 $this->fontSize += 10;
86 $this->TextWrap($mcol, $this->row, $this->pageWidth - $this->rightMargin - $mcol - 20, $this->title, 'right');
88 $this->fontSize -= 10;
90 $this->SetTextColor(0, 0, 0);
91 $adrline = $this->row;
94 $this->TextWrapLines($ccol, $icol, $this->company['postal_address']);
95 $this->Font('italic');
96 if (@$this->company['phone'])
98 $this->Text($ccol, _("Phone"), $c2col);
99 $this->Text($c2col, $this->company['phone'], $mcol);
102 if (@$this->company['fax'])
104 $this->Text($ccol, _("Fax"), $c2col);
105 $this->Text($c2col, $this->company['fax'], $mcol);
108 if (@$this->company['email'])
110 $this->Text($ccol, _("Email"), $c2col);
112 $url = "mailto:" . $this->company['email'];
113 $this->SetTextColor(0, 0, 255);
114 $this->Text($c2col, $this->company['email'], $mcol);
115 $this->SetTextColor(0, 0, 0);
116 $this->addLink($url, $c2col, $this->row, $mcol, $this->row + $this->lineHeight);
120 if (@$this->company['gst_no'])
122 $this->Text($ccol, _("Our VAT No."), $c2col);
123 $this->Text($c2col, $this->company['gst_no'], $mcol);
126 if (@$this->formData['domicile'])
128 $this->Text($ccol, _("Domicile"), $c2col);
129 $this->Text($c2col, $this->company['domicile'], $mcol);
133 $this->row = $adrline;
135 $this->Text($mcol + 100, _("Date"));
136 $this->Text($mcol + 180, sql2date($this->formData['document_date']));
139 $this->Text($mcol + 100, $this->formData['document_name']);
140 $this->Text($mcol + 180, $this->formData['document_number']);
143 if ($this->pageNumber > 1)
144 $this->Text($mcol + 180, _("Page") . ' ' . $this->pageNumber);
145 $this->row = $iline1 - $this->lineHeight;
146 $this->fontSize -= 4;
147 $this->Text($ccol, $Addr1['title'], $icol);
148 $this->Text($mcol, $Addr2['title']);
149 $this->fontSize += 4;
152 $temp = $this->row = $this->row - $this->lineHeight - 5;
153 $this->Text($ccol, $Addr1['name'], $icol);
155 $this->TextWrapLines($ccol, $icol - $ccol, $Addr1['address']);
159 $this->Text($mcol, $Addr2['name']);
161 $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $Addr2['address'], 'left', 0, 0, NULL, 1);
163 // Auxiliary document information
164 $col = $this->leftMargin;
165 foreach($aux_info as $info_header => $info_content)
168 $this->row = $iline2 - $this->lineHeight - 1;
169 $this->TextWrap($col, $this->row, $width, $info_header, 'C');
170 $this->row = $iline3 - $this->lineHeight - 1;
171 $this->TextWrap($col, $this->row, $width, $info_content, 'C');
175 $this->row -= (2 * $this->lineHeight);
176 $this->Font('italic');
177 $this->TextWrap($ccol, $this->row, $right-$ccol, $Payment_Terms);
181 $this->row = $iline5 - $this->lineHeight - 1;
183 $count = count($this->headers);
184 $this->cols[$count] = $right - 3;
185 for ($i = 0; $i < $count; $i++)
186 $this->TextCol($i, $i + 1, $this->headers[$i], -2);
190 $this->Font('italic');
191 $this->row = $iline7 - $this->lineHeight - 6;
193 foreach ($Footer as $line => $txt)
195 if (!is_numeric($line)) // title => link
197 $this->fontSize -= 2;
198 $this->TextWrap($ccol, $this->row, $right - $ccol, $line, 'C');
199 $this->row -= $this->lineHeight;
200 $this->SetTextColor(0, 0, 255);
201 $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C');
202 $this->SetTextColor(0, 0, 0);
203 $this->addLink($txt, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row + $this->lineHeight);
204 $this->fontSize += 2;
207 $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C');
208 $this->row -= $this->lineHeight;
213 $temp = $iline6 - $this->lineHeight - 2;