|
From: <te...@us...> - 2015-09-28 00:57:27
|
Revision: 7360
http://sourceforge.net/p/web-erp/reponame/7360
Author: tehonu
Date: 2015-09-28 00:57:25 +0000 (Mon, 28 Sep 2015)
Log Message:
-----------
Several fixes and add of logo (not labels can print company logo image)
Modified Paths:
--------------
trunk/Labels.php
trunk/PDFPrintLabel.php
Modified: trunk/Labels.php
===================================================================
--- trunk/Labels.php 2015-09-23 13:53:26 UTC (rev 7359)
+++ trunk/Labels.php 2015-09-28 00:57:25 UTC (rev 7360)
@@ -6,7 +6,7 @@
$Title = _('Label Templates');
include('includes/header.inc');
-//define PaperSize array sizes in pdf points
+//define PaperSize array sizes in mm
$PaperSize = array();
$PaperSize['A4']['PageHeight'] = 297;
$PaperSize['A4']['PageWidth'] = 210;
@@ -114,7 +114,7 @@
echo '<p class="page_title_text">
<img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Label Template Maintenance')
- . '" alt="" />' . $Title . ' - ' . _('all measurements in PDF points') .
+ . '" alt="" />' . $Title . ' - ' . _('all measurements in mm.') .
'</p>';
if (!function_exists('gd_info')) {
@@ -591,6 +591,11 @@
} else {
echo '<option value="price">' . _('Price') . '</option>';
}
+ if ($myrow['fieldvalue']=='logo'){
+ echo '<option selected="selected" value="logo">' . _('Company Logo') . '</option>';
+ } else {
+ echo '<option value="logo">' . _('Company Logo') . '</option>';
+ }
echo '</select></td>
<td><input type="text" name="VPos' . $i . '" size="4" maxlength="4" value="' . $myrow['vpos'] . '" /></td>
<td><input type="text" name="HPos' . $i . '" size="4" maxlength="4" value="' . $myrow['hpos'] . '" /></td>
@@ -620,6 +625,7 @@
<option value="itemdescription">' . _('Item Descrption') . '</option>
<option value="barcode">' . _('Item Barcode') . '</option>
<option value="price">' . _('Price') . '</option>
+ <option value="logo">' . _('Company Logo') . '</option>
</select></td>
<td><input type="text" size="4" maxlength="4" name="VPos" /></td>
<td><input type="text" size="4" maxlength="4" name="HPos" /></td>
Modified: trunk/PDFPrintLabel.php
===================================================================
--- trunk/PDFPrintLabel.php 2015-09-23 13:53:26 UTC (rev 7359)
+++ trunk/PDFPrintLabel.php 2015-09-28 00:57:25 UTC (rev 7360)
@@ -4,13 +4,11 @@
include('includes/session.inc');
include('includes/barcodepack/class.code128.php');
-$PtsPerMM = 2.83465; //pdf points per mm
+$PtsPerMM = 2.83464567; //pdf points per mm (72 dpi / 25.4 mm per inch)
if ((isset($_POST['ShowLabels']) OR isset($_POST['SelectAll']))
- AND isset($_POST['FromCriteria'])
- AND mb_strlen($_POST['FromCriteria'])>=1
- AND isset($_POST['ToCriteria'])
- AND mb_strlen($_POST['ToCriteria'])>=1){
+ AND isset($_POST['StockCategory'])
+ AND mb_strlen($_POST['StockCategory'])>=1){
$Title = _('Print Labels');
include('includes/header.inc');
@@ -26,8 +24,7 @@
ON stockmaster.stockid=prices.stockid
INNER JOIN currencies
ON prices.currabrev=currencies.currabrev
- WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "'
- AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "'
+ WHERE stockmaster.categoryid = '" . $_POST['StockCategory'] . "'
AND prices.typeabbrev='" . $_POST['SalesType'] . "'
AND prices.currabrev='" . $_POST['Currency'] . "'
AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "'
@@ -98,8 +95,7 @@
echo '</table>
<input type="hidden" name="NoOfLabels" value="' . $i . '" />
<input type="hidden" name="LabelID" value="' . $_POST['LabelID'] . '" />
- <input type="hidden" name="FromCriteria" value="' . $_POST['FromCriteria'] . '" />
- <input type="hidden" name="ToCriteria" value="' . $_POST['ToCriteria'] . '" />
+ <input type="hidden" name="StockCategory" value="' . $_POST['StockCategory'] . '" />
<input type="hidden" name="SalesType" value="' . $_POST['SalesType'] . '" />
<input type="hidden" name="Currency" value="' . $_POST['Currency'] . '" />
<input type="hidden" name="EffectiveDate" value="' . $_POST['EffectiveDate'] . '" />
@@ -199,9 +195,8 @@
$NoOfLabels--;
foreach ($LabelFields as $Field){
//print_r($Field);
-
if ($Field['FieldValue']== 'price'){
- $Value = $_POST['Price' . $i];
+ $Value = $_POST['Price' . $i] . ' '. $_POST['Currency'];
} elseif ($Field['FieldValue']== 'stockid'){
$Value = $_POST['StockID' . $i];
} elseif ($Field['FieldValue']== 'description'){
@@ -210,8 +205,12 @@
$Value = $_POST['Barcode' . $i];
}
if ($Field['FieldValue'] == 'price'){ //need to format for the number of decimal places
- $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$_POST['Price' . $i],'center');
- } elseif($Field['Barcode']==1) {
+// $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$_POST['Price' . $i],'center');
+ $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$Value);
+ }elseif ($Field['FieldValue'] == 'logo'){
+ $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],'', $Field['FontSize']);
+
+ }elseif($Field['Barcode']==1) {
$BarcodeImage = new code128(str_replace('_','',$Value));
@@ -223,7 +222,7 @@
$pdf->addJpegFromFile('@' . $Image_String,$XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],'', $Field['FontSize']);
} else {
- $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos']-20,$Field['FontSize'],$Value);
+ $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$Value);
}
} // end loop through label fields
if ($NoOfLabels>0) {
@@ -273,9 +272,9 @@
}
- if (!isset($_POST['FromCriteria']) OR !isset($_POST['ToCriteria'])) {
+ if (!isset($_POST['StockCategory'])) {
- /*if $FromCriteria is not set then show a form to allow input */
+ /*if $StockCategory is not set then show a form to allow input */
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
@@ -291,26 +290,15 @@
echo '</select></td>
</tr>
<tr>
- <td>' . _('From Inventory Category Code') .':</td>
- <td><select name="FromCriteria">';
+ <td>' . _('For Stock Category') .':</td>
+ <td><select name="StockCategory">';
- $CatResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid");
+ $CatResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription");
while ($myrow = DB_fetch_array($CatResult)){
- echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>';
+ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
}
echo '</select></td></tr>';
- echo '<tr><td>' . _('To Inventory Category Code'). ':</td>
- <td><select name="ToCriteria">';
-
- /*Set the index for the categories result set back to 0 */
- DB_data_seek($CatResult,0);
-
- While ($myrow = DB_fetch_array($CatResult)){
- echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>';
- }
- echo '</select></td></tr>';
-
echo '<tr><td>' . _('For Sales Type/Price List').':</td>
<td><select name="SalesType">';
$sql = "SELECT sales_type, typeabbrev FROM salestypes";
|