From: <vv...@us...> - 2012-04-21 20:21:39
|
Revision: 5268 http://web-erp.svn.sourceforge.net/web-erp/?rev=5268&view=rev Author: vvs2012 Date: 2012-04-21 20:21:33 +0000 (Sat, 21 Apr 2012) Log Message: ----------- Editable item description in PO Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2012-04-20 08:49:59 UTC (rev 5267) +++ trunk/PO_Items.php 2012-04-21 20:21:33 UTC (rev 5268) @@ -48,6 +48,7 @@ $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=filter_number_format($_POST['SuppPrice'.$POLine->LineNo])/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ItemDescription =$_POST['ItemDescription'.$POLine->LineNo]; } } } @@ -371,7 +372,7 @@ AND ($_SESSION['PO'.$identifier]->Status=='Authorised' OR $_SESSION['PO'.$identifier]->Status=='Printed')){ - echo '<br /><a target="_blank" href="'.$rootpath.'/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['PO'.$identifier]->OrderNo . '">' . _('Print Purchase Order') . '</a>'; + echo '<br /><div class="centre"><a target="_blank" href="'.$rootpath.'/PO_PDFPurchOrder.php?OrderNo=' . $_SESSION['PO'.$identifier]->OrderNo . '">' . _('Print Purchase Order') . '</a></div>'; } } /*end of if its a new order or an existing one */ @@ -695,7 +696,7 @@ } echo '<td>' . $POLine->StockID . '</td> - <td>' . $POLine->ItemDescription . '</td> + <td><input type="text" name="ItemDescription' . $POLine->LineNo.'" size="80" value="' .$POLine->ItemDescription .'" /></td> <td class="number">' . locale_number_format($POLine->Quantity,$POLine->DecimalPlaces) . '</td> <td>' . $POLine->Units . '</td> <td class="number">' . $DisplayPrice . '</td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-20 08:49:59 UTC (rev 5267) +++ trunk/doc/Change.log 2012-04-21 20:21:33 UTC (rev 5268) @@ -1,4 +1,5 @@ webERP Change Log +21/04/2012 Vitaly: Editable item description in PO. 16/04/2012 Vitaly: Added option to display only items that are currently on purchase order in StockLocStatus.php 16/04/2012 Vitaly: Fixed Days textbox where it did not remember entered value. 16/04/2012 Ricard: ReorderLevelLocation.php only showing items not discontinued (current). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-21 20:23:03
|
Revision: 5269 http://web-erp.svn.sourceforge.net/web-erp/?rev=5269&view=rev Author: vvs2012 Date: 2012-04-21 20:22:57 +0000 (Sat, 21 Apr 2012) Log Message: ----------- Display POs for user default location if location is not selected Modified Paths: -------------- trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2012-04-21 20:21:33 UTC (rev 5268) +++ trunk/PO_SelectOSPurchOrder.php 2012-04-21 20:22:57 UTC (rev 5269) @@ -327,7 +327,7 @@ if (isset($SelectedSupplier)) { if (!isset($_POST['StockLocation'])) { - $_POST['StockLocation']=''; + $_POST['StockLocation']=$_SESSION['UserStockLocation']; } if (isset($SelectedStockItem)) { @@ -400,7 +400,7 @@ } } else { //no supplier selected if (!isset($_POST['StockLocation'])) { - $_POST['StockLocation']=''; + $_POST['StockLocation']=$_SESSION['UserStockLocation']; } if (isset($SelectedStockItem) AND isset($_POST['StockLocation'])) { $SQL = "SELECT purchorders.realorderno, Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2012-04-21 20:21:33 UTC (rev 5268) +++ trunk/PO_SelectPurchOrder.php 2012-04-21 20:22:57 UTC (rev 5269) @@ -292,7 +292,7 @@ } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (empty($_POST['StockLocation'])) { - $_POST['StockLocation'] = ''; + $_POST['StockLocation'] = $_SESSION['UserStockLocation']; } if (isset($SelectedSupplier)) { if (isset($SelectedStockItem)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-21 20:23:04
|
Revision: 5269 http://web-erp.svn.sourceforge.net/web-erp/?rev=5269&view=rev Author: vvs2012 Date: 2012-04-21 20:22:57 +0000 (Sat, 21 Apr 2012) Log Message: ----------- Display POs for user default location if location is not selected Modified Paths: -------------- trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2012-04-21 20:21:33 UTC (rev 5268) +++ trunk/PO_SelectOSPurchOrder.php 2012-04-21 20:22:57 UTC (rev 5269) @@ -327,7 +327,7 @@ if (isset($SelectedSupplier)) { if (!isset($_POST['StockLocation'])) { - $_POST['StockLocation']=''; + $_POST['StockLocation']=$_SESSION['UserStockLocation']; } if (isset($SelectedStockItem)) { @@ -400,7 +400,7 @@ } } else { //no supplier selected if (!isset($_POST['StockLocation'])) { - $_POST['StockLocation']=''; + $_POST['StockLocation']=$_SESSION['UserStockLocation']; } if (isset($SelectedStockItem) AND isset($_POST['StockLocation'])) { $SQL = "SELECT purchorders.realorderno, Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2012-04-21 20:21:33 UTC (rev 5268) +++ trunk/PO_SelectPurchOrder.php 2012-04-21 20:22:57 UTC (rev 5269) @@ -292,7 +292,7 @@ } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (empty($_POST['StockLocation'])) { - $_POST['StockLocation'] = ''; + $_POST['StockLocation'] = $_SESSION['UserStockLocation']; } if (isset($SelectedSupplier)) { if (isset($SelectedStockItem)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-21 21:11:02
|
Revision: 5270 http://web-erp.svn.sourceforge.net/web-erp/?rev=5270&view=rev Author: vvs2012 Date: 2012-04-21 21:10:56 +0000 (Sat, 21 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/StockStatus.php trunk/StockTransfers.php trunk/StockUsage.php trunk/SuppContractChgs.php trunk/SuppCreditGRNs.php trunk/SuppFixedAssetChgs.php trunk/SuppInvGRNs.php Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/StockStatus.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -56,7 +56,7 @@ echo '<div class="centre"><input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; -echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /></div>'; +echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" />'; $sql = "SELECT locstock.loccode, locations.locationname, @@ -379,7 +379,6 @@ } }//end of displaying price history for a debtor -echo '<div class="centre">'; echo '<br /><a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Movements') . '</a>'; echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Usage') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/StockTransfers.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -51,7 +51,7 @@ echo '<tr> <td>'.$myrow['stockid'].'</td> <td>'.$myrow['description'].'</td> - <td><a href="' . $rootpath . '/StockTransfers.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&NewTransfer=Yes&Quantity='. filter_number_format($_POST['Quantity']).'&From='.$_POST['StockLocationFrom'].'&To='.$_POST['StockLocationTo'].'">' + <td><a href="' . $rootpath . '/StockTransfers.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&NewTransfer=Yes&Quantity='. filter_number_format($_POST['Quantity']).'&From='.$_POST['StockLocationFrom'].'&To='.$_POST['StockLocationTo'].'">' ._('Transfer').'</a></td> </tr>'; @@ -457,6 +457,7 @@ </p>'; echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_GET['Description'])) { @@ -504,7 +505,7 @@ } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_SESSION['Transfer']->StockLocationFrom=$myrow['loccode'] . '</option>'; + $_SESSION['Transfer']->StockLocationFrom=$myrow['loccode']; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } @@ -528,7 +529,7 @@ } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation'] AND isset($_SESSION['Transfer'])){ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_SESSION['Transfer']->StockLocationTo=$myrow['loccode'] . '</option>'; + $_SESSION['Transfer']->StockLocationTo=$myrow['loccode']; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } @@ -569,13 +570,14 @@ echo '<br /> <a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>'; echo '<br /> - <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Show Stock Usage') . '</a>'; + <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Show Stock Usage') . '</a>'; echo '<br /> - <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Search Outstanding Sales Orders') . '</a>'; + <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /> <a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">'._('Search Completed Sales Orders').'</a>'; } echo '</div> + </div> </form>'; include('includes/footer.inc'); ?> Modified: trunk/StockUsage.php =================================================================== --- trunk/StockUsage.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/StockUsage.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -15,10 +15,10 @@ } if (isset($_POST['ShowGraphUsage'])) { - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] . '&StockID=' . $StockID . '">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] . '&StockID=' . $StockID . '">'; prnMsg(_('You should automatically be forwarded to the usage graph') . '. ' . _('If this does not happen') .' (' . _('if the browser does not support META Refresh') . ') ' . - '<a href="' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] .'&StockID=' . $StockID . '">' . _('click here') . '</a> ' . _('to continue'),'info'); + '<a href="' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] .'&StockID=' . $StockID . '">' . _('click here') . '</a> ' . _('to continue'),'info'); exit; } @@ -39,6 +39,9 @@ $DecimalPlaces = $myrow[3]; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; $Its_A_KitSet_Assembly_Or_Dummy =False; @@ -47,20 +50,17 @@ OR $myrow[2]=='D') { $Its_A_KitSet_Assembly_Or_Dummy =True; - echo '<font color="navy" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b></font>'; + echo '<h3>' . $StockID . ' - ' . $myrow[0] . '</h3>'; prnMsg( _('The selected item is a dummy or assembly or kit-set item and cannot have a stock holding') . '. ' . _('Please select a different item'),'warn'); $StockID = ''; } else { echo '<tr> - <th><font size="3" color="navy">' . _('Item') . ' :<b> ' . $StockID . ' - ' . $myrow[0] . ' </b> (' . _('in units of') . ' :<b> ' . $myrow[1] . ')</b></font></th> + <th><h3>' . _('Item') . ' : ' . $StockID . ' - ' . $myrow[0] . ' (' . _('in units of') . ' : ' . $myrow[1] . ')</h3></th> </tr>'; } -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; - -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Stock Code') . ':<input type="text" name="StockID" size="21" maxlength="20" value="' . $StockID . '" />'; echo _('From Stock Location') . ':<select name="StockLocation">'; @@ -141,8 +141,7 @@ exit; } - echo '</div> - <table class="selection">'; + echo '<table class="selection">'; $tableheader = '<tr> <th>' . _('Month') . '</th> <th>' . _('Usage') . '</th> @@ -179,7 +178,7 @@ } //end of while loop - if ($TotalUsage>0 && $PeriodsCounter>0){ + if ($TotalUsage>0 AND $PeriodsCounter>0){ echo '<tr> <th colspan="2">' . _('Average Usage per month is') . ' ' . locale_number_format($TotalUsage/$PeriodsCounter) . '</th> </tr>'; @@ -187,19 +186,21 @@ echo '</table>'; } /* end if Show Usage is clicked */ +echo '<div class="centre">'; echo '<br /> - <div class="centre">'; -echo '<a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') .'</a>'; + <a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') .'</a>'; echo '<br /> - <a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Movements') . '</a>'; + <a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Movements') . '</a>'; echo '<br /> - <a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; + <a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /> <a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; echo '<br /> <a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Purchase Orders') . '</a>'; -echo '</form></div>'; +echo '</div> + </div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SuppContractChgs.php =================================================================== --- trunk/SuppContractChgs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppContractChgs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -104,7 +104,7 @@ } echo '<tr> - <td class="number">' . _('Total') . ':</font></td> + <td class="number">' . _('Total') . ':</td> <td class="number">' . locale_number_format($TotalContractsValue,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr> </table>'; @@ -121,6 +121,7 @@ /*Set up a form to allow input of new Contract charges */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['ContractRef'])) { @@ -132,7 +133,7 @@ <td><input type="text" name="ContractRef" size="22" maxlength="20" value="' . $_POST['ContractRef'] . '" /></td> </tr>'; echo '<tr> - <td>' . _('Contract Selection') . ':<br /><font size="1">' . _('If you know the code enter it above') . '<br />' . _('otherwise select the contract from the list') . '</font></td> + <td>' . _('Contract Selection') . ':<br />' . _('If you know the code enter it above') . '<br />' . _('otherwise select the contract from the list') . '</td> <td><select name="ContractSelection">'; $sql = "SELECT contractref, name @@ -180,8 +181,9 @@ </tr> </table>'; -echo '<input type="submit" name="AddContractChgToInvoice" value="' . _('Enter Contract Charge') . '" />'; +echo '<div class="centre"><input type="submit" name="AddContractChgToInvoice" value="' . _('Enter Contract Charge') . '" /></div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SuppCreditGRNs.php =================================================================== --- trunk/SuppCreditGRNs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppCreditGRNs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -84,7 +84,7 @@ echo '<table class="selection">'; echo '<tr> - <th colspan="6"><font size="3" color="navy">' . _('Credits Against Goods Received Selected') . '</font></th> + <th colspan="6"><h3>' . _('Credits Against Goods Received Selected') . '</h3></th> </tr>'; $TableHeader = '<tr> <th>' . _('GRN') . '</th> @@ -122,8 +122,8 @@ } echo '<tr> - <td colspan="5 class="number"><font size="2" color="navy">' . _('Total Value Credited Against Goods') . ':</font></td> - <td class="number"><font size="2" color="navy"><U>' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td colspan="5" class="number"><h4>' . _('Total Value Credited Against Goods') . ':</h4></td> + <td class="number"><h4>' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td> </tr>'; echo '</table> <br /> @@ -167,15 +167,16 @@ /*Set up a table to show the GRNs outstanding for selection */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> <table class="selection"> <tr> - <th colspan="10"><font size="3" color="navy">' . _('Show Goods Received Since') . ': </font>'; -echo '<input type="text" name="Show_Since" maxlength="11" size="12" class="date" alt='.$_SESSION['DefaultDateFormat'].' value="' . $_POST['Show_Since'] . '" /> + <th colspan="10"><h3>' . _('Show Goods Received Since') . ': </h3>'; +echo '<input type="text" name="Show_Since" maxlength="11" size="12" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" value="' . $_POST['Show_Since'] . '" /> <input type="submit" name="FindGRNs" value="' . _('Display GRNs') . '" /> - <font size="3" color="navy"> ' . _('From') . ' ' . $_SESSION['SuppTrans']->SupplierName . '</font></th> + <h3> ' . _('From') . ' ' . $_SESSION['SuppTrans']->SupplierName . '</h3></th> </tr>'; if (DB_num_rows($GRNResults)>0){ @@ -270,7 +271,7 @@ echo '<br /> <table class="selection">'; echo '<tr> - <th colspan="6"><font size="3" color="navy">' . _('GRN Selected For Adding To A Suppliers Credit Note') . '</font></th> + <th colspan="6"><h3>' . _('GRN Selected For Adding To A Suppliers Credit Note') . '</h3></th> </tr>'; echo '<tr> <th>' . _('GRN') . '</th> @@ -327,6 +328,10 @@ echo '<input type="hidden" name="GRNBatchNo" value="' . $myrow['grnbatch'] . '" />'; } } //end if there were GRNs to select -echo '</form>'; +else { + echo '</table>'; +} +echo '</div> + </form>'; include('includes/footer.inc'); ?> Modified: trunk/SuppFixedAssetChgs.php =================================================================== --- trunk/SuppFixedAssetChgs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppFixedAssetChgs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -91,8 +91,8 @@ } echo '<tr> - <td class="number"><font size="2" color="navy">' . _('Total') . ':</font></td> - <td class="number"><font size="2" color="navy"><U>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td class="number"><h4>' . _('Total') . ':</h4></td> + <td class="number"><h4>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td> </tr> </table><br />'; @@ -103,7 +103,8 @@ } /*Set up a form to allow input of new Shipment charges */ -echo '<br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" />'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" />'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['AssetID'])) { @@ -116,7 +117,7 @@ echo '<tr> <td>' . _('Enter Asset ID') . ':</td> - <td><input type="text" name="AssetID" size="5" maxlength="6" value="' . $_POST['AssetID'] . '" /> <a href="FixedAssetItems.php" target=_blank>'. _('New Fixed Asset') . '</a></td> + <td><input type="text" name="AssetID" size="5" maxlength="6" value="' . $_POST['AssetID'] . '" /> <a href="FixedAssetItems.php" target="_blank">'. _('New Fixed Asset') . '</a></td> </tr>'; echo '<tr> <td><b>' . _('OR') .' </b>'. _('Select from list') . ':</td> @@ -156,6 +157,7 @@ <input type="submit" name="AddAssetToInvoice" value="' . _('Enter Fixed Asset') . '" /> </div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppInvGRNs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -117,7 +117,7 @@ echo '<table class="selection"> <tr> - <th colspan="6"><font size="3" color="navy">' . _('Invoiced Goods Received Selected') . '</font></th> + <th colspan="6"><h3>' . _('Invoiced Goods Received Selected') . '</h3></th> </tr>'; $tableheader = '<tr> @@ -158,7 +158,7 @@ echo '<tr> <td colspan="5" align="right">' . _('Total Value of Goods Charged') . ':</td> - <td class="number"><font size="2" color="navy">' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + <td class="number"><h4>' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td> </tr> </table> <br /> @@ -196,13 +196,14 @@ if (DB_num_rows($GRNResults)==0){ prnMsg(_('There are no outstanding goods received from') . ' ' . $_SESSION['SuppTrans']->SupplierName . ' ' . _('that have not been invoiced by them') . '<br />' . _('The goods must first be received using the link below to select purchase orders to receive'),'warn'); - echo '<div class="centre"><p><a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SupplierID=' . $_SESSION['SuppTrans']->SupplierID .'">' . _('Select Purchase Orders to Receive') .'</a></div>'; + echo '<div class="centre"><p><a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SupplierID=' . $_SESSION['SuppTrans']->SupplierID .'">' . _('Select Purchase Orders to Receive') .'</a></p></div>'; include('includes/footer.inc'); exit; } /*Set up a table to show the GRNs outstanding for selection */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset( $_SESSION['SuppTransTmp'])){ @@ -249,7 +250,7 @@ echo '<table class="selection">'; echo '<tr> - <th colspan="10"><font size="3" color="navy">' . _('GRN Selected For Adding To A Purchase Invoice') . '</font></th> + <th colspan="10"><h3>' . _('GRN Selected For Adding To A Purchase Invoice') . '</h3></th> </tr>'; echo '<tr> <th>' . _('Sequence') . ' #</th> @@ -295,7 +296,7 @@ if (count( $_SESSION['SuppTransTmp']->GRNs)>0){ /*if there are any outstanding GRNs then */ echo '<table class="selection"> <tr> - <th colspan="10"><font size="3" color="navy">' . _('Goods Received Yet to be Invoiced From') . ' ' . $_SESSION['SuppTrans']->SupplierName.'</font></th> + <th colspan="10"><h3>' . _('Goods Received Yet to be Invoiced From') . ' ' . $_SESSION['SuppTrans']->SupplierName.'</h3></th> </tr>'; $tableheader = '<tr> @@ -360,6 +361,7 @@ } } -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-21 21:11:03
|
Revision: 5270 http://web-erp.svn.sourceforge.net/web-erp/?rev=5270&view=rev Author: vvs2012 Date: 2012-04-21 21:10:56 +0000 (Sat, 21 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/StockStatus.php trunk/StockTransfers.php trunk/StockUsage.php trunk/SuppContractChgs.php trunk/SuppCreditGRNs.php trunk/SuppFixedAssetChgs.php trunk/SuppInvGRNs.php Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/StockStatus.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -56,7 +56,7 @@ echo '<div class="centre"><input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; -echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /></div>'; +echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" />'; $sql = "SELECT locstock.loccode, locations.locationname, @@ -379,7 +379,6 @@ } }//end of displaying price history for a debtor -echo '<div class="centre">'; echo '<br /><a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Movements') . '</a>'; echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Usage') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/StockTransfers.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -51,7 +51,7 @@ echo '<tr> <td>'.$myrow['stockid'].'</td> <td>'.$myrow['description'].'</td> - <td><a href="' . $rootpath . '/StockTransfers.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&NewTransfer=Yes&Quantity='. filter_number_format($_POST['Quantity']).'&From='.$_POST['StockLocationFrom'].'&To='.$_POST['StockLocationTo'].'">' + <td><a href="' . $rootpath . '/StockTransfers.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&NewTransfer=Yes&Quantity='. filter_number_format($_POST['Quantity']).'&From='.$_POST['StockLocationFrom'].'&To='.$_POST['StockLocationTo'].'">' ._('Transfer').'</a></td> </tr>'; @@ -457,6 +457,7 @@ </p>'; echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_GET['Description'])) { @@ -504,7 +505,7 @@ } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_SESSION['Transfer']->StockLocationFrom=$myrow['loccode'] . '</option>'; + $_SESSION['Transfer']->StockLocationFrom=$myrow['loccode']; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } @@ -528,7 +529,7 @@ } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation'] AND isset($_SESSION['Transfer'])){ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_SESSION['Transfer']->StockLocationTo=$myrow['loccode'] . '</option>'; + $_SESSION['Transfer']->StockLocationTo=$myrow['loccode']; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } @@ -569,13 +570,14 @@ echo '<br /> <a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>'; echo '<br /> - <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Show Stock Usage') . '</a>'; + <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Show Stock Usage') . '</a>'; echo '<br /> - <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Search Outstanding Sales Orders') . '</a>'; + <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /> <a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">'._('Search Completed Sales Orders').'</a>'; } echo '</div> + </div> </form>'; include('includes/footer.inc'); ?> Modified: trunk/StockUsage.php =================================================================== --- trunk/StockUsage.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/StockUsage.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -15,10 +15,10 @@ } if (isset($_POST['ShowGraphUsage'])) { - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] . '&StockID=' . $StockID . '">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] . '&StockID=' . $StockID . '">'; prnMsg(_('You should automatically be forwarded to the usage graph') . '. ' . _('If this does not happen') .' (' . _('if the browser does not support META Refresh') . ') ' . - '<a href="' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] .'&StockID=' . $StockID . '">' . _('click here') . '</a> ' . _('to continue'),'info'); + '<a href="' . $rootpath . '/StockUsageGraph.php?StockLocation=' . $_POST['StockLocation'] .'&StockID=' . $StockID . '">' . _('click here') . '</a> ' . _('to continue'),'info'); exit; } @@ -39,6 +39,9 @@ $DecimalPlaces = $myrow[3]; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; $Its_A_KitSet_Assembly_Or_Dummy =False; @@ -47,20 +50,17 @@ OR $myrow[2]=='D') { $Its_A_KitSet_Assembly_Or_Dummy =True; - echo '<font color="navy" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b></font>'; + echo '<h3>' . $StockID . ' - ' . $myrow[0] . '</h3>'; prnMsg( _('The selected item is a dummy or assembly or kit-set item and cannot have a stock holding') . '. ' . _('Please select a different item'),'warn'); $StockID = ''; } else { echo '<tr> - <th><font size="3" color="navy">' . _('Item') . ' :<b> ' . $StockID . ' - ' . $myrow[0] . ' </b> (' . _('in units of') . ' :<b> ' . $myrow[1] . ')</b></font></th> + <th><h3>' . _('Item') . ' : ' . $StockID . ' - ' . $myrow[0] . ' (' . _('in units of') . ' : ' . $myrow[1] . ')</h3></th> </tr>'; } -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; - -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Stock Code') . ':<input type="text" name="StockID" size="21" maxlength="20" value="' . $StockID . '" />'; echo _('From Stock Location') . ':<select name="StockLocation">'; @@ -141,8 +141,7 @@ exit; } - echo '</div> - <table class="selection">'; + echo '<table class="selection">'; $tableheader = '<tr> <th>' . _('Month') . '</th> <th>' . _('Usage') . '</th> @@ -179,7 +178,7 @@ } //end of while loop - if ($TotalUsage>0 && $PeriodsCounter>0){ + if ($TotalUsage>0 AND $PeriodsCounter>0){ echo '<tr> <th colspan="2">' . _('Average Usage per month is') . ' ' . locale_number_format($TotalUsage/$PeriodsCounter) . '</th> </tr>'; @@ -187,19 +186,21 @@ echo '</table>'; } /* end if Show Usage is clicked */ +echo '<div class="centre">'; echo '<br /> - <div class="centre">'; -echo '<a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') .'</a>'; + <a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') .'</a>'; echo '<br /> - <a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Movements') . '</a>'; + <a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Movements') . '</a>'; echo '<br /> - <a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; + <a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /> <a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; echo '<br /> <a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Purchase Orders') . '</a>'; -echo '</form></div>'; +echo '</div> + </div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SuppContractChgs.php =================================================================== --- trunk/SuppContractChgs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppContractChgs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -104,7 +104,7 @@ } echo '<tr> - <td class="number">' . _('Total') . ':</font></td> + <td class="number">' . _('Total') . ':</td> <td class="number">' . locale_number_format($TotalContractsValue,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr> </table>'; @@ -121,6 +121,7 @@ /*Set up a form to allow input of new Contract charges */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['ContractRef'])) { @@ -132,7 +133,7 @@ <td><input type="text" name="ContractRef" size="22" maxlength="20" value="' . $_POST['ContractRef'] . '" /></td> </tr>'; echo '<tr> - <td>' . _('Contract Selection') . ':<br /><font size="1">' . _('If you know the code enter it above') . '<br />' . _('otherwise select the contract from the list') . '</font></td> + <td>' . _('Contract Selection') . ':<br />' . _('If you know the code enter it above') . '<br />' . _('otherwise select the contract from the list') . '</td> <td><select name="ContractSelection">'; $sql = "SELECT contractref, name @@ -180,8 +181,9 @@ </tr> </table>'; -echo '<input type="submit" name="AddContractChgToInvoice" value="' . _('Enter Contract Charge') . '" />'; +echo '<div class="centre"><input type="submit" name="AddContractChgToInvoice" value="' . _('Enter Contract Charge') . '" /></div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SuppCreditGRNs.php =================================================================== --- trunk/SuppCreditGRNs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppCreditGRNs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -84,7 +84,7 @@ echo '<table class="selection">'; echo '<tr> - <th colspan="6"><font size="3" color="navy">' . _('Credits Against Goods Received Selected') . '</font></th> + <th colspan="6"><h3>' . _('Credits Against Goods Received Selected') . '</h3></th> </tr>'; $TableHeader = '<tr> <th>' . _('GRN') . '</th> @@ -122,8 +122,8 @@ } echo '<tr> - <td colspan="5 class="number"><font size="2" color="navy">' . _('Total Value Credited Against Goods') . ':</font></td> - <td class="number"><font size="2" color="navy"><U>' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td colspan="5" class="number"><h4>' . _('Total Value Credited Against Goods') . ':</h4></td> + <td class="number"><h4>' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td> </tr>'; echo '</table> <br /> @@ -167,15 +167,16 @@ /*Set up a table to show the GRNs outstanding for selection */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> <table class="selection"> <tr> - <th colspan="10"><font size="3" color="navy">' . _('Show Goods Received Since') . ': </font>'; -echo '<input type="text" name="Show_Since" maxlength="11" size="12" class="date" alt='.$_SESSION['DefaultDateFormat'].' value="' . $_POST['Show_Since'] . '" /> + <th colspan="10"><h3>' . _('Show Goods Received Since') . ': </h3>'; +echo '<input type="text" name="Show_Since" maxlength="11" size="12" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" value="' . $_POST['Show_Since'] . '" /> <input type="submit" name="FindGRNs" value="' . _('Display GRNs') . '" /> - <font size="3" color="navy"> ' . _('From') . ' ' . $_SESSION['SuppTrans']->SupplierName . '</font></th> + <h3> ' . _('From') . ' ' . $_SESSION['SuppTrans']->SupplierName . '</h3></th> </tr>'; if (DB_num_rows($GRNResults)>0){ @@ -270,7 +271,7 @@ echo '<br /> <table class="selection">'; echo '<tr> - <th colspan="6"><font size="3" color="navy">' . _('GRN Selected For Adding To A Suppliers Credit Note') . '</font></th> + <th colspan="6"><h3>' . _('GRN Selected For Adding To A Suppliers Credit Note') . '</h3></th> </tr>'; echo '<tr> <th>' . _('GRN') . '</th> @@ -327,6 +328,10 @@ echo '<input type="hidden" name="GRNBatchNo" value="' . $myrow['grnbatch'] . '" />'; } } //end if there were GRNs to select -echo '</form>'; +else { + echo '</table>'; +} +echo '</div> + </form>'; include('includes/footer.inc'); ?> Modified: trunk/SuppFixedAssetChgs.php =================================================================== --- trunk/SuppFixedAssetChgs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppFixedAssetChgs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -91,8 +91,8 @@ } echo '<tr> - <td class="number"><font size="2" color="navy">' . _('Total') . ':</font></td> - <td class="number"><font size="2" color="navy"><U>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td class="number"><h4>' . _('Total') . ':</h4></td> + <td class="number"><h4>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td> </tr> </table><br />'; @@ -103,7 +103,8 @@ } /*Set up a form to allow input of new Shipment charges */ -echo '<br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" />'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" />'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['AssetID'])) { @@ -116,7 +117,7 @@ echo '<tr> <td>' . _('Enter Asset ID') . ':</td> - <td><input type="text" name="AssetID" size="5" maxlength="6" value="' . $_POST['AssetID'] . '" /> <a href="FixedAssetItems.php" target=_blank>'. _('New Fixed Asset') . '</a></td> + <td><input type="text" name="AssetID" size="5" maxlength="6" value="' . $_POST['AssetID'] . '" /> <a href="FixedAssetItems.php" target="_blank">'. _('New Fixed Asset') . '</a></td> </tr>'; echo '<tr> <td><b>' . _('OR') .' </b>'. _('Select from list') . ':</td> @@ -156,6 +157,7 @@ <input type="submit" name="AddAssetToInvoice" value="' . _('Enter Fixed Asset') . '" /> </div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2012-04-21 20:22:57 UTC (rev 5269) +++ trunk/SuppInvGRNs.php 2012-04-21 21:10:56 UTC (rev 5270) @@ -117,7 +117,7 @@ echo '<table class="selection"> <tr> - <th colspan="6"><font size="3" color="navy">' . _('Invoiced Goods Received Selected') . '</font></th> + <th colspan="6"><h3>' . _('Invoiced Goods Received Selected') . '</h3></th> </tr>'; $tableheader = '<tr> @@ -158,7 +158,7 @@ echo '<tr> <td colspan="5" align="right">' . _('Total Value of Goods Charged') . ':</td> - <td class="number"><font size="2" color="navy">' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + <td class="number"><h4>' . locale_number_format($TotalValueCharged,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td> </tr> </table> <br /> @@ -196,13 +196,14 @@ if (DB_num_rows($GRNResults)==0){ prnMsg(_('There are no outstanding goods received from') . ' ' . $_SESSION['SuppTrans']->SupplierName . ' ' . _('that have not been invoiced by them') . '<br />' . _('The goods must first be received using the link below to select purchase orders to receive'),'warn'); - echo '<div class="centre"><p><a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SupplierID=' . $_SESSION['SuppTrans']->SupplierID .'">' . _('Select Purchase Orders to Receive') .'</a></div>'; + echo '<div class="centre"><p><a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SupplierID=' . $_SESSION['SuppTrans']->SupplierID .'">' . _('Select Purchase Orders to Receive') .'</a></p></div>'; include('includes/footer.inc'); exit; } /*Set up a table to show the GRNs outstanding for selection */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset( $_SESSION['SuppTransTmp'])){ @@ -249,7 +250,7 @@ echo '<table class="selection">'; echo '<tr> - <th colspan="10"><font size="3" color="navy">' . _('GRN Selected For Adding To A Purchase Invoice') . '</font></th> + <th colspan="10"><h3>' . _('GRN Selected For Adding To A Purchase Invoice') . '</h3></th> </tr>'; echo '<tr> <th>' . _('Sequence') . ' #</th> @@ -295,7 +296,7 @@ if (count( $_SESSION['SuppTransTmp']->GRNs)>0){ /*if there are any outstanding GRNs then */ echo '<table class="selection"> <tr> - <th colspan="10"><font size="3" color="navy">' . _('Goods Received Yet to be Invoiced From') . ' ' . $_SESSION['SuppTrans']->SupplierName.'</font></th> + <th colspan="10"><h3>' . _('Goods Received Yet to be Invoiced From') . ' ' . $_SESSION['SuppTrans']->SupplierName.'</h3></th> </tr>'; $tableheader = '<tr> @@ -360,6 +361,7 @@ } } -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-23 03:06:08
|
Revision: 5276 http://web-erp.svn.sourceforge.net/web-erp/?rev=5276&view=rev Author: vvs2012 Date: 2012-04-23 03:06:00 +0000 (Mon, 23 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/SupplierAllocations.php trunk/SupplierBalsAtPeriodEnd.php trunk/SupplierContacts.php trunk/SupplierCredit.php trunk/SupplierInquiry.php trunk/SupplierInvoice.php trunk/SupplierPriceList.php Modified: trunk/SupplierAllocations.php =================================================================== --- trunk/SupplierAllocations.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierAllocations.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -264,6 +264,7 @@ for allocating to */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_POST['SupplierID'])){ @@ -591,7 +592,7 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><a href="%sAllocTrans=%s">' . _('Allocate') .'</td> + <td><a href="%sAllocTrans=%s">' . _('Allocate') .'</a></td> </tr>', $myrow['typename'], $myrow['suppname'], @@ -667,7 +668,7 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><a href="%sAllocTrans=%s">' . _('Allocate') . '</td> + <td><a href="%sAllocTrans=%s">' . _('Allocate') . '</a></td> </tr>', $myrow['typename'], $myrow['suppname'], @@ -689,6 +690,7 @@ } /* end of else if not a SupplierID or transaction called with the URL */ -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SupplierBalsAtPeriodEnd.php =================================================================== --- trunk/SupplierBalsAtPeriodEnd.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierBalsAtPeriodEnd.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -123,11 +123,12 @@ } /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - - echo '<tr> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table class="selection">'; + echo '<tr> <td>' . _('From Supplier Code') . ':</td> <td><input type="text" maxlength="6" size="7" name="FromCriteria" value="'.$_POST['FromCriteria'].'" /></td> </tr> @@ -137,7 +138,7 @@ </tr> <tr> <td>' . _('Balances As At') . ':</td> - <td><select Name="PeriodEnd">'; + <td><select name="PeriodEnd">'; $sql = "SELECT periodno, lastdate_in_period @@ -158,7 +159,8 @@ <div class="centre"> <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; - + echo '</div> + </form>'; include('includes/footer.inc'); }/*end of else not PrintPDF */ Modified: trunk/SupplierContacts.php =================================================================== --- trunk/SupplierContacts.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierContacts.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -143,7 +143,7 @@ echo '<table class="selection"> <tr> - <th colspan="7"><font size="3" color="navy">' . _('Contacts Defined for') . ' - ' . $myrow['suppname'] . '</font></th> + <th colspan="7"><h3>' . _('Contacts Defined for') . ' - ' . $myrow['suppname'] . '</h3></th> </tr>'; echo '<tr> @@ -159,9 +159,9 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href="mailto:%s">%s</td> - <td><a href="%s&SupplierID=%s&SelectedContact=%s">' . _('Edit') . '</td> - <td><a href="%s&SupplierID=%s&SelectedContact=%s&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this contact?') . '");\'>' . _('Delete') . '</td></tr>', + <td><a href="mailto:%s">%s</a></td> + <td><a href="%s&SupplierID=%s&SelectedContact=%s">' . _('Edit') . '</a></td> + <td><a href="%s&SupplierID=%s&SelectedContact=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this contact?') . '\');">' . _('Delete') . '</a></td></tr>', $myrow['contact'], $myrow['position'], $myrow['tel'], @@ -175,6 +175,7 @@ $SupplierID, $myrow['contact']); } while ($myrow = DB_fetch_array($result)); + echo '</table><br />'; } else { prnMsg(_('There are no contacts defined for this supplier'),'info'); } @@ -183,7 +184,6 @@ //end of ifs and buts! -echo '</table><br />'; if (isset($SelectedContact)) { echo '<div class="centre"> @@ -195,6 +195,7 @@ if (! isset($_GET['delete'])) { echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedContact)) { @@ -253,9 +254,9 @@ $_POST['Email'] = ''; } - echo '<input type="hidden" name="SupplierID" value="' . $SupplierID . '" /> - <tr> - <td>' . _('Position') . ':</td> + echo '<tr> + <td><input type="hidden" name="SupplierID" value="' . $SupplierID . '" /> + ' . _('Position') . ':</td> <td><input type="text" name="Position" size="31" maxlength="30" value="' . $_POST['Position'] . '" /></td> </tr> <tr> @@ -280,6 +281,7 @@ echo '<div class="centre"> <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> + </div> </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierCredit.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -266,28 +266,29 @@ </tr>'; echo '<tr> - <th><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></font></th> - <th><font color="blue"><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> - <td><font color="blue"><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> - <td><font color="blue"><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> + <th><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></th> + <th><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></th> + <td><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></td> + <td><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></td> </tr> </table>'; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" name="form1">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> <table class="selection">'; echo '<tr> - <td><font color="red">' . _('Supplier Credit Note Reference') . ':</font></td> - <td><font size="2"><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '" /></td>'; + <td style="color:red">' . _('Supplier Credit Note Reference') . ':</td> + <td><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '" /></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ $_SESSION['SuppTrans']->TranDate= Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } -echo '<td><font color="red">' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</font></td> +echo '<td style="color:red">' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" name="TranDate" value="' . $_SESSION['SuppTrans']->TranDate . '" /></td> - <td><font color=red>' . _('Exchange Rate') . ':</font></td> + <td style="color:red">' . _('Exchange Rate') . ':</td> <td><input type="text" class="number" size="11" maxlength="10" name="ExRate" value="' . locale_number_format($_SESSION['SuppTrans']->ExRate,'Variable') . '" /></td> </tr> </table>'; @@ -367,8 +368,8 @@ } echo '<tr> - <td class="number"><font color="red">' . _('Total Credited Against Shipments') . ':</font></td> - <td class="number"><font color="red"><U>' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td class="number" style="color:red">' . _('Total Credited Against Shipments') . ':</td> + <td class="number" style="color:red">' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table><br />'; } @@ -403,8 +404,8 @@ } echo '<tr> - <td colspan="2" class="number"><font color="red">' . _('Total') . ':</font></td> - <td class="number"><font color="red"><u>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="2" class="number" style="color:red">' . _('Total') . ':</td> + <td class="number" style="color:red">' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } //end loop around fixed assets @@ -440,7 +441,7 @@ } } - echo '<tr><td class="number" colspan="2"><font color="red">' . _('Total Credited against Contracts') . ':</font></td> + echo '<tr><td class="number" colspan="2" style="color:red">' . _('Total Credited against Contracts') . ':</td> <td class="number">' . locale_number_format($TotalContractsValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr></table><br />'; } @@ -482,8 +483,8 @@ } echo '<tr> - <td colspan="3" class="number"><font color="red">' . _('Total GL Analysis') . ':</font></td> - <td class="number"><font color="red"><u>' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="3" class="number" style="color:red">' . _('Total GL Analysis') . ':</td> + <td class="number" style="color:red">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table> <br />'; @@ -508,14 +509,14 @@ echo '<table class="selection"> <tr> - <td><font color="red">' . _('Credit Amount in Supplier Currency') . ':</font></td> - <td colspan="2" class="number">' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td></tr>'; - echo '<input type="hidden" name="OvAmount" value="' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; + <td style="color:red">' . _('Credit Amount in Supplier Currency') . ':</td> + <td colspan="2" class="number">' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces); + echo '<input type="hidden" name="OvAmount" value="' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" /></td></tr>'; } else { echo '<table class="selection"> <tr> - <td><font color="red">' . _('Credit Amount in Supplier Currency') . - ':</font></td> + <td style="color:red">' . _('Credit Amount in Supplier Currency') . + ':</td> <td colspan="2" class="number"><input type="text" size="12" maxlength="10" name="OvAmount" value="' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" /></td></tr>'; } @@ -588,7 +589,7 @@ $DisplayTotal = locale_number_format($_SESSION['SuppTrans']->OvAmount + $TaxTotal,$_SESSION['SuppTrans']->CurrDecimalPlaces); echo '<tr> - <td><font color="red">' . _('Credit Note Total') . '</font></td> + <td style="color:red">' . _('Credit Note Total') . '</td> <td colspan="2" class="number"><b>' . $DisplayTotal. '</b></td> </tr> </table> @@ -596,16 +597,15 @@ echo '<table class="selection"> <tr> - <td><font color="red">' . _('Comments') . '</font></td> + <td style="color:red">' . _('Comments') . '</td> <td><textarea name="Comments" cols="40" rows="2">' . $_SESSION['SuppTrans']->Comments . '</textarea></td> </tr> </table>'; -echo '<p> +echo '<br /> <div class="centre"> <input type="submit" name="PostCreditNote" value="' . _('Enter Credit Note') . '" /> - </div> - </p>'; + </div>'; if (isset($_POST['PostCreditNote'])){ @@ -1337,6 +1337,7 @@ } /*end of process credit note */ -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SupplierInquiry.php =================================================================== --- trunk/SupplierInquiry.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierInquiry.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -158,9 +158,11 @@ echo '<br /> <div class="centre"> <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Show all transactions after') . ': ' .'<input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="TransAfterDate" value="' . $_POST['TransAfterDate'] . '" maxlength="10" size="10" /> - <input type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '" /> + <input type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '" /> + </div> </form> <br />'; echo '</div>'; @@ -192,7 +194,7 @@ $TransResult = DB_query($SQL, $db, $ErrMsg, $DbgMsg); if (DB_num_rows($TransResult) == 0){ - echo '<p><div class="centre">' . _('There are no transactions to display since') . ' ' . $_POST['TransAfterDate']; + echo '<br /><div class="centre">' . _('There are no transactions to display since') . ' ' . $_POST['TransAfterDate']; echo '</div>'; include('includes/footer.inc'); exit; @@ -254,8 +256,8 @@ <td class="number">' . locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> <td class="number">' . locale_number_format($myrow['totalamount']-$myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> <td align="left">' . $myrow['transtext'] . '</td> - <td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['transno'] .'">' . _('View GL Postings') . '</a></td> - <td><a href="' . $rootpath . '/PaymentAllocations.php?SuppID=' . $myrow['supplierno'] . '&InvID=' . $myrow['suppreference'] .'">' . _('View Payments') . '</a></td> + <td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['transno'] .'">' . _('View GL Postings') . '</a></td> + <td><a href="' . $rootpath . '/PaymentAllocations.php?SuppID=' . $myrow['supplierno'] . '&InvID=' . $myrow['suppreference'] .'">' . _('View Payments') . '</a></td> </tr>'; } else { echo '<td>' . $myrow['transno'] . '</td> @@ -277,15 +279,15 @@ $AuthRow=DB_fetch_array($AuthResult); if ($AuthRow[0]==0) { - echo '<td><a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?HoldType=' . $myrow['type'] . '&HoldTrans=' . $myrow['transno']. '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'].'">' . $HoldValue .'</a></td>'; + echo '<td><a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?HoldType=' . $myrow['type'] . '&HoldTrans=' . $myrow['transno']. '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'].'">' . $HoldValue .'</a></td>'; } else { if ($HoldValue==_('Release')) { echo '<td>' . $HoldValue .'</a></td>'; } else { - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?' . 'HoldType=' . $myrow['type'] .'&HoldTrans=' . $myrow['transno'] . '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'] .'">'.$HoldValue .'</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?' . 'HoldType=' . $myrow['type'] .'&HoldTrans=' . $myrow['transno'] . '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'] .'">'.$HoldValue .'</a></td>'; } } - echo '<td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] .'&TransNo=' . $myrow['transno'] .'">' ._('View GL Postings') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] .'&TransNo=' . $myrow['transno'] .'">' ._('View GL Postings') . '</a></td></tr>'; } } else { @@ -321,8 +323,8 @@ <td class="number">%s</td> <td class="number">%s</td> <td align=left>%s</td> - <td><a href="%s?HoldType=%s&HoldTrans=%s&HoldStatus=%s&FromDate=%s">%s</a></td> - <td><a href="%s/PaymentAllocations.php?SuppID=%s&InvID=%s">' . _('View Payments') . '</a></tr>', + <td><a href="%s?HoldType=%s&HoldTrans=%s&HoldStatus=%s&FromDate=%s">%s</a></td> + <td><a href="%s/PaymentAllocations.php?SuppID=%s&InvID=%s">' . _('View Payments') . '</a></tr>', $myrow['transno'], $myrow['typename'], $myrow['suppreference'], @@ -356,7 +358,7 @@ <td class="number">%s</td> <td align="left">%s</td> <td><a href="%s/SupplierAllocations.php?AllocTrans=%s">' . _('View Allocations') . '</a></td> - <td><a target="_blank" href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Postings') . '</a></td> + <td><a target="_blank" href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Postings') . '</a></td> </tr>', $myrow['transno'], $myrow['typename'], Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierInvoice.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -238,15 +238,16 @@ </tr>'; echo '<tr> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . - $_SESSION['SuppTrans']->SupplierName . '</b></font></td> - <th><font color=blue><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> + <td><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . + $_SESSION['SuppTrans']->SupplierName . '</b></td> + <th><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></th> + <td><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></td> + <td><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></td> </tr> </table>'; - echo '<br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" name="form1" />'; + echo '<br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; @@ -313,8 +314,8 @@ } echo '<tr> - <td colspan="5" class="number"><font color="blue">' . _('Total Value of Goods Charged') . ':</font></td> - <td class="number"><font color="blue"><U>' . locale_number_format($TotalGRNValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td colspan="5" class="number" style="color:blue">' . _('Total Value of Goods Charged') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalGRNValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -353,8 +354,8 @@ } echo '<tr> - <td class="number"><font color="blue">' . _('Total shipment charges') . ':</font></td> - <td class="number"><font color="blue"><u>' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td class="number" style="color:blue">' . _('Total shipment charges') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -393,8 +394,8 @@ } echo '<tr> - <td colspan="2" class="number"><font color="blue">' . _('Total asset additions') . ':</font></td> - <td class="number"><font color="blue"><u>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="2" class="number" style="color:blue">' . _('Total asset additions') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } //end loop around assets added to invocie @@ -435,8 +436,8 @@ } echo '<tr> - <td colspan="2" class="number"><font color="blue">' . _('Total contract charges') . ':</font></td> - <td class="number"><font color="blue">' . locale_number_format($TotalContractsValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + <td colspan="2" class="number" style="color:blue">' . _('Total contract charges') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalContractsValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -473,8 +474,8 @@ } echo '<tr> - <td colspan="3" class="number"><font color="blue">' . _('Total GL Analysis') . ':</font></td> - <td class="number"><font color="blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + <td colspan="3" class="number" style="color:blue">' . _('Total GL Analysis') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -528,7 +529,7 @@ if (!isset($_POST['OverRideTax']) OR $_POST['OverRideTax']=='Auto'){ - echo ' <input type="text" class="number" name=TaxRate' . $Tax->TaxCalculationOrder . ' maxlength="4" size="4" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />%'; + echo ' <input type="text" class="number" name="TaxRate' . $Tax->TaxCalculationOrder . '" maxlength="4" size="4" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />%'; /*Now recaluclate the tax depending on the method */ if ($Tax->TaxOnTax ==1){ @@ -551,7 +552,7 @@ // } $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = filter_number_format($_POST['TaxAmount' . $Tax->TaxCalculationOrder]); - echo ' <input type="hidden" name="TaxRate"' . $Tax->TaxCalculationOrder . ' value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; + echo ' <input type="hidden" name="TaxRate' . $Tax->TaxCalculationOrder . '" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; echo '</td> <td><input type="text" class="number" size="12" maxlength="12" name="TaxAmount' . $Tax->TaxCalculationOrder . '" value="' . locale_number_format(round($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces),$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; @@ -585,6 +586,8 @@ <input type="submit" name="PostInvoice" value="' . _('Enter Invoice') . '" /> </div>'; + echo '</div> + </form>'; } else { // $_POST['PostInvoice'] is set so do the postings -and dont show the button to process /*First do input reasonableness checks @@ -1518,6 +1521,5 @@ echo '<div class="centre"><a href="'.$rootpath.'/SupplierInvoice.php" >'._('Back to Invoice Entry').'</a></div>'; } //end of return link for input errors -echo '</form>'; include('includes/footer.inc'); ?> Modified: trunk/SupplierPriceList.php =================================================================== --- trunk/SupplierPriceList.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierPriceList.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -8,6 +8,7 @@ if (isset($_POST['StockSearch'])) { echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" value="' . $_POST['SupplierID'] . '" name="SupplierID" />'; @@ -43,7 +44,7 @@ echo '<input type="search" name="Keywords" size="34" maxlength="25" placeholder="Enter part of the item description" />'; } echo '</td></tr><tr><td></td>'; - echo '<td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; + echo '<td><b>' . _('OR') . ' ' . '</b>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; echo '<td>'; if (isset($_POST['StockCode'])) { echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" />'; @@ -53,7 +54,8 @@ echo '</td></tr></table><br />'; echo '<div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /></div><br />'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>'; - echo '</form>'; + echo '</div> + </form>'; include('includes/footer.inc'); exit; } @@ -211,6 +213,7 @@ if (isset($searchresult) AND !isset($_POST['Select'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Inventory Items'). '</p>'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" value="' . $_POST['SupplierID'] . '" name="SupplierID" />'; $ListCount = DB_num_rows($searchresult); @@ -281,7 +284,10 @@ //end of page full new headings if } //end of while loop - echo '</table></form><br />'; + echo '</table> + <br /> + </div> + </form>'; include('includes/footer.inc'); exit; } @@ -380,16 +386,20 @@ } if (!isset($_POST['SearchSupplier'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . _('Search for a supplier') . '</p><br />'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post"> - <table cellpadding="3" class="selection"><tr>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table cellpadding="3" class="selection"><tr>'; + echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</td>'; echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; - echo '<td><font size="3"><b>' . _('OR') . '</b></font></td>'; - echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; + echo '<td><b>' . _('OR') . '</b></td>'; + echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</td>'; echo '<td><input type="text" name="SupplierCode" size="15" maxlength="18" /></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /></div></form>'; + echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /></div>'; + echo '</div> + </form>'; include ('includes/footer.inc'); exit; }; @@ -427,9 +437,11 @@ if (isset($SuppliersResult)) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . _('Select a supplier') . '</p><br />'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post"> - <table cellpadding="2" class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table cellpadding="2" class="selection">'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> @@ -447,12 +459,12 @@ echo '<tr class="OddTableRows">'; $k++; } - printf('<td><font size="1"><input type="submit" name="SupplierID" value="%s" /></font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> + printf('<td><input type="submit" name="SupplierID" value="%s" /></td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> </tr>', $myrow['supplierid'], $myrow['suppname'], @@ -464,7 +476,10 @@ } //end of while loop - echo '</table><br/></form>'; + echo '</table> + <br/> + </div> + </form>'; include('includes/footer.inc'); exit; } @@ -473,6 +488,7 @@ if (isset($_POST['SupplierID'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . _('Supplier Purchasing Data') . '</p><br />'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $SQL="SELECT purchdata.stockid, stockmaster.description, @@ -499,9 +515,9 @@ $UOMResult = DB_query($UOMSQL, $db); echo '<input type="hidden" value="' . $_POST['SupplierID'] . '" name="SupplierID" />'; echo '<table class="selection">'; - echo '<tr><th colspan="8" style="text-align: left"><font color="navy" size="3">' . _('Supplier purchasing data for') . ' ' . $_POST['SupplierID'] . '</font></th>'; - echo '<th colspan="5" style="text-align: right"><font color="navy" size="2">' . _('Find new Item Code') . '</font> - <button type="submit" name="StockSearch"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" /></button></th></tr>'; + echo '<tr><th colspan="8" style="text-align: left"><h3>' . _('Supplier purchasing data for') . ' ' . $_POST['SupplierID'] . '</h3></th>'; + echo '<th colspan="5" style="text-align: right">' . _('Find new Item Code') . ' + <button type="submit" name="StockSearch"><img width="15" src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" alt="" /></button></th></tr>'; echo '<tr> <th>' . _('StockID') . '</th> <th>' . _('Description') . '</th> @@ -541,7 +557,7 @@ echo '<td><input type="text" class="date" size="11" value="' . date( $_SESSION['DefaultDateFormat']) . '" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom0" /></td> <td><input type="text" size="20" maxlength="50" value="" name="SupplierPartNo0" /></td> <td><input type="text" class="number" size="11" value="1" name="MinOrderQty0" /></td> - <td><button type="submit" style="width:100%;text-align:left" name="Insert"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" /></button></td> + <td><button type="submit" style="width:100%;text-align:left" name="Insert"><img width="15" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" alt="" /></button></td> </tr>'; } @@ -572,12 +588,13 @@ echo '<td><input type="text" class="date" size="11" value="' . ConvertSQLDate($myrow['effectivefrom']) . '" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom'.$RowCounter.'" /></td> <td><input type="text" size="20" maxlength="50" value="' . $myrow['suppliers_partno'] . '" name="SupplierPartNo'.$RowCounter.'" /></td> <td><input type="text" class="number" size="11" value="' . $myrow['minorderqty'] . '" name="MinOrderQty'.$RowCounter.'" /></td> - <td><button type="submit" style="width:100%;text-align:left" name="Update'.$RowCounter.'"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" /></button></td> + <td><button type="submit" style="width:100%;text-align:left" name="Update'.$RowCounter.'"><img width="15" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" alt="" /></button></td> </tr>'; $RowCounter++; } echo '</table>'; - echo '</form>'; + echo '</div> + </form>'; include('includes/footer.inc'); exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-23 03:06:08
|
Revision: 5276 http://web-erp.svn.sourceforge.net/web-erp/?rev=5276&view=rev Author: vvs2012 Date: 2012-04-23 03:06:00 +0000 (Mon, 23 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/SupplierAllocations.php trunk/SupplierBalsAtPeriodEnd.php trunk/SupplierContacts.php trunk/SupplierCredit.php trunk/SupplierInquiry.php trunk/SupplierInvoice.php trunk/SupplierPriceList.php Modified: trunk/SupplierAllocations.php =================================================================== --- trunk/SupplierAllocations.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierAllocations.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -264,6 +264,7 @@ for allocating to */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_POST['SupplierID'])){ @@ -591,7 +592,7 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><a href="%sAllocTrans=%s">' . _('Allocate') .'</td> + <td><a href="%sAllocTrans=%s">' . _('Allocate') .'</a></td> </tr>', $myrow['typename'], $myrow['suppname'], @@ -667,7 +668,7 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><a href="%sAllocTrans=%s">' . _('Allocate') . '</td> + <td><a href="%sAllocTrans=%s">' . _('Allocate') . '</a></td> </tr>', $myrow['typename'], $myrow['suppname'], @@ -689,6 +690,7 @@ } /* end of else if not a SupplierID or transaction called with the URL */ -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SupplierBalsAtPeriodEnd.php =================================================================== --- trunk/SupplierBalsAtPeriodEnd.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierBalsAtPeriodEnd.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -123,11 +123,12 @@ } /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - - echo '<tr> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table class="selection">'; + echo '<tr> <td>' . _('From Supplier Code') . ':</td> <td><input type="text" maxlength="6" size="7" name="FromCriteria" value="'.$_POST['FromCriteria'].'" /></td> </tr> @@ -137,7 +138,7 @@ </tr> <tr> <td>' . _('Balances As At') . ':</td> - <td><select Name="PeriodEnd">'; + <td><select name="PeriodEnd">'; $sql = "SELECT periodno, lastdate_in_period @@ -158,7 +159,8 @@ <div class="centre"> <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; - + echo '</div> + </form>'; include('includes/footer.inc'); }/*end of else not PrintPDF */ Modified: trunk/SupplierContacts.php =================================================================== --- trunk/SupplierContacts.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierContacts.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -143,7 +143,7 @@ echo '<table class="selection"> <tr> - <th colspan="7"><font size="3" color="navy">' . _('Contacts Defined for') . ' - ' . $myrow['suppname'] . '</font></th> + <th colspan="7"><h3>' . _('Contacts Defined for') . ' - ' . $myrow['suppname'] . '</h3></th> </tr>'; echo '<tr> @@ -159,9 +159,9 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href="mailto:%s">%s</td> - <td><a href="%s&SupplierID=%s&SelectedContact=%s">' . _('Edit') . '</td> - <td><a href="%s&SupplierID=%s&SelectedContact=%s&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this contact?') . '");\'>' . _('Delete') . '</td></tr>', + <td><a href="mailto:%s">%s</a></td> + <td><a href="%s&SupplierID=%s&SelectedContact=%s">' . _('Edit') . '</a></td> + <td><a href="%s&SupplierID=%s&SelectedContact=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this contact?') . '\');">' . _('Delete') . '</a></td></tr>', $myrow['contact'], $myrow['position'], $myrow['tel'], @@ -175,6 +175,7 @@ $SupplierID, $myrow['contact']); } while ($myrow = DB_fetch_array($result)); + echo '</table><br />'; } else { prnMsg(_('There are no contacts defined for this supplier'),'info'); } @@ -183,7 +184,6 @@ //end of ifs and buts! -echo '</table><br />'; if (isset($SelectedContact)) { echo '<div class="centre"> @@ -195,6 +195,7 @@ if (! isset($_GET['delete'])) { echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedContact)) { @@ -253,9 +254,9 @@ $_POST['Email'] = ''; } - echo '<input type="hidden" name="SupplierID" value="' . $SupplierID . '" /> - <tr> - <td>' . _('Position') . ':</td> + echo '<tr> + <td><input type="hidden" name="SupplierID" value="' . $SupplierID . '" /> + ' . _('Position') . ':</td> <td><input type="text" name="Position" size="31" maxlength="30" value="' . $_POST['Position'] . '" /></td> </tr> <tr> @@ -280,6 +281,7 @@ echo '<div class="centre"> <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> + </div> </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierCredit.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -266,28 +266,29 @@ </tr>'; echo '<tr> - <th><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></font></th> - <th><font color="blue"><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> - <td><font color="blue"><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> - <td><font color="blue"><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> + <th><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></th> + <th><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></th> + <td><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></td> + <td><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></td> </tr> </table>'; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" name="form1">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> <table class="selection">'; echo '<tr> - <td><font color="red">' . _('Supplier Credit Note Reference') . ':</font></td> - <td><font size="2"><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '" /></td>'; + <td style="color:red">' . _('Supplier Credit Note Reference') . ':</td> + <td><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '" /></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ $_SESSION['SuppTrans']->TranDate= Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } -echo '<td><font color="red">' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</font></td> +echo '<td style="color:red">' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" name="TranDate" value="' . $_SESSION['SuppTrans']->TranDate . '" /></td> - <td><font color=red>' . _('Exchange Rate') . ':</font></td> + <td style="color:red">' . _('Exchange Rate') . ':</td> <td><input type="text" class="number" size="11" maxlength="10" name="ExRate" value="' . locale_number_format($_SESSION['SuppTrans']->ExRate,'Variable') . '" /></td> </tr> </table>'; @@ -367,8 +368,8 @@ } echo '<tr> - <td class="number"><font color="red">' . _('Total Credited Against Shipments') . ':</font></td> - <td class="number"><font color="red"><U>' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td class="number" style="color:red">' . _('Total Credited Against Shipments') . ':</td> + <td class="number" style="color:red">' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table><br />'; } @@ -403,8 +404,8 @@ } echo '<tr> - <td colspan="2" class="number"><font color="red">' . _('Total') . ':</font></td> - <td class="number"><font color="red"><u>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="2" class="number" style="color:red">' . _('Total') . ':</td> + <td class="number" style="color:red">' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } //end loop around fixed assets @@ -440,7 +441,7 @@ } } - echo '<tr><td class="number" colspan="2"><font color="red">' . _('Total Credited against Contracts') . ':</font></td> + echo '<tr><td class="number" colspan="2" style="color:red">' . _('Total Credited against Contracts') . ':</td> <td class="number">' . locale_number_format($TotalContractsValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr></table><br />'; } @@ -482,8 +483,8 @@ } echo '<tr> - <td colspan="3" class="number"><font color="red">' . _('Total GL Analysis') . ':</font></td> - <td class="number"><font color="red"><u>' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="3" class="number" style="color:red">' . _('Total GL Analysis') . ':</td> + <td class="number" style="color:red">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table> <br />'; @@ -508,14 +509,14 @@ echo '<table class="selection"> <tr> - <td><font color="red">' . _('Credit Amount in Supplier Currency') . ':</font></td> - <td colspan="2" class="number">' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td></tr>'; - echo '<input type="hidden" name="OvAmount" value="' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; + <td style="color:red">' . _('Credit Amount in Supplier Currency') . ':</td> + <td colspan="2" class="number">' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces); + echo '<input type="hidden" name="OvAmount" value="' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" /></td></tr>'; } else { echo '<table class="selection"> <tr> - <td><font color="red">' . _('Credit Amount in Supplier Currency') . - ':</font></td> + <td style="color:red">' . _('Credit Amount in Supplier Currency') . + ':</td> <td colspan="2" class="number"><input type="text" size="12" maxlength="10" name="OvAmount" value="' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" /></td></tr>'; } @@ -588,7 +589,7 @@ $DisplayTotal = locale_number_format($_SESSION['SuppTrans']->OvAmount + $TaxTotal,$_SESSION['SuppTrans']->CurrDecimalPlaces); echo '<tr> - <td><font color="red">' . _('Credit Note Total') . '</font></td> + <td style="color:red">' . _('Credit Note Total') . '</td> <td colspan="2" class="number"><b>' . $DisplayTotal. '</b></td> </tr> </table> @@ -596,16 +597,15 @@ echo '<table class="selection"> <tr> - <td><font color="red">' . _('Comments') . '</font></td> + <td style="color:red">' . _('Comments') . '</td> <td><textarea name="Comments" cols="40" rows="2">' . $_SESSION['SuppTrans']->Comments . '</textarea></td> </tr> </table>'; -echo '<p> +echo '<br /> <div class="centre"> <input type="submit" name="PostCreditNote" value="' . _('Enter Credit Note') . '" /> - </div> - </p>'; + </div>'; if (isset($_POST['PostCreditNote'])){ @@ -1337,6 +1337,7 @@ } /*end of process credit note */ -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SupplierInquiry.php =================================================================== --- trunk/SupplierInquiry.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierInquiry.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -158,9 +158,11 @@ echo '<br /> <div class="centre"> <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Show all transactions after') . ': ' .'<input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="TransAfterDate" value="' . $_POST['TransAfterDate'] . '" maxlength="10" size="10" /> - <input type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '" /> + <input type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '" /> + </div> </form> <br />'; echo '</div>'; @@ -192,7 +194,7 @@ $TransResult = DB_query($SQL, $db, $ErrMsg, $DbgMsg); if (DB_num_rows($TransResult) == 0){ - echo '<p><div class="centre">' . _('There are no transactions to display since') . ' ' . $_POST['TransAfterDate']; + echo '<br /><div class="centre">' . _('There are no transactions to display since') . ' ' . $_POST['TransAfterDate']; echo '</div>'; include('includes/footer.inc'); exit; @@ -254,8 +256,8 @@ <td class="number">' . locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> <td class="number">' . locale_number_format($myrow['totalamount']-$myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> <td align="left">' . $myrow['transtext'] . '</td> - <td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['transno'] .'">' . _('View GL Postings') . '</a></td> - <td><a href="' . $rootpath . '/PaymentAllocations.php?SuppID=' . $myrow['supplierno'] . '&InvID=' . $myrow['suppreference'] .'">' . _('View Payments') . '</a></td> + <td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['transno'] .'">' . _('View GL Postings') . '</a></td> + <td><a href="' . $rootpath . '/PaymentAllocations.php?SuppID=' . $myrow['supplierno'] . '&InvID=' . $myrow['suppreference'] .'">' . _('View Payments') . '</a></td> </tr>'; } else { echo '<td>' . $myrow['transno'] . '</td> @@ -277,15 +279,15 @@ $AuthRow=DB_fetch_array($AuthResult); if ($AuthRow[0]==0) { - echo '<td><a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?HoldType=' . $myrow['type'] . '&HoldTrans=' . $myrow['transno']. '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'].'">' . $HoldValue .'</a></td>'; + echo '<td><a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?HoldType=' . $myrow['type'] . '&HoldTrans=' . $myrow['transno']. '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'].'">' . $HoldValue .'</a></td>'; } else { if ($HoldValue==_('Release')) { echo '<td>' . $HoldValue .'</a></td>'; } else { - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?' . 'HoldType=' . $myrow['type'] .'&HoldTrans=' . $myrow['transno'] . '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'] .'">'.$HoldValue .'</a></td>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?' . 'HoldType=' . $myrow['type'] .'&HoldTrans=' . $myrow['transno'] . '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'] .'">'.$HoldValue .'</a></td>'; } } - echo '<td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] .'&TransNo=' . $myrow['transno'] .'">' ._('View GL Postings') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] .'&TransNo=' . $myrow['transno'] .'">' ._('View GL Postings') . '</a></td></tr>'; } } else { @@ -321,8 +323,8 @@ <td class="number">%s</td> <td class="number">%s</td> <td align=left>%s</td> - <td><a href="%s?HoldType=%s&HoldTrans=%s&HoldStatus=%s&FromDate=%s">%s</a></td> - <td><a href="%s/PaymentAllocations.php?SuppID=%s&InvID=%s">' . _('View Payments') . '</a></tr>', + <td><a href="%s?HoldType=%s&HoldTrans=%s&HoldStatus=%s&FromDate=%s">%s</a></td> + <td><a href="%s/PaymentAllocations.php?SuppID=%s&InvID=%s">' . _('View Payments') . '</a></tr>', $myrow['transno'], $myrow['typename'], $myrow['suppreference'], @@ -356,7 +358,7 @@ <td class="number">%s</td> <td align="left">%s</td> <td><a href="%s/SupplierAllocations.php?AllocTrans=%s">' . _('View Allocations') . '</a></td> - <td><a target="_blank" href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Postings') . '</a></td> + <td><a target="_blank" href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Postings') . '</a></td> </tr>', $myrow['transno'], $myrow['typename'], Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierInvoice.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -238,15 +238,16 @@ </tr>'; echo '<tr> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . - $_SESSION['SuppTrans']->SupplierName . '</b></font></td> - <th><font color=blue><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></font></th> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></font></td> - <td><font color=blue><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></font></td> + <td><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . + $_SESSION['SuppTrans']->SupplierName . '</b></td> + <th><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></th> + <td><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></td> + <td><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></td> </tr> </table>'; - echo '<br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" name="form1" />'; + echo '<br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; @@ -313,8 +314,8 @@ } echo '<tr> - <td colspan="5" class="number"><font color="blue">' . _('Total Value of Goods Charged') . ':</font></td> - <td class="number"><font color="blue"><U>' . locale_number_format($TotalGRNValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</U></font></td> + <td colspan="5" class="number" style="color:blue">' . _('Total Value of Goods Charged') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalGRNValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -353,8 +354,8 @@ } echo '<tr> - <td class="number"><font color="blue">' . _('Total shipment charges') . ':</font></td> - <td class="number"><font color="blue"><u>' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td class="number" style="color:blue">' . _('Total shipment charges') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalShiptValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -393,8 +394,8 @@ } echo '<tr> - <td colspan="2" class="number"><font color="blue">' . _('Total asset additions') . ':</font></td> - <td class="number"><font color="blue"><u>' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="2" class="number" style="color:blue">' . _('Total asset additions') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalAssetValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } //end loop around assets added to invocie @@ -435,8 +436,8 @@ } echo '<tr> - <td colspan="2" class="number"><font color="blue">' . _('Total contract charges') . ':</font></td> - <td class="number"><font color="blue">' . locale_number_format($TotalContractsValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + <td colspan="2" class="number" style="color:blue">' . _('Total contract charges') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalContractsValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -473,8 +474,8 @@ } echo '<tr> - <td colspan="3" class="number"><font color="blue">' . _('Total GL Analysis') . ':</font></td> - <td class="number"><font color="blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</font></td> + <td colspan="3" class="number" style="color:blue">' . _('Total GL Analysis') . ':</td> + <td class="number" style="color:blue">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; } @@ -528,7 +529,7 @@ if (!isset($_POST['OverRideTax']) OR $_POST['OverRideTax']=='Auto'){ - echo ' <input type="text" class="number" name=TaxRate' . $Tax->TaxCalculationOrder . ' maxlength="4" size="4" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />%'; + echo ' <input type="text" class="number" name="TaxRate' . $Tax->TaxCalculationOrder . '" maxlength="4" size="4" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />%'; /*Now recaluclate the tax depending on the method */ if ($Tax->TaxOnTax ==1){ @@ -551,7 +552,7 @@ // } $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = filter_number_format($_POST['TaxAmount' . $Tax->TaxCalculationOrder]); - echo ' <input type="hidden" name="TaxRate"' . $Tax->TaxCalculationOrder . ' value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; + echo ' <input type="hidden" name="TaxRate' . $Tax->TaxCalculationOrder . '" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; echo '</td> <td><input type="text" class="number" size="12" maxlength="12" name="TaxAmount' . $Tax->TaxCalculationOrder . '" value="' . locale_number_format(round($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces),$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />'; @@ -585,6 +586,8 @@ <input type="submit" name="PostInvoice" value="' . _('Enter Invoice') . '" /> </div>'; + echo '</div> + </form>'; } else { // $_POST['PostInvoice'] is set so do the postings -and dont show the button to process /*First do input reasonableness checks @@ -1518,6 +1521,5 @@ echo '<div class="centre"><a href="'.$rootpath.'/SupplierInvoice.php" >'._('Back to Invoice Entry').'</a></div>'; } //end of return link for input errors -echo '</form>'; include('includes/footer.inc'); ?> Modified: trunk/SupplierPriceList.php =================================================================== --- trunk/SupplierPriceList.php 2012-04-23 02:34:38 UTC (rev 5275) +++ trunk/SupplierPriceList.php 2012-04-23 03:06:00 UTC (rev 5276) @@ -8,6 +8,7 @@ if (isset($_POST['StockSearch'])) { echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" value="' . $_POST['SupplierID'] . '" name="SupplierID" />'; @@ -43,7 +44,7 @@ echo '<input type="search" name="Keywords" size="34" maxlength="25" placeholder="Enter part of the item description" />'; } echo '</td></tr><tr><td></td>'; - echo '<td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; + echo '<td><b>' . _('OR') . ' ' . '</b>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; echo '<td>'; if (isset($_POST['StockCode'])) { echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" />'; @@ -53,7 +54,8 @@ echo '</td></tr></table><br />'; echo '<div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /></div><br />'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>'; - echo '</form>'; + echo '</div> + </form>'; include('includes/footer.inc'); exit; } @@ -211,6 +213,7 @@ if (isset($searchresult) AND !isset($_POST['Select'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Inventory Items'). '</p>'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" value="' . $_POST['SupplierID'] . '" name="SupplierID" />'; $ListCount = DB_num_rows($searchresult); @@ -281,7 +284,10 @@ //end of page full new headings if } //end of while loop - echo '</table></form><br />'; + echo '</table> + <br /> + </div> + </form>'; include('includes/footer.inc'); exit; } @@ -380,16 +386,20 @@ } if (!isset($_POST['SearchSupplier'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . _('Search for a supplier') . '</p><br />'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post"> - <table cellpadding="3" class="selection"><tr>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table cellpadding="3" class="selection"><tr>'; + echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</td>'; echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; - echo '<td><font size="3"><b>' . _('OR') . '</b></font></td>'; - echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; + echo '<td><b>' . _('OR') . '</b></td>'; + echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</td>'; echo '<td><input type="text" name="SupplierCode" size="15" maxlength="18" /></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /></div></form>'; + echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '" /></div>'; + echo '</div> + </form>'; include ('includes/footer.inc'); exit; }; @@ -427,9 +437,11 @@ if (isset($SuppliersResult)) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . _('Select a supplier') . '</p><br />'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post"> - <table cellpadding="2" class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table cellpadding="2" class="selection">'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> @@ -447,12 +459,12 @@ echo '<tr class="OddTableRows">'; $k++; } - printf('<td><font size="1"><input type="submit" name="SupplierID" value="%s" /></font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> - <td><font size="1">%s</font></td> + printf('<td><input type="submit" name="SupplierID" value="%s" /></td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> </tr>', $myrow['supplierid'], $myrow['suppname'], @@ -464,7 +476,10 @@ } //end of while loop - echo '</table><br/></form>'; + echo '</table> + <br/> + </div> + </form>'; include('includes/footer.inc'); exit; } @@ -473,6 +488,7 @@ if (isset($_POST['SupplierID'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="" />' . _('Supplier Purchasing Data') . '</p><br />'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $SQL="SELECT purchdata.stockid, stockmaster.description, @@ -499,9 +515,9 @@ $UOMResult = DB_query($UOMSQL, $db); echo '<input type="hidden" value="' . $_POST['SupplierID'] . '" name="SupplierID" />'; echo '<table class="selection">'; - echo '<tr><th colspan="8" style="text-align: left"><font color="navy" size="3">' . _('Supplier purchasing data for') . ' ' . $_POST['SupplierID'] . '</font></th>'; - echo '<th colspan="5" style="text-align: right"><font color="navy" size="2">' . _('Find new Item Code') . '</font> - <button type="submit" name="StockSearch"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" /></button></th></tr>'; + echo '<tr><th colspan="8" style="text-align: left"><h3>' . _('Supplier purchasing data for') . ' ' . $_POST['SupplierID'] . '</h3></th>'; + echo '<th colspan="5" style="text-align: right">' . _('Find new Item Code') . ' + <button type="submit" name="StockSearch"><img width="15" src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" alt="" /></button></th></tr>'; echo '<tr> <th>' . _('StockID') . '</th> <th>' . _('Description') . '</th> @@ -541,7 +557,7 @@ echo '<td><input type="text" class="date" size="11" value="' . date( $_SESSION['DefaultDateFormat']) . '" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom0" /></td> <td><input type="text" size="20" maxlength="50" value="" name="SupplierPartNo0" /></td> <td><input type="text" class="number" size="11" value="1" name="MinOrderQty0" /></td> - <td><button type="submit" style="width:100%;text-align:left" name="Insert"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" /></button></td> + <td><button type="submit" style="width:100%;text-align:left" name="Insert"><img width="15" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" alt="" /></button></td> </tr>'; } @@ -572,12 +588,13 @@ echo '<td><input type="text" class="date" size="11" value="' . ConvertSQLDate($myrow['effectivefrom']) . '" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom'.$RowCounter.'" /></td> <td><input type="text" size="20" maxlength="50" value="' . $myrow['suppliers_partno'] . '" name="SupplierPartNo'.$RowCounter.'" /></td> <td><input type="text" class="number" size="11" value="' . $myrow['minorderqty'] . '" name="MinOrderQty'.$RowCounter.'" /></td> - <td><button type="submit" style="width:100%;text-align:left" name="Update'.$RowCounter.'"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" /></button></td> + <td><button type="submit" style="width:100%;text-align:left" name="Update'.$RowCounter.'"><img width="15" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" alt="" /></button></td> </tr>'; $RowCounter++; } echo '</table>'; - echo '</form>'; + echo '</div> + </form>'; include('includes/footer.inc'); exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-24 09:46:09
|
Revision: 5277 http://web-erp.svn.sourceforge.net/web-erp/?rev=5277&view=rev Author: daintree Date: 2012-04-24 09:45:59 +0000 (Tue, 24 Apr 2012) Log Message: ----------- insert of blank item code fixed Modified Paths: -------------- trunk/CopyBOM.php trunk/Labels.php trunk/companies/weberpdemo/reportwriter/labels.xml trunk/doc/Change.log Modified: trunk/CopyBOM.php =================================================================== --- trunk/CopyBOM.php 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/CopyBOM.php 2012-04-24 09:45:59 UTC (rev 5277) @@ -15,135 +15,142 @@ include('includes/SQL_CommonFunctions.inc'); if(isset($_POST['Submit'])) { - $stkid = $_POST['stkid']; - $type = $_POST['type']; - $newstkid = ''; - - if($type == 'N') { - $newstkid = $_POST['tostkid']; + $StockID = $_POST['StockID']; + $NewOrExisting = $_POST['NewOrExisting']; + $NewStockID = ''; + $InputError = 0; //assume the best + + if($NewOrExisting == 'N') { + $NewStockID = $_POST['ToStockID']; + if (mb_strlen($NewStockID)==0 OR $NewStockID==''){ + $InputError = 1; + prnMsg(_('The new item code cannot be blank. Enter a new code for the item to copy the BOM to'),'error'); + } } else { - $newstkid = $_POST['exstkid']; + $NewStockID = $_POST['ExStockID']; } + if ($InputError==0){ + $result = DB_Txn_Begin($db); - $result = DB_query("begin", $db); - - if($type == 'N') { - /* duplicate rows into stockmaster */ - $sql = "INSERT INTO stockmaster( stockid, - categoryid, - description, - longdescription, - units, - mbflag, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid, - serialised, - appendfile, - perishable, - decimalplaces, - nextserialno, - pansize, - shrinkfactor, - netweight ) - SELECT '".$newstkid."' AS stockid, - categoryid, - description, - longdescription, - units, - mbflag, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid, - serialised, - appendfile, - perishable, - decimalplaces, - nextserialno, - pansize, - shrinkfactor, - netweight + if($NewOrExisting == 'N') { + /* duplicate rows into stockmaster */ + $sql = "INSERT INTO stockmaster( stockid, + categoryid, + description, + longdescription, + units, + mbflag, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid, + serialised, + appendfile, + perishable, + decimalplaces, + nextserialno, + pansize, + shrinkfactor, + netweight ) + SELECT '".$NewStockID."' AS stockid, + categoryid, + description, + longdescription, + units, + mbflag, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid, + serialised, + appendfile, + perishable, + decimalplaces, + nextserialno, + pansize, + shrinkfactor, + netweight + FROM stockmaster + WHERE stockid='".$StockID."';"; + $result = DB_query($sql, $db); + } else { + $sql = "SELECT lastcostupdate, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel FROM stockmaster - WHERE stockid='".$stkid."';"; + WHERE stockid='".$StockID."';"; + $result = DB_query($sql, $db); + + $myrow = DB_fetch_row($result); + + $sql = "UPDATE stockmaster set + lastcostupdate = " . $myrow[0] . ", + actualcost = " . $myrow[1] . ", + lastcost = " . $myrow[2] . ", + materialcost = " . $myrow[3] . ", + labourcost = " . $myrow[4] . ", + overheadcost = " . $myrow[5] . ", + lowestlevel = " . $myrow[6] . " + WHERE stockid='".$NewStockID."';"; + $result = DB_query($sql, $db); + } + + $sql = "INSERT INTO bom + SELECT '".$NewStockID."' AS parent, + component, + workcentreadded, + loccode, + effectiveafter, + effectiveto, + quantity, + autoissue + FROM bom + WHERE parent='".$StockID."';"; $result = DB_query($sql, $db); - } else { - $sql = "SELECT lastcurcostdate, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel - FROM stockmaster - WHERE stockid='".$stkid."';"; - $result = DB_query($sql, $db); - - $row = DB_fetch_row($result); - - $sql = "UPDATE stockmaster set - lastcurcostdate = '".$row[0]."', - actualcost = ".$row[1].", - lastcost = ".$row[2].", - materialcost = ".$row[3].", - labourcost = ".$row[4].", - overheadcost = ".$row[5].", - lowestlevel = ".$row[6]." - WHERE stockid='".$newstkid."';"; - $result = DB_query($sql, $db); - } - - $sql = "INSERT INTO bom - SELECT '".$newstkid."' AS parent, - component, - workcentreadded, - loccode, - effectiveafter, - effectiveto, - quantity, - autoissue - FROM bom - WHERE parent='".$stkid."';"; - $result = DB_query($sql, $db); - - if($type == 'N') { - $sql = "INSERT INTO locstock - SELECT loccode, - '".$newstkid."' AS stockid, - 0 AS quantity, - reorderlevel - FROM locstock - WHERE stockid='".$stkid."';"; - $result = DB_query($sql, $db); - } - - $result = DB_query('commit', $db); - - UpdateCost($db, $newstkid); - - header('Location: BOMs.php?Select='.$newstkid); - ob_end_flush(); + + if($NewOrExisting == 'N') { + $sql = "INSERT INTO locstock + SELECT loccode, + '".$NewStockID."' AS stockid, + 0 AS quantity, + reorderlevel + FROM locstock + WHERE stockid='".$StockID."'"; + + $result = DB_query($sql, $db); + } + + $result = DB_Txn_Commit($db); + + UpdateCost($db, $NewStockID); + + header('Location: BOMs.php?Select='.$NewStockID); + ob_end_flush(); + } //end if there is no input error } else { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Contract') . '" alt="" />' . ' ' . $title . '</p>'; @@ -156,35 +163,35 @@ description FROM stockmaster WHERE stockid IN (SELECT DISTINCT parent FROM bom) - AND mbflag IN ('M', 'A', 'K');"; + AND mbflag IN ('M', 'A', 'K', 'G');"; $result = DB_query($sql, $db); echo '<table class="selection"> <tr> <td>' . _('From Stock ID') . '</td>'; - echo '<td><select name="stkid">'; - while($row = DB_fetch_row($result)) { - echo '<option value="'.$row[0].'">'.$row[0].' -- '.$row[1].'</option>'; + echo '<td><select name="StockID">'; + while($myrow = DB_fetch_row($result)) { + echo '<option value="'.$myrow[0].'">'.$myrow[0].' -- '.$myrow[1].'</option>'; } echo '</select></td> </tr>'; echo '<tr> - <td><input type="radio" name="type" value="N" />' . _(' To New Stock ID') . '</td>'; - echo '<td><input type="text" maxlength="20" name="tostkid" /></td></tr>'; + <td><input type="radio" name="NewOrExisting" value="N" />' . _(' To New Stock ID') . '</td>'; + echo '<td><input type="text" maxlength="20" name="ToStockID" /></td></tr>'; $sql = "SELECT stockid, description FROM stockmaster WHERE stockid NOT IN (SELECT DISTINCT parent FROM bom) - AND mbflag IN ('M', 'A', 'K');"; + AND mbflag IN ('M', 'A', 'K', 'G');"; $result = DB_query($sql, $db); if (DB_num_rows($result) > 0) { echo '<tr> - <td><input type="radio" name="type" value="E" />'._('To Existing Stock ID') . '</td><td>'; - echo '<select name="exstkid">'; - while($row = DB_fetch_row($result)) { - echo '<option value="'.$row[0].'">'.$row[0].' -- '.$row[1].'</option>'; + <td><input type="radio" name="NewOrExisting" value="E" />'._('To Existing Stock ID') . '</td><td>'; + echo '<select name="ExStockID">'; + while($myrow = DB_fetch_row($result)) { + echo '<option value="'.$myrow[0].'">'.$myrow[0].' -- '.$myrow[1].'</option>'; } echo '</select></td></tr>'; } Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/Labels.php 2012-04-24 09:45:59 UTC (rev 5277) @@ -7,12 +7,22 @@ * @version 1.1 * Last changes: 2010-08-31 * + * + * Phil's notes: + * This is an example of clever code that works but IMHO is very hard to decipher and modify - sorry Marcos! + * It is in webERP because it fulfills a useful function on its own but don't expect to be able to modify it!! + * I would prefer this code was re-written in a manner consistent with the rest of webERP + * There are many meaningless variable names + * unecessary abrastaction at every turn + * No class is necessary for this script IMHO + * Data held in an xml file instead of the database + * Variable naming uses a lower case first character + * $debug is used - but is a webERP global to trap SQL errors for sysadmins + * **/ $Version_adds= 1.1; -/** Error reporting */ - include('includes/session.inc'); $title=_('Label Templates Maintainance'); include('includes/header.inc'); @@ -20,8 +30,11 @@ $debug=false; include('includes/DefineLabelClass.php'); + +//Phil why xml? Why not use the database like every other part of webERP for storing data + $allLabels = //!< The variable $allLabels is the global variable that contains the list - getXMLFile(LABELS_FILE); //!< of all the label objects defined until now. In case of a fresh + getXMLFile($_SESSION['reports_dir'] . '/labels.xml'); //!< of all the label objects defined until now. In case of a fresh //!< installation or an empty XML labels file it holds a NULL value. if ($debug) { @@ -41,6 +54,7 @@ */ if (isset($_POST['Update'])) { // Get the data from the user input & validate it (not new) + //getData function $Label=getData($_POST, false, $ok); // If all OK try to update the requested label if (!$ok OR !updateLabel($Label)) { @@ -138,17 +152,20 @@ // Check the heading data $errors=array(); if ($new) { - if (empty($data['id'])) + if (empty($data['id'])) { $errors[]=_('Id required'); - elseif ($allLabels!=null AND $allLabels->findLabel($data['id'])!==false) + } elseif ($allLabels!=null AND $allLabels->findLabel($data['id'])!==false){ $errors[]=_('This id exists in previous list'); + } } if (empty($data['description'])) $errors=_('the description is required'); // Check the dimensions data foreach ($DimensionTags as $iTag=>$tag) { - if ($tag['type']=='s') continue; // select type does not require validation + if ($tag['type']=='s') { + continue; // select type does not require validation + } $dd = trim($data[$iTag]); $desc=$tag['desc']; switch ($tag['type']) { @@ -286,7 +303,8 @@ </tr> </tbody> </table> - <br /><input type="submit" name="'.$name.'" value="'.$value.'" /> + <br /> + <input type="submit" name="'.$name.'" value="'.$value.'" /> <input type="submit" name="Cancel" value="'.$vCancel.'" /> </div> </div> @@ -295,7 +313,7 @@ function setTableGD($Label, $ReadOnly) { global $GlobalTags, $DimensionTags; - $html='<table border="0" cellspacing="1" class="selection">'; + $html='<table class="selection">'; $html .= setDataFields($GlobalTags, 0, $Label, $specialTag='id', $ReadOnly); $html .= setDataFields($DimensionTags, 1, $Label->dimensions); $html .= ' @@ -345,13 +363,11 @@ function setTableLines($lineArray) { global $DataTags; - $html=' - <table border="0" cellspacing="1" class="selection">'; + $html='<table class="selection">'; $html .= setTableHeader($DataTags); $iCount=MAX_LINES_PER_LABEL; foreach ($lineArray as $i=>$data) { - $iCount--; $html .= setLineFields($DataTags, $data); } @@ -406,8 +422,7 @@ * @return Nothing */ function showLabelsList($list) { - $txt= //*< - array(_('Label id'),_('Description'), _('Label array'), + $txt= array(_('Label id'),_('Description'), _('Label array'), _('New'), _('Edit'), _('Copy'), _('Delete'), _('Do you really want to erase the label') ); @@ -425,7 +440,7 @@ } } </script> - <form action="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'" method="post" id="form1"> + <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1"> <div> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> <input type="hidden" name="action" id="action" value="" /> Modified: trunk/companies/weberpdemo/reportwriter/labels.xml =================================================================== --- trunk/companies/weberpdemo/reportwriter/labels.xml 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/companies/weberpdemo/reportwriter/labels.xml 2012-04-24 09:45:59 UTC (rev 5277) @@ -1,2 +1,2 @@ <?xml version="1.0"?> -<labels><label><id>111-price</id><description>111-CodePrice</description><dimensions><Unit>mm</Unit><Rows>12</Rows><Cols>10</Cols><Sh>162</Sh><Sw>196</Sw><He>12</He><Wi>18</Wi><Tm>3</Tm><Lm>3</Lm><Rh>12.5</Rh><Cw>18.5</Cw></dimensions><data><line><row>7</row><pos>1</pos><max>15</max><font>2</font><dat>code</dat></line><line><row>2</row><pos>1</pos><max>15</max><font>2</font><dat>bcode</dat></line></data></label><label><id>130-price</id><description>130-CodePrice</description><dimensions><Unit>mm</Unit><Rows>8</Rows><Cols>6</Cols><Sh>170</Sh><Sw>205</Sw><He>18</He><Wi>31</Wi><Tm>3</Tm><Lm>2</Lm><Rh>20.5</Rh><Cw>33.5</Cw></dimensions><data><line><row>13</row><pos>2</pos><max>27</max><font>4</font><dat>code</dat></line><line><row>5</row><pos>2</pos><max>27</max><font>4</font><dat>price</dat></line></data></label></labels> +<labels><label><id>111-price</id><description>111-CodePrice</description><dimensions><Unit>mm</Unit><Rows>12</Rows><Cols>10</Cols><Sh>162</Sh><Sw>196</Sw><He>12</He><Wi>18</Wi><Tm>3</Tm><Lm>3</Lm><Rh>12.5</Rh><Cw>18.5</Cw></dimensions><data><line><row>7</row><pos>1</pos><max>15</max><font>2</font><dat>code</dat></line><line><row>2</row><pos>1</pos><max>15</max><font>2</font><dat>bcode</dat></line></data></label><label><id>130-price</id><description>130-CodePrice</description><dimensions><Unit>mm</Unit><Rows>8</Rows><Cols>6</Cols><Sh>170</Sh><Sw>205</Sw><He>18</He><Wi>31</Wi><Tm>3</Tm><Lm>2</Lm><Rh>20.5</Rh><Cw>33.5</Cw></dimensions><data><line><row>13</row><pos>2</pos><max>27</max><font>4</font><dat>code</dat></line><line><row>5</row><pos>2</pos><max>27</max><font>4</font><dat>price</dat></line></data></label><label><id>PriceLabel</id><description>Price Label</description><dimensions><Unit>mm</Unit><Rows>10</Rows><Cols>4</Cols><Sh>297</Sh><Sw>210</Sw><He>25.4</He><Wi>45.7</Wi><Tm>5</Tm><Lm>10</Lm><Rh>25.4</Rh><Cw>48</Cw></dimensions><data><line><row>20</row><pos>5</pos><max>20</max><font>3</font><dat>code</dat></line><line><row>12</row><pos>10</pos><max>15</max><font>5</font><dat>price</dat></line><line><row>5</row><pos>2</pos><max>40</max><font>2</font><dat>name1</dat></line></data></label></labels> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/doc/Change.log 2012-04-24 09:45:59 UTC (rev 5277) @@ -1,4 +1,6 @@ webERP Change Log + +24/4/2012 Phil: fix CopyBOM.php that was insering a blank stockid into stockmaster as reported by Ricard 21/04/2012 Vitaly: Editable item description in PO. 16/04/2012 Vitaly: Added option to display only items that are currently on purchase order in StockLocStatus.php 16/04/2012 Vitaly: Fixed Days textbox where it did not remember entered value. @@ -65,10 +67,6 @@ 17/2/12 Phil: SuppCreditGRNs.php SuppInvGRNs.php DefineSuppTransClass.php SupplierInvoice.php stock movement was not being updated correctly with cost on purchase invoice entry as was using GRNNo not GRNBatchNo - which is used as the GRN transaction number in stock movements. 16/2/12 Tim: Modified index.php to use arrays of links rather than hard code all menus 16/2/12 Exson: Fixed StockAdjustments.php was not producing gltrans entries when stock code entered directly - - -Release 4.07 - 11/2/12 Phil: Fix Prices.php for end dates when a new price with no end date is inserted with a start date in the future. 11/2/12 Ahmed.Fawzy: Repairs to Prices_Customer.php option to have prices for a single customer and all branches had been compromised by having the branch selection box with no "All Branches" option. Also selected branch was not showing as it should have when editing a specific branch price 7/2/12 Ricard: Made new system parameter for StandardCostDecimalPlaces - reworked SelectProduct.php and StockCostUpdate.php to use the new parameter. Modified SystemParameters.php to allow the parameter to be a number between 0 and 4 inclusive. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-24 09:46:10
|
Revision: 5277 http://web-erp.svn.sourceforge.net/web-erp/?rev=5277&view=rev Author: daintree Date: 2012-04-24 09:45:59 +0000 (Tue, 24 Apr 2012) Log Message: ----------- insert of blank item code fixed Modified Paths: -------------- trunk/CopyBOM.php trunk/Labels.php trunk/companies/weberpdemo/reportwriter/labels.xml trunk/doc/Change.log Modified: trunk/CopyBOM.php =================================================================== --- trunk/CopyBOM.php 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/CopyBOM.php 2012-04-24 09:45:59 UTC (rev 5277) @@ -15,135 +15,142 @@ include('includes/SQL_CommonFunctions.inc'); if(isset($_POST['Submit'])) { - $stkid = $_POST['stkid']; - $type = $_POST['type']; - $newstkid = ''; - - if($type == 'N') { - $newstkid = $_POST['tostkid']; + $StockID = $_POST['StockID']; + $NewOrExisting = $_POST['NewOrExisting']; + $NewStockID = ''; + $InputError = 0; //assume the best + + if($NewOrExisting == 'N') { + $NewStockID = $_POST['ToStockID']; + if (mb_strlen($NewStockID)==0 OR $NewStockID==''){ + $InputError = 1; + prnMsg(_('The new item code cannot be blank. Enter a new code for the item to copy the BOM to'),'error'); + } } else { - $newstkid = $_POST['exstkid']; + $NewStockID = $_POST['ExStockID']; } + if ($InputError==0){ + $result = DB_Txn_Begin($db); - $result = DB_query("begin", $db); - - if($type == 'N') { - /* duplicate rows into stockmaster */ - $sql = "INSERT INTO stockmaster( stockid, - categoryid, - description, - longdescription, - units, - mbflag, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid, - serialised, - appendfile, - perishable, - decimalplaces, - nextserialno, - pansize, - shrinkfactor, - netweight ) - SELECT '".$newstkid."' AS stockid, - categoryid, - description, - longdescription, - units, - mbflag, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid, - serialised, - appendfile, - perishable, - decimalplaces, - nextserialno, - pansize, - shrinkfactor, - netweight + if($NewOrExisting == 'N') { + /* duplicate rows into stockmaster */ + $sql = "INSERT INTO stockmaster( stockid, + categoryid, + description, + longdescription, + units, + mbflag, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid, + serialised, + appendfile, + perishable, + decimalplaces, + nextserialno, + pansize, + shrinkfactor, + netweight ) + SELECT '".$NewStockID."' AS stockid, + categoryid, + description, + longdescription, + units, + mbflag, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid, + serialised, + appendfile, + perishable, + decimalplaces, + nextserialno, + pansize, + shrinkfactor, + netweight + FROM stockmaster + WHERE stockid='".$StockID."';"; + $result = DB_query($sql, $db); + } else { + $sql = "SELECT lastcostupdate, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel FROM stockmaster - WHERE stockid='".$stkid."';"; + WHERE stockid='".$StockID."';"; + $result = DB_query($sql, $db); + + $myrow = DB_fetch_row($result); + + $sql = "UPDATE stockmaster set + lastcostupdate = " . $myrow[0] . ", + actualcost = " . $myrow[1] . ", + lastcost = " . $myrow[2] . ", + materialcost = " . $myrow[3] . ", + labourcost = " . $myrow[4] . ", + overheadcost = " . $myrow[5] . ", + lowestlevel = " . $myrow[6] . " + WHERE stockid='".$NewStockID."';"; + $result = DB_query($sql, $db); + } + + $sql = "INSERT INTO bom + SELECT '".$NewStockID."' AS parent, + component, + workcentreadded, + loccode, + effectiveafter, + effectiveto, + quantity, + autoissue + FROM bom + WHERE parent='".$StockID."';"; $result = DB_query($sql, $db); - } else { - $sql = "SELECT lastcurcostdate, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel - FROM stockmaster - WHERE stockid='".$stkid."';"; - $result = DB_query($sql, $db); - - $row = DB_fetch_row($result); - - $sql = "UPDATE stockmaster set - lastcurcostdate = '".$row[0]."', - actualcost = ".$row[1].", - lastcost = ".$row[2].", - materialcost = ".$row[3].", - labourcost = ".$row[4].", - overheadcost = ".$row[5].", - lowestlevel = ".$row[6]." - WHERE stockid='".$newstkid."';"; - $result = DB_query($sql, $db); - } - - $sql = "INSERT INTO bom - SELECT '".$newstkid."' AS parent, - component, - workcentreadded, - loccode, - effectiveafter, - effectiveto, - quantity, - autoissue - FROM bom - WHERE parent='".$stkid."';"; - $result = DB_query($sql, $db); - - if($type == 'N') { - $sql = "INSERT INTO locstock - SELECT loccode, - '".$newstkid."' AS stockid, - 0 AS quantity, - reorderlevel - FROM locstock - WHERE stockid='".$stkid."';"; - $result = DB_query($sql, $db); - } - - $result = DB_query('commit', $db); - - UpdateCost($db, $newstkid); - - header('Location: BOMs.php?Select='.$newstkid); - ob_end_flush(); + + if($NewOrExisting == 'N') { + $sql = "INSERT INTO locstock + SELECT loccode, + '".$NewStockID."' AS stockid, + 0 AS quantity, + reorderlevel + FROM locstock + WHERE stockid='".$StockID."'"; + + $result = DB_query($sql, $db); + } + + $result = DB_Txn_Commit($db); + + UpdateCost($db, $NewStockID); + + header('Location: BOMs.php?Select='.$NewStockID); + ob_end_flush(); + } //end if there is no input error } else { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Contract') . '" alt="" />' . ' ' . $title . '</p>'; @@ -156,35 +163,35 @@ description FROM stockmaster WHERE stockid IN (SELECT DISTINCT parent FROM bom) - AND mbflag IN ('M', 'A', 'K');"; + AND mbflag IN ('M', 'A', 'K', 'G');"; $result = DB_query($sql, $db); echo '<table class="selection"> <tr> <td>' . _('From Stock ID') . '</td>'; - echo '<td><select name="stkid">'; - while($row = DB_fetch_row($result)) { - echo '<option value="'.$row[0].'">'.$row[0].' -- '.$row[1].'</option>'; + echo '<td><select name="StockID">'; + while($myrow = DB_fetch_row($result)) { + echo '<option value="'.$myrow[0].'">'.$myrow[0].' -- '.$myrow[1].'</option>'; } echo '</select></td> </tr>'; echo '<tr> - <td><input type="radio" name="type" value="N" />' . _(' To New Stock ID') . '</td>'; - echo '<td><input type="text" maxlength="20" name="tostkid" /></td></tr>'; + <td><input type="radio" name="NewOrExisting" value="N" />' . _(' To New Stock ID') . '</td>'; + echo '<td><input type="text" maxlength="20" name="ToStockID" /></td></tr>'; $sql = "SELECT stockid, description FROM stockmaster WHERE stockid NOT IN (SELECT DISTINCT parent FROM bom) - AND mbflag IN ('M', 'A', 'K');"; + AND mbflag IN ('M', 'A', 'K', 'G');"; $result = DB_query($sql, $db); if (DB_num_rows($result) > 0) { echo '<tr> - <td><input type="radio" name="type" value="E" />'._('To Existing Stock ID') . '</td><td>'; - echo '<select name="exstkid">'; - while($row = DB_fetch_row($result)) { - echo '<option value="'.$row[0].'">'.$row[0].' -- '.$row[1].'</option>'; + <td><input type="radio" name="NewOrExisting" value="E" />'._('To Existing Stock ID') . '</td><td>'; + echo '<select name="ExStockID">'; + while($myrow = DB_fetch_row($result)) { + echo '<option value="'.$myrow[0].'">'.$myrow[0].' -- '.$myrow[1].'</option>'; } echo '</select></td></tr>'; } Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/Labels.php 2012-04-24 09:45:59 UTC (rev 5277) @@ -7,12 +7,22 @@ * @version 1.1 * Last changes: 2010-08-31 * + * + * Phil's notes: + * This is an example of clever code that works but IMHO is very hard to decipher and modify - sorry Marcos! + * It is in webERP because it fulfills a useful function on its own but don't expect to be able to modify it!! + * I would prefer this code was re-written in a manner consistent with the rest of webERP + * There are many meaningless variable names + * unecessary abrastaction at every turn + * No class is necessary for this script IMHO + * Data held in an xml file instead of the database + * Variable naming uses a lower case first character + * $debug is used - but is a webERP global to trap SQL errors for sysadmins + * **/ $Version_adds= 1.1; -/** Error reporting */ - include('includes/session.inc'); $title=_('Label Templates Maintainance'); include('includes/header.inc'); @@ -20,8 +30,11 @@ $debug=false; include('includes/DefineLabelClass.php'); + +//Phil why xml? Why not use the database like every other part of webERP for storing data + $allLabels = //!< The variable $allLabels is the global variable that contains the list - getXMLFile(LABELS_FILE); //!< of all the label objects defined until now. In case of a fresh + getXMLFile($_SESSION['reports_dir'] . '/labels.xml'); //!< of all the label objects defined until now. In case of a fresh //!< installation or an empty XML labels file it holds a NULL value. if ($debug) { @@ -41,6 +54,7 @@ */ if (isset($_POST['Update'])) { // Get the data from the user input & validate it (not new) + //getData function $Label=getData($_POST, false, $ok); // If all OK try to update the requested label if (!$ok OR !updateLabel($Label)) { @@ -138,17 +152,20 @@ // Check the heading data $errors=array(); if ($new) { - if (empty($data['id'])) + if (empty($data['id'])) { $errors[]=_('Id required'); - elseif ($allLabels!=null AND $allLabels->findLabel($data['id'])!==false) + } elseif ($allLabels!=null AND $allLabels->findLabel($data['id'])!==false){ $errors[]=_('This id exists in previous list'); + } } if (empty($data['description'])) $errors=_('the description is required'); // Check the dimensions data foreach ($DimensionTags as $iTag=>$tag) { - if ($tag['type']=='s') continue; // select type does not require validation + if ($tag['type']=='s') { + continue; // select type does not require validation + } $dd = trim($data[$iTag]); $desc=$tag['desc']; switch ($tag['type']) { @@ -286,7 +303,8 @@ </tr> </tbody> </table> - <br /><input type="submit" name="'.$name.'" value="'.$value.'" /> + <br /> + <input type="submit" name="'.$name.'" value="'.$value.'" /> <input type="submit" name="Cancel" value="'.$vCancel.'" /> </div> </div> @@ -295,7 +313,7 @@ function setTableGD($Label, $ReadOnly) { global $GlobalTags, $DimensionTags; - $html='<table border="0" cellspacing="1" class="selection">'; + $html='<table class="selection">'; $html .= setDataFields($GlobalTags, 0, $Label, $specialTag='id', $ReadOnly); $html .= setDataFields($DimensionTags, 1, $Label->dimensions); $html .= ' @@ -345,13 +363,11 @@ function setTableLines($lineArray) { global $DataTags; - $html=' - <table border="0" cellspacing="1" class="selection">'; + $html='<table class="selection">'; $html .= setTableHeader($DataTags); $iCount=MAX_LINES_PER_LABEL; foreach ($lineArray as $i=>$data) { - $iCount--; $html .= setLineFields($DataTags, $data); } @@ -406,8 +422,7 @@ * @return Nothing */ function showLabelsList($list) { - $txt= //*< - array(_('Label id'),_('Description'), _('Label array'), + $txt= array(_('Label id'),_('Description'), _('Label array'), _('New'), _('Edit'), _('Copy'), _('Delete'), _('Do you really want to erase the label') ); @@ -425,7 +440,7 @@ } } </script> - <form action="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'" method="post" id="form1"> + <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1"> <div> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> <input type="hidden" name="action" id="action" value="" /> Modified: trunk/companies/weberpdemo/reportwriter/labels.xml =================================================================== --- trunk/companies/weberpdemo/reportwriter/labels.xml 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/companies/weberpdemo/reportwriter/labels.xml 2012-04-24 09:45:59 UTC (rev 5277) @@ -1,2 +1,2 @@ <?xml version="1.0"?> -<labels><label><id>111-price</id><description>111-CodePrice</description><dimensions><Unit>mm</Unit><Rows>12</Rows><Cols>10</Cols><Sh>162</Sh><Sw>196</Sw><He>12</He><Wi>18</Wi><Tm>3</Tm><Lm>3</Lm><Rh>12.5</Rh><Cw>18.5</Cw></dimensions><data><line><row>7</row><pos>1</pos><max>15</max><font>2</font><dat>code</dat></line><line><row>2</row><pos>1</pos><max>15</max><font>2</font><dat>bcode</dat></line></data></label><label><id>130-price</id><description>130-CodePrice</description><dimensions><Unit>mm</Unit><Rows>8</Rows><Cols>6</Cols><Sh>170</Sh><Sw>205</Sw><He>18</He><Wi>31</Wi><Tm>3</Tm><Lm>2</Lm><Rh>20.5</Rh><Cw>33.5</Cw></dimensions><data><line><row>13</row><pos>2</pos><max>27</max><font>4</font><dat>code</dat></line><line><row>5</row><pos>2</pos><max>27</max><font>4</font><dat>price</dat></line></data></label></labels> +<labels><label><id>111-price</id><description>111-CodePrice</description><dimensions><Unit>mm</Unit><Rows>12</Rows><Cols>10</Cols><Sh>162</Sh><Sw>196</Sw><He>12</He><Wi>18</Wi><Tm>3</Tm><Lm>3</Lm><Rh>12.5</Rh><Cw>18.5</Cw></dimensions><data><line><row>7</row><pos>1</pos><max>15</max><font>2</font><dat>code</dat></line><line><row>2</row><pos>1</pos><max>15</max><font>2</font><dat>bcode</dat></line></data></label><label><id>130-price</id><description>130-CodePrice</description><dimensions><Unit>mm</Unit><Rows>8</Rows><Cols>6</Cols><Sh>170</Sh><Sw>205</Sw><He>18</He><Wi>31</Wi><Tm>3</Tm><Lm>2</Lm><Rh>20.5</Rh><Cw>33.5</Cw></dimensions><data><line><row>13</row><pos>2</pos><max>27</max><font>4</font><dat>code</dat></line><line><row>5</row><pos>2</pos><max>27</max><font>4</font><dat>price</dat></line></data></label><label><id>PriceLabel</id><description>Price Label</description><dimensions><Unit>mm</Unit><Rows>10</Rows><Cols>4</Cols><Sh>297</Sh><Sw>210</Sw><He>25.4</He><Wi>45.7</Wi><Tm>5</Tm><Lm>10</Lm><Rh>25.4</Rh><Cw>48</Cw></dimensions><data><line><row>20</row><pos>5</pos><max>20</max><font>3</font><dat>code</dat></line><line><row>12</row><pos>10</pos><max>15</max><font>5</font><dat>price</dat></line><line><row>5</row><pos>2</pos><max>40</max><font>2</font><dat>name1</dat></line></data></label></labels> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-23 03:06:00 UTC (rev 5276) +++ trunk/doc/Change.log 2012-04-24 09:45:59 UTC (rev 5277) @@ -1,4 +1,6 @@ webERP Change Log + +24/4/2012 Phil: fix CopyBOM.php that was insering a blank stockid into stockmaster as reported by Ricard 21/04/2012 Vitaly: Editable item description in PO. 16/04/2012 Vitaly: Added option to display only items that are currently on purchase order in StockLocStatus.php 16/04/2012 Vitaly: Fixed Days textbox where it did not remember entered value. @@ -65,10 +67,6 @@ 17/2/12 Phil: SuppCreditGRNs.php SuppInvGRNs.php DefineSuppTransClass.php SupplierInvoice.php stock movement was not being updated correctly with cost on purchase invoice entry as was using GRNNo not GRNBatchNo - which is used as the GRN transaction number in stock movements. 16/2/12 Tim: Modified index.php to use arrays of links rather than hard code all menus 16/2/12 Exson: Fixed StockAdjustments.php was not producing gltrans entries when stock code entered directly - - -Release 4.07 - 11/2/12 Phil: Fix Prices.php for end dates when a new price with no end date is inserted with a start date in the future. 11/2/12 Ahmed.Fawzy: Repairs to Prices_Customer.php option to have prices for a single customer and all branches had been compromised by having the branch selection box with no "All Branches" option. Also selected branch was not showing as it should have when editing a specific branch price 7/2/12 Ricard: Made new system parameter for StandardCostDecimalPlaces - reworked SelectProduct.php and StockCostUpdate.php to use the new parameter. Modified SystemParameters.php to allow the parameter to be a number between 0 and 4 inclusive. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-25 09:11:59
|
Revision: 5280 http://web-erp.svn.sourceforge.net/web-erp/?rev=5280&view=rev Author: daintree Date: 2012-04-25 09:11:48 +0000 (Wed, 25 Apr 2012) Log Message: ----------- rewrite of label printing code Modified Paths: -------------- trunk/Labels.php trunk/PDFPrintLabel.php trunk/doc/Change.log trunk/includes/class.pdf.php trunk/includes/tcpdf/tcpdf.php trunk/sql/mysql/upgrade4.07-4.08.sql Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-04-25 06:12:02 UTC (rev 5279) +++ trunk/Labels.php 2012-04-25 09:11:48 UTC (rev 5280) @@ -1,563 +1,450 @@ -<?php -/** - * <b>Labels XML file Managment</b> - * This program maintains the XML file containing the label defintions - * used to print the products prices tickets - * @author Marcos R Garcia <addsmgt at gmail dot com> - * @version 1.1 - * Last changes: 2010-08-31 - * - * - * Phil's notes: - * This is an example of clever code that works but IMHO is very hard to decipher and modify - sorry Marcos! - * It is in webERP because it fulfills a useful function on its own but don't expect to be able to modify it!! - * I would prefer this code was re-written in a manner consistent with the rest of webERP - * There are many meaningless variable names - * unecessary abrastaction at every turn - * No class is necessary for this script IMHO - * Data held in an xml file instead of the database - * Variable naming uses a lower case first character - * $debug is used - but is a webERP global to trap SQL errors for sysadmins - * -**/ - -$Version_adds= 1.1; - -include('includes/session.inc'); -$title=_('Label Templates Maintainance'); -include('includes/header.inc'); - -$debug=false; -include('includes/DefineLabelClass.php'); - - -//Phil why xml? Why not use the database like every other part of webERP for storing data - -$allLabels = //!< The variable $allLabels is the global variable that contains the list - getXMLFile($_SESSION['reports_dir'] . '/labels.xml'); //!< of all the label objects defined until now. In case of a fresh - //!< installation or an empty XML labels file it holds a NULL value. - -if ($debug) { - echo '<br />' ; - echo '<pre>'; - print_r($_POST); - echo '</pre>'; -//exit(); -} - -/** Check if some action has been requested -*/ -$showList=true; // By default will show the tamplates list - -/** - * Save the changes in template? - */ -if (isset($_POST['Update'])) { - // Get the data from the user input & validate it (not new) - //getData function - $Label=getData($_POST, false, $ok); - // If all OK try to update the requested label - if (!$ok OR !updateLabel($Label)) { - // show the data label from the input data as update data (id read only)} - showLabel($Label, _('Correct data'), $theme, false); - $showList=false; - } - -/** - * Save the data for a new template? - */ -} elseif (isset($_POST['Save'])) { - // Get the data from the user input & validate it for new id - $Label=getData($_POST, true, $ok); - if (!$ok OR !createLabel($Label)) { // - showLabel($Label, _('Correct data'), $theme, false); - $showList=false; - } - -/** - * Get the data from an old one to create a new template? - */ -} elseif (isset($_POST['Copy'])) { - $Label=$allLabels->getLabel($_POST['labelID']); - $Label->id = _('New ID'); // Well, where did I get it? of course from the user, but .. - showLabel($Label, _('Edit data new label'), $theme, false); - $showList=false; - -/** - * Change some data from an old template? - */ -} elseif (isset($_POST['Edit'])) { - $Label=$allLabels->getLabel($_POST['labelID']); - showLabel($Label, _('Edit data label'), $theme, true); - $showList=false; - -/** - * Eliminate an unnecesary template? - */ -} elseif (isset($_POST['Delete'])) { - $allLabels=deleteLabel($allLabels, $_POST['labelID']); - -/** - * Create a new template? - */ -} elseif (isset($_POST['New'])) { - showLabel(null, _('New label'), $theme); - $showList=false; - -/** - * Do nothing? only show the list (if it exist)) - */ -} elseif (isset($_POST['Cancel'])) { - ; // showLabelList - -/** - * No action requested, show all or get the first one - */ -} else { - if ($allLabels==null OR count($allLabels->label)<1) { - showLabel(null, _('There is no labels, create a new one'), $theme); - $showList=false; - } -} - -/** - * The default is to show the list of labels templates yet defined, - * the exception occurs when previously has been selected a particular - * template, for edit, copy or to create a new one - */ -if ($showList) { - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; - showLabelsList($allLabels->label); -} -include('includes/footer.inc'); -exit(); - -/*! \brief getData - Gets the input data from the user's submit - * - * This code constructs a new objet Label from the form's data - * provided by the user. It validates the data too. - * @param $data The array of strings gived by the user - * @param $new This flag indicates that the labels is new, so check no repeated id - * @param $ok The variable where the routine gives the validation result. - * @return The Label object constructed qith the data, included errors. - */ -function getData($data, $new, &$ok) { - $ok = validData($data, $new); - return newLabel($data); -} - -function validData($data, $new) { - global $allLabels, $DimensionTags, $DataTags; - -// Check the heading data - $errors=array(); - if ($new) { - if (empty($data['id'])) { - $errors[]=_('Id required'); - } elseif ($allLabels!=null AND $allLabels->findLabel($data['id'])!==false){ - $errors[]=_('This id exists in previous list'); - } - } - if (empty($data['description'])) - $errors=_('the description is required'); - -// Check the dimensions data - foreach ($DimensionTags as $iTag=>$tag) { - if ($tag['type']=='s') { - continue; // select type does not require validation - } - $dd = trim($data[$iTag]); - $desc=$tag['desc']; - switch ($tag['type']) { - case 'n': - if (!is_numeric($dd)) - $errors[]= _('The value of').' '.$desc.' '._('would be numeric'); - elseif ((float)$data[$iTag]<=0) - $errors[]= _('The value of').' '.$desc.' '._('requires a positive value').$dd; - break; - case 'i': - if (!is_numeric($dd) OR (int)$data[$iTag]<=0) - $errors[]= _('The value of').' '.$tag['desc'].' '._('would be a positive integer'); - break; - } - } - // Checking consistency between data - // Rh > He - $tag = $DimensionTags[$iTag='Rh']; - if ((float)$data['Rh'] < (float)$data['He'] ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the height of the labels'); - } - // Sh >= rows*Rh+Tm - $tag = $DimensionTags[$iTag='Sh']; - if ((float)$data['Sh'] <= (float)$data['Tm'] + ( (int)$data['Rows']*((float)$data['Rh']) ) ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the height of all the rows, including the top margin'); - } - // Cw > Wi - $tag = $DimensionTags[$iTag='Cw']; - if ((float)$data['Cw'] < (float)$data['Wi'] ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the width of the labels'); - } - // Sw >= Cols*Cw+Lm - $tag = $DimensionTags[$iTag='Sw']; - if ((float)$data['Sw'] <= (float)$data['Lm'] + ( (int)$data['Cols']*((float)$data['Cw']) ) ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the width of all the cols, including the left margin'); - } - - $rowCount=0; - $jRow=0; - foreach ($data['row'] as $iRow=>$row) { - $jRow++; - if (empty($row)) continue; // The empty row indicates no data - $rowCount++; // we have data - - if (!is_numeric($row) ) $row=0; - else $row = (float)$row; - if ($row<=0) - $errors[]= _('The vert. pos. value would be positive') ." ($jRow)"; - elseif ((float)$row>(float)$data['He']) - $errors[]= _('The value of the vert. pos. would be less than')." ". $data['He'] ."($jRow)"; - - // now the rest of the line data is validated - foreach ($DataTags as $iTag=>$tag) { - if ($tag['type']=='s' // select type does not require validation - OR $iTag == 'row') continue; // the row is just validated - $dd = trim($data[$iTag][$iRow]); - $desc=$tag['desc']; - if ($tag['type']=='n') { - if (!is_numeric($dd)) - $errors[]= _('The value of').' '.$desc.' '._('would be numeric')." ($jRow)"; - elseif (empty($dd) OR (float)$dd<=0) - $errors[]= _('The value of').' '.$desc.' '._('requires a positive value')." ($jRow)"; - } - switch ($iTag) { - case 'font': - if ((float)$dd+$row >= (float)$data['He']) { - $errors[]= _('The value of').' '.$desc.' '._('in this position exceeds the label height'). - " ($jRow)"; - } - break; - case 'pos': - $posD = (float)$dd; - break; - case 'max': - if ((float)$dd+$posD >= (float)$data['Wi']) { - $errors[]= _('The position and lenght of the string leads the text to get out of the label'). " ($jRow)"; - } - break; - } - } - } - // Display the errors detected - if (count($errors)>0) { - foreach($errors as $err) - prnMsg($err); - return false; - } - return true; // all data are valid! -} - -/*! \brief Shows the label requested - * - * It shows the data label from the input $data as update data (id read only) - * if the third parameter is true or a fresh data label (new label). It is - * possible that the combination $data valid and $ReadOnly false occurs when - * invalid data needs to be recaptured because an error in a new label capture. - */ -function showLabel($Label, $msg, $theme, $ReadOnly=false) { - global $rootpath; - if ($Label==null) - $Label = newLabel(); - if ($ReadOnly) { - $name = 'Update'; - $value = _('Update'); - } else { - $name = 'Save'; - $value = _('Save'); - } - - $vCancel = _('Cancel'); - - $TableGD = setTableGD($Label, $ReadOnly); - $TableLines = setTableLines($Label->data->line); - - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $msg.'</p>'; - - echo '<br /> - <form action="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'" method="post"> - <div> - <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <div class="centre"> - <table border="2" cellspacing="4" class="selection"> - <tbody> - <tr> - <td align="center"><img src="'.$rootpath.'/css/paramsLabel.png" alt="" /></td> - <td>'.$TableGD.'</td> - </tr> - <tr> - <td align="center"><img src="'.$rootpath.'/css/labelsDim.png" alt="" /></td> - <td>'.$TableLines.'</td> - </tr> - </tbody> - </table> - <br /> - <input type="submit" name="'.$name.'" value="'.$value.'" /> - <input type="submit" name="Cancel" value="'.$vCancel.'" /> - </div> - </div> - </form>'; -} - -function setTableGD($Label, $ReadOnly) { - global $GlobalTags, $DimensionTags; - $html='<table class="selection">'; - $html .= setDataFields($GlobalTags, 0, $Label, $specialTag='id', $ReadOnly); - $html .= setDataFields($DimensionTags, 1, $Label->dimensions); - $html .= ' - </table>'; - return $html; -} - -function setDataFields($tags, $withTagId, $data, $specialTag=false, $ReadOnly=false) { - $iCol=0; - $html = ''; - foreach ($tags as $iTag=>$tag) { - $vDat = (is_object($data) AND isset($data->$iTag))?$data->$iTag:''; - if ($tag['type']=='s') { - $input ='<select name="'. $iTag . '">'; - foreach ($tag['values'] as $i=>$val) { - $xSel = ($vDat==$i)?' selected="selected"' : ''; - $input .= ' - <option value="'. $i .'"'. $xSel .'>'.$val.'</option>'; - } - $input .= ' - </select>'; - } else { - $ro=''; - if ($ReadOnly AND $specialTag==$iTag) - $ro='readonly="readonly"'; - $input = '<input type="text" name="'. $iTag .'" value="'. $vDat .'" size="'. $tag['sz'] .'" maxlength="'. $tag['maxsz'] .'" '. $ro .' />'; - } - if (!$iCol++) // when zero begins a line - $html .= ' - <tr>'; - else - $iCol=0; - $wTag= $withTagId ? (' ('.$iTag.')') :''; - $html .= ' - <td align="right">' . $tag['desc'] . $wTag . ':</td> - <td>' . $input . '</td>'; - if (!$iCol) - $html .= ' - </tr>'; - } - if ($iCol) // if the count ends in an odd count, add the end of line - $html .= ' - </tr>'; - - return $html; -} - -function setTableLines($lineArray) { - global $DataTags; - $html='<table class="selection">'; - $html .= setTableHeader($DataTags); - - $iCount=MAX_LINES_PER_LABEL; - foreach ($lineArray as $i=>$data) { - $iCount--; - $html .= setLineFields($DataTags, $data); - } - while ($iCount-->0) - $html .= setLineFields($DataTags, null); - $html .= ' - </table>'; - return $html; -} - -function setTableHeader($tags) { - $html= ' - <tr>'; - foreach ($tags as $tit) - $html .= ' - <th>' . $tit['desc'] . '</th>'; - return $html . ' - </tr>'; -} - -function setLineFields($tags, $data) { - $html = ' - <tr>'; - foreach ($tags as $iTag=>$tag) { - $vDat = ($data!=null AND isset($data->$iTag))?$data->$iTag:''; - if ($tag['type']=='s') { - $input ='<select name="'. $iTag . '[]">'; - foreach ($tag['values'] as $kI=>$kVal) { - $xSel = ($vDat==$kI) ? ' selected="selected"':''; - $input .= ' - <option value="'. $kI .'"'. $xSel .'>'.$kVal.'</option>'; - } - $input .= ' - </select>'; - } else { - $input = '<input type="text" name="'. $iTag .'[]" value="'. $vDat .'" size="'. $tag['sz'] .'" maxlength="'. $tag['maxsz'] .'" />'; - } - $html .= ' - <td align="center">' . $input . '</td>'; - } - $html .= ' - </tr>'; - return $html; -} - -/*! \brief Shows the current label list -* -* When the user begin or finishes an maintance action, the program -* shows the current list, in particular, the ID and the description of the label. -* -* @param $list The label object list to be displayed -* @return Nothing -*/ -function showLabelsList($list) { - $txt= array(_('Label id'),_('Description'), _('Label array'), - _('New'), _('Edit'), _('Copy'), _('Delete'), - _('Do you really want to erase the label') - ); - // The header of the list - echo '<script type="text/javascript"> - function submitForm(formID, action, value) { - document.getElementById(\'action\').name=action; - document.getElementById(\'labelID\').value=value; - document.getElementById(formID).submit(); - } - function areYouSure(form, action, value) { - var r=confirm("'.$txt[7].'"); - if (r) { - submitForm(form, action, value); - } - } - </script> - <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1"> - <div> - <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <input type="hidden" name="action" id="action" value="" /> - <input type="hidden" name="labelID" id="labelID" value="" /> - </div> - </form> - <div class="centre"> - <table class="selection"> - <thead> - <tr> - <th>'.$txt[0].'</th> - <th>'.$txt[1].'</th> - <th>'.$txt[2].'</th> - <th><input type="submit" name="new" onclick="submitForm(\'form1\',\'New\',\'\');" value="'.$txt[3].'" /> - </th> - </tr> - </thead> - <tbody>'; - foreach ($list as $Label) { - $dim = (string)$Label->dimensions->Rows. ' x '. (string)$Label->dimensions->Cols; - echo ' - <tr><td>'. $Label->id . '</td> - <td>'. $Label->description . '</td> - <td><div class="centre">'. $dim . '</div></td> - <td><input type="submit" onclick="submitForm('. "'form1','Edit','". $Label->id . "');" .'" value="' . $txt[4]. '" /> - <input type="submit" onclick="submitForm('. "'form1','Copy','". $Label->id . "');" .'" value="' . $txt[5]. '" /> - <input type="submit" onclick="areYouSure('. "'form1','Delete','". $Label->id . "');" .'" value="' . $txt[6]. '" /> - </td> - </tr>'; - } - echo ' - </tbody> - </table> - </div>'; -} - -/*! \brief Generates a new label -* -* After the user gives the label data, this routine tries to insert -* the new label in the current list. -* -* @param $Label The object label that will replace an old one -* @return True when the update was ok -*/ -function createLabel($Label) { - global $allLabels; - $new = emptyList(); - $done=false; - if ($allLabels!=null) { - foreach ($allLabels as $oldLabel) { - if (!$done AND (string)$oldLabel->id >= (string)$Label->id) { - $new->addLabel($Label); - $done=true; - } - $new->addLabel($oldLabel); // inser data in the list, replacing the old one - } - } - if (!$done) - $new->addLabel($Label); - $allLabels = $new; - rewrite($allLabels); // rewrite it to the XML file - return true; -} - -/*! \brief Update the label data -* -* After the user modifies the label data this routine tries to update -* the corresponding structure in the label list with the object given. -* If the label with the id of the new one is found, the object could -* be accepted in the list and written to the XML file. -* -* @param $Label The object label that will replace an old one -* @return True when the update was ok -*/ -function updateLabel($Label) { - global $allLabels; - $new = emptyList(); - foreach ($allLabels as $oldLabel) { - if ((string)$oldLabel->id == (string)$Label->id) - $new->addLabel($Label); - else - $new->addLabel($oldLabel); // inser data in the list, replacing the old one - } - $allLabels = $new; - rewrite($allLabels); // rewrite it to the XML file - return true; -} - -/*! \brief Label elimination from the list. - * - * This routine eliminates one label from the global list $allLabels. It - * just find the index that correspond to the id given as input data. - * Because this function is called from the selection of a button with - * correct data, it would be unsual that some error exist, but it is - * included the code for the validation of some this strange case. - * - * @param $LabelID is the identifier of the label to delete. - * @see $allLabels - * @return true in case of success - */ -function deleteLabel($list, $LabelID) { - $new = emptyList(); - foreach ($list as $Label) { - if ((string)$Label->id!=$LabelID) - $new->addLabel($Label); - } - rewrite($new); - return $new; -} - -function rewrite($list) { - // First rename the previous XML file - if (is_file(LABELS_FILE) AND !rename(LABELS_FILE, LABELS_FILE.".bak")) - abortMsg(_('Could not rename the previous file.')); - $result=$list->asXML(LABELS_FILE); - if (!$result) - abortMsg(_('Could not create the new XML file.').': '.LABELS_FILE); -} - +<?php + +/* $Id: Labels.php 4950 2012-02-22 06:26:38Z daintree $*/ + +include('includes/session.inc'); +$title = _('Label Templates'); +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'); + + +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Label Template Maintenance') + . '" alt="" />' . $title. ' + </p>'; + +if (isset($_POST['SelectedLabelID'])){ + $SelectedLabelID =$_POST['SelectedLabelID']; + if (ctype_digit($_POST['NoOfFieldsDefined'])){ //Now Process any field updates + + for ($i=0;$i<=$_POST['NoOfFieldsDefined'];$i++){ + + if (ctype_digit($_POST['VPos' . $i]) + AND ctype_digit($_POST['HPos' . $i]) + AND ctype_digit($_POST['FontSize' . $i])){ // if all entries are integers + + $result =DB_query("UPDATE labelfields SET fieldvalue='" . $_POST['FieldName' . $i] . "', + vpos='" . $_POST['VPos' . $i] . "', + hpos='" . $_POST['HPos' . $i] . "', + fontsize='" . $_POST['FontSize' . $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'); + } + } + } + if (ctype_digit($_POST['VPos']) AND ctype_digit($_POST['HPos']) AND ctype_digit($_POST['FontSize'])){ + //insert the new label field entered + $result = DB_query("INSERT INTO labelfields (labelid, + fieldvalue, + vpos, + hpos, + fontsize, + barcode) + VALUES ('" . $SelectedLabelID . "', + '" . $_POST['FieldName'] . "', + '" . $_POST['VPos'] . "', + '" . $_POST['HPos'] . "', + '" . $_POST['FontSize'] . "', + '" . $_POST['Barcode'] . "')", + $db); + } +} elseif(isset($_GET['SelectedLabelID'])){ + $SelectedLabelID =$_GET['SelectedLabelID']; + if (isset($_GET['DeleteField'])){ //then process any deleted fields + $result = DB_query("DELETE FROM labelfields WHERE labelfieldid='" . $_GET['DeleteField'] . "'",$db); + } +} + +if (isset($_POST['submit'])) { + $InputError = 0; + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + if ( trim( $_POST['Description'] ) == '' ) { + $InputError = 1; + prnMsg( _('The label description may not be empty'), 'error'); + } + $Message = ''; + 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'] . "', + height = '" . $_POST['Height'] . "', + topmargin = '". $_POST['TopMargin'] . "', + width = '". $_POST['Width'] . "', + leftmargin = '". $_POST['LeftMargin'] . "', + rowheight = '". $_POST['RowHeight'] . "', + columnwidth = '". $_POST['ColumnWidth'] . "' + WHERE labelid = '" . $SelectedLabelID . "'"; + + $ErrMsg = _('The update of this label template failed because'); + $result = DB_query($sql,$db,$ErrMsg); + + $Message = _('The label template has been updated'); + + } elseif ($InputError !=1) { + + /*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, + height, + topmargin, + width, + leftmargin, + rowheight, + columnwidth) + VALUES ('" . $_POST['PaperSize'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['Height'] . "', + '" . $_POST['TopMargin'] . "', + '" . $_POST['Width'] . "', + '" . $_POST['LeftMargin'] . "', + '" . $_POST['RowHeight'] . "', + '" . $_POST['ColumnWidth'] . "')"; + + $ErrMsg = _('The addition of this label failed because'); + $result = DB_query($sql,$db,$ErrMsg); + $Message = _('The new label template has been added to the database'); + } + //run the SQL from either of the above possibilites + if (isset($InputError) AND $InputError !=1) { + unset( $_POST['PaperSize']); + unset( $_POST['Description']); + unset( $_POST['Width']); + unset( $_POST['Height']); + unset( $_POST['TopMargin']); + unset( $_POST['LeftMargin']); + unset( $_POST['ColumnWidth']); + unset( $_POST['RowHeight']); + + } + + prnMsg($Message); + +} elseif (isset($_GET['delete'])) { +//the link to delete a selected record was clicked instead of the submit button + + /*Cascade deletes in TaxAuthLevels */ + $result = DB_query("DELETE FROM labelfields WHERE labelid= '" . $SelectedLabelID . "'",$db); + $result = DB_query("DELETE FROM labels WHERE labelid= '" . $SelectedLabelID . "'",$db); + prnMsg(_('The selected label template has been deleted'),'success'); + unset ($SelectedLabelID); +} + +if (!isset($SelectedLabelID)) { + +/* It could still be the second time the page has been run and a record has been selected for modification - SelectedLabelID will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of label templates will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ + + $sql = "SELECT labelid, + description, + papersize, + height, + width, + topmargin, + leftmargin, + rowheight, + columnwidth + FROM labels"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The defined label templates could not be retrieved because'); + $DbgMsg = _('The following SQL to retrieve the label templates was used'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + + if (DB_num_rows($result)>0){ + echo '<table class="selection"> + <tr> + <th>' . _('Description') . '</th> + <th>' . _('Page Size') . '</th> + <th>' . _('Height') . '</th> + <th>' . _('Width') . '</th> + <th>' . _('Row Height') . '</th> + <th>' . _('Column Width') . '</th> + </tr>'; + $k=0; + while ($myrow = DB_fetch_array($result)) { + + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + 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']); + + } + //END WHILE LIST LOOP + + //end of ifs and buts! + + echo '</table><p>'; + } //end if there are label definitions to show +} + +if (isset($SelectedLabelID)) { + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'">' . _('Review all defined label records') . '</a> + </div>'; +} + +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +if (isset($SelectedLabelID)) { + //editing an existing label + + $sql = "SELECT papersize, + description, + height, + width, + topmargin, + leftmargin, + rowheight, + columnwidth + FROM labels + WHERE labelid='" . $SelectedLabelID . "'"; + + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + + $_POST['PaperSize'] = $myrow['papersize']; + $_POST['Description'] = $myrow['description']; + $_POST['Height'] = $myrow['height']; + $_POST['TopMargin'] = $myrow['topmargin']; + $_POST['Width'] = $myrow['width']; + $_POST['LeftMargin'] = $myrow['leftmargin']; + $_POST['RowHeight'] = $myrow['rowheight']; + $_POST['ColumnWidth'] = $myrow['columnwidth']; + + echo '<input type="hidden" name="SelectedLabelID" value="' . $SelectedLabelID . '" />'; + +} //end of if $SelectedLabelID only do the else when a new record is being entered + + +if (!isset($_POST['Description'])) { + $_POST['Description']=''; +} +echo '<table class="selection"> + <tr> + <td><img src="css/paramsLabel.png"></td> + <td><table> + <tr> + <td>' . _('Label Description') . ':</td> + <td><input type="text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '" /></td> + </tr> + <tr> + <td>' . _('Label Paper Size') . ':</td> + <td><select name="PaperSize">'; + +foreach($PaperSize as $PaperType) { + if (isset($_POST['PaperSize']) AND $PaperType==$_POST['PaperSize']) { + echo '<option selected="selected" value="'; + } else { + echo '<option value="'; + } + echo $PaperType . '">' . $PaperType . '</option>'; + +} //end while loop + +echo '</select></td> + </tr>'; + +if (!isset($_POST['Height'])) { + $_POST['Height']=0; +} +if (!isset($_POST['TopMargin'])) { + $_POST['TopMargin']=5; +} +if (!isset($_POST['Width'])) { + $_POST['Width']=0; +} +if (!isset($_POST['LeftMargin'])) { + $_POST['LeftMargin']=10; +} +if (!isset($_POST['RowHeight'])) { + $_POST['RowHeight']=0; +} + +if (!isset($_POST['ColumnWidth'])) { + $_POST['ColumnWidth']=0; +} +echo '<tr> + <td>' . _('Label Height') . ' - (He):</td> + <td><input type="text" name="Height" size="4" maxlength="4" value="' . $_POST['Height'] . '" /></td> + </tr> + <tr> + <td>' . _('Label Width') . ' - (Wi):</td> + <td><input type="text" name="Width" size="4" maxlength="4" value="' . $_POST['Width'] . '" /></td> + </tr> + <tr> + <td>' . _('Top Margin') . ' - (Tm):</td> + <td><input type="text" name="TopMargin" size="4" maxlength="4" value="' . $_POST['TopMargin'] . '" /></td> + </tr> + <tr> + <td>' . _('Left Margin') . ' - (Lm):</td> + <td><input type="text" name="LeftMargin" size="4" maxlength="4" value="' . $_POST['LeftMargin'] . '" /></td> + </tr> + <tr> + <td>' . _('Row Height') . ' - (Rh):</td> + <td><input type="text" name="RowHeight" size="4" maxlength="4" value="' . $_POST['RowHeight'] . '" /></td> + </tr> + <tr> + <td>' . _('Column Width') . ' - (Cw):</td> + <td><input type="text" name="ColumnWidth" size="4" maxlength="4" value="' . $_POST['ColumnWidth'] . '" /></td> + </tr> + </table></td></tr> + </td></tr> + </table>'; + +if (isset($SelectedLabelID)) { + //get the fields to show + $SQL = "SELECT labelfieldid, + labelid, + fieldvalue, + vpos, + hpos, + fontsize, + barcode + FROM labelfields + WHERE labelid = '" . $SelectedLabelID . "' + ORDER BY vpos DESC"; + $ErrMsg = _('Could note get the label fields because'); + $result = DB_query($SQL,$db,$ErrMsg); + $i=0; + echo '<table class="selection"> + <tr> + <td><img src="css/labelsDim.png"></td> + <td><table> + <tr> + <th>' . _('Field') . '</th> + <th>' . _('Vertical') . '<br />' . _('Position') . '<br />(VPos)</th> + <th>' . _('Horizonal') . '<br />' . _('Position') . '<br />(HPos)</th> + <th>' . _('Font Size') . '</th> + <th>' . _('Bar-code') . '</th> + </tr>'; + if (DB_num_rows($result)>0){ + $k=0; + while ($myrow = DB_fetch_array($result)) { + + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + + echo '<input type="hidden" name="LabelFieldID' . $i . '" value="' . $myrow['labelfieldid'] . '" /> + <td><select name="FieldName' . $i . '">'; + if ($myrow['fieldvalue']=='itemcode'){ + echo '<option selected="selected" value="itemcode">' . _('Item Code') . '</option>'; + } else { + echo '<option value="itemcode">' . _('Item Code') . '</option>'; + } + if ($myrow['fieldvalue']=='itemdescription'){ + echo '<option selected="selected" value="itemdescription">' . _('Item Description') . '</option>'; + } else { + echo '<option value="itemdescription">' . _('Item Descrption') . '</option>'; + } + if ($myrow['fieldvalue']=='barcode'){ + echo '<option selected="selected" value="barcode">' . _('Item Barcode') . '</option>'; + } else { + echo '<option value="barcode">' . _('Item Barcode') . '</option>'; + } + if ($myrow['fieldvalue']=='price'){ + echo '<option selected="selected" value="price">' . _('Price') . '</option>'; + } else { + echo '<option value="price">' . _('Price') . '</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> + <td><input type="text" name="FontSize' . $i . '" size="4" maxlength="4" value="' . $myrow['fontsize'] . '" /></td> + <td><select name="Barcode' . $i . '">'; + if ($myrow['barcode']==0){ + echo '<option selected="selected" value="0">' . _('No') . '</option> + <option value="1">' . _('Yes') . '</option>'; + } else { + echo '<option selected="selected" value="1">' . _('Yes') . '</option> + <option value="0">' . _('No') . '</option>'; + } + echo '</select></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedLabelID=' . $SelectedLabelID . '&DeleteField=' . $myrow['labelfieldid'] .' onclick="return confirm(\'' . _('Are you sure you wish to delete this label field?') . '\');">' . _('Delete') . '</a></td> + </tr>'; + $i++; + } + //END WHILE LIST LOOP + $i--; //last increment needs to be wound back + echo '<input type="hidden" name="NoOfFieldsDefined" value="' . $i . '" />'; + } //end if there are label definitions to show + + echo '<tr> + <td><select name="FieldName"> + <option value="itemcode">' . _('Item Code') . '</option> + <option value="itemdescription">' . _('Item Descrption') . '</option> + <option value="barcode">' . _('Item Barcode') . '</option> + <option value="price">' . _('Price') . '</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> + <td><input type="text" size="4" maxlength="4" name="FontSize" /></td> + <td><select name="Barcode"> + <option value="1">' . _('Yes') . '</option> + <option selected="selected" value="0">' . _('No') . '</option> + </select></td> + </tr> + </table> + </td> + </tr> + </table> + <p />'; +} + +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; + +include('includes/footer.inc'); + ?> \ No newline at end of file Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-04-25 06:12:02 UTC (rev 5279) +++ trunk/PDFPrintLabel.php 2012-04-25 09:11:48 UTC (rev 5280) @@ -1,522 +1,260 @@ <?php +/* $Id: PDFPriceLabels.php 5228 2012-04-06 02:48:00Z vvs2012 $*/ -/* $Id: PDFPrintLabel.php 4285 2010-12-22 16:01:51Z tim_schofield $*/ - -$Version_adds= '1.2'; - include('includes/session.inc'); -require_once('includes/DefineLabelClass.php'); -$MsgErr=null; -$DecimalPlaces=2; -$pdf= null; -/* The variable $AllLabels is the global variable that contains the list */ -$AllLabels = getXMLFile(LABELS_FILE); -/* of all the label objects defined until now. In case of a fresh -installation or an empty XML labels file it holds a NULL value. +$PtsPerMM = 2.83465; //pdf millimetres to points -If there is no label templates, the user could select to set up a new one -*/ -if ($AllLabels==null) { +if (isset($_POST['PrintPDF']) + AND isset($_POST['FromCriteria']) + AND mb_strlen($_POST['FromCriteria'])>=1 + AND isset($_POST['ToCriteria']) + AND mb_strlen($_POST['ToCriteria'])>=1){ + + $result = DB_query("SELECT papersize, + description, + width*" . $PtsPerMM . " as label_width, + height*" . $PtsPerMM . " as label_height, + rowheight*" . $PtsPerMM . " as label_rowheight, + columnwidth*" . $PtsPerMM . " as label_columnwidth, + topmargin*" . $PtsPerMM . " as label_topmargin, + leftmargin*" . $PtsPerMM . " as label_leftmargin + FROM labels + 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']; - abortMsg( _('There isn\'t any label template to select for printing. Click') . - ' <a href="Labels.php"><b>' . _('HERE'). '</b></a> '. _('to set up a new one') ); -} + $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') ); + $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') ); -/** - * The option print was selected, first it is checked if there are enough data - * to print the labels. - */ -if (isset($_POST['PrintPDF']) OR isset($_POST['PDFTest']) ) { - if (!isset($_POST['QtyByItem']) OR (int)$_POST['QtyByItem']<1) - $MsgErr = _('You must specify the number of labels per item required'); - else { - if (count($_POST['StockID'])<1) - $MsgErr = _('You must select the items to be printed'); - else { - // - $label = $AllLabels->getLabel($_POST['LabelID']); - list($dimensions, $lines) = resizeLabel($label); - $formatPage = getPageDimensions($dimensions); - list($Page_Width, - $Page_Height, - $Top_Margin, - $Bottom_Margin, - $Left_Margin, - $Right_Margin) = $formatPage; - - // Do it! - $PaperSize = 'User_special'; // Don't use any of the predefined sizes - $DocumentPaper='LETTER'; - $DocumentOrientation='P'; // Correccion para la version trunk :( - include('includes/PDFStarter.php'); - if ($Version>='3.12') - $pdf->setPageFormat($formatPage); - $ok = printLabels( - $dimensions, - $lines, - intval($_POST['QtyByItem']), - $_POST['Currency'], - $_POST['SalesType'], - $_POST['StockID'], - FormatDateForSQL($_POST['EffectiveDate']) - ); - - if ($ok) - exit(); // the print was success - else // Has been ocurred an error - $MsgErr = _('There was an error. Consult your IT staff'); + $result = DB_query("SELECT fieldvalue, + vpos, + hpos, + fontsize, + barcode + FROM labelfields + WHERE labelid = '" . $_POST['LabelID'] . "'", + $db); + $LabelFields = array(); + $i=0; + while ($LabelFieldRow = DB_fetch_array($result)){ + if ($LabelFieldRow['fieldvalue'] == 'itemcode'){ + $LabelFields[$i]['FieldValue'] = 'stockid'; + } elseif ($LabelFieldRow['fieldvalue'] == 'itemdescription'){ + $LabelFields[$i]['FieldValue'] = 'description'; + } else { + $LabelFields[$i]['FieldValue'] = $LabelFieldRow['fieldvalue']; } + $LabelFields[$i]['VPos'] = $LabelFieldRow['vpos']*$PtsPerMM; + $LabelFields[$i]['HPos'] = $LabelFieldRow['hpos']*$PtsPerMM; + $LabelFields[$i]['FontSize'] = $LabelFieldRow['fontsize']; + $LabelFields[$i]['Barcode'] = $LabelFieldRow['barcode']; + $i++; } -} + + $SQL = "SELECT prices.stockid, + stockmaster.description, + stockmaster.barcode, + prices.price, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.currabrev='" . $_POST['Currency'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; + + $LabelsResult = DB_query($SQL,$db,'','',false,false); -/** - * There is not activated option print, then show the window for capture the printing - * options. - */ - -$title = _('Print Price Labels'); -include('includes/header.inc'); - -if ($MsgErr!=null) { - prnMsg($MsgErr,'warn'); -} - -showLabelOptions(); - -include('includes/footer.inc'); -exit(); - -function showLabelOptions() { - global $AllLabels, $DecimalPlaces, $rootpath, $theme; - $txt = array( - _('Label Sticker Printing'), - _('Select label type'), - _('Number of labels per item'), - _('Price list'), - _('Currency'), - _('Category'), - _('Effective Date'), - _('Update values') - ); - if (!isset($_POST['LabelID'])) - $_POST['LabelID']=(string)$AllLabels->label[0]->id; - $OptionLabels = selLabels($_POST['LabelID']); - if (!isset($_POST['QtyByItem'])) - $_POST['QtyByItem']=1; - if (!isset($_POST['SalesType'])) - $_POST['SalesType']=$_SESSION['DefaultPriceList']; - $OptionSales = selSalesType($_POST['SalesType']); - - if (!isset($_POST['Currency'])){ - $_POST['Currency']=$_SESSION['CompanyRecord']['currencydefault']; + if (DB_error_no($db) !=0) { + $title = _('Price Label') . ' - ' . _('Problem Report....'); + include('includes/header.inc'); + prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; + if ($debug==1){ + prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); + } + include('includes/footer.inc'); + exit; } - $DecimalPlaces=getDecimalPlaces($_POST['Currency']); + if (DB_num_rows($LabelsResult)==0){ + $title = _('Print Price Labels Error'); + include('includes/header.inc'); + prnMsg(_('There were no price labels to print out for the category specified'),'warn'); + echo '<br /><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'. _('Back').'</a>'; + include('includes/footer.inc'); + exit; + } - $OptionCurrency = selCurrency($_POST['Currency']); - if (!isset($_POST['Category'])) - $_POST['Category']=''; - $OptionsCategory = selCategory($_POST['Category']); + $style = array( + 'position' => '', + 'align' => 'C', + 'stretch' => false, + 'fitwidth' => true, + 'cellfitalign' => '', + 'border' => false, + 'hpadding' => 'auto', + 'vpadding' => 'auto', + 'fgcolor' => array(0,0,0), + 'bgcolor' => false, //array(255,255,255), + 'text' => false, + 'font' => 'helvetica', + 'fontsize' => 8, + 'stretchtext' => 4 ); - $TableItems = tableItems($_POST['Category'], $okItems); + $PageNumber=1; + //go down first then accross + $YPos = $Page_Height - $Top_Margin; //top of current label + $XPos = $Left_Margin; // left of current label - if (!isset($_POST['EffectiveDate'])){ - $_POST['EffectiveDate']=Date($_SESSION['DefaultDateFormat']); + while ($PriceLabels = DB_fetch_array($LabelsResult,$db)){ + foreach ($LabelFields as $Field){ + 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'],locale_number_format($PriceLabels['price'],$PriceLabels['decimalplaces']),'right'); + } elseif($Field['Barcode']==1) { + + /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') + * 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('_','',$PriceLabels[$Field['FieldValue']]), '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'); + } else { + $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$PriceLabels[$Field['FieldValue']]); + } + } // 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 + */ + $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 space below to print a label + */ + $YPos -= $LabelDimensions['label_rowheight']; //Top of next label + } } - $SendButton = '<br /><div class="centre"><input type="submit" name="PrintPDF" value="'. _('Print labels') .'" /> - <input type="submit" name="PDFTest" value="'. _('Print labels with borders') .'" /></div>'; - $iTxt=0; - echo '<script type="text/javascript"> - function setAll(all) { - var x=document.getElementById("form1"); - for (var i=0;i<x.length;i++) { - if (x.elements[i].id=="item"); - x.elements[i].checked=all.checked; - } - } - </script>'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' .$txt[$iTxt++].'</p>'; - echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'" method="post" id="form1">'; - echo '<div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tbody>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="LabelID">'. - $OptionLabels - .'</select></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><input type="text" class="number" name="QtyByItem" value="'.$_POST['QtyByItem'].'" size="2" - maxlength="4" /></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="SalesType" onchange="ReloadForm(form1.refresh)"> - '.$OptionSales.' - </select></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="Currency" onchange="ReloadForm(form1.refresh)"> - '.$OptionCurrency.' - </select></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="Category" onchange="ReloadForm(form1.refresh)"> - '.$OptionsCategory.' - </select> </td> - </tr>'; - echo '<tr><td class="number">'.$txt[$iTxt++].':</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="EffectiveDate" size="11" maxlength="10" value="' . $_POST['EffectiveDate'] . '" /></td></tr>'; - echo '<tr> - <th colspan="2"> - <input type="submit" name="refresh" value="' . _('Refresh options') . '" /> - </th> - </tr>'; - echo '<tr> - <td colspan="2"> - '.$TableItems.' - </td> - </tr>'; - echo '</tbody> - </table> - '.$SendButton.' - </div> - </form>'; -} + $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; + ob_clean(); + $pdf->OutputD($FileName); + $pdf->__destruct(); -function selLabels($type) { - global $AllLabels; - $list=array(); +} else { /*The option to print PDF was not hit */ - foreach ($AllLabels->label as $label) - $list[(string)$label->id] = (string)$label->description; + $title= _('Price Labels'); + include('includes/header.inc'); - return selectOptions($list, $type); -} + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Price Labels') . '" alt="" /> + ' . ' ' . _('Print Price Labels') . '</p>'; -function selSalesType($type) { - return selectTable('SELECT typeabbrev, sales_type FROM salestypes ORDER BY sales_type', $type); -} + if (!isset($_POST['FromCriteria']) OR !isset($_POST['ToCriteria'])) { -function selCurrency($curr) { - return selectTable('SELECT currabrev, currency FROM currencies', $curr); -} + /*if $FromCriteria is not set then show a form to allow input */ -function selCategory(&$categ) { - return selectTable('SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription', $categ); -} - -function selectTable($sql, &$currentKey) { - global $db; - $result = DB_query($sql, $db); - while ($myrow=DB_fetch_row($result)) { - if (empty($currentKey)) - $currentKey=$myrow[0]; - $list[$myrow[0]] = $myrow[1]; - } - DB_free_result($result); - return selectOptions($list, $currentKey); -} - -function selectOptions($list, $currentKey) { - $html=''; - foreach ($list as $key=>$value) { - $xs = ($currentKey==$key) ? ' selected="selected"':''; - $html .= ' - <option value="'. $key .'"'. $xs .'>'. $value. '</option>'; - } - return $html; -} - -function tableItems($CategoryID, &$ok) { - global $db, $DecimalPlaces; - - if (empty($CategoryID)) { - $ok=false; - return noneButton( _('Select a Category') ); - } - $result = getStockItems($CategoryID, $_POST['Currency'], $_POST['SalesType'], FormatDateForSQL($_POST['EffectiveDate'])); - if (!DB_num_rows($result)) { - $ok=false; - return noneButton( _('This category has no items to show') ); - } - - $txt=array(_('Code'), - _('Description'), - _('Price'). '<br />('.$_POST['Currency'].')', - _('All') - ); - $ix=0; - // The table's header - $html= '<table border="0" width="100%"> - <thead> - <tr> - <th>'.$txt[$ix++].'</th> - <th>'.$txt[$ix++].'</th> - <th>'.$txt[$ix++].'</th> - <th colspan="2" align="center">'.$txt[$ix++].' - <input type="checkbox" checked="checked" onclick="setAll(this);" /> - </th> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection">'; + echo '<tr> + <td>' . _('Label to print') . ':</td> + <td><select name="LabelID">'; + + $LabelResult = DB_query("SELECT labelid, description FROM labels",$db); + while ($LabelRow = DB_fetch_array($LabelResult)){ + echo '<option value="' . $LabelRow['labelid'] . '">' . $LabelRow['description'] . '</option>'; + } + echo '</select></td> </tr> - </thead> + <tr> + <td>'. _('From Inventory Category Code') .':</td> + <td><select name="FromCriteria">'; - <tbody>'; - $ok=true; - $odd=true; - while ($myrow=DB_fetch_array($result)) { - $price = locale_number_format($myrow['price'],$DecimalPlaces); - $oddEven=$odd?"Odd":"Even"; - $odd = !$odd; - $html .= <<<ZZZ - <tr class="{$oddEven}TableRows"> - <td>{$myrow['stockid']}</td> - <td>{$myrow['description']}</td> - <td class="number">{$price}</td> - <td><div class="centre"> - <input type="checkbox" checked="checked" name="StockID[{$myrow['stockid']}]" id="item" /> - </div> - </td> - <td> </td> - </tr> -ZZZ; - } - return $html . ' - </tbody> - </table>'; -} + $CatResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid",$db); + while ($myrow = DB_fetch_array($CatResult)){ + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + } + echo '</select></td></tr>'; -function noneButton($msg) { - return ' - <div class="centre"> - <input type="button" disabled name="None" value="'. $msg . '" /> - </div>'; -} + echo '<tr><td>' . _('To Inventory Category Code'). ':</td> + <td><select name="ToCriteria">'; -/** - * This access to item data includes its price. - * The routine works in two contexts: when only the category is given - * it looks for all the items - */ -function getStockItems($CategoryID, $CurrCode, $SalesType, $EffectiveDate, $StockID=false) { - global $db, $Today; + /*Set the index for the categories result set back to 0 */ + DB_data_seek($CatResult,0); - if ($StockID!==false) { - $WhereClause = "stockmaster.stockid='$StockID' LIMIT 1"; - } else { - $WhereClause = "stockmaster.categoryid='$CategoryID' ORDER BY stockmaster.stockid"; - } - - $WhereClause = " stockmaster.discontinued!=1 AND " . $WhereClause; - - $sql="SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.longdescription, - stockmaster.barcode, - prices.price - FROM stockmaster LEFT JOIN prices - ON stockmaster.stockid=prices.stockid - AND prices.currabrev = '" . $CurrCode . "' - AND prices.typeabbrev= '" . $SalesType . "' - AND prices.startdate <= '" . $EffectiveDate . "' - AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00') - AND prices.debtorno='' - WHERE " . $WhereClause; - - return DB_query($sql, $db); -} - -function getStockData($StockID, $Currency, $salesType, $EffectiveDate) { - $result = getStockItems(null, $Currency, $salesType, $EffectiveDate, $StockID); - return DB_fetch_array($result); -} - -/** - * Change de scale of data given by points - * Returns two array for the dimension and lines of data - */ -function resizeLabel($label) { - global $DimensionTags, $DataTags; - - //<* Values required from the beggining - $scales=array('pt'=>1, 'in'=>72, 'mm'=>(float)72/25.4, 'cm'=>(float)72/2.54); - - $obj = $label->dimensions; - $unit = (string)$obj->Unit; - if ( array_key_exists($unit , $scales) ) { - $factor = $scales[$unit]; - } else { - abortMsg( _('Unit not defined in scale operation! Correct the template') ); - } - - $dims = array(); - foreach ($DimensionTags as $iTag=>$tag) { - if ($tag['type']=='n') // it is a data numeric - $dims[$iTag] = round(((float)$obj->$iTag)*$factor, 3); - elseif ($tag['type']=='i') - $dims[$iTag] = (int)$obj->$iTag; - } - - $obj = $label->data; - $line = array(); - $i=0; - foreach ($obj->line as $labelLine) { - $line[$i] = array(); - foreach ($DataTags as $iTag=>$tag) { - if ($tag['type']=='n') // it is a data numeric - $line[$i][$iTag]= round(((float)$labelLine->$iTag)*$factor, 3); - else - $line[$i][$iTag]=(string)$labelLine->$iTag; // field to use in printing data + While ($myrow = DB_fetch_array($CatResult)){ + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; } - $i++; - } - return array($dims, $line); -} + echo '</select></td></tr>'; -/** - * Returns the following data: - * $Page_Width, - * $Page_Height, - * $Top_Margin, - * $Bottom_Margin, - * $Left_Margin, - * $Right_Margin - */ -function getPageDimensions($dimensions) { - $bm =(float)$dimensions['Sh'] - ( (float)$dimensions['Tm'] + - (int)$dimensions['Rows']*(float)$dimensions['He']); - $rm =(float)$dimensions['Sw'] - ( (float)$dimensions['Lm'] + - (int)$dimensions['Cols']*(float)$dimensions['Wi']); - return array( - (float)$dimensions['Sw'], - (float)$dimensions['Sh'], - (float)$dimensions['Tm'], 0, -// ($bm>0?$bm:0), - (float)$dimensions['Lm'], 0 -// ($rm>0?$rm:0) - ); -} + echo '<tr><td>' . _('For Sales Type/Price List').':</td> + <td><select name="SalesType">'; + $sql = "SELECT sales_type, typeabbrev FROM salestypes"; + $SalesTypesResult=DB_query($sql,$db); -function printLabels($dimensions, $lines, $qtyByItem, $Currency, $salesType, $StockIDList, $EffectiveDate) { - global $pdf, $DecimalPlaces, $Version; - $row = $col = 0; - - $DecimalPlaces=getDecimalPlaces($Currency); - - foreach ($StockIDList as $StockID=>$on) { // At least there is one item - $itemData = getStockData($StockID, $Currency, $salesType, $EffectiveDate); - $num=$qtyByItem; - while ($num-- > 0) { // Print $num labels per item - printStockid($itemData, $dimensions, $lines, $Currency, $row, $col); - if (++$col>=$dimensions['Cols']) { - $col=0; - if (++$row>=$dimensions['Rows']) { - $row=0; - $pdf->newpage(); - } + while ($myrow=DB_fetch_array($SalesTypesResult)){ + if ($_SESSION['DefaultPriceList']==$myrow['typeabbrev']){ + echo '<option selected="selected" value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; + } else { + echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } } - } - /* if ($row OR $col) // it seems to be unnecesary. - $pdf->newpage(); */ + echo '</select></td></tr>'; - // now, emit the PDF file (if not errors!) - if ($Version>="3.12") { - $pdf->OutputD($_SESSION['DatabaseName'] . '_Labels_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN - } else { - $pdfcode = $pdf->output(); - $len = mb_strlen($pdfcode); + echo '<tr><td>' . _('For Currency').':</td> + <td><select name="Currency">'; + $sql = "SELECT currabrev, country, currency FROM currencies"; + $CurrenciesResult=DB_query($sql,$db); - if ($len<=20){ - return false; - } else{ - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=Labels.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Stream(); + while ($myrow=DB_fetch_array($CurrenciesResult)){ + if ($_SESSION['CompanyRecord']['currencydefault']==$myrow['currabrev']){ + echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $myrow['country'] . ' - ' .$myrow['currency'] . '</option>'; + } else { + echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['country'] . ' - ' .$myrow['currency'] . '</option>'; + } } - } - return true; // All fine!! -} + echo '</select></td></tr>'; -/*! \brief The heart of the program (perhaps the liver) - * - * It shows the data label from the input $data as update data (id read only) - * if the third parameter is true or a fresh data label (new label). It is - * possible that the combination $data valid and $readonly false occurs when - * invalid data needs to be recaptured because an error in a new label capture. - */ -function printStockid($itemData, $labelDim, $dataParams, $Currency, $row, $col) { - global $pdf, $DecimalPlaces; -//echo $row.':'.$col.'<br />'; - // Calculate the bottom left corner position - $iX = $labelDim['Lm'] + $col * $labelDim['Cw']; - $iY = $labelDim['Sh'] - ($labelDim['Tm'] + ($row+1) * $labelDim['Rh']); + echo '<tr><td>' . _('Effective As At') . ':</td>'; + echo '<td><input type="text" size="11" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveDate" value="' . Date($_SESSION['DefaultDateFormat']) . '" />'; + echo '</td></tr>'; - if (isset($_POST['PDFTest'])) { - $pdf->line($iX, $iY+$labelDim['He'], $iX+$labelDim['Wi'], $iY+$labelDim['He']); // top - $pdf->line($iX, $iY, $iX+$labelDim['Wi'], $iY); // bottom - $pdf->line($iX, $iY, $iX, $iY+$labelDim['He']); // left - $pdf->line($iX+$labelDim['Wi'], $iY, $iX+$labelDim['Wi'], $iY+$labelDim['He']); + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'. _('Print PDF'). '" /> + </div> + </form>'; } - // Now, for every data, write down the correspondig text - $descrip= $ldescrip=''; - foreach ($dataParams as $line) { - unset($resid); // unlink the previous residue - unset($txt); - $adj='left'; - switch ($line['dat']) { - case 'code': - $txt = $itemData['stockid']; - break; - case 'name1': - $txt = $itemData['description']; - $resid = &$descrip; - break; - case 'name2': - $txt = $descrip; - unset($descrip); - break; - case 'lname1': - $txt = $itemData['longdescription']; - $resid = &$ldescrip; - break; - case 'lname2': - $txt = $ldescrip; - unset($ldescrip); - break; - case 'price': - $txt = locale_number_format($itemData['price'], $DecimalPlaces). ' '. $Currency; -// $adj='left'; - break; - case 'bcode': break; - } - $ix = $iX + $line['pos']; - $iy = $iY + $line['row']; - if (isset($txt)) { - $resid = $pdf->addTextWrap($ix,$iy,$line['max'],$line['font'],$txt, $adj); - } - } -} + include('includes/footer.inc'); -function getDecimalPlaces($Currency) { - global $db; - $sql="SELECT decimalplaces FROM currencies WHERE currabrev='$Currency'"; - $result = DB_query($sql, $db); - if (!DB_num_rows($result)) - abortMsg(_('Couldnt get the currency data')); - $myrow=DB_fetch_row($result); - return $myrow[0]; -} +} /*end of else not PrintPDF */ + ?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-25 06:12:02 UTC (rev 5279) +++ trunk/doc/... [truncated message content] |
From: <dai...@us...> - 2012-04-25 10:26:59
|
Revision: 5280 http://web-erp.svn.sourceforge.net/web-erp/?rev=5280&view=rev Author: daintree Date: 2012-04-25 09:11:48 +0000 (Wed, 25 Apr 2012) Log Message: ----------- rewrite of label printing code Modified Paths: -------------- trunk/Labels.php trunk/PDFPrintLabel.php trunk/doc/Change.log trunk/includes/class.pdf.php trunk/includes/tcpdf/tcpdf.php trunk/sql/mysql/upgrade4.07-4.08.sql Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-04-25 06:12:02 UTC (rev 5279) +++ trunk/Labels.php 2012-04-25 09:11:48 UTC (rev 5280) @@ -1,563 +1,450 @@ -<?php -/** - * <b>Labels XML file Managment</b> - * This program maintains the XML file containing the label defintions - * used to print the products prices tickets - * @author Marcos R Garcia <addsmgt at gmail dot com> - * @version 1.1 - * Last changes: 2010-08-31 - * - * - * Phil's notes: - * This is an example of clever code that works but IMHO is very hard to decipher and modify - sorry Marcos! - * It is in webERP because it fulfills a useful function on its own but don't expect to be able to modify it!! - * I would prefer this code was re-written in a manner consistent with the rest of webERP - * There are many meaningless variable names - * unecessary abrastaction at every turn - * No class is necessary for this script IMHO - * Data held in an xml file instead of the database - * Variable naming uses a lower case first character - * $debug is used - but is a webERP global to trap SQL errors for sysadmins - * -**/ - -$Version_adds= 1.1; - -include('includes/session.inc'); -$title=_('Label Templates Maintainance'); -include('includes/header.inc'); - -$debug=false; -include('includes/DefineLabelClass.php'); - - -//Phil why xml? Why not use the database like every other part of webERP for storing data - -$allLabels = //!< The variable $allLabels is the global variable that contains the list - getXMLFile($_SESSION['reports_dir'] . '/labels.xml'); //!< of all the label objects defined until now. In case of a fresh - //!< installation or an empty XML labels file it holds a NULL value. - -if ($debug) { - echo '<br />' ; - echo '<pre>'; - print_r($_POST); - echo '</pre>'; -//exit(); -} - -/** Check if some action has been requested -*/ -$showList=true; // By default will show the tamplates list - -/** - * Save the changes in template? - */ -if (isset($_POST['Update'])) { - // Get the data from the user input & validate it (not new) - //getData function - $Label=getData($_POST, false, $ok); - // If all OK try to update the requested label - if (!$ok OR !updateLabel($Label)) { - // show the data label from the input data as update data (id read only)} - showLabel($Label, _('Correct data'), $theme, false); - $showList=false; - } - -/** - * Save the data for a new template? - */ -} elseif (isset($_POST['Save'])) { - // Get the data from the user input & validate it for new id - $Label=getData($_POST, true, $ok); - if (!$ok OR !createLabel($Label)) { // - showLabel($Label, _('Correct data'), $theme, false); - $showList=false; - } - -/** - * Get the data from an old one to create a new template? - */ -} elseif (isset($_POST['Copy'])) { - $Label=$allLabels->getLabel($_POST['labelID']); - $Label->id = _('New ID'); // Well, where did I get it? of course from the user, but .. - showLabel($Label, _('Edit data new label'), $theme, false); - $showList=false; - -/** - * Change some data from an old template? - */ -} elseif (isset($_POST['Edit'])) { - $Label=$allLabels->getLabel($_POST['labelID']); - showLabel($Label, _('Edit data label'), $theme, true); - $showList=false; - -/** - * Eliminate an unnecesary template? - */ -} elseif (isset($_POST['Delete'])) { - $allLabels=deleteLabel($allLabels, $_POST['labelID']); - -/** - * Create a new template? - */ -} elseif (isset($_POST['New'])) { - showLabel(null, _('New label'), $theme); - $showList=false; - -/** - * Do nothing? only show the list (if it exist)) - */ -} elseif (isset($_POST['Cancel'])) { - ; // showLabelList - -/** - * No action requested, show all or get the first one - */ -} else { - if ($allLabels==null OR count($allLabels->label)<1) { - showLabel(null, _('There is no labels, create a new one'), $theme); - $showList=false; - } -} - -/** - * The default is to show the list of labels templates yet defined, - * the exception occurs when previously has been selected a particular - * template, for edit, copy or to create a new one - */ -if ($showList) { - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; - showLabelsList($allLabels->label); -} -include('includes/footer.inc'); -exit(); - -/*! \brief getData - Gets the input data from the user's submit - * - * This code constructs a new objet Label from the form's data - * provided by the user. It validates the data too. - * @param $data The array of strings gived by the user - * @param $new This flag indicates that the labels is new, so check no repeated id - * @param $ok The variable where the routine gives the validation result. - * @return The Label object constructed qith the data, included errors. - */ -function getData($data, $new, &$ok) { - $ok = validData($data, $new); - return newLabel($data); -} - -function validData($data, $new) { - global $allLabels, $DimensionTags, $DataTags; - -// Check the heading data - $errors=array(); - if ($new) { - if (empty($data['id'])) { - $errors[]=_('Id required'); - } elseif ($allLabels!=null AND $allLabels->findLabel($data['id'])!==false){ - $errors[]=_('This id exists in previous list'); - } - } - if (empty($data['description'])) - $errors=_('the description is required'); - -// Check the dimensions data - foreach ($DimensionTags as $iTag=>$tag) { - if ($tag['type']=='s') { - continue; // select type does not require validation - } - $dd = trim($data[$iTag]); - $desc=$tag['desc']; - switch ($tag['type']) { - case 'n': - if (!is_numeric($dd)) - $errors[]= _('The value of').' '.$desc.' '._('would be numeric'); - elseif ((float)$data[$iTag]<=0) - $errors[]= _('The value of').' '.$desc.' '._('requires a positive value').$dd; - break; - case 'i': - if (!is_numeric($dd) OR (int)$data[$iTag]<=0) - $errors[]= _('The value of').' '.$tag['desc'].' '._('would be a positive integer'); - break; - } - } - // Checking consistency between data - // Rh > He - $tag = $DimensionTags[$iTag='Rh']; - if ((float)$data['Rh'] < (float)$data['He'] ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the height of the labels'); - } - // Sh >= rows*Rh+Tm - $tag = $DimensionTags[$iTag='Sh']; - if ((float)$data['Sh'] <= (float)$data['Tm'] + ( (int)$data['Rows']*((float)$data['Rh']) ) ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the height of all the rows, including the top margin'); - } - // Cw > Wi - $tag = $DimensionTags[$iTag='Cw']; - if ((float)$data['Cw'] < (float)$data['Wi'] ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the width of the labels'); - } - // Sw >= Cols*Cw+Lm - $tag = $DimensionTags[$iTag='Sw']; - if ((float)$data['Sw'] <= (float)$data['Lm'] + ( (int)$data['Cols']*((float)$data['Cw']) ) ) { - $desc=$tag['desc']; - $errors[]= _('The value of').' '.$desc.' '._('requires to be greater than the width of all the cols, including the left margin'); - } - - $rowCount=0; - $jRow=0; - foreach ($data['row'] as $iRow=>$row) { - $jRow++; - if (empty($row)) continue; // The empty row indicates no data - $rowCount++; // we have data - - if (!is_numeric($row) ) $row=0; - else $row = (float)$row; - if ($row<=0) - $errors[]= _('The vert. pos. value would be positive') ." ($jRow)"; - elseif ((float)$row>(float)$data['He']) - $errors[]= _('The value of the vert. pos. would be less than')." ". $data['He'] ."($jRow)"; - - // now the rest of the line data is validated - foreach ($DataTags as $iTag=>$tag) { - if ($tag['type']=='s' // select type does not require validation - OR $iTag == 'row') continue; // the row is just validated - $dd = trim($data[$iTag][$iRow]); - $desc=$tag['desc']; - if ($tag['type']=='n') { - if (!is_numeric($dd)) - $errors[]= _('The value of').' '.$desc.' '._('would be numeric')." ($jRow)"; - elseif (empty($dd) OR (float)$dd<=0) - $errors[]= _('The value of').' '.$desc.' '._('requires a positive value')." ($jRow)"; - } - switch ($iTag) { - case 'font': - if ((float)$dd+$row >= (float)$data['He']) { - $errors[]= _('The value of').' '.$desc.' '._('in this position exceeds the label height'). - " ($jRow)"; - } - break; - case 'pos': - $posD = (float)$dd; - break; - case 'max': - if ((float)$dd+$posD >= (float)$data['Wi']) { - $errors[]= _('The position and lenght of the string leads the text to get out of the label'). " ($jRow)"; - } - break; - } - } - } - // Display the errors detected - if (count($errors)>0) { - foreach($errors as $err) - prnMsg($err); - return false; - } - return true; // all data are valid! -} - -/*! \brief Shows the label requested - * - * It shows the data label from the input $data as update data (id read only) - * if the third parameter is true or a fresh data label (new label). It is - * possible that the combination $data valid and $ReadOnly false occurs when - * invalid data needs to be recaptured because an error in a new label capture. - */ -function showLabel($Label, $msg, $theme, $ReadOnly=false) { - global $rootpath; - if ($Label==null) - $Label = newLabel(); - if ($ReadOnly) { - $name = 'Update'; - $value = _('Update'); - } else { - $name = 'Save'; - $value = _('Save'); - } - - $vCancel = _('Cancel'); - - $TableGD = setTableGD($Label, $ReadOnly); - $TableLines = setTableLines($Label->data->line); - - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $msg.'</p>'; - - echo '<br /> - <form action="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'" method="post"> - <div> - <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <div class="centre"> - <table border="2" cellspacing="4" class="selection"> - <tbody> - <tr> - <td align="center"><img src="'.$rootpath.'/css/paramsLabel.png" alt="" /></td> - <td>'.$TableGD.'</td> - </tr> - <tr> - <td align="center"><img src="'.$rootpath.'/css/labelsDim.png" alt="" /></td> - <td>'.$TableLines.'</td> - </tr> - </tbody> - </table> - <br /> - <input type="submit" name="'.$name.'" value="'.$value.'" /> - <input type="submit" name="Cancel" value="'.$vCancel.'" /> - </div> - </div> - </form>'; -} - -function setTableGD($Label, $ReadOnly) { - global $GlobalTags, $DimensionTags; - $html='<table class="selection">'; - $html .= setDataFields($GlobalTags, 0, $Label, $specialTag='id', $ReadOnly); - $html .= setDataFields($DimensionTags, 1, $Label->dimensions); - $html .= ' - </table>'; - return $html; -} - -function setDataFields($tags, $withTagId, $data, $specialTag=false, $ReadOnly=false) { - $iCol=0; - $html = ''; - foreach ($tags as $iTag=>$tag) { - $vDat = (is_object($data) AND isset($data->$iTag))?$data->$iTag:''; - if ($tag['type']=='s') { - $input ='<select name="'. $iTag . '">'; - foreach ($tag['values'] as $i=>$val) { - $xSel = ($vDat==$i)?' selected="selected"' : ''; - $input .= ' - <option value="'. $i .'"'. $xSel .'>'.$val.'</option>'; - } - $input .= ' - </select>'; - } else { - $ro=''; - if ($ReadOnly AND $specialTag==$iTag) - $ro='readonly="readonly"'; - $input = '<input type="text" name="'. $iTag .'" value="'. $vDat .'" size="'. $tag['sz'] .'" maxlength="'. $tag['maxsz'] .'" '. $ro .' />'; - } - if (!$iCol++) // when zero begins a line - $html .= ' - <tr>'; - else - $iCol=0; - $wTag= $withTagId ? (' ('.$iTag.')') :''; - $html .= ' - <td align="right">' . $tag['desc'] . $wTag . ':</td> - <td>' . $input . '</td>'; - if (!$iCol) - $html .= ' - </tr>'; - } - if ($iCol) // if the count ends in an odd count, add the end of line - $html .= ' - </tr>'; - - return $html; -} - -function setTableLines($lineArray) { - global $DataTags; - $html='<table class="selection">'; - $html .= setTableHeader($DataTags); - - $iCount=MAX_LINES_PER_LABEL; - foreach ($lineArray as $i=>$data) { - $iCount--; - $html .= setLineFields($DataTags, $data); - } - while ($iCount-->0) - $html .= setLineFields($DataTags, null); - $html .= ' - </table>'; - return $html; -} - -function setTableHeader($tags) { - $html= ' - <tr>'; - foreach ($tags as $tit) - $html .= ' - <th>' . $tit['desc'] . '</th>'; - return $html . ' - </tr>'; -} - -function setLineFields($tags, $data) { - $html = ' - <tr>'; - foreach ($tags as $iTag=>$tag) { - $vDat = ($data!=null AND isset($data->$iTag))?$data->$iTag:''; - if ($tag['type']=='s') { - $input ='<select name="'. $iTag . '[]">'; - foreach ($tag['values'] as $kI=>$kVal) { - $xSel = ($vDat==$kI) ? ' selected="selected"':''; - $input .= ' - <option value="'. $kI .'"'. $xSel .'>'.$kVal.'</option>'; - } - $input .= ' - </select>'; - } else { - $input = '<input type="text" name="'. $iTag .'[]" value="'. $vDat .'" size="'. $tag['sz'] .'" maxlength="'. $tag['maxsz'] .'" />'; - } - $html .= ' - <td align="center">' . $input . '</td>'; - } - $html .= ' - </tr>'; - return $html; -} - -/*! \brief Shows the current label list -* -* When the user begin or finishes an maintance action, the program -* shows the current list, in particular, the ID and the description of the label. -* -* @param $list The label object list to be displayed -* @return Nothing -*/ -function showLabelsList($list) { - $txt= array(_('Label id'),_('Description'), _('Label array'), - _('New'), _('Edit'), _('Copy'), _('Delete'), - _('Do you really want to erase the label') - ); - // The header of the list - echo '<script type="text/javascript"> - function submitForm(formID, action, value) { - document.getElementById(\'action\').name=action; - document.getElementById(\'labelID\').value=value; - document.getElementById(formID).submit(); - } - function areYouSure(form, action, value) { - var r=confirm("'.$txt[7].'"); - if (r) { - submitForm(form, action, value); - } - } - </script> - <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" id="form1"> - <div> - <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <input type="hidden" name="action" id="action" value="" /> - <input type="hidden" name="labelID" id="labelID" value="" /> - </div> - </form> - <div class="centre"> - <table class="selection"> - <thead> - <tr> - <th>'.$txt[0].'</th> - <th>'.$txt[1].'</th> - <th>'.$txt[2].'</th> - <th><input type="submit" name="new" onclick="submitForm(\'form1\',\'New\',\'\');" value="'.$txt[3].'" /> - </th> - </tr> - </thead> - <tbody>'; - foreach ($list as $Label) { - $dim = (string)$Label->dimensions->Rows. ' x '. (string)$Label->dimensions->Cols; - echo ' - <tr><td>'. $Label->id . '</td> - <td>'. $Label->description . '</td> - <td><div class="centre">'. $dim . '</div></td> - <td><input type="submit" onclick="submitForm('. "'form1','Edit','". $Label->id . "');" .'" value="' . $txt[4]. '" /> - <input type="submit" onclick="submitForm('. "'form1','Copy','". $Label->id . "');" .'" value="' . $txt[5]. '" /> - <input type="submit" onclick="areYouSure('. "'form1','Delete','". $Label->id . "');" .'" value="' . $txt[6]. '" /> - </td> - </tr>'; - } - echo ' - </tbody> - </table> - </div>'; -} - -/*! \brief Generates a new label -* -* After the user gives the label data, this routine tries to insert -* the new label in the current list. -* -* @param $Label The object label that will replace an old one -* @return True when the update was ok -*/ -function createLabel($Label) { - global $allLabels; - $new = emptyList(); - $done=false; - if ($allLabels!=null) { - foreach ($allLabels as $oldLabel) { - if (!$done AND (string)$oldLabel->id >= (string)$Label->id) { - $new->addLabel($Label); - $done=true; - } - $new->addLabel($oldLabel); // inser data in the list, replacing the old one - } - } - if (!$done) - $new->addLabel($Label); - $allLabels = $new; - rewrite($allLabels); // rewrite it to the XML file - return true; -} - -/*! \brief Update the label data -* -* After the user modifies the label data this routine tries to update -* the corresponding structure in the label list with the object given. -* If the label with the id of the new one is found, the object could -* be accepted in the list and written to the XML file. -* -* @param $Label The object label that will replace an old one -* @return True when the update was ok -*/ -function updateLabel($Label) { - global $allLabels; - $new = emptyList(); - foreach ($allLabels as $oldLabel) { - if ((string)$oldLabel->id == (string)$Label->id) - $new->addLabel($Label); - else - $new->addLabel($oldLabel); // inser data in the list, replacing the old one - } - $allLabels = $new; - rewrite($allLabels); // rewrite it to the XML file - return true; -} - -/*! \brief Label elimination from the list. - * - * This routine eliminates one label from the global list $allLabels. It - * just find the index that correspond to the id given as input data. - * Because this function is called from the selection of a button with - * correct data, it would be unsual that some error exist, but it is - * included the code for the validation of some this strange case. - * - * @param $LabelID is the identifier of the label to delete. - * @see $allLabels - * @return true in case of success - */ -function deleteLabel($list, $LabelID) { - $new = emptyList(); - foreach ($list as $Label) { - if ((string)$Label->id!=$LabelID) - $new->addLabel($Label); - } - rewrite($new); - return $new; -} - -function rewrite($list) { - // First rename the previous XML file - if (is_file(LABELS_FILE) AND !rename(LABELS_FILE, LABELS_FILE.".bak")) - abortMsg(_('Could not rename the previous file.')); - $result=$list->asXML(LABELS_FILE); - if (!$result) - abortMsg(_('Could not create the new XML file.').': '.LABELS_FILE); -} - +<?php + +/* $Id: Labels.php 4950 2012-02-22 06:26:38Z daintree $*/ + +include('includes/session.inc'); +$title = _('Label Templates'); +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'); + + +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Label Template Maintenance') + . '" alt="" />' . $title. ' + </p>'; + +if (isset($_POST['SelectedLabelID'])){ + $SelectedLabelID =$_POST['SelectedLabelID']; + if (ctype_digit($_POST['NoOfFieldsDefined'])){ //Now Process any field updates + + for ($i=0;$i<=$_POST['NoOfFieldsDefined'];$i++){ + + if (ctype_digit($_POST['VPos' . $i]) + AND ctype_digit($_POST['HPos' . $i]) + AND ctype_digit($_POST['FontSize' . $i])){ // if all entries are integers + + $result =DB_query("UPDATE labelfields SET fieldvalue='" . $_POST['FieldName' . $i] . "', + vpos='" . $_POST['VPos' . $i] . "', + hpos='" . $_POST['HPos' . $i] . "', + fontsize='" . $_POST['FontSize' . $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'); + } + } + } + if (ctype_digit($_POST['VPos']) AND ctype_digit($_POST['HPos']) AND ctype_digit($_POST['FontSize'])){ + //insert the new label field entered + $result = DB_query("INSERT INTO labelfields (labelid, + fieldvalue, + vpos, + hpos, + fontsize, + barcode) + VALUES ('" . $SelectedLabelID . "', + '" . $_POST['FieldName'] . "', + '" . $_POST['VPos'] . "', + '" . $_POST['HPos'] . "', + '" . $_POST['FontSize'] . "', + '" . $_POST['Barcode'] . "')", + $db); + } +} elseif(isset($_GET['SelectedLabelID'])){ + $SelectedLabelID =$_GET['SelectedLabelID']; + if (isset($_GET['DeleteField'])){ //then process any deleted fields + $result = DB_query("DELETE FROM labelfields WHERE labelfieldid='" . $_GET['DeleteField'] . "'",$db); + } +} + +if (isset($_POST['submit'])) { + $InputError = 0; + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + if ( trim( $_POST['Description'] ) == '' ) { + $InputError = 1; + prnMsg( _('The label description may not be empty'), 'error'); + } + $Message = ''; + 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'] . "', + height = '" . $_POST['Height'] . "', + topmargin = '". $_POST['TopMargin'] . "', + width = '". $_POST['Width'] . "', + leftmargin = '". $_POST['LeftMargin'] . "', + rowheight = '". $_POST['RowHeight'] . "', + columnwidth = '". $_POST['ColumnWidth'] . "' + WHERE labelid = '" . $SelectedLabelID . "'"; + + $ErrMsg = _('The update of this label template failed because'); + $result = DB_query($sql,$db,$ErrMsg); + + $Message = _('The label template has been updated'); + + } elseif ($InputError !=1) { + + /*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, + height, + topmargin, + width, + leftmargin, + rowheight, + columnwidth) + VALUES ('" . $_POST['PaperSize'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['Height'] . "', + '" . $_POST['TopMargin'] . "', + '" . $_POST['Width'] . "', + '" . $_POST['LeftMargin'] . "', + '" . $_POST['RowHeight'] . "', + '" . $_POST['ColumnWidth'] . "')"; + + $ErrMsg = _('The addition of this label failed because'); + $result = DB_query($sql,$db,$ErrMsg); + $Message = _('The new label template has been added to the database'); + } + //run the SQL from either of the above possibilites + if (isset($InputError) AND $InputError !=1) { + unset( $_POST['PaperSize']); + unset( $_POST['Description']); + unset( $_POST['Width']); + unset( $_POST['Height']); + unset( $_POST['TopMargin']); + unset( $_POST['LeftMargin']); + unset( $_POST['ColumnWidth']); + unset( $_POST['RowHeight']); + + } + + prnMsg($Message); + +} elseif (isset($_GET['delete'])) { +//the link to delete a selected record was clicked instead of the submit button + + /*Cascade deletes in TaxAuthLevels */ + $result = DB_query("DELETE FROM labelfields WHERE labelid= '" . $SelectedLabelID . "'",$db); + $result = DB_query("DELETE FROM labels WHERE labelid= '" . $SelectedLabelID . "'",$db); + prnMsg(_('The selected label template has been deleted'),'success'); + unset ($SelectedLabelID); +} + +if (!isset($SelectedLabelID)) { + +/* It could still be the second time the page has been run and a record has been selected for modification - SelectedLabelID will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of label templates will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ + + $sql = "SELECT labelid, + description, + papersize, + height, + width, + topmargin, + leftmargin, + rowheight, + columnwidth + FROM labels"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The defined label templates could not be retrieved because'); + $DbgMsg = _('The following SQL to retrieve the label templates was used'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + + if (DB_num_rows($result)>0){ + echo '<table class="selection"> + <tr> + <th>' . _('Description') . '</th> + <th>' . _('Page Size') . '</th> + <th>' . _('Height') . '</th> + <th>' . _('Width') . '</th> + <th>' . _('Row Height') . '</th> + <th>' . _('Column Width') . '</th> + </tr>'; + $k=0; + while ($myrow = DB_fetch_array($result)) { + + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + 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']); + + } + //END WHILE LIST LOOP + + //end of ifs and buts! + + echo '</table><p>'; + } //end if there are label definitions to show +} + +if (isset($SelectedLabelID)) { + echo '<div class="centre"> + <a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'">' . _('Review all defined label records') . '</a> + </div>'; +} + +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +if (isset($SelectedLabelID)) { + //editing an existing label + + $sql = "SELECT papersize, + description, + height, + width, + topmargin, + leftmargin, + rowheight, + columnwidth + FROM labels + WHERE labelid='" . $SelectedLabelID . "'"; + + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + + $_POST['PaperSize'] = $myrow['papersize']; + $_POST['Description'] = $myrow['description']; + $_POST['Height'] = $myrow['height']; + $_POST['TopMargin'] = $myrow['topmargin']; + $_POST['Width'] = $myrow['width']; + $_POST['LeftMargin'] = $myrow['leftmargin']; + $_POST['RowHeight'] = $myrow['rowheight']; + $_POST['ColumnWidth'] = $myrow['columnwidth']; + + echo '<input type="hidden" name="SelectedLabelID" value="' . $SelectedLabelID . '" />'; + +} //end of if $SelectedLabelID only do the else when a new record is being entered + + +if (!isset($_POST['Description'])) { + $_POST['Description']=''; +} +echo '<table class="selection"> + <tr> + <td><img src="css/paramsLabel.png"></td> + <td><table> + <tr> + <td>' . _('Label Description') . ':</td> + <td><input type="text" name="Description" size="21" maxlength="20" value="' . $_POST['Description'] . '" /></td> + </tr> + <tr> + <td>' . _('Label Paper Size') . ':</td> + <td><select name="PaperSize">'; + +foreach($PaperSize as $PaperType) { + if (isset($_POST['PaperSize']) AND $PaperType==$_POST['PaperSize']) { + echo '<option selected="selected" value="'; + } else { + echo '<option value="'; + } + echo $PaperType . '">' . $PaperType . '</option>'; + +} //end while loop + +echo '</select></td> + </tr>'; + +if (!isset($_POST['Height'])) { + $_POST['Height']=0; +} +if (!isset($_POST['TopMargin'])) { + $_POST['TopMargin']=5; +} +if (!isset($_POST['Width'])) { + $_POST['Width']=0; +} +if (!isset($_POST['LeftMargin'])) { + $_POST['LeftMargin']=10; +} +if (!isset($_POST['RowHeight'])) { + $_POST['RowHeight']=0; +} + +if (!isset($_POST['ColumnWidth'])) { + $_POST['ColumnWidth']=0; +} +echo '<tr> + <td>' . _('Label Height') . ' - (He):</td> + <td><input type="text" name="Height" size="4" maxlength="4" value="' . $_POST['Height'] . '" /></td> + </tr> + <tr> + <td>' . _('Label Width') . ' - (Wi):</td> + <td><input type="text" name="Width" size="4" maxlength="4" value="' . $_POST['Width'] . '" /></td> + </tr> + <tr> + <td>' . _('Top Margin') . ' - (Tm):</td> + <td><input type="text" name="TopMargin" size="4" maxlength="4" value="' . $_POST['TopMargin'] . '" /></td> + </tr> + <tr> + <td>' . _('Left Margin') . ' - (Lm):</td> + <td><input type="text" name="LeftMargin" size="4" maxlength="4" value="' . $_POST['LeftMargin'] . '" /></td> + </tr> + <tr> + <td>' . _('Row Height') . ' - (Rh):</td> + <td><input type="text" name="RowHeight" size="4" maxlength="4" value="' . $_POST['RowHeight'] . '" /></td> + </tr> + <tr> + <td>' . _('Column Width') . ' - (Cw):</td> + <td><input type="text" name="ColumnWidth" size="4" maxlength="4" value="' . $_POST['ColumnWidth'] . '" /></td> + </tr> + </table></td></tr> + </td></tr> + </table>'; + +if (isset($SelectedLabelID)) { + //get the fields to show + $SQL = "SELECT labelfieldid, + labelid, + fieldvalue, + vpos, + hpos, + fontsize, + barcode + FROM labelfields + WHERE labelid = '" . $SelectedLabelID . "' + ORDER BY vpos DESC"; + $ErrMsg = _('Could note get the label fields because'); + $result = DB_query($SQL,$db,$ErrMsg); + $i=0; + echo '<table class="selection"> + <tr> + <td><img src="css/labelsDim.png"></td> + <td><table> + <tr> + <th>' . _('Field') . '</th> + <th>' . _('Vertical') . '<br />' . _('Position') . '<br />(VPos)</th> + <th>' . _('Horizonal') . '<br />' . _('Position') . '<br />(HPos)</th> + <th>' . _('Font Size') . '</th> + <th>' . _('Bar-code') . '</th> + </tr>'; + if (DB_num_rows($result)>0){ + $k=0; + while ($myrow = DB_fetch_array($result)) { + + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + + echo '<input type="hidden" name="LabelFieldID' . $i . '" value="' . $myrow['labelfieldid'] . '" /> + <td><select name="FieldName' . $i . '">'; + if ($myrow['fieldvalue']=='itemcode'){ + echo '<option selected="selected" value="itemcode">' . _('Item Code') . '</option>'; + } else { + echo '<option value="itemcode">' . _('Item Code') . '</option>'; + } + if ($myrow['fieldvalue']=='itemdescription'){ + echo '<option selected="selected" value="itemdescription">' . _('Item Description') . '</option>'; + } else { + echo '<option value="itemdescription">' . _('Item Descrption') . '</option>'; + } + if ($myrow['fieldvalue']=='barcode'){ + echo '<option selected="selected" value="barcode">' . _('Item Barcode') . '</option>'; + } else { + echo '<option value="barcode">' . _('Item Barcode') . '</option>'; + } + if ($myrow['fieldvalue']=='price'){ + echo '<option selected="selected" value="price">' . _('Price') . '</option>'; + } else { + echo '<option value="price">' . _('Price') . '</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> + <td><input type="text" name="FontSize' . $i . '" size="4" maxlength="4" value="' . $myrow['fontsize'] . '" /></td> + <td><select name="Barcode' . $i . '">'; + if ($myrow['barcode']==0){ + echo '<option selected="selected" value="0">' . _('No') . '</option> + <option value="1">' . _('Yes') . '</option>'; + } else { + echo '<option selected="selected" value="1">' . _('Yes') . '</option> + <option value="0">' . _('No') . '</option>'; + } + echo '</select></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedLabelID=' . $SelectedLabelID . '&DeleteField=' . $myrow['labelfieldid'] .' onclick="return confirm(\'' . _('Are you sure you wish to delete this label field?') . '\');">' . _('Delete') . '</a></td> + </tr>'; + $i++; + } + //END WHILE LIST LOOP + $i--; //last increment needs to be wound back + echo '<input type="hidden" name="NoOfFieldsDefined" value="' . $i . '" />'; + } //end if there are label definitions to show + + echo '<tr> + <td><select name="FieldName"> + <option value="itemcode">' . _('Item Code') . '</option> + <option value="itemdescription">' . _('Item Descrption') . '</option> + <option value="barcode">' . _('Item Barcode') . '</option> + <option value="price">' . _('Price') . '</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> + <td><input type="text" size="4" maxlength="4" name="FontSize" /></td> + <td><select name="Barcode"> + <option value="1">' . _('Yes') . '</option> + <option selected="selected" value="0">' . _('No') . '</option> + </select></td> + </tr> + </table> + </td> + </tr> + </table> + <p />'; +} + +echo '<br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </form>'; + +include('includes/footer.inc'); + ?> \ No newline at end of file Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-04-25 06:12:02 UTC (rev 5279) +++ trunk/PDFPrintLabel.php 2012-04-25 09:11:48 UTC (rev 5280) @@ -1,522 +1,260 @@ <?php +/* $Id: PDFPriceLabels.php 5228 2012-04-06 02:48:00Z vvs2012 $*/ -/* $Id: PDFPrintLabel.php 4285 2010-12-22 16:01:51Z tim_schofield $*/ - -$Version_adds= '1.2'; - include('includes/session.inc'); -require_once('includes/DefineLabelClass.php'); -$MsgErr=null; -$DecimalPlaces=2; -$pdf= null; -/* The variable $AllLabels is the global variable that contains the list */ -$AllLabels = getXMLFile(LABELS_FILE); -/* of all the label objects defined until now. In case of a fresh -installation or an empty XML labels file it holds a NULL value. +$PtsPerMM = 2.83465; //pdf millimetres to points -If there is no label templates, the user could select to set up a new one -*/ -if ($AllLabels==null) { +if (isset($_POST['PrintPDF']) + AND isset($_POST['FromCriteria']) + AND mb_strlen($_POST['FromCriteria'])>=1 + AND isset($_POST['ToCriteria']) + AND mb_strlen($_POST['ToCriteria'])>=1){ + + $result = DB_query("SELECT papersize, + description, + width*" . $PtsPerMM . " as label_width, + height*" . $PtsPerMM . " as label_height, + rowheight*" . $PtsPerMM . " as label_rowheight, + columnwidth*" . $PtsPerMM . " as label_columnwidth, + topmargin*" . $PtsPerMM . " as label_topmargin, + leftmargin*" . $PtsPerMM . " as label_leftmargin + FROM labels + 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']; - abortMsg( _('There isn\'t any label template to select for printing. Click') . - ' <a href="Labels.php"><b>' . _('HERE'). '</b></a> '. _('to set up a new one') ); -} + $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') ); + $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') ); -/** - * The option print was selected, first it is checked if there are enough data - * to print the labels. - */ -if (isset($_POST['PrintPDF']) OR isset($_POST['PDFTest']) ) { - if (!isset($_POST['QtyByItem']) OR (int)$_POST['QtyByItem']<1) - $MsgErr = _('You must specify the number of labels per item required'); - else { - if (count($_POST['StockID'])<1) - $MsgErr = _('You must select the items to be printed'); - else { - // - $label = $AllLabels->getLabel($_POST['LabelID']); - list($dimensions, $lines) = resizeLabel($label); - $formatPage = getPageDimensions($dimensions); - list($Page_Width, - $Page_Height, - $Top_Margin, - $Bottom_Margin, - $Left_Margin, - $Right_Margin) = $formatPage; - - // Do it! - $PaperSize = 'User_special'; // Don't use any of the predefined sizes - $DocumentPaper='LETTER'; - $DocumentOrientation='P'; // Correccion para la version trunk :( - include('includes/PDFStarter.php'); - if ($Version>='3.12') - $pdf->setPageFormat($formatPage); - $ok = printLabels( - $dimensions, - $lines, - intval($_POST['QtyByItem']), - $_POST['Currency'], - $_POST['SalesType'], - $_POST['StockID'], - FormatDateForSQL($_POST['EffectiveDate']) - ); - - if ($ok) - exit(); // the print was success - else // Has been ocurred an error - $MsgErr = _('There was an error. Consult your IT staff'); + $result = DB_query("SELECT fieldvalue, + vpos, + hpos, + fontsize, + barcode + FROM labelfields + WHERE labelid = '" . $_POST['LabelID'] . "'", + $db); + $LabelFields = array(); + $i=0; + while ($LabelFieldRow = DB_fetch_array($result)){ + if ($LabelFieldRow['fieldvalue'] == 'itemcode'){ + $LabelFields[$i]['FieldValue'] = 'stockid'; + } elseif ($LabelFieldRow['fieldvalue'] == 'itemdescription'){ + $LabelFields[$i]['FieldValue'] = 'description'; + } else { + $LabelFields[$i]['FieldValue'] = $LabelFieldRow['fieldvalue']; } + $LabelFields[$i]['VPos'] = $LabelFieldRow['vpos']*$PtsPerMM; + $LabelFields[$i]['HPos'] = $LabelFieldRow['hpos']*$PtsPerMM; + $LabelFields[$i]['FontSize'] = $LabelFieldRow['fontsize']; + $LabelFields[$i]['Barcode'] = $LabelFieldRow['barcode']; + $i++; } -} + + $SQL = "SELECT prices.stockid, + stockmaster.description, + stockmaster.barcode, + prices.price, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.currabrev='" . $_POST['Currency'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; + + $LabelsResult = DB_query($SQL,$db,'','',false,false); -/** - * There is not activated option print, then show the window for capture the printing - * options. - */ - -$title = _('Print Price Labels'); -include('includes/header.inc'); - -if ($MsgErr!=null) { - prnMsg($MsgErr,'warn'); -} - -showLabelOptions(); - -include('includes/footer.inc'); -exit(); - -function showLabelOptions() { - global $AllLabels, $DecimalPlaces, $rootpath, $theme; - $txt = array( - _('Label Sticker Printing'), - _('Select label type'), - _('Number of labels per item'), - _('Price list'), - _('Currency'), - _('Category'), - _('Effective Date'), - _('Update values') - ); - if (!isset($_POST['LabelID'])) - $_POST['LabelID']=(string)$AllLabels->label[0]->id; - $OptionLabels = selLabels($_POST['LabelID']); - if (!isset($_POST['QtyByItem'])) - $_POST['QtyByItem']=1; - if (!isset($_POST['SalesType'])) - $_POST['SalesType']=$_SESSION['DefaultPriceList']; - $OptionSales = selSalesType($_POST['SalesType']); - - if (!isset($_POST['Currency'])){ - $_POST['Currency']=$_SESSION['CompanyRecord']['currencydefault']; + if (DB_error_no($db) !=0) { + $title = _('Price Label') . ' - ' . _('Problem Report....'); + include('includes/header.inc'); + prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; + if ($debug==1){ + prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); + } + include('includes/footer.inc'); + exit; } - $DecimalPlaces=getDecimalPlaces($_POST['Currency']); + if (DB_num_rows($LabelsResult)==0){ + $title = _('Print Price Labels Error'); + include('includes/header.inc'); + prnMsg(_('There were no price labels to print out for the category specified'),'warn'); + echo '<br /><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'. _('Back').'</a>'; + include('includes/footer.inc'); + exit; + } - $OptionCurrency = selCurrency($_POST['Currency']); - if (!isset($_POST['Category'])) - $_POST['Category']=''; - $OptionsCategory = selCategory($_POST['Category']); + $style = array( + 'position' => '', + 'align' => 'C', + 'stretch' => false, + 'fitwidth' => true, + 'cellfitalign' => '', + 'border' => false, + 'hpadding' => 'auto', + 'vpadding' => 'auto', + 'fgcolor' => array(0,0,0), + 'bgcolor' => false, //array(255,255,255), + 'text' => false, + 'font' => 'helvetica', + 'fontsize' => 8, + 'stretchtext' => 4 ); - $TableItems = tableItems($_POST['Category'], $okItems); + $PageNumber=1; + //go down first then accross + $YPos = $Page_Height - $Top_Margin; //top of current label + $XPos = $Left_Margin; // left of current label - if (!isset($_POST['EffectiveDate'])){ - $_POST['EffectiveDate']=Date($_SESSION['DefaultDateFormat']); + while ($PriceLabels = DB_fetch_array($LabelsResult,$db)){ + foreach ($LabelFields as $Field){ + 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'],locale_number_format($PriceLabels['price'],$PriceLabels['decimalplaces']),'right'); + } elseif($Field['Barcode']==1) { + + /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') + * 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('_','',$PriceLabels[$Field['FieldValue']]), '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'); + } else { + $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$PriceLabels[$Field['FieldValue']]); + } + } // 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 + */ + $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 space below to print a label + */ + $YPos -= $LabelDimensions['label_rowheight']; //Top of next label + } } - $SendButton = '<br /><div class="centre"><input type="submit" name="PrintPDF" value="'. _('Print labels') .'" /> - <input type="submit" name="PDFTest" value="'. _('Print labels with borders') .'" /></div>'; - $iTxt=0; - echo '<script type="text/javascript"> - function setAll(all) { - var x=document.getElementById("form1"); - for (var i=0;i<x.length;i++) { - if (x.elements[i].id=="item"); - x.elements[i].checked=all.checked; - } - } - </script>'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' .$txt[$iTxt++].'</p>'; - echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'" method="post" id="form1">'; - echo '<div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tbody>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="LabelID">'. - $OptionLabels - .'</select></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><input type="text" class="number" name="QtyByItem" value="'.$_POST['QtyByItem'].'" size="2" - maxlength="4" /></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="SalesType" onchange="ReloadForm(form1.refresh)"> - '.$OptionSales.' - </select></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="Currency" onchange="ReloadForm(form1.refresh)"> - '.$OptionCurrency.' - </select></td> - </tr>'; - echo '<tr> - <td class="number">'.$txt[$iTxt++].':</td> - <td><select name="Category" onchange="ReloadForm(form1.refresh)"> - '.$OptionsCategory.' - </select> </td> - </tr>'; - echo '<tr><td class="number">'.$txt[$iTxt++].':</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="EffectiveDate" size="11" maxlength="10" value="' . $_POST['EffectiveDate'] . '" /></td></tr>'; - echo '<tr> - <th colspan="2"> - <input type="submit" name="refresh" value="' . _('Refresh options') . '" /> - </th> - </tr>'; - echo '<tr> - <td colspan="2"> - '.$TableItems.' - </td> - </tr>'; - echo '</tbody> - </table> - '.$SendButton.' - </div> - </form>'; -} + $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; + ob_clean(); + $pdf->OutputD($FileName); + $pdf->__destruct(); -function selLabels($type) { - global $AllLabels; - $list=array(); +} else { /*The option to print PDF was not hit */ - foreach ($AllLabels->label as $label) - $list[(string)$label->id] = (string)$label->description; + $title= _('Price Labels'); + include('includes/header.inc'); - return selectOptions($list, $type); -} + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Price Labels') . '" alt="" /> + ' . ' ' . _('Print Price Labels') . '</p>'; -function selSalesType($type) { - return selectTable('SELECT typeabbrev, sales_type FROM salestypes ORDER BY sales_type', $type); -} + if (!isset($_POST['FromCriteria']) OR !isset($_POST['ToCriteria'])) { -function selCurrency($curr) { - return selectTable('SELECT currabrev, currency FROM currencies', $curr); -} + /*if $FromCriteria is not set then show a form to allow input */ -function selCategory(&$categ) { - return selectTable('SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription', $categ); -} - -function selectTable($sql, &$currentKey) { - global $db; - $result = DB_query($sql, $db); - while ($myrow=DB_fetch_row($result)) { - if (empty($currentKey)) - $currentKey=$myrow[0]; - $list[$myrow[0]] = $myrow[1]; - } - DB_free_result($result); - return selectOptions($list, $currentKey); -} - -function selectOptions($list, $currentKey) { - $html=''; - foreach ($list as $key=>$value) { - $xs = ($currentKey==$key) ? ' selected="selected"':''; - $html .= ' - <option value="'. $key .'"'. $xs .'>'. $value. '</option>'; - } - return $html; -} - -function tableItems($CategoryID, &$ok) { - global $db, $DecimalPlaces; - - if (empty($CategoryID)) { - $ok=false; - return noneButton( _('Select a Category') ); - } - $result = getStockItems($CategoryID, $_POST['Currency'], $_POST['SalesType'], FormatDateForSQL($_POST['EffectiveDate'])); - if (!DB_num_rows($result)) { - $ok=false; - return noneButton( _('This category has no items to show') ); - } - - $txt=array(_('Code'), - _('Description'), - _('Price'). '<br />('.$_POST['Currency'].')', - _('All') - ); - $ix=0; - // The table's header - $html= '<table border="0" width="100%"> - <thead> - <tr> - <th>'.$txt[$ix++].'</th> - <th>'.$txt[$ix++].'</th> - <th>'.$txt[$ix++].'</th> - <th colspan="2" align="center">'.$txt[$ix++].' - <input type="checkbox" checked="checked" onclick="setAll(this);" /> - </th> + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection">'; + echo '<tr> + <td>' . _('Label to print') . ':</td> + <td><select name="LabelID">'; + + $LabelResult = DB_query("SELECT labelid, description FROM labels",$db); + while ($LabelRow = DB_fetch_array($LabelResult)){ + echo '<option value="' . $LabelRow['labelid'] . '">' . $LabelRow['description'] . '</option>'; + } + echo '</select></td> </tr> - </thead> + <tr> + <td>'. _('From Inventory Category Code') .':</td> + <td><select name="FromCriteria">'; - <tbody>'; - $ok=true; - $odd=true; - while ($myrow=DB_fetch_array($result)) { - $price = locale_number_format($myrow['price'],$DecimalPlaces); - $oddEven=$odd?"Odd":"Even"; - $odd = !$odd; - $html .= <<<ZZZ - <tr class="{$oddEven}TableRows"> - <td>{$myrow['stockid']}</td> - <td>{$myrow['description']}</td> - <td class="number">{$price}</td> - <td><div class="centre"> - <input type="checkbox" checked="checked" name="StockID[{$myrow['stockid']}]" id="item" /> - </div> - </td> - <td> </td> - </tr> -ZZZ; - } - return $html . ' - </tbody> - </table>'; -} + $CatResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid",$db); + while ($myrow = DB_fetch_array($CatResult)){ + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + } + echo '</select></td></tr>'; -function noneButton($msg) { - return ' - <div class="centre"> - <input type="button" disabled name="None" value="'. $msg . '" /> - </div>'; -} + echo '<tr><td>' . _('To Inventory Category Code'). ':</td> + <td><select name="ToCriteria">'; -/** - * This access to item data includes its price. - * The routine works in two contexts: when only the category is given - * it looks for all the items - */ -function getStockItems($CategoryID, $CurrCode, $SalesType, $EffectiveDate, $StockID=false) { - global $db, $Today; + /*Set the index for the categories result set back to 0 */ + DB_data_seek($CatResult,0); - if ($StockID!==false) { - $WhereClause = "stockmaster.stockid='$StockID' LIMIT 1"; - } else { - $WhereClause = "stockmaster.categoryid='$CategoryID' ORDER BY stockmaster.stockid"; - } - - $WhereClause = " stockmaster.discontinued!=1 AND " . $WhereClause; - - $sql="SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.longdescription, - stockmaster.barcode, - prices.price - FROM stockmaster LEFT JOIN prices - ON stockmaster.stockid=prices.stockid - AND prices.currabrev = '" . $CurrCode . "' - AND prices.typeabbrev= '" . $SalesType . "' - AND prices.startdate <= '" . $EffectiveDate . "' - AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00') - AND prices.debtorno='' - WHERE " . $WhereClause; - - return DB_query($sql, $db); -} - -function getStockData($StockID, $Currency, $salesType, $EffectiveDate) { - $result = getStockItems(null, $Currency, $salesType, $EffectiveDate, $StockID); - return DB_fetch_array($result); -} - -/** - * Change de scale of data given by points - * Returns two array for the dimension and lines of data - */ -function resizeLabel($label) { - global $DimensionTags, $DataTags; - - //<* Values required from the beggining - $scales=array('pt'=>1, 'in'=>72, 'mm'=>(float)72/25.4, 'cm'=>(float)72/2.54); - - $obj = $label->dimensions; - $unit = (string)$obj->Unit; - if ( array_key_exists($unit , $scales) ) { - $factor = $scales[$unit]; - } else { - abortMsg( _('Unit not defined in scale operation! Correct the template') ); - } - - $dims = array(); - foreach ($DimensionTags as $iTag=>$tag) { - if ($tag['type']=='n') // it is a data numeric - $dims[$iTag] = round(((float)$obj->$iTag)*$factor, 3); - elseif ($tag['type']=='i') - $dims[$iTag] = (int)$obj->$iTag; - } - - $obj = $label->data; - $line = array(); - $i=0; - foreach ($obj->line as $labelLine) { - $line[$i] = array(); - foreach ($DataTags as $iTag=>$tag) { - if ($tag['type']=='n') // it is a data numeric - $line[$i][$iTag]= round(((float)$labelLine->$iTag)*$factor, 3); - else - $line[$i][$iTag]=(string)$labelLine->$iTag; // field to use in printing data + While ($myrow = DB_fetch_array($CatResult)){ + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; } - $i++; - } - return array($dims, $line); -} + echo '</select></td></tr>'; -/** - * Returns the following data: - * $Page_Width, - * $Page_Height, - * $Top_Margin, - * $Bottom_Margin, - * $Left_Margin, - * $Right_Margin - */ -function getPageDimensions($dimensions) { - $bm =(float)$dimensions['Sh'] - ( (float)$dimensions['Tm'] + - (int)$dimensions['Rows']*(float)$dimensions['He']); - $rm =(float)$dimensions['Sw'] - ( (float)$dimensions['Lm'] + - (int)$dimensions['Cols']*(float)$dimensions['Wi']); - return array( - (float)$dimensions['Sw'], - (float)$dimensions['Sh'], - (float)$dimensions['Tm'], 0, -// ($bm>0?$bm:0), - (float)$dimensions['Lm'], 0 -// ($rm>0?$rm:0) - ); -} + echo '<tr><td>' . _('For Sales Type/Price List').':</td> + <td><select name="SalesType">'; + $sql = "SELECT sales_type, typeabbrev FROM salestypes"; + $SalesTypesResult=DB_query($sql,$db); -function printLabels($dimensions, $lines, $qtyByItem, $Currency, $salesType, $StockIDList, $EffectiveDate) { - global $pdf, $DecimalPlaces, $Version; - $row = $col = 0; - - $DecimalPlaces=getDecimalPlaces($Currency); - - foreach ($StockIDList as $StockID=>$on) { // At least there is one item - $itemData = getStockData($StockID, $Currency, $salesType, $EffectiveDate); - $num=$qtyByItem; - while ($num-- > 0) { // Print $num labels per item - printStockid($itemData, $dimensions, $lines, $Currency, $row, $col); - if (++$col>=$dimensions['Cols']) { - $col=0; - if (++$row>=$dimensions['Rows']) { - $row=0; - $pdf->newpage(); - } + while ($myrow=DB_fetch_array($SalesTypesResult)){ + if ($_SESSION['DefaultPriceList']==$myrow['typeabbrev']){ + echo '<option selected="selected" value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; + } else { + echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } } - } - /* if ($row OR $col) // it seems to be unnecesary. - $pdf->newpage(); */ + echo '</select></td></tr>'; - // now, emit the PDF file (if not errors!) - if ($Version>="3.12") { - $pdf->OutputD($_SESSION['DatabaseName'] . '_Labels_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN - } else { - $pdfcode = $pdf->output(); - $len = mb_strlen($pdfcode); + echo '<tr><td>' . _('For Currency').':</td> + <td><select name="Currency">'; + $sql = "SELECT currabrev, country, currency FROM currencies"; + $CurrenciesResult=DB_query($sql,$db); - if ($len<=20){ - return false; - } else{ - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=Labels.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - - $pdf->Stream(); + while ($myrow=DB_fetch_array($CurrenciesResult)){ + if ($_SESSION['CompanyRecord']['currencydefault']==$myrow['currabrev']){ + echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $myrow['country'] . ' - ' .$myrow['currency'] . '</option>'; + } else { + echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['country'] . ' - ' .$myrow['currency'] . '</option>'; + } } - } - return true; // All fine!! -} + echo '</select></td></tr>'; -/*! \brief The heart of the program (perhaps the liver) - * - * It shows the data label from the input $data as update data (id read only) - * if the third parameter is true or a fresh data label (new label). It is - * possible that the combination $data valid and $readonly false occurs when - * invalid data needs to be recaptured because an error in a new label capture. - */ -function printStockid($itemData, $labelDim, $dataParams, $Currency, $row, $col) { - global $pdf, $DecimalPlaces; -//echo $row.':'.$col.'<br />'; - // Calculate the bottom left corner position - $iX = $labelDim['Lm'] + $col * $labelDim['Cw']; - $iY = $labelDim['Sh'] - ($labelDim['Tm'] + ($row+1) * $labelDim['Rh']); + echo '<tr><td>' . _('Effective As At') . ':</td>'; + echo '<td><input type="text" size="11" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveDate" value="' . Date($_SESSION['DefaultDateFormat']) . '" />'; + echo '</td></tr>'; - if (isset($_POST['PDFTest'])) { - $pdf->line($iX, $iY+$labelDim['He'], $iX+$labelDim['Wi'], $iY+$labelDim['He']); // top - $pdf->line($iX, $iY, $iX+$labelDim['Wi'], $iY); // bottom - $pdf->line($iX, $iY, $iX, $iY+$labelDim['He']); // left - $pdf->line($iX+$labelDim['Wi'], $iY, $iX+$labelDim['Wi'], $iY+$labelDim['He']); + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'. _('Print PDF'). '" /> + </div> + </form>'; } - // Now, for every data, write down the correspondig text - $descrip= $ldescrip=''; - foreach ($dataParams as $line) { - unset($resid); // unlink the previous residue - unset($txt); - $adj='left'; - switch ($line['dat']) { - case 'code': - $txt = $itemData['stockid']; - break; - case 'name1': - $txt = $itemData['description']; - $resid = &$descrip; - break; - case 'name2': - $txt = $descrip; - unset($descrip); - break; - case 'lname1': - $txt = $itemData['longdescription']; - $resid = &$ldescrip; - break; - case 'lname2': - $txt = $ldescrip; - unset($ldescrip); - break; - case 'price': - $txt = locale_number_format($itemData['price'], $DecimalPlaces). ' '. $Currency; -// $adj='left'; - break; - case 'bcode': break; - } - $ix = $iX + $line['pos']; - $iy = $iY + $line['row']; - if (isset($txt)) { - $resid = $pdf->addTextWrap($ix,$iy,$line['max'],$line['font'],$txt, $adj); - } - } -} + include('includes/footer.inc'); -function getDecimalPlaces($Currency) { - global $db; - $sql="SELECT decimalplaces FROM currencies WHERE currabrev='$Currency'"; - $result = DB_query($sql, $db); - if (!DB_num_rows($result)) - abortMsg(_('Couldnt get the currency data')); - $myrow=DB_fetch_row($result); - return $myrow[0]; -} +} /*end of else not PrintPDF */ + ?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-25 06:12:02 UTC (rev 5279) +++ trunk/doc/... [truncated message content] |
From: <dai...@us...> - 2012-04-26 10:48:06
|
Revision: 5287 http://web-erp.svn.sourceforge.net/web-erp/?rev=5287&view=rev Author: daintree Date: 2012-04-26 10:48:00 +0000 (Thu, 26 Apr 2012) Log Message: ----------- label priting changes Modified Paths: -------------- trunk/PDFPrintLabel.php trunk/UpgradeDatabase.php Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-04-26 09:23:58 UTC (rev 5286) +++ trunk/PDFPrintLabel.php 2012-04-26 10:48:00 UTC (rev 5287) @@ -5,12 +5,95 @@ $PtsPerMM = 2.83465; //pdf millimetres to points -if (isset($_POST['PrintPDF']) + +if (isset($_POST['ShowLabels']) AND isset($_POST['FromCriteria']) AND mb_strlen($_POST['FromCriteria'])>=1 AND isset($_POST['ToCriteria']) AND mb_strlen($_POST['ToCriteria'])>=1){ + + $title = _('Print Labels'); + include('includes/header.inc'); + + $SQL = "SELECT prices.stockid, + stockmaster.description, + stockmaster.barcode, + prices.price, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.currabrev='" . $_POST['Currency'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; + $LabelsResult = DB_query($SQL,$db,'','',false,false); + + if (DB_error_no($db) !=0) { + prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; + if ($debug==1){ + prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); + } + include('includes/footer.inc'); + exit; + } + if (DB_num_rows($LabelsResult)==0){ + prnMsg(_('There were no price labels to print out for the category specified'),'warn'); + echo '<br /><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'. _('Back').'</a>'; + include('includes/footer.inc'); + exit; + } + + + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection"> + <tr> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Print') . ' ?</th> + </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> + </tr>'; + echo '<input type="hidden" name="StockID' . $i . '" value="' . $LabelRow['stockid'] . '" /> + <input type="hidden" name="Description' . $i . '" value="' . $LabelRow['description'] . '" /> + <input type="hidden" name="Barcode' . $i . '" value="' . $LabelRow['barcode'] . '" /> + <input type="hidden" name="Price' . $i . '" value="' . locale_number_format($LabelRow['price'],$LabelRow['decimalplaces']) . '" />'; + $i++; + } + $i--; + echo '</table> + <input type="hidden" name="NoOfLabels" value="' . $i . '" /> + <input type="hidden" name="LabelID" value="' . $_POST['LabelID'] . '" /> + <br /> + <div class="centre"> + <input type="submit" name="PrintLabels" value="'. _('Print Labels'). '" /> + </div> + </form>'; + exit; +} +if (isset($_POST['PrintLabels']) + AND isset($_POST['NoOfLabels'])) { + $result = DB_query("SELECT papersize, description, width*" . $PtsPerMM . " as label_width, @@ -56,51 +139,6 @@ $i++; } - $SQL = "SELECT prices.stockid, - stockmaster.description, - stockmaster.barcode, - prices.price, - currencies.decimalplaces - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - INNER JOIN prices - ON stockmaster.stockid=prices.stockid - INNER JOIN currencies - ON prices.currabrev=currencies.currabrev - WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' - AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' - AND prices.typeabbrev='" . $_POST['SalesType'] . "' - AND prices.currabrev='" . $_POST['Currency'] . "' - AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') - AND prices.debtorno='' - ORDER BY prices.currabrev, - stockmaster.categoryid, - stockmaster.stockid, - prices.startdate"; - - $LabelsResult = DB_query($SQL,$db,'','',false,false); - - if (DB_error_no($db) !=0) { - $title = _('Price Label') . ' - ' . _('Problem Report....'); - include('includes/header.inc'); - prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); - echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; - if ($debug==1){ - prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); - } - include('includes/footer.inc'); - exit; - } - if (DB_num_rows($LabelsResult)==0){ - $title = _('Print Price Labels Error'); - include('includes/header.inc'); - prnMsg(_('There were no price labels to print out for the category specified'),'warn'); - echo '<br /><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'. _('Back').'</a>'; - include('includes/footer.inc'); - exit; - } - $style = array( 'position' => '', 'align' => 'C', @@ -121,46 +159,59 @@ //go down first then accross $YPos = $Page_Height - $Top_Margin; //top of current label $XPos = $Left_Margin; // left of current label - - while ($PriceLabels = DB_fetch_array($LabelsResult,$db)){ - foreach ($LabelFields as $Field){ - 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'],locale_number_format($PriceLabels['price'],$PriceLabels['decimalplaces']),'right'); - } elseif($Field['Barcode']==1) { + + for ($i=0;$i <= $_POST['NoOfLabels'];$i++){ + if ($_POST['PrintLabel'.$i]=='on'){ + + if ($Field['FieldValue']== 'price'){ + $Value = $_POST['Price' . $i]; + } elseif ($Field['FieldValue']== 'stockid'){ + $Value = $_POST['StockID' . $i]; + } elseif ($Field['FieldValue']== 'description'){ + $Value = $_POST['Description' . $i]; + } elseif ($Field['FieldValue']== 'barcode'){ + $Value = $_POST['Barcode' . $i]; + } + foreach ($LabelFields as $Field){ - /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') - * 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! + 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) { + + /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') + * 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'); + } 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 */ - - $pdf->write1DBarcode(str_replace('_','',$PriceLabels[$Field['FieldValue']]), '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'); + 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 { - $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$PriceLabels[$Field['FieldValue']]); - } - } // 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 + /* There is space below to print a label */ - $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 space below to print a label - */ - $YPos -= $LabelDimensions['label_rowheight']; //Top of next label - } - } + $YPos -= $LabelDimensions['label_rowheight']; //Top of next label + } + } //this label is set to print + } //loop through labels selected to print $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; @@ -249,12 +300,13 @@ echo '</table> <br /> <div class="centre"> - <input type="submit" name="PrintPDF" value="'. _('Print PDF'). '" /> + <input type="submit" name="ShowLabels" value="'. _('Show Labels'). '" /> </div> - </form>'; + </form>'; + } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2012-04-26 09:23:58 UTC (rev 5286) +++ trunk/UpgradeDatabase.php 2012-04-26 10:48:00 UTC (rev 5287) @@ -136,6 +136,11 @@ case '4.07': case '4.07.0': case '4.07.1': + case '4.07.2': + case '4.07.3': + case '4.07.4': + case '4.07.5': + case '4.07.6': $SQLScripts[] = './sql/mysql/upgrade4.07-4.08.sql'; case '4.08.0': break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-26 10:48:11
|
Revision: 5287 http://web-erp.svn.sourceforge.net/web-erp/?rev=5287&view=rev Author: daintree Date: 2012-04-26 10:48:00 +0000 (Thu, 26 Apr 2012) Log Message: ----------- label priting changes Modified Paths: -------------- trunk/PDFPrintLabel.php trunk/UpgradeDatabase.php Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-04-26 09:23:58 UTC (rev 5286) +++ trunk/PDFPrintLabel.php 2012-04-26 10:48:00 UTC (rev 5287) @@ -5,12 +5,95 @@ $PtsPerMM = 2.83465; //pdf millimetres to points -if (isset($_POST['PrintPDF']) + +if (isset($_POST['ShowLabels']) AND isset($_POST['FromCriteria']) AND mb_strlen($_POST['FromCriteria'])>=1 AND isset($_POST['ToCriteria']) AND mb_strlen($_POST['ToCriteria'])>=1){ + + $title = _('Print Labels'); + include('includes/header.inc'); + + $SQL = "SELECT prices.stockid, + stockmaster.description, + stockmaster.barcode, + prices.price, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.currabrev='" . $_POST['Currency'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; + $LabelsResult = DB_query($SQL,$db,'','',false,false); + + if (DB_error_no($db) !=0) { + prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; + if ($debug==1){ + prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); + } + include('includes/footer.inc'); + exit; + } + if (DB_num_rows($LabelsResult)==0){ + prnMsg(_('There were no price labels to print out for the category specified'),'warn'); + echo '<br /><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'. _('Back').'</a>'; + include('includes/footer.inc'); + exit; + } + + + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection"> + <tr> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Print') . ' ?</th> + </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> + </tr>'; + echo '<input type="hidden" name="StockID' . $i . '" value="' . $LabelRow['stockid'] . '" /> + <input type="hidden" name="Description' . $i . '" value="' . $LabelRow['description'] . '" /> + <input type="hidden" name="Barcode' . $i . '" value="' . $LabelRow['barcode'] . '" /> + <input type="hidden" name="Price' . $i . '" value="' . locale_number_format($LabelRow['price'],$LabelRow['decimalplaces']) . '" />'; + $i++; + } + $i--; + echo '</table> + <input type="hidden" name="NoOfLabels" value="' . $i . '" /> + <input type="hidden" name="LabelID" value="' . $_POST['LabelID'] . '" /> + <br /> + <div class="centre"> + <input type="submit" name="PrintLabels" value="'. _('Print Labels'). '" /> + </div> + </form>'; + exit; +} +if (isset($_POST['PrintLabels']) + AND isset($_POST['NoOfLabels'])) { + $result = DB_query("SELECT papersize, description, width*" . $PtsPerMM . " as label_width, @@ -56,51 +139,6 @@ $i++; } - $SQL = "SELECT prices.stockid, - stockmaster.description, - stockmaster.barcode, - prices.price, - currencies.decimalplaces - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - INNER JOIN prices - ON stockmaster.stockid=prices.stockid - INNER JOIN currencies - ON prices.currabrev=currencies.currabrev - WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' - AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' - AND prices.typeabbrev='" . $_POST['SalesType'] . "' - AND prices.currabrev='" . $_POST['Currency'] . "' - AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') - AND prices.debtorno='' - ORDER BY prices.currabrev, - stockmaster.categoryid, - stockmaster.stockid, - prices.startdate"; - - $LabelsResult = DB_query($SQL,$db,'','',false,false); - - if (DB_error_no($db) !=0) { - $title = _('Price Label') . ' - ' . _('Problem Report....'); - include('includes/header.inc'); - prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); - echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; - if ($debug==1){ - prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); - } - include('includes/footer.inc'); - exit; - } - if (DB_num_rows($LabelsResult)==0){ - $title = _('Print Price Labels Error'); - include('includes/header.inc'); - prnMsg(_('There were no price labels to print out for the category specified'),'warn'); - echo '<br /><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'. _('Back').'</a>'; - include('includes/footer.inc'); - exit; - } - $style = array( 'position' => '', 'align' => 'C', @@ -121,46 +159,59 @@ //go down first then accross $YPos = $Page_Height - $Top_Margin; //top of current label $XPos = $Left_Margin; // left of current label - - while ($PriceLabels = DB_fetch_array($LabelsResult,$db)){ - foreach ($LabelFields as $Field){ - 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'],locale_number_format($PriceLabels['price'],$PriceLabels['decimalplaces']),'right'); - } elseif($Field['Barcode']==1) { + + for ($i=0;$i <= $_POST['NoOfLabels'];$i++){ + if ($_POST['PrintLabel'.$i]=='on'){ + + if ($Field['FieldValue']== 'price'){ + $Value = $_POST['Price' . $i]; + } elseif ($Field['FieldValue']== 'stockid'){ + $Value = $_POST['StockID' . $i]; + } elseif ($Field['FieldValue']== 'description'){ + $Value = $_POST['Description' . $i]; + } elseif ($Field['FieldValue']== 'barcode'){ + $Value = $_POST['Barcode' . $i]; + } + foreach ($LabelFields as $Field){ - /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') - * 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! + 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) { + + /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') + * 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'); + } 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 */ - - $pdf->write1DBarcode(str_replace('_','',$PriceLabels[$Field['FieldValue']]), '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'); + 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 { - $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$PriceLabels[$Field['FieldValue']]); - } - } // 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 + /* There is space below to print a label */ - $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 space below to print a label - */ - $YPos -= $LabelDimensions['label_rowheight']; //Top of next label - } - } + $YPos -= $LabelDimensions['label_rowheight']; //Top of next label + } + } //this label is set to print + } //loop through labels selected to print $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; @@ -249,12 +300,13 @@ echo '</table> <br /> <div class="centre"> - <input type="submit" name="PrintPDF" value="'. _('Print PDF'). '" /> + <input type="submit" name="ShowLabels" value="'. _('Show Labels'). '" /> </div> - </form>'; + </form>'; + } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2012-04-26 09:23:58 UTC (rev 5286) +++ trunk/UpgradeDatabase.php 2012-04-26 10:48:00 UTC (rev 5287) @@ -136,6 +136,11 @@ case '4.07': case '4.07.0': case '4.07.1': + case '4.07.2': + case '4.07.3': + case '4.07.4': + case '4.07.5': + case '4.07.6': $SQLScripts[] = './sql/mysql/upgrade4.07-4.08.sql'; case '4.08.0': break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-28 19:41:52
|
Revision: 5293 http://web-erp.svn.sourceforge.net/web-erp/?rev=5293&view=rev Author: vvs2012 Date: 2012-04-28 19:41:43 +0000 (Sat, 28 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/SuppLoginSetup.php trunk/SuppPaymentRun.php trunk/SuppPriceList.php trunk/SuppShiptChgs.php trunk/SuppTransGLAnalysis.php trunk/SupplierTenderCreate.php trunk/SupplierTransInquiry.php trunk/SupplierTypes.php trunk/Suppliers.php trunk/SystemParameters.php trunk/Tax.php trunk/TaxAuthorities.php trunk/TaxAuthorityRates.php trunk/TaxCategories.php trunk/TaxGroups.php trunk/TaxProvinces.php trunk/TopItems.php trunk/UnitsOfMeasure.php trunk/UpgradeDatabase.php trunk/UserSettings.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderStatus.php trunk/includes/MainMenuLinksArray.php Modified: trunk/SuppLoginSetup.php =================================================================== --- trunk/SuppLoginSetup.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppLoginSetup.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -109,6 +109,7 @@ } echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -133,7 +134,7 @@ } echo '<tr> <td>' . _('Password') . ':</td> - <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /> + <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /></td> </tr> <tr> <td>' . _('Full Name') . ':</td> @@ -178,8 +179,10 @@ } if (!$FoundTheSupplierRole){ + echo '</table> + </div> + </form>'; prnMsg(_('The supplier login role is expected to contain just one token - number 9. There is no such role currently defined - so a supplier login cannot be set up until this role is defined'),'error'); - echo '</table>'; include('includes/footer.inc'); exit; } @@ -292,6 +295,7 @@ <div class="centre"> <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> + </div> </form>'; echo '<script type="text/javascript">defaultControl(document.forms[0].UserID);</script>'; Modified: trunk/SuppPaymentRun.php =================================================================== --- trunk/SuppPaymentRun.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppPaymentRun.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -246,9 +246,10 @@ /* show form to allow input */ - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection">'; if (!isset($_POST['FromCriteria']) or mb_strlen($_POST['FromCriteria'])<1){ $DefaultFromCriteria = '1'; @@ -384,7 +385,8 @@ <input type="submit" name="PrintPDF" value="' . _('Print PDF Only') . '" /> <input type="submit" name="PrintPDFAndProcess" value="' . _('Print and Process Payments') . '" /> </div>'; - + echo '</div> + </form>'; include ('includes/footer.inc'); } /*end of else not PrintPDF */ ?> \ No newline at end of file Modified: trunk/SuppPriceList.php =================================================================== --- trunk/SuppPriceList.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppPriceList.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -203,9 +203,9 @@ echo '<div class="page_help_text">' . _('View the Price List from supplier') . '</div><br />'; echo '<br/> - <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <table>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT supplierid,suppname FROM `suppliers`"; $result = DB_query($sql,$db); @@ -255,6 +255,8 @@ <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; + echo '</div> + </form>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ Modified: trunk/SuppShiptChgs.php =================================================================== --- trunk/SuppShiptChgs.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppShiptChgs.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -94,13 +94,14 @@ } echo '<tr> - <td class="number"><font size="2" color=navy>' . _('Total') . ':</font></td> - <td class="number"><font size="2" color=navy><U>' . locale_number_format($TotalShiptValue,2) . '</U></font></td> + <td class="number">' . _('Total') . ':</td> + <td class="number">' . locale_number_format($TotalShiptValue,2) . '</td> </tr> </table><br />'; /*Set up a form to allow input of new Shipment charges */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['ShiptRef'])) { @@ -152,6 +153,7 @@ <div class="centre"> <input type="submit" name="AddShiptChgToInvoice" value="' . _('Enter Shipment Charge') . '" /> </div> + </div> </form>'; include('includes/footer.inc'); Modified: trunk/SuppTransGLAnalysis.php =================================================================== --- trunk/SuppTransGLAnalysis.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppTransGLAnalysis.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -131,8 +131,8 @@ } echo '<tr> - <td colspan="2" class="number"><font size="4" color="blue">' . _('Total') . ':</font></td> - <td class="number"><font size="2" color="navy"><u>' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="2" class="number">' . _('Total') . ':</td> + <td class="number">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; @@ -150,6 +150,7 @@ /*Set up a form to allow input of new GL entries */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> @@ -159,8 +160,8 @@ } echo '<tr> <td>' . _('Account Code') . ':</td> - <td><input type="text" name="GLCode" size="12" maxlength="11" value="' . $_POST['GLCode'] . '" /></td> - <input type="hidden" name="JobRef" value="" /> + <td><input type="text" name="GLCode" size="12" maxlength="11" value="' . $_POST['GLCode'] . '" /> + <input type="hidden" name="JobRef" value="" /></td> </tr>'; echo '<tr> <td>' . _('Account Selection') . ': @@ -178,7 +179,7 @@ } else { echo '<option value="'; } - echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . '</option>'; } echo '</select> @@ -206,6 +207,7 @@ <input type="submit" name="AddGLCodeToTrans" value="' . _('Enter GL Line') . '" /> </div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SupplierTenderCreate.php =================================================================== --- trunk/SupplierTenderCreate.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SupplierTenderCreate.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -1,865 +1,875 @@ -<?php -/* $Id: SupplierTenderCreate.php 4821 2012-01-20 13:48:53Z tim_schofield $ */ - -include('includes/DefineTenderClass.php'); -include('includes/SQL_CommonFunctions.inc'); -include('includes/session.inc'); - -if (empty($_GET['identifier'])) { - /*unique session identifier to ensure that there is no conflict with other supplier tender sessions on the same machine */ - $identifier=date('U'); -} else { - $identifier=$_GET['identifier']; -} - -if (isset($_GET['New']) and isset($_SESSION['tender'.$identifier])) { - unset($_SESSION['tender'.$identifier]); -} - -if (isset($_GET['New']) and $_SESSION['CanCreateTender']==0) { - $title = _('Authorisation Problem'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; - prnMsg( _('You do not have authority to create supplier tenders for this company.') . '<br />' . - _('Please see your system administrator'), 'warn'); - include('includes/footer.inc'); - exit; -} - -if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) { - $title = _('Authorisation Problem'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; - prnMsg( _('You do not have authority to amend supplier tenders for this company.') . '<br />' . - _('Please see your system administrator'), 'warn'); - include('includes/footer.inc'); - exit; -} - -$ShowTender = 0; - -if (isset($_GET['ID'])) { - $sql="SELECT tenderid, - location, - address1, - address2, - address3, - address4, - address5, - address6, - telephone - FROM tenders - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - if (isset($_SESSION['tender'.$identifier])) { - unset($_SESSION['tender'.$identifier]); - } - $_SESSION['tender'.$identifier] = new Tender(); - $_SESSION['tender'.$identifier]->TenderId = $myrow['tenderid']; - $_SESSION['tender'.$identifier]->Location = $myrow['location']; - $_SESSION['tender'.$identifier]->DelAdd1 = $myrow['address1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $myrow['address2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $myrow['address3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $myrow['address4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $myrow['address5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $myrow['address6']; - - $sql="SELECT tenderid, - tendersuppliers.supplierid, - suppliers.suppname, - tendersuppliers.email - FROM tendersuppliers - LEFT JOIN suppliers - ON tendersuppliers.supplierid=suppliers.supplierid - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql, $db); - while ($myrow=DB_fetch_array($result)) { - $_SESSION['tender'.$identifier]->add_supplier_to_tender($myrow['supplierid'], - $myrow['suppname'], - $myrow['email']); - } - - $sql="SELECT tenderid, - tenderitems.stockid, - tenderitems.quantity, - stockmaster.description, - tenderitems.units, - stockmaster.decimalplaces - FROM tenderitems - LEFT JOIN stockmaster - ON tenderitems.stockid=stockmaster.stockid - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql, $db); - while ($myrow=DB_fetch_array($result)) { - $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, - $myrow['stockid'], - $myrow['quantity'], - $myrow['description'], - $myrow['units'], - $myrow['decimalplaces'], - DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); - } - $ShowTender = 1; -} - -if (isset($_GET['Edit'])) { - $title = _('Edit an Existing Supplier Tender Request'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; - $sql="SELECT tenderid, - location, - address1, - address2, - address3, - address4, - address5, - address6, - telephone - FROM tenders - WHERE closed=0"; - $result=DB_query($sql, $db); - echo '<table class="selection">'; - echo '<tr> - <th>' . _('Tender ID') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Address 1') . '</th> - <th>' . _('Address 2') . '</th> - <th>' . _('Address 3') . '</th> - <th>' . _('Address 4') . '</th> - <th>' . _('Address 5') . '</th> - <th>' . _('Address 6') . '</th> - <th>' . _('Telephone') . '</th> - </tr>'; - while ($myrow=DB_fetch_array($result)) { - echo '<tr> - <td>' . $myrow['tenderid'] . '</td> - <td>' . $myrow['location'] . '</td> - <td>' . $myrow['address1'] . '</td> - <td>' . $myrow['address2'] . '</td> - <td>' . $myrow['address3'] . '</td> - <td>' . $myrow['address4'] . '</td> - <td>' . $myrow['address5'] . '</td> - <td>' . $myrow['address6'] . '</td> - <td>' . $myrow['telephone'] . '</td> - <td><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier.'&ID='.$myrow['tenderid'].'">'. _('Edit') .'</a></td> - </tr>'; - } - echo '</table>'; - include('includes/footer.inc'); - exit; -} else if (isset($_GET['ID']) or (isset($_SESSION['tender'.$identifier]->TenderId))) { - $title = _('Edit an Existing Supplier Tender Request'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; -} else { - $title = _('Create a New Supplier Tender Request'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; -} - -if (isset($_POST['Save'])) { - $_SESSION['tender'.$identifier]->RequiredByDate=$_POST['RequiredByDate']; - $_SESSION['tender'.$identifier]->save($db); - $_SESSION['tender'.$identifier]->EmailSuppliers(); - prnMsg( _('The tender has been successfully saved'), 'success'); - include('includes/footer.inc'); - exit; -} - -if (isset($_GET['DeleteSupplier'])) { - $_SESSION['tender'.$identifier]->remove_supplier_from_tender($_GET['DeleteSupplier']); - $ShowTender = 1; -} - -if (isset($_GET['DeleteItem'])) { - $_SESSION['tender'.$identifier]->remove_item_from_tender($_GET['DeleteItem']); - $ShowTender = 1; -} - -if (isset($_POST['SelectedSupplier'])) { - $sql = "SELECT suppname, - email - FROM suppliers - WHERE supplierid='" . $_POST['SelectedSupplier'] . "'"; - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); - if (mb_strlen($myrow['email'])>0) { - $_SESSION['tender'.$identifier]->add_supplier_to_tender($_POST['SelectedSupplier'], - $myrow['suppname'], - $myrow['email']); - } else { - prnMsg( _('The supplier must have an email set up or they cannot be part of a tender'), 'warn'); - } - $ShowTender = 1; -} - -if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) { - foreach ($_POST as $key => $value) { - if (mb_substr($key,0,7)=='StockID') { - $Index = mb_substr($key,7,mb_strlen($key)-7); - $StockID = $value; - $Quantity = filter_number_format($_POST['Qty'.$Index]); - $UOM = $_POST['UOM'.$Index]; - $sql="SELECT description, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, - $StockID, - $Quantity, - $myrow['description'], - $UOM, - $myrow['decimalplaces'], - DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); - unset($UOM); - } - } - $ShowTender = 1; -} - -if (!isset($_SESSION['tender'.$identifier]) - or isset($_POST['LookupDeliveryAddress']) - or $ShowTender==1) { - - /* Show Tender header screen */ - if (!isset($_SESSION['tender'.$identifier])) { - $_SESSION['tender'.$identifier]=new Tender(); - } - echo '<form name="form1" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr> - <th colspan="4"><font size="3" color="#616161">' . _('Tender header details') . '</font></th> - </tr>'; - echo '<tr> - <td>' . _('Delivery Must Be Made Before') . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredByDate" size="11" value="' . date($_SESSION['DefaultDateFormat']) . '" /></td> - </tr>'; - - if (!isset($_POST['StkLocation']) or $_POST['StkLocation']==''){ - /* If this is the first time - * the form loaded set up defaults */ - - $_POST['StkLocation'] = $_SESSION['UserStockLocation']; - - $sql = "SELECT deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode='" . $_POST['StkLocation'] . "'"; - - $LocnAddrResult = DB_query($sql,$db); - if (DB_num_rows($LocnAddrResult)==1){ - $LocnRow = DB_fetch_array($LocnAddrResult); - $_POST['DelAdd1'] = $LocnRow['deladd1']; - $_POST['DelAdd2'] = $LocnRow['deladd2']; - $_POST['DelAdd3'] = $LocnRow['deladd3']; - $_POST['DelAdd4'] = $LocnRow['deladd4']; - $_POST['DelAdd5'] = $LocnRow['deladd5']; - $_POST['DelAdd6'] = $LocnRow['deladd6']; - $_POST['Tel'] = $LocnRow['tel']; - $_POST['Contact'] = $LocnRow['contact']; - - $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; - $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; - $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; - - } else { - /*The default location of the user is crook */ - prnMsg(_('The default stock location set up for this user is not a currently defined stock location') . - '. ' . _('Your system administrator needs to amend your user record'),'error'); - } - - - } elseif (isset($_POST['LookupDeliveryAddress'])){ - - $sql = "SELECT deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode='" . $_POST['StkLocation'] . "'"; - - $LocnAddrResult = DB_query($sql,$db); - if (DB_num_rows($LocnAddrResult)==1){ - $LocnRow = DB_fetch_array($LocnAddrResult); - $_POST['DelAdd1'] = $LocnRow['deladd1']; - $_POST['DelAdd2'] = $LocnRow['deladd2']; - $_POST['DelAdd3'] = $LocnRow['deladd3']; - $_POST['DelAdd4'] = $LocnRow['deladd4']; - $_POST['DelAdd5'] = $LocnRow['deladd5']; - $_POST['DelAdd6'] = $LocnRow['deladd6']; - $_POST['Tel'] = $LocnRow['tel']; - $_POST['Contact'] = $LocnRow['contact']; - - $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; - $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; - $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; - } - } - echo '<tr> - <td>' . _('Warehouse') . ':</td> - <td><select name="StkLocation" onchange="ReloadForm(form1.LookupDeliveryAddress)">'; - - $sql = "SELECT loccode, - locationname - FROM locations"; - $LocnResult = DB_query($sql,$db); - - while ($LocnRow=DB_fetch_array($LocnResult)){ - if ((isset($_SESSION['tender'.$identifier]->Location) and $_SESSION['tender'.$identifier]->Location == $LocnRow['loccode'])){ - echo '<option selected="selected" value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; - } else { - echo '<option value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; - } - } - - echo '</select> - <input type="submit" name="LookupDeliveryAddress" value="' ._('Select') . '" /></td> - </tr>'; - - /* Display the details of the delivery location - */ - echo '<tr> - <td>' . _('Delivery Contact') . ':</td> - <td><input type="text" name="Contact" size="41" value="' . $_SESSION['tender'.$identifier]->Contact . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 1 :</td> - <td><input type="text" name="DelAdd1" size="41" maxlength="40" value="' . $_POST['DelAdd1'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 2 :</td> - <td><input type="text" name="DelAdd2" size="41" maxlength="40" value="' . $_POST['DelAdd2'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 3 :</td> - <td><input type="text" name="DelAdd3" size="41" maxlength="40" value="' . $_POST['DelAdd3'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 4 :</td> - <td><input type="text" name="DelAdd4" size="21" maxlength="20" value="' . $_POST['DelAdd4'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 5 :</td> - <td><input type="text" name="DelAdd5" size="16" maxlength="15" value="' . $_POST['DelAdd5'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 6 :</td> - <td><input type="text" name="DelAdd6" size="16" maxlength="15" value="' . $_POST['DelAdd6'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Phone') . ':</td> - <td><input type="text" name="Tel" size="31" maxlength="30" value="' . $_SESSION['tender'.$identifier]->Telephone . '" /></td> - </tr>'; - echo '</table><br />'; - - /* Display the supplier/item details - */ - echo '<table>'; - - /* Supplier Details - */ - echo '<tr> - <td valign="top"> - <table class="selection">'; - echo '<tr> - <th colspan="4"><font size="3" color="#616161">' . _('Suppliers To Send Tender') . '</font></th> - </tr>'; - echo '<tr> - <th>'. _('Supplier Code') . '</th> - <th>' ._('Supplier Name') . '</th> - <th>' ._('Email Address') . '</th> - </tr>'; - foreach ($_SESSION['tender'.$identifier]->Suppliers as $Supplier) { - echo '<tr> - <td>' . $Supplier->SupplierCode . '</td> - <td>' . $Supplier->SupplierName . '</td> - <td>' . $Supplier->EmailAddress . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '&DeleteSupplier=' . $Supplier->SupplierCode . '">' . _('Delete') . '</a></td> - </tr>'; - } - echo '</table></td>'; - /* Item Details - */ - echo '<td valign="top"><table class="selection">'; - echo '<tr><th colspan="6"><font size="3" color="#616161">' . _('Items in Tender') . '</font></th></tr>'; - echo '<tr> - <th>'._('Stock ID').'</th> - <th>'._('Description').'</th> - <th>'._('Quantity').'</th> - <th>'._('UOM').'</th> - </tr>'; - $k=0; - foreach ($_SESSION['tender'.$identifier]->LineItems as $LineItems) { - if ($LineItems->Deleted==False) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - echo '<td>'.$LineItems->StockID.'</td> - <td>'.$LineItems->ItemDescription.'</td> - <td class="number">' . locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces).'</td> - <td>'.$LineItems->Units.'</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier,ENT_QUOTES,'UTF-8') . '&DeleteItem=' . $LineItems->LineNo . '">' . _('Delete') . '</a></td> - </tr>'; - echo '</tr>'; - } - } - echo '</table></td></tr></table><br />'; - - echo '<div class="centre"> - <input type="submit" name="Suppliers" value="' . _('Select Suppliers') . '" /> - <input type="submit" name="Items" value="' . _('Select Item Details') . '" /> - </div> - <br />'; - if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 - and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { - - echo '<div class="centre"> - <input type="submit" name="Save" value="' . _('Save Tender') . '" /> - </div>'; - } - echo '</form>'; - include('includes/footer.inc'); - exit; -} - -if (isset($_POST['SearchSupplier']) or isset($_POST['Go']) - or isset($_POST['Next']) or isset($_POST['Previous'])) { - - if (mb_strlen($_POST['Keywords']) > 0 and mb_strlen($_POST['SupplierCode']) > 0) { - prnMsg( '<br />' . _('Supplier name keywords have been used in preference to the Supplier code extract entered'), 'info' ); - } - if ($_POST['Keywords'] == '' and $_POST['SupplierCode'] == '') { - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - ORDER BY suppname"; - } else { - if (mb_strlen($_POST['Keywords']) > 0) { - $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE suppname " . LIKE . " '$SearchString' - ORDER BY suppname"; - } elseif (mb_strlen($_POST['SupplierCode']) > 0) { - $_POST['SupplierCode'] = mb_strtoupper($_POST['SupplierCode']); - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%' - ORDER BY supplierid"; - } - } //one of keywords or SupplierCode was more than a zero length string - $result = DB_query($SQL, $db); - if (DB_num_rows($result) == 1) { - $myrow = DB_fetch_array($result); - $SingleSupplierReturned = $myrow['supplierid']; - } -} //end of if search -if (isset($SingleSupplierReturned)) { /*there was only one supplier returned */ - $_SESSION['SupplierID'] = $SingleSupplierReturned; - unset($_POST['Keywords']); - unset($_POST['SupplierCode']); -} - -if (!isset($_POST['PageOffset'])) { - $_POST['PageOffset'] = 1; -} else { - if ($_POST['PageOffset'] == 0) { - $_POST['PageOffset'] = 1; - } -} - -if (isset($_POST['Suppliers'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Suppliers') . '</p> - <table cellpadding="3" class="selection"> - <tr> - <td>' . _('Enter a partial Name') . ':</td> - <td>'; - if (isset($_POST['Keywords'])) { - echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; - } else { - echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; - } - echo '</td><td><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</font></td><td>'; - if (isset($_POST['SupplierCode'])) { - echo '<input type="text" name="SupplierCode" value="' . $_POST['SupplierCode'] . '" size="15" maxlength="18" />'; - } else { - echo '<input type="text" name="SupplierCode" size="15" maxlength="18" />'; - } - echo '</td></tr></table><br /><div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Search Now') . '" /></div>'; - echo '</form>'; -} - -if (isset($_POST['SearchSupplier'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $ListCount = DB_num_rows($result); - $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); - if (isset($_POST['Next'])) { - if ($_POST['PageOffset'] < $ListPageMax) { - $_POST['PageOffset'] = $_POST['PageOffset'] + 1; - } - } - if (isset($_POST['Previous'])) { - if ($_POST['PageOffset'] > 1) { - $_POST['PageOffset'] = $_POST['PageOffset'] - 1; - } - } - if ($ListPageMax > 1) { - echo '<br /> ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; - echo '<select name="PageOffset">'; - $ListPage = 1; - while ($ListPage <= $ListPageMax) { - if ($ListPage == $_POST['PageOffset']) { - echo '<option value="' . $ListPage . '" selected="selected">' . $ListPage . '</option>'; - } else { - echo '<option value="' . $ListPage . '">' . $ListPage . '</option>'; - } - $ListPage++; - } - echo '</select> - <input type="submit" name="Go" value="' . _('Go') . '" /> - <input type="submit" name="Previous" value="' . _('Previous') . '" /> - <input type="submit" name="Next" value="' . _('Next') . '" />'; - echo '<br />'; - } - echo '<input type="hidden" name="Search" value="' . _('Search Now') . '" />'; - echo '<br /> - <br /> - <br /> - <table cellpadding="2">'; - echo '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Supplier Name') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Address 1') . '</th> - <th>' . _('Address 2') . '</th> - <th>' . _('Address 3') . '</th> - <th>' . _('Address 4') . '</th> - </tr>'; - $j = 1; - $k = 0; //row counter to determine background colour - $RowIndex = 0; - if (DB_num_rows($result) <> 0) { - DB_data_seek($result, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); - } - while (($myrow = DB_fetch_array($result)) and ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo '<tr class="EvenTableRows">'; - $k = 0; - } else { - echo '<tr class="OddTableRows">'; - $k = 1; - } - echo '<td><input type="submit" name="SelectedSupplier" value="'.$myrow['supplierid'].'" /></td> - <td>'.$myrow['suppname'].'</td> - <td>'.$myrow['currcode'].'</td> - <td>'.$myrow['address1'].'</td> - <td>'.$myrow['address2'].'</td> - <td>'.$myrow['address3'].'</td> - <td>'.$myrow['address4'].'</td> - </tr>'; - $RowIndex = $RowIndex + 1; - //end of page full new headings if - } - //end of while loop - echo '</table>'; -} - -/*The supplier has chosen option 2 - */ -if (isset($_POST['Items'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Inventory Items') . '</p>'; - $sql = "SELECT categoryid, - categorydescription - FROM stockcategory - ORDER BY categorydescription"; - $result = DB_query($sql, $db); - if (DB_num_rows($result) == 0) { - echo '<br /><font size="4" color="red">' . _('Problem Report') . ':</font><br />' . - _('There are no stock categories currently defined please use the link below to set them up'); - echo '<br /><a href="' . $rootpath . '/StockCategories.php">' . _('Define Stock Categories') . '</a>'; - exit; - } - echo '<table class="selection"> - <tr> - <td>' . _('In Stock Category') . ':<select name="StockCat">'; - if (!isset($_POST['StockCat'])) { - $_POST['StockCat'] = ''; - } - if ($_POST['StockCat'] == 'All') { - echo '<option selected="selected" value="All">' . _('All') . '</option>'; - } else { - echo '<option value="All">' . _('All') . '</option>'; - } - while ($myrow1 = DB_fetch_array($result)) { - if ($myrow1['categoryid'] == $_POST['StockCat']) { - echo '<option selected="selected" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; - } else { - echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; - } - } - echo '</select></td> - <td>' . _('Enter partial') . '<b> ' . _('Description') . '</b>:</td> - <td>'; - if (isset($_POST['Keywords'])) { - echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; - } else { - echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; - } - echo '</td> - </tr> - <tr> - <td></td> - <td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td> - <td>'; - if (isset($_POST['StockCode'])) { - echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" />'; - } else { - echo '<input type="text" name="StockCode" size="15" maxlength="18" />'; - } - echo '</td></tr> - </table> - <br /> - <div class="centre"> - <input type="submit" name="Search" value="' . _('Search Now') . '" /> - </div> - <br /> - </form>'; - echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>'; -} - -if (isset($_POST['Search'])){ /*ie seach for stock items */ - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier,ENT_QUOTES,'UTF-8') .'">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Tenders') . '" alt="" />' . ' ' . _('Select items required on this tender').'</p>'; - - if ($_POST['Keywords'] and $_POST['StockCode']) { - prnMsg( _('Stock description keywords have been used in preference to the Stock code extract entered'), 'info' ); - } - if ($_POST['Keywords']) { - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - - } elseif ($_POST['StockCode']){ - - $_POST['StockCode'] = '%' . $_POST['StockCode'] . '%'; - - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - - } else { - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - } - - $ErrMsg = _('There is a problem selecting the part records to display because'); - $DbgMsg = _('The SQL statement that failed was'); - $SearchResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - - if (DB_num_rows($SearchResult)==0 and $debug==1){ - prnMsg( _('There are no products to display matching the criteria provided'),'warn'); - } - if (DB_num_rows($SearchResult)==1){ - - $myrow=DB_fetch_array($SearchResult); - $_GET['NewItem'] = $myrow['stockid']; - DB_data_seek($SearchResult,0); - } - - if (isset($SearchResult)) { - - echo '<table cellpadding="1">'; - echo '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th> - </tr>'; - - $i = 0; - $k = 0; //row colour counter - $PartsDisplayed=0; - while ($myrow=DB_fetch_array($SearchResult)) { - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - $FileName = $myrow['stockid'] . '.jpg'; - if (file_exists( $_SESSION['part_pics_dir'] . '/' . $FileName) ) { - - $ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $FileName . '" width="50" height="50" />'; - - } else { - $ImageSource = '<i>'._('No Image').'</i>'; - } - - echo '<td>'.$myrow['stockid'].'</td> - <td>'.$myrow['description'].'</td> - <td>'.$myrow['units'].'</td> - <td>'.$ImageSource.'</td> - <td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /></td> - <input type="hidden" value="'.$myrow['units'].'" name="UOM'.$i.'" /> - <input type="hidden" value="'.$myrow['stockid'].'" name="StockID'.$i.'" /> - </tr>'; - - $i++; -#end of page full new headings if - } -#end of while loop - echo '</table>'; - - echo '<a name="end"></a> - <br /> - <div class="centre"> - <input type="submit" name="NewItem" value="' . _('Add to Tender') . '" /> - </div>'; - }#end if SearchResults to show - - echo '</form>'; - -} //end of if search - -include('includes/footer.inc'); - +<?php +/* $Id: SupplierTenderCreate.php 4821 2012-01-20 13:48:53Z tim_schofield $ */ + +include('includes/DefineTenderClass.php'); +include('includes/SQL_CommonFunctions.inc'); +include('includes/session.inc'); + +if (empty($_GET['identifier'])) { + /*unique session identifier to ensure that there is no conflict with other supplier tender sessions on the same machine */ + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + +if (isset($_GET['New']) and isset($_SESSION['tender'.$identifier])) { + unset($_SESSION['tender'.$identifier]); +} + +if (isset($_GET['New']) and $_SESSION['CanCreateTender']==0) { + $title = _('Authorisation Problem'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; + prnMsg( _('You do not have authority to create supplier tenders for this company.') . '<br />' . + _('Please see your system administrator'), 'warn'); + include('includes/footer.inc'); + exit; +} + +if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) { + $title = _('Authorisation Problem'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; + prnMsg( _('You do not have authority to amend supplier tenders for this company.') . '<br />' . + _('Please see your system administrator'), 'warn'); + include('includes/footer.inc'); + exit; +} + +$ShowTender = 0; + +if (isset($_GET['ID'])) { + $sql="SELECT tenderid, + location, + address1, + address2, + address3, + address4, + address5, + address6, + telephone + FROM tenders + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + if (isset($_SESSION['tender'.$identifier])) { + unset($_SESSION['tender'.$identifier]); + } + $_SESSION['tender'.$identifier] = new Tender(); + $_SESSION['tender'.$identifier]->TenderId = $myrow['tenderid']; + $_SESSION['tender'.$identifier]->Location = $myrow['location']; + $_SESSION['tender'.$identifier]->DelAdd1 = $myrow['address1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $myrow['address2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $myrow['address3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $myrow['address4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $myrow['address5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $myrow['address6']; + + $sql="SELECT tenderid, + tendersuppliers.supplierid, + suppliers.suppname, + tendersuppliers.email + FROM tendersuppliers + LEFT JOIN suppliers + ON tendersuppliers.supplierid=suppliers.supplierid + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql, $db); + while ($myrow=DB_fetch_array($result)) { + $_SESSION['tender'.$identifier]->add_supplier_to_tender($myrow['supplierid'], + $myrow['suppname'], + $myrow['email']); + } + + $sql="SELECT tenderid, + tenderitems.stockid, + tenderitems.quantity, + stockmaster.description, + tenderitems.units, + stockmaster.decimalplaces + FROM tenderitems + LEFT JOIN stockmaster + ON tenderitems.stockid=stockmaster.stockid + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql, $db); + while ($myrow=DB_fetch_array($result)) { + $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, + $myrow['stockid'], + $myrow['quantity'], + $myrow['description'], + $myrow['units'], + $myrow['decimalplaces'], + DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); + } + $ShowTender = 1; +} + +if (isset($_GET['Edit'])) { + $title = _('Edit an Existing Supplier Tender Request'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; + $sql="SELECT tenderid, + location, + address1, + address2, + address3, + address4, + address5, + address6, + telephone + FROM tenders + WHERE closed=0"; + $result=DB_query($sql, $db); + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Tender ID') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Address 1') . '</th> + <th>' . _('Address 2') . '</th> + <th>' . _('Address 3') . '</th> + <th>' . _('Address 4') . '</th> + <th>' . _('Address 5') . '</th> + <th>' . _('Address 6') . '</th> + <th>' . _('Telephone') . '</th> + </tr>'; + while ($myrow=DB_fetch_array($result)) { + echo '<tr> + <td>' . $myrow['tenderid'] . '</td> + <td>' . $myrow['location'] . '</td> + <td>' . $myrow['address1'] . '</td> + <td>' . $myrow['address2'] . '</td> + <td>' . $myrow['address3'] . '</td> + <td>' . $myrow['address4'] . '</td> + <td>' . $myrow['address5'] . '</td> + <td>' . $myrow['address6'] . '</td> + <td>' . $myrow['telephone'] . '</td> + <td><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier.'&ID='.$myrow['tenderid'].'">'. _('Edit') .'</a></td> + </tr>'; + } + echo '</table>'; + include('includes/footer.inc'); + exit; +} else if (isset($_GET['ID']) or (isset($_SESSION['tender'.$identifier]->TenderId))) { + $title = _('Edit an Existing Supplier Tender Request'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; +} else { + $title = _('Create a New Supplier Tender Request'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; +} + +if (isset($_POST['Save'])) { + $_SESSION['tender'.$identifier]->RequiredByDate=$_POST['RequiredByDate']; + $_SESSION['tender'.$identifier]->save($db); + $_SESSION['tender'.$identifier]->EmailSuppliers(); + prnMsg( _('The tender has been successfully saved'), 'success'); + include('includes/footer.inc'); + exit; +} + +if (isset($_GET['DeleteSupplier'])) { + $_SESSION['tender'.$identifier]->remove_supplier_from_tender($_GET['DeleteSupplier']); + $ShowTender = 1; +} + +if (isset($_GET['DeleteItem'])) { + $_SESSION['tender'.$identifier]->remove_item_from_tender($_GET['DeleteItem']); + $ShowTender = 1; +} + +if (isset($_POST['SelectedSupplier'])) { + $sql = "SELECT suppname, + email + FROM suppliers + WHERE supplierid='" . $_POST['SelectedSupplier'] . "'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + if (mb_strlen($myrow['email'])>0) { + $_SESSION['tender'.$identifier]->add_supplier_to_tender($_POST['SelectedSupplier'], + $myrow['suppname'], + $myrow['email']); + } else { + prnMsg( _('The supplier must have an email set up or they cannot be part of a tender'), 'warn'); + } + $ShowTender = 1; +} + +if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) { + foreach ($_POST as $key => $value) { + if (mb_substr($key,0,7)=='StockID') { + $Index = mb_substr($key,7,mb_strlen($key)-7); + $StockID = $value; + $Quantity = filter_number_format($_POST['Qty'.$Index]); + $UOM = $_POST['UOM'.$Index]; + $sql="SELECT description, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, + $StockID, + $Quantity, + $myrow['description'], + $UOM, + $myrow['decimalplaces'], + DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); + unset($UOM); + } + } + $ShowTender = 1; +} + +if (!isset($_SESSION['tender'.$identifier]) + or isset($_POST['LookupDeliveryAddress']) + or $ShowTender==1) { + + /* Show Tender header screen */ + if (!isset($_SESSION['tender'.$identifier])) { + $_SESSION['tender'.$identifier]=new Tender(); + } + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection">'; + echo '<tr> + <th colspan="4"><h3>' . _('Tender header details') . '</h3></th> + </tr>'; + echo '<tr> + <td>' . _('Delivery Must Be Made Before') . '</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredByDate" size="11" value="' . date($_SESSION['DefaultDateFormat']) . '" /></td> + </tr>'; + + if (!isset($_POST['StkLocation']) or $_POST['StkLocation']==''){ + /* If this is the first time + * the form loaded set up defaults */ + + $_POST['StkLocation'] = $_SESSION['UserStockLocation']; + + $sql = "SELECT deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode='" . $_POST['StkLocation'] . "'"; + + $LocnAddrResult = DB_query($sql,$db); + if (DB_num_rows($LocnAddrResult)==1){ + $LocnRow = DB_fetch_array($LocnAddrResult); + $_POST['DelAdd1'] = $LocnRow['deladd1']; + $_POST['DelAdd2'] = $LocnRow['deladd2']; + $_POST['DelAdd3'] = $LocnRow['deladd3']; + $_POST['DelAdd4'] = $LocnRow['deladd4']; + $_POST['DelAdd5'] = $LocnRow['deladd5']; + $_POST['DelAdd6'] = $LocnRow['deladd6']; + $_POST['Tel'] = $LocnRow['tel']; + $_POST['Contact'] = $LocnRow['contact']; + + $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; + $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; + $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; + + } else { + /*The default location of the user is crook */ + prnMsg(_('The default stock location set up for this user is not a currently defined stock location') . + '. ' . _('Your system administrator needs to amend your user record'),'error'); + } + + + } elseif (isset($_POST['LookupDeliveryAddress'])){ + + $sql = "SELECT deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode='" . $_POST['StkLocation'] . "'"; + + $LocnAddrResult = DB_query($sql,$db); + if (DB_num_rows($LocnAddrResult)==1){ + $LocnRow = DB_fetch_array($LocnAddrResult); + $_POST['DelAdd1'] = $LocnRow['deladd1']; + $_POST['DelAdd2'] = $LocnRow['deladd2']; + $_POST['DelAdd3'] = $LocnRow['deladd3']; + $_POST['DelAdd4'] = $LocnRow['deladd4']; + $_POST['DelAdd5'] = $LocnRow['deladd5']; + $_POST['DelAdd6'] = $LocnRow['deladd6']; + $_POST['Tel'] = $LocnRow['tel']; + $_POST['Contact'] = $LocnRow['contact']; + + $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; + $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; + $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; + } + } + echo '<tr> + <td>' . _('Warehouse') . ':</td> + <td><select name="StkLocation" onchange="ReloadForm(form1.LookupDeliveryAddress)">'; + + $sql = "SELECT loccode, + locationname + FROM locations"; + $LocnResult = DB_query($sql,$db); + + while ($LocnRow=DB_fetch_array($LocnResult)){ + if ((isset($_SESSION['tender'.$identifier]->Location) and $_SESSION['tender'.$identifier]->Location == $LocnRow['loccode'])){ + echo '<option selected="selected" value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; + } else { + echo '<option value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; + } + } + + echo '</select> + <input type="submit" name="LookupDeliveryAddress" value="' ._('Select') . '" /></td> + </tr>'; + + /* Display the details of the delivery location + */ + echo '<tr> + <td>' . _('Delivery Contact') . ':</td> + <td><input type="text" name="Contact" size="41" value="' . $_SESSION['tender'.$identifier]->Contact . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 1 :</td> + <td><input type="text" name="DelAdd1" size="41" maxlength="40" value="' . $_POST['DelAdd1'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 2 :</td> + <td><input type="text" name="DelAdd2" size="41" maxlength="40" value="' . $_POST['DelAdd2'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 3 :</td> + <td><input type="text" name="DelAdd3" size="41" maxlength="40" value="' . $_POST['DelAdd3'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 4 :</td> + <td><input type="text" name="DelAdd4" size="21" maxlength="20" value="' . $_POST['DelAdd4'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 5 :</td> + <td><input type="text" name="DelAdd5" size="16" maxlength="15" value="' . $_POST['DelAdd5'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 6 :</td> + <td><input type="text" name="DelAdd6" size="16" maxlength="15" value="' . $_POST['DelAdd6'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Phone') . ':</td> + <td><input type="text" name="Tel" size="31" maxlength="30" value="' . $_SESSION['tender'.$identifier]->Telephone . '" /></td> + </tr>'; + echo '</table><br />'; + + /* Display the supplier/item details + */ + echo '<table>'; + + /* Supplier Details + */ + echo '<tr> + <td valign="top"> + <table class="selection">'; + echo '<tr> + <th colspan="4"><h3>' . _('Suppliers To Send Tender') . '</h3></th> + </tr>'; + echo '<tr> + <th>'. _('Supplier Code') . '</th> + <th>' ._('Supplier Name') . '</th> + <th>' ._('Email Address') . '</th> + </tr>'; + foreach ($_SESSION['tender'.$identifier]->Suppliers as $Supplier) { + echo '<tr> + <td>' . $Supplier->SupplierCode . '</td> + <td>' . $Supplier->SupplierName . '</td> + <td>' . $Supplier->EmailAddress . '</td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '&DeleteSupplier=' . $Supplier->SupplierCode . '">' . _('Delete') . '</a></td> + </tr>'; + } + echo '</table></td>'; + /* Item Details + */ + echo '<td valign="top"><table class="selection">'; + echo '<tr><th colspan="6"><h3>' . _('Items in Tender') . '</h3></th></tr>'; + echo '<tr> + <th>'._('Stock ID').'</th> + <th>'._('Description').'</th> + <th>'._('Quantity').'</th> + <th>'._('UOM').'</th> + </tr>'; + $k=0; + foreach ($_SESSION['tender'.$identifier]->LineItems as $LineItems) { + if ($LineItems->Deleted==False) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + echo '<td>'.$LineItems->StockID.'</td> + <td>'.$LineItems->ItemDescription.'</td> + <td class="number">' . locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces).'</td> + <td>'.$LineItems->Units.'</td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier,ENT_QUOTES,'UTF-8') . '&DeleteItem=' . $LineItems->LineNo . '">' . _('Delete') . '</a></td> + </tr>'; + } + } + echo '</table></td></tr></table><br />'; + + echo '<div class="centre"> + <input type="submit" name="Suppliers" value="' . _('Select Suppliers') . '" /> + <input type="submit" name="Items" value="' . _('Select Item Details') . '" /> + </div> + <br />'; + if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 + and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { + + echo '<div class="centre"> + <input type="submit" name="Save" value="' . _('Save Tender') . '" /> + </div>'; + } + echo '</div> + </form>'; + include('includes/footer.inc'); + exit; +} + +if (isset($_POST['SearchSupplier']) or isset($_POST['Go']) + or isset($_POST['Next']) or isset($_POST['Previous'])) { + + if (mb_strlen($_POST['Keywords']) > 0 and mb_strlen($_POST['SupplierCode']) > 0) { + prnMsg( '<br />' . _('Supplier name keywords have been used in preference to the Supplier code extract entered'), 'info' ); + } + if ($_POST['Keywords'] == '' and $_POST['SupplierCode'] == '') { + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + ORDER BY suppname"; + } else { + if (mb_strlen($_POST['Keywords']) > 0) { + $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE suppname " . LIKE . " '$SearchString' + ORDER BY suppname"; + } elseif (mb_strlen($_POST['SupplierCode']) > 0) { + $_POST['SupplierCode'] = mb_strtoupper($_POST['SupplierCode']); + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%' + ORDER BY supplierid"; + } + } //one of keywords or SupplierCode was more than a zero length string + $result = DB_query($SQL, $db); + if (DB_num_rows($result) == 1) { + $myrow = DB_fetch_array($result); + $SingleSupplierReturned = $myrow['supplierid']; + } +} //end of if search +if (isset($SingleSupplierReturned)) { /*there was only one supplier returned */ + $_SESSION['SupplierID'] = $SingleSupplierReturned; + unset($_POST['Keywords']); + unset($_POST['SupplierCode']); +} + +if (!isset($_POST['PageOffset'])) { + $_POST['PageOffset'] = 1; +} else { + if ($_POST['PageOffset'] == 0) { + $_POST['PageOffset'] = 1; + } +} + +if (isset($_POST['Suppliers'])) { + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Suppliers') . '</p> + <table cellpadding="3" class="selection"> + <tr> + <td>' . _('Enter a partial Name') . ':</td> + <td>'; + if (isset($_POST['Keywords'])) { + echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; + } else { + echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; + } + echo '</td><td><b>' . _('OR') . '</b></td><td>' . _('Enter a partial Code') . ':</td><td>'; + if (isset($_POST['SupplierCode'])) { + echo '<input type="text" name="SupplierCode" value="' . $_POST['SupplierCode'] . '" size="15" maxlength="18" />'; + } else { + echo '<input type="text" name="SupplierCode" size="15" maxlength="18" />'; + } + echo '</td></tr></table><br /><div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Search Now') . '" /></div>'; + echo '</div> + </form>'; +} + +if (isset($_POST['SearchSupplier'])) { + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + $ListCount = DB_num_rows($result); + $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); + if (isset($_POST['Next'])) { + if ($_POST['PageOffset'] < $ListPageMax) { + $_POST['PageOffset'] = $_POST['PageOffset'] + 1; + } + } + if (isset($_POST['Previous'])) { + if ($_POST['PageOffset'] > 1) {... [truncated message content] |
From: <vv...@us...> - 2012-04-28 19:41:52
|
Revision: 5293 http://web-erp.svn.sourceforge.net/web-erp/?rev=5293&view=rev Author: vvs2012 Date: 2012-04-28 19:41:43 +0000 (Sat, 28 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/SuppLoginSetup.php trunk/SuppPaymentRun.php trunk/SuppPriceList.php trunk/SuppShiptChgs.php trunk/SuppTransGLAnalysis.php trunk/SupplierTenderCreate.php trunk/SupplierTransInquiry.php trunk/SupplierTypes.php trunk/Suppliers.php trunk/SystemParameters.php trunk/Tax.php trunk/TaxAuthorities.php trunk/TaxAuthorityRates.php trunk/TaxCategories.php trunk/TaxGroups.php trunk/TaxProvinces.php trunk/TopItems.php trunk/UnitsOfMeasure.php trunk/UpgradeDatabase.php trunk/UserSettings.php trunk/WOSerialNos.php trunk/WWW_Access.php trunk/WWW_Users.php trunk/WhereUsedInquiry.php trunk/WorkCentres.php trunk/WorkOrderCosting.php trunk/WorkOrderEntry.php trunk/WorkOrderIssue.php trunk/WorkOrderStatus.php trunk/includes/MainMenuLinksArray.php Modified: trunk/SuppLoginSetup.php =================================================================== --- trunk/SuppLoginSetup.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppLoginSetup.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -109,6 +109,7 @@ } echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -133,7 +134,7 @@ } echo '<tr> <td>' . _('Password') . ':</td> - <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /> + <td><input type="password" name="Password" size="22" maxlength="20" value="' . $_POST['Password'] . '" /></td> </tr> <tr> <td>' . _('Full Name') . ':</td> @@ -178,8 +179,10 @@ } if (!$FoundTheSupplierRole){ + echo '</table> + </div> + </form>'; prnMsg(_('The supplier login role is expected to contain just one token - number 9. There is no such role currently defined - so a supplier login cannot be set up until this role is defined'),'error'); - echo '</table>'; include('includes/footer.inc'); exit; } @@ -292,6 +295,7 @@ <div class="centre"> <input type="submit" name="submit" value="' . _('Enter Information') . '" /> </div> + </div> </form>'; echo '<script type="text/javascript">defaultControl(document.forms[0].UserID);</script>'; Modified: trunk/SuppPaymentRun.php =================================================================== --- trunk/SuppPaymentRun.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppPaymentRun.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -246,9 +246,10 @@ /* show form to allow input */ - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <table class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection">'; if (!isset($_POST['FromCriteria']) or mb_strlen($_POST['FromCriteria'])<1){ $DefaultFromCriteria = '1'; @@ -384,7 +385,8 @@ <input type="submit" name="PrintPDF" value="' . _('Print PDF Only') . '" /> <input type="submit" name="PrintPDFAndProcess" value="' . _('Print and Process Payments') . '" /> </div>'; - + echo '</div> + </form>'; include ('includes/footer.inc'); } /*end of else not PrintPDF */ ?> \ No newline at end of file Modified: trunk/SuppPriceList.php =================================================================== --- trunk/SuppPriceList.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppPriceList.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -203,9 +203,9 @@ echo '<div class="page_help_text">' . _('View the Price List from supplier') . '</div><br />'; echo '<br/> - <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <table>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT supplierid,suppname FROM `suppliers`"; $result = DB_query($sql,$db); @@ -255,6 +255,8 @@ <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; + echo '</div> + </form>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ Modified: trunk/SuppShiptChgs.php =================================================================== --- trunk/SuppShiptChgs.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppShiptChgs.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -94,13 +94,14 @@ } echo '<tr> - <td class="number"><font size="2" color=navy>' . _('Total') . ':</font></td> - <td class="number"><font size="2" color=navy><U>' . locale_number_format($TotalShiptValue,2) . '</U></font></td> + <td class="number">' . _('Total') . ':</td> + <td class="number">' . locale_number_format($TotalShiptValue,2) . '</td> </tr> </table><br />'; /*Set up a form to allow input of new Shipment charges */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['ShiptRef'])) { @@ -152,6 +153,7 @@ <div class="centre"> <input type="submit" name="AddShiptChgToInvoice" value="' . _('Enter Shipment Charge') . '" /> </div> + </div> </form>'; include('includes/footer.inc'); Modified: trunk/SuppTransGLAnalysis.php =================================================================== --- trunk/SuppTransGLAnalysis.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SuppTransGLAnalysis.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -131,8 +131,8 @@ } echo '<tr> - <td colspan="2" class="number"><font size="4" color="blue">' . _('Total') . ':</font></td> - <td class="number"><font size="2" color="navy"><u>' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</u></font></td> + <td colspan="2" class="number">' . _('Total') . ':</td> + <td class="number">' . locale_number_format($TotalGLValue,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> </tr> </table>'; @@ -150,6 +150,7 @@ /*Set up a form to allow input of new GL entries */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> @@ -159,8 +160,8 @@ } echo '<tr> <td>' . _('Account Code') . ':</td> - <td><input type="text" name="GLCode" size="12" maxlength="11" value="' . $_POST['GLCode'] . '" /></td> - <input type="hidden" name="JobRef" value="" /> + <td><input type="text" name="GLCode" size="12" maxlength="11" value="' . $_POST['GLCode'] . '" /> + <input type="hidden" name="JobRef" value="" /></td> </tr>'; echo '<tr> <td>' . _('Account Selection') . ': @@ -178,7 +179,7 @@ } else { echo '<option value="'; } - echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . '</option>'; } echo '</select> @@ -206,6 +207,7 @@ <input type="submit" name="AddGLCodeToTrans" value="' . _('Enter GL Line') . '" /> </div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/SupplierTenderCreate.php =================================================================== --- trunk/SupplierTenderCreate.php 2012-04-28 13:20:43 UTC (rev 5292) +++ trunk/SupplierTenderCreate.php 2012-04-28 19:41:43 UTC (rev 5293) @@ -1,865 +1,875 @@ -<?php -/* $Id: SupplierTenderCreate.php 4821 2012-01-20 13:48:53Z tim_schofield $ */ - -include('includes/DefineTenderClass.php'); -include('includes/SQL_CommonFunctions.inc'); -include('includes/session.inc'); - -if (empty($_GET['identifier'])) { - /*unique session identifier to ensure that there is no conflict with other supplier tender sessions on the same machine */ - $identifier=date('U'); -} else { - $identifier=$_GET['identifier']; -} - -if (isset($_GET['New']) and isset($_SESSION['tender'.$identifier])) { - unset($_SESSION['tender'.$identifier]); -} - -if (isset($_GET['New']) and $_SESSION['CanCreateTender']==0) { - $title = _('Authorisation Problem'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; - prnMsg( _('You do not have authority to create supplier tenders for this company.') . '<br />' . - _('Please see your system administrator'), 'warn'); - include('includes/footer.inc'); - exit; -} - -if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) { - $title = _('Authorisation Problem'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; - prnMsg( _('You do not have authority to amend supplier tenders for this company.') . '<br />' . - _('Please see your system administrator'), 'warn'); - include('includes/footer.inc'); - exit; -} - -$ShowTender = 0; - -if (isset($_GET['ID'])) { - $sql="SELECT tenderid, - location, - address1, - address2, - address3, - address4, - address5, - address6, - telephone - FROM tenders - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - if (isset($_SESSION['tender'.$identifier])) { - unset($_SESSION['tender'.$identifier]); - } - $_SESSION['tender'.$identifier] = new Tender(); - $_SESSION['tender'.$identifier]->TenderId = $myrow['tenderid']; - $_SESSION['tender'.$identifier]->Location = $myrow['location']; - $_SESSION['tender'.$identifier]->DelAdd1 = $myrow['address1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $myrow['address2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $myrow['address3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $myrow['address4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $myrow['address5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $myrow['address6']; - - $sql="SELECT tenderid, - tendersuppliers.supplierid, - suppliers.suppname, - tendersuppliers.email - FROM tendersuppliers - LEFT JOIN suppliers - ON tendersuppliers.supplierid=suppliers.supplierid - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql, $db); - while ($myrow=DB_fetch_array($result)) { - $_SESSION['tender'.$identifier]->add_supplier_to_tender($myrow['supplierid'], - $myrow['suppname'], - $myrow['email']); - } - - $sql="SELECT tenderid, - tenderitems.stockid, - tenderitems.quantity, - stockmaster.description, - tenderitems.units, - stockmaster.decimalplaces - FROM tenderitems - LEFT JOIN stockmaster - ON tenderitems.stockid=stockmaster.stockid - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql, $db); - while ($myrow=DB_fetch_array($result)) { - $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, - $myrow['stockid'], - $myrow['quantity'], - $myrow['description'], - $myrow['units'], - $myrow['decimalplaces'], - DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); - } - $ShowTender = 1; -} - -if (isset($_GET['Edit'])) { - $title = _('Edit an Existing Supplier Tender Request'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; - $sql="SELECT tenderid, - location, - address1, - address2, - address3, - address4, - address5, - address6, - telephone - FROM tenders - WHERE closed=0"; - $result=DB_query($sql, $db); - echo '<table class="selection">'; - echo '<tr> - <th>' . _('Tender ID') . '</th> - <th>' . _('Location') . '</th> - <th>' . _('Address 1') . '</th> - <th>' . _('Address 2') . '</th> - <th>' . _('Address 3') . '</th> - <th>' . _('Address 4') . '</th> - <th>' . _('Address 5') . '</th> - <th>' . _('Address 6') . '</th> - <th>' . _('Telephone') . '</th> - </tr>'; - while ($myrow=DB_fetch_array($result)) { - echo '<tr> - <td>' . $myrow['tenderid'] . '</td> - <td>' . $myrow['location'] . '</td> - <td>' . $myrow['address1'] . '</td> - <td>' . $myrow['address2'] . '</td> - <td>' . $myrow['address3'] . '</td> - <td>' . $myrow['address4'] . '</td> - <td>' . $myrow['address5'] . '</td> - <td>' . $myrow['address6'] . '</td> - <td>' . $myrow['telephone'] . '</td> - <td><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier.'&ID='.$myrow['tenderid'].'">'. _('Edit') .'</a></td> - </tr>'; - } - echo '</table>'; - include('includes/footer.inc'); - exit; -} else if (isset($_GET['ID']) or (isset($_SESSION['tender'.$identifier]->TenderId))) { - $title = _('Edit an Existing Supplier Tender Request'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; -} else { - $title = _('Create a New Supplier Tender Request'); - include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; -} - -if (isset($_POST['Save'])) { - $_SESSION['tender'.$identifier]->RequiredByDate=$_POST['RequiredByDate']; - $_SESSION['tender'.$identifier]->save($db); - $_SESSION['tender'.$identifier]->EmailSuppliers(); - prnMsg( _('The tender has been successfully saved'), 'success'); - include('includes/footer.inc'); - exit; -} - -if (isset($_GET['DeleteSupplier'])) { - $_SESSION['tender'.$identifier]->remove_supplier_from_tender($_GET['DeleteSupplier']); - $ShowTender = 1; -} - -if (isset($_GET['DeleteItem'])) { - $_SESSION['tender'.$identifier]->remove_item_from_tender($_GET['DeleteItem']); - $ShowTender = 1; -} - -if (isset($_POST['SelectedSupplier'])) { - $sql = "SELECT suppname, - email - FROM suppliers - WHERE supplierid='" . $_POST['SelectedSupplier'] . "'"; - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); - if (mb_strlen($myrow['email'])>0) { - $_SESSION['tender'.$identifier]->add_supplier_to_tender($_POST['SelectedSupplier'], - $myrow['suppname'], - $myrow['email']); - } else { - prnMsg( _('The supplier must have an email set up or they cannot be part of a tender'), 'warn'); - } - $ShowTender = 1; -} - -if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) { - foreach ($_POST as $key => $value) { - if (mb_substr($key,0,7)=='StockID') { - $Index = mb_substr($key,7,mb_strlen($key)-7); - $StockID = $value; - $Quantity = filter_number_format($_POST['Qty'.$Index]); - $UOM = $_POST['UOM'.$Index]; - $sql="SELECT description, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, - $StockID, - $Quantity, - $myrow['description'], - $UOM, - $myrow['decimalplaces'], - DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); - unset($UOM); - } - } - $ShowTender = 1; -} - -if (!isset($_SESSION['tender'.$identifier]) - or isset($_POST['LookupDeliveryAddress']) - or $ShowTender==1) { - - /* Show Tender header screen */ - if (!isset($_SESSION['tender'.$identifier])) { - $_SESSION['tender'.$identifier]=new Tender(); - } - echo '<form name="form1" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr> - <th colspan="4"><font size="3" color="#616161">' . _('Tender header details') . '</font></th> - </tr>'; - echo '<tr> - <td>' . _('Delivery Must Be Made Before') . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredByDate" size="11" value="' . date($_SESSION['DefaultDateFormat']) . '" /></td> - </tr>'; - - if (!isset($_POST['StkLocation']) or $_POST['StkLocation']==''){ - /* If this is the first time - * the form loaded set up defaults */ - - $_POST['StkLocation'] = $_SESSION['UserStockLocation']; - - $sql = "SELECT deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode='" . $_POST['StkLocation'] . "'"; - - $LocnAddrResult = DB_query($sql,$db); - if (DB_num_rows($LocnAddrResult)==1){ - $LocnRow = DB_fetch_array($LocnAddrResult); - $_POST['DelAdd1'] = $LocnRow['deladd1']; - $_POST['DelAdd2'] = $LocnRow['deladd2']; - $_POST['DelAdd3'] = $LocnRow['deladd3']; - $_POST['DelAdd4'] = $LocnRow['deladd4']; - $_POST['DelAdd5'] = $LocnRow['deladd5']; - $_POST['DelAdd6'] = $LocnRow['deladd6']; - $_POST['Tel'] = $LocnRow['tel']; - $_POST['Contact'] = $LocnRow['contact']; - - $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; - $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; - $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; - - } else { - /*The default location of the user is crook */ - prnMsg(_('The default stock location set up for this user is not a currently defined stock location') . - '. ' . _('Your system administrator needs to amend your user record'),'error'); - } - - - } elseif (isset($_POST['LookupDeliveryAddress'])){ - - $sql = "SELECT deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - WHERE loccode='" . $_POST['StkLocation'] . "'"; - - $LocnAddrResult = DB_query($sql,$db); - if (DB_num_rows($LocnAddrResult)==1){ - $LocnRow = DB_fetch_array($LocnAddrResult); - $_POST['DelAdd1'] = $LocnRow['deladd1']; - $_POST['DelAdd2'] = $LocnRow['deladd2']; - $_POST['DelAdd3'] = $LocnRow['deladd3']; - $_POST['DelAdd4'] = $LocnRow['deladd4']; - $_POST['DelAdd5'] = $LocnRow['deladd5']; - $_POST['DelAdd6'] = $LocnRow['deladd6']; - $_POST['Tel'] = $LocnRow['tel']; - $_POST['Contact'] = $LocnRow['contact']; - - $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; - $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; - $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; - } - } - echo '<tr> - <td>' . _('Warehouse') . ':</td> - <td><select name="StkLocation" onchange="ReloadForm(form1.LookupDeliveryAddress)">'; - - $sql = "SELECT loccode, - locationname - FROM locations"; - $LocnResult = DB_query($sql,$db); - - while ($LocnRow=DB_fetch_array($LocnResult)){ - if ((isset($_SESSION['tender'.$identifier]->Location) and $_SESSION['tender'.$identifier]->Location == $LocnRow['loccode'])){ - echo '<option selected="selected" value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; - } else { - echo '<option value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; - } - } - - echo '</select> - <input type="submit" name="LookupDeliveryAddress" value="' ._('Select') . '" /></td> - </tr>'; - - /* Display the details of the delivery location - */ - echo '<tr> - <td>' . _('Delivery Contact') . ':</td> - <td><input type="text" name="Contact" size="41" value="' . $_SESSION['tender'.$identifier]->Contact . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 1 :</td> - <td><input type="text" name="DelAdd1" size="41" maxlength="40" value="' . $_POST['DelAdd1'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 2 :</td> - <td><input type="text" name="DelAdd2" size="41" maxlength="40" value="' . $_POST['DelAdd2'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 3 :</td> - <td><input type="text" name="DelAdd3" size="41" maxlength="40" value="' . $_POST['DelAdd3'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 4 :</td> - <td><input type="text" name="DelAdd4" size="21" maxlength="20" value="' . $_POST['DelAdd4'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 5 :</td> - <td><input type="text" name="DelAdd5" size="16" maxlength="15" value="' . $_POST['DelAdd5'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Address') . ' 6 :</td> - <td><input type="text" name="DelAdd6" size="16" maxlength="15" value="' . $_POST['DelAdd6'] . '" /></td> - </tr>'; - echo '<tr> - <td>' . _('Phone') . ':</td> - <td><input type="text" name="Tel" size="31" maxlength="30" value="' . $_SESSION['tender'.$identifier]->Telephone . '" /></td> - </tr>'; - echo '</table><br />'; - - /* Display the supplier/item details - */ - echo '<table>'; - - /* Supplier Details - */ - echo '<tr> - <td valign="top"> - <table class="selection">'; - echo '<tr> - <th colspan="4"><font size="3" color="#616161">' . _('Suppliers To Send Tender') . '</font></th> - </tr>'; - echo '<tr> - <th>'. _('Supplier Code') . '</th> - <th>' ._('Supplier Name') . '</th> - <th>' ._('Email Address') . '</th> - </tr>'; - foreach ($_SESSION['tender'.$identifier]->Suppliers as $Supplier) { - echo '<tr> - <td>' . $Supplier->SupplierCode . '</td> - <td>' . $Supplier->SupplierName . '</td> - <td>' . $Supplier->EmailAddress . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '&DeleteSupplier=' . $Supplier->SupplierCode . '">' . _('Delete') . '</a></td> - </tr>'; - } - echo '</table></td>'; - /* Item Details - */ - echo '<td valign="top"><table class="selection">'; - echo '<tr><th colspan="6"><font size="3" color="#616161">' . _('Items in Tender') . '</font></th></tr>'; - echo '<tr> - <th>'._('Stock ID').'</th> - <th>'._('Description').'</th> - <th>'._('Quantity').'</th> - <th>'._('UOM').'</th> - </tr>'; - $k=0; - foreach ($_SESSION['tender'.$identifier]->LineItems as $LineItems) { - if ($LineItems->Deleted==False) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - echo '<td>'.$LineItems->StockID.'</td> - <td>'.$LineItems->ItemDescription.'</td> - <td class="number">' . locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces).'</td> - <td>'.$LineItems->Units.'</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier,ENT_QUOTES,'UTF-8') . '&DeleteItem=' . $LineItems->LineNo . '">' . _('Delete') . '</a></td> - </tr>'; - echo '</tr>'; - } - } - echo '</table></td></tr></table><br />'; - - echo '<div class="centre"> - <input type="submit" name="Suppliers" value="' . _('Select Suppliers') . '" /> - <input type="submit" name="Items" value="' . _('Select Item Details') . '" /> - </div> - <br />'; - if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 - and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { - - echo '<div class="centre"> - <input type="submit" name="Save" value="' . _('Save Tender') . '" /> - </div>'; - } - echo '</form>'; - include('includes/footer.inc'); - exit; -} - -if (isset($_POST['SearchSupplier']) or isset($_POST['Go']) - or isset($_POST['Next']) or isset($_POST['Previous'])) { - - if (mb_strlen($_POST['Keywords']) > 0 and mb_strlen($_POST['SupplierCode']) > 0) { - prnMsg( '<br />' . _('Supplier name keywords have been used in preference to the Supplier code extract entered'), 'info' ); - } - if ($_POST['Keywords'] == '' and $_POST['SupplierCode'] == '') { - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - ORDER BY suppname"; - } else { - if (mb_strlen($_POST['Keywords']) > 0) { - $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE suppname " . LIKE . " '$SearchString' - ORDER BY suppname"; - } elseif (mb_strlen($_POST['SupplierCode']) > 0) { - $_POST['SupplierCode'] = mb_strtoupper($_POST['SupplierCode']); - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%' - ORDER BY supplierid"; - } - } //one of keywords or SupplierCode was more than a zero length string - $result = DB_query($SQL, $db); - if (DB_num_rows($result) == 1) { - $myrow = DB_fetch_array($result); - $SingleSupplierReturned = $myrow['supplierid']; - } -} //end of if search -if (isset($SingleSupplierReturned)) { /*there was only one supplier returned */ - $_SESSION['SupplierID'] = $SingleSupplierReturned; - unset($_POST['Keywords']); - unset($_POST['SupplierCode']); -} - -if (!isset($_POST['PageOffset'])) { - $_POST['PageOffset'] = 1; -} else { - if ($_POST['PageOffset'] == 0) { - $_POST['PageOffset'] = 1; - } -} - -if (isset($_POST['Suppliers'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Suppliers') . '</p> - <table cellpadding="3" class="selection"> - <tr> - <td>' . _('Enter a partial Name') . ':</td> - <td>'; - if (isset($_POST['Keywords'])) { - echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; - } else { - echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; - } - echo '</td><td><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</font></td><td>'; - if (isset($_POST['SupplierCode'])) { - echo '<input type="text" name="SupplierCode" value="' . $_POST['SupplierCode'] . '" size="15" maxlength="18" />'; - } else { - echo '<input type="text" name="SupplierCode" size="15" maxlength="18" />'; - } - echo '</td></tr></table><br /><div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Search Now') . '" /></div>'; - echo '</form>'; -} - -if (isset($_POST['SearchSupplier'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $ListCount = DB_num_rows($result); - $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); - if (isset($_POST['Next'])) { - if ($_POST['PageOffset'] < $ListPageMax) { - $_POST['PageOffset'] = $_POST['PageOffset'] + 1; - } - } - if (isset($_POST['Previous'])) { - if ($_POST['PageOffset'] > 1) { - $_POST['PageOffset'] = $_POST['PageOffset'] - 1; - } - } - if ($ListPageMax > 1) { - echo '<br /> ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; - echo '<select name="PageOffset">'; - $ListPage = 1; - while ($ListPage <= $ListPageMax) { - if ($ListPage == $_POST['PageOffset']) { - echo '<option value="' . $ListPage . '" selected="selected">' . $ListPage . '</option>'; - } else { - echo '<option value="' . $ListPage . '">' . $ListPage . '</option>'; - } - $ListPage++; - } - echo '</select> - <input type="submit" name="Go" value="' . _('Go') . '" /> - <input type="submit" name="Previous" value="' . _('Previous') . '" /> - <input type="submit" name="Next" value="' . _('Next') . '" />'; - echo '<br />'; - } - echo '<input type="hidden" name="Search" value="' . _('Search Now') . '" />'; - echo '<br /> - <br /> - <br /> - <table cellpadding="2">'; - echo '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Supplier Name') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Address 1') . '</th> - <th>' . _('Address 2') . '</th> - <th>' . _('Address 3') . '</th> - <th>' . _('Address 4') . '</th> - </tr>'; - $j = 1; - $k = 0; //row counter to determine background colour - $RowIndex = 0; - if (DB_num_rows($result) <> 0) { - DB_data_seek($result, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); - } - while (($myrow = DB_fetch_array($result)) and ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo '<tr class="EvenTableRows">'; - $k = 0; - } else { - echo '<tr class="OddTableRows">'; - $k = 1; - } - echo '<td><input type="submit" name="SelectedSupplier" value="'.$myrow['supplierid'].'" /></td> - <td>'.$myrow['suppname'].'</td> - <td>'.$myrow['currcode'].'</td> - <td>'.$myrow['address1'].'</td> - <td>'.$myrow['address2'].'</td> - <td>'.$myrow['address3'].'</td> - <td>'.$myrow['address4'].'</td> - </tr>'; - $RowIndex = $RowIndex + 1; - //end of page full new headings if - } - //end of while loop - echo '</table>'; -} - -/*The supplier has chosen option 2 - */ -if (isset($_POST['Items'])) { - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Inventory Items') . '</p>'; - $sql = "SELECT categoryid, - categorydescription - FROM stockcategory - ORDER BY categorydescription"; - $result = DB_query($sql, $db); - if (DB_num_rows($result) == 0) { - echo '<br /><font size="4" color="red">' . _('Problem Report') . ':</font><br />' . - _('There are no stock categories currently defined please use the link below to set them up'); - echo '<br /><a href="' . $rootpath . '/StockCategories.php">' . _('Define Stock Categories') . '</a>'; - exit; - } - echo '<table class="selection"> - <tr> - <td>' . _('In Stock Category') . ':<select name="StockCat">'; - if (!isset($_POST['StockCat'])) { - $_POST['StockCat'] = ''; - } - if ($_POST['StockCat'] == 'All') { - echo '<option selected="selected" value="All">' . _('All') . '</option>'; - } else { - echo '<option value="All">' . _('All') . '</option>'; - } - while ($myrow1 = DB_fetch_array($result)) { - if ($myrow1['categoryid'] == $_POST['StockCat']) { - echo '<option selected="selected" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; - } else { - echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; - } - } - echo '</select></td> - <td>' . _('Enter partial') . '<b> ' . _('Description') . '</b>:</td> - <td>'; - if (isset($_POST['Keywords'])) { - echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; - } else { - echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; - } - echo '</td> - </tr> - <tr> - <td></td> - <td><font size="3"><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td> - <td>'; - if (isset($_POST['StockCode'])) { - echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" />'; - } else { - echo '<input type="text" name="StockCode" size="15" maxlength="18" />'; - } - echo '</td></tr> - </table> - <br /> - <div class="centre"> - <input type="submit" name="Search" value="' . _('Search Now') . '" /> - </div> - <br /> - </form>'; - echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>'; -} - -if (isset($_POST['Search'])){ /*ie seach for stock items */ - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier,ENT_QUOTES,'UTF-8') .'">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Tenders') . '" alt="" />' . ' ' . _('Select items required on this tender').'</p>'; - - if ($_POST['Keywords'] and $_POST['StockCode']) { - prnMsg( _('Stock description keywords have been used in preference to the Stock code extract entered'), 'info' ); - } - if ($_POST['Keywords']) { - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - - } elseif ($_POST['StockCode']){ - - $_POST['StockCode'] = '%' . $_POST['StockCode'] . '%'; - - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - - } else { - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - } - - $ErrMsg = _('There is a problem selecting the part records to display because'); - $DbgMsg = _('The SQL statement that failed was'); - $SearchResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - - if (DB_num_rows($SearchResult)==0 and $debug==1){ - prnMsg( _('There are no products to display matching the criteria provided'),'warn'); - } - if (DB_num_rows($SearchResult)==1){ - - $myrow=DB_fetch_array($SearchResult); - $_GET['NewItem'] = $myrow['stockid']; - DB_data_seek($SearchResult,0); - } - - if (isset($SearchResult)) { - - echo '<table cellpadding="1">'; - echo '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Image') . '</th> - <th>' . _('Quantity') . '</th> - </tr>'; - - $i = 0; - $k = 0; //row colour counter - $PartsDisplayed=0; - while ($myrow=DB_fetch_array($SearchResult)) { - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - $FileName = $myrow['stockid'] . '.jpg'; - if (file_exists( $_SESSION['part_pics_dir'] . '/' . $FileName) ) { - - $ImageSource = '<img src="'.$rootpath . '/' . $_SESSION['part_pics_dir'] . '/' . $FileName . '" width="50" height="50" />'; - - } else { - $ImageSource = '<i>'._('No Image').'</i>'; - } - - echo '<td>'.$myrow['stockid'].'</td> - <td>'.$myrow['description'].'</td> - <td>'.$myrow['units'].'</td> - <td>'.$ImageSource.'</td> - <td><input class="number" type="text" size="6" value="0" name="Qty'.$i.'" /></td> - <input type="hidden" value="'.$myrow['units'].'" name="UOM'.$i.'" /> - <input type="hidden" value="'.$myrow['stockid'].'" name="StockID'.$i.'" /> - </tr>'; - - $i++; -#end of page full new headings if - } -#end of while loop - echo '</table>'; - - echo '<a name="end"></a> - <br /> - <div class="centre"> - <input type="submit" name="NewItem" value="' . _('Add to Tender') . '" /> - </div>'; - }#end if SearchResults to show - - echo '</form>'; - -} //end of if search - -include('includes/footer.inc'); - +<?php +/* $Id: SupplierTenderCreate.php 4821 2012-01-20 13:48:53Z tim_schofield $ */ + +include('includes/DefineTenderClass.php'); +include('includes/SQL_CommonFunctions.inc'); +include('includes/session.inc'); + +if (empty($_GET['identifier'])) { + /*unique session identifier to ensure that there is no conflict with other supplier tender sessions on the same machine */ + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + +if (isset($_GET['New']) and isset($_SESSION['tender'.$identifier])) { + unset($_SESSION['tender'.$identifier]); +} + +if (isset($_GET['New']) and $_SESSION['CanCreateTender']==0) { + $title = _('Authorisation Problem'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; + prnMsg( _('You do not have authority to create supplier tenders for this company.') . '<br />' . + _('Please see your system administrator'), 'warn'); + include('includes/footer.inc'); + exit; +} + +if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) { + $title = _('Authorisation Problem'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" /> '.$title . '</p>'; + prnMsg( _('You do not have authority to amend supplier tenders for this company.') . '<br />' . + _('Please see your system administrator'), 'warn'); + include('includes/footer.inc'); + exit; +} + +$ShowTender = 0; + +if (isset($_GET['ID'])) { + $sql="SELECT tenderid, + location, + address1, + address2, + address3, + address4, + address5, + address6, + telephone + FROM tenders + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + if (isset($_SESSION['tender'.$identifier])) { + unset($_SESSION['tender'.$identifier]); + } + $_SESSION['tender'.$identifier] = new Tender(); + $_SESSION['tender'.$identifier]->TenderId = $myrow['tenderid']; + $_SESSION['tender'.$identifier]->Location = $myrow['location']; + $_SESSION['tender'.$identifier]->DelAdd1 = $myrow['address1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $myrow['address2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $myrow['address3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $myrow['address4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $myrow['address5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $myrow['address6']; + + $sql="SELECT tenderid, + tendersuppliers.supplierid, + suppliers.suppname, + tendersuppliers.email + FROM tendersuppliers + LEFT JOIN suppliers + ON tendersuppliers.supplierid=suppliers.supplierid + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql, $db); + while ($myrow=DB_fetch_array($result)) { + $_SESSION['tender'.$identifier]->add_supplier_to_tender($myrow['supplierid'], + $myrow['suppname'], + $myrow['email']); + } + + $sql="SELECT tenderid, + tenderitems.stockid, + tenderitems.quantity, + stockmaster.description, + tenderitems.units, + stockmaster.decimalplaces + FROM tenderitems + LEFT JOIN stockmaster + ON tenderitems.stockid=stockmaster.stockid + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql, $db); + while ($myrow=DB_fetch_array($result)) { + $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, + $myrow['stockid'], + $myrow['quantity'], + $myrow['description'], + $myrow['units'], + $myrow['decimalplaces'], + DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); + } + $ShowTender = 1; +} + +if (isset($_GET['Edit'])) { + $title = _('Edit an Existing Supplier Tender Request'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; + $sql="SELECT tenderid, + location, + address1, + address2, + address3, + address4, + address5, + address6, + telephone + FROM tenders + WHERE closed=0"; + $result=DB_query($sql, $db); + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Tender ID') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Address 1') . '</th> + <th>' . _('Address 2') . '</th> + <th>' . _('Address 3') . '</th> + <th>' . _('Address 4') . '</th> + <th>' . _('Address 5') . '</th> + <th>' . _('Address 6') . '</th> + <th>' . _('Telephone') . '</th> + </tr>'; + while ($myrow=DB_fetch_array($result)) { + echo '<tr> + <td>' . $myrow['tenderid'] . '</td> + <td>' . $myrow['location'] . '</td> + <td>' . $myrow['address1'] . '</td> + <td>' . $myrow['address2'] . '</td> + <td>' . $myrow['address3'] . '</td> + <td>' . $myrow['address4'] . '</td> + <td>' . $myrow['address5'] . '</td> + <td>' . $myrow['address6'] . '</td> + <td>' . $myrow['telephone'] . '</td> + <td><a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier.'&ID='.$myrow['tenderid'].'">'. _('Edit') .'</a></td> + </tr>'; + } + echo '</table>'; + include('includes/footer.inc'); + exit; +} else if (isset($_GET['ID']) or (isset($_SESSION['tender'.$identifier]->TenderId))) { + $title = _('Edit an Existing Supplier Tender Request'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; +} else { + $title = _('Create a New Supplier Tender Request'); + include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order Tendering') . '" alt="" /> '.$title . '</p>'; +} + +if (isset($_POST['Save'])) { + $_SESSION['tender'.$identifier]->RequiredByDate=$_POST['RequiredByDate']; + $_SESSION['tender'.$identifier]->save($db); + $_SESSION['tender'.$identifier]->EmailSuppliers(); + prnMsg( _('The tender has been successfully saved'), 'success'); + include('includes/footer.inc'); + exit; +} + +if (isset($_GET['DeleteSupplier'])) { + $_SESSION['tender'.$identifier]->remove_supplier_from_tender($_GET['DeleteSupplier']); + $ShowTender = 1; +} + +if (isset($_GET['DeleteItem'])) { + $_SESSION['tender'.$identifier]->remove_item_from_tender($_GET['DeleteItem']); + $ShowTender = 1; +} + +if (isset($_POST['SelectedSupplier'])) { + $sql = "SELECT suppname, + email + FROM suppliers + WHERE supplierid='" . $_POST['SelectedSupplier'] . "'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + if (mb_strlen($myrow['email'])>0) { + $_SESSION['tender'.$identifier]->add_supplier_to_tender($_POST['SelectedSupplier'], + $myrow['suppname'], + $myrow['email']); + } else { + prnMsg( _('The supplier must have an email set up or they cannot be part of a tender'), 'warn'); + } + $ShowTender = 1; +} + +if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) { + foreach ($_POST as $key => $value) { + if (mb_substr($key,0,7)=='StockID') { + $Index = mb_substr($key,7,mb_strlen($key)-7); + $StockID = $value; + $Quantity = filter_number_format($_POST['Qty'.$Index]); + $UOM = $_POST['UOM'.$Index]; + $sql="SELECT description, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, + $StockID, + $Quantity, + $myrow['description'], + $UOM, + $myrow['decimalplaces'], + DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); + unset($UOM); + } + } + $ShowTender = 1; +} + +if (!isset($_SESSION['tender'.$identifier]) + or isset($_POST['LookupDeliveryAddress']) + or $ShowTender==1) { + + /* Show Tender header screen */ + if (!isset($_SESSION['tender'.$identifier])) { + $_SESSION['tender'.$identifier]=new Tender(); + } + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class="selection">'; + echo '<tr> + <th colspan="4"><h3>' . _('Tender header details') . '</h3></th> + </tr>'; + echo '<tr> + <td>' . _('Delivery Must Be Made Before') . '</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="RequiredByDate" size="11" value="' . date($_SESSION['DefaultDateFormat']) . '" /></td> + </tr>'; + + if (!isset($_POST['StkLocation']) or $_POST['StkLocation']==''){ + /* If this is the first time + * the form loaded set up defaults */ + + $_POST['StkLocation'] = $_SESSION['UserStockLocation']; + + $sql = "SELECT deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode='" . $_POST['StkLocation'] . "'"; + + $LocnAddrResult = DB_query($sql,$db); + if (DB_num_rows($LocnAddrResult)==1){ + $LocnRow = DB_fetch_array($LocnAddrResult); + $_POST['DelAdd1'] = $LocnRow['deladd1']; + $_POST['DelAdd2'] = $LocnRow['deladd2']; + $_POST['DelAdd3'] = $LocnRow['deladd3']; + $_POST['DelAdd4'] = $LocnRow['deladd4']; + $_POST['DelAdd5'] = $LocnRow['deladd5']; + $_POST['DelAdd6'] = $LocnRow['deladd6']; + $_POST['Tel'] = $LocnRow['tel']; + $_POST['Contact'] = $LocnRow['contact']; + + $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; + $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; + $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; + + } else { + /*The default location of the user is crook */ + prnMsg(_('The default stock location set up for this user is not a currently defined stock location') . + '. ' . _('Your system administrator needs to amend your user record'),'error'); + } + + + } elseif (isset($_POST['LookupDeliveryAddress'])){ + + $sql = "SELECT deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + WHERE loccode='" . $_POST['StkLocation'] . "'"; + + $LocnAddrResult = DB_query($sql,$db); + if (DB_num_rows($LocnAddrResult)==1){ + $LocnRow = DB_fetch_array($LocnAddrResult); + $_POST['DelAdd1'] = $LocnRow['deladd1']; + $_POST['DelAdd2'] = $LocnRow['deladd2']; + $_POST['DelAdd3'] = $LocnRow['deladd3']; + $_POST['DelAdd4'] = $LocnRow['deladd4']; + $_POST['DelAdd5'] = $LocnRow['deladd5']; + $_POST['DelAdd6'] = $LocnRow['deladd6']; + $_POST['Tel'] = $LocnRow['tel']; + $_POST['Contact'] = $LocnRow['contact']; + + $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; + $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; + $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; + } + } + echo '<tr> + <td>' . _('Warehouse') . ':</td> + <td><select name="StkLocation" onchange="ReloadForm(form1.LookupDeliveryAddress)">'; + + $sql = "SELECT loccode, + locationname + FROM locations"; + $LocnResult = DB_query($sql,$db); + + while ($LocnRow=DB_fetch_array($LocnResult)){ + if ((isset($_SESSION['tender'.$identifier]->Location) and $_SESSION['tender'.$identifier]->Location == $LocnRow['loccode'])){ + echo '<option selected="selected" value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; + } else { + echo '<option value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; + } + } + + echo '</select> + <input type="submit" name="LookupDeliveryAddress" value="' ._('Select') . '" /></td> + </tr>'; + + /* Display the details of the delivery location + */ + echo '<tr> + <td>' . _('Delivery Contact') . ':</td> + <td><input type="text" name="Contact" size="41" value="' . $_SESSION['tender'.$identifier]->Contact . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 1 :</td> + <td><input type="text" name="DelAdd1" size="41" maxlength="40" value="' . $_POST['DelAdd1'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 2 :</td> + <td><input type="text" name="DelAdd2" size="41" maxlength="40" value="' . $_POST['DelAdd2'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 3 :</td> + <td><input type="text" name="DelAdd3" size="41" maxlength="40" value="' . $_POST['DelAdd3'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 4 :</td> + <td><input type="text" name="DelAdd4" size="21" maxlength="20" value="' . $_POST['DelAdd4'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 5 :</td> + <td><input type="text" name="DelAdd5" size="16" maxlength="15" value="' . $_POST['DelAdd5'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Address') . ' 6 :</td> + <td><input type="text" name="DelAdd6" size="16" maxlength="15" value="' . $_POST['DelAdd6'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Phone') . ':</td> + <td><input type="text" name="Tel" size="31" maxlength="30" value="' . $_SESSION['tender'.$identifier]->Telephone . '" /></td> + </tr>'; + echo '</table><br />'; + + /* Display the supplier/item details + */ + echo '<table>'; + + /* Supplier Details + */ + echo '<tr> + <td valign="top"> + <table class="selection">'; + echo '<tr> + <th colspan="4"><h3>' . _('Suppliers To Send Tender') . '</h3></th> + </tr>'; + echo '<tr> + <th>'. _('Supplier Code') . '</th> + <th>' ._('Supplier Name') . '</th> + <th>' ._('Email Address') . '</th> + </tr>'; + foreach ($_SESSION['tender'.$identifier]->Suppliers as $Supplier) { + echo '<tr> + <td>' . $Supplier->SupplierCode . '</td> + <td>' . $Supplier->SupplierName . '</td> + <td>' . $Supplier->EmailAddress . '</td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '&DeleteSupplier=' . $Supplier->SupplierCode . '">' . _('Delete') . '</a></td> + </tr>'; + } + echo '</table></td>'; + /* Item Details + */ + echo '<td valign="top"><table class="selection">'; + echo '<tr><th colspan="6"><h3>' . _('Items in Tender') . '</h3></th></tr>'; + echo '<tr> + <th>'._('Stock ID').'</th> + <th>'._('Description').'</th> + <th>'._('Quantity').'</th> + <th>'._('UOM').'</th> + </tr>'; + $k=0; + foreach ($_SESSION['tender'.$identifier]->LineItems as $LineItems) { + if ($LineItems->Deleted==False) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + echo '<td>'.$LineItems->StockID.'</td> + <td>'.$LineItems->ItemDescription.'</td> + <td class="number">' . locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces).'</td> + <td>'.$LineItems->Units.'</td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier,ENT_QUOTES,'UTF-8') . '&DeleteItem=' . $LineItems->LineNo . '">' . _('Delete') . '</a></td> + </tr>'; + } + } + echo '</table></td></tr></table><br />'; + + echo '<div class="centre"> + <input type="submit" name="Suppliers" value="' . _('Select Suppliers') . '" /> + <input type="submit" name="Items" value="' . _('Select Item Details') . '" /> + </div> + <br />'; + if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 + and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { + + echo '<div class="centre"> + <input type="submit" name="Save" value="' . _('Save Tender') . '" /> + </div>'; + } + echo '</div> + </form>'; + include('includes/footer.inc'); + exit; +} + +if (isset($_POST['SearchSupplier']) or isset($_POST['Go']) + or isset($_POST['Next']) or isset($_POST['Previous'])) { + + if (mb_strlen($_POST['Keywords']) > 0 and mb_strlen($_POST['SupplierCode']) > 0) { + prnMsg( '<br />' . _('Supplier name keywords have been used in preference to the Supplier code extract entered'), 'info' ); + } + if ($_POST['Keywords'] == '' and $_POST['SupplierCode'] == '') { + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + ORDER BY suppname"; + } else { + if (mb_strlen($_POST['Keywords']) > 0) { + $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE suppname " . LIKE . " '$SearchString' + ORDER BY suppname"; + } elseif (mb_strlen($_POST['SupplierCode']) > 0) { + $_POST['SupplierCode'] = mb_strtoupper($_POST['SupplierCode']); + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%' + ORDER BY supplierid"; + } + } //one of keywords or SupplierCode was more than a zero length string + $result = DB_query($SQL, $db); + if (DB_num_rows($result) == 1) { + $myrow = DB_fetch_array($result); + $SingleSupplierReturned = $myrow['supplierid']; + } +} //end of if search +if (isset($SingleSupplierReturned)) { /*there was only one supplier returned */ + $_SESSION['SupplierID'] = $SingleSupplierReturned; + unset($_POST['Keywords']); + unset($_POST['SupplierCode']); +} + +if (!isset($_POST['PageOffset'])) { + $_POST['PageOffset'] = 1; +} else { + if ($_POST['PageOffset'] == 0) { + $_POST['PageOffset'] = 1; + } +} + +if (isset($_POST['Suppliers'])) { + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Suppliers') . '</p> + <table cellpadding="3" class="selection"> + <tr> + <td>' . _('Enter a partial Name') . ':</td> + <td>'; + if (isset($_POST['Keywords'])) { + echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />'; + } else { + echo '<input type="text" name="Keywords" size="20" maxlength="25" />'; + } + echo '</td><td><b>' . _('OR') . '</b></td><td>' . _('Enter a partial Code') . ':</td><td>'; + if (isset($_POST['SupplierCode'])) { + echo '<input type="text" name="SupplierCode" value="' . $_POST['SupplierCode'] . '" size="15" maxlength="18" />'; + } else { + echo '<input type="text" name="SupplierCode" size="15" maxlength="18" />'; + } + echo '</td></tr></table><br /><div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Search Now') . '" /></div>'; + echo '</div> + </form>'; +} + +if (isset($_POST['SearchSupplier'])) { + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'].'?identifier='.$identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + $ListCount = DB_num_rows($result); + $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); + if (isset($_POST['Next'])) { + if ($_POST['PageOffset'] < $ListPageMax) { + $_POST['PageOffset'] = $_POST['PageOffset'] + 1; + } + } + if (isset($_POST['Previous'])) { + if ($_POST['PageOffset'] > 1) {... [truncated message content] |
From: <dai...@us...> - 2012-04-29 03:46:05
|
Revision: 5294 http://web-erp.svn.sourceforge.net/web-erp/?rev=5294&view=rev Author: daintree Date: 2012-04-29 03:45:59 +0000 (Sun, 29 Apr 2012) Log Message: ----------- David Shorts EDI work Modified Paths: -------------- trunk/Labels.php trunk/PDFPrintLabel.php trunk/doc/Change.log trunk/includes/PDFStarter.php Added Paths: ----------- trunk/EDISendInvoices_Reece.php Added: trunk/EDISendInvoices_Reece.php =================================================================== --- trunk/EDISendInvoices_Reece.php (rev 0) +++ trunk/EDISendInvoices_Reece.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -0,0 +1,359 @@ +<?php + +/* $Revision: 1.9 $ */ + +$PageSecurity =15; + +include ('includes/session.inc'); +include ('includes/header.inc'); +include('includes/SQL_CommonFunctions.inc'); //need for EDITransNo +include('includes/htmlMimeMail.php'); // need for sending email attachments + +//Important: Default value for EDIsent in debtortrans should probably be 1 for non EDI customers +//updated to 0 only for EDI enabled customers. As it stands run some sql to update all existing +//transactions to EDISent = 1 for newly enabled EDI customers. If you don't do this and try to run +//this code you will create a very large number of EDI invoices. + +/*Get the Customers who are enabled for EDI invoicing */ +$sql = 'SELECT debtorno, + edireference, + editransport, + ediaddress, + ediserveruser, + ediserverpwd, + daysbeforedue, + dayinfollowingmonth + FROM debtorsmaster INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator + WHERE ediinvoices=1'; + +$EDIInvCusts = DB_query($sql,$db); + +if (DB_num_rows($EDIInvCusts)==0){ + exit; +} + +while ($CustDetails = DB_fetch_array($EDIInvCusts)){ + + /*Figure out if there are any unset invoices or credits for the customer */ + + $sql = "SELECT debtortrans.id, + transno, + type, + order_, + trandate, + ovgst, + ovamount, + ovfreight, + ovdiscount, + debtortrans.branchcode, + custbranchcode, + invtext, + shipvia, + rate, + brname, + braddress1, + braddress2, + braddress3, + braddress4, + braddress5 + FROM debtortrans INNER JOIN custbranch ON custbranch.debtorno = debtortrans.debtorno + AND custbranch.branchcode = debtortrans.branchcode + WHERE (type=10 or type=11) + AND edisent=0 + AND debtortrans.debtorno='" . $CustDetails['debtorno'] . "'"; + + $ErrMsg = _('There was a problem retrieving the customer transactions because'); + $TransHeaders = DB_query($sql,$db,$ErrMsg); + + + if (DB_num_rows($TransHeaders)==0){ + break; /*move on to the next EDI customer */ + } + + /*Setup the variable from the DebtorsMaster required for the message */ + $CompanyEDIReference = '0' . strval($_SESSION['EDIReference']); //very annoying, but had to add leading 0 + //because our GLN had leading 0 and GetConfig.php looks for numbers and text fields, saw GLN as number and skipped 0 + $CustEDIReference = $CustDetails['edireference']; + $TaxAuthorityRef = $_SESSION['CompanyRecord']['gstno']; + + while ($TransDetails = DB_fetch_array($TransHeaders)){ + +/*Set up the variables that will be needed in construction of the EDI message */ + if ($TransDetails['type']==10){ /* its an invoice */ + $InvOrCrd = 388; + } else { /* its a credit note */ + $InvOrCrd = 381; + } + $TransNo = $TransDetails['transno']; + /*Always an original in this script since only non-sent transactions being processed */ + $OrigOrDup = 9; + //$TranDate = SQLDateToEDI($TransDetails['trandate']); + $TranDate = date('Ymd'); //probably should use the date edi was created not the date filed in our system + $TranDateTime = date('Ymd:hi'); + $OrderNo = $TransDetails['order_']; + $CustBranchCode = $TransDetails['branchcode']; + $BranchName = $TransDetails['brname']; + $BranchStreet =$TransDetails['braddress1']; + $BranchSuburb = $TransDetails['braddress2']; + $BranchState = $TransDetails['braddress3']; + $BranchZip = $TransDetails['braddress4']; + $BranchCountry = $TransDetails['braddress5']; + $ExchRate = $TransDetails['rate']; + $TaxTotal = number_format($TransDetails['ovgst'],2, '.', ''); + $ShipToFreight = number_format(round($TransDetails['ovfreight'],2),2, '.', ''); + $SegCount = 1; + + + $DatePaymentDue = ConvertToEDIDate(CalcDueDate(ConvertSQLDate($TransDetails['trandate']),$CustDetails['dayinfollowingmonth'], $CustDetails['daysbeforedue'])); + + $TotalAmountExclTax = number_format(($TransDetails['ovamount']+ $TransDetails['ovfreight'] + $TransDetails['ovdiscount']),2, '.', ''); + $TotalAmountInclTax = number_format(($TransDetails['ovamount']+ $TransDetails['ovfreight'] + $TransDetails['ovdiscount'] + $TransDetails['ovgst']),2, '.', ''); + + //**************Need to get delivery address as may be diff from branch address + + $sql = "SELECT deliverto, + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + salesorders.customerref + FROM debtortrans INNER JOIN salesorders ON debtortrans.order_ = salesorders.orderno + WHERE order_ = '" . $OrderNo . "'"; + + $ErrMsg = _('There was a problem retrieving the ship to details because'); + $ShipToLines = DB_query($sql,$db,$ErrMsg); + + While ($ShipTo = DB_fetch_array($ShipToLines)){ + $ShipToName = $ShipTo[0]; + $ShipToStreet = $ShipTo[1]; + $ShipToSuburb = $ShipTo[2]; + $ShipToState = $ShipTo[3]; + $ShipToZip = $ShipTo[4]; + $ShipToCountry = $ShipTo[5]; + $CustOrderNo = $ShipTo[7]; + + } + + //**************Need to get delivery address as may be diff from branch address + + //**************Reece needs NAD ST in every invoice, sometimes freeform text, so no real code + + if($ShipToName === $BranchName){ + $ShipToCode = $CustBranchCode; + } Else { + $ShipToCode = $ShipToName; + } + + //**************Reece needs NAD ST in every invoice, sometimes freeform text, so no real code + + //**************Taxrate, need to find + + $sql = "SELECT stockmovestaxes.taxrate + FROM stockmoves, + stockmovestaxes + WHERE stockmoves.stkmoveno = stockmovestaxes.stkmoveno + AND stockmoves.transno=" . $TransNo . " + AND stockmoves.show_on_inv_crds=1 + LIMIT 0,1"; + + $ResultTax = DB_query($sql,$db); + + $TaxRate = 100 * (mysql_result($ResultTax, 0)); + + //**************Taxrate, need to find + + //**************Check to see if freight was added, probably specific to Reece and some other OZ hardware stores + + if($ShipToFreight > 0){ + $FreightTax = number_format(round(($ShipToFreight * $TaxRate/100),2),2, '.', ''); + $Freight_YN = "ALC+C" . "'" . "MOA+64:" .$ShipToFreight. "'" . "TAX+7+GST+++:::" .$TaxRate. "'". "MOA+124:" .$FreightTax."'"; + $SegCount = $SegCount + 3; + } else { + $Freight_YN = ""; + } + + //**************Check to see if freight was added could do this in Substitution, skip if 0 freight + + + + //Get the message lines, replace variable names with data, write the output to a file one line at a time + + $sql = "SELECT section, linetext FROM edimessageformat WHERE partnercode='" . $CustDetails['debtorno'] . "' AND messagetype='INVOIC' ORDER BY sequenceno"; + $ErrMsg = _('An error occurred in getting the EDI format template for') . ' ' . $CustDetails['debtorno'] . ' ' . _('because'); + $MessageLinesResult = DB_query($sql, $db,$ErrMsg); + + + if (DB_num_rows($MessageLinesResult)>0){ + + + $DetailLines = array(); + $ArrayCounter =0; + While ($MessageLine = DB_fetch_array($MessageLinesResult)){ + if ($MessageLine['section']=='Detail'){ + $DetailLines[$ArrayCounter]=$MessageLine['linetext']; + $ArrayCounter++; + } + } + DB_data_seek($MessageLinesResult,0); + + $EDITransNo = GetNextTransNo(99,$db); + $fp = fopen('EDI_INV_' . $TransNo . '.txt', 'w'); + + while ($LineDetails = DB_fetch_array($MessageLinesResult)){ + + if ($LineDetails['section']=='Heading'){ + $MsgLineText = $LineDetails['linetext']; + include ('includes/EDIVariableSubstitution.inc'); + $LastLine ='Heading'; + } + + if ($LineDetails['section']=='Detail' AND $LastLine=='Heading') { + /*This must be the detail section + need to get the line details for the invoice or credit note + for creating the detail lines */ + + + if ($TransDetails['type']==10){ /*its an invoice */ + $sql = "SELECT stockmoves.stockid, + stockmaster.description, + -stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=10 + AND stockmoves.transno=" . $TransNo . " + AND stockmoves.show_on_inv_crds=1"; + + } else { + /* credit note */ + $sql = "SELECT stockmoves.stockid, + stockmaster.description, + stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) as fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=11 and stockmoves.transno=" . $TransNo . " + AND stockmoves.show_on_inv_crds=1"; + } + $TransLinesResult = DB_query($sql,$db); + + $LineNumber = 0; + while ($TransLines = DB_fetch_array($TransLinesResult)){ + /*now set up the variable values */ + + $LineNumber++; + $StockID = $TransLines['stockid']; + $sql = "SELECT partnerstockid + FROM ediitemmapping + WHERE supporcust='CUST' + AND partnercode ='" . $CustDetails['debtorno'] . "' + AND stockid='" . $TransLines['stockid'] . "'"; + + $CustStkResult = DB_query($sql,$db); + if (DB_num_rows($CustStkResult)==1){ + $CustStkIDRow = DB_fetch_row($CustStkResult); + $CustStockID = $CustStkIDRow[0]; + } else { + $CustStockID = 'Not_Known'; + } + $ItemDescription = $TransLines['description']; + $QtyInvoiced = $TransLines['quantity']; + $LineTotalExclTax = number_format(round($TransLines['fxnet'],3),2, '.', ''); + $UnitPriceExclTax = number_format(round( $TransLines['fxnet'] / $TransLines['quantity'], 3),2, '.', ''); + $LineTaxAmount = number_format(round($TaxRate/100 * $TransLines['fxnet'],3),2, '.', ''); + $LineTotalInclTax = number_format(round((1+$TaxRate/100) * $LineTotalExclTax,3),2, '.', ''); + $UnitPriceInclTax = number_format(round((1+$TaxRate/100) * $UnitPriceExclTax,2),2, '.', ''); + + /*now work through the detail line segments */ + foreach ($DetailLines as $DetailLineText) { + $MsgLineText = $DetailLineText; + include ('includes/EDIVariableSubstitution.inc'); + } + + + } + + + $LastLine ='Detail'; + $NoLines = $LineNumber; + } + + if($LineDetails['section']=='Summary' AND $LastLine=='Detail'){ + $MsgLineText = $LineDetails['linetext']; + include ('includes/EDIVariableSubstitution.inc'); + } + } /*end while there are message lines to parse and substitute vbles for */ + fclose($fp); /*close the file at the end of each transaction */ + DB_query("UPDATE debtortrans SET EDISent=1 WHERE ID=" . $TransDetails['id'],$db); + /*Now send the file using the customer transport */ + if ($CustDetails['editransport']=='email'){ + + $mail = new htmlMimeMail(); + $attachment = $mail->getFile( "EDI_INV_" . $TransNo .".txt"); + $mail->SetSubject('EDI Invoice/Credit Note ' . $TransNo); + $mail->addAttachment($attachment, 'EDI_INV_' . $TransNo . '.txt', 'application/txt'); + $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>'); + $MessageSent = $mail->send(array($CustDetails['ediaddress'])); + + if ($MessageSent==True){ + echo '<BR><BR>'; + prnMsg(_('EDI Message') . ' ' . $TransNo . ' ' . _('was sucessfully emailed'),'success'); + } else { + echo '<BR><BR>'; + prnMsg(_('EDI Message') . ' ' . $TransNo . _('could not be emailed to') . ' ' . $CustDetails['ediaddress'],'error'); + } + } else { /*it must be ftp transport */ + + //Godaddy limitations make it impossible to sftp using ssl or curl, so save to EDI_Sent file and 'rsynch' back to sftp server + + /* set up basic connection + $conn_id = ftp_connect($CustDetails['ediaddress']); // login with username and password + $login_result = ftp_login($conn_id, $CustDetails['ediserveruser'], $CustDetails['ediserverpwd']); // check connection + if ((!$conn_id) || (!$login_result)) { + prnMsg( _('Ftp connection has failed'). '<BR>' . _('Attempted to connect to') . ' ' . $CustDetails['ediaddress'] . ' ' ._('for user') . ' ' . $CustDetails['ediserveruser'],'error'); + include('includes/footer.inc'); + exit; + } + $MessageSent = ftp_put($conn_id, $_SESSION['EDI_MsgPending'] . '/EDI_INV_' . $EDITransNo, 'EDI_INV_' . $EDITransNo, FTP_ASCII); // check upload status + if (!$MessageSent) { + echo '<BR><BR>'; + prnMsg(_('EDI Message') . ' ' . $EDITransNo . ' ' . _('could not be sent via ftp to') .' ' . $CustDetails['ediaddress'],'error'); + } else { + echo '<BR><BR>'; + prnMsg( _('Successfully uploaded EDI_INV_') . $EDITransNo . ' ' . _('via ftp to') . ' ' . $CustDetails['ediaddress'],'success'); + } // close the FTP stream + ftp_quit($conn_id); + */ + } + + + if ($MessageSent==True){ /*the email was sent sucessfully */ + /* move the sent file to sent directory */ + $source = 'EDI_INV_' . $TransNo . '.txt'; + $destination = 'EDI_Sent/EDI_INV_' . $TransNo . '.txt'; + rename($source, $destination); + + } + + } else { + + prnMsg( _('Cannot create EDI message since there is no EDI INVOIC message template set up for') . ' ' . $CustDetails['debtorno'],'error'); + } /*End if there is a message template defined for the customer invoic*/ + + + } /* loop around all the customer transactions to be sent */ + +} /*loop around all the customers enabled for EDI Invoices */ + +include ('includes/footer.inc'); +?> Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/Labels.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -16,7 +16,8 @@ 'Letter', 'Letter_Landscape', 'Legal', - 'Legal_Landscape'); + 'Legal_Landscape', + '28mm_x_45mm_label'); echo '<p class="page_title_text"> @@ -414,9 +415,10 @@ } //END WHILE LIST LOOP $i--; //last increment needs to be wound back - echo '<input type="hidden" name="NoOfFieldsDefined" value="' . $i . '" />'; + } //end if there are label definitions to show - + echo '<input type="hidden" name="NoOfFieldsDefined" value="' . $i . '" />'; + echo '<tr> <td><select name="FieldName"> <option value="itemcode">' . _('Item Code') . '</option> Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/PDFPrintLabel.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -3,7 +3,7 @@ include('includes/session.inc'); -$PtsPerMM = 2.83465; //pdf millimetres to points +$PtsPerMM = 2.83465; //pdf points per mm if (isset($_POST['ShowLabels']) @@ -163,25 +163,26 @@ for ($i=0;$i <= $_POST['NoOfLabels'];$i++){ if ($_POST['PrintLabel'.$i]=='on'){ - if ($Field['FieldValue']== 'price'){ - $Value = $_POST['Price' . $i]; - } elseif ($Field['FieldValue']== 'stockid'){ - $Value = $_POST['StockID' . $i]; - } elseif ($Field['FieldValue']== 'description'){ - $Value = $_POST['Description' . $i]; - } elseif ($Field['FieldValue']== 'barcode'){ - $Value = $_POST['Barcode' . $i]; - } foreach ($LabelFields as $Field){ - + //print_r($Field); + + if ($Field['FieldValue']== 'price'){ + $Value = $_POST['Price' . $i]; + } elseif ($Field['FieldValue']== 'stockid'){ + $Value = $_POST['StockID' . $i]; + } elseif ($Field['FieldValue']== 'description'){ + $Value = $_POST['Description' . $i]; + } elseif ($Field['FieldValue']== 'barcode'){ + $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) { - + /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') * 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'); } else { $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos']-20,$Field['FontSize'],$Value); @@ -213,7 +214,7 @@ } //this label is set to print } //loop through labels selected to print - + $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; ob_clean(); $pdf->OutputD($FileName); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/doc/Change.log 2012-04-29 03:45:59 UTC (rev 5294) @@ -1,4 +1,5 @@ webERP Change Log +29/4/12 David Short: Added EDISendInvoices_Reece.php to send Reece format EDI invoices - approved by Reece (Australian Plumbing retailer) 28/4/2012 Exson: Fixed bugs in MRPCalendar.php which caused working days cannot be calculated correctly. 06/4/2012 Exson: Fixed PO header that does not display user's default warehous when iusse a new PO in PO_Header.php. 25/4/12 Phil: Complete rewrite of PDFPrintLabels.php and Labels.php in webERP style - half the code and maintainable with templates stored with all the other data in the database. The new labels also allow fields to be printed as barcodes too. Modified: trunk/includes/PDFStarter.php =================================================================== --- trunk/includes/PDFStarter.php 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/includes/PDFStarter.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -128,7 +128,8 @@ case 'legal': - $DocumentPaper = 'LEGAL'; $DocumentOrientation ='P'; + $DocumentPaper = 'LEGAL'; + $DocumentOrientation ='P'; $Page_Width=612; $Page_Height=1008; @@ -140,7 +141,8 @@ case 'legal_landscape': - $DocumentPaper = 'LEGAL'; $DocumentOrientation ='L'; + $DocumentPaper = 'LEGAL'; + $DocumentOrientation ='L'; $Page_Width=1008; $Page_Height=612; @@ -149,6 +151,19 @@ $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; } // Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-29 03:46:06
|
Revision: 5294 http://web-erp.svn.sourceforge.net/web-erp/?rev=5294&view=rev Author: daintree Date: 2012-04-29 03:45:59 +0000 (Sun, 29 Apr 2012) Log Message: ----------- David Shorts EDI work Modified Paths: -------------- trunk/Labels.php trunk/PDFPrintLabel.php trunk/doc/Change.log trunk/includes/PDFStarter.php Added Paths: ----------- trunk/EDISendInvoices_Reece.php Added: trunk/EDISendInvoices_Reece.php =================================================================== --- trunk/EDISendInvoices_Reece.php (rev 0) +++ trunk/EDISendInvoices_Reece.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -0,0 +1,359 @@ +<?php + +/* $Revision: 1.9 $ */ + +$PageSecurity =15; + +include ('includes/session.inc'); +include ('includes/header.inc'); +include('includes/SQL_CommonFunctions.inc'); //need for EDITransNo +include('includes/htmlMimeMail.php'); // need for sending email attachments + +//Important: Default value for EDIsent in debtortrans should probably be 1 for non EDI customers +//updated to 0 only for EDI enabled customers. As it stands run some sql to update all existing +//transactions to EDISent = 1 for newly enabled EDI customers. If you don't do this and try to run +//this code you will create a very large number of EDI invoices. + +/*Get the Customers who are enabled for EDI invoicing */ +$sql = 'SELECT debtorno, + edireference, + editransport, + ediaddress, + ediserveruser, + ediserverpwd, + daysbeforedue, + dayinfollowingmonth + FROM debtorsmaster INNER JOIN paymentterms ON debtorsmaster.paymentterms=paymentterms.termsindicator + WHERE ediinvoices=1'; + +$EDIInvCusts = DB_query($sql,$db); + +if (DB_num_rows($EDIInvCusts)==0){ + exit; +} + +while ($CustDetails = DB_fetch_array($EDIInvCusts)){ + + /*Figure out if there are any unset invoices or credits for the customer */ + + $sql = "SELECT debtortrans.id, + transno, + type, + order_, + trandate, + ovgst, + ovamount, + ovfreight, + ovdiscount, + debtortrans.branchcode, + custbranchcode, + invtext, + shipvia, + rate, + brname, + braddress1, + braddress2, + braddress3, + braddress4, + braddress5 + FROM debtortrans INNER JOIN custbranch ON custbranch.debtorno = debtortrans.debtorno + AND custbranch.branchcode = debtortrans.branchcode + WHERE (type=10 or type=11) + AND edisent=0 + AND debtortrans.debtorno='" . $CustDetails['debtorno'] . "'"; + + $ErrMsg = _('There was a problem retrieving the customer transactions because'); + $TransHeaders = DB_query($sql,$db,$ErrMsg); + + + if (DB_num_rows($TransHeaders)==0){ + break; /*move on to the next EDI customer */ + } + + /*Setup the variable from the DebtorsMaster required for the message */ + $CompanyEDIReference = '0' . strval($_SESSION['EDIReference']); //very annoying, but had to add leading 0 + //because our GLN had leading 0 and GetConfig.php looks for numbers and text fields, saw GLN as number and skipped 0 + $CustEDIReference = $CustDetails['edireference']; + $TaxAuthorityRef = $_SESSION['CompanyRecord']['gstno']; + + while ($TransDetails = DB_fetch_array($TransHeaders)){ + +/*Set up the variables that will be needed in construction of the EDI message */ + if ($TransDetails['type']==10){ /* its an invoice */ + $InvOrCrd = 388; + } else { /* its a credit note */ + $InvOrCrd = 381; + } + $TransNo = $TransDetails['transno']; + /*Always an original in this script since only non-sent transactions being processed */ + $OrigOrDup = 9; + //$TranDate = SQLDateToEDI($TransDetails['trandate']); + $TranDate = date('Ymd'); //probably should use the date edi was created not the date filed in our system + $TranDateTime = date('Ymd:hi'); + $OrderNo = $TransDetails['order_']; + $CustBranchCode = $TransDetails['branchcode']; + $BranchName = $TransDetails['brname']; + $BranchStreet =$TransDetails['braddress1']; + $BranchSuburb = $TransDetails['braddress2']; + $BranchState = $TransDetails['braddress3']; + $BranchZip = $TransDetails['braddress4']; + $BranchCountry = $TransDetails['braddress5']; + $ExchRate = $TransDetails['rate']; + $TaxTotal = number_format($TransDetails['ovgst'],2, '.', ''); + $ShipToFreight = number_format(round($TransDetails['ovfreight'],2),2, '.', ''); + $SegCount = 1; + + + $DatePaymentDue = ConvertToEDIDate(CalcDueDate(ConvertSQLDate($TransDetails['trandate']),$CustDetails['dayinfollowingmonth'], $CustDetails['daysbeforedue'])); + + $TotalAmountExclTax = number_format(($TransDetails['ovamount']+ $TransDetails['ovfreight'] + $TransDetails['ovdiscount']),2, '.', ''); + $TotalAmountInclTax = number_format(($TransDetails['ovamount']+ $TransDetails['ovfreight'] + $TransDetails['ovdiscount'] + $TransDetails['ovgst']),2, '.', ''); + + //**************Need to get delivery address as may be diff from branch address + + $sql = "SELECT deliverto, + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + salesorders.customerref + FROM debtortrans INNER JOIN salesorders ON debtortrans.order_ = salesorders.orderno + WHERE order_ = '" . $OrderNo . "'"; + + $ErrMsg = _('There was a problem retrieving the ship to details because'); + $ShipToLines = DB_query($sql,$db,$ErrMsg); + + While ($ShipTo = DB_fetch_array($ShipToLines)){ + $ShipToName = $ShipTo[0]; + $ShipToStreet = $ShipTo[1]; + $ShipToSuburb = $ShipTo[2]; + $ShipToState = $ShipTo[3]; + $ShipToZip = $ShipTo[4]; + $ShipToCountry = $ShipTo[5]; + $CustOrderNo = $ShipTo[7]; + + } + + //**************Need to get delivery address as may be diff from branch address + + //**************Reece needs NAD ST in every invoice, sometimes freeform text, so no real code + + if($ShipToName === $BranchName){ + $ShipToCode = $CustBranchCode; + } Else { + $ShipToCode = $ShipToName; + } + + //**************Reece needs NAD ST in every invoice, sometimes freeform text, so no real code + + //**************Taxrate, need to find + + $sql = "SELECT stockmovestaxes.taxrate + FROM stockmoves, + stockmovestaxes + WHERE stockmoves.stkmoveno = stockmovestaxes.stkmoveno + AND stockmoves.transno=" . $TransNo . " + AND stockmoves.show_on_inv_crds=1 + LIMIT 0,1"; + + $ResultTax = DB_query($sql,$db); + + $TaxRate = 100 * (mysql_result($ResultTax, 0)); + + //**************Taxrate, need to find + + //**************Check to see if freight was added, probably specific to Reece and some other OZ hardware stores + + if($ShipToFreight > 0){ + $FreightTax = number_format(round(($ShipToFreight * $TaxRate/100),2),2, '.', ''); + $Freight_YN = "ALC+C" . "'" . "MOA+64:" .$ShipToFreight. "'" . "TAX+7+GST+++:::" .$TaxRate. "'". "MOA+124:" .$FreightTax."'"; + $SegCount = $SegCount + 3; + } else { + $Freight_YN = ""; + } + + //**************Check to see if freight was added could do this in Substitution, skip if 0 freight + + + + //Get the message lines, replace variable names with data, write the output to a file one line at a time + + $sql = "SELECT section, linetext FROM edimessageformat WHERE partnercode='" . $CustDetails['debtorno'] . "' AND messagetype='INVOIC' ORDER BY sequenceno"; + $ErrMsg = _('An error occurred in getting the EDI format template for') . ' ' . $CustDetails['debtorno'] . ' ' . _('because'); + $MessageLinesResult = DB_query($sql, $db,$ErrMsg); + + + if (DB_num_rows($MessageLinesResult)>0){ + + + $DetailLines = array(); + $ArrayCounter =0; + While ($MessageLine = DB_fetch_array($MessageLinesResult)){ + if ($MessageLine['section']=='Detail'){ + $DetailLines[$ArrayCounter]=$MessageLine['linetext']; + $ArrayCounter++; + } + } + DB_data_seek($MessageLinesResult,0); + + $EDITransNo = GetNextTransNo(99,$db); + $fp = fopen('EDI_INV_' . $TransNo . '.txt', 'w'); + + while ($LineDetails = DB_fetch_array($MessageLinesResult)){ + + if ($LineDetails['section']=='Heading'){ + $MsgLineText = $LineDetails['linetext']; + include ('includes/EDIVariableSubstitution.inc'); + $LastLine ='Heading'; + } + + if ($LineDetails['section']=='Detail' AND $LastLine=='Heading') { + /*This must be the detail section + need to get the line details for the invoice or credit note + for creating the detail lines */ + + + if ($TransDetails['type']==10){ /*its an invoice */ + $sql = "SELECT stockmoves.stockid, + stockmaster.description, + -stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=10 + AND stockmoves.transno=" . $TransNo . " + AND stockmoves.show_on_inv_crds=1"; + + } else { + /* credit note */ + $sql = "SELECT stockmoves.stockid, + stockmaster.description, + stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) as fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=11 and stockmoves.transno=" . $TransNo . " + AND stockmoves.show_on_inv_crds=1"; + } + $TransLinesResult = DB_query($sql,$db); + + $LineNumber = 0; + while ($TransLines = DB_fetch_array($TransLinesResult)){ + /*now set up the variable values */ + + $LineNumber++; + $StockID = $TransLines['stockid']; + $sql = "SELECT partnerstockid + FROM ediitemmapping + WHERE supporcust='CUST' + AND partnercode ='" . $CustDetails['debtorno'] . "' + AND stockid='" . $TransLines['stockid'] . "'"; + + $CustStkResult = DB_query($sql,$db); + if (DB_num_rows($CustStkResult)==1){ + $CustStkIDRow = DB_fetch_row($CustStkResult); + $CustStockID = $CustStkIDRow[0]; + } else { + $CustStockID = 'Not_Known'; + } + $ItemDescription = $TransLines['description']; + $QtyInvoiced = $TransLines['quantity']; + $LineTotalExclTax = number_format(round($TransLines['fxnet'],3),2, '.', ''); + $UnitPriceExclTax = number_format(round( $TransLines['fxnet'] / $TransLines['quantity'], 3),2, '.', ''); + $LineTaxAmount = number_format(round($TaxRate/100 * $TransLines['fxnet'],3),2, '.', ''); + $LineTotalInclTax = number_format(round((1+$TaxRate/100) * $LineTotalExclTax,3),2, '.', ''); + $UnitPriceInclTax = number_format(round((1+$TaxRate/100) * $UnitPriceExclTax,2),2, '.', ''); + + /*now work through the detail line segments */ + foreach ($DetailLines as $DetailLineText) { + $MsgLineText = $DetailLineText; + include ('includes/EDIVariableSubstitution.inc'); + } + + + } + + + $LastLine ='Detail'; + $NoLines = $LineNumber; + } + + if($LineDetails['section']=='Summary' AND $LastLine=='Detail'){ + $MsgLineText = $LineDetails['linetext']; + include ('includes/EDIVariableSubstitution.inc'); + } + } /*end while there are message lines to parse and substitute vbles for */ + fclose($fp); /*close the file at the end of each transaction */ + DB_query("UPDATE debtortrans SET EDISent=1 WHERE ID=" . $TransDetails['id'],$db); + /*Now send the file using the customer transport */ + if ($CustDetails['editransport']=='email'){ + + $mail = new htmlMimeMail(); + $attachment = $mail->getFile( "EDI_INV_" . $TransNo .".txt"); + $mail->SetSubject('EDI Invoice/Credit Note ' . $TransNo); + $mail->addAttachment($attachment, 'EDI_INV_' . $TransNo . '.txt', 'application/txt'); + $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>'); + $MessageSent = $mail->send(array($CustDetails['ediaddress'])); + + if ($MessageSent==True){ + echo '<BR><BR>'; + prnMsg(_('EDI Message') . ' ' . $TransNo . ' ' . _('was sucessfully emailed'),'success'); + } else { + echo '<BR><BR>'; + prnMsg(_('EDI Message') . ' ' . $TransNo . _('could not be emailed to') . ' ' . $CustDetails['ediaddress'],'error'); + } + } else { /*it must be ftp transport */ + + //Godaddy limitations make it impossible to sftp using ssl or curl, so save to EDI_Sent file and 'rsynch' back to sftp server + + /* set up basic connection + $conn_id = ftp_connect($CustDetails['ediaddress']); // login with username and password + $login_result = ftp_login($conn_id, $CustDetails['ediserveruser'], $CustDetails['ediserverpwd']); // check connection + if ((!$conn_id) || (!$login_result)) { + prnMsg( _('Ftp connection has failed'). '<BR>' . _('Attempted to connect to') . ' ' . $CustDetails['ediaddress'] . ' ' ._('for user') . ' ' . $CustDetails['ediserveruser'],'error'); + include('includes/footer.inc'); + exit; + } + $MessageSent = ftp_put($conn_id, $_SESSION['EDI_MsgPending'] . '/EDI_INV_' . $EDITransNo, 'EDI_INV_' . $EDITransNo, FTP_ASCII); // check upload status + if (!$MessageSent) { + echo '<BR><BR>'; + prnMsg(_('EDI Message') . ' ' . $EDITransNo . ' ' . _('could not be sent via ftp to') .' ' . $CustDetails['ediaddress'],'error'); + } else { + echo '<BR><BR>'; + prnMsg( _('Successfully uploaded EDI_INV_') . $EDITransNo . ' ' . _('via ftp to') . ' ' . $CustDetails['ediaddress'],'success'); + } // close the FTP stream + ftp_quit($conn_id); + */ + } + + + if ($MessageSent==True){ /*the email was sent sucessfully */ + /* move the sent file to sent directory */ + $source = 'EDI_INV_' . $TransNo . '.txt'; + $destination = 'EDI_Sent/EDI_INV_' . $TransNo . '.txt'; + rename($source, $destination); + + } + + } else { + + prnMsg( _('Cannot create EDI message since there is no EDI INVOIC message template set up for') . ' ' . $CustDetails['debtorno'],'error'); + } /*End if there is a message template defined for the customer invoic*/ + + + } /* loop around all the customer transactions to be sent */ + +} /*loop around all the customers enabled for EDI Invoices */ + +include ('includes/footer.inc'); +?> Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/Labels.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -16,7 +16,8 @@ 'Letter', 'Letter_Landscape', 'Legal', - 'Legal_Landscape'); + 'Legal_Landscape', + '28mm_x_45mm_label'); echo '<p class="page_title_text"> @@ -414,9 +415,10 @@ } //END WHILE LIST LOOP $i--; //last increment needs to be wound back - echo '<input type="hidden" name="NoOfFieldsDefined" value="' . $i . '" />'; + } //end if there are label definitions to show - + echo '<input type="hidden" name="NoOfFieldsDefined" value="' . $i . '" />'; + echo '<tr> <td><select name="FieldName"> <option value="itemcode">' . _('Item Code') . '</option> Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/PDFPrintLabel.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -3,7 +3,7 @@ include('includes/session.inc'); -$PtsPerMM = 2.83465; //pdf millimetres to points +$PtsPerMM = 2.83465; //pdf points per mm if (isset($_POST['ShowLabels']) @@ -163,25 +163,26 @@ for ($i=0;$i <= $_POST['NoOfLabels'];$i++){ if ($_POST['PrintLabel'.$i]=='on'){ - if ($Field['FieldValue']== 'price'){ - $Value = $_POST['Price' . $i]; - } elseif ($Field['FieldValue']== 'stockid'){ - $Value = $_POST['StockID' . $i]; - } elseif ($Field['FieldValue']== 'description'){ - $Value = $_POST['Description' . $i]; - } elseif ($Field['FieldValue']== 'barcode'){ - $Value = $_POST['Barcode' . $i]; - } foreach ($LabelFields as $Field){ - + //print_r($Field); + + if ($Field['FieldValue']== 'price'){ + $Value = $_POST['Price' . $i]; + } elseif ($Field['FieldValue']== 'stockid'){ + $Value = $_POST['StockID' . $i]; + } elseif ($Field['FieldValue']== 'description'){ + $Value = $_POST['Description' . $i]; + } elseif ($Field['FieldValue']== 'barcode'){ + $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) { - + /* write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') * 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'); } else { $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos']-20,$Field['FontSize'],$Value); @@ -213,7 +214,7 @@ } //this label is set to print } //loop through labels selected to print - + $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; ob_clean(); $pdf->OutputD($FileName); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/doc/Change.log 2012-04-29 03:45:59 UTC (rev 5294) @@ -1,4 +1,5 @@ webERP Change Log +29/4/12 David Short: Added EDISendInvoices_Reece.php to send Reece format EDI invoices - approved by Reece (Australian Plumbing retailer) 28/4/2012 Exson: Fixed bugs in MRPCalendar.php which caused working days cannot be calculated correctly. 06/4/2012 Exson: Fixed PO header that does not display user's default warehous when iusse a new PO in PO_Header.php. 25/4/12 Phil: Complete rewrite of PDFPrintLabels.php and Labels.php in webERP style - half the code and maintainable with templates stored with all the other data in the database. The new labels also allow fields to be printed as barcodes too. Modified: trunk/includes/PDFStarter.php =================================================================== --- trunk/includes/PDFStarter.php 2012-04-28 19:41:43 UTC (rev 5293) +++ trunk/includes/PDFStarter.php 2012-04-29 03:45:59 UTC (rev 5294) @@ -128,7 +128,8 @@ case 'legal': - $DocumentPaper = 'LEGAL'; $DocumentOrientation ='P'; + $DocumentPaper = 'LEGAL'; + $DocumentOrientation ='P'; $Page_Width=612; $Page_Height=1008; @@ -140,7 +141,8 @@ case 'legal_landscape': - $DocumentPaper = 'LEGAL'; $DocumentOrientation ='L'; + $DocumentPaper = 'LEGAL'; + $DocumentOrientation ='L'; $Page_Width=1008; $Page_Height=612; @@ -149,6 +151,19 @@ $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; } // Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-29 04:21:13
|
Revision: 5295 http://web-erp.svn.sourceforge.net/web-erp/?rev=5295&view=rev Author: daintree Date: 2012-04-29 04:21:07 +0000 (Sun, 29 Apr 2012) Log Message: ----------- Klaus-optp changes Modified Paths: -------------- trunk/SelectWorkOrder.php trunk/doc/Change.log Modified: trunk/SelectWorkOrder.php =================================================================== --- trunk/SelectWorkOrder.php 2012-04-29 03:45:59 UTC (rev 5294) +++ trunk/SelectWorkOrder.php 2012-04-29 04:21:07 UTC (rev 5295) @@ -251,7 +251,8 @@ stockmaster.decimalplaces, woitems.qtyreqd, woitems.qtyrecd, - workorders.requiredby + workorders.requiredby, + workorders.startdate FROM workorders INNER JOIN woitems ON workorders.wo=woitems.wo INNER JOIN stockmaster ON woitems.stockid=stockmaster.stockid @@ -269,7 +270,8 @@ stockmaster.decimalplaces, woitems.qtyreqd, woitems.qtyrecd, - workorders.requiredby + workorders.requiredby, + workorders.startdate FROM workorders INNER JOIN woitems ON workorders.wo=woitems.wo INNER JOIN stockmaster ON woitems.stockid=stockmaster.stockid @@ -285,7 +287,8 @@ stockmaster.decimalplaces, woitems.qtyreqd, woitems.qtyrecd, - workorders.requiredby + workorders.requiredby, + workorders.startdate FROM workorders INNER JOIN woitems ON workorders.wo=woitems.wo INNER JOIN stockmaster ON woitems.stockid=stockmaster.stockid @@ -315,6 +318,7 @@ <th>' . _('Quantity Required') . '</th> <th>' . _('Quantity Received') . '</th> <th>' . _('Quantity Outstanding') . '</th> + <th>' . _('Start Date') . '</th> <th>' . _('Required Date') . '</th> </tr>'; @@ -339,6 +343,7 @@ $Costing_WO =$rootpath . '/WorkOrderCosting.php?WO=' .$myrow['wo']; $FormatedRequiredByDate = ConvertSQLDate($myrow['requiredby']); + $FormatedStartDate = ConvertSQLDate($myrow['startdate']); printf('<td><a href="%s">%s</a></td> @@ -351,6 +356,7 @@ <td class="number">%s</td> <td class="number">%s</td> <td>%s</td> + <td>%s</td> </tr>', $ModifyPage, $myrow['wo'], @@ -363,6 +369,7 @@ locale_number_format($myrow['qtyreqd'],$myrow['decimalplaces']), locale_number_format($myrow['qtyrecd'],$myrow['decimalplaces']), locale_number_format($myrow['qtyreqd']-$myrow['qtyrecd'],$myrow['decimalplaces']), + $FormatedStartDate, $FormatedRequiredByDate); $j++; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-29 03:45:59 UTC (rev 5294) +++ trunk/doc/Change.log 2012-04-29 04:21:07 UTC (rev 5295) @@ -1,4 +1,5 @@ webERP Change Log +29/4/12 Opto/Klaus: SelectWorkOrder.php added start date for the work order to the work orders displayed for selection 29/4/12 David Short: Added EDISendInvoices_Reece.php to send Reece format EDI invoices - approved by Reece (Australian Plumbing retailer) 28/4/2012 Exson: Fixed bugs in MRPCalendar.php which caused working days cannot be calculated correctly. 06/4/2012 Exson: Fixed PO header that does not display user's default warehous when iusse a new PO in PO_Header.php. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-04-29 04:21:14
|
Revision: 5295 http://web-erp.svn.sourceforge.net/web-erp/?rev=5295&view=rev Author: daintree Date: 2012-04-29 04:21:07 +0000 (Sun, 29 Apr 2012) Log Message: ----------- Klaus-optp changes Modified Paths: -------------- trunk/SelectWorkOrder.php trunk/doc/Change.log Modified: trunk/SelectWorkOrder.php =================================================================== --- trunk/SelectWorkOrder.php 2012-04-29 03:45:59 UTC (rev 5294) +++ trunk/SelectWorkOrder.php 2012-04-29 04:21:07 UTC (rev 5295) @@ -251,7 +251,8 @@ stockmaster.decimalplaces, woitems.qtyreqd, woitems.qtyrecd, - workorders.requiredby + workorders.requiredby, + workorders.startdate FROM workorders INNER JOIN woitems ON workorders.wo=woitems.wo INNER JOIN stockmaster ON woitems.stockid=stockmaster.stockid @@ -269,7 +270,8 @@ stockmaster.decimalplaces, woitems.qtyreqd, woitems.qtyrecd, - workorders.requiredby + workorders.requiredby, + workorders.startdate FROM workorders INNER JOIN woitems ON workorders.wo=woitems.wo INNER JOIN stockmaster ON woitems.stockid=stockmaster.stockid @@ -285,7 +287,8 @@ stockmaster.decimalplaces, woitems.qtyreqd, woitems.qtyrecd, - workorders.requiredby + workorders.requiredby, + workorders.startdate FROM workorders INNER JOIN woitems ON workorders.wo=woitems.wo INNER JOIN stockmaster ON woitems.stockid=stockmaster.stockid @@ -315,6 +318,7 @@ <th>' . _('Quantity Required') . '</th> <th>' . _('Quantity Received') . '</th> <th>' . _('Quantity Outstanding') . '</th> + <th>' . _('Start Date') . '</th> <th>' . _('Required Date') . '</th> </tr>'; @@ -339,6 +343,7 @@ $Costing_WO =$rootpath . '/WorkOrderCosting.php?WO=' .$myrow['wo']; $FormatedRequiredByDate = ConvertSQLDate($myrow['requiredby']); + $FormatedStartDate = ConvertSQLDate($myrow['startdate']); printf('<td><a href="%s">%s</a></td> @@ -351,6 +356,7 @@ <td class="number">%s</td> <td class="number">%s</td> <td>%s</td> + <td>%s</td> </tr>', $ModifyPage, $myrow['wo'], @@ -363,6 +369,7 @@ locale_number_format($myrow['qtyreqd'],$myrow['decimalplaces']), locale_number_format($myrow['qtyrecd'],$myrow['decimalplaces']), locale_number_format($myrow['qtyreqd']-$myrow['qtyrecd'],$myrow['decimalplaces']), + $FormatedStartDate, $FormatedRequiredByDate); $j++; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-04-29 03:45:59 UTC (rev 5294) +++ trunk/doc/Change.log 2012-04-29 04:21:07 UTC (rev 5295) @@ -1,4 +1,5 @@ webERP Change Log +29/4/12 Opto/Klaus: SelectWorkOrder.php added start date for the work order to the work orders displayed for selection 29/4/12 David Short: Added EDISendInvoices_Reece.php to send Reece format EDI invoices - approved by Reece (Australian Plumbing retailer) 28/4/2012 Exson: Fixed bugs in MRPCalendar.php which caused working days cannot be calculated correctly. 06/4/2012 Exson: Fixed PO header that does not display user's default warehous when iusse a new PO in PO_Header.php. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-04-29 15:28:27
|
Revision: 5296 http://web-erp.svn.sourceforge.net/web-erp/?rev=5296&view=rev Author: vvs2012 Date: 2012-04-29 15:28:19 +0000 (Sun, 29 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/Z_BottomUpCosts.php trunk/Z_ChangeBranchCode.php trunk/Z_ChangeCustomerCode.php trunk/Z_ChangeStockCategory.php trunk/Z_ChangeStockCode.php trunk/Z_CheckAllocs.php trunk/Z_CheckDebtorsControl.php trunk/Z_CreateCompanyTemplateFile.php trunk/Z_CurrencyDebtorsBalances.php trunk/Z_CurrencySuppliersBalances.php trunk/Z_DataExport.php trunk/Z_DeleteSalesTransActions.php trunk/Z_ImportChartOfAccounts.php trunk/Z_ImportFixedAssets.php trunk/Z_ImportGLAccountGroups.php trunk/Z_ImportGLAccountSections.php trunk/Z_ImportPartCodes.php trunk/Z_ImportStocks.php trunk/Z_MakeNewCompany.php trunk/Z_ReApplyCostToSA.php trunk/Z_RePostGLFromPeriod.php trunk/Z_ReverseSuppPaymentRun.php trunk/Z_SalesIntegrityCheck.php trunk/Z_UpdateChartDetailsBFwd.php trunk/Z_index.php trunk/install/index.php trunk/install/timezone.php Modified: trunk/Z_BottomUpCosts.php =================================================================== --- trunk/Z_BottomUpCosts.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_BottomUpCosts.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -50,7 +50,8 @@ <br />'; prnMsg(_('This script will not update the General Ledger stock balances for the changed costs. If you use integrated stock then do not use this utility'),'warn'); - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" name="form">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"> <img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Update costs for all items listed in a bill of materials').'<br /> @@ -58,6 +59,7 @@ <div class="centre"> <input type="submit" name="Run" value="' . _('Run') . '" /> </div> + </div> </form>'; } Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeBranchCode.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -193,9 +193,10 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<p /> +echo '<br /> <table> <tr> <td>' . _('Customer Code') . ':</td> @@ -213,7 +214,8 @@ echo '<input type="submit" name="ProcessCustomerChange" value="' . _('Process') . '" />'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> Modified: trunk/Z_ChangeCustomerCode.php =================================================================== --- trunk/Z_ChangeCustomerCode.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeCustomerCode.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -224,6 +224,7 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> @@ -239,7 +240,7 @@ </table> <input type="submit" name="ProcessCustomerChange" value="' . _('Process') . '" /> - + </div> </form>'; include('includes/footer.inc'); Modified: trunk/Z_ChangeStockCategory.php =================================================================== --- trunk/Z_ChangeStockCategory.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeStockCategory.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -91,6 +91,7 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> <table> @@ -104,10 +105,8 @@ </tr> </table> - <div class="centre"> <input type="submit" name="ProcessStockChange" value="' . _('Process') . '" /> </div> - </form>'; include ('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeStockCode.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -322,9 +322,11 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<p><table> +echo '<br /> + <table> <tr> <td>' . _('Existing Inventory Code') . ':</td> <td><input type="text" name="OldStockID" size="20" maxlength="20" /></td> @@ -334,10 +336,9 @@ <td><input type="text" name="NewStockID" size="20" maxlength="20" /></td> </tr> </table> - <div class="centre"> + <input type="submit" name="ProcessStockChange" value="' . _('Process') . '" /> </div> - </form>'; include('includes/footer.inc'); Modified: trunk/Z_CheckAllocs.php =================================================================== --- trunk/Z_CheckAllocs.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CheckAllocs.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -113,11 +113,9 @@ //end of while loop echo '<tr><td colspan="6" class="number">' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '</td></tr>'; echo '</table> - <hr />'; + <br />'; } -echo '</form>'; - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_CheckDebtorsControl.php =================================================================== --- trunk/Z_CheckDebtorsControl.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CheckDebtorsControl.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -10,20 +10,17 @@ //========[ SHOW OUR FORM ]=========== // + // Context Navigation and Title + echo '<a href="'. $rootpath . '/index.php?&Application=AR">' . _('Back to Customers') . '</a>'; + echo '<div class="centre"><h3>' . $title . '</h3></div>'; + // Page Border - echo '<table border="1" width="100%"><tr><td style="background-color:#FFFFFF">'; echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - // Context Navigation and Title - echo '<table width="100%"> - <td width="37%" align=left><a href="'. $rootpath . '/index.php?&Application=AR">' . _('Back to Customers') . '</a></td> - <td align=left><font size="4" color=blue><u><b>' . _('Debtors Control Integrity') . '</b></u></font></td> - </table><p>'; + echo '<table class="selection">'; - echo '<table border="1">'; //Main table - echo '<td><table>'; // First column - $DefaultFromPeriod = ( !isset($_POST['FromPeriod']) OR $_POST['FromPeriod']=='' ) ? 1 : $_POST['FromPeriod']; if ( !isset($_POST['ToPeriod']) OR $_POST['ToPeriod']=='' ) @@ -48,32 +45,28 @@ $perResult = DB_query($SQL,$db); while ( $perRow=DB_fetch_array($perResult) ) { - $FromSelected = ( $perRow['periodno'] == $DefaultFromPeriod ) ? 'selected' : ''; + $FromSelected = ( $perRow['periodno'] == $DefaultFromPeriod ) ? 'selected="selected"' : ''; echo '<option ' . $FromSelected . ' value="' . $perRow['periodno'] . '">' .MonthAndYearFromSQLDate($perRow['lastdate_in_period']) .'</option>'; - $ToSelected = ( $perRow['periodno'] == $DefaultToPeriod ) ? 'selected' : ''; + $ToSelected = ( $perRow['periodno'] == $DefaultToPeriod ) ? 'selected="selected"' : ''; $ToSelect .= '<option ' . $ToSelected . ' value="' . $perRow['periodno'] . '">' . MonthAndYearFromSQLDate($perRow['lastdate_in_period']) .'</option>'; } DB_free_result($perResult); echo '</select></td></tr>'; - echo '</table></td>'; // End First column - echo '<td><table>'; // Start Second column - echo $ToSelect . '</select></td></tr>'; - echo '</table></td>'; // End Second column - echo '</table>'; //End the main table + echo '</table>'; - echo '<p><input type="submit" name="Show" value="'._('Accept').'" />'; - echo '<input type="submit" action="reset" value="' . _('Cancel') .'" />'; + echo '<br /><input type="submit" name="Show" value="'._('Accept').'" />'; + echo '<input type="submit" value="' . _('Cancel') .'" />'; if ( isset($_POST['Show']) ) { // //========[ SHOW SYNOPSYS ]=========== // - echo '<p><table border="1">'; + echo '<br /><table border="1">'; echo '<tr> <th>' . _('Period') . '</th> <th>' . _('Bal B/F in GL') . '</th> @@ -145,24 +138,26 @@ echo '<td class="number">' . locale_number_format($glMovement,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(($CalcMovement),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number" style="background-color:white"><font color="' . $color . '">' . locale_number_format($diff,$_SESSION['CompanyRecord']['decimalplaces']) . '</font></td> + <td class="number" style="background-color:white;color:' . $color . '">' . locale_number_format($diff,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $CurPeriod++; } $difColor = ( $DiffTotal == 0 ) ? 'green' : 'red'; - echo '<tr bgcolor=white> + echo '<tr style="bgcolor:white"> <td>' . _('Total') . '</td> <td class="number">' . locale_number_format($GLOpening,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($invTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($RecTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($GLClosing,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CalcTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number"><font color="' . $difColor . '">' . locale_number_format($DiffTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</font></td> + <td class="number" style="color=' . $difColor . '">' . locale_number_format($DiffTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - echo '</table></form>'; + echo '</table>'; } + echo '</div> + </form>'; include('includes/footer.inc'); Modified: trunk/Z_CreateCompanyTemplateFile.php =================================================================== --- trunk/Z_CreateCompanyTemplateFile.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CreateCompanyTemplateFile.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -215,6 +215,7 @@ } /*end submit button hit */ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; prnMsg(_('Running the create a new company template script will export all account groups, account codes and tax set up tables including tax groups, tax authorities, tax rates etc. However, no transactions or private data will be exported. There is opportunity to prevent specific general ledger accounts from being exported where these are considered private - again no transactional or balance data is exported and you can inspect the contents of the sql file. The template file will be emailed automatically to the webERP project'),'info'); @@ -232,7 +233,7 @@ $i = 0; while ($ChartRow = DB_fetch_array($ChartResult)){ echo '<tr><td>' . $ChartRow['accountcode'] . '</td> - <td>' . $ChartRow['accountname'] . '</td> + <td>' . htmlspecialchars($ChartRow['accountname'],ENT_QUOTES,'UTF-8',false) . '</td> <td><input type="checkbox" name="IncludeAccount_' . $i . '" checked="checked" /></td> </tr>'; $i++; @@ -240,8 +241,9 @@ echo '</table>'; echo '<hr />'; -echo '<center><input type="submit" name="CreateTemplate" value="' . _('Create Template and Email') . '" /></center>'; +echo '<div class="centre"><input type="submit" name="CreateTemplate" value="' . _('Create Template and Email') . '" /></div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_CurrencyDebtorsBalances.php =================================================================== --- trunk/Z_CurrencyDebtorsBalances.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CurrencyDebtorsBalances.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -5,7 +5,7 @@ $title=_('Currency Debtor Balances'); include('includes/header.inc'); -echo '<font size="4"><b>' . _('Debtors Balances By Currency Totals') . '</b></font>'; +echo '<div class="centre"><h3>' . _('Debtors Balances By Currency Totals') . '</h3></div>'; $sql = "SELECT SUM(ovamount+ovgst+ovdiscount+ovfreight-alloc) AS currencybalance, currcode, Modified: trunk/Z_CurrencySuppliersBalances.php =================================================================== --- trunk/Z_CurrencySuppliersBalances.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CurrencySuppliersBalances.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -5,7 +5,7 @@ $title=_('Currency Debtor Balances'); include('includes/header.inc'); -echo '<b>' . _('Suppliers Balances By Currency Totals') . '</b>'; +echo '<div class="centre"><h3>' . _('Suppliers Balances By Currency Totals') . '</h3></div>'; $sql = "SELECT SUM(ovamount+ovgst-alloc) AS currencybalance, currcode, Modified: trunk/Z_DataExport.php =================================================================== --- trunk/Z_DataExport.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_DataExport.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -533,6 +533,7 @@ echo '<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>'; echo '<tr><th colspan="2">' . _('Price List Export') . '</th></tr>'; @@ -541,7 +542,7 @@ echo '<tr><td>' . _('For Sales Type/Price List') . ':</td>'; echo '<td><select name="SalesType">'; while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type']; + echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } echo '</select></td></tr>'; @@ -550,12 +551,13 @@ echo '<tr><td>' . _('For Location') . ':</td>'; echo '<td><select name="Location">'; while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } echo '</select></td></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='pricelist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='pricelist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT FOR CUSTOMER LIST @@ -563,6 +565,7 @@ echo "<br />"; // Export Stock For Location 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>'; echo '<tr><th colspan="2">' . _('Customer List Export') . '</th></tr>'; @@ -572,69 +575,82 @@ echo '<tr><td>' . _('For Location') . ':</td>'; echo '<td><select name="Location">'; while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } echo '</select></td></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='custlist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='custlist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT FOR SALES MAN echo "<br />"; // Export Stock For Location 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>'; echo '<tr><th colspan="2">' . _('Salesman List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><div class='centre'><input type='Submit' name='salesmanlist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='salesmanlist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT FOR IMAGES 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>'; echo '<tr><th colspan="2">' . _('Image List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='imagelist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='imagelist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY TOKENS 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>'; echo '<tr><th colspan="2">' . _('Security Token List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='sectokenlist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='sectokenlist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY ROLES 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>'; echo '<tr><th colspan="2">' . _('Security Role List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='secrolelist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='secrolelist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY GROUPS 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>'; echo '<tr><th colspan="2">' . _('Security Group List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='secgrouplist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='secgrouplist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY USERS 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>'; echo '<tr><th colspan="2">' . _('Security User List Export') . '</th></tr>'; echo '</table>'; echo '<div class="centre"><input type="submit" name="secuserlist" value="' . _('Export') . '" /></div>'; - echo '</form><br />'; + echo '</div> + </form><br />'; include('includes/footer.inc'); Modified: trunk/Z_DeleteSalesTransActions.php =================================================================== --- trunk/Z_DeleteSalesTransActions.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_DeleteSalesTransActions.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -133,9 +133,10 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<p><table> +echo '<br /><table> <tr> <td>' . _('Delete All Sales Analysis') . '</td> <td><input type="checkbox" name="SalesAnalysis" /></td> @@ -177,7 +178,8 @@ echo '<input type="submit" name="ProcessDeletions" value="' . _('Process') . '" onclick="return confirm(\'' . _('Are You Really REALLY Sure?') . '\');" />'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ImportChartOfAccounts.php =================================================================== --- trunk/Z_ImportChartOfAccounts.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportChartOfAccounts.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -73,12 +73,14 @@ prnMsg( _('Select a csv file containing the details of the account codes that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=chartmaster">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class="centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } include('includes/footer.inc'); Modified: trunk/Z_ImportFixedAssets.php =================================================================== --- trunk/Z_ImportFixedAssets.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportFixedAssets.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -289,6 +289,7 @@ <br /> '; echo '<form enctype="multipart/form-data" action="Z_ImportFixedAssets.php" method="post">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />'; @@ -300,8 +301,9 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[0]) . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Fixed Assets Upload file:') . '</td><td><input name="SelectedAssetFile" type="file" /></tr></table> + echo '<tr><td>' . _('Fixed Assets Upload file:') . '</td><td><input name="SelectedAssetFile" type="file" /></td></tr></table> <input type="submit" value="' . _('Send File') . '" /> + </div> </form>'; } Modified: trunk/Z_ImportGLAccountGroups.php =================================================================== --- trunk/Z_ImportGLAccountGroups.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportGLAccountGroups.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -66,12 +66,14 @@ prnMsg( _('Select a csv file containing the details of the account sections that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=accountsection">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class="centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } include('includes/footer.inc'); Modified: trunk/Z_ImportGLAccountSections.php =================================================================== --- trunk/Z_ImportGLAccountSections.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportGLAccountSections.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -70,12 +70,14 @@ prnMsg( _('Select a csv file containing the details of the account sections that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=accountsection">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class= "centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ImportPartCodes.php =================================================================== --- trunk/Z_ImportPartCodes.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportPartCodes.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -77,12 +77,14 @@ prnMsg( _('Select a csv file containing the details of the parts that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=stockmaster">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class="centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } } Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportStocks.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -289,12 +289,14 @@ <a href="Z_ImportStocks.php?gettemplate=1">Get Import Template</a> <br /> <br />'; - echo '<form ENCtype="multipart/form-data" action="Z_ImportStocks.php" method="post">'; + echo '<form action="Z_ImportStocks.php" method="post">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />' . _('Upload file') . ': <input name="userfile" type="file" /> <input type="submit" value="' . _('Send File') . '" /> + </div> </form>'; } Modified: trunk/Z_MakeNewCompany.php =================================================================== --- trunk/Z_MakeNewCompany.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_MakeNewCompany.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -34,8 +34,8 @@ } else { $_POST['NewCompany'] = strtolower($_POST['NewCompany']); - echo '<div class="centre">'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /* check for directory existence */ if (!file_exists('./companies/' . $_POST['NewCompany']) @@ -161,8 +161,8 @@ prnMsg('_FILES[LogoFile][name] ' ._('is blank'),'info'); } + echo '</div>'; echo '</form>'; - echo '</div>'; include('includes/footer.inc'); exit; } @@ -195,8 +195,8 @@ echo '<p><a href="' . $rootpath . '/SystemParameters.php">' . _('Set Up Configuration Details') . '</a>'; echo '<p><a href="' . $rootpath . '/WWW_Users.php">' . _('Set Up User Accounts') . '</a>'; + echo '</div>'; echo '</form>'; - echo '</div>'; include('includes/footer.inc'); exit; } @@ -208,8 +208,9 @@ echo '<br />'; prnMsg (_('This utility will create a new company') . '<br /><br />' . _('If the company name already exists then you cannot recreate it'), 'info', _('PLEASE NOTE')); -echo '<br />'; -echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . ' enctype="multipart/form-data">'; +echo '<br /></div>'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '" enctype="multipart/form-data">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr>'; @@ -217,17 +218,17 @@ <td><input type="text" size="33" maxlength="32" name="NewCompany" /></td> </tr> <tr> - <td>'. _('Logo Image File (.jpg)') . ':</td><td><input type="FILE" ID="LogoFile" name="LogoFile" /></td> + <td>'. _('Logo Image File (.jpg)') . ':</td><td><input type="file" id="LogoFile" name="LogoFile" /></td> </tr> <tr> <td>' . _('Create Database?') . '</td> - <td><input type="CHECKBOX" name="CreateDB" /></td> + <td><input type="checkbox" name="CreateDB" /></td> </tr> </table>'; echo '<br /><input type="submit" name="submit" value="' . _('Proceed') . '" />'; +echo '</div>'; echo '</form>'; -echo '</div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ReApplyCostToSA.php =================================================================== --- trunk/Z_ReApplyCostToSA.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ReApplyCostToSA.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -8,14 +8,15 @@ $Period = 42; -echo "<form method='POST' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo "<form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $SQL = "SELECT MonthName(lastdate_in_period) AS mnth, YEAR(lastdate_in_period) AS yr, periodno FROM periods"; -echo '<p><div class="centre">' . _('Select the Period to update the costs for') . ':<select name="PeriodNo">'; +echo '<br /><div class="centre">' . _('Select the Period to update the costs for') . ':<select name="PeriodNo">'; $result = DB_query($SQL,$db); echo '<option selected="selected" value="0">' . _('No Period Selected') . '</option>'; @@ -28,8 +29,8 @@ echo '</select>'; -echo '<p><input type="submit" name="UpdateSalesAnalysis" value="' . _('Update Sales Analysis Costs') .'" /></div>'; -echo '</form>'; +echo '<br /><input type="submit" name="UpdateSalesAnalysis" value="' . _('Update Sales Analysis Costs') .'" /></div>'; +echo '</div></form>'; if (isset($_POST['UpdateSalesAnalysis']) AND $_POST['PeriodNo']!=0){ $sql = "SELECT stockmaster.stockid, Modified: trunk/Z_RePostGLFromPeriod.php =================================================================== --- trunk/Z_RePostGLFromPeriod.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_RePostGLFromPeriod.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -7,6 +7,7 @@ include('includes/header.inc'); echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['FromPeriod'])){ @@ -15,7 +16,7 @@ echo '<table> <tr> <td>' . _('Select Period From') . ':</td> - <td><select Name="FromPeriod">'; + <td><select name="FromPeriod">'; $sql = "SELECT periodno, lastdate_in_period @@ -30,7 +31,9 @@ </tr> </table>'; - echo '<div class="centre"><input type="submit" Name="recalc" value="' . _('Do the Recalculation') . '" onclick="return confirm(\'' . _('Are you sure you wish to re-post all general ledger transactions since the selected period this can take some time?') . '\');"></div></form>'; + echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" onclick="return confirm(\'' . _('Are you sure you wish to re-post all general ledger transactions since the selected period this can take some time?') . '\');" /></div> + </div> + </form>'; } else { /*OK do the updates */ Modified: trunk/Z_ReverseSuppPaymentRun.php =================================================================== --- trunk/Z_ReverseSuppPaymentRun.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ReverseSuppPaymentRun.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -84,10 +84,12 @@ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br />' . _('Enter the date of the payment run') . ': <input type="text" name="PaytDate" maxlength="11" size="11" value="' . $_POST['PaytDate'] . '" />'; echo '<input type="submit" name="RevPayts" value="' . _('Reverse Supplier Payments on the Date Entered') . '" />'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_SalesIntegrityCheck.php =================================================================== --- trunk/Z_SalesIntegrityCheck.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_SalesIntegrityCheck.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -11,7 +11,7 @@ include('includes/header.inc'); -echo '<div class="centre"><font size="4" color=blue><U><b>' . _('Sales Integrity Check') . '</b></U></font></div>'; +echo '<div class="centre"><h3>' . _('Sales Integrity Check') . '</h3></div>'; echo '<br /><br />'._('Check every Invoice has a Sales Order').'<br />'; echo '<br /><br />'._('Check every Invoice has a Tax Entry').'<br />'; @@ -25,7 +25,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Invoice '). ' '. $myrow['transno'] . ' : '; - echo '<font color=RED>' . _('No Sales Order') . '</font>'; + echo '<div style="color:red">' . _('No Sales Order') . '</div>'; } $SQL3 = "SELECT debtortransid FROM debtortranstaxes WHERE debtortransid = '" . $myrow['id'] . "'"; @@ -33,7 +33,7 @@ if ( DB_num_rows($Result3) == 0) { echo '<br />'. _('Invoice '). ' ' . $myrow['transno'] . ' : '; - echo '<font color=RED>' . _('Has no Tax Entry') . '</font>'; + echo '<div style="color:red">' . _('Has no Tax Entry') . '</div>'; } $SQL4 = "SELECT typeno @@ -44,7 +44,7 @@ if ( DB_num_rows($Result4) == 0) { echo '<br />' . _('Invoice') . ' ' . $myrow['transno'] . ' : '; - echo '<font color=RED>' . _('has no GL Entry') . '</font>'; + echo '<div style="color:red">' . _('has no GL Entry') . '</div>'; } } @@ -64,7 +64,7 @@ if ( DB_num_rows($Result2) == 0) { echo "<br />"._('GL Entry ') . $myrow['counterindex'] . " : "; - echo ', <font color=RED>'._('Invoice ') . $myrow['typeno'] . _(' could not be found').'</font>'; + echo ', <div style="color:red">'._('Invoice ') . $myrow['typeno'] . _(' could not be found').'</div>'; } } @@ -88,7 +88,7 @@ if ( $myrow2[0] + $myrow['amount'] == 0 ) { echo '<br />'._('Receipt') . ' ' . $myrow['typeno'] . " : "; - echo '<font color=RED>' . $myrow['amount']. ' ' . _('in GL but found'). ' ' . $myrow2[0] . ' ' . _('in debtorstrans').'</font>'; + echo '<div style="color:red">' . $myrow['amount']. ' ' . _('in GL but found'). ' ' . $myrow2[0] . ' ' . _('in debtorstrans').'</div>'; } } @@ -103,7 +103,7 @@ if ( !$myrow2[0] ) { echo '<br />'._('Receipt') . ' ' . $myrow['transno'] . " : "; - echo '<font color=RED>' . $myrow['transno'] . ' ' ._('not found in GL')."</font>"; + echo '<div style="color:red">' . $myrow['transno'] . ' ' ._('not found in GL')."</div>"; } } @@ -124,7 +124,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Sales Order') . ' ' . $myrow['orderno'] . ' : '; - echo '<font color=RED>'._('Has no Invoice').'</font>'; + echo '<div style="color:red">'._('Has no Invoice').'</div>'; } } @@ -139,7 +139,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Order Item') . ' ' . $myrow['orderno'] . ' : '; - echo ', <font color=RED>'._('Has no Sales Order').'</font>'; + echo ', <div style="color:red">'._('Has no Sales Order').'</div>'; } $sumsql = "SELECT SUM( qtyinvoiced * unitprice ) AS InvoiceTotal @@ -163,7 +163,7 @@ if ( $invrow['type'] != 11 ) { // Do an integrity check on sales order items if ( $sumrow['InvoiceTotal'] != $invrow['ovamount'] ) { - echo '<br /><font color=red>' . _('Debtors trans') . ' ' . $invrow['ovamount'] . ' ' . _('differ from salesorderdetails') . ' ' . $sumrow['InvoiceTotal'] . '</font>'; + echo '<br /><div style="color:red">' . _('Debtors trans') . ' ' . $invrow['ovamount'] . ' ' . _('differ from salesorderdetails') . ' ' . $sumrow['InvoiceTotal'] . '</div>'; } } } @@ -187,7 +187,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Stock Move') . ' ' . $myrow['stkmoveno'] . ' : '; - echo ', <font color=RED>'._('Has no Invoice').'</font>'; + echo ', <div style="color:red">'._('Has no Invoice').'</div>'; } } @@ -202,7 +202,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Tax Entry') . ' ' . $myrow['debtortransid'] . ' : '; - echo ', <font color=RED>'._('Has no Invoice').'</font>'; + echo ', <div style="color:red">'._('Has no Invoice').'</div>'; } } Modified: trunk/Z_UpdateChartDetailsBFwd.php =================================================================== --- trunk/Z_UpdateChartDetailsBFwd.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_UpdateChartDetailsBFwd.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -7,6 +7,7 @@ include('includes/header.inc'); echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ($_POST['FromPeriod'] > $_POST['ToPeriod']){ @@ -47,12 +48,14 @@ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option VALUE =' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } echo '</select></td></tr></table>'; - echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" /></div></form>'; + echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" /></div> + </div> + </form>'; } else { /*OK do the updates */ Modified: trunk/Z_index.php =================================================================== --- trunk/Z_index.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_index.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -5,38 +5,38 @@ $title = _('Special Fixes and Utilities') . ' - ' . _('Only System Administrator'); include('includes/header.inc'); - echo '<p>' . _('BE VERY CAREFUL DO NOT RUN THESE LINKS BELOW WITHOUT UNDERSTANDING EXACTLY WHAT THEY DO AND THE IMPLICATIONS'); + echo '<p>' . _('BE VERY CAREFUL DO NOT RUN THESE LINKS BELOW WITHOUT UNDERSTANDING EXACTLY WHAT THEY DO AND THE IMPLICATIONS') . '</p>'; - echo '<p><a href="' .$rootpath . '/Z_ReApplyCostToSA.php">'. _('Re-apply costs to Sales Analysis') . '</a>'; - echo '<p><a href="' .$rootpath . '/EDISendInvoices.php">' . _('Send All Unsent EDI Invoices and Credits') .'</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeCustomerCode.php">'. _('Change A Customer Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeBranchCode.php">' . _('Change A Customer Branch Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeStockCode.php">' . _('Change An Inventory Item Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeSupplierCode.php">' . _('Change A Supplier Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_BottomUpCosts.php">' . _('Update costs for all BOM items, from the bottom up') . '</a>'; + echo '<p><a href="' .$rootpath . '/Z_ReApplyCostToSA.php">'. _('Re-apply costs to Sales Analysis') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/EDISendInvoices.php">' . _('Send All Unsent EDI Invoices and Credits') .'</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeCustomerCode.php">'. _('Change A Customer Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeBranchCode.php">' . _('Change A Customer Branch Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeStockCode.php">' . _('Change An Inventory Item Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeSupplierCode.php">' . _('Change A Supplier Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_BottomUpCosts.php">' . _('Update costs for all BOM items, from the bottom up') . '</a></p>'; - echo '<p><a href="' .$rootpath . '/Z_CurrencyDebtorsBalances.php">' . _('Show Local Currency Total Debtor Balances') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CurrencySuppliersBalances.php">' . _('Show Local Currency Total Suppliers Balances') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CheckGLTransBalance.php">' . _('Show General Transactions That Do Not Balance') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_poAdmin.php">' . _('Maintain Language Files') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_MakeNewCompany.php">' . _('Make New Company') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_DataExport.php">' . _('Data Export Options') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_GetStockImage.php">' . _('Image Manipulation Utility') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ImportStocks.php">' . _('Import Stock Items from .csv') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ImportFixedAssets.php">' . _('Import Fixed Assets from .csv file') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CreateCompanyTemplateFile.php">' . _('Create new company template SQL file and submit to webERP') . '</a>'; + echo '<p><a href="' .$rootpath . '/Z_CurrencyDebtorsBalances.php">' . _('Show Local Currency Total Debtor Balances') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CurrencySuppliersBalances.php">' . _('Show Local Currency Total Suppliers Balances') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CheckGLTransBalance.php">' . _('Show General Transactions That Do Not Balance') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_poAdmin.php">' . _('Maintain Language Files') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_MakeNewCompany.php">' . _('Make New Company') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_DataExport.php">' . _('Data Export Options') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_GetStockImage.php">' . _('Image Manipulation Utility') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ImportStocks.php">' . _('Import Stock Items from .csv') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ImportFixedAssets.php">' . _('Import Fixed Assets from .csv file') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CreateCompanyTemplateFile.php">' . _('Create new company template SQL file and submit to webERP') . '</a></p>'; echo '<br /><br /><hr /><br />' . _('The stuff below is really quite dangerous!'); - echo '<p>' . _('To delete a credit note call') . ' ' . $rootpath . '/Z_DeleteCreditNote.php?' . ' ' ._('and the credit note number to delete'); - echo '<p>' . _('To delete an invoice call') . ' ' . $rootpath . '/Z_DeleteInvoice.php?' . _('and the invoice number to delete'); - echo '<p><a href="' .$rootpath . '/Z_UploadForm.php">' . _('Upload a file to the server') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_DeleteSalesTransActions.php">' . _('Delete sales transactions') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ReverseSuppPaymentRun.php">' . _('Reverse all supplier payments on a specified date') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_UpdateChartDetailsBFwd.php">' . _('Re-calculate brought forward amounts in GL') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_RePostGLFromPeriod.php">' . _('Re-Post all GL transactions from a specified period') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CheckDebtorsControl.php">' . _('Show Debtors Control (Need to edit Z_CheckDebtorsControl.php for the period to show control totals for') . '</a>'; + echo '<p>' . _('To delete a credit note call') . ' ' . $rootpath . '/Z_DeleteCreditNote.php?' . ' ' ._('and the credit note number to delete') . '</p>'; + echo '<p>' . _('To delete an invoice call') . ' ' . $rootpath . '/Z_DeleteInvoice.php?' . _('and the invoice number to delete') . '</p>'; + echo '<p><a href="' .$rootpath . '/Z_UploadForm.php">' . _('Upload a file to the server') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_DeleteSalesTransActions.php">' . _('Delete sales transactions') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ReverseSuppPaymentRun.php">' . _('Reverse all supplier payments on a specified date') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_UpdateChartDetailsBFwd.php">' . _('Re-calculate brought forward amounts in GL') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_RePostGLFromPeriod.php">' . _('Re-Post all GL transactions from a specified period') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CheckDebtorsControl.php">' . _('Show Debtors Control (Need to edit Z_CheckDebtorsControl.php for the period to show control totals for') . '</a></p>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/install/index.php =================================================================== --- trunk/install/index.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/install/index.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -37,12 +37,14 @@ ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>WebERP Installation Wizard</title> <link href="../css/jelly/default.css" rel="stylesheet" type="text/css" /> -<script language="javascript" type="text/javascript"> +<script type="text/javascript"> function change_os(type) { if(type == 'linux') { @@ -71,29 +73,21 @@ </head> <body> -<table cellpadding="0" cellspacing="0" border="0" width="750" align="center"> -<tr> - <td width="100%" align="center" style="font-size: 20px;"> - <p style="color: #FFFFFF;">WebERP</p> - <p style="color: #DDDDDD;">Installation Wizard</p> - </td> -</tr> -</table> - -<form name="weberp_installation_wizard" action="save.php" method="post" enctype="multipart/form-data"> +<form id="weberp_installation_wizard" action="save.php" method="post" enctype="multipart/form-data"> +<div> <input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> <input type="hidden" name="url" value="" /> <input type="hidden" name="password_fieldname" value="admin_password" /> <input type="hidden" name="remember" id="remember" value="true" /> <input type="hidden" name="path_to_root" value="<?php echo $PathToRoot; ?>" /> -<table cellpadding="0" cellspacing="0" border="0" width="750" align="center" style="margin-top: 10px;"> +<table cellpadding="0" cellspacing="0" border="0" width="750" style="margin-top: 10px;"> <tr> <td class="content"> + <div class="centre"> <h2>Welcome to the WebERP Installation Wizard.</h2> - <center> <img src="<?php echo "../companies/weberpdemo/logo.jpg"; ?>" width="250" height="50" alt="Logo" /> - </center> + </div> <?php @@ -101,9 +95,9 @@ ?><div style="width: 700px; padding: 10px; margin-bottom: 5px; border: 1px solid #FF0000; background-color: #FFDBDB;"><b>Error:</b> <?php echo $_SESSION['message']; ?></div><?php } ?> - <table cellpadding="3" cellspacing="0" width="100%" align="center"> + <table cellpadding="3" cellspacing="0" width="100%"> <tr> - <td colspan="8"><h1>Step 1</h1>Please check the following requirements are met before continuing...</td> + <td colspan="8"><h3>Step 1</h3>Please check the following requirements are met before continuing...</td> </tr> <?php if($session_support != '<p class="good">Enabled</p>') { ?> <tr> @@ -111,8 +105,8 @@ </tr> <?php } ?> <tr> - <td width="140" style="color: #666666;">PHP Version > 5.1.0</td> - <td width="35"> + <td style="color: #666666;">PHP Version > 5.1.0</td> + <td> <?php $phpversion = mb_substr(PHP_VERSION, 0, 6); if($phpversion > 5.1) { @@ -122,9 +116,9 @@ } ?> </td> - <td width="140" style="color: #666666;">PHP Session Support</td> - <td width="115"><?php echo $session_support; ?></td> - <td width="105" style="color: #666666;">PHP Safe Mode</td> + <td style="color: #666666;">PHP Session Support</td> + <td><?php echo $session_support; ?></td> + <td style="color: #666666;">PHP Safe Mode</td> <td> <?php if(ini_get('safe_mode')) { @@ -136,9 +130,9 @@ </td> </tr> </table> - <table cellpadding="3" cellspacing="0" width="100%" align="center"> + <table cellpadding="3" cellspacing="0" width="100%"> <tr> - <td colspan="8"><h1>Step 2</h1>Please check the following files/folders are writeable before continuing...</td> + <td colspan="8"><h3>Step 2</h3>Please check the following files/folders are writeable before continuing...</td> </tr> <tr> <td style="color: #666666;">Configuration file</td> @@ -159,91 +153,92 @@ </td> </tr> </table> - <table cellpadding="3" cellspacing="0" width="100%" align="center"> + <table cellpadding="3" cellspacing="0" width="100%"> <tr> - <td colspan="2"><h1>Step 3</h1>Please check your path settings...</td> + <td colspan="2"><h3>Step 3</h3>Please check your path settings...</td> </tr> <tr> - <td width="125" style="color: #666666;"> + <td style="color: #666666;width:20%"> Absolute URL: </td> <td> <?php - // Try to guess installation URL - $GuessedURL = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]; - $GuessedURL = trim(rtrim(dirname($GuessedURL), 'install')); + if (isset($_SESSION['ba_url'])) { + $IntstallUrl = $_SESSION['ba_url']; + } else { + // Try to guess installation URL + $GuessedURL = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]; + $GuessedURL = trim(rtrim(dirname($GuessedURL), 'install')); + $IntstallUrl = $GuessedURL; + } ?> - <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value="<?php - if(isset($_SESSION['ba_url'])) { - echo $_SESSION['ba_url']; - } else { - echo $GuessedURL; - } - ?>" /> + <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value="<?php echo $IntstallUrl;?>" /> </td> </tr> </table> - <table cellpadding="5" cellspacing="0" width="100%" align="center"> + <table cellpadding="5" cellspacing="0" width="100%"> <tr> - <td colspan="3"><h1>Step 4</h1>Please specify your operating system information below...</td> + <td colspan="3"><h3>Step 4</h3>Please specify your operating system information below...</td> </tr> - <tr height="50"> - <td width="170"> + <tr> + <td > Server Operating System: </td> - <td width="180"> - <input type="radio" tabindex="40" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux" + <td> + <p style="cursor: pointer;" onclick="javascript: change_os('linux');"> + <input type="radio" tabindex="40" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux" <?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { - echo ' checked'; + echo ' checked="checked"'; } ?> - /> - <p style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</p> + />Linux/Unix based</p> <br /> + <p style="cursor: pointer;" onclick="javascript: change_os('windows');"> <input type="radio" tabindex="41" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows" <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { - echo ' checked'; } + echo ' checked="checked"'; } ?> - /> - <p style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</p> + />Windows</p> </td> <td> - - <?php + <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo '<div id="file_perms_box" style="margin:0; padding:0; display:none">'; } else { echo '<div id="file_perms_box" style="margin:0; padding:0; display:block">'; } ?> - <input type="checkbox" tabindex="42" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> /> + + <input type="checkbox" tabindex="42" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked="checked"'; } ?> /> <label for="world_writeable"> World-writeable file permissions (777) </label> <br /> <p>(Please note: this is only recommended for testing environments)</p> - </div> + <?php echo '</div>';?> </td> </tr> </table> - <table cellpadding="5" cellspacing="0" width="100%" align="center"> + <table cellpadding="5" cellspacing="0" width="100%"> <tr> <td colspan="5">Please enter your MySQL database server details below...</td> </tr> <tr> - <td width="120" style="color: #666666;">Host Name:</td> - <td width="230"> + <td style="color: #666666;">Host Name:</td> + <td> <input type="text" tabindex="43" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; } ?>" /> </td> - <td width="7"> </td> - <td width="70" style="color: #666666;">Username:</td> + <td> </td> + </tr> + <tr> + <td style="color: #666666;">Username:</td> <td> - <input type="text" tabindex="44" name="database_username" style="width: 98%;" value="<?php + <input type="text" tabindex="44" name="database_username" size="20" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { @@ -253,24 +248,21 @@ </td> </tr> <tr> - <td style="color: #666666;"></td> - <td> - </td> - <td> </td> <td style="color: #666666;">Password:</td> <td> - <input type="password" tabindex="45" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { + <input type="password" tabindex="45" name="database_password" size="20"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> /> </td> + <td> </td> </tr> <tr> <td colspan="2"> <input type="checkbox" tabindex="46" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { - echo ' checked'; + echo ' checked="checked"'; } elseif($_SESSION['install_tables'] == 'true') { - echo ' checked'; + echo ' checked="checked"'; } ?> /> <label for="install_tables" style="color: #666666;">Install Tables</label> <br /> @@ -278,7 +270,7 @@ </td> </tr> <tr> - <td colspan="5"><h1>Step 5</h1>Please enter the company name below...</td> + <td colspan="5"><h3>Step 5</h3>Please enter the company name below...</td> </tr> <tr> <td style="color: #666666;" colspan="1">Company Name:</td> @@ -287,21 +279,22 @@ </td> </tr> <tr> - <td width="170"> + <td> Install the test company : </td> - <td width="180"> - <input type="checkbox" tabindex="51" name="DemoData" id="db_file_demo" value="demo"<?php if(!isset($_SESSION['db_file']) OR $_SESSION['db_file'] == 'demo') { echo ' checked'; } ?> /> - <p style="cursor: pointer;" onclick="javascript: change_data('demo');">weberpdemo company</p> + <td> + <p style="cursor: pointer;" onclick="javascript: change_data('demo');"> + <input type="checkbox" tabindex="51" name="DemoData" id="db_file_demo" value="demo"<?php if(!isset($_SESSION['db_file']) OR $_SESSION['db_file'] == 'demo') { echo ' checked="checked"'; } ?> /> + weberpdemo company</p> </td> </tr> <tr> - <td width="170"> + <td> Time Zone </td> - <td width="180"> + <td> <select name='timezone' tabindex="52"> <?php include('timezone.php'); @@ -311,17 +304,17 @@ </td> </tr> <tr> - <td width="170"> + <td> Logo Image File (.jpg) </td> - <td width="180"> + <td> <input type="hidden" name="MAX_FILE_SIZE" <?php echo "value=\"" . $_SESSION['MaxLogoSize'] . "\"" ?> /> <input type="file" size="50" id="LogoFile" name="LogoFile" tabindex="53" /> </td> </tr> <tr> - <td colspan="5"><h1>Step 6</h1>Please enter your Administrator accou... [truncated message content] |
From: <vv...@us...> - 2012-04-29 15:28:27
|
Revision: 5296 http://web-erp.svn.sourceforge.net/web-erp/?rev=5296&view=rev Author: vvs2012 Date: 2012-04-29 15:28:19 +0000 (Sun, 29 Apr 2012) Log Message: ----------- xhtml Modified Paths: -------------- trunk/Z_BottomUpCosts.php trunk/Z_ChangeBranchCode.php trunk/Z_ChangeCustomerCode.php trunk/Z_ChangeStockCategory.php trunk/Z_ChangeStockCode.php trunk/Z_CheckAllocs.php trunk/Z_CheckDebtorsControl.php trunk/Z_CreateCompanyTemplateFile.php trunk/Z_CurrencyDebtorsBalances.php trunk/Z_CurrencySuppliersBalances.php trunk/Z_DataExport.php trunk/Z_DeleteSalesTransActions.php trunk/Z_ImportChartOfAccounts.php trunk/Z_ImportFixedAssets.php trunk/Z_ImportGLAccountGroups.php trunk/Z_ImportGLAccountSections.php trunk/Z_ImportPartCodes.php trunk/Z_ImportStocks.php trunk/Z_MakeNewCompany.php trunk/Z_ReApplyCostToSA.php trunk/Z_RePostGLFromPeriod.php trunk/Z_ReverseSuppPaymentRun.php trunk/Z_SalesIntegrityCheck.php trunk/Z_UpdateChartDetailsBFwd.php trunk/Z_index.php trunk/install/index.php trunk/install/timezone.php Modified: trunk/Z_BottomUpCosts.php =================================================================== --- trunk/Z_BottomUpCosts.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_BottomUpCosts.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -50,7 +50,8 @@ <br />'; prnMsg(_('This script will not update the General Ledger stock balances for the changed costs. If you use integrated stock then do not use this utility'),'warn'); - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post" name="form">'; + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"> <img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Update costs for all items listed in a bill of materials').'<br /> @@ -58,6 +59,7 @@ <div class="centre"> <input type="submit" name="Run" value="' . _('Run') . '" /> </div> + </div> </form>'; } Modified: trunk/Z_ChangeBranchCode.php =================================================================== --- trunk/Z_ChangeBranchCode.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeBranchCode.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -193,9 +193,10 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<p /> +echo '<br /> <table> <tr> <td>' . _('Customer Code') . ':</td> @@ -213,7 +214,8 @@ echo '<input type="submit" name="ProcessCustomerChange" value="' . _('Process') . '" />'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> Modified: trunk/Z_ChangeCustomerCode.php =================================================================== --- trunk/Z_ChangeCustomerCode.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeCustomerCode.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -224,6 +224,7 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> @@ -239,7 +240,7 @@ </table> <input type="submit" name="ProcessCustomerChange" value="' . _('Process') . '" /> - + </div> </form>'; include('includes/footer.inc'); Modified: trunk/Z_ChangeStockCategory.php =================================================================== --- trunk/Z_ChangeStockCategory.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeStockCategory.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -91,6 +91,7 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> <table> @@ -104,10 +105,8 @@ </tr> </table> - <div class="centre"> <input type="submit" name="ProcessStockChange" value="' . _('Process') . '" /> </div> - </form>'; include ('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ChangeStockCode.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -322,9 +322,11 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<p><table> +echo '<br /> + <table> <tr> <td>' . _('Existing Inventory Code') . ':</td> <td><input type="text" name="OldStockID" size="20" maxlength="20" /></td> @@ -334,10 +336,9 @@ <td><input type="text" name="NewStockID" size="20" maxlength="20" /></td> </tr> </table> - <div class="centre"> + <input type="submit" name="ProcessStockChange" value="' . _('Process') . '" /> </div> - </form>'; include('includes/footer.inc'); Modified: trunk/Z_CheckAllocs.php =================================================================== --- trunk/Z_CheckAllocs.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CheckAllocs.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -113,11 +113,9 @@ //end of while loop echo '<tr><td colspan="6" class="number">' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '</td></tr>'; echo '</table> - <hr />'; + <br />'; } -echo '</form>'; - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_CheckDebtorsControl.php =================================================================== --- trunk/Z_CheckDebtorsControl.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CheckDebtorsControl.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -10,20 +10,17 @@ //========[ SHOW OUR FORM ]=========== // + // Context Navigation and Title + echo '<a href="'. $rootpath . '/index.php?&Application=AR">' . _('Back to Customers') . '</a>'; + echo '<div class="centre"><h3>' . $title . '</h3></div>'; + // Page Border - echo '<table border="1" width="100%"><tr><td style="background-color:#FFFFFF">'; echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - // Context Navigation and Title - echo '<table width="100%"> - <td width="37%" align=left><a href="'. $rootpath . '/index.php?&Application=AR">' . _('Back to Customers') . '</a></td> - <td align=left><font size="4" color=blue><u><b>' . _('Debtors Control Integrity') . '</b></u></font></td> - </table><p>'; + echo '<table class="selection">'; - echo '<table border="1">'; //Main table - echo '<td><table>'; // First column - $DefaultFromPeriod = ( !isset($_POST['FromPeriod']) OR $_POST['FromPeriod']=='' ) ? 1 : $_POST['FromPeriod']; if ( !isset($_POST['ToPeriod']) OR $_POST['ToPeriod']=='' ) @@ -48,32 +45,28 @@ $perResult = DB_query($SQL,$db); while ( $perRow=DB_fetch_array($perResult) ) { - $FromSelected = ( $perRow['periodno'] == $DefaultFromPeriod ) ? 'selected' : ''; + $FromSelected = ( $perRow['periodno'] == $DefaultFromPeriod ) ? 'selected="selected"' : ''; echo '<option ' . $FromSelected . ' value="' . $perRow['periodno'] . '">' .MonthAndYearFromSQLDate($perRow['lastdate_in_period']) .'</option>'; - $ToSelected = ( $perRow['periodno'] == $DefaultToPeriod ) ? 'selected' : ''; + $ToSelected = ( $perRow['periodno'] == $DefaultToPeriod ) ? 'selected="selected"' : ''; $ToSelect .= '<option ' . $ToSelected . ' value="' . $perRow['periodno'] . '">' . MonthAndYearFromSQLDate($perRow['lastdate_in_period']) .'</option>'; } DB_free_result($perResult); echo '</select></td></tr>'; - echo '</table></td>'; // End First column - echo '<td><table>'; // Start Second column - echo $ToSelect . '</select></td></tr>'; - echo '</table></td>'; // End Second column - echo '</table>'; //End the main table + echo '</table>'; - echo '<p><input type="submit" name="Show" value="'._('Accept').'" />'; - echo '<input type="submit" action="reset" value="' . _('Cancel') .'" />'; + echo '<br /><input type="submit" name="Show" value="'._('Accept').'" />'; + echo '<input type="submit" value="' . _('Cancel') .'" />'; if ( isset($_POST['Show']) ) { // //========[ SHOW SYNOPSYS ]=========== // - echo '<p><table border="1">'; + echo '<br /><table border="1">'; echo '<tr> <th>' . _('Period') . '</th> <th>' . _('Bal B/F in GL') . '</th> @@ -145,24 +138,26 @@ echo '<td class="number">' . locale_number_format($glMovement,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format(($CalcMovement),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number" style="background-color:white"><font color="' . $color . '">' . locale_number_format($diff,$_SESSION['CompanyRecord']['decimalplaces']) . '</font></td> + <td class="number" style="background-color:white;color:' . $color . '">' . locale_number_format($diff,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $CurPeriod++; } $difColor = ( $DiffTotal == 0 ) ? 'green' : 'red'; - echo '<tr bgcolor=white> + echo '<tr style="bgcolor:white"> <td>' . _('Total') . '</td> <td class="number">' . locale_number_format($GLOpening,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($invTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($RecTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($GLClosing,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CalcTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number"><font color="' . $difColor . '">' . locale_number_format($DiffTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</font></td> + <td class="number" style="color=' . $difColor . '">' . locale_number_format($DiffTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - echo '</table></form>'; + echo '</table>'; } + echo '</div> + </form>'; include('includes/footer.inc'); Modified: trunk/Z_CreateCompanyTemplateFile.php =================================================================== --- trunk/Z_CreateCompanyTemplateFile.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CreateCompanyTemplateFile.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -215,6 +215,7 @@ } /*end submit button hit */ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; prnMsg(_('Running the create a new company template script will export all account groups, account codes and tax set up tables including tax groups, tax authorities, tax rates etc. However, no transactions or private data will be exported. There is opportunity to prevent specific general ledger accounts from being exported where these are considered private - again no transactional or balance data is exported and you can inspect the contents of the sql file. The template file will be emailed automatically to the webERP project'),'info'); @@ -232,7 +233,7 @@ $i = 0; while ($ChartRow = DB_fetch_array($ChartResult)){ echo '<tr><td>' . $ChartRow['accountcode'] . '</td> - <td>' . $ChartRow['accountname'] . '</td> + <td>' . htmlspecialchars($ChartRow['accountname'],ENT_QUOTES,'UTF-8',false) . '</td> <td><input type="checkbox" name="IncludeAccount_' . $i . '" checked="checked" /></td> </tr>'; $i++; @@ -240,8 +241,9 @@ echo '</table>'; echo '<hr />'; -echo '<center><input type="submit" name="CreateTemplate" value="' . _('Create Template and Email') . '" /></center>'; +echo '<div class="centre"><input type="submit" name="CreateTemplate" value="' . _('Create Template and Email') . '" /></div>'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_CurrencyDebtorsBalances.php =================================================================== --- trunk/Z_CurrencyDebtorsBalances.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CurrencyDebtorsBalances.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -5,7 +5,7 @@ $title=_('Currency Debtor Balances'); include('includes/header.inc'); -echo '<font size="4"><b>' . _('Debtors Balances By Currency Totals') . '</b></font>'; +echo '<div class="centre"><h3>' . _('Debtors Balances By Currency Totals') . '</h3></div>'; $sql = "SELECT SUM(ovamount+ovgst+ovdiscount+ovfreight-alloc) AS currencybalance, currcode, Modified: trunk/Z_CurrencySuppliersBalances.php =================================================================== --- trunk/Z_CurrencySuppliersBalances.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_CurrencySuppliersBalances.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -5,7 +5,7 @@ $title=_('Currency Debtor Balances'); include('includes/header.inc'); -echo '<b>' . _('Suppliers Balances By Currency Totals') . '</b>'; +echo '<div class="centre"><h3>' . _('Suppliers Balances By Currency Totals') . '</h3></div>'; $sql = "SELECT SUM(ovamount+ovgst-alloc) AS currencybalance, currcode, Modified: trunk/Z_DataExport.php =================================================================== --- trunk/Z_DataExport.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_DataExport.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -533,6 +533,7 @@ echo '<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>'; echo '<tr><th colspan="2">' . _('Price List Export') . '</th></tr>'; @@ -541,7 +542,7 @@ echo '<tr><td>' . _('For Sales Type/Price List') . ':</td>'; echo '<td><select name="SalesType">'; while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type']; + echo '<option value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } echo '</select></td></tr>'; @@ -550,12 +551,13 @@ echo '<tr><td>' . _('For Location') . ':</td>'; echo '<td><select name="Location">'; while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } echo '</select></td></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='pricelist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='pricelist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT FOR CUSTOMER LIST @@ -563,6 +565,7 @@ echo "<br />"; // Export Stock For Location 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>'; echo '<tr><th colspan="2">' . _('Customer List Export') . '</th></tr>'; @@ -572,69 +575,82 @@ echo '<tr><td>' . _('For Location') . ':</td>'; echo '<td><select name="Location">'; while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } echo '</select></td></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='custlist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='custlist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT FOR SALES MAN echo "<br />"; // Export Stock For Location 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>'; echo '<tr><th colspan="2">' . _('Salesman List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><div class='centre'><input type='Submit' name='salesmanlist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='salesmanlist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT FOR IMAGES 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>'; echo '<tr><th colspan="2">' . _('Image List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='imagelist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='imagelist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY TOKENS 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>'; echo '<tr><th colspan="2">' . _('Security Token List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='sectokenlist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='sectokenlist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY ROLES 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>'; echo '<tr><th colspan="2">' . _('Security Role List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='secrolelist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='secrolelist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY GROUPS 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>'; echo '<tr><th colspan="2">' . _('Security Group List Export') . '</th></tr>'; echo '</table>'; - echo "<div class='centre'><input type='Submit' name='secgrouplist' value='" . _('Export') . "' /></div>"; - echo '</form><br />'; + echo "<div class='centre'><input type='submit' name='secgrouplist' value='" . _('Export') . "' /></div>"; + echo '</div> + </form><br />'; // SELECT EXPORT SECURITY USERS 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>'; echo '<tr><th colspan="2">' . _('Security User List Export') . '</th></tr>'; echo '</table>'; echo '<div class="centre"><input type="submit" name="secuserlist" value="' . _('Export') . '" /></div>'; - echo '</form><br />'; + echo '</div> + </form><br />'; include('includes/footer.inc'); Modified: trunk/Z_DeleteSalesTransActions.php =================================================================== --- trunk/Z_DeleteSalesTransActions.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_DeleteSalesTransActions.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -133,9 +133,10 @@ } echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<p><table> +echo '<br /><table> <tr> <td>' . _('Delete All Sales Analysis') . '</td> <td><input type="checkbox" name="SalesAnalysis" /></td> @@ -177,7 +178,8 @@ echo '<input type="submit" name="ProcessDeletions" value="' . _('Process') . '" onclick="return confirm(\'' . _('Are You Really REALLY Sure?') . '\');" />'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ImportChartOfAccounts.php =================================================================== --- trunk/Z_ImportChartOfAccounts.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportChartOfAccounts.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -73,12 +73,14 @@ prnMsg( _('Select a csv file containing the details of the account codes that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=chartmaster">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class="centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } include('includes/footer.inc'); Modified: trunk/Z_ImportFixedAssets.php =================================================================== --- trunk/Z_ImportFixedAssets.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportFixedAssets.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -289,6 +289,7 @@ <br /> '; echo '<form enctype="multipart/form-data" action="Z_ImportFixedAssets.php" method="post">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />'; @@ -300,8 +301,9 @@ echo '<option value="' . $PeriodRow[0] . '">' . ConvertSQLDate($PeriodRow[0]) . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Fixed Assets Upload file:') . '</td><td><input name="SelectedAssetFile" type="file" /></tr></table> + echo '<tr><td>' . _('Fixed Assets Upload file:') . '</td><td><input name="SelectedAssetFile" type="file" /></td></tr></table> <input type="submit" value="' . _('Send File') . '" /> + </div> </form>'; } Modified: trunk/Z_ImportGLAccountGroups.php =================================================================== --- trunk/Z_ImportGLAccountGroups.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportGLAccountGroups.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -66,12 +66,14 @@ prnMsg( _('Select a csv file containing the details of the account sections that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=accountsection">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class="centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } include('includes/footer.inc'); Modified: trunk/Z_ImportGLAccountSections.php =================================================================== --- trunk/Z_ImportGLAccountSections.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportGLAccountSections.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -70,12 +70,14 @@ prnMsg( _('Select a csv file containing the details of the account sections that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=accountsection">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class= "centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ImportPartCodes.php =================================================================== --- trunk/Z_ImportPartCodes.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportPartCodes.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -77,12 +77,14 @@ prnMsg( _('Select a csv file containing the details of the parts that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=stockmaster">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>'._('File to import').'</td>'. '<td><input type="file" id="ImportFile" name="ImportFile" /></td></tr></table>'; echo '<div class="centre"><input type="submit" name="update" value="Process" /></div>'; - echo '</form>'; + echo '</div> + </form>'; } } Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ImportStocks.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -289,12 +289,14 @@ <a href="Z_ImportStocks.php?gettemplate=1">Get Import Template</a> <br /> <br />'; - echo '<form ENCtype="multipart/form-data" action="Z_ImportStocks.php" method="post">'; + echo '<form action="Z_ImportStocks.php" method="post">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />' . _('Upload file') . ': <input name="userfile" type="file" /> <input type="submit" value="' . _('Send File') . '" /> + </div> </form>'; } Modified: trunk/Z_MakeNewCompany.php =================================================================== --- trunk/Z_MakeNewCompany.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_MakeNewCompany.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -34,8 +34,8 @@ } else { $_POST['NewCompany'] = strtolower($_POST['NewCompany']); - echo '<div class="centre">'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '">'; + echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /* check for directory existence */ if (!file_exists('./companies/' . $_POST['NewCompany']) @@ -161,8 +161,8 @@ prnMsg('_FILES[LogoFile][name] ' ._('is blank'),'info'); } + echo '</div>'; echo '</form>'; - echo '</div>'; include('includes/footer.inc'); exit; } @@ -195,8 +195,8 @@ echo '<p><a href="' . $rootpath . '/SystemParameters.php">' . _('Set Up Configuration Details') . '</a>'; echo '<p><a href="' . $rootpath . '/WWW_Users.php">' . _('Set Up User Accounts') . '</a>'; + echo '</div>'; echo '</form>'; - echo '</div>'; include('includes/footer.inc'); exit; } @@ -208,8 +208,9 @@ echo '<br />'; prnMsg (_('This utility will create a new company') . '<br /><br />' . _('If the company name already exists then you cannot recreate it'), 'info', _('PLEASE NOTE')); -echo '<br />'; -echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . ' enctype="multipart/form-data">'; +echo '<br /></div>'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '" enctype="multipart/form-data">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr>'; @@ -217,17 +218,17 @@ <td><input type="text" size="33" maxlength="32" name="NewCompany" /></td> </tr> <tr> - <td>'. _('Logo Image File (.jpg)') . ':</td><td><input type="FILE" ID="LogoFile" name="LogoFile" /></td> + <td>'. _('Logo Image File (.jpg)') . ':</td><td><input type="file" id="LogoFile" name="LogoFile" /></td> </tr> <tr> <td>' . _('Create Database?') . '</td> - <td><input type="CHECKBOX" name="CreateDB" /></td> + <td><input type="checkbox" name="CreateDB" /></td> </tr> </table>'; echo '<br /><input type="submit" name="submit" value="' . _('Proceed') . '" />'; +echo '</div>'; echo '</form>'; -echo '</div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_ReApplyCostToSA.php =================================================================== --- trunk/Z_ReApplyCostToSA.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ReApplyCostToSA.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -8,14 +8,15 @@ $Period = 42; -echo "<form method='POST' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo "<form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $SQL = "SELECT MonthName(lastdate_in_period) AS mnth, YEAR(lastdate_in_period) AS yr, periodno FROM periods"; -echo '<p><div class="centre">' . _('Select the Period to update the costs for') . ':<select name="PeriodNo">'; +echo '<br /><div class="centre">' . _('Select the Period to update the costs for') . ':<select name="PeriodNo">'; $result = DB_query($SQL,$db); echo '<option selected="selected" value="0">' . _('No Period Selected') . '</option>'; @@ -28,8 +29,8 @@ echo '</select>'; -echo '<p><input type="submit" name="UpdateSalesAnalysis" value="' . _('Update Sales Analysis Costs') .'" /></div>'; -echo '</form>'; +echo '<br /><input type="submit" name="UpdateSalesAnalysis" value="' . _('Update Sales Analysis Costs') .'" /></div>'; +echo '</div></form>'; if (isset($_POST['UpdateSalesAnalysis']) AND $_POST['PeriodNo']!=0){ $sql = "SELECT stockmaster.stockid, Modified: trunk/Z_RePostGLFromPeriod.php =================================================================== --- trunk/Z_RePostGLFromPeriod.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_RePostGLFromPeriod.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -7,6 +7,7 @@ include('includes/header.inc'); echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_POST['FromPeriod'])){ @@ -15,7 +16,7 @@ echo '<table> <tr> <td>' . _('Select Period From') . ':</td> - <td><select Name="FromPeriod">'; + <td><select name="FromPeriod">'; $sql = "SELECT periodno, lastdate_in_period @@ -30,7 +31,9 @@ </tr> </table>'; - echo '<div class="centre"><input type="submit" Name="recalc" value="' . _('Do the Recalculation') . '" onclick="return confirm(\'' . _('Are you sure you wish to re-post all general ledger transactions since the selected period this can take some time?') . '\');"></div></form>'; + echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" onclick="return confirm(\'' . _('Are you sure you wish to re-post all general ledger transactions since the selected period this can take some time?') . '\');" /></div> + </div> + </form>'; } else { /*OK do the updates */ Modified: trunk/Z_ReverseSuppPaymentRun.php =================================================================== --- trunk/Z_ReverseSuppPaymentRun.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_ReverseSuppPaymentRun.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -84,10 +84,12 @@ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br />' . _('Enter the date of the payment run') . ': <input type="text" name="PaytDate" maxlength="11" size="11" value="' . $_POST['PaytDate'] . '" />'; echo '<input type="submit" name="RevPayts" value="' . _('Reverse Supplier Payments on the Date Entered') . '" />'; -echo '</form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Z_SalesIntegrityCheck.php =================================================================== --- trunk/Z_SalesIntegrityCheck.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_SalesIntegrityCheck.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -11,7 +11,7 @@ include('includes/header.inc'); -echo '<div class="centre"><font size="4" color=blue><U><b>' . _('Sales Integrity Check') . '</b></U></font></div>'; +echo '<div class="centre"><h3>' . _('Sales Integrity Check') . '</h3></div>'; echo '<br /><br />'._('Check every Invoice has a Sales Order').'<br />'; echo '<br /><br />'._('Check every Invoice has a Tax Entry').'<br />'; @@ -25,7 +25,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Invoice '). ' '. $myrow['transno'] . ' : '; - echo '<font color=RED>' . _('No Sales Order') . '</font>'; + echo '<div style="color:red">' . _('No Sales Order') . '</div>'; } $SQL3 = "SELECT debtortransid FROM debtortranstaxes WHERE debtortransid = '" . $myrow['id'] . "'"; @@ -33,7 +33,7 @@ if ( DB_num_rows($Result3) == 0) { echo '<br />'. _('Invoice '). ' ' . $myrow['transno'] . ' : '; - echo '<font color=RED>' . _('Has no Tax Entry') . '</font>'; + echo '<div style="color:red">' . _('Has no Tax Entry') . '</div>'; } $SQL4 = "SELECT typeno @@ -44,7 +44,7 @@ if ( DB_num_rows($Result4) == 0) { echo '<br />' . _('Invoice') . ' ' . $myrow['transno'] . ' : '; - echo '<font color=RED>' . _('has no GL Entry') . '</font>'; + echo '<div style="color:red">' . _('has no GL Entry') . '</div>'; } } @@ -64,7 +64,7 @@ if ( DB_num_rows($Result2) == 0) { echo "<br />"._('GL Entry ') . $myrow['counterindex'] . " : "; - echo ', <font color=RED>'._('Invoice ') . $myrow['typeno'] . _(' could not be found').'</font>'; + echo ', <div style="color:red">'._('Invoice ') . $myrow['typeno'] . _(' could not be found').'</div>'; } } @@ -88,7 +88,7 @@ if ( $myrow2[0] + $myrow['amount'] == 0 ) { echo '<br />'._('Receipt') . ' ' . $myrow['typeno'] . " : "; - echo '<font color=RED>' . $myrow['amount']. ' ' . _('in GL but found'). ' ' . $myrow2[0] . ' ' . _('in debtorstrans').'</font>'; + echo '<div style="color:red">' . $myrow['amount']. ' ' . _('in GL but found'). ' ' . $myrow2[0] . ' ' . _('in debtorstrans').'</div>'; } } @@ -103,7 +103,7 @@ if ( !$myrow2[0] ) { echo '<br />'._('Receipt') . ' ' . $myrow['transno'] . " : "; - echo '<font color=RED>' . $myrow['transno'] . ' ' ._('not found in GL')."</font>"; + echo '<div style="color:red">' . $myrow['transno'] . ' ' ._('not found in GL')."</div>"; } } @@ -124,7 +124,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Sales Order') . ' ' . $myrow['orderno'] . ' : '; - echo '<font color=RED>'._('Has no Invoice').'</font>'; + echo '<div style="color:red">'._('Has no Invoice').'</div>'; } } @@ -139,7 +139,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Order Item') . ' ' . $myrow['orderno'] . ' : '; - echo ', <font color=RED>'._('Has no Sales Order').'</font>'; + echo ', <div style="color:red">'._('Has no Sales Order').'</div>'; } $sumsql = "SELECT SUM( qtyinvoiced * unitprice ) AS InvoiceTotal @@ -163,7 +163,7 @@ if ( $invrow['type'] != 11 ) { // Do an integrity check on sales order items if ( $sumrow['InvoiceTotal'] != $invrow['ovamount'] ) { - echo '<br /><font color=red>' . _('Debtors trans') . ' ' . $invrow['ovamount'] . ' ' . _('differ from salesorderdetails') . ' ' . $sumrow['InvoiceTotal'] . '</font>'; + echo '<br /><div style="color:red">' . _('Debtors trans') . ' ' . $invrow['ovamount'] . ' ' . _('differ from salesorderdetails') . ' ' . $sumrow['InvoiceTotal'] . '</div>'; } } } @@ -187,7 +187,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Stock Move') . ' ' . $myrow['stkmoveno'] . ' : '; - echo ', <font color=RED>'._('Has no Invoice').'</font>'; + echo ', <div style="color:red">'._('Has no Invoice').'</div>'; } } @@ -202,7 +202,7 @@ if ( DB_num_rows($Result2) == 0) { echo '<br />'._('Tax Entry') . ' ' . $myrow['debtortransid'] . ' : '; - echo ', <font color=RED>'._('Has no Invoice').'</font>'; + echo ', <div style="color:red">'._('Has no Invoice').'</div>'; } } Modified: trunk/Z_UpdateChartDetailsBFwd.php =================================================================== --- trunk/Z_UpdateChartDetailsBFwd.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_UpdateChartDetailsBFwd.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -7,6 +7,7 @@ include('includes/header.inc'); echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ($_POST['FromPeriod'] > $_POST['ToPeriod']){ @@ -47,12 +48,14 @@ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option VALUE =' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } echo '</select></td></tr></table>'; - echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" /></div></form>'; + echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" /></div> + </div> + </form>'; } else { /*OK do the updates */ Modified: trunk/Z_index.php =================================================================== --- trunk/Z_index.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/Z_index.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -5,38 +5,38 @@ $title = _('Special Fixes and Utilities') . ' - ' . _('Only System Administrator'); include('includes/header.inc'); - echo '<p>' . _('BE VERY CAREFUL DO NOT RUN THESE LINKS BELOW WITHOUT UNDERSTANDING EXACTLY WHAT THEY DO AND THE IMPLICATIONS'); + echo '<p>' . _('BE VERY CAREFUL DO NOT RUN THESE LINKS BELOW WITHOUT UNDERSTANDING EXACTLY WHAT THEY DO AND THE IMPLICATIONS') . '</p>'; - echo '<p><a href="' .$rootpath . '/Z_ReApplyCostToSA.php">'. _('Re-apply costs to Sales Analysis') . '</a>'; - echo '<p><a href="' .$rootpath . '/EDISendInvoices.php">' . _('Send All Unsent EDI Invoices and Credits') .'</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeCustomerCode.php">'. _('Change A Customer Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeBranchCode.php">' . _('Change A Customer Branch Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeStockCode.php">' . _('Change An Inventory Item Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ChangeSupplierCode.php">' . _('Change A Supplier Code') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_BottomUpCosts.php">' . _('Update costs for all BOM items, from the bottom up') . '</a>'; + echo '<p><a href="' .$rootpath . '/Z_ReApplyCostToSA.php">'. _('Re-apply costs to Sales Analysis') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/EDISendInvoices.php">' . _('Send All Unsent EDI Invoices and Credits') .'</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeCustomerCode.php">'. _('Change A Customer Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeBranchCode.php">' . _('Change A Customer Branch Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeStockCode.php">' . _('Change An Inventory Item Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ChangeSupplierCode.php">' . _('Change A Supplier Code') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_BottomUpCosts.php">' . _('Update costs for all BOM items, from the bottom up') . '</a></p>'; - echo '<p><a href="' .$rootpath . '/Z_CurrencyDebtorsBalances.php">' . _('Show Local Currency Total Debtor Balances') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CurrencySuppliersBalances.php">' . _('Show Local Currency Total Suppliers Balances') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CheckGLTransBalance.php">' . _('Show General Transactions That Do Not Balance') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_poAdmin.php">' . _('Maintain Language Files') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_MakeNewCompany.php">' . _('Make New Company') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_DataExport.php">' . _('Data Export Options') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_GetStockImage.php">' . _('Image Manipulation Utility') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ImportStocks.php">' . _('Import Stock Items from .csv') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ImportFixedAssets.php">' . _('Import Fixed Assets from .csv file') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CreateCompanyTemplateFile.php">' . _('Create new company template SQL file and submit to webERP') . '</a>'; + echo '<p><a href="' .$rootpath . '/Z_CurrencyDebtorsBalances.php">' . _('Show Local Currency Total Debtor Balances') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CurrencySuppliersBalances.php">' . _('Show Local Currency Total Suppliers Balances') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CheckGLTransBalance.php">' . _('Show General Transactions That Do Not Balance') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_poAdmin.php">' . _('Maintain Language Files') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_MakeNewCompany.php">' . _('Make New Company') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_DataExport.php">' . _('Data Export Options') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_GetStockImage.php">' . _('Image Manipulation Utility') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ImportStocks.php">' . _('Import Stock Items from .csv') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ImportFixedAssets.php">' . _('Import Fixed Assets from .csv file') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CreateCompanyTemplateFile.php">' . _('Create new company template SQL file and submit to webERP') . '</a></p>'; echo '<br /><br /><hr /><br />' . _('The stuff below is really quite dangerous!'); - echo '<p>' . _('To delete a credit note call') . ' ' . $rootpath . '/Z_DeleteCreditNote.php?' . ' ' ._('and the credit note number to delete'); - echo '<p>' . _('To delete an invoice call') . ' ' . $rootpath . '/Z_DeleteInvoice.php?' . _('and the invoice number to delete'); - echo '<p><a href="' .$rootpath . '/Z_UploadForm.php">' . _('Upload a file to the server') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_DeleteSalesTransActions.php">' . _('Delete sales transactions') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_ReverseSuppPaymentRun.php">' . _('Reverse all supplier payments on a specified date') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_UpdateChartDetailsBFwd.php">' . _('Re-calculate brought forward amounts in GL') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_RePostGLFromPeriod.php">' . _('Re-Post all GL transactions from a specified period') . '</a>'; - echo '<p><a href="' .$rootpath . '/Z_CheckDebtorsControl.php">' . _('Show Debtors Control (Need to edit Z_CheckDebtorsControl.php for the period to show control totals for') . '</a>'; + echo '<p>' . _('To delete a credit note call') . ' ' . $rootpath . '/Z_DeleteCreditNote.php?' . ' ' ._('and the credit note number to delete') . '</p>'; + echo '<p>' . _('To delete an invoice call') . ' ' . $rootpath . '/Z_DeleteInvoice.php?' . _('and the invoice number to delete') . '</p>'; + echo '<p><a href="' .$rootpath . '/Z_UploadForm.php">' . _('Upload a file to the server') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_DeleteSalesTransActions.php">' . _('Delete sales transactions') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_ReverseSuppPaymentRun.php">' . _('Reverse all supplier payments on a specified date') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_UpdateChartDetailsBFwd.php">' . _('Re-calculate brought forward amounts in GL') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_RePostGLFromPeriod.php">' . _('Re-Post all GL transactions from a specified period') . '</a></p>'; + echo '<p><a href="' .$rootpath . '/Z_CheckDebtorsControl.php">' . _('Show Debtors Control (Need to edit Z_CheckDebtorsControl.php for the period to show control totals for') . '</a></p>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/install/index.php =================================================================== --- trunk/install/index.php 2012-04-29 04:21:07 UTC (rev 5295) +++ trunk/install/index.php 2012-04-29 15:28:19 UTC (rev 5296) @@ -37,12 +37,14 @@ ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>WebERP Installation Wizard</title> <link href="../css/jelly/default.css" rel="stylesheet" type="text/css" /> -<script language="javascript" type="text/javascript"> +<script type="text/javascript"> function change_os(type) { if(type == 'linux') { @@ -71,29 +73,21 @@ </head> <body> -<table cellpadding="0" cellspacing="0" border="0" width="750" align="center"> -<tr> - <td width="100%" align="center" style="font-size: 20px;"> - <p style="color: #FFFFFF;">WebERP</p> - <p style="color: #DDDDDD;">Installation Wizard</p> - </td> -</tr> -</table> - -<form name="weberp_installation_wizard" action="save.php" method="post" enctype="multipart/form-data"> +<form id="weberp_installation_wizard" action="save.php" method="post" enctype="multipart/form-data"> +<div> <input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> <input type="hidden" name="url" value="" /> <input type="hidden" name="password_fieldname" value="admin_password" /> <input type="hidden" name="remember" id="remember" value="true" /> <input type="hidden" name="path_to_root" value="<?php echo $PathToRoot; ?>" /> -<table cellpadding="0" cellspacing="0" border="0" width="750" align="center" style="margin-top: 10px;"> +<table cellpadding="0" cellspacing="0" border="0" width="750" style="margin-top: 10px;"> <tr> <td class="content"> + <div class="centre"> <h2>Welcome to the WebERP Installation Wizard.</h2> - <center> <img src="<?php echo "../companies/weberpdemo/logo.jpg"; ?>" width="250" height="50" alt="Logo" /> - </center> + </div> <?php @@ -101,9 +95,9 @@ ?><div style="width: 700px; padding: 10px; margin-bottom: 5px; border: 1px solid #FF0000; background-color: #FFDBDB;"><b>Error:</b> <?php echo $_SESSION['message']; ?></div><?php } ?> - <table cellpadding="3" cellspacing="0" width="100%" align="center"> + <table cellpadding="3" cellspacing="0" width="100%"> <tr> - <td colspan="8"><h1>Step 1</h1>Please check the following requirements are met before continuing...</td> + <td colspan="8"><h3>Step 1</h3>Please check the following requirements are met before continuing...</td> </tr> <?php if($session_support != '<p class="good">Enabled</p>') { ?> <tr> @@ -111,8 +105,8 @@ </tr> <?php } ?> <tr> - <td width="140" style="color: #666666;">PHP Version > 5.1.0</td> - <td width="35"> + <td style="color: #666666;">PHP Version > 5.1.0</td> + <td> <?php $phpversion = mb_substr(PHP_VERSION, 0, 6); if($phpversion > 5.1) { @@ -122,9 +116,9 @@ } ?> </td> - <td width="140" style="color: #666666;">PHP Session Support</td> - <td width="115"><?php echo $session_support; ?></td> - <td width="105" style="color: #666666;">PHP Safe Mode</td> + <td style="color: #666666;">PHP Session Support</td> + <td><?php echo $session_support; ?></td> + <td style="color: #666666;">PHP Safe Mode</td> <td> <?php if(ini_get('safe_mode')) { @@ -136,9 +130,9 @@ </td> </tr> </table> - <table cellpadding="3" cellspacing="0" width="100%" align="center"> + <table cellpadding="3" cellspacing="0" width="100%"> <tr> - <td colspan="8"><h1>Step 2</h1>Please check the following files/folders are writeable before continuing...</td> + <td colspan="8"><h3>Step 2</h3>Please check the following files/folders are writeable before continuing...</td> </tr> <tr> <td style="color: #666666;">Configuration file</td> @@ -159,91 +153,92 @@ </td> </tr> </table> - <table cellpadding="3" cellspacing="0" width="100%" align="center"> + <table cellpadding="3" cellspacing="0" width="100%"> <tr> - <td colspan="2"><h1>Step 3</h1>Please check your path settings...</td> + <td colspan="2"><h3>Step 3</h3>Please check your path settings...</td> </tr> <tr> - <td width="125" style="color: #666666;"> + <td style="color: #666666;width:20%"> Absolute URL: </td> <td> <?php - // Try to guess installation URL - $GuessedURL = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]; - $GuessedURL = trim(rtrim(dirname($GuessedURL), 'install')); + if (isset($_SESSION['ba_url'])) { + $IntstallUrl = $_SESSION['ba_url']; + } else { + // Try to guess installation URL + $GuessedURL = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]; + $GuessedURL = trim(rtrim(dirname($GuessedURL), 'install')); + $IntstallUrl = $GuessedURL; + } ?> - <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value="<?php - if(isset($_SESSION['ba_url'])) { - echo $_SESSION['ba_url']; - } else { - echo $GuessedURL; - } - ?>" /> + <input type="text" tabindex="30" name="ba_url" style="width: 99%;" value="<?php echo $IntstallUrl;?>" /> </td> </tr> </table> - <table cellpadding="5" cellspacing="0" width="100%" align="center"> + <table cellpadding="5" cellspacing="0" width="100%"> <tr> - <td colspan="3"><h1>Step 4</h1>Please specify your operating system information below...</td> + <td colspan="3"><h3>Step 4</h3>Please specify your operating system information below...</td> </tr> - <tr height="50"> - <td width="170"> + <tr> + <td > Server Operating System: </td> - <td width="180"> - <input type="radio" tabindex="40" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux" + <td> + <p style="cursor: pointer;" onclick="javascript: change_os('linux');"> + <input type="radio" tabindex="40" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux" <?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { - echo ' checked'; + echo ' checked="checked"'; } ?> - /> - <p style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</p> + />Linux/Unix based</p> <br /> + <p style="cursor: pointer;" onclick="javascript: change_os('windows');"> <input type="radio" tabindex="41" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows" <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { - echo ' checked'; } + echo ' checked="checked"'; } ?> - /> - <p style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</p> + />Windows</p> </td> <td> - - <?php + <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo '<div id="file_perms_box" style="margin:0; padding:0; display:none">'; } else { echo '<div id="file_perms_box" style="margin:0; padding:0; display:block">'; } ?> - <input type="checkbox" tabindex="42" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> /> + + <input type="checkbox" tabindex="42" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked="checked"'; } ?> /> <label for="world_writeable"> World-writeable file permissions (777) </label> <br /> <p>(Please note: this is only recommended for testing environments)</p> - </div> + <?php echo '</div>';?> </td> </tr> </table> - <table cellpadding="5" cellspacing="0" width="100%" align="center"> + <table cellpadding="5" cellspacing="0" width="100%"> <tr> <td colspan="5">Please enter your MySQL database server details below...</td> </tr> <tr> - <td width="120" style="color: #666666;">Host Name:</td> - <td width="230"> + <td style="color: #666666;">Host Name:</td> + <td> <input type="text" tabindex="43" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; } ?>" /> </td> - <td width="7"> </td> - <td width="70" style="color: #666666;">Username:</td> + <td> </td> + </tr> + <tr> + <td style="color: #666666;">Username:</td> <td> - <input type="text" tabindex="44" name="database_username" style="width: 98%;" value="<?php + <input type="text" tabindex="44" name="database_username" size="20" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { @@ -253,24 +248,21 @@ </td> </tr> <tr> - <td style="color: #666666;"></td> - <td> - </td> - <td> </td> <td style="color: #666666;">Password:</td> <td> - <input type="password" tabindex="45" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { + <input type="password" tabindex="45" name="database_password" size="20"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> /> </td> + <td> </td> </tr> <tr> <td colspan="2"> <input type="checkbox" tabindex="46" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { - echo ' checked'; + echo ' checked="checked"'; } elseif($_SESSION['install_tables'] == 'true') { - echo ' checked'; + echo ' checked="checked"'; } ?> /> <label for="install_tables" style="color: #666666;">Install Tables</label> <br /> @@ -278,7 +270,7 @@ </td> </tr> <tr> - <td colspan="5"><h1>Step 5</h1>Please enter the company name below...</td> + <td colspan="5"><h3>Step 5</h3>Please enter the company name below...</td> </tr> <tr> <td style="color: #666666;" colspan="1">Company Name:</td> @@ -287,21 +279,22 @@ </td> </tr> <tr> - <td width="170"> + <td> Install the test company : </td> - <td width="180"> - <input type="checkbox" tabindex="51" name="DemoData" id="db_file_demo" value="demo"<?php if(!isset($_SESSION['db_file']) OR $_SESSION['db_file'] == 'demo') { echo ' checked'; } ?> /> - <p style="cursor: pointer;" onclick="javascript: change_data('demo');">weberpdemo company</p> + <td> + <p style="cursor: pointer;" onclick="javascript: change_data('demo');"> + <input type="checkbox" tabindex="51" name="DemoData" id="db_file_demo" value="demo"<?php if(!isset($_SESSION['db_file']) OR $_SESSION['db_file'] == 'demo') { echo ' checked="checked"'; } ?> /> + weberpdemo company</p> </td> </tr> <tr> - <td width="170"> + <td> Time Zone </td> - <td width="180"> + <td> <select name='timezone' tabindex="52"> <?php include('timezone.php'); @@ -311,17 +304,17 @@ </td> </tr> <tr> - <td width="170"> + <td> Logo Image File (.jpg) </td> - <td width="180"> + <td> <input type="hidden" name="MAX_FILE_SIZE" <?php echo "value=\"" . $_SESSION['MaxLogoSize'] . "\"" ?> /> <input type="file" size="50" id="LogoFile" name="LogoFile" tabindex="53" /> </td> </tr> <tr> - <td colspan="5"><h1>Step 6</h1>Please enter your Administrator accou... [truncated message content] |
From: <te...@us...> - 2012-05-04 02:48:01
|
Revision: 5313 http://web-erp.svn.sourceforge.net/web-erp/?rev=5313&view=rev Author: tehonu Date: 2012-05-04 02:47:55 +0000 (Fri, 04 May 2012) Log Message: ----------- Changed order by category description Modified Paths: -------------- trunk/InventoryPlanning.php trunk/InventoryValuation.php trunk/StockCheck.php Modified: trunk/InventoryPlanning.php =================================================================== --- trunk/InventoryPlanning.php 2012-05-03 08:46:12 UTC (rev 5312) +++ trunk/InventoryPlanning.php 2012-05-04 02:47:55 UTC (rev 5313) @@ -389,7 +389,7 @@ $sql="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $CatResult= DB_query($sql,$db); while ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] .'</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select> </td> @@ -402,7 +402,7 @@ DB_data_seek($CatResult,0); while ($myrow = DB_fetch_array($CatResult)){ - echo "<option value='" . $myrow['categoryid'] . "'>" . $myrow['categoryid'] . " - " . $myrow['categorydescription'].'</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td> </tr> Modified: trunk/InventoryValuation.php =================================================================== --- trunk/InventoryValuation.php 2012-05-03 08:46:12 UTC (rev 5312) +++ trunk/InventoryValuation.php 2012-05-04 02:47:55 UTC (rev 5313) @@ -220,7 +220,7 @@ $CatResult= DB_query($sql,$db); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td> </tr>'; @@ -233,7 +233,7 @@ DB_data_seek($CatResult,0); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td> </tr>'; Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2012-05-03 08:46:12 UTC (rev 5312) +++ trunk/StockCheck.php 2012-05-04 02:47:55 UTC (rev 5313) @@ -270,10 +270,10 @@ echo '<tr><td>' . _('From Inventory Category Code') . ':</td> <td><select name="FromCriteria">'; - $sql="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid"; + $sql="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $CatResult= DB_query($sql,$db); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td></tr>'; @@ -285,14 +285,14 @@ DB_data_seek($CatResult,0); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td></tr>'; echo '<tr> <td>' . _('For Inventory in Location') . ':</td> <td><select name="Location">'; - $sql = "SELECT loccode, locationname FROM locations"; + $sql = "SELECT loccode, locationname FROM locations ORDER BY locationname"; $LocnResult=DB_query($sql,$db); while ($myrow=DB_fetch_array($LocnResult)){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2012-05-04 02:48:01
|
Revision: 5313 http://web-erp.svn.sourceforge.net/web-erp/?rev=5313&view=rev Author: tehonu Date: 2012-05-04 02:47:55 +0000 (Fri, 04 May 2012) Log Message: ----------- Changed order by category description Modified Paths: -------------- trunk/InventoryPlanning.php trunk/InventoryValuation.php trunk/StockCheck.php Modified: trunk/InventoryPlanning.php =================================================================== --- trunk/InventoryPlanning.php 2012-05-03 08:46:12 UTC (rev 5312) +++ trunk/InventoryPlanning.php 2012-05-04 02:47:55 UTC (rev 5313) @@ -389,7 +389,7 @@ $sql="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $CatResult= DB_query($sql,$db); while ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] .'</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select> </td> @@ -402,7 +402,7 @@ DB_data_seek($CatResult,0); while ($myrow = DB_fetch_array($CatResult)){ - echo "<option value='" . $myrow['categoryid'] . "'>" . $myrow['categoryid'] . " - " . $myrow['categorydescription'].'</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td> </tr> Modified: trunk/InventoryValuation.php =================================================================== --- trunk/InventoryValuation.php 2012-05-03 08:46:12 UTC (rev 5312) +++ trunk/InventoryValuation.php 2012-05-04 02:47:55 UTC (rev 5313) @@ -220,7 +220,7 @@ $CatResult= DB_query($sql,$db); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td> </tr>'; @@ -233,7 +233,7 @@ DB_data_seek($CatResult,0); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td> </tr>'; Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2012-05-03 08:46:12 UTC (rev 5312) +++ trunk/StockCheck.php 2012-05-04 02:47:55 UTC (rev 5313) @@ -270,10 +270,10 @@ echo '<tr><td>' . _('From Inventory Category Code') . ':</td> <td><select name="FromCriteria">'; - $sql="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid"; + $sql="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $CatResult= DB_query($sql,$db); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td></tr>'; @@ -285,14 +285,14 @@ DB_data_seek($CatResult,0); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . ' - ' . $myrow['categoryid'] . '</option>'; } echo '</select></td></tr>'; echo '<tr> <td>' . _('For Inventory in Location') . ':</td> <td><select name="Location">'; - $sql = "SELECT loccode, locationname FROM locations"; + $sql = "SELECT loccode, locationname FROM locations ORDER BY locationname"; $LocnResult=DB_query($sql,$db); while ($myrow=DB_fetch_array($LocnResult)){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-05-04 21:56:02
|
Revision: 5315 http://web-erp.svn.sourceforge.net/web-erp/?rev=5315&view=rev Author: daintree Date: 2012-05-04 21:55:53 +0000 (Fri, 04 May 2012) Log Message: ----------- update to 5.9.160 tcpdf Modified Paths: -------------- trunk/doc/Change.log trunk/includes/tcpdf/2dbarcodes.php trunk/includes/tcpdf/CHANGELOG.TXT trunk/includes/tcpdf/README.TXT trunk/includes/tcpdf/barcodes.php trunk/includes/tcpdf/tcpdf.php trunk/sql/mysql/upgrade4.07-4.08.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/doc/Change.log 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,6 +1,8 @@ webERP Change Log -1/5/2012 MTPubRadio: Measurement unit in FormDesigner.php should be points instead of millimeters. -1/5/2012 MTPubRadio: Fixed Purch Order PDF file text of Order Total- Excl tax does not align with amount horizontally. + +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. 29/4/12 Opto/Klaus: SelectWorkOrder.php added start date for the work order to the work orders displayed for selection 29/4/12 David Short: Added EDISendInvoices_Reece.php to send Reece format EDI invoices - approved by Reece (Australian Plumbing retailer) 28/4/2012 Exson: Fixed bugs in MRPCalendar.php which caused working days cannot be calculated correctly. Modified: trunk/includes/tcpdf/2dbarcodes.php =================================================================== --- trunk/includes/tcpdf/2dbarcodes.php 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/2dbarcodes.php 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : 2dbarcodes.php -// Version : 1.0.013 +// Version : 1.0.014 // Begin : 2009-04-07 -// Last Update : 2012-01-12 +// Last Update : 2012-04-30 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - in...@te... // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -37,14 +37,14 @@ * PHP class to creates array representations for 2D barcodes to be used with TCPDF. * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.013 + * @version 1.0.014 */ /** * @class TCPDF2DBarcode * PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org). * @package com.tecnick.tcpdf - * @version 1.0.013 + * @version 1.0.014 * @author Nicola Asuni */ class TCPDF2DBarcode { @@ -202,9 +202,9 @@ if ($this->barcode_array['bcode'][$r][$c] == 1) { // draw a single barcode cell if ($imagick) { - $bar->rectangle($x, $y, ($x + $w), ($y + $h)); + $bar->rectangle($x, $y, ($x + $w - 1), ($y + $h - 1)); } else { - imagefilledrectangle($png, $x, $y, ($x + $w), ($y + $h), $fgcol); + imagefilledrectangle($png, $x, $y, ($x + $w - 1), ($y + $h - 1), $fgcol); } } $x += $w; Modified: trunk/includes/tcpdf/CHANGELOG.TXT =================================================================== --- trunk/includes/tcpdf/CHANGELOG.TXT 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/CHANGELOG.TXT 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,3 +1,55 @@ +5.9.160 (2012-05-03) + - A bug on tcpdf_parser.php was fixed. + +5.9.159 (2012-04-30) + - Barcode classes were updated to fix PNG export Bug (ID: 3522291). + +5.9.158 (2012-04-22) + - Some SVG-related bugs were fixed. + +5.9.157 (2012-04-16) + - Some SVG-related bugs were fixed. + +5.9.156 (2012-04-10) + - Bug item #3515885 "TOC and booklet: left and right page exchanged". + - SetAutoPageBreak(false) now works also in multicolumn mode. + +5.9.155 (2012-04-02) + - Bug item #3512596 "font import problems" was fixed. + - Method addTTFfont() was modified to extract only specified Platform ID and Encoding ID (check the source code documentation). + - All fonts were updated. + - Bug item #3513867 "booklet and setHeaderTemplateAutoreset: header shifted left" was fixed. + - Bug item #3513749 "TCPDF Superscript/Subscript" was fixed. + +5.9.154 (2012-03-29) + - A debug echo was removed. + +5.9.153 (2012-03-28) + - A bug on font conversion was fixed. + - All fonts were updated. + - Method isCharDefined() was added to find if a character is defined on the selected font. + - Method replaceMissingChars() was added to automatically replace missing chars on selected font. + - SetFont() method was fixed. + +5.9.152 (2012-03-23) + - The following overprint methods were added: setOverprint(), getOverprint(). + - Signature of setAlpha() method was changed and method getAlpha() was added. + - stroke-opacity support was added on SVG. + - The following date methods were added: setDocCreationTimestamp(), setDocModificationTimestamp(), getDocCreationTimestamp(), getDocModificationTimestamp(), getFormattedDate(), getTimestamp(). + - Signature of _datestring() method was changed. + - Method getFontBBox() was added. + - Method setPageBoxTypes() was aded. + +5.9.151 (2012-03-22) + - Bug item #3509889 "Transform() distorts PDF" was fixed. + - Precision of real number were extended. + - ComboBox and ListBox methods were fixed. + - Bulgarian language file was added. + - addTOC() method was improved to include bookmark color and font style. + +5.9.150 (2012-03-16) + - A bug related to form fields in PDF/A mode was fixed. + 5.9.149 (2012-02-21) - Bug item #3489933 "SVG Parser treats tspan like text" was fixed. Modified: trunk/includes/tcpdf/README.TXT =================================================================== --- trunk/includes/tcpdf/README.TXT 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/README.TXT 2012-05-04 21:55:53 UTC (rev 5315) @@ -8,8 +8,8 @@ ------------------------------------------------------------ Name: TCPDF -Version: 5.9.149 -Release date: 2012-02-21 +Version: 5.9.160 +Release date: 2012-05-03 Author: Nicola Asuni Copyright (c) 2002-2012: @@ -93,5 +93,5 @@ To get the original distribution archives please check the information on fonts subfolders: - DejaVu fonts 2.33 (Bitstream) - Copyright, License and other info: fonts/dejavu-fonts-ttf-2.33 - GNU FreeFont (GNU-GPLv3) - Copyright, License and other info: fonts/freefont-20100919 - + ============================================================ Modified: trunk/includes/tcpdf/barcodes.php =================================================================== --- trunk/includes/tcpdf/barcodes.php 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/barcodes.php 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : barcodes.php -// Version : 1.0.023 +// Version : 1.0.024 // Begin : 2008-06-09 -// Last Update : 2012-01-14 +// Last Update : 2012-04-30 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - in...@te... // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -37,14 +37,14 @@ * PHP class to creates array representations for common 1D barcodes to be used with TCPDF. * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.023 + * @version 1.0.024 */ /** * @class TCPDFBarcode * PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br> * @package com.tecnick.tcpdf - * @version 1.0.023 + * @version 1.0.024 * @author Nicola Asuni */ class TCPDFBarcode { @@ -201,9 +201,9 @@ $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); // draw a vertical bar if ($imagick) { - $bar->rectangle($x, $y, ($x + $bw), ($y + $bh)); + $bar->rectangle($x, $y, ($x + $bw - 1), ($y + $bh - 1)); } else { - imagefilledrectangle($png, $x, $y, ($x + $bw), ($y + $bh), $fgcol); + imagefilledrectangle($png, $x, $y, ($x + $bw - 1), ($y + $bh - 1), $fgcol); } } $x += $bw; Modified: trunk/includes/tcpdf/tcpdf.php =================================================================== --- trunk/includes/tcpdf/tcpdf.php 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/tcpdf.php 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : tcpdf.php -// Version : 5.9.149 +// Version : 5.9.160 // Begin : 2002-08-03 -// Last Update : 2012-02-21 +// Last Update : 2012-05-03 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - in...@te... // License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 // ------------------------------------------------------------------- @@ -137,7 +137,7 @@ * Tools to encode your unicode fonts are on fonts/utils directory.</p> * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.149 + * @version 5.9.160 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +149,7 @@ * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br> * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.149 + * @version 5.9.160 * @author Nicola Asuni - in...@te... */ class TCPDF { @@ -160,7 +160,7 @@ * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.149'; + private $tcpdf_version = '5.9.160'; // Protected properties @@ -1816,19 +1816,63 @@ protected $pdfa_mode = false; /** - * Document creation date + * Document creation date-time * @protected - * @since 5.9.121 (2011-09-28) + * @since 5.9.152 (2012-03-22) */ - protected $doc_date; + protected $doc_creation_timestamp; /** + * Document modification date-time + * @protected + * @since 5.9.152 (2012-03-22) + */ + protected $doc_modification_timestamp; + + /** * Custom XMP data. * @protected * @since 5.9.128 (2011-10-06) */ protected $custom_xmp = ''; + /** + * Overprint mode array. + * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $overprint = array('OP' => false, 'op' => false, 'OPM' => 0); + + /** + * Alpha mode array. + * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $alpha = array('CA' => 1, 'ca' => 1, 'BM' => '/Normal', 'AIS' => false); + + /** + * Define the page boundaries boxes to be set on document. + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $page_boxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); + + /** + * Set the document producer metadata. + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $pdfproducer; + + /** + * If true print TCPDF meta link. + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $tcpdflink = true; + //------------------------------------------------------------ // METHODS //------------------------------------------------------------ @@ -1941,7 +1985,7 @@ $this->setCellMargins(0, 0, 0, 0); // line width (0.2 mm) $this->LineWidth = 0.57 / $this->k; - $this->linestyleWidth = sprintf('%.2F w', ($this->LineWidth * $this->k)); + $this->linestyleWidth = sprintf('%F w', ($this->LineWidth * $this->k)); $this->linestyleCap = '0 J'; $this->linestyleJoin = '0 j'; $this->linestyleDash = '[] 0 d'; @@ -1953,6 +1997,8 @@ $this->SetCompression(); // set default PDF version number $this->setPDFVersion(); + $this->pdfproducer = "\x54\x43\x50\x44\x46\x20".$this->tcpdf_version."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; + $this->tcpdflink = true; $this->encoding = $encoding; $this->HREF = array(); $this->getFontsList(); @@ -1992,8 +2038,9 @@ $this->default_form_prop = array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 255), 'strokeColor'=>array(128, 128, 128)); // set file ID for trailer $this->file_id = md5($this->getRandomSeed('TCPDF'.$orientation.$unit.$format.$encoding)); - // set document date - $this->doc_date = substr_replace(date('YmdHisO'), '\'', (0 - 2), 0).'\''; + // set document creation and modification timestamp + $this->doc_creation_timestamp = time(); + $this->doc_modification_timestamp = $this->doc_creation_timestamp; // get default graphic vars $this->default_graphic_vars = $this->getGraphicVars(); $this->header_xobj_autoreset = false; @@ -3742,24 +3789,26 @@ $this->AddPage(); } $this->endLayer(); - // save current graphic settings - $gvars = $this->getGraphicVars(); - $this->setEqualColumns(); - $this->lastpage(true); - $this->SetAutoPageBreak(false); - $this->x = 0; - $this->y = $this->h - (1 / $this->k); - $this->lMargin = 0; - $this->_out('q'); - $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; - $this->SetFont($font, '', 1); - $this->setTextRenderingMode(0, false, false); - $msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; - $lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67"; - $this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B'); - $this->_out('Q'); - // restore graphic settings - $this->setGraphicVars($gvars); + if ($this->tcpdflink) { + // save current graphic settings + $gvars = $this->getGraphicVars(); + $this->setEqualColumns(); + $this->lastpage(true); + $this->SetAutoPageBreak(false); + $this->x = 0; + $this->y = $this->h - (1 / $this->k); + $this->lMargin = 0; + $this->_out('q'); + $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; + $this->SetFont($font, '', 1); + $this->setTextRenderingMode(0, false, false); + $msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; + $lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67"; + $this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B'); + $this->_out('Q'); + // restore graphic settings + $this->setGraphicVars($gvars); + } // close page $this->endPage(); // close document @@ -4212,7 +4261,7 @@ // print header template $x = 0; $dx = 0; - if ($this->booklet AND (($this->page % 2) == 0)) { + if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) { // adjust margins for booklet mode $dx = ($this->original_lMargin - $this->original_rMargin); } @@ -4503,19 +4552,19 @@ $pdfcolor = sprintf('/CS%d ', $this->spot_colors[$name]['i']); switch ($type) { case 'draw': { - $pdfcolor .= sprintf('CS %.3F SCN', $tint); + $pdfcolor .= sprintf('CS %F SCN', $tint); $this->DrawColor = $pdfcolor; $this->strokecolor = $spotcolor; break; } case 'fill': { - $pdfcolor .= sprintf('cs %.3F scn', $tint); + $pdfcolor .= sprintf('cs %F scn', $tint); $this->FillColor = $pdfcolor; $this->bgcolor = $spotcolor; break; } case 'text': { - $pdfcolor .= sprintf('cs %.3F scn', $tint); + $pdfcolor .= sprintf('cs %F scn', $tint); $this->TextColor = $pdfcolor; $this->fgcolor = $spotcolor; break; @@ -4674,7 +4723,7 @@ // Grey scale $col1 = max(0, min(255, $col1)); $intcolor = array('G' => $col1); - $pdfcolor = sprintf('%.3F ', ($col1 / 255)); + $pdfcolor = sprintf('%F ', ($col1 / 255)); $suffix = 'g'; } elseif ($col4 == -1) { // RGB @@ -4682,7 +4731,7 @@ $col2 = max(0, min(255, $col2)); $col3 = max(0, min(255, $col3)); $intcolor = array('R' => $col1, 'G' => $col2, 'B' => $col3); - $pdfcolor = sprintf('%.3F %.3F %.3F ', ($col1 / 255), ($col2 / 255), ($col3 / 255)); + $pdfcolor = sprintf('%F %F %F ', ($col1 / 255), ($col2 / 255), ($col3 / 255)); $suffix = 'rg'; } else { $col1 = max(0, min(100, $col1)); @@ -4692,7 +4741,7 @@ if (empty($name)) { // CMYK $intcolor = array('C' => $col1, 'M' => $col2, 'Y' => $col3, 'K' => $col4); - $pdfcolor = sprintf('%.3F %.3F %.3F %.3F ', ($col1 / 100), ($col2 / 100), ($col3 / 100), ($col4 / 100)); + $pdfcolor = sprintf('%F %F %F %F ', ($col1 / 100), ($col2 / 100), ($col3 / 100), ($col4 / 100)); $suffix = 'k'; } else { // SPOT COLOR @@ -4744,17 +4793,17 @@ switch (count($c)) { case 4: { // CMYK - $color .= sprintf('%.3F %.3F %.3F %.3F', (max(0, min(100, floatval($c[0]))) / 100), (max(0, min(100, floatval($c[1]))) / 100), (max(0, min(100, floatval($c[2]))) / 100), (max(0, min(100, floatval($c[3]))) / 100)); + $color .= sprintf('%F %F %F %F', (max(0, min(100, floatval($c[0]))) / 100), (max(0, min(100, floatval($c[1]))) / 100), (max(0, min(100, floatval($c[2]))) / 100), (max(0, min(100, floatval($c[3]))) / 100)); break; } case 3: { // RGB - $color .= sprintf('%.3F %.3F %.3F', (max(0, min(255, floatval($c[0]))) / 255), (max(0, min(255, floatval($c[1]))) / 255), (max(0, min(255, floatval($c[2]))) / 255)); + $color .= sprintf('%F %F %F', (max(0, min(255, floatval($c[0]))) / 255), (max(0, min(255, floatval($c[1]))) / 255), (max(0, min(255, floatval($c[2]))) / 255)); break; } case 1: { // grayscale - $color .= sprintf('%.3F', (max(0, min(255, floatval($c[0]))) / 255)); + $color .= sprintf('%F', (max(0, min(255, floatval($c[0]))) / 255)); break; } } @@ -5230,11 +5279,14 @@ * @since 1.0 * @see AddFont(), SetFontSize() */ - public function SetFont($family, $style='', $size=0, $fontfile='', $subset='default', $out=true) { + public function SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) { //Select a font; size given in points - if ($size == 0) { + if ($size === null) { $size = $this->FontSizePt; } + if ($size < 0) { + $size = 0; + } // try to add font (if not already added) $fontdata = $this->AddFont($family, $style, $fontfile, $subset); $this->FontFamily = $fontdata['family']; @@ -5281,11 +5333,52 @@ $this->FontAscent = ($font_ascent / $this->k); $this->FontDescent = ($font_descent / $this->k); if ($out AND ($this->page > 0) AND (isset($this->CurrentFont['i']))) { - $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); + $this->_out(sprintf('BT /F%d %F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); } } /** + * Returns the bounding box of the current font in user units. + * @return array + * @public + * @since 5.9.152 (2012-03-23) + */ + public function getFontBBox() { + $result = array(); + if (isset($this->CurrentFont['desc']['FontBBox'])) { + $bbox = explode(' ', substr($this->CurrentFont['desc']['FontBBox'], 1, -1)); + foreach ($bbox as $v) { + $result[] = (intval($v) * $this->FontSize / 1000); + } + } else { + // Find max width + if (isset($this->CurrentFont['desc']['MaxWidth'])) { + $maxw = (intval($this->CurrentFont['desc']['MaxWidth']) * $this->FontSize / 1000); + } else { + $maxw = 0; + if (isset($this->CurrentFont['desc']['MissingWidth'])) { + $maxw = max($maxw, $this->CurrentFont['desc']['MissingWidth']); + } + if (isset($this->CurrentFont['desc']['AvgWidth'])) { + $maxw = max($maxw, $this->CurrentFont['desc']['AvgWidth']); + } + if (isset($this->CurrentFont['dw'])) { + $maxw = max($maxw, $this->CurrentFont['dw']); + } + foreach ($this->CurrentFont['cw'] as $char => $w) { + $maxw = max($maxw, $w); + } + if ($maxw == 0) { + $maxw = 600; + } + $maxw = ($maxw * $this->FontSize / 1000); + } + $result = array(0, -$this->FontDescent, $maxw, $this->FontAscent); + } + return $result; + } + + /** * Return the font descent value * @param $font (string) font name * @param $style (string) font style @@ -5328,6 +5421,70 @@ } /** + * Return the font descent value + * @param $char (mixed) Character to check (integer value or string) + * @param $font (string) Font name (family name). + * @param $style (string) Font style. + * @return (boolean) true if the char is defined, false otherwise. + * @public + * @since 5.9.153 (2012-03-28) + */ + public function isCharDefined($char, $font='', $style='') { + if (is_string($char)) { + // get character code + $char = $this->UTF8StringToArray($char); + $char = $char[0]; + } + if ($this->empty_string($font)) { + $font = $this->FontFamily; + } + $fontdata = $this->AddFont($font, $style); + $fontinfo = $this->getFontBuffer($fontdata['fontkey']); + return (isset($fontinfo['cw'][intval($char)])); + } + + /** + * Replace missing font characters on selected font with specified substitutions. + * @param $text (string) Text to process. + * @param $font (string) Font name (family name). + * @param $style (string) Font style. + * @param $subs (array) Array of possible character substitutions. The key is the character to check (integer value) and the value is a single intege value or an array of possible substitutes. + * @return (string) Processed text. + * @public + * @since 5.9.153 (2012-03-28) + */ + public function replaceMissingChars($text, $font='', $style='', $subs=array()) { + if (empty($subs)) { + return $text; + } + if ($this->empty_string($font)) { + $font = $this->FontFamily; + } + $fontdata = $this->AddFont($font, $style); + $fontinfo = $this->getFontBuffer($fontdata['fontkey']); + $uniarr = $this->UTF8StringToArray($text); + foreach ($uniarr as $k => $chr) { + if (!isset($fontinfo['cw'][$chr])) { + // this character is missing on the selected font + if (isset($subs[$chr])) { + // we have available substitutions + if (is_array($subs[$chr])) { + foreach($subs[$chr] as $s) { + if (isset($fontinfo['cw'][$s])) { + $uniarr[$k] = $s; + break; + } + } + } elseif (isset($fontinfo['cw'][$subs[$chr]])) { + $uniarr[$k] = $subs[$chr]; + } + } + } + } + return $this->UniArrSubString($this->UTF8ArrayToUniArray($uniarr)); + } + + /** * Defines the default monospaced font. * @param $font (string) Font name. * @public @@ -5561,7 +5718,7 @@ if ($this->current_column < ($this->num_columns - 1)) { // go to next column $this->selectColumn($this->current_column + 1); - } else { + } elseif ($this->AutoPageBreak) { // add a new page $this->AddPage(); // set first column @@ -5854,7 +6011,7 @@ } else { $xk = ($x * $k); } - $s .= sprintf('%.2F %.2F %.2F %.2F re %s ', $xk, (($this->h - $y) * $k), ($w * $k), (-$h * $k), $op); + $s .= sprintf('%F %F %F %F re %s ', $xk, (($this->h - $y) * $k), ($w * $k), (-$h * $k), $op); } // draw borders $s .= $this->getCellBorder($x, $y, $w, $h, $border); @@ -5927,17 +6084,17 @@ } if ($this->font_stretching != 100) { // apply font stretching - $rs .= sprintf('BT %.2F Tz ET ', $this->font_stretching); + $rs .= sprintf('BT %F Tz ET ', $this->font_stretching); } if ($this->font_spacing != 0) { // increase/decrease font spacing - $rs .= sprintf('BT %.2F Tc ET ', ($this->font_spacing * $this->k)); + $rs .= sprintf('BT %F Tc ET ', ($this->font_spacing * $this->k)); } if ($this->ColorFlag AND ($this->textrendermode < 4)) { $s .= 'q '.$this->TextColor.' '; } // rendering mode - $s .= sprintf('BT %d Tr %.2F w ET ', $this->textrendermode, $this->textstrokewidth); + $s .= sprintf('BT %d Tr %F w ET ', $this->textrendermode, $this->textstrokewidth); // count number of spaces $ns = substr_count($txt, chr(32)); // Justification @@ -5953,7 +6110,7 @@ $spacewidth /= ($this->font_stretching / 100); } // set word position to be used with TJ operator - $txt2 = str_replace(chr(0).chr(32), ') '.sprintf('%.3F', $spacewidth).' (', $txt2); + $txt2 = str_replace(chr(0).chr(32), ') '.sprintf('%F', $spacewidth).' (', $txt2); $unicode_justification = true; } else { // get string width @@ -5965,7 +6122,7 @@ $spacewidth /= ($this->font_stretching / 100); } // set word spacing - $rs .= sprintf('BT %.3F Tw ET ', $spacewidth); + $rs .= sprintf('BT %F Tw ET ', $spacewidth); } $width = $w - $this->cell_padding['L'] - $this->cell_padding['R']; } @@ -6009,7 +6166,7 @@ } $xdk = $xdx * $k; // print text - $s .= sprintf('BT %.2F %.2F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * $k), $txt2); + $s .= sprintf('BT %F %F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * $k), $txt2); if (isset($uniblock)) { // print overlapping characters as separate string $xshift = 0; // horizontal shift @@ -6027,7 +6184,7 @@ // character to print $topchr = $this->arrUTF8ToUTF16BE($uniarr, false); $topchr = $this->_escape($topchr); - $s .= sprintf(' BT %.2F %.2F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr); + $s .= sprintf(' BT %F %F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr); } } } @@ -6193,85 +6350,85 @@ } // draw borders by case if (strlen($border) == 4) { - $s .= sprintf('%.2F %.2F %.2F %.2F re S ', $xT, $yT, ($w * $k), (-$h * $k)); + $s .= sprintf('%F %F %F %F re S ', $xT, $yT, ($w * $k), (-$h * $k)); } elseif (strlen($border) == 3) { if (strpos($border,'B') === false) { // LTR - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif (strpos($border,'L') === false) { // TRB - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } elseif (strpos($border,'T') === false) { // RBL - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; } elseif (strpos($border,'R') === false) { // BLT - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; } } elseif (strlen($border) == 2) { if ((strpos($border,'L') !== false) AND (strpos($border,'T') !== false)) { // LT - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; } elseif ((strpos($border,'T') !== false) AND (strpos($border,'R') !== false)) { // TR - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif ((strpos($border,'R') !== false) AND (strpos($border,'B') !== false)) { // RB - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } elseif ((strpos($border,'B') !== false) AND (strpos($border,'L') !== false)) { // BL - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; } elseif ((strpos($border,'L') !== false) AND (strpos($border,'R') !== false)) { // LR - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif ((strpos($border,'T') !== false) AND (strpos($border,'B') !== false)) { // TB - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } } else { // strlen($border) == 1 if (strpos($border,'L') !== false) { // L - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; } elseif (strpos($border,'T') !== false) { // T - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; } elseif (strpos($border,'R') !== false) { // R - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif (strpos($border,'B') !== false) { // B - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } } @@ -7755,7 +7912,7 @@ $tmp = array(); if (preg_match('/[\s]+width[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) { $ow = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, false); - $owu = sprintf('%.3F', ($ow * $dpi / 72)).$this->pdfunit; + $owu = sprintf('%F', ($ow * $dpi / 72)).$this->pdfunit; $svgtag = preg_replace('/[\s]+width[\s]*=[\s]*"[^"]*"/si', ' width="'.$owu.'"', $svgtag, 1); } else { $ow = $w; @@ -7763,7 +7920,7 @@ $tmp = array(); if (preg_match('/[\s]+height[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) { $oh = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, false); - $ohu = sprintf('%.3F', ($oh * $dpi / 72)).$this->pdfunit; + $ohu = sprintf('%F', ($oh * $dpi / 72)).$this->pdfunit; $svgtag = preg_replace('/[\s]+height[\s]*=[\s]*"[^"]*"/si', ' height="'.$ohu.'"', $svgtag, 1); } else { $oh = $h; @@ -7772,7 +7929,7 @@ if (!preg_match('/[\s]+viewBox[\s]*=[\s]*"[\s]*([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]*"/si', $svgtag, $tmp)) { $vbw = ($ow * $this->imgscale * $this->k); $vbh = ($oh * $this->imgscale * $this->k); - $vbox = sprintf(' viewBox="0 0 %.3F %.3F" ', $vbw, $vbh); + $vbox = sprintf(' viewBox="0 0 %F %F" ', $vbw, $vbh); $svgtag = $vbox.$svgtag; } $svgimg = preg_replace('/<svg([^\>]*)>/si', '<svg'.$svgtag.'>', $svgimg, 1); @@ -7856,7 +8013,7 @@ $xkimg = $ximg * $this->k; if (!$alt) { // only non-alternative immages will be set - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%u Do Q', ($w * $this->k), ($h * $this->k), $xkimg, (($this->h - ($y + $h)) * $this->k), $info['i'])); + $this->_out(sprintf('q %F 0 0 %F %F %F cm /I%u Do Q', ($w * $this->k), ($h * $this->k), $xkimg, (($this->h - ($y + $h)) * $this->k), $info['i'])); } if (!empty($border)) { $bx = $this->x; @@ -8843,6 +9000,21 @@ } /** + * Set page boxes to be included on page descriptions. + * @param $boxes (array) Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'). + * @protected + */ + protected function setPageBoxTypes($boxes) { + $validboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); + $this->page_boxes = array(); + foreach ($boxes as $box) { + if (in_array($box, $validboxes)) { + $this->page_boxes[] = $box; + } + } + } + + /** * Output pages (and replace page number aliases). * @protected */ @@ -8904,22 +9076,21 @@ $out = '<<'; $out .= ' /Type /Page'; $out .= ' /Parent 1 0 R'; - $out .= ' /LastModified '.$this->_datestring(); + $out .= ' /LastModified '.$this->_datestring(0, $this->doc_modification_timestamp); $out .= ' /Resources 2 0 R'; - $boxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); - foreach ($boxes as $box) { + foreach ($this->page_boxes as $box) { $out .= ' /'.$box; - $out .= sprintf(' [%.2F %.2F %.2F %.2F]', $this->pagedim[$n][$box]['llx'], $this->pagedim[$n][$box]['lly'], $this->pagedim[$n][$box]['urx'], $this->pagedim[$n][$box]['ury']); + $out .= sprintf(' [%F %F %F %F]', $this->pagedim[$n][$box]['llx'], $this->pagedim[$n][$box]['lly'], $this->pagedim[$n][$box]['urx'], $this->pagedim[$n][$box]['ury']); } if (isset($this->pagedim[$n]['BoxColorInfo']) AND !empty($this->pagedim[$n]['BoxColorInfo'])) { $out .= ' /BoxColorInfo <<'; - foreach ($boxes as $box) { + foreach ($this->page_boxes as $box) { if (isset($this->pagedim[$n]['BoxColorInfo'][$box])) { $out .= ' /'.$box.' <<'; if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['C'])) { $color = $this->pagedim[$n]['BoxColorInfo'][$box]['C']; $out .= ' /C ['; - $out .= sprintf(' %.3F %.3F %.3F', $color[0]/255, $color[1]/255, $color[2]/255); + $out .= sprintf(' %F %F %F', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255)); $out .= ' ]'; } if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['W'])) { @@ -8932,7 +9103,7 @@ $dashes = $this->pagedim[$n]['BoxColorInfo'][$box]['D']; $out .= ' /D ['; foreach ($dashes as $dash) { - $out .= sprintf(' %.3F', ($dash * $this->k)); + $out .= sprintf(' %F', ($dash * $this->k)); } $out .= ' ]'; } @@ -9116,7 +9287,7 @@ $b = $this->pagedim[$n]['h'] - (($pl['y'] + $pl['h']) * $this->k); $c = $pl['w'] * $this->k; $d = $pl['h'] * $this->k; - $rect = sprintf('%.2F %.2F %.2F %.2F', $a, $b, $a+$c, $b+$d); + $rect = sprintf('%F %F %F %F', $a, $b, $a+$c, $b+$d); // create new annotation object $annots = '<</Type /Annot'; $annots .= ' /Subtype /'.$pl['opt']['subtype']; @@ -9129,7 +9300,7 @@ $annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id); $annots .= ' /P '.$this->page_obj_id[$n].' 0 R'; $annots .= ' /NM '.$this->_datastring(sprintf('%04u-%04u', $n, $key), $annot_obj_id); - $annots .= ' /M '.$this->_datestring($annot_obj_id); + $annots .= ' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp); if (isset($pl['opt']['f'])) { $fval = 0; if (is_array($pl['opt']['f'])) { @@ -9265,7 +9436,7 @@ $annots .= ' /S /S'; } if (isset($pl['opt']['be']['i']) AND ($pl['opt']['be']['i'] >= 0) AND ($pl['opt']['be']['i'] <= 2)) { - $annots .= ' /I '.sprintf(' %.4F', $pl['opt']['be']['i']); + $annots .= ' /I '.sprintf(' %F', $pl['opt']['be']['i']); } $annots .= '>>'; } @@ -9282,12 +9453,12 @@ } //$annots .= ' /Popup '; if (isset($pl['opt']['ca'])) { - $annots .= ' /CA '.sprintf('%.4F', floatval($pl['opt']['ca'])); + $annots .= ' /CA '.sprintf('%F', floatval($pl['opt']['ca'])); } if (isset($pl['opt']['rc'])) { $annots .= ' /RC '.$this->_textstring($pl['opt']['rc'], $annot_obj_id); } - $annots .= ' /CreationDate '.$this->_datestring($annot_obj_id); + $annots .= ' /CreationDate '.$this->_datestring($annot_obj_id, $this->doc_creation_timestamp); //$annots .= ' /IRT '; if (isset($pl['opt']['subj'])) { $annots .= ' /Subj '.$this->_textstring($pl['opt']['subj'], $annot_obj_id); @@ -9340,7 +9511,7 @@ // internal link $l = $this->links[$pl['txt']]; if (isset($this->page_obj_id[($l[0])])) { - $annots .= sprintf(' /Dest [%u 0 R /XYZ 0 %.2F null]', $this->page_obj_id[($l[0])], ($this->pagedim[$l[0]]['h'] - ($l[1] * $this->k))); + $annots .= sprintf(' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[($l[0])], ($this->pagedim[$l[0]]['h'] - ($l[1] * $this->k))); } } $hmodes = array('N', 'I', 'O', 'P'); @@ -9369,7 +9540,7 @@ if (isset($pl['opt']['cl']) AND is_array($pl['opt']['cl'])) { $annots .= ' /CL ['; foreach ($pl['opt']['cl'] as $cl) { - $annots .= sprintf('%.4F ', $cl * $this->k); + $annots .= sprintf('%F ', $cl * $this->k); } $annots .= ']'; } @@ -9382,7 +9553,7 @@ $r = $pl['opt']['rd'][1] * $this->k; $t = $pl['opt']['rd'][2] * $this->k; $b = $pl['opt']['rd'][3] * $this->k; - $annots .= ' /RD ['.sprintf('%.2F %.2F %.2F %.2F', $l, $r, $t, $b).']'; + $annots .= ' /RD ['.sprintf('%F %F %F %F', $l, $r, $t, $b).']'; } if (isset($pl['opt']['le']) AND in_array($pl['opt']['le'], $lineendings)) { $annots .= ' /LE /'.$pl['opt']['le']; @@ -9523,7 +9694,7 @@ $annots .= ' /S /'.$pl['opt']['mk']['if']['s']; } if (isset($pl['opt']['mk']['if']['a']) AND (is_array($pl['opt']['mk']['if']['a'])) AND !empty($pl['opt']['mk']['if']['a'])) { - $annots .= sprintf(' /A [%.2F %.2F]', $pl['opt']['mk']['if']['a'][0], $pl['opt']['mk']['if']['a'][1]); + $annots .= sprintf(' /A [%F %F]', $pl['opt']['mk']['if']['a'][0], $pl['opt']['mk']['if']['a'][1]); } if (isset($pl['opt']['mk']['if']['fb']) AND ($pl['opt']['mk']['if']['fb'])) { $annots .= ' /FB true'; @@ -9569,7 +9740,7 @@ if (is_array($pl['opt']['v'])) { foreach ($pl['opt']['v'] AS $optval) { if (is_float($optval)) { - $optval = sprintf('%.2F', $optval); + $optval = sprintf('%F', $optval); } $annots .= ' '.$optval; } @@ -9582,7 +9753,7 @@ if (is_array($pl['opt']['dv'])) { foreach ($pl['opt']['dv'] AS $optval) { if (is_float($optval)) { - $optval = sprintf('%.2F', $optval); + $optval = sprintf('%F', $optval); } $annots .= ' '.$optval; } @@ -9595,7 +9766,7 @@ if (is_array($pl['opt']['rv'])) { foreach ($pl['opt']['rv'] AS $optval) { if (is_float($optval)) { - $optval = sprintf('%.2F', $optval); + $optval = sprintf('%F', $optval); } $annots .= ' '.$optval; } @@ -9690,7 +9861,7 @@ $stream = gzcompress($stream); $out .= ' /Filter /FlateDecode'; } - $rect = sprintf('%.2F %.2F', $w, $h); + $rect = sprintf('%F %F', $w, $h); $out .= ' /BBox [0 0 '.$rect.']'; $out .= ' /Matrix [1 0 0 1 0 0]'; $out .= ' /Resources 2 0 R'; @@ -9733,8 +9904,8 @@ /** * Get SHORT from string (Big Endian 16-bit signed integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param $str (string) String from where to extract value. + * @param $offset (int) Point from where to read the data. * @return int 16 bit value * @author Nicola Asuni * @protected @@ -9747,8 +9918,8 @@ /** * Get FWORD from string (Big Endian 16-bit signed integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param $str (string) String from where to extract value. + * @param $offset (int) Point from where to read the data. * @return int 16 bit value * @author Nicola Asuni * @protected @@ -9830,17 +10001,19 @@ /** * Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable). - * @param $fontfile (string) TrueType or Type1 font file (full path). + * @param $fontfile (string) Font file (full path). * @param $fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional. * @param $enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats. * @param $flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font. * @param $outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder. + * @param $platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1). + * @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4. * @return (string) TCPDF font name. * @author Nicola Asuni * @public * @since 5.9.123 (2010-09-30) */ - public function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='') { + public function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1) { if (!file_exists($fontfile)) { $this->Error('Could not find file: '.$fontfile.''); } @@ -10309,220 +10482,216 @@ // ---------- get CIDToGIDMap ---------- $ctg = array(); foreach ($encodingTables as $enctable) { - if (($enctable['platformID'] == 3) AND ($enctable['encodingID'] == 0)) { - $modesymbol = true; - } else { - $modesymbol = false; - } - $offset = $table['cmap']['offset'] + $enctable['offset']; - $format = $this->_getUSHORT($font, $offset); - $offset += 2; - switch ($format) { - case 0: { // Format 0: Byte encoding table - $offset += 4; // skip length and version/language - for ($c = 0; $c < 256; ++$c) { - $g = $this->_getBYTE($font, $offset); - $ctg[$c] = $g; - ++$offset; + // get only specified Platform ID and Encoding ID + if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) { + $offset = $table['cmap']['offset'] + $enctable['offset']; + $format = $this->_getUSHORT($font, $offset); + $offset += 2; + switch ($format) { + case 0: { // Format 0: Byte encoding table + $offset += 4; // skip length and version/language + for ($c = 0; $c < 256; ++$c) { + $g = $this->_getBYTE($font, $offset); + $ctg[$c] = $g; + ++$offset; + } + break; } - break; - } - case 2: { // Format 2: High-byte mapping through table - $offset += 4; // skip length and version/language - $numSubHeaders = 0; - for ($i = 0; $i < 256; ++$i) { - // Array that maps high bytes to subHeaders: value is subHeader index * 8. - $subHeaderKeys[$i] = ($this->_getUSHORT($font, $offset) / 8); - $offset += 2; - if ($numSubHeaders < $subHeaderKeys[$i]) { - $numSubHeaders = $subHeaderKeys[$i]; + case 2: { // Format 2: High-byte mapping through table + $offset += 4; // skip length and version/language + $numSubHeaders = 0; + for ($i = 0; $i < 256; ++$i) { + // Array that maps high bytes to subHeaders: value is subHeader index * 8. + $subHeaderKeys[$i] = ($this->_getUSHORT($font, $offset) / 8); + $offset += 2; + if ($numSubHeaders < $subHeaderKeys[$i]) { + $numSubHeaders = $subHeaderKeys[$i]; + } } + // the number of subHeaders is equal to the max of subHeaderKeys + 1 + ++$numSubHeaders; + // read subHeader structures + $subHeaders = array(); + $numGlyphIndexArray = 0; + for ($k = 0; $k < $numSubHeaders; ++$k) { + $subHeaders[$k]['firstCode'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['entryCount'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['idDelta'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['idRangeOffset'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8)); + $subHeaders[$k]['idRangeOffset'] /= 2; + $numGlyphIndexArray += $subHeaders[$k]['entryCount']; + } + for ($k = 0; $k < $numGlyphIndexArray; ++$k) { + $glyphIndexArray[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + for ($i = 0; $i < 256; ++$i) { + $k = $subHeaderKeys[$i]; + if ($k == 0) { + // one byte code + $c = $i; + $g = $glyphIndexArray[0]; + $ctg[$c] = $g; + } else { + // two bytes code + $start_byte = $subHeaders[$k]['firstCode']; + $end_byte = $start_byte + $subHeaders[$k]['entryCount']; + for ($j = $start_byte; $j < $end_byte; ++$j) { + // combine high and low bytes + $c = (($i << 8) + $j); + $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); + $g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536; + if ($g < 0) { + $g = 0; + } + $ctg[$c] = $g; + } + } + } + break; } - // the number of subHeaders is equal to the max of subHeaderKeys + 1 - ++$numSubHeaders; - // read subHeader structures - $subHeaders = array(); - $numGlyphIndexArray = 0; - for ($k = 0; $k < $numSubHeaders; ++$k) { - $subHeaders[$k]['firstCode'] = $this->_getUSHORT($font, $offset); + case 4: { // Format 4: Segment mapping to delta values + $length = $this->_getUSHORT($font, $offset); $offset += 2; - $subHeaders[$k]['entryCount'] = $this->_getUSHORT($font, $offset); + $offset += 2; // skip version/language + $segCount = ($this->_getUSHORT($font, $offset) / 2); $offset += 2; - $subHeaders[$k]['idDelta'] = $this->_getSHORT($font, $offset); - $offset += 2; - $subHeaders[$k]['idRangeOffset'] = $this->_getUSHORT($font, $offset); - $offset += 2; - $subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8)); - $subHeaders[$k]['idRangeOffset'] /= 2; - $numGlyphIndexArray += $subHeaders[$k]['entryCount']; - } - for ($k = 0; $k < $numGlyphIndexArray; ++$k) { - $glyphIndexArray[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - for ($i = 0; $i < 256; ++$i) { - $k = $subHeaderKeys[$i]; - if ($k == 0) { - // one byte code - $c = $i; - $g = $glyphIndexArray[0]; - $ctg[$c] = $g; - } else { - // two bytes code - $start_byte = $subHeaders[$k]['firstCode']; - $end_byte = $start_byte + $subHeaders[$k]['entryCount']; - for ($j = $start_byte; $j < $end_byte; ++$j) { - // combine high and low bytes - $c = (($i << 8) + $j); - $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); - $g = $glyphIndexArray[$idRangeOffset]; - $g += ($idDelta[$k] - 65536); + $offset += 6; // skip searchRange, entrySelector, rangeShift + $endCount = array(); // array of end character codes for each segment + for ($k = 0; $k < $segCount; ++$k) { + $endCount[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $offset += 2; // skip reservedPad + $startCount = array(); // array of start character codes for each segment + for ($k = 0; $k < $segCount; ++$k) { + $startCount[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $idDelta = array(); // delta for all character codes in segment + for ($k = 0; $k < $segCount; ++$k) { + $idDelta[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $idRangeOffset = array(); // Offsets into glyphIdArray or 0 + for ($k = 0; $k < $segCount; ++$k) { + $idRangeOffset[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $gidlen = ($length / 2) - 8 - (4 * $segCount); + $glyphIdArray = array(); // glyph index array + for ($k = 0; $k < $gidlen; ++$k) { + $glyphIdArray[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + for ($k = 0; $k < $segCount; ++$k) { + for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { + if ($idRangeOffset[$k] == 0) { + $g = ($idDelta[$k] + $c) % 65536; + } else { + $gid = (($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k)); + $g = ($glyphIdArray[$gid] + $idDelta[$k]) % 65536; + } if ($g < 0) { $g = 0; } $ctg[$c] = $g; } } + break; } - break; - } - case 4: { // Format 4: Segment mapping to delta values - $length = $this->_getUSHORT($font, $offset); - $offset += 2; - $offset += 2; // skip version/language - $segCount = ($this->_getUSHORT($font, $offset) / 2); - $offset += 2; - $offset += 6; // skip searchRange, entrySelector, rangeShift - $endCount = array(); // array of end character codes for each segment - for ($k = 0; $k < $segCount; ++$k) { - $endCount[$k] = $this->_getUSHORT($font, $offset); + case 6: { // Format 6: Trimmed table mapping + $offset += 4; // skip length and version/language + $firstCode = $this->_getUSHORT($font, $offset); $offset += 2; - } - $offset += 2; // skip reservedPad - $startCount = array(); // array of start character codes for each segment - for ($k = 0; $k < $segCount; ++$k) { - $startCount[$k] = $this->_getUSHORT($font, $offset); + $entryCount = $this->_getUSHORT($font, $offset); $offset += 2; + for ($k = 0; $k < $entryCount; ++$k) { + $c = ($k + $firstCode); + $g = $this->_getUSHORT($font, $offset); + $offset += 2; + $ctg[$c] = $g; + } + break; } - $idDelta = array(); // delta for all character codes in segment - for ($k = 0; $k < $segCount; ++$k) { - $idDelta[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - $idRangeOffset = array(); // Offsets into glyphIdArray or 0 - for ($k = 0; $k < $segCount; ++$k) { - $idRangeOffset[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - $gidlen = ($length / 2) - 8 - (4 * $segCount); - $glyphIdArray = array(); // glyph index array - for ($k = 0; $k < $gidlen; ++$k) { - $glyphIdArray[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - for ($k = 0; $k < $segCount; ++$k) { - for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { - if ($idRangeOffset[$k] == 0) { - $g = $c; - } else { - $gid = (($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k)); - $g = $glyphIdArray[$gid]; + case 8: { // Format 8: Mixed 16-bit and 32-bit coverage + $offset += 10; // skip reserved, length and version/language + for ($k = 0; $k < 8192; ++$k) { + $is32[$k] = $this->_getBYTE($font, $offset); + ++$offset; + } + $nGroups = $this->_getULONG($font, $offset); + $offset += 4; + for ($i = 0; $i < $nGroups; ++$i) { + $startCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $endCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $startGlyphID = $this->_getULONG($font, $offset); + $offset += 4; + for ($k = $startCharCode; $k <= $endCharCode; ++$k) { + $is32idx = floor($c / 8); + if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) { + $c = $k; + } else { + // 32 bit format + // convert to decimal (http://www.unicode.org/faq//utf_bom.html#utf16-4) + //LEAD_OFFSET = (0xD800 - (0x10000 >> 10)) = 55232 + //SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00) = -56613888 + $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888; + } + $ctg[$c] = 0; + ++$startGlyphID; } - $g += ($idDelta[$k] - 65536); - if ($g < 0) { - $g = 0; - } - $ctg[$c] = $g; } + break; } - break; - } - case 6: { // Format 6: Trimmed table mapping - $offset += 4; // skip length and version/language - $firstCode = $this->_getUSHORT($font, $offset); - $offset += 2; - $entryCount = $this->_getUSHORT($font, $offset); - $offset += 2; - for ($k = 0; $k < $entryCount; ++$k) { - $c = ($k + $firstCode); - $g = $this->_getUSHORT($font, $offset); - $ctg[$c] = $g; - $offset += 2; - } - break; - } - case 8: { // Format 8: Mixed 16-bit and 32-bit coverage - $offset += 10; // skip reserved, length and version/language - for ($k = 0; $k < 8192; ++$k) { - $is32[$k] = $this->_getBYTE($font, $offset); - ++$offset; - } - $nGroups = $this->_getULONG($font, $offset); - $offset += 4; - for ($i = 0; $i < $nGroups; ++$i) { + case 10: { // Format 10: Trimmed array + $offset += 10; // skip reserved, length and version/language $startCharCode = $this->_getULONG($font, $offset); $offset += 4; - $endCharCode = $this->_getULONG($font, $offset); + $numChars = $this->_getULONG($font, $offset); $offset += 4; - $startGlyphID = $this->_getULONG($font, $offset); - $offset += 4; - for ($k = $startCharCode; $k <= $endCharCode; ++$k) { - $is32idx = floor($c / 8); - if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) { - $c = $k; - } else { - // 32 bit format - // convert to decimal (http://www.unicode.org/faq//utf_bom.html#utf16-4) - //LEAD_OFFSET = (0xD800 - (0x10000 >> 10)) = 55232 - //SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00) = -56613888 - $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888; - } + for ($k = 0; $k < $numChars; ++$k) { + $c = ($k + $startCharCode); + $g = $this->_getUSHORT($font, $offset); $ctg[$c] = $g; - ++$startGlyphID; + $offset += 2; } + break; } - break; - } - case 10: { // Format 10: Trimmed array - $offset += 10; // skip reserved, length and version/language - $startCharCode = $this->_getULONG($font, $offset); - $offset += 4; - $numChars = $this->_getULONG($font, $offset); - $offset += 4; - for ($k = 0; $k < $numChars; ++$k) { - $c = ($k + $startCharCode); - $g = $this->_getUSHORT($font, $offset); - $ctg[$c] = $g; - $offset += 2; - } - break; - } - case 12: { // Format 12: Segmented coverage - $offset += 10; // skip length and version/language - $nGroups = $this->_getULONG($font, $offset); - $offset += 4; - for ($k = 0; $k < $nGroups; ++$k) { - $startCharCode = $this->_getULONG($font, $offset); + case 12: { // Format 12: Segmented coverage + $offset += 10; // skip length and version/language + $nGroups = $this->_getULONG($font, $offset); $offset += 4; - $endCharCode = $this->_getULONG($font, $offset); - $offset += 4; - $startGlyphCode = $this->_getULONG($font, $offset); - $offset += 4; - for ($c = $startCharCode; $c <= $endCharCode; ++$c) { - $ctg[$c] = $startGlyphCode; - ++$startGlyphCode; + for ($k = 0; $k < $nGroups; ++$k) { + $startCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $endCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $startGlyphCode = $this->_getULONG($font, $offset); + $offset += 4; + for ($c = $startCharCode; $c <= $endCharCode; ++$c) { + $ctg[$c] = $startGlyphCode; + ++$startGlyphCode; + } } + break; } - break; + case 13: { // Format 13: Many-to-one range mappings + // to be implemented ... + break; + } + case 14: { // Format 14: Unicode Variation Sequences + // to be implemented ... + break; + } } - case 13: { // Format 13: Many-to-one range mappings - // to be implemented ... - break; - } - case 14: { // Format 14: Unicode Variation Sequences - // to be implemented ... - break; - } } } if (!isset($ctg[0])) { @@ -10741,11 +10910,7 @@ $offset += 4; } foreach ($encodingTables as $enctable) { - if (($enctable['platformID'] == 3) AND ($enctable['encodingID'] == 0)) { - $modesymbol = true; - } else { - $modesymbol = false; - } + // get all platforms and encodings $offset = $table['cmap']['offset'] + $enctable['offset']; $format = $this->_getUSHORT($font, $offset); $offset += 2; @@ -10782,7 +10947,7 @@ $offset += 2; $subHeaders[$k]['entryCount'] = $this->_getUSHORT($font, $offset); $offset += 2; - $subHeaders[$k]['idDelta'] = $this->_getSHORT($font, $offset); + $subHeaders[$k]['idDelta'] = $this->_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idRangeOffset'] = $this->_getUSHORT($font, $offset); $offset += 2; @@ -10812,8 +10977,7 @@ $c = (($i << 8) + $j); if (isset($subsetchars[$c])) { $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); - $g = $glyphIndexArray[$idRangeOffset]; - $g += ($idDelta[$k] - 65536); + $g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536; if ($g < 0) { $g = 0; } @@ -10862,12 +11026,11 @@... [truncated message content] |
From: <dai...@us...> - 2012-05-04 21:56:03
|
Revision: 5315 http://web-erp.svn.sourceforge.net/web-erp/?rev=5315&view=rev Author: daintree Date: 2012-05-04 21:55:53 +0000 (Fri, 04 May 2012) Log Message: ----------- update to 5.9.160 tcpdf Modified Paths: -------------- trunk/doc/Change.log trunk/includes/tcpdf/2dbarcodes.php trunk/includes/tcpdf/CHANGELOG.TXT trunk/includes/tcpdf/README.TXT trunk/includes/tcpdf/barcodes.php trunk/includes/tcpdf/tcpdf.php trunk/sql/mysql/upgrade4.07-4.08.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/doc/Change.log 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,6 +1,8 @@ webERP Change Log -1/5/2012 MTPubRadio: Measurement unit in FormDesigner.php should be points instead of millimeters. -1/5/2012 MTPubRadio: Fixed Purch Order PDF file text of Order Total- Excl tax does not align with amount horizontally. + +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. 29/4/12 Opto/Klaus: SelectWorkOrder.php added start date for the work order to the work orders displayed for selection 29/4/12 David Short: Added EDISendInvoices_Reece.php to send Reece format EDI invoices - approved by Reece (Australian Plumbing retailer) 28/4/2012 Exson: Fixed bugs in MRPCalendar.php which caused working days cannot be calculated correctly. Modified: trunk/includes/tcpdf/2dbarcodes.php =================================================================== --- trunk/includes/tcpdf/2dbarcodes.php 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/2dbarcodes.php 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : 2dbarcodes.php -// Version : 1.0.013 +// Version : 1.0.014 // Begin : 2009-04-07 -// Last Update : 2012-01-12 +// Last Update : 2012-04-30 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - in...@te... // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -37,14 +37,14 @@ * PHP class to creates array representations for 2D barcodes to be used with TCPDF. * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.013 + * @version 1.0.014 */ /** * @class TCPDF2DBarcode * PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org). * @package com.tecnick.tcpdf - * @version 1.0.013 + * @version 1.0.014 * @author Nicola Asuni */ class TCPDF2DBarcode { @@ -202,9 +202,9 @@ if ($this->barcode_array['bcode'][$r][$c] == 1) { // draw a single barcode cell if ($imagick) { - $bar->rectangle($x, $y, ($x + $w), ($y + $h)); + $bar->rectangle($x, $y, ($x + $w - 1), ($y + $h - 1)); } else { - imagefilledrectangle($png, $x, $y, ($x + $w), ($y + $h), $fgcol); + imagefilledrectangle($png, $x, $y, ($x + $w - 1), ($y + $h - 1), $fgcol); } } $x += $w; Modified: trunk/includes/tcpdf/CHANGELOG.TXT =================================================================== --- trunk/includes/tcpdf/CHANGELOG.TXT 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/CHANGELOG.TXT 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,3 +1,55 @@ +5.9.160 (2012-05-03) + - A bug on tcpdf_parser.php was fixed. + +5.9.159 (2012-04-30) + - Barcode classes were updated to fix PNG export Bug (ID: 3522291). + +5.9.158 (2012-04-22) + - Some SVG-related bugs were fixed. + +5.9.157 (2012-04-16) + - Some SVG-related bugs were fixed. + +5.9.156 (2012-04-10) + - Bug item #3515885 "TOC and booklet: left and right page exchanged". + - SetAutoPageBreak(false) now works also in multicolumn mode. + +5.9.155 (2012-04-02) + - Bug item #3512596 "font import problems" was fixed. + - Method addTTFfont() was modified to extract only specified Platform ID and Encoding ID (check the source code documentation). + - All fonts were updated. + - Bug item #3513867 "booklet and setHeaderTemplateAutoreset: header shifted left" was fixed. + - Bug item #3513749 "TCPDF Superscript/Subscript" was fixed. + +5.9.154 (2012-03-29) + - A debug echo was removed. + +5.9.153 (2012-03-28) + - A bug on font conversion was fixed. + - All fonts were updated. + - Method isCharDefined() was added to find if a character is defined on the selected font. + - Method replaceMissingChars() was added to automatically replace missing chars on selected font. + - SetFont() method was fixed. + +5.9.152 (2012-03-23) + - The following overprint methods were added: setOverprint(), getOverprint(). + - Signature of setAlpha() method was changed and method getAlpha() was added. + - stroke-opacity support was added on SVG. + - The following date methods were added: setDocCreationTimestamp(), setDocModificationTimestamp(), getDocCreationTimestamp(), getDocModificationTimestamp(), getFormattedDate(), getTimestamp(). + - Signature of _datestring() method was changed. + - Method getFontBBox() was added. + - Method setPageBoxTypes() was aded. + +5.9.151 (2012-03-22) + - Bug item #3509889 "Transform() distorts PDF" was fixed. + - Precision of real number were extended. + - ComboBox and ListBox methods were fixed. + - Bulgarian language file was added. + - addTOC() method was improved to include bookmark color and font style. + +5.9.150 (2012-03-16) + - A bug related to form fields in PDF/A mode was fixed. + 5.9.149 (2012-02-21) - Bug item #3489933 "SVG Parser treats tspan like text" was fixed. Modified: trunk/includes/tcpdf/README.TXT =================================================================== --- trunk/includes/tcpdf/README.TXT 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/README.TXT 2012-05-04 21:55:53 UTC (rev 5315) @@ -8,8 +8,8 @@ ------------------------------------------------------------ Name: TCPDF -Version: 5.9.149 -Release date: 2012-02-21 +Version: 5.9.160 +Release date: 2012-05-03 Author: Nicola Asuni Copyright (c) 2002-2012: @@ -93,5 +93,5 @@ To get the original distribution archives please check the information on fonts subfolders: - DejaVu fonts 2.33 (Bitstream) - Copyright, License and other info: fonts/dejavu-fonts-ttf-2.33 - GNU FreeFont (GNU-GPLv3) - Copyright, License and other info: fonts/freefont-20100919 - + ============================================================ Modified: trunk/includes/tcpdf/barcodes.php =================================================================== --- trunk/includes/tcpdf/barcodes.php 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/barcodes.php 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : barcodes.php -// Version : 1.0.023 +// Version : 1.0.024 // Begin : 2008-06-09 -// Last Update : 2012-01-14 +// Last Update : 2012-04-30 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - in...@te... // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- @@ -37,14 +37,14 @@ * PHP class to creates array representations for common 1D barcodes to be used with TCPDF. * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.0.023 + * @version 1.0.024 */ /** * @class TCPDFBarcode * PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br> * @package com.tecnick.tcpdf - * @version 1.0.023 + * @version 1.0.024 * @author Nicola Asuni */ class TCPDFBarcode { @@ -201,9 +201,9 @@ $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); // draw a vertical bar if ($imagick) { - $bar->rectangle($x, $y, ($x + $bw), ($y + $bh)); + $bar->rectangle($x, $y, ($x + $bw - 1), ($y + $bh - 1)); } else { - imagefilledrectangle($png, $x, $y, ($x + $bw), ($y + $bh), $fgcol); + imagefilledrectangle($png, $x, $y, ($x + $bw - 1), ($y + $bh - 1), $fgcol); } } $x += $bw; Modified: trunk/includes/tcpdf/tcpdf.php =================================================================== --- trunk/includes/tcpdf/tcpdf.php 2012-05-04 02:48:41 UTC (rev 5314) +++ trunk/includes/tcpdf/tcpdf.php 2012-05-04 21:55:53 UTC (rev 5315) @@ -1,9 +1,9 @@ <?php //============================================================+ // File name : tcpdf.php -// Version : 5.9.149 +// Version : 5.9.160 // Begin : 2002-08-03 -// Last Update : 2012-02-21 +// Last Update : 2012-05-03 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - in...@te... // License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 // ------------------------------------------------------------------- @@ -137,7 +137,7 @@ * Tools to encode your unicode fonts are on fonts/utils directory.</p> * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.149 + * @version 5.9.160 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +149,7 @@ * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br> * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.149 + * @version 5.9.160 * @author Nicola Asuni - in...@te... */ class TCPDF { @@ -160,7 +160,7 @@ * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.149'; + private $tcpdf_version = '5.9.160'; // Protected properties @@ -1816,19 +1816,63 @@ protected $pdfa_mode = false; /** - * Document creation date + * Document creation date-time * @protected - * @since 5.9.121 (2011-09-28) + * @since 5.9.152 (2012-03-22) */ - protected $doc_date; + protected $doc_creation_timestamp; /** + * Document modification date-time + * @protected + * @since 5.9.152 (2012-03-22) + */ + protected $doc_modification_timestamp; + + /** * Custom XMP data. * @protected * @since 5.9.128 (2011-10-06) */ protected $custom_xmp = ''; + /** + * Overprint mode array. + * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $overprint = array('OP' => false, 'op' => false, 'OPM' => 0); + + /** + * Alpha mode array. + * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $alpha = array('CA' => 1, 'ca' => 1, 'BM' => '/Normal', 'AIS' => false); + + /** + * Define the page boundaries boxes to be set on document. + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $page_boxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); + + /** + * Set the document producer metadata. + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $pdfproducer; + + /** + * If true print TCPDF meta link. + * @protected + * @since 5.9.152 (2012-03-23) + */ + protected $tcpdflink = true; + //------------------------------------------------------------ // METHODS //------------------------------------------------------------ @@ -1941,7 +1985,7 @@ $this->setCellMargins(0, 0, 0, 0); // line width (0.2 mm) $this->LineWidth = 0.57 / $this->k; - $this->linestyleWidth = sprintf('%.2F w', ($this->LineWidth * $this->k)); + $this->linestyleWidth = sprintf('%F w', ($this->LineWidth * $this->k)); $this->linestyleCap = '0 J'; $this->linestyleJoin = '0 j'; $this->linestyleDash = '[] 0 d'; @@ -1953,6 +1997,8 @@ $this->SetCompression(); // set default PDF version number $this->setPDFVersion(); + $this->pdfproducer = "\x54\x43\x50\x44\x46\x20".$this->tcpdf_version."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; + $this->tcpdflink = true; $this->encoding = $encoding; $this->HREF = array(); $this->getFontsList(); @@ -1992,8 +2038,9 @@ $this->default_form_prop = array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 255), 'strokeColor'=>array(128, 128, 128)); // set file ID for trailer $this->file_id = md5($this->getRandomSeed('TCPDF'.$orientation.$unit.$format.$encoding)); - // set document date - $this->doc_date = substr_replace(date('YmdHisO'), '\'', (0 - 2), 0).'\''; + // set document creation and modification timestamp + $this->doc_creation_timestamp = time(); + $this->doc_modification_timestamp = $this->doc_creation_timestamp; // get default graphic vars $this->default_graphic_vars = $this->getGraphicVars(); $this->header_xobj_autoreset = false; @@ -3742,24 +3789,26 @@ $this->AddPage(); } $this->endLayer(); - // save current graphic settings - $gvars = $this->getGraphicVars(); - $this->setEqualColumns(); - $this->lastpage(true); - $this->SetAutoPageBreak(false); - $this->x = 0; - $this->y = $this->h - (1 / $this->k); - $this->lMargin = 0; - $this->_out('q'); - $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; - $this->SetFont($font, '', 1); - $this->setTextRenderingMode(0, false, false); - $msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; - $lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67"; - $this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B'); - $this->_out('Q'); - // restore graphic settings - $this->setGraphicVars($gvars); + if ($this->tcpdflink) { + // save current graphic settings + $gvars = $this->getGraphicVars(); + $this->setEqualColumns(); + $this->lastpage(true); + $this->SetAutoPageBreak(false); + $this->x = 0; + $this->y = $this->h - (1 / $this->k); + $this->lMargin = 0; + $this->_out('q'); + $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; + $this->SetFont($font, '', 1); + $this->setTextRenderingMode(0, false, false); + $msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; + $lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67"; + $this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B'); + $this->_out('Q'); + // restore graphic settings + $this->setGraphicVars($gvars); + } // close page $this->endPage(); // close document @@ -4212,7 +4261,7 @@ // print header template $x = 0; $dx = 0; - if ($this->booklet AND (($this->page % 2) == 0)) { + if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) { // adjust margins for booklet mode $dx = ($this->original_lMargin - $this->original_rMargin); } @@ -4503,19 +4552,19 @@ $pdfcolor = sprintf('/CS%d ', $this->spot_colors[$name]['i']); switch ($type) { case 'draw': { - $pdfcolor .= sprintf('CS %.3F SCN', $tint); + $pdfcolor .= sprintf('CS %F SCN', $tint); $this->DrawColor = $pdfcolor; $this->strokecolor = $spotcolor; break; } case 'fill': { - $pdfcolor .= sprintf('cs %.3F scn', $tint); + $pdfcolor .= sprintf('cs %F scn', $tint); $this->FillColor = $pdfcolor; $this->bgcolor = $spotcolor; break; } case 'text': { - $pdfcolor .= sprintf('cs %.3F scn', $tint); + $pdfcolor .= sprintf('cs %F scn', $tint); $this->TextColor = $pdfcolor; $this->fgcolor = $spotcolor; break; @@ -4674,7 +4723,7 @@ // Grey scale $col1 = max(0, min(255, $col1)); $intcolor = array('G' => $col1); - $pdfcolor = sprintf('%.3F ', ($col1 / 255)); + $pdfcolor = sprintf('%F ', ($col1 / 255)); $suffix = 'g'; } elseif ($col4 == -1) { // RGB @@ -4682,7 +4731,7 @@ $col2 = max(0, min(255, $col2)); $col3 = max(0, min(255, $col3)); $intcolor = array('R' => $col1, 'G' => $col2, 'B' => $col3); - $pdfcolor = sprintf('%.3F %.3F %.3F ', ($col1 / 255), ($col2 / 255), ($col3 / 255)); + $pdfcolor = sprintf('%F %F %F ', ($col1 / 255), ($col2 / 255), ($col3 / 255)); $suffix = 'rg'; } else { $col1 = max(0, min(100, $col1)); @@ -4692,7 +4741,7 @@ if (empty($name)) { // CMYK $intcolor = array('C' => $col1, 'M' => $col2, 'Y' => $col3, 'K' => $col4); - $pdfcolor = sprintf('%.3F %.3F %.3F %.3F ', ($col1 / 100), ($col2 / 100), ($col3 / 100), ($col4 / 100)); + $pdfcolor = sprintf('%F %F %F %F ', ($col1 / 100), ($col2 / 100), ($col3 / 100), ($col4 / 100)); $suffix = 'k'; } else { // SPOT COLOR @@ -4744,17 +4793,17 @@ switch (count($c)) { case 4: { // CMYK - $color .= sprintf('%.3F %.3F %.3F %.3F', (max(0, min(100, floatval($c[0]))) / 100), (max(0, min(100, floatval($c[1]))) / 100), (max(0, min(100, floatval($c[2]))) / 100), (max(0, min(100, floatval($c[3]))) / 100)); + $color .= sprintf('%F %F %F %F', (max(0, min(100, floatval($c[0]))) / 100), (max(0, min(100, floatval($c[1]))) / 100), (max(0, min(100, floatval($c[2]))) / 100), (max(0, min(100, floatval($c[3]))) / 100)); break; } case 3: { // RGB - $color .= sprintf('%.3F %.3F %.3F', (max(0, min(255, floatval($c[0]))) / 255), (max(0, min(255, floatval($c[1]))) / 255), (max(0, min(255, floatval($c[2]))) / 255)); + $color .= sprintf('%F %F %F', (max(0, min(255, floatval($c[0]))) / 255), (max(0, min(255, floatval($c[1]))) / 255), (max(0, min(255, floatval($c[2]))) / 255)); break; } case 1: { // grayscale - $color .= sprintf('%.3F', (max(0, min(255, floatval($c[0]))) / 255)); + $color .= sprintf('%F', (max(0, min(255, floatval($c[0]))) / 255)); break; } } @@ -5230,11 +5279,14 @@ * @since 1.0 * @see AddFont(), SetFontSize() */ - public function SetFont($family, $style='', $size=0, $fontfile='', $subset='default', $out=true) { + public function SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) { //Select a font; size given in points - if ($size == 0) { + if ($size === null) { $size = $this->FontSizePt; } + if ($size < 0) { + $size = 0; + } // try to add font (if not already added) $fontdata = $this->AddFont($family, $style, $fontfile, $subset); $this->FontFamily = $fontdata['family']; @@ -5281,11 +5333,52 @@ $this->FontAscent = ($font_ascent / $this->k); $this->FontDescent = ($font_descent / $this->k); if ($out AND ($this->page > 0) AND (isset($this->CurrentFont['i']))) { - $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); + $this->_out(sprintf('BT /F%d %F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); } } /** + * Returns the bounding box of the current font in user units. + * @return array + * @public + * @since 5.9.152 (2012-03-23) + */ + public function getFontBBox() { + $result = array(); + if (isset($this->CurrentFont['desc']['FontBBox'])) { + $bbox = explode(' ', substr($this->CurrentFont['desc']['FontBBox'], 1, -1)); + foreach ($bbox as $v) { + $result[] = (intval($v) * $this->FontSize / 1000); + } + } else { + // Find max width + if (isset($this->CurrentFont['desc']['MaxWidth'])) { + $maxw = (intval($this->CurrentFont['desc']['MaxWidth']) * $this->FontSize / 1000); + } else { + $maxw = 0; + if (isset($this->CurrentFont['desc']['MissingWidth'])) { + $maxw = max($maxw, $this->CurrentFont['desc']['MissingWidth']); + } + if (isset($this->CurrentFont['desc']['AvgWidth'])) { + $maxw = max($maxw, $this->CurrentFont['desc']['AvgWidth']); + } + if (isset($this->CurrentFont['dw'])) { + $maxw = max($maxw, $this->CurrentFont['dw']); + } + foreach ($this->CurrentFont['cw'] as $char => $w) { + $maxw = max($maxw, $w); + } + if ($maxw == 0) { + $maxw = 600; + } + $maxw = ($maxw * $this->FontSize / 1000); + } + $result = array(0, -$this->FontDescent, $maxw, $this->FontAscent); + } + return $result; + } + + /** * Return the font descent value * @param $font (string) font name * @param $style (string) font style @@ -5328,6 +5421,70 @@ } /** + * Return the font descent value + * @param $char (mixed) Character to check (integer value or string) + * @param $font (string) Font name (family name). + * @param $style (string) Font style. + * @return (boolean) true if the char is defined, false otherwise. + * @public + * @since 5.9.153 (2012-03-28) + */ + public function isCharDefined($char, $font='', $style='') { + if (is_string($char)) { + // get character code + $char = $this->UTF8StringToArray($char); + $char = $char[0]; + } + if ($this->empty_string($font)) { + $font = $this->FontFamily; + } + $fontdata = $this->AddFont($font, $style); + $fontinfo = $this->getFontBuffer($fontdata['fontkey']); + return (isset($fontinfo['cw'][intval($char)])); + } + + /** + * Replace missing font characters on selected font with specified substitutions. + * @param $text (string) Text to process. + * @param $font (string) Font name (family name). + * @param $style (string) Font style. + * @param $subs (array) Array of possible character substitutions. The key is the character to check (integer value) and the value is a single intege value or an array of possible substitutes. + * @return (string) Processed text. + * @public + * @since 5.9.153 (2012-03-28) + */ + public function replaceMissingChars($text, $font='', $style='', $subs=array()) { + if (empty($subs)) { + return $text; + } + if ($this->empty_string($font)) { + $font = $this->FontFamily; + } + $fontdata = $this->AddFont($font, $style); + $fontinfo = $this->getFontBuffer($fontdata['fontkey']); + $uniarr = $this->UTF8StringToArray($text); + foreach ($uniarr as $k => $chr) { + if (!isset($fontinfo['cw'][$chr])) { + // this character is missing on the selected font + if (isset($subs[$chr])) { + // we have available substitutions + if (is_array($subs[$chr])) { + foreach($subs[$chr] as $s) { + if (isset($fontinfo['cw'][$s])) { + $uniarr[$k] = $s; + break; + } + } + } elseif (isset($fontinfo['cw'][$subs[$chr]])) { + $uniarr[$k] = $subs[$chr]; + } + } + } + } + return $this->UniArrSubString($this->UTF8ArrayToUniArray($uniarr)); + } + + /** * Defines the default monospaced font. * @param $font (string) Font name. * @public @@ -5561,7 +5718,7 @@ if ($this->current_column < ($this->num_columns - 1)) { // go to next column $this->selectColumn($this->current_column + 1); - } else { + } elseif ($this->AutoPageBreak) { // add a new page $this->AddPage(); // set first column @@ -5854,7 +6011,7 @@ } else { $xk = ($x * $k); } - $s .= sprintf('%.2F %.2F %.2F %.2F re %s ', $xk, (($this->h - $y) * $k), ($w * $k), (-$h * $k), $op); + $s .= sprintf('%F %F %F %F re %s ', $xk, (($this->h - $y) * $k), ($w * $k), (-$h * $k), $op); } // draw borders $s .= $this->getCellBorder($x, $y, $w, $h, $border); @@ -5927,17 +6084,17 @@ } if ($this->font_stretching != 100) { // apply font stretching - $rs .= sprintf('BT %.2F Tz ET ', $this->font_stretching); + $rs .= sprintf('BT %F Tz ET ', $this->font_stretching); } if ($this->font_spacing != 0) { // increase/decrease font spacing - $rs .= sprintf('BT %.2F Tc ET ', ($this->font_spacing * $this->k)); + $rs .= sprintf('BT %F Tc ET ', ($this->font_spacing * $this->k)); } if ($this->ColorFlag AND ($this->textrendermode < 4)) { $s .= 'q '.$this->TextColor.' '; } // rendering mode - $s .= sprintf('BT %d Tr %.2F w ET ', $this->textrendermode, $this->textstrokewidth); + $s .= sprintf('BT %d Tr %F w ET ', $this->textrendermode, $this->textstrokewidth); // count number of spaces $ns = substr_count($txt, chr(32)); // Justification @@ -5953,7 +6110,7 @@ $spacewidth /= ($this->font_stretching / 100); } // set word position to be used with TJ operator - $txt2 = str_replace(chr(0).chr(32), ') '.sprintf('%.3F', $spacewidth).' (', $txt2); + $txt2 = str_replace(chr(0).chr(32), ') '.sprintf('%F', $spacewidth).' (', $txt2); $unicode_justification = true; } else { // get string width @@ -5965,7 +6122,7 @@ $spacewidth /= ($this->font_stretching / 100); } // set word spacing - $rs .= sprintf('BT %.3F Tw ET ', $spacewidth); + $rs .= sprintf('BT %F Tw ET ', $spacewidth); } $width = $w - $this->cell_padding['L'] - $this->cell_padding['R']; } @@ -6009,7 +6166,7 @@ } $xdk = $xdx * $k; // print text - $s .= sprintf('BT %.2F %.2F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * $k), $txt2); + $s .= sprintf('BT %F %F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * $k), $txt2); if (isset($uniblock)) { // print overlapping characters as separate string $xshift = 0; // horizontal shift @@ -6027,7 +6184,7 @@ // character to print $topchr = $this->arrUTF8ToUTF16BE($uniarr, false); $topchr = $this->_escape($topchr); - $s .= sprintf(' BT %.2F %.2F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr); + $s .= sprintf(' BT %F %F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr); } } } @@ -6193,85 +6350,85 @@ } // draw borders by case if (strlen($border) == 4) { - $s .= sprintf('%.2F %.2F %.2F %.2F re S ', $xT, $yT, ($w * $k), (-$h * $k)); + $s .= sprintf('%F %F %F %F re S ', $xT, $yT, ($w * $k), (-$h * $k)); } elseif (strlen($border) == 3) { if (strpos($border,'B') === false) { // LTR - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif (strpos($border,'L') === false) { // TRB - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } elseif (strpos($border,'T') === false) { // RBL - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; } elseif (strpos($border,'R') === false) { // BLT - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; } } elseif (strlen($border) == 2) { if ((strpos($border,'L') !== false) AND (strpos($border,'T') !== false)) { // LT - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; } elseif ((strpos($border,'T') !== false) AND (strpos($border,'R') !== false)) { // TR - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif ((strpos($border,'R') !== false) AND (strpos($border,'B') !== false)) { // RB - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } elseif ((strpos($border,'B') !== false) AND (strpos($border,'L') !== false)) { // BL - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; } elseif ((strpos($border,'L') !== false) AND (strpos($border,'R') !== false)) { // LR - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif ((strpos($border,'T') !== false) AND (strpos($border,'B') !== false)) { // TB - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } } else { // strlen($border) == 1 if (strpos($border,'L') !== false) { // L - $s .= sprintf('%.2F %.2F m ', $xL, $yL); - $s .= sprintf('%.2F %.2F l ', $xT, $yT); + $s .= sprintf('%F %F m ', $xL, $yL); + $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; } elseif (strpos($border,'T') !== false) { // T - $s .= sprintf('%.2F %.2F m ', $xT, $yT); - $s .= sprintf('%.2F %.2F l ', $xR, $yR); + $s .= sprintf('%F %F m ', $xT, $yT); + $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; } elseif (strpos($border,'R') !== false) { // R - $s .= sprintf('%.2F %.2F m ', $xR, $yR); - $s .= sprintf('%.2F %.2F l ', $xB, $yB); + $s .= sprintf('%F %F m ', $xR, $yR); + $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; } elseif (strpos($border,'B') !== false) { // B - $s .= sprintf('%.2F %.2F m ', $xB, $yB); - $s .= sprintf('%.2F %.2F l ', $xL, $yL); + $s .= sprintf('%F %F m ', $xB, $yB); + $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; } } @@ -7755,7 +7912,7 @@ $tmp = array(); if (preg_match('/[\s]+width[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) { $ow = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, false); - $owu = sprintf('%.3F', ($ow * $dpi / 72)).$this->pdfunit; + $owu = sprintf('%F', ($ow * $dpi / 72)).$this->pdfunit; $svgtag = preg_replace('/[\s]+width[\s]*=[\s]*"[^"]*"/si', ' width="'.$owu.'"', $svgtag, 1); } else { $ow = $w; @@ -7763,7 +7920,7 @@ $tmp = array(); if (preg_match('/[\s]+height[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) { $oh = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, false); - $ohu = sprintf('%.3F', ($oh * $dpi / 72)).$this->pdfunit; + $ohu = sprintf('%F', ($oh * $dpi / 72)).$this->pdfunit; $svgtag = preg_replace('/[\s]+height[\s]*=[\s]*"[^"]*"/si', ' height="'.$ohu.'"', $svgtag, 1); } else { $oh = $h; @@ -7772,7 +7929,7 @@ if (!preg_match('/[\s]+viewBox[\s]*=[\s]*"[\s]*([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]*"/si', $svgtag, $tmp)) { $vbw = ($ow * $this->imgscale * $this->k); $vbh = ($oh * $this->imgscale * $this->k); - $vbox = sprintf(' viewBox="0 0 %.3F %.3F" ', $vbw, $vbh); + $vbox = sprintf(' viewBox="0 0 %F %F" ', $vbw, $vbh); $svgtag = $vbox.$svgtag; } $svgimg = preg_replace('/<svg([^\>]*)>/si', '<svg'.$svgtag.'>', $svgimg, 1); @@ -7856,7 +8013,7 @@ $xkimg = $ximg * $this->k; if (!$alt) { // only non-alternative immages will be set - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%u Do Q', ($w * $this->k), ($h * $this->k), $xkimg, (($this->h - ($y + $h)) * $this->k), $info['i'])); + $this->_out(sprintf('q %F 0 0 %F %F %F cm /I%u Do Q', ($w * $this->k), ($h * $this->k), $xkimg, (($this->h - ($y + $h)) * $this->k), $info['i'])); } if (!empty($border)) { $bx = $this->x; @@ -8843,6 +9000,21 @@ } /** + * Set page boxes to be included on page descriptions. + * @param $boxes (array) Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'). + * @protected + */ + protected function setPageBoxTypes($boxes) { + $validboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); + $this->page_boxes = array(); + foreach ($boxes as $box) { + if (in_array($box, $validboxes)) { + $this->page_boxes[] = $box; + } + } + } + + /** * Output pages (and replace page number aliases). * @protected */ @@ -8904,22 +9076,21 @@ $out = '<<'; $out .= ' /Type /Page'; $out .= ' /Parent 1 0 R'; - $out .= ' /LastModified '.$this->_datestring(); + $out .= ' /LastModified '.$this->_datestring(0, $this->doc_modification_timestamp); $out .= ' /Resources 2 0 R'; - $boxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); - foreach ($boxes as $box) { + foreach ($this->page_boxes as $box) { $out .= ' /'.$box; - $out .= sprintf(' [%.2F %.2F %.2F %.2F]', $this->pagedim[$n][$box]['llx'], $this->pagedim[$n][$box]['lly'], $this->pagedim[$n][$box]['urx'], $this->pagedim[$n][$box]['ury']); + $out .= sprintf(' [%F %F %F %F]', $this->pagedim[$n][$box]['llx'], $this->pagedim[$n][$box]['lly'], $this->pagedim[$n][$box]['urx'], $this->pagedim[$n][$box]['ury']); } if (isset($this->pagedim[$n]['BoxColorInfo']) AND !empty($this->pagedim[$n]['BoxColorInfo'])) { $out .= ' /BoxColorInfo <<'; - foreach ($boxes as $box) { + foreach ($this->page_boxes as $box) { if (isset($this->pagedim[$n]['BoxColorInfo'][$box])) { $out .= ' /'.$box.' <<'; if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['C'])) { $color = $this->pagedim[$n]['BoxColorInfo'][$box]['C']; $out .= ' /C ['; - $out .= sprintf(' %.3F %.3F %.3F', $color[0]/255, $color[1]/255, $color[2]/255); + $out .= sprintf(' %F %F %F', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255)); $out .= ' ]'; } if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['W'])) { @@ -8932,7 +9103,7 @@ $dashes = $this->pagedim[$n]['BoxColorInfo'][$box]['D']; $out .= ' /D ['; foreach ($dashes as $dash) { - $out .= sprintf(' %.3F', ($dash * $this->k)); + $out .= sprintf(' %F', ($dash * $this->k)); } $out .= ' ]'; } @@ -9116,7 +9287,7 @@ $b = $this->pagedim[$n]['h'] - (($pl['y'] + $pl['h']) * $this->k); $c = $pl['w'] * $this->k; $d = $pl['h'] * $this->k; - $rect = sprintf('%.2F %.2F %.2F %.2F', $a, $b, $a+$c, $b+$d); + $rect = sprintf('%F %F %F %F', $a, $b, $a+$c, $b+$d); // create new annotation object $annots = '<</Type /Annot'; $annots .= ' /Subtype /'.$pl['opt']['subtype']; @@ -9129,7 +9300,7 @@ $annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id); $annots .= ' /P '.$this->page_obj_id[$n].' 0 R'; $annots .= ' /NM '.$this->_datastring(sprintf('%04u-%04u', $n, $key), $annot_obj_id); - $annots .= ' /M '.$this->_datestring($annot_obj_id); + $annots .= ' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp); if (isset($pl['opt']['f'])) { $fval = 0; if (is_array($pl['opt']['f'])) { @@ -9265,7 +9436,7 @@ $annots .= ' /S /S'; } if (isset($pl['opt']['be']['i']) AND ($pl['opt']['be']['i'] >= 0) AND ($pl['opt']['be']['i'] <= 2)) { - $annots .= ' /I '.sprintf(' %.4F', $pl['opt']['be']['i']); + $annots .= ' /I '.sprintf(' %F', $pl['opt']['be']['i']); } $annots .= '>>'; } @@ -9282,12 +9453,12 @@ } //$annots .= ' /Popup '; if (isset($pl['opt']['ca'])) { - $annots .= ' /CA '.sprintf('%.4F', floatval($pl['opt']['ca'])); + $annots .= ' /CA '.sprintf('%F', floatval($pl['opt']['ca'])); } if (isset($pl['opt']['rc'])) { $annots .= ' /RC '.$this->_textstring($pl['opt']['rc'], $annot_obj_id); } - $annots .= ' /CreationDate '.$this->_datestring($annot_obj_id); + $annots .= ' /CreationDate '.$this->_datestring($annot_obj_id, $this->doc_creation_timestamp); //$annots .= ' /IRT '; if (isset($pl['opt']['subj'])) { $annots .= ' /Subj '.$this->_textstring($pl['opt']['subj'], $annot_obj_id); @@ -9340,7 +9511,7 @@ // internal link $l = $this->links[$pl['txt']]; if (isset($this->page_obj_id[($l[0])])) { - $annots .= sprintf(' /Dest [%u 0 R /XYZ 0 %.2F null]', $this->page_obj_id[($l[0])], ($this->pagedim[$l[0]]['h'] - ($l[1] * $this->k))); + $annots .= sprintf(' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[($l[0])], ($this->pagedim[$l[0]]['h'] - ($l[1] * $this->k))); } } $hmodes = array('N', 'I', 'O', 'P'); @@ -9369,7 +9540,7 @@ if (isset($pl['opt']['cl']) AND is_array($pl['opt']['cl'])) { $annots .= ' /CL ['; foreach ($pl['opt']['cl'] as $cl) { - $annots .= sprintf('%.4F ', $cl * $this->k); + $annots .= sprintf('%F ', $cl * $this->k); } $annots .= ']'; } @@ -9382,7 +9553,7 @@ $r = $pl['opt']['rd'][1] * $this->k; $t = $pl['opt']['rd'][2] * $this->k; $b = $pl['opt']['rd'][3] * $this->k; - $annots .= ' /RD ['.sprintf('%.2F %.2F %.2F %.2F', $l, $r, $t, $b).']'; + $annots .= ' /RD ['.sprintf('%F %F %F %F', $l, $r, $t, $b).']'; } if (isset($pl['opt']['le']) AND in_array($pl['opt']['le'], $lineendings)) { $annots .= ' /LE /'.$pl['opt']['le']; @@ -9523,7 +9694,7 @@ $annots .= ' /S /'.$pl['opt']['mk']['if']['s']; } if (isset($pl['opt']['mk']['if']['a']) AND (is_array($pl['opt']['mk']['if']['a'])) AND !empty($pl['opt']['mk']['if']['a'])) { - $annots .= sprintf(' /A [%.2F %.2F]', $pl['opt']['mk']['if']['a'][0], $pl['opt']['mk']['if']['a'][1]); + $annots .= sprintf(' /A [%F %F]', $pl['opt']['mk']['if']['a'][0], $pl['opt']['mk']['if']['a'][1]); } if (isset($pl['opt']['mk']['if']['fb']) AND ($pl['opt']['mk']['if']['fb'])) { $annots .= ' /FB true'; @@ -9569,7 +9740,7 @@ if (is_array($pl['opt']['v'])) { foreach ($pl['opt']['v'] AS $optval) { if (is_float($optval)) { - $optval = sprintf('%.2F', $optval); + $optval = sprintf('%F', $optval); } $annots .= ' '.$optval; } @@ -9582,7 +9753,7 @@ if (is_array($pl['opt']['dv'])) { foreach ($pl['opt']['dv'] AS $optval) { if (is_float($optval)) { - $optval = sprintf('%.2F', $optval); + $optval = sprintf('%F', $optval); } $annots .= ' '.$optval; } @@ -9595,7 +9766,7 @@ if (is_array($pl['opt']['rv'])) { foreach ($pl['opt']['rv'] AS $optval) { if (is_float($optval)) { - $optval = sprintf('%.2F', $optval); + $optval = sprintf('%F', $optval); } $annots .= ' '.$optval; } @@ -9690,7 +9861,7 @@ $stream = gzcompress($stream); $out .= ' /Filter /FlateDecode'; } - $rect = sprintf('%.2F %.2F', $w, $h); + $rect = sprintf('%F %F', $w, $h); $out .= ' /BBox [0 0 '.$rect.']'; $out .= ' /Matrix [1 0 0 1 0 0]'; $out .= ' /Resources 2 0 R'; @@ -9733,8 +9904,8 @@ /** * Get SHORT from string (Big Endian 16-bit signed integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param $str (string) String from where to extract value. + * @param $offset (int) Point from where to read the data. * @return int 16 bit value * @author Nicola Asuni * @protected @@ -9747,8 +9918,8 @@ /** * Get FWORD from string (Big Endian 16-bit signed integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param $str (string) String from where to extract value. + * @param $offset (int) Point from where to read the data. * @return int 16 bit value * @author Nicola Asuni * @protected @@ -9830,17 +10001,19 @@ /** * Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable). - * @param $fontfile (string) TrueType or Type1 font file (full path). + * @param $fontfile (string) Font file (full path). * @param $fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional. * @param $enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats. * @param $flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font. * @param $outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder. + * @param $platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1). + * @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4. * @return (string) TCPDF font name. * @author Nicola Asuni * @public * @since 5.9.123 (2010-09-30) */ - public function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='') { + public function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1) { if (!file_exists($fontfile)) { $this->Error('Could not find file: '.$fontfile.''); } @@ -10309,220 +10482,216 @@ // ---------- get CIDToGIDMap ---------- $ctg = array(); foreach ($encodingTables as $enctable) { - if (($enctable['platformID'] == 3) AND ($enctable['encodingID'] == 0)) { - $modesymbol = true; - } else { - $modesymbol = false; - } - $offset = $table['cmap']['offset'] + $enctable['offset']; - $format = $this->_getUSHORT($font, $offset); - $offset += 2; - switch ($format) { - case 0: { // Format 0: Byte encoding table - $offset += 4; // skip length and version/language - for ($c = 0; $c < 256; ++$c) { - $g = $this->_getBYTE($font, $offset); - $ctg[$c] = $g; - ++$offset; + // get only specified Platform ID and Encoding ID + if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) { + $offset = $table['cmap']['offset'] + $enctable['offset']; + $format = $this->_getUSHORT($font, $offset); + $offset += 2; + switch ($format) { + case 0: { // Format 0: Byte encoding table + $offset += 4; // skip length and version/language + for ($c = 0; $c < 256; ++$c) { + $g = $this->_getBYTE($font, $offset); + $ctg[$c] = $g; + ++$offset; + } + break; } - break; - } - case 2: { // Format 2: High-byte mapping through table - $offset += 4; // skip length and version/language - $numSubHeaders = 0; - for ($i = 0; $i < 256; ++$i) { - // Array that maps high bytes to subHeaders: value is subHeader index * 8. - $subHeaderKeys[$i] = ($this->_getUSHORT($font, $offset) / 8); - $offset += 2; - if ($numSubHeaders < $subHeaderKeys[$i]) { - $numSubHeaders = $subHeaderKeys[$i]; + case 2: { // Format 2: High-byte mapping through table + $offset += 4; // skip length and version/language + $numSubHeaders = 0; + for ($i = 0; $i < 256; ++$i) { + // Array that maps high bytes to subHeaders: value is subHeader index * 8. + $subHeaderKeys[$i] = ($this->_getUSHORT($font, $offset) / 8); + $offset += 2; + if ($numSubHeaders < $subHeaderKeys[$i]) { + $numSubHeaders = $subHeaderKeys[$i]; + } } + // the number of subHeaders is equal to the max of subHeaderKeys + 1 + ++$numSubHeaders; + // read subHeader structures + $subHeaders = array(); + $numGlyphIndexArray = 0; + for ($k = 0; $k < $numSubHeaders; ++$k) { + $subHeaders[$k]['firstCode'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['entryCount'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['idDelta'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['idRangeOffset'] = $this->_getUSHORT($font, $offset); + $offset += 2; + $subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8)); + $subHeaders[$k]['idRangeOffset'] /= 2; + $numGlyphIndexArray += $subHeaders[$k]['entryCount']; + } + for ($k = 0; $k < $numGlyphIndexArray; ++$k) { + $glyphIndexArray[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + for ($i = 0; $i < 256; ++$i) { + $k = $subHeaderKeys[$i]; + if ($k == 0) { + // one byte code + $c = $i; + $g = $glyphIndexArray[0]; + $ctg[$c] = $g; + } else { + // two bytes code + $start_byte = $subHeaders[$k]['firstCode']; + $end_byte = $start_byte + $subHeaders[$k]['entryCount']; + for ($j = $start_byte; $j < $end_byte; ++$j) { + // combine high and low bytes + $c = (($i << 8) + $j); + $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); + $g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536; + if ($g < 0) { + $g = 0; + } + $ctg[$c] = $g; + } + } + } + break; } - // the number of subHeaders is equal to the max of subHeaderKeys + 1 - ++$numSubHeaders; - // read subHeader structures - $subHeaders = array(); - $numGlyphIndexArray = 0; - for ($k = 0; $k < $numSubHeaders; ++$k) { - $subHeaders[$k]['firstCode'] = $this->_getUSHORT($font, $offset); + case 4: { // Format 4: Segment mapping to delta values + $length = $this->_getUSHORT($font, $offset); $offset += 2; - $subHeaders[$k]['entryCount'] = $this->_getUSHORT($font, $offset); + $offset += 2; // skip version/language + $segCount = ($this->_getUSHORT($font, $offset) / 2); $offset += 2; - $subHeaders[$k]['idDelta'] = $this->_getSHORT($font, $offset); - $offset += 2; - $subHeaders[$k]['idRangeOffset'] = $this->_getUSHORT($font, $offset); - $offset += 2; - $subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8)); - $subHeaders[$k]['idRangeOffset'] /= 2; - $numGlyphIndexArray += $subHeaders[$k]['entryCount']; - } - for ($k = 0; $k < $numGlyphIndexArray; ++$k) { - $glyphIndexArray[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - for ($i = 0; $i < 256; ++$i) { - $k = $subHeaderKeys[$i]; - if ($k == 0) { - // one byte code - $c = $i; - $g = $glyphIndexArray[0]; - $ctg[$c] = $g; - } else { - // two bytes code - $start_byte = $subHeaders[$k]['firstCode']; - $end_byte = $start_byte + $subHeaders[$k]['entryCount']; - for ($j = $start_byte; $j < $end_byte; ++$j) { - // combine high and low bytes - $c = (($i << 8) + $j); - $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); - $g = $glyphIndexArray[$idRangeOffset]; - $g += ($idDelta[$k] - 65536); + $offset += 6; // skip searchRange, entrySelector, rangeShift + $endCount = array(); // array of end character codes for each segment + for ($k = 0; $k < $segCount; ++$k) { + $endCount[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $offset += 2; // skip reservedPad + $startCount = array(); // array of start character codes for each segment + for ($k = 0; $k < $segCount; ++$k) { + $startCount[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $idDelta = array(); // delta for all character codes in segment + for ($k = 0; $k < $segCount; ++$k) { + $idDelta[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $idRangeOffset = array(); // Offsets into glyphIdArray or 0 + for ($k = 0; $k < $segCount; ++$k) { + $idRangeOffset[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + $gidlen = ($length / 2) - 8 - (4 * $segCount); + $glyphIdArray = array(); // glyph index array + for ($k = 0; $k < $gidlen; ++$k) { + $glyphIdArray[$k] = $this->_getUSHORT($font, $offset); + $offset += 2; + } + for ($k = 0; $k < $segCount; ++$k) { + for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { + if ($idRangeOffset[$k] == 0) { + $g = ($idDelta[$k] + $c) % 65536; + } else { + $gid = (($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k)); + $g = ($glyphIdArray[$gid] + $idDelta[$k]) % 65536; + } if ($g < 0) { $g = 0; } $ctg[$c] = $g; } } + break; } - break; - } - case 4: { // Format 4: Segment mapping to delta values - $length = $this->_getUSHORT($font, $offset); - $offset += 2; - $offset += 2; // skip version/language - $segCount = ($this->_getUSHORT($font, $offset) / 2); - $offset += 2; - $offset += 6; // skip searchRange, entrySelector, rangeShift - $endCount = array(); // array of end character codes for each segment - for ($k = 0; $k < $segCount; ++$k) { - $endCount[$k] = $this->_getUSHORT($font, $offset); + case 6: { // Format 6: Trimmed table mapping + $offset += 4; // skip length and version/language + $firstCode = $this->_getUSHORT($font, $offset); $offset += 2; - } - $offset += 2; // skip reservedPad - $startCount = array(); // array of start character codes for each segment - for ($k = 0; $k < $segCount; ++$k) { - $startCount[$k] = $this->_getUSHORT($font, $offset); + $entryCount = $this->_getUSHORT($font, $offset); $offset += 2; + for ($k = 0; $k < $entryCount; ++$k) { + $c = ($k + $firstCode); + $g = $this->_getUSHORT($font, $offset); + $offset += 2; + $ctg[$c] = $g; + } + break; } - $idDelta = array(); // delta for all character codes in segment - for ($k = 0; $k < $segCount; ++$k) { - $idDelta[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - $idRangeOffset = array(); // Offsets into glyphIdArray or 0 - for ($k = 0; $k < $segCount; ++$k) { - $idRangeOffset[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - $gidlen = ($length / 2) - 8 - (4 * $segCount); - $glyphIdArray = array(); // glyph index array - for ($k = 0; $k < $gidlen; ++$k) { - $glyphIdArray[$k] = $this->_getUSHORT($font, $offset); - $offset += 2; - } - for ($k = 0; $k < $segCount; ++$k) { - for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { - if ($idRangeOffset[$k] == 0) { - $g = $c; - } else { - $gid = (($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k)); - $g = $glyphIdArray[$gid]; + case 8: { // Format 8: Mixed 16-bit and 32-bit coverage + $offset += 10; // skip reserved, length and version/language + for ($k = 0; $k < 8192; ++$k) { + $is32[$k] = $this->_getBYTE($font, $offset); + ++$offset; + } + $nGroups = $this->_getULONG($font, $offset); + $offset += 4; + for ($i = 0; $i < $nGroups; ++$i) { + $startCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $endCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $startGlyphID = $this->_getULONG($font, $offset); + $offset += 4; + for ($k = $startCharCode; $k <= $endCharCode; ++$k) { + $is32idx = floor($c / 8); + if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) { + $c = $k; + } else { + // 32 bit format + // convert to decimal (http://www.unicode.org/faq//utf_bom.html#utf16-4) + //LEAD_OFFSET = (0xD800 - (0x10000 >> 10)) = 55232 + //SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00) = -56613888 + $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888; + } + $ctg[$c] = 0; + ++$startGlyphID; } - $g += ($idDelta[$k] - 65536); - if ($g < 0) { - $g = 0; - } - $ctg[$c] = $g; } + break; } - break; - } - case 6: { // Format 6: Trimmed table mapping - $offset += 4; // skip length and version/language - $firstCode = $this->_getUSHORT($font, $offset); - $offset += 2; - $entryCount = $this->_getUSHORT($font, $offset); - $offset += 2; - for ($k = 0; $k < $entryCount; ++$k) { - $c = ($k + $firstCode); - $g = $this->_getUSHORT($font, $offset); - $ctg[$c] = $g; - $offset += 2; - } - break; - } - case 8: { // Format 8: Mixed 16-bit and 32-bit coverage - $offset += 10; // skip reserved, length and version/language - for ($k = 0; $k < 8192; ++$k) { - $is32[$k] = $this->_getBYTE($font, $offset); - ++$offset; - } - $nGroups = $this->_getULONG($font, $offset); - $offset += 4; - for ($i = 0; $i < $nGroups; ++$i) { + case 10: { // Format 10: Trimmed array + $offset += 10; // skip reserved, length and version/language $startCharCode = $this->_getULONG($font, $offset); $offset += 4; - $endCharCode = $this->_getULONG($font, $offset); + $numChars = $this->_getULONG($font, $offset); $offset += 4; - $startGlyphID = $this->_getULONG($font, $offset); - $offset += 4; - for ($k = $startCharCode; $k <= $endCharCode; ++$k) { - $is32idx = floor($c / 8); - if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) { - $c = $k; - } else { - // 32 bit format - // convert to decimal (http://www.unicode.org/faq//utf_bom.html#utf16-4) - //LEAD_OFFSET = (0xD800 - (0x10000 >> 10)) = 55232 - //SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00) = -56613888 - $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888; - } + for ($k = 0; $k < $numChars; ++$k) { + $c = ($k + $startCharCode); + $g = $this->_getUSHORT($font, $offset); $ctg[$c] = $g; - ++$startGlyphID; + $offset += 2; } + break; } - break; - } - case 10: { // Format 10: Trimmed array - $offset += 10; // skip reserved, length and version/language - $startCharCode = $this->_getULONG($font, $offset); - $offset += 4; - $numChars = $this->_getULONG($font, $offset); - $offset += 4; - for ($k = 0; $k < $numChars; ++$k) { - $c = ($k + $startCharCode); - $g = $this->_getUSHORT($font, $offset); - $ctg[$c] = $g; - $offset += 2; - } - break; - } - case 12: { // Format 12: Segmented coverage - $offset += 10; // skip length and version/language - $nGroups = $this->_getULONG($font, $offset); - $offset += 4; - for ($k = 0; $k < $nGroups; ++$k) { - $startCharCode = $this->_getULONG($font, $offset); + case 12: { // Format 12: Segmented coverage + $offset += 10; // skip length and version/language + $nGroups = $this->_getULONG($font, $offset); $offset += 4; - $endCharCode = $this->_getULONG($font, $offset); - $offset += 4; - $startGlyphCode = $this->_getULONG($font, $offset); - $offset += 4; - for ($c = $startCharCode; $c <= $endCharCode; ++$c) { - $ctg[$c] = $startGlyphCode; - ++$startGlyphCode; + for ($k = 0; $k < $nGroups; ++$k) { + $startCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $endCharCode = $this->_getULONG($font, $offset); + $offset += 4; + $startGlyphCode = $this->_getULONG($font, $offset); + $offset += 4; + for ($c = $startCharCode; $c <= $endCharCode; ++$c) { + $ctg[$c] = $startGlyphCode; + ++$startGlyphCode; + } } + break; } - break; + case 13: { // Format 13: Many-to-one range mappings + // to be implemented ... + break; + } + case 14: { // Format 14: Unicode Variation Sequences + // to be implemented ... + break; + } } - case 13: { // Format 13: Many-to-one range mappings - // to be implemented ... - break; - } - case 14: { // Format 14: Unicode Variation Sequences - // to be implemented ... - break; - } } } if (!isset($ctg[0])) { @@ -10741,11 +10910,7 @@ $offset += 4; } foreach ($encodingTables as $enctable) { - if (($enctable['platformID'] == 3) AND ($enctable['encodingID'] == 0)) { - $modesymbol = true; - } else { - $modesymbol = false; - } + // get all platforms and encodings $offset = $table['cmap']['offset'] + $enctable['offset']; $format = $this->_getUSHORT($font, $offset); $offset += 2; @@ -10782,7 +10947,7 @@ $offset += 2; $subHeaders[$k]['entryCount'] = $this->_getUSHORT($font, $offset); $offset += 2; - $subHeaders[$k]['idDelta'] = $this->_getSHORT($font, $offset); + $subHeaders[$k]['idDelta'] = $this->_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idRangeOffset'] = $this->_getUSHORT($font, $offset); $offset += 2; @@ -10812,8 +10977,7 @@ $c = (($i << 8) + $j); if (isset($subsetchars[$c])) { $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); - $g = $glyphIndexArray[$idRangeOffset]; - $g += ($idDelta[$k] - 65536); + $g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536; if ($g < 0) { $g = 0; } @@ -10862,12 +11026,11 @@... [truncated message content] |