Thread: [Weberp-svn] SF.net SVN: weberp:[8861] trunk (Page 12)
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2012-05-09 01:37:47
|
Revision: 8861 http://weberp.svn.sourceforge.net/weberp/?rev=8861&view=rev Author: tim_schofield Date: 2012-05-09 01:37:41 +0000 (Wed, 09 May 2012) Log Message: ----------- Have a unique identifier for each instance of adjustment object Modified Paths: -------------- trunk/StockAdjustments.php trunk/StockAdjustmentsControlled.php trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsKeyed.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/StockAdjustments.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -11,46 +11,53 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (empty($_GET['identifier'])) { + /*unique session identifier to ensure that there is no conflict with other order entry sessions on the same machine */ + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + if (isset($_GET['NewAdjustment'])){ - unset($_SESSION['Adjustment']); - $_SESSION['Adjustment'] = new StockAdjustment(); + unset($_SESSION['Adjustment'.$identifier]); + $_SESSION['Adjustment'.$identifier] = new StockAdjustment(); } -if (!isset($_SESSION['Adjustment'])){ - $_SESSION['Adjustment'] = new StockAdjustment(); +if (!isset($_SESSION['Adjustment'.$identifier])){ + $_SESSION['Adjustment'.$identifier] = new StockAdjustment(); } $NewAdjustment = false; if (isset($_GET['StockID'])){ $StockID = trim(mb_strtoupper($_GET['StockID'])); - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($StockID)); - $result = DB_query("SELECT description, controlled, serialised, decimalplaces FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + $_SESSION['Adjustment'.$identifier]->StockID = trim(mb_strtoupper($StockID)); + $result = DB_query("SELECT description, controlled, serialised, decimalplaces FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "'",$db); $myrow = DB_fetch_array($result); - $_SESSION['Adjustment']->ItemDescription = $myrow['description']; - $_SESSION['Adjustment']->Controlled = $myrow['controlled']; - $_SESSION['Adjustment']->Serialised = $myrow['serialised']; - $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; - $_SESSION['Adjustment']->SerialItems = array(); - if (!isset($_SESSION['Adjustment']->Quantity)or !is_numeric($_SESSION['Adjustment']->Quantity)){ - $_SESSION['Adjustment']->Quantity=0; + $_SESSION['Adjustment'.$identifier]->ItemDescription = $myrow['description']; + $_SESSION['Adjustment'.$identifier]->Controlled = $myrow['controlled']; + $_SESSION['Adjustment'.$identifier]->Serialised = $myrow['serialised']; + $_SESSION['Adjustment'.$identifier]->DecimalPlaces = $myrow['decimalplaces']; + $_SESSION['Adjustment'.$identifier]->SerialItems = array(); + if (!isset($_SESSION['Adjustment'.$identifier]->Quantity)or !is_numeric($_SESSION['Adjustment'.$identifier]->Quantity)){ + $_SESSION['Adjustment'.$identifier]->Quantity=0; } $NewAdjustment = true; } elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) and $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + if(isset($_POST['StockID']) and $_POST['StockID'] != $_SESSION['Adjustment'.$identifier]->StockID){ $NewAdjustment = true; - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); + $_SESSION['Adjustment'.$identifier]->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); } - $_SESSION['Adjustment']->tag = $_POST['tag']; - $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; - $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; + $_SESSION['Adjustment'.$identifier]->tag = $_POST['tag']; + $_SESSION['Adjustment'.$identifier]->Narrative = $_POST['Narrative']; + $_SESSION['Adjustment'.$identifier]->StockLocation = $_POST['StockLocation']; if ($_POST['Quantity']==''){ $_POST['Quantity']=0; } else { $_POST['Quantity'] = filter_number_input($_POST['Quantity']); } - $_SESSION['Adjustment']->Quantity = $_POST['Quantity']; + $_SESSION['Adjustment'.$identifier]->Quantity = $_POST['Quantity']; } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -67,9 +74,16 @@ $ErrMsg=_('The stock information cannot be retrieved because'); $DbgMsg=_('The SQL to get the stock description was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class="selection"><tr><th>'._('Stock Code').'</th><th>'._('Stock Description').'</th></tr>'; + echo '<table class="selection"> + <tr> + <th>'._('Stock Code').'</th> + <th>'._('Stock Description').'</th> + </tr>'; while ($myrow = DB_fetch_array($result)) { - echo '<tr><td>'.$myrow['stockid'].'</td><td>'.$myrow['description'].'</td><td><a href="StockAdjustments.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'">'._('Adjust').'</a></tr>'; + echo '<tr> + <td>'.$myrow['stockid'].'</td> + <td>'.$myrow['description'].'</td> + <td><a href="StockAdjustments.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&identifier=' . $identifier . '">'._('Adjust').'</a></tr>'; } echo '</table>'; include('includes/footer.inc'); @@ -79,28 +93,28 @@ if (isset($_POST['EnterAdjustment'])){ $InputError = false; /*Start by hoping for the best */ - $result = DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + $result = DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "'",$db); if (DB_num_rows($result)==0) { prnMsg( _('The entered item code does not exist'),'error'); $InputError = true; - } elseif (!is_numeric($_SESSION['Adjustment']->Quantity)){ + } elseif (!is_numeric($_SESSION['Adjustment'.$identifier]->Quantity)){ prnMsg( _('The quantity entered must be numeric'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Quantity==0){ + } elseif ($_SESSION['Adjustment'.$identifier]->Quantity==0){ prnMsg( _('The quantity entered cannot be zero') . '. ' . _('There would be no adjustment to make'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Controlled==1 AND count($_SESSION['Adjustment']->SerialItems)==0) { + } elseif ($_SESSION['Adjustment'.$identifier]->Controlled==1 AND count($_SESSION['Adjustment'.$identifier]->SerialItems)==0) { prnMsg( _('The item entered is a controlled item that requires the detail of the serial numbers or batch references to be adjusted to be entered'),'error'); $InputError = true; } if ($_SESSION['ProhibitNegativeStock']==1){ $SQL = "SELECT quantity FROM locstock - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "'"; $CheckNegResult=DB_query($SQL,$db); $CheckNegRow = DB_fetch_array($CheckNegResult); - if ($CheckNegRow['quantity']+$_SESSION['Adjustment']->Quantity <0){ + if ($CheckNegRow['quantity']+$_SESSION['Adjustment'.$identifier]->Quantity <0){ $InputError=true; prnMsg(_('The system parameters are set to prohibit negative stocks. Processing this stock adjustment would result in negative stock at this location. This adjustment will not be processed.'),'error'); } @@ -119,8 +133,8 @@ // Need to get the current location quantity will need it later for the stock movement $SQL="SELECT locstock.quantity FROM locstock - WHERE locstock.stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode= '" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE locstock.stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode= '" . $_SESSION['Adjustment'.$identifier]->StockLocation . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_array($Result); @@ -141,15 +155,15 @@ qty, newqoh) VALUES ( - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . "', 17, '" . $AdjustmentNumber . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + '" . $_SESSION['Adjustment'.$identifier]->StockLocation . "', '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', - '" . $_SESSION['Adjustment']->Narrative ."', - '" . $_SESSION['Adjustment']->Quantity . "', - '" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "' + '" . $_SESSION['Adjustment'.$identifier]->Narrative ."', + '" . $_SESSION['Adjustment'.$identifier]->Quantity . "', + '" . ($QtyOnHandPrior + $_SESSION['Adjustment'.$identifier]->Quantity) . "' )"; @@ -163,8 +177,8 @@ /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ - if ($_SESSION['Adjustment']->Controlled ==1){ - foreach($_SESSION['Adjustment']->SerialItems as $Item){ + if ($_SESSION['Adjustment'.$identifier]->Controlled ==1){ + foreach($_SESSION['Adjustment'.$identifier]->SerialItems as $Item){ /*We need to add or update the StockSerialItem record and The StockSerialMoves as well */ @@ -172,8 +186,8 @@ $SQL = "SELECT stockid FROM stockserialitems WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Unable to determine if the serial item exists'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -183,8 +197,8 @@ $SQL = "UPDATE stockserialitems SET quantity= quantity + " . $Item->BundleQty . " WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); @@ -197,8 +211,8 @@ serialno, qualitytext, quantity) - VALUES ('" . $_SESSION['Adjustment']->StockID . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + VALUES ('" . $_SESSION['Adjustment'.$identifier]->StockID . "', + '" . $_SESSION['Adjustment'.$identifier]->StockLocation . "', '" . $Item->BundleRef . "', '', '" . $Item->BundleQty . "' @@ -217,7 +231,7 @@ serialno, moveqty) VALUES ('" . $StkMoveNo . "', - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . "', '" . $Item->BundleRef . "', '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); @@ -229,18 +243,18 @@ - $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment']->Quantity . "' - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment'.$identifier]->Quantity . "' + WHERE stockid='" . $_SESSION['Adjustment'.$identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment'.$identifier]->StockLocation . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the stock record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment']->StandardCost > 0){ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment'.$identifier]->StandardCost > 0){ - $StockGLCodes = GetStockGLCode($_SESSION['Adjustment']->StockID,$db); + $StockGLCodes = GetStockGLCode($_SESSION['Adjustment'.$identifier]->StockID,$db); $SQL = "INSERT INTO gltrans (type, typeno, @@ -255,10 +269,10 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity) . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . - $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . $_SESSION['Adjustment'.$identifier]->StandardCost * -($_SESSION['Adjustment'.$identifier]->Quantity) . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . " x " . $_SESSION['Adjustment'.$identifier]->Quantity . " @ " . + $_SESSION['Adjustment'.$identifier]->StandardCost . " " . $_SESSION['Adjustment'.$identifier]->Narrative . "', + '" . $_SESSION['Adjustment'.$identifier]->tag . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -278,9 +292,9 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . $_SESSION['Adjustment'.$identifier]->StandardCost * $_SESSION['Adjustment'.$identifier]->Quantity . "', + '" . $_SESSION['Adjustment'.$identifier]->StockID . " x " . $_SESSION['Adjustment'.$identifier]->Quantity . " @ " . $_SESSION['Adjustment'.$identifier]->StandardCost . " " . $_SESSION['Adjustment'.$identifier]->Narrative . "', + '" . $_SESSION['Adjustment'.$identifier]->tag . "' )"; $Errmsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -290,36 +304,36 @@ $Result = DB_Txn_Commit($db); - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . $_SESSION['Adjustment']->Quantity ; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment'.$identifier]->StockID . ' - ' . $_SESSION['Adjustment'.$identifier]->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment'.$identifier]->StockLocation .' '. _('for a quantity of') . ' ' . $_SESSION['Adjustment'.$identifier]->Quantity ; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ $ConfirmationText = $ConfirmationText . ' ' . _('by user') . ' ' . $_SESSION['UserID'] . ' ' . _('at') . ' ' . Date('Y-m-d H:i:s'); - $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID; + $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment'.$identifier]->StockID; mail($_SESSION['InventoryManagerEmail'],$EmailSubject,$ConfirmationText); } - unset ($_SESSION['Adjustment']); + unset ($_SESSION['Adjustment'.$identifier]); } /* end if there was no input error */ }/* end if the user hit enter the adjustment */ -echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; +echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier, ENT_QUOTES, 'UTF-8') . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (!isset($_SESSION['Adjustment'])) { +if (!isset($_SESSION['Adjustment'.$identifier])) { $StockID=''; $Controlled= 0; $Quantity = 0; } else { - $StockID = $_SESSION['Adjustment']->StockID; - $Controlled = $_SESSION['Adjustment']->Controlled; - $Quantity = $_SESSION['Adjustment']->Quantity; + $StockID = $_SESSION['Adjustment'.$identifier]->StockID; + $Controlled = $_SESSION['Adjustment'.$identifier]->Controlled; + $Quantity = $_SESSION['Adjustment'.$identifier]->Quantity; $sql="SELECT materialcost, labourcost, overheadcost, units FROM stockmaster WHERE stockid='".$StockID."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); - $_SESSION['Adjustment']->PartUnit=$myrow['units']; - $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $_SESSION['Adjustment'.$identifier]->PartUnit=$myrow['units']; + $_SESSION['Adjustment'.$identifier]->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; } echo '<br /><table class="selection">'; echo '<tr><th colspan="4" class="header">'._('Adjustment Details').'</th></tr>'; @@ -342,10 +356,10 @@ echo '<input type="text" name="StockCode" size="21" value="" maxlength="20" />'; } echo '</td><td><button type="submit" name="CheckCode">'._('Check Part').'</button></td></tr>'; -if (isset($_SESSION['Adjustment']) and mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ - echo '<tr><td colspan="3"><font size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . - $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . - locale_money_format($_SESSION['Adjustment']->StandardCost,$_SESSION['CompanyRecord']['currencydefault']) . '</font></td></tr>'; +if (isset($_SESSION['Adjustment'.$identifier]) and mb_strlen($_SESSION['Adjustment'.$identifier]->ItemDescription)>1){ + echo '<tr><td colspan="3"><font size="3">' . $_SESSION['Adjustment'.$identifier]->ItemDescription . ' ('._('In Units of').' ' . + $_SESSION['Adjustment'.$identifier]->PartUnit . ' ) - ' . _('Unit Cost').' = ' . + locale_money_format($_SESSION['Adjustment'.$identifier]->StandardCost,$_SESSION['CompanyRecord']['currencydefault']) . '</font></td></tr>'; } echo '<tr><td>'. _('Adjustment to Stock At Location').':</td><td><select name="StockLocation"> '; @@ -353,8 +367,8 @@ $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_SESSION['Adjustment']->StockLocation)){ - if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ + if (isset($_SESSION['Adjustment'.$identifier]->StockLocation)){ + if ($myrow['loccode'] == $_SESSION['Adjustment'.$identifier]->StockLocation){ echo '<option selected="True" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -368,26 +382,26 @@ } echo '</select></td></tr>'; -if (isset($_SESSION['Adjustment']) and !isset($_SESSION['Adjustment']->Narrative)) { - $_SESSION['Adjustment']->Narrative = ''; +if (isset($_SESSION['Adjustment'.$identifier]) and !isset($_SESSION['Adjustment'.$identifier]->Narrative)) { + $_SESSION['Adjustment'.$identifier]->Narrative = ''; } echo '<tr><td>'. _('Comments On Why').':</td> - <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $_SESSION['Adjustment']->Narrative . '" /></td></tr>'; + <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $_SESSION['Adjustment'.$identifier]->Narrative . '" /></td></tr>'; echo '<tr><td>'._('Adjustment Quantity').':</td>'; echo '<td>'; if ($Controlled==1){ - if ($_SESSION['Adjustment']->StockLocation == ''){ - $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; + if ($_SESSION['Adjustment'.$identifier]->StockLocation == ''){ + $_SESSION['Adjustment'.$identifier]->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="hidden" name="Quantity" value="' . locale_number_format($_SESSION['Adjustment']->Quantity , $_SESSION['Adjustment']->DecimalPlaces). '" /> - '.locale_number_format($_SESSION['Adjustment']->Quantity, $_SESSION['Adjustment']->DecimalPlaces).' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; + echo '<input type="hidden" name="Quantity" value="' . locale_number_format($_SESSION['Adjustment'.$identifier]->Quantity , $_SESSION['Adjustment'.$identifier]->DecimalPlaces). '" /> + '.locale_number_format($_SESSION['Adjustment'.$identifier]->Quantity, $_SESSION['Adjustment'.$identifier]->DecimalPlaces).' + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE&identifier=' . $identifier . '">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD&identifier=' . $identifier . '">'._('Add').'</a>]'; } else { - echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity, $_SESSION['Adjustment']->DecimalPlaces) . '" />'; + echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity, $_SESSION['Adjustment'.$identifier]->DecimalPlaces) . '" />'; } echo '</td></tr>'; //Select the tag @@ -401,7 +415,7 @@ $result=DB_query($SQL,$db); echo '<option value=0>0 - None</option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_SESSION['Adjustment']->tag) and $_SESSION['Adjustment']->tag==$myrow['tagref']){ + if (isset($_SESSION['Adjustment'.$identifier]->tag) and $_SESSION['Adjustment'.$identifier]->tag==$myrow['tagref']){ echo '<option selected="True" value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } else { echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; Modified: trunk/StockAdjustmentsControlled.php =================================================================== --- trunk/StockAdjustmentsControlled.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/StockAdjustmentsControlled.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -4,13 +4,13 @@ include('includes/DefineStockAdjustment.php'); include('includes/session.inc'); - +$identifier=$_GET['identifier']; $title = _('Adjusting Controlled Items'); /* Session started in header.inc for password checking and authorisation level check */ include('includes/header.inc'); -if (!isset($_SESSION['Adjustment'])) { +if (!isset($_SESSION['Adjustment'.$identifier])) { /* This page can only be called when a stock adjustment is pending */ echo '<div class="centre"><a href="' . $rootpath . '/StockAdjustments.php?NewAdjustment=Yes">'. _('Enter A Stock Adjustment'). '</a><br />'; prnMsg( _('This page can only be opened if a stock adjustment for a controlled item has been entered').'<br />','error'); @@ -18,14 +18,14 @@ include('includes/footer.inc'); exit; } -if (isset($_SESSION['Adjustment'])){ +if (isset($_SESSION['Adjustment'.$identifier])){ if (isset($_GET['AdjType']) and $_GET['AdjType']!=''){ - $_SESSION['Adjustment']->AdjustmentType = $_GET['AdjType']; + $_SESSION['Adjustment'.$identifier]->AdjustmentType = $_GET['AdjType']; } } /*Save some typing by referring to the line item class object in short form */ -$LineItem = $_SESSION['Adjustment']; +$LineItem = $_SESSION['Adjustment'.$identifier]; //Make sure this item is really controlled if ( $LineItem->Controlled != 1 ){ @@ -38,12 +38,12 @@ /***** get the page going now... *****/ echo '<div class="centre">'; -echo '<br /><a href="'.$rootpath.'/StockAdjustments.php">' . _('Back to Adjustment Screen') . '</a>'; +echo '<br /><a href="'.$rootpath.'/StockAdjustments.php?identifier=' . $identifier . '">' . _('Back to Adjustment Screen') . '</a>'; echo '<br /><font size="2"><b>'. _('Adjustment of controlled item').' ' . $LineItem->StockID . ' - ' . $LineItem->ItemDescription ; /** vars needed by InputSerialItem : **/ -$LocationOut = $_SESSION['Adjustment']->StockLocation; +$LocationOut = $_SESSION['Adjustment'.$identifier]->StockLocation; $StockID = $LineItem->StockID; if ($LineItem->AdjustmentType == 'ADD'){ echo '<br />'. _('Adding Items').'...'; @@ -65,7 +65,7 @@ /*TotalQuantity set inside this include file from the sum of the bundles of the item selected for adjusting */ -$_SESSION['Adjustment']->Quantity = $TotalQuantity; +$_SESSION['Adjustment'.$identifier]->Quantity = $TotalQuantity; /*Also a multi select box for adding bundles to the adjustment without keying, showing only when keying */ include('includes/footer.inc'); Modified: trunk/includes/InputSerialItems.php =================================================================== --- trunk/includes/InputSerialItems.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/includes/InputSerialItems.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -48,7 +48,7 @@ $invalid_imports = 0; $valid = true; -echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" enctype="multipart/form-data" >'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier , ENT_QUOTES, 'UTF-8') . '" enctype="multipart/form-data" >'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="LineNo" value="' . $LineNo . '" />'; echo '<input type="hidden" name="StockID" value="'. $StockID. '" />'; Modified: trunk/includes/InputSerialItemsKeyed.php =================================================================== --- trunk/includes/InputSerialItemsKeyed.php 2012-05-09 01:37:27 UTC (rev 8860) +++ trunk/includes/InputSerialItemsKeyed.php 2012-05-09 01:37:41 UTC (rev 8861) @@ -54,7 +54,7 @@ echo '<td class="number">' . $Bundle->ExpiryDate . '</td>'; } - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'&identifier=' . $identifier . '">'. _('Delete'). '</a></td></tr>'; $TotalQuantity += $Bundle->BundleQty; } @@ -79,7 +79,7 @@ echo $tableheader; -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" name="Ga6uF5Wa" method="post"> +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier, ENT_QUOTES, 'UTF-8') . '" name="Ga6uF5Wa" method="post"> <input type="hidden" name=LineNo value="' . $LineNo . '" /> <input type="hidden" name=StockID value="' . $StockID . '" /> <input type="hidden" name=EntryType value="KEYED" />'; @@ -131,7 +131,7 @@ } echo '</table>'; -echo '<br /><div class="centre"><input type="submit" name="AddBatches" value="'. _('Enter'). '" /></div>'; +echo '<br /><div class="centre"><button type="submit" name="AddBatches" value="'. _('Enter'). '">'. _('Enter'). '</button></div>'; echo '</form></td><td valign=top>'; if ($ShowExisting){ include('includes/InputSerialItemsExisting.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-10 08:50:07
|
Revision: 8869 http://weberp.svn.sourceforge.net/weberp/?rev=8869&view=rev Author: tim_schofield Date: 2012-05-10 08:49:56 +0000 (Thu, 10 May 2012) Log Message: ----------- Remove hard coding of price security token from the code and replace with a flag within security roles Modified Paths: -------------- trunk/CounterSales.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/WWW_Access.php trunk/includes/UserLogin.php Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2012-05-10 08:49:38 UTC (rev 8868) +++ trunk/CounterSales.php 2012-05-10 08:49:56 UTC (rev 8869) @@ -813,9 +813,22 @@ <td class="number">' . locale_number_format($OrderLine->QOHatLoc/$OrderLine->ConversionFactor,$OrderLine->DecimalPlaces) . '</td> <td>' . $OrderLine->Units . '</td>'; - echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . locale_number_format($OrderLine->Price,4) . '" /></td> - <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . locale_number_format($OrderLine->DiscountPercent * 100,2) . '" /></td> - <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="8" maxlength="8" value="' . locale_number_format($OrderLine->GPPercent,4) . '" /></td>'; + if ($_SESSION['CanViewPrices']==1) { + echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . locale_number_format($OrderLine->Price,4) . '" /></td>'; + } else { + echo '<input type="hidden" name="Price_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->Price,4) . '" />'; + echo '<td class="number">' . locale_number_format($OrderLine->Price,4) . '</td>'; + } + + if ($_SESSION['CanViewPrices']==1) { + echo '<td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . locale_number_format($OrderLine->DiscountPercent * 100,2) . '" /></td> + <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="8" maxlength="8" value="' . locale_number_format($OrderLine->GPPercent,4) . '" /></td>'; + } else { + echo '<input type="hidden" name="Discount_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->DiscountPercent * 100,2) . '" /> + <input type="hidden" name="GPPercent_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->GPPercent,4) . '" />'; + echo '<td class="number">' . locale_number_format($OrderLine->DiscountPercent * 100,2) . '</td> + <td class="number">' . locale_number_format($OrderLine->GPPercent,4) . '%</td>'; + } echo '<td class="number">' . locale_money_format($SubTotal,$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td>'; $LineDueDate = $OrderLine->ItemDue; if (!Is_Date($OrderLine->ItemDue)){ Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2012-05-10 08:49:38 UTC (rev 8868) +++ trunk/SelectOrderItems.php 2012-05-10 08:49:56 UTC (rev 8869) @@ -869,7 +869,7 @@ } } unset($NewItem); - } /* end of if quick entry */ + } /* end of if quick entry */ if (isset($_POST['AssetDisposalEntered'])){ //its an asset being disposed of if ($_POST['AssetToDisposeOf'] == 'NoAssetSelected'){ //don't do anything unless an asset is disposed of @@ -981,13 +981,15 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ - + if (!isset($PropertiesArray[$OrderLine->LineNumber])) { + $PropertiesArray[$OrderLine->LineNumber]=''; + } $Quantity = filter_number_input($_POST['Quantity_' . $OrderLine->LineNumber]); if (ABS($OrderLine->Price - $_POST['Price_' . $OrderLine->LineNumber])>0.01){ $Price = filter_currency_input($_POST['Price_' . $OrderLine->LineNumber]); $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-($_POST['Discount_' . $OrderLine->LineNumber]/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-$_POST['Discount_' . $OrderLine->LineNumber])/100); - } elseif (ABS($OrderLine->GPPercent - $_POST['GPPercent_' . $OrderLine->LineNumber])>=0.001) { + } elseif (ABS($OrderLine->GPPercent - $_POST['GPPercent_' . $OrderLine->LineNumber])>=0.01) { //then do a recalculation of the price at this new GP Percentage $Price = ($OrderLine->StandardCost*$ExRate)/(1 -(($_POST['GPPercent_' . $OrderLine->LineNumber] + $_POST['Discount_' . $OrderLine->LineNumber])/100)); } else { @@ -1224,10 +1226,12 @@ $DisplayDiscount = locale_number_format(($OrderLine->DiscountPercent * 100),2); $QtyOrdered = $OrderLine->Quantity; $QtyRemain = $QtyOrdered - $OrderLine->QtyInv; + $LineComments = ''; if ($OrderLine->QOHatLoc < $OrderLine->Quantity AND ($OrderLine->MBflag=='B' OR $OrderLine->MBflag=='M')) { /*There is a stock deficiency in the stock location selected */ $RowStarter = '<tr bgcolor="#EEAABB">'; //rows show red where stock deficiency + $LineComments = '* ' . _('Insufficient Stock at Location'); } elseif ($k==1){ $RowStarter = '<tr class="OddTableRows">'; $k=0; @@ -1256,7 +1260,7 @@ echo '<input type="hidden" name="Units_'.$OrderLine->LineNumber.'" value="' . $OrderLine->Units . '" />'; echo '<input type="hidden" name="ConversionFactor_'.$OrderLine->LineNumber.'" value="' . $OrderLine->ConversionFactor . '" />'; - if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ + if ($_SESSION['CanViewPrices']==1){ /*OK to display with discount if it is an internal user with appropriate permissions */ echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . locale_money_format($OrderLine->Price, $_SESSION['Items'.$identifier]->DefaultCurrency) . '" /></td> <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="7" maxlength="6" value="' . locale_number_format($OrderLine->DiscountPercent * 100, 2) . '" />%'; @@ -1267,8 +1271,12 @@ } echo '<td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="8" maxlength="40" value="' . locale_number_format($OrderLine->GPPercent,2) . '" /></td>'; } else { - echo '<td class="number">' . $OrderLine->Price . '</td><td></td>'; + echo '<td class="number">' . locale_money_format($OrderLine->Price, $_SESSION['Items'.$identifier]->DefaultCurrency) . '</td>'; echo '<input type="hidden" name="Price_' . $OrderLine->LineNumber . '" value="' . $OrderLine->Price . '" />'; + echo '<td class="number">' . locale_number_format($OrderLine->DiscountPercent * 100, 2) . '%</td>'; + echo '<input type="hidden" name="Discount_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->DiscountPercent * 100, 2) . '" />'; + echo '<td class="number">' . locale_number_format($OrderLine->GPPercent,2) . '%</td>'; + echo '<input type="hidden" name="GPPercent_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->GPPercent,2) . '" />'; } if ($_SESSION['Items'.$identifier]->Some_Already_Delivered($OrderLine->LineNumber)){ $RemTxt = _('Clear Remaining'); @@ -1284,7 +1292,8 @@ echo '<td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ItemDue_' . $OrderLine->LineNumber . '" size="10" maxlength="10" value="' . $LineDueDate . '" /></td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . $RemTxt . '</a></td></tr>'; + echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . $RemTxt . '</a></td> + <td>' . $LineComments . '</td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ echo $RowStarter; @@ -1376,19 +1385,17 @@ } else { $ColSpanNumber = 1; } - echo '<tr class="EvenTableRows"><td class="number" colspan="7"><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> - <td colspan="' . $ColSpanNumber . '" class="number">' . $DisplayTotal . '</td></tr></table>'; - $DisplayVolume = locale_number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<br /><table class="selection"><tr class="EvenTableRows"><td>' . _('Total Weight') . ':</td> + echo '<tr class="EvenTableRows"><td colspan="2"><table class="selection"><tr class="EvenTableRows"><td>' . _('Total Weight') . ':</td> <td>' . $DisplayWeight . '</td> <td>' . _('Total Volume') . ':</td> <td>' . $DisplayVolume . '</td> - </tr></table>'; + </tr></table></td><td class="number" colspan="4"><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> + <td colspan="' . $ColSpanNumber . '" class="number">' . $DisplayTotal . '</td> + <td colspan="3" style="text-align: right;"><button type="submit" name="Recalculate">' . _('Re-Calculate') . '</button></td></tr></table>'; - - echo '<br /><div class="centre"><button type="submit" name="Recalculate">' . _('Re-Calculate') . '</button> + echo '<br /><div class="centre"> <button type="submit" name="DeliveryDetails">' . _('Enter Delivery Details and Confirm Order') . '</button></div>'; } # end of if lines Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2012-05-10 08:49:38 UTC (rev 8868) +++ trunk/SelectProduct.php 2012-05-10 08:49:56 UTC (rev 8869) @@ -77,7 +77,7 @@ echo '<table width="90%" class="selection"><tr><th colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' ' . $ItemStatus . '</b></th></tr>'; echo '<tr><td width="40%" valign="top"> <table align="left" style="background: transparent;">'; //nested table - echo '<tr><th style="text-align:right;">' . _('Item Type:') . '</th> + echo '<tr><th style="text-align:right;"><b>' . _('Item Type:') . '</b></th> <td colspan="2" class="select">'; switch ($myrow['mbflag']) { case 'A': @@ -104,7 +104,7 @@ echo _('Manufactured Item'); break; } - echo '</td><th style="text-align:right;">' . _('Control Level:') . '</th><td class="select">'; + echo '</td><th style="text-align:right;"><b>' . _('Control Level:') . '</b></th><td class="select">'; if ($myrow['serialised'] == 1) { echo _('serialised'); } elseif ($myrow['controlled'] == 1) { @@ -112,16 +112,16 @@ } else { echo _('N/A'); } - echo '</td><th style="text-align:right;">' . _('Units') . ':</th> + echo '</td><th style="text-align:right;"><b>' . _('Units') . ':</b></th> <td class="select">' . $myrow['units'] . '</td></tr>'; - echo '<tr><th style="text-align:right;">' . _('Volume') . ':</th> + echo '<tr><th style="text-align:right;"><b>' . _('Volume') . ':</b></th> <td class="select" colspan="2">' . locale_number_format($myrow['volume'], 3) . '</td> - <th style="text-align:right;">' . _('Weight') . ':</th> + <th style="text-align:right;"><b>' . _('Weight') . ':</b></th> <td class="select">' . locale_number_format($myrow['kgs'], 3) . '</td> - <th style="text-align:right;">' . _('EOQ') . ':</th> + <th style="text-align:right;"><b>' . _('EOQ') . ':</b></th> <td class="select">' . locale_number_format($myrow['eoq'], $myrow['decimalplaces']) . '</td></tr>'; - if (in_array($PricesSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PricesSecurity)) { - echo '<tr><th colspan="2">' . _('Sell Price') . ':</th> + if ($_SESSION['CanViewPrices']==1) { + echo '<tr><th colspan="2"><b>' . _('Sell Price') . ':</b></th> <td class="select">'; $PriceResult = DB_query("SELECT typeabbrev, price, currabrev FROM prices WHERE currabrev ='" . $_SESSION['CompanyRecord']['currencydefault'] . "' @@ -150,7 +150,7 @@ $PriceRow = DB_fetch_array($PriceResult); $Price = $PriceRow['price']; echo $PriceRow['typeabbrev'] . '</td><td class="select">' . locale_money_format($Price, $PriceRow['currabrev']) . '</td> - <th style="text-align:right;">' . _('Gross Profit') . '</th> + <th style="text-align:right;"><b>' . _('Gross Profit') . '</b></th> <td class="select">'; if ($Price > 0) { $GP = locale_money_format(($Price - $Cost) * 100 / $Price, $PriceRow['currabrev']); @@ -163,7 +163,7 @@ echo '<tr><td></td> <td class="select">' . $PriceRow['typeabbrev'] . '</td> <td class="select">' . locale_money_format($Price, $PriceRow['currabrev']) . '</td> - <th style="text-align:right;">' . _('Gross Profit') . '</th> + <th style="text-align:right;"><b>' . _('Gross Profit') . '</b></th> <td class="select">'; if ($Price > 0) { $GP = locale_money_format(($Price - $Cost) * 100 / $Price, $PriceRow['currabrev']); @@ -187,7 +187,7 @@ } else { $Cost = $myrow['cost']; } - echo '<th style="text-align:right;">' . _('Cost') . '</th> + echo '<th style="text-align:right;"><b>' . _('Cost') . '</b></th> <td class="select">' . locale_money_format($Cost, $_SESSION['CompanyRecord']['currencydefault']) . '</td>'; } //end of if PricesSecuirty allows viewing of prices echo '</table>'; //end of first nested table Modified: trunk/WWW_Access.php =================================================================== --- trunk/WWW_Access.php 2012-05-10 08:49:38 UTC (rev 8868) +++ trunk/WWW_Access.php 2012-05-10 08:49:56 UTC (rev 8869) @@ -15,6 +15,10 @@ $SelectedRole = $_POST['SelectedRole']; } +if (!isset($_POST['CanViewPrices'])) { + $_POST['CanViewPrices']=0; +} + if (isset($_POST['submit']) or isset($_GET['remove']) or isset($_GET['add']) ) { //initialise no input errors assumed initially before we test @@ -33,12 +37,14 @@ unset($sql); if (isset($_POST['SecRoleName']) ){ // Update or Add Security Headings if(isset($SelectedRole)) { // Update Security Heading - $sql = "UPDATE securityroles SET secrolename = '".$_POST['SecRoleName']."' + $sql = "UPDATE securityroles + SET secrolename = '".$_POST['SecRoleName']."', + canviewprices='".$_POST['CanViewPrices']."' WHERE secroleid = '".$SelectedRole . "'"; $ErrMsg = _('The update of the security role description failed because'); $ResMsg = _('The Security role description was updated.'); } else { // Add Security Heading - $sql = "INSERT INTO securityroles (secrolename) VALUES ('".$_POST['SecRoleName']."')"; + $sql = "INSERT INTO securityroles (secrolename, canviewprices) VALUES ('".$_POST['SecRoleName']."', '".$_POST['CanViewPrices']."')"; $ErrMsg = _('The update of the security role failed because'); $ResMsg = _('The Security role was created.'); } @@ -78,8 +84,9 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'www_users' $sql= "SELECT COUNT(*) FROM www_users WHERE fullaccess='" . $_GET['SelectedRole'] . "'"; $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); - if (DB_num_rows($result)>0) { + if ($myrow[0]>0) { prnMsg( _('Cannot delete this role because user accounts are setup using it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('user accounts that have this security role setting') . '</font>'; } else { @@ -99,13 +106,17 @@ /* If its the first time the page has been displayed with no parameters then none of the above are true and the list of Users 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 secroleid, - secrolename - FROM securityroles - ORDER BY secrolename"; + secrolename, + canviewprices + FROM securityroles + ORDER BY secrolename"; $result = DB_query($sql,$db); echo '<table class="selection">'; - echo '<tr><th>' . _('Role') . '</th></tr>'; + echo '<tr> + <th>' . _('Role') . '</th> + <th>' . _('Can view') . '<br />' . _('prices') . '</th> + </tr>'; $k=0; //row colour counter @@ -118,18 +129,26 @@ $k=1; } + if ($myrow['canviewprices']==1) { + $CanViewPrices = _('Yes'); + } else { + $CanViewPrices = _('No'); + } + /*The SecurityHeadings array is defined in config.php */ printf('<td>%s</td> - <td><a href="%s?SelectedRole=%s">' . _('Edit') . '</a></td> - <td><a href="%s?SelectedRole=%s&delete=1&SecRoleName=%s">' . _('Delete') . '</a></td> - </tr>', - $myrow['secrolename'], - htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') , - $myrow['secroleid'], - htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') , - $myrow['secroleid'], - urlencode($myrow['secrolename'])); + <td>%s</td> + <td><a href="%s?SelectedRole=%s">' . _('Edit') . '</a></td> + <td><a href="%s?SelectedRole=%s&delete=1&SecRoleName=%s">' . _('Delete') . '</a></td> + </tr>', + $myrow['secrolename'], + $CanViewPrices, + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') , + $myrow['secroleid'], + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') , + $myrow['secroleid'], + urlencode($myrow['secrolename'])); } //END WHILE LIST LOOP echo '</table>'; @@ -144,7 +163,8 @@ //editing an existing role $sql = "SELECT secroleid, - secrolename + secrolename, + canviewprices FROM securityroles WHERE secroleid='" . $SelectedRole . "'"; $result = DB_query($sql, $db); @@ -154,6 +174,7 @@ $myrow = DB_fetch_array($result); $_POST['SelectedRole'] = $myrow['secroleid']; $_POST['SecRoleName'] = $myrow['secrolename']; + $_POST['CanViewPrices'] = $myrow['canviewprices']; } } echo '<br />'; @@ -166,8 +187,25 @@ if (!isset($_POST['SecRoleName'])) { $_POST['SecRoleName']=''; } -echo '<tr><td>' . _('Role') . ':</td> - <td><input type="text" name="SecRoleName" size="40" maxlength="40" value="' . $_POST['SecRoleName'] . '" /></tr>'; +if (!isset($_POST['CanViewPrices'])) { + $_POST['CanViewPrices']=0; +} +echo '<tr> + <td>' . _('Role') . ':</td> + <td><input type="text" name="SecRoleName" size="40" maxlength="40" value="' . $_POST['SecRoleName'] . '" /> + </tr>'; +if ($_POST['CanViewPrices']==1) { + echo '<tr> + <td>' . _('User can view prices') . ':</td> + <td><input type="checkbox" name="CanViewPrices" checked="checked" value="1" /> + </tr>'; +} else { + echo '<tr> + <td>' . _('User can view prices') . ':</td> + <td><input type="checkbox" name="CanViewPrices" value="1" /> + </tr>'; +} + echo '</table><br /> <div class="centre"><button type="submit" name="submit">' . _('Enter Role') . '</button></div></form>'; Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2012-05-10 08:49:38 UTC (rev 8868) +++ trunk/includes/UserLogin.php 2012-05-10 08:49:56 UTC (rev 8869) @@ -90,6 +90,12 @@ $sql = "UPDATE www_users SET lastvisitdate='". date('Y-m-d H:i:s') ."' WHERE www_users.userid='" . $Name . "'"; $Auth_Result = DB_query($sql, $db); + + $sql = "SELECT canviewprices FROM securityroles + WHERE secroleid = '" . $_SESSION['AccessLevel'] . "'"; + $ViewPricesResult = DB_query($sql, $db); + $MyViewPricesRow = DB_fetch_array($ViewPricesResult); + $_SESSION['CanViewPrices'] = $MyViewPricesRow['canviewprices']; /*get the security tokens that the user has access to */ $sql = "SELECT tokenid FROM securitygroups WHERE secroleid = '" . $_SESSION['AccessLevel'] . "'"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-10 18:57:14
|
Revision: 8881 http://weberp.svn.sourceforge.net/weberp/?rev=8881&view=rev Author: tim_schofield Date: 2012-05-10 18:57:08 +0000 (Thu, 10 May 2012) Log Message: ----------- Check country name is entered before updatin database Modified Paths: -------------- trunk/Currencies.php trunk/includes/MiscFunctions.php Modified: trunk/Currencies.php =================================================================== --- trunk/Currencies.php 2012-05-10 18:56:52 UTC (rev 8880) +++ trunk/Currencies.php 2012-05-10 18:57:08 UTC (rev 8881) @@ -80,6 +80,12 @@ $Errors[$i] = 'Country'; $i++; } + if (strlen($_POST['Country']) == 0) { + $InputError = 1; + prnMsg(_('You must enter a country name'),'error'); + $Errors[$i] = 'Country'; + $i++; + } if (strlen($_POST['HundredsName']) > 15) { $InputError = 1; prnMsg(_('The hundredths name must be 15 characters or less long'),'error'); Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2012-05-10 18:56:52 UTC (rev 8880) +++ trunk/includes/MiscFunctions.php 2012-05-10 18:57:08 UTC (rev 8881) @@ -172,13 +172,11 @@ $stack = array(); foreach ($tags as $tag) { $index = count($elements); - if (isset($tag['attributes']) and ($tag['type'] == 'complete' OR $tag['type'] == 'open')) { + if ($tag['type'] == 'complete' OR $tag['type'] == 'open') { $elements[$index] = new XmlElement; $elements[$index]->name = $tag['tag']; - $elements[$index]->attributes = $tag['attributes']; - if (isset($tag['value'])) { - $elements[$index]->content = $tag['value']; - } +// $elements[$index]->attributes = $tag['attributes']; +// $elements[$index]->content = $tag['value']; if ($tag['type'] == 'open') { // push $elements[$index]->children = array(); $stack[count($stack)] = &$elements; @@ -193,10 +191,8 @@ $Currencies = array(); - if (isset($elements)) { - foreach ($elements[0]->children[2]->children[0]->children as $CurrencyDetails){ - $Currencies[$CurrencyDetails->attributes['currency']]= $CurrencyDetails->attributes['rate'] ; - } + foreach ($elements[0]->children[2]->children[0]->children as $CurrencyDetails){ + $Currencies[$CurrencyDetails->attributes['currency']]= $CurrencyDetails->attributes['rate'] ; } $Currencies['EUR']=1; //ECB delivers no rate for Euro //return an array of the currencies and rates @@ -238,7 +234,6 @@ } } - function AddCarriageReturns($str) { return str_replace('\r\n',chr(10),$str); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-11 22:05:44
|
Revision: 8886 http://weberp.svn.sourceforge.net/weberp/?rev=8886&view=rev Author: tim_schofield Date: 2012-05-11 22:05:38 +0000 (Fri, 11 May 2012) Log Message: ----------- Bring foraward start date from planned work orders Modified Paths: -------------- trunk/MRPPlannedWorkOrders.php trunk/WorkOrderEntry.php Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2012-05-11 16:27:41 UTC (rev 8885) +++ trunk/MRPPlannedWorkOrders.php 2012-05-11 22:05:38 UTC (rev 8886) @@ -275,10 +275,11 @@ $k++; } - printf('<td><a href="%s/WorkOrderEntry.php?NewItem=%s&ReqQty=%s&ReqDate=%s">%s</a></td>', + printf('<td><a href="%s/WorkOrderEntry.php?NewItem=%s&ReqQty=%s&StartDate=%s&ReqDate=%s">%s</a></td>', $rootpath, $myrow['part'], $myrow['supplyquantity'], + ConvertSQLDate($myrow['mrpdate']), ConvertSQLDate($myrow['duedate']), _('Convert') ); Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2012-05-11 16:27:41 UTC (rev 8885) +++ trunk/WorkOrderEntry.php 2012-05-11 22:05:38 UTC (rev 8886) @@ -10,10 +10,17 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (isset($_GET['ReqDate'])){ - $ReqDate = $_GET['ReqDate']; + $ReqDate = ConvertSQLDate($_GET['ReqDate']); } else { $ReqDate=Date('Y-m-d'); } + +if (isset($_GET['StartDate'])){ + $StartDate = ConvertSQLDate($_GET['StartDate']); +} else { + $StartDate=Date('Y-m-d'); +} + if (isset($_GET['loccode'])){ $LocCode = $_GET['loccode']; } else { @@ -41,7 +48,7 @@ VALUES ('" . $_POST['WO'] . "', '" . $LocCode . "', '" . $ReqDate . "', - '" . Date('Y-m-d'). "')"; + '" . $StartDate. "')"; $InsWOResult = DB_query($sql,$db); } @@ -366,6 +373,8 @@ if ($CancelDelete==false) { //ie all tests proved ok to delete DB_Txn_Begin($db); + $ErrMsg = _('The work order could not be deleted'); + $DbgMsg = _('The SQL used to delete the work order was'); //delete the worequirements $sql = "DELETE FROM worequirements WHERE wo='" . $_POST['WO'] . "'"; $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -382,7 +391,7 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); DB_Txn_Commit($db); - prnMsg(_('The work order has been deleted'),'success'); + prnMsg(_('The work order has been cancelled'),'success'); echo '<p><a href="' . $rootpath . '/SelectWorkOrder.php">' . _('Select an existing outstanding work order') . '</a></p>'; @@ -557,7 +566,7 @@ echo '<br /><div class="centre"><button type="submit" name="submit">' . _('Update') . '</button></div>'; -echo '<br /><div class="centre"><button type="submit" name="delete" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete This Work Order') . '</button>'; +echo '<br /><div class="centre"><button type="submit" name="delete" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Cancel This Work Order') . '</button>'; echo '</div><br />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-12 19:56:34
|
Revision: 8892 http://weberp.svn.sourceforge.net/weberp/?rev=8892&view=rev Author: tim_schofield Date: 2012-05-12 19:56:27 +0000 (Sat, 12 May 2012) Log Message: ----------- Fixes to show links to batches and serial numbers Modified Paths: -------------- trunk/SelectProduct.php trunk/StockSerialItems.php trunk/includes/MiscFunctions.php Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2012-05-12 16:17:45 UTC (rev 8891) +++ trunk/SelectProduct.php 2012-05-12 19:56:27 UTC (rev 8892) @@ -139,7 +139,7 @@ if ($myrow['serialised'] == 1) { echo _('serialised'); } elseif ($myrow['controlled'] == 1) { - echo _('Batchs/Lots'); + echo '<a href="StockSerialItems.php?Location=All&StockID='.$StockID.'">' . _('Batchs/Lots') . '</a>'; } else { echo _('N/A'); } @@ -236,7 +236,7 @@ // Item Category Property mod: display the item properties echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table align="left" class="selection">'; + echo '<table align="left" style="background: transparent;border: gray solid 1px;border-radius: 5px">'; $CatValResult = DB_query("SELECT categoryid FROM stockmaster WHERE stockid='" . $StockID . "'", $db); @@ -264,7 +264,7 @@ echo '<input type="hidden" name="PropCat' . $PropertyRow['stkcatpropid'] . '" value="' . $PropertyRow['stkcatpropid'] . '" />'; switch ($PropertyRow['controltype']) { case 0; //textbox - echo '<td class="select number" width="60"><input type="text" name="PropValue' . $PropertyRow['stkcatpropid'] . '" value="' . $PropertyValue . '" />'; + echo '<td class="select number" style="border: 0px" width="60"><input type="text" name="PropValue' . $PropertyRow['stkcatpropid'] . '" value="' . $PropertyValue . '" />'; break; case 1; //select box $OptionValues = explode(',', $PropertyRow['defaultvalue']); @@ -290,7 +290,7 @@ $PropertyCounter++; } //end loop round properties for the item category echo '<tr> - <th colspan="2"><button type="submit" name="UpdateProperties">' . _('Update Properties') . '</button></th> + <th colspan="2" style="border: 0px"><button type="submit" name="UpdateProperties">' . _('Update Properties') . '</button></th> </tr>'; echo '</table></form>'; //end of Item Category Property mod echo '<td style="width: 15%; vertical-align: top"> @@ -463,8 +463,8 @@ echo '</td><td valign="top" class="select">'; /* Stock Transactions */ if ($Its_A_Kitset_Assembly_Or_Dummy == false) { - echo '<a href="' . $rootpath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; - echo '<a href="' . $rootpath . '/StockTransfers.php?StockID=' . $StockID . '&NewTransfer=Yes">' . _('Location Transfers') . '</a><br />'; + echo InternalLink($rootpath, '/StockAdjustments.php?StockID=' . $StockID, _('Quantity Adjustments')) . '<br />'; + echo InternalLink($rootpath, '/StockTransfers.php?StockID=' . $StockID . '&NewTransfer=Yes', _('Location Transfers')) . '<br />'; if (function_exists('imagecreatefrompng')){ $StockImgLink = 'GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. '&StockID='.urlencode($StockID). @@ -502,8 +502,8 @@ } /* end of ($Its_A_Kitset_Assembly_Or_Dummy == False) */ echo '</td><td valign="top" class="select">'; /* Stock Maintenance Options */ - echo '<a href="' . $rootpath . '/Stocks.php?">' . _('Add Inventory Items') . '</a><br />'; - echo '<a href="' . $rootpath . '/Stocks.php?StockID=' . $StockID . '">' . _('Modify Item Details') . '</a><br />'; + echo InternalLink($rootpath, '/Stocks.php?', _('Add Inventory Items'), '') . '<br />'; + echo InternalLink($rootpath, '/Stocks.php?StockID=' . $StockID . '', _('Modify Item Details'), '') . '<br />'; if ($Its_A_Kitset_Assembly_Or_Dummy == False) { echo '<a href="' . $rootpath . '/StockReorderLevel.php?StockID=' . $StockID . '">' . _('Maintain Reorder Levels') . '</a><br />'; echo '<a href="' . $rootpath . '/StockCostUpdate.php?StockID=' . $StockID . '">' . _('Maintain Standard Cost') . '</a><br />'; Modified: trunk/StockSerialItems.php =================================================================== --- trunk/StockSerialItems.php 2012-05-12 16:17:45 UTC (rev 8891) +++ trunk/StockSerialItems.php 2012-05-12 19:56:27 UTC (rev 8892) @@ -44,35 +44,48 @@ exit; } -$result = DB_query("SELECT locationname - FROM locations - WHERE loccode='" . $_GET['Location'] . "'", - $db, - _('Could not retrieve the stock location of the item because'), - _('The SQL used to lookup the location was')); +if ($_GET['Location']!='All') { + $result = DB_query("SELECT locationname + FROM locations + WHERE loccode='" . $_GET['Location'] . "'", + $db, + _('Could not retrieve the stock location of the item because'), + _('The SQL used to lookup the location was')); -$myrow = DB_fetch_array($result); + $myrow = DB_fetch_array($result); + $LocationName=$myrow['locationname']; -$sql = "SELECT serialno, - quantity, - expirationdate - FROM stockserialitems - WHERE loccode='" . $_GET['Location'] . "' - AND stockid = '" . $StockID . "' - AND quantity <>0"; + $sql = "SELECT serialno, + quantity, + expirationdate + FROM stockserialitems + WHERE loccode='" . $_GET['Location'] . "' + AND stockid = '" . $StockID . "' + AND quantity <>0"; + $ErrMsg = _('The serial numbers/batches held cannot be retrieved because'); + $LocStockResult = DB_query($sql, $db, $ErrMsg); +} else { + $LocationName=_('All Locations'); -$ErrMsg = _('The serial numbers/batches held cannot be retrieved because'); -$LocStockResult = DB_query($sql, $db, $ErrMsg); + $sql = "SELECT serialno, + quantity, + expirationdate + FROM stockserialitems + WHERE stockid = '" . $StockID . "' + AND quantity <>0"; + $ErrMsg = _('The serial numbers/batches held cannot be retrieved because'); + $LocStockResult = DB_query($sql, $db, $ErrMsg); +} + echo '<table cellpadding="2" class="selection">'; if ($Serialised==1){ - echo '<tr><th colspan="5" class="header">' . _('Serialised items in') . ' '; + echo '<tr><th colspan="5" class="header">' . _('Serialised items in') . ' ' . $LocationName . '</th></tr>'; } else { - echo '<tr><th colspan="11" class="header">' . _('Controlled items in') . ' '; + echo '<tr><th colspan="11" class="header">' . _('Controlled items in') . ' ' . $LocationName . '</th></tr>'; } -echo $myrow['locationname']. '</th></tr>'; echo '<tr><th colspan="11" class="header">'.$StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</th></tr>'; @@ -156,8 +169,8 @@ } //end of while loop +echo '<tr><th colspan="9"><b>' . _('Total quantity') . ': ' . locale_number_format($TotalQuantity, $DecimalPlaces) . '</b></th></tr>'; echo '</table><br />'; -echo '<div class="centre"><br /><b>' . _('Total quantity') . ': ' . locale_number_format($TotalQuantity, $DecimalPlaces) . '<br /></div>'; echo '</form>'; include('includes/footer.inc'); Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2012-05-12 16:17:45 UTC (rev 8891) +++ trunk/includes/MiscFunctions.php 2012-05-12 19:56:27 UTC (rev 8892) @@ -6,12 +6,6 @@ /** STANDARD MESSAGE HANDLING & FORMATTING **/ /********************************************/ -function prnMsg($Msg,$Type='info', $Prefix=''){ - - echo getMsg($Msg, $Type, $Prefix); - -}//prnMsg - function reverse_escape($str) { $search=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); $replace=array("\\","\0","\n","\r","\x1a","'",'"'); @@ -38,6 +32,12 @@ return str_replace($LocaleInfo['mon_decimal_point'], '.', str_replace($LocaleInfo['mon_thousands_sep'], '', $Amount)); } +function prnMsg($Msg,$Type='info', $Prefix=''){ + + echo getMsg($Msg, $Type, $Prefix); + +}//prnMsg + function getMsg($Msg,$Type='info',$Prefix=''){ $Colour=''; if (isset($_SESSION['LogSeverity']) and $_SESSION['LogSeverity']>0) { @@ -322,4 +322,12 @@ return false; } -?> +function InternalLink($rootpath, $Script, $Caption, $Format='') { + $ScriptNameArray = explode('?', substr($Script,1)); + $PageSecurity = $_SESSION['PageSecurityArray'][$ScriptNameArray[0]]; + if ((in_array($PageSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PageSecurity))) { + return '<a href="' . $rootpath . $Script .'">' . $Caption . '</a>'; + } +} + +?> \ 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: <tim...@us...> - 2012-05-17 10:02:59
|
Revision: 8911 http://weberp.svn.sourceforge.net/weberp/?rev=8911&view=rev Author: tim_schofield Date: 2012-05-17 10:02:53 +0000 (Thu, 17 May 2012) Log Message: ----------- Ahmed Fawzy: Fixes to tendering system Modified Paths: -------------- trunk/SupplierTenders.php trunk/includes/DefineOfferClass.php Modified: trunk/SupplierTenders.php =================================================================== --- trunk/SupplierTenders.php 2012-05-17 10:02:42 UTC (rev 8910) +++ trunk/SupplierTenders.php 2012-05-17 10:02:53 UTC (rev 8911) @@ -265,7 +265,7 @@ /*The supplier has chosen option 1 */ -if (isset($_POST['TenderType']) and $_POST['TenderType']==1 and !isset($_POST['Refresh'])) { +if (isset($_POST['TenderType']) AND $_POST['TenderType']==1 AND !isset($_POST['Refresh']) AND !isset($_GET['Delete'])) { $sql="SELECT offers.offerid, offers.stockid, stockmaster.description, @@ -506,6 +506,7 @@ echo '<td>' . $myrow['currcode'] . '</td>'; echo '<td><input type="text" class="number" size="10" name="Price'. $i . '" value="0.00" /></td>'; echo '<td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="RequiredByDate'. $i . '" size="11" value="' . ConvertSQLDate($MyItemRow['requiredbydate']) . '" /></td>'; + $i++; } echo '</form>'; } Modified: trunk/includes/DefineOfferClass.php =================================================================== --- trunk/includes/DefineOfferClass.php 2012-05-17 10:02:42 UTC (rev 8910) +++ trunk/includes/DefineOfferClass.php 2012-05-17 10:02:53 UTC (rev 8911) @@ -109,22 +109,31 @@ } } else { foreach ($this->LineItems as $LineItem) { - $sql="UPDATE offers SET - quantity='".$LineItem->Quantity."', - price='".$LineItem->Price."', - expirydate='".FormatDateForSQL($LineItem->ExpiryDate)."' - WHERE offerid='".$LineItem->LineNo . "'"; - $ErrMsg = _('The suppliers offer could not be updated on the database because'); - $DbgMsg = _('The SQL statement used to update the suppliers offer record and failed was'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - if (DB_error_no($db)==0) { - prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('has been updated in the database'), 'success'); - $this->OfferMailText .= $LineItem->Quantity.' '.$LineItem->Units.' '._('of').' '.$LineItem->StockID.' '._('at a price of'). - ' '.$this->CurrCode.$LineItem->Price."\n"; - } else { - prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('could not be updated in the database'), 'error'); - include('includes/footer.inc'); - exit; + if ($LineItem->Deleted==false){ //Update only the LineItems which is not flagged as deleted + $sql="UPDATE offers SET quantity='".$LineItem->Quantity."', + price='".$LineItem->Price."', + expirydate='".FormatDateForSQL($LineItem->ExpiryDate)."' + WHERE offerid='".$LineItem->LineNo . "'"; + $ErrMsg = _('The suppliers offer could not be updated on the database because'); + $DbgMsg = _('The SQL statement used to update the suppliers offer record and failed was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + if (DB_error_no($db)==0) { + prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('has been updated in the database'), 'success'); + $this->OfferMailText .= $LineItem->Quantity.' '.$LineItem->Units.' '._('of').' '.$LineItem->StockID.' '._('at a price of'). + ' '.$this->CurrCode.$LineItem->Price."\n"; + } else { + prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('could not be updated in the database'), 'error'); + include('includes/footer.inc'); + exit; + } + } else { // the LineItem is Deleted flag is true so delete it + $sql = "DELETE from offers WHERE offerid='".$LineItem->LineNo . "'"; + $ErrMsg = _('The suppliers offer could not be deleted on the database because'); + $DbgMsg = _('The SQL statement used to delete the suppliers offer record and failed was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + if (DB_error_no($db)==0) { + prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('has been deleted in the database'), 'success'); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-17 20:42:08
|
Revision: 8917 http://weberp.svn.sourceforge.net/weberp/?rev=8917&view=rev Author: tim_schofield Date: 2012-05-17 20:42:01 +0000 (Thu, 17 May 2012) Log Message: ----------- Abstract item search to separate functions and use ajax for searching Modified Paths: -------------- trunk/CounterSales.php Added Paths: ----------- trunk/includes/ItemSearch.php trunk/includes/ItemShowSearch.php Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2012-05-17 20:38:57 UTC (rev 8916) +++ trunk/CounterSales.php 2012-05-17 20:42:01 UTC (rev 8917) @@ -14,6 +14,7 @@ include('includes/GetPrice.inc'); include('includes/SQL_CommonFunctions.inc'); include('includes/GetSalesTransGLCodes.inc'); +include('includes/ItemSearch.php'); if (empty($_GET['identifier'])) { $identifier=date('U'); @@ -28,10 +29,6 @@ $_SESSION['Items'.$identifier]->Comments = _('Cash sale on') . ' ' . date($_SESSION['DefaultDateFormat']); } -if (isset($_POST['QuickEntry'])){ - unset($_POST['PartSearch']); -} - if (isset($_POST['OrderItems'])){ foreach ($_POST as $key => $value) { if (mb_strstr($key,'StockID')) { @@ -100,11 +97,11 @@ $_SESSION['PrintedPackingSlip'] = 0; /*Of course 'cos the order ain't even started !!*/ /*Get the default customer-branch combo from the user's default location record */ $sql = "SELECT cashsalecustomer, - cashsalebranch, - locationname, - taxprovinceid - FROM locations - WHERE loccode='" . $_SESSION['UserStockLocation'] ."'"; + cashsalebranch, + locationname, + taxprovinceid + FROM locations + WHERE loccode='" . $_SESSION['UserStockLocation'] ."'"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0) { prnMsg(_('Your user account does not have a valid default inventory location set up. Please see the system administrator to modify your user account.'),'error'); @@ -136,20 +133,20 @@ // Now check to ensure this account exists and set defaults */ $sql = "SELECT debtorsmaster.name, - holdreasons.dissallowinvoices, - debtorsmaster.salestype, - salestypes.sales_type, - debtorsmaster.currcode, - debtorsmaster.customerpoline, - paymentterms.terms - FROM debtorsmaster, - holdreasons, - salestypes, - paymentterms - WHERE debtorsmaster.salestype=salestypes.typeabbrev - AND debtorsmaster.holdreason=holdreasons.reasoncode - AND debtorsmaster.paymentterms=paymentterms.termsindicator - AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + holdreasons.dissallowinvoices, + debtorsmaster.salestype, + salestypes.sales_type, + debtorsmaster.currcode, + debtorsmaster.customerpoline, + paymentterms.terms + FROM debtorsmaster, + holdreasons, + salestypes, + paymentterms + WHERE debtorsmaster.salestype=salestypes.typeabbrev + AND debtorsmaster.holdreason=holdreasons.reasoncode + AND debtorsmaster.paymentterms=paymentterms.termsindicator + AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; $ErrMsg = _('The details of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->DebtorNo . ' ' . _('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the customer details and failed was') . ':'; @@ -176,21 +173,21 @@ /* now get the branch defaults from the customer branches table CustBranch. */ $sql = "SELECT custbranch.brname, - custbranch.braddress1, - custbranch.defaultshipvia, - custbranch.deliverblind, - custbranch.specialinstructions, - custbranch.estdeliverydays, - custbranch.salesman, - custbranch.taxgroupid, - custbranch.defaultshipvia - FROM custbranch - WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' - AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + custbranch.braddress1, + custbranch.defaultshipvia, + custbranch.deliverblind, + custbranch.specialinstructions, + custbranch.estdeliverydays, + custbranch.salesman, + custbranch.taxgroupid, + custbranch.defaultshipvia + FROM custbranch + WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' + AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('cannot be retrieved because'); $DbgMsg = _('SQL used to retrieve the branch details was') . ':'; - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($result)==0){ @@ -203,7 +200,6 @@ exit; } // add echo - echo '<br />'; $myrow = DB_fetch_array($result); $_SESSION['Items'.$identifier]->DeliverTo = ''; @@ -261,140 +257,6 @@ echo '</p>'; } -if (isset($_POST['Search']) or isset($_POST['Next']) or isset($_POST['Prev'])){ - - if ($_POST['Keywords']!=='' AND $_POST['StockCode']=='') { - $msg='<div class="page_help_text">' . _('Item description has been used in search') . '.</div>'; - } else if ($_POST['StockCode']!=='' AND $_POST['Keywords']=='') { - $msg='<div class="page_help_text">' . _('Item Code has been used in search') . '.</div>'; - } else if ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { - $msg='<div class="page_help_text">' . _('Stock Category has been used in search') . '.</div>'; - } - if (isset($_POST['Keywords']) AND strlen($_POST['Keywords'])>0) { - //insert wildcard characters in spaces - $_POST['Keywords'] = strtoupper($_POST['Keywords']); - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - - if ($_POST['StockCat']=='All'){ - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.decimalplaces - FROM stockmaster, - stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.mbflag <>'G' - AND stockmaster.description " . LIKE . " '" . $SearchString . "' - AND stockmaster.discontinued=0 - ORDER BY stockmaster.stockid"; - } else { - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.decimalplaces - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.mbflag <>'G' - AND stockmaster.discontinued=0 - AND stockmaster.description " . LIKE . " '" . $SearchString . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; - } - - } else if (strlen($_POST['StockCode'])>0){ - - $_POST['StockCode'] = strtoupper($_POST['StockCode']); - $SearchString = '%' . $_POST['StockCode'] . '%'; - - if ($_POST['StockCat']=='All'){ - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.controlled, - stockmaster.decimalplaces - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' - AND stockmaster.mbflag <>'G' - AND stockmaster.discontinued=0 - ORDER BY stockmaster.stockid"; - } else { - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.controlled, - stockmaster.decimalplaces - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' - AND stockmaster.mbflag <>'G' - AND stockmaster.discontinued=0 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; - } - - } else { - if ($_POST['StockCat']=='All'){ - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.controlled, - stockmaster.decimalplaces - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.discontinued=0 - ORDER BY stockmaster.stockid"; - } else { - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units, - stockmaster.controlled, - stockmaster.decimalplaces - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.mbflag <>'G' - AND stockmaster.discontinued=0 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; - } - } - - if (isset($_POST['Next'])) { - $Offset = $_POST['NextList']; - } - if (isset($_POST['Prev'])) { - $Offset = $_POST['previous']; - } - if (!isset($Offset) or $Offset<0) { - $Offset=0; - } - $SQL = $SQL . ' LIMIT ' . $_SESSION['DefaultDisplayRecordsMax'].' OFFSET '.($_SESSION['DefaultDisplayRecordsMax']*$Offset); - - $ErrMsg = _('There is a problem selecting the part records to display because'); - $DbgMsg = _('The SQL used to get the part selection was'); - $SearchResult = DB_query($SQL,$db,$ErrMsg, $DbgMsg); - - if (DB_num_rows($SearchResult)==0 ){ - prnMsg (_('There are no products available meeting the criteria specified'),'info'); - } - if (DB_num_rows($SearchResult)==1){ -/* $myrow=DB_fetch_array($SearchResult); - $NewItem = $myrow['stockid']; - DB_data_seek($SearchResult,0);*/ - } - if (DB_num_rows($SearchResult)< $_SESSION['DisplayRecordsMax']){ - $Offset=0; - } - -} //end of if search - - /* Always do the stuff below */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier='.$identifier . '" name="SelectParts" method="post">'; @@ -465,9 +327,10 @@ $NewItemDue = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); } /*Now figure out if the item is a kit set - the field MBFlag='K'*/ - $sql = "SELECT stockmaster.mbflag, stockmaster.controlled - FROM stockmaster - WHERE stockmaster.stockid='". $NewItem ."'"; + $sql = "SELECT stockmaster.mbflag, + stockmaster.controlled + FROM stockmaster + WHERE stockmaster.stockid='". $NewItem ."'"; $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); $DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was '); @@ -479,9 +342,9 @@ } elseif ($myrow=DB_fetch_array($KitResult)){ if ($myrow['mbflag']=='K'){ /*It is a kit set item */ $sql = "SELECT bom.component, - bom.quantity - FROM bom - WHERE bom.parent='" . $NewItem . "' + bom.quantity + FROM bom + WHERE bom.parent='" . $NewItem . "' AND bom.effectiveto > '" . Date('Y-m-d') . "' AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; @@ -504,7 +367,7 @@ } } unset($NewItem); - } /* end of if quick entry */ +} /* end of if quick entry */ /*Now do non-quick entry delete/edits/adds */ @@ -550,17 +413,18 @@ or $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, - $Quantity, - $Price, - $OrderLine->Units, - $OrderLine->ConversionFactor, - ($DiscountPercentage/100), - 0, - $Narrative, - 'No', /*Update DB */ - $_POST['ItemDue_' . $OrderLine->LineNumber], - $_POST['POLine_' . $OrderLine->LineNumber], - filter_number_input($_POST['GPPercent_' . $OrderLine->LineNumber])); + $Quantity, + $Price, + $OrderLine->Units, + $OrderLine->ConversionFactor, + ($DiscountPercentage/100), + 0, + $Narrative, + 'No', /*Update DB */ + $_POST['ItemDue_' . $OrderLine->LineNumber], + $_POST['POLine_' . $OrderLine->LineNumber], + filter_number_input($_POST['GPPercent_' . $OrderLine->LineNumber]) + ); } } //page not called from itself - POST variables not set } @@ -569,7 +433,8 @@ if (isset($_POST['Recalculate'])) { foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { $NewItem=$OrderLine->StockID; - $sql = "SELECT stockmaster.mbflag, stockmaster.controlled + $sql = "SELECT stockmaster.mbflag, + stockmaster.controlled FROM stockmaster WHERE stockmaster.stockid='". $OrderLine->StockID."'"; @@ -579,9 +444,9 @@ if ($myrow=DB_fetch_array($KitResult)){ if ($myrow['mbflag']=='K'){ /*It is a kit set item */ $sql = "SELECT bom.component, - bom.quantity - FROM bom - WHERE bom.parent='" . $OrderLine->StockID. "' + bom.quantity + FROM bom + WHERE bom.parent='" . $OrderLine->StockID. "' AND bom.effectiveto > '" . Date('Y-m-d') . "' AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; @@ -613,9 +478,9 @@ * controlled items and ghost/phantom items cannot be selected because the SQL to show items to select doesn't show 'em * */ $sql = "SELECT stockmaster.mbflag, - stockmaster.taxcatid - FROM stockmaster - WHERE stockmaster.stockid='". $NewItem ."'"; + stockmaster.taxcatid + FROM stockmaster + WHERE stockmaster.stockid='". $NewItem ."'"; $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); @@ -627,11 +492,11 @@ if ($myrow=DB_fetch_array($KitResult)){ if ($myrow['mbflag']=='K'){ /*It is a kit set item */ $sql = "SELECT bom.component, - bom.quantity - FROM bom - WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + bom.quantity + FROM bom + WHERE bom.parent='" . $NewItem . "' + AND bom.effectiveto > '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$db,$ErrMsg); @@ -678,9 +543,9 @@ if ($myrow=DB_fetch_array($KitResult)){ if ($myrow['mbflag']=='K'){ /*It is a kit set item */ $sql = "SELECT bom.component, - bom.quantity - FROM bom - WHERE bom.parent='" . $NewItem . "' + bom.quantity + FROM bom + WHERE bom.parent='" . $NewItem . "' AND bom.effectiveto > '" . Date('Y-m-d') . "' AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; @@ -731,10 +596,10 @@ } } $result = DB_query("SELECT MAX(discountrate) AS discount - FROM discountmatrix - WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' - AND discountcategory ='" . $OrderLine->DiscCat . "' - AND quantitybreak <='" . $QuantityOfDiscCat . "'",$db); + FROM discountmatrix + WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' + AND discountcategory ='" . $OrderLine->DiscCat . "' + AND quantitybreak <='" . $QuantityOfDiscCat . "'",$db); $myrow = DB_fetch_row($result); if ($myrow[0]==NULL){ $DiscountMatrixRate = 0; @@ -753,17 +618,16 @@ } } /* end of discount matrix lookup code */ -if (count($_SESSION['Items'.$identifier]->LineItems)>0 and !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */ +if (count($_SESSION['Items'.$identifier]->LineItems)>0 and !isset($_POST['ProcessSale']) and !isset($_POST['PartSearch'])){ /*only show order lines if there are any */ /* // ************************************************************************* // T H I S W H E R E T H E S A L E I S D I S P L A Y E D // ************************************************************************* */ - echo '<br /> - <table width="90%" cellpadding="2" class="selection"> - <tr>'; - echo '<th>' . _('Item Code') . '</th> + echo '<br /><table width="90%" cellpadding="2" class="selection"> + <tr> + <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('QOH') . '</th> @@ -774,7 +638,7 @@ <th>' . _('Net') . '</th> <th>' . _('Tax') . '</th> <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th> - </tr>'; + </tr>'; $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; @@ -807,10 +671,9 @@ echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> <td>' . $OrderLine->ItemDescription . '</td>'; - echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . ($OrderLine->LineNumber) . '" size="6" maxlength="6" value="' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '" />'; + echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . ($OrderLine->LineNumber) . '" size="6" maxlength="6" value="' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '" /></td>'; - echo '</td> - <td class="number">' . locale_number_format($OrderLine->QOHatLoc/$OrderLine->ConversionFactor,$OrderLine->DecimalPlaces) . '</td> + echo '<td class="number">' . locale_number_format($OrderLine->QOHatLoc/$OrderLine->ConversionFactor,$OrderLine->DecimalPlaces) . '</td> <td>' . $OrderLine->Units . '</td>'; if ($_SESSION['CanViewPrices']==1) { @@ -827,7 +690,7 @@ echo '<input type="hidden" name="Discount_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->DiscountPercent * 100,2) . '" /> <input type="hidden" name="GPPercent_' . $OrderLine->LineNumber . '" value="' . locale_number_format($OrderLine->GPPercent,4) . '" />'; echo '<td class="number">' . locale_number_format($OrderLine->DiscountPercent * 100,2) . '</td> - <td class="number">' . locale_number_format($OrderLine->GPPercent,4) . '%</td>'; + <td class="number">' . locale_number_format($OrderLine->GPPercent,4) . '%</td>'; } echo '<td class="number">' . locale_money_format($SubTotal,$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td>'; $LineDueDate = $OrderLine->ItemDue; @@ -872,34 +735,40 @@ } /* end of loop around items */ - echo '<tr class="EvenTableRows"><td colspan="8" class="number"><b>' . _('Total') . '</b></td> - <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td> - <td class="number">' . locale_money_format($TaxTotal,$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td> - <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td> - </tr> + echo '<tr class="EvenTableRows"> + <td colspan="8" class="number"><b>' . _('Total') . '</b></td> + <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td> + <td class="number">' . locale_money_format($TaxTotal,$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td> + <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->DefaultCurrency) . '</td> + </tr> </table>'; echo '<input type="hidden" name="TaxTotal" value="'.$TaxTotal.'" />'; echo '<br /><table><tr><td>'; //nested table - echo '<table class="selection"><tr> - <td>'. _('Picked Up By') .':</td> - <td><input type="text" size="25" maxlength="25" name="DeliverTo" value="' . stripslashes($_SESSION['Items'.$identifier]->DeliverTo) . '" /></td> - </tr>'; + echo '<table class="selection"> + <tr> + <td>'. _('Picked Up By') .':</td> + <td><input type="text" size="25" maxlength="25" name="DeliverTo" value="' . stripslashes($_SESSION['Items'.$identifier]->DeliverTo) . '" /></td> + </tr>'; echo '<tr> - <td>'. _('Contact Phone Number') .':</td> - <td><input type="text" size="25" maxlength="25" name="PhoneNo" value="' . stripslashes($_SESSION['Items'.$identifier]->PhoneNo) . '" /></td> - </tr>'; + <td>'. _('Contact Phone Number') .':</td> + <td><input type="text" size="25" maxlength="25" name="PhoneNo" value="' . stripslashes($_SESSION['Items'.$identifier]->PhoneNo) . '" /></td> + </tr>'; - echo '<tr><td>' . _('Contact Email') . ':</td><td><input type="text" size="25" maxlength="30" name="Email" value="' . stripslashes($_SESSION['Items'.$identifier]->Email) . '" /></td></tr>'; + echo '<tr> + <td>' . _('Contact Email') . ':</td> + <td><input type="text" size="25" maxlength="30" name="Email" value="' . stripslashes($_SESSION['Items'.$identifier]->Email) . '" /></td> + </tr>'; - echo '<tr><td>'. _('Customer Reference') .':</td> - <td><input type="text" size="25" maxlength="25" name="CustRef" value="' . stripcslashes($_SESSION['Items'.$identifier]->CustRef) . '" /></td> - </tr>'; + echo '<tr> + <td>'. _('Customer Reference') .':</td> + <td><input type="text" size="25" maxlength="25" name="CustRef" value="' . stripcslashes($_SESSION['Items'.$identifier]->CustRef) . '" /></td> + </tr>'; echo '<tr> - <td>'. _('Comments') .':</td> - <td><textarea name="Comments" cols="23" rows="5">' . stripcslashes($_SESSION['Items'.$identifier]->Comments) .'</textarea></td> - </tr>'; + <td>'. _('Comments') .':</td> + <td><textarea name="Comments" cols="23" rows="5">' . stripcslashes($_SESSION['Items'.$identifier]->Comments) .'</textarea></td> + </tr>'; echo '</table>'; //end the sub table in the first column of master table echo '</td><th style="vertical-align: top;border-width: 0px;">'; //for the master table echo '<table class="selection">'; // a new nested table in the second column of master table @@ -908,7 +777,9 @@ $_POST['PaymentMethod']='Cash'; - echo '<tr><td>' . _('Payment Type') . ':</td><td><select name="PaymentMethod">'; + echo '<tr> + <td>' . _('Payment Type') . ':</td> + <td><select name="PaymentMethod">'; while ($PaymentMethodRow = DB_fetch_array($PaymentMethodsResult)){ if (isset($_POST['PaymentMethod']) and $_POST['PaymentMethod'] == $PaymentMethodRow['paymentname']){ echo '<option selected="True" value="' . $PaymentMethodRow['paymentid'] . '">' . $PaymentMethodRow['paymentname'] . '</option>'; @@ -920,7 +791,9 @@ $BankAccountsResult = DB_query("SELECT bankaccountname, accountcode FROM bankaccounts",$db); - echo '<tr><td>' . _('Banked to') . ':</td><td><select name="BankAccount">'; + echo '<tr> + <td>' . _('Banked to') . ':</td> + <td><select name="BankAccount">'; while ($BankAccountsRow = DB_fetch_array($BankAccountsResult)){ if (isset($_POST['BankAccount']) and $_POST['BankAccount'] == $BankAccountsRow['accountcode']){ echo '<option selected="True" value="' . $BankAccountsRow['accountcode'] . '">' . $BankAccountsRow['bankaccountname'] . '</option>'; @@ -936,11 +809,19 @@ echo '</table>'; //end the sub table in the second column of master table echo '</th></tr></table>'; //end of column/row/master table - echo '<br /><div class="centre"><button type="submit" name="Recalculate">' . _('Re-Calculate') . '</button> - <button type="submit" name="ProcessSale">' . _('Process The Sale') . '</button></div><br />'; + echo '<br /><div class="centre"> + <button type="submit" name="Recalculate">' . _('Re-Calculate') . '</button> + <button type="submit" name="ProcessSale">' . _('Process The Sale') . '</button> + <button type="submit" name="PartSearch">' . _('Add more items') . '</button> + <button type="submit" name="CancelOrder" onclick="return confirm(\'' . _('Are you sure you wish to cancel this sale?') . '\');">' . _('Cancel Sale') . '</button> + </div>'; } # end of if lines +if (isset($_SESSION['Items'.$identifier]) and $_SESSION['Items'.$identifier]->ItemsOrdered==0) { + $_POST['PartSearch']='Yes'; +} + /* ********************************** * Invoice Processing Here * ********************************** @@ -963,13 +844,13 @@ $NegativesFound = false; foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { $SQL = "SELECT stockmaster.description, - locstock.quantity, - stockmaster.mbflag - FROM locstock - INNER JOIN stockmaster - ON stockmaster.stockid=locstock.stockid - WHERE stockmaster.stockid='" . $OrderLine->StockID . "' - AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "'"; + locstock.quantity, + stockmaster.mbflag + FROM locstock + INNER JOIN stockmaster + ON stockmaster.stockid=locstock.stockid + WHERE stockmaster.stockid='" . $OrderLine->StockID . "' + AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "'"; $ErrMsg = _('Could not retrieve the quantity left at the location once this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -985,15 +866,15 @@ $SQL = "SELECT bom.component, stockmaster.description, locstock.quantity-(" . $OrderLine->Quantity . "*bom.quantity) AS qtyleft - FROM bom - INNER JOIN locstock - ON bom.component=locstock.stockid - INNER JOIN stockmaster - ON stockmaster.stockid=bom.component - WHERE bom.parent='" . $OrderLine->StockID . "' - AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "' - AND effectiveafter <'" . Date('Y-m-d') . "' - AND effectiveto >='" . Date('Y-m-d') . "'"; + FROM bom + INNER JOIN locstock + ON bom.component=locstock.stockid + INNER JOIN stockmaster + ON stockmaster.stockid=bom.component + WHERE bom.parent='" . $OrderLine->StockID . "' + AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "' + AND effectiveafter <'" . Date('Y-m-d') . "' + AND effectiveto >='" . Date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve the component quantity left at the location once the assembly item on this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -1020,10 +901,10 @@ /* Now Get the area where the sale is to from the branches table */ $SQL = "SELECT area, - defaultshipvia - FROM custbranch - WHERE custbranch.debtorno ='". $_SESSION['Items'.$identifier]->DebtorNo . "' - AND custbranch.branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "'"; + defaultshipvia + FROM custbranch + WHERE custbranch.debtorno ='". $_SESSION['Items'.$identifier]->DebtorNo . "' + AND custbranch.branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "'"; $ErrMsg = _('We were unable to load the area where the sale is to from the custbranch table'); $Result = DB_query($SQL,$db, $ErrMsg); @@ -1291,40 +1172,39 @@ /*Now insert the DebtorTrans */ - $SQL = "INSERT INTO debtortrans ( - transno, - type, - debtorno, - branchcode, - trandate, - inputdate, - prd, - reference, - tpe, - order_, - ovamount, - ovgst, - rate, - invtext, - shipvia, - alloc ) - VALUES ( - '". $InvoiceNo . "', - 10, - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $DefaultDispatchDate . "', - '" . date('Y-m-d H-i-s') . "', - '" . $PeriodNo . "', - '" . $_SESSION['Items'.$identifier]->CustRef . "', - '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', - '" . $OrderNo . "', - '" . filter_currency_input($_SESSION['Items'.$identifier]->total) . "', - '" . filter_currency_input($_POST['TaxTotal']) . "', - '" . $ExRate . "', - '" . $_SESSION['Items'.$identifier]->Comments . "', - '" . $_SESSION['Items'.$identifier]->ShipVia . "', - '" . filter_number_input($_SESSION['Items'.$identifier]->total + $_POST['TaxTotal']) . "')"; + $SQL = "INSERT INTO debtortrans (transno, + type, + debtorno, + branchcode, + trandate, + inputdate, + prd, + reference, + tpe, + order_, + ovamount, + ovgst, + rate, + invtext, + shipvia, + alloc ) + VALUES ( + '". $InvoiceNo . "', + 10, + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $DefaultDispatchDate . "', + '" . date('Y-m-d H-i-s') . "', + '" . $PeriodNo . "', + '" . $_SESSION['Items'.$identifier]->CustRef . "', + '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', + '" . $OrderNo . "', + '" . filter_currency_input($_SESSION['Items'.$identifier]->total) . "', + '" . filter_currency_input($_POST['TaxTotal']) . "', + '" . $ExRate . "', + '" . $_SESSION['Items'.$identifier]->Comments . "', + '" . $_SESSION['Items'.$identifier]->ShipVia . "', + '" . filter_number_input($_SESSION['Items'.$identifier]->total + $_POST['TaxTotal']) . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction record could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1335,15 +1215,16 @@ foreach ($_SESSION['Items'.$identifier]->TaxTotals AS $TaxAuthID => $TaxAmount) { $SQL = "INSERT INTO debtortranstaxes (debtortransid, - taxauthid, - taxamount) - VALUES ('" . $DebtorTransID . "', - '" . $TaxAuthID . "', - '" . filter_currency_input($TaxAmount/$ExRate) . "')"; + taxauthid, + taxamount) + VALUES ( + '" . $DebtorTransID . "', + '" . $TaxAuthID . "', + '" . filter_currency_input($TaxAmount/$ExRate) . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } @@ -1425,35 +1306,34 @@ if (empty($AssParts['standard'])) { $AssParts['standard']=0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - prd, - reference, - qty, - standardcost, - show_on_inv_crds, - newqoh - ) VALUES ( - '" . $AssParts['component'] . "', - 10, - '" . $InvoiceNo . "', - '" . $_SESSION['Items'.$identifier]->Location . "', - '" . $DefaultDispatchDate . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', - '-" . filter_number_input($AssParts['quantity'] * $OrderLine->Quantity) . "', - '" . $AssParts['standard'] . "', - 0, - newqoh-" . filter_number_input($AssParts['quantity'] * $OrderLine->Quantity) . " - )"; + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh + ) VALUES ( + '" . $AssParts['component'] . "', + 10, + '" . $InvoiceNo . "', + '" . $_SESSION['Items'.$identifier]->Location . "', + '" . $DefaultDispatchDate . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $OrderNo . "', + '-" . filter_number_input($AssParts['quantity'] * $OrderLine->Quantity) . "', + '" . $AssParts['standard'] . "', + 0, + newqoh-" . filter_number_input($AssParts['quantity'] * $OrderLine->Quantity) . " + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1482,23 +1362,23 @@ $OrderLine->StandardCost=0; } if ($MBFlag=='B' OR $MBFlag=='M'){ - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - newqoh, - narrative ) - VALUES ('" . $OrderLine->StockID . "', + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh, + narrative + ) VALUES ( + '" . $OrderLine->StockID . "', 10, '" . $InvoiceNo . "', '" . $_SESSION['Items'.$identifier]->Location . "', @@ -1518,22 +1398,21 @@ if (empty($OrderLine->StandardCost)) { $OrderLine->StandardCost = 0; } - $SQL = "INSERT INTO stockmoves ( - stockid, - type, - transno, - loccode, - trandate, - debtorno, - branchcode, - price, - prd, - reference, - qty, - discountpercent, - standardcost, - narrative ) - VALUES ('" . $OrderLine->StockID . "', + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + narrative + ) VALUES ('" . $OrderLine->StockID . "', 10, '" . $InvoiceNo . "', '" . $_SESSION['Items'.$identifier]->Location . "', @@ -1566,17 +1445,16 @@ $DbgMsg = _('The following SQL to update the stock batch record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $SQL="INSERT INTO stockserialmoves - (stockmoveno, - stockid, - serialno, - moveqty) - VALUES ( - '" . $StkMoveNo . "', - '" . $OrderLine->StockID . "', - '" . $SerialItemNumber . "', - '-" . filter_number_input($OrderLine->SerialItems['Quantity'][$i]*$OrderLine->ConversionFactor) . "' - )"; + $SQL="INSERT INTO stockserialmoves (stockmoveno, + stockid, + serialno, + moveqty + ) VALUES ( + '" . $StkMoveNo . "', + '" . $OrderLine->StockID . "', + '" . $SerialItemNumber . "', + '-" . filter_number_input($OrderLine->SerialItems['Quantity'][$i]*$OrderLine->ConversionFactor) . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Batch numbers could not be updated'); $DbgMsg = _('The following SQL to insert the stock batch movement was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1587,61 +1465,22 @@ foreach ($OrderLine->Taxes as $Tax) { $SQL = "INSERT INTO stockmovestaxes (stkmoveno, - taxauthid, - taxrate, - taxcalculationorder, - taxontax) - VALUES ('" . $StkMoveNo . "', - '" . $Tax->TaxAuthID . "', - '" . $Tax->TaxRate . "', - '" . $Tax->TaxCalculationOrder . "', - '" . $Tax->TaxOnTax . "')"; + taxauthid, + taxrate, + taxcalculationorder, + taxontax + ) VALUES ( + '" . $StkMoveNo . "', + '" . $Tax->TaxAuthID . "', + '" . $Tax->TaxRate . "', + '" . $Tax->TaxCalculationOrder . "', + '" . $Tax->TaxOnTax . "')"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Taxes and rates applicable to this invoice line item could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement tax detail records was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } //end for each tax for the line - /* Controlled stuff not currently handled by counter orders - - Insert the StockSerialMovements and update the StockSerialItems for controlled items - - if ($OrderLine->Controlled ==1){ - foreach($OrderLine->SerialItems as $Item){ - //We need to add the StockSerialItem record and the StockSerialMoves as well - - $SQL = "UPDATE stockserialitems - SET quantity= quantity - " . $Item->BundleQty . " - WHERE stockid='" . $OrderLine->StockID . "' - AND loccode='" . $_SESSION['Items'.$identifier]->Location . "' - AND serialno='" . $Item->BundleRef . "'"; - - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); - $DbgMsg = _('The following SQL to update the serial stock item record was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - - // now insert the serial stock movement - - $SQL = "INSERT INTO stockserialmoves (stockmoveno, - stockid, - serialno, - moveqty) - VALUES (" . $StkMoveNo . ", - '" . $OrderLine->StockID . "', - '" . $Item->BundleRef . "', - " . -$Item->BundleQty . ")"; - - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); - $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - }// foreach controlled item in the serialitems array - } //end if the orderline is a controlled item - - End of controlled stuff not currently handled by counter orders - */ - - /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), @@ -1715,24 +1554,25 @@ budgetoractual, salesperson, stkcategory ) - SELECT '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', - '" . $PeriodNo . "', - '" . filter_currency_input($OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', - '" . filter_currency_input($OrderLine->StandardCost * $OrderLine->Quantity) . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $_SESSION['Items'.$identifier]->Branch . "', - '" . $OrderLine->Quantity . "', - '" . filter_currency_input($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', - '" . $OrderLine->StockID . "', - custbranch.area, - 1, - custbranch.salesman, - stockmaster.categoryid - FROM stockmaster, - custbranch - WHERE stockmaster.stockid = '" . $OrderLine->StockID . "' - AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "' - AND custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "'"; + SELECT + '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', + '" . $PeriodNo . "', + '" . filter_currency_input($OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', + '" . filter_currency_input($OrderLine->StandardCost * $OrderLine->Quantity) . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '" . $OrderLine->Quantity . "', + '" . filter_currency_input($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->Quantity / $ExRate) . "', + '" . $OrderLine->StockID . "', + custbranch.area, + 1, + custbranch.salesman, + stockmaster.categoryid + FROM stockmaster, + custbranch + WHERE stockmaster.stockid = '" . $OrderLine->StockID . "' + AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "' + AND custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "'"; } $ErrMsg = _('Sales analysis record could not be added or updated because'); @@ -1955,25 +1795,26 @@ //insert the banktrans record in the currency of the bank account $SQL="INSERT INTO banktrans (type, - transno, - bankact, - ref, - exrate, - functionalexrate, - transdate, - banktranstype, - amount, - currcode) - VALUES (12, - '" . $ReceiptNumber . "', - '" . $_POST['BankAccount'] . "', - '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') . ' ' . $InvoiceNo . "', - '" . $ExRate . "', - '" . $BankAccountExRate . "', - '" . $DefaultDispatchDate . "', - '" . $_POST['PaymentMethod'] . "', - '" . filter_currency_input(filter_currency_input($_POST['AmountPaid']) * $BankAccountExRate) . "', - '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; + transno, + bankact, + ref, + exrate, + functionalexrate, + transdate, + banktranstype, + amount, + currcode) + VALUES ( + 12, + '" . $ReceiptNumber . "', + '" . $_POST['BankAccount'] . "', + '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') . ' ' . $InvoiceNo . "', + '" . $ExRate . "', + '" . $BankAccountExRate . "', + '" . $DefaultDispatchDate . "', + '" . $_POST['PaymentMethod'] . "', + '" . filter_currency_input(filter_currency_input($_POST['AmountPaid']) * $BankAccountExRate) . "', + '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); $ErrMsg = _('Cannot insert a bank transaction'); @@ -1982,27 +1823,28 @@ //insert a new debtortrans for the receipt $SQL = "INSERT INTO debtortrans (transno, - type, - debtorno, - trandate, - inputdate, - prd, - reference, - rate, - ovamount, - alloc, - invtext) - VALUES ('" . $ReceiptNumber . "', - 12, - '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - '" . $DefaultDispatchDate . "', - '" . date('Y-m-d H-i-s') . "', - '" . $PeriodNo . "', - '" . $InvoiceNo . "', - '" . $ExRate . "', - '-" . filter_currency_input($_POST['AmountPaid']) . "', - '-" . filter_currency_input($_POST['AmountPaid']) . "', - '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') ."')"; + type, + debtorno, + trandate, + inputdate, + prd, + reference, + rate, + ovamount, + alloc, + invtext) + VALUES ( + '" . $ReceiptNumber . "', + 12, + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $DefaultDispatchDate . "', + '" . date('Y-m-d H-i-s') . "', + '" . $PeriodNo . "', + '" . $InvoiceNo . "', + '" . $ExRate . "', + '-" . filter_currency_input($_POST['AmountPaid']) . "', + '-" . filter_currency_input($_POST['AmountPaid']) . "', + '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') ."')"; $DbgMsg = _('The SQL that failed to insert the customer receipt transaction was'); $ErrMsg = _('Cannot insert a receipt transaction against the customer because') ; @@ -2051,7 +1893,7 @@ } else { echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PDFReceipt.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this receipt'). '</a><br /><br />'; } - echo '<br /><br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Start a new Counter Sale') . '</a></div>'; + echo '<br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Start a new Counter Sale') . '</a></div>'; } // There were input errors so don't process nuffin @@ -2068,401 +1910,10 @@ $ImageSource = _('No Image'); /* Now show the stock item selection search stuff below */ -if (!isset($_POST['ProcessSale'])){ - if (isset($_POST['PartSearch']) and $_POST['PartSearch']!=''){ - - echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '" />'; - - if ($_SESSION['FrequentlyOrderedItems']>0){ //show the Frequently Order Items selection where configured to do so - - // Select the most recently ordered items for quick select - $SixMonthsAgo = DateAdd (Date($_SESSION['DefaultDateFormat']),'m',-6); - - $SQL="SELECT stockmaster.units, - stockmaster.description, - stockmaster.decimalplaces, - stockmaster.stockid, - stockmaster.controlled, - salesorderdetails.stkcode, - SUM(qtyinvoiced) Sales - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode = stockmaster.stockid - WHERE ActualDispatchDate >= '" . FormatDateForSQL($SixMonthsAgo) . "' - AND stockmaster.controlled=0 - GROUP BY stkcode - ORDER BY sales DESC - LIMIT " . $_SESSION['FrequentlyOrderedItems']; - $result2 = DB_query($SQL,$db); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' '; - echo _('Frequently Ordered Items') . '</p><br />'; - echo '<div class="page_help_text">' . _('Frequently Ordered Items') . _(', shows the most frequently ordered items in the last 6 months. You can choose from this list, or search further for other items') . '.</div><br />'; - echo '<table class="table1">'; - $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('On Demand') . '</th> - <th>' . _('On Order') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('Quantity') . '</th></tr>'; - echo $TableHeader; - $j = 1; - $k=0; //row colour counter - - while ($myrow=DB_fetch_array($result2)) { - // Find the quantity in stock at location - $QohSql = "SELECT sum(quantity) - FROM locstock - WHERE stockid='" .$myrow['stockid'] . "' AND - loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; - $QohResult = DB_query($QohSql,$db); - $QohRow = DB_fetch_row($QohResult); - $QOH = $QohRow[0]; - - // Find the quantity on outstanding sales orders - $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "' AND - salesorderdetails.completed=0 AND - salesorders.quotation=0 AND - salesorderdetails.stkcode='" . $myrow['stockid'] . "'"; - - $ErrMsg = _('The demand for this product from') . ' ' . $_SESSION['Items'.$identifier]->Location . ' ' . - _('cannot be retrieved because'); - $DemandResult = DB_query($sql,$db,$ErrMsg); - - $DemandRow = DB_fetch_row($DemandResult); - if ($DemandRow[0] != null){ - $DemandQty = $DemandRow[0]; - } else { - $DemandQty = 0; - } - // Find the quantity on purchase orders - $sql = "SELECT SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS QOO - FROM purchorderdetails INNER JOIN purchorders - WHERE purchorderdetails.completed=0 - AND purchorders.status<>'Cancelled' - AND purchorders.status<>'Rejected' - AND purchorderdetails.itemcode='" . $myrow['stockid'] . "'"; - - $ErrMsg = _('The order details for this product cannot be retrieved because'); - $PurchResult = DB_query($sql,$db,$ErrMsg); - - $PurchRow = DB_fetch_row($PurchResult); - if ($PurchRow[0]!=null){ - $PurchQty = $PurchRow[0]; - } else { - $PurchQty = 0; - } - - // Find the quantity on works orders - $sql = "SELECT SUM(woitems.qtyreqd - woitems.qtyrecd) AS dedm - FROM woitems - WHERE stockid='" . $myrow['stockid'] ."'"; - $ErrMsg = _('The order details for this product cannot be retrieved because'); - $WoResult = DB_query($sql,$db,$ErrMsg); - $WoRow = DB_fetch_row($WoResult); - if ($WoRow[0]!=null){ - $WoQty = $WoRow[0]; - } else { - $WoQty = 0; - } - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - $OnOrder = $PurchQty + $WoQty; - - $Available = $QOH - $DemandQty + $OnOrder; - - printf('<td>%s</font></td> - <td>%s</td> - <td>%s</td> - <td style="text-align:center">%s</td> - <td style="text-align:center">%s</td> - <td style="text-align:center">%s</td> - <td style="text-align:center">%s</td> - <td><font size="1"><input class="number" type="text" size="6" name="itm'.$myrow['stockid'].'" value="0" /> - </td> - </tr>', - $myrow['stockid'], - $myrow['description'], - $myrow['units'], - locale_number_format($QOH, $myrow['decimalplaces']), - locale_number_format($DemandQty, $myrow['decimalplaces']), - locale_number_format($OnOrder, $myrow['decimalplaces']), - locale_number_format($Available, $myrow['decimalplaces'])); - - echo '<input type="hidden" name="Units' . $myrow['stockid'] . '" value="' . $myrow['units'] . '" />'; - - if ($j==1) { - $jsCall = '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.itm'.$myrow['stockid'].');}</script>'; - } - $j++; - #end of page full new headings if - } - #end of while loop for Frequently Ordered Items - echo '<td style="text-align:center" colspan="8"> - <input type="hidden" name="OrderItems" value="1" /> - <button type="submit">'._('Add to Sale').'</button></td>'; - echo '</table>'; - } //end of if Frequently Ordered Items > 0 - if (isset($msg)){ - echo '<p><div class="centre"><b>' . $msg . '</b></div></p>'; - } - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' '; - echo _('Search for Items') . '</p>'; - echo '<div class="page_help_text">' . _('Search for Items') . _(', Searches the database for items, you can narrow the results by selecting a stock category, or just enter a partial item description or partial item code') . '.</div><br />'; - echo '<table class="selection"><tr><td><b>' . _('Select a Stock Category') . ': </b><select tabindex="1" name="StockCat">'; - - if (!isset($_POST['StockCat'])){ - echo '<option selected="True" value="All">' . _('All').'</option>'; - $_POST['StockCat'] ='All'; - } else { - echo '<option value="All">' . _('All').'</option>'; - } - $SQL="SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype='F' OR stocktype='D' - ORDER BY categorydescription"; - $result1 = DB_query($SQL,$db); - while ($myrow1 = DB_fetch_array($result1)) { - if ($_POST['StockCat']==$myrow1['categoryid']){ - echo '<option selected="True" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; - } else { - echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; - } - } - - if (!isset($_POST['Keywords'])) { - $_POST['Keywords']=''; - } - - if (!isset($_POST['StockCode'])) { - $_POST['StockCode']=''; - } - - echo '</select></td> - <td><b>' . _('Enter partial Description') . ':</b> - <input tabindex="2" type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" /></td> - - <td align="right"><b>' . _('OR') . ' </b><b>' . _('Enter extract of the Stock Code') . ':</b> - <input tabindex="3" type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> - - </tr><tr> - <td style="text-align:center"><button tabindex="4" type="submit" name="Search">' . _('Search Now') . '</button></td> - <td style="text-align:center"><button tabindex="5" type="submit" name="QuickEntry">' . _('Use Quick Entry') . '</button></td>'; - - if (!isset($_POST['PartSearch'])) { - echo '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.Keywords);}</script>'; - } - - echo '</tr></table><br />'; - // Add some useful help as the order progresses - if (isset($SearchResult)) { - echo '<br />'; - echo '<div class="page_help_text">' . _('Select an item by entering the quantity required. Click Order when ready.') . '</div>'; - echo '<br />'; - } - - - if (isset($SearchResult)) { - $j = 1; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier='.$identifier . '" method="post" name="orderform">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr><td><input type="hidden" name="previous" value="'.locale_number_format($Offset-1,0).'" /> - <button type="submit" name="Prev">'._('Prev').'</button></td>'; - echo '<td style="text-align:center" colspan="6"> - <input type="hidden" name="OrderItems" value="1" /> - <button type="submit">'._('Add to Sale').'</button></td>'; - echo '<td><input type="hidden" name="NextList" value="'.locale_number_format($Offset+1,0).'" /> - <button type="submit" name="Next">'._('Next').'</button></td></tr>'; - $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Batch No') . '</th> - <th>' . _('Batch Qty') . '</th> - <th>' . _('Expiry Date') . '</th> - </tr>'; - echo $TableHeader; - - $k=0; //row colour counter - $i=0; - - while ($myrow=DB_fetch_array($SearchResult)) { - - $PricesSQL="SELECT price, - units, - conversionfactor, - decimalplaces - FROM prices - WHERE stockid='".$myrow['stockid']."' - AND typeabbrev='".$_SESSION['Items'.$identifier]->DefaultSalesType."' - AND '".date('Y-m-d')."' BETWEEN startdate and enddate"; - $PricesResult = DB_query($PricesSQL, $db); - if (DB_num_rows($PricesResult)>0) { - $PricesRow = DB_fetch_array($PricesResult); - $myrow['price']=$PricesRow['price']; - $myrow['units']=$PricesRow['units']; - $myrow['conversionfactor']=$PricesRow['conversionfactor']; - } else { - $myrow['conversionfactor']=1; - } - - // Find the quantity in stock at location - $QOHSql = "SELECT sum(quantity) AS QOH - FROM locstock - WHERE locstock.stockid='" .$myrow['stockid'] . "' - AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; - $QOHResult = DB_query($QOHSql,$db); - $QOHRow = DB_fetch_array($QOHResult); - $QOH = $QOHRow['QOH']/$myrow['conversionfactor']; - - $sql = "SELECT serialno, - expirationdate, - quantity - FROM stockserialitems - WHERE stockid='" . $myrow['stockid'] ."' - AND loccode='".$_SESSION['Items'.$identifier]->Location."'"; - $ErrMsg = _('The batch details cannot be found'); - $BatchResult = DB_query($sql,$db,$ErrMsg); - - if ($myrow['controlled']==0) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - echo '<input type="hidden" name="StockID'.$i.'" value="'.$myrow['stockid'].'" />'; - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td><font size="1"><input class="number" type="text" size="15" name="Quantity'.$i.'" value="0" /> - </font></td> - </tr>', - $myrow['stockid'], - $myrow['description'], - $myrow['units'], - locale_number_format($QOH, $myrow['decimalplaces'])); - echo '<input type="hidden" name="Units' . $i . '" value="' . $myrow['units'] . '" />'; - $i++; - } else { - $LastStockID=''; - while ($BatchRow=DB_fetch_array($BatchResult)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - if ($LastStockID!=$myrow['stockid']) { - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td>', - $myrow['stockid'], - $myrow['description'], - $myrow['units'], - locale_number_format($QOH, $myrow['decimalplaces'])); - } else { - echo '<td colspan="4">'; - } - echo '<input type="hidden" name="Batch'.$i.'" value="'.$BatchRow['serialno'].'" />'; - echo '<input type="hidden" name="StockID'.$i.'" value="'.$myrow['stockid'].'" />'; - printf('<td><font size="1"> - <input class="number" type="text" size="15" name="Quantity'.$i.'" value="0" /> - </font></td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - </tr>', - $BatchRow['serialno'], - locale_number_format($BatchRow['quantity']/$myrow['conversionfactor'], $myrow['decimalplaces']), - ConvertSQLDate($BatchRow['expirationdate'])); - $LastStockID=$myrow['stockid']; - echo '<input type="hidden" name="Units' . $i . '" value="' . $myrow['units'] . '" />'; - $i++; - } - } - - if ($j==1) { - $jsCall = '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.itm'.$myrow['stockid'].');}</script>'; - } - $j++; - #end of page full new headings if - } - #end of while loop - echo '<input ... [truncated message content] |
From: <tim...@us...> - 2012-05-18 16:35:14
|
Revision: 8923 http://weberp.svn.sourceforge.net/weberp/?rev=8923&view=rev Author: tim_schofield Date: 2012-05-18 16:35:08 +0000 (Fri, 18 May 2012) Log Message: ----------- Fix customer login bug Modified Paths: -------------- trunk/includes/UserLogin.php trunk/index.php Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2012-05-18 16:27:16 UTC (rev 8922) +++ trunk/includes/UserLogin.php 2012-05-18 16:35:08 UTC (rev 8923) @@ -64,7 +64,7 @@ $_SESSION['AttemptsCounter'] = 0; $_SESSION['AccessLevel'] = $myrow['fullaccess']; $_SESSION['CanCreateTender'] = $myrow['cancreatetender']; - $_SESSION['CustomerID'] = $myrow['customerid']; + $_SESSION['UserCustomerID'] = $myrow['customerid']; $_SESSION['UserBranch'] = $myrow['branchcode']; $_SESSION['UserSupplierID'] = $myrow['supplierid']; $_SESSION['DefaultPageSize'] = $myrow['pagesize']; Modified: trunk/index.php =================================================================== --- trunk/index.php 2012-05-18 16:27:16 UTC (rev 8922) +++ trunk/index.php 2012-05-18 16:35:08 UTC (rev 8923) @@ -28,7 +28,7 @@ </table>'; include('includes/footer.inc'); exit; -} elseif ($_SESSION['CustomerID']!=''){ +} elseif ($_SESSION['UserCustomerID']!=''){ echo '<table class="table_index"> <tr> <td class="menu_group_item"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-20 21:21:41
|
Revision: 8938 http://weberp.svn.sourceforge.net/weberp/?rev=8938&view=rev Author: tim_schofield Date: 2012-05-20 21:21:35 +0000 (Sun, 20 May 2012) Log Message: ----------- Fix to allow any characters in the customer and branch codes Modified Paths: -------------- trunk/CustomerBranches.php trunk/Customers.php Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2012-05-20 21:08:44 UTC (rev 8937) +++ trunk/CustomerBranches.php 2012-05-20 21:21:35 UTC (rev 8938) @@ -50,12 +50,6 @@ $_POST['BranchCode'] = mb_strtoupper($_POST['BranchCode']); - if (ContainsIllegalCharacters($_POST['BranchCode']) OR mb_strstr($_POST['BranchCode'],' ')) { - $InputError = 1; - prnMsg(_('The Branch code cannot contain a space or any of the illegal characters'),'error'); - $Errors[$i] = 'BranchCode'; - $i++; - } if (mb_strlen($_POST['BranchCode'])==0) { $InputError = 1; prnMsg(_('The Branch code must be at least one character long'),'error'); Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2012-05-20 21:08:44 UTC (rev 8937) +++ trunk/Customers.php 2012-05-20 21:21:35 UTC (rev 8938) @@ -47,11 +47,6 @@ prnMsg( _('The debtor code cannot be empty'),'error'); $Errors[$i] = 'DebtorNo'; $i++; - } elseif ($_SESSION['AutoDebtorNo']==0 AND (ContainsIllegalCharacters($_POST['DebtorNo']) OR mb_strpos($_POST['DebtorNo'], ' '))) { - $InputError = 1; - prnMsg( _('The customer code cannot contain any of the illefal characters') ,'error'); - $Errors[$i] = 'DebtorNo'; - $i++; } elseif (mb_strlen($_POST['Address1']) >40) { $InputError = 1; prnMsg( _('The Line 1 of the address must be forty characters or less long'),'error'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-26 08:18:06
|
Revision: 8950 http://weberp.svn.sourceforge.net/weberp/?rev=8950&view=rev Author: tim_schofield Date: 2012-05-26 08:18:00 +0000 (Sat, 26 May 2012) Log Message: ----------- NoSalesItems.php New script to show the items available for sale but no sale in X days Modified Paths: -------------- trunk/includes/IndexArray.php Added Paths: ----------- trunk/sql/mysql/updates/130.php Modified: trunk/includes/IndexArray.php =================================================================== --- trunk/includes/IndexArray.php 2012-05-24 18:48:30 UTC (rev 8949) +++ trunk/includes/IndexArray.php 2012-05-26 08:18:00 UTC (rev 8950) @@ -54,6 +54,7 @@ _('Order Delivery Differences Report'), _('Delivery In Full On Time (DIFOT) Report'), _('Sales Order Detail Or Summary Inquiries'), + _('Low Sales Items Report'), _('Top Sales Items Report'), _('Sales With Low Gross Profit Report') ); @@ -69,6 +70,7 @@ '/PDFDeliveryDifferences.php', '/PDFDIFOT.php', '/SalesInquiry.php', + '/NoSalesItems.php', '/TopItems.php', '/PDFLowGP.php' ); Added: trunk/sql/mysql/updates/130.php =================================================================== --- trunk/sql/mysql/updates/130.php (rev 0) +++ trunk/sql/mysql/updates/130.php 2012-05-26 08:18:00 UTC (rev 8950) @@ -0,0 +1,10 @@ +<?php + +/* Include the new script for printing quotations in Portrait + */ + +InsertRecord('pagesecurity', array('script', 'security'), array('NoSalesItems.php',4), array('script', 'security'), array('NoSalesItems.php',4), $db); + +UpdateDBNo(basename(__FILE__, '.php'), $db); + +?> \ 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: <tim...@us...> - 2012-05-26 21:46:12
|
Revision: 8957 http://weberp.svn.sourceforge.net/weberp/?rev=8957&view=rev Author: tim_schofield Date: 2012-05-26 21:46:00 +0000 (Sat, 26 May 2012) Log Message: ----------- Phil Daintree: fix barcode printing in PDFPrintLabel.php Modified Paths: -------------- trunk/Labels.php trunk/PDFPrintLabel.php Added Paths: ----------- trunk/includes/barcodepack/ trunk/includes/barcodepack/class.barcode.php trunk/includes/barcodepack/class.code128.php trunk/includes/barcodepack/class.ean13.php trunk/includes/barcodepack/class.i2of5.php trunk/includes/barcodepack/class.linearBarcode.php trunk/includes/barcodepack/class.qrCode.php trunk/includes/barcodepack/class.s2of5.php trunk/includes/barcodepack/class.upc.php trunk/sql/mysql/updates/131.php Modified: trunk/Labels.php =================================================================== --- trunk/Labels.php 2012-05-26 13:04:57 UTC (rev 8956) +++ trunk/Labels.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -7,19 +7,18 @@ include('includes/header.inc'); //define PaperSize array sizes in pdf points -$PaperSize = array('A4', - 'A4_Landscape', - 'A5', - 'A5_Landscape', - 'A3', - 'A3_Landscape', - 'Letter', - 'Letter_Landscape', - 'Legal', - 'Legal_Landscape', - '28mm_x_45mm_label'); +$PaperSize = array(); +$PaperSize['A4']['PageHeight'] = 297; +$PaperSize['A4']['PageWidth'] = 210; +$PaperSize['A5']['PageHeight'] = 210; +$PaperSize['A5']['PageWidth'] = 148; +$PaperSize['A3']['PageHeight'] = 420; +$PaperSize['A3']['PageWidth'] = 297; +$PaperSize['Letter']['PageHeight'] = 279.4; +$PaperSize['Letter']['PageWidth'] = 215.9; +$PaperSize['Legal']['PageHeight'] = 355.6; +$PaperSize['Legal']['PageWidth'] = 215.9; - echo '<p class="page_title_text"> <img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Label Template Maintenance') . '" alt="" />' . $title. ' @@ -43,7 +42,7 @@ WHERE labelfieldid='" . $_POST['LabelFieldID' . $i] . "'", $db); } else { - prnMsg (_('Entries for Vertical Position Horizonal Position and Font Size must be integers.'),'error'); + prnMsg (_('Entries for Vertical Position, Horizonal Position, and Font Size must be integers.'),'error'); } } } @@ -79,20 +78,30 @@ prnMsg( _('The label description may not be empty'), 'error'); } $Message = ''; + + if (isset($_POST['PaperSize']) AND $_POST['PaperSize']!='custom'){ + $_POST['PageWidth'] = $PaperSize[$_POST['PaperSize']]['PageWidth']; + $_POST['PageHeight'] = $PaperSize[$_POST['PaperSize']]['PageHeight']; + } elseif ($_POST['PaperSize']=='custom' AND !isset($_POST['PageWidth'])){ + $_POST['PageWidth'] = 0; + $_POST['PageHeight'] = 0; + } + if (isset($SelectedLabelID)) { /*SelectedLabelID could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE labels SET papersize ='" . $_POST['PaperSize'] . "', - description = '" . $_POST['Description'] . "', + $sql = "UPDATE labels SET description = '" . $_POST['Description'] . "', height = '" . $_POST['Height'] . "', topmargin = '". $_POST['TopMargin'] . "', width = '". $_POST['Width'] . "', leftmargin = '". $_POST['LeftMargin'] . "', rowheight = '". $_POST['RowHeight'] . "', - columnwidth = '". $_POST['ColumnWidth'] . "' + columnwidth = '". $_POST['ColumnWidth'] . "', + pagewidth = '" . $_POST['PageWidth'] . "', + pageheight = '" . $_POST['PageHeight'] . "' WHERE labelid = '" . $SelectedLabelID . "'"; $ErrMsg = _('The update of this label template failed because'); @@ -104,22 +113,24 @@ /*Selected label is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new label form */ - $sql = "INSERT INTO labels (papersize, - description, + $sql = "INSERT INTO labels (description, height, topmargin, width, leftmargin, rowheight, - columnwidth) - VALUES ('" . $_POST['PaperSize'] . "', - '" . $_POST['Description'] . "', + columnwidth, + pagewidth, + pageheight) + VALUES ('" . $_POST['Description'] . "', '" . $_POST['Height'] . "', '" . $_POST['TopMargin'] . "', '" . $_POST['Width'] . "', '" . $_POST['LeftMargin'] . "', '" . $_POST['RowHeight'] . "', - '" . $_POST['ColumnWidth'] . "')"; + '" . $_POST['ColumnWidth'] . "', + '" . $_POST['PageWidth'] . "', + '" . $_POST['PageHeight'] . "')"; $ErrMsg = _('The addition of this label failed because'); $result = DB_query($sql,$db,$ErrMsg); @@ -135,7 +146,8 @@ unset( $_POST['LeftMargin']); unset( $_POST['ColumnWidth']); unset( $_POST['RowHeight']); - + unset($_POST['PageWidth']); + unset($_POST['PageHeight']); } prnMsg($Message); @@ -156,7 +168,8 @@ $sql = "SELECT labelid, description, - papersize, + pagewidth, + pageheight, height, width, topmargin, @@ -173,7 +186,9 @@ echo '<br /><table class="selection"> <tr> <th>' . _('Description') . '</th> - <th>' . _('Page Size') . '</th> + <th>' . _('Rows x Cols') . '</th> + <th>' . _('Page Width') . '</th> + <th>' . _('Page Height') . '</th> <th>' . _('Height') . '</th> <th>' . _('Width') . '</th> <th>' . _('Row Height') . '</th> @@ -189,29 +204,65 @@ echo '<tr class="OddTableRows">'; $k++; } + $NoOfRows = floor(($myrow['pageheight']-$myrow['topmargin'])/$myrow['rowheight']); + $NoOfCols = floor(($myrow['pagewidth']-$myrow['leftmargin'])/$myrow['columnwidth']); - 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']); - + foreach ($PaperSize as $PaperName=>$PaperType) { + if ($PaperType['PageWidth'] == $myrow['pagewidth'] AND $PaperType['PageHeight'] == $myrow['pageheight']) { + $Paper = $PaperName; + } + } + if (isset($Paper)){ + printf('<td>%s</td> + <td>%s</td> + <td colspan="2">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td><a href="%sSelectedLabelID=%s">' . _('Edit') . '</a></td> + <td><a href="%sSelectedLabelID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this label?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['description'], + $NoOfRows . ' x ' . $NoOfCols, + $Paper, + $myrow['height'], + $myrow['width'], + $myrow['rowheight'], + $myrow['columnwidth'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $myrow['labelid'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $myrow['labelid'], + $rootpath . '/LabelFields.php?', + $myrow['labelid']); + } else { + printf('<td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td><a href="%sSelectedLabelID=%s">' . _('Edit') . '</a></td> + <td><a href="%sSelectedLabelID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this label?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['description'], + $NoOfRows . ' x ' . $NoOfCols, + $myrow['pagewidth'], + $myrow['pageheight'], + $myrow['height'], + $myrow['width'], + $myrow['rowheight'], + $myrow['columnwidth'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $myrow['labelid'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $myrow['labelid'], + $rootpath . '/LabelFields.php?', + $myrow['labelid']); + } } //END WHILE LIST LOOP @@ -233,7 +284,8 @@ if (isset($SelectedLabelID)) { //editing an existing label - $sql = "SELECT papersize, + $sql = "SELECT pagewidth, + pageheight, description, height, width, @@ -247,7 +299,8 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); - $_POST['PaperSize'] = $myrow['papersize']; + $_POST['PageWidth'] = $myrow['pagewidth']; + $_POST['PageHeight'] = $myrow['pageheight']; $_POST['Description'] = $myrow['description']; $_POST['Height'] = $myrow['height']; $_POST['TopMargin'] = $myrow['topmargin']; @@ -256,6 +309,12 @@ $_POST['RowHeight'] = $myrow['rowheight']; $_POST['ColumnWidth'] = $myrow['columnwidth']; + foreach ($PaperSize as $PaperName=>$PaperType) { + if ($PaperType['PageWidth'] == $myrow['pagewidth'] AND $PaperType['PageHeight'] == $myrow['pageheight']) { + $_POST['PaperSize'] = $PaperName; + } + } + echo '<input type="hidden" name="SelectedLabelID" value="' . $SelectedLabelID . '" />'; } //end of if $SelectedLabelID only do the else when a new record is being entered @@ -274,9 +333,14 @@ </tr> <tr> <td>' . _('Label Paper Size') . ':</td> - <td><select name="PaperSize">'; + <td><select name="PaperSize" onchange="ReloadForm(submit)" >'; -foreach($PaperSize as $PaperType) { +if (!isset($_POST['PaperSize'])){ + echo '<option selected="selected" value="custom">' . _('Custom Size') . '</option>'; +} else { + echo '<option value="custom">' . _('Custom Size') . '</option>'; +} +foreach($PaperSize as $PaperType=>$PaperSizeElement) { if (isset($_POST['PaperSize']) AND $PaperType==$_POST['PaperSize']) { echo '<option selected="selected" value="'; } else { @@ -289,6 +353,12 @@ echo '</select></td> </tr>'; +if (!isset($_POST['PageHeight'])) { + $_POST['PageHeight']=0; +} +if (!isset($_POST['PageWidth'])) { + $_POST['PageWidth']=0; +} if (!isset($_POST['Height'])) { $_POST['Height']=0; } @@ -308,6 +378,21 @@ if (!isset($_POST['ColumnWidth'])) { $_POST['ColumnWidth']=0; } + +if (!isset($_POST['PaperSize']) OR $_POST['PaperSize'] == 'Custom') { + if (!isset($_POST['PageWidth'])){ + $_POST['PageWidth'] = 0; + $_POST['PageHeight'] = 0; + } + echo '<tr> + <td>' . _('Page Width') . '</td> + <td><input type="text" size="4" maxlength="4" name="PageWidth" value="' . $_POST['PageWidth'] . '" /></td> + </tr> + <tr> + <td>' . _('Page Height') . '</td> + <td><input type="text" size="4" maxlength="4" name="PageHeight" value="' . $_POST['PageHeight'] . '" /></td> + </tr>'; +} echo '<tr> <td>' . _('Label Height') . ' - (He):</td> <td><input type="text" name="Height" size="4" maxlength="4" value="' . $_POST['Height'] . '" /></td> @@ -375,7 +460,7 @@ } echo '<input type="hidden" name="LabelFieldID' . $i . '" value="' . $myrow['labelfieldid'] . '" /> - <td><select name="FieldName' . $i . '">'; + <td><select name="FieldName' . $i . '" onchange="ReloadForm(submit)">'; if ($myrow['fieldvalue']=='itemcode'){ echo '<option selected="selected" value="itemcode">' . _('Item Code') . '</option>'; } else { @@ -400,7 +485,7 @@ <td><input type="text" name="VPos' . $i . '" size="4" maxlength="4" value="' . $myrow['vpos'] . '" /></td> <td><input type="text" name="HPos' . $i . '" size="4" maxlength="4" value="' . $myrow['hpos'] . '" /></td> <td><input type="text" name="FontSize' . $i . '" size="4" maxlength="4" value="' . $myrow['fontsize'] . '" /></td> - <td><select name="Barcode' . $i . '">'; + <td><select name="Barcode' . $i . '" onchange="ReloadForm(submit)">'; if ($myrow['barcode']==0){ echo '<option selected="selected" value="0">' . _('No') . '</option> <option value="1">' . _('Yes') . '</option>'; @@ -444,7 +529,11 @@ echo '<br /> <div class="centre"> <button type="submit" name="submit">' . _('Enter Information') . '</button> - </div><br /> + </div> + <br /> + <div class="centre"> + <a href="' . $rootpath . '/PDFPrintLabel.php">' . _('Print Labels') . '</a> + </div> </form>'; include('includes/footer.inc'); Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2012-05-26 13:04:57 UTC (rev 8956) +++ trunk/PDFPrintLabel.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -2,11 +2,12 @@ /* $Id: PDFPriceLabels.php 5228 2012-04-06 02:48:00Z vvs2012 $*/ include('includes/session.inc'); +include('includes/barcodepack/class.code128.php'); $PtsPerMM = 2.83465; //pdf points per mm -if (isset($_POST['ShowLabels']) +if ((isset($_POST['ShowLabels']) OR isset($_POST['SelectAll'])) AND isset($_POST['FromCriteria']) AND mb_strlen($_POST['FromCriteria'])>=1 AND isset($_POST['ToCriteria']) @@ -14,6 +15,8 @@ $title = _('Print Labels'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' . _('Price Labels') . '" alt="" /> + ' . ' ' . _('Select Labels to Print') . '</p>'; $SQL = "SELECT prices.stockid, stockmaster.description, @@ -65,14 +68,28 @@ <th>' . _('Item Description') . '</th> <th>' . _('Price') . '</th> <th>' . _('Print') . ' ?</th> - </tr>'; + </tr> + <tr> + <th colspan="4"><input type="submit" name="SelectAll" value="' . _('Select All Labels') . '" /><input type="checkbox" name="CheckAll" '; + if (isset($_POST['CheckAll'])){ + echo 'checked="checked" '; + } + echo 'onchange="ReloadForm(SelectAll)" /></td> + </tr>'; + $i=0; while ($LabelRow = DB_fetch_array($LabelsResult)){ echo '<tr> <td>' . $LabelRow['stockid'] . '</td> <td>' . $LabelRow['description'] . '</td> <td class="number">' . locale_number_format($LabelRow['price'],$LabelRow['decimalplaces']) . '</td> - <td><input type="checkbox" checked="checked" name="PrintLabel' . $i .'" /></td> + <td>'; + if (isset($_POST['SelectAll']) AND isset($_POST['CheckAll'])) { + echo '<input type="checkbox" checked="checked" name="PrintLabel' . $i .'" />'; + } else { + echo '<input type="checkbox" name="PrintLabel' . $i .'" />'; + } + echo '</td> </tr>'; echo '<input type="hidden" name="StockID' . $i . '" value="' . $LabelRow['stockid'] . '" /> <input type="hidden" name="Description' . $i . '" value="' . $LabelRow['description'] . '" /> @@ -84,18 +101,42 @@ echo '</table> <input type="hidden" name="NoOfLabels" value="' . $i . '" /> <input type="hidden" name="LabelID" value="' . $_POST['LabelID'] . '" /> + <input type="hidden" name="FromCriteria" value="' . $_POST['FromCriteria'] . '" /> + <input type="hidden" name="ToCriteria" value="' . $_POST['ToCriteria'] . '" /> + <input type="hidden" name="SalesType" value="' . $_POST['SalesType'] . '" /> + <input type="hidden" name="Currency" value="' . $_POST['Currency'] . '" /> + <input type="hidden" name="EffectiveDate" value="' . $_POST['EffectiveDate'] . '" /> <br /> <div class="centre"> + <button type="submit" name="PrintLabels">'. _('Print Labels'). '</button> - </div><br /> + </div> + <br /> + <div style="text-align: right"> + <a href="'. $rootpath . '/Labels.php">' . _('Label Template Maintenance'). '</a> + </div> </form>'; + include('includes/footer.inc'); exit; } if (isset($_POST['PrintLabels']) - AND isset($_POST['NoOfLabels'])) { + AND isset($_POST['NoOfLabels']) + AND $_POST['NoOfLabels']>0){ + $NoOfLabels = 0; + for ($i=0;$i < $_POST['NoOfLabels'];$i++){ + if (isset($_POST['PrintLabel'.$i])){ + $NoOfLabels++; + } + } + if ($NoOfLabels ==0){ + prnMsg(_('There are no labels selected to print'),'info'); + } +} +if (isset($_POST['PrintLabels']) AND $NoOfLabels>0) { - $result = DB_query("SELECT papersize, - description, + $result = DB_query("SELECT description, + pagewidth*" . $PtsPerMM . " as page_width, + pageheight*" . $PtsPerMM . " as page_height, width*" . $PtsPerMM . " as label_width, height*" . $PtsPerMM . " as label_height, rowheight*" . $PtsPerMM . " as label_rowheight, @@ -106,14 +147,7 @@ WHERE labelid='" . $_POST['LabelID'] . "'", $db); $LabelDimensions = DB_fetch_array($result); - $PaperSize = $LabelDimensions['papersize']; - include('includes/PDFStarter.php'); - $Top_Margin = $LabelDimensions['label_topmargin']; - $Left_Margin = $LabelDimensions['label_leftmargin']; - $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') ); - $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') ); - $result = DB_query("SELECT fieldvalue, vpos, hpos, @@ -139,30 +173,35 @@ $i++; } - $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 ); + $PaperSize = 'Custom'; // so PDF starter wont default the DocumentPaper + $DocumentPaper = array($LabelDimensions['page_width'],$LabelDimensions['page_height']); + include('includes/PDFStarter.php'); + $Top_Margin = $LabelDimensions['label_topmargin']; + $Left_Margin = $LabelDimensions['label_leftmargin']; + $Page_Height = $LabelDimensions['page_height']; + $Page_Width = $LabelDimensions['page_width']; + $Right_Margin =0; + $Bottom_Margin =0; + $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') ); + $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') ); + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + + + $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + $PageNumber=1; //go down first then accross $YPos = $Page_Height - $Top_Margin; //top of current label $XPos = $Left_Margin; // left of current label - for ($i=0;$i <= $_POST['NoOfLabels'];$i++){ - if ($_POST['PrintLabel'.$i]=='on'){ - + for ($i=0;$i < $_POST['NoOfLabels'];$i++){ + if (isset($_POST['PrintLabel'.$i])){ + $NoOfLabels--; foreach ($LabelFields as $Field){ //print_r($Field); @@ -179,45 +218,51 @@ $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! - */ + $BarcodeImage = new code128(str_replace('_','',$Value)); - $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'); + ob_start(); + imagepng(imagepng($BarcodeImage->draw())); + $Image_String = ob_get_contents(); + ob_end_clean(); + + $pdf->addJpegFromFile('@' . $Image_String,$XPos+$Field['HPos'],$Field['VPos'],'', $Field['FontSize']); + } else { $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos']-20,$Field['FontSize'],$Value); } } // end loop through label fields - //setup $YPos and $XPos for the next label - if (($YPos - $LabelDimensions['label_rowheight']) < $LabelDimensions['label_height']){ - /* not enough space below the above label to print a new label - * so the above was the last label in the column - * need to start either a new column or new page - */ - if (($Page_Width - $XPos - $LabelDimensions['label_columnwidth']) < $LabelDimensions['label_width']) { - /* Not enough space to start a new column so we are into a new page + if ($NoOfLabels>0) { + //setup $YPos and $XPos for the next label + if (($YPos - $LabelDimensions['label_rowheight']) < $LabelDimensions['label_height']){ + /* not enough space below the above label to print a new label + * so the above was the last label in the column + * need to start either a new column or new page */ - $pdf->newPage(); - $PageNumber++; - $YPos = $Page_Height - $Top_Margin; //top of next label - $XPos = $Left_Margin; // left of next label + if (($Page_Width - $XPos - $LabelDimensions['label_columnwidth']) < $LabelDimensions['label_width']) { + /* Not enough space to start a new column so we are into a new page + */ + $pdf->newPage(); + $PageNumber++; + $YPos = $Page_Height - $Top_Margin; //top of next label + $XPos = $Left_Margin; // left of next label + } else { + /* There is enough space for another column */ + $YPos = $Page_Height - $Top_Margin; //back to the top of next label column + $XPos += $LabelDimensions['label_columnwidth']; // left of next label + } } else { - /* There is enough space for another column */ - $YPos = $Page_Height - $Top_Margin; //back to the top of next label column - $XPos += $LabelDimensions['label_columnwidth']; // left of next label + /* There is space below to print a label + */ + $YPos -= $LabelDimensions['label_rowheight']; //Top of next label } - } else { - /* There is space below to print a label - */ - $YPos -= $LabelDimensions['label_rowheight']; //Top of next label - } + }//end if there is another label to print } //this label is set to print } //loop through labels selected to print $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; ob_clean(); - $pdf->OutputD($FileName); + $pdf->OutputI($FileName); $pdf->__destruct(); } else { /*The option to print PDF was not hit */ @@ -301,8 +346,12 @@ echo '</table> <br /> <div class="centre"> - <button type="submit" name="ShowLabels">'. _('Print Labels'). '</button> + <button type="submit" name="ShowLabels">'. _('Show Labels'). '</button> </div> + <br /> + <div style="text-align: right"> + <a href="'. $rootpath . '/Labels.php">' . _('Label Template Maintenance'). '</a> + </div> </form>'; } Added: trunk/includes/barcodepack/class.barcode.php =================================================================== --- trunk/includes/barcodepack/class.barcode.php (rev 0) +++ trunk/includes/barcodepack/class.barcode.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the BarcodePack - PHP Barcode Library. + * Copyright (c) 2011 Tomáš Horáček (http://www.barcodepack.com) + * BarcodePack by Tomáš Horáček is licensed under + * a Creative Commons Attribution-NoDerivs 3.0 Unported License. + */ + + + +// Error codes + +define('E_EMPTY_TEXT', 100); +define('E_MODULE_SIZE', 101); + + +/** + * barcode + * + * Main class of BarcodePack Library + * + * @author Tomáš Horáček <in...@we...> + * @package BarcodePack + */ +class barcode { + + // Minimal module size + const MIN_MODULE_SIZE = 1; + + // Maximal module size + const MAX_MODULE_SIZE = 10; + + // Default module size + const MODULE_SIZE = 2; + + /** + * Text to be encoded + * @var string + */ + protected $text = ''; + + /** + * Module size in pixels + * @var int + */ + protected $moduleSize = null; + + + /** + * Constructor + * + * @param string $text + * @param int $moduleSize + */ + public function __construct($text, $moduleSize=self::MODULE_SIZE) + { + + // input text check + if(!empty ($text)) { + $this->text = $text; + } else { + throw new Exception('Input text can not be empty.', E_EMPTY_TEXT); + } + + // Module size check + $moduleSize = (int) $moduleSize; + if($moduleSize >= self::MIN_MODULE_SIZE && $moduleSize <= self::MAX_MODULE_SIZE) { + $this->moduleSize = $moduleSize; + } else { + throw new Exception('Module size have to be in range '.self::MIN_MODULE_SIZE.' - '.self::MAX_MODULE_SIZE.'.', E_MODULE_SIZE); + } + + } + +} Property changes on: trunk/includes/barcodepack/class.barcode.php ___________________________________________________________________ Added: svn:executable + * Added: trunk/includes/barcodepack/class.code128.php =================================================================== --- trunk/includes/barcodepack/class.code128.php (rev 0) +++ trunk/includes/barcodepack/class.code128.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -0,0 +1,338 @@ +<?php + +/** + * This file is part of the BarcodePack - PHP Barcode Library. + * Copyright (c) 2011 Tomáš Horáček (http://www.barcodepack.com) + * BarcodePack by Tomáš Horáček is licensed under + * a Creative Commons Attribution-NoDerivs 3.0 Unported License. + */ + + + +require_once 'class.linearBarcode.php'; + +/** + * Code 128 + * Class implements Code 128 barcode + * + * @author Tomáš Horáček <in...@we...> + * @package BarcodePack + */ +class code128 extends linearBarcode { + + // Code sets + const CHARSET_A = 'A'; + const CHARSET_B = 'B'; + const CHARSET_C = 'C'; + + const START_A = 103; + const START_B = 104; + const START_C = 105; + const STOP = 106; + const TERMINATION = 107; + + // Code sets switchers + const CODE_A = 101; + const CODE_B = 100; + const CODE_C = 99; + + + private $setA = array(); + private $setB = array(); + private $setC = array(); + + private $charsA = ''; + private $charsB = ''; + private $charsC = ''; + + /** + * Zero represents white line + * One represents black line + * + * After each character except STOP I will add one white line + * (separating line) + * + * ASCII (dec) => bitecode + * + * @var array + */ + private $codeTable = array( + '11011001100', // 01 + '11001101100', // 02 + '11001100110', // 03 + '10010011000', // 04 + '10010001100', // ... + '10001001100', + '10011001000', + '10011000100', + '10001100100', + '11001001000', + '11001000100', + '11000100100', + '10110011100', + '10011011100', + '10011001110', + '10111001100', + '10011101100', + '10011100110', + '11001110010', + '11001011100', + '11001001110', + '11011100100', + '11001110100', + '11101101110', + '11101001100', + '11100101100', + '11100100110', + '11101100100', + '11100110100', + '11100110010', + '11011011000', + '11011000110', + '11000110110', + '10100011000', + '10001011000', + '10001000110', + '10110001000', + '10001101000', + '10001100010', + '11010001000', + '11000101000', + '11000100010', + '10110111000', + '10110001110', + '10001101110', + '10111011000', + '10111000110', + '10001110110', + '11101110110', + '11010001110', + '11000101110', + '11011101000', + '11011100010', + '11011101110', + '11101011000', + '11101000110', + '11100010110', + '11101101000', + '11101100010', + '11100011010', + '11101111010', + '11001000010', + '11110001010', + '10100110000', + '10100001100', + '10010110000', + '10010000110', + '10000101100', + '10000100110', + '10110010000', + '10110000100', + '10011010000', + '10011000010', + '10000110100', + '10000110010', + '11000010010', + '11001010000', + '11110111010', + '11000010100', + '10001111010', + '10100111100', + '10010111100', + '10010011110', + '10111100100', + '10011110100', + '10011110010', + '11110100100', + '11110010100', + '11110010010', + '11011011110', + '11011110110', + '11110110110', + '10101111000', + '10100011110', + '10001011110', + '10111101000', + '10111100010', + '11110101000', + '11110100010', + '10111011110', + '10111101110', + '11101011110', + '11110101110', + '11010000100', // 103 START A + '11010010000', // 104 START B + '11010011100', // 105 START C + '11000111010', // 106 STOP + '11' // 107 Termination bar + ); + + + /** + * Constructor + * + * @param string $text + * @param int $moduleSize + */ + public function __construct($text, $moduleSize=2) + { + try { + // Fill set A + for($i=32; $i<=95; $i++) { + // chars SPACE - UNDERSPACE + $this->setA[$i] = $i - 32; + $this->charsA .= chr($i); + $allowedChars[] = chr($i); + } + for($i=0; $i<=31; $i++) { + // chars NUL - US (Unit seperator) + $this->setA[$i] = $i + 64; + $this->charsA .= chr($i); + $allowedChars[] = chr($i); + } + + /* Fill set B + * chars SPACE " " - "DEL" + */ + for($i=32; $i<=127; $i++) { + $this->setB[$i] = $i - 32; + $this->charsB .= chr($i); + $allowedChars[] = chr($i); + } + + + parent::__construct($text, $moduleSize, $allowedChars); + + + $this->biteCode = $this->createBiteCode(); + + } catch (Exception $e) { + throw $e; + } + + } + + + /** + * Create Bite Code + * + * + * @return string + */ + private function createBiteCode() + { + $biteCode = array(); + + $characterSet = self::CHARSET_B; // Default code set + + $weightedSum = 0; + $checksumCounter = 1; + + $biteCode['DATA'] = ''; + // Find start character + if(strlen($this->text)>=2 && is_numeric($this->text{0}) && is_numeric($this->text{1})) { + // If the first and second characters are numeric use character set C + // and insert START_C char + $biteCode['DATA'] .= $this->codeTable[self::START_C]; + $characterSet = self::CHARSET_C; + $weightedSum += self::START_C; + } else if (strpos ($this->charsB, $this->text{0})) { + // Character set B + $biteCode['DATA'] .= $this->codeTable[self::START_B]; + $characterSet = self::CHARSET_B; + $weightedSum += self::START_B; + } else if (strpos ($this->charsA, $this->text{0})) { + // Character set A + $biteCode['DATA'] .= $this->codeTable[self::START_A]; + $characterSet = self::CHARSET_A; + $weightedSum += self::START_A; + } else { + throw new Exception(); + } + + + for($i=0;$i<strlen($this->text);$i++) { + switch ($characterSet) { + case 'B': + // Character set B is default, so it is first + $characterValue = $this->setB[ord($this->text{$i})]; + $biteCode['DATA'] .= $this->codeTable[$characterValue]; + break; + + case 'A': + $characterValue = $this->setA[ord($this->text{$i})]; + $biteCode['DATA'] .= $this->codeTable[$characterValue]; + break; + + case 'C': + $characterValue = intval($this->text{$i}.$this->text{$i+1}); + $biteCode['DATA'] .= $this->codeTable[$characterValue]; + $i++; + break; + + default: + break; + } + + $weightedSum += $characterValue*$checksumCounter; + $checksumCounter++; + + // find next char set. + if(strlen($this->text) > ($i+2) && is_numeric($this->text{$i+1}) && is_numeric($this->text{$i+2})) { + if($characterSet!=self::CHARSET_C) { + $characterValue = 99; + $biteCode['DATA'] .= $this->codeTable[$characterValue]; + $weightedSum += $characterValue*$checksumCounter; + $checksumCounter++; + } + $characterSet = 'C'; + } else if(isset($this->text{$i+1})) { + $newCharacterSet = $this->findCharacterSet($this->text{$i+1}); + if($characterSet==self::CHARSET_C) { + if($newCharacterSet==self::CHARSET_A) { + $characterValue = 101; + } + else { + $characterValue = 100; + } + $weightedSum += $characterValue*$checksumCounter; + $checksumCounter++; + $biteCode['DATA'] .= $this->codeTable[$characterValue]; + } + $characterSet = $newCharacterSet; + } + } + + // Count the checksum + $checkSum = (int) $weightedSum%103; + + // Add the checksum + $biteCode['DATA'] .= $this->codeTable[$checkSum]; + + // Add the stop character + $biteCode['DATA'] .= $this->codeTable[self::STOP]; + + // Add the termination bar + $biteCode['DATA'] .= $this->codeTable[self::TERMINATION]; + + return $biteCode; + } + + + /** + * Find Character Set + * Find correct character set depends on imput char + * + * @param char $char + * @return char + */ + private function findCharacterSet($char) { + if(strpos($this->charsB, $char)!==false) { + return self::CHARSET_B; + } + if(strpos($this->charsA, $char)!==false) { + return self::CHARSET_A; + } + } + +} Property changes on: trunk/includes/barcodepack/class.code128.php ___________________________________________________________________ Added: svn:executable + * Added: trunk/includes/barcodepack/class.ean13.php =================================================================== --- trunk/includes/barcodepack/class.ean13.php (rev 0) +++ trunk/includes/barcodepack/class.ean13.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -0,0 +1,209 @@ +<?php + +require_once 'class.linearBarcode.php'; + +// Error Codes +define('E_BAD_EAN_LENGTH', 600); + + + +/** + * EAN 13 + * + * @author Tomáš Horáček <in...@we...> + * @package BarcodePack + */ +class ean13 extends linearBarcode { + + /** @var array */ + private $allowedChars = array( + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + ); + + /** @var array */ + private $parity = array( + '0' => 'LLLLLLRRRRRR', + '1' => 'LLGLGGRRRRRR', + '2' => 'LLGGLGRRRRRR', + '3' => 'LLGGGLRRRRRR', + '4' => 'LGLLGGRRRRRR', + '5' => 'LGGLLGRRRRRR', + '6' => 'LGGGLLRRRRRR', + '7' => 'LGLGLGRRRRRR', + '8' => 'LGLGGLRRRRRR', + '9' => 'LGGLGLRRRRRR', + ); + + + /** + * Zero represents white line + * One represents black line + * + * After each character except STOP I will add one white line + * (separating line) + * + * @var array + */ + private $codeTable = array( + '0' => array('L'=>'0001101', 'G'=>'0100111', 'R'=>'1110010',), + '1' => array('L'=>'0011001', 'G'=>'0110011', 'R'=>'1100110',), + '2' => array('L'=>'0010011', 'G'=>'0011011', 'R'=>'1101100',), + '3' => array('L'=>'0111101', 'G'=>'0100001', 'R'=>'1000010',), + '4' => array('L'=>'0100011', 'G'=>'0011101', 'R'=>'1011100',), + '5' => array('L'=>'0110001', 'G'=>'0111001', 'R'=>'1001110',), + '6' => array('L'=>'0101111', 'G'=>'0000101', 'R'=>'1010000',), + '7' => array('L'=>'0111011', 'G'=>'0010001', 'R'=>'1000100',), + '8' => array('L'=>'0110111', 'G'=>'0001001', 'R'=>'1001000',), + '9' => array('L'=>'0001011', 'G'=>'0010111', 'R'=>'1110100',), + 'START' => '101', + 'SEPARATOR' => '01010', + 'STOP' => '101', + ); + + + /** + * Constructor + * + * @param string $text + * @param int $modulesize + */ + public function __construct($text, $moduleSize) + { + try { + parent::__construct($text, $moduleSize, $this->allowedChars); + + if(strlen($this->text)!=12) { + throw new Exception('Text length must be 12 characters.', E_BAD_EAN_LENGTH); + } + + $this->biteCode = $this->createBiteCode(); + } + catch(Exception $e) { + throw $e; + } + + } + + + /** + * Create Bite Code + * Create bitecode where 1 represents dark module and 0 white module. + * + * @return string + */ + private function createBiteCode() + { + $biteCode = array(); + + $saveTo = 'DATA'; + + // Parity determine + $parity = $this->parity[$this->text{0}]; + + $biteCode['START'] = $this->codeTable['START']; + + for($i=1;$i<strlen($this->text);$i++) { + $biteCode[$saveTo] .= $this->codeTable[$this->text{$i}][$parity{$i-1}]; + if($i==6) { + $biteCode['SEPARATOR'] = $this->codeTable['SEPARATOR']; + $saveTo = 'DATA2'; + } + + } + + $checksum = (string) $this->checksum($this->text); + + $this->text .= $checksum; + + $biteCode[$saveTo] .= $this->codeTable[$checksum]['R']; + + $biteCode['STOP'] = $this->codeTable['STOP']; + + return $biteCode; + } + + + /** + * Checksum + * Count checksum + * + * @param string $text + * @return int + */ + private function checksum($text) { + + $evensum = 0; + $oddsum = 0; + + for($i=1;$i<=strlen($text);$i++) { + if($i%2==0) { + $evensum += (int) $text{$i-1}; + } else { + $oddsum += (int) $text{$i-1}; + } + } + + $sum = $evensum*3 + $oddsum; + + return ceil($sum/10)*10 - $sum; + } + + + /** + * Draw + * Add text into barcode + * + * @param bool $showText + * @return image resource + */ + public function draw($showText = true) { + $im = parent::draw(false); + + $margin = $this->margin*$this->moduleSize; + + + $white = Imagecolorallocate ($im,255,255,255); + $black = Imagecolorallocate ($im,0,0,0); + + + if($showText) { + + // Increase space between symbol 2x + $im2 = ImageCreate($this->getBarcodeLen()*$this->moduleSize+(2*$margin)+$margin, + $this->height+$this->fontSize+(2*$margin)); + + imagecopy($im2, $im, $margin, 0, 0, 0, $this->getBarcodeLen()*$this->moduleSize+(2*$margin), $this->height+$this->fontSize+(2*$margin)); + + // Divide text into three parts and each insert to the diffrerent place + $charsA = $this->text{0}; // first char + for($i=1;$i<=strlen($this->text);$i++) { + if($i<=6) { + $charsB .= $this->text{$i}; + } else { + $charsC .= $this->text{$i}; + } + } + + // Insert A + $textWidth = ImageFontWidth($this->fontSize)*strlen($charsA); + imagestring ($im2, $this->fontSize, + $margin, + $this->height-$this->fontSize/2+$margin, $charsA, $black); + + // Insert B + $textWidth = ImageFontWidth($this->fontSize)*strlen($charsB); + imagestring ($im2, $this->fontSize, + $this->getBarcodeLen()*$this->moduleSize/4-$textWidth/2+2*$margin, + $this->height-$this->fontSize/2+$margin, $charsB, $black); + + // Insert C + $textWidth = ImageFontWidth($this->fontSize)*strlen($charsC); + imagestring ($im2, $this->fontSize, + $this->getBarcodeLen()*$this->moduleSize-$this->getBarcodeLen()*$this->moduleSize/4-$textWidth/2+2*$margin, + $this->height-$this->fontSize/2+$margin, $charsC, $black); + } + + return $im2; + } + +} Property changes on: trunk/includes/barcodepack/class.ean13.php ___________________________________________________________________ Added: svn:executable + * Added: trunk/includes/barcodepack/class.i2of5.php =================================================================== --- trunk/includes/barcodepack/class.i2of5.php (rev 0) +++ trunk/includes/barcodepack/class.i2of5.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -0,0 +1,135 @@ +<?php + +/** + * This file is part of the BarcodePack - PHP Barcode Library. + * Copyright (c) 2011 Tomáš Horáček (http://www.barcodepack.com) + * BarcodePack by Tomáš Horáček is licensed under + * a Creative Commons Attribution-NoDerivs 3.0 Unported License. + */ + + + +require_once 'class.linearBarcode.php'; + + +// Error codes +define('E_ODD_LENGTH', 500); + + +/** + * i2of5 + * + * Interleaved 2/5 + * + * @author Tomáš Horáček <in...@we...> + * @package BarcodePack + */ +class i2of5 extends linearBarcode { + + /** @var array */ + private $allowedChars = array( + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + ); + + /** + * Coding table + * + * @var array + */ + private $codeTable = array( + '0' => '1010111011101', + '1' => '1110101010111', + '2' => '1011101010111', + '3' => '1110111010101', + '4' => '1010111010111', + '5' => '1110101110101', + '6' => '1011101110101', + '7' => '1010101110111', + '8' => '1110101011101', + '9' => '1011101011101', + 'START' => '1010', + 'STOP' => '11101', + ); + + + /** + * Constructor + * + * @param string $text + * @param int $modulesize + */ + public function __construct($text, $moduleSize) + { + try { + parent::__construct($text, $moduleSize, $this->allowedChars); + + if((strlen($this->text)%2)!=0) { + throw new Exception('The number of characters must be even', E_ODD_LENGTH); + } + + $this->biteCode = $this->createBiteCode(); + } + catch(Exception $e) { + throw $e; + } + + } + + + /** + * Create Bite Code + * + * @return string + */ + private function createBiteCode() + { + $biteCode = array(); + + // START character + $biteCode['START'] = $this->codeTable['START']; + + $biteCode['DATA'] = ''; + + + for($i=0;$i<strlen($this->text);$i++) { + $firstCounter = 0; // Num of line module + $secondCounter = 0; // Num of space module + + // Each char is encoded to 5 lines or spaces + for($j=0; $j<5; $j++) { + + // Encode first char into lines + $bars = true; + while($bars && $firstCounter<13) { + if($this->codeTable[$this->text{$i}]{$firstCounter}=="1") { + $biteCode['DATA'] .= '1'; // line + } else { + $bars = false; + } + $firstCounter++; // jump to next line + } + + // Second char is encoded to spaces + $spaces = true; + while($spaces && $secondCounter<13) { + if($this->codeTable[$this->text{$i+1}]{$secondCounter}=='1') { + $biteCode['DATA'] .= '0'; // space + $secondCounter++; + } else { + $spaces = false; + $secondCounter++; // jump to next space + } + } + } + + $i++; // jump to next char + } + + // Insert STOP character + $biteCode['STOP'] = $this->codeTable['STOP']; + + return $biteCode; + } + + +} Property changes on: trunk/includes/barcodepack/class.i2of5.php ___________________________________________________________________ Added: svn:executable + * Added: trunk/includes/barcodepack/class.linearBarcode.php =================================================================== --- trunk/includes/barcodepack/class.linearBarcode.php (rev 0) +++ trunk/includes/barcodepack/class.linearBarcode.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -0,0 +1,175 @@ +<?php + +/** + * This file is part of the BarcodePack - PHP Barcode Library. + * Copyright (c) 2011 Tomáš Horáček (http://www.barcodepack.com) + * BarcodePack by Tomáš Horáček is licensed under + * a Creative Commons Attribution-NoDerivs 3.0 Unported License. + */ + + + +require_once 'class.barcode.php'; + +// Error codes +define('E_BAD_CHARS', 200); + + +/** + * Linear Barcode + * Parent class for all linear barcode types + * + * @author Tomáš Horáček <in...@we...> + * @package BarcodePack + */ +class linearBarcode extends barcode { + + /** @var array */ + protected $biteCode = array(); + + /** @var int */ + protected $height = 100; + + /** @var int */ + protected $fontSize = 10; + + /** + * Quiet zone + * Multiple of module size + * @var int */ + protected $margin = 5; + + /** + * Constructor + * + * @param string $text + * @param int $modulesize + */ + public function __construct($text, $moduleSize=2, $allowedChars=null) + { + try { + parent::__construct($text, $moduleSize); + + if($allowedChars) { + $this->checkAllowedChars($text, $allowedChars); + } + + } catch (Exception $e) { + throw $e; + } + } + + + /** + * Check Allowed Chars + * + * @param string $text + * @param array $alloweChars + * @return bool + */ + protected function checkAllowedChars($text, $allowedChars) + { + for($i=0; $i<strlen($text); $i++) { + if(!in_array($text{$i}, $allowedChars)) { + throw new Exception('Input text contains nonallowed characters.', E_BAD_CHARS); + return false; + } + } + return true; + } + + + + /** + * Get Barcode Length + * @return int + */ + protected function getBarcodeLen() { + $len = 0; + foreach ($this->biteCode as $value) { + $len += strlen($value); + } + return $len; + } + + + /** + * Draw + * Create image with barcode + * + * @param bool $showText + * @return image resource + */ + public function draw($showText=true) + { + // Image create + $margin = $this->margin*$this->moduleSize; + $im = ImageCreate($this->getBarcodeLen()*$this->moduleSize+(2*$margin), + $this->height+$this->fontSize+(2*$margin)); + + // Color set + $white = Imagecolorallocate ($im,255,255,255); + $black = Imagecolorallocate ($im,0,0,0); + + + // Draw lines + $pos = 0; + foreach ($this->biteCode as $type => $values) { + switch($type) { + case 'DATA': + case 'DATA2': + // Data + for($i=0;$i<strlen($values);$i++) { + $color = (($values{$i})=='1') ? $black : $white; + imagefilledrectangle($im, $pos*$this->moduleSize+$margin, $margin, + ($pos+1)*$this->moduleSize+$margin, + $this->height-5*$this->moduleSize+$margin, $color); + $pos++; + } + break; + default: + // Special chars + // will be longer + for($i=0;$i<strlen($values);$i++) { + + $color = (($values{$i})=='1') ? $black : $white; + imagefilledrectangle($im, $pos*$this->moduleSize+$margin, $margin, + ($pos+1)*$this->moduleSize+$margin, $this->height+$margin, + $color); + $pos++; + } + + break; + } + } + + // Text + if($showText) { + $textWidth = ImageFontWidth($this->fontSize)*strlen($this->text); + imagestring ($im, $this->fontSize, + $this->getBarcodeLen()*$this->moduleSize/2-$textWidth/2+$margin, + $this->height-$this->fontSize/2+$margin, $this->text, $black); + } + + return $im; + } + + + /** + * Raw Data + * Returns data in text representation + * Black module is represented as 1 and white module as 0 + * + * @return string $output + */ + public function rawData() + { + $ret = ''; + foreach ($this->biteCode as $value) { + $ret .= $value; + } + return $ret; + } + + +} Property changes on: trunk/includes/barcodepack/class.linearBarcode.php ___________________________________________________________________ Added: svn:executable + * Added: trunk/includes/barcodepack/class.qrCode.php =================================================================== --- trunk/includes/barcodepack/class.qrCode.php (rev 0) +++ trunk/includes/barcodepack/class.qrCode.php 2012-05-26 21:46:00 UTC (rev 8957) @@ -0,0 +1,1266 @@ +<?php + +/** + * This file is part of the BarcodePack - PHP Barcode Library. + * Copyright (c) 2011 Tomáš Horáček (http://www.barcodepack.com) + * BarcodePack by Tomáš Horáček is licensed under + * a Creative Commons Attribution-NoDerivs 3.0 Unported License. + */ + + + +require_once 'class.barcode.php'; + +// Erroe codes +define('E_BAD_QR_LENGTH', 800); +define('E_BAD_VERSION', 801); +define('E_BAD_MASK', 802); + + + +/** + * qrCode + * Class for QR Code generation + * + * @author Tomáš Horáček <in...@we...> + * @package BarcodePack + */ +class qrCode extends barcode { + + // Error correction levels + const ECL_L_CODE = 'L'; + const ECL_M_CODE = 'M'; + const ECL_Q_CODE = 'Q'; + const ECL_H_CODE = 'H'; + + const DEFAULT_ECL = 'M'; + + // Error correction levels numbers + const ECL_L = 1; + const ECL_M = 0; + const ECL_Q = 3; + const ECL_H = 2; + + + // Mode indicators + const MODE_ECI = 7; + const MODE_NUMERIC = 1; + const MODE_ALPHANUMERIC = 2; + const MODE_8BITBYTE = 4; + const MODE_KANJI = 8; + const MODE_STRUCTURED_APPEND = 3; + const MODE_FNC1_FP = 5; // First position + const MODE_FNC1_SP = 9; // Second position + const MODE_TERMINATOR = 0; + + // Quiet zone size + const QUIET_ZONE = 4; + + // Directions + const DIRECTION_UP = 'UP'; + const DIRECTION_DOWN = 'DOWN'; + + /** + * Error correction level + * @var char + */ + private $ecl = self::ECL_L; + + /** + * Version (1-40) + * @var int + */ + private $version = 1; + + /** + * Matrix size (QR code size without quiet zone) + * @var int + */ + private $matrixSize = 0; + + /** + * Symbol size with quiet zone + * @var int + */ + private $symbolSize = 0; + + /** + * Number of imput characters + * @var int + */ + private $charsNum = 0; + + /** + * Mode indicator + * @var int + */ + private $mode; + + /** + * QR code matrix + * @var array + */ + private $matrix; + + /** + * Masked matrix + * @var array + */ + private $maskedMatrix; + + /** + * Coordinates of modules in matrix + * @var array + */ + private $bitsCoordinates; + + /** + * Mask reference (0-7) + * @var int + */ + private $maskReference; + + /** + * ECL conversion table + * @var array + */ + private $eclConvertTable = array( + self::ECL_L_CODE => self::ECL_L, + self::ECL_M_CODE => self::ECL_M, + self::ECL_Q_CODE => self::ECL_Q, + self::ECL_H_CODE => self::ECL_H, + ); + + /** + * Number of bits the num chars indicator is saved + * @var array + */ + private $characterCountIndicatorBits = array( + self::MODE_NUMERIC => array(1=> 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,), + self::MODE_ALPHANUMERIC => array(1=> 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,), + self::MODE_8BITBYTE => array(1=> 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,), + self::MODE_KANJI => array(1=> 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,), + ); + + /** + * Code capacity + * Include mode indicator and num chars indicator without ECL + * @var array + */ + private $numberDataBits = array( + self::ECL_L => array(1 => 152, 272, 440, 640, 864, 1088, 1248, 1552, 1856, 2192, 2592, 2960, 3424, 3688, 4184, 4712, 5176, 5768, 6360, 6888, 7456, 8048, 8752, 9392, 10208, 10960, 11744, 12248, 13048, 13880, 14744, 15640, 16568, 17528, 18448, 19472, 20528, 21616, 22496, 23648,), + self::ECL_M => array(1 => 128, 224, 352, 512, 688, 864, 992, 1232, 1456, 1728, 2032, 2320, 2672, 2920, 3320, 3624, 4056, 4504, 5016, 5352, 5712, 6256, 6880, 7312, 8000, 8496, 9024, 9544, 10136, 10984, 11640, 12328, 13048, 13800, 14496, 15312, 15936, 16816, 17728, 18672,), + self::ECL_Q => array(1 => 104, 176, 272, 384, 496, 608, 704, 880, 1056, 1232, 1440, 1648, 1952, 2088, 2360, 2600, 2936, 3176, 3560, 3880, 4096, 4544, 4912, 5312, 5744, 6032, 6464, 6968, 7288, 7880, 8264, 8920, 9368, 9848, 10288, 10832, 11408, 12016, 12656, 13328,), + self::ECL_H => array(1 => 72, 128, 208, 288, 368, 480, 528, 688, 800, 976, 1120, 1264, 1440, 1576, 1784, 2024, 2264, 2504, 2728, 3080, 3248, 3536, 3712, 4112, 4304, 4768, 5024, 5288, 5608, 5960, 6344, 6760, 7208, 7688, 7888, 8432, 8768, 9136, 9776, 10208,), + ); + + /** + * Code capacity in codewords + * @var array + */ + private $codewordsCapacity=array(1 => 26,44,70,100,134,172,196,242, + 292,346,404,466,532,581,655,733,815,901,991,1085,1156, + 1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465, + 2611,2761,2876,3034,3196,3362,3532,3706); + + /** + * Capacity in characters + * @var array + */ + private $dataCapacity = array( + self::ECL_L => array( + self::MODE_NUMERIC => array(1 => 41, 77, 127, 187, 255, 322, 370, 461, 552, 652, 772, 883, 1022, 1101, 1250, 1408, 1548, 1725, 1903, 2061, 2232, 2409, 2620, 2812, 3057, 3283, 3517, 3669, 3909, 4158, 4417, 4686, 4965, 5253, 5529, 5836, 6153, 6479, 6743, 7089,), + self::MODE_ALPHANUMERIC => array(1 => 25, 47, 77, 114, 154, 195, 224, 279, 335, 395, 468, 535, 619, 667, 758, 854, 938, 1046, 1153, 1249, 1352, 1460, 1588, 1704, 1853, 1990, 2132, 2223, 2369, 2520, 2677, 2840, 3009, 3183, 3351, 3537, 3729, 3927, 4087, 4296,), + self::MODE_8BITBYTE => array(1 => 17, 32, 53, 78, 106, 134, 154, 192, 230, 271, 321, 367, 425, 458, 520, 586, 644, 718, 792, 858, 929, 1003, 1091, 1171, 1273, 1367, 1465, 1528, 1628, 1732, 1840, 1952, 2068, 2188, 2303, 2431, 2563, 2699, 2809, 2953,), + self::MODE_KANJI => array(1 => 10, 20, 32, 48, 65, 82, 95, 118, 141, 167, 198, 226, 262, 282, 320, 361, 397, 442, 488, 528, 572, 618, 672, 721, 784, 842, 902, 940, 1002, 1066, 1132, 1201, 1273, 1347, 1417, 1496, 1577, 1661, 1729, 1817,), + ), + self::ECL_M => array( + self::MODE_NUMERIC => array(1 => 34, 63, 101, 149, 202, 255, 293, 365, 432, 513, 604, 691, 796, 871, 991, 1082, 1212, 1346, 1500, 1600, 1708, 1872, 2059, 2188, 2395, 2544, 2701, 2857, 3035, 3289, 3486, 3693, 3909, 4134, 4343, 4588, 4775, 5039, 5313, 5596,), + self::MODE_ALPHANUMERIC => array(1 => 20, 38, 61, 90, 122, 154, 178, 221, 262, 311, 366, 419, 483, 528, 600, 656, 734, 816, 909, 970, 1035, 1134, 1248, 1326, 1451, 1542, 1637, 1732, 1839, 1994, 2113, 2238, 2369, 2506, 2632, 2780, 2894, 3054, 3220, 3391,), + self::MODE_8BITBYTE => array(1 => 14, 26, 42, 62, 84, 106, 122, 152, 180, 213, 251, 287, 331, 362, 412, 450, 504, 560, 624, 666, 711, 779, 857, 911, 997, 1059, 1125, 1190, 1264, 1370, 1452, 1538, 1628, 1722, 1809, 1911, 1989, 2099, 2213, 2331,), + self::MODE_KANJI => array(1 => 8, 16, 26, 38, 52, 65, 75, 93, 111, 131, 155, 177, 204, 223, 254, 277, 310, 345, 384, 410, 438, 480, 528, 561, 614, 652, 692, 732, 778, 843, 894, 947, 1002, 1060, 1113, 1176, 1224, 1292, 1362, 1435,), + ), + self::ECL_Q => array( + self::MODE_NUMERIC => array(1 => 27, 48, 77, 111, 144, 178, 207, 259, 312, 364, 427, 489, 580, 621, 703, 775, 876, 948, 1063, 1159, 1224, 1358, 1468, 1588, 1718, 1804, 1933, 2085, 2181, 2358, 2473, 2670, 2805, 2949, 3081, 3244, 3417, 3599, 3791, 3993,), + self::MODE_ALPHANUMERIC => array(1 => 16, 29, 47, 67, 87, 108, 125, 157, 189, 221, 259, 296, 352, 376, 426, 470, 531, 574, 644, 702, 742, 823, 890, 963, 1041, 1094, 1172, 1263, 1322, 1429, 1499, 1618, 1700, 1787, 1867, 1966, 2071, 2181, 2298, 2420,), + self::MODE_8BITBYTE => array(1 => 11, 20, 32, 46, 60, 74, 86, 108, 130, 151, 177, 203, 241, 258, 292, 322, 364, 394, 442, 482, 509, 565, 611, 661, 715, 751, 805, 868, 908, 982, 1030, 1112, 1168, 1228, 1283, 1351, 1423, 1499, 1579, 1663,), + self::MODE_KANJI => array(1 => 7, 12, 20, 28, 37, 45, 53, 66, 80, 93, 109, 125, 149, 159, 180, 198, 224, 243, 272, 297, 314, 348, 376, 407, 440, 462, 496, 534, 559, 604, 634, 684, 719, 756, 790, 832, 876, 923, 972, 1024,), + ), + self::ECL_H => array( + self::MODE_NUMERIC => array(1 => 17, 34, 58, 82, 106, 139, 154, 202, 235, 288, 331, 374, 427, 468, 530, 602, 674, 746, 813, 919, 969, 1056, 1108, 1228, 1286, 1425, 1501, 1581, 1677, 1782, 1897, 2022, 2157, 2301, 2361, 2524, 2625, 2735, 2927, 3057,), + self::MODE_ALPHANUMERIC => array(1 => 10, 20, 35, 50, 64, 84, 93, 122, 143, 174, 200, 227, 259, 283, 321, 365, 408, 452, 493, 557, 587, 640, 672, 744, 779, 864, 910, 958, 1016, 1080, 1150, 1226, 1307, 1394, 1431, 1530, 1591, 1658, 1774, 1852,), + self::MODE_8BITBYTE => array(1 => 7, 14, 24, 34, 44, 58, 64, 84, 98, 119, 137, 155, 177, 194, 220, 250, 280, 310, 338, 382, 403, 439, 461, 511, 535, 593, 625, 658, 698, 742, 790, 842, 898, 958, 983, 1051, 1093, 1139, 1219, 1273,), + self::MODE_KANJI => array(1 => 4, 8, 15, 21, 27, 36, 39, 52, 60, 74, 85, 96, 109, 120, 136, 154, 173, 191, 208, 235, 248, 270, 284, 315, 330, 365, 385, 405, 430, 457, 486, 518, 553, 590, 605, 647, 673, 701, 750, 784,), + ), + ); + + /** + * Position detection pattern + * @var array + */ + private $positionPattern = array( + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, + ); + + /** + * Alignment pattern + * @var array + */ + private $alignmentPattern = array( + 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, + ); + + /** + * Coordinates of alignment patterns + * @var array + */ + private $alignmentPatternCoordinate = array( + 1 => array(), + array(6, 18), + array(6, 22), + array(6, 26), + array(6, 30), + array(6, 34), + array(6, 22, 38), + array(6, 24, 42), + array(6, 26, 46), + array(6, 28, 50), + array(6, 30, 54), + array(6, 32, 58), + array(6, 34, 62), + array(6, 26, 46, 66,), + array(6, 26, 48, 70,), + array(6, 26, 50, 74,), + array(6, 30, 54, 78,), + array(6, 30, 56, 82,), + array(6, 30, 58, 86,), + array(6, 34, 62, 90,), + array(6, 28, 50, 72, 94), + array(6, 26, 50, 74, 98,), + array(6, 30, 54, 78, 102,), + array(6, 28, 54, 80, 106), + array(6, 32, 58, 84, 110,), + array(6, 30, 58, 86, 114,), + array(6, 34, 62, 90, 118,), + array(6, 26, 50, 74, 98, 122,), + array(6, 30, 54, 78, 102, 126,), + array(6, 26, 52, 78, 104, 130,), + array(6, 30, 56, 82, 108, 134,), + array(6, 34, 60, 86, 112, 138,), + array(6, 30, 58, 86, 114, 142,), + array(6, 34, 62, 90, 118, 146,), + array(6, 30, 54, 78, 102, 126, 150,), + array(6, 24, 50, 76, 102, 128, 154,), + array(6, 28, 54, 80, 106, 132, 158,), + array(6, 32, 58, 84, 110, 136, 162,), + array(6, 26, 54, 82, 110, 138, 166,), + array(6, 30, 58, 86, 114, 142, 170), + ); + + + /** + * Block specification + * @var array + */ + private $blocksSpec = array( + 1 => + array(self::ECL_L => array( 1, 0), self::ECL_M => array( 1, 0), self::ECL_Q => array( 1, 0), self::ECL_H => array( 1, 0)), // 1 + array(self::ECL_L => array( 1, 0), self::ECL_M => array( 1, 0), self::ECL_Q => array( 1, 0), self::ECL_H => array( 1, 0)), + array(self::ECL_L => array( 1, 0), self::ECL_M => array( 1, 0), self::ECL_Q => array( 2, 0), self::ECL_H => array( 2, 0)), + array(self::ECL_L => array( 1, 0), self::ECL_M => array( 2, 0), self::ECL_Q => array( 2, 0), self::ECL_H => array( 4, 0)), + array(self::ECL_L => array( 1, 0), self::ECL_M => array( 2, 0), self::ECL_Q => array( 2, 2), self::ECL_H => array( 2, 2)), // 5 + array(self::ECL_L => array( 2, 0), self::ECL_M => array( 4, 0), self::ECL_Q => array( 4, 0), self::ECL_H => array( 4, 0)), + array(self::ECL_L => array( 2, 0), self::ECL_M => array( 4, 0), self::ECL_Q => array( 2, 4), self::ECL_H => array( 4, 1)), + array(self::ECL_L => array( 2, 0), self::ECL_M => array( 2, 2), self::ECL_Q => array( 4, 2), self::ECL_H => array( 4, 2)), + array(self::ECL_L => array( 2, 0), self::ECL_M => array( 3, 2), self::ECL_Q => array( 4, 4), self::ECL_H => array( 4, 4)), + array(self::ECL_L => array( 2, 2), self::ECL_M => array( 4, 1), self::ECL_Q => array( 6, 2), self::ECL_H => array( 6, 2)), //10 + array(self::ECL_L => array( 4, 0), self::ECL_M => array( 1, 4), self::ECL_Q => array( 4, 4), self::ECL_H => array( 3, 8)), + array(self::ECL_L => array( 2, 2), self::ECL_M => array( 6, 2), self::ECL_Q => array( 4, 6), self::ECL_H => array( 7, 4)), + array(self::ECL_L => array( 4, 0), self::ECL_M => array( 8, 1), self::ECL_Q => array( 8, 4), self::ECL_H => array(12, 4)), + array(self::ECL_L => array( 3, 1), self::ECL_M => array( 4, 5), self::ECL_Q => array(11, 5), self::ECL_H => array(11, 5)), + array(self::ECL_L => array( 5, 1), self::ECL_M => array( 5, 5), self::ECL_Q => array( 5, 7), self::ECL_H => array(11, 7)), //15 + array(self::ECL_L => array( 5, 1), self::ECL_M => array( 7, 3), self::ECL_Q => array(15, 2), self::ECL_H => array( 3, 13)), + array(self::ECL_L => array( 1, 5), self::ECL_M => array(10, 1), self::ECL_Q => array( 1, 15), self::ECL_H => array( 2, 17)), + array(self::ECL_L => array( 5, 1), self::ECL_M => array( 9, 4), self::ECL_Q => array(17, 1), self::ECL_H => array( 2, 19)), + array(self::ECL_L => array( 3, 4), self::ECL_M => array( 3, 11), self::ECL_Q => array(17, 4), self::ECL_H => array( 9, 16)), + array(self::ECL_L => array( 3, 5), self::ECL_M => array( 3, 13), self::ECL_Q => array(15, 5), self::ECL_H => array(15, 10)), //20 + array(self::ECL_L => array( 4, 4), self::ECL_M => array(17, 0), self::ECL_Q => array(17, 6), self::ECL_H => array(19, 6)), + array(self::ECL_L => array( 2, 7), self::ECL_M => array(17, 0), self::ECL_Q => array( 7, 16), self::ECL_H => array(34, 0)), + array(self::ECL_L => array( 4, 5), self::ECL_M => array( 4, 14), self::ECL_Q => array(11, 14), self::ECL_H => array(16, 14)), + array(self::ECL_L => array( 6, 4), self::ECL_M => array( 6, 14), self::ECL_Q => array(11, 16), self::ECL_H => array(30, 2)), + array(self::ECL_L => array( 8, 4), self::ECL_M => array( 8, 13), self::ECL_Q => array( 7, 22), self::ECL_H => array(22, 13... [truncated message content] |
From: <tim...@us...> - 2012-05-26 21:56:27
|
Revision: 8958 http://weberp.svn.sourceforge.net/weberp/?rev=8958&view=rev Author: tim_schofield Date: 2012-05-26 21:56:21 +0000 (Sat, 26 May 2012) Log Message: ----------- Set pdf attributes correctly Modified Paths: -------------- trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2012-05-26 21:46:00 UTC (rev 8957) +++ trunk/PrintCustTrans.php 2012-05-26 21:56:21 UTC (rev 8958) @@ -29,6 +29,11 @@ $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/SalesInvoice.xml'); } if (isset($PrintPDF) or isset($_GET['PrintPDF']) and $PrintPDF and isset($FromTransNo) and isset($InvOrCredit) and $FromTransNo != '') { + $pdf->setAutoPageBreak(0); // Javier: needs check. + $pdf->setPrintHeader(false); // Javier: I added this must be called before Add Page + $pdf->setPrintFooter(false); + $pdf->AddPage(); + $pdf->cMargin = 0; // Javier: needs check. $PaperSize = $FormDesign->PaperSize; include ('includes/PDFStarter.php'); // Javier: now I use the native constructor, better to not use references Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2012-05-26 21:46:00 UTC (rev 8957) +++ trunk/PrintCustTransPortrait.php 2012-05-26 21:56:21 UTC (rev 8958) @@ -66,6 +66,7 @@ I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */ $pdf->setAutoPageBreak(0); // Javier: needs check. $pdf->setPrintHeader(false); // Javier: I added this must be called before Add Page + $pdf->setPrintFooter(false); $pdf->AddPage(); $pdf->cMargin = 0; // Javier: needs check. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-30 19:22:23
|
Revision: 8975 http://weberp.svn.sourceforge.net/weberp/?rev=8975&view=rev Author: tim_schofield Date: 2012-05-30 19:22:17 +0000 (Wed, 30 May 2012) Log Message: ----------- Move javascript to separate file Modified Paths: -------------- trunk/includes/ItemSearch.php Added Paths: ----------- trunk/javascripts/ItemSearch.js Modified: trunk/includes/ItemSearch.php =================================================================== --- trunk/includes/ItemSearch.php 2012-05-30 15:06:56 UTC (rev 8974) +++ trunk/includes/ItemSearch.php 2012-05-30 19:22:17 UTC (rev 8975) @@ -1,32 +1,7 @@ <?php -echo '<script type="text/javascript"> -function ShowItems(Category, Code, Description, MaxItems, identifier) -{ -if (Category=="") - { - document.getElementById("txtHint").innerHTML=""; - return; - } -if (window.XMLHttpRequest) - {// code for IE7+, Firefox, Chrome, Opera, Safari - xmlhttp=new XMLHttpRequest(); - } -else - {// code for IE6, IE5 - xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); - } -xmlhttp.onreadystatechange=function() - { - if (xmlhttp.readyState==4 && xmlhttp.status==200) - { - document.getElementById("txtHint").innerHTML=xmlhttp.responseText; - } - } -xmlhttp.open("GET","includes/ItemShowSearch.php?Category="+Category+"&Code="+Code+"&Description="+Description+"&MaxItems="+MaxItems+"&identifier="+identifier,true); -xmlhttp.send(); -} -</script>'; +echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/ItemSearch.js"></script>'; + function ShowItemSearchFields($rootpath, $theme, $db, $identifier) { $PathPrefix=$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']) . '/'; Added: trunk/javascripts/ItemSearch.js =================================================================== --- trunk/javascripts/ItemSearch.js (rev 0) +++ trunk/javascripts/ItemSearch.js 2012-05-30 19:22:17 UTC (rev 8975) @@ -0,0 +1,25 @@ +function ShowItems(Category, Code, Description, MaxItems, identifier) +{ +if (Category=="") + { + document.getElementById("txtHint").innerHTML=""; + return; + } +if (window.XMLHttpRequest) + {// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + } +else + {// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } +xmlhttp.onreadystatechange=function() + { + if (xmlhttp.readyState==4 && xmlhttp.status==200) + { + document.getElementById("txtHint").innerHTML=xmlhttp.responseText; + } + } +xmlhttp.open("GET","includes/ItemShowSearch.php?Category="+Category+"&Code="+Code+"&Description="+Description+"&MaxItems="+MaxItems+"&identifier="+identifier,true); +xmlhttp.send(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-05-30 21:10:50
|
Revision: 8976 http://weberp.svn.sourceforge.net/weberp/?rev=8976&view=rev Author: tim_schofield Date: 2012-05-30 21:10:44 +0000 (Wed, 30 May 2012) Log Message: ----------- Generalisation of stock item search functionality Modified Paths: -------------- trunk/CounterSales.php trunk/includes/ItemSearch.php trunk/includes/ItemShowSearch.php Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2012-05-30 19:22:17 UTC (rev 8975) +++ trunk/CounterSales.php 2012-05-30 21:10:44 UTC (rev 8976) @@ -1911,7 +1911,7 @@ /* Now show the stock item selection search stuff below */ if (isset($_POST['PartSearch'])){ - ShowItemSearchFields($rootpath, $theme, $db, $identifier); + ShowItemSearchFields($rootpath, $theme, $db, $identifier, array('A', 'K', 'M', 'B', 'D'), array('F', 'D'), 'Search'); } echo '<br /></form>'; Modified: trunk/includes/ItemSearch.php =================================================================== --- trunk/includes/ItemSearch.php 2012-05-30 19:22:17 UTC (rev 8975) +++ trunk/includes/ItemSearch.php 2012-05-30 21:10:44 UTC (rev 8976) @@ -2,7 +2,7 @@ echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/ItemSearch.js"></script>'; -function ShowItemSearchFields($rootpath, $theme, $db, $identifier) { +function ShowItemSearchFields($rootpath, $theme, $db, $identifier, $MBFlags, $StockTypes, $SearchOrSelect) { $PathPrefix=$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']) . '/'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Items') . '</p>'; @@ -15,7 +15,7 @@ echo '<table class="selection" width="98%"> <tr> <td><b>' . _('Select a Stock Category') . ': </b></td> - <td><select tabindex="1" name="StockCat" onchange="ShowItems(this.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')">'; + <td><select tabindex="1" name="StockCat" onchange="ShowItems(\'' . $SearchOrSelect . '\', this.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')">'; if (!isset($_POST['Keywords'])) { $_POST['Keywords']=''; @@ -47,16 +47,16 @@ echo '</select></td></tr> <tr> <td><b>' . _('Enter partial Description') . ':</b></td> - <td><input tabindex="2" type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" onkeyup="ShowItems(StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')" /></td> + <td><input tabindex="2" type="text" name="Keywords" size="20" maxlength="25" value="' . $_POST['Keywords'] . '" onkeyup="ShowItems(\'' . $SearchOrSelect . '\', StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')" /></td> </tr> <tr> <td><b>' . _('OR') . ' ' . _('Enter extract of the Stock Code') . ':</b></td> - <td><input tabindex="3" type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" onkeyup="ShowItems(StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')" /></td> + <td><input tabindex="3" type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" onkeyup="ShowItems(\'' . $SearchOrSelect . '\', StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')" /></td> </tr> <tr> <td><b>' . _('Maximum number of Items to Show') . ':</b></td> <td> - <select name="MaxItems" onchange="ShowItems(StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')"> + <select name="MaxItems" onchange="ShowItems(\'' . $SearchOrSelect . '\', StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')"> <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> @@ -79,7 +79,26 @@ /* Search Results*/ echo '<td width="67%" valign="top">'; - include('includes/ItemShowSearch.php'); + + unset($_SESSION['MBFlagSQL']); + unset($_SESSION['StockTypesSQL']); + $MBFlagSQL=" AND ("; + foreach ($MBFlags as $MBFlag) { + $MBFlagSQL .= "stockmaster.mbflag='".$MBFlag."' OR "; + } + $_SESSION['MBFlagSQL']=mb_substr($MBFlagSQL, 0, mb_strlen($MBFlagSQL)-3).")"; + + $StockTypesSQL=" ("; + foreach ($StockTypes as $StockType) { + $StockTypesSQL .= "stockcategory.stocktype='".$StockType."' OR "; + } + $_SESSION['StockTypesSQL']=mb_substr($StockTypesSQL, 0, mb_strlen($StockTypesSQL)-3).") "; + + if ($SearchOrSelect=='Search') { + include('includes/ItemShowSearch.php'); + } else { + include('includes/ItemShowSelect.php'); + } echo '</td> </tr> </table>'; Modified: trunk/includes/ItemShowSearch.php =================================================================== --- trunk/includes/ItemShowSearch.php 2012-05-30 19:22:17 UTC (rev 8975) +++ trunk/includes/ItemShowSearch.php 2012-05-30 21:10:44 UTC (rev 8976) @@ -48,8 +48,8 @@ FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid - WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') - AND stockmaster.mbflag <>'G' + WHERE ".$_SESSION['StockTypesSQL']." + ".$_SESSION['MBFlagSQL']." AND stockmaster.discontinued=0 AND stockmaster.categoryid like '".$Category."' AND stockmaster.description like '%".$Description."%' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-06 20:43:10
|
Revision: 8986 http://weberp.svn.sourceforge.net/weberp/?rev=8986&view=rev Author: tim_schofield Date: 2012-06-06 20:43:04 +0000 (Wed, 06 Jun 2012) Log Message: ----------- Add in selection of single item as well as multi select Modified Paths: -------------- trunk/includes/ItemSearch.php trunk/javascripts/ItemSearch.js Added Paths: ----------- trunk/includes/ItemShowSelect.php Modified: trunk/includes/ItemSearch.php =================================================================== --- trunk/includes/ItemSearch.php 2012-06-06 18:09:13 UTC (rev 8985) +++ trunk/includes/ItemSearch.php 2012-06-06 20:43:04 UTC (rev 8986) @@ -1,3 +1,4 @@ +<<<<<<< TREE <?php echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/ItemSearch.js"></script>'; @@ -5,8 +6,6 @@ function ShowItemSearchFields($rootpath, $theme, $db, $identifier, $MBFlags, $StockTypes, $SearchOrSelect) { $PathPrefix=$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']) . '/'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Items') . '</p>'; - echo '<div class="page_help_text">' . _('Search for Items') . _(', Searches the database for items, you can narrow the results by selecting a stock category, or just enter a partial item description or partial item code') . '.</div><br />'; echo '<table width="98%"> <tr> <td width="33%" valign="top">'; @@ -15,7 +14,7 @@ echo '<table class="selection" width="98%"> <tr> <td><b>' . _('Select a Stock Category') . ': </b></td> - <td><select tabindex="1" name="StockCat" onchange="ShowItems(\'' . $SearchOrSelect . '\', this.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')">'; + <td><select tabindex="1" name="StockCat" onchange="ShowItems(\'' . $SearchOrSelect . '\', StockCat.value, StockCode.value, Keywords.value, MaxItems.value,' . $identifier . ')">'; if (!isset($_POST['Keywords'])) { $_POST['Keywords']=''; Added: trunk/includes/ItemShowSelect.php =================================================================== --- trunk/includes/ItemShowSelect.php (rev 0) +++ trunk/includes/ItemShowSelect.php 2012-06-06 20:43:04 UTC (rev 8986) @@ -0,0 +1,98 @@ +<?php +$PageSecurity=1; + +if (!isset($PathPrefix)) { + $PathPrefix=$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']) . '/../'; + $rootpath = dirname(htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8')); +} + +include($PathPrefix . 'config.php'); +require_once($PathPrefix . 'includes/session.inc'); +if (isset($_GET['Category'])) { + $Category=$_GET['Category']; +} else { + $Category='%'; +} +if (isset($_GET['identifier'])) { + $identifier=$_GET['identifier']; +} +if (isset($_GET['Code'])) { + $Code=$_GET['Code']; +} else { + $Code='%'; +} +if (isset($_GET['Description'])) { + $Description=$_GET['Description']; +} else { + $Description='%'; +} + +if (isset($_GET['MaxItems'])) { + $MaxItems=$_GET['MaxItems']; +} else { + $MaxItems=10; +} + +function __autoload($Cart) { + global $PathPrefix; + include $PathPrefix . 'includes/DefineCartClass.php'; +} + +$db = mysqli_connect($host , $dbuser, $dbpassword,$_SESSION['DatabaseName'], $mysqlport); +$SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.perishable, + stockmaster.controlled, + stockmaster.decimalplaces + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE ".$_SESSION['StockTypesSQL']." + ".$_SESSION['MBFlagSQL']." + AND stockmaster.discontinued=0 + AND stockmaster.categoryid like '".$Category."' + AND stockmaster.description like '%".$Description."%' + AND stockmaster.stockid like '%".$Code."%' + ORDER BY stockmaster.stockid + LIMIT 0,".($MaxItems+1); +$SearchResult = mysqli_query($db, $SQL); + +echo '<input type="hidden" name="identifier" value="' . $identifier . '" />'; +echo '<table class="selection" width="98%" id="txtHint"> + <tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('UOM') . '</th> + <th>' . _('Select') . '</th> + </tr>'; +$k=0; +$i=0; + +while ($myrow=DB_fetch_array($SearchResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + echo '<input type="hidden" name="StockID'.$i.'" value="'.$myrow['stockid'].'" />'; + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td><input type="radio" name="Selected" value="' . $i . '" /></td> + </tr>', + $myrow['stockid'], + $myrow['description'], + $myrow['units']); + echo '<input type="hidden" name="Units' . $i . '" value="' . $myrow['units'] . '" />'; + $i++; +} +#end of while loop +echo '<tr> + <th colspan="9"><button type="submit" name="OrderItems">'._('Select').'</button></th> + </tr>'; +echo '</table>'; + +?> \ No newline at end of file Modified: trunk/javascripts/ItemSearch.js =================================================================== --- trunk/javascripts/ItemSearch.js 2012-06-06 18:09:13 UTC (rev 8985) +++ trunk/javascripts/ItemSearch.js 2012-06-06 20:43:04 UTC (rev 8986) @@ -1,4 +1,4 @@ -function ShowItems(Category, Code, Description, MaxItems, identifier) +function ShowItems(SearchOrSelect, Category, Code, Description, MaxItems, identifier) { if (Category=="") { @@ -20,6 +20,10 @@ document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } -xmlhttp.open("GET","includes/ItemShowSearch.php?Category="+Category+"&Code="+Code+"&Description="+Description+"&MaxItems="+MaxItems+"&identifier="+identifier,true); + if (SearchOrSelect=='Search') { + xmlhttp.open("GET","includes/ItemShowSearch.php?Category="+Category+"&Code="+Code+"&Description="+Description+"&MaxItems="+MaxItems+"&identifier="+identifier,true); + } else { + xmlhttp.open("GET","includes/ItemShowSelect.php?Category="+Category+"&Code="+Code+"&Description="+Description+"&MaxItems="+MaxItems+"&identifier="+identifier,true); + } xmlhttp.send(); -} +} \ 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: <tim...@us...> - 2012-06-07 08:26:22
|
Revision: 8994 http://weberp.svn.sourceforge.net/weberp/?rev=8994&view=rev Author: tim_schofield Date: 2012-06-07 08:26:11 +0000 (Thu, 07 Jun 2012) Log Message: ----------- Pak Ricard: Correct rounding for different currency decimalpalces Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2012-06-07 08:25:58 UTC (rev 8993) +++ trunk/AgedDebtors.php 2012-06-07 08:26:11 UTC (rev 8994) @@ -91,7 +91,7 @@ holdreasons.dissallowinvoices, holdreasons.reasondescription HAVING - ABS(SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)) >0.005"; + ROUND(ABS(SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)),currencies.decimalplaces) >0.005"; } elseif ($_POST['All_Or_Overdues']=='OverduesOnly') { Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2012-06-07 08:25:58 UTC (rev 8993) +++ trunk/AgedSuppliers.php 2012-06-07 08:26:11 UTC (rev 8994) @@ -56,7 +56,7 @@ paymentterms.terms, paymentterms.daysbeforedue, paymentterms.dayinfollowingmonth - HAVING SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) <>0"; + HAVING ROUND(SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc),currencie.decimalplaces) <>0"; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-09 08:45:39
|
Revision: 8997 http://weberp.svn.sourceforge.net/weberp/?rev=8997&view=rev Author: tim_schofield Date: 2012-06-09 08:45:33 +0000 (Sat, 09 Jun 2012) Log Message: ----------- Ricard: Added lastcategoryupdate field to stockmaster table Modified Paths: -------------- trunk/Stocks.php Added Paths: ----------- trunk/sql/mysql/updates/134.php Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2012-06-07 20:02:15 UTC (rev 8996) +++ trunk/Stocks.php 2012-06-09 08:45:33 UTC (rev 8997) @@ -215,7 +215,8 @@ serialised, materialcost+labourcost+overheadcost AS itemcost, stockcategory.stockact, - stockcategory.wipact + stockcategory.wipact, + stockcategory.categoryid FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -228,6 +229,7 @@ $UnitCost = $myrow['itemcost']; $OldStockAccount = $myrow['stockact']; $OldWipAccount = $myrow['wipact']; + $OldCategoryId = $myrow['categoryid']; $sql = "SELECT SUM(locstock.quantity) AS totalquantity FROM locstock @@ -328,15 +330,18 @@ DB_Txn_Begin($db); - $sql = "UPDATE stockmaster + $sql = "UPDATE stockmaster SET longdescription='" . $_POST['LongDescription'] . "', description='" . $_POST['Description'] . "', discontinued='" . $_POST['Discontinued'] . "', controlled='" . $_POST['Controlled'] . "', serialised='" . $_POST['Serialised']."', perishable='" . $_POST['Perishable']."', - categoryid='" . $_POST['CategoryID'] . "', - units='" . $_POST['Units'] . "', + categoryid='" . $_POST['CategoryID'] . "',"; + if ($OldCategoryId != $_POST['CategoryID']){ + $sql = $sql . "lastcategoryupdate='" . date('Y-m-d') . "', "; + } + $sql = $sql . " units='" . $_POST['Units'] . "', mbflag='" . $_POST['MBFlag'] . "', eoq='" . $_POST['EOQ'] . "', volume='" . $_POST['Volume'] . "', @@ -498,6 +503,7 @@ description, longdescription, categoryid, + lastcategoryupdate, units, mbflag, eoq, @@ -517,6 +523,7 @@ '" . $_POST['Description'] . "', '" . $_POST['LongDescription'] . "', '" . $_POST['CategoryID'] . "', + '" . date('Y-m-d') . "', '" . $_POST['Units'] . "', '" . $_POST['MBFlag'] . "', '" . $_POST['EOQ'] . "', Added: trunk/sql/mysql/updates/134.php =================================================================== --- trunk/sql/mysql/updates/134.php (rev 0) +++ trunk/sql/mysql/updates/134.php 2012-06-09 08:45:33 UTC (rev 8997) @@ -0,0 +1,7 @@ +<?php + +AddColumn('lastcategoryupdate', 'stockmaster', 'DATE', 'NOT NULL', '0000-00-00', 'categoryid', $db); + +UpdateDBNo(basename(__FILE__, '.php'), $db); + +?> \ 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: <tim...@us...> - 2012-06-20 21:28:07
|
Revision: 9030 http://weberp.svn.sourceforge.net/weberp/?rev=9030&view=rev Author: tim_schofield Date: 2012-06-20 21:28:01 +0000 (Wed, 20 Jun 2012) Log Message: ----------- Allow receipts to be marked against an order number Modified Paths: -------------- trunk/CustomerAllocations.php trunk/CustomerReceipt.php trunk/includes/DefineCustAllocsClass.php trunk/includes/DefineReceiptClass.php Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/CustomerAllocations.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -253,18 +253,20 @@ // First get transactions that have outstanding balances $SQL = "SELECT debtortrans.id, - typename, - transno, - trandate, - rate, - ovamount+ovgst+ovfreight+ovdiscount as total, - diffonexch, - alloc - FROM debtortrans, systypes - WHERE debtortrans.type = systypes.typeid - AND debtortrans.settled=0 - AND debtorno='" . $_SESSION['Alloc']->DebtorNo . "' - ORDER BY debtortrans.trandate"; + typename, + transno, + trandate, + rate, + order_, + ovamount+ovgst+ovfreight+ovdiscount as total, + diffonexch, + alloc + FROM debtortrans + LEFT JOIN systypes + ON debtortrans.type = systypes.typeid + WHERE debtortrans.settled=0 + AND debtorno='" . $_SESSION['Alloc']->DebtorNo . "' + ORDER BY debtortrans.trandate"; $Result = DB_query($SQL,$db); while ($myrow=DB_fetch_array($Result)) { @@ -276,6 +278,7 @@ 0, $myrow['total'], $myrow['rate'], + $myrow['order_'], $myrow['diffonexch'], $myrow['diffonexch'], $myrow['alloc'], @@ -285,24 +288,25 @@ DB_free_result($Result); // Get trans previously allocated to by this trans - this will overwrite incomplete allocations above - $SQL= "SELECT debtortrans.id, - typename, - transno, - trandate, - rate, - ovamount+ovgst+ovfreight+ovdiscount AS total, - diffonexch, - debtortrans.alloc-custallocns.amt AS prevallocs, - amt, - custallocns.id AS allocid - FROM debtortrans, - systypes, - custallocns - WHERE debtortrans.type = systypes.typeid AND - debtortrans.id=custallocns.transid_allocto AND - custallocns.transid_allocfrom='" . $_POST['AllocTrans'] . "' AND - debtorno='" . $_SESSION['Alloc']->DebtorNo . "' - ORDER BY debtortrans.trandate"; + $SQL = "SELECT debtortrans.id, + typename, + transno, + trandate, + rate, + order_, + ovamount+ovgst+ovfreight+ovdiscount AS total, + diffonexch, + debtortrans.alloc-custallocns.amt AS prevallocs, + amt, + custallocns.id AS allocid + FROM debtortrans + LEFT JOIN systypes + ON debtortrans.type = systypes.typeid + LEFT JOIN custallocns + ON debtortrans.id=custallocns.transid_allocto + WHERE custallocns.transid_allocfrom='" . $_POST['AllocTrans'] . "' + AND debtorno='" . $_SESSION['Alloc']->DebtorNo . "' + ORDER BY debtortrans.trandate"; $Result=DB_query($SQL,$db); while ($myrow=DB_fetch_array($Result)) { @@ -329,15 +333,16 @@ ' ' . _('Allocate Receipts') . '</p>'; $TableHeader = '<tr> - <th>' . _('Trans Type') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Cust No') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - <th>' . _('Action') . '</th> - </tr>'; + <th>' . _('Trans Type') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Cust No') . '</th> + <th>' . _('Order No') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + <th>' . _('Action') . '</th> + </tr>'; if (isset($_POST['AllocTrans'])) { // Page called with trans number @@ -348,7 +353,7 @@ // Show trans already allocated and potential new allocations echo '<br /><table class="selection">'; - echo '<tr><th colspan="7"><div class="centre"><font color="blue"><b>' . $_SESSION['Alloc']->DebtorNo . ' - ' . $_SESSION['Alloc']->CustomerName . '</b></div>'; + echo '<tr><th colspan="8" class="header">' . $_SESSION['Alloc']->DebtorNo . ' - ' . $_SESSION['Alloc']->CustomerName; if ($_SESSION['Alloc']->TransExRate != 1) { echo '<br />'._('Amount in customer currency').' <b>' . @@ -359,6 +364,7 @@ echo '</th></tr><tr> <th>' . _('Trans') . '<br />' . _('Type') . '</th> <th>' . _('Trans') . '<br />' . _('Number') . '</th> + <th>' . _('Order') . '<br />' . _('Number') . '</th> <th>' . _('Trans') . '<br />' . _('Date') . '</th> <th>' . _('Total') . '<br />' . _('Amount') . '</th> <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> @@ -386,6 +392,7 @@ echo '<td>' . $AllocnItem->TransType . '</td> <td>' . $AllocnItem->TypeNo . '</td> + <td>' . $AllocnItem->OrderNo . '</td> <td class="number">' . $AllocnItem->TransDate . '</td> <td class="number">' . locale_money_format($AllocnItem->TransAmount,$_SESSION['Alloc']->CurrCode) . '</td> <td class="number">' . locale_money_format($YetToAlloc,$_SESSION['Alloc']->CurrCode) . '</td>'; @@ -414,14 +421,14 @@ } echo '<tr> - <td colspan="5" class="number"><b>'._('Total Allocated').':</b></td> + <td colspan="6" class="number"><b>'._('Total Allocated').':</b></td> <td class="number"><b><u>' . locale_money_format($TotalAllocated,$_SESSION['Alloc']->CurrCode) . '</u></b></td>'; $j++; echo '<td rowspan="2"> <button tabindex='.$j.' type="submit" name="RefreshAllocTotal">' . _('Recalculate Total To Allocate') . '</button></td>'; echo '<tr> - <td colspan="5" class="number"><b>'._('Left to allocate').'</b></td> + <td colspan="6" class="number"><b>'._('Left to allocate').'</b></td> <td class="number"><b>' . locale_money_format($remaining-$TotalAllocated,$_SESSION['Alloc']->CurrCode).'</b></td> </tr>'; echo '</table><br />'; @@ -444,6 +451,7 @@ debtortrans.trandate, debtortrans.reference, debtortrans.rate, + debtortrans.order_, debtortrans.ovamount+debtortrans.ovgst+debtortrans.ovdiscount+debtortrans.ovfreight as total, debtortrans.alloc FROM debtortrans, @@ -476,6 +484,7 @@ echo '<td>' . $myrow['typename'] .'</td> <td>' . $myrow['name'] . '</td> <td>' . $myrow['debtorno'] . '</td> + <td>' . $myrow['order_'] . '</td> <td>' . $myrow['transno'] . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class="number">' . locale_money_format($myrow['total'],$myrow['currcode']) . '</td> @@ -500,6 +509,7 @@ debtortrans.trandate, debtortrans.reference, debtortrans.rate, + debtortrans.order_, debtortrans.ovamount+debtortrans.ovgst+debtortrans.ovdiscount+debtortrans.ovfreight as total, debtortrans.alloc FROM debtortrans, @@ -558,6 +568,7 @@ echo '<td>' . $myrow['typename'] .'</td> <td>' . $myrow['name'] . '</td> <td>' . $myrow['debtorno'] . '</td> + <td>' . $myrow['order_'] . '</td> <td>' . $myrow['transno'] . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class="number">' . locale_money_format($myrow['total'],$myrow['currcode']) . '</td> Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/CustomerReceipt.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -155,6 +155,9 @@ if (!isset($_POST['CustomerName'])) { $_POST['CustomerName']=''; } + if (!isset($_POST['OrderNumber'])) { + $_POST['OrderNumber']=''; + } if ($_POST['GLCode'] == '' and $_GET['Type']=='GL') { prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn'); @@ -163,6 +166,7 @@ $_POST['CustomerID'], filter_currency_input($_POST['Discount']), $_POST['Narrative'], + $_POST['OrderNumber'], $_POST['GLCode'], $_POST['PayeeBankDetail'], $_POST['CustomerName'], @@ -183,7 +187,6 @@ unset($_POST['PayeeBankDetail']); } - if (isset($_POST['CommitBatch'])){ /* once all receipts items entered, process all the data in the @@ -380,6 +383,7 @@ prd, reference, tpe, + order_, rate, ovamount, ovdiscount, @@ -394,6 +398,7 @@ '" . $PeriodNo . "', '" . $_SESSION['ReceiptBatch']->ReceiptType . ' ' . $ReceiptItem->PayeeBankDetail . "', '', + '" . $ReceiptItem->OrderNo . "', '" . filter_currency_input($_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate) . "', -" . ($ReceiptItem->Amount) . ", -" . filter_currency_input($ReceiptItem->Discount) . ", @@ -530,7 +535,7 @@ '<a href="' . $rootpath . '/PDFBankingSummary.php?BatchNo=' . $_SESSION['ReceiptBatch']->BatchNo . '">' . _('Print PDF Batch Summary') . '</a></p>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/allocation.png" title="' . _('Allocate') . '" alt="" />' . ' ' . '<a href="' . $rootpath . '/CustomerAllocations.php">' . _('Allocate Receipts') . '</a></p>'; - echo '<p class="page_title_text">• ' . $rootpath . '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer ' . _('Enter Receipts') . ' </p>'; + echo '<p class="page_title_text">•<a href="' . $rootpath . '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer">' . _('Enter Receipts') . '</a></p>'; unset($_SESSION['ReceiptBatch']); include('includes/footer.inc'); exit; @@ -833,6 +838,11 @@ if (!isset($_SESSION['ReceiptBatch']->Narrative)) { $_SESSION['ReceiptBatch']->Narrative=''; } + +if (!isset($_POST['Currency'])) { + $_POST['Currency']=$_SESSION['CompanyRecord']['currencydefault']; +} + echo '<tr> <td>' . _('Narrative') . ':</td><td><input tabindex="7" type="text" name="BatchNarrative" maxlength="50" size="52" value="' . $_SESSION['ReceiptBatch']->Narrative . '" /></td> </tr> @@ -1017,6 +1027,20 @@ echo '<input tabindex="11" type="hidden" name="Discount" value="0" />'; } + $sql="SELECT orderno + FROM salesorders + WHERE debtorno='" . $_POST['CustomerID'] . "'"; + $OrderResult=DB_query($sql, $db); + + echo '<tr> + <td>' . _('Order no. (If advanced payment against order)') . '</td> + <td><select name="OrderNumber">'; + echo '<option value=""></option>'; + while ($OrderRow=DB_fetch_array($OrderResult)) { + echo '<option value="' . $OrderRow['orderno'] . '">' . $OrderRow['orderno'] . '</option>'; + } + echo '</td></tr>'; + echo '<tr><td>' . _('Payee Bank Details') . ':</td> <td><input tabindex="12" type="text" name="PayeeBankDetail" maxlength="22" size="20" value="' . $_POST['PayeeBankDetail'] . '" /></td></tr>'; // echo '<tr><td>' . _('Narrative') . ':</td> Modified: trunk/includes/DefineCustAllocsClass.php =================================================================== --- trunk/includes/DefineCustAllocsClass.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/includes/DefineCustAllocsClass.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -23,10 +23,10 @@ $this->Allocs = array(); } - function add_to_AllocsAllocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ + function add_to_AllocsAllocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $OrderNo, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ // if ($AllocAmt <= ($TransAmount - $PrevAlloc)){ - $this->Allocs[$ID] = new Allocn($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID); + $this->Allocs[$ID] = new Allocn($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $OrderNo, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID); Return 1; } @@ -48,6 +48,7 @@ Var $AllocAmt; Var $TransAmount; Var $ExRate; + Var $OrderNo; Var $DiffOnExch; /*Difference on exchange calculated on this allocation */ Var $PrevDiffOnExch; /*Difference on exchange before this allocation */ Var $PrevAlloc; /*Total of allocations vs this trans from other receipts/credits*/ @@ -57,7 +58,7 @@ THERE CAN BE ONLY ONE ... allocation record for each receipt/inovice combination */ - function Allocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ + function Allocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $OrderNo, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ /* Constructor function to add a new Allocn object with passed params */ $this->ID =$ID; @@ -68,6 +69,7 @@ $this->OrigAlloc = $AllocAmt; $this->TransAmount = $TransAmount; $this->ExRate = $ExRate; + $this->OrderNo = $OrderNo; $this->DiffOnExch=$DiffOnExch; $this->PrevDiffOnExch = $PrevDiffOnExch; $this->PrevAlloc = $PrevAlloc; Modified: trunk/includes/DefineReceiptClass.php =================================================================== --- trunk/includes/DefineReceiptClass.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/includes/DefineReceiptClass.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -26,9 +26,9 @@ $this->total=0; } - function add_to_batch($Amount, $Customer, $Discount, $Narrative, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ + function add_to_batch($Amount, $Customer, $Discount, $Narrative, $OrderNo, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ if ((isset($Customer) or isset($GLCode)) and ($Amount + $Discount) !=0){ - $this->Items[$this->ItemCounter] = new Receipt($Amount, $Customer, $Discount, $Narrative, $this->ItemCounter, $GLCode, $PayeeBankDetail, $CustomerName, $tag); + $this->Items[$this->ItemCounter] = new Receipt($Amount, $Customer, $Discount, $Narrative, $OrderNo, $this->ItemCounter, $GLCode, $PayeeBankDetail, $CustomerName, $tag); $this->ItemCounter++; $this->total = $this->total + ($Amount + $Discount) / $this->ExRate; Return 1; @@ -51,12 +51,13 @@ Var $CustomerName; Var $Discount; Var $Narrative; + Var $OrderNo; Var $GLCode; Var $PayeeBankDetail; Var $ID; var $tag; - function Receipt ($Amt, $Cust, $Disc, $Narr, $id, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ + function Receipt ($Amt, $Cust, $Disc, $Narr, $OrderNo, $id, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ /* Constructor function to add a new Receipt object with passed params */ $this->Amount =$Amt; @@ -64,6 +65,7 @@ $this->CustomerName = $CustomerName; $this->Discount = $Disc; $this->Narrative = $Narr; + $this->OrderNo = $OrderNo; $this->GLCode = $GLCode; $this->PayeeBankDetail=$PayeeBankDetail; $this->ID = $id; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-24 10:18:59
|
Revision: 9057 http://weberp.svn.sourceforge.net/weberp/?rev=9057&view=rev Author: tim_schofield Date: 2012-06-24 10:18:50 +0000 (Sun, 24 Jun 2012) Log Message: ----------- Adjust header.inc, ManualContents.php, ManualHeader.html to take ViewTopic and Bookmark parameters in displaying manual. Add ManualOutline.php file containing manual TOC, add CSS and rework all manual docs. Add $Viewtopic and $Bookmark to some functions (eg see Stocks.php) - ongoing work Modified Paths: -------------- trunk/doc/Manual/ManualARInquiries.html trunk/doc/Manual/ManualARReports.html trunk/doc/Manual/ManualARTransactions.html trunk/doc/Manual/ManualAccountsPayable.html trunk/doc/Manual/ManualAccountsReceivable.html trunk/doc/Manual/ManualContents.php trunk/doc/Manual/ManualContracts.html trunk/doc/Manual/ManualContributors.html trunk/doc/Manual/ManualCreatingNewSystem.html trunk/doc/Manual/ManualCreditStatus.html trunk/doc/Manual/ManualCurrencies.html trunk/doc/Manual/ManualDevelopmentStructure.html trunk/doc/Manual/ManualFixedAssets.html trunk/doc/Manual/ManualFooter.html trunk/doc/Manual/ManualGeneralLedger.html trunk/doc/Manual/ManualGettingStarted.html trunk/doc/Manual/ManualHeader.html trunk/doc/Manual/ManualIntroduction.html trunk/doc/Manual/ManualInventory.html trunk/doc/Manual/ManualMRP.html trunk/doc/Manual/ManualManufacturing.html trunk/doc/Manual/ManualMultilanguage.html trunk/doc/Manual/ManualNewScripts.html trunk/doc/Manual/ManualPaymentTerms.html trunk/doc/Manual/ManualPettyCash.html trunk/doc/Manual/ManualPrices.html trunk/doc/Manual/ManualPurchaseOrdering.html trunk/doc/Manual/ManualReportBuilder.html trunk/doc/Manual/ManualRequirements.html trunk/doc/Manual/ManualSalesAnalysis.html trunk/doc/Manual/ManualSalesOrders.html trunk/doc/Manual/ManualSalesPeople.html trunk/doc/Manual/ManualSalesTypes.html trunk/doc/Manual/ManualSecuritySchema.html trunk/doc/Manual/ManualShipments.html trunk/doc/Manual/ManualSpecialUtilities.html trunk/doc/Manual/ManualSystemConventions.html trunk/doc/Manual/ManualTax.html trunk/includes/header.inc Added Paths: ----------- trunk/doc/Manual/ManualAPITutorial.html trunk/doc/Manual/ManualOutline.php trunk/doc/Manual/images/AccountsPayable.jpg trunk/doc/Manual/images/BankReconciliation.jpg trunk/doc/Manual/images/GLIntegration.jpg trunk/doc/Manual/images/Purchasing.jpg trunk/doc/Manual/images/Sales.jpg trunk/doc/Manual/style/ trunk/doc/Manual/style/manual.css Added: trunk/doc/Manual/ManualAPITutorial.html =================================================================== --- trunk/doc/Manual/ManualAPITutorial.html (rev 0) +++ trunk/doc/Manual/ManualAPITutorial.html 2012-06-24 10:18:50 UTC (rev 9057) @@ -0,0 +1,92 @@ +<a id="APITutorial"><h1>Application Programming Interface</h1></a> + +<h2>webERP API - Getting Started</h2> +<p> +The API is an Application Program Interface, that is intended to expose webERP functionality to external programs. There are currently a number of low level functions it exposes to enable external applications to retrieve webERP data and to update or insert webERP data. +</p> +The API in webERP uses XML-RPC in particular the phpxmlrpc class from Useful Inc originally developed by Edd Dumbill +</p> +<p>XML-RPC is a protocl to use XML to make RPC - remote procedure calls.</p> +<p> +Simply put the XML-RPC call is XML that contains the method of the remote procedure call together with any parameters and their data types and is sent over http as a POST to the XML-RPC server - the server returns an XML payload containing the results of the call. The parameters sent to the methods can contain arrays and associative arrays of data.</p> +<p> +The clever thing about XML-RPC is that it is the simplest protocol around for doing web-services. The newer and MUCH more complex SOAP - Simple Object Access Protocol - is quite involved and complicated. webERP is founded on the KISS principle.</p> +<p> +In fact the XML-RPC "Server" in webERP is just the script http://www.yourdomain.com/webERP/api/api_xml-rpc.php</p> +<p>There is no daemon background process running continuously to field calls to the "server" it is just a script that is http posted to by the XML-RPC call sending the XML encoded method to be run together with the necessary parameters to the webERP API - the server script runs the API php functions exposed by the xml-rpc methods and returns the XML-RPC response as an XML payload. The phpxmlrpc class does the packaging converting the PHP variables and arrays to the XML required for the XML-RPC call and also has the functions to convert the XML response into something useable in PHP without having to write the XML parsing routines.</p> +<p> +It is worthwhile reading a how-to on XML-RPC with PHP which explains in more detail what is going on as a primer for the concepts.</p> +<p> +The beauty of XML-RPC is that the client calling the webERP XML-RPC server and performing native webERP functions can be called from any language (with XML-RPC bindings). I have used Vala, Genie and Python. Python particularly has been very straight forward as it has an xmlrpclib bundled with it. Of course a PHP client is also possible and is demonstrated below.</p> +<p> +The API help is actually produced by an xml-rpc call to the API using the system.listMethods method (this is a phpxmlrpc method - not a webERP API method). Aother system xml-rpc method of phpxmlrpc class is used to return the details of each method's parameters required. So the help file not only documents each of the API methods it is itself and illustration of how the API can be used!!</p> +<p> +Below is a simple example of how to use the API.</p> +<p> +<hr> +<pre> +echo "Test webERP API"; + +//the xmlrpc class can output some funny warnings so make sure notices are turned off error_reporting (E_ALL & ~E_NOTICE); + +/* you need to include the phpxmlrpc class - see link above - copy the whole directory structure of the class over to your client application from the webERP/xmlrpc directory */ + +include ("xmlrpc/lib/xmlrpc.inc"); + +//if your webERP install is on a server at http://www.yourdomain.com/webERP + +$ServerURL = "http://www.yourdomain.com/webERP/api/api_xml-rpc.php"; + +$DebugLevel = 0; //Set to 0,1, or 2 with 2 being the highest level of debug info + +$Parameters = array(); + +/* The trap for me was that each parameter needs to be run through xmlrpcval() - to create the necessary xml required for the rpc call if one of the parameters required is an array then it needs to be processing into xml for the rpc call through php_xmlrpc_encode()*/ + +$Parameters['StockID'] = xmlrpcval('DVD-TOPGUN'); //the stockid of the item we wish to know the balance for + +//assuming the demo username and password will work ! + +$Parameters['Username'] = xmlrpcval('admin'); + +$Parameters['Password'] = xmlrpcval('weberp'); + +$msg = new xmlrpcmsg("weberp.xmlrpc_GetStockBalance", $Parameters); + +$client = new xmlrpc_client($ServerURL); + +$client->setDebug($DebugLevel); + +$response = $client->send($msg); + +$answer = php_xmlrpc_decode($response->value()); + +if ($answer[0]!=0){ //then the API returned some errors need to figure out what went wrong + +//need to figure out how to return all the error descriptions associated with the codes + +} else { //all went well the returned data is in $answer[1] + +//answer will be an array of the locations and quantity on hand for DVD_TOPGUN so we need to run through the array to print out + +for ($i=0; $i < sizeof($answer[1]);$i++) { + +echo '<br> +' . $answer[1][$i]['loccode'] . ' has ' . $answer[1][$i]['quantity'] . ' on hand'; + +} + +echo ""; +</pre> +<p> +It is necessary to be logged in to see the API functions manual shows all the functions in the API with a description of the parameters required and what each function does.</p> +<p> +To create invoices in webERP you need to use the following methods:</p> +<p> +InsertOrderHeader InsertOrderLine - potentially multiple times for all the lines on the order then InvoiceSalesOrder - to invoice sales orders directly assuming the entire order is delivered - it cannot deal with controlled stock items though. However, it does process invoices in much the same way as standard webERP with updates to the stock quantities dispatched, GL entries and records required to record taxes and sales analysis records.</p> +<p> +To create a credit note just a sinlge API call is required:</p> +<p> +CreateCreditNote - to create a credit note from some base header data and an array of line items (as an associative array. In the same way as the InvoiceSalesOrder function this does all the same processing as a standard credit note from the interface in webERP.</p> +<p> +There are some example scripts on the wiki showing how a number of the API XML-RPC functions are called - these scripts should be put on a web-server outside a webERP installation - all you need to do is edit the config.inc file to give the system your webERP username and password and the URL of your webERP installation you wish to connect to. As always playing with the examples helps to figure out how it all works.</p> Property changes on: trunk/doc/Manual/ManualAPITutorial.html ___________________________________________________________________ Added: svn:executable + * Modified: trunk/doc/Manual/ManualARInquiries.html =================================================================== --- trunk/doc/Manual/ManualARInquiries.html 2012-06-23 22:46:20 UTC (rev 9056) +++ trunk/doc/Manual/ManualARInquiries.html 2012-06-24 10:18:50 UTC (rev 9057) @@ -1,40 +1,34 @@ -<br /><br /> - <!-- Help Begin: CustomerInquiry --> +<a id="ARInquiries"><h1>Accounts Receivable Inquiries</h1></a> +<h2>Customer Inquiries</h2> +<p> +Complete "drill down" inquiries are available to extract the full detail of transactions. The system maintains more data than many systems, preferring to minimise the use of consolidated or batch entries, in favour of the full detail of each transaction. The enquires can show the account history for a customer and from this inquiry it is possible to look at the details behind each transaction, from the detail of the transaction it is possible to look at the line items on the original invoice and which receipts paid the invoice. The original invoice or credit can be viewed directly from customer inquiries and the general ledger transactions that were created by the invoice, credit or receipt may also be inspected.</p> -<a name="ARInquiries"><font size="+3"><b>Accounts Receivable Inquiries</b></font></a> -<br /><br /> -<font size="+2"><b>Customer Inquiries</b></font> -<br /><br /> -Complete "drill down" inquiries are available to extract the full detail of transactions. The system maintains more data than many systems, preferring to minimise the use of consolidated or batch entries, in favour of the full detail of each transaction. The enquires can show the account history for a customer and from this inquiry it is possible to look at the details behind each transaction, from the detail of the transaction it is possible to look at the line items on the original invoice and which receipts paid the invoice. The original invoice or credit can be viewed directly from customer inquiries and the general ledger transactions that were created by the invoice, credit or receipt may also be inspected. -<br /><br /> -<font size="+1"><b>Customer Account inquiries</b></font> -<br /><br /> -From any page, click the "select customer" link. Having selected the customer all links applicable to the customer show. Among them the customer transactions inquiry. -<br /><br /> -By default the inquiry screen shows only those transactions after a date six months ago. The default period can be modified by simple editing of the script CustomerInquiry.php. If transactions further back are required only occasionally and not by default - the date after which all transactions will show can be altered at will. When the screen opens the customer's account is shown in the currency of the customer. The aged analysis based on the customer's terms is displayed. -<br /><br /> -If the transaction is an invoice or a credit note a magnifying glass icon shows on the same line as the transaction. A click on this magnifying glass then opens a new window showing the detail of the invoice or credit note. -<br /><br /> -If the integration to the general ledger from accounts receivable - see the option to "Create GL entries for accounts receivable transactions" from the Company Preferences page under setup - then another link with the letters GL will show. This link shows a new page with the detail of the general ledger postings created by this transaction. -<br /><br /> -If the transaction is a receipt or a credit note and the user has appropriate access privileges, a book icon shows. Clicking this icon takes the user to the page for allocating receipts and credits - if the receipt or credit is already allocated then the detail of how the receipt/credit was allocated is shown together with other invoices that could be used for allocating against. Invoices that have previously been allocated will not show. -<br /><br /> -More (or less) history can be shown by changing the "Show all transactions after: -<br /><br /> -" date - then clicking the refresh button. The balance on the customer's account should balance to the sum of the amounts outstanding. The amount outstanding is used to represent: -<br /><br /> +<h2>Customer Account inquiries</h2> + +<p>From any page, click the "select customer" link. Having selected the customer all links applicable to the customer show. Among them the customer transactions inquiry.</p> + +<p>By default the inquiry screen shows only those transactions after a date six months ago. The default period can be modified by simple editing of the script CustomerInquiry.php. If transactions further back are required only occasionally and not by default - the date after which all transactions will show can be altered at will. When the screen opens the customer's account is shown in the currency of the customer. The aged analysis based on the customer's terms is displayed.</p> + +<p>If the transaction is an invoice or a credit note a magnifying glass icon shows on the same line as the transaction. A click on this magnifying glass then opens a new window showing the detail of the invoice or credit note.</p> + +<p>If the integration to the general ledger from accounts receivable - see the option to "Create GL entries for accounts receivable transactions" from the Company Preferences page under setup - then another link with the letters GL will show. This link shows a new page with the detail of the general ledger postings created by this transaction.</p> + +<p>If the transaction is a receipt or a credit note and the user has appropriate access privileges, a book icon shows. Clicking this icon takes the user to the page for allocating receipts and credits - if the receipt or credit is already allocated then the detail of how the receipt/credit was allocated is shown together with other invoices that could be used for allocating against. Invoices that have previously been allocated will not show.</p> + +<p>More (or less) history can be shown by changing the "Show all transactions after:</p> + +<p>" date - then clicking the refresh button. The balance on the customer's account should balance to the sum of the amounts outstanding. The amount outstanding is used to represent:</p> + <ul> -<li>For Invoices, the amount which has not yet been settled by receipts or credit notes -<li>For Receipts, the amount which has yet to be allocated (or matched off) against invoices. + <li>For Invoices, the amount which has not yet been settled by receipts or credit notes</li> + <li>For Receipts, the amount which has yet to be allocated (or matched off) against invoices.</li> </ul> -<font size="+1"><b>Transaction Detail inquiries</b></font> -<br /><br /> -The detail of transactions can be inspected via one of two avenues: -<br /><br /> +<h3>Transaction Detail inquiries</h3> +The detail of transactions can be inspected via one of two avenues:</p> + <ul> -<li>From the Customer's Account inquiry - click on the magnifying glass or the GL link against the transaction required. -<li>From the Transaction Enquires - from the Accounts Receivable tab, click on the magnifying glass to see the actual invoice or credit note. -</ul> + <li>From the Customer's Account inquiry - click on the magnifying glass or the GL link against the transaction required.</li> -<!-- Help End: CustomerInquiry --> + <li>From the Transaction Enquires - from the Accounts Receivable tab, click on the magnifying glass to see the actual invoice or credit note.</li> +</ul><!-- Help End: CustomerInquiry --> Modified: trunk/doc/Manual/ManualARReports.html =================================================================== --- trunk/doc/Manual/ManualARReports.html 2012-06-23 22:46:20 UTC (rev 9056) +++ trunk/doc/Manual/ManualARReports.html 2012-06-24 10:18:50 UTC (rev 9057) @@ -1,71 +1,50 @@ -<br /><br /> -<a name="ARReports"><font size="+3"><b>Accounts Receivable Reports</b></font></a> -<br /><br /> -The system is designed for flexibility and to provide the framework of core functionality required to administer a debtors ledger system. The basic accounts receivable reports are available as standard since they are used by all businesses. However, since the database is open it is envisaged that the business will make use of ODBC drivers for database used and use Crystal Reports or Microsoft Access or some other analysis software, where the user is on the same LAN as the server for specialised reports. -<br /><br /> +<a id="ARReports"><h1>Accounts Receivable Reports</h1></a> +The system is designed for flexibility and to provide the framework of core functionality required to administer a debtors ledger system. The basic accounts receivable reports are available as standard since they are used by all businesses. However, since the database is open it is envisaged that the business will make use of ODBC drivers for database used and use Crystal Reports or Microsoft Access or some other analysis software, where the user is on the same LAN as the server for specialised reports.</p> + <!-- Help Begin: AgedDebtors --> +<h2>Aged Customer Balance Listing</h2> +<p> +From the main menu select Customers, Reports, "Aged Customer Balances/Overdues Report".</p> +<p> +This report calculates the balances of the customers' accounts according to the parameters specified in config.php $PastDueDays1 and $PastDueDays2. The report is generated in the currency of the customer. The currency of the report must first be selected and the range of customers accounts to print.</p> +<p> +The report can be printed at two levels:</p> -<font size="+1"><b>Aged Customer Balance Listing</b></font> -<br /><br /> -From the main menu select Customers, Reports, "Aged Customer Balances/Overdues Report". -<br /><br /> -This report calculates the balances of the customers' accounts according to the parameters specified in config.php $PastDueDays1 and $PastDueDays2. The report is generated in the currency of the customer. The currency of the report must first be selected and the range of customers accounts to print. -<br /><br /> -The report can be printed at two levels: -<br /><br /> <ul> -<li>The full detail of the all outstanding amounts on the account, transaction by transaction analysed into current, Due, $PastDueDays1 and PastDueDays2. The detailed report also shows the terms applicable to each customer. -<li>A summary of the account balances split in the same aged groupings. -</ul> -This report recalculates the balance on the customer's account from the outstanding transactions and analyses each outstanding transaction based on the date of invoice plus the expected time to deliver to the branch invoiced. -<br /><br /> -The Aged Customer Balances can also be restricted to show just the accounts where there is some balance overdue. The same detail and summary reports are available. The resultant reports create pdf files that can be either saved or printed. + <li>The full detail of the all outstanding amounts on the account, transaction by transaction analysed into current, Due, $PastDueDays1 and PastDueDays2. The detailed report also shows the terms applicable to each customer.</li> -<!-- Help End: AgedDebtors --> + <li>A summary of the account balances split in the same aged groupings.</li> +</ul>This report recalculates the balance on the customer's account from the outstanding transactions and analyses each outstanding transaction based on the date of invoice plus the expected time to deliver to the branch invoiced.</p> +<p> +The Aged Customer Balances can also be restricted to show just the accounts where there is some balance overdue. The same detail and summary reports are available. The resultant reports create pdf files that can be either saved or printed. <!-- Help End: AgedDebtors --> -<br /><br /> - <!-- Help Begin: PrintCustStatements --> +<h2>Customer Statements</h2> +<p> +The customer statement shows the outstanding transactions on the account. There is an option in config.php that allows transactions that have been settled at some time within the last month to be shown in a settled transactions section of the statement. The parameter, $Show_Settled_LastMonth should be set equal to 1 for this. If it is set to 0, then any settled transactions will not be shown on the statements. This saves printing zero balance statements and there is argument both ways as to which is best.</p> +<p> +When transactions are created, the date of the transaction determines the period into which it is posted in the general ledger. The date of the transaction is also used in the aging calculations used on the statement. All transactions to the date of the statement are included. It is not possible to print a statement as at some prior date. It may be necessary to delay the start of invoicing for the new month until all receipts are entered and allocated and the statements printed before processing new invoices that should appear on the following month's statement.</p> +<p> +Procedure - All receipts must be allocated for the aged analysis to be calculated correctly. Then from the main menu Accounts Receivable tab select from the reports and inquiries section, "Print Statements". The link will allow selection of a range of customers. A single customer's statement can be printed by selecting the same starting an finishing customer code. Statements will be printed in sequence of the Customer code set up in the customer details screen. A pdf file is created this can be saved or printed. <!-- Help End: PrintCustStatements --> -<font size="+1"><b>Customer Statements</b></font> -<br /><br /> -The customer statement shows the outstanding transactions on the account. There is an option in config.php that allows transactions that have been settled at some time within the last month to be shown in a settled transactions section of the statement. The parameter, $Show_Settled_LastMonth should be set equal to 1 for this. If it is set to 0, then any settled transactions will not be shown on the statements. This saves printing zero balance statements and there is argument both ways as to which is best. -<br /><br /> -When transactions are created, the date of the transaction determines the period into which it is posted in the general ledger. The date of the transaction is also used in the aging calculations used on the statement. All transactions to the date of the statement are included. It is not possible to print a statement as at some prior date. It may be necessary to delay the start of invoicing for the new month until all receipts are entered and allocated and the statements printed before processing new invoices that should appear on the following month's statement. -<br /><br /> -Procedure - All receipts must be allocated for the aged analysis to be calculated correctly. Then from the main menu Accounts Receivable tab select from the reports and inquiries section, "Print Statements". The link will allow selection of a range of customers. A single customer's statement can be printed by selecting the same starting an finishing customer code. Statements will be printed in sequence of the Customer code set up in the customer details screen. A pdf file is created this can be saved or printed. - -<!-- Help End: PrintCustStatements --> - -<br /><br /> - <!-- Help Begin: CustomerTransInquiry --> +<h2>Customer Transaction Listing Options</h2> +<p> +This is accessed from the main menu, accounts receivable tab under the link "Transaction Inquiries".</p> +<p> +This inquiry allows transactions to be listed based on the selection of criteria on screen. The page allows listing of receipts, invoices or credit notes within any specified date range.</p> +<p> +This listing is shown on the screen and can of course be printed from the browser if necessary. <!-- Help End: CustomerTransInquiry --> + <!-- Help Begin: PrintCustTrans --> -<font size="+1"><b>Customer Transaction Listing Options</b></font> -<br /><br /> -This is accessed from the main menu, accounts receivable tab under the link "Transaction Inquiries". -<br /><br /> -This inquiry allows transactions to be listed based on the selection of criteria on screen. The page allows listing of receipts, invoices or credit notes within any specified date range. -<br /><br /> -This listing is shown on the screen and can of course be printed from the browser if necessary. - -<!-- Help End: CustomerTransInquiry --> - -<!-- Help Begin: PrintCustTrans --> - -<br /><br /> -<font size="+1"><b>Printing Invoices Or Credit Notes</b></font> -<br /><br /> -From the Main Menu select the Accounts Receivable tab, under Inquiries and Reports, "Print Invoices or Credit Notes". -<br /><br /> -This page shows the last invoice and credit note created and some brief instructions on how to use the page. By default the page assumes that invoices are required. However, if credit notes are required, they can be selected from the list field. -<br /><br /> -If only one transaction is required then the number of the transaction should be entered in the field "Start invoice/credit note number to print". If a range of transactions is required then both fields are necessary to be completed. -<br /><br /> -There is also an option to print EDI invoices/credit notes. By default these are not printed as they will normally be dispatched electronically to the customer. However, some businesses and tax authorities require hard copy invoices and credit notes to be produced in any event. -<br /><br /> -Two options are available - Print, produces a html page of the invoice (or credit note), the resulting page can then be printed using the browser print functionality. The print PDF produces a PDF invoice (or credit note). - -<!-- Help End: PrintCustTrans --> - +<h2>Printing Invoices Or Credit Notes</h2> +<p> +From the Main Menu select the Accounts Receivable tab, under Inquiries and Reports, "Print Invoices or Credit Notes".</p> +<p> +This page shows the last invoice and credit note created and some brief instructions on how to use the page. By default the page assumes that invoices are required. However, if credit notes are required, they can be selected from the list field.</p> +<p>If only one transaction is required then the number of the transaction should be entered in the field "Start invoice/credit note number to print". If a range of transactions is required then both fields are necessary to be completed.</p> +<p> +There is also an option to print EDI invoices/credit notes. By default these are not printed as they will normally be dispatched electronically to the customer. However, some businesses and tax authorities require hard copy invoices and credit notes to be produced in any event.</p> +<p> +Two options are available - Print, produces a html page of the invoice (or credit note), the resulting page can then be printed using the browser print functionality. The print PDF produces a PDF invoice (or credit note). <!-- Help End: PrintCustTrans --> Modified: trunk/doc/Manual/ManualARTransactions.html =================================================================== --- trunk/doc/Manual/ManualARTransactions.html 2012-06-23 22:46:20 UTC (rev 9056) +++ trunk/doc/Manual/ManualARTransactions.html 2012-06-24 10:18:50 UTC (rev 9057) @@ -1,190 +1,209 @@ -<br /><br /> +<h1><a id="ARTransactions">Accounts Receivable Transactions</a></h1> -<!-- Help Begin: SelectSalesOrder --> +<h2>Invoicing An Order</h2> -<a name="ARTransactions"><font size="+3"><b>Accounts Receivable Transactions</b></font></a> -<br /><br /> -<font size="+2"><b>Invoicing An Order</b></font> -<br /><br /> -<font size="+1"><b>Selecting an Order To Invoice</b></font> -<br /><br /> -All invoices require a sales order to be entered first. -<br /><br /> -From the main menu select the orders tab. Select Outstanding Sales Orders Maintenance. This page shows all the orders outstanding. If the order number is known it can be entered on this screen to select the order to invoice. Hit search orders and the order should show below, together with links to modify the order, print the packing slip and to invoice. Click the link to invoice the order. -<br /><br /> -<font size="+1"><b>Producing An Invoice From A Selected Order</b></font> -<br /><br /> -Having selected an order to invoice the order line comes up for confirming the quantities of the order that were dispatched. If the quantity dispatched differs from the order the difference is recorded in the table OrderDeliveryDifferencesLog - and a report is available to show the orders that were not able to be delivered with the first dispatch. There is also opportunity to enter the freight charge and if necessary enter the tax charge - which will normally be calculated automatically based on the tax authority of the customer branch being invoiced. The date of the invoice is defaulted based on the time of day and the settings in config.php. If the hour (in 24 hour format) is after the setting of $DispatchCutOffTime in config.php, then the following day is deemed to be the invoice date, alternatively the invoice date will default to today. Where not all lines on the order are being invoiced there are two choices with how to deal with the balance. -<br /><br /> +<h3>Selecting an Order To Invoice</h3> + +<p>All invoices require a sales order to be entered first.</p> + +<p>From the main menu select the orders tab. Select Outstanding Sales Orders Maintenance. This page shows all the orders outstanding. If the order number is known it can be entered on this screen to select the order to invoice. Hit search orders and the order should show below, together with links to modify the order, print the packing slip and to invoice. Click the link to invoice the order.</p> + +<h3>Producing An Invoice From A Selected Order</h3> + +<p>Having selected an order to invoice the order line comes up for confirming the quantities of the order that were dispatched. If the quantity dispatched differs from the order the difference is recorded in the table OrderDeliveryDifferencesLog - and a report is available to show the orders that were not able to be delivered with the first dispatch. There is also opportunity to enter the freight charge and if necessary enter the tax charge - which will normally be calculated automatically based on the tax authority of the customer branch being invoiced. The date of the invoice is defaulted based on the time of day and the settings in config.php. If the hour (in 24 hour format) is after the setting of $DispatchCutOffTime in config.php, then the following day is deemed to be the invoice date, alternatively the invoice date will default to today. Where not all lines on the order are being invoiced there are two choices with how to deal with the balance.</p> + <ul> -<li>Put the balance on back order -<li>Cancel the line on the order -</ul> -Finally there is also a field for entry of any text on the invoice. Hitting the process invoice button updates the order as instructed and produces all the entries including general ledger postings (if integration is enabled in the company preferences screen - see setup) to record the invoice. Until the process invoice button is hit, no entries have been saved to the database and it is safe to leave the page at any stage without having changed anything - the invoicing process can be cancelled at any time simply by following a link to another page. The processing that takes place once the Process Invoice button is hit includes: -<br /><br /> + <li>Put the balance on back order</li> + + <li>Cancel the line on the order</li> +</ul>Finally there is also a field for entry of any text on the invoice. Hitting the process invoice button updates the order as instructed and produces all the entries including general ledger postings (if integration is enabled in the company preferences screen - see setup) to record the invoice. Until the process invoice button is hit, no entries have been saved to the database and it is safe to leave the page at any stage without having changed anything - the invoicing process can be cancelled at any time simply by following a link to another page. The processing that takes place once the Process Invoice button is hit includes: +<p> + <ul> -<li>Creation of the stock movements for each line item on the order - or for the assemblies components - from the location entered at the time of the order, at the price as per the order. -<li>Creation of the DebtorTrans record that records the invoice against the customer's account. -<li>Creation of the general ledger jorunals to record the sale and debtor etc. -<li>Updating the order for amounts dispatched, and the invoice number. -<li>Creating/updating the sales analysis records of the items being sold. -<li>Updating the stock quantities for all lines of the invoice and the components of all assemblies included on the order. + <li>Creation of the stock movements for each line item on the order - or for the assemblies components - from the location entered at the time of the order, at the price as per the order.</li> + + <li>Creation of the DebtorTrans record that records the invoice against the customer's account.</li> + + <li>Creation of the general ledger jorunals to record the sale and debtor etc.</li> + + <li>Updating the order for amounts dispatched, and the invoice number.</li> + + <li>Creating/updating the sales analysis records of the items being sold.</li> + + <li>Updating the stock quantities for all lines of the invoice and the components of all assemblies included on the order.</li> </ul> -If the order is not to be invoiced to the customer or branch specified in the order, or pricing is to be changed then the order must be changed. These elements cannot be altered at the time of invoice, they must be altered in the order before it is confirmed for invoicing. Once an invoice is created it cannot be deleted or modified. The order is also updated with the invoice number that it was dispatched on. -<!-- Help End: SelectSalesOrder --> +<p>If the order is not to be invoiced to the customer or branch specified in the order, or pricing is to be changed then the order must be changed. These elements cannot be altered at the time of invoice, they must be altered in the order before it is confirmed for invoicing. Once an invoice is created it cannot be deleted or modified. The order is also updated with the invoice number that it was dispatched on.</p><!-- Help End: SelectSalesOrder --> -<br /><br /> +<div class="floatright"> + <a class="minitext" href="#top">⬆ Top</a> +</div><!-- Help Begin: SelectCreditItems --> -<!-- Help Begin: SelectCreditItems --> +<h2>Credit Notes</h2> -<font size="+2"><b>Credit Notes</b></font> -<br /><br /> -Credit notes can be created in one of two ways: -<br /><br /> +<p>Credit notes can be created in one of two ways:</p> + <ul> -<li>From a customer inquiry screen if the user has the necessary permissions ( $PageSecurity=3 - see Security Schema) a link shows to allow an entire invoice to be credited. Having clicked this link there is opportunity to de-select some items from being credited so that only the part of the invoice that needs to be credited can be, with only minimal keying. The same credit note creation page as used in manual creation of credit notes will appear but with all the items from the orignal invoice already entered into the credit note. -<li>Using the link on the main menu under the receivables tab, select the link to create a credit note. + <li>From a customer inquiry screen if the user has the necessary permissions ( $PageSecurity=3 - see Security Schema) a link shows to allow an entire invoice to be credited. Having clicked this link there is opportunity to de-select some items from being credited so that only the part of the invoice that needs to be credited can be, with only minimal keying. The same credit note creation page as used in manual creation of credit notes will appear but with all the items from the orignal invoice already entered into the credit note.</li> + + <li>Using the link on the main menu under the receivables tab, select the link to create a credit note.</li> </ul> -<b>Important Note:</b> -<br /><br /> -It is important to use credit notes to correct incorrect invoices correctly. Crediting a small price against a part implies that the goods were returned and the customer only credited a fraction of their worth. This is not the correct way to credit an overcharge. By default credit notes return the stock to the location specified, so the stock records will be overstated by the goods returned to stock by the credit note. To correct a pricing error a credit note for the invoice line at the incorrect charge must be done and a new invoice at the correct charge must be made up. This ensures that sales analysis records are not corrupted for the quantities sold and that stock records are maintained correctly. A special pricing adjustment type of credit note is available that does not have any cost implications for the sales analysis and has no stock physical movement record associated with it. -<br /><br /> -The process for creating a credit note manually is: -<br /><br /> + +<h4>Important Note:</h4> + +<p>It is important to use credit notes to correct incorrect invoices correctly. Crediting a small price against a part implies that the goods were returned and the customer only credited a fraction of their worth. This is not the correct way to credit an overcharge. By default credit notes return the stock to the location specified, so the stock records will be overstated by the goods returned to stock by the credit note. To correct a pricing error a credit note for the invoice line at the incorrect charge must be done and a new invoice at the correct charge must be made up. This ensures that sales analysis records are not corrupted for the quantities sold and that stock records are maintained correctly. A special pricing adjustment type of credit note is available that does not have any cost implications for the sales analysis and has no stock physical movement record associated with it.</p> + +<p>The process for creating a credit note manually is:</p> + <ul> -<li>Select the customer to be credited, there are the usual selection options (a box to enter an extract of the customer's name and a box to enter an extract of the customer's code) -<li>Select the items to be credited and the prices to be used in crediting the customer - the same quick entry option is available as is used in order entry. - where the part code and quantity to be credited is entered directly. Pricing is automatically determined by reference to the customer's sales type, currency with regard to any special pricing for the customer (and branch) being credited. If the search for a part functions are used, then after each part is selected the quantity can be updated after the item is selected. -<li>Having selected all the items it is possible to edit the items to be credited by clicking the button of the code of the item on the summary, then editing the price and quantity. -<li>Amounts to be credited for freight can be entered directly (this would be entered directly from the original invoice if the credit an invoice option was used from the customer inquiry screen). -<li>The tax amount to credit is calculated automatically by default based on the tax authority of the branch being credited and the total of the line items and freight to be credited. It is also possible to select the manual option. Once having selected manual, the user should hit update to allow free entry of any amount in the tax field. -<li>By default it is assumed that the goods in the credit note are being returned to stock. The location to where the goods are being returned must be selected from the selection box. -<li>If the goods are not being returned to stock, they are to be written off perhaps as samples or showroom display, damaged goods or whatever, the credit note type option should be changed to goods written off. After changing the credit note type and hitting the update button, a new select box will allow a general ledger code to be selected (assuming the general ledger interface to accounts receivable is active - it will not show if there is no integration). The appropriate general ledger code should be selected from this box. The location to return the stock to select box will disappear since it is no longer relevant. A third option is to credit a pricing adjustment - this type does not create any stock movements and the sales analysis updates only affect the value no cost of sales updates take place. -<li>Any text describing the reasons for the credit note should be entered in the narrative box provided. -<li>After completing all the inputs required, hit the Process Credit Note button to create the credit note. The created credit note number will be reported confirming that it has been processed. -</ul> + <li>Select the customer to be credited, there are the usual selection options (a box to enter an extract of the customer's name and a box to enter an extract of the customer's code)</li> -<!-- Help End: SelectCreditItems --> + <li>Select the items to be credited and the prices to be used in crediting the customer - the same quick entry option is available as is used in order entry. - where the part code and quantity to be credited is entered directly. Pricing is automatically determined by reference to the customer's sales type, currency with regard to any special pricing for the customer (and branch) being credited. If the search for a part functions are used, then after each part is selected the quantity can be updated after the item is selected.</li> + <li>Having selected all the items it is possible to edit the items to be credited by clicking the button of the code of the item on the summary, then editing the price and quantity.</li> + + <li>Amounts to be credited for freight can be entered directly (this would be entered directly from the original invoice if the credit an invoice option was used from the customer inquiry screen).</li> + + <li>The tax amount to credit is calculated automatically by default based on the tax authority of the branch being credited and the total of the line items and freight to be credited. It is also possible to select the manual option. Once having selected manual, the user should hit update to allow free entry of any amount in the tax field.</li> + + <li>By default it is assumed that the goods in the credit note are being returned to stock. The location to where the goods are being returned must be selected from the selection box.</li> + + <li>If the goods are not being returned to stock, they are to be written off perhaps as samples or showroom display, damaged goods or whatever, the credit note type option should be changed to goods written off. After changing the credit note type and hitting the update button, a new select box will allow a general ledger code to be selected (assuming the general ledger interface to accounts receivable is active - it will not show if there is no integration). The appropriate general ledger code should be selected from this box. The location to return the stock to select box will disappear since it is no longer relevant. A third option is to credit a pricing adjustment - this type does not create any stock movements and the sales analysis updates only affect the value no cost of sales updates take place.</li> + + <li>Any text describing the reasons for the credit note should be entered in the narrative box provided.</li> + + <li>After completing all the inputs required, hit the Process Credit Note button to create the credit note. The created credit note number will be reported confirming that it has been processed.</li> +</ul><!-- Help End: SelectCreditItems --> <!-- Help Begin: CustomerReceipt --> -<font size="+2"><b>Entry Of Receipts</b></font> -<br /><br /> -This system tracks the invoices and credits which are outstanding (a so called open item system) in contrast to systems which use a balance brought forward from the previous month to add and subtract current month transactions. Experience has shown balance forward systems whilst intuitive, often result in queries for more information with the inevitable question from customers "what was this balance made up of ?" . The statements produced by this system show a full reconciliation of the amounts outstanding against invoices and credits that are yet to be settled totalling the amount of the customer's account. In order to provide the necessary information to track outstanding amounts, invoice by invoice, the detail of the make up of payments must be entered. -<br /><br /> -Payments received from customers are therefore entered in a two-stage process: -<br /><br /> +<div class="floatright"> + <a class="minitext" href="#top">⬆ Top</a> +</div> + +<h2>Entry Of Receipts</h2> + +<p>This system tracks the invoices and credits which are outstanding (a so called open item system) in contrast to systems which use a balance brought forward from the previous month to add and subtract current month transactions. Experience has shown balance forward systems whilst intuitive, often result in queries for more information with the inevitable question from customers "what was this balance made up of ?" . The statements produced by this system show a full reconciliation of the amounts outstanding against invoices and credits that are yet to be settled totalling the amount of the customer's account. In order to provide the necessary information to track outstanding amounts, invoice by invoice, the detail of the make up of payments must be entered.</p> + +<p>Payments received from customers are therefore entered in a two-stage process:</p> + <ul> -<li>The amount of the payment received is entered in foreign currency together with the exchange rate at which this has been banked into local currency. Any details pertinent to the receipt such as the date, method of payment and any details (which can be recalled from inquiries later) are entered at this stage. -<li>The foreign currency received is allocated to the invoices (and debit journals) on the customer's account. Put another way, the invoices that the payment is meant to be settling are matched off against the payment. -</ul> -If the details of the make up of a payment received are not available at the time of banking, the receipt can still be entered to stage 1. However, the allocation must be done before the statement is produced if the account is to make sense. -<br /><br /> -Note: Differences on exchange are only calculated once the receipt is matched against the invoices it is paying. -<br /><br /> -Receipts relating to general ledger transactions can also be entered in the same batch as customer receipts. -<br /><br /> -The process of entering receipts is initiated from the main menu under the receivables tab - another link is also available from the general ledger tab. -<br /><br /> -Firstly, the receipt header information is required, the bank account - one of the previously defined bank accounts (see setup), the date the batch of receipts are banked, the currency and exchange rate of the banking and the type of receipt together with any narrative. The currency can be selected from the defined currencies (see setup). The receipt types can also be selected - they are defined in config.php. Once this information is entered it must be accepted before the receipts in the batch can be entered. -<br /><br /> -<font size="+1"><b>Receipt - Customer</b></font> -<br /><br /> -By default once the a customer has been selected the following information is displayed: -<br /><br /> + <li>The amount of the payment received is entered in foreign currency together with the exchange rate at which this has been banked into local currency. Any details pertinent to the receipt such as the date, method of payment and any details (which can be recalled from inquiries later) are entered at this stage.</li> + + <li>The foreign currency received is allocated to the invoices (and debit journals) on the customer's account. Put another way, the invoices that the payment is meant to be settling are matched off against the payment.</li> +</ul>If the details of the make up of a payment received are not available at the time of banking, the receipt can still be entered to stage 1. However, the allocation must be done before the statement is produced if the account is to make sense. +<p> + +<p>Note: Differences on exchange are only calculated once the receipt is matched against the invoices it is paying.</p> + +<p>Receipts relating to general ledger transactions can also be entered in the same batch as customer receipts.</p> + +<p>The process of entering receipts is initiated from the main menu under the receivables tab - another link is also available from the general ledger tab.</p> + +<p>Firstly, the receipt header information is required, the bank account - one of the previously defined bank accounts (see setup), the date the batch of receipts are banked, the currency and exchange rate of the banking and the type of receipt together with any narrative. The currency can be selected from the defined currencies (see setup). The receipt types can also be selected - they are defined in config.php. Once this information is entered it must be accepted before the receipts in the batch can be entered.</p> + +<h3>Receipt - Customer</h3> + +<p>By default once the a customer has been selected the following information is displayed:</p> + <ul> -<li>The payment terms applicable, so amounts overdue can be easily noted from the allocation screen without having to go back and do an inquiry. -<li>The payment discount percentage applicable. The user can then use this rate if applicable to calculate the discount applicable, depending on how much of the payment relates to "on time" invoices. -<li>The currency that the currency is paying in. + <li>The payment terms applicable, so amounts overdue can be easily noted from the allocation screen without having to go back and do an inquiry.</li> + + <li>The payment discount percentage applicable. The user can then use this rate if applicable to calculate the discount applicable, depending on how much of the payment relates to "on time" invoices.</li> + + <li>The currency that the currency is paying in.</li> </ul> -<font size="+1"><b>Receipt - Date</b></font> -<br /><br /> -The date that the receipt was received and banked. If a receipt is being entered retrospectively - or several days bankings are being done together, the default date (i.e. the current date) should be over written with the date the receipt was originally received. This date is used on the statement and the customer may not be able to tie up the receipt if an incorrect date is entered. -<br /><br /> -Customer account inquiries are shown in date order so the account will not show correctly if the date entered is not the date the money was received. The date is also used in the general ledger transaction created. -<br /><br /> -<font size="+1"><b>Receipts - Currency and Exchange Rate</b></font> -<br /><br /> -Selection of the customer automatically tells the system which currency to expect the receipt in. The customer's account is maintained in the currency selected in the customer maintenance screen. -<br /><br /> -The correct rate at which the bank has converted the foreign currency to local currency must be input, the system shows the calculation of the local currency banked at the bottom of the screen. The receipt cannot (therefore) be entered until the amount in local currency is known. The exact rate to enter in this field will be the foreign currency figure divided by the local currency figure. -<br /><br /> -Eg banked 1212 local, in customer's currency this was 400. -<br /><br /> -Rate is 400/1212 = 0.330033 -<br /><br /> -The local currency calculated by the system should confirm that the rate entered is correct. The general ledger integration - if enabled - will produce a bank deposit for the local currency amount shown at the bottom of the screen, and reduce (credit) the Debtors Control account by the same amount. The system defaults the exchange rate to that set up against the currency in the currencies table. -<br /><br /> -When the receipt is matched to invoices, any differences between the local currency amounts banked against the local currency invoiced are recorded against the invoices and written off the general ledger Debtors Control Account and written into the profit and loss account - (specified in the company record of the customer concerned) if the general ledger integration is enabled from the module options screen. -<br /><br /> -<font size="+1"><b>Receipts - Payment Method</b></font> -<br /><br /> -The payment method is stored against the receipt and shows on the customer's statement. A banking report can also be run off based on the payment method to summarise the day's bankings, to automate the task of collating the different vouchers and summarising for the bank. -<br /><br /> -<font size="+1"><b>Receipts - Amount</b></font> -<br /><br /> -The amount of the receipt in foreign currency is entered here. This cannot be 0. Although, negative receipts are allowed (to reverse incorrect receipts). -<br /><br /> -Note: Care should be taken when allocating negative receipts to ensure that only previous allocations are reversed, strange results could occur if allocations are made to invoices not previously allocated to positive receipts - although system integrity will be maintained. -<br /><br /> -<font size="+1"><b>Receipts - Discount</b></font> -<br /><br /> -The amount of discount on a receipt can be entered at this point and allocated together with the receipt as one amount. This is useful, where a customer pays an amount net of discount - quite correctly according to his terms and conditions, and the amount naturally will not tie up to invoices on its own without the addition of the discount. The system calculates the gross amount of the payment including discount to set off the customer's account. -<br /><br /> -<font size="+1"><b>Receipts - Allocating to Invoices</b></font> -<br /><br /> -Once all the details necessary have been entered for the receipt - the customer, the exchange rate and the amount in foreign currency, the receipt is ready to be allocated to the invoices which is to settle. -<br /><br /> -This concept can seem strange to businesses that have previously operated customer accounts where they are only interested in the current months' transactions and the balance brought forward from last month. The aim of this system is to remove the question from the customer's lips ... "What is that figure, balance brought forward made up of?". Under the "Balance Forward" system this question can be a tough one to answer, since there is no record of which invoices were paid by which payment. However, this system needs explicit instructions for each receipt on which transactions should be settled as a result. -<br /><br /> -From the menu under the Accounts Receivable tab - Click on the link to Allocate Receipts or Credits. -<br /><br /> -This page shows all outstanding receipts and credits that are yet to be allocated. Clicking on the links against these receipts and credits takes the user to the outstanding transactions on the customers account that are available for allocation. This screen shows all unallocated transactions but only invoices are available to allocate the receipt or credit note to. -<br /><br /> -Note that allocations of a receipt are not allowed to another receipt. If necessary, negative receipts can be used to reverse allocation against invoices and debit journals (although this is undesirable). Once entered, receipts cannot be deleted - (obviously this would be undesirable from the standpoint of proper internal controls). -<br /><br /> -If the whole of the receipt is not matched off against (allocated to) invoices and debit journals the system will prompt to ensure that this is what was intended. Unlike many systems, allocations can always be completed or amended later. -<br /><br /> -<font size="+1"><b>Differences on Exchange</b></font> -<br /><br /> -The process of allocating receipts to invoices gives the system the information necessary to calculate the difference on exchange since the receipt converted at the rate specified in the receipt screen will equate to a different amount to the local currency equivalent of the invoices it is matched to, unless both the receipt and the invoices it is allocated to are converted at the same rate. -<br /><br /> -The difference calculated at the time of allocation can be seen on the receipt screen once the allocations are done and the screen closed and is itemised against the invoices to which it is allocated against. Unlike many systems the difference on exchange can be fully itemised transaction by transaction. Inquiries on the detail of receipts show the difference on exchange that the receipt is responsible for. Further the inquiry on where the receipt was allocated to will show the analysis of where the difference on exchange for the receipt under review came from. -<br /><br /> -Alterations to the allocations naturally alter the difference on exchange. The general ledger interface produces a journal for only the movement of the difference on exchange for a given receipt each time its allocations are altered. -<br /><br /> -<font size="+1"><b>Receipts Processing</b></font> -<br /><br /> -Many customer receipts can be entered at a time and mixed together with receipts for nominal items i.e. receipts from vending machine or sales of fixed assets reimbursement for private use of company assets etc. Once all receipts have been entered the processing can take place. The system only stores the data entered in a server side cookie called a session until such time as the Process button is clicked. -<br /><br /> -The processing will give the batch of receipts a number and insert new receipt transactions against customer accounts and update the customer's record with the amount of and the date of the last payment. In addition if the general ledger interface is enabled, the journals to put the receipt into the bank account specified and to decrease the Debtors control account - specified in the company record are created. General Ledger journals are also created for the discount - if any, with the corresponding entry to the Debtors Control account. All the necessary account codes must be set up in the company preferences page under the setup tab and the bank account set up page. -<br /><br /> -<font size="+1"><b>Deposits Listing</b></font> -<br /><br /> -After processing has completed a link to print the deposit listing for the batch of receipts just entered is shown. The batch number is also reported. The listing shows the information required by banks in processing a batch of cheques. This deposit listing can be reprinted at any time from a link under the accounts receivable tab - reports and inquiries. -<!-- Help End: CustomerReceipt --> +<h3>Receipt - Date</h... [truncated message content] |
From: <tim...@us...> - 2012-06-24 10:37:12
|
Revision: 9058 http://weberp.svn.sourceforge.net/weberp/?rev=9058&view=rev Author: tim_schofield Date: 2012-06-24 10:37:05 +0000 (Sun, 24 Jun 2012) Log Message: ----------- Icedlava: Add ViewTopic and BookMark vars to some functions to take advantage of new Manual contextual help. Must be added before header.inc include. Ongoing work Modified Paths: -------------- trunk/InventoryPlanning.php trunk/SelectProduct.php trunk/StockAdjustments.php trunk/StockMovements.php trunk/StockTransfers.php trunk/Stocks.php Modified: trunk/InventoryPlanning.php =================================================================== --- trunk/InventoryPlanning.php 2012-06-24 10:18:50 UTC (rev 9057) +++ trunk/InventoryPlanning.php 2012-06-24 10:37:05 UTC (rev 9058) @@ -3,6 +3,9 @@ /* $Id$ */ include('includes/session.inc'); +/* webERP manual links before header.inc */ +$ViewTopic= 'Inventory'; +$BookMark = 'PlanningReport'; if (isset($_POST['PrintPDF']) and isset($_POST['FromCriteria']) Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2012-06-24 10:18:50 UTC (rev 9057) +++ trunk/SelectProduct.php 2012-06-24 10:37:05 UTC (rev 9058) @@ -5,6 +5,8 @@ $SuppliersSecurity = 9; //don't show supplier purchasing info unless security token 9 available to user include ('includes/session.inc'); $title = _('Search Inventory Items'); +/* webERP manual links before header.inc */ +$ViewTopic= 'Inventory'; include ('includes/header.inc'); if (isset($_GET['StockID'])) { Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-06-24 10:18:50 UTC (rev 9057) +++ trunk/StockAdjustments.php 2012-06-24 10:37:05 UTC (rev 9058) @@ -7,7 +7,9 @@ include('includes/session.inc'); $title = _('Stock Adjustments'); - +/* webERP manual links before header.inc */ +$ViewTopic= "Inventory"; +$BookMark = "InventoryAdjustments"; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2012-06-24 10:18:50 UTC (rev 9057) +++ trunk/StockMovements.php 2012-06-24 10:37:05 UTC (rev 9058) @@ -4,6 +4,9 @@ include('includes/session.inc'); $title = _('Stock Movements'); +/* webERP manual links before header.inc */ +$ViewTopic= 'Inventory'; +$BookMark = 'InventoryMovement'; include('includes/header.inc'); Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2012-06-24 10:18:50 UTC (rev 9057) +++ trunk/StockTransfers.php 2012-06-24 10:37:05 UTC (rev 9058) @@ -7,7 +7,9 @@ include('includes/session.inc'); $title = _('Stock Transfers'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'Inventory'; +$BookMark = 'LocationTransfers'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2012-06-24 10:18:50 UTC (rev 9057) +++ trunk/Stocks.php 2012-06-24 10:37:05 UTC (rev 9058) @@ -4,6 +4,9 @@ include('includes/session.inc'); $title = _('Item Maintenance'); +/* webERP manual links before header.inc */ +$ViewTopic= 'Inventory'; +$BookMark = 'InventoryAddingItems'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-24 11:11:30
|
Revision: 9059 http://weberp.svn.sourceforge.net/weberp/?rev=9059&view=rev Author: tim_schofield Date: 2012-06-24 11:11:22 +0000 (Sun, 24 Jun 2012) Log Message: ----------- Phil: added title/tooltip of long description to a number of stock scripts Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/Credit_Invoice.php trunk/DeliveryDetails.php trunk/RecurringSalesOrders.php trunk/SelectCreditItems.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/includes/DefineCartClass.php trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/ConfirmDispatch_Invoice.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -121,6 +121,7 @@ $LineItemsSQL = "SELECT stkcode, stockmaster.description, + stockmaster.longdescription, stockmaster.controlled, stockmaster.serialised, stockmaster.volume, @@ -161,6 +162,7 @@ $_SESSION['Items']->add_to_cart($myrow['stkcode'], $myrow['quantity'], $myrow['description'], + $myrow['longdescription'], $myrow['unitprice'], $myrow['discountpercent'], $myrow['units'], @@ -314,7 +316,7 @@ $_SESSION['Items']->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); echo '<td>'.$LnItm->StockID.'</td> - <td>'.$LnItm->ItemDescription.'</td> + <td title="'. $LnItm->LongDescription . '">'.$LnItm->ItemDescription.'</td> <td class="number">' . number_format($LnItm->Quantity,$LnItm->DecimalPlaces) . '</td> <td>'.$LnItm->Units.'</td> <td class="number">' . number_format($LnItm->QtyInv,$LnItm->DecimalPlaces) . '</td>'; Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/Credit_Invoice.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -100,6 +100,7 @@ $LineItemsSQL = "SELECT stockmoves.stkmoveno, stockmoves.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.volume, stockmaster.kgs, stockmaster.mbflag, @@ -138,6 +139,7 @@ $_SESSION['CreditItems']->add_to_cart($myrow['stockid'], $myrow['quantity'], $myrow['description'], + $myrow['longdescription'], $myrow['price'], $myrow['discountpercent'], $myrow['units'], @@ -312,7 +314,7 @@ $j++; echo '<tr '.$RowStarter.'><td>' . $LnItm->StockID . '</td> - <td>' . $LnItm->ItemDescription . '</td> + <td title="'. $LnItm->LongDescription . '">' . $LnItm->ItemDescription . '</td> <td class="number">' . locale_number_format($LnItm->Quantity,$LnItm->DecimalPlaces) . '</td> <td>' . $LnItm->Units . '</td>'; Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/DeliveryDetails.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -874,7 +874,7 @@ } echo '<td>'.$StockItem->StockID.'</td> - <td>'.$StockItem->ItemDescription.'</td> + <td title="'. $StockItem->LongDescription . '">'.$StockItem->ItemDescription.'</td> <td class="number">'.$DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> <td class="number">'.$DisplayPrice.'</td> Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/RecurringSalesOrders.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -105,6 +105,7 @@ /*need to look up customer name from debtors master then populate the line items array with the sales order details records */ $LineItemsSQL = "SELECT recurrsalesorderdetails.stkcode, stockmaster.description, + stockmaster.longdescription, stockmaster.volume, stockmaster.kgs, stockmaster.units, @@ -130,6 +131,7 @@ $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], $myrow['quantity'], $myrow['description'], + $myrow['longdescription'], $myrow['unitprice'], $myrow['discountpercent'], $myrow['units'], @@ -347,7 +349,7 @@ } echo '<td>'.$StockItem->StockID.'</td> - <td>'.$StockItem->ItemDescription.'</td> + <td title="'. $StockItem->LongDescription . '">'.$StockItem->ItemDescription.'</td> <td class="number">'.$DisplayQuantity.'</td> <td>'.$StockItem->Units.'</td> <td class="number">'.$DisplayPrice.'</td> Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/SelectCreditItems.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -206,6 +206,7 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.decimalplaces, stockmaster.units as stockunits FROM stockmaster, stockcategory @@ -219,6 +220,7 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.decimalplaces, stockmaster.units as stockunits FROM stockmaster, @@ -238,6 +240,7 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.decimalplaces, stockmaster.units as stockunits FROM stockmaster, @@ -252,6 +255,7 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.decimalplaces, stockmaster.units as stockunits FROM stockmaster, @@ -268,6 +272,7 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.decimalplaces, stockmaster.units as stockunits FROM stockmaster, stockcategory @@ -280,6 +285,7 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.decimalplaces, stockmaster.units as stockunits FROM stockmaster, @@ -368,6 +374,7 @@ if ($AlreadyOnThisCredit!=1){ $sql = "SELECT stockmaster.description, + stockmaster.longdescription, stockmaster.stockid, stockmaster.units as stockunits, stockmaster.volume, @@ -392,6 +399,7 @@ if ($_SESSION['CreditItems'.$identifier]->add_to_cart ($myrow['stockid'], $NewItemQty, $myrow['description'], + $myrow['longdescription'], GetPrice ($_POST['NewItem'], $_SESSION['CreditItems'.$identifier]->DebtorNo, $_SESSION['CreditItems'.$identifier]->Branch, $db), @@ -539,6 +547,7 @@ foreach ($NewItem_array as $key=>$value) { $NewItem=$key; $sql = "SELECT stockmaster.description, + stockmaster.longdescription, stockmaster.stockid, stockmaster.units as stockunits, stockmaster.volume, @@ -569,6 +578,7 @@ $myrow['stockid'], $value, $myrow['description'], + $myrow['longdescription'], $Price[0], 0, $_POST['Units'.$myrow['stockid']], @@ -647,7 +657,7 @@ } echo $RowStarter . '<td>' . $LineItem->StockID . '</td> - <td>' . $LineItem->ItemDescription . '</td>'; + <td title="'. $LineItem->LongDescription . '">' . $LineItem->ItemDescription . '</td>'; if ($LineItem->Controlled==0){ echo '<td><input type="text" class="number" name="Quantity_' . $LineItem->LineNumber . '" maxlength="6" size="6" value="' . locale_number_format($LineItem->Quantity, $LineItem->DecimalPlaces) . '" /></td>'; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/SelectOrderItems.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -198,6 +198,7 @@ $LineItemsSQL = "SELECT salesorderdetails.orderlineno, salesorderdetails.stkcode, stockmaster.description, + stockmaster.longdescription, stockmaster.volume, stockmaster.kgs, stockmaster.units, @@ -251,6 +252,7 @@ $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], $myrow['quantity'], $myrow['description'], + $myrow['longdescription'], $myrow['unitprice'], $myrow['discountpercent'], $myrow['units'], @@ -651,6 +653,7 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.units as stockunits, stockmaster.decimalplaces FROM stockmaster, @@ -664,6 +667,7 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.units as stockunits, stockmaster.decimalplaces FROM stockmaster, @@ -685,6 +689,7 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.units as stockunits, stockmaster.decimalplaces FROM stockmaster, @@ -698,6 +703,7 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.units as stockunits, stockmaster.decimalplaces FROM stockmaster, @@ -715,6 +721,7 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.units as stockunits, stockmaster.decimalplaces FROM stockmaster, @@ -727,6 +734,7 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, + stockmaster.longdescription, stockmaster.units as stockunits, stockmaster.decimalplaces FROM stockmaster, @@ -1248,7 +1256,7 @@ } echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> - <td>' . $OrderLine->ItemDescription . '</td>'; + <td title="'. $OrderLine->LongDescription . '">' . $OrderLine->ItemDescription . '</td>'; echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . locale_number_format($OrderLine->Quantity, $OrderLine->DecimalPlaces) . '" />'; if ($QtyRemain != $QtyOrdered){ @@ -1413,6 +1421,7 @@ $SQL="SELECT stockmaster.units, stockmaster.description, + stockmaster.longdescription, stockmaster.stockid, salesorderdetails.stkcode, SUM(qtyinvoiced) salesqty @@ -1525,8 +1534,8 @@ $Available = $QOH - $DemandQty + $OnOrder; printf('<td>%s</font></td> + <td title="%s">%s</td> <td>%s</td> - <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> <td class="number">%s</td> @@ -1536,6 +1545,7 @@ </tr>', $myrow['stockid'], $myrow['description'], + $myrow['longdescription'], $myrow['units'], locale_number_format($QOH, $DecimalPlaces), locale_number_format($DemandQty, $DecimalPlaces), Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/SelectProduct.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -99,6 +99,7 @@ $StockID = $_SESSION['SelectedStockItem']; } $result = DB_query("SELECT stockmaster.description, + stockmaster.longdescription, stockmaster.mbflag, stockcategory.stocktype, stockmaster.units, @@ -123,7 +124,9 @@ } else { $ItemStatus = ''; } - echo '<table width="95%" class="selection"><tr><th colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' ' . $ItemStatus . '</b></th></tr>'; + echo '<table width="95%" class="selection"> + <tr> + <th title="'. $myrow['longdescription'] . '" colspan="3"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' ' . $ItemStatus . '</b></th></tr>'; echo '<tr><td width="40%" valign="top"> <table align="left" style="background: transparent;">'; //nested table echo '<tr><th style="text-align:right;"><b>' . _('Item Type:') . '</b></th> Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/includes/DefineCartClass.php 2012-06-24 11:11:22 UTC (rev 9059) @@ -73,6 +73,7 @@ function add_to_cart($StockID, $Qty, $Descr, + $LongDescr, $Price, $Disc=0, $Units, @@ -114,6 +115,7 @@ $this->LineItems[$LineNumber] = new LineDetails($LineNumber, $StockID, $Descr, + $LongDescr, $Qty, $Price, $Disc, @@ -429,6 +431,7 @@ var $LineNumber; var $StockID; var $ItemDescription; + var $LongDescription; var $Quantity; var $Price; var $DiscountPercent; @@ -463,6 +466,7 @@ function LineDetails ($LineNumber, $StockItem, $Descr, + $LongDescr, $Qty, $Prc, $DiscPercent, @@ -493,6 +497,7 @@ $this->LineNumber = $LineNumber; $this->StockID =$StockItem; $this->ItemDescription = $Descr; + $this->LongDescription = $LongDescr; $this->Quantity = $Qty; $this->Price = $Prc; $this->DiscountPercent = $DiscPercent; Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2012-06-24 10:37:05 UTC (rev 9058) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2012-06-24 11:11:22 UTC (rev 9059) @@ -31,6 +31,7 @@ if ($AlreadyOnThisOrder!=1){ $sql = "SELECT stockmaster.description, + stockmaster.longdescription, stockmaster.stockid, stockmaster.units, stockmaster.volume, @@ -136,6 +137,7 @@ $_SESSION['Items'.$identifier]->add_to_cart ($NewItem, $NewItemQty, $myItemRow['description'], + $myItemRow['longdescription'], $Price, $Discount, $_POST['Units'.$NewItem], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-24 11:21:32
|
Revision: 9060 http://weberp.svn.sourceforge.net/weberp/?rev=9060&view=rev Author: tim_schofield Date: 2012-06-24 11:21:25 +0000 (Sun, 24 Jun 2012) Log Message: ----------- Phil: added a few bookmarks Modified Paths: -------------- trunk/AccountGroups.php trunk/BankAccounts.php trunk/Payments.php trunk/SelectProduct.php trunk/StockCategories.php Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2012-06-24 11:11:22 UTC (rev 9059) +++ trunk/AccountGroups.php 2012-06-24 11:21:25 UTC (rev 9060) @@ -5,7 +5,8 @@ include('includes/session.inc'); $title = _('Account Groups'); - +$ViewTopic= 'GeneralLedger'; +$BookMark = 'AccountGroups'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2012-06-24 11:11:22 UTC (rev 9059) +++ trunk/BankAccounts.php 2012-06-24 11:21:25 UTC (rev 9060) @@ -5,7 +5,8 @@ include('includes/session.inc'); $title = _('Bank Accounts Maintenance'); - +$ViewTopic= 'GeneralLedger'; +$BookMark = 'BankAccounts'; include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Bank') . '" alt="" />' . ' ' . $title . '</p>'; Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-06-24 11:11:22 UTC (rev 9059) +++ trunk/Payments.php 2012-06-24 11:21:25 UTC (rev 9060) @@ -4,7 +4,8 @@ include('includes/DefinePaymentClass.php'); include('includes/session.inc'); - +$ViewTopic= 'GeneralLedger'; +$BookMark = 'BankAccountPayments'; $title = _('Payment Entry'); include('includes/header.inc'); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2012-06-24 11:11:22 UTC (rev 9059) +++ trunk/SelectProduct.php 2012-06-24 11:21:25 UTC (rev 9060) @@ -7,6 +7,7 @@ $title = _('Search Inventory Items'); /* webERP manual links before header.inc */ $ViewTopic= 'Inventory'; +$BookMark = 'SelectingInventory'; include ('includes/header.inc'); if (isset($_GET['StockID'])) { Modified: trunk/StockCategories.php =================================================================== --- trunk/StockCategories.php 2012-06-24 11:11:22 UTC (rev 9059) +++ trunk/StockCategories.php 2012-06-24 11:21:25 UTC (rev 9060) @@ -4,7 +4,8 @@ include('includes/session.inc'); $title = _('Stock Category Maintenance'); - +$ViewTopic= 'Inventory'; +$BookMark = 'InventoryCategories'; include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '</p>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-25 13:51:29
|
Revision: 9063 http://weberp.svn.sourceforge.net/weberp/?rev=9063&view=rev Author: tim_schofield Date: 2012-06-25 13:51:20 +0000 (Mon, 25 Jun 2012) Log Message: ----------- Icedlava: Add a few bookmarks for webERP manual. Modified Paths: -------------- trunk/CustomerBranches.php trunk/Customers.php trunk/SupplierContacts.php trunk/SupplierInvoice.php trunk/Suppliers.php trunk/doc/Manual/ManualAccountsPayable.html trunk/doc/Manual/ManualAccountsReceivable.html trunk/doc/Manual/ManualInventory.html Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/CustomerBranches.php 2012-06-25 13:51:20 UTC (rev 9063) @@ -5,6 +5,9 @@ include('includes/session.inc'); $title = _('Customer Branches'); +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsReceivable'; +$BookMark = 'NewCustomerBranch'; include('includes/header.inc'); if (isset($_GET['DebtorNo'])) { Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/Customers.php 2012-06-25 13:51:20 UTC (rev 9063) @@ -5,7 +5,9 @@ include('includes/session.inc'); $title = _('Customer Maintenance'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsReceivable'; +$BookMark = 'NewCustomer'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/SupplierContacts.php =================================================================== --- trunk/SupplierContacts.php 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/SupplierContacts.php 2012-06-25 13:51:20 UTC (rev 9063) @@ -4,7 +4,9 @@ include('includes/session.inc'); $title = _('Supplier Contacts'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsPayable'; +$BookMark = 'SupplierContact'; include('includes/header.inc'); if (isset($_GET['SupplierID'])){ Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/SupplierInvoice.php 2012-06-25 13:51:20 UTC (rev 9063) @@ -12,6 +12,9 @@ include('includes/session.inc'); $title = _('Enter Supplier Invoice'); +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsPayable'; +$BookMark = 'SupplierInvoice'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/Suppliers.php 2012-06-25 13:51:20 UTC (rev 9063) @@ -5,6 +5,9 @@ include('includes/session.inc'); $title = _('Supplier Maintenance'); +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsPayable'; +$BookMark = 'NewSupplier'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/doc/Manual/ManualAccountsPayable.html =================================================================== --- trunk/doc/Manual/ManualAccountsPayable.html 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/doc/Manual/ManualAccountsPayable.html 2012-06-25 13:51:20 UTC (rev 9063) @@ -23,7 +23,7 @@ <!-- Help Begin: Suppliers --> <div class="floatright"><a class="minitext" href="#top">⬆ Top</a></div> -<h2>Entering Supplier (Vendors)</h2> +<h2><a id="NewSupplier">Entering Supplier (Vendors)</a></h2> <p> From the menu Payables tab, under Maintenance, click on "Add A New Supplier". The new details entered are only committed to the database as a new supplier once the user clicks on the button to "Insert New Supplier". If the user moves to another screen without clicking this button any entries are lost.</p> <h3>Supplier Code</h3> @@ -89,7 +89,7 @@ <!-- Help End: SelectSupplier --> <!-- Help Begin: SupplierContacts --> <div class="floatright"><a class="minitext" href="#top">⬆ Top</a></div> -<h2>Supplier Contacts</h2> +<h2><a id="SupplierContact">Supplier Contacts</a></h2> <p> Any number of supplier contacts can be defined. This facility allows for ready access to phone numbers and email addresses of all company suppliers. Purchase orders created can be emailed directly to any of the defined contacts email addresses.</p> <p> @@ -113,7 +113,7 @@ <!-- Help End: SupplierContacts --> <!-- Help Begin: SupplierInvoices --> <div class="floatright"><a class="minitext" href="#top">⬆ Top</a></div> - <h2>Entering Supplier Invoices</h2> + <h2><a id="SupplierInvoice">Entering Supplier Invoices</a></h2> <p> As with all transactions in webERP the entity to be transacted with must first be selected i.e. a customer, item or supplier. Entering accounts payable transactions then requires the selection of a supplier first. Once a supplier is selected, the menu of options shows for the supplier among them "Enter an Invoice". The process below applies equally to entry of supplier credit notes as it does to entry of purchase invoices. In every case, entry of invoices and supplier credit notes (debit notes) requires entry of: Modified: trunk/doc/Manual/ManualAccountsReceivable.html =================================================================== --- trunk/doc/Manual/ManualAccountsReceivable.html 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/doc/Manual/ManualAccountsReceivable.html 2012-06-25 13:51:20 UTC (rev 9063) @@ -26,7 +26,7 @@ <a class="minitext" href="#top">⬆ Top</a> </div> -<h2>Entering New Customers</h2> +<h2><a id="NewCustomer">Entering New Customers</a></h2> <p>From the menu Receivables tab, click on "Add A New Customer". The customer record is the actual charge account, any number of branches can be defined for each customer account. At least one branch must be defined for each customer. It is the branch details that record the local information about delivery address, tax authority, sales area and sales person.</p> @@ -94,8 +94,9 @@ <div class="floatright"> <a class="minitext" href="#top">⬆ Top</a> </div> -<h2>Entering Customer Branches</h2> +<h2><a id="NewCustomerBranch">Entering Customer Branches</a></h2> + <p>A customer code entered on its own is insufficient to enter sales orders against. All customers must have at least one branch. The branch records contain the information about the delivery address, the sales area, the tax code, the sales representative and other regional information. New branches can be set up at any time. The first step will always be to select the customer, then to Add/Edit/Delete Customer Branch Records from the Customer menu. There is no limit to the number of branches that can be referenced against a single charge account (customer record). However, branches cannot be transferred between different customers. Only one statement will print per customer, but each invoice will be referenced to the branch it was delivered to.</p> <h3>Branch Name</h3> Modified: trunk/doc/Manual/ManualInventory.html =================================================================== --- trunk/doc/Manual/ManualInventory.html 2012-06-25 11:17:51 UTC (rev 9062) +++ trunk/doc/Manual/ManualInventory.html 2012-06-25 13:51:20 UTC (rev 9063) @@ -105,7 +105,7 @@ <a class="minitext" href="#top">⬆ Top</a> </div> - <h2><a id="InventoryAddingItems">Adding Inventory Items</a></h2> + <h2><a name="InventoryAddingItems">Adding Inventory Items</a></h2> <p>Entry of new items requires the input of certain base information:</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-28 10:03:53
|
Revision: 9066 http://weberp.svn.sourceforge.net/weberp/?rev=9066&view=rev Author: tim_schofield Date: 2012-06-28 10:03:41 +0000 (Thu, 28 Jun 2012) Log Message: ----------- New style for all pages Modified Paths: -------------- trunk/AccountGroups.php trunk/css/silverwolf/default.css trunk/doc/Manual/ManualContents.php trunk/doc/Manual/ManualGeneralLedger.html trunk/doc/Manual/ManualHeader.html trunk/doc/Manual/style/manual.css trunk/includes/MiscFunctions.php trunk/includes/footer.inc trunk/includes/header.inc trunk/includes/session.inc trunk/index.php trunk/javascripts/MiscFunctions.js Added Paths: ----------- trunk/branding.php trunk/css/silverwolf/sub.css trunk/includes/main_footer.inc trunk/includes/main_header.inc trunk/javascripts/FormFunctions.js Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/AccountGroups.php 2012-06-28 10:03:41 UTC (rev 9066) @@ -10,7 +10,7 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; +//echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; function CheckForRecursiveGroup ($ParentGroupName, $GroupName, $db) { @@ -64,7 +64,7 @@ $result=DB_query($sql, $db,$ErrMsg,$DbgMsg); $myrow=DB_fetch_row($result); - if ($myrow[0]!=0 and $_POST['SelectedAccountGroup']=='') { + if ($myrow[0]!=0 and (isset($_POST['SelectedAccountGroup']) and $_POST['SelectedAccountGroup']=='')) { $InputError = 1; prnMsg( _('The account group name already exists in the database'),'error'); $Errors[$i] = 'GroupName'; @@ -126,9 +126,8 @@ $i++; } + if ((isset($_POST['SelectedAccountGroup']) and $_POST['SelectedAccountGroup']!='') AND $InputError !=1) { - if ($_POST['SelectedAccountGroup']!='' AND $InputError !=1) { - /*SelectedAccountGroup 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 accountgroups SET groupname='" . $_POST['GroupName'] . "', @@ -165,10 +164,13 @@ //run the SQL from either of the above possibilites $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); prnMsg($msg,'success'); - unset ($_POST['SelectedAccountGroup']); - unset ($_POST['GroupName']); - unset ($_POST['SequenceInTB']); } + unset ($_POST['SelectedAccountGroup']); + unset ($_POST['GroupName']); + unset ($_POST['SequenceInAccounts']); + unset ($_POST['SequenceInTB']); + unset ($_POST['PandL']); + unset ($_POST['submit']); } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button @@ -204,8 +206,6 @@ } -if (!isset($_GET['SelectedAccountGroup']) and !isset($_POST['SelectedAccountGroup'])) { - /* An account group could be posted when one has been edited and is being updated or GOT when selected for modification SelectedAccountGroup will exist because it was sent with the page in a GET . If its the first time the page has been displayed with no parameters @@ -228,6 +228,9 @@ echo '<br /><table class="selection"> <tr> + <th colspan="7" class="header">' . _('Review Account Groups') . '</th> + </tr> + <tr> <th>' . _('Group Name') . '</th> <th>' . _('Section') . '</th> <th>' . _('Sequence In TB') . '</th> @@ -260,20 +263,23 @@ echo '<td>' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '</td> <td>' . $myrow['sectionname'] . '</td> - <td>' . $myrow['sequenceintb'] . '</td> - <td>' . $PandLText . '</td> + <td class="number">' . $myrow['sequenceintb'] . '</td> + <td style="text-align: center;">' . $PandLText . '</td> <td>' . $myrow['parentgroupname'] . '</td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this account group?') . '\');">' . _('Delete') .'</a></td></tr>'; - } //END WHILE LIST LOOP - echo '</table>'; -} //end of ifs and buts! + if (!isset($_GET['SelectedAccountGroup']) and !isset($_POST['SelectedAccountGroup'])) { + echo '<td>'.InternalLink($rootpath, htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8'), _('Edit')).'</td>'; + echo '<td>'.InternalLink($rootpath, htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedAccountGroup=' . htmlentities($myrow['groupname'], ENT_QUOTES,'UTF-8') . '&delete=1', _('Delete')).'</td>'; + } else { + echo '<td>' . _('Edit') . '</td>'; + echo '<td>' . _('Delete') . '</td>'; + } +} //END WHILE LIST LOOP +echo '</table>'; - if (!isset($_GET['delete'])) { - echo '<form method="post" id="AccountGroups" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">'; + echo '<form method="post" id="AccountGroups" onsubmit="return SubmitForm(this)" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedAccountGroup'])) { @@ -303,7 +309,7 @@ $_POST['PandL'] = $myrow['pandl']; $_POST['ParentGroupName'] = $myrow['parentgroupname']; - echo '<table class="selection">'; + echo '<br /><table class="selection">'; echo '<tr> <th colspan="2" class="header">' . _('Edit Account Group Details') . '</th> </tr>'; @@ -334,7 +340,6 @@ } echo '<br /><table class="selection">'; - echo '<input type="hidden" name="SelectedAccountGroup" value="' . $_POST['SelectedAccountGroup'] . '" />'; echo '<tr> <th colspan="2" class="header">' . _('New Account Group Details') . '</th> </tr>'; @@ -405,15 +410,11 @@ </tr>'; echo '<tr> - <td colspan="2"><div class="centre"><button tabindex="6" type="submit" name="submit">' . _('Enter Information') . '</button></div></td> + <td colspan="2"><div class="centre"><button tabindex="6" type="submit" name="submit" value="submit">' . _('Enter Information') . '</button></div></td> </tr>'; echo '</table><br />'; - if (isset($_POST['SelectedAccountGroup']) or isset($_GET['SelectedAccountGroup'])) { - echo '<div style="text-align: right"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Review Account Groups') . '</a></div>'; - } - echo '<script type="text/javascript">defaultControl(document.forms[0].GroupName);</script>'; echo '</form>'; Added: trunk/branding.php =================================================================== --- trunk/branding.php (rev 0) +++ trunk/branding.php 2012-06-28 10:03:41 UTC (rev 9066) @@ -0,0 +1,5 @@ +<?php + +$ProjectName='webERP'; + +?> \ No newline at end of file Modified: trunk/css/silverwolf/default.css =================================================================== --- trunk/css/silverwolf/default.css 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/css/silverwolf/default.css 2012-06-28 10:03:41 UTC (rev 9066) @@ -35,6 +35,11 @@ border:none; } +img.manual { + border:none; + width: 98%; +} + /* From merge li { list-style-image: url(bullet.gif); ¡ bullet.gif only exist in fresh theme and off images directory ! } */ @@ -128,7 +133,7 @@ border-radius: 5px; -moz-box-shadow: 3px 3px 2px #B1B1B1; -webkit-box-shadow: 3px 3px 2px #B1B1B1; - box-shadow: 3px 3px 2px #B1B1B1; + box-shadow: 3px 3px 8px #B1B1B1; } td.number { @@ -184,7 +189,8 @@ background-color: #fddbdb; color: red; border: 1px solid red; - width: 80%; + border-radius: 10px; + width: 95%; text-align: center; margin: 0 auto; } @@ -193,7 +199,8 @@ background-color: #f5dbfd; color: maroon; border: 1px solid maroon; - width: 80%; + border-radius: 10px; + width: 95%; text-align: center; margin: 0 auto; } @@ -202,7 +209,8 @@ background-color: #b9ecb4; color: #006400; /* darkgreen is not a w3c css valid color */ border: 1px solid #006400; /* darkgreen is not a w3c css valid color */ - width: 80%; + border-radius: 10px; + width: 95%; text-align: center; margin: 0 auto; } @@ -211,7 +219,7 @@ background-color: #c7ccf6; color: navy; border: 1px solid navy; - width: 80%; + width: 95%; text-align: center; margin: 0 auto; } @@ -747,7 +755,7 @@ text-align:center; -moz-box-shadow: 3px 3px 2px #888; -webkit-box-shadow: 3px 3px 2px #888; - box-shadow: 3px 3px 2px #888; + box-shadow: 3px 3px 3px #888; } div.page_help_text { @@ -767,6 +775,9 @@ font-size: 100%; color: black; text-align:center; + -moz-box-shadow: 3px 3px 2px #888; + -webkit-box-shadow: 3px 3px 2px #888; + box-shadow: 3px 3px 3px #888; } /* From merge @@ -907,8 +918,3 @@ background-color: #FFDAE1; color: #510D19; } -/* From merge, uncomment to apply style -.table_index { - background-color: #F1FFDD; -} -End merge */ Added: trunk/css/silverwolf/sub.css =================================================================== --- trunk/css/silverwolf/sub.css (rev 0) +++ trunk/css/silverwolf/sub.css 2012-06-28 10:03:41 UTC (rev 9066) @@ -0,0 +1,255 @@ + +div.mask { + position: absolute; + top: 0px; + right: 0px; + bottom: 0px; + left: 0px; + background: black; + opacity: 0.4; + z-index: 1; +} + +div.unmask { + position: absolute; + display: none; + z-index: 1; +} + +div.inputbox { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size:12px; + border-radius: 17px; + position: absolute; + display: inline; + top: 10px; + right: 10px; + bottom: 20px; + left: 20px; + background: black; + color: white; + opacity: 0.85; + z-index: 2; + overflow:auto; +} + +div.helpbox { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size:12px; + border-radius: 17px; + position: absolute; + display: inline; + top: 20px; + right: 20%; + bottom: 25px; + left: 20%; + padding-left: 10px; + padding-right: 10px; + background: white; + color: black; + opacity: 0.99; + z-index: 4; + overflow:auto; +} + +div.messagebox { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size:12px; + border-radius: 17px; + position: absolute; + display: inline; + top: 35%; + right: 20%; + bottom: 35%; + left: 20%; + padding-left: 4px; + padding-right: 4px; + background: #AEDFFF; + color: #110D75; + opacity: 1.00; + z-index: 4; + overflow:auto; +} + +div.title_bar { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 200%; + border: solid #ffffff 2px; + border-radius: 17px; + margin-top: 2px; + margin-left: 4px; + margin-right: 4px; + font-size: 200%; + padding-left: 10px; +} + +div.manual_title_bar { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 24px; + border: solid #000000 2px; + border-radius: 17px; + margin-top: 2px; + margin-left: 0px; + margin-right: 4px; + padding-left: 10px; +} + +div.status_bar { + position: relative; + bottom:2px; + border: solid #ffffff 2px; + border-radius: 17px; + margin-top: 2px; + margin-left: 4px; + margin-right: 4px; + font-size: 200%; + width: 99%; +} + +div.clock { + float: right; + margin-top: 0px; + margin-bottom: 2px; + margin-left: 4px; + margin-right: 4px; + font-size: 100%; + height: 26px; +} + +div.exit { + float: right; + padding-top:0px; + padding-right:10px; + height: 100%; + cursor: pointer; +} + +table.selection { + margin-bottom: 5px; + background: transparent; + border: solid #ffffff 2px; + border-radius: 5px; + box-shadow: 0px 0px 0px #B1B1B1; +} + +th { + font-weight: bold; + background-color: transparent; + border: solid #ffffff 1px; + border-radius: 5px; + font-size: 100%; + color: #ffffff; + text-align: center; + vertical-align: middle; +} + +th.header { + font-weight: normal; + background: #90979B; + border: solid #A49999 1px; + border-radius: 5px; + font-size: 16px; + color: #000000; + text-align: center; + vertical-align: middle; +} + +button { + border: 1px solid #ffffff; + background: transparent; + padding: 2px 3px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 12px; + color: #ffffff; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "Geneva", "Verdana", "sans-serif"; + font-size: 10px; + vertical-align: middle; + cursor: hand; +} + +button:hover { + border: 1px solid #000000; + background: #BEBEBE; + color: #000000; + cursor: pointer; +} + +button:active { + border-top-color: #4C5860; + background: #638094; +} + +button.dialog { + border: 1px solid #000000; + background: transparent; + float: right; + width: 20%; + padding: 2px 3px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 12px; + color: #000000; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "Geneva", "Verdana", "sans-serif"; + font-size: 10px; + vertical-align: middle; + cursor: hand; +} + +button.dialog:hover { + border: 1px solid #000000; + background: #BEBEBE; + color: #000000; + cursor: pointer; +} + +button.dialog:active { + border-top-color: #4C5860; + background: #638094; +} + +input { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 10px; + background-color: transparent; + border-width:1px; + color:#ffffff; + border-color: gray; + border-style: solid; + border-radius: 3px; +} +input:hover { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 10px; + background-color: transparent; + border-width:1px; + color:#ffffff; + border-color: #646566; + border-style: solid; + border-radius: 3px; +} + +select { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 10px; + background-color: transparent; + border-width:1px; + color:#ffffff; + border-color: gray; + border-style: solid; + border-radius: 3px; +} +select:hover { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 10px; + background-color: transparent; + border-width:1px; + color:#ffffff; + border-color: #646566; + border-style: solid; + border-radius: 3px; +} + +a:hover { + color:#D2D5D6; +} \ No newline at end of file Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/doc/Manual/ManualContents.php 2012-06-28 10:03:41 UTC (rev 9066) @@ -29,7 +29,7 @@ echo ' <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (((!isset($_POST['Submit'])) AND (empty($_GET['ViewTopic']))) || - ((isset($_POST['Submit'])) AND(isset($_POST['SelectTableOfContents'])))) { + ((isset($_POST['Submit'])) AND(isset($_POST['SelectTableOfContents'])))) { // if not submittws then coming into manual to look at TOC // if SelectTableOfContents set then user wants it displayed if (!isset($_POST['Submit'])) { @@ -44,7 +44,7 @@ } echo "Table of Contents</h1></li>\n"; foreach ($TOC_Array['TableOfContents'] as $Title => $SubLinks) { - + $Name = 'Select' . $Title; echo "<ul>\n"; if (!isset($_POST['Submit'])) { Modified: trunk/doc/Manual/ManualGeneralLedger.html =================================================================== --- trunk/doc/Manual/ManualGeneralLedger.html 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/doc/Manual/ManualGeneralLedger.html 2012-06-28 10:03:41 UTC (rev 9066) @@ -2,7 +2,7 @@ <h2>Overview</h2> -<p>The general ledger is the accounting hub that is central to the "sub" ledgers for creditors (Accounts Payable), debtors (Accounts Receivable) and stock (inventory). All entries in the sub ledgers are also represented by entries in the general ledger. It is the integration set-up that determines how entries in the sub-ledgers are reflected in the general ledger. Most activity in the general ledger will be automatically created from the activity in the sub-ledgers with receivables, payables and stock administration.</p><img src="images/GLIntegration.jpg"> +<p>The general ledger is the accounting hub that is central to the "sub" ledgers for creditors (Accounts Payable), debtors (Accounts Receivable) and stock (inventory). All entries in the sub ledgers are also represented by entries in the general ledger. It is the integration set-up that determines how entries in the sub-ledgers are reflected in the general ledger. Most activity in the general ledger will be automatically created from the activity in the sub-ledgers with receivables, payables and stock administration.</p><img class="manual" src="doc/Manual/images/GLIntegration.jpg"> <p> <p>However, there are also facilities to:</p> @@ -48,7 +48,7 @@ <p>Bank accounts are defined from the setup tab from the link to Bank Accounts Maintenance. There is facility to enter the name of the account, the currency of the account, the bank account number and the address of the bank if required, as well as selecting the general ledger account to which it refers. There are links to edit existing bank account records and to delete them. However, once defined as referring to a particular general ledger code it is not possible to change the general ledger code of the bank account. This is because there would be entries made to this account. Similarly, if bank transactions have been created using this bank account it is not possible to delete it. The bank account transactions must be purged first (but currently no facility exists to purge bank transactions). It is not possible to change the currency of a bank account once there are transactions against it.</p> -<p>Once all receipts and payments are matched to bank statements, the bank reconciliation statement can be printed which should show how the current general ledger balance reconciles to the bank statement for this account. The reconciliation also has an option available for bank accounts set up in other than the functional currency of the business (local currency), to post differences in exchange. The balance of the account is maintained in local currency in the general ledger and for the purposes of the bank reconciliation this is converted to the bank account currency at the exchange rate in the currencies table (see Setup -> Currency Maintenance) - this rate can be changed manually to the rate of the day and the foreign currency balance on the account will change - to correct this balance an exchange difference needs to be recorded. Having worked through the matching of receipts and payments to the bank statements - the bank statment balance can be entered to compare against the system balance - a correcting entry is then made to the GL to post the difference on exchange. The posting to the general ledger is back dated to the end of the preceeding month - since it is assumed that the reconciliation may be a few days or a week behind the current date.</p><img src="images/BankReconciliation.jpg"> <!-- Help End: BankAccounts --> +<p>Once all receipts and payments are matched to bank statements, the bank reconciliation statement can be printed which should show how the current general ledger balance reconciles to the bank statement for this account. The reconciliation also has an option available for bank accounts set up in other than the functional currency of the business (local currency), to post differences in exchange. The balance of the account is maintained in local currency in the general ledger and for the purposes of the bank reconciliation this is converted to the bank account currency at the exchange rate in the currencies table (see Setup -> Currency Maintenance) - this rate can be changed manually to the rate of the day and the foreign currency balance on the account will change - to correct this balance an exchange difference needs to be recorded. Having worked through the matching of receipts and payments to the bank statements - the bank statment balance can be entered to compare against the system balance - a correcting entry is then made to the GL to post the difference on exchange. The posting to the general ledger is back dated to the end of the preceeding month - since it is assumed that the reconciliation may be a few days or a week behind the current date.</p><img class="manual" src="doc/Manual/images/BankReconciliation.jpg"> <!-- Help End: BankAccounts --> <!-- Help Begin: Payments --> <div class="floatright"> Modified: trunk/doc/Manual/ManualHeader.html =================================================================== --- trunk/doc/Manual/ManualHeader.html 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/doc/Manual/ManualHeader.html 2012-06-28 10:03:41 UTC (rev 9066) @@ -3,10 +3,13 @@ <head> <title>webERP Manual</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> - <link rel="stylesheet" type="text/css" href="style/manual.css" /> + <link rel="stylesheet" type="text/css" href="doc/Manual/style/manual.css" /> </head> <body> - <div id="pagetitle">webERP Manual</div> + + <div class="manual_title_bar"><b><?php echo $ProjectName; ?> Manual </b> + <div onClick="CloseHelpWindow()" class="exit" title="Close the manual">X</div> +</div> <div class="right"> <a id="top"> </a><a class="minitext" href="<?php echo $rootpath; ?>/ManualContents.php">☜ Table of Contents</a> <br /> Modified: trunk/doc/Manual/style/manual.css =================================================================== --- trunk/doc/Manual/style/manual.css 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/doc/Manual/style/manual.css 2012-06-28 10:03:41 UTC (rev 9066) @@ -4,35 +4,41 @@ * */ body { - font-family: Trebuchet, 'Times New Roman', serif; - font-size:.95em; - margin:0; - padding:2em; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 100%; + margin-left:0px; + padding:20em; } - -img { - border:none; -} #pagetitle { - font-weight: bold; - font-size: 2.8em; - text-align:center; - color: #0033cc; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 100%; + text-align:center; + color: #0033cc; } #manualpage{ + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 100%; margin: 10px; margin-top:20px; + margin-left:20px; + padding: 20px; } #toc { + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 100%; padding:0; margin:0; } h1, h2, h3, h4, h1 a, h2 a, h3 a, h4 a { font-weight: bold; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 100%; } h1 { padding-top: 10px; color: #0033cc; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 100%; } h2 { } h3 { } @@ -61,10 +67,13 @@ text-align:left; } .minitext { - font-size: .8em; + font-size: 50%; } li.toc { color: #0033cc; padding-top:10px; + padding-left:10px; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + font-size: 50%; } Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/includes/MiscFunctions.php 2012-06-28 10:03:41 UTC (rev 9066) @@ -33,9 +33,9 @@ } function prnMsg($Msg,$Type='info', $Prefix=''){ + global $Messages; + $Messages[] = array($Msg, $Type, $Prefix); - echo getMsg($Msg, $Type, $Prefix); - }//prnMsg function getMsg($Msg,$Type='info',$Prefix=''){ @@ -327,10 +327,11 @@ } function InternalLink($rootpath, $Script, $Caption, $Format='') { - $ScriptNameArray = explode('?', substr($Script,1)); - $PageSecurity = $_SESSION['PageSecurityArray'][$ScriptNameArray[0]]; + $PathArray = explode('?', substr($Script,1)); + $ScriptNameArray = explode('/', substr($PathArray[0],1)); + $PageSecurity = $_SESSION['PageSecurityArray'][$ScriptNameArray[1]]; if ((in_array($PageSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PageSecurity))) { - return '<a href="' . $rootpath . $Script .'">' . $Caption . '</a>'; + return '<a onclick="return OpenSubWindow(\'' . $Script.'\')" href="' . $rootpath . $Script .'">' . $Caption . '</a>'; } } Modified: trunk/includes/footer.inc =================================================================== --- trunk/includes/footer.inc 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/includes/footer.inc 2012-06-28 10:03:41 UTC (rev 9066) @@ -2,23 +2,32 @@ /* $Id$*/ -echo '<table width="100%" id="footer" class="selection">'; +if (sizeOf($Messages) > 0) { + echo '<div class="mask" id="DialogMask"></div>'; + echo '<div class="messagebox" id="messagebox">'; + echo '<div class="manual_title_bar">' . _('System Messages') . '</div>'; + echo '<br />'; + foreach ($Messages as $Message) { + switch($Message[1]){ + case 'error': + $Class = 'error'; + break; + case 'warn': + $Class = 'warn'; + break; + case 'success': + $Class = 'success'; + break; + case 'info': + default: + $Class = 'info'; + } + echo '<div class="' . $Class . '">' . $Message[0] . '</div>'; + } + echo '<br /><button class="dialog" type="submit" value="ok" onclick="CloseDialog()">' . _('OK') . '</button>'; + echo '</div>'; +} -echo '<tr>'; -echo '<td style="width:33%"></td><td class="footer">'; -echo '<img src="'. $rootpath . '/' . $_SESSION['LogoFile'] . '" width="120" alt="webERP" title="webERP" /></td>'; -echo '<td class="footer" style="text-align: right;width:33%">'.(strftime('%A')).', '.(date($_SESSION['DefaultDateFormat']).' | '.(strftime(($DefaultClock==12) ? '%I:%M %p' : '%H:%M'))).'</td>'; - -echo '</tr>'; - -echo '<tr><td colspan="3" class="footer">webERP v' . $_SESSION['VersionNumber'] .'</td></tr>'; - -// if(http_file_exists('http://sflogo.sourceforge.net/sflogo.php')) { -// echo '<tr><td class="footer"><a href="https://sourceforge.net/projects/weberp"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=391629&type=12" width="120" height="30" border="0" alt="Get webERP web-based ERP Accounting at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a></td></tr>'; -// } - -echo '</table>'; - echo '</body>'; echo '</html>'; ?> \ No newline at end of file Modified: trunk/includes/header.inc =================================================================== --- trunk/includes/header.inc 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/includes/header.inc 2012-06-28 10:03:41 UTC (rev 9066) @@ -14,7 +14,7 @@ if ($StrictXHTML) { header('Content-type: application/xhtml+xml; charset=utf-8'); } else { - header('Content-type: text/html; charset=utf-8'); + header('Content-type: text/html; charset=utf-8;Cache-Control: no-store, no-cache, must-revalidate'); } } echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" @@ -27,58 +27,25 @@ if ($StrictXHTML) { echo '<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />'; } else { - echo '<meta http-equiv="Content-Type" content="application/html; charset=utf-8" />'; + echo '<meta http-equiv="Content-Type" content="application/html; charset=utf-8; content="no-cache" />'; } -echo '<link href="' . $rootpath . '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />'; echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/MiscFunctions.js"></script>'; +echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/sorttable.js"></script>'; echo '</head>'; echo '<body>'; -echo '<table class="selection" cellpadding="0" cellspacing="0" style="margin-top:3px; width:99%;">'; -echo '<tr>'; -echo '<td colspan="2" rowspan="2">'; -if (isset($title)) { - echo '<table cellpadding="0" cellspacing="0" border="0" id="quick_menu" class="quick_menu">'; - echo '<tr>'; - echo '<td align="left" style="width:100%;" class="quick_menu_left">'; -// Use icons for company and user data, saves screen realestate, use alt tag in case theme icon not avail. - echo '<img src="'.$rootpath.'/css/'.$theme.'/images/company.png" title="' . _('Company') . '" alt="' . _('Company') . '" style="width: 24px" />'; - echo ' ' . stripslashes($_SESSION['CompanyRecord']['coyname']) . ' <a href="' . $rootpath . '/UserSettings.php"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="User" alt="' . _('User') . '" style="width: 16px" />' . stripslashes($_SESSION['UsersRealName']) . '</a>'; -// Make the title text a class, can be set to display:none is some themes - echo '<br />' . $title . '</td>'; - echo '<td class="quick_menu_tabs">'; - echo '<table cellpadding="0" cellspacing="0" class="quick_menu_tabs"><tr>'; - echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/index.php"><span style="text-decoration:underline;">1</span> ' . _('Main Menu') . '</a></td>'; +$DefaultManualLink = $rootpath . '/doc/Manual/ManualContents.php'. $ViewTopic . $BookMark; - if (count($_SESSION['AllowedPageSecurityTokens'])>1){ - - echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/SelectCustomer.php"><span style="text-decoration:underline;">2</span> ' . _('Customers') . '</a></td>'; - echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/SelectProduct.php"><span style="text-decoration:underline;">3</span> ' . _('Items') . '</a></td>'; - - echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/SelectSupplier.php"><span style="text-decoration:underline;">4</span> ' . _('Suppliers') . '</a></td>'; - - $DefaultManualLink = '<td class="quick_menu_tab" align="center"><a rel="external" accesskey="8" href="' . $rootpath . '/doc/Manual/ManualContents.php'. $ViewTopic . $BookMark. '"><span style="text-decoration:underline;">8</span> ' . _('Manual') . '</a></td>'; - - if (mb_substr($_SESSION['Language'],0,2) !='en'){ - if (file_exists('locale/' . $_SESSION['Language'] . '/Manual/ManualContents.php')){ - echo '<td class="quick_menu_tab" align="center"><a target="_blank" href="' . $rootpath . '/locale/' . $_SESSION['Language'] . '/Manual/ManualContents.php'.$ViewTopic . $BookMark.'"><span style="text-decoration:underline;">8</span> ' . _('Manual') . '</a></td>'; - } else { - echo $DefaultManualLink; - } - } else { - echo $DefaultManualLink; - } - } - echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/Logout.php" onclick="return confirm(\'' . _('Are you sure you wish to logout?') . '\');"><span style="text-decoration:underline;">0</span> ' . _('Logout') . '</a></td>'; - - echo '</tr></table>'; - echo '</td></tr></table>'; - +if (mb_substr($_SESSION['Language'],0,2) !='en'){ + $DeafaulManualLink='locale/' . $_SESSION['Language'] . '/Manual/ManualContents.php'; } -echo '</td>'; -echo '</tr>'; -echo '</table>'; +echo '<div class="title_bar">'; +echo $ProjectName . ' - ' . $title; +echo '<div onClick="CloseSubWindow()" class="exit" title="Close this form">X</div>'; +echo '<div onClick="OpenHelpWindow(\''.$DefaultManualLink.'\'); " class="exit" title="Show help for this function">?</div>'; +echo '</div>'; + ?> \ No newline at end of file Added: trunk/includes/main_footer.inc =================================================================== --- trunk/includes/main_footer.inc (rev 0) +++ trunk/includes/main_footer.inc 2012-06-28 10:03:41 UTC (rev 9066) @@ -0,0 +1,24 @@ +<?php + +/* $Id$*/ + +echo '<table width="100%" id="footer" class="selection">'; + +echo '<tr>'; +echo '<td style="width:33%"></td><td class="footer">'; +echo '<img src="'. $rootpath . '/' . $_SESSION['LogoFile'] . '" width="120" alt="webERP" title="webERP" /></td>'; +echo '<td class="footer" style="text-align: right;width:33%">'.(strftime('%A')).', '.(date($_SESSION['DefaultDateFormat']).' | '.(strftime(($DefaultClock==12) ? '%I:%M %p' : '%H:%M'))).'</td>'; + +echo '</tr>'; + +echo '<tr><td colspan="3" class="footer">webERP v' . $_SESSION['VersionNumber'] .'</td></tr>'; + +// if(http_file_exists('http://sflogo.sourceforge.net/sflogo.php')) { +// echo '<tr><td class="footer"><a href="https://sourceforge.net/projects/weberp"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=391629&type=12" width="120" height="30" border="0" alt="Get webERP web-based ERP Accounting at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a></td></tr>'; +// } + +echo '</table>'; + +echo '</body>'; +echo '</html>'; +?> \ No newline at end of file Added: trunk/includes/main_header.inc =================================================================== --- trunk/includes/main_header.inc (rev 0) +++ trunk/includes/main_header.inc 2012-06-28 10:03:41 UTC (rev 9066) @@ -0,0 +1,84 @@ +<?php +/* $Id$ */ + +// Titles and screen header +// Needs the file config.php loaded where the variables are defined for +// $rootpath +// $title - should be defined in the page this file is included with + +$StrictXHTML=False; + +$ViewTopic = isset($ViewTopic)?"?ViewTopic=$ViewTopic":''; +$BookMark = isset($BookMark)? "#$BookMark":''; +if (!headers_sent()){ + if ($StrictXHTML) { + header('Content-type: application/xhtml+xml; charset=utf-8'); + } else { + header('Content-type: text/html; charset=utf-8'); + } +} +echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; + + +echo '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>' . $title . '</title>'; +echo '<link rel="shortcut icon" href="'. $rootpath.'/favicon.ico" />'; +echo '<link rel="icon" href="' . $rootpath.'/favicon.ico" />'; +if ($StrictXHTML) { + echo '<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />'; +} else { + echo '<meta http-equiv="Content-Type" content="application/html; charset=utf-8" />'; +} +echo '<link href="' . $rootpath . '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />'; +echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/MiscFunctions.js"></script>'; +echo '</head>'; + +echo '<body>'; +echo '<table class="selection" cellpadding="0" cellspacing="0" style="margin-top:3px; width:99%;">'; +echo '<tr>'; +echo '<td colspan="2" rowspan="2">'; + +if (isset($title)) { + echo '<table cellpadding="0" cellspacing="0" border="0" id="quick_menu" class="quick_menu">'; + echo '<tr>'; + echo '<td align="left" style="width:100%;" class="quick_menu_left">'; +// Use icons for company and user data, saves screen realestate, use alt tag in case theme icon not avail. + echo '<img src="'.$rootpath.'/css/'.$theme.'/images/company.png" title="' . _('Company') . '" alt="' . _('Company') . '" style="width: 24px" />'; + echo ' ' . stripslashes($_SESSION['CompanyRecord']['coyname']) . ' <a href="' . $rootpath . '/UserSettings.php"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="User" alt="' . _('User') . '" style="width: 16px" />' . stripslashes($_SESSION['UsersRealName']) . '</a>'; +// Make the title text a class, can be set to display:none is some themes + echo '<br />' . $title . '</td>'; + echo '<td class="quick_menu_tabs">'; + echo '<table cellpadding="0" cellspacing="0" class="quick_menu_tabs"><tr>'; + echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/index.php"><span style="text-decoration:underline;">1</span> ' . _('Main Menu') . '</a></td>'; + + if (count($_SESSION['AllowedPageSecurityTokens'])>1){ + + echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/SelectCustomer.php"><span style="text-decoration:underline;">2</span> ' . _('Customers') . '</a></td>'; + echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/SelectProduct.php"><span style="text-decoration:underline;">3</span> ' . _('Items') . '</a></td>'; + + echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/SelectSupplier.php"><span style="text-decoration:underline;">4</span> ' . _('Suppliers') . '</a></td>'; + + $DefaultManualLink = '<td class="quick_menu_tab" align="center"><a rel="external" accesskey="8" href="' . $rootpath . '/doc/Manual/ManualContents.php'. $ViewTopic . $BookMark. '"><span style="text-decoration:underline;">8</span> ' . _('Manual') . '</a></td>'; + + if (mb_substr($_SESSION['Language'],0,2) !='en'){ + if (file_exists('locale/' . $_SESSION['Language'] . '/Manual/ManualContents.php')){ + echo '<td class="quick_menu_tab" align="center"><a target="_blank" href="' . $rootpath . '/locale/' . $_SESSION['Language'] . '/Manual/ManualContents.php'.$ViewTopic . $BookMark.'"><span style="text-decoration:underline;">8</span> ' . _('Manual') . '</a></td>'; + } else { + echo $DefaultManualLink; + } + } else { + echo $DefaultManualLink; + } + } + echo '<td class="quick_menu_tab" align="center"><a href="' . $rootpath . '/Logout.php" onclick="return confirm(\'' . _('Are you sure you wish to logout?') . '\');"><span style="text-decoration:underline;">0</span> ' . _('Logout') . '</a></td>'; + + echo '</tr></table>'; + echo '</td></tr></table>'; + +} + +echo '</td>'; +echo '</tr>'; +echo '</table>'; + +?> \ No newline at end of file Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/includes/session.inc 2012-06-28 10:03:41 UTC (rev 9066) @@ -73,6 +73,8 @@ $_SESSION['FormID'] = sha1(uniqid(mt_rand(), true)); } +$Messages=array(); + if (!isset($AllowAnyone)){ /* only do security checks if AllowAnyone is not true */ include $PathPrefix . 'includes/UserLogin.php'; /* Login checking and setup */ Modified: trunk/index.php =================================================================== --- trunk/index.php 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/index.php 2012-06-28 10:03:41 UTC (rev 9066) @@ -3,11 +3,15 @@ include('includes/session.inc'); $title=_('Main Menu'); -include('includes/header.inc'); +include('includes/main_header.inc'); +echo '<script type="text/javascript" src = "'.$rootpath.'/javascripts/FormFunctions.js"></script>'; /*The module link codes are hard coded in a switch statement below to determine the options to show for each tab */ include('includes/IndexArray.php'); - +echo '<link href="' . $rootpath . '/css/'. $_SESSION['Theme'] .'/sub.css" rel="stylesheet" type="text/css" />'; +echo '<div id="Mask"></div>'; +echo '<div id="SubWindow"></div>'; +echo '<div id="HelpWindow"></div>'; if ($_SESSION['UserSupplierID']!=''){ echo '<table class="table_index"> <tr> @@ -26,7 +30,7 @@ </td> </tr> </table>'; - include('includes/footer.inc'); + include('includes/main_footer.inc'); exit; } elseif ($_SESSION['UserCustomerID']!=''){ echo '<table class="table_index"> @@ -46,7 +50,7 @@ </td> </tr> </table>'; - include('includes/footer.inc'); + include('includes/main_footer.inc'); exit; } @@ -171,7 +175,7 @@ if ((in_array($PageSecurity, $_SESSION['AllowedPageSecurityTokens']) OR !isset($PageSecurity))) { echo '<tr> <td class="menu_group_item"> - <p>• <a href="' . $rootpath . $MenuItems[$_SESSION['Module']]['Maintenance']['URL'][$i] .'">' . $Caption . '</a></p> + <p>• <a onclick="return OpenSubWindow(\'' . $rootpath . $MenuItems[$_SESSION['Module']]['Maintenance']['URL'][$i] .'\')" href="' . $rootpath . $MenuItems[$_SESSION['Module']]['Maintenance']['URL'][$i] .'">' . $Caption . '</a></p> </td> </tr>'; } @@ -183,7 +187,7 @@ echo '</tr> </table>'; -include('includes/footer.inc'); +include('includes/main_footer.inc'); function GetRptLinks($GroupID) { /* Added: trunk/javascripts/FormFunctions.js =================================================================== --- trunk/javascripts/FormFunctions.js (rev 0) +++ trunk/javascripts/FormFunctions.js 2012-06-28 10:03:41 UTC (rev 9066) @@ -0,0 +1,119 @@ +function MakeFormWriteable(form) { + for(var i=0,fLen=form.length;i<fLen;i++){ + form.elements[i].removeAttribute('disabled','disabled'); + form.elements[i].removeAttribute('readonly','readonly'); + } + return false; +} + +function ChangeButtonText(button, text) { + if (document.getElementById) { + if (button) { + if (button.childNodes[0]) { + button.childNodes[0].nodeValue=text; + } else if (button.value) { + button.value=text; + } else { + button.innerHTML=text; + } + } + } +} + +function SortSelect(selElem) { + var tmpArray = new Array(); + for (var i=0;i<selElem.options.length;i++) { + tmpArray[i] = new Array(); + tmpArray[i][0] = parseInt(selElem.options[i].text); + tmpArray[i][1] = parseInt(selElem.options[i].value); + } + tmpArray.sort(function(a,b){return b-a}); + tmpArray.reverse(); + while (selElem.options.length > 0) { + selElem.options[0] = null; + } + for (var i=0;i<tmpArray.length;i++) { + var op = new Option(tmpArray[i][0], tmpArray[i][1]); + selElem.options[i] = op; + } + return; +} + +function SubmitForm(FormName) { + var Target=FormName.action; + var PostData=''; + for(var i=0,fLen=FormName.length;i<fLen;i++){ + PostData=PostData+FormName.elements[i].name+'='+FormName.elements[i].value+'&'; + } + if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + } else {// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + xmlhttp.onreadystatechange=function() { + if (xmlhttp.readyState==4 && xmlhttp.status==200) { + document.getElementById("SubWindow").innerHTML=xmlhttp.responseText; + } + } + xmlhttp.open("POST",Target,true); + xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + xmlhttp.setRequestHeader("Cache-Control","no-store, no-cache, must-revalidate"); + xmlhttp.setRequestHeader("Pragma","no-cache"); + xmlhttp.send(PostData); + return false; +} + +function OpenSubWindow(TargetURL) { + document.getElementById("Mask").setAttribute("class", "mask"); + document.getElementById("SubWindow").setAttribute("class", "inputbox"); + if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + } else {// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + xmlhttp.onreadystatechange=function() { + if (xmlhttp.readyState==4 && xmlhttp.status==200) { + document.getElementById("SubWindow").innerHTML=xmlhttp.responseText; + } + } + xmlhttp.open("GET",TargetURL,true); + xmlhttp.send(); + return false; +} + +function OpenHelpWindow(TargetURL) { + document.getElementById("Mask").style.zIndex=3; + document.getElementById("HelpWindow").setAttribute("class", "helpbox"); + if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + } else {// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + xmlhttp.onreadystatechange=function() { + if (xmlhttp.readyState==4 && xmlhttp.status==200) { + document.getElementById("HelpWindow").innerHTML=xmlhttp.responseText; + } + } + xmlhttp.open("GET",TargetURL,true); + xmlhttp.send(); + HelpWindow.location.hash = "#AccountGroups"; + return false; +} + +function CloseSubWindow() { + document.getElementById("Mask").setAttribute("class", "unmask"); + document.getElementById("SubWindow").innerHTML=""; + document.getElementById("SubWindow").removeAttribute("class", "inputbox"); +} + +function CloseHelpWindow() { + document.getElementById("Mask").style.zIndex=1; + document.getElementById("HelpWindow").innerHTML=""; + document.getElementById("HelpWindow").removeAttribute("class", "helpbox"); +} + +function CloseDialog() { + document.getElementById("DialogMask").style.zIndex=-1; + document.getElementById("messagebox").innerHTML=""; + document.getElementById("messagebox").removeAttribute("class", "inputbox"); +} \ No newline at end of file Modified: trunk/javascripts/MiscFunctions.js =================================================================== --- trunk/javascripts/MiscFunctions.js 2012-06-26 09:24:09 UTC (rev 9065) +++ trunk/javascripts/MiscFunctions.js 2012-06-28 10:03:41 UTC (rev 9066) @@ -194,6 +194,28 @@ function changeDate(){ isDate(this.value,this.alt); } + +function startTime() +{ +var today=new Date(); +var h=today.getHours(); +var m=today.getMinutes(); +var s=today.getSeconds(); +// add a zero in front of numbers<10 +m=checkTime(m); +s=checkTime(s); +document.getElementById('clock').innerHTML=today.toDateString()+' '+h+":"+m+":"+s; +t=setTimeout('startTime()',500); +} + +function checkTime(i) +{ +if (i<10) + { + i="0" + i; + } +return i; +} function initial(){ if (document.getElementsByTagName){ var as=document.getElementsByTagName("a"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-06-28 10:43:00
|
Revision: 9067 http://weberp.svn.sourceforge.net/weberp/?rev=9067&view=rev Author: tim_schofield Date: 2012-06-28 10:42:49 +0000 (Thu, 28 Jun 2012) Log Message: ----------- More work on new interface Modified Paths: -------------- trunk/AccountSections.php trunk/css/silverwolf/default.css trunk/css/silverwolf/sub.css Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2012-06-28 10:03:41 UTC (rev 9066) +++ trunk/AccountSections.php 2012-06-28 10:42:49 UTC (rev 9067) @@ -8,8 +8,6 @@ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; - // SOME TEST TO ENSURE THAT AT LEAST INCOME AND COST OF SALES ARE THERE $sql= "SELECT sectionid FROM accountsection WHERE sectionid=1"; $result = DB_query($sql,$db); @@ -151,8 +149,6 @@ unset ($_POST['SectionName']); } -if (!isset($_GET['SelectedSectionID']) and !isset($_POST['SelectedSectionID'])) { - /* An account section could be posted when one has been edited and is being updated or GOT when selected for modification SelectedSectionID will exist because it was sent with the page in a GET . @@ -161,46 +157,57 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = "SELECT sectionid, - sectionname - FROM accountsection - ORDER BY sectionid"; +$sql = "SELECT sectionid, + sectionname + FROM accountsection + ORDER BY sectionid"; - $ErrMsg = _('Could not get account group sections because'); - $result = DB_query($sql,$db,$ErrMsg); +$ErrMsg = _('Could not get account group sections because'); +$result = DB_query($sql,$db,$ErrMsg); - echo '<br /><table name="SectionList" class="selection"> +echo '<br /><table name="SectionList" class="selection"> <tr> + <th colspan="4" class="header">' . _('Review Account Sections') . '</th + </tr> + <tr> <th>' . _('Section Number') . '</th> <th>' . _('Section Description') . '</th> </tr>'; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { +$k=0; //row colour counter +while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + + echo '<td>' . $myrow['sectionid'] . '</td><td>' . $myrow['sectionname'] . '</td>'; + if (!isset($_GET['SelectedSectionID']) and !isset($_POST['SelectedSectionID'])) { + echo '<td>'.InternalLink($rootpath, htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedSectionID=' . htmlentities($myrow['sectionid'], ENT_QUOTES,'UTF-8'), _('Edit')).'</td>'; + if ( $myrow['sectionid'] == '1' or $myrow['sectionid'] == '2' ) { + echo '<td><b>'._('Restricted').'</b></td>'; } else { - echo '<tr class="OddTableRows">'; - $k++; + echo '<td>'.InternalLink($rootpath, htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedSectionID=' . htmlentities($myrow['sectionid'], ENT_QUOTES,'UTF-8') . '&delete=1', _('Delete')).'</td>'; } - - echo '<td>' . $myrow['sectionid'] . '</td><td>' . $myrow['sectionname'] . '</td>'; - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedSectionID=' . $myrow['sectionid'] . '">' . _('Edit') . '</a></td>'; + } else { + echo '<td>' . _('Edit') . '</td>'; if ( $myrow['sectionid'] == '1' or $myrow['sectionid'] == '2' ) { echo '<td><b>'._('Restricted').'</b></td>'; } else { - echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?SelectedSectionID=' . $myrow['sectionid'] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td>' . _('Delete') . '</td>'; } - echo '</tr>'; - } //END WHILE LIST LOOP - echo '</table><br />'; -} //end of ifs and buts! + } + echo '</tr>'; +} //END WHILE LIST LOOP +echo '</table><br />'; if (! isset($_GET['delete'])) { - echo '<form method="post" name="AccountSections" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">'; + echo '<form method="post" name="AccountSections" onsubmit="return SubmitForm(this)" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($_GET['SelectedSectionID'])) { @@ -222,7 +229,7 @@ $_POST['SectionName'] = $myrow['sectionname']; echo '<input type="hidden" name="SelectedSectionID" value="' . $_POST['SectionID'] . '" />'; - echo '<br /><table class="selection"> + echo '<table class="selection"> <tr> <th class="header" colspan="2">' . _('Edit Account Section Details') . '</th> </tr> @@ -259,10 +266,6 @@ echo '<tr><td colspan="2"><div class="centre"><button tabindex="3" type="submit" name="submit">' . _('Enter Information') . '</button></div></td></tr>'; echo '</table><br />'; - if (isset($_POST['SelectedSectionID']) or isset($_GET['SelectedSectionID'])) { - echo '<div style="text-align: right"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Review Account Sections') . '</a></div>'; - } - if (!isset($_GET['SelectedSectionID']) or $_GET['SelectedSectionID']=='') { echo '<script>defaultControl(document.AccountSections.SectionID);</script>'; } else { Modified: trunk/css/silverwolf/default.css =================================================================== --- trunk/css/silverwolf/default.css 2012-06-28 10:03:41 UTC (rev 9066) +++ trunk/css/silverwolf/default.css 2012-06-28 10:42:49 UTC (rev 9067) @@ -756,6 +756,7 @@ -moz-box-shadow: 3px 3px 2px #888; -webkit-box-shadow: 3px 3px 2px #888; box-shadow: 3px 3px 3px #888; + visibility: hidden; } div.page_help_text { Modified: trunk/css/silverwolf/sub.css =================================================================== --- trunk/css/silverwolf/sub.css 2012-06-28 10:03:41 UTC (rev 9066) +++ trunk/css/silverwolf/sub.css 2012-06-28 10:42:49 UTC (rev 9067) @@ -64,7 +64,7 @@ left: 20%; padding-left: 4px; padding-right: 4px; - background: #AEDFFF; + background: #DEFFDF; color: #110D75; opacity: 1.00; z-index: 4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |