forked from webERP-team/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PDFStockLocTransfer.php
116 lines (96 loc) · 4.39 KB
/
PDFStockLocTransfer.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
<?php
include('includes/session.php');
$Title = _('Stock Location Transfer Docket Error');
include('includes/PDFStarter.php');
if (isset($_POST['TransferNo'])) {
$_GET['TransferNo']=$_POST['TransferNo'];
}
if (!isset($_GET['TransferNo'])){
include ('includes/header.php');
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Search') .
'" alt="" />' . ' ' . _('Reprint transfer docket') . '</p><br />';
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table>
<tr>
<td>' . _('Transfer docket to reprint') . '</td>
<td><input type="text" class="number" size="10" name="TransferNo" /></td>
</tr>
</table>';
echo '<br />
<div class="centre">
<input type="submit" name="Print" value="' . _('Print') .'" />
</div>';
echo '</div>
</form>';
echo '<form method="post" action="' . $RootPath . '/PDFShipLabel.php">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<input type="hidden" name="Type" value="Transfer" />';
echo '<table>
<tr>
<td>' . _('Transfer docket to reprint Shipping Labels') . '</td>
<td><input type="text" class="number" size="10" name="ORD" /></td>
</tr>
</table>';
echo '<br />
<div class="centre">
<input type="submit" name="Print" value="' . _('Print Shipping Labels') .'" />
</div>';
echo '</div>
</form>';
include ('includes/footer.php');
exit;
}
$pdf->addInfo('Title', _('Inventory Location Transfer BOL') );
$pdf->addInfo('Subject', _('Inventory Location Transfer BOL') . ' # ' . $_GET['TransferNo']);
$FontSize=10;
$PageNumber=1;
$line_height=30;
$ErrMsg = _('An error occurred retrieving the items on the transfer'). '.' . '<p>' . _('This page must be called with a location transfer reference number').'.';
$DbgMsg = _('The SQL that failed while retrieving the items on the transfer was');
$sql = "SELECT loctransfers.reference,
loctransfers.stockid,
stockmaster.description,
loctransfers.shipqty,
loctransfers.recqty,
loctransfers.shipdate,
loctransfers.shiploc,
locations.locationname as shiplocname,
loctransfers.recloc,
locationsrec.locationname as reclocname,
stockmaster.decimalplaces
FROM loctransfers
INNER JOIN stockmaster ON loctransfers.stockid=stockmaster.stockid
INNER JOIN locations ON loctransfers.shiploc=locations.loccode
INNER JOIN locations AS locationsrec ON loctransfers.recloc = locationsrec.loccode
INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1
INNER JOIN locationusers as locationusersrec ON locationusersrec.loccode=locationsrec.loccode AND locationusersrec.userid='" . $_SESSION['UserID'] . "' AND locationusersrec.canview=1
WHERE loctransfers.reference='" . $_GET['TransferNo'] . "'";
$result = DB_query($sql, $ErrMsg, $DbgMsg);
If (DB_num_rows($result)==0){
include ('includes/header.php');
prnMsg(_('The transfer reference selected does not appear to be set up') . ' - ' . _('enter the items to be transferred first'),'error');
include ('includes/footer.php');
exit;
}
$TransferRow = DB_fetch_array($result);
include ('includes/PDFStockLocTransferHeader.inc');
$line_height=30;
$FontSize=10;
do {
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 100, $FontSize, $TransferRow['stockid'], 'left');
$LeftOvers = $pdf->addTextWrap($Left_Margin+100, $YPos, 250, $FontSize, $TransferRow['description'], 'left');
$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-100-100, $YPos, 100, $FontSize, locale_number_format($TransferRow['shipqty'],$TransferRow['decimalplaces']), 'right');
$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-100, $YPos, 100, $FontSize, locale_number_format($TransferRow['recqty'],$TransferRow['decimalplaces']), 'right');
$pdf->line($Left_Margin, $YPos-2,$Page_Width-$Right_Margin, $YPos-2);
$YPos -= $line_height;
if ($YPos < $Bottom_Margin + $line_height) {
$PageNumber++;
include('includes/PDFStockLocTransferHeader.inc');
}
} while ($TransferRow = DB_fetch_array($result));
$pdf->OutputD($_SESSION['DatabaseName'] . '_StockLocTrfShipment_' . date('Y-m-d') . '.pdf');
$pdf->__destruct();
?>