|
From: <dai...@us...> - 2012-05-05 05:04:12
|
Revision: 5316
http://web-erp.svn.sourceforge.net/web-erp/?rev=5316&view=rev
Author: daintree
Date: 2012-05-05 05:04:04 +0000 (Sat, 05 May 2012)
Log Message:
-----------
factor in Ricards review to label code
Modified Paths:
--------------
trunk/CustomerTypes.php
trunk/InventoryPlanning.php
trunk/Labels.php
trunk/PDFPrintLabel.php
trunk/SelectOrderItems.php
trunk/doc/Change.log
trunk/includes/DateFunctions.inc
trunk/includes/PDFStarter.php
trunk/includes/footer.inc
trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po
trunk/sql/mysql/upgrade4.07-4.08.sql
Modified: trunk/CustomerTypes.php
===================================================================
--- trunk/CustomerTypes.php 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/CustomerTypes.php 2012-05-05 05:04:04 UTC (rev 5316)
@@ -156,13 +156,17 @@
if ($myrow[0]>0) {
prnMsg (_('Cannot delete this type because customers are currently set up to use this type') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('customers with this type code'));
} else {
-
- $sql="DELETE FROM debtortype WHERE typeid='".$SelectedType."'";
- $ErrMsg = _('The Type record could not be deleted because');
- $result = DB_query($sql,$db,$ErrMsg);
- echo '<br />';
- prnMsg(_('Customer type') . $SelectedType . ' ' . _('has been deleted') ,'success');
-
+ $result = DB_query("SELECT typename FROM debtortype WHERE typeid='".$SelectedType."'",$db);
+ if (DB_Num_Rows($result)>0){
+ $TypeRow = DB_fetch_array($result);
+ $TypeName = $TypeRow['typename'];
+
+ $sql="DELETE FROM debtortype WHERE typeid='".$SelectedType."'";
+ $ErrMsg = _('The Type record could not be deleted because');
+ $result = DB_query($sql,$db,$ErrMsg);
+ echo '<br />';
+ prnMsg(_('Customer type') . ' ' . $TypeName . ' ' . _('has been deleted') ,'success');
+ }
unset ($SelectedType);
unset($_GET['delete']);
Modified: trunk/InventoryPlanning.php
===================================================================
--- trunk/InventoryPlanning.php 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/InventoryPlanning.php 2012-05-05 05:04:04 UTC (rev 5316)
@@ -105,12 +105,12 @@
include('includes/footer.inc');
exit;
}
- $Period_0_Name = strftime('%b',mktime(0,0,0,Date('m'),Date('d'),Date('Y')));
- $Period_1_Name = strftime('%b',mktime(0,0,0,Date('m')-1,Date('d'),Date('Y')));
- $Period_2_Name = strftime('%b',mktime(0,0,0,Date('m')-2,Date('d'),Date('Y')));
- $Period_3_Name = strftime('%b',mktime(0,0,0,Date('m')-3,Date('d'),Date('Y')));
- $Period_4_Name = strftime('%b',mktime(0,0,0,Date('m')-4,Date('d'),Date('Y')));
- $Period_5_Name = strftime('%b',mktime(0,0,0,Date('m')-5,Date('d'),Date('Y')));
+ $Period_0_Name = GetMonthText(mktime(0,0,0,Date('m'),Date('d'),Date('Y')));
+ $Period_1_Name = GetMonthText(mktime(0,0,0,Date('m')-1,Date('d'),Date('Y')));
+ $Period_2_Name = GetMonthText(mktime(0,0,0,Date('m')-2,Date('d'),Date('Y')));
+ $Period_3_Name = GetMonthText(mktime(0,0,0,Date('m')-3,Date('d'),Date('Y')));
+ $Period_4_Name = GetMonthText(mktime(0,0,0,Date('m')-4,Date('d'),Date('Y')));
+ $Period_5_Name = GetMonthText(mktime(0,0,0,Date('m')-5,Date('d'),Date('Y')));
include ('includes/PDFInventoryPlanPageHeader.inc');
Modified: trunk/Labels.php
===================================================================
--- trunk/Labels.php 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/Labels.php 2012-05-05 05:04:04 UTC (rev 5316)
@@ -7,19 +7,20 @@
include('includes/header.inc');
//define PaperSize array sizes in pdf points
-$PaperSize = array('A4',
- 'A4_Landscape',
- 'A5',
- 'A5_Landscape',
- 'A3',
- 'A3_Landscape',
- 'Letter',
- 'Letter_Landscape',
- 'Legal',
- 'Legal_Landscape',
- '28mm_x_45mm_label');
+$PaperSize = array();
+$PaperSize['A4']['PageHeight'] = 297;
+$PaperSize['A4']['PageWidth'] = 210;
+$PaperSize['A5']['PageHeight'] = 210;
+$PaperSize['A5']['PageWidth'] = 148;
+$PaperSize['A3']['PageHeight'] = 420;
+$PaperSize['A3']['PageWidth'] = 297;
+$PaperSize['Letter']['PageHeight'] = 279.4;
+$PaperSize['Letter']['PageWidth'] = 215.9;
+$PaperSize['Legal']['PageHeight'] = 355.6;
+$PaperSize['Legal']['PageWidth'] = 215.9;
+
echo '<p class="page_title_text">
<img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Label Template Maintenance')
. '" alt="" />' . $title. '
@@ -39,11 +40,11 @@
vpos='" . $_POST['VPos' . $i] . "',
hpos='" . $_POST['HPos' . $i] . "',
fontsize='" . $_POST['FontSize' . $i] . "',
- barcode='" . $_POST['Barcode' . $i] . "'
+ barcode='" . $_POST['Barcode' . $i] . "'
WHERE labelfieldid='" . $_POST['LabelFieldID' . $i] . "'",
$db);
} else {
- prnMsg (_('Entries for Vertical Position Horizonal Position and Font Size must be integers.'),'error');
+ prnMsg (_('Entries for Vertical Position, Horizonal Position and Font Size must be integers.'),'error');
}
}
}
@@ -79,20 +80,30 @@
prnMsg( _('The label description may not be empty'), 'error');
}
$Message = '';
+
+ if (isset($_POST['PaperSize']) AND $_POST['PaperSize']!='custom'){
+ $_POST['PageWidth'] = $PaperSize[$_POST['PaperSize']]['PageWidth'];
+ $_POST['PageHeight'] = $PaperSize[$_POST['PaperSize']]['PageHeight'];
+ } elseif ($_POST['PaperSize']=='custom' AND !isset($_POST['PageWidth'])){
+ $_POST['PageWidth'] = 0;
+ $_POST['PageHeight'] = 0;
+ }
+
if (isset($SelectedLabelID)) {
/*SelectedLabelID could also exist if submit had not been clicked this code
would not run in this case cos submit is false of course see the
delete code below*/
- $sql = "UPDATE labels SET papersize ='" . $_POST['PaperSize'] . "',
- description = '" . $_POST['Description'] . "',
+ $sql = "UPDATE labels SET description = '" . $_POST['Description'] . "',
height = '" . $_POST['Height'] . "',
topmargin = '". $_POST['TopMargin'] . "',
width = '". $_POST['Width'] . "',
leftmargin = '". $_POST['LeftMargin'] . "',
rowheight = '". $_POST['RowHeight'] . "',
- columnwidth = '". $_POST['ColumnWidth'] . "'
+ columnwidth = '". $_POST['ColumnWidth'] . "',
+ pagewidth = '" . $_POST['PageWidth'] . "',
+ pageheight = '" . $_POST['PageHeight'] . "'
WHERE labelid = '" . $SelectedLabelID . "'";
$ErrMsg = _('The update of this label template failed because');
@@ -104,22 +115,24 @@
/*Selected label is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new label form */
- $sql = "INSERT INTO labels (papersize,
- description,
+ $sql = "INSERT INTO labels (description,
height,
topmargin,
width,
leftmargin,
rowheight,
- columnwidth)
- VALUES ('" . $_POST['PaperSize'] . "',
- '" . $_POST['Description'] . "',
+ columnwidth,
+ pagewidth,
+ pageheight)
+ VALUES ('" . $_POST['Description'] . "',
'" . $_POST['Height'] . "',
'" . $_POST['TopMargin'] . "',
'" . $_POST['Width'] . "',
'" . $_POST['LeftMargin'] . "',
'" . $_POST['RowHeight'] . "',
- '" . $_POST['ColumnWidth'] . "')";
+ '" . $_POST['ColumnWidth'] . "',
+ '" . $_POST['PageWidth'] . "',
+ '" . $_POST['PageHeight'] . "')";
$ErrMsg = _('The addition of this label failed because');
$result = DB_query($sql,$db,$ErrMsg);
@@ -135,7 +148,8 @@
unset( $_POST['LeftMargin']);
unset( $_POST['ColumnWidth']);
unset( $_POST['RowHeight']);
-
+ unset($_POST['PageWidth']);
+ unset($_POST['PageHeight']);
}
prnMsg($Message);
@@ -156,7 +170,8 @@
$sql = "SELECT labelid,
description,
- papersize,
+ pagewidth,
+ pageheight,
height,
width,
topmargin,
@@ -173,7 +188,9 @@
echo '<table class="selection">
<tr>
<th>' . _('Description') . '</th>
- <th>' . _('Page Size') . '</th>
+ <th>' . _('Rows x Cols') . '</th>
+ <th>' . _('Page Width') . '</th>
+ <th>' . _('Page Height') . '</th>
<th>' . _('Height') . '</th>
<th>' . _('Width') . '</th>
<th>' . _('Row Height') . '</th>
@@ -189,29 +206,65 @@
echo '<tr class="OddTableRows">';
$k++;
}
-
- printf('<td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td><a href="%sSelectedLabelID=%s">' . _('Edit') . '</a></td>
- <td><a href="%sSelectedLabelID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this label?') . '\');">' . _('Delete') . '</a></td>
- </tr>',
- $myrow['description'],
- $myrow['papersize'],
- $myrow['height'],
- $myrow['width'],
- $myrow['rowheight'],
- $myrow['columnwidth'],
- htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
- $myrow['labelid'],
- htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
- $myrow['labelid'],
- $rootpath . '/LabelFields.php?',
- $myrow['labelid']);
-
+ $NoOfRows = floor(($myrow['pageheight']-$myrow['topmargin'])/$myrow['rowheight']);
+ $NoOfCols = floor(($myrow['pagewidth']-$myrow['leftmargin'])/$myrow['columnwidth']);
+
+ foreach ($PaperSize as $PaperName=>$PaperType) {
+ if ($PaperType['PageWidth'] == $myrow['pagewidth'] AND $PaperType['PageHeight'] == $myrow['pageheight']) {
+ $Paper = $PaperName;
+ }
+ }
+ if (isset($Paper)){
+ printf('<td>%s</td>
+ <td>%s</td>
+ <td colspan="2">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td><a href="%sSelectedLabelID=%s">' . _('Edit') . '</a></td>
+ <td><a href="%sSelectedLabelID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this label?') . '\');">' . _('Delete') . '</a></td>
+ </tr>',
+ $myrow['description'],
+ $NoOfRows . ' x ' . $NoOfCols,
+ $Paper,
+ $myrow['height'],
+ $myrow['width'],
+ $myrow['rowheight'],
+ $myrow['columnwidth'],
+ htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
+ $myrow['labelid'],
+ htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
+ $myrow['labelid'],
+ $rootpath . '/LabelFields.php?',
+ $myrow['labelid']);
+ } else {
+ printf('<td>%s</td>
+ <td>%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td><a href="%sSelectedLabelID=%s">' . _('Edit') . '</a></td>
+ <td><a href="%sSelectedLabelID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this label?') . '\');">' . _('Delete') . '</a></td>
+ </tr>',
+ $myrow['description'],
+ $NoOfRows . ' x ' . $NoOfCols,
+ $myrow['pagewidth'],
+ $myrow['pageheight'],
+ $myrow['height'],
+ $myrow['width'],
+ $myrow['rowheight'],
+ $myrow['columnwidth'],
+ htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
+ $myrow['labelid'],
+ htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
+ $myrow['labelid'],
+ $rootpath . '/LabelFields.php?',
+ $myrow['labelid']);
+ }
}
//END WHILE LIST LOOP
@@ -233,7 +286,8 @@
if (isset($SelectedLabelID)) {
//editing an existing label
- $sql = "SELECT papersize,
+ $sql = "SELECT pagewidth,
+ pageheight,
description,
height,
width,
@@ -247,7 +301,8 @@
$result = DB_query($sql, $db);
$myrow = DB_fetch_array($result);
- $_POST['PaperSize'] = $myrow['papersize'];
+ $_POST['PageWidth'] = $myrow['pagewidth'];
+ $_POST['PageHeight'] = $myrow['pageheight'];
$_POST['Description'] = $myrow['description'];
$_POST['Height'] = $myrow['height'];
$_POST['TopMargin'] = $myrow['topmargin'];
@@ -255,6 +310,12 @@
$_POST['LeftMargin'] = $myrow['leftmargin'];
$_POST['RowHeight'] = $myrow['rowheight'];
$_POST['ColumnWidth'] = $myrow['columnwidth'];
+
+ foreach ($PaperSize as $PaperName=>$PaperType) {
+ if ($PaperType['PageWidth'] == $myrow['pagewidth'] AND $PaperType['PageHeight'] == $myrow['pageheight']) {
+ $_POST['PaperSize'] = $PaperName;
+ }
+ }
echo '<input type="hidden" name="SelectedLabelID" value="' . $SelectedLabelID . '" />';
@@ -274,9 +335,14 @@
</tr>
<tr>
<td>' . _('Label Paper Size') . ':</td>
- <td><select name="PaperSize">';
+ <td><select name="PaperSize" onchange="ReloadForm(submit)" >';
-foreach($PaperSize as $PaperType) {
+if (!isset($_POST['PaperSize'])){
+ echo '<option selected="selected" value="custom">' . _('Custom Size') . '</option>';
+} else {
+ echo '<option value="custom">' . _('Custom Size') . '</option>';
+}
+foreach($PaperSize as $PaperType=>$PaperSizeElement) {
if (isset($_POST['PaperSize']) AND $PaperType==$_POST['PaperSize']) {
echo '<option selected="selected" value="';
} else {
@@ -289,6 +355,13 @@
echo '</select></td>
</tr>';
+
+if (!isset($_POST['PageHeight'])) {
+ $_POST['PageHeight']=0;
+}
+if (!isset($_POST['PageWidth'])) {
+ $_POST['PageWidth']=0;
+}
if (!isset($_POST['Height'])) {
$_POST['Height']=0;
}
@@ -308,6 +381,21 @@
if (!isset($_POST['ColumnWidth'])) {
$_POST['ColumnWidth']=0;
}
+
+if (!isset($_POST['PaperSize']) OR $_POST['PaperSize'] == 'Custom') {
+ if (!isset($_POST['PageWidth'])){
+ $_POST['PageWidth'] = 0;
+ $_POST['PageHeight'] = 0;
+ }
+ echo '<tr>
+ <td>' . _('Page Width') . '</td>
+ <td><input type="text" size="4" maxlength="4" name="PageWidth" value="' . $_POST['PageWidth'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Page Height') . '</td>
+ <td><input type="text" size="4" maxlength="4" name="PageHeight" value="' . $_POST['PageHeight'] . '" /></td>
+ </tr>';
+}
echo '<tr>
<td>' . _('Label Height') . ' - (He):</td>
<td><input type="text" name="Height" size="4" maxlength="4" value="' . $_POST['Height'] . '" /></td>
@@ -375,7 +463,7 @@
}
echo '<input type="hidden" name="LabelFieldID' . $i . '" value="' . $myrow['labelfieldid'] . '" />
- <td><select name="FieldName' . $i . '">';
+ <td><select name="FieldName' . $i . '" onchange="ReloadForm(submit)">';
if ($myrow['fieldvalue']=='itemcode'){
echo '<option selected="selected" value="itemcode">' . _('Item Code') . '</option>';
} else {
@@ -400,7 +488,7 @@
<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>
<td><input type="text" name="FontSize' . $i . '" size="4" maxlength="4" value="' . $myrow['fontsize'] . '" /></td>
- <td><select name="Barcode' . $i . '">';
+ <td><select name="Barcode' . $i . '" onchange="ReloadForm(submit)">';
if ($myrow['barcode']==0){
echo '<option selected="selected" value="0">' . _('No') . '</option>
<option value="1">' . _('Yes') . '</option>';
@@ -445,6 +533,10 @@
<div class="centre">
<input type="submit" name="submit" value="' . _('Enter Information') . '" />
</div>
+ <br />
+ <div class="centre">
+ <a href="' . $rootpath . '/PDFPrintLabel.php">' . _('Print Labels') . '</a>
+ </div>
</form>';
include('includes/footer.inc');
Modified: trunk/PDFPrintLabel.php
===================================================================
--- trunk/PDFPrintLabel.php 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/PDFPrintLabel.php 2012-05-05 05:04:04 UTC (rev 5316)
@@ -6,7 +6,7 @@
$PtsPerMM = 2.83465; //pdf points per mm
-if (isset($_POST['ShowLabels'])
+if ((isset($_POST['ShowLabels']) OR isset($_POST['SelectAll']))
AND isset($_POST['FromCriteria'])
AND mb_strlen($_POST['FromCriteria'])>=1
AND isset($_POST['ToCriteria'])
@@ -65,14 +65,27 @@
<th>' . _('Item Description') . '</th>
<th>' . _('Price') . '</th>
<th>' . _('Print') . ' ?</th>
- </tr>';
+ </tr>
+ <tr><th colspan="4"><input type="submit" name="SelectAll" value="' . _('Select All Labels') . '" /><input type="checkbox" name="CheckAll" ';
+ if (isset($_POST['CheckAll'])){
+ echo 'checked="checked" ';
+ }
+ echo 'onchange="ReloadForm(SelectAll)" /></td>
+ </tr>';
+
$i=0;
while ($LabelRow = DB_fetch_array($LabelsResult)){
echo '<tr>
<td>' . $LabelRow['stockid'] . '</td>
<td>' . $LabelRow['description'] . '</td>
<td class="number">' . locale_number_format($LabelRow['price'],$LabelRow['decimalplaces']) . '</td>
- <td><input type="checkbox" checked="checked" name="PrintLabel' . $i .'" /></td>
+ <td>';
+ if (isset($_POST['SelectAll']) AND isset($_POST['CheckAll'])) {
+ echo '<input type="checkbox" checked="checked" name="PrintLabel' . $i .'" />';
+ } else {
+ echo '<input type="checkbox" name="PrintLabel' . $i .'" />';
+ }
+ echo '</td>
</tr>';
echo '<input type="hidden" name="StockID' . $i . '" value="' . $LabelRow['stockid'] . '" />
<input type="hidden" name="Description' . $i . '" value="' . $LabelRow['description'] . '" />
@@ -84,18 +97,41 @@
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="SalesType" value="' . $_POST['SalesType'] . '" />
+ <input type="hidden" name="Currency" value="' . $_POST['Currency'] . '" />
+ <input type="hidden" name="EffectiveDate" value="' . $_POST['EffectiveDate'] . '" />
<br />
<div class="centre">
+
<input type="submit" name="PrintLabels" value="'. _('Print Labels'). '" />
</div>
+ <br />
+ <div class="centre">
+ <a href="'. $rootpath . '/Labels.php">' . _('Label Template Maintenance'). '</a>
+ </div>
</form>';
exit;
}
if (isset($_POST['PrintLabels'])
- AND isset($_POST['NoOfLabels'])) {
-
- $result = DB_query("SELECT papersize,
- description,
+ AND isset($_POST['NoOfLabels'])
+ AND $_POST['NoOfLabels']>0){
+ $NoOfLabels = 0;
+ for ($i=0;$i < $_POST['NoOfLabels'];$i++){
+ if (isset($_POST['PrintLabel'.$i])){
+ $NoOfLabels++;
+ }
+ }
+ if ($NoOfLabels ==0){
+ prnMsg(_('There are no labels selected to print'),'info');
+ }
+}
+if (isset($_POST['PrintLabels']) AND $NoOfLabels>0) {
+
+ $result = DB_query("SELECT description,
+ pagewidth*" . $PtsPerMM . " as page_width,
+ pageheight*" . $PtsPerMM . " as page_height,
width*" . $PtsPerMM . " as label_width,
height*" . $PtsPerMM . " as label_height,
rowheight*" . $PtsPerMM . " as label_rowheight,
@@ -106,14 +142,7 @@
WHERE labelid='" . $_POST['LabelID'] . "'",
$db);
$LabelDimensions = DB_fetch_array($result);
- $PaperSize = $LabelDimensions['papersize'];
- include('includes/PDFStarter.php');
- $Top_Margin = $LabelDimensions['label_topmargin'];
- $Left_Margin = $LabelDimensions['label_leftmargin'];
-
- $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') );
- $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') );
-
+
$result = DB_query("SELECT fieldvalue,
vpos,
hpos,
@@ -139,6 +168,19 @@
$i++;
}
+ $PaperSize = 'Custom'; // so PDF starter wont default the DocumentPaper
+ $DocumentPaper = array($LabelDimensions['page_width'],$LabelDimensions['page_height']);
+ include('includes/PDFStarter.php');
+ $Top_Margin = $LabelDimensions['label_topmargin'];
+ $Left_Margin = $LabelDimensions['label_leftmargin'];
+ $Page_Height = $LabelDimensions['page_height'];
+ $Page_Width = $LabelDimensions['page_width'];
+ $Right_Margin =0;
+ $Bottom_Margin =0;
+
+ $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') );
+ $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') );
+
$style = array(
'position' => '',
'align' => 'C',
@@ -160,9 +202,9 @@
$YPos = $Page_Height - $Top_Margin; //top of current label
$XPos = $Left_Margin; // left of current label
- for ($i=0;$i <= $_POST['NoOfLabels'];$i++){
+ for ($i=0;$i < $_POST['NoOfLabels'];$i++){
if ($_POST['PrintLabel'.$i]=='on'){
-
+ $NoOfLabels--;
foreach ($LabelFields as $Field){
//print_r($Field);
@@ -183,34 +225,36 @@
* Note that the YPos for this function is based on the opposite origin for the Y axis i.e from the bottom not from the top!
*/
- $pdf->write1DBarcode(str_replace('_','',$Value), 'C128',$XPos+$Field['HPos'],$Page_Height - $YPos+$LabelDimensions['label_height']-$Field['VPos']-$Field['FontSize'],$LabelDimensions['label_width']-$Field['HPos'], $Field['FontSize'], 0.4, $style, 'N');
+ $pdf->write1DBarcode(str_replace('_','',$Value), 'C39',$XPos+$Field['HPos'],$Page_Height - $YPos+$LabelDimensions['label_height']-$Field['VPos']-$Field['FontSize'],$LabelDimensions['label_width']-$Field['HPos'], $Field['FontSize'], 0.4, $style, 'N');
} else {
$LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos']-20,$Field['FontSize'],$Value);
}
} // end loop through label fields
- //setup $YPos and $XPos for the next label
- if (($YPos - $LabelDimensions['label_rowheight']) < $LabelDimensions['label_height']){
- /* not enough space below the above label to print a new label
- * so the above was the last label in the column
- * need to start either a new column or new page
- */
- if (($Page_Width - $XPos - $LabelDimensions['label_columnwidth']) < $LabelDimensions['label_width']) {
- /* Not enough space to start a new column so we are into a new page
+ if ($NoOfLabels>0) {
+ //setup $YPos and $XPos for the next label
+ if (($YPos - $LabelDimensions['label_rowheight']) < $LabelDimensions['label_height']){
+ /* not enough space below the above label to print a new label
+ * so the above was the last label in the column
+ * need to start either a new column or new page
*/
- $pdf->newPage();
- $PageNumber++;
- $YPos = $Page_Height - $Top_Margin; //top of next label
- $XPos = $Left_Margin; // left of next label
+ if (($Page_Width - $XPos - $LabelDimensions['label_columnwidth']) < $LabelDimensions['label_width']) {
+ /* Not enough space to start a new column so we are into a new page
+ */
+ $pdf->newPage();
+ $PageNumber++;
+ $YPos = $Page_Height - $Top_Margin; //top of next label
+ $XPos = $Left_Margin; // left of next label
+ } else {
+ /* There is enough space for another column */
+ $YPos = $Page_Height - $Top_Margin; //back to the top of next label column
+ $XPos += $LabelDimensions['label_columnwidth']; // left of next label
+ }
} else {
- /* There is enough space for another column */
- $YPos = $Page_Height - $Top_Margin; //back to the top of next label column
- $XPos += $LabelDimensions['label_columnwidth']; // left of next label
+ /* There is space below to print a label
+ */
+ $YPos -= $LabelDimensions['label_rowheight']; //Top of next label
}
- } else {
- /* There is space below to print a label
- */
- $YPos -= $LabelDimensions['label_rowheight']; //Top of next label
- }
+ }//end if there is another label to print
} //this label is set to print
} //loop through labels selected to print
@@ -303,6 +347,10 @@
<div class="centre">
<input type="submit" name="ShowLabels" value="'. _('Show Labels'). '" />
</div>
+ <br />
+ <div class="centre">
+ <a href="'. $rootpath . '/Labels.php">' . _('Label Template Maintenance'). '</a>
+ </div>
</form>';
}
Modified: trunk/SelectOrderItems.php
===================================================================
--- trunk/SelectOrderItems.php 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/SelectOrderItems.php 2012-05-05 05:04:04 UTC (rev 5316)
@@ -750,7 +750,7 @@
stockmaster.units
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D' stockcategory.stocktype='L')
AND stockmaster.mbflag <>'G'
AND stockmaster.description " . LIKE . " '" . $SearchString . "'
AND stockmaster.discontinued=0
@@ -761,7 +761,7 @@
stockmaster.units
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D' OR stockcategory.stocktype='L')
AND stockmaster.mbflag <>'G'
AND stockmaster.discontinued=0
AND stockmaster.description " . LIKE . " '" . $SearchString . "'
@@ -780,7 +780,7 @@
stockmaster.units
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D' OR stockcategory.stocktype='L')
AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
AND stockmaster.mbflag <>'G'
AND stockmaster.discontinued=0
@@ -791,7 +791,7 @@
stockmaster.units
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D' OR stockcategory.stocktype='L')
AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
AND stockmaster.mbflag <>'G'
AND stockmaster.discontinued=0
@@ -806,7 +806,7 @@
stockmaster.units
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D' OR stockcategory.stocktype='L')
AND stockmaster.mbflag <>'G'
AND stockmaster.discontinued=0
ORDER BY stockmaster.stockid";
@@ -816,7 +816,7 @@
stockmaster.units
FROM stockmaster INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D' OR stockcategory.stocktype='L')
AND stockmaster.mbflag <>'G'
AND stockmaster.discontinued=0
AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/doc/Change.log 2012-05-05 05:04:04 UTC (rev 5316)
@@ -1,5 +1,10 @@
webERP Change Log
+4/5/12 Phil: Labels.php PDFPrintLabel.php fine tuning of new labels code
+4/5/12 Phil: Fixed customer type name displayed when it is successfully deleted as reported by James Dupin
+4/5/12 Phil: Attempt to create simple work around for the limitations of strftime function and resulting character encoding issues - added new functions to get multi-lingual months GetMonthText() and week day names GetWeekDayText(). Not sure if there is any international consensus on the best format here - but can use the DefaultDateFormat or $_SESSION['Language'] if others want it a different way
+4/5/12 Phil: Allow SelectOrderItems.php to select labour type items
+4/5/12 Phil: updated tcpdf to 5.9.160
4/5/12 Phil: Default lastcostupdate to 0000-00-00 to avoid issues inserting new items.
1/5/12 MTPubRadio: Measurement unit in FormDesigner.php should be points instead of millimeters.
1/5/12 MTPubRadio: Fixed Purch Order PDF file text of Order Total- Excl tax does not align with amount horizontally.
Modified: trunk/includes/DateFunctions.inc
===================================================================
--- trunk/includes/DateFunctions.inc 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/includes/DateFunctions.inc 2012-05-05 05:04:04 UTC (rev 5316)
@@ -78,8 +78,6 @@
} //end of Is_Date function
-//_______________________________________________________________
-
function MonthAndYearFromSQLDate($DateEntry) {
@@ -94,20 +92,85 @@
if (mb_strlen($Date_Array[2])>4) {
$Date_Array[2]= mb_substr($Date_Array[2],0,2);
}
- $str = strftime('%B %Y', mktime(0,0,0, (int)$Date_Array[1],(int)$Date_Array[2],(int)$Date_Array[0]));
- //This code to handle characters in windows system which not encoded in UTF-8. Those non-utf8 code leads to display garbage
- $encode = mb_detect_encoding($str,'GB2312,BIG5,UTF-8');
-
- if($encode=='EUC-CN'){
- return iconv('GB2312','UTF-8',$str);
- }elseif($encode=='EUC-TW' or $encode=='BIG-5'){
- return iconv('BIG5','UTF-8', $str);
- }else{
- return ucfirst($str);
- }
-
+
+ $MonthName = GetMonthText(date('n', mktime(0,0,0, (int)$Date_Array[1],(int)$Date_Array[2],(int)$Date_Array[0])));
+ return $MonthName . ' ' . date('Y', mktime(0,0,0, (int)$Date_Array[1],(int)$Date_Array[2],(int)$Date_Array[0]));
+
}
+function GetMonthText($MonthNumber){
+ switch ($MonthNumber) {
+ case 1:
+ $Month = _('January');
+ break;
+ case 2:
+ $Month = _('February');
+ break;
+ case 3:
+ $Month = _('March');
+ break;
+ case 4:
+ $Month = _('April');
+ break;
+ case 5:
+ $Month = _('May');
+ break;
+ case 6:
+ $Month = _('June');
+ break;
+ case 7:
+ $Month = _('July');
+ break;
+ case 8:
+ $Month = _('August');
+ break;
+ case 9:
+ $Month = _('September');
+ break;
+ case 10:
+ $Month = _('October');
+ break;
+ case 11:
+ $Month = _('November');
+ break;
+ case 12:
+ $Month = _('December');
+ break;
+ }
+ return $Month;
+}
+
+function GetWeekDayText ($WeekDayNumber){
+ switch ($WeekDayNumber) {
+ case 0:
+ $Day = _('Sunday');
+ break;
+ case 1:
+ $Day = _('Monday');
+ break;
+ case 2:
+ $Day = _('Tuesday');
+ break;
+ case 3:
+ $Day = _('Wednesday');
+ break;
+ case 4:
+ $Day = _('Thursday');
+ break;
+ case 5:
+ $Day = _('Friday');
+ break;
+ case 6:
+ $Day = _('Saturday');
+ break;
+ }
+ return $Day;
+}
+
+function DisplayDateTime () {
+ return GetWeekDayText(date('w')) . ' ' . date('j') . ' ' . GetMonthText(date('n')) . ' ' . date('G:i') ;
+}
+
function DayOfWeekFromSQLDate($DateEntry) {
if (mb_strpos($DateEntry,'/')) {
@@ -126,6 +189,7 @@
}
+
function DayOfMonthFromSQLDate($DateEntry) {
if (mb_strpos($DateEntry,'/')) {
Modified: trunk/includes/PDFStarter.php
===================================================================
--- trunk/includes/PDFStarter.php 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/includes/PDFStarter.php 2012-05-05 05:04:04 UTC (rev 5316)
@@ -22,148 +22,144 @@
}
/* Javier: TCPDF supports 45 standard ISO (DIN) paper formats and 4 american common formats and does this cordinates calculation.
- However, reports use this units */
+However, reports use this units */
switch ($PaperSize) {
case 'A4':
-
// Javier: Now I use the native TCPDF constructor to which I send these values in each case,
// this should have been done whith FPDF which use the same values in its constructor.
+ $DocumentPaper = 'A4';
+ $DocumentOrientation ='P';
+
+ // Javier: DIN-A4 is 210 mm width, i.e., 595'2756 points (inches * 72 ppi)
+ $Page_Width=595;
+ $Page_Height=842;
+ $Top_Margin=30;
+ $Bottom_Margin=30;
+ $Left_Margin=40;
+ $Right_Margin=30;
+ break;
- $DocumentPaper = 'A4'; $DocumentOrientation ='P';
-
-// Javier: DIN-A4 is 210 mm width, i.e., 595'2756 points (inches * 72 ppi)
- $Page_Width=595;
- $Page_Height=842;
- $Top_Margin=30;
- $Bottom_Margin=30;
- $Left_Margin=40;
- $Right_Margin=30;
- break;
-
case 'A4_Landscape':
+
+ $DocumentPaper = 'A4';
+ $DocumentOrientation ='L';
+
+ $Page_Width=842;
+ $Page_Height=595;
+ $Top_Margin=30;
+ $Bottom_Margin=30;
+ $Left_Margin=40;
+ $Right_Margin=30;
+ break;
- $DocumentPaper = 'A4'; $DocumentOrientation ='L';
-
- $Page_Width=842;
- $Page_Height=595;
- $Top_Margin=30;
- $Bottom_Margin=30;
- $Left_Margin=40;
- $Right_Margin=30;
- break;
-
case 'A5':
- $DocumentPaper = 'A5'; $DocumentOrientation ='P';
+ $DocumentPaper = 'A5';
+ $DocumentOrientation ='P';
+
+ $Page_Width=421;
+ $Page_Height=595;
+ $Top_Margin=30;
+ $Bottom_Margin=30;
+ $Left_Margin=40;
+ $Right_Margin=30;
+ break;
- $Page_Width=421;
- $Page_Height=595;
- $Top_Margin=30;
- $Bottom_Margin=30;
- $Left_Margin=40;
- $Right_Margin=30;
- break;
-
case 'A5_Landscape':
+
+ $DocumentPaper = 'A5';
+ $DocumentOrientation ='L';
+
+ $Page_Width=595;
+ $Page_Height=421;
+ $Top_Margin=30;
+ $Bottom_Margin=30;
+ $Left_Margin=40;
+ $Right_Margin=30;
+ break;
- $DocumentPaper = 'A5'; $DocumentOrientation ='L';
-
- $Page_Width=595;
- $Page_Height=421;
- $Top_Margin=30;
- $Bottom_Margin=30;
- $Left_Margin=40;
- $Right_Margin=30;
- break;
-
case 'A3':
- $DocumentPaper = 'A3'; $DocumentOrientation ='P';
+ $DocumentPaper = 'A3';
+ $DocumentOrientation ='P';
+
+ $Page_Width=842;
+ $Page_Height=1190;
+ $Top_Margin=50;
+ $Bottom_Margin=50;
+ $Left_Margin=50;
+ $Right_Margin=40;
+ break;
- $Page_Width=842;
- $Page_Height=1190;
- $Top_Margin=50;
- $Bottom_Margin=50;
- $Left_Margin=50;
- $Right_Margin=40;
- break;
-
case 'A3_landscape':
- $DocumentPaper = 'A3'; $DocumentOrientation ='L';
+ $DocumentPaper = 'A3';
+ $DocumentOrientation ='L';
+
+ $Page_Width=1190;
+ $Page_Height=842;
+ $Top_Margin=50;
+ $Bottom_Margin=50;
+ $Left_Margin=50;
+ $Right_Margin=40;
+ break;
- $Page_Width=1190;
- $Page_Height=842;
- $Top_Margin=50;
- $Bottom_Margin=50;
- $Left_Margin=50;
- $Right_Margin=40;
- break;
-
case 'letter':
+
+ $DocumentPaper = 'LETTER';
+ $DocumentOrientation ='P';
+
+ $Page_Width=612;
+ $Page_Height=792;
+ $Top_Margin=30;
+ $Bottom_Margin=30;
+ $Left_Margin=30;
+ $Right_Margin=25;
+ break;
- $DocumentPaper = 'LETTER'; $DocumentOrientation ='P';
-
- $Page_Width=612;
- $Page_Height=792;
- $Top_Margin=30;
- $Bottom_Margin=30;
- $Left_Margin=30;
- $Right_Margin=25;
- break;
-
case 'letter_landscape':
- $DocumentPaper = 'LETTER'; $DocumentOrientation ='L';
-
- $Page_Width=792;
- $Page_Height=612;
- $Top_Margin=30;
- $Bottom_Margin=30;
- $Left_Margin=30;
- $Right_Margin=25;
- break;
-
+ $DocumentPaper = 'LETTER';
+ $DocumentOrientation ='L';
+
+ $Page_Width=792;
+ $Page_Height=612;
+ $Top_Margin=30;
+ $Bottom_Margin=30;
+ $Left_Margin=30;
+ $Right_Margin=25;
+ break;
+
case 'legal':
- $DocumentPaper = 'LEGAL';
- $DocumentOrientation ='P';
+ $DocumentPaper = 'LEGAL';
+ $DocumentOrientation ='P';
+
+ $Page_Width=612;
+ $Page_Height=1008;
+ $Top_Margin=50;
+ $Bottom_Margin=40;
+ $Left_Margin=30;
+ $Right_Margin=25;
+ break;
- $Page_Width=612;
- $Page_Height=1008;
- $Top_Margin=50;
- $Bottom_Margin=40;
- $Left_Margin=30;
- $Right_Margin=25;
- break;
-
case 'legal_landscape':
- $DocumentPaper = 'LEGAL';
- $DocumentOrientation ='L';
-
- $Page_Width=1008;
- $Page_Height=612;
- $Top_Margin=50;
- $Bottom_Margin=40;
- $Left_Margin=30;
- $Right_Margin=25;
- break;
-
- case '28mm_x_45mm_label':
- //$DocumentPaper can be an array or width/height of paper size
- //as an alternative to the string ISO paper size required by tcpdf
- $DocumentPaper = array(127.6,79.4);
- $DocumentOrientation='L';
- $Page_Width=127.6;
- $Page_Height=79.4;
- $Top_Margin=0;
- $Bottom_Margin=0;
- $Left_Margin=0;
- $Right_Margin=0;
- break;
+ $DocumentPaper = 'LEGAL';
+ $DocumentOrientation ='L';
+
+ $Page_Width=1008;
+ $Page_Height=612;
+ $Top_Margin=50;
+ $Bottom_Margin=40;
+ $Left_Margin=30;
+ $Right_Margin=25;
+ break;
+ default:
+ $DocumentOrientation = 'L';
+ break;
}
// Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-)
Modified: trunk/includes/footer.inc
===================================================================
--- trunk/includes/footer.inc 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/includes/footer.inc 2012-05-05 05:04:04 UTC (rev 5316)
@@ -7,7 +7,7 @@
echo '<tr>';
echo '<td style="width:33%"></td><td class="footer">';
echo '<img src="'. $rootpath . '/' . $_SESSION['LogoFile'] . '" width="120" alt="webERP" title="webERP ' . _('Copyright') . ' © weberp.org - ' . date('Y') . '" /></td>';
-echo '<td class="footer" style="text-align: right;width:33%">'.strftimeToUTF8((strftime('%A'))).', '.(date($_SESSION['DefaultDateFormat']).' | '.(strftimeToUTF8(strftime(($DefaultClock==12) ? '%I:%M %p' : '%H:%M')))).'</td>';
+echo '<td class="footer" style="text-align: right;width:33%">'. DisplayDateTime() .'</td>';
echo '</tr>';
echo '<tr><td colspan="3" class="footer">webERP ' ._('version') .' ' . $_SESSION['VersionNumber'] . '</td></tr>';
@@ -21,22 +21,5 @@
echo '</div>';
echo '</body>';
echo '</html>';
- function strftimeToUTF8 ($str) {
-
- $encoding = mb_detect_encoding($str,"GB2312,BIG5,UTF-8");
- switch($encoding){
- case 'EUC-CN':
- return iconv('GB2312','UTF-8',$str);
- break;
- case 'EUC-TW':
- return iconv('BIG5','UTF-8',$str);
- break;
- case 'BIG-5':
- return iconv('BIG5','UTF-8',$str);
- break;
- default:
- return $str;
- }
- }
?>
Modified: trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po
===================================================================
--- trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po 2012-05-05 05:04:04 UTC (rev 5316)
@@ -13189,7 +13189,7 @@
#: index.php:511
#, fuzzy
msgid "Create a New Tender"
-msgstr "Planungskalender anlegen"
+msgstr "Ausschreibung erstellen"
#: index.php:516
#, fuzzy
Modified: trunk/sql/mysql/upgrade4.07-4.08.sql
===================================================================
--- trunk/sql/mysql/upgrade4.07-4.08.sql 2012-05-04 21:55:53 UTC (rev 5315)
+++ trunk/sql/mysql/upgrade4.07-4.08.sql 2012-05-05 05:04:04 UTC (rev 5316)
@@ -76,7 +76,16 @@
ALTER TABLE `locations` ADD UNIQUE `locationname` (`locationname`);
-ALTER TABLE `stockmaster` CHANGE `lastcostupdate` `lastcostupdate` DATE NOT NULL DEFAULT '0000-00-00'
+ALTER TABLE `stockmaster` CHANGE `lastcostupdate` `lastcostupdate` DATE NOT NULL DEFAULT '0000-00-00';
+ALTER TABLE `labels` CHANGE `papersize` `pagewidth` FLOAT NOT NULL DEFAULT '0';
+ALTER TABLE `labels` ADD `pageheight` FLOAT NOT NULL DEFAULT '0' AFTER `pagewidth`;
+ALTER TABLE `labels` CHANGE `height` `height` FLOAT NOT NULL DEFAULT '0';
+ALTER TABLE `labels` CHANGE `width` `width` FLOAT NOT NULL DEFAULT '0';
+ALTER TABLE `labels` CHANGE `topmargin` `topmargin` FLOAT NOT NULL DEFAULT '0';
+ALTER TABLE `labels` CHANGE `leftmargin` `leftmargin` FLOAT NOT NULL DEFAULT '0';
+ALTER TABLE `labels` CHANGE `rowheight` `rowheight` FLOAT NOT NULL DEFAULT '0';
+ALTER TABLE `labels` CHANGE `columnwidth` `columnwidth` FLOAT NOT NULL DEFAULT '0';
+
UPDATE config SET confvalue='4.08' WHERE confname='VersionNumber';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|