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($right, $iline2 ,$right, $iline4);
63 $this->LineTo($this->leftMargin, $iline5 ,$this->leftMargin, $iline7);
64 if ($this->l['a_meta_dir'] == 'rtl') // avoid line overwrite in rtl language
65 $this->LineTo($this->cols[$cols - 2], $iline5 ,$this->cols[$cols - 2], $iline7);
67 $this->LineTo($this->cols[$cols - 2] + 4, $iline5 ,$this->cols[$cols - 2] + 4, $iline7);
68 $this->LineTo($right, $iline5 ,$right, $iline7);
72 $logo = company_path() . "/images/" . $this->company['coy_logo'];
73 if ($this->company['coy_logo'] != '' && file_exists($logo))
75 $this->AddImage($logo, $ccol, $this->row, 0, 40);
81 $this->Text($ccol, $this->company['coy_name'], $icol);
86 $this->SetTextColor(190, 190, 190);
87 $this->fontSize += 10;
89 $this->TextWrap($mcol, $this->row, $this->pageWidth - $this->rightMargin - $mcol - 20, $this->title, 'right');
91 $this->fontSize -= 10;
93 $this->SetTextColor(0, 0, 0);
94 $adrline = $this->row;
97 $this->TextWrapLines($ccol, $icol, $this->company['postal_address']);
98 $this->Font('italic');
99 if (@$this->company['phone'])
101 $this->Text($ccol, _("Phone"), $c2col);
102 $this->Text($c2col, $this->company['phone'], $mcol);
105 if (@$this->company['fax'])
107 $this->Text($ccol, _("Fax"), $c2col);
108 $this->Text($c2col, $this->company['fax'], $mcol);
111 if (@$this->company['email'])
113 $this->Text($ccol, _("Email"), $c2col);
115 $url = "mailto:" . $this->company['email'];
116 $this->SetTextColor(0, 0, 255);
117 $this->Text($c2col, $this->company['email'], $mcol);
118 $this->SetTextColor(0, 0, 0);
119 $this->addLink($url, $c2col, $this->row, $mcol, $this->row + $this->lineHeight);
123 if (@$this->company['gst_no'])
125 $this->Text($ccol, _("Our VAT No."), $c2col);
126 $this->Text($c2col, $this->company['gst_no'], $mcol);
129 if (@$this->formData['domicile'])
131 $this->Text($ccol, _("Domicile"), $c2col);
132 $this->Text($c2col, $this->company['domicile'], $mcol);
136 $this->row = $adrline;
138 $this->Text($mcol + 100, _("Date"));
139 $this->Text($mcol + 180, sql2date($this->formData['document_date']));
142 $this->Text($mcol + 100, $this->formData['document_name']);
143 $this->Text($mcol + 180, $this->formData['document_number']);
146 if ($this->pageNumber > 1)
147 $this->Text($mcol + 180, _("Page") . ' ' . $this->pageNumber);
148 $this->row = $iline1 - $this->lineHeight;
149 $this->fontSize -= 4;
150 $this->Text($ccol, $Addr1['title'], $icol);
151 $this->Text($mcol, $Addr2['title']);
152 $this->fontSize += 4;
155 $temp = $this->row = $this->row - $this->lineHeight - 5;
156 $this->Text($ccol, $Addr1['name'], $icol);
158 $this->TextWrapLines($ccol, $icol - $ccol, $Addr1['address']);
162 $this->Text($mcol, $Addr2['name']);
164 $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $Addr2['address']);
166 // Auxiliary document information
167 $col = $this->leftMargin;
168 foreach($aux_info as $info_header => $info_content)
171 $this->row = $iline2 - $this->lineHeight - 1;
172 $this->TextWrap($col, $this->row, $width, $info_header, 'C');
173 $this->row = $iline3 - $this->lineHeight - 1;
174 $this->TextWrap($col, $this->row, $width, $info_content, 'C');
178 $this->row -= (2 * $this->lineHeight);
179 $this->Font('italic');
180 $this->TextWrap($ccol, $this->row, $right-$ccol, $Payment_Terms);
184 $this->row = $iline5 - $this->lineHeight - 1;
186 $count = count($this->headers);
187 $this->cols[$count] = $right - 3;
188 for ($i = 0; $i < $count; $i++)
189 $this->TextCol($i, $i + 1, $this->headers[$i], -2);
193 $this->Font('italic');
194 $this->row = $iline7 - $this->lineHeight - 6;
196 foreach ($Footer as $line => $txt)
198 if (!is_numeric($line)) // title => link
200 $this->fontSize -= 2;
201 $this->TextWrap($ccol, $this->row, $right - $ccol, $line, 'C');
202 $this->row -= $this->lineHeight;
203 $this->SetTextColor(0, 0, 255);
204 $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C');
205 $this->SetTextColor(0, 0, 0);
206 $this->addLink($txt, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row + $this->lineHeight);
207 $this->fontSize += 2;
210 $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C');
211 $this->row -= $this->lineHeight;
216 $temp = $iline6 - $this->lineHeight - 2;