|
From: <dai...@us...> - 2014-09-19 20:25:11
|
Revision: 6895
http://sourceforge.net/p/web-erp/reponame/6895
Author: daintree
Date: 2014-09-19 20:25:01 +0000 (Fri, 19 Sep 2014)
Log Message:
-----------
Amendments to CustomerInquiry Tim, StockStatus Bob Thomas
Modified Paths:
--------------
trunk/CustomerInquiry.php
trunk/StockStatus.php
trunk/doc/Change.log
Modified: trunk/CustomerInquiry.php
===================================================================
--- trunk/CustomerInquiry.php 2014-09-19 19:27:05 UTC (rev 6894)
+++ trunk/CustomerInquiry.php 2014-09-19 20:25:01 UTC (rev 6895)
@@ -1,51 +1,43 @@
<?php
-/* $Id$*/
-
-include('includes/SQL_CommonFunctions.inc');
-
include('includes/session.inc');
$Title = _('Customer Inquiry');
-
-$ViewTopic = 'ARInquiries';
-$BookMark = 'CustomerInquiry';
-
+/* Manual links before header.inc */
+$ViewTopic = 'ARInquiries'; // Filename in ManualContents.php's TOC.
+$BookMark = 'CustomerInquiry'; // Anchor's id in the manual's html document.
include('includes/header.inc');
// always figure out the SQL required from the inputs available
-if(!isset($_GET['CustomerID']) AND !isset($_SESSION['CustomerID'])) {
- prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'),'info');
- echo '<br /><div class="centre"><a href="'. $RootPath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br /></div>';
+if (!isset($_GET['CustomerID']) and !isset($_SESSION['CustomerID'])) {
+ prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'), 'info');
+ echo '<br /><div class="centre"><a href="', $RootPath, '/SelectCustomer.php">', _('Select a Customer to Inquire On'), '</a></div>';
include('includes/footer.inc');
exit;
} else {
if (isset($_GET['CustomerID'])) {
- $_SESSION['CustomerID'] = $_GET['CustomerID'];
+ $_SESSION['CustomerID'] = stripslashes($_GET['CustomerID']);
}
$CustomerID = $_SESSION['CustomerID'];
}
-if(isset($_GET['Status'])){
- if(is_numeric($_GET['Status'])){
+
+if (isset($_GET['Status'])) {
+ if (is_numeric($_GET['Status'])) {
$_POST['Status'] = $_GET['Status'];
}
-}
-if(isset($_POST['Status'])){
- if($_POST['Status']=='' OR $_POST['Status']==1 OR $_POST['Status']==0){
+} elseif (isset($_POST['Status'])) {
+ if($_POST['Status'] == '' or $_POST['Status'] == 1 or $_POST['Status'] == 0) {
$Status = $_POST['Status'];
- }else{
- prnMsg(_('The balance status should be all or zero balance or not zero balance'),'error');
+ } else {
+ prnMsg(_('The balance status should be all or zero balance or not zero balance'), 'error');
exit;
}
+} else {
+ $_POST['Status'] = '';
}
+
if (!isset($_POST['TransAfterDate'])) {
- $sql = "SELECT confvalue
- FROM `config`
- WHERE confname ='NumberOfMonthMustBeShown'";
- $ErrMsg=_('The config value NumberOfMonthMustBeShown cannot be retrieved');
- $result = DB_query($sql,$db,$ErrMsg);
- $row = DB_fetch_array($result);
- $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m')-$row['confvalue'],Date('d'),Date('Y')));
+ $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - $_SESSION['NumberOfMonthMustBeShown'], Date('d'), Date('Y')));
}
$SQL = "SELECT debtorsmaster.name,
@@ -55,8 +47,7 @@
debtorsmaster.creditlimit,
holdreasons.dissallowinvoices,
holdreasons.reasondescription,
- SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount
-- debtortrans.alloc) AS balance,
+ SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) AS balance,
SUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN
CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= paymentterms.daysbeforedue
THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
@@ -65,11 +56,10 @@
END) AS due,
SUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN
CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue
- AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " .
- $_SESSION['PastDueDays1'] . ")
+ AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ")
THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
ELSE
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ". INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ")
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ")
THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount
- debtortrans.alloc ELSE 0 END
END) AS overdue1,
@@ -77,18 +67,18 @@
CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue
AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
ELSE
- CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1','MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
+ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
END) AS overdue2
FROM debtorsmaster,
- paymentterms,
- holdreasons,
- currencies,
- debtortrans
+ paymentterms,
+ holdreasons,
+ currencies,
+ debtortrans
WHERE debtorsmaster.paymentterms = paymentterms.termsindicator
- AND debtorsmaster.currcode = currencies.currabrev
- AND debtorsmaster.holdreason = holdreasons.reasoncode
- AND debtorsmaster.debtorno = '" . $CustomerID . "'
- AND debtorsmaster.debtorno = debtortrans.debtorno";
+ AND debtorsmaster.currcode = currencies.currabrev
+ AND debtorsmaster.holdreason = holdreasons.reasoncode
+ AND debtorsmaster.debtorno = '" . $CustomerID . "'
+ AND debtorsmaster.debtorno = debtortrans.debtorno";
if ($_SESSION['SalesmanLogin'] != '') {
$SQL .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
@@ -104,9 +94,9 @@
holdreasons.reasondescription";
$ErrMsg = _('The customer details could not be retrieved by the SQL because');
-$CustomerResult = DB_query($SQL,$db,$ErrMsg);
+$CustomerResult = DB_query($SQL, $ErrMsg);
-if (DB_num_rows($CustomerResult)==0) {
+if (DB_num_rows($CustomerResult) == 0) {
/*Because there is no balance - so just retrieve the header information about the customer - the choice is do one query to get the balance and transactions for those customers who have a balance and two queries for those who don't have a balance OR always do two queries - I opted for the former */
@@ -122,14 +112,14 @@
holdreasons.reasondescription
FROM debtorsmaster INNER JOIN paymentterms
ON debtorsmaster.paymentterms = paymentterms.termsindicator
+ INNER JOIN currencies
+ ON debtorsmaster.currcode = currencies.currabrev
INNER JOIN holdreasons
ON debtorsmaster.holdreason = holdreasons.reasoncode
- INNER JOIN currencies
- ON debtorsmaster.currcode = currencies.currabrev
WHERE debtorsmaster.debtorno = '" . $CustomerID . "'";
- $ErrMsg =_('The customer details could not be retrieved by the SQL because');
- $CustomerResult = DB_query($SQL,$db,$ErrMsg);
+ $ErrMsg = _('The customer details could not be retrieved by the SQL because');
+ $CustomerResult = DB_query($SQL, $ErrMsg);
} else {
$NIL_BALANCE = False;
@@ -137,77 +127,68 @@
$CustomerRecord = DB_fetch_array($CustomerResult);
-if ($NIL_BALANCE==True) {
- $CustomerRecord['balance']=0;
- $CustomerRecord['due']=0;
- $CustomerRecord['overdue1']=0;
- $CustomerRecord['overdue2']=0;
+if ($NIL_BALANCE == True) {
+ $CustomerRecord['balance'] = 0;
+ $CustomerRecord['due'] = 0;
+ $CustomerRecord['overdue1'] = 0;
+ $CustomerRecord['overdue2'] = 0;
}
-include('includes/CurrenciesArray.php'); // To get the currency name from the currency code.
-echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/customer.png" title="' . _('Customer') . '" alt="" /> ' .
- _('Customer') . ': ' .
- $CustomerID . ' - ' . $CustomerRecord['name'] . '<br />' .
- _('All amounts stated in') . ': ' .
- $CustomerRecord['currency'] . '<br />' . // To be replaced by:
-/* $CustomerRecord['currcode'] . ' - ' . $CurrencyName[$CustomerRecord['currcode']] . '<br />' . // <-- Replacement */
- _('Terms') . ': ' .
- $CustomerRecord['terms'] . '<br />' .
- _('Credit Limit') . ': ' .
- locale_number_format($CustomerRecord['creditlimit'],0) . '<br />' .
- _('Credit Status') . ': ' .
- $CustomerRecord['reasondescription'] . '</p>';
-if ($CustomerRecord['dissallowinvoices']!=0) {
- echo '<br /><font color="red" size="4"><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />';
+echo '<div class="toplink">
+ <a href="', $RootPath, '/SelectCustomer.php">', _('Back to Customer Screen'), '</a>
+ </div>';
+
+echo '<p class="page_title_text">
+ <img src="', $RootPath, '/css/', $Theme, '/images/customer.png" title="', _('Customer'), '" alt="" />', _('Customer'), ': ', stripslashes($CustomerID), ' - ', $CustomerRecord['name'], '<br />', _('All amounts stated in'), ': ', $CustomerRecord['currency'], '<br />', _('Terms'), ': ', $CustomerRecord['terms'], '<br />', _('Credit Limit'), ': ', locale_number_format($CustomerRecord['creditlimit'], 0), '<br />', _('Credit Status'), ': ', $CustomerRecord['reasondescription'], '
+ </p>';
+
+if ($CustomerRecord['dissallowinvoices'] != 0) {
+ echo '<br /><font color="red" size="4"><b>', _('ACCOUNT ON HOLD'), '</font></b><br />';
}
echo '<table class="selection" width="70%">
<tr>
- <th style="width:20%">' . _('Total Balance') . '</th>
- <th style="width:20%">' . _('Current') . '</th>
- <th style="width:20%">' . _('Now Due') . '</th>
- <th style="width:20%">' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th>
- <th style="width:20%">' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>';
+ <th style="width:20%">', _('Total Balance'), '</th>
+ <th style="width:20%">', _('Current'), '</th>
+ <th style="width:20%">', _('Now Due'), '</th>
+ <th style="width:20%">', $_SESSION['PastDueDays1'], '-', $_SESSION['PastDueDays2'], ' ' . _('Days Overdue'), '</th>
+ <th style="width:20%">', _('Over'), ' ', $_SESSION['PastDueDays2'], ' ', _('Days Overdue'), '</th>
+ </tr>';
echo '<tr>
- <td class="number">' . locale_number_format($CustomerRecord['balance'],$CustomerRecord['decimalplaces']) . '</td>
- <td class="number">' . locale_number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),$CustomerRecord['decimalplaces']) . '</td>
- <td class="number">' . locale_number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),$CustomerRecord['decimalplaces']) . '</td>
- <td class="number">' . locale_number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,$CustomerRecord['decimalplaces']) . '</td>
- <td class="number">' . locale_number_format($CustomerRecord['overdue2'],$CustomerRecord['decimalplaces']) . '</td>
+ <td class="number">', locale_number_format($CustomerRecord['balance'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format(($CustomerRecord['balance'] - $CustomerRecord['due']), $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format(($CustomerRecord['due'] - $CustomerRecord['overdue1']), $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format(($CustomerRecord['overdue1'] - $CustomerRecord['overdue2']), $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($CustomerRecord['overdue2'], $CustomerRecord['decimalplaces']), '</td>
</tr>
- </table>';
-if(!isset($_POST['Status'])){
- $_POST['Status'] = '';
+</table>';
+
+echo '<form onSubmit="return VerifyForm(this);" action="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '" method="post" class="noPrint">
+ <input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" />';
+echo _('Show all transactions after'), ':<input tabindex="1" type="text" required="required" class="date" alt="', $_SESSION['DefaultDateFormat'], '" id="datepicker" name="TransAfterDate" value="', $_POST['TransAfterDate'], '" minlength="0" maxlength="10" size="12" />';
+
+echo '<select name="Status">';
+if ($_POST['Status'] == '') {
+ echo '<option value="" selected="selected">', _('All'), '</option>';
+ echo '<option value="1">', _('Invoices not fully allocated'), '</option>';
+ echo '<option value="0">', _('Invoices fully allocated'), '</option>';
+} else {
+ if ($_POST['Status'] == 0) {
+ echo '<option value="">', _('All'), '</option>';
+ echo '<option value="1">', _('Invoices not fully allocated'), '</option>';
+ echo '<option selected="selected" value="0">', _('Invoices fully allocated'), '</option>';
+ } elseif ($_POST['Status'] == 1) {
+ echo '<option value="" selected="selected">', _('All'), '</option>';
+ echo '<option selected="selected" value="1">', _('Invoices not fully allocated'), '</option>';
+ echo '<option value="0">', _('Invoices fully allocated'), '</option>';
+ }
}
-echo '<br />
- <div class="centre">
- <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
- <div>
- <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'
- . _('Show all transactions after') . ': <input tabindex="1" type="text" required="required" title="' . _('A date after which all transactions for the customer should be displayed must be entered') . '" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" value="' . $_POST['TransAfterDate'] . '" maxlength="10" size="12" />
- <select name="Status">';
- if($_POST['Status']==''){
- echo '<option value="" selected="selected">' . _('All') . '</option>';
- echo '<option value="1">' . _('Invoices not fully allocated') . '</option>';
- echo '<option value="0">' . _('Invoices fully allocated') . '</option>';
- }else{
- $Choice = ($_POST['Status']==1)?_('Invoices fully allocated'):_('Invoices not fully allocated');
- $ChoiceLeft = ($_POST['Status']==1)?_('Invoices not fully allocated'):_('Invoices fully allocated');
- echo '<option value="' . $_POST['Status'] . '" selected="selected">' . $Choice . '</option>';
- $StatusValue = ($_POST['Status']==1)?0:1;
- echo '<option value="' . $StatusValue . '">' . $ChoiceLeft . '</option>';
- echo '<option value="">' . _('All') . '</option>';
+echo '</select>';
+echo '<input tabindex="3" type="submit" name="Refresh Inquiry" value="', _('Refresh Inquiry'), '" />
+ </form>';
- }
-
-echo '</select><input tabindex="3" type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '" />
- </div>
- </form>
- </div>
- <br />';
-
$DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']);
$SQL = "SELECT systypes.typename,
@@ -219,62 +200,58 @@
debtortrans.reference,
debtortrans.invtext,
debtortrans.order_,
+ salesorders.customerref,
debtortrans.rate,
(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount) AS totalamount,
- debtortrans.alloc AS allocated,
- (debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) as balance
- FROM debtortrans INNER JOIN systypes
- ON debtortrans.type = systypes.typeid
- WHERE debtortrans.debtorno = '" . $CustomerID . "'
- AND debtortrans.trandate >= '" . $DateAfterCriteria . "'";
+ debtortrans.alloc AS allocated
+ FROM debtortrans
+ INNER JOIN systypes
+ ON debtortrans.type = systypes.typeid
+ LEFT JOIN salesorders
+ ON salesorders.orderno=debtortrans.order_
+ WHERE debtortrans.debtorno = '" . $CustomerID . "'
+ AND debtortrans.trandate >= '" . $DateAfterCriteria . "'";
if ($_SESSION['SalesmanLogin'] != '') {
$SQL .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
}
-if (isset($Status) AND $Status != '') {
- $SQL .= ($Status==1)?' having balance<=0.00001 ':' having balance>0.00001 ';
-}
-
$SQL .= " ORDER BY debtortrans.id";
$ErrMsg = _('No transactions were returned by the SQL because');
-$TransResult = DB_query($SQL,$db,$ErrMsg);
+$TransResult = DB_query($SQL, $ErrMsg);
-if (DB_num_rows($TransResult)==0){
- echo '<div class="centre">' . _('There are no transactions to display since') . ' ' . $_POST['TransAfterDate'] . '</div>';
+if (DB_num_rows($TransResult) == 0) {
+ echo '<div class="centre">', _('There are no transactions to display since'), ' ', $_POST['TransAfterDate'], '</div>';
include('includes/footer.inc');
exit;
}
-/*show a table of the invoices returned by the SQL */
-echo '<table class="selection">';
+/* Show a table of the invoices returned by the SQL. */
-$tableheader = '<tr>
- <th class="assending">' . _('Type') . '</th>
- <th class="assending">' . _('Number') . '</th>
- <th class="ascending">' . _('Date') . '</th>
- <th>' . _('Branch') . '</th>
- <th>' . _('Reference') . '</th>
- <th>' . _('Comments') . '</th>
- <th>' . _('Order') . '</th>
- <th>' . _('Total') . '</th>
- <th>' . _('Allocated') . '</th>
- <th>' . _('Balance') . '</th>
- <th>' . _('More Info') . '</th>
- <th>' . _('More Info') . '</th>
- <th>' . _('More Info') . '</th>
- <th>' . _('More Info') . '</th>
- <th>' . _('More Info') . '</th>
- </tr>';
+echo '<table class="selection">
+ <tr>
+ <th class="SortableColumn">', _('Type'), '</th>
+ <th class="SortableColumn">', _('Number'), '</th>
+ <th class="SortableColumn">', _('Date'), '</th>
+ <th>', _('Branch'), '</th>
+ <th class="SortableColumn">', _('Reference'), '</th>
+ <th>', _('Comments'), '</th>
+ <th>', _('Order'), '</th>
+ <th>', _('Total'), '</th>
+ <th>', _('Allocated'), '</th>
+ <th>', _('Balance'), '</th>
+ <th>', _('More Info'), '</th>
+ <th>', _('More Info'), '</th>
+ <th>', _('More Info'), '</th>
+ <th>', _('More Info'), '</th>
+ <th>', _('More Info'), '</th>
+ </tr>';
-echo $tableheader;
+$k = 0; //row colour counter
+while ($MyRow = DB_fetch_array($TransResult)) {
-$j = 1;
-$k = 0;//row colour counter
-while ($myrow=DB_fetch_array($TransResult)) {
-
- if ($k==1) {
+ if ($k == 1) {
echo '<tr class="EvenTableRows">';
$k = 0;
} else {
@@ -282,305 +259,371 @@
$k = 1;
}
- $FormatedTranDate = ConvertSQLDate($myrow['trandate']);
+ $FormatedTranDate = ConvertSQLDate($MyRow['trandate']);
- if ($_SESSION['InvoicePortraitFormat']==1){ //Invoice/credits in portrait
+ if ($_SESSION['InvoicePortraitFormat'] == 1) { //Invoice/credits in portrait
$PrintCustomerTransactionScript = 'PrintCustTransPortrait.php';
} else { //produce pdfs in landscape
$PrintCustomerTransactionScript = 'PrintCustTrans.php';
}
- $BaseFormatString = '<td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td style="width:200px">%s</td>
- <td>%s</td>
- <td class="number">%s</td>
- <td class="number">%s</td>
- <td class="number">%s</td>';
+ /* if the user is allowed to create credits for invoices */
+ if (in_array($_SESSION['PageSecurityArray']['Credit_Invoice.php'], $_SESSION['AllowedPageSecurityTokens']) and $MyRow['type'] == 10) {
+ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) {
+ /* Show transactions where:
+ * - Is invoice
+ * - User can raise credits
+ * - User can view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td>
+ <a href="', $RootPath, '/Credit_Invoice.php?InvoiceNumber=', $MyRow['transno'], '">', _('Credit '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/credit.png" title="', _('Click to credit the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice">', _('HTML '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/preview.png" title="', _('Click to preview the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/', $PrintCustomerTransactionScript, '?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice&PrintPDF=True">', _('PDF '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/pdf.png" title="', _('Click for PDF'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/EmailCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice">', _('Email '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/email.png" title="', _('Click to email the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/GLTransInquiry.php?TypeID=', $MyRow['type'], '&TransNo=', $MyRow['transno'], '">', _('View GL Entries'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/gl.png" title="', _('View the GL Entries'), '" alt="" />
+ </a>
+ </td>
+ </tr>';
+ } else {
+ /* Show transactions where:
+ * - Is invoice
+ * - User can raise credits
+ * - User cannot view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td>
+ <a href="', $RootPath, '/Credit_Invoice.php?InvoiceNumber=', $MyRow['transno'], '">' . _('Credit ') . '
+ <img src="', $RootPath, '/css/', $Theme, '/images/credit.png" title="', _('Click to credit the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice">', _('HTML '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/preview.png" title="', _('Click to preview the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/', $PrintCustomerTransactionScript, '?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice&PrintPDF=True">', _('PDF '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/pdf.png" title="', _('Click for PDF'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/EmailCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice">', _('Email ') . '
+ <img src="', $RootPath, '/css/', $Theme, '/images/email.png" title="', _('Click to email the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td></td>
+ </tr>';
-
- $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') . '<img src="%s/credit.gif" title="' . _('Click to credit the invoice') . '" alt="" /></a></td>';
-
- $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<img src="%s/preview.gif" title="' . _('Click to preview the invoice') . '" alt="" /></a></td>
- <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $Theme . '/images/pdf.png" title="' . _('Click for PDF') . '" alt="" /></a></td>
- <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<img src="%s/email.gif" title="' . _('Click to email the invoice') . '" alt="" /></a></td>';
-
- $PreviewCreditFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('HTML ') . ' <IMG SRC="%s/preview.gif" title="' . _('Click to preview the credit note') . '" /></a></td>
- <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $Theme . '/images/pdf.png" title="' . _('Click for PDF') . '" alt="" /></a></td>
- <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <img src="%s/email.gif" title="' . _('Click to email the credit note') . '" alt="" /></a></td>';
-
- /* assumed allowed page security token 3 allows the user to create credits for invoices */
- if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) AND $myrow['type']==10){
- /*Show a link to allow an invoice to be credited */
-
- /* assumed allowed page security token 8 allows the user to see GL transaction information */
- if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){
-
- /* format string with GL inquiry options and for invoice to be credited */
-
- printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString .
- '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . '
- <img src="' .$RootPath. '/css/'.$Theme.'/images/gl.png" title="' . _('View the GL Entries') . '" alt="" /></a></td>
- </tr>',
- //$BaseFormatString parameters
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- //$CreditInvoiceFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- //$PreviewInvoiceFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- $RootPath,
- $PrintCustomerTransactionScript,
- $myrow['transno'],
- $RootPath,
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- //Parameter for string for GL Trans Inquiries
- $RootPath,
- $myrow['type'],
- $myrow['transno']);
- } else { //user does not have privileges to see GL inquiry stuff
-
- printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . '</tr>',
- //BaseFormatString parameters
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- //CreditInvoiceFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- //$PreviewInvoiceFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- $RootPath,
- $PrintCustomerTransactionScript,
- $myrow['transno'],
- $RootPath,
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images');
}
- } elseif($myrow['type']==10) { /*its an invoice but not high enough priveliges to credit it */
+ } elseif ($MyRow['type'] == 10) {
+ /* Show transactions where:
+ * - Is invoice
+ * - User cannot raise credits
+ * - User cannot view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td></td>
+ <td>
+ <a href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice">', _('HTML '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/preview.png" title="', _('Click to preview the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/', $PrintCustomerTransactionScript, '?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '
+ <img src="', $RootPath, '/css/', $Theme, '/images/pdf.png" title="', _('Click for PDF'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/EmailCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Invoice">', _('Email ') . '
+ <img src="', $RootPath, '/css/', $Theme, '/images/email.png" title="', _('Click to email the invoice'), '" alt="" />
+ </a>
+ </td>
+ <td></td>
+ </tr>';
- printf($BaseFormatString .
- $PreviewInvoiceFormatString .
- '</tr>',
- //$BaseFormatString parameters
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- //$PreviewInvoiceFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- $RootPath,
- $PrintCustomerTransactionScript,
- $myrow['transno'],
- $RootPath,
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images');
+ } elseif ($MyRow['type'] == 11) {
+ /* Show transactions where:
+ * - Is credit note
+ * - User can view GL transactions
+ */
+ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) {
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td>
+ <a href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Credit">', _('HTML '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/preview.png" title="', _('Click to preview the credit note'), '" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/', $PrintCustomerTransactionScript, '?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Credit&PrintPDF=True">', _('PDF '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/pdf.png" title="', _('Click for PDF'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/EmailCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Credit">', _('Email'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/email.png" title="', _('Click to email the credit note'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/CustomerAllocations.php?AllocTrans=', $MyRow['id'], '">', _('Allocation'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/allocation.png" title="', _('Click to allocate funds'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/GLTransInquiry.php?TypeID=', $MyRow['type'], '&TransNo=', $MyRow['transno'], '">' . _('View GL Entries') . '
+ <img src="', $RootPath, '/css/', $Theme, '/images/gl.png" title="', _('View the GL Entries'), '" alt="" />
+ </a>
+ </td>
+ </tr>';
- } elseif ($myrow['type']==11) { /*its a credit note */
- if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){
- printf($BaseFormatString .
- $PreviewCreditFormatString .
- '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$RootPath .'/css/' . $Theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '" alt="" /></a></td>
- <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a><img src="' .$RootPath.'/css/'.$Theme.'/images/gl.png" title="' . _('View the GL Entries') . '" alt="" /></a></td></tr>',
- //$BaseFormatString parameters
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- //$PreviewCreditFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- $RootPath,
- $PrintCustomerTransactionScript,
- $myrow['transno'],
- $RootPath,
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- // hand coded format string for Allocations and GLTrans Inquiry parameters
- $RootPath,
- $myrow['id'],
- $RootPath,
- $myrow['type'],
- $myrow['transno']);
} else {
- printf($BaseFormatString .
- $PreviewCreditFormatString .
- '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="%s/allocation.png" title="' . _('Click to allocate funds') . '" alt="" /></a></td>
- </tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- //$PreviewCreditFormatString parameters
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- $RootPath,
- $PrintCustomerTransactionScript,
- $myrow['transno'],
- $RootPath,
- $RootPath,
- $myrow['transno'],
- $RootPath.'/css/'.$Theme.'/images',
- //Parameters for hand coded string to show allocations
- $RootPath,
- $myrow['id'],
- $RootPath.'/css/'.$Theme.'/images');
+ /* Show transactions where:
+ * - Is credit note
+ * - User cannot view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td>
+ <a href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Credit">', _('HTML '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/preview.png" title="', _('Click to preview the credit note'), '" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/', $PrintCustomerTransactionScript, '?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Credit&PrintPDF=True">', _('PDF '), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/pdf.png" title="', _('Click for PDF'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/EmailCustTrans.php?FromTransNo=', $MyRow['transno'], '&InvOrCredit=Credit">', _('Email'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/email.png" title="', _('Click to email the credit note'), '" alt="" />
+ </a>
+ </td>
+ <td>
+ <a href="', $RootPath, '/CustomerAllocations.php?AllocTrans=', $MyRow['id'], '">', _('Allocation'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/allocation.png" title="', _('Click to allocate funds'), '" alt="" />
+ </a>
+ </td>
+ <td></td>
+ </tr>';
+
}
- } elseif ($myrow['type']==12 AND $myrow['totalamount']<0) { /*its a receipt which could have an allocation*/
+ } elseif ($MyRow['type'] == 12 and $MyRow['totalamount'] < 0) {
+ /* Show transactions where:
+ * - Is receipt
+ * - User can view GL transactions
+ */
+ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) {
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td>
+ <a href="', $RootPath, '/CustomerAllocations.php?AllocTrans=', $MyRow['id'], '">', _('Allocation'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/allocation.png" title="', _('Click to allocate funds'), '" alt="" />
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>
+ <a href="', $RootPath, '/GLTransInquiry.php?TypeID=', $MyRow['type'], '&TransNo=', $MyRow['transno'], '">', _('View GL Entries'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/gl.png" title="', _('View the GL Entries'), '" alt="" />
+ </a>
+ </td>
+ </tr>';
- //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries
- if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){
- printf($BaseFormatString .
- '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$RootPath . '/css/' . $Theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '" alt="" /></a></td>
- <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$RootPath . '/css/' . $Theme .'/images/gl.png" title="' . _('View the GL Entries') . '" alt="" /></a></td>
- </tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- $RootPath,
- $myrow['id'],
- $RootPath,
- $myrow['type'],
- $myrow['transno']);
} else { //no permission for GLTrans Inquiries
- printf($BaseFormatString .
- '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$RootPath . '/css/' . $Theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '" alt="" /></a></td>
- </tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- $RootPath,
- $myrow['id']);
+ /* Show transactions where:
+ * - Is credit note
+ * - User cannot view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td>
+ <a href="', $RootPath, '/CustomerAllocations.php?AllocTrans=', $MyRow['id'], '">', _('Allocation'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/allocation.png" title="', _('Click to allocate funds'), '" alt="" />
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>';
+
}
- } elseif ($myrow['type']==12 AND $myrow['totalamount']>0) { /*its a negative receipt */
+ } elseif ($MyRow['type'] == 12 and $MyRow['totalamount'] > 0) {
+ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) {
+ /* Show transactions where:
+ * - Is a negative receipt
+ * - User can view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>
+ <a href="', $RootPath, '/GLTransInquiry.php?TypeID=', $MyRow['type'], '&TransNo=', $MyRow['transno'], '">' . _('View GL Entries') . '
+ <img src="', $RootPath, '/css/', $Theme, '/images/gl.png" title="', _('View the GL Entries'), '" alt="" />
+ </a>
+ </td>
+ </tr>';
- //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries
- if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){
- printf($BaseFormatString .
- '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- $RootPath,
- $myrow['type'],
- $myrow['transno']);
- } else { //no permission for GLTrans Inquiries
- printf($BaseFormatString . '<td></tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']));
+ } else {
+ /* Show transactions where:
+ * - Is a negative receipt
+ * - User cannot view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>';
}
} else {
- //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries
- if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){
- printf($BaseFormatString .
- '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']),
- $RootPath,
- $myrow['type'],
- $myrow['transno']);
+ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) {
+ /* Show transactions where:
+ * - Is a misc transaction
+ * - User can view GL transactions
+ */
+ echo '<td>', _($MyRow['typename']), '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>
+ <a href="', $RootPath, '/GLTransInquiry.php?TypeID=', $MyRow['type'], '&TransNo=', $MyRow['transno'], '">', _('View GL Entries'), '
+ <img src="', $RootPath, '/css/', $Theme, '/images/gl.png" title="', _('View the GL Entries'), '" alt="" />
+ </a>
+ </td>
+ </tr>';
+
} else {
- printf($BaseFormatString . '</tr>',
- $myrow['typename'],
- $myrow['transno'],
- ConvertSQLDate($myrow['trandate']),
- $myrow['branchcode'],
- $myrow['reference'],
- $myrow['invtext'],
- $myrow['order_'],
- locale_number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['allocated'],$CustomerRecord['decimalplaces']),
- locale_number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']));
+ /* Show transactions where:
+ * - Is a misc transaction
+ * - User cannot view GL transactions
+ */
+ echo '<td>', $MyRow['typename'], '</td>
+ <td>', $MyRow['transno'], '</td>
+ <td>', ConvertSQLDate($MyRow['trandate']), '</td>
+ <td>', $MyRow['branchcode'], '</td>
+ <td>', $MyRow['reference'], '</td>
+ <td style="width:200px">', $MyRow['invtext'], '</td>
+ <td>', $MyRow['order_'], '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td class="number">', locale_number_format($MyRow['totalamount'] - $MyRow['allocated'], $CustomerRecord['decimalplaces']), '</td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>';
}
}
@@ -589,4 +632,4 @@
echo '</table>';
include('includes/footer.inc');
-?>
+?>
\ No newline at end of file
Modified: trunk/StockStatus.php
===================================================================
--- trunk/StockStatus.php 2014-09-19 19:27:05 UTC (rev 6894)
+++ trunk/StockStatus.php 2014-09-19 20:25:01 UTC (rev 6895)
@@ -176,12 +176,9 @@
if ($Its_A_KitSet_Assembly_Or_Dummy == False){
- $sql="SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) -
- purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END))
+ $sql="SELECT SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd)
FROM purchorders LEFT JOIN purchorderdetails
ON purchorders.orderno=purchorderdetails.orderno
- LEFT JOIN purchdata ON purchorders.supplierno=purchdata.supplierno
- AND purchorderdetails.itemcode=purchdata.stockid
WHERE purchorderdetails.itemcode='" . $StockID . "'
AND purchorders.intostocklocation='" . $myrow['loccode'] . "'
AND (purchorders.status<>'Cancelled'
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2014-09-19 19:27:05 UTC (rev 6894)
+++ trunk/doc/Change.log 2014-09-19 20:25:01 UTC (rev 6895)
@@ -1,5 +1,6 @@
webERP Change Log
+20/9/14 Bob Thomas: StockStatus incorrectly displaying quantity on order extended by conversion units
11/09/14 RChacon: Add ascending class to PaymentMethods.php to have sortable columns.
17/9/14 Phil: Moved the audit log purge to occur if DB_Maintenance is set to run
16/9/14 Phil: Added BNZ GIFTS format for bank account transaction imports
|