forked from webERP-team/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PDFReceipt.php
124 lines (94 loc) · 4.77 KB
/
PDFReceipt.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
include('includes/session.php');
include('includes/PDFStarter.php');
$FontSize=10;
$pdf->addInfo('Title', _('Sales Receipt') );
$PageNumber=1;
$line_height=12;
if ($PageNumber>1){
$pdf->newPage();
}
$FontSize=10;
$YPos= $Page_Height-$Top_Margin;
$XPos=0;
/* Prints company logo */
$pdf->addJpegFromFile($_SESSION['LogoFile'], $XPos+20, $YPos-50, 0, 60);
/* Prints company info */
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*6),300,$FontSize,$_SESSION['CompanyRecord']['coyname']);
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*7),300,$FontSize,$_SESSION['CompanyRecord']['regoffice1']);
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*8),300,$FontSize,$_SESSION['CompanyRecord']['regoffice2']);
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*9),300,$FontSize,$_SESSION['CompanyRecord']['regoffice3']);
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*10),300,$FontSize,$_SESSION['CompanyRecord']['regoffice4']);
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*11),300,$FontSize,$_SESSION['CompanyRecord']['regoffice5']);
$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*12),300,$FontSize,$_SESSION['CompanyRecord']['regoffice6']);
$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-180,$YPos-($line_height*3),550,$FontSize, _('Customer Receipt Number ').' : ' . $_GET['BatchNumber'] .'/'.$_GET['ReceiptNumber'] );
$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-180,$YPos-($line_height*4.5),140,$FontSize, _('Printed').': ' . Date($_SESSION['DefaultDateFormat']) . ' '. _('Page'). ' ' . $PageNumber);
$YPos -= 150;
$YPos -=$line_height;
//Note, this is ok for multilang as this is the value of a Select, text in option is different
$YPos -=(2*$line_height);
/*Draw a rectangle to put the headings in */
$pdf->line($Left_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height);
$FontSize=10;
$YPos -= (1.5 * $line_height);
$PageNumber++;
$sql="SELECT MIN(id) as start FROM debtortrans WHERE type=12 AND transno='". $_GET['BatchNumber']. "'";
$result=DB_query($sql);
$myrow=DB_fetch_array($result);
$StartReceiptNumber=$myrow['start'];
$sql="SELECT debtorno,
ovamount,
invtext
FROM debtortrans
WHERE type=12
AND transno='" . $_GET['BatchNumber'] . "'
AND id='". ($StartReceiptNumber-1+$_GET['ReceiptNumber']) ."'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result);
$DebtorNo = $myrow['debtorno'];
$Amount = $myrow['ovamount'];
$Narrative = $myrow['invtext'];
$sql = "SELECT currabrev,
decimalplaces
FROM currencies
WHERE currabrev=(SELECT currcode
FROM banktrans
WHERE type=12
AND transno='" . $_GET['BatchNumber']."')";
$result=DB_query($sql);
$myrow=DB_fetch_array($result);
$CurrencyCode=$myrow['currabrev'];
$DecimalPlaces=$myrow['decimalplaces'];
$sql="SELECT name,
address1,
address2,
address3,
address4,
address5,
address6
FROM debtorsmaster
WHERE debtorno='".$DebtorNo."'";
$result=DB_query($sql);
$myrow=DB_fetch_array($result);
/* Prints customer info */
$LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,_('Received From').' :');
$LeftOvers = $pdf->addTextWrap(150,$YPos,300,$FontSize, htmlspecialchars_decode($myrow['name']));
$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*1),300,$FontSize, htmlspecialchars_decode($myrow['address1']));
$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*2),300,$FontSize, htmlspecialchars_decode($myrow['address2']));
$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*3),300,$FontSize, htmlspecialchars_decode($myrow['address3']));
$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*4),300,$FontSize, htmlspecialchars_decode($myrow['address4']));
$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*5),300,$FontSize, htmlspecialchars_decode($myrow['address5']));
$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*6),300,$FontSize, htmlspecialchars_decode($myrow['address6']));
$YPos=$YPos-($line_height*8);
$LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize, _('The Sum Of').' :');
include('includes/CurrenciesArray.php'); // To get the currency name from the currency code.
$LeftOvers = $pdf->addTextWrap(150,$YPos,300,$FontSize, locale_number_format(-$Amount,$DecimalPlaces).' '. $CurrencyCode . '-' . $CurrencyName[$CurrencyCode]);
$YPos=$YPos-($line_height*2);
$LeftOvers = $pdf->addTextWrap(50,$YPos,500,$FontSize, _('Details').' :');
$LeftOvers = $pdf->addTextWrap(150,$YPos,500,$FontSize, $Narrative);
$YPos=$YPos-($line_height*8);
$LeftOvers = $pdf->addTextWrap(50,$YPos,500,$FontSize,_('Signed On Behalf Of').' : '.$_SESSION['CompanyRecord']['coyname']);
$YPos=$YPos-($line_height*10);
$LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,'______________________________________________________________________________');
$pdf->Output('Receipt-'.$_GET['ReceiptNumber'], 'I');
?>