|
From: <dai...@us...> - 2011-06-17 09:16:46
|
Revision: 4597
http://web-erp.svn.sourceforge.net/web-erp/?rev=4597&view=rev
Author: daintree
Date: 2011-06-17 09:16:37 +0000 (Fri, 17 Jun 2011)
Log Message:
-----------
consistency
Modified Paths:
--------------
trunk/AccountGroups.php
trunk/AccountSections.php
trunk/AddCustomerContacts.php
trunk/AddCustomerNotes.php
trunk/AddCustomerTypeNotes.php
trunk/AgedDebtors.php
trunk/AgedSuppliers.php
trunk/BOMExtendedQty.php
trunk/BOMIndented.php
trunk/BOMIndentedReverse.php
trunk/BOMInquiry.php
trunk/BOMs.php
trunk/BankAccounts.php
trunk/BankReconciliation.php
trunk/COGSGLPostings.php
trunk/ConfirmDispatchControlled_Invoice.php
trunk/ConfirmDispatch_Invoice.php
trunk/ContractBOM.php
trunk/ContractCosting.php
trunk/ContractOtherReqts.php
trunk/Contracts.php
trunk/CounterSales.php
trunk/CustomerInquiry.php
trunk/Customers.php
trunk/MRPPlannedWorkOrders.php
trunk/SelectContract.php
trunk/SelectCustomer.php
trunk/StockLocTransfer.php
trunk/UpgradeDatabase.php
trunk/doc/Change.log
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/ManualCreatingNewSystem.html
trunk/doc/Manual/ManualCreditStatus.html
trunk/doc/Manual/ManualCurrencies.html
trunk/doc/Manual/ManualFixedAssets.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/ConnectDB.inc
Added Paths:
-----------
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
Modified: trunk/AccountGroups.php
===================================================================
--- trunk/AccountGroups.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AccountGroups.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -53,10 +53,10 @@
FROM accountgroups WHERE groupname='".$_POST['GroupName']."'";
$DbgMsg = _('The SQL that was used to retrieve the information was');
- $ErrMsg = _('Could not check whether the group exists because');
+ $ErrMsg = _('Could not check whether the group exists because');
$result=DB_query($sql, $db,$ErrMsg,$DbgMsg);
- $myrow=DB_fetch_row($result);
+ $myrow=DB_fetch_row($result);
if ($myrow[0]!=0 and $_POST['SelectedAccountGroup']=='') {
$InputError = 1;
@@ -362,7 +362,7 @@
<td><select tabindex="3" ' . (in_array('SectionInAccounts',$Errors) ? 'class="selecterror"' : '' ) .
' name="SectionInAccounts">';
- $sql = 'SELECT sectionid, sectionname FROM accountsection ORDER BY sectionid';
+ $sql = "SELECT sectionid, sectionname FROM accountsection ORDER BY sectionid";
$secresult = DB_query($sql, $db,$ErrMsg,$DbgMsg);
while( $secrow = DB_fetch_array($secresult) ) {
if ($_POST['SectionInAccounts']==$secrow['sectionid']) {
Modified: trunk/AccountSections.php
===================================================================
--- trunk/AccountSections.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AccountSections.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -172,7 +172,8 @@
$ErrMsg = _('Could not get account group sections because');
$result = DB_query($sql,$db,$ErrMsg);
- echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />';
+ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>
+ <br />';
echo '<table name="SectionList" class="selection">
<tr>
Modified: trunk/AddCustomerContacts.php
===================================================================
--- trunk/AddCustomerContacts.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AddCustomerContacts.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -17,16 +17,16 @@
} elseif (isset($_GET['DebtorNo'])){
$DebtorNo = $_GET['DebtorNo'];
}
-echo "<a href='" . $rootpath . '/Customers.php?' . SID .'&DebtorNo='.$DebtorNo."'>" . _('Back to Customers') . '</a><br />';
+echo '<a href="' . $rootpath . '/Customers.php?DebtorNo=' . $DebtorNo .'">' . _('Back to Customers') . '</a><br />';
$SQLname="SELECT name FROM debtorsmaster where debtorno='" .$DebtorNo."'";
$Result = DB_query($SQLname,$db);
$row = DB_fetch_array($Result);
if (!isset($_GET['Id'])) {
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') .
- '" alt="" />' . ' ' . _('Contacts for Customer: <b>') .$row['name'].'</p><br />';
+ '" alt="" />' . ' ' . _('Contacts for Customer:') . ' <b>' . $row['name'].'</b></p><br />';
} else {
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') .
- '" alt="" />' . ' ' . _('Edit contact for <b>') .$row['name'].'</p><br />';
+ '" alt="" />' . ' ' . _('Edit contact for') . '<b>' . $row['name'].'</b></p><br />';
}
if ( isset($_POST['submit']) ) {
@@ -39,34 +39,40 @@
if (isset($_POST['Con_ID']) and !is_long((integer)$_POST['Con_ID'])) {
$InputError = 1;
prnMsg( _('The Contact ID must be an integer.'), 'error');
- } elseif (strlen($_POST['conName']) >40) {
+ } elseif (strlen($_POST['ContactName']) >40) {
$InputError = 1;
prnMsg( _('The contact name must be forty characters or less long'), 'error');
- } elseif( trim($_POST['conName']) == '' ) {
+ } elseif( trim($_POST['ContactName']) == '' ) {
$InputError = 1;
prnMsg( _('The contact name may not be empty'), 'error');
+ }elseif (!IsEmailAddress($_POST['ContactEmail']) AND strlen($_POST['ContactEmail'])>0){
+ $InputError = 1;
+ prnMsg( _('The contact email address is not a valid email address'), 'error');
}
-
if (isset($Id) and ($Id and $InputError !=1)) {
- $sql = "UPDATE custcontacts SET
- contactname='" . $_POST['conName'] . "',
- role='" . $_POST['conRole'] . "',
- phoneno='" . $_POST['conPhone'] . "',
- notes='" . $_POST['conNotes'] . "'
- WHERE debtorno ='".$DebtorNo."'
- AND contid='".$Id."'";
+ $sql = "UPDATE custcontacts SET contactname='" . $_POST['ContactName'] . "',
+ role='" . $_POST['ContactRole'] . "',
+ phoneno='" . $_POST['ContactPhone'] . "',
+ notes='" . $_POST['ContactNotes'] . "',
+ email='" . $_POST['ContactEmail'] . "'
+ WHERE debtorno ='".$DebtorNo."'
+ AND contid='".$Id."'";
$msg = _('Customer Contacts') . ' ' . $DebtorNo . ' ' . _('has been updated');
} elseif ($InputError !=1) {
- $sql = "INSERT INTO custcontacts (debtorno,contactname,role,phoneno,notes)
- VALUES (
- '" . $DebtorNo. "',
- '" . $_POST['conName'] . "',
- '" . $_POST['conRole'] . "',
- '" . $_POST['conPhone'] . "',
- '" . $_POST['conNotes'] . "'
- )";
+ $sql = "INSERT INTO custcontacts (debtorno,
+ contactname,
+ role,
+ phoneno,
+ notes,
+ email)
+ VALUES ('" . $DebtorNo. "',
+ '" . $_POST['ContactName'] . "',
+ '" . $_POST['ContactRole'] . "',
+ '" . $_POST['ContactPhone'] . "',
+ '" . $_POST['ContactNotes'] . "',
+ '" . $_POST['ContactEmail'] . "')";
$msg = _('The contact record has been added');
}
@@ -78,40 +84,51 @@
prnMsg($msg, 'success');
echo '<br />';
unset($Id);
- unset($_POST['conName']);
- unset($_POST['conRole']);
- unset($_POST['conPhone']);
- unset($_POST['conNotes']);
+ unset($_POST['ContactName']);
+ unset($_POST['ContactRole']);
+ unset($_POST['ContactPhone']);
+ unset($_POST['ContactNotes']);
+ unset($_POST['ContactEmail']);
unset($_POST['Con_ID']);
}
- } elseif (isset($_GET['delete']) and $_GET['delete']) {
+} elseif (isset($_GET['delete']) and $_GET['delete']) {
//the link to delete a selected record was clicked instead of the submit button
// PREVENT DELETES IF DEPENDENT RECORDS IN 'SalesOrders'
- $sql="DELETE FROM custcontacts WHERE contid=".$Id."
- and debtorno='".$DebtorNo."'";
+ $sql="DELETE FROM custcontacts
+ WHERE contid='" . $Id . "'
+ AND debtorno='" . $DebtorNo . "'";
$result = DB_query($sql,$db);
- //echo '<br />'.$sql;
- echo '<br />';
- prnMsg( _('The contact record has been deleted'), 'success');
- unset($Id);
- unset($_GET['delete']);
+ echo '<br />';
+ prnMsg( _('The contact record has been deleted'), 'success');
+ unset($Id);
+ unset($_GET['delete']);
- }
+}
if (!isset($Id)) {
- $sql = "SELECT * FROM custcontacts where debtorno='".$DebtorNo."' ORDER BY contid";
+ $sql = "SELECT contid,
+ debtorno,
+ contactname,
+ role,
+ phoneno,
+ notes,
+ email
+ FROM custcontacts
+ WHERE debtorno='".$DebtorNo."'
+ ORDER BY contid";
$result = DB_query($sql,$db);
//echo '<br />'.$sql;
- echo '<table class=selection>';
+ echo '<table class="selection">';
echo '<tr>
<th>' . _('Name') . '</th>
<th>' . _('Role') . '</th>
<th>' . _('Phone no') . '</th>
+ <th>' . _('Email') . '</th>
<th>' . _('Notes') . '</th>';
$k=0; //row colour counter
@@ -127,83 +144,102 @@
printf('<td>%s</td>
<td>%s</td>
<td>%s</td>
+ <td><a href=mailto:%s>%s</a></td>
<td>%s</td>
<td><a href="%sId=%s&DebtorNo=%s">'. _('Edit').' </td>
- <td><a href="%sId=%s&DebtorNo=%s&delete=1">'. _('Delete'). '</td></tr>',
- $myrow[2],
- $myrow[3],
- $myrow[4],
- $myrow[5],
- $_SERVER['PHP_SELF'] . "?" . SID,
- $myrow[0],
- $myrow[1],
- $_SERVER['PHP_SELF'] . "?" . SID,
- $myrow[0],
- $myrow[1]);
+ <td><a href="%sId=%s&DebtorNo=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this contact?') . '\');">'. _('Delete'). '</td></tr>',
+ $myrow['contactname'],
+ $myrow['role'],
+ $myrow['phoneno'],
+ $myrow['email'],
+ $myrow['email'],
+ $myrow['notes'],
+ $_SERVER['PHP_SELF'] . '?',
+ $myrow['contid'],
+ $myrow['debtorno'],
+ $_SERVER['PHP_SELF'] . '?',
+ $myrow['contid'],
+ $myrow['debtorno']);
}
//END WHILE LIST LOOP
echo '</table>';
}
-if (isset($Id)) { ?>
- <div class="centre"><a href="<?php echo $_SERVER['PHP_SELF'] . '?' . SID .'&DebtorNo='.$DebtorNo;?>"><?=_('Review all contacts for this Customer')?></a></div>
-<?php } ?>
-<p>
+if (isset($Id)) {
+ echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo .'">' . _('Review all contacts for this Customer') . '</a></div>';
+}
-<?php
if (!isset($_GET['delete'])) {
echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo.'">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
if (isset($Id)) {
- //editing an existing Shipper
- $sql = "SELECT * FROM custcontacts WHERE contid='".$Id."'
- and debtorno='".$DebtorNo."'";
+ $sql = "SELECT contid,
+ debtorno,
+ contactname,
+ role,
+ phoneno,
+ notes,
+ email
+ FROM custcontacts
+ WHERE contid='".$Id."'
+ AND debtorno='".$DebtorNo."'";
$result = DB_query($sql, $db);
- //echo '<br />'.$sql;
-
$myrow = DB_fetch_array($result);
$_POST['Con_ID'] = $myrow['contid'];
- $_POST['conName'] = $myrow['contactname'];
- $_POST['conRole'] = $myrow['role'];
- $_POST['conPhone'] = $myrow['phoneno'];
- $_POST['conNotes'] = $myrow['notes'];
- $_POST['debtorno'] = $myrow['debtorno'];
+ $_POST['ContactName'] = $myrow['contactname'];
+ $_POST['ContactRole'] = $myrow['role'];
+ $_POST['ContactPhone'] = $myrow['phoneno'];
+ $_POST['ContactNotes'] = $myrow['notes'];
+ $_POST['ContactEmail'] = $myrow['email'];
+ $_POST['DebtorNo'] = $myrow['debtorno'];
echo '<input type=hidden name="Id" value='. $Id .'>';
echo '<input type=hidden name="Con_ID" value=' . $_POST['Con_ID'] . '>';
- echo '<input type=hidden name="DebtorNo" value=' . $_POST['debtorno'] . '>';
- echo '<table class=selection><tr><td>'. _('Contact Code').':</td><td>' . $_POST['Con_ID'] . '</td></tr>';
+ echo '<input type=hidden name="DebtorNo" value=' . $_POST['DebtorNo'] . '>';
+ echo '<br />
+ <table class="selection">
+ <tr>
+ <td>'. _('Contact Code').':</td>
+ <td>' . $_POST['Con_ID'] . '</td>
+ </tr>';
} else {
- echo '<table class=selection>';
+ echo '<br />
+ <table class="selection">';
}
echo '<tr><td>'. _('Contact Name') . '</td>';
- if (isset($_POST['conName'])) {
- echo '<td><input type="Text" name="conName" value="' . $_POST['conName']. '" size=35 maxlength=40></td></tr>';
+ if (isset($_POST['ContactName'])) {
+ echo '<td><input type="text" name="ContactName" value="' . $_POST['ContactName']. '" size=35 maxlength=40></td></tr>';
} else {
- echo '<td><input type="Text" name="conName" size=35 maxlength=40></td></tr>';
+ echo '<td><input type="text" name="ContactName" size=35 maxlength=40></td></tr>';
}
echo '<tr><td>' . _('Role') . '</td>';
- if (isset($_POST['conRole'])) {
- echo '<td><input type="text" name="conRole" value="'. $_POST['conRole']. '" size=35 maxlength=40></td></tr>';
+ if (isset($_POST['ContactRole'])) {
+ echo '<td><input type="text" name="ContactRole" value="'. $_POST['ContactRole']. '" size=35 maxlength=40></td></tr>';
} else {
- echo '<td><input type="text" name="conRole" size=35 maxlength=40></td></tr>';
+ echo '<td><input type="text" name="ContactRole" size=35 maxlength=40></td></tr>';
}
echo '<tr><td>' . _('Phone') . '</td>';
- if (isset($_POST['conPhone'])) {
- echo '<td><input type="Text" name="conPhone" value="' . $_POST['conPhone'] . '" size=35 maxlength=40></td></tr>';
+ if (isset($_POST['ContactPhone'])) {
+ echo '<td><input type="text" name="ContactPhone" value="' . $_POST['ContactPhone'] . '" size=35 maxlength=40></td></tr>';
} else {
- echo '<td><input type="Text" name="conPhone"" size=35 maxlength=40></td></tr>';
+ echo '<td><input type="text" name="ContactPhone" size=35 maxlength=40></td></tr>';
}
+ echo '<tr><td>' . _('Email') . '</td>';
+ if (isset($_POST['ContactEmail'])) {
+ echo '<td><input type="text" name="ContactEmail" value="' . $_POST['ContactEmail'] . '" size=55 maxlength="55"></td></tr>';
+ } else {
+ echo '<td><input type="text" name="ContactEmail" size="55" maxlength="55"></td></tr>';
+ }
echo '<tr><td>' . _('Notes') . '</td>';
- if (isset($_POST['conNotes'])) {
- echo '<td><textarea name="conNotes">'. $_POST['conNotes'] . '</textarea>';
+ if (isset($_POST['ContactNotes'])) {
+ echo '<td><textarea name="ContactNotes">'. $_POST['ContactNotes'] . '</textarea>';
} else {
- echo '<td><textarea name="conNotes"></textarea>';
+ echo '<td><textarea name="ContactNotes"></textarea>';
}
echo '<tr><td colspan=2><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information') . '"></div></td></tr>';
echo '</table>';
@@ -212,4 +248,4 @@
} //end if record deleted no point displaying form to add record
include('includes/footer.inc');
-?>
+?>
\ No newline at end of file
Modified: trunk/AddCustomerNotes.php
===================================================================
--- trunk/AddCustomerNotes.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AddCustomerNotes.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -1,7 +1,7 @@
<?php
-/* $Revision: 1.4 $ */
+
/* $Id$*/
-//$PageSecurity = 3;
+
include('includes/session.inc');
$title = _('Customer Notes');
include('includes/header.inc');
@@ -17,7 +17,8 @@
} elseif (isset($_GET['DebtorNo'])){
$DebtorNo = $_GET['DebtorNo'];
}
-echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID .'&DebtorNo='.$DebtorNo."'>" . _('Back to Select Customer') . '</a><br>';
+
+echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorNo=' . $DebtorNo . '">' . _('Back to Select Customer') . '</a><br />';
if ( isset($_POST['submit']) ) {
//initialise no input errors assumed initially before we test
@@ -49,22 +50,24 @@
$msg = _('Customer Notes') . ' ' . $DebtorNo . ' ' . _('has been updated');
} elseif ($InputError !=1) {
- $sql = "INSERT INTO custnotes (debtorno,href,note,date,priority)
- VALUES (
- '" . $DebtorNo. "',
- '" . $_POST['href'] . "',
- '" . $_POST['note'] . "',
- '" . FormatDateForSQL($_POST['date']) . "',
- '" . $_POST['priority'] . "'
- )";
+ $sql = "INSERT INTO custnotes (debtorno,
+ href,
+ note,
+ date,
+ priority)
+ VALUES ('" . $DebtorNo. "',
+ '" . $_POST['href'] . "',
+ '" . $_POST['note'] . "',
+ '" . FormatDateForSQL($_POST['date']) . "',
+ '" . $_POST['priority'] . "')";
$msg = _('The contact notes record has been added');
}
if ($InputError !=1) {
$result = DB_query($sql,$db);
- //echo '<br>'.$sql;
+ //echo '<br />'.$sql;
- echo '<br>';
+ echo '<br />';
prnMsg($msg, 'success');
unset($Id);
unset($_POST['note']);
@@ -78,28 +81,32 @@
// PREVENT DELETES IF DEPENDENT RECORDS IN 'SalesOrders'
- $sql="DELETE FROM custnotes WHERE noteid='".$Id."'
- and debtorno='".$DebtorNo."'";
- $result = DB_query($sql,$db);
- //echo '<br>'.$sql;
+ $sql="DELETE FROM custnotes
+ WHERE noteid='".$Id."'
+ AND debtorno='".$DebtorNo."'";
+ $result = DB_query($sql,$db);
+ //echo '<br />'.$sql;
- echo '<br>';
- prnMsg( _('The contact note record has been deleted'), 'success');
- unset($Id);
- unset($_GET['delete']);
+ echo '<br />';
+ prnMsg( _('The contact note record has been deleted'), 'success');
+ unset($Id);
+ unset($_GET['delete']);
+}
- }
-
if (!isset($Id)) {
- $SQLname="SELECT * from debtorsmaster where debtorno='".$DebtorNo."'";
+ $SQLname="SELECT * FROM debtorsmaster
+ WHERE debtorno='".$DebtorNo."'";
$Result = DB_query($SQLname,$db);
$row = DB_fetch_array($Result);
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') .
- '" alt="" />' . _('Notes for Customer').': <b>' .$row['name'].'</b></p><br />';
+ '" alt="" />' . _('Notes for Customer').': <b>' .$row['name'].'</b></p>
+ <br />';
- $sql = "SELECT * FROM custnotes where debtorno='".$DebtorNo."' ORDER BY date DESC";
+ $sql = "SELECT * FROM custnotes
+ WHERE debtorno='".$DebtorNo."'
+ ORDER BY date DESC";
$result = DB_query($sql,$db);
- //echo '<br>'.$sql;
+ //echo '<br />'.$sql;
echo '<table class=selection>';
echo '<tr>
@@ -128,10 +135,10 @@
$myrow[3],
$myrow[2],
$myrow[5],
- $_SERVER['PHP_SELF'] . "?" . SID,
+ $_SERVER['PHP_SELF'] . '?',
$myrow[0],
$myrow[1],
- $_SERVER['PHP_SELF'] . "?" . SID,
+ $_SERVER['PHP_SELF'] . '?',
$myrow[0],
$myrow[1]);
@@ -140,9 +147,9 @@
echo '</table>';
}
if (isset($Id)) {
- echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?' . SID .'&DebtorNo='.$DebtorNo.'"><?='._('Review all notes for this Customer').'</a></div>';
+ echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?DebtorNo='.$DebtorNo.'">'._('Review all notes for this Customer').'</a></div>';
}
-echo '<p>';
+echo '<br />';
if (!isset($_GET['delete'])) {
@@ -156,7 +163,6 @@
and debtorno='".$DebtorNo."'";
$result = DB_query($sql, $db);
- //echo '<br>'.$sql;
$myrow = DB_fetch_array($result);
@@ -169,9 +175,13 @@
echo '<input type=hidden name="Id" value='. $Id .'>';
echo '<input type=hidden name="Con_ID" value=' . $_POST['noteid'] . '>';
echo '<input type=hidden name="DebtorNo" value=' . $_POST['debtorno'] . '>';
- echo '<table class=selection><tr><td>'. _('Note ID').':</td><td>' . $_POST['noteid'] . '</td></tr>';
+ echo '<table class="selection">
+ <tr>
+ <td>'. _('Note ID').':</td>
+ <td>' . $_POST['noteid'] . '</td>
+ </tr>';
} else {
- echo '<table class=selection>';
+ echo '<table class="selection">';
}
echo '<tr><td>' . _('Contact Note'). '</td>';
@@ -188,15 +198,15 @@
}
echo '<tr><td>' . _('Date') .'</td>';
if (isset($_POST['date'])) {
- echo '<td><input type="Text" name="date" value="'.ConvertSQLDate($_POST['date']).'" size=10 maxlength=10></td></tr>';
+ echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" value="'.ConvertSQLDate($_POST['date']).'" size=10 maxlength=10></td></tr>';
} else {
- echo '<td><input type="Text" name="date" size=10 maxlength=10></td></tr>';
+ echo '<td><input type="text" name="date" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" size=10 maxlength=10></td></tr>';
}
echo '<tr><td>'. _('Priority'). '</td>';
if (isset($_POST['priority'])) {
echo '<td><input type="Text" name="priority" value="' .$_POST['priority']. '" size=1 maxlength=3></td></td>';
} else {
- echo '<td><input type="Text" name="priority" size=1 maxlength=3></td></td>';
+ echo '<td><input type="text" name="priority" size=1 maxlength=3></td></td>';
}
echo '<tr><td colspan=2><div class="centre"><input type="Submit" name="submit" value="'._('Enter Information').'"></div></td></tr>';
echo '</table>';
@@ -206,4 +216,4 @@
} //end if record deleted no point displaying form to add record
include('includes/footer.inc');
-?>
+?>
\ No newline at end of file
Modified: trunk/AddCustomerTypeNotes.php
===================================================================
--- trunk/AddCustomerTypeNotes.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AddCustomerTypeNotes.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -1,7 +1,6 @@
<?php
-/* $Revision: 1.3 $ */
/* $Id$*/
-//$PageSecurity = 3;
+
include('includes/session.inc');
$title = _('Customer Type (Group) Notes');
include('includes/header.inc');
@@ -17,8 +16,8 @@
} elseif (isset($_GET['DebtorType'])){
$DebtorType = $_GET['DebtorType'];
}
-echo "<a href='" . $rootpath . '/SelectCustomer.php?' . SID .'&DebtorType='.$DebtorType."'>" . _('Back to Select Customer') . '</a><br>';
-if ( isset($_POST['submit']) ) {
+echo '<a href="' . $rootpath . '/SelectCustomer.php?DebtorType='.$DebtorType.'">' . _('Back to Select Customer') . '</a><br />';
+if (isset($_POST['submit']) ) {
//initialise no input errors assumed initially before we test
$InputError = 0;
@@ -28,10 +27,10 @@
//first off validate inputs sensible
if (!is_long((integer)$_POST['priority'])) {
$InputError = 1;
- prnMsg( _('The Contact priority must be an integer.'), 'error');
+ prnMsg(_('The Contact priority must be an integer.'), 'error');
} elseif (strlen($_POST['note']) >200) {
$InputError = 1;
- prnMsg( _("The contact's notes must be two hundred characters or less long"), 'error');
+ prnMsg(_("The contact's notes must be two hundred characters or less long"), 'error');
} elseif( trim($_POST['note']) == '' ) {
$InputError = 1;
prnMsg( _("The contact's notes may not be empty"), 'error');
@@ -40,31 +39,32 @@
if ($Id AND $InputError !=1) {
$sql = "UPDATE debtortypenotes SET
- note='" . $_POST['note'] . "',
- date='" . $_POST['date'] . "',
- href='" . $_POST['href'] . "',
- priority='" . $_POST['priority'] . "'
- WHERE typeid ='".$DebtorType."'
- AND noteid='".$Id."'";
+ note='" . $_POST['note'] . "',
+ date='" . $_POST['date'] . "',
+ href='" . $_POST['href'] . "',
+ priority='" . $_POST['priority'] . "'
+ WHERE typeid ='".$DebtorType."'
+ AND noteid='".$Id."'";
$msg = _('Customer Group Notes') . ' ' . $DebtorType . ' ' . _('has been updated');
} elseif ($InputError !=1) {
- $sql = "INSERT INTO debtortypenotes (typeid,href,note,date,priority)
- VALUES (
- '" . $DebtorType. "',
- '" . $_POST['href'] . "',
- '" . $_POST['note'] . "',
- '" . $_POST['date'] . "',
- '" . $_POST['priority'] . "'
- )";
+ $sql = "INSERT INTO debtortypenotes (typeid,
+ href,
+ note,
+ date,
+ priority)
+ VALUES ('" . $DebtorType. "',
+ '" . $_POST['href'] . "',
+ '" . $_POST['note'] . "',
+ '" . $_POST['date'] . "',
+ '" . $_POST['priority'] . "')";
$msg = _('The contact group notes record has been added');
}
if ($InputError !=1) {
$result = DB_query($sql,$db);
- //echo '<br>'.$sql;
- echo '<br>';
+ echo '<br />';
prnMsg($msg, 'success');
unset($Id);
unset($_POST['note']);
@@ -75,12 +75,13 @@
// PREVENT DELETES IF DEPENDENT RECORDS IN 'SalesOrders'
- $sql="DELETE FROM debtortypenotes WHERE noteid='".$Id."'
- and typeid='".$DebtorType."'";
+ $sql="DELETE FROM debtortypenotes
+ WHERE noteid='".$Id."'
+ AND typeid='".$DebtorType."'";
$result = DB_query($sql,$db);
- //echo '<br>'.$sql;
+ //echo '<br />'.$sql;
- echo '<br>';
+ echo '<br />';
prnMsg( _('The contact group note record has been deleted'), 'success');
unset($Id);
unset($_GET['delete']);
@@ -97,9 +98,8 @@
$sql = "SELECT * FROM debtortypenotes where typeid='".$DebtorType."' ORDER BY date DESC";
$result = DB_query($sql,$db);
- //echo '<br>'.$sql;
- echo '<table class=selection>';
+ echo '<table class="selection">';
echo '<tr>
<th>' . _('Date') . '</th>
<th>' . _('Note') . '</th>
@@ -121,15 +121,15 @@
<td>%s</td>
<td>%s</td>
<td><a href="%sId=%s&DebtorType=%s">'. _('Edit').' </td>
- <td><a href="%sId=%s&DebtorType=%s&delete=1">'. _('Delete'). '</td></tr>',
+ <td><a href="%sId=%s&DebtorType=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this customer type note?') . '\');">'. _('Delete'). '</td></tr>',
$myrow[4],
$myrow[3],
$myrow[2],
$myrow[5],
- $_SERVER['PHP_SELF'] . "?" . SID,
+ $_SERVER['PHP_SELF'] . '?',
$myrow[0],
$myrow[1],
- $_SERVER['PHP_SELF'] . "?" . SID,
+ $_SERVER['PHP_SELF'] . '?',
$myrow[0],
$myrow[1]);
@@ -145,7 +145,7 @@
<?php
if (!isset($_GET['delete'])) {
- echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '&DebtorType='.$DebtorType.'">';
+ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?DebtorType='.$DebtorType.'">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
if (isset($Id)) {
@@ -155,7 +155,6 @@
and typeid='".$DebtorType."'";
$result = DB_query($sql, $db);
- //echo '<br>'.$sql;
$myrow = DB_fetch_array($result);
@@ -189,7 +188,7 @@
echo '<tr><td>'. _('Priority').':</td>';
echo '<td><input type="Text" name="priority" value="'. $_POST['priority'].'" size=1 maxlength=3></td></td>
</table>';
- echo '<br><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div>';
+ echo '<br /><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div>';
echo '</form>';
Modified: trunk/AgedDebtors.php
===================================================================
--- trunk/AgedDebtors.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AgedDebtors.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -80,7 +80,7 @@
AND debtorsmaster.debtorno >= '" . $_POST['FromCriteria'] . "'
AND debtorsmaster.debtorno <= '" . $_POST['ToCriteria'] . "'
AND debtorsmaster.currcode ='" . $_POST['Currency'] . "'
- $SalesLimit
+ " . $SalesLimit . "
GROUP BY debtorsmaster.debtorno,
debtorsmaster.name,
currencies.currency,
@@ -154,7 +154,7 @@
AND debtorsmaster.debtorno >= '" . $_POST['FromCriteria'] . "'
AND debtorsmaster.debtorno <= '" . $_POST['ToCriteria'] . "'
AND debtorsmaster.currcode ='" . $_POST['Currency'] . "'
- $SalesLimit
+ " . $SalesLimit . "
GROUP BY debtorsmaster.debtorno,
debtorsmaster.name,
currencies.currency,
@@ -243,7 +243,7 @@
AND debtorsmaster.debtorno >= '" . $_POST['FromCriteria'] . "'
AND debtorsmaster.debtorno <= '" . $_POST['ToCriteria'] . "'
AND debtorsmaster.currcode ='" . $_POST['Currency'] . "'
- $SalesLimit
+ " . $SalesLimit . "
GROUP BY debtorsmaster.debtorno,
debtorsmaster.name,
currencies.currency,
@@ -269,7 +269,7 @@
if (DB_error_no($db) !=0) {
$title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '.... ';
include('includes/header.inc');
- echo '<p>' . _('The customer details could not be retrieved by the SQL because') . ' ' . DB_error_msg($db);
+ prnMsg(_('The customer details could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error');
echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
if ($debug==1){
echo '<br />' . $SQL;
@@ -368,10 +368,10 @@
if (DB_error_no($db) !=0) {
$title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....';
include('includes/header.inc');
- echo '<br /><br />' . _('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db);
+ prnMsg(_('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db),'error');
echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
if ($debug==1){
- echo '<br />' . _('The SQL that failed was') . '<p>' . $sql;
+ echo '<br />' . _('The SQL that failed was') . '<br />' . $sql;
}
include('includes/footer.inc');
exit;
@@ -483,13 +483,12 @@
$sql = "SELECT salesmancode, salesmanname FROM salesman";
$result=DB_query($sql,$db);
- echo '<option value=""></option>';
+ echo '<option value="">' . _('All Sales people') . '</option>';
while ($myrow=DB_fetch_array($result)){
echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>';
}
echo '</select></td></tr>';
-
echo '<tr><td>' . _('Only show customers trading in') . ':' . '</td>
<td><select tabindex="5" name="Currency">';
Modified: trunk/AgedSuppliers.php
===================================================================
--- trunk/AgedSuppliers.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/AgedSuppliers.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -2,9 +2,6 @@
/* $Id$*/
-/* $Revision: 1.13 $ */
-
-//$PageSecurity = 2;
include('includes/session.inc');
If (isset($_POST['PrintPDF'])
@@ -24,78 +21,83 @@
/*Now figure out the aged analysis for the Supplier range under review */
if ($_POST['All_Or_Overdues']=='All'){
- $SQL = "SELECT suppliers.supplierid, suppliers.suppname, currencies.currency, paymentterms.terms,
- SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) as balance,
- SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) >= paymentterms.daysbeforedue THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- ELSE
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= 0 THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- END) AS due,
- Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- ELSE
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') ."), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- END) AS overdue1,
- Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- ELSE
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- END) AS overdue2
- FROM suppliers, paymentterms, currencies, supptrans WHERE suppliers.paymentterms = paymentterms.termsindicator
- AND suppliers.currcode = currencies.currabrev
- AND suppliers.supplierid = supptrans.supplierno
- AND suppliers.supplierid >= '" . $_POST['FromCriteria'] . "'
- AND suppliers.supplierid <= '" . $_POST['ToCriteria'] . "'
- AND suppliers.currcode ='" . $_POST['Currency'] . "'
- GROUP BY suppliers.supplierid,
- suppliers.suppname,
- currencies.currency,
- paymentterms.terms,
- paymentterms.daysbeforedue,
- paymentterms.dayinfollowingmonth
- HAVING Sum(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) <>0";
-
+ $SQL = "SELECT suppliers.supplierid,
+ suppliers.suppname,
+ currencies.currency,
+ paymentterms.terms,
+ SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) as balance,
+ SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) >= paymentterms.daysbeforedue THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ ELSE
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= 0 THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ END) AS due,
+ SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ ELSE
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') ."), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ END) AS overdue1,
+ SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ ELSE
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ END) AS overdue2
+ FROM suppliers INNER JOIN paymentterms
+ ON suppliers.paymentterms = paymentterms.termsindicator
+ INNER JOIN currencies
+ ON suppliers.currcode = currencies.currabrev
+ INNER JOIN supptrans
+ ON suppliers.supplierid = supptrans.supplierno
+ WHERE suppliers.supplierid >= '" . $_POST['FromCriteria'] . "'
+ AND suppliers.supplierid <= '" . $_POST['ToCriteria'] . "'
+ AND suppliers.currcode ='" . $_POST['Currency'] . "'
+ GROUP BY suppliers.supplierid,
+ suppliers.suppname,
+ currencies.currency,
+ paymentterms.terms,
+ paymentterms.daysbeforedue,
+ paymentterms.dayinfollowingmonth
+ HAVING SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) <>0";
+
} else {
$SQL = "SELECT suppliers.supplierid,
- suppliers.suppname,
- currencies.currency,
- paymentterms.terms,
- SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) AS balance,
- SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) >= paymentterms.daysbeforedue THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- ELSE
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= 0 THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- END) AS due,
- Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- ELSE
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- END) AS overdue1,
- SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- ELSE
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
- END) AS overdue2
- FROM suppliers,
- paymentterms,
- currencies,
- supptrans
- WHERE suppliers.paymentterms = paymentterms.termsindicator
- AND suppliers.currcode = currencies.currabrev
- and suppliers.supplierid = supptrans.supplierno
- AND suppliers.supplierid >= '" . $_POST['FromCriteria'] . "'
- AND suppliers.supplierid <= '" . $_POST['ToCriteria'] . "'
- AND suppliers.currcode ='" . $_POST['Currency'] . "'
- GROUP BY suppliers.supplierid,
- suppliers.suppname,
- currencies.currency,
- paymentterms.terms,
- paymentterms.daysbeforedue,
- paymentterms.dayinfollowingmonth
- HAVING Sum(IF (paymentterms.daysbeforedue > 0,
- CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END,
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END)) > 0";
+ suppliers.suppname,
+ currencies.currency,
+ paymentterms.terms,
+ SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) AS balance,
+ SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) >= paymentterms.daysbeforedue THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ ELSE
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= 0 THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ END) AS due,
+ Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ ELSE
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ END) AS overdue1,
+ SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ ELSE
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
+ END) AS overdue2
+ FROM suppliers INNER JOIN paymentterms
+ ON suppliers.paymentterms = paymentterms.termsindicator
+ INNER JOIN currencies
+ ON suppliers.currcode = currencies.currabrev
+ INNER JOIN supptrans
+ ON suppliers.supplierid = supptrans.supplierno
+ WHERE suppliers.supplierid >= '" . $_POST['FromCriteria'] . "'
+ AND suppliers.supplierid <= '" . $_POST['ToCriteria'] . "'
+ AND suppliers.currcode ='" . $_POST['Currency'] . "'
+ GROUP BY suppliers.supplierid,
+ suppliers.suppname,
+ currencies.currency,
+ paymentterms.terms,
+ paymentterms.daysbeforedue,
+ paymentterms.dayinfollowingmonth
+ HAVING Sum(IF (paymentterms.daysbeforedue > 0,
+ CASE WHEN TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) > paymentterms.daysbeforedue AND TO_DAYS(Now()) - TO_DAYS(supptrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END,
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ") THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END)) > 0";
}
@@ -103,11 +105,11 @@
if (DB_error_no($db) !=0) {
$title = _('Aged Supplier Account Analysis') . ' - ' . _('Problem Report') ;
- include("includes/header.inc");
+ include('includes/header.inc');
prnMsg(_('The Supplier details could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error');
- echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>';
+ echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
if ($debug==1){
- echo "<br>$SQL";
+ echo '<br />' . $SQL;
}
include('includes/footer.inc');
exit;
@@ -186,10 +188,10 @@
if (DB_error_no($db) !=0) {
$title = _('Aged Supplier Account Analysis - Problem Report');
include('includes/header.inc');
- echo '<br>' . _('The details of outstanding transactions for Supplier') . ' - ' . $AgedAnalysis['supplierid'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db);
- echo "<br><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>';
+ prnMsg(_('The details of outstanding transactions for Supplier') . ' - ' . $AgedAnalysis['supplierid'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg($db),'error');
+ echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
if ($debug==1){
- echo '<br>' . _('The SQL that failed was') . '<br>' . $sql;
+ echo '<br />' . _('The SQL that failed was') . '<br />' . $sql;
}
include('includes/footer.inc');
exit;
@@ -250,22 +252,11 @@
$YPos -=$line_height;
$pdf->line($Page_Width-$Right_Margin, $YPos ,220, $YPos);
-/* UldisN : this doesn't work for TCPDF
- $buf = $pdf->output();
- $len = strlen($buf);
- header('Content-type: application/pdf');
- header("Content-Length: $len");
- header('Content-Disposition: inline; filename=AgedSuppliers.pdf');
- header('Expires: 0');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
- $pdf->stream();
-*/
if ($ListCount == 0) {
- prnMsg('there are no results so the PDF is empty');
+ prnMsg('There are no results so the PDF is empty');
} else {
- $pdf->OutputD($_SESSION['DatabaseName'] . '_AggedSupliers_' . date('Y-m-d').'.pdf');//UldisN
+ $pdf->OutputD($_SESSION['DatabaseName'] . '_AggedSupliers_' . date('Y-m-d').'.pdf');
}
$pdf->__destruct();
} else { /*The option to print PDF was not hit */
@@ -280,46 +271,47 @@
/*if $FromCriteria is not set then show a form to allow input */
- echo "<form sction='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table>";
+ echo '<form sction="' . $_SERVER['PHP_SELF'] . '" method="post">
+ <table class="selection">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo '<tr><td>' . _('From Supplier Code') . ":</font></td>
- <td><input tabindex='1' type=text maxlength=6 size=7 name=FromCriteria value='1'></td>
- </tr>";
- echo '<tr><td>' . _('To Supplier Code') . ":</td>
- <td><input tabindex='2' Type=text maxlength=6 size=7 name=ToCriteria value='zzzzzz'></td>
- </tr>";
+ echo '<tr><td>' . _('From Supplier Code') . ':</font></td>
+ <td><input tabindex="1" type="text" maxlength="6" size="7" name="FromCriteria" value="1"></td>
+ </tr>';
+ echo '<tr><td>' . _('To Supplier Code') . ':</td>
+ <td><input tabindex="2" type="text" maxlength="6" size="7" name="ToCriteria" value="zzzzzz"></td>
+ </tr>';
- echo '<tr><td>' . _('All balances or overdues only') . ':' . "</td>
- <td><select tabindex='3' name='All_Or_Overdues'>";
- echo "<option selected value='All'>" . _('All suppliers with balances');
- echo "<option value='OverduesOnly'>" . _('Overdue accounts only');
+ echo '<tr><td>' . _('All balances or overdues only') . ':' . '</td>
+ <td><select tabindex="3" name="All_Or_Overdues">';
+ echo '<option selected value="All">' . _('All suppliers with balances') . '</option>';
+ echo '<option value="OverduesOnly">' . _('Overdue accounts only') . '</option>';
echo '</select></td></tr>';
- echo '<tr><td>' . _('For suppliers trading in') . ':' . "</td>
- <td><select tabindex='4' name='Currency'>";
+ echo '<tr><td>' . _('For suppliers trading in') . ':' . '</td>
+ <td><select tabindex="4" name="Currency">';
- $sql = 'SELECT currency, currabrev FROM currencies';
+ $sql = "SELECT currency, currabrev FROM currencies";
$result=DB_query($sql,$db);
while ($myrow=DB_fetch_array($result)){
if ($myrow['currabrev'] == $_SESSION['CompanyRecord']['currencydefault']){
- echo "<option selected value='" . $myrow["currabrev"] . "'>" . $myrow['currency'];
+ echo '<option selected value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>';
} else {
- echo "<option value='" . $myrow['currabrev'] . "'>" . $myrow['currency'];
+ echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>';
}
}
echo '</select></td></tr>';
- echo '<tr><td>' . _('Summary or Detailed Report') . ':' . "</td>
- <td><select tabindex='5' name='DetailedReport'>";
- echo "<option selected value='No'>" . _('Summary Report');
- echo "<option value='Yes'>" . _('Detailed Report');
+ echo '<tr><td>' . _('Summary or Detailed Report') . ':' . '</td>
+ <td><select tabindex="5" name="DetailedReport">';
+ echo '<option selected value="No">' . _('Summary Report') . '</option>';
+ echo '<option value="Yes">' . _('Detailed Report') . '</option>';
echo '</select></td></tr>';
- echo '</table><br><div class="centre"><input tabindex="6" type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>';
+ echo '</table><br /><div class="centre"><input tabindex="6" type=submit name="PrintPDF" value="' . _('Print PDF') . '"></div>';
}
include('includes/footer.inc');
} /*end of else not PrintPDF */
-?>
+?>
\ No newline at end of file
Modified: trunk/BOMExtendedQty.php
===================================================================
--- trunk/BOMExtendedQty.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/BOMExtendedQty.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -2,8 +2,8 @@
/* $Id$*/
-// BOMExtendedQty.php - Quantiy Extended Bill of Materials
-//$PageSecurity = 2;
+// BOMExtendedQty.php - Quantity Extended Bill of Materials
+
include('includes/session.inc');
if (isset($_POST['PrintPDF'])) {
@@ -15,24 +15,21 @@
$PageNumber=1;
$line_height=12;
- if (!$_POST['Quantity'] || !is_numeric($_POST['Quantity'])) {
+ if (!$_POST['Quantity'] OR !is_numeric($_POST['Quantity'])) {
$_POST['Quantity'] = 1;
}
- $sql = 'DROP TABLE IF EXISTS tempbom';
- $result = DB_query($sql,$db);
- $sql = 'DROP TABLE IF EXISTS passbom';
- $result = DB_query($sql,$db);
- $sql = 'DROP TABLE IF EXISTS passbom2';
- $result = DB_query($sql,$db);
- $sql = 'CREATE TEMPORARY TABLE passbom (
+ $result = DB_query("DROP TABLE IF EXISTS tempbom",$db);
+ $result = DB_query("DROP TABLE IF EXISTS passbom",$db);
+ $result = DB_query("DROP TABLE IF EXISTS passbom2",$db);
+ $sql = "CREATE TEMPORARY TABLE passbom (
part char(20),
extendedqpa double,
- sortpart text) DEFAULT CHARSET=utf8';
+ sortpart text) DEFAULT CHARSET=utf8";
$ErrMsg = _('The SQL to to create passbom failed with the message');
$result = DB_query($sql,$db,$ErrMsg);
- $sql = 'CREATE TEMPORARY TABLE tempbom (
+ $sql = "CREATE TEMPORARY TABLE tempbom (
parent char(20),
component char(20),
sortpart text,
@@ -41,7 +38,7 @@
loccode char(5),
effectiveafter date,
effectiveto date,
- quantity double) DEFAULT CHARSET=utf8';
+ quantity double) DEFAULT CHARSET=utf8";
$result = DB_query($sql,$db,_('Create of tempbom failed because'));
// First, find first level of components below requested assembly
// Put those first level parts in passbom, use COMPONENT in passbom
@@ -59,8 +56,8 @@
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
- $levelctr = 2;
- // $levelctr is the level counter
+ $LevelCounter = 2;
+ // $LevelCounter is the level counter
$sql = "INSERT INTO tempbom (
parent,
component,
@@ -74,7 +71,7 @@
SELECT bom.parent,
bom.component,
CONCAT(bom.parent,bom.component) AS sortpart,"
- . $levelctr . " as level,
+ . $LevelCounter . " as level,
bom.workcentreadded,
bom.loccode,
bom.effectiveafter,
@@ -86,13 +83,13 @@
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
//echo "</br>sql is $sql</br>";
- // This while routine finds the other levels as long as $componentctr - the
+ // This while routine finds the other levels as long as $ComponentCounter - the
// component counter finds there are more components that are used as
// assemblies at lower levels
- $componentctr = 1;
- while ($componentctr > 0) {
- $levelctr++;
+ $ComponentCounter = 1;
+ while ($ComponentCounter > 0) {
+ $LevelCounter++;
$sql = "INSERT INTO tempbom (
parent,
component,
@@ -106,7 +103,7 @@
SELECT bom.parent,
bom.component,
CONCAT(passbom.sortpart,bom.component) AS sortpart,
- $levelctr as level,
+ " . $LevelCounter . " as level,
bom.workcentreadded,
bom.loccode,
bom.effectiveafter,
@@ -118,22 +115,15 @@
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
- $sql = 'DROP TABLE IF EXISTS passbom2';
- $result = DB_query($sql,$db);
+ $result = DB_query("DROP TABLE IF EXISTS passbom2",$db);
+ $result = DB_query("ALTER TABLE passbom RENAME AS passbom2",$db);
+ $result = DB_query("DROP TABLE IF EXISTS passbom",$db);
- $sql = 'ALTER TABLE passbom RENAME AS passbom2';
+ $sql = "CREATE TEMPORARY TABLE passbom (part char(20),
+ extendedqpa decimal(10,3),
+ sortpart text) DEFAULT CHARSET=utf8";
$result = DB_query($sql,$db);
- $sql = 'DROP TABLE IF EXISTS passbom';
- $result = DB_query($sql,$db);
-
- $sql = 'CREATE TEMPORARY TABLE passbom (
- part char(20),
- extendedqpa decimal(10,3),
- sortpart text) DEFAULT CHARSET=utf8';
- $result = DB_query($sql,$db);
-
-
$sql = "INSERT INTO passbom (part, extendedqpa, sortpart)
SELECT bom.component AS part,
(bom.quantity * passbom2.extendedqpa),
@@ -145,15 +135,15 @@
$result = DB_query($sql,$db);
- $sql = 'SELECT COUNT(*) FROM bom, passbom
+ $sql = "SELECT COUNT(*) FROM bom, passbom
WHERE bom.parent = passbom.part
- GROUP BY passbom.part';
+ GROUP BY passbom.part";
$result = DB_query($sql,$db);
$myrow = DB_fetch_row($result);
- $componentctr = $myrow[0];
+ $ComponentCounter = $myrow[0];
- } // End of while $componentctr > 0
+ } // End of while $ComponentCounter > 0
if (DB_error_no($db) !=0) {
$title = _('Quantity Extended BOM Listing') . ' - ' . _('Problem Report');
@@ -167,9 +157,8 @@
exit;
}
- PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
- $Right_Margin);
- $sql = "SELECT stockmaster.stockid,stockmaster.description
+ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin);
+ $sql = "SELECT stockid,description
FROM stockmaster
WHERE stockid = '" . $_POST['Part'] . "'";
$result = DB_query($sql,$db);
@@ -181,7 +170,7 @@
$Tot_Val=0;
$fill = false;
$pdf->SetFillColor(224,235,255);
- $sql = 'SELECT tempbom.component,
+ $sql = "SELECT tempbom.component,
SUM(tempbom.quantity) as quantity,
stockmaster.description,
stockmaster.decimalplaces,
@@ -207,10 +196,10 @@
GROUP BY tempbom.component,
stockmaster.description,
stockmaster.decimalplaces,
- stockmaster.mbflag';
+ stockmaster.mbflag";
$result = DB_query($sql,$db);
- $ListCount = DB_num_rows($result); // UldisN
- While ($myrow = DB_fetch_array($result,$db)){
+ $ListCount = DB_num_rows($result);
+ while ($myrow = DB_fetch_array($result,$db)){
// Parameters for addTextWrap are defined in /includes/class.pdf.php
// 1) X position 2) Y position 3) Width
@@ -239,8 +228,7 @@
$myrow['decimalplaces']),'right',0,$fill);
}
if ($YPos < $Bottom_Margin + $line_height){
- PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
- $Right_Margin);
+ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin);
}
} /*end while loop */
@@ -249,14 +237,13 @@
$YPos -= (2*$line_height);
if ($YPos < $Bottom_Margin + $line_height){
- PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,
- $Right_Margin);
+ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width,$Right_Margin);
}
if ($ListCount == 0) {
$title = _('Print Indented BOM Listing Error');
include('includes/header.inc');
prnMsg(_('There were no items for the selected assembly'),'error');
- echo "<br /><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>';
+ echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
include('includes/footer.inc');
exit;
} else {
@@ -271,19 +258,29 @@
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' .
_('Search') . '" alt="" />' . ' ' . $title.'</p><br />';
- echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>";
+ echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . ' method="post"><table class="selection">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo '<tr><td>' . _('Part') . ":</td><td><input type ='text' name='Part' size='20'>";
- echo '<tr><td>' . _('Quantity') . ":</td><td><input type='text' class=number name='Quantity' size='4'>";
- echo '<tr><td>' . _('Selection Option') . ":</td><td><select name='Select'>";
- echo "<option selected value='All'>" . _('Show All Parts');
- echo "<option value='Shortages'>" . _('Only Show Shortages');
- echo '</select></td></tr>';
- echo '<tr><td>' . _('Print Option') . ":</td><td><select name='Fill'>";
- echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines');
- echo "<option value='no'>" . _('Plain Print');
- echo '</select></td></tr>';
- echo "</table></br></br><div class='centre'><br /><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>";
+ echo '<tr><td>' . _('Part') . ':</td>
+ <td><input type ="text" name="Part" size="20">';
+ echo '<tr><td>' . _('Quantity') . ':</td>
+ <td><input type="text" class="number" name="Quantity" size="4"></td></tr>';
+
+ echo '<tr><td>' . _('Selection Option') . ':</td>
+ <td><select name="Select">
+ <option selected value="All">' . _('Show All Parts') . '</option>
+ <option value="Shortages">' . _('Only Show Shortages') . '</option>
+ </select></td></tr>';
+ echo '<tr><td>' . _('Print Option') . ':</td>
+ <td><select name="Fill">
+ <option selected value="yes">' . _('Print With Alternating Highlighted Lines') . '</option>
+ <option value="no">' . _('Plain Print') . '</option>
+ </select></td></tr>';
+ echo '</table>
+ </br>
+ </br>
+ <div class="centre">
+ <br /><input type=submit name="PrintPDF" value="' . _('Print PDF') . '">
+ </div>';
include('includes/footer.inc');
@@ -334,4 +331,4 @@
$YPos =$YPos - (2*$line_height);
$PageNumber++;
} // End of PrintHeader function
-?>
+?>
\ No newline at end of file
Modified: trunk/BOMIndented.php
===================================================================
--- trunk/BOMIndented.php 2011-06-13 10:23:44 UTC (rev 4596)
+++ trunk/BOMIndented.php 2011-06-17 09:16:37 UTC (rev 4597)
@@ -53,8 +53,8 @@
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
- $levelctr = 2;
- // $levelctr is the level counter
+ $LevelCounter = 2;
+ // $LevelCounter is the level counter
$sql = "INSERT INTO tempbom (
parent,
component,
@@ -68,7 +68,7 @@
SELECT bom.parent,
bom.component,
CONCAT(bom.parent,bom.component) AS sortpart,
- '$levelctr' as level,
+ " . $LevelCounter . " AS level,
bom.workcentreadded,
bom.loccode,
bom.effectiveafter,
@@ -80,14 +80,14 @@
AND bom.effectiveafte...
[truncated message content] |