|
From: <dai...@us...> - 2011-11-06 03:12:40
|
Revision: 4740
http://web-erp.svn.sourceforge.net/web-erp/?rev=4740&view=rev
Author: daintree
Date: 2011-11-06 03:12:31 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
number_formats
Modified Paths:
--------------
trunk/CustLoginSetup.php
trunk/CustWhereAlloc.php
trunk/CustomerTransInquiry.php
trunk/DebtorsAtPeriodEnd.php
trunk/DiscountMatrix.php
trunk/EDIMessageFormat.php
trunk/Factors.php
trunk/FixedAssetCategories.php
trunk/FixedAssetDepreciation.php
trunk/FixedAssetItems.php
trunk/FixedAssetLocations.php
trunk/FixedAssetRegister.php
trunk/SuppLoginSetup.php
trunk/Z_BottomUpCosts.php
trunk/Z_ChangeBranchCode.php
trunk/Z_ChangeCustomerCode.php
trunk/Z_ChangeStockCategory.php
trunk/Z_ChangeStockCode.php
trunk/Z_CheckAllocationsFrom.php
trunk/Z_CheckAllocs.php
trunk/Z_CheckDebtorsControl.php
trunk/Z_CheckGLTransBalance.php
trunk/Z_CopyBOM.php
trunk/Z_CreateCompany.php
trunk/Z_CurrencyDebtorsBalances.php
trunk/Z_CurrencySuppliersBalances.php
trunk/Z_DeleteSalesTransActions.php
Modified: trunk/CustLoginSetup.php
===================================================================
--- trunk/CustLoginSetup.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/CustLoginSetup.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -8,6 +8,16 @@
include('includes/SQL_CommonFunctions.inc');
include ('includes/LanguagesArray.php');
+
+if (!isset($_SESSION['CustomerID'])){
+ echo '<br />
+ <br />';
+ prnMsg(_('A customer must first be selected before logins can be defined for it') . '<br /><br /><a href="' . $rootpath . '/SelectCustomer.php">' . _('Select A Customer') . '</a>','info');
+ include('includes/footer.inc');
+ exit;
+}
+
+
echo '<a href="' . $rootpath . '/SelectCustomer.php">' . _('Back to Customers') . '</a><br />';
$sql="SELECT name
@@ -20,7 +30,8 @@
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') .
'" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName. _(' has been selected') .
- '</p><br />';
+ '</p>
+ <br />';
if (isset($_POST['submit'])) {
@@ -246,11 +257,11 @@
foreach ($LanguagesArray as $LanguageEntry => $LanguageName){
if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){
- echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>';
- } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) {
- echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>';
+ echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>';
+ } elseif (!isset($_POST['UserLanguage']) AND $LanguageEntry == $DefaultLanguage) {
+ echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>';
} else {
- echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>';
+ echo '<option value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>';
}
}
echo '</select></td>
Modified: trunk/CustWhereAlloc.php
===================================================================
--- trunk/CustWhereAlloc.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/CustWhereAlloc.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -6,7 +6,7 @@
$title = _('Customer How Paid Inquiry');
include('includes/header.inc');
-echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>';
+echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text">
@@ -96,7 +96,7 @@
echo '<tr>
<th colspan="6">
<div class="centre">
- <font size=3 color=blue><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] . '<br />'._('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</font></b>
+ <font size=3 color="blue"><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] . '<br />'._('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</font></b>
</div>
</th>
</tr>';
Modified: trunk/CustomerTransInquiry.php
===================================================================
--- trunk/CustomerTransInquiry.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/CustomerTransInquiry.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -51,15 +51,15 @@
echo '<td>' . _('From') . ':</td>
<td><input tabindex="2" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td>
<td>' . _('To') . ':</td>
- <td><input tabindex="3" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td>';
+ <td><input tabindex="3" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" type="text" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td>
+ </tr>
+ </table>
+ <br />
+ <div class="centre">
+ <input tabindex="4" type="submit" name="ShowResults" value="' . _('Show Transactions') . '" />
+ </div>
+ </form>';
-echo '</tr></table>
- <br />
- <div class="centre">
- <input tabindex="4" type="submit" name="ShowResults" value="' . _('Show Transactions') . '">
- </div>
- </form>';
-
if (isset($_POST['ShowResults']) && $_POST['TransType'] != ''){
$SQL_FromDate = FormatDateForSQL($_POST['FromDate']);
$SQL_ToDate = FormatDateForSQL($_POST['ToDate']);
Modified: trunk/DebtorsAtPeriodEnd.php
===================================================================
--- trunk/DebtorsAtPeriodEnd.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/DebtorsAtPeriodEnd.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -133,13 +133,16 @@
<table class="selection">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo '<tr><td>' . _('From Customer Code') .':</font></td>
+ echo '<tr>
+ <td>' . _('From Customer Code') .':</font></td>
<td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1" /></td>
- </tr>';
- echo '<tr><td>' . _('To Customer Code') . ':</td>
- <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td></tr>';
-
- echo '<tr><td>' . _('Balances As At') . ':</td>
+ </tr>
+ <tr>
+ <td>' . _('To Customer Code') . ':</td>
+ <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Balances As At') . ':</td>
<td><select tabindex="3" name="PeriodEnd">';
$sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC";
@@ -152,9 +155,14 @@
}
}
- echo '</select></td></tr>';
- echo '</table>
- <br /><div class="centre"><input tabindex=5 type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>';
+ echo '</select></td>
+ </tr>
+ </table>
+ <br />
+ <div class="centre">
+ <input tabindex="5" type="submit" name="PrintPDF" value="' . _('Print PDF') . '" />
+ </div>
+ </form>';
include('includes/footer.inc');
} /*end of else not PrintPDF */
Modified: trunk/DiscountMatrix.php
===================================================================
--- trunk/DiscountMatrix.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/DiscountMatrix.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -20,26 +20,26 @@
//initialise no input errors assumed initially before we test
$InputError = 0;
- if (!is_numeric($_POST['QuantityBreak'])){
+ if (!is_numeric(filter_number_format($_POST['QuantityBreak']))){
prnMsg( _('The quantity break must be entered as a positive number'),'error');
$InputError =1;
$Errors[$i] = 'QuantityBreak';
$i++;
}
- if ($_POST['QuantityBreak']<=0){
+ if (filter_number_format($_POST['QuantityBreak'])<=0){
prnMsg( _('The quantity of all items on an order in the discount category') . ' ' . $_POST['DiscountCategory'] . ' ' . _('at which the discount will apply is 0 or less than 0') . '. ' . _('Positive numbers are expected for this entry'),'warn');
$InputError =1;
$Errors[$i] = 'QuantityBreak';
$i++;
}
- if (!is_numeric($_POST['DiscountRate'])){
+ if (!is_numeric(filter_number_format($_POST['DiscountRate']))){
prnMsg( _('The discount rate must be entered as a positive number'),'warn');
$InputError =1;
$Errors[$i] = 'DiscountRate';
$i++;
}
- if ($_POST['DiscountRate']<=0 OR $_POST['DiscountRate']>=70){
+ if (filter_number_format($_POST['DiscountRate'])<=0 OR filter_number_format($_POST['DiscountRate'])>=70){
prnMsg( _('The discount rate applicable for this record is either less than 0% or greater than 70%') . '. ' . _('Numbers between 1 and 69 are expected'),'warn');
$InputError =1;
$Errors[$i] = 'DiscountRate';
@@ -57,8 +57,8 @@
discountrate)
VALUES('" . $_POST['SalesType'] . "',
'" . $_POST['DiscountCategory'] . "',
- '" . $_POST['QuantityBreak'] . "',
- '" . ($_POST['DiscountRate']/100) . "')";
+ '" . filter_number_format($_POST['QuantityBreak']) . "',
+ '" . (filter_number_format($_POST['DiscountRate'])/100) . "')";
$result = DB_query($sql,$db);
prnMsg( _('The discount matrix record has been added'),'success');
@@ -111,8 +111,9 @@
$sql = "SELECT DISTINCT discountcategory FROM stockmaster WHERE discountcategory <>''";
$result = DB_query($sql, $db);
if (DB_num_rows($result) > 0) {
- echo '<tr><td>'. _('Discount Category Code') .': </td>';
- echo '<td><select name="DiscountCategory">';
+ echo '<tr>
+ <td>'. _('Discount Category Code') .': </td>
+ <td><select name="DiscountCategory">';
while ($myrow = DB_fetch_array($result)){
if ($myrow['discountcategory']==$_POST['DiscCat']){
@@ -123,18 +124,24 @@
}
echo '</select></td>';
} else {
- echo '<input type="hidden" name="DiscountCategory" value="">';
+ echo '<input type="hidden" name="DiscountCategory" value="" />';
}
-echo '<tr><td>' . _('Quantity Break') . '</td>
- <td><input class="number" tabindex=3 ' . (in_array('QuantityBreak',$Errors) ? 'class="inputerror"' : '') .' type="text" name="QuantityBreak" size=10 maxlength=10></td></tr>';
+echo '<tr>
+ <td>' . _('Quantity Break') . '</td>
+ <td><input class="number" tabindex=3 ' . (in_array('QuantityBreak',$Errors) ? 'class="inputerror"' : '') .' type="text" name="QuantityBreak" size="10" maxlength="10" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Discount Rate') . ' (%):</td>
+ <td><input class="number" tabindex=4 ' . (in_array('DiscountRate',$Errors) ? 'class="inputerror"' : '') . 'type="text" name="DiscountRate" size="5" maxlength="5" /></td>
+ </tr>
+ </table>
+ <br />
+ <div class="centre">
+ <input tabindex=5 type="submit" name="submit" value="' . _('Enter Information') . '">
+ </div>
+ <br />';
-echo '<tr><td>' . _('Discount Rate') . ' (%):</td>
- <td><input class="number" tabindex=4 ' . (in_array('DiscountRate',$Errors) ? 'class="inputerror"' : '') . 'type="text" name="DiscountRate" size=11 maxlength=14></td></tr>';
-echo '</table><br />';
-
-echo '<div class="centre"><input tabindex=5 type="submit" name="submit" value="' . _('Enter Information') . '"></div><br />';
-
$sql = "SELECT sales_type,
salestype,
discountcategory,
@@ -169,22 +176,21 @@
$DeleteURL = htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&DiscountCategory=' . $myrow['discountcategory'] . '&QuantityBreak=' . $myrow['quantitybreak'];
printf('<td>%s</td>
- <td>%s</td>
- <td class="number">%s</td>
- <td class="number">%s</td>
- <td><a href="%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this discount matrix record?') . '\');">' . _('Delete') . '</td>
- </tr>',
- $myrow['sales_type'],
- $myrow['discountcategory'],
- $myrow['quantitybreak'],
- $myrow['discountrate']*100 ,
- $DeleteURL);
+ <td>%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td><a href="%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this discount matrix record?') . '\');">' . _('Delete') . '</td>
+ </tr>',
+ $myrow['sales_type'],
+ $myrow['discountcategory'],
+ $myrow['quantitybreak'],
+ $myrow['discountrate']*100 ,
+ $DeleteURL);
}
-echo '</table>';
+echo '</table>
+ </form>';
-echo '</form>';
-
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/EDIMessageFormat.php
===================================================================
--- trunk/EDIMessageFormat.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/EDIMessageFormat.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -45,7 +45,7 @@
}
$InputError = 0;
-if ($InputError !=1 and isset($_POST['update'])) {
+if ($InputError !=1 AND isset($_POST['update'])) {
/*SelectedMessageLine 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*/
if (!isset($SelectedMessageLine)) {
@@ -62,7 +62,7 @@
$msg = _('Message line updated');
unset ($SelectedMessageLine);
-} elseif ($InputError !=1 and isset($_POST['submit'])) {
+} elseif ($InputError !=1 AND isset($_POST['submit'])) {
/*Selected group is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new message line form */
@@ -123,8 +123,8 @@
$result = DB_query($sql,$db);
- echo '<table class=selection>';
- echo '<tr><th colspan=5><font size=3>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode.'</font></th></tr>';
+ echo '<table class="selection">';
+ echo '<tr><th colspan="5"><font size=3>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode.'</font></th></tr>';
$TableHeader = '<tr>
<th>' . _('Section') . '</th>
<th>' . _('Sequence') . '</th>
@@ -161,8 +161,10 @@
} //END WHILE LIST LOOP
echo '</table><p>';
if (DB_num_rows($result)==0){
- echo '<div class="centre"><input tabindex=1 type=submit name="NewEDIInvMsg" value="' .
- _('Create New EDI Invoice Message From Default Template') . '"></div><br />';
+ echo '<div class="centre">
+ <input tabindex=1 type=submit name="NewEDIInvMsg" value="' . _('Create New EDI Invoice Message From Default Template') . '" />
+ </div>
+ <br />';
}
} //end of ifs SelectedLine is not set
@@ -183,19 +185,18 @@
$result = DB_query($sql, $db);
$myrow = DB_fetch_array($result);
-
$_POST['Section'] = $myrow['section'];
$_POST['SequenceNo'] = $myrow['sequenceno'];
$_POST['LineText'] = $myrow['linetext'];
echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?MessageType=INVOIC&PartnerCode=' . $myrow['partnercode'] . '">' . _('Review Message Lines') . '</a></div>';
- echo '<input type=hidden name="SelectedMessageLine" VALUE="' . $SelectedMessageLine . '">';
- echo '<input type=hidden name="MessageType" VALUE="' . $myrow['messagetype'] . '">';
- echo '<input type=hidden name="PartnerCode" VALUE="' . $myrow['partnercode'] . '">';
+ echo '<input type="hidden" name="SelectedMessageLine" value="' . $SelectedMessageLine . '" />';
+ echo '<input type="hidden" name="MessageType" value="' . $myrow['messagetype'] . '" />';
+ echo '<input type="hidden" name="PartnerCode" value="' . $myrow['partnercode'] . '" />';
} else { //end of if $SelectedMessageLine only do the else when a new record is being entered
- echo '<input type=hidden name="MessageType" VALUE="' . $MessageType . '">';
- echo '<input type=hidden name="PartnerCode" VALUE="' . $PartnerCode . '">';
+ echo '<input type="hidden" name="MessageType" value="' . $MessageType . '" />';
+ echo '<input type="hidden" name="PartnerCode" value="' . $PartnerCode . '" />';
}
echo '<table class=selection>';
@@ -209,18 +210,18 @@
echo '<select tabindex=2 name="Section">';
if ($_POST['Section']=='Heading') {
- echo '<option selected VALUE="Heading">' . _('Heading') . '</option>';
+ echo '<option selected value="Heading">' . _('Heading') . '</option>';
} else {
echo '<option value="Heading">' . _('Heading') . '</option>';
}
-if (isset($_POST['Section']) and $_POST['Section']=='Detail') {
- echo '<option selected VALUE="Detail">' . _('Detail') . '</option>';
+if (isset($_POST['Section']) AND $_POST['Section']=='Detail') {
+ echo '<option selected value="Detail">' . _('Detail') . '</option>';
} else {
echo '<option value="Detail">' . _('Detail') . '</option>';
}
-if (isset($_POST['Section']) and $_POST['Section']=='Summary') {
- echo '<option selected VALUE="Summary">' . _('Summary') . '</option>';
+if (isset($_POST['Section']) AND $_POST['Section']=='Summary') {
+ echo '<option selected value="Summary">' . _('Summary') . '</option>';
} else {
echo '<option value="Summary">' . _('Summary') . '</option>';
}
@@ -234,17 +235,17 @@
echo '</td></tr>';
echo '<tr><td>Sequence Number:</td>';
-echo '<td><input tabindex=3 type="text" name=SequenceNo size=3 maxlength=3 value='.$_POST['SequenceNo'].'>';
+echo '<td><input tabindex=3 type="text" name=SequenceNo size=3 maxlength=3 value='.$_POST['SequenceNo'].' />';
echo '</td></tr>';
echo '<tr><td>' . _('Line Text') . ':' .'</td>';
echo '<td>';
-echo '<input tabindex=4 type="Text" name="LineText" size=50 maxlength=50 VALUE='.$_POST['LineText'] .'>';
+echo '<input tabindex=4 type="text" name="LineText" size=50 maxlength=50 value='.$_POST['LineText'] .' />';
echo '</td></tr>';
echo '</table><br />';
if (isset($_GET['SelectedMessageLine'])) {
- echo '<div class="centre"><input tabindex=5 type="submit" name="update" value="'. _('Update Information'). '"></div>';
+ echo '<div class="centre"><input tabindex=5 type="submit" name="update" value="'. _('Update Information'). '" /></div>';
} else {
- echo '<div class="centre"><input tabindex=5 type="submit" name="submit" value="'. _('Enter Information'). '"></div>';
+ echo '<div class="centre"><input tabindex=5 type="submit" name="submit" value="'. _('Enter Information'). '" /></div>';
}
echo '</form>';
Modified: trunk/Factors.php
===================================================================
--- trunk/Factors.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/Factors.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -33,7 +33,7 @@
if (isset($_POST['Submit']) OR isset($_POST['Update'])) {
- if (mb_strlen($_POST['FactorName']) > 40 or mb_strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') {
+ if (mb_strlen($_POST['FactorName']) > 40 OR mb_strlen($_POST['FactorName']) == 0 OR $_POST['FactorName'] == '') {
$InputError = 1;
prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error');
}
@@ -49,7 +49,7 @@
}
/* If no input errors have been recieved */
- if ($InputError == 0 and isset($_POST['Submit'])){
+ if ($InputError == 0 AND isset($_POST['Submit'])){
//And if its not a new part then update existing one
$sql = "INSERT INTO factorcompanies (id,
@@ -65,7 +65,7 @@
fax,
email)
VALUES (null,
- '" .$_POST['FactorName'] . "',
+ '" . $_POST['FactorName'] . "',
'" . $_POST['Address1'] . "',
'" . $_POST['Address2'] . "',
'" . $_POST['Address3'] . "',
@@ -199,45 +199,74 @@
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo '<input type="hidden" name="FactorID" value="' . $FactorID .'">';
- echo '<table class=selection>';
- echo '<input type="hidden" name="New" value="Yes">';
- echo '<tr><td>' . _('Factor company Name') . ':</td>
- <td><input tabindex=1 type="text" name="FactorName" size=42 maxlength=40 value="' .$_POST['FactorName'].'"></td></tr>';
- echo '<tr><td>' . _('Address Line 1') . ':</td>
- <td><input tabindex=2 type="text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] .'"></td></tr>';
- echo '<tr><td>' . _('Address Line 2') . ':</td>
- <td><input tabindex=3 type="text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] .'"></td></tr>';
- echo '<tr><td>' . _('Address Line 3') . ':</td>
- <td><input tabindex=4 type="text" name="Address3" size=42 maxlength=40 value="' .$_POST['Address3'] .'"></td></tr>';
- echo '<tr><td>' . _('Address Line 4') . ':</td>
- <td><input tabindex=5 type="text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'].'"></td></tr>';
- echo '<tr><td>' . _('Address Line 5') . ':</td>
- <td><input tabindex=6 type="text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] .'"></td></tr>';
- echo '<tr><td>' . _('Address Line 6') . ':</td>
- <td><input tabindex=7 type="text" name="Address6" size=42 maxlength=40 value="' .$_POST['Address6'] . '"></td></tr>';
- echo '<tr><td>' . _('Contact Name') . ':</td>
- <td><input tabindex=8 type="text" name="ContactName" size=13 maxlength=25 value="' . $_POST['ContactName'] .'"></td></tr>';
- echo '<tr><td>' . _('Telephone') . ':</td>
- <td><input tabindex=9 type="text" name="Telephone" size=13 maxlength=25 value="' .$_POST['Telephone'].'"></td></tr>';
- echo '<tr><td>' . _('Fax') . ':</td>
- <td><input tabindex=10 type="text" name="Fax" value=0 size=13 maxlength=25 value="' . $_POST['Fax'] .'"></td></tr>';
- echo '<tr><td>' . _('Email') . ':</td>
- <td><input tabindex=11 type="text" name="Email" size=55 maxlength=55 value="' . $_POST['Email'] . '"></td></tr>';
- echo '</form>';
+ echo '<input type="hidden" name="FactorID" value="' . $FactorID .'" />
+ <table class=selection>
+ <input type="hidden" name="New" value="Yes" />
+ <tr>
+ <td>' . _('Factor company Name') . ':</td>
+ <td><input tabindex="1" type="text" name="FactorName" size="42" maxlength="40" value="' .$_POST['FactorName'].'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 1') . ':</td>
+ <td><input tabindex=2 type="text" name="Address1" size="42" maxlength="40" value="' . $_POST['Address1'] .'" /></td>
+ </tr>
+ <tr><td>' . _('Address Line 2') . ':</td>
+ <td><input tabindex=3 type="text" name="Address2" size="42" maxlength="40" value="' . $_POST['Address2'] .'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 3') . ':</td>
+ <td><input tabindex=4 type="text" name="Address3" size="42" maxlength="40" value="' .$_POST['Address3'] .'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 4') . ':</td>
+ <td><input tabindex=5 type="text" name="Address4" size="42" maxlength="40" value="' . $_POST['Address4'].'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 5') . ':</td>
+ <td><input tabindex="6" type="text" name="Address5" size="42" maxlength="40" value="' . $_POST['Address5'] .'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 6') . ':</td>
+ <td><input tabindex="7" type="text" name="Address6" size="42" maxlength="40" value="' .$_POST['Address6'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Contact Name') . ':</td>
+ <td><input tabindex="8" type="text" name="ContactName" size="20" maxlength="25" value="' . $_POST['ContactName'] .'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Telephone') . ':</td>
+ <td><input tabindex="9" type="text" name="Telephone" size="20" maxlength="25" value="' .$_POST['Telephone'].'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Fax') . ':</td>
+ <td><input tabindex="10" type="text" name="Fax" value=0 size="20" maxlength="25" value="' . $_POST['Fax'] .'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Email') . ':</td>
+ <td><input tabindex="11" type="text" name="Email" size="55" maxlength=55 value="' . $_POST['Email'] . '" /></td>
+ </tr>
+ </table>';
}
if (isset($_POST['Create'])) {
- echo '</table><p><div class="centre"><input tabindex=12 type="submit" name="Submit" value="' . _('Insert New Factor') . '"></div>';
+ echo '<p>
+ <div class="centre">
+ <input tabindex="12" type="submit" name="Submit" value="' . _('Insert New Factor') . '" />
+ </div>
+ </form>';
} else if (isset($_POST['Amend'])) {
- echo '</table>
- <p><div class="centre"><input tabindex=13 type="submit" name="Update" value="' . _('Update Factor') . '"><p>';
- prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn');
- echo '<p><input tabindex=14 type="submit" name="Delete" value="' . _('Delete Factor') . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this factoring company?') . '\');"></form></div>';
+ echo '<p>
+ <div class="centre">
+ <input tabindex="13" type="submit" name="Update" value="' . _('Update Factor') . '" />
+ <p>';
+ prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn');
+ echo '<p>
+ <input tabindex="14" type="submit" name="Delete" value="' . _('Delete Factor') . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this factoring company?') . '\');" />
+ </div>
+ </form>';
}
-
/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the
option to create a new one*/
@@ -247,7 +276,7 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<input type="hidden" name="New" value="No">';
- echo '<table class=selection>
+ echo '<table class="selection">
<tr>
<th>' . _('ID') . '</th>
<th>' . _('Company Name').'</th>
@@ -299,13 +328,14 @@
<td>' . $myrow['email'].'</td>
<td><a href="'.$rootpath . '/Factors.php?FactorID='.$myrow['id'].'">'._('Edit').'</a></td>
</tr>';
- }
- echo '</table><p><div class="centre">';
- echo '<br /><input tabindex=3 type="submit" name="Create" value="' . _('Create New Factor') . '">';
- echo '</div></form>';
- include('includes/footer.inc');
- exit;
-
+ } //end while loop
+ echo '</table>
+ <p>
+ <div class="centre">
+ <br />
+ <input tabindex="3" type="submit" name="Create" value="' . _('Create New Factor') . '" />
+ </div>
+ </form>';
}
include('includes/footer.inc');
Modified: trunk/FixedAssetCategories.php
===================================================================
--- trunk/FixedAssetCategories.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/FixedAssetCategories.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -8,8 +8,10 @@
include('includes/header.inc');
-echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' .
- _('Fixed Asset Categories') . '" alt="" />' . ' ' . $title . '</p>';
+echo '<div class="centre">
+ <p class="page_title_text">
+ <img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Fixed Asset Categories') . '" alt="" />' . ' ' . $title . '
+ </p>';
if (isset($_GET['SelectedCategory'])){
$SelectedCategory = mb_strtoupper($_GET['SelectedCategory']);
@@ -41,11 +43,12 @@
}
if ($_POST['CostAct'] == $_SESSION['CompanyRecord']['debtorsact']
- OR $_POST['CostAct'] == $_SESSION['CompanyRecord']['creditorsact']
- OR $_POST['AccumDepnAct'] == $_SESSION['CompanyRecord']['debtorsact']
- OR $_POST['AccumDepnAct'] == $_SESSION['CompanyRecord']['creditorsact']
- OR $_POST['CostAct'] == $_SESSION['CompanyRecord']['grnact']
- OR $_POST['AccumDepnAct'] == $_SESSION['CompanyRecord']['grnact']){
+ OR $_POST['CostAct'] == $_SESSION['CompanyRecord']['creditorsact']
+ OR $_POST['AccumDepnAct'] == $_SESSION['CompanyRecord']['debtorsact']
+ OR $_POST['AccumDepnAct'] == $_SESSION['CompanyRecord']['creditorsact']
+ OR $_POST['CostAct'] == $_SESSION['CompanyRecord']['grnact']
+ OR $_POST['AccumDepnAct'] == $_SESSION['CompanyRecord']['grnact']){
+
prnMsg(_('The accounts selected to post cost or accumulated depreciation to cannot be either of the debtors control account, creditors control account or GRN suspense accounts'),'error');
$InputError =1;
}
@@ -62,12 +65,12 @@
$i++;
}
if (in_array($_POST['CostAct'], $BankAccounts)) {
- prnMsg( _('The asset cost account selected is a bank account - bank accounts are protected from having any other postings made to them. Select another balance sheet account for the asset cost'),'error');
- $InputError =1;
+ prnMsg(_('The asset cost account selected is a bank account - bank accounts are protected from having any other postings made to them. Select another balance sheet account for the asset cost'),'error');
+ $InputError=1;
}
if (in_array($_POST['AccumDepnAct'], $BankAccounts)) {
prnMsg( _('The accumulated depreciation account selected is a bank account - bank accounts are protected from having any other postings made to them. Select another balance sheet account for the asset accumulated depreciation'),'error');
- $InputError =1;
+ $InputError=1;
}
if (isset($SelectedCategory) AND $InputError !=1) {
@@ -76,13 +79,14 @@
would not run in this case cos submit is false of course see the
delete code below*/
- $sql = "UPDATE fixedassetcategories SET
- categorydescription = '" . $_POST['CategoryDescription'] . "',
- costact = '" . $_POST['CostAct'] . "',
- depnact = '" . $_POST['DepnAct'] . "',
- disposalact = '" . $_POST['DisposalAct'] . "',
- accumdepnact = '" . $_POST['AccumDepnAct'] . "'
- WHERE categoryid = '".$SelectedCategory . "'";
+ $sql = "UPDATE fixedassetcategories
+ SET categorydescription = '" . $_POST['CategoryDescription'] . "',
+ costact = '" . $_POST['CostAct'] . "',
+ depnact = '" . $_POST['DepnAct'] . "',
+ disposalact = '" . $_POST['DisposalAct'] . "',
+ accumdepnact = '" . $_POST['AccumDepnAct'] . "'
+ WHERE categoryid = '".$SelectedCategory . "'";
+
$ErrMsg = _('Could not update the fixed asset category') . $_POST['CategoryDescription'] . _('because');
$result = DB_query($sql,$db,$ErrMsg);
@@ -91,11 +95,11 @@
} elseif ($InputError !=1) {
$sql = "INSERT INTO fixedassetcategories (categoryid,
- categorydescription,
- costact,
- depnact,
- disposalact,
- accumdepnact)
+ categorydescription,
+ costact,
+ depnact,
+ disposalact,
+ accumdepnact)
VALUES ('" . $_POST['CategoryID'] . "',
'" . $_POST['CategoryDescription'] . "',
'" . $_POST['CostAct'] . "',
@@ -227,16 +231,23 @@
$_POST['DisposalAct'] = $myrow['disposalact'];
$_POST['AccumDepnAct'] = $myrow['accumdepnact'];
- echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">';
- echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '">';
- echo '<table class=selection><tr><td>' . _('Category Code') . ':</td><td>' . $_POST['CategoryID'] . '</td></tr>';
+ echo '<input type="hidden" name="SelectedCategory" value="' . $SelectedCategory . '" />';
+ echo '<input type="hidden" name="CategoryID" value="' . $_POST['CategoryID'] . '" />';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('Category Code') . ':</td>
+ <td>' . $_POST['CategoryID'] . '</td>
+ </tr>';
} else { //end of if $SelectedCategory only do the else when a new record is being entered
if (!isset($_POST['CategoryID'])) {
$_POST['CategoryID'] = '';
}
- echo '<table class=selection><tr><td>' . _('Category Code') . ':</td>
- <td><input type="Text" name="CategoryID" size=7 maxlength=6 value="' . $_POST['CategoryID'] . '"></td></tr>';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('Category Code') . ':</td>
+ <td><input type="text" name="CategoryID" size="7" maxlength="6" value="' . $_POST['CategoryID'] . '" /></td>
+ </tr>';
}
//SQL to poulate account selection boxes
@@ -262,13 +273,14 @@
$_POST['CategoryDescription'] = '';
}
-echo '<tr><td>' . _('Category Description') . ':</td>
- <td><input type="Text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '"></td></tr>';
+echo '<tr>
+ <td>' . _('Category Description') . ':</td>
+ <td><input type="text" name="CategoryDescription" size="22" maxlength="20" value="' . $_POST['CategoryDescription'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Fixed Asset Cost GL Code') . ':</td>
+ <td><select name="CostAct">';
-echo '<tr><td>' . _('Fixed Asset Cost GL Code');
-
-echo ':</td><td><select name="CostAct">';
-
while ($myrow = DB_fetch_array($BSAccountsResult)){
if (isset($_POST['CostAct']) and $myrow['accountcode']==$_POST['CostAct']) {
@@ -277,9 +289,10 @@
echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>';
}
} //end while loop
-echo '</select></td></tr>';
-
-echo '<tr><td>' . _('Profit and Loss Depreciation GL Code') . ':</td>
+echo '</select></td>
+ </tr>
+ <tr>
+ <td>' . _('Profit and Loss Depreciation GL Code') . ':</td>
<td><select name="DepnAct">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
@@ -289,10 +302,13 @@
echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>';
}
} //end while loop
-echo '</select></td></tr>';
+echo '</select></td>
+ </tr>';
DB_data_seek($PnLAccountsResult,0);
-echo '<tr><td>' . _('Profit or Loss on Disposal GL Code:') . '</td><td><select name="DisposalAct">';
+echo '<tr>
+ <td>' . _('Profit or Loss on Disposal GL Code:') . '</td>
+ <td><select name="DisposalAct">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
if (isset($_POST['DisposalAct']) and $myrow['accountcode']==$_POST['DisposalAct']) {
echo '<option selected value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>';
@@ -300,11 +316,13 @@
echo '<option value='.$myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')' . '</option>';
}
} //end while loop
-echo '</select></td></tr>';
+echo '</select></td>
+ </tr>';
-
DB_data_seek($BSAccountsResult,0);
-echo '<tr><td>' . _('Balance Sheet Accumulated Depreciation GL Code') . ':</td><td><select name="AccumDepnAct">';
+echo '<tr>
+ <td>' . _('Balance Sheet Accumulated Depreciation GL Code') . ':</td>
+ <td><select name="AccumDepnAct">';
while ($myrow = DB_fetch_array($BSAccountsResult)) {
@@ -317,11 +335,15 @@
} //end while loop
-echo '</select></td></tr></table><br />';
+echo '</select></td>
+ </tr>
+ </table>
+ <br />';
-echo '<div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>';
+echo '<div class="centre">
+ <input type="Submit" name="submit" value="' . _('Enter Information') . '" />
+ </div>
+ </form>';
-echo '</form>';
-
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/FixedAssetDepreciation.php
===================================================================
--- trunk/FixedAssetDepreciation.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/FixedAssetDepreciation.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -66,6 +66,7 @@
fixedassetcategories.depnact,
fixedassetcategories.categorydescription
ORDER BY assetcategoryid, assetid";
+
$AssetsResult=DB_query($sql, $db);
$InputError = false; //always hope for the best
@@ -80,7 +81,8 @@
}
echo '<p></p><table>';
-$Heading = '<tr><th>' . _('Asset ID') . '</th>
+$Heading = '<tr>
+ <th>' . _('Asset ID') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Date Purchased') . '</th>
<th>' . _('Cost') . '</th>
@@ -97,6 +99,10 @@
$TotalCost =0;
$TotalAccumDepn=0;
$TotalDepn = 0;
+$TotalCategoryCost = 0;
+$TotalCategoryAccumDepn =0;
+$TotalCategoryDepn = 0;
+
$RowCounter = 0;
$k=0;
@@ -111,7 +117,9 @@
<th class="number">' . locale_number_format($TotalCategoryDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
</tr>';
}
- echo '<tr><th colspan=9 align="left">' . $AssetRow['categorydescription'] . '</th></tr>';
+ echo '<tr>
+ <th colspan="9" align="left">' . $AssetRow['categorydescription'] . '</th>
+ </tr>';
$AssetCategoryDescription = $AssetRow['categorydescription'];
$TotalCategoryCost = 0;
$TotalCategoryAccumDepn =0;
@@ -161,7 +169,9 @@
$TotalAccumDepn +=$AssetRow['depnbfwd'];
$TotalDepn +=$NewDepreciation;
- if (isset($_POST['CommitDepreciation']) AND $NewDepreciation !=0 AND $InputError==false){
+ if (isset($_POST['CommitDepreciation'])
+ AND $NewDepreciation !=0
+ AND $InputError==false){
//debit depreciation expense
$SQL = "INSERT INTO gltrans (type,
@@ -178,9 +188,11 @@
'" . $AssetRow['depnact'] . "',
'" . $AssetRow['assetid'] . "',
'" . $NewDepreciation ."')";
+
$ErrMsg = _('Cannot insert a depreciation GL entry for the depreciation because');
$DbgMsg = _('The SQL that failed to insert the GL Trans record was');
$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
+
$SQL = "INSERT INTO gltrans (type,
typeno,
trandate,
@@ -226,22 +238,26 @@
$Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true);
} //end if Committing the depreciation to DB
} //end loop around the assets to calculate depreciation for
-echo '<tr><th colspan=3 align="right">' . _('Total for') . ' ' . $AssetCategoryDescription . ' </th>
- <th class="number">' . locale_number_format($TotalCategoryCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- <th class="number">' . locale_number_format($TotalCategoryAccumDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- <th class="number">' . locale_number_format(($TotalCategoryCost-$TotalCategoryAccumDepn),$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- <th colspan=2></th>
- <th class="number">' . locale_number_format($TotalCategoryDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- </tr>';
-echo '<tr><th colspan=3 align="right">' . _('GRAND Total') . ' </th>
- <th class="number">' . locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- <th class="number">' . locale_number_format($TotalAccumDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- <th class="number">' . locale_number_format(($TotalCost-$TotalAccumDepn),$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- <th colspan=2></th>
- <th class="number">' . locale_number_format($TotalDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
- </tr>';
+echo '<tr>
+ <th colspan="3" align="right">' . _('Total for') . ' ' . $AssetCategoryDescription . ' </th>
+ <th class="number">' . locale_number_format($TotalCategoryCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ <th class="number">' . locale_number_format($TotalCategoryAccumDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ <th class="number">' . locale_number_format(($TotalCategoryCost-$TotalCategoryAccumDepn),$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ <th colspan="2"></th>
+ <th class="number">' . locale_number_format($TotalCategoryDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ </tr>
+ <tr>
+ <th colspan="3" align="right">' . _('GRAND Total') . ' </th>
+ <th class="number">' . locale_number_format($TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ <th class="number">' . locale_number_format($TotalAccumDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ <th class="number">' . locale_number_format(($TotalCost-$TotalAccumDepn),$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ <th colspan="2"></th>
+ <th class="number">' . locale_number_format($TotalDepn,$_SESSION['CompanyRecord']['decimalplaces']) . '</th>
+ </tr>';
-echo '</table><hr><p></p>';
+echo '</table>
+ <hr />
+ <p />';
if (isset($_POST['CommitDepreciation']) AND $InputError==false){
$result = DB_Txn_Commit($db);
@@ -251,20 +267,24 @@
/*And post the journal too */
include ('includes/GLPostings.inc');
} else {
- echo '<form action=' . htmlspecialchars($_SERVER['PHP_SELF']) . ' method=post name="form">';
+ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post" name="form">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo '<p></p>';
- echo '<table class=selection width=30%><tr></tr><tr>';
+ echo '<p />
+ <table class="selection" width="30%">
+ <tr></tr>
+ <tr>';
if ($AllowUserEnteredProcessDate){
echo '<td>'._('Date to Process Depreciation'). ':</td>
- <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" name="ProcessDate" maxlength=10 size=11 value="' . $_POST['ProcessDate'] . '"></td>';
+ <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" name="ProcessDate" maxlength="10" size="11" value="' . $_POST['ProcessDate'] . '" /></td>';
} else {
echo '<td>'._('Date to Process Depreciation'). ':</td>
- <td>' . $_POST['ProcessDate'] .'</td>';
+ <td>' . $_POST['ProcessDate'] .'</td>';
}
- echo '<td><div class="centre"><input type="submit" name="CommitDepreciation" value="'._('Commit Depreciation').'"></div>';
- echo '</tr></table><br />';
- echo '</form>';
+ echo '<td><div class="centre"><input type="submit" name="CommitDepreciation" value="'._('Commit Depreciation').'" /></div></td>
+ </tr>
+ </table>
+ <br />
+ </form>';
}
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/FixedAssetItems.php
===================================================================
--- trunk/FixedAssetItems.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/FixedAssetItems.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -104,13 +104,16 @@
$Errors[$i] = 'AssetLocation';
$i++;
}
- if (!is_numeric($_POST['DepnRate']) OR $_POST['DepnRate']>100 OR $_POST['DepnRate']<0){
+ if (!is_numeric(filter_number_format($_POST['DepnRate']))
+ OR filter_number_format($_POST['DepnRate'])>100
+ OR filter_number_format($_POST['DepnRate'])<0){
+
$InputError = 1;
prnMsg(_('The depreciation rate is expected to be a number between 0 and 100'),'error');
$Errors[$i] = 'DepnRate';
$i++;
}
- if ($_POST['DepnRate']>0 AND $_POST['DepnRate']<1){
+ if (filter_number_format($_POST['DepnRate'])>0 AND filter_number_format($_POST['DepnRate'])<1){
prnMsg(_('Numbers less than 1 are interpreted as less than 1%. The depreciation rate should be entered as a number between 0 and 100'),'warn');
}
@@ -226,15 +229,15 @@
} /*end if there was accumulated depreciation for the asset */
} /* end if there is a change in asset category */
$sql = "UPDATE fixedassets
- SET longdescription='" . $_POST['LongDescription'] . "',
- description='" . $_POST['Description'] . "',
- assetcategoryid='" . $_POST['AssetCategoryID'] . "',
- assetlocation='" . $_POST['AssetLocation'] . "',
- depntype='" . $_POST['DepnType'] . "',
- depnrate='" . $_POST['DepnRate'] . "',
- barcode='" . $_POST['BarCode'] . "',
- serialno='" . $_POST['SerialNo'] . "'
- WHERE assetid='" . $AssetID . "'";
+ SET longdescription='" . $_POST['LongDescription'] . "',
+ description='" . $_POST['Description'] . "',
+ assetcategoryid='" . $_POST['AssetCategoryID'] . "',
+ assetlocation='" . $_POST['AssetLocation'] . "',
+ depntype='" . $_POST['DepnType'] . "',
+ depnrate='" . filter_number_format($_POST['DepnRate']) . "',
+ barcode='" . $_POST['BarCode'] . "',
+ serialno='" . $_POST['SerialNo'] . "'
+ WHERE assetid='" . $AssetID . "'";
$ErrMsg = _('The asset could not be updated because');
$DbgMsg = _('The SQL that was used to update the asset and failed was');
@@ -257,7 +260,7 @@
'" . $_POST['AssetCategoryID'] . "',
'" . $_POST['AssetLocation'] . "',
'" . $_POST['DepnType'] . "',
- '" . $_POST['DepnRate']. "',
+ '" . filter_number_format($_POST['DepnRate']). "',
'" . $_POST['BarCode'] . "',
'" . $_POST['SerialNo'] . "' )";
$ErrMsg = _('The asset could not be added because');
@@ -382,7 +385,7 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
-if (!isset($AssetID) or $AssetID=='') {
+if (!isset($AssetID) OR $AssetID=='') {
/*If the page was called without $AssetID passed to page then assume a new asset is to be entered other wise the form showing the fields with the existing entries against the asset will show for editing with a hidden AssetID field. New is set to flag that the page may have called itself and still be entering a new asset, in which case the page needs to know not to go looking up details for an existing asset*/
@@ -425,13 +428,19 @@
$_POST['AssetLocation'] = $AssetRow['assetlocation'];
$_POST['DepnType'] = $AssetRow['depntype'];
$_POST['BarCode'] = $AssetRow['barcode'];
- $_POST['DepnRate'] = $AssetRow['depnrate'];
+ $_POST['DepnRate'] = locale_number_format($AssetRow['depnrate'],2);
- echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$AssetID.'</td></tr>'. "\n";
- echo '<input type="Hidden" name="AssetID" value="'.$AssetID.'"/>'. "\n";
+ echo '<tr>
+ <td>' . _('Asset Code') . ':</td>
+ <td>' . $AssetID . '</td>
+ </tr>';
+ echo '<input type="Hidden" name="AssetID" value="'.$AssetID.'"/>';
} else { // some changes were made to the data so don't re-set form variables to DB ie the code above
- echo '<tr><td>' . _('Asset Code') . ':</td><td>' . $AssetID . '</td></tr>';
+ echo '<tr>
+ <td>' . _('Asset Code') . ':</td>
+ <td>' . $AssetID . '</td>
+ </tr>';
echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '"/>';
}
@@ -440,19 +449,27 @@
} else {
$Description ='';
}
-echo '<tr><td>' . _('Asset Description') . ' (' . _('short') . '):</td>
- <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n";
+echo '<tr>
+ <td>' . _('Asset Description') . ' (' . _('short') . '):</td>
+ <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Description" size="52" maxlength="50" value="' . $Description . '"></td>
+ </tr>';
+
if (isset($_POST['LongDescription'])) {
$LongDescription = AddCarriageReturns($_POST['LongDescription']);
} else {
$LongDescription ='';
}
-echo '<tr><td>' . _('Asset Description') . ' (' . _('long') . '):</td><td><textarea ' . (in_array('LongDescription',$Errors) ? 'class="texterror"' : '' ) .' name="LongDescription" cols=40 rows=4>' . stripslashes($LongDescription) . '</textarea></td></tr>';
+echo '<tr>
+ <td>' . _('Asset Description') . ' (' . _('long') . '):</td>
+ <td><textarea ' . (in_array('LongDescription',$Errors) ? 'class="texterror"' : '' ) .' name="LongDescription" cols="40" rows="4">' . stripslashes($LongDescription) . '</textarea></td>
+ </tr>';
if (!isset($New) ) { //ie not new at all!
- echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td>';
+ echo '<tr>
+ <td>'. _('Image File (.jpg)') . ':</td>
+ <td><input type="file" id="ItemPicture" name="ItemPicture"></td>';
if (function_exists('imagecreatefromjpg')){
$AssetImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'.
@@ -478,7 +495,9 @@
// EOR Add Image upload for New Item - by Ori
} //only show the add image if the asset already exists - otherwise AssetID will not be set - and the image needs the AssetID to save
-echo '<tr><td>' . _('Asset Category') . ':</td><td><select name="AssetCategoryID">';
+echo '<tr>
+ <td>' . _('Asset Category') . ':</td>
+ <td><select name="AssetCategoryID">';
$sql = "SELECT categoryid, categorydescription FROM fixedassetcategories";
$ErrMsg = _('The asset categories could not be retrieved because');
@@ -499,7 +518,10 @@
}
if (isset($AssetRow) AND ($AssetRow['datepurchased']!='0000-00-00' AND $AssetRow['datepurchased']!='')){
- echo '<tr><td>' . _('Date Purchased') . ':</td><td>' . ConvertSQLDate($AssetRow['datepurchased']) . '</td></tr>';
+ echo '<tr>
+ <td>' . _('Date Purchased') . ':</td>
+ <td>' . ConvertSQLDate($AssetRow['datepurchased']) . '</td>
+ </tr>';
}
$sql = "SELECT locationid, locationdescription FROM fixedassetlocations";
@@ -507,7 +529,10 @@
$DbgMsg = _('The SQL used to retrieve asset locations and failed was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg);
-echo '<tr><td>' . _('Asset Location') . ':</td><td><select name="AssetLocation">';
+echo '<tr>
+ <td>' . _('Asset Location') . ':</td>
+ <td><select name="AssetLocation">';
+
while ($myrow=DB_fetch_array($result)){
if ($_POST['AssetLocation']==$myrow['locationid']){
echo '<option selected value="' . $myrow['locationid'] .'">' . $myrow['locationdescription'] . '</option>';
@@ -515,15 +540,21 @@
echo '<option value="' . $myrow['locationid'] .'">' . $myrow['locationdescription'] . '</option>';
}
}
-echo '</select><a target="_blank" href="'. $rootpath . '/FixedAssetLocations.php">'.' ' . _('Add Asset Location') . '</a></td></tr>';
+echo '</select>
+ <a target="_blank" href="'. $rootpath . '/FixedAssetLocations.php">'.' ' . _('Add Asset Location') . '</a></td>
+ </tr>
+ <tr>
+ <td>' . _('Bar Code') . ':</td>
+ <td><input ' . (in_array('BarCode',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="BarCode" size="22" maxlength="20" value="' . $_POST['BarCode'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Serial Number') . ':</td>
+ <td><input ' . (in_array('SerialNo',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="SerialNo" size="32" maxlength="30" value="' . $_POST['SerialNo'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Depreciation Type') . ':</td>
+ <td><select name="DepnType">';
-echo '<tr><td>' . _('Bar Code') . ':</td><td><input ' . (in_array('BarCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="BarCode" size=22 maxlength=20 value="' . $_POST['BarCode'] . '"></td></tr>';
-
-echo '<tr><td>' . _('Serial Number') . ':</td><td><input ' . (in_array('SerialNo',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="SerialNo" size=32 maxlength=30 value="' . $_POST['SerialNo'] . '"></td></tr>';
-
-
-echo '<tr><td>' . _('Depreciation Type') . ':</td><td><select name="DepnType">';
-
if (!isset($_POST['DepnType'])){
$_POST['DepnType'] = 0; //0 = Straight line - 1 = Diminishing Value
}
@@ -535,19 +566,35 @@
echo '<option selected value="1">' . _('Diminishing Value') . '</option>';
}
-echo '</select></td></tr>';
+echo '</select></td>
+ </tr>
+ <tr>
+ <td>' . _('Depreciation Rate') . ':</td>
+ <td><input ' . (in_array('DepnRate',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="text" name="DepnRate" size="4" maxlength="4" value="' . $_POST['DepnRate'] . '" />%</td>
+ </tr>
+ </table>';
-echo '<tr><td>' . _('Depreciation Rate') . ':</td><td><input ' . (in_array('DepnRate',$Errors) ? 'class="inputerror"' : 'class="number"' ) .' type="Text" name="DepnRate" size=4 maxlength=4 value="' . $_POST['DepnRate'] . '">%</td></tr>';
-echo '</table>';
+if (isset($AssetRow)){
+
+ echo '<table>
+ <tr>
+ <th colspan="2">' . _('Asset Financial Summary') . '</th>
+ </tr>
+ <tr>
+ <td>' . _('Accumulated Costs') . ':</td>
+ <td class="number">' . locale_number_format($AssetRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ </tr>
+ <tr>
+ <td>' . _('Accumulated Depreciation') . ':</td>
+ <td class="number">' . locale_number_format($AssetRow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ </tr>
+ <tr>
+ <td>' . _('Net Book Value') . ':</td>
+ <td class="number">' . locale_number_format($AssetRow['cost']-$AssetRow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ </tr>';
-/*Get the last period depreciation (depn is transtype =44) was posted for */
-echo '<table><tr><th colspan=2>' . _('Asset Financial Summary') . '</th></tr>';
-
-echo '<tr><td>' . _('Accumulated Costs') . ':</td><td class="number">' . locale_number_format($AssetRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
-echo '<tr><td>' . _('Accumulated Depreciation') . ':</td><td class="number">' . locale_number_format($AssetRow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
-echo '<tr><td>' . _('Net Book Value') . ':</td><td class="number">' . locale_number_format($AssetRow['cost']-$AssetRow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
-
-$result = DB_query("SELECT periods.lastdate_in_period,
+ /*Get the last period depreciation (depn is transtype =44) was posted for */
+ $result = DB_query("SELECT periods.lastdate_in_period,
max(fixedassettrans.periodno)
FROM fixedassettrans INNER JOIN periods
ON fixedassettrans.periodno=periods.periodno
@@ -555,26 +602,35 @@
GROUP BY periods.lastdate_in_period
ORDER BY periods.lastdate_in_period DESC",$db);
-$LastDepnRun = DB_fetch_row($result);
-if(DB_num_rows($result)==0){
- $LastRunDate = _('Not Yet Run');
-} else {
- $LastRunDate = ConvertSQLDate($LastDepnRun[0]);
+ $LastDepnRun = DB_fetch_row($result);
+ if(DB_num_rows($result)==0){
+ $LastRunDate = _('Not Yet Run');
+ } else {
+ $LastRunDate = ConvertSQLDate($LastDepnRun[0]);
+ }
+ echo '<tr>
+ <td>' . _('Depreciation last run') . ':</td>
+ <td>' . $LastRunDate . '</td>
+ </tr>
+ </table>';
}
-echo '<tr><td>' . _('Depreciation last run') . ':</td><td>' . $LastRunDate . '</td></tr>
- </table>';
-
if (isset($New)) {
- echo '<div class="centre"><br /><input type="submit" name="submit" value="' . _('Insert New Fixed Asset') . '">';
-
+ echo '<div class="centre">
+ <br />
+ <input type="submit" name="submit" value="' . _('Insert New Fixed Asset') . '" />';
} else {
-
- echo '<br /><div class="centre"><input type="submit" name="submit" value="' . _('Update') . '"></div>';
- prnMsg( _('Only click the Delete button if you are sure you wish to delete the asset. Only assets with a zero book value can be deleted'), 'warn', _('WARNING'));
- echo '<br /><div class="centre"><input type="submit" name="delete" value="' . _('Delete This Asset') . '" onclick="return confirm(\'' . _('Are You Sure? Only assets with a zero book value can be deleted.') . '\');"></div>';
+ echo '<br />
+ <div class="centre">
+ <input type="submit" name="submit" value="' . _('Update') . '" />
+ </div>';
+ prnMsg( _('Only click the Delete button if you are sure you wish to delete the asset. Only assets with a zero book value can be deleted'), 'warn', _('WARNING'));
+ echo '<br />
+ <div class="centre">
+ <input type="submit" name="delete" value="' . _('Delete This Asset') . '" onclick="return confirm(\'' . _('Are You Sure? Only assets with a zero book value can be deleted.') . '\');" />';
}
-echo '</form></div>';
+echo '</div>
+ </form>';
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/FixedAssetLocations.php
===================================================================
--- trunk/FixedAssetLocations.php 2011-11-04 04:56:22 UTC (rev 4739)
+++ trunk/FixedAssetLocations.php 2011-11-06 03:12:31 UTC (rev 4740)
@@ -1,34 +1,35 @@
<?php
-//$PageSecurity = 11;
+/* $Id$ */
include('includes/session.inc');
$title = _('Fixed Asset Locations');
include('includes/header.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>';
-if (isset($_POST['submit']) and !isset($_POST['delete'])) {
+if (isset($_POST['submit']) AND !isset($_POST['delete'])) {
$InputError=0;
- if (!isset($_POST['LocationID']) or mb_strlen($_POST['LocationID'])<1) {
+ if (!isset($_POST['LocationID']) OR mb_strlen($_POST['LocationID'])<1) {
prnMsg(_('You must enter at least one character in the location ID'),'error');
$InputError=1;
}
- if (!isset($_POST['LocationDescription']) or mb_strlen($_POST['LocationDescription'])<1) {
+ if (!isset($_POST['LocationDescription']) OR mb_strlen($_POST['LocationDescription'])<1) {
prnMsg(_('You must enter at least one character in the location description'),'error');
$InputError=1;
}
if ($InputError==0) {
$sql="INSERT INTO fixedassetlocations
- VALUES (
- '".$_POST['LocationID']."',
- '".$_POST['LocationDescription']."',
- '".$_POST['ParentLocationID']."')";
+ VALUES ('".$_POST['LocationID']."',
+ '".$_POST['LocationDescription']."',
+ '".$_POST['ParentLocationID']."')";
$result=DB_query($sql, $db);
}
}
if (isset($_GET['SelectedLocation'])) {
- $sql="SELECT * FROM fixedassetlocations WHERE locationid='".$_GET['SelectedLocation']."'";
+ $sql="SELECT * FROM fixedassetlocations
+ WHERE locationid='".$_GET['SelectedLocation']."'";
$result = DB_query($sql, $db);
$myrow = DB_fetch_array($result);
$LocationID = $myrow['locationid'];
@@ -45,14 +46,15 @@
if (isset($_POST['update']) and !isset($_POST['delete'])) {
$InputError=0;
if (!isset($_POST['LocationDescription']) or mb_strlen($_POST['LocationDescription'])<1) {
- prnMsg(_('You must enter at least one character in the location description'),'error');
- $InputError=1;
+ prnMsg(_('You must enter at least one character in the location description'),'error');
+ $InputError=1;
}
if ($InputError==0) {
- $sql="UPDATE fixedassetlocations SET
- locationdescription='".$_POST['LocationDescription']."',
- parentlocationid='".$_POST['ParentLocationID']."'
- WHERE locationid ='".$_POST['LocationID']."'";
+ $sql="UPDATE fixedassetlocations
+ SET locationdescription='" . $_POST['LocationDescription'] . "',
+ parentlocationid='" . $_POST['ParentLocationID'] . "'
+ WHERE locationid ='" . $_POST['LocationID'] . "'";
+
$result=DB_query($sql,$db);
echo '<meta http-equiv="Refresh" content="0; url="'.htmlspecialchars($_SERVER['PHP_SELF']).'">';
}
@@ -87,68 +89,74 @@
$result=DB_query($sql, $db);
if (DB_num_rows($result) > 0) {
- echo '<table class=selection><tr>';
- echo '<th>'._('Location ID').'</th>
- <th>'._('Location Description').'</th>
- <th>'._('Parent Location').'</th></tr>';
+ echo '<table class="selection">
+ <tr>
+ <th>'._('Location ID').'</th>
+ <th>'._('Location Description').'</th>
+ <th>'._('Parent Location').'</th>
+ </tr>';
}
while ($myrow=DB_fetch_array($result)) {
- echo '<tr><td>'.$myrow['locationid'].'</td>
- <td>'.$myrow['locationdescription'].'</td>';
- $parentsql="SELECT locationdescription FROM fixedassetlocations WHERE locationid='".$myrow['parentlocationid']."'";
- $parentresult=DB_query($parentsql, $db);
- $parentrow=DB_fetch_array($parentresult);
- echo '<td>'.$parentrow['locationdescription'].'</td>';
- echo '<td><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID.'SelectedLocation='.$myrow['locationid'].'">' . _('Edit') . '</td>';
+ echo '<tr>
+ <td>' . $myrow['locationid'] . '</td>
+ <td>' . $myrow['locationdescription'] . '</td>';
+ $ParentSql="SELECT locationdescription FROM fixedassetlocations WHERE locationid='".$myrow['parentlocationid']."'";
+ $ParentResult=DB_query($ParentSql, $db);
+ $ParentRow=DB_fetch_array($ParentResult);
+ echo '<td>' . $ParentRow['locationdescription'] . '</td>
+ <td><a href="'.htmlspecialchars($_SERVER['PHP_SELF']) . '?SelectedLocation='.$myrow['locationid'].'">' . _('Edit') . '</td>';
}
-echo '</table><br />';
-echo '<form name="LocationForm" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?' . SID . '"><table class=selection>';
-echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
-echo '<tr><th style="text-align:left">'._('Location ID').'</th>';
+echo '</table>
+ <br />';
+echo '<form name="LocationForm" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">
+ <table class="selection">
+ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
+ <tr>
+ <th style="text-align:left">'._('Location ID').'</th>';
if (isset($_GET['SelectedLocation'])) {
- echo '<input type=hidden name=LocationID value="'.$LocationID.'">';
+ echo '<input type="hidden" n...
[truncated message content] |