From: <ex...@us...> - 2016-01-14 08:19:22
|
Revision: 7447 http://sourceforge.net/p/web-erp/reponame/7447 Author: exsonqu Date: 2016-01-14 08:19:19 +0000 (Thu, 14 Jan 2016) Log Message: ----------- 14/01/16 Exson: Add credit note allocation option for CustWhereAlloc.php and add a link to it in CustomerInquiry.php and make the allocation printable by print.css. Modified Paths: -------------- trunk/CustWhereAlloc.php trunk/CustomerInquiry.php Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2016-01-13 08:20:05 UTC (rev 7446) +++ trunk/CustWhereAlloc.php 2016-01-14 08:19:19 UTC (rev 7447) @@ -9,14 +9,19 @@ $BookMark = 'WhereAllocated'; include('includes/header.inc'); +if (isset($_GET['TransNo']) AND isset($_GET['TransType'])) { + $_POST['TransNo'] = (int)$_GET['TransNo']; + $_POST['TransType'] = (int)$_GET['TransType']; + $_POST['ShowResults'] = true; +} echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> <div> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <p class="page_title_text"> + <p class="page_title_text noprint"> <img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' . _('Customer Where Allocated'). '" alt="" />' . $Title . ' </p> - <table class="selection"> + <table class="selection noprint"> <tr> <td>' . _('Type') . ':</td> <td><select tabindex="1" name="TransType"> '; @@ -25,11 +30,17 @@ $_POST['TransType']='10'; } if ($_POST['TransType']==10){ - echo '<option selected="selected" value="10">' . _('Invoices') . '</option> - <option value="12">' . _('Negative Receipts (Payments)') . '</option>'; -} else { - echo '<option selected="selected" value="12">' . _('Negative Receipts (Payments)') . '</option> - <option selected="selected" value="10">' . _('Invoices') . '</option>'; + echo '<option selected="selected" value="10">' . _('Invoice') . '</option> + <option value="12">' . _('Receipt') . '</option> + <option value="11">' . _('Credit Note') . '</option>'; +} elseif ($_POST['TransType'] == 12) { + echo '<option selected="selected" value="12">' . _('Receipt') . '</option> + <option value="10">' . _('Invoice') . '</option> + <option value="11">' . _('Credit Note') . '</option>'; +} elseif ($_POST['TransType'] == 11) { + echo '<option selected="selected" value="11">' . _('Credit Note') . '</option> + <option value="10">' . _('Invoice') . '</option> + <option value="12">' . _('Receipt') . '</option>'; } echo '</select></td>'; @@ -40,7 +51,7 @@ </tr> </table> <br /> - <div class="centre"> + <div class="centre noprint"> <input tabindex="3" type="submit" name="ShowResults" value="' . _('Show How Allocated') . '" /> </div>'; @@ -63,7 +74,10 @@ ON debtorsmaster.currcode=currencies.currabrev WHERE type='" . $_POST['TransType'] . "' AND transno = '" . $_POST['TransNo']."'"; - + + if ($_SESSION['SalesmanLogin'] != '') { + $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; + } $result = DB_query($sql ); if (DB_num_rows($result)==1){ @@ -71,7 +85,6 @@ $AllocToID = $myrow['id']; $CurrCode = $myrow['currcode']; $CurrDecimalPlaces = $myrow['currdecimalplaces']; - $sql = "SELECT type, transno, trandate, @@ -81,28 +94,39 @@ ovamount+ovgst+ovfreight+ovdiscount as totalamt, custallocns.amt FROM debtortrans - INNER JOIN custallocns - ON debtortrans.id=custallocns.transid_allocfrom - WHERE custallocns.transid_allocto='". $AllocToID."'"; + INNER JOIN custallocns "; + if ($_POST['TransType']==12 OR $_POST['TransType'] == 11){ + $TitleInfo = ($_POST['TransType'] == 12)?_('Receipt'):_('Credit Note'); + $sql .= "ON debtortrans.id = custallocns.transid_allocto + WHERE custallocns.transid_allocfrom = '" . $AllocToID . "'"; + } else { + $TitleInfo = _('invoice'); + $sql .= "ON debtortrans.id = custallocns.transid_allocfrom + WHERE custallocns.transid_allocto = '" . $AllocToID . "'"; + } + $sql .= " ORDER BY transno "; + $ErrMsg = _('The customer transactions for the selected criteria could not be retrieved because'); $TransResult = DB_query($sql, $ErrMsg); if (DB_num_rows($TransResult)==0){ - - if ($myrow['totamt']<0 AND $_POST['TransType']==12){ + + if ($myrow['totamt']<0 AND ($_POST['TransType']==12 OR $_POST['TransType'] == 11)){ prnMsg(_('This transaction was a receipt of funds and there can be no allocations of receipts or credits to a receipt. This inquiry is meant to be used to see how a payment which is entered as a negative receipt is settled against credit notes or receipts'),'info'); } else { prnMsg(_('There are no allocations made against this transaction'),'info'); } } else { + $Printer = true; echo '<br /> + <div id="Report"> <table class="selection">'; echo '<tr> <th colspan="6"> <div class="centre"> - <b>' . _('Allocations made against invoice number') . ' ' . $_POST['TransNo'] . '<br />' . _('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</b> + <b>' . _('Allocations made against') . ' ' . $TitleInfo . ' ' . _('number') . ' ' . $_POST['TransNo'] . '<br />' . _('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</b> </div> </th> </tr>'; @@ -132,6 +156,8 @@ if ($myrow['type']==11){ $TransType = _('Credit Note'); + } elseif ($myrow['type'] == 10){ + $TransType = _('Invoice'); } else { $TransType = _('Receipt'); } @@ -156,12 +182,21 @@ <td colspan="5" class="number">' . _('Total allocated') . '</td> <td class="number">' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '</td> </tr> - </table>'; + </table> + </div>'; } // end if there are allocations against the transaction } //got the ID of the transaction to find allocations for } echo '</div>'; echo '</form>'; +if (isset($Printer)) { + echo '<div class="centre noprint"> + <button onclick="javascript:window.print()" type="button"><img alt="" src="' . $RootPath . '/css/' . $Theme . + '/images/printer.png" /> ' . + _('Print This') . ' + </button> + </div>';// "Print This" button. +} include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2016-01-13 08:20:05 UTC (rev 7446) +++ trunk/CustomerInquiry.php 2016-01-14 08:19:19 UTC (rev 7447) @@ -292,7 +292,7 @@ * - User can view GL transactions */ echo '<td>', _($MyRow['typename']), '</td> - <td>', $MyRow['transno'], '</td> + <td><a href="' . $RootPath . '/CustWhereAlloc.php?TransType=' . $MyRow['type'] . '&TransNo=' . $MyRow['transno'] . '" target="_blank">' . $MyRow['transno'] . '</a></td> <td>', ConvertSQLDate($MyRow['trandate']), '</td> <td>', $MyRow['branchcode'], '</td> <td>', $MyRow['reference'], '</td> @@ -338,7 +338,7 @@ * - User cannot view GL transactions */ echo '<td>', _($MyRow['typename']), '</td> - <td>', $MyRow['transno'], '</td> + <td><a href="' . $RootPath . '/CustWhereAlloc.php?TransType=' . $MyRow['type'] . '&TransNo=' . $MyRow['transno'] . '">' . $MyRow['transno'] . '</a></td> <td>', ConvertSQLDate($MyRow['trandate']), '</td> <td>', $MyRow['branchcode'], '</td> <td>', $MyRow['reference'], '</td> @@ -419,7 +419,7 @@ */ 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><a href="' . $RootPath . '/CustWhereAlloc.php?TransType=' . $MyRow['type'] . '&TransNo=' . $MyRow['transno'] . '">' . $MyRow['transno'] . '</a></td> <td>', ConvertSQLDate($MyRow['trandate']), '</td> <td>', $MyRow['branchcode'], '</td> <td>', $MyRow['reference'], '</td> @@ -465,7 +465,7 @@ * - User cannot view GL transactions */ echo '<td>', _($MyRow['typename']), '</td> - <td>', $MyRow['transno'], '</td> + <td><a href="' . $RootPath . '/CustWhereAlloc.php?TransType=' . $MyRow['type'] . '&TransNo=' . $MyRow['transno'] . '">' . $MyRow['transno'] . '</a></td> <td>', ConvertSQLDate($MyRow['trandate']), '</td> <td>', $MyRow['branchcode'], '</td> <td>', $MyRow['reference'], '</td> @@ -508,7 +508,7 @@ */ 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><a href="' . $RootPath . '/CustWhereAlloc.php?TransType=' . $MyRow['type'] . '&TransNo=' . $MyRow['transno'] . '">' . $MyRow['transno'] . '</a></td> <td>', ConvertSQLDate($MyRow['trandate']), '</td> <td>', $MyRow['branchcode'], '</td> <td>', $MyRow['reference'], '</td> @@ -669,4 +669,4 @@ echo '</tbody></table>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> |