From: <rc...@us...> - 2014-08-14 22:27:36
|
Revision: 6819 http://sourceforge.net/p/web-erp/reponame/6819 Author: rchacon Date: 2014-08-14 22:27:32 +0000 (Thu, 14 Aug 2014) Log Message: ----------- In SupplierInquiry.php: Reorganizes columns Date, Type, Number, Reference and Comments, and regroups table-datacel format-strings as in CustomerInquiry.php code. Modified Paths: -------------- trunk/CustomerInquiry.php trunk/SupplierInquiry.php trunk/doc/Change.log Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2014-08-14 22:21:48 UTC (rev 6818) +++ trunk/CustomerInquiry.php 2014-08-14 22:27:32 UTC (rev 6819) @@ -212,12 +212,12 @@ echo '<table class="selection"> <tr> - <th class="ascending">• ' . _('Date') . '</th> - <th class="ascending">• ' . _('Type') . '</th> - <th class="ascending">• ' . _('Number') . '</th> - <th class="ascending">• ' . _('Reference') . '</th> + <th class="ascending">' . _('Date') . '</th> + <th class="ascending">' . _('Type') . '</th> + <th class="ascending">' . _('Number') . '</th> + <th class="ascending">' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> <th>' . _('Branch') . '</th> - <th>' . _('Comments') . '</th> <th>' . _('Order') . '</th> <th>' . _('Total') . '</th> <th>' . _('Allocated') . '</th> @@ -255,8 +255,8 @@ <td>' . _($myrow['typename']) . '</td> <td class="number">' . $myrow['transno'] . '</td> <td>' . $myrow['reference'] . '</td> + <td>' . $myrow['invtext'] . '</td> <td>' . $myrow['branchcode'] . '</td> - <td style="width:200px">' . $myrow['invtext'] . '</td> <td class="number">' . $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> @@ -290,7 +290,7 @@ _('Click to email the credit note') . '"><img alt="" src="' . $RootPath . '/css/' . $Theme . '/images/email.gif" /> ' . _('Email') . '</a></td>'; - $GLEntriesTD1 = '<td><a href="' . $RootPath . '/GLTransInquiry.php?TypeID=%s&TransNo=%s" title="' . + $GLEntriesTD1 = '<td><a href="' . $RootPath . '/GLTransInquiry.php?TypeID=%s&TransNo=%s" target="_blank" title="' . _('Click to view the GL entries') . '"><img alt="" src="' . $RootPath . '/css/' . $Theme . '/images/gl.png" width="16" /> ' . _('GL Entries') . '</a></td>'; Modified: trunk/SupplierInquiry.php =================================================================== --- trunk/SupplierInquiry.php 2014-08-14 22:21:48 UTC (rev 6818) +++ trunk/SupplierInquiry.php 2014-08-14 22:27:32 UTC (rev 6819) @@ -3,7 +3,7 @@ include('includes/session.inc'); $Title = _('Supplier Inquiry'); -$ViewTopic = 'AccountsPayable'; /* RChacon: Is there any content for Supplier Inquiry? */ +$ViewTopic = 'AccountsPayable';// Filename in ManualContents.php's TOC./* RChacon: Is there any content for Supplier Inquiry? */ $BookMark = 'AccountsPayable';// Anchor's id in the manual's html document. include('includes/header.inc'); @@ -11,7 +11,7 @@ // always figure out the SQL required from the inputs available -if(!isset($_GET['SupplierID']) AND !isset($_SESSION['SupplierID'])){ +if(!isset($_GET['SupplierID']) AND !isset($_SESSION['SupplierID'])) { echo '<br />' . _('To display the enquiry a Supplier must first be selected from the Supplier selection screen') . '<br /> <div class="centre"> @@ -20,13 +20,13 @@ include('includes/footer.inc'); exit; } else { - if (isset($_GET['SupplierID'])){ + if (isset($_GET['SupplierID'])) { $_SESSION['SupplierID'] = $_GET['SupplierID']; } $SupplierID = $_SESSION['SupplierID']; } -if (isset($_GET['FromDate'])){ +if (isset($_GET['FromDate'])) { $_POST['TransAfterDate']=$_GET['FromDate']; } if (!isset($_POST['TransAfterDate']) OR !Is_Date($_POST['TransAfterDate'])) { @@ -79,7 +79,7 @@ $SupplierResult = DB_query($SQL, $db, $ErrMsg, $DbgMsg); -if (DB_num_rows($SupplierResult) == 0){ +if (DB_num_rows($SupplierResult) == 0) { /*Because there is no balance - so just retrieve the header information about the Supplier - the choice is do one query to get the balance and transactions for those Suppliers 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 */ @@ -107,7 +107,7 @@ $SupplierRecord = DB_fetch_array($SupplierResult); -if ($NIL_BALANCE == True){ +if ($NIL_BALANCE == True) { $SupplierRecord['balance'] = 0; $SupplierRecord['due'] = 0; $SupplierRecord['overdue1'] = 0; @@ -122,13 +122,13 @@ _('Terms') . ': ' . $SupplierRecord['terms'] . '</p>'; -if (isset($_GET['HoldType']) AND isset($_GET['HoldTrans'])){ +if (isset($_GET['HoldType']) AND isset($_GET['HoldTrans'])) { - if ($_GET['HoldStatus'] == _('Hold')){ + if ($_GET['HoldStatus'] == _('Hold')) { $SQL = "UPDATE supptrans SET hold=1 WHERE type='" . $_GET['HoldType'] . "' AND transno='" . $_GET['HoldTrans'] . "'"; - } elseif ($_GET['HoldStatus'] == _('Release')){ + } elseif ($_GET['HoldStatus'] == _('Release')) { $SQL = "UPDATE supptrans SET hold=0 WHERE type='" . $_GET['HoldType'] . "' AND transno='" . $_GET['HoldTrans'] . "'"; @@ -140,13 +140,13 @@ } -echo '<table width="90%" class="selection"> - <tr><th>' . _('Total Balance') . '</th> - <th>' . _('Current') . '</th> - <th>' . _('Now Due') . '</th> - <th>' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> - <th>' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> - </tr>'; +echo '<table class="selection"> + <tr><th>' . _('Total Balance') . '</th> + <th>' . _('Current') . '</th> + <th>' . _('Now Due') . '</th> + <th>' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> + <th>' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> + </tr>'; echo '<tr> <td class="number">' . locale_number_format($SupplierRecord['balance'],$SupplierRecord['currdecimalplaces']) . '</td> @@ -195,7 +195,7 @@ $TransResult = DB_query($SQL, $db, $ErrMsg, $DbgMsg); -if (DB_num_rows($TransResult) == 0){ +if (DB_num_rows($TransResult) == 0) { echo '<br /><div class="centre">' . _('There are no transactions to display since') . ' ' . $_POST['TransAfterDate']; echo '</div>'; include('includes/footer.inc'); @@ -204,35 +204,34 @@ /*show a table of the transactions returned by the SQL */ -echo '<table width="90%" class="selection">'; -$TableHeader = '<tr> - <th class="ascending">• ' . _('Type') . '</th> - <th class="ascending">• ' . _('Number') . '</th> - <th class="ascending">• ' . _('Reference') . '</th> - <th class="ascending">• ' . _('Date') . '</th> - <th class="ascending">• ' . _('Total') . '</th> - <th class="ascending">• ' . _('Allocated') . '</th> - <th class="ascending">• ' . _('Balance') . '</th> - <th class="ascending">• ' . _('Comments') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - </tr>'; -echo $TableHeader; +echo '<table width="90%" class="selection"> + <tr> + <th class="ascending">' . _('Date') . '</th> + <th class="ascending">' . _('Type') . '</th> + <th class="ascending">' . _('Number') . '</th> + <th class="ascending">' . _('Reference') . '</th> + <th class="ascending">' . _('Comments') . '</th> + <th class="ascending">' . _('Total') . '</th> + <th class="ascending">' . _('Allocated') . '</th> + <th class="ascending">' . _('Balance') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + </tr>'; $j = 1; -$k = 0; //row colour counter +$k = 0;// Row colour counter. while ($myrow=DB_fetch_array($TransResult)) { - if ($myrow['hold'] == 0 AND $myrow['settled'] == 0){ + if ($myrow['hold'] == 0 AND $myrow['settled'] == 0) { $HoldValue = _('Hold'); } elseif ($myrow['settled'] == 1) { $HoldValue = ''; }else { $HoldValue = _('Release'); } - if ($myrow['hold'] == 1){ + if ($myrow['hold'] == 1) { // echo "<tr bgcolor='#DD99BB'>"; - }elseif ($k == 1){ + }elseif ($k == 1) { echo '<tr class="EvenTableRows">'; $k = 0; } else { @@ -242,43 +241,53 @@ $FormatedTranDate = ConvertSQLDate($myrow['trandate']); - if ($myrow['type'] == 20){ /*Show a link to allow GL postings to be viewed but no link to allocate */ + // All table-row (tag tr) must have 10 table-datacells (tag td). - if ($_SESSION['CompanyRecord']['gllink_creditors'] == True){ - if ($myrow['totalamount'] - $myrow['allocated'] == 0){ + $BaseTD8 = '<td>' . ConvertSQLDate($myrow['trandate']) . '</td> + <td>' . _($myrow['typename']) . '</td> + <td class="number">' . $myrow['transno'] . '</td> + <td>' . $myrow['suppreference'] . '</td> + <td>' . $myrow['transtext'] . '</td> + <td class="number">' . locale_number_format($myrow['totalamount'],$SupplierRecord['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['totalamount']-$myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td>'; - /*The trans is settled so don't show option to hold */ + $PaymentTD1 = '<td><a href="' . $RootPath . '/PaymentAllocations.php?SuppID=%s&InvID=%s" title="' . + _('Click to view payments') . '"><img alt="" src="' . $RootPath . + '/css/' . $Theme . '/images/money_delete.png" width="16"/> ' . _('Payments') . '</a></td>'; - echo '<td>' . _($myrow['typename']) . '</td> - <td class="number">' . $myrow['transno'] . '</td> - <td>' . $myrow['suppreference'] . '</td> - <td>' . ConvertSQLDate($myrow['trandate']) . '</td> - <td class="number">' . locale_number_format($myrow['totalamount'],$SupplierRecord['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format($myrow['totalamount']-$myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> - <td>' . $myrow['transtext'] . '</td> - <td><a href="' . $RootPath . '/PaymentAllocations.php?SuppID=' . $myrow['supplierno'] . '&InvID=' . $myrow['suppreference'] .'">' . _('View Payments') . '</a></td> - <td><a target="_blank" href="' . $RootPath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['transno'] .'">' . _('View GL Postings') . '</a></td> - </tr>'; +/* To do: $HoldValueTD1*/ + + $AllocationTD1 = '<td><a href="' . $RootPath . '/SupplierAllocations.php?AllocTrans=%s" title="' . + _('Click to allocate funds') . '"><img alt="" src="' . $RootPath . + '/css/' . $Theme . '/images/allocation.png" /> ' . _('Allocation') . '</a></td>'; + + $GLEntriesTD1 = '<td><a href="' . $RootPath . '/GLTransInquiry.php?TypeID=%s&TransNo=%s" target="_blank" title="' . + _('Click to view the GL entries') . '"><img alt="" src="' . $RootPath . + '/css/' . $Theme . '/images/gl.png" width="16" /> ' . _('GL Entries') . '</a></td>'; + + if ($myrow['type'] == 20) { /*Show a link to allow GL postings to be viewed but no link to allocate */ + + if ($_SESSION['CompanyRecord']['gllink_creditors'] == True) { + if ($myrow['totalamount'] - $myrow['allocated'] == 0) { + /*The trans is settled so don't show option to hold */ + printf($BaseTD8 . $PaymentTD1 . $GLEntriesTD1 . '</tr>', + // $PaymentTD1 parameters: + $myrow['supplierno'], + $myrow['suppreference'], + // $GLEntriesTD1 parameters: + $myrow['type'], + $myrow['transno']); + } else { - echo '<td>' . _($myrow['typename']) . '</td> - <td class="number">' . $myrow['transno'] . '</td> - <td>' . $myrow['suppreference'] . '</td> - <td>' . ConvertSQLDate($myrow['trandate']) . '</td> - <td class="number">' . locale_number_format($myrow['totalamount'],$SupplierRecord['currdecimalplaces']) . '</td> - <td class="number">' .locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format($myrow['totalamount'] - $myrow['allocated'],$SupplierRecord['currdecimalplaces']) . '</td> - <td>' . $myrow['transtext'] . '</td>'; - $AuthSQL="SELECT offhold FROM purchorderauth WHERE userid='" . $_SESSION['UserID'] . "' AND currabrev='" . $SupplierRecord['currcode']."'"; - $AuthResult=DB_query($AuthSQL, $db); - $AuthRow=DB_fetch_array($AuthResult); + printf($BaseTD8); if ($AuthRow[0]==0) { echo '<td><a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?HoldType=' . $myrow['type'] . '&HoldTrans=' . $myrow['transno']. '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'].'">' . $HoldValue . '</a></td>'; } else { @@ -288,103 +297,42 @@ echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'). '?HoldType=' . $myrow['type'] .'&HoldTrans=' . $myrow['transno'] . '&HoldStatus=' . $HoldValue . '&FromDate=' . $_POST['TransAfterDate'] .'">' . $HoldValue . '</a></td>'; } } - echo '<td><a href="' . $RootPath . '/GLTransInquiry.php?TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['transno'] . - '" target="_blank">' ._('View GL Postings') . '</a></td></tr>'; + printf($GLEntriesTD1 . '</tr>', + // $GLEntriesTD1 parameters: + $myrow['type'], + $myrow['transno']); + } } else { + if ($myrow['totalamount'] - $myrow['allocated'] == 0) { + /*The trans is settled so don't show option to hold */ + printf($BaseTD8 . '<td> </td><td> </td></tr>'); - if ($myrow['totalamount'] - $myrow['allocated'] == 0){ - - /*The trans is settled so don't show option to hold */ - - printf('<td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td>%s</td> - <td> </td> - <td> </td> - </tr>', - _($myrow['typename']), - $myrow['transno'], - $myrow['suppreference'], - ConvertSQLDate($myrow['trandate']), - locale_number_format($myrow['totalamount'],$SupplierRecord['currdecimalplaces']), - locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']), - locale_number_format($myrow['totalamount'] - $myrow['allocated'],$SupplierRecord['currdecimalplaces']), - $myrow['transtext']); - } else { - echo ' <td>' . _($myrow['typename']) . '</td> - <td class="number">' . $myrow['transno'] . '</td> - <td>' . $myrow['suppreference'] . '</td> - <td>' . ConvertSQLDate($myrow['trandate']) . '</td> - <td class="number">' . locale_number_format($myrow['totalamount'], $SupplierRecord['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format($myrow['allocated'], $SupplierRecord['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format($myrow['totalamount']-$myrow['allocated'], $SupplierRecord['currdecimalplaces']) . '</td> - <td align=left>' . $myrow['transtext'] . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES,'UTF-8') . '/PaymentAllocations.php?SuppID=' . - $myrow['type'] . '&InvID=' . $myrow['transno'] . '">' . _('View Payments') . '</a></td> - <td><a href="' . $HoldValue . '?HoldType=' . $_POST['TransAfterDate'] . '&HoldTrans=' . $HoldValue . '&HoldStatus=' . - $RootPath . '&FromDate='. $myrow['supplierno'] . '">' . $myrow['suppreference'] . '</a></td> - </tr>'; + printf($BaseTD8); + echo ' + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES,'UTF-8') . '/PaymentAllocations.php?SuppID=' . + $myrow['type'] . '&InvID=' . $myrow['transno'] . '">' . _('View Payments') . '</a></td> + <td><a href="' . $HoldValue . '?HoldType=' . $_POST['TransAfterDate'] . '&HoldTrans=' . $HoldValue . '&HoldStatus=' . + $RootPath . '&FromDate='. $myrow['supplierno'] . '">' . $myrow['suppreference'] . '</a></td></tr>'; } } } else { /*its a credit note or a payment */ - if ($_SESSION['CompanyRecord']['gllink_creditors'] == True){ + if ($_SESSION['CompanyRecord']['gllink_creditors'] == True) { + printf($BaseTD8 . $AllocationTD1 . $GLEntriesTD1 . '</tr>', + // $AllocationTD1 parameters: + $myrow['id'], + // $GLEntriesTD1 parameters: + $myrow['type'], + $myrow['transno']); - printf('<td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td>%s</td> - <td><a href="%s/SupplierAllocations.php?AllocTrans=%s">' . _('View Allocations') . '</a></td> - <td><a target="_blank" href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Postings') . '</a></td> - </tr>', - _($myrow['typename']), - $myrow['transno'], - $myrow['suppreference'], - ConvertSQLDate($myrow['trandate']), - locale_number_format($myrow['totalamount'],$SupplierRecord['currdecimalplaces']), - locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']), - locale_number_format($myrow['totalamount']-$myrow['allocated'],$SupplierRecord['currdecimalplaces']), - $myrow['transtext'], - $RootPath, - $myrow['id'], - $RootPath, - $myrow['type'], - $myrow['transno'] ); + } else { /*Not linked to GL */ + printf($BaseTD8 . $AllocationTD1 . '<td> </td></tr>', + // $AllocationTD1 parameters: + $myrow['id']); - } else { /*Not linked to GL */ - printf('<td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td>%s</td> - <td><a href="%s/SupplierAllocations.php?AllocTrans=%s">' . _('View Allocations') . '</a></td> - <td> </td> - </tr>', - _($myrow['typename']), - $myrow['transno'], - $myrow['suppreference'], - ConvertSQLDate($myrow['trandate']), - locale_number_format($myrow['totalamount'],$SupplierRecord['currdecimalplaces']), - locale_number_format($myrow['allocated'],$SupplierRecord['currdecimalplaces']), - locale_number_format($myrow['totalamount'] - $myrow['allocated'],$SupplierRecord['currdecimalplaces']), - $myrow['transtext'], - $RootPath, - $myrow['id']); } }// End of page full new headings if }// End of while loop Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2014-08-14 22:21:48 UTC (rev 6818) +++ trunk/doc/Change.log 2014-08-14 22:27:32 UTC (rev 6819) @@ -1,5 +1,6 @@ webERP Change Log +14/08/14 RChacon: In SupplierInquiry.php: Reorganizes columns Date, Type, Number, Reference and Comments, and regroups table-datacel format-strings as in CustomerInquiry.php code. 13/08/14 kelo: SupplierBalsAtPeriodEnd.php fix calculation to take into account fx differences on after date transactions 13/08/14 RChacon: includes/DatabaseTranslations.php used to store the fields of tables that are used from the database so that they can be translated in particular systypes for the types of transactions invoice credit note payment receipt etc. Can be extended for scripts and other tables where the data from the table is static and used to display 13/08/14 RChacon: In CustomerInquiry.php: Adds class ascending and reorganizes columns Date, Type, Number and Reference; Regroups table-datacel format-strings, completes the datacel quantity by table-row; makes translatable the systypes.typename. |